ghost 6.17.2 → 6.18.1

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 (211) hide show
  1. package/components/{tryghost-i18n-6.17.2.tgz → tryghost-i18n-6.18.1.tgz} +0 -0
  2. package/components/{tryghost-parse-email-address-6.17.2.tgz → tryghost-parse-email-address-6.18.1.tgz} +0 -0
  3. package/core/built/admin/assets/{PolarAngleAxis-B8JrAxf_.js → PolarAngleAxis-Dod0DwfL.js} +1 -1
  4. package/core/built/admin/assets/{_baseAssignValue-Bbalamaq.js → _baseAssignValue-DnkbkowM.js} +1 -1
  5. package/core/built/admin/assets/{a-large-small-CgWPeKpi.js → a-large-small-C5mgFBRg.js} +1 -1
  6. package/core/built/admin/assets/activitypub/activitypub.js +1 -1
  7. package/core/built/admin/assets/activitypub/{at-sign-Fsk3x72r.mjs → at-sign-BR2C2gdz.mjs} +2 -2
  8. package/core/built/admin/assets/activitypub/{avatar-flipboard-C10JfFS_.mjs → avatar-flipboard-CJV3KhLU.mjs} +2 -2
  9. package/core/built/admin/assets/activitypub/{bluesky-sharing-C1xeGSL6.mjs → bluesky-sharing-DY4KCGPZ.mjs} +4 -4
  10. package/core/built/admin/assets/activitypub/{copy-C1fElSkQ.mjs → copy-CBFwbAdE.mjs} +2 -2
  11. package/core/built/admin/assets/activitypub/{deleted-feed-item-Bun4tY2_.mjs → deleted-feed-item-DOm9GxTQ.mjs} +2 -2
  12. package/core/built/admin/assets/activitypub/{edit-profile-CYh00FZ7.mjs → edit-profile-CcbnZWkM.mjs} +3 -3
  13. package/core/built/admin/assets/activitypub/{feed-BxUqmcN9.mjs → feed-BHiZU0Q_.mjs} +4 -4
  14. package/core/built/admin/assets/activitypub/{hash-CNgwAx-U.mjs → hash-Csjloy5t.mjs} +2 -2
  15. package/core/built/admin/assets/activitypub/{inbox-DqNqII4a.mjs → inbox-DGKbBux9.mjs} +2 -2
  16. package/core/built/admin/assets/activitypub/{index-CONoLlDU.mjs → index-Bt_qFJNY.mjs} +2 -2
  17. package/core/built/admin/assets/activitypub/{index--Q6orQkb.mjs → index-CCYuVHjm.mjs} +21 -21
  18. package/core/built/admin/assets/activitypub/{index-jhjmoHwu.mjs → index-CTV39jCH.mjs} +2 -2
  19. package/core/built/admin/assets/activitypub/{index-Dvh9q3jy.mjs → index-ClNx7qzi.mjs} +4 -4
  20. package/core/built/admin/assets/activitypub/{index-C9pnotJK.mjs → index-D6Y6ywyl.mjs} +6 -6
  21. package/core/built/admin/assets/activitypub/{index-BueIufRq.mjs → index-YLvIz6pJ.mjs} +5 -5
  22. package/core/built/admin/assets/activitypub/{index-C3KJXzZE.mjs → index-tWANcGjH.mjs} +7 -7
  23. package/core/built/admin/assets/activitypub/{index-CJJXnqq1.mjs → index-vVqFEPIX.mjs} +3 -3
  24. package/core/built/admin/assets/activitypub/{moderation-CYhwUFi2.mjs → moderation-CUGqRfT1.mjs} +3 -3
  25. package/core/built/admin/assets/activitypub/{note-COVa8CMw.mjs → note-DMy39JHG.mjs} +4 -4
  26. package/core/built/admin/assets/activitypub/{reply-BHpKVBxx.mjs → reply-BboFcDsv.mjs} +2 -2
  27. package/core/built/admin/assets/activitypub/{separator-DP7q5sFH.mjs → separator-DBvIXQnV.mjs} +2 -2
  28. package/core/built/admin/assets/activitypub/{settings-3n7zo_3K.mjs → settings-D4qRhs9E.mjs} +3 -3
  29. package/core/built/admin/assets/activitypub/{step-1-BmUukywZ.mjs → step-1-C-ubwwIT.mjs} +3 -3
  30. package/core/built/admin/assets/activitypub/{step-2-C--I3xxp.mjs → step-2-Dsd2XY1_.mjs} +5 -5
  31. package/core/built/admin/assets/activitypub/{step-3-0Deh5N9c.mjs → step-3-BHz3ow0t.mjs} +7 -7
  32. package/core/built/admin/assets/activitypub/{tabs-D_vmoLBo.mjs → tabs-s_P4XeyF.mjs} +3 -3
  33. package/core/built/admin/assets/activitypub/{topic-filter-DJMrhH-c.mjs → topic-filter-CCf15CR-.mjs} +2 -2
  34. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
  35. package/core/built/admin/assets/admin-x-settings/{code-editor-view-BzvYs1fs.mjs → code-editor-view-BWi3-ftq.mjs} +2 -2
  36. package/core/built/admin/assets/admin-x-settings/{index-DdMo_pvD.mjs → index-B3PtvbUw.mjs} +2 -2
  37. package/core/built/admin/assets/admin-x-settings/{index-DYEF3NiM.mjs → index-Did70N9h.mjs} +2 -2
  38. package/core/built/admin/assets/admin-x-settings/{index-BXChUyr6.mjs → index-JaMlaX9G.mjs} +30 -19
  39. package/core/built/admin/assets/admin-x-settings/{modals-Ck3AHDx3.mjs → modals-Bwrf9ptQ.mjs} +8060 -8067
  40. package/core/built/admin/assets/{at-sign-BottTo2X.js → at-sign-Bz-SU-S_.js} +1 -1
  41. package/core/built/admin/assets/{audience-CcGOt5Fb.js → audience-DmVdEmIe.js} +1 -1
  42. package/core/built/admin/assets/{avatar-flipboard-MxW2k124.js → avatar-flipboard-C7sxDVEM.js} +1 -1
  43. package/core/built/admin/assets/{bluesky-sharing-BBmDBlxr.js → bluesky-sharing-DJniSF6N.js} +1 -1
  44. package/core/built/admin/assets/{chart-pimL5Chk.js → chart-mYz3IJwm.js} +1 -1
  45. package/core/built/admin/assets/{chunk.524.9a8f5123fd3ecf3e4451.js → chunk.524.9d300778a63b42b0de62.js} +7 -7
  46. package/core/built/admin/assets/{chunk.582.41886d06af2895d571bd.js → chunk.582.2e363cd976d9bba998b9.js} +10 -10
  47. package/core/built/admin/assets/{code-editor-view-tCZOpc_h.js → code-editor-view-BIQWFJ01.js} +1 -1
  48. package/core/built/admin/assets/comments-B_-hdjc6.js +1 -0
  49. package/core/built/admin/assets/{copy-aC0WUVtq.js → copy-Bpq3uhnh.js} +1 -1
  50. package/core/built/admin/assets/{data-list-BOdyZGWI.js → data-list-BYNMbRIq.js} +1 -1
  51. package/core/built/admin/assets/{deleted-feed-item-BnUJ8bWP.js → deleted-feed-item-B_AwUKZy.js} +1 -1
  52. package/core/built/admin/assets/{edit-profile-CEgPhWMJ.js → edit-profile-DZo2ZcOu.js} +1 -1
  53. package/core/built/admin/assets/{empty-indicator-CR_9BHAH.js → empty-indicator-Bn5wG9-T.js} +1 -1
  54. package/core/built/admin/assets/{en-ajofhc7o.js → en-D4zIrMLN.js} +1 -1
  55. package/core/built/admin/assets/{feed-Ci-ODCHE.js → feed-Bgq4RarU.js} +1 -1
  56. package/core/built/admin/assets/{filters-CmJJOv3I.js → filters-CpVwu1Gk.js} +1 -1
  57. package/core/built/admin/assets/{gh-chart-hn7wEnik.js → gh-chart-Br7NXn_b.js} +1 -1
  58. package/core/built/admin/assets/{ghost-78b420974adc056bf1c9570275a46535.css → ghost-3c48d37b32f4fcd7eb15cfd739905a03.css} +1 -1
  59. package/core/built/admin/assets/{ghost-a9268074d0a9b02198594a05ecd7a626.js → ghost-98a3c5fd6235ebd344594f491cb6d17b.js} +241 -246
  60. package/core/built/admin/assets/{ghost-dark-12abca67e79c76fe6bfed6cb81ba2a53.css → ghost-dark-0100fe3ec7b4c3f6d8d043c904254a63.css} +1 -1
  61. package/core/built/admin/assets/{growth-CQceZQ1g.js → growth-CiPDnWxJ.js} +1 -1
  62. package/core/built/admin/assets/{hash-BcaWmkw5.js → hash-Bc1e38oH.js} +1 -1
  63. package/core/built/admin/assets/{inbox-D9hID-rO.js → inbox-BcZNBNhk.js} +1 -1
  64. package/core/built/admin/assets/{index-d_UH71zm.js → index-BFEx_ouC.js} +1 -1
  65. package/core/built/admin/assets/{index-kXF42nga.js → index-B_7QsC5T.js} +1 -1
  66. package/core/built/admin/assets/{index-CZ3lARQ2.js → index-Bm5ZeLtt.js} +1 -1
  67. package/core/built/admin/assets/{index-DJDgMk-T.js → index-BpcL7RmI.js} +2 -2
  68. package/core/built/admin/assets/{index-g4BWcHhl.js → index-Brg4tecQ.js} +1 -1
  69. package/core/built/admin/assets/{index-f5Lv9kLb.js → index-CMTzNTew.js} +29 -29
  70. package/core/built/admin/assets/{index-Cl2eSBwg.js → index-CTfJflJ2.js} +1 -1
  71. package/core/built/admin/assets/{index-BJS8H75W.js → index-Cn32t_gv.js} +1 -1
  72. package/core/built/admin/assets/{index-D8syEvSm.js → index-CsidX7Si.js} +1 -1
  73. package/core/built/admin/assets/{index-DO76vL0R.js → index-D212VvOz.js} +1 -1
  74. package/core/built/admin/assets/{index-B1rKIiOr.js → index-D67LJ_H4.js} +1 -1
  75. package/core/built/admin/assets/{index-BmK6ThYl.js → index-DU3bv9jz.js} +1 -1
  76. package/core/built/admin/assets/{index-DYM1MbXR.js → index-Dv13wKfX.js} +1 -1
  77. package/core/built/admin/assets/{index-Do091GLu.js → index-ETsoQLbU.js} +1 -1
  78. package/core/built/admin/assets/{index-rluYcfd-.js → index-ZYDRMgcT.js} +1 -1
  79. package/core/built/admin/assets/{koenig-lexical-D2XHvS2J.js → koenig-lexical-DZUWzN0P.js} +1 -1
  80. package/core/built/admin/assets/{kpi-card-Dga9rFZ5.js → kpi-card-DENsK2xK.js} +1 -1
  81. package/core/built/admin/assets/{kpis-BbnqD1za.js → kpis-CDrs2iS1.js} +1 -1
  82. package/core/built/admin/assets/{label-D8WHEOe0.js → label-BznQtEEo.js} +1 -1
  83. package/core/built/admin/assets/{links-dgwx7ko1.js → links-lpAC3T1p.js} +1 -1
  84. package/core/built/admin/assets/{lucide-react-BARFK2PZ.js → lucide-react-CBigk-fq.js} +1 -1
  85. package/core/built/admin/assets/{main-layout-CcjtCuF_.js → main-layout-_SYQRjIl.js} +1 -1
  86. package/core/built/admin/assets/{message-square-text-BxquqPhA.js → message-square-text-cV8O_qKq.js} +1 -1
  87. package/core/built/admin/assets/{minus-Ziy4LSYD.js → minus-NvnQTlW7.js} +1 -1
  88. package/core/built/admin/assets/{modals-fMQzR7L6.js → modals-XRSkribf.js} +3 -3
  89. package/core/built/admin/assets/{moderation-Ci9UNwiZ.js → moderation-BQp1GEWG.js} +1 -1
  90. package/core/built/admin/assets/{newsletter-DnrS7Fvi.js → newsletter-foM6KNNV.js} +1 -1
  91. package/core/built/admin/assets/{newsletters-D78pgnas.js → newsletters-BexdXUhn.js} +1 -1
  92. package/core/built/admin/assets/{note-BAfNweZN.js → note-DuaUGOeZ.js} +1 -1
  93. package/core/built/admin/assets/{overview-CWQPNOF0.js → overview-DgKBNqyc.js} +1 -1
  94. package/core/built/admin/assets/{pagemenu-DjSqq3Wu.js → pagemenu-CZyroidv.js} +1 -1
  95. package/core/built/admin/assets/{post-analytics-c8kRV0YB.js → post-analytics-DLK2SOSQ.js} +1 -1
  96. package/core/built/admin/assets/{post-analytics-context-CEqWyqgm.js → post-analytics-context-CF7C67-0.js} +1 -1
  97. package/core/built/admin/assets/{post-analytics-header-CpPPBAz4.js → post-analytics-header-7GtJCx0W.js} +1 -1
  98. package/core/built/admin/assets/{post-share-modal-Dln0kZhn.js → post-share-modal-D8R7DUZP.js} +1 -1
  99. package/core/built/admin/assets/posts/{comments-CHEqbZPq.mjs → comments-Bn_vn_sb.mjs} +434 -407
  100. package/core/built/admin/assets/posts/{dialog-VFomJYla.mjs → dialog-CKPcMrj7.mjs} +3 -3
  101. package/core/built/admin/assets/posts/{empty-indicator-CT9qQsMO.mjs → empty-indicator-kkrhP6K_.mjs} +2 -2
  102. package/core/built/admin/assets/posts/{filters-BXCfSKKS.mjs → filters-DHsxxy0F.mjs} +6 -6
  103. package/core/built/admin/assets/posts/{growth-xMitvyvt.mjs → growth-D7ACh-oR.mjs} +12 -12
  104. package/core/built/admin/assets/posts/{heading-DIulQwgD.mjs → heading-BrKVbOxA.mjs} +2 -2
  105. package/core/built/admin/assets/posts/{hooks-BiBMDYOA.mjs → hooks-BBEMuLiW.mjs} +3 -3
  106. package/core/built/admin/assets/posts/{index-uYyMBANY.mjs → index-C0rRguZx.mjs} +9 -9
  107. package/core/built/admin/assets/posts/{kpis-DK6j0CJA.mjs → kpis-1o524OIK.mjs} +10 -10
  108. package/core/built/admin/assets/posts/{links-CBiYZsyk.mjs → links-JpeATx1f.mjs} +4 -4
  109. package/core/built/admin/assets/posts/{loading-indicator-BPPeKpVb.mjs → loading-indicator-BHAmSf8j.mjs} +3 -3
  110. package/core/built/admin/assets/posts/{main-layout-f-PcNn-6.mjs → main-layout-BTItAOQE.mjs} +2 -2
  111. package/core/built/admin/assets/posts/{newsletter-CSOyAfvO.mjs → newsletter-CQdsCEHv.mjs} +13 -13
  112. package/core/built/admin/assets/posts/{overview-Dve3Uxt4.mjs → overview-sYh4JN1D.mjs} +15 -15
  113. package/core/built/admin/assets/posts/{post-analytics-CPKxH7yg.mjs → post-analytics-DtLt2SWx.mjs} +6 -6
  114. package/core/built/admin/assets/posts/{post-analytics-context-B5zQoflZ.mjs → post-analytics-context-CB1yM9fk.mjs} +4 -4
  115. package/core/built/admin/assets/posts/{post-analytics-header-BBxuaptK.mjs → post-analytics-header-BYaWuL9W.mjs} +9 -9
  116. package/core/built/admin/assets/posts/{post-share-modal-D_iMXvnI.mjs → post-share-modal-V0HTOBaf.mjs} +4 -4
  117. package/core/built/admin/assets/posts/{posts-DW6ne0od.mjs → posts-DeQT3knv.mjs} +2 -2
  118. package/core/built/admin/assets/posts/posts.js +1 -1
  119. package/core/built/admin/assets/posts/{search-CVlPqGMA.mjs → search-CLjC37AT.mjs} +2 -2
  120. package/core/built/admin/assets/posts/{separator-YrJkDGVP.mjs → separator-KNoTIaJx.mjs} +5 -5
  121. package/core/built/admin/assets/posts/{sheet-T5GWxxrn.mjs → sheet-DBg_SCDt.mjs} +3 -3
  122. package/core/built/admin/assets/posts/{skeleton-qnvlkDy-.mjs → skeleton-DvsoolWu.mjs} +3 -3
  123. package/core/built/admin/assets/posts/{source-icon-DBU0eZwS.mjs → source-icon-OmRaTU2G.mjs} +3 -3
  124. package/core/built/admin/assets/posts/{stats-udwJVZP8.mjs → stats-BC2DzntY.mjs} +4 -4
  125. package/core/built/admin/assets/posts/{table-Cu0BZfBU.mjs → table-CxX9OKAj.mjs} +2 -2
  126. package/core/built/admin/assets/posts/{tabs-B-RaoD3I.mjs → tabs-B1jw7cBi.mjs} +10 -10
  127. package/core/built/admin/assets/posts/{tags-DSDGzArh.mjs → tags-BBilTo1a.mjs} +11 -11
  128. package/core/built/admin/assets/posts/{tags-DByfrDKO.mjs → tags-BitrLT_j.mjs} +2 -2
  129. package/core/built/admin/assets/posts/{use-infinite-virtual-scroll-B7dD2nWW.mjs → use-infinite-virtual-scroll-DaijA1ao.mjs} +3 -3
  130. package/core/built/admin/assets/posts/{web-B9wvEtJ_.mjs → web-CKmyC4Xj.mjs} +15 -15
  131. package/core/built/admin/assets/{posts-C1Eh5Ypq.js → posts-CL9UDYoW.js} +1 -1
  132. package/core/built/admin/assets/{repeat-CN4fiG5H.js → repeat-DgH39UKE.js} +1 -1
  133. package/core/built/admin/assets/{reply-BfWgvH7y.js → reply-DAaNxiy8.js} +1 -1
  134. package/core/built/admin/assets/{select-B_0NBkLz.js → select-Cor2wFXT.js} +1 -1
  135. package/core/built/admin/assets/{settings-BqaVcJee.js → settings-BeumESEN.js} +5 -5
  136. package/core/built/admin/assets/{settings-Dk9E7Fqv.js → settings-xRx917Gj.js} +1 -1
  137. package/core/built/admin/assets/{sort-button-C2M35dLh.js → sort-button-BNW3i4Lb.js} +1 -1
  138. package/core/built/admin/assets/{source-icon-DkGi13e_.js → source-icon-DvDuzw73.js} +1 -1
  139. package/core/built/admin/assets/{sprout-BKiwQsGn.js → sprout-C3cc0c-K.js} +1 -1
  140. package/core/built/admin/assets/{square-BEpRc_fY.js → square-tZp0_n7e.js} +1 -1
  141. package/core/built/admin/assets/stats/{audience-Dfo7BmNu.mjs → audience-BWqU7WWT.mjs} +3 -3
  142. package/core/built/admin/assets/stats/{index-DUWoiDE_.mjs → index-CUuQaROI.mjs} +5 -5
  143. package/core/built/admin/assets/stats/{index-Yo58temM.mjs → index-CcCyLMxL.mjs} +7 -7
  144. package/core/built/admin/assets/stats/{index-h0rsyxDz.mjs → index-D5mlMG4l.mjs} +8 -8
  145. package/core/built/admin/assets/stats/{index-_vL3Zubi.mjs → index-DXU2rE9t.mjs} +5 -5
  146. package/core/built/admin/assets/stats/{index-Banm1wtA.mjs → index-K7ASx7EG.mjs} +6 -6
  147. package/core/built/admin/assets/stats/{sort-button-i6PS-TUn.mjs → sort-button-CELUx6Zp.mjs} +3 -3
  148. package/core/built/admin/assets/stats/{stats-CjepXEWS.mjs → stats-d_u_in4l.mjs} +2 -2
  149. package/core/built/admin/assets/stats/stats.js +2 -2
  150. package/core/built/admin/assets/stats/{tabs-Q20S1oup.mjs → tabs-3wLZsy0v.mjs} +3 -3
  151. package/core/built/admin/assets/stats/{url-helpers-DrGoeEH1.mjs → url-helpers-Drq3xg0l.mjs} +4 -4
  152. package/core/built/admin/assets/stats/{use-growth-stats-BnffY2W3.mjs → use-growth-stats-28Sr42va.mjs} +3 -3
  153. package/core/built/admin/assets/{stats-CRgy_cWm.js → stats-2Jelnn-Q.js} +1 -1
  154. package/core/built/admin/assets/{stats-view-CTQ4qO3S.js → stats-view-CESy8ELH.js} +1 -1
  155. package/core/built/admin/assets/{step-1-CNbdmB8C.js → step-1-DrqdolAh.js} +1 -1
  156. package/core/built/admin/assets/{step-2-Ddrl2uae.js → step-2-DmEpKck5.js} +1 -1
  157. package/core/built/admin/assets/{step-3-CbqkEtwh.js → step-3-Bus-0o0n.js} +1 -1
  158. package/core/built/admin/assets/{table-Dw9xFlFd.js → table-BQUcKHfm.js} +1 -1
  159. package/core/built/admin/assets/{tabs-DCHagOip.js → tabs-BmdL0X4U.js} +1 -1
  160. package/core/built/admin/assets/{tags-DV2SSdMK.js → tags-CLxXZlOO.js} +1 -1
  161. package/core/built/admin/assets/{tags-BsDlfsPN.js → tags-EchqlZUJ.js} +1 -1
  162. package/core/built/admin/assets/{tiers-tc5tafWV.js → tiers-nCGyTly9.js} +1 -1
  163. package/core/built/admin/assets/{toggle-group-DS-ZVhCr.js → toggle-group-CM5uf7J1.js} +1 -1
  164. package/core/built/admin/assets/{topic-filter-BfoEqHRD.js → topic-filter-LTRvZ8aU.js} +1 -1
  165. package/core/built/admin/assets/{trash-CpnxYen-.js → trash-u5BxolyH.js} +1 -1
  166. package/core/built/admin/assets/{url-helpers-wKPPeCtD.js → url-helpers-D41fEt51.js} +1 -1
  167. package/core/built/admin/assets/{use-growth-stats-CbHIETF_.js → use-growth-stats-BJ0O9ewi.js} +1 -1
  168. package/core/built/admin/assets/{use-infinite-virtual-scroll-DU1EUhyj.js → use-infinite-virtual-scroll-APZWciOk.js} +1 -1
  169. package/core/built/admin/assets/{use-simple-pagination-X6kmRz2u.js → use-simple-pagination-DVRHeaAR.js} +1 -1
  170. package/core/built/admin/assets/{user-round-check-DYkrjHxF.js → user-round-check-B6j98D6d.js} +1 -1
  171. package/core/built/admin/assets/{wallet-cards-CSdWOmJE.js → wallet-cards-KmOh29LP.js} +1 -1
  172. package/core/built/admin/assets/{web-C39IKnvl.js → web-Cclotbnz.js} +1 -1
  173. package/core/built/admin/index.html +5 -5
  174. package/core/frontend/meta/asset-url.js +126 -15
  175. package/core/frontend/services/asset-hash/index.js +73 -0
  176. package/core/frontend/services/theme-engine/active.js +4 -2
  177. package/core/server/api/endpoints/utils/serializers/output/utils/post-gating.js +6 -0
  178. package/core/server/data/migrations/versions/6.17/2026-02-04-10-42-20-offers-nullable-product-id.js +11 -0
  179. package/core/server/data/migrations/versions/6.18/2026-02-04-10-42-20-offers-nullable-product-id.js +4 -0
  180. package/core/server/data/schema/schema.js +1 -1
  181. package/core/server/data/tinybird/datasources/_mv_daily_pages.datasource +13 -0
  182. package/core/server/data/tinybird/endpoints/api_top_pages_v3.pipe +113 -0
  183. package/core/server/data/tinybird/pipes/mv_daily_pages.pipe +23 -0
  184. package/core/server/data/tinybird/scripts/benchmark-top-pages.sh +186 -0
  185. package/core/server/data/tinybird/scripts/compare-top-pages.sh +262 -0
  186. package/core/server/data/tinybird/tests/api_top_pages_v3.yaml +112 -0
  187. package/core/server/models/automated-email.js +34 -0
  188. package/core/server/services/koenig/node-renderers/transistor-renderer.js +3 -8
  189. package/core/server/services/lib/member-signup-contexts.js +23 -0
  190. package/core/server/services/lib/member-signup-contexts.ts +22 -0
  191. package/core/server/services/member-welcome-emails/member-welcome-email-renderer.js +13 -7
  192. package/core/server/services/member-welcome-emails/service.js +84 -15
  193. package/core/server/services/members/members-api/controllers/router-controller.js +14 -0
  194. package/core/server/services/members/members-api/repositories/member-repository.js +1 -1
  195. package/core/server/services/members/members-api/services/payments-service.js +5 -0
  196. package/core/server/services/oembed/oembed-service.js +1 -1
  197. package/core/server/services/offers/application/offer-mapper.js +6 -7
  198. package/core/server/services/offers/application/offers-api.js +3 -3
  199. package/core/server/services/offers/domain/errors/index.js +2 -0
  200. package/core/server/services/offers/domain/models/offer.js +15 -3
  201. package/core/server/services/offers/offer-bookshelf-repository.js +4 -5
  202. package/core/server/services/stats/utils/tinybird.js +5 -3
  203. package/core/server/services/stripe/services/webhook/checkout-session-event-service.js +17 -1
  204. package/core/server/services/stripe/stripe-service.js +8 -0
  205. package/core/shared/config/defaults.json +6 -0
  206. package/core/shared/labs.js +3 -3
  207. package/core/shared/url-utils.js +2 -1
  208. package/package.json +6 -6
  209. package/tsconfig.tsbuildinfo +1 -1
  210. package/yarn.lock +23 -2
  211. package/core/built/admin/assets/comments-OXqhcC0t.js +0 -1
@@ -1 +1 @@
1
- import{aP as Y,r as _,bV as C,bW as W,j as e,S as j,bR as se,B as T,aT as M,aj as u,y as $,ai as Q,cz as te,aQ as oe,cA as O,e as le,cB as q,cC as ce,bE as de,cD as X,bK as me,cE as ue,af as pe,ag as z,aW as I,_ as xe,aX as he}from"./index-f5Lv9kLb.js";import{g as H,S as ge,a as fe,D as be,b as je}from"./stats-view-CTQ4qO3S.js";import{C as D,a as E,b as F,f as R,c as V,E as ve,K as Ne,d as we,e as ye,u as ke,j as _e}from"./pagemenu-DjSqq3Wu.js";import{E as P}from"./empty-indicator-CR_9BHAH.js";import{P as Ce}from"./post-share-modal-Dln0kZhn.js";import{g as Ae,c as Te}from"./post-helpers-gInwAwEv.js";import{S as Le,U as ae}from"./wallet-cards-CSdWOmJE.js";import{C as ze,h as K,d as Me,i as We,L as $e,j as J,k as Z,l as De}from"./lucide-react-BARFK2PZ.js";import{G as B}from"./gh-chart-hn7wEnik.js";import{g as Ee}from"./audience-CcGOt5Fb.js";import{u as Fe}from"./use-growth-stats-CbHIETF_.js";import{u as Re}from"./posts-C1Eh5Ypq.js";import{h as Ve,i as Ue}from"./stats-CRgy_cWm.js";import"./select-B_0NBkLz.js";import"./message-square-text-BxquqPhA.js";import"./sprout-BKiwQsGn.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./trash-CpnxYen-.js";import"./chart-pimL5Chk.js";import"./_baseAssignValue-Bbalamaq.js";import"./currency-fEUUCkj0.js";const Ie=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",Be=({latestPostStats:s,isLoading:o})=>{const t=Y(),[r,i]=_.useState(!1),{site:n,settings:x}=C(),{appSettings:l}=W(),{emailTrackClicks:c,emailTrackOpens:h}=l?.analytics||{},m=n.title||String(x.find(g=>g.key==="title")?.value||"Ghost Site"),a=String(x.find(g=>g.key==="timezone")?.value||"Etc/UTC"),d=s?Ae(s,{membersTrackSources:l?.analytics.membersTrackSources}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer";return e.jsxs(D,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between font-medium leading-snug text-muted-foreground",children:"Latest post performance"}),e.jsx(R,{className:"hidden",children:"How your last post did"})]}),e.jsxs(V,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[o&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(j,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(j,{className:"w-full max-w-[420px]"}),e.jsx(j,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]})]})})]}),!o&&s&&d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg font-semibold leading-tighter tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!o&&s&&t(`/posts/analytics/${s.id}`,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(g=>g.name).join(", ")," – ",se(s.published_at,a)]}),e.jsx("div",{className:"mt-0.5",children:Ie(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ce,{author:s.authors?.map(g=>g.name).join(", ")||"",description:"",faviconURL:n.icon||"",featureImageURL:s.feature_image||"",open:r,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:m,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Le,{})," Share post"]})}),e.jsxs(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(`/posts/analytics/${s.id}`,{crossApp:!0})},children:[e.jsx(ze,{}),e.jsx("span",{className:"hidden md:!visible md:!block",children:s.email_only?"Post analytics":"Analytics"})]})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[d.showWebMetrics&&l?.analytics.webAnalytics&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:!visible md:!block",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:u(s.visitors)})]}),d.showMemberGrowth&&e.jsxs("div",{className:$(b,d.showEmailMetrics&&(!d.showWebMetrics||!l?.analytics.webAnalytics)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(ae,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:!visible md:!block",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",u(s.member_delta)]}):0})]}),d.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(K,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:!visible md:!block",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),c&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(Me,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:!visible md:!block",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!o&&e.jsx(P,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(te,{strokeWidth:1.5})})]})]})},Ge=()=>{const{data:s}=C();return{isLimited:t=>{const r=s?.config;return r?.hostSettings?.limits&&t==="limitAnalytics"?r.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},G=({title:s,iconName:o,description:t,color:r,diffDirection:i,diffValue:n,formattedValue:x,trendingFromValue:l,children:c,onClick:h})=>{const{range:m}=C(),a=o&&$e[o],d=le.useMemo(()=>{if(!i||i==="empty"||m===q.allTime.value||!n)return"";const b=i==="up"?"up":i==="down"?"down":"at",N=H(m).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:x})," compared to the ",e.jsx("span",{className:"font-semibold",children:N})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[b," ",n]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",N]})},[i,n,l,x,m]);return e.jsxs(D,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(R,{children:t})]}),e.jsxs(Ne,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(we,{className:h&&"transition-all group-hover:text-foreground",children:[r&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:r}}),a&&e.jsx(a,{size:16,strokeWidth:1.5}),s]}),e.jsx(ye,{diffDirection:m===q.allTime.value?"hidden":i,diffTooltip:d,diffValue:n,value:x})]}),h&&e.jsx(T,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:h,children:"View more"})]}),e.jsx(V,{children:c})]})},Se=({kpiValues:s,visitorsChartData:o,visitorsYRange:t,growthTotals:r,membersChartData:i,mrrChartData:n,currencySymbol:x,isLoading:l})=>{const c=Y(),{range:h}=C(),{appSettings:m}=W(),d=Ge().isLimited("limitAnalytics"),b="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:!cursor-pointer";if(l)return e.jsx(ve,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:!cursor-pointer",children:e.jsx(oe,{})});const g=m?.analytics.webAnalytics,N=d&&!g,y=!0,L=m?.paidMembersEnabled,w=[g,N,y,L].filter(Boolean).length;let A="lg:grid-cols-3";w===2?A="lg:grid-cols-2":w===1&&(A="lg:grid-cols-1");const U=`flex flex-col lg:grid ${A} gap-6`;return e.jsxs("div",{className:U,children:[g&&!N&&e.jsx(G,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{c("/analytics/web/")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-blue))",data:o,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),N&&e.jsxs(D,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(R,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(V,{className:"flex h-full items-center justify-center p-6",children:e.jsx(P,{actions:e.jsx(T,{variant:"outline",onClick:()=>c("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx(We,{})})})]}),e.jsx(G,{description:"How number of members of your publication changed over time",diffDirection:r.directions.total,diffValue:r.percentChanges.total,formattedValue:u(r.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${u(i[0].value)}`,onClick:()=>{c("/analytics/growth/?tab=total-members")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-darkblue))",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),L&&e.jsx(G,{description:"Monthly recurring revenue changes over time",diffDirection:r.directions.mrr,diffValue:r.percentChanges.mrr,formattedValue:`${x}${u(O(r.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${x}${u(n[0].value)}`,onClick:()=>{c("/analytics/growth/?tab=mrr")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-teal))",data:n,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Oe=({className:s})=>e.jsx("div",{className:$("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(ce,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),S=({className:s,metrics:o,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:$("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 whitespace-nowrap border-b pb-1.5 pr-10 font-medium text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:o?.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[r.icon,r.label]}),e.jsx("span",{className:"font-mono",children:r.metric})]},r.label))})]})}),He=({topPostsData:s,isLoading:o})=>{const t=Y(),{range:r,settings:i}=C(),{appSettings:n}=W(),x=String(i.find(a=>a.key==="timezone")?.value||"Etc/UTC"),l=n?.analytics.webAnalytics,c=n?.analytics.emailTrackClicks,h=n?.analytics.emailTrackOpens,m="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs(D,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between font-medium leading-snug text-muted-foreground",children:["Top posts ",H(r)]}),e.jsx(R,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(V,{children:o?e.jsx(de,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(a=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:!border-border hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(`/posts/analytics/${a.post_id}`,{crossApp:!0})},children:[a.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:!visible sm:!block lg:w-[100px]",style:{backgroundImage:`url(${a.feature_image})`}}):e.jsx(Oe,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:!visible sm:!flex lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg font-semibold leading-[1.35em]",children:a.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",a.authors," – ",se(a.published_at,x)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Te(a)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/web`,{crossApp:!0})},children:[e.jsx(S,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:u(a.views)}],title:"Web traffic"}),e.jsxs("div",{className:m,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.views)]})]}),a.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(S,{className:`${n?.analytics.membersTrackSources?"":"left-auto right-0 translate-x-0"}`,metrics:[{icon:e.jsx(J,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:u(a.sent_count||0)},...h?[{icon:e.jsx(K,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:u(a.opened_count||0)}]:[],...c?[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:u(a.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:m,children:h?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.open_rate?`${Math.round(a.open_rate)}%`:"0%"]}):c?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.click_rate?`${Math.round(a.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.sent_count||0)]})})]}),n?.analytics.membersTrackSources&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/growth`,{crossApp:!0})},children:[e.jsx(S,{className:"left-auto right-0 translate-x-0",metrics:[{icon:e.jsx(me,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:a.free_members>0?`+${u(a.free_members)}`:"0"},...n?.paidMembersEnabled?[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:a.paid_members>0?`+${u(a.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:m,children:[e.jsx(ae,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.members>0?`+${u(a.members)}`:"0"]})]})]})]},a.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(P,{className:"w-full pb-10",title:`No posts ${H(r)}`,children:e.jsx(te,{strokeWidth:1.5})})]})})]})},Ke=()=>{const{data:{posts:[s]}={posts:[]},isLoading:o}=Re({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,r=Ve(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:n}=r;return{data:_.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:o||!!t?.id&&n}},ee=({className:s,title:o,description:t,url:r,children:i})=>e.jsx("a",{className:$("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:r,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:o}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),ks=()=>{const{appSettings:s}=W(),{statsConfig:o,isLoading:t,range:r}=C(),{startDate:i,endDate:n,timezone:x}=pe(r),{isLoading:l,chartData:c,totals:h,currencySymbol:m}=Fe(r),{data:a,isLoading:d}=Ke(),{data:b,isLoading:g}=Ue({searchParams:{date_from:z(i),date_to:z(n),limit:"5",timezone:x}}),N={site_uuid:o?.id||"",date_from:z(i),date_to:z(n),timezone:x,member_status:Ee(he)},{data:y,loading:L}=ke({endpoint:"api_kpis",statsConfig:o,params:N}),w=_.useMemo(()=>I(y||[],r,"visits","sum")?.map(f=>{const v=Number(f.visits),k=isNaN(v)?0:v;return{date:String(f.date),value:k,formattedValue:u(k),label:"Visitors"}}),[y,r]),A=_.useMemo(()=>{const f=[0,1];if(!w||w.length===0)return f;const v=w.map(p=>p.value).filter(p=>p>=0);return v.length===0?f:[0,Math.max(...v)||f[1]]},[w]),U=_.useMemo(()=>{if(!c||c.length===0)return[];let f=[];return f=I(c,r,"value","exact"),f.map(p=>({date:p.date,value:p.free+p.paid,formattedValue:u(p.free+p.paid),label:"Members"}))},[c,r]),re=_.useMemo(()=>{if(!s?.paidMembersEnabled||!c||c.length===0)return[];let f=[];return f=I(c,r,"mrr","exact"),f.map(p=>({date:p.date,value:O(p.mrr),formattedValue:`${m}${u(O(p.mrr))}`,label:"MRR"}))},[c,r,m,s]),ie=_.useMemo(()=>{if(!y?.length)return{visits:"0"};const f=y.reduce((v,k)=>{const p=Number(k.visits);return v+(isNaN(p)?0:p)},0);return{visits:u(f)}},[y]),ne=t;return e.jsxs(ge,{children:[e.jsx(fe,{children:e.jsx(_e,{children:e.jsx(be,{excludeRanges:["today"]})})}),e.jsxs(je,{isLoading:ne,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Se,{currencySymbol:m,growthTotals:h,isLoading:L||l,kpiValues:ie,membersChartData:U,mrrChartData:re,visitorsChartData:w,visitorsYRange:A}),e.jsx(Be,{isLoading:d,latestPostStats:a}),e.jsx(He,{isLoading:g,topPostsData:b}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(xe,{className:"-mb-4 mt-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(De,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{ks as default};
1
+ import{aP as Y,r as _,bV as C,bW as W,j as e,S as j,bR as se,B as T,aT as M,aj as u,y as $,ai as Q,cz as te,aQ as oe,cA as O,e as le,cB as q,cC as ce,bE as de,cD as X,bK as me,cE as ue,af as pe,ag as z,aW as I,_ as xe,aX as he}from"./index-CMTzNTew.js";import{g as H,S as ge,a as fe,D as be,b as je}from"./stats-view-CESy8ELH.js";import{C as D,a as E,b as F,f as R,c as V,E as ve,K as Ne,d as we,e as ye,u as ke,j as _e}from"./pagemenu-CZyroidv.js";import{E as P}from"./empty-indicator-Bn5wG9-T.js";import{P as Ce}from"./post-share-modal-D8R7DUZP.js";import{g as Ae,c as Te}from"./post-helpers-gInwAwEv.js";import{S as Le,U as ae}from"./wallet-cards-KmOh29LP.js";import{C as ze,h as K,d as Me,i as We,L as $e,j as J,k as Z,l as De}from"./lucide-react-CBigk-fq.js";import{G as B}from"./gh-chart-Br7NXn_b.js";import{g as Ee}from"./audience-DmVdEmIe.js";import{u as Fe}from"./use-growth-stats-BJ0O9ewi.js";import{u as Re}from"./posts-CL9UDYoW.js";import{h as Ve,i as Ue}from"./stats-2Jelnn-Q.js";import"./select-Cor2wFXT.js";import"./message-square-text-cV8O_qKq.js";import"./sprout-C3cc0c-K.js";import"./a-large-small-C5mgFBRg.js";import"./at-sign-Bz-SU-S_.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./trash-u5BxolyH.js";import"./chart-mYz3IJwm.js";import"./_baseAssignValue-DnkbkowM.js";import"./currency-fEUUCkj0.js";const Ie=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",Be=({latestPostStats:s,isLoading:o})=>{const t=Y(),[r,i]=_.useState(!1),{site:n,settings:x}=C(),{appSettings:l}=W(),{emailTrackClicks:c,emailTrackOpens:h}=l?.analytics||{},m=n.title||String(x.find(g=>g.key==="title")?.value||"Ghost Site"),a=String(x.find(g=>g.key==="timezone")?.value||"Etc/UTC"),d=s?Ae(s,{membersTrackSources:l?.analytics.membersTrackSources}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer";return e.jsxs(D,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between font-medium leading-snug text-muted-foreground",children:"Latest post performance"}),e.jsx(R,{className:"hidden",children:"How your last post did"})]}),e.jsxs(V,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[o&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(j,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(j,{className:"w-full max-w-[420px]"}),e.jsx(j,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(j,{className:"w-3/4"}),e.jsx(j,{className:"h-10 w-1/3"})]})]})})]}),!o&&s&&d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg font-semibold leading-tighter tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!o&&s&&t(`/posts/analytics/${s.id}`,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(g=>g.name).join(", ")," – ",se(s.published_at,a)]}),e.jsx("div",{className:"mt-0.5",children:Ie(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ce,{author:s.authors?.map(g=>g.name).join(", ")||"",description:"",faviconURL:n.icon||"",featureImageURL:s.feature_image||"",open:r,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:m,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Le,{})," Share post"]})}),e.jsxs(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(`/posts/analytics/${s.id}`,{crossApp:!0})},children:[e.jsx(ze,{}),e.jsx("span",{className:"hidden md:!visible md:!block",children:s.email_only?"Post analytics":"Analytics"})]})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[d.showWebMetrics&&l?.analytics.webAnalytics&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:!visible md:!block",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:u(s.visitors)})]}),d.showMemberGrowth&&e.jsxs("div",{className:$(b,d.showEmailMetrics&&(!d.showWebMetrics||!l?.analytics.webAnalytics)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(ae,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:!visible md:!block",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",u(s.member_delta)]}):0})]}),d.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(K,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:!visible md:!block",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),c&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(Me,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:!visible md:!block",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] font-semibold leading-none tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!o&&e.jsx(P,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(te,{strokeWidth:1.5})})]})]})},Ge=()=>{const{data:s}=C();return{isLimited:t=>{const r=s?.config;return r?.hostSettings?.limits&&t==="limitAnalytics"?r.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},G=({title:s,iconName:o,description:t,color:r,diffDirection:i,diffValue:n,formattedValue:x,trendingFromValue:l,children:c,onClick:h})=>{const{range:m}=C(),a=o&&$e[o],d=le.useMemo(()=>{if(!i||i==="empty"||m===q.allTime.value||!n)return"";const b=i==="up"?"up":i==="down"?"down":"at",N=H(m).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:x})," compared to the ",e.jsx("span",{className:"font-semibold",children:N})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[b," ",n]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",N]})},[i,n,l,x,m]);return e.jsxs(D,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(R,{children:t})]}),e.jsxs(Ne,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(we,{className:h&&"transition-all group-hover:text-foreground",children:[r&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:r}}),a&&e.jsx(a,{size:16,strokeWidth:1.5}),s]}),e.jsx(ye,{diffDirection:m===q.allTime.value?"hidden":i,diffTooltip:d,diffValue:n,value:x})]}),h&&e.jsx(T,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:h,children:"View more"})]}),e.jsx(V,{children:c})]})},Se=({kpiValues:s,visitorsChartData:o,visitorsYRange:t,growthTotals:r,membersChartData:i,mrrChartData:n,currencySymbol:x,isLoading:l})=>{const c=Y(),{range:h}=C(),{appSettings:m}=W(),d=Ge().isLimited("limitAnalytics"),b="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:!cursor-pointer";if(l)return e.jsx(ve,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:!cursor-pointer",children:e.jsx(oe,{})});const g=m?.analytics.webAnalytics,N=d&&!g,y=!0,L=m?.paidMembersEnabled,w=[g,N,y,L].filter(Boolean).length;let A="lg:grid-cols-3";w===2?A="lg:grid-cols-2":w===1&&(A="lg:grid-cols-1");const U=`flex flex-col lg:grid ${A} gap-6`;return e.jsxs("div",{className:U,children:[g&&!N&&e.jsx(G,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{c("/analytics/web/")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-blue))",data:o,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),N&&e.jsxs(D,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(R,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(V,{className:"flex h-full items-center justify-center p-6",children:e.jsx(P,{actions:e.jsx(T,{variant:"outline",onClick:()=>c("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx(We,{})})})]}),e.jsx(G,{description:"How number of members of your publication changed over time",diffDirection:r.directions.total,diffValue:r.percentChanges.total,formattedValue:u(r.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${u(i[0].value)}`,onClick:()=>{c("/analytics/growth/?tab=total-members")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-darkblue))",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),L&&e.jsx(G,{description:"Monthly recurring revenue changes over time",diffDirection:r.directions.mrr,diffValue:r.percentChanges.mrr,formattedValue:`${x}${u(O(r.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${x}${u(n[0].value)}`,onClick:()=>{c("/analytics/growth/?tab=mrr")},children:e.jsx(B,{className:b,color:"hsl(var(--chart-teal))",data:n,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Oe=({className:s})=>e.jsx("div",{className:$("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(ce,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),S=({className:s,metrics:o,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:$("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 whitespace-nowrap border-b pb-1.5 pr-10 font-medium text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:o?.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[r.icon,r.label]}),e.jsx("span",{className:"font-mono",children:r.metric})]},r.label))})]})}),He=({topPostsData:s,isLoading:o})=>{const t=Y(),{range:r,settings:i}=C(),{appSettings:n}=W(),x=String(i.find(a=>a.key==="timezone")?.value||"Etc/UTC"),l=n?.analytics.webAnalytics,c=n?.analytics.emailTrackClicks,h=n?.analytics.emailTrackOpens,m="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs(D,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between font-medium leading-snug text-muted-foreground",children:["Top posts ",H(r)]}),e.jsx(R,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(V,{children:o?e.jsx(de,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(a=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:!border-border hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(`/posts/analytics/${a.post_id}`,{crossApp:!0})},children:[a.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:!visible sm:!block lg:w-[100px]",style:{backgroundImage:`url(${a.feature_image})`}}):e.jsx(Oe,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:!visible sm:!flex lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg font-semibold leading-[1.35em]",children:a.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",a.authors," – ",se(a.published_at,x)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Te(a)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/web`,{crossApp:!0})},children:[e.jsx(S,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:u(a.views)}],title:"Web traffic"}),e.jsxs("div",{className:m,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.views)]})]}),a.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(S,{className:`${n?.analytics.membersTrackSources?"":"left-auto right-0 translate-x-0"}`,metrics:[{icon:e.jsx(J,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:u(a.sent_count||0)},...h?[{icon:e.jsx(K,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:u(a.opened_count||0)}]:[],...c?[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:u(a.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:m,children:h?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.open_rate?`${Math.round(a.open_rate)}%`:"0%"]}):c?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.click_rate?`${Math.round(a.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.sent_count||0)]})})]}),n?.analytics.membersTrackSources&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:d=>{d.stopPropagation(),t(`/posts/analytics/${a.post_id}/growth`,{crossApp:!0})},children:[e.jsx(S,{className:"left-auto right-0 translate-x-0",metrics:[{icon:e.jsx(me,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:a.free_members>0?`+${u(a.free_members)}`:"0"},...n?.paidMembersEnabled?[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:a.paid_members>0?`+${u(a.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:m,children:[e.jsx(ae,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.members>0?`+${u(a.members)}`:"0"]})]})]})]},a.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(P,{className:"w-full pb-10",title:`No posts ${H(r)}`,children:e.jsx(te,{strokeWidth:1.5})})]})})]})},Ke=()=>{const{data:{posts:[s]}={posts:[]},isLoading:o}=Re({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,r=Ve(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:n}=r;return{data:_.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:o||!!t?.id&&n}},ee=({className:s,title:o,description:t,url:r,children:i})=>e.jsx("a",{className:$("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:r,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:o}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),ks=()=>{const{appSettings:s}=W(),{statsConfig:o,isLoading:t,range:r}=C(),{startDate:i,endDate:n,timezone:x}=pe(r),{isLoading:l,chartData:c,totals:h,currencySymbol:m}=Fe(r),{data:a,isLoading:d}=Ke(),{data:b,isLoading:g}=Ue({searchParams:{date_from:z(i),date_to:z(n),limit:"5",timezone:x}}),N={site_uuid:o?.id||"",date_from:z(i),date_to:z(n),timezone:x,member_status:Ee(he)},{data:y,loading:L}=ke({endpoint:"api_kpis",statsConfig:o,params:N}),w=_.useMemo(()=>I(y||[],r,"visits","sum")?.map(f=>{const v=Number(f.visits),k=isNaN(v)?0:v;return{date:String(f.date),value:k,formattedValue:u(k),label:"Visitors"}}),[y,r]),A=_.useMemo(()=>{const f=[0,1];if(!w||w.length===0)return f;const v=w.map(p=>p.value).filter(p=>p>=0);return v.length===0?f:[0,Math.max(...v)||f[1]]},[w]),U=_.useMemo(()=>{if(!c||c.length===0)return[];let f=[];return f=I(c,r,"value","exact"),f.map(p=>({date:p.date,value:p.free+p.paid,formattedValue:u(p.free+p.paid),label:"Members"}))},[c,r]),re=_.useMemo(()=>{if(!s?.paidMembersEnabled||!c||c.length===0)return[];let f=[];return f=I(c,r,"mrr","exact"),f.map(p=>({date:p.date,value:O(p.mrr),formattedValue:`${m}${u(O(p.mrr))}`,label:"MRR"}))},[c,r,m,s]),ie=_.useMemo(()=>{if(!y?.length)return{visits:"0"};const f=y.reduce((v,k)=>{const p=Number(k.visits);return v+(isNaN(p)?0:p)},0);return{visits:u(f)}},[y]),ne=t;return e.jsxs(ge,{children:[e.jsx(fe,{children:e.jsx(_e,{children:e.jsx(be,{excludeRanges:["today"]})})}),e.jsxs(je,{isLoading:ne,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Se,{currencySymbol:m,growthTotals:h,isLoading:L||l,kpiValues:ie,membersChartData:U,mrrChartData:re,visitorsChartData:w,visitorsYRange:A}),e.jsx(Be,{isLoading:d,latestPostStats:a}),e.jsx(He,{isLoading:g,topPostsData:b}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(xe,{className:"-mb-4 mt-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(De,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{ks as default};
@@ -1,4 +1,4 @@
1
- import{e as R,r as F,aB as uR,aC as ine,aD as fR}from"./index-f5Lv9kLb.js";var Kd={},rne=Object.defineProperty,one=(t,e,n)=>e in t?rne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,we=(t,e,n)=>one(t,typeof e!="symbol"?e+"":e,n);(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="bfe81679-99e3-4b92-baf2-93d0d8b7ea9d",t._sentryDebugIdIdentifier="sentry-dbid-bfe81679-99e3-4b92-baf2-93d0d8b7ea9d")}catch{}})();var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function vk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var hR={exports:{}},bk={};/**
1
+ import{e as R,r as F,aB as uR,aC as ine,aD as fR}from"./index-CMTzNTew.js";var Kd={},rne=Object.defineProperty,one=(t,e,n)=>e in t?rne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,we=(t,e,n)=>one(t,typeof e!="symbol"?e+"":e,n);(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="bfe81679-99e3-4b92-baf2-93d0d8b7ea9d",t._sentryDebugIdIdentifier="sentry-dbid-bfe81679-99e3-4b92-baf2-93d0d8b7ea9d")}catch{}})();var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function vk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var hR={exports:{}},bk={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -1 +1 @@
1
- import{j as a,y as o,B as s}from"./index-f5Lv9kLb.js";const i=({children:e,className:r,...t})=>a.jsx("div",{className:o("flex flex-col",r),...t,children:e}),l=({children:e,className:r,...t})=>a.jsx("div",{className:o("[&_svg]:size-4 flex items-center gap-1.5 text-base h-[22px] font-medium transition-all",r,t.onClick&&"hover:cursor-pointer hover:text-black dark:hover:text-white"),...t,children:e}),d=({children:e,className:r,...t})=>a.jsx("div",{className:o("text-[26px] mt-0.5 tracking-tighter leading-none text-foreground font-semibold",r),...t,children:e}),c=({children:e,className:r,...t})=>a.jsx(s,{className:o("absolute right-4 top-4 z-50 hidden translate-x-10 text-black dark:text-white/80 dark:hover:text-white opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100 md:!visible md:!block",r),size:"sm",variant:"outline",...t,children:e}),x=({children:e,className:r,...t})=>a.jsx("div",{className:o("group relative isolate flex flex-col border-r border-border last:border-none items-start gap-2 px-6 py-5 transition-all text-muted-foreground",t.onClick?"hover:bg-accent/50 hover:text-foreground cursor-pointer":"cursor-auto",r),...t,children:e});export{x as K,l as a,i as b,d as c,c as d};
1
+ import{j as a,y as o,B as s}from"./index-CMTzNTew.js";const i=({children:e,className:r,...t})=>a.jsx("div",{className:o("flex flex-col",r),...t,children:e}),l=({children:e,className:r,...t})=>a.jsx("div",{className:o("[&_svg]:size-4 flex items-center gap-1.5 text-base h-[22px] font-medium transition-all",r,t.onClick&&"hover:cursor-pointer hover:text-black dark:hover:text-white"),...t,children:e}),d=({children:e,className:r,...t})=>a.jsx("div",{className:o("text-[26px] mt-0.5 tracking-tighter leading-none text-foreground font-semibold",r),...t,children:e}),c=({children:e,className:r,...t})=>a.jsx(s,{className:o("absolute right-4 top-4 z-50 hidden translate-x-10 text-black dark:text-white/80 dark:hover:text-white opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100 md:!visible md:!block",r),size:"sm",variant:"outline",...t,children:e}),x=({children:e,className:r,...t})=>a.jsx("div",{className:o("group relative isolate flex flex-col border-r border-border last:border-none items-start gap-2 px-6 py-5 transition-all text-muted-foreground",t.onClick?"hover:bg-accent/50 hover:text-foreground cursor-pointer":"cursor-auto",r),...t,children:e});export{x as K,l as a,i as b,d as c,c as d};
@@ -1 +1 @@
1
- import{e as N,j as s,by as w,bz as T,B as y,bA as D,bB as C,bC as L,bD as S,aS as E,bE as I,aj as u,ai as g,bF as H,bG as $,r as G,aW as O,bH as q,ap as F,bI as W,bJ as k}from"./index-f5Lv9kLb.js";import{S as K}from"./source-icon-DkGi13e_.js";import{p as J,e as U}from"./source-utils-B1S3ZHA2.js";import{C as M,a as Q,b as X,f as Y,c as P,g as Z}from"./pagemenu-DjSqq3Wu.js";import{D as ss,h as es,i as V,a as as,b as ts,c as rs,d as is,e as ls,f as ns,g as cs}from"./data-list-BOdyZGWI.js";import{S as os,u as ds}from"./post-analytics-context-CEqWyqgm.js";import{A as hs}from"./lucide-react-BARFK2PZ.js";import{a as ms}from"./wallet-cards-CSdWOmJE.js";import{G as us}from"./gh-chart-hn7wEnik.js";import{T as xs,a as ps,K as _,d as x,e as vs}from"./tabs-DCHagOip.js";const js=i=>{const a=Object.values(os).find(l=>l.value===i);return a?["Last 7 days","Last 30 days","Last 90 days","Last 12 months"].includes(a.name)?`in the ${a.name.toLowerCase()}`:a.name==="All time"?"(all time)":a.name.toLowerCase():""},R="https://www.google.com/s2/favicons?domain=ghost.org&sz=64",p=({dataTableHeader:i,data:a,defaultSourceIconUrl:l=R,onSourceClick:o})=>s.jsxs(ss,{children:[i&&s.jsxs(es,{children:[s.jsx(V,{children:"Source"}),s.jsx(V,{children:"Visitors"})]}),s.jsx(as,{children:a?.map(e=>{const r=!!o,c=e.source?e.source.toLowerCase().replace(/[^a-z0-9]/g,"-"):"direct";return s.jsxs(ts,{className:`group/row ${r?"cursor-pointer":""}`,"data-testid":`source-row-${c}`,onClick:r?()=>o(e.source):void 0,children:[s.jsx(rs,{style:{width:`${e.percentage?Math.round(e.percentage*100):0}%`}}),s.jsx(is,{className:"group-hover/datalist:max-w-[calc(100%-140px)]",children:s.jsx("div",{className:"flex items-center space-x-4 overflow-hidden",children:s.jsx("div",{className:"truncate font-medium",children:e.linkUrl&&!o?s.jsxs("a",{className:"group/link flex items-center gap-2",href:e.linkUrl,rel:"noreferrer",target:"_blank",children:[s.jsx(K,{defaultSourceIconUrl:l,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{className:"group-hover/link:underline",children:e.displayName})]}):s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(K,{defaultSourceIconUrl:l,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{children:e.displayName})]})})})}),s.jsxs(ls,{children:[s.jsx(ns,{children:u(e.visits)}),s.jsx(cs,{children:g(e.percentage||0)})]})]},e.source)})})]}),ks=({data:i,range:a=30,totalVisitors:l=0,siteUrl:o,siteIcon:e,defaultSourceIconUrl:r=R,tableOnly:c=!1,topSourcesLimit:n=10,onSourceClick:t})=>{const{isPostLoading:h}=ds(),m=N.useMemo(()=>J({data:i,mode:"visits",siteUrl:o,siteIcon:e,defaultSourceIconUrl:r}),[i,o,e,r]),d=N.useMemo(()=>U({processedData:m,totalVisitors:l,mode:"visits"}),[m,l]),f=d.slice(0,n),v="Top sources",j=`How readers found this post ${a&&` ${js(a)}`}`;if(c){const z=d.slice(0,n),B=d.length>n;return s.jsxs("div",{children:[s.jsx(p,{data:z,dataTableHeader:!1,defaultSourceIconUrl:r,range:a,onSourceClick:t}),B&&s.jsx("div",{className:"mt-4",children:s.jsxs(w,{children:[s.jsx(T,{asChild:!0,children:s.jsxs(y,{className:"w-full",size:"sm",variant:"outline",children:["View all (",d.length,") ",s.jsx(hs,{size:14})]})}),s.jsxs(D,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(C,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(L,{children:v}),s.jsx(S,{children:j})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(p,{data:d,dataTableHeader:!0,defaultSourceIconUrl:r,range:a,onSourceClick:t})})]})]})})]})}const A=h;return s.jsxs(M,{className:"group/datalist","data-testid":"top-sources-card",children:[s.jsxs("div",{className:"flex items-center justify-between p-6",children:[s.jsxs(Q,{className:"p-0",children:[s.jsx(X,{children:v}),s.jsx(Y,{children:j})]}),s.jsx(E,{className:"mr-2",children:"Visitors"})]}),s.jsxs(P,{className:"overflow-hidden",children:[s.jsx("div",{className:"h-[1px] w-full bg-border"}),A?s.jsx(I,{lines:5}):f.length>0?s.jsx(p,{data:f,dataTableHeader:!1,defaultSourceIconUrl:r,range:a,onSourceClick:t}):s.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"No sources data available."})]}),d.length>10&&s.jsx(Z,{children:s.jsxs(w,{children:[s.jsx(T,{asChild:!0,children:s.jsxs(y,{variant:"outline",children:["View all ",s.jsx(ms,{})]})}),s.jsxs(D,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(C,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(L,{children:v}),s.jsx(S,{children:j})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(p,{data:d,dataTableHeader:!0,defaultSourceIconUrl:r,range:a,onSourceClick:t})})]})]})})]})},bs=i=>{if(!i?.length)return{visits:"0",views:"0",bounceRate:"0%",duration:"0s"};const a=n=>{const t=Number(n);return isNaN(t)?0:t},l=i.reduce((n,t)=>n+a(t.visits),0),o=i.reduce((n,t)=>n+a(t.pageviews),0),e=n=>l===0?0:i.reduce((t,h)=>{const m=a(h[n]),d=a(h.visits);return t+m*d/l},0),r=e("bounce_rate"),c=e("avg_session_sec");return{visits:u(l),views:u(o),bounceRate:g(r),duration:H(c)}},b={visits:{dataKey:"visits",label:"Visitors",color:"hsl(var(--chart-blue))",formatter:u},views:{dataKey:"pageviews",label:"Pageviews",color:"hsl(var(--chart-teal))",formatter:u},"bounce-rate":{dataKey:"bounce_rate",label:"Bounce rate",color:"hsl(var(--chart-purple))",formatter:g},duration:{dataKey:"avg_session_sec",label:"Time on page",color:"hsl(var(--chart-orange))",formatter:H}},Ks=({data:i,range:a})=>{const[l]=$(),o=l.get("tab")||"visits",[e,r]=G.useState(o),c=b[e],n=O(i||[],a,c.dataKey,"sum")?.map(h=>{const m=Number(h[c.dataKey]);return{date:String(h.date),value:m,formattedValue:c.formatter(m),label:c.label}}),t=bs(i);return s.jsx(M,{children:s.jsx(P,{children:s.jsxs(xs,{defaultValue:e,variant:"kpis",children:[s.jsxs(ps,{className:"-mx-6 hidden grid-cols-2 md:!visible md:!grid",children:[s.jsx(_,{value:"visits",onClick:()=>{r("visits")},children:s.jsx(x,{color:b.visits.color,label:"Unique visitors",value:t.visits})}),s.jsx(_,{value:"views",onClick:()=>{r("views")},children:s.jsx(x,{color:b.views.color,label:"Total views",value:t.views})})]}),s.jsxs(q,{children:[s.jsx(F,{className:"md:hidden",asChild:!0,children:s.jsxs(vs,{children:[e==="visits"&&s.jsx(x,{color:"hsl(var(--chart-blue))",label:"Unique visitors",value:t.visits}),e==="views"&&s.jsx(x,{color:"hsl(var(--chart-teal))",label:"Total views",value:t.views})]})}),s.jsxs(W,{align:"end",className:"w-56",children:[s.jsx(k,{onClick:()=>r("visits"),children:"Unique visitors"}),s.jsx(k,{onClick:()=>r("views"),children:"Total views"})]})]}),s.jsx("div",{className:"my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:s.jsx(us,{className:"-mb-3 aspect-auto h-[16vw] max-h-[320px] min-h-[180px] w-full",color:c.color,data:n,id:c.dataKey,range:a,showHours:!0,syncId:"overview-charts"})})]})})})};export{b as K,ks as S,Ks as a,js as b,bs as g};
1
+ import{e as N,j as s,by as w,bz as T,B as y,bA as D,bB as C,bC as L,bD as S,aS as E,bE as I,aj as u,ai as g,bF as H,bG as $,r as G,aW as O,bH as q,ap as F,bI as W,bJ as k}from"./index-CMTzNTew.js";import{S as K}from"./source-icon-DvDuzw73.js";import{p as J,e as U}from"./source-utils-B1S3ZHA2.js";import{C as M,a as Q,b as X,f as Y,c as P,g as Z}from"./pagemenu-CZyroidv.js";import{D as ss,h as es,i as V,a as as,b as ts,c as rs,d as is,e as ls,f as ns,g as cs}from"./data-list-BYNMbRIq.js";import{S as os,u as ds}from"./post-analytics-context-CF7C67-0.js";import{A as hs}from"./lucide-react-CBigk-fq.js";import{a as ms}from"./wallet-cards-KmOh29LP.js";import{G as us}from"./gh-chart-Br7NXn_b.js";import{T as xs,a as ps,K as _,d as x,e as vs}from"./tabs-BmdL0X4U.js";const js=i=>{const a=Object.values(os).find(l=>l.value===i);return a?["Last 7 days","Last 30 days","Last 90 days","Last 12 months"].includes(a.name)?`in the ${a.name.toLowerCase()}`:a.name==="All time"?"(all time)":a.name.toLowerCase():""},R="https://www.google.com/s2/favicons?domain=ghost.org&sz=64",p=({dataTableHeader:i,data:a,defaultSourceIconUrl:l=R,onSourceClick:o})=>s.jsxs(ss,{children:[i&&s.jsxs(es,{children:[s.jsx(V,{children:"Source"}),s.jsx(V,{children:"Visitors"})]}),s.jsx(as,{children:a?.map(e=>{const r=!!o,c=e.source?e.source.toLowerCase().replace(/[^a-z0-9]/g,"-"):"direct";return s.jsxs(ts,{className:`group/row ${r?"cursor-pointer":""}`,"data-testid":`source-row-${c}`,onClick:r?()=>o(e.source):void 0,children:[s.jsx(rs,{style:{width:`${e.percentage?Math.round(e.percentage*100):0}%`}}),s.jsx(is,{className:"group-hover/datalist:max-w-[calc(100%-140px)]",children:s.jsx("div",{className:"flex items-center space-x-4 overflow-hidden",children:s.jsx("div",{className:"truncate font-medium",children:e.linkUrl&&!o?s.jsxs("a",{className:"group/link flex items-center gap-2",href:e.linkUrl,rel:"noreferrer",target:"_blank",children:[s.jsx(K,{defaultSourceIconUrl:l,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{className:"group-hover/link:underline",children:e.displayName})]}):s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(K,{defaultSourceIconUrl:l,displayName:e.displayName,iconSrc:e.iconSrc}),s.jsx("span",{children:e.displayName})]})})})}),s.jsxs(ls,{children:[s.jsx(ns,{children:u(e.visits)}),s.jsx(cs,{children:g(e.percentage||0)})]})]},e.source)})})]}),ks=({data:i,range:a=30,totalVisitors:l=0,siteUrl:o,siteIcon:e,defaultSourceIconUrl:r=R,tableOnly:c=!1,topSourcesLimit:n=10,onSourceClick:t})=>{const{isPostLoading:h}=ds(),m=N.useMemo(()=>J({data:i,mode:"visits",siteUrl:o,siteIcon:e,defaultSourceIconUrl:r}),[i,o,e,r]),d=N.useMemo(()=>U({processedData:m,totalVisitors:l,mode:"visits"}),[m,l]),f=d.slice(0,n),v="Top sources",j=`How readers found this post ${a&&` ${js(a)}`}`;if(c){const z=d.slice(0,n),B=d.length>n;return s.jsxs("div",{children:[s.jsx(p,{data:z,dataTableHeader:!1,defaultSourceIconUrl:r,range:a,onSourceClick:t}),B&&s.jsx("div",{className:"mt-4",children:s.jsxs(w,{children:[s.jsx(T,{asChild:!0,children:s.jsxs(y,{className:"w-full",size:"sm",variant:"outline",children:["View all (",d.length,") ",s.jsx(hs,{size:14})]})}),s.jsxs(D,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(C,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(L,{children:v}),s.jsx(S,{children:j})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(p,{data:d,dataTableHeader:!0,defaultSourceIconUrl:r,range:a,onSourceClick:t})})]})]})})]})}const A=h;return s.jsxs(M,{className:"group/datalist","data-testid":"top-sources-card",children:[s.jsxs("div",{className:"flex items-center justify-between p-6",children:[s.jsxs(Q,{className:"p-0",children:[s.jsx(X,{children:v}),s.jsx(Y,{children:j})]}),s.jsx(E,{className:"mr-2",children:"Visitors"})]}),s.jsxs(P,{className:"overflow-hidden",children:[s.jsx("div",{className:"h-[1px] w-full bg-border"}),A?s.jsx(I,{lines:5}):f.length>0?s.jsx(p,{data:f,dataTableHeader:!1,defaultSourceIconUrl:r,range:a,onSourceClick:t}):s.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"No sources data available."})]}),d.length>10&&s.jsx(Z,{children:s.jsxs(w,{children:[s.jsx(T,{asChild:!0,children:s.jsxs(y,{variant:"outline",children:["View all ",s.jsx(ms,{})]})}),s.jsxs(D,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[s.jsxs(C,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[s.jsx(L,{children:v}),s.jsx(S,{children:j})]}),s.jsx("div",{className:"group/datalist",children:s.jsx(p,{data:d,dataTableHeader:!0,defaultSourceIconUrl:r,range:a,onSourceClick:t})})]})]})})]})},bs=i=>{if(!i?.length)return{visits:"0",views:"0",bounceRate:"0%",duration:"0s"};const a=n=>{const t=Number(n);return isNaN(t)?0:t},l=i.reduce((n,t)=>n+a(t.visits),0),o=i.reduce((n,t)=>n+a(t.pageviews),0),e=n=>l===0?0:i.reduce((t,h)=>{const m=a(h[n]),d=a(h.visits);return t+m*d/l},0),r=e("bounce_rate"),c=e("avg_session_sec");return{visits:u(l),views:u(o),bounceRate:g(r),duration:H(c)}},b={visits:{dataKey:"visits",label:"Visitors",color:"hsl(var(--chart-blue))",formatter:u},views:{dataKey:"pageviews",label:"Pageviews",color:"hsl(var(--chart-teal))",formatter:u},"bounce-rate":{dataKey:"bounce_rate",label:"Bounce rate",color:"hsl(var(--chart-purple))",formatter:g},duration:{dataKey:"avg_session_sec",label:"Time on page",color:"hsl(var(--chart-orange))",formatter:H}},Ks=({data:i,range:a})=>{const[l]=$(),o=l.get("tab")||"visits",[e,r]=G.useState(o),c=b[e],n=O(i||[],a,c.dataKey,"sum")?.map(h=>{const m=Number(h[c.dataKey]);return{date:String(h.date),value:m,formattedValue:c.formatter(m),label:c.label}}),t=bs(i);return s.jsx(M,{children:s.jsx(P,{children:s.jsxs(xs,{defaultValue:e,variant:"kpis",children:[s.jsxs(ps,{className:"-mx-6 hidden grid-cols-2 md:!visible md:!grid",children:[s.jsx(_,{value:"visits",onClick:()=>{r("visits")},children:s.jsx(x,{color:b.visits.color,label:"Unique visitors",value:t.visits})}),s.jsx(_,{value:"views",onClick:()=>{r("views")},children:s.jsx(x,{color:b.views.color,label:"Total views",value:t.views})})]}),s.jsxs(q,{children:[s.jsx(F,{className:"md:hidden",asChild:!0,children:s.jsxs(vs,{children:[e==="visits"&&s.jsx(x,{color:"hsl(var(--chart-blue))",label:"Unique visitors",value:t.visits}),e==="views"&&s.jsx(x,{color:"hsl(var(--chart-teal))",label:"Total views",value:t.views})]})}),s.jsxs(W,{align:"end",className:"w-56",children:[s.jsx(k,{onClick:()=>r("visits"),children:"Unique visitors"}),s.jsx(k,{onClick:()=>r("views"),children:"Total views"})]})]}),s.jsx("div",{className:"my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:s.jsx(us,{className:"-mb-3 aspect-auto h-[16vw] max-h-[320px] min-h-[180px] w-full",color:c.color,data:n,id:c.dataKey,range:a,showHours:!0,syncId:"overview-charts"})})]})})})};export{b as K,ks as S,Ks as a,js as b,bs as g};
@@ -1 +1 @@
1
- import{r as i,bT as E,j as p,bU as x,y as R,an as S}from"./index-f5Lv9kLb.js";var v=Symbol.for("react.lazy"),u=E[" use ".trim().toString()];function C(e){return typeof e=="object"&&e!==null&&"then"in e}function y(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===v&&"_payload"in e&&C(e._payload)}function w(e){const t=h(e),r=i.forwardRef((o,n)=>{let{children:a,...s}=o;y(a)&&typeof u=="function"&&(a=u(a._payload));const l=i.Children.toArray(a),f=l.find(N);if(f){const c=f.props.children,g=l.map(d=>d===f?i.Children.count(c)>1?i.Children.only(null):i.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...s,ref:n,children:i.isValidElement(c)?i.cloneElement(c,void 0,g):null})}return p.jsx(t,{...s,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function h(e){const t=i.forwardRef((r,o)=>{let{children:n,...a}=r;if(y(n)&&typeof u=="function"&&(n=u(n._payload)),i.isValidElement(n)){const s=_(n),l=P(a,n.props);return n.type!==i.Fragment&&(l.ref=o?x(o,s):s),i.cloneElement(n,l)}return i.Children.count(n)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var j=Symbol("radix.slottable");function N(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===j}function P(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...l)=>{const f=a(...l);return n(...l),f}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function _(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var L=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=L.reduce((e,t)=>{const r=w(`Primitive.${t}`),o=i.forwardRef((n,a)=>{const{asChild:s,...l}=n,f=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(f,{...l,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),A="Label",m=i.forwardRef((e,t)=>p.jsx($.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));m.displayName=A;var b=m;const D=S("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),V=i.forwardRef(({className:e,...t},r)=>p.jsx(b,{ref:r,className:R(D(),e),...t}));V.displayName=b.displayName;export{V as L};
1
+ import{r as i,bT as E,j as p,bU as x,y as R,an as S}from"./index-CMTzNTew.js";var v=Symbol.for("react.lazy"),u=E[" use ".trim().toString()];function C(e){return typeof e=="object"&&e!==null&&"then"in e}function y(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===v&&"_payload"in e&&C(e._payload)}function w(e){const t=h(e),r=i.forwardRef((o,n)=>{let{children:a,...s}=o;y(a)&&typeof u=="function"&&(a=u(a._payload));const l=i.Children.toArray(a),f=l.find(N);if(f){const c=f.props.children,g=l.map(d=>d===f?i.Children.count(c)>1?i.Children.only(null):i.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...s,ref:n,children:i.isValidElement(c)?i.cloneElement(c,void 0,g):null})}return p.jsx(t,{...s,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function h(e){const t=i.forwardRef((r,o)=>{let{children:n,...a}=r;if(y(n)&&typeof u=="function"&&(n=u(n._payload)),i.isValidElement(n)){const s=_(n),l=P(a,n.props);return n.type!==i.Fragment&&(l.ref=o?x(o,s):s),i.cloneElement(n,l)}return i.Children.count(n)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var j=Symbol("radix.slottable");function N(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===j}function P(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...l)=>{const f=a(...l);return n(...l),f}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function _(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var L=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=L.reduce((e,t)=>{const r=w(`Primitive.${t}`),o=i.forwardRef((n,a)=>{const{asChild:s,...l}=n,f=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(f,{...l,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),A="Label",m=i.forwardRef((e,t)=>p.jsx($.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));m.displayName=A;var b=m;const D=S("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),V=i.forwardRef(({className:e,...t},r)=>p.jsx(b,{ref:r,className:R(D(),e),...t}));V.displayName=b.displayName;export{V as L};
@@ -1 +1 @@
1
- import{e as A,aH as Q,r as ht,j as o,y as yt,ai as gt,ac as bt,ad as vt}from"./index-f5Lv9kLb.js";import{S as At,b as J,c as X,A as xt,i as K,L as N,d as Ot,e as st,m as V,h as Y,G as jt,j as St,k as Pt,l as kt,n as Rt,t as Ct,o as Et,p as Z,q as _t,r as wt,g as Dt,s as Tt,C as Nt,u as It,a as zt,v as Bt}from"./chart-pimL5Chk.js";import{P as ct,a as lt}from"./PolarAngleAxis-B8JrAxf_.js";function w(t){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(t)}function U(){return U=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},U.apply(this,arguments)}function tt(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),a.push.apply(a,r)}return a}function F(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(a),!0).forEach(function(r){Lt(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):tt(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function Lt(t,e,a){return e=Mt(e),e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Mt(t){var e=$t(t,"string");return w(e)=="symbol"?e:e+""}function $t(t,e){if(w(t)!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function et(t){return typeof t=="string"?parseInt(t,10):t}function Wt(t,e){var a="".concat(e.cx||t.cx),r=Number(a),n="".concat(e.cy||t.cy),i=Number(n);return F(F(F({},e),t),{},{cx:r,cy:i})}function rt(t){return A.createElement(At,U({shapeType:"sector",propTransformer:Wt},t))}var Gt=["shape","activeShape","activeIndex","cornerRadius"],Kt=["value","background"];function C(t){"@babel/helpers - typeof";return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(t)}function I(){return I=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},I.apply(this,arguments)}function at(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),a.push.apply(a,r)}return a}function u(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?at(Object(a),!0).forEach(function(r){j(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):at(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function nt(t,e){if(t==null)return{};var a=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Ft(t,e){if(t==null)return{};var a={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;a[r]=t[r]}return a}function Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function it(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pt(r.key),r)}}function Ut(t,e,a){return e&&it(t.prototype,e),a&&it(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function qt(t,e,a){return e=z(e),Ht(t,ut()?Reflect.construct(e,a||[],z(t).constructor):e.apply(t,a))}function Ht(t,e){if(e&&(C(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qt(t)}function Qt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},z(t)}function Jt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&q(t,e)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},q(t,e)}function j(t,e,a){return e=pt(e),e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function pt(t){var e=Xt(t,"string");return C(e)=="symbol"?e:e+""}function Xt(t,e){if(C(t)!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(C(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var D=(function(t){function e(){var a;Vt(this,e);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return a=qt(this,e,[].concat(n)),j(a,"state",{isAnimationFinished:!1}),j(a,"handleAnimationEnd",function(){var s=a.props.onAnimationEnd;a.setState({isAnimationFinished:!0}),Y(s)&&s()}),j(a,"handleAnimationStart",function(){var s=a.props.onAnimationStart;a.setState({isAnimationFinished:!1}),Y(s)&&s()}),a}return Jt(e,t),Ut(e,[{key:"getDeltaAngle",value:function(){var r=this.props,n=r.startAngle,i=r.endAngle,s=V(i-n),p=Math.min(Math.abs(i-n),360);return s*p}},{key:"renderSectorsStatically",value:function(r){var n=this,i=this.props,s=i.shape,p=i.activeShape,d=i.activeIndex,l=i.cornerRadius,c=nt(i,Gt),y=J(c,!1);return r.map(function(g,f){var v=f===d,m=u(u(u(u({},y),{},{cornerRadius:et(l)},g),X(n.props,g,f)),{},{className:"recharts-radial-bar-sector ".concat(g.className),forceCornerRadius:c.forceCornerRadius,cornerIsExternal:c.cornerIsExternal,isActive:v,option:v?p:s});return A.createElement(rt,I({},m,{key:"sector-".concat(f)}))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,n=this.props,i=n.data,s=n.isAnimationActive,p=n.animationBegin,d=n.animationDuration,l=n.animationEasing,c=n.animationId,y=this.state.prevData;return A.createElement(xt,{begin:p,duration:d,isActive:s,easing:l,from:{t:0},to:{t:1},key:"radialBar-".concat(c),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var f=g.t,v=i.map(function(m,E){var S=y&&y[E];if(S){var B=K(S.startAngle,m.startAngle),b=K(S.endAngle,m.endAngle);return u(u({},m),{},{startAngle:B(f),endAngle:b(f)})}var T=m.endAngle,L=m.startAngle,M=K(L,T);return u(u({},m),{},{endAngle:M(f)})});return A.createElement(N,null,r.renderSectorsStatically(v))})}},{key:"renderSectors",value:function(){var r=this.props,n=r.data,i=r.isAnimationActive,s=this.state.prevData;return i&&n&&n.length&&(!s||!Ot(s,n))?this.renderSectorsWithAnimation():this.renderSectorsStatically(n)}},{key:"renderBackground",value:function(r){var n=this,i=this.props.cornerRadius,s=J(this.props.background,!1);return r.map(function(p,d){p.value;var l=p.background,c=nt(p,Kt);if(!l)return null;var y=u(u(u(u(u({cornerRadius:et(i)},c),{},{fill:"#eee"},l),s),X(n.props,p,d)),{},{index:d,className:Q("recharts-radial-bar-background-sector",s?.className),option:l,isActive:!1});return A.createElement(rt,I({},y,{key:"sector-".concat(d)}))})}},{key:"render",value:function(){var r=this.props,n=r.hide,i=r.data,s=r.className,p=r.background,d=r.isAnimationActive;if(n||!i||!i.length)return null;var l=this.state.isAnimationFinished,c=Q("recharts-area",s);return A.createElement(N,{className:c},p&&A.createElement(N,{className:"recharts-radial-bar-background"},this.renderBackground(i)),A.createElement(N,{className:"recharts-radial-bar-sectors"},this.renderSectors()),(!d||l)&&st.renderCallByParent(u({},this.props),i))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:n.curData}:r.data!==n.curData?{curData:r.data}:null}}])})(ht.PureComponent);j(D,"displayName","RadialBar");j(D,"defaultProps",{angleAxisId:0,radiusAxisId:0,minPointSize:0,hide:!1,legendType:"rect",data:[],isAnimationActive:!jt.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease",forceCornerRadius:!1,cornerIsExternal:!1});j(D,"getComposedData",function(t){var e=t.item,a=t.props,r=t.radiusAxis,n=t.radiusAxisTicks,i=t.angleAxis,s=t.angleAxisTicks,p=t.displayedData,d=t.dataKey,l=t.stackedData,c=t.barPosition,y=t.bandSize,g=t.dataStartIndex,f=St(c,e);if(!f)return null;var v=i.cx,m=i.cy,E=a.layout,S=e.props,B=S.children,b=S.minPointSize,T=E==="radial"?i:r,L=l?T.scale.domain():null,M=Pt({numericAxis:T}),$=kt(B,Rt),dt=p.map(function(P,_){var h,x,O,k,R,H;if(l?h=Ct(l[g+_],L):(h=Et(P,d),Array.isArray(h)||(h=[M,h])),E==="radial"){x=Z({axis:r,ticks:n,bandSize:y,offset:f.offset,entry:P,index:_}),R=i.scale(h[1]),k=i.scale(h[0]),O=x+f.size;var W=R-k;if(Math.abs(b)>0&&Math.abs(W)<Math.abs(b)){var ft=V(W||b)*(Math.abs(b)-Math.abs(W));R+=ft}H={background:{cx:v,cy:m,innerRadius:x,outerRadius:O,startAngle:a.startAngle,endAngle:a.endAngle}}}else{x=r.scale(h[0]),O=r.scale(h[1]),k=Z({axis:i,ticks:s,bandSize:y,offset:f.offset,entry:P,index:_}),R=k+f.size;var G=O-x;if(Math.abs(b)>0&&Math.abs(G)<Math.abs(b)){var mt=V(G||b)*(Math.abs(b)-Math.abs(G));O+=mt}}return u(u(u(u({},P),H),{},{payload:P,value:l?h:h[1],cx:v,cy:m,innerRadius:x,outerRadius:O,startAngle:k,endAngle:R},$&&$[_]&&$[_].props),{},{tooltipPayload:[_t(e,P)],tooltipPosition:wt(v,m,(x+O)/2,(k+R)/2)})});return{data:dt,layout:E}});var Yt=Dt({chartName:"RadialBarChart",GraphicalChild:D,legendContent:"children",defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"angleAxis",AxisComp:ct},{axisType:"radiusAxis",AxisComp:lt}],formatAxisMap:Tt,defaultProps:{layout:"radial",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const re=({config:t,data:e,percentageValue:a,percentageLabel:r,className:n,tooltip:i=!0,size:s="responsive"})=>{const d=(()=>{switch(s){case"sm":return{barWidth:28,innerRadiusStart:e.length>1?42:56,fontSize:{percentage:"1.2rem",label:"0.8rem"}};case"md":return{barWidth:36,innerRadiusStart:e.length>1?60:72,fontSize:{percentage:"1.4rem",label:"0.9rem"}};case"lg":return{barWidth:46,innerRadiusStart:e.length>1?72:94,fontSize:{percentage:"1.6rem",label:"1rem"}};case"responsive":default:return{barWidth:46,innerRadiusStart:e.length>1?72:94,fontSize:{percentage:"1.6rem",label:"1rem"}}}})(),l={innerRadius:d.innerRadiusStart,outerRadius:d.innerRadiusStart+d.barWidth,startAngle:90,endAngle:-270};return o.jsx(Nt,{className:yt("mx-auto",n),config:t,children:o.jsxs(Yt,{data:e,endAngle:l.endAngle,innerRadius:l.innerRadius,outerRadius:l.outerRadius,startAngle:l.startAngle,children:[o.jsxs("defs",{children:[o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientPurple",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-purple))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-purple))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientBlue",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-blue))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-blue))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientTeal",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-teal))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-teal))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientGray",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-gray))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-gray))",stopOpacity:1})]})]}),o.jsx(ct,{angleAxisId:0,domain:[0,1],tick:!1,type:"number"}),o.jsx(D,{cornerRadius:10,dataKey:"value",minPointSize:-2,background:!0,children:e.length>1&&o.jsx(st,{className:"fill-black opacity-60",dataKey:"datatype",fontSize:11,position:"insideStart"})}),o.jsx(lt,{axisLine:!1,tick:!1,tickLine:!1,children:o.jsx(It,{content:({viewBox:c})=>{if(c&&"cx"in c&&"cy"in c)return o.jsxs("text",{dominantBaseline:"middle",textAnchor:"middle",x:c.cx,y:c.cy,children:[a&&o.jsx("tspan",{className:"fill-foreground text-[1.6rem] font-semibold tracking-tight",x:c.cx,y:(c.cy||0)-6,children:a}),r&&o.jsx("tspan",{className:"fill-muted-foreground font-medium",x:c.cx,y:(c.cy||0)+14,children:r})]})}})}),i&&o.jsx(zt,{content:o.jsx(Bt,{formatter:(c,y,g)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:g.payload?.color}}),o.jsx("div",{className:"text-xs text-muted-foreground",children:g.payload?.datatype}),o.jsx("div",{className:"ml-3 font-mono text-xs",children:gt(c)})]}),nameKey:"datatype",hideLabel:!0}),cursor:!1,isAnimationActive:!1})]})})},ot=(t,e=!1)=>{try{const a=["ref","attribution_id","attribution_type"],r=new URL(t);for(const i of a)r.searchParams.delete(i);return e?(r.host+(r.pathname==="/"&&!r.search?"":r.pathname)+(r.search?r.search:"")+(r.hash?r.hash:"")).replace(/^www\./,""):r.toString()}catch{return t}},ae=(t,e)=>t.find(a=>a.link.link_id===e),ne=t=>{const r=(t?.links.map(n=>({link:n.link,count:n.count?.clicks||0}))||[]).map(n=>({...n,link:{...n.link,originalTo:n.link.to,to:ot(n.link.to,!1),title:ot(n.link.to,!0)}})).reduce((n,i)=>(n[i.link.title]?(n[i.link.title].count||(n[i.link.title].count=0),n[i.link.title].count+=i.count??0):n[i.link.title]=i,n),{});return Object.values(r).sort((n,i)=>{const s=n.count||0;return(i.count||0)-s})},ie=bt({dataType:"LinkResponseType",path:"/links/"}),oe=vt({method:"PUT",path:()=>"/links/bulk/",body:({editedUrl:t})=>({bulk:{action:"updateLink",meta:{link:{to:t}}}}),searchParams:({originalUrl:t,postId:e})=>({filter:`post_id:'${e}'+to:'${t}'`})});export{re as N,oe as a,ot as c,ae as g,ne as p,ie as u};
1
+ import{e as A,aH as Q,r as ht,j as o,y as yt,ai as gt,ac as bt,ad as vt}from"./index-CMTzNTew.js";import{S as At,b as J,c as X,A as xt,i as K,L as N,d as Ot,e as st,m as V,h as Y,G as jt,j as St,k as Pt,l as kt,n as Rt,t as Ct,o as Et,p as Z,q as _t,r as wt,g as Dt,s as Tt,C as Nt,u as It,a as zt,v as Bt}from"./chart-mYz3IJwm.js";import{P as ct,a as lt}from"./PolarAngleAxis-Dod0DwfL.js";function w(t){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(t)}function U(){return U=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},U.apply(this,arguments)}function tt(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),a.push.apply(a,r)}return a}function F(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?tt(Object(a),!0).forEach(function(r){Lt(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):tt(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function Lt(t,e,a){return e=Mt(e),e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Mt(t){var e=$t(t,"string");return w(e)=="symbol"?e:e+""}function $t(t,e){if(w(t)!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(w(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function et(t){return typeof t=="string"?parseInt(t,10):t}function Wt(t,e){var a="".concat(e.cx||t.cx),r=Number(a),n="".concat(e.cy||t.cy),i=Number(n);return F(F(F({},e),t),{},{cx:r,cy:i})}function rt(t){return A.createElement(At,U({shapeType:"sector",propTransformer:Wt},t))}var Gt=["shape","activeShape","activeIndex","cornerRadius"],Kt=["value","background"];function C(t){"@babel/helpers - typeof";return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(t)}function I(){return I=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},I.apply(this,arguments)}function at(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),a.push.apply(a,r)}return a}function u(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{};e%2?at(Object(a),!0).forEach(function(r){j(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):at(Object(a)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))})}return t}function nt(t,e){if(t==null)return{};var a=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Ft(t,e){if(t==null)return{};var a={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;a[r]=t[r]}return a}function Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function it(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pt(r.key),r)}}function Ut(t,e,a){return e&&it(t.prototype,e),a&&it(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function qt(t,e,a){return e=z(e),Ht(t,ut()?Reflect.construct(e,a||[],z(t).constructor):e.apply(t,a))}function Ht(t,e){if(e&&(C(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qt(t)}function Qt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},z(t)}function Jt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&q(t,e)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},q(t,e)}function j(t,e,a){return e=pt(e),e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function pt(t){var e=Xt(t,"string");return C(e)=="symbol"?e:e+""}function Xt(t,e){if(C(t)!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var r=a.call(t,e);if(C(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var D=(function(t){function e(){var a;Vt(this,e);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return a=qt(this,e,[].concat(n)),j(a,"state",{isAnimationFinished:!1}),j(a,"handleAnimationEnd",function(){var s=a.props.onAnimationEnd;a.setState({isAnimationFinished:!0}),Y(s)&&s()}),j(a,"handleAnimationStart",function(){var s=a.props.onAnimationStart;a.setState({isAnimationFinished:!1}),Y(s)&&s()}),a}return Jt(e,t),Ut(e,[{key:"getDeltaAngle",value:function(){var r=this.props,n=r.startAngle,i=r.endAngle,s=V(i-n),p=Math.min(Math.abs(i-n),360);return s*p}},{key:"renderSectorsStatically",value:function(r){var n=this,i=this.props,s=i.shape,p=i.activeShape,d=i.activeIndex,l=i.cornerRadius,c=nt(i,Gt),y=J(c,!1);return r.map(function(g,f){var v=f===d,m=u(u(u(u({},y),{},{cornerRadius:et(l)},g),X(n.props,g,f)),{},{className:"recharts-radial-bar-sector ".concat(g.className),forceCornerRadius:c.forceCornerRadius,cornerIsExternal:c.cornerIsExternal,isActive:v,option:v?p:s});return A.createElement(rt,I({},m,{key:"sector-".concat(f)}))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,n=this.props,i=n.data,s=n.isAnimationActive,p=n.animationBegin,d=n.animationDuration,l=n.animationEasing,c=n.animationId,y=this.state.prevData;return A.createElement(xt,{begin:p,duration:d,isActive:s,easing:l,from:{t:0},to:{t:1},key:"radialBar-".concat(c),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var f=g.t,v=i.map(function(m,E){var S=y&&y[E];if(S){var B=K(S.startAngle,m.startAngle),b=K(S.endAngle,m.endAngle);return u(u({},m),{},{startAngle:B(f),endAngle:b(f)})}var T=m.endAngle,L=m.startAngle,M=K(L,T);return u(u({},m),{},{endAngle:M(f)})});return A.createElement(N,null,r.renderSectorsStatically(v))})}},{key:"renderSectors",value:function(){var r=this.props,n=r.data,i=r.isAnimationActive,s=this.state.prevData;return i&&n&&n.length&&(!s||!Ot(s,n))?this.renderSectorsWithAnimation():this.renderSectorsStatically(n)}},{key:"renderBackground",value:function(r){var n=this,i=this.props.cornerRadius,s=J(this.props.background,!1);return r.map(function(p,d){p.value;var l=p.background,c=nt(p,Kt);if(!l)return null;var y=u(u(u(u(u({cornerRadius:et(i)},c),{},{fill:"#eee"},l),s),X(n.props,p,d)),{},{index:d,className:Q("recharts-radial-bar-background-sector",s?.className),option:l,isActive:!1});return A.createElement(rt,I({},y,{key:"sector-".concat(d)}))})}},{key:"render",value:function(){var r=this.props,n=r.hide,i=r.data,s=r.className,p=r.background,d=r.isAnimationActive;if(n||!i||!i.length)return null;var l=this.state.isAnimationFinished,c=Q("recharts-area",s);return A.createElement(N,{className:c},p&&A.createElement(N,{className:"recharts-radial-bar-background"},this.renderBackground(i)),A.createElement(N,{className:"recharts-radial-bar-sectors"},this.renderSectors()),(!d||l)&&st.renderCallByParent(u({},this.props),i))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:n.curData}:r.data!==n.curData?{curData:r.data}:null}}])})(ht.PureComponent);j(D,"displayName","RadialBar");j(D,"defaultProps",{angleAxisId:0,radiusAxisId:0,minPointSize:0,hide:!1,legendType:"rect",data:[],isAnimationActive:!jt.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease",forceCornerRadius:!1,cornerIsExternal:!1});j(D,"getComposedData",function(t){var e=t.item,a=t.props,r=t.radiusAxis,n=t.radiusAxisTicks,i=t.angleAxis,s=t.angleAxisTicks,p=t.displayedData,d=t.dataKey,l=t.stackedData,c=t.barPosition,y=t.bandSize,g=t.dataStartIndex,f=St(c,e);if(!f)return null;var v=i.cx,m=i.cy,E=a.layout,S=e.props,B=S.children,b=S.minPointSize,T=E==="radial"?i:r,L=l?T.scale.domain():null,M=Pt({numericAxis:T}),$=kt(B,Rt),dt=p.map(function(P,_){var h,x,O,k,R,H;if(l?h=Ct(l[g+_],L):(h=Et(P,d),Array.isArray(h)||(h=[M,h])),E==="radial"){x=Z({axis:r,ticks:n,bandSize:y,offset:f.offset,entry:P,index:_}),R=i.scale(h[1]),k=i.scale(h[0]),O=x+f.size;var W=R-k;if(Math.abs(b)>0&&Math.abs(W)<Math.abs(b)){var ft=V(W||b)*(Math.abs(b)-Math.abs(W));R+=ft}H={background:{cx:v,cy:m,innerRadius:x,outerRadius:O,startAngle:a.startAngle,endAngle:a.endAngle}}}else{x=r.scale(h[0]),O=r.scale(h[1]),k=Z({axis:i,ticks:s,bandSize:y,offset:f.offset,entry:P,index:_}),R=k+f.size;var G=O-x;if(Math.abs(b)>0&&Math.abs(G)<Math.abs(b)){var mt=V(G||b)*(Math.abs(b)-Math.abs(G));O+=mt}}return u(u(u(u({},P),H),{},{payload:P,value:l?h:h[1],cx:v,cy:m,innerRadius:x,outerRadius:O,startAngle:k,endAngle:R},$&&$[_]&&$[_].props),{},{tooltipPayload:[_t(e,P)],tooltipPosition:wt(v,m,(x+O)/2,(k+R)/2)})});return{data:dt,layout:E}});var Yt=Dt({chartName:"RadialBarChart",GraphicalChild:D,legendContent:"children",defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"angleAxis",AxisComp:ct},{axisType:"radiusAxis",AxisComp:lt}],formatAxisMap:Tt,defaultProps:{layout:"radial",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const re=({config:t,data:e,percentageValue:a,percentageLabel:r,className:n,tooltip:i=!0,size:s="responsive"})=>{const d=(()=>{switch(s){case"sm":return{barWidth:28,innerRadiusStart:e.length>1?42:56,fontSize:{percentage:"1.2rem",label:"0.8rem"}};case"md":return{barWidth:36,innerRadiusStart:e.length>1?60:72,fontSize:{percentage:"1.4rem",label:"0.9rem"}};case"lg":return{barWidth:46,innerRadiusStart:e.length>1?72:94,fontSize:{percentage:"1.6rem",label:"1rem"}};case"responsive":default:return{barWidth:46,innerRadiusStart:e.length>1?72:94,fontSize:{percentage:"1.6rem",label:"1rem"}}}})(),l={innerRadius:d.innerRadiusStart,outerRadius:d.innerRadiusStart+d.barWidth,startAngle:90,endAngle:-270};return o.jsx(Nt,{className:yt("mx-auto",n),config:t,children:o.jsxs(Yt,{data:e,endAngle:l.endAngle,innerRadius:l.innerRadius,outerRadius:l.outerRadius,startAngle:l.startAngle,children:[o.jsxs("defs",{children:[o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientPurple",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-purple))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-purple))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientBlue",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-blue))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-blue))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientTeal",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-teal))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-teal))",stopOpacity:1})]}),o.jsxs("radialGradient",{cx:"30%",cy:"30%",id:"gradientGray",r:"70%",children:[o.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-gray))",stopOpacity:.5}),o.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-gray))",stopOpacity:1})]})]}),o.jsx(ct,{angleAxisId:0,domain:[0,1],tick:!1,type:"number"}),o.jsx(D,{cornerRadius:10,dataKey:"value",minPointSize:-2,background:!0,children:e.length>1&&o.jsx(st,{className:"fill-black opacity-60",dataKey:"datatype",fontSize:11,position:"insideStart"})}),o.jsx(lt,{axisLine:!1,tick:!1,tickLine:!1,children:o.jsx(It,{content:({viewBox:c})=>{if(c&&"cx"in c&&"cy"in c)return o.jsxs("text",{dominantBaseline:"middle",textAnchor:"middle",x:c.cx,y:c.cy,children:[a&&o.jsx("tspan",{className:"fill-foreground text-[1.6rem] font-semibold tracking-tight",x:c.cx,y:(c.cy||0)-6,children:a}),r&&o.jsx("tspan",{className:"fill-muted-foreground font-medium",x:c.cx,y:(c.cy||0)+14,children:r})]})}})}),i&&o.jsx(zt,{content:o.jsx(Bt,{formatter:(c,y,g)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:g.payload?.color}}),o.jsx("div",{className:"text-xs text-muted-foreground",children:g.payload?.datatype}),o.jsx("div",{className:"ml-3 font-mono text-xs",children:gt(c)})]}),nameKey:"datatype",hideLabel:!0}),cursor:!1,isAnimationActive:!1})]})})},ot=(t,e=!1)=>{try{const a=["ref","attribution_id","attribution_type"],r=new URL(t);for(const i of a)r.searchParams.delete(i);return e?(r.host+(r.pathname==="/"&&!r.search?"":r.pathname)+(r.search?r.search:"")+(r.hash?r.hash:"")).replace(/^www\./,""):r.toString()}catch{return t}},ae=(t,e)=>t.find(a=>a.link.link_id===e),ne=t=>{const r=(t?.links.map(n=>({link:n.link,count:n.count?.clicks||0}))||[]).map(n=>({...n,link:{...n.link,originalTo:n.link.to,to:ot(n.link.to,!1),title:ot(n.link.to,!0)}})).reduce((n,i)=>(n[i.link.title]?(n[i.link.title].count||(n[i.link.title].count=0),n[i.link.title].count+=i.count??0):n[i.link.title]=i,n),{});return Object.values(r).sort((n,i)=>{const s=n.count||0;return(i.count||0)-s})},ie=bt({dataType:"LinkResponseType",path:"/links/"}),oe=vt({method:"PUT",path:()=>"/links/bulk/",body:({editedUrl:t})=>({bulk:{action:"updateLink",meta:{link:{to:t}}}}),searchParams:({originalUrl:t,postId:e})=>({filter:`post_id:'${e}'+to:'${t}'`})});export{re as N,oe as a,ot as c,ae as g,ne as p,ie as u};
@@ -1,4 +1,4 @@
1
- import{aA as e,eg as M0,aM as v0,T as m0,bs as _0,eh as g0,ei as L0,$ as x0,be as w0,bi as f0,C as I0,ej as C0,cX as b0,ek as c,el as r,cE as N0,bN as k,x as $0,em as q0,bj as p,cz as z0,aT as S0,bq as A0,cC as H0,en as j0,ab as V0,eo as P0,ep as B0,c$ as F0,d0 as D0,eq as R0,er as T0,es as s,cR as l,et as U0,cs as O0,eu as G0,cp as Z0,ev as W0,ew as E0,ex as X0,ey as u,cj as K0,c6 as Q0,ao as J0,ez as M,bK as Y0,eA as v,eB as m,c7 as _,ci as ea,X as aa,eC as q_}from"./index-f5Lv9kLb.js";import{A as ca}from"./a-large-small-CgWPeKpi.js";import{A as ta,C as oa,G as da,M as na,P as g,S as ha,a as ia,T as ya,U as ra,W as ka}from"./wallet-cards-CSdWOmJE.js";import{A as pa}from"./at-sign-BottTo2X.js";import{a as sa,C as la,c as L,D as ua,f as Ma,E as va,b as ma,d as x,F as _a,L as w,e as ga,M as La}from"./message-square-text-BxquqPhA.js";import{C as xa}from"./copy-aC0WUVtq.js";import{H as wa}from"./hash-BcaWmkw5.js";import{I as fa}from"./inbox-D9hID-rO.js";import{M as Ia}from"./minus-Ziy4LSYD.js";import{P as Ca,T as ba}from"./tags-DV2SSdMK.js";import{R as Na,S as $a}from"./square-BEpRc_fY.js";import{R as qa,U as f}from"./user-round-check-DYkrjHxF.js";import{R as za}from"./repeat-CN4fiG5H.js";import{R as Sa}from"./reply-BfWgvH7y.js";import{S as Aa}from"./sprout-BKiwQsGn.js";import{T as Ha}from"./trash-CpnxYen-.js";/**
1
+ import{aA as e,eg as M0,aM as v0,T as m0,bs as _0,eh as g0,ei as L0,$ as x0,be as w0,bi as f0,C as I0,ej as C0,cX as b0,ek as c,el as r,cE as N0,bN as k,x as $0,em as q0,bj as p,cz as z0,aT as S0,bq as A0,cC as H0,en as j0,ab as V0,eo as P0,ep as B0,c$ as F0,d0 as D0,eq as R0,er as T0,es as s,cR as l,et as U0,cs as O0,eu as G0,cp as Z0,ev as W0,ew as E0,ex as X0,ey as u,cj as K0,c6 as Q0,ao as J0,ez as M,bK as Y0,eA as v,eB as m,c7 as _,ci as ea,X as aa,eC as q_}from"./index-CMTzNTew.js";import{A as ca}from"./a-large-small-C5mgFBRg.js";import{A as ta,C as oa,G as da,M as na,P as g,S as ha,a as ia,T as ya,U as ra,W as ka}from"./wallet-cards-KmOh29LP.js";import{A as pa}from"./at-sign-Bz-SU-S_.js";import{a as sa,C as la,c as L,D as ua,f as Ma,E as va,b as ma,d as x,F as _a,L as w,e as ga,M as La}from"./message-square-text-cV8O_qKq.js";import{C as xa}from"./copy-Bpq3uhnh.js";import{H as wa}from"./hash-Bc1e38oH.js";import{I as fa}from"./inbox-BcZNBNhk.js";import{M as Ia}from"./minus-NvnQTlW7.js";import{P as Ca,T as ba}from"./tags-CLxXZlOO.js";import{R as Na,S as $a}from"./square-tZp0_n7e.js";import{R as qa,U as f}from"./user-round-check-B6j98D6d.js";import{R as za}from"./repeat-DgH39UKE.js";import{R as Sa}from"./reply-DAaNxiy8.js";import{S as Aa}from"./sprout-C3cc0c-K.js";import{T as Ha}from"./trash-u5BxolyH.js";/**
2
2
  * @license lucide-react v0.553.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as a}from"./index-f5Lv9kLb.js";const t=({children:e,...s})=>a.jsx("div",{className:"size-full",children:a.jsx("div",{className:"relative mx-auto flex h-full max-w-page flex-col",...s,children:e})});export{t as M};
1
+ import{j as a}from"./index-CMTzNTew.js";const t=({children:e,...s})=>a.jsx("div",{className:"size-full",children:a.jsx("div",{className:"relative mx-auto flex h-full max-w-page flex-col",...s,children:e})});export{t as M};
@@ -1,4 +1,4 @@
1
- import{aA as e}from"./index-f5Lv9kLb.js";/**
1
+ import{aA as e}from"./index-CMTzNTew.js";/**
2
2
  * @license lucide-react v0.553.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{aA as o}from"./index-f5Lv9kLb.js";/**
1
+ import{aA as o}from"./index-CMTzNTew.js";/**
2
2
  * @license lucide-react v0.553.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.