ghost 6.68.0 → 6.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/components/ghost-storage-base-3.0.1.tgz +0 -0
  2. package/components/tryghost-adapter-base-cache-0.2.1.tgz +0 -0
  3. package/components/tryghost-adapter-base-scheduling-0.2.5.tgz +0 -0
  4. package/components/tryghost-adapter-base-sso-0.1.4.tgz +0 -0
  5. package/components/tryghost-app-contracts-0.0.0.tgz +0 -0
  6. package/components/tryghost-checkout-0.0.0.tgz +0 -0
  7. package/components/tryghost-i18n-0.0.0.tgz +0 -0
  8. package/components/tryghost-kg-card-factory-5.2.6.tgz +0 -0
  9. package/components/tryghost-kg-clean-basic-html-4.3.6.tgz +0 -0
  10. package/components/tryghost-kg-converters-1.2.6.tgz +0 -0
  11. package/components/tryghost-kg-default-cards-10.3.7.tgz +0 -0
  12. package/components/tryghost-kg-default-nodes-2.2.3.tgz +0 -0
  13. package/components/tryghost-kg-default-transforms-1.3.6.tgz +0 -0
  14. package/components/tryghost-kg-html-to-lexical-1.4.1.tgz +0 -0
  15. package/components/tryghost-kg-lexical-html-renderer-1.5.1.tgz +0 -0
  16. package/components/tryghost-kg-markdown-html-renderer-7.2.7.tgz +0 -0
  17. package/components/tryghost-kg-utils-1.1.6.tgz +0 -0
  18. package/components/tryghost-metafield-csv-0.0.0.tgz +0 -0
  19. package/components/tryghost-metafield-types-0.1.1.tgz +0 -0
  20. package/core/boot.js +6 -0
  21. package/core/built/admin/assets/{about-D_nwtf7X.js → about-Dxp30cNg.js} +1 -1
  22. package/core/built/admin/assets/{account-migration-BaecWw1T.js → account-migration-D05akW4q.js} +1 -1
  23. package/core/built/admin/assets/activitypub/{account-migration-4saTEZ6p.js → account-migration-BmiwuzXI.js} +6 -6
  24. package/core/built/admin/assets/activitypub/activitypub.js +2 -2
  25. package/core/built/admin/assets/activitypub/{bluesky-sharing-BHBNuZQH.js → bluesky-sharing-B1fzMdFb.js} +6 -6
  26. package/core/built/admin/assets/activitypub/{content-formatters-DVx9YktY.js → content-formatters-G0qBT5QE.js} +3 -3
  27. package/core/built/admin/assets/activitypub/{domain-rAmlMXBC.js → domain-B3UtdA1m.js} +7 -7
  28. package/core/built/admin/assets/activitypub/{edit-profile-CXYL4ZrS.js → edit-profile-9EodzviR.js} +4 -4
  29. package/core/built/admin/assets/activitypub/{explore-dqpEx3GA.js → explore-DmwPdxHI.js} +8 -8
  30. package/core/built/admin/assets/activitypub/{feed-Cb-wYNw9.js → feed-yauqnu7A.js} +5 -5
  31. package/core/built/admin/assets/activitypub/{field-JxegcPt6.js → field-CsrMjbg2.js} +2 -2
  32. package/core/built/admin/assets/activitypub/{inbox-2hXDJBn5.js → inbox-DV3RrpFH.js} +7 -7
  33. package/core/built/admin/assets/activitypub/{label-DRQzZ7lb.js → label-DPs40NLn.js} +2 -2
  34. package/core/built/admin/assets/activitypub/layout-CvOhndCA.js +1 -0
  35. package/core/built/admin/assets/activitypub/{moderation-BnYKcTXY.js → moderation-DGa6hVNH.js} +7 -7
  36. package/core/built/admin/assets/activitypub/{note-C6ucS3Wu.js → note-BVL6LVHF.js} +5 -5
  37. package/core/built/admin/assets/activitypub/{notifications-DgBW9wEC.js → notifications-CRUu_uMC.js} +5 -5
  38. package/core/built/admin/assets/activitypub/{onboarding-DGu6yG4L.js → onboarding-Dpm-nLkQ.js} +2 -2
  39. package/core/built/admin/assets/activitypub/{onboarding-Bq3fNf_a.js → onboarding-KtpJA-xb.js} +2 -2
  40. package/core/built/admin/assets/activitypub/{preferences-C3jI1eVN.js → preferences-CdFuVqIt.js} +7 -7
  41. package/core/built/admin/assets/activitypub/{profile-Cn3vRb5Z.js → profile-KnNAoHYu.js} +8 -8
  42. package/core/built/admin/assets/activitypub/{routes-DbrwlS9h.js → routes-BRndai50.js} +26 -26
  43. package/core/built/admin/assets/activitypub/{settings-D0BALDQu.js → settings-DU7ftJ8w.js} +4 -4
  44. package/core/built/admin/assets/activitypub/{site-BFGj8HuQ.js → site-D1ZYV3AT.js} +2 -2
  45. package/core/built/admin/assets/activitypub/{step-1-CaoPg0a5.js → step-1-9IHheE78.js} +4 -4
  46. package/core/built/admin/assets/activitypub/{step-3-5k0TkyC9.js → step-3-DBERnfa-.js} +3 -3
  47. package/core/built/admin/assets/activitypub/{tabs-BV4JU7Vg.js → tabs-CvkwStij.js} +4 -4
  48. package/core/built/admin/assets/activitypub/{topic-filter-71sX5nfN.js → topic-filter-CS0Jsf_4.js} +2 -2
  49. package/core/built/admin/assets/activitypub/{use-activity-pub-queries-B3srUuKt.js → use-activity-pub-queries-CGgtQrxL.js} +2 -2
  50. package/core/built/admin/assets/activitypub/{use-reply-chain-data-Cl6bGNy7.js → use-reply-chain-data-CLdUpx1t.js} +4 -4
  51. package/core/built/admin/assets/activitypub/{users-EcSPpds5.js → users-CyoMXlwX.js} +11 -3
  52. package/core/built/admin/assets/{add-integration-modal-DBFzeAUT.js → add-integration-modal-BVg-ec8i.js} +1 -1
  53. package/core/built/admin/assets/{add-newsletter-modal-CYJe-dTC.js → add-newsletter-modal-Du6th521.js} +1 -1
  54. package/core/built/admin/assets/{add-recommendation-modal-CgwGKH-_.js → add-recommendation-modal-BiCJ0-q5.js} +1 -1
  55. package/core/built/admin/assets/{analytics-CcXT_WqF.js → analytics-CQJzDDdJ.js} +1 -1
  56. package/core/built/admin/assets/{announcement-bar-modal-Ldcg-PB-.js → announcement-bar-modal-CskyZLzT.js} +1 -1
  57. package/core/built/admin/assets/{api-BLteQZ7W.js → api-BFocMbDg.js} +2 -2
  58. package/core/built/admin/assets/{api-keys-CoeerpwI.js → api-keys-CqKJHuAV.js} +1 -1
  59. package/core/built/admin/assets/{audience-Deg9lzfk.js → audience-Dn7LuH-r.js} +1 -1
  60. package/core/built/admin/assets/{auth-layout-CRaMX7g6.js → auth-layout-VLhXgXn5.js} +1 -1
  61. package/core/built/admin/assets/{automated-emails-WcjjRkRV.js → automated-emails-D5cFl1wr.js} +1 -1
  62. package/core/built/admin/assets/{automations-CbIdX0rd.js → automations-BpweKEcq.js} +1 -1
  63. package/core/built/admin/assets/automations-DBTYwNTJ.js +1 -0
  64. package/core/built/admin/assets/{bluesky-sharing-BJMNRwnU.js → bluesky-sharing-CrfpFHQ9.js} +1 -1
  65. package/core/built/admin/assets/{chart-helpers-D-3N170i.js → chart-helpers-BSuFLd6-.js} +1 -1
  66. package/core/built/admin/assets/{chunk.524.94ab17e1199b4c3f4615.js → chunk.524.e24d68bc6253b274b726.js} +4 -4
  67. package/core/built/admin/assets/{chunk.582.6f09b19a007e2805824e.js → chunk.582.47834285406dfa1abb29.js} +6 -6
  68. package/core/built/admin/assets/{chunk.476.53b5794a67d68111e0bf.js → chunk.837.e1454abc054e1fba1fe5.js} +5 -5
  69. package/core/built/admin/assets/{code-editor-view-DhTwpxxv.js → code-editor-view-BrGe3eS4.js} +1 -1
  70. package/core/built/admin/assets/{code-editor-view-C7wXGiuv.js → code-editor-view-CY6JCXNv.js} +1 -1
  71. package/core/built/admin/assets/{color-picker-field-Cjz2zY11.js → color-picker-field-DGe9HH6W.js} +1 -1
  72. package/core/built/admin/assets/{comments-DY-VLVxh.js → comments-iRbF6XiJ.js} +1 -1
  73. package/core/built/admin/assets/{config-B3HuCo0y.js → config-CRAZ4Civ.js} +1 -1
  74. package/core/built/admin/assets/{content-api-modal-2jt-jWiM.js → content-api-modal-B-XRbzeW.js} +1 -1
  75. package/core/built/admin/assets/{content-formatters-VqvNA7Pv.js → content-formatters-C08JJbUJ.js} +2 -2
  76. package/core/built/admin/assets/{context-menu-BWbk9nd5.js → context-menu-BxGXsgQO.js} +1 -1
  77. package/core/built/admin/assets/{custom-field-type-option-CIatEwIN.js → custom-field-type-option-C8Nt4X6x.js} +1 -1
  78. package/core/built/admin/assets/{custom-integration-modal-Cw0w2Tb3.js → custom-integration-modal-DzI16qjN.js} +1 -1
  79. package/core/built/admin/assets/{date-range-select-O-uA-BRV.js → date-range-select-BZqsYsGx.js} +1 -1
  80. package/core/built/admin/assets/{design-and-theme-modal-BLjNHRYN.js → design-and-theme-modal-1ty_KEkM.js} +2 -2
  81. package/core/built/admin/assets/{dist-DJhCsld6.js → dist-B4jqKAG5.js} +1 -1
  82. package/core/built/admin/assets/{dist-5Ol0DC_t.js → dist-Bmo2j_KH.js} +1 -1
  83. package/core/built/admin/assets/{dist-p52UDdoR.js → dist-C-_aTlvJ.js} +1 -1
  84. package/core/built/admin/assets/{dist-CcN1a5SB.js → dist-CWHIoxYn.js} +1 -1
  85. package/core/built/admin/assets/{dist-BcfsaiCV.js → dist-Cp2M5TzT.js} +1 -1
  86. package/core/built/admin/assets/{dist-kjTYGivb.js → dist-DQAAPbtg.js} +1 -1
  87. package/core/built/admin/assets/{dist-IMek6Acg.js → dist-DyO279y5.js} +1 -1
  88. package/core/built/admin/assets/{domain-DaPAeOFF.js → domain-DiFl_Z1A.js} +1 -1
  89. package/core/built/admin/assets/{edit-profile-BKO5qonH.js → edit-profile-PrLbJV3P.js} +1 -1
  90. package/core/built/admin/assets/editor-BBJDJL8U.js +8 -0
  91. package/core/built/admin/assets/{editor-screen-l4BUPE2o.js → editor-screen-nblrp808.js} +3 -3
  92. package/core/built/admin/assets/{email-previews-B1Ska3CF.js → email-previews-BKJxrW29.js} +1 -1
  93. package/core/built/admin/assets/{email-sending-status-provider-Bjn5KTy2.js → email-sending-status-provider-DB9ylBWk.js} +1 -1
  94. package/core/built/admin/assets/{emails-qxNbhO6X.js → emails-8YiSmC2X.js} +1 -1
  95. package/core/built/admin/assets/{embed-signup-form-modal-DSgds6Js.js → embed-signup-form-modal-CZmbYKfd.js} +1 -1
  96. package/core/built/admin/assets/{error-boundary-CJODV8Rg.js → error-boundary-DrxPFFO-.js} +1 -1
  97. package/core/built/admin/assets/{esm-CNLDtBMc.js → esm-_iCUCvbN.js} +1 -1
  98. package/core/built/admin/assets/{explore-C6V_JpUZ.js → explore-C69LSRVg.js} +1 -1
  99. package/core/built/admin/assets/{feed-B_TyFn9E.js → feed-B_0m7WhZ.js} +1 -1
  100. package/core/built/admin/assets/{feedback-gKOzmiGt.js → feedback-DW1DXdzT.js} +1 -1
  101. package/core/built/admin/assets/{filters-Bf6E1qAP.js → filters-Dr3vMnjZ.js} +1 -1
  102. package/core/built/admin/assets/{filters-DhsiEotO.js → filters-M2sRWPoF.js} +1 -1
  103. package/core/built/admin/assets/{first-promoter-modal-LmTXHr-z.js → first-promoter-modal-D43R2zhI.js} +1 -1
  104. package/core/built/admin/assets/{focus-koenig-editor-on-bottom-click-BAcLNJti.js → focus-koenig-editor-on-bottom-click-BzS8jiJf.js} +1 -1
  105. package/core/built/admin/assets/fullscreen-close-button-CWSp-MsK.js +1 -0
  106. package/core/built/admin/assets/{ghost-63bc7da4336844000c523a5a0819531e.js → ghost-ffde29676517b768b1aef5ec8d492418.js} +93 -96
  107. package/core/built/admin/assets/{gift-link-modal-uZtwRHzl.js → gift-link-modal-CNE7dfPD.js} +1 -1
  108. package/core/built/admin/assets/{gift-links-HVqaXear.js → gift-links-lQ7H_D8Z.js} +1 -1
  109. package/core/built/admin/assets/global-search-modal-DzRM3aON.js +1 -0
  110. package/core/built/admin/assets/{growth-BlPW4DHj.js → growth-CAi_5HIf.js} +1 -1
  111. package/core/built/admin/assets/{growth-CflU3vR0.js → growth-CMHbTWKE.js} +1 -1
  112. package/core/built/admin/assets/history-modal-BIz13vhr.js +1 -0
  113. package/core/built/admin/assets/{hooks-C-BDQ6Hs.js → hooks-0r7qxGEo.js} +2 -2
  114. package/core/built/admin/assets/{html-field-D6G0G1d_.js → html-field-vTe2q1be.js} +1 -1
  115. package/core/built/admin/assets/{iframe-buffering-DW-Axhvc.js → iframe-buffering-cu-yK7NA.js} +1 -1
  116. package/core/built/admin/assets/{images-BSUWxquu.js → images-DTZtaIAr.js} +1 -1
  117. package/core/built/admin/assets/{inbox-BkU3sg13.js → inbox-BHfpmmzn.js} +1 -1
  118. package/core/built/admin/assets/{index-z8-nEVdb.css → index-B02LJqc8.css} +1 -1
  119. package/core/built/admin/assets/{index-CuDhPtkB.js → index-RuRs_qGS.js} +3 -3
  120. package/core/built/admin/assets/{index.es-H6HOI4DG.js → index.es-rdb1skp_.js} +1 -1
  121. package/core/built/admin/assets/{integrations-BRo5DwA5.js → integrations-Deg9-u8X.js} +1 -1
  122. package/core/built/admin/assets/{invite-user-modal-CydBOG99.js → invite-user-modal-C4DeNcoO.js} +1 -1
  123. package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +10483 -10455
  124. package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +131 -131
  125. package/core/built/admin/assets/{koenig-lexical-CG_eb4dw.js → koenig-lexical-BhXu1__-.js} +96 -96
  126. package/core/built/admin/assets/{kpi-helpers-CyRx_yD6.js → kpi-helpers-H-Hl6h7h.js} +1 -1
  127. package/core/built/admin/assets/{kpi-tabs-V1_Nu9sh.js → kpi-tabs-k4A9-imn.js} +1 -1
  128. package/core/built/admin/assets/{label-picker-GTIIlBQ6.js → label-picker-DaivLdMw.js} +1 -1
  129. package/core/built/admin/assets/{labels-BVGLgdAj.js → labels-BCj6D_nl.js} +1 -1
  130. package/core/built/admin/assets/{layout-CG58T6P7.js → layout-_g2xhB0L.js} +1 -1
  131. package/core/built/admin/assets/{lib-Dkic19kH.js → lib-Bre6UXdJ.js} +2 -2
  132. package/core/built/admin/assets/{links-jD8AkkIu.js → links-C8RnEJVJ.js} +1 -1
  133. package/core/built/admin/assets/{member-activity-JggQ0VNQ.js → member-activity-DNJPUW5X.js} +1 -1
  134. package/core/built/admin/assets/{member-activity-feed-BBeCZmLM.js → member-activity-feed-CvKEetHS.js} +1 -1
  135. package/core/built/admin/assets/{member-custom-fields-DPsyP1Hq.js → member-custom-fields-CBdiwPD9.js} +1 -1
  136. package/core/built/admin/assets/{member-detail-D7qugPN7.js → member-detail-BIoyIIsl.js} +1 -1
  137. package/core/built/admin/assets/{members-Cj_BUZUL.js → members-CH6KeXQc.js} +1 -1
  138. package/core/built/admin/assets/{members-alDWPKDd.js → members-Dd9RczFK.js} +1 -1
  139. package/core/built/admin/assets/{migrate-2uKKakld.js → migrate-CVQIWsXO.js} +1 -1
  140. package/core/built/admin/assets/{moderation-pCUKsxbF.js → moderation-OtjZoNOc.js} +1 -1
  141. package/core/built/admin/assets/{navigation-modal-D0FBI5-m.js → navigation-modal-Bl02NjtO.js} +1 -1
  142. package/core/built/admin/assets/{newsletter-4urgCSR_.js → newsletter-BXyT7o69.js} +1 -1
  143. package/core/built/admin/assets/{newsletter-detail-modal-Chh1jvjH.js → newsletter-detail-modal-DxuKNu_1.js} +1 -1
  144. package/core/built/admin/assets/{newsletter-emails-CzVCiC2K.js → newsletter-emails-DicgmnMU.js} +1 -1
  145. package/core/built/admin/assets/{newsletters-eRQTtOBH.js → newsletters-By25FmUs.js} +1 -1
  146. package/core/built/admin/assets/{newsletters-BMEgeL2l.js → newsletters-CACa0VCx.js} +1 -1
  147. package/core/built/admin/assets/{note-dqog4Bua.js → note-CF4LrSmR.js} +1 -1
  148. package/core/built/admin/assets/{notifications-rcEVv-gx.js → notifications-BmHJmqIJ.js} +1 -1
  149. package/core/built/admin/assets/{offers-hV7zBtsI.js → offers-Df9Jzay5.js} +1 -1
  150. package/core/built/admin/assets/{offers-container-modal-DgZgkMsA.js → offers-container-modal-R0HRwugm.js} +1 -1
  151. package/core/built/admin/assets/{onboarding-4TxbZb90.js → onboarding-Bpo1yTzA.js} +1 -1
  152. package/core/built/admin/assets/{onboarding-SGscZLIc.js → onboarding-bMq3R8jB.js} +1 -1
  153. package/core/built/admin/assets/{onboarding-route-B3mN9l7E.js → onboarding-route-flf5YWti.js} +1 -1
  154. package/core/built/admin/assets/{overview-D4EanvDG.js → overview-C9WvmmOC.js} +1 -1
  155. package/core/built/admin/assets/{overview-CCwbHet8.js → overview-CDkHdIJM.js} +1 -1
  156. package/core/built/admin/assets/{page-header-Baymg6VR.js → page-header-CxTb0je5.js} +1 -1
  157. package/core/built/admin/assets/{pagemenu--UL0gW1x.js → pagemenu-DXr_U43J.js} +1 -1
  158. package/core/built/admin/assets/{pages-Cbq1M2kG.js → pages-Bm-zFXyP.js} +1 -1
  159. package/core/built/admin/assets/pages-route-LCw94aIO.js +1 -0
  160. package/core/built/admin/assets/{pintura-modal-D6HGlnJa.js → pintura-modal-B5sIPWcj.js} +1 -1
  161. package/core/built/admin/assets/{portal-modal-Bhqsevn_.js → portal-modal-DjOO3Unv.js} +1 -1
  162. package/core/built/admin/assets/{post-analytics-header-DX9fETdi.js → post-analytics-header-D2anehCj.js} +1 -1
  163. package/core/built/admin/assets/{post-analytics-provider-U7RtOle1.js → post-analytics-provider-BLQvV5C0.js} +1 -1
  164. package/core/built/admin/assets/{post-analytics-BJWDtC3a.js → post-analytics-wdu9gq8u.js} +1 -1
  165. package/core/built/admin/assets/{post-debug-D1b8Amju.js → post-debug-BnABXMfD.js} +1 -1
  166. package/core/built/admin/assets/{posts-Lg-p_ZHg.js → posts-CftunZgV.js} +1 -1
  167. package/core/built/admin/assets/{posts-list-screen-CmsW18e_.js → posts-list-screen-CwXmvY68.js} +2 -2
  168. package/core/built/admin/assets/posts-route-J74fMhCe.js +1 -0
  169. package/core/built/admin/assets/{preferences-CMlDfHfa.js → preferences-DFhf_pJF.js} +1 -1
  170. package/core/built/admin/assets/{preview-modal-D8om_cQv.js → preview-modal-BrZza3R_.js} +1 -1
  171. package/core/built/admin/assets/{profile-yFsIoZom.js → profile-CS4fP60N.js} +1 -1
  172. package/core/built/admin/assets/{radio-group-DwgLjwWB.js → radio-group-Xfp-frJz.js} +1 -1
  173. package/core/built/admin/assets/{referrers-DzP5QoXL.js → referrers-C8LJlrBm.js} +1 -1
  174. package/core/built/admin/assets/{reload-CZ-KP3IQ.js → reload-D0fnKoCm.js} +1 -1
  175. package/core/built/admin/assets/{reset-CCAa8v35.js → reset-CB-ATcLE.js} +1 -1
  176. package/core/built/admin/assets/{restore-screen-Ba0i2Y1K.js → restore-screen-EaZf4V8j.js} +1 -1
  177. package/core/built/admin/assets/{routes-DrnhmKTT.js → routes-DKfpFMfF.js} +2 -2
  178. package/core/built/admin/assets/search-index-sM3OjEUl.js +1 -0
  179. package/core/built/admin/assets/settings-BWzod-5X.js +4 -0
  180. package/core/built/admin/assets/{settings-lqWkfSmT.js → settings-DvgngbFt.js} +1 -1
  181. package/core/built/admin/assets/{setup-BopRPuaM.js → setup-CdHAchG5.js} +1 -1
  182. package/core/built/admin/assets/{signin-e8NgsU9M.js → signin-CUEEme88.js} +1 -1
  183. package/core/built/admin/assets/{signin-verify-CHkFJevb.js → signin-verify-CYRphSrj.js} +1 -1
  184. package/core/built/admin/assets/{signout-DRvQZuWa.js → signout-kLCJau9G.js} +1 -1
  185. package/core/built/admin/assets/{signup-DQHi7jZz.js → signup-J2Vjq7Gt.js} +1 -1
  186. package/core/built/admin/assets/{slack-modal-BuGESzgn.js → slack-modal-DKamr_94.js} +1 -1
  187. package/core/built/admin/assets/source-icon-DqBCPDIK.js +1 -0
  188. package/core/built/admin/assets/{stats-CHOikfoP.js → stats-BL_FJ7Ns.js} +1 -1
  189. package/core/built/admin/assets/{stats-view-DQZzKeEz.js → stats-view-BwbdkdOQ.js} +1 -1
  190. package/core/built/admin/assets/{step-1-C8XwHcKt.js → step-1-CLYhNmG9.js} +1 -1
  191. package/core/built/admin/assets/{step-2-BXaXAdwY.js → step-2-B2ujMlpa.js} +1 -1
  192. package/core/built/admin/assets/{step-3-DytbqpJi.js → step-3-DoaTWqqj.js} +1 -1
  193. package/core/built/admin/assets/{stripe-connect-modal-BhudjSeO.js → stripe-connect-modal-DytxH9DJ.js} +1 -1
  194. package/core/built/admin/assets/{tabs-CDb_TceL.js → tabs-fHs3A8WC.js} +1 -1
  195. package/core/built/admin/assets/{tag-detail-V72Zlro8.js → tag-detail-BcO46Ids.js} +2 -2
  196. package/core/built/admin/assets/{tag-picker-M3fC-yOF.js → tag-picker-Ct6NeqWK.js} +1 -1
  197. package/core/built/admin/assets/{tags-CXqE2A2T.js → tags-C1h3wCpW.js} +1 -1
  198. package/core/built/admin/assets/{tags-ZhqbPPc6.js → tags-OlmRJ6Ps.js} +1 -1
  199. package/core/built/admin/assets/{testimonials-modal-Cn8gvIFA.js → testimonials-modal-DMsQzSCB.js} +1 -1
  200. package/core/built/admin/assets/{themes-pOHHvnkt.js → themes-CPJSMo_W.js} +1 -1
  201. package/core/built/admin/assets/{tier-detail-modal-CeDla1OO.js → tier-detail-modal-DssSmhkF.js} +1 -1
  202. package/core/built/admin/assets/{tiers-D7aGzwZ-.js → tiers-DlvS8D6_.js} +1 -1
  203. package/core/built/admin/assets/{toggle-group-D7ly9OGa.js → toggle-group-BFWCtH3p.js} +1 -1
  204. package/core/built/admin/assets/{topic-filter-DQ3pr6AB.js → topic-filter-DAJ-DFPb.js} +1 -1
  205. package/core/built/admin/assets/{transistor-modal-4_Yx2vRo.js → transistor-modal-CtyFRsD0.js} +1 -1
  206. package/core/built/admin/assets/{unsplash-modal-Dm7R4k4k.js → unsplash-modal-DHnnTPmZ.js} +1 -1
  207. package/core/built/admin/assets/{use-activity-pub-queries-Gy9_locM.js → use-activity-pub-queries-BgR1USeY.js} +1 -1
  208. package/core/built/admin/assets/{use-analytics-data-oJ2o0pSS.js → use-analytics-data-Byf83QE-.js} +1 -1
  209. package/core/built/admin/assets/{use-availability-BqL7Dvn_.js → use-availability-CgZC6L_V.js} +1 -1
  210. package/core/built/admin/assets/{use-check-theme-limit-error-CxC9uKJz.js → use-check-theme-limit-error-DjprzKAN.js} +1 -1
  211. package/core/built/admin/assets/use-definitions-CJuXLSob.js +1 -0
  212. package/core/built/admin/assets/{use-email-sending-status-BFAg5TIb.js → use-email-sending-status-7kopNcza.js} +1 -1
  213. package/core/built/admin/assets/{use-filter-params-BOo9yZ5j.js → use-filter-params-DQ7uX-Zp.js} +1 -1
  214. package/core/built/admin/assets/{use-filterable-api-BnNLaS_r.js → use-filterable-api-CDrrxoGD.js} +1 -1
  215. package/core/built/admin/assets/{use-growth-stats-BS62uyyn.js → use-growth-stats-CCpnBgqS.js} +1 -1
  216. package/core/built/admin/assets/{use-host-limits-CNh4AAEs.js → use-host-limits-BZx7rzRI.js} +1 -1
  217. package/core/built/admin/assets/{use-limiter-DPKxoO1_.js → use-limiter-gF219BEg.js} +1 -1
  218. package/core/built/admin/assets/{use-pintura-config-CyVO62ZV.js → use-pintura-config-D-pmGkn2.js} +1 -1
  219. package/core/built/admin/assets/{use-pintura-editor-B5VBPbiO.js → use-pintura-editor-D_4zhlGE.js} +1 -1
  220. package/core/built/admin/assets/{use-post-referrers-nUPolSk7.js → use-post-referrers-Bc8eq4uy.js} +1 -1
  221. package/core/built/admin/assets/{use-post-top-links-DCH4eO11.js → use-post-top-links-DjltnQuI.js} +1 -1
  222. package/core/built/admin/assets/{use-reply-chain-data-UMzFbDvh.js → use-reply-chain-data-BiV3Cl0B.js} +1 -1
  223. package/core/built/admin/assets/use-sending-eta-gE-2B0Zw.js +1 -0
  224. package/core/built/admin/assets/{use-setting-group-Bf3vY8br.js → use-setting-group-YP84CqrJ.js} +1 -1
  225. package/core/built/admin/assets/{use-staff-users-CcQzTHqH.js → use-staff-users-CnwfdSx1.js} +1 -1
  226. package/core/built/admin/assets/{use-tinybird-query-CPy5ipAP.js → use-tinybird-query-BYbl5gKY.js} +1 -1
  227. package/core/built/admin/assets/{use-tinybird-token-DVNHuhu_.js → use-tinybird-token-Dz37zvb7.js} +1 -1
  228. package/core/built/admin/assets/{use-unsaved-changes-guard-Bvcp_Rny.js → use-unsaved-changes-guard-BkCuSlvU.js} +1 -1
  229. package/core/built/admin/assets/{use-upgrade-route-Bsxw9ZLN.js → use-upgrade-route-C-V-Xfak.js} +1 -1
  230. package/core/built/admin/assets/{use-url-input-DPJ592FB.js → use-url-input-BeYKYMGh.js} +1 -1
  231. package/core/built/admin/assets/{user-detail-modal-6UY6GdNy.js → user-detail-modal-CSoj7vOC.js} +1 -1
  232. package/core/built/admin/assets/{users-CzgQKbfO.js → users-CKJaAxEJ.js} +1 -1
  233. package/core/built/admin/assets/{view-site-DA_-zfGq.js → view-site-SpMx4P7G.js} +1 -1
  234. package/core/built/admin/assets/{web-Cq5YiD2r.js → web-CZf-k4F0.js} +1 -1
  235. package/core/built/admin/assets/{web-DqFIrOxt.js → web-uAqgYPK9.js} +1 -1
  236. package/core/built/admin/assets/{zapier-modal-DgqU-OBB.js → zapier-modal-DENbgTyE.js} +1 -1
  237. package/core/built/admin/index.html +24 -24
  238. package/core/frontend/helpers/color_to_rgba.js +15 -13
  239. package/core/frontend/helpers/facebook_url.js +27 -15
  240. package/core/frontend/services/assets-minification/card-assets.js +1 -1
  241. package/core/frontend/services/helpers/register-ghost-helpers.js +2 -2
  242. package/core/server/api/endpoints/app-installations.js +36 -0
  243. package/core/server/api/endpoints/automations.js +1 -1
  244. package/core/server/api/endpoints/index.js +4 -0
  245. package/core/server/data/exporter/table-lists.js +2 -0
  246. package/core/server/data/migrations/versions/6.69/2026-10-07-06-20-43-add-app-installation-permissions.js +40 -0
  247. package/core/server/data/schema/fixtures/fixtures.json +21 -0
  248. package/core/server/data/schema/in-development.js +1 -1
  249. package/core/server/data/schema/schema.js +53 -0
  250. package/core/server/lib/after-commit.js +20 -0
  251. package/core/server/models/action.js +6 -0
  252. package/core/server/services/app-installations/actions.js +44 -0
  253. package/core/server/services/app-installations/codec.js +20 -0
  254. package/core/server/services/app-installations/index.js +42 -0
  255. package/core/server/services/app-installations/schema.js +52 -0
  256. package/core/server/services/app-installations/service.js +160 -0
  257. package/core/server/services/automations/README.md +3 -3
  258. package/core/server/services/automations/automations-api.js +1 -1
  259. package/core/server/services/comments/comments-service-emails.js +8 -6
  260. package/core/server/services/email-service/README.md +16 -0
  261. package/core/server/services/email-service/email-service-wrapper.js +1 -0
  262. package/core/server/services/email-service/email-service.js +94 -53
  263. package/core/server/services/email-service/sending-status-serializers.js +4 -1
  264. package/core/server/services/email-service/sending-status-service.js +13 -0
  265. package/core/server/services/email-service/sending-status.js +12 -1
  266. package/core/server/services/members/members-api/repositories/member-repository.js +5 -23
  267. package/core/server/services/posts/post-email-handler.js +61 -28
  268. package/core/server/services/posts/posts-service.js +27 -2
  269. package/core/server/services/service-inventory.yaml +93 -7
  270. package/core/server/services/stats/stats-service.js +1 -5
  271. package/core/server/services/tinybird-sync/index.js +0 -3
  272. package/core/server/services/tinybird-sync/tinybird-sync-service.js +2 -6
  273. package/core/server/web/api/endpoints/admin/routes.js +25 -12
  274. package/core/shared/labs.js +4 -6
  275. package/package.json +11 -10
  276. package/pnpm-lock.yaml +112 -100
  277. package/pnpm-workspace.yaml +14 -12
  278. package/components/ghost-storage-base-3.0.0.tgz +0 -0
  279. package/components/tryghost-adapter-base-cache-0.2.0.tgz +0 -0
  280. package/components/tryghost-checkout-0.0.1.tgz +0 -0
  281. package/components/tryghost-kg-card-factory-5.2.4.tgz +0 -0
  282. package/components/tryghost-kg-clean-basic-html-4.3.4.tgz +0 -0
  283. package/components/tryghost-kg-converters-1.2.5.tgz +0 -0
  284. package/components/tryghost-kg-default-transforms-1.3.4.tgz +0 -0
  285. package/components/tryghost-kg-html-to-lexical-1.4.0.tgz +0 -0
  286. package/components/tryghost-kg-markdown-html-renderer-7.2.6.tgz +0 -0
  287. package/components/tryghost-kg-utils-1.1.4.tgz +0 -0
  288. package/components/tryghost-metafield-csv-0.0.1.tgz +0 -0
  289. package/core/built/admin/assets/activitypub/layout-QTbY0t8e.js +0 -1
  290. package/core/built/admin/assets/automations-DVToctfJ.js +0 -1
  291. package/core/built/admin/assets/editor-CMXR0YvR.js +0 -8
  292. package/core/built/admin/assets/fullscreen-close-button-DXssPeDB.js +0 -1
  293. package/core/built/admin/assets/global-search-modal-C8LVJmiz.js +0 -1
  294. package/core/built/admin/assets/history-modal-parBtjpz.js +0 -1
  295. package/core/built/admin/assets/pages-route-CDk3V9rq.js +0 -1
  296. package/core/built/admin/assets/posts-route-CexHhklY.js +0 -1
  297. package/core/built/admin/assets/settings-xqakrAWa.js +0 -4
  298. package/core/built/admin/assets/source-icon-BjVangBd.js +0 -1
  299. package/core/built/admin/assets/use-definitions-DMVU3mTG.js +0 -1
  300. package/core/built/admin/assets/use-sending-eta-BsnKdQhv.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-p52UDdoR.js","./dist-tI811Kyl.js","./dist-DJhCsld6.js","./dist-5Ol0DC_t.js","./react-C9lG_SsT.js","./dist-CcN1a5SB.js"])))=>i.map(i=>d[i]);
2
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`db206abf-84ba-4120-808f-23bca7a38f17`,e._sentryDebugIdIdentifier=`sentry-dbid-db206abf-84ba-4120-808f-23bca7a38f17`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./react-dom-t7VxfrkA.js";import{r}from"./framework-provider-CIvHFnik.js";import{g as i}from"./hooks-C-BDQ6Hs.js";import{t as a}from"./jsx-runtime-Bm2_KH-0.js";import{n as o}from"./dist-pogVoW2G.js";import{a as s,i as c,n as l,o as u}from"./tags-ZhqbPPc6.js";import{t as d}from"./preload-helper-Ba4JejZL.js";import{h as f,n as p}from"./chunk-OB3PAWPO-D3muQBsq.js";import{a as m}from"./router-provider-Cf-bcYZr.js";import{H as h,L as g,r as _}from"./shade-provider-DvrXKKQZ.js";import{t as v}from"./box-BOIwAOVT.js";import{t as y}from"./container-DakAbO79.js";import{t as b}from"./grid-BYJO9x_v.js";import{t as x}from"./inline-Qoyy4r2g.js";import{t as S}from"./stack-C3OmgpUv.js";import{i as C,n as w,r as T,t as E}from"./accordion-BB5V0RD1.js";import{D,E as ee,Nn as te,Pn as ne,Rt as O,X as k,ct as A,gn as j,k as M,nn as N,nt as P,t as F,v as I,yt as L}from"./button-CTHYSI-d.js";import{t as re}from"./badge-DuMiqyUH.js";import{a as ie,i as ae,n as oe,o as se,r as ce,t as le}from"./breadcrumb-BO_Xhq8u.js";import{n as R,t as z}from"./card-Cd6xB_Ok.js";import{a as B,i as ue,n as de,o as V,r as fe,t as pe}from"./lib-Dkic19kH.js";import{a as me,i as he,o as ge,r as _e,s as ve,t as ye}from"./dialog-BO1lcy8A.js";import{a as be,i as xe,t as Se}from"./popover-r_3DwMi9.js";import{t as H}from"./label-CxXFmzcd.js";import{i as U}from"./field-DCPPrQDr.js";import{a as Ce,c as we,i as Te,n as Ee,o as W,r as G,s as De,t as K}from"./images-BSUWxquu.js";import{t as q}from"./input-BHb2A_DU.js";import{a as Oe,i as ke,n as Ae,t as je}from"./input-group-DL5EFP5r.js";import{t as Me}from"./skeleton-C1s6yr9e.js";import{n as Ne}from"./loading-indicator-DaRyGrxv.js";import{t as J}from"./page-header-Baymg6VR.js";import{i as Pe,n as Fe,r as Ie,t as Le}from"./tabs-CDb_TceL.js";import{t as Re}from"./textarea-B_rfKtjs.js";import{n as ze,t as Be}from"./x-logo-DpF1U_6M.js";import{t as Ve}from"./google-logo-IGBgqBWI.js";import{t as He}from"./dirty-confirm-dialog-CdxPMCA8.js";import{n as Ue,t as We}from"./color-picker-jiQKnLn-.js";import{Ht as Ge,Kt as Ke,ct as qe,ft as Je,g as Ye,gt as Xe,ut as Ze,v as Qe,vt as $e}from"./index-CuDhPtkB.js";import{t as et}from"./detail-page-DkWBi2i0.js";import{n as tt,t as nt}from"./use-unsaved-changes-guard-Bvcp_Rny.js";import{t as rt}from"./index.es-H6HOI4DG.js";import{t as it}from"./brand-icon-BFOhZhQt.js";var Y=e(t(),1),X=a(),at=({open:e,onOpenChange:t,tag:n,displayName:r,onPendingChange:a,allowLeaveWithUnsavedChanges:o})=>{let s=m(),l=i(),u=c(),d=n.count?.posts??0,f=Y.useRef(!0);Y.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async()=>{a(!0);try{if(await u.mutateAsync(n.id),!f.current)return;t(!1),o(),s(`/tags`)}catch(e){f.current&&l(e)}finally{f.current&&a(!1)}};return(0,X.jsx)(ye,{open:e,onOpenChange:e=>{u.isPending||t(e)},children:(0,X.jsxs)(_e,{"data-testid":`delete-tag-modal`,children:[(0,X.jsxs)(ge,{children:[(0,X.jsx)(ve,{children:`Are you sure you want to delete this tag?`}),(0,X.jsxs)(he,{children:[`You’re about to delete the tag "`,(0,X.jsx)(`strong`,{children:r}),`".`,` `,d>0&&(0,X.jsxs)(X.Fragment,{children:[`It will be removed from`,` `,(0,X.jsxs)(`span`,{"data-testid":`delete-tag-posts-count`,children:[h(d),` `,d===1?`post`:`posts`]}),`.`,` `]}),`This is permanent! We warned you, k?`]})]}),(0,X.jsxs)(me,{children:[(0,X.jsx)(F,{"data-testid":`cancel-delete-tag`,disabled:u.isPending,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(F,{"data-testid":`confirm-delete-tag`,disabled:u.isPending,variant:`destructive`,autoFocus:!0,onClick:()=>void p(),children:u.isPending?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ne,{size:`sm`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Deleting`})]}):`Delete`})]})]})})},ot=/#[0-9A-Fa-f]{6}$/,st=({value:e,disabled:t,errorId:n,onChange:r,onError:i})=>{let[a,o]=Y.useState(e.replace(/^#/,``)),s=Y.useRef(e),c=Y.useRef(!1);Y.useEffect(()=>{e!==s.current&&(s.current=e,o(e.replace(/^#/,``)))},[e]);let l=t=>{if(i(null),t===``){e!==``&&(s.current=``,r(``));return}let n=t;if(n[0]!==`#`&&(n=`#${n}`),ot.test(n)){if(n===e)return;s.current=n,o(n.replace(/^#/,``)),r(n)}else i(`The colour should be in valid hex format`)};return(0,X.jsxs)(Se,{onOpenChange:()=>c.current=!1,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-accent-color`,children:`Color`}),(0,X.jsxs)(je,{className:`w-28`,"data-disabled":t?`true`:void 0,children:[(0,X.jsxs)(Ae,{align:`inline-start`,children:[(0,X.jsx)(be,{asChild:!0,children:(0,X.jsx)(Ue,{"aria-label":`Accent color picker`,className:`-ml-1`,disabled:t,value:e||`#ffffff`})}),(0,X.jsx)(Oe,{className:`font-mono`,children:`#`})]}),(0,X.jsx)(ke,{"aria-describedby":n,"aria-invalid":!!n,"aria-label":`Accent color hex value`,autoCorrect:`off`,className:`font-mono`,disabled:t,id:`tag-accent-color`,maxLength:6,placeholder:`15171A`,value:a,onBlur:e=>l(e.target.value),onChange:e=>{o(e.target.value),l(e.target.value)}})]})]}),(0,X.jsx)(xe,{align:`start`,className:`w-auto p-4`,children:(0,X.jsx)(`div`,{onInputCapture:()=>c.current=!0,onKeyDownCapture:()=>c.current=!0,onPointerDownCapture:()=>c.current=!0,children:(0,X.jsx)(We,{value:e||`#ffffff`,onChange:e=>{c.current&&(o(e.replace(/^#/,``)),l(e))}})})})]})},ct=[()=>d(()=>import(`./dist-p52UDdoR.js`).then(e=>e.html()),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)],lt=({disabled:e,headerValue:t,footerValue:n,onHeaderChange:r,onFooterChange:i})=>(0,X.jsx)(z,{"data-testid":`tag-code-injection-card`,children:(0,X.jsx)(E,{defaultValue:t.trim()||n.trim()?`code-injection`:void 0,type:`single`,collapsible:!0,children:(0,X.jsxs)(T,{className:`border-b-0`,value:`code-injection`,children:[(0,X.jsx)(C,{className:`px-6 py-5 hover:no-underline`,children:(0,X.jsxs)(S,{className:`text-left`,gap:`none`,children:[(0,X.jsx)(`span`,{className:`text-[14px] font-semibold`,children:`Code injection`}),(0,X.jsx)(`span`,{className:`text-[13px] leading-[16px] font-normal tracking-normal text-muted-foreground`,children:`Add styles/scripts to the header and footer.`})]})}),(0,X.jsx)(w,{className:`px-6`,children:(0,X.jsxs)(S,{className:`pt-1`,gap:`lg`,children:[(0,X.jsx)(V,{"data-testid":`codeinjection-head`,editable:!e,extensions:ct,height:`192px`,title:(0,X.jsxs)(X.Fragment,{children:[`Tag header `,(0,X.jsx)(`code`,{className:`ml-1 font-normal`,children:`{{ghost_head}}`})]}),value:t,onChange:r}),(0,X.jsx)(V,{"data-testid":`codeinjection-foot`,editable:!e,extensions:ct,height:`192px`,title:(0,X.jsxs)(X.Fragment,{children:[`Tag footer `,(0,X.jsx)(`code`,{className:`ml-1 font-normal`,children:`{{ghost_foot}}`})]}),value:n,onChange:i})]})})]})})}),ut=e(n(),1),dt=`image`,ft=({id:e,label:t,uploadText:n,value:i,disabled:a,unsplashEnabled:s,onChange:c,onBusyChange:l,onUploadPendingChange:u})=>{let{mutateAsync:d,isPending:f}=Ee(),{unsplashConfig:p}=r(),m=B({disabled:a}),[h,g]=Y.useState(!1),[_,v]=Y.useState(!1),y=Y.useRef(!0),b=Y.useRef(!1),x=Y.useRef(l);x.current=l;let C=Y.useRef(u);C.current=u,Y.useEffect(()=>(y.current=!0,()=>{y.current=!1,x.current?.(!1),C.current?.(!1)}),[]);let w=_||h||m.isOpen;Y.useEffect(()=>{x.current?.(w)},[w]),Y.useEffect(()=>{C.current?.(_)},[_]),Y.useEffect(()=>{f&&g(!1)},[f]);let T=async e=>{if(b.current)return!1;b.current=!0,v(!0);try{let t=await d({file:e});return y.current&&c(K(t)),!0}catch(e){return y.current&&o.error(ue(e,dt)),!1}finally{b.current=!1,y.current&&v(!1)}},E=a||_||f;return(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:e,children:t}),(0,X.jsx)(G,{className:`h-40`,children:i?(0,X.jsxs)(we,{children:[(0,X.jsx)(De,{alt:``,src:i}),(0,X.jsxs)(Ce,{children:[m.isEnabled&&(0,X.jsx)(Te,{"aria-label":`Edit ${t.toLowerCase()}`,disabled:E,onClick:()=>m.openEditor({image:i,handleSave:T}),children:(0,X.jsx)(L,{})}),(0,X.jsx)(Te,{"aria-label":`Remove ${t.toLowerCase()}`,disabled:E,onClick:()=>c(``),children:(0,X.jsx)(D,{})})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{accept:de,className:`group/dropzone transition-colors hover:bg-interactive-hover`,disabled:E,inputAriaLabel:n,inputId:e,onDropAccepted:e=>{e[0]&&T(e[0])},onDropRejected:()=>o.error(fe),children:f?(0,X.jsx)(Ne,{size:`sm`}):(0,X.jsxs)(S,{align:`center`,gap:`sm`,children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-6 stroke-[1.5px] text-muted-foreground transition-colors group-hover/dropzone:text-foreground`}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground transition-colors group-hover/dropzone:text-foreground`,children:n})]})}),s&&(0,X.jsx)(Ce,{className:`top-1 right-1 opacity-100`,children:(0,X.jsx)(F,{"aria-label":`Select ${t.toLowerCase()} from Unsplash`,className:`group/unsplash hover:bg-button-hover`,disabled:E,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>g(!0),children:(0,X.jsx)(it,{className:`size-4 text-muted-foreground transition-colors group-hover/unsplash:text-foreground`,name:`unsplash`})})})]})}),h&&(0,ut.createPortal)((0,X.jsx)(rt,{unsplashProviderConfig:p,onClose:()=>g(!1),onImageInsert:e=>{e.src&&c(e.src),g(!1)}}),document.body)]})},pt=pe();function mt(e){return{name:e.name??``,slug:e.slug??``,description:e.description??``,featureImage:e.feature_image??``,metaTitle:e.meta_title??``,metaDescription:e.meta_description??``,canonicalUrl:e.canonical_url??``,twitterImage:e.twitter_image??``,twitterTitle:e.twitter_title??``,twitterDescription:e.twitter_description??``,ogImage:e.og_image??``,ogTitle:e.og_title??``,ogDescription:e.og_description??``,codeinjectionHead:e.codeinjection_head??``,codeinjectionFoot:e.codeinjection_foot??``,accentColor:e.accent_color??``}}function ht(e,t){let n={};for(let r of Object.keys(e))n[r]=r!==`codeinjectionHead`&&r!==`codeinjectionFoot`&&(!t||t.has(r))?e[r].trim():e[r];return n}function gt(e){return/^#/.test(e)?`internal`:`public`}function _t(e){let t=(0,pt.slugify)(e);return/^#/.test(e)&&(t=`hash-${t}`),t}function Z(e){return Array.from(e).length}function vt(e,t){let n=t[e].trim();switch(e){case`name`:return n===``?`You must specify a name for the tag.`:/^,/.test(n)?`Tag names can't start with commas.`:Z(n)>191?`Tag names cannot be longer than 191 characters.`:null;case`slug`:return Z(n)>191?`URL cannot be longer than 191 characters.`:null;case`description`:return Z(n)>500?`Description cannot be longer than 500 characters.`:null;case`metaTitle`:return Z(n)>300?`Meta Title cannot be longer than 300 characters.`:null;case`metaDescription`:return Z(n)>500?`Meta Description cannot be longer than 500 characters.`:null;case`canonicalUrl`:return yt(n);default:return null}}function yt(e){if(e===``)return null;try{return new URL(e),null}catch{return`The url should be a valid url`}}var bt=[`name`,`slug`,`description`,`metaTitle`,`metaDescription`,`canonicalUrl`];function xt(e){let t={};for(let n of bt){let r=vt(n,e);r&&(t[n]=r)}return t}function St(e,t,n){let r=ht(e,n),i={name:r.name,slug:r.slug,description:r.description,feature_image:r.featureImage||null,meta_title:r.metaTitle||null,meta_description:r.metaDescription||null,canonical_url:r.canonicalUrl||null,twitter_image:r.twitterImage||null,twitter_title:r.twitterTitle||null,twitter_description:r.twitterDescription||null,og_image:r.ogImage||null,og_title:r.ogTitle||null,og_description:r.ogDescription||null,codeinjection_head:r.codeinjectionHead||null,codeinjection_foot:r.codeinjectionFoot||null,accent_color:r.accentColor||null};return(t===null||r.name!==t)&&(i.visibility=gt(r.name)),i}function Ct(e,t){let n=e.canonicalUrl||`${t}/tag/${e.slug}`;return n.endsWith(`/`)||(n+=`/`),n}function wt(e,t){let n=t.indexOf(`://`);return`${n===-1?t:t.slice(n+3)}/tag/${e?`${e}/`:``}`}function Tt(e,t=140){let n=t-3;return e.length>n?`${e.substring(0,n)}...`:e}function Et(e,t){let n=t?`${e.name} - ${t}`:e.name,r=e.metaTitle||n;return r.length>70&&(r=`${r.substring(0,70).trim()}…`),r}function Dt(e){let t=e.metaDescription||e.description;return t.length>156&&(t=`${t.substring(0,156).trim()}…`),t}function Ot(e,t){let n=Ct(e,t);return n.length>70&&(n=`${n.substring(0,70).trim()}…`),n}function kt(e){return e.replace(/^[a-zA-Z0-9-]+:\/\//,``).replace(/\/$/,``)}var At=`Search engines will automatically show a custom preview of content related to the search term here if no custom meta description is set.`,jt=({url:e,title:t,description:n})=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`seo-preview`,children:[(0,X.jsxs)(`div`,{className:`mb-6 flex items-center gap-4`,children:[(0,X.jsx)(Ve,{className:`h-6`}),(0,X.jsx)(`div`,{className:`flex h-9 flex-1 items-center justify-end rounded-full border border-border px-3`,children:(0,X.jsx)(P,{className:`size-4 text-muted-foreground`})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:e}),(0,X.jsx)(`span`,{className:`text-lg`,"data-testid":`seo-preview-title`,children:t}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`seo-preview-description`,children:n?Tt(n,149):At})]})]}),Mt=()=>(0,X.jsxs)(`div`,{className:`mt-2 mb-3 flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`h-2 w-full rounded-sm bg-muted`}),(0,X.jsx)(`span`,{className:`h-2 w-3/5 rounded-sm bg-muted`})]}),Nt=({siteHeader:e,domain:t,image:n,title:r,description:i})=>(0,X.jsx)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`x-card-preview`,children:(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[(0,X.jsx)(Be,{className:`mt-1 size-5 shrink-0`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold`,children:e}),(0,X.jsxs)(`span`,{className:`ml-1 text-sm text-muted-foreground`,children:[h(12),` hrs`]}),(0,X.jsx)(Mt,{}),(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[n&&(0,X.jsx)(`div`,{className:`h-32 bg-muted bg-cover bg-center`,style:{backgroundImage:`url(${n})`}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm font-semibold`,"data-testid":`x-card-preview-title`,children:r}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`x-card-preview-description`,children:Tt(i)}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-muted-foreground`,children:[(0,X.jsx)(N,{className:`size-3.5`}),t]})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-6 text-sm text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(O,{className:`size-3.5`}),h(2)]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(A,{className:`size-3.5`}),h(11)]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(j,{className:`size-3.5`}),h(32)]}),(0,X.jsx)(`span`,{className:`flex items-center gap-1`,children:(0,X.jsx)(k,{className:`size-3.5`})})]})]})]})}),Pt=({siteHeader:e,domain:t,image:n,title:r,description:i})=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`facebook-card-preview`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(ze,{className:`size-10 shrink-0`}),(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold`,children:e}),(0,X.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[h(12),` hrs`]})]})]}),(0,X.jsx)(Mt,{}),(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[n&&(0,X.jsx)(`div`,{className:`h-32 bg-muted bg-cover bg-center`,style:{backgroundImage:`url(${n})`}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase`,children:t}),(0,X.jsx)(`span`,{className:`truncate text-sm font-semibold`,"data-testid":`facebook-card-preview-title`,children:Tt(r)}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`facebook-card-preview-description`,children:Tt(i)})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(M,{className:`size-3.5`}),h(182)]}),(0,X.jsxs)(`span`,{children:[h(7),` comments`]}),(0,X.jsxs)(`span`,{children:[h(2),` shares`]})]})]}),Q=e=>`tag-${e}-error`,$=({value:e,limit:t,prefix:n})=>{let r=Z(e);return(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n,`: `,h(t),` characters. You’ve used`,` `,(0,X.jsx)(`span`,{className:g(`font-semibold`,r>t?`text-destructive`:`text-state-success`),children:h(r)})]})},Ft=({draft:e,errors:t,blogUrl:n,disabled:r,onChange:i,onFieldError:a,onImageBusyChange:o,onImageUploadPendingChange:s})=>{let{data:c}=Ke({}),l=Ge(c?.settings??[],`title`)??``,u=Ge(c?.settings??[],`meta_title`)??``,d=Ge(c?.settings??[],`meta_description`)??``,f=Ge(c?.settings??[],`unsplash`)??!1,p=t=>{a(t,vt(t,e))},m=Et(e,l),h=Dt(e),g=Ot(e,n),_=u||l,v=kt(n);return(0,X.jsxs)(b,{align:`start`,className:`lg:grid-cols-2 sidebarlg:grid-cols-[minmax(0,5fr)_minmax(0,3fr)]`,"data-testid":`tag-detail-form`,gap:`2xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(z,{"data-testid":`tag-core-data-card`,children:(0,X.jsx)(R,{className:`p-6`,children:(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsxs)(x,{align:`start`,gap:`md`,children:[(0,X.jsxs)(S,{className:`min-w-0 flex-1`,gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-name`,children:`Name`}),(0,X.jsx)(q,{"aria-describedby":t.name?Q(`name`):void 0,"aria-invalid":!!t.name,disabled:r,id:`tag-name`,value:e.name,onBlur:()=>p(`name`),onChange:e=>i({name:e.target.value})})]}),(0,X.jsx)(st,{disabled:r,errorId:t.accentColor?Q(`accentColor`):void 0,value:e.accentColor,onChange:e=>i({accentColor:e}),onError:e=>a(`accentColor`,e)})]}),(0,X.jsxs)(S,{gap:`xs`,children:[(0,X.jsx)(U,{className:`text-sm`,id:Q(`name`),children:t.name}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`accentColor`),children:t.accentColor}),(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Start with # to create internal tags.`,` `,(0,X.jsx)(`a`,{className:`underline`,href:`https://ghost.org/help/organising-content/#private-tags`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]})]})]}),(0,X.jsx)(ft,{disabled:r,id:`tag-image`,label:`Tag image`,unsplashEnabled:f,uploadText:`Upload tag image`,value:e.featureImage,onBusyChange:e=>o(`featureImage`,e),onChange:e=>i({featureImage:e}),onUploadPendingChange:e=>s(`featureImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-slug`,children:`Slug`}),(0,X.jsx)(q,{"aria-describedby":t.slug?Q(`slug`):void 0,"aria-invalid":!!t.slug,disabled:r,id:`tag-slug`,value:e.slug,onBlur:()=>p(`slug`),onChange:e=>i({slug:e.target.value})}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`tag-slug-preview`,children:wt(e.slug,n)}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`slug`),children:t.slug})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-description`,children:`Description`}),(0,X.jsx)(Re,{"aria-describedby":t.description?Q(`description`):void 0,"aria-invalid":!!t.description,className:`min-h-24`,disabled:r,id:`tag-description`,value:e.description,onBlur:()=>p(`description`),onChange:e=>i({description:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`description`),children:t.description}),(0,X.jsx)($,{limit:500,prefix:`Maximum`,value:e.description})]})]})})}),(0,X.jsx)(lt,{disabled:r,footerValue:e.codeinjectionFoot,headerValue:e.codeinjectionHead,onFooterChange:e=>i({codeinjectionFoot:e}),onHeaderChange:e=>i({codeinjectionHead:e})})]}),(0,X.jsx)(z,{className:`overflow-hidden`,"data-testid":`tag-metadata-card`,children:(0,X.jsx)(R,{className:`p-6`,children:(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`none`,children:[(0,X.jsx)(`span`,{className:`text-[14px] font-semibold`,children:`Meta data`}),(0,X.jsx)(`span`,{className:`text-[13px] leading-[16px] font-normal tracking-normal text-muted-foreground`,children:`Extra content for search engines and social accounts.`})]}),(0,X.jsxs)(Le,{defaultValue:`search`,variant:`underline`,children:[(0,X.jsxs)(Ie,{"aria-label":`Tag metadata`,children:[(0,X.jsx)(Pe,{value:`search`,children:`Search`}),(0,X.jsx)(Pe,{value:`x-card`,children:`X card`}),(0,X.jsx)(Pe,{value:`facebook-card`,children:`Facebook card`})]}),(0,X.jsx)(Fe,{className:`pt-5`,value:`search`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`meta-title`,children:`Meta title`}),(0,X.jsx)(q,{"aria-describedby":t.metaTitle?Q(`metaTitle`):void 0,"aria-invalid":!!t.metaTitle,disabled:r,id:`meta-title`,placeholder:e.name,value:e.metaTitle,onBlur:()=>p(`metaTitle`),onChange:e=>i({metaTitle:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`metaTitle`),children:t.metaTitle}),(0,X.jsx)($,{limit:70,prefix:`Recommended`,value:e.metaTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`meta-description`,children:`Meta description`}),(0,X.jsx)(Re,{"aria-describedby":t.metaDescription?Q(`metaDescription`):void 0,"aria-invalid":!!t.metaDescription,disabled:r,id:`meta-description`,placeholder:e.description,value:e.metaDescription,onBlur:()=>p(`metaDescription`),onChange:e=>i({metaDescription:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`metaDescription`),children:t.metaDescription}),(0,X.jsx)($,{limit:156,prefix:`Recommended`,value:e.metaDescription})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`canonical-url`,children:`Canonical URL`}),(0,X.jsx)(q,{"aria-describedby":t.canonicalUrl?Q(`canonicalUrl`):void 0,"aria-invalid":!!t.canonicalUrl,disabled:r,id:`canonical-url`,value:e.canonicalUrl,onBlur:()=>p(`canonicalUrl`),onChange:e=>i({canonicalUrl:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`canonicalUrl`),children:t.canonicalUrl})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`search-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`Search Engine Result Preview`}),(0,X.jsx)(jt,{description:h,title:m,url:g})]})]})}),(0,X.jsx)(Fe,{className:`pt-5`,value:`x-card`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(ft,{disabled:r,id:`twitter-image`,label:`X image`,unsplashEnabled:f,uploadText:`Add X image`,value:e.twitterImage,onBusyChange:e=>o(`twitterImage`,e),onChange:e=>i({twitterImage:e}),onUploadPendingChange:e=>s(`twitterImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`twitter-title`,children:`X title`}),(0,X.jsx)(q,{disabled:r,id:`twitter-title`,placeholder:e.name,value:e.twitterTitle,onChange:e=>i({twitterTitle:e.target.value})}),(0,X.jsx)($,{limit:70,prefix:`Recommended`,value:e.twitterTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`twitter-description`,children:`X description`}),(0,X.jsx)(Re,{disabled:r,id:`twitter-description`,placeholder:e.description,value:e.twitterDescription,onChange:e=>i({twitterDescription:e.target.value})}),(0,X.jsx)($,{limit:125,prefix:`Recommended`,value:e.twitterDescription})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`x-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`X preview`}),(0,X.jsx)(Nt,{description:e.twitterDescription||h||d||``,domain:v,image:e.twitterImage||e.featureImage,siteHeader:_,title:e.twitterTitle||m})]})]})}),(0,X.jsx)(Fe,{className:`pt-5`,value:`facebook-card`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(ft,{disabled:r,id:`og-image`,label:`Facebook image`,unsplashEnabled:f,uploadText:`Add Facebook image`,value:e.ogImage,onBusyChange:e=>o(`ogImage`,e),onChange:e=>i({ogImage:e}),onUploadPendingChange:e=>s(`ogImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`og-title`,children:`Facebook title`}),(0,X.jsx)(q,{disabled:r,id:`og-title`,placeholder:e.name,value:e.ogTitle,onChange:e=>i({ogTitle:e.target.value})}),(0,X.jsx)($,{limit:100,prefix:`Recommended`,value:e.ogTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`og-description`,children:`Facebook description`}),(0,X.jsx)(Re,{disabled:r,id:`og-description`,placeholder:e.description,value:e.ogDescription,onChange:e=>i({ogDescription:e.target.value})}),(0,X.jsx)($,{limit:65,prefix:`Recommended`,value:e.ogDescription})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`facebook-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`Facebook preview`}),(0,X.jsx)(Pt,{description:h||d||``,domain:v,image:e.ogImage||e.featureImage,siteHeader:_,title:e.ogTitle||m})]})]})})]})]})})})]})},It=`new`,Lt=()=>{let{isAdmin7:e}=_(),{tagSlug:t=``}=f(),n=m(),r=i(),a=t===It,{data:c,isLoading:d,error:h,refetch:g}=u(t,{enabled:!!t&&!a,searchParams:{include:`count.posts`},defaultErrorHandler:!1}),b=c?.tags?.[0],x=!a&&!d&&h?.response?.status===404,S=!a&&!d&&!!h&&!x,{data:C}=Ye(),w=C?.site.url.replace(/\/$/,``)??``,T=s(),E=l(),D=a?E:T,[O,k]=Y.useState(void 0),[A,j]=Y.useState({}),M=Y.useRef(void 0),N=Y.useRef(void 0),P=Y.useRef(new Set),I=Y.useRef(t);I.current=t;let L=Y.useRef(null),R=Y.useRef(!1),[z,B]=Y.useState(`idle`),[ue,de]=Y.useState(!1),[V,fe]=Y.useState(!1),[pe,me]=Y.useState(new Set),[he,ge]=Y.useState(new Set);Y.useEffect(()=>{if(a){if(M.current!==It){M.current=It,R.current=!1,P.current.clear();let e=mt({});N.current=e,k(e),j({})}return}if(!b)return;let e=mt(b);if(M.current!==b.id){M.current=b.id,P.current.clear(),N.current=e,k(e),j({});return}let t=N.current;N.current=e,k(n=>!n||t&&tt(ht(n,P.current),t)?e:n)},[b,a]),Y.useEffect(()=>{de(!1),fe(!1),me(new Set),ge(new Set),B(L.current===t?`success`:`idle`),L.current=null,E.reset(),T.reset()},[t]);let _e=N.current,ve=!!O&&!!_e&&!tt(ht(O,P.current),_e),ye=pe.size>0,be=he.size>0,xe=D.isPending||ye||V||ue,{dialogProps:Se,bypassNextNavigation:H,resumeBlockedNavigationAfterSave:U}=nt({when:D.isPending||be||V||ve,isSaving:D.isPending}),Ce=Y.useCallback((e,t)=>{me(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),we=Y.useCallback((e,t)=>{ge(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),Te=e=>{z===`error`&&D.reset(),B(`idle`);let t=e.slug!==void 0;for(let t of Object.keys(e))P.current.add(t);a&&e.name!==void 0&&!R.current&&(e={...e,slug:_t(e.name)}),t&&(R.current=!!e.slug),k(t=>t&&{...t,...e})},Ee=(e,t)=>{j(n=>{if(t===null){if(!(e in n))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},W=Y.useCallback(()=>{if(!O||xe||!a&&(!b||M.current!==b.id))return;let e={...xt(O)};A.accentColor&&(e.accentColor=A.accentColor),j(e);let i=Object.values(e)[0];if(i){B(`idle`),o.error(i);return}let s=t,c=b?.id;B(`pending`);let l=e=>{if(I.current!==s)return;let r=e.tags?.[0];if(!r){B(`error`),o.error(`Couldn’t save the tag.`);return}let i=mt(r);N.current=i,k(i),P.current.clear(),B(`success`),!U()&&r.slug!==t&&(L.current=r.slug,H(),n(`/tags/${r.slug}`,{replace:!0}))},u=e=>{I.current===s&&(B(`error`),r(e))};if(a){E.mutate(St(O,null,P.current),{onSuccess:l,onError:u});return}b&&T.mutate({id:b.id,...St(O,mt(b).name,P.current)},{onSuccess:e=>{I.current!==s||M.current!==c||l(e)},onError:u})},[O,A.accentColor,a,b,t,xe,E,T,n,r,H,U]);Y.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),W())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[W]);let G=`Save`,De=`default`;z===`pending`?G=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ne,{size:`sm`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Saving`})]}):z===`error`?(G=`Retry`,De=`destructive`):z===`success`&&!ve&&(G=`Saved`);let K=!!O&&!!w&&(a||!!b),q=``;return a?q=`New tag`:O&&K?q=O.name:b&&(q=b.name),x?(0,X.jsx)(Qe,{}):(0,X.jsx)(v,{className:`size-full`,children:(0,X.jsx)(y,{className:`relative flex h-full flex-col`,size:`page`,children:(0,X.jsxs)(et,{"data-testid":`tag-detail`,children:[(0,X.jsx)(et.Header,{children:(0,X.jsxs)(J,{blurredBackground:!1,sticky:!1,children:[(0,X.jsx)(J.Left,{children:(0,X.jsx)(le,{children:(0,X.jsxs)(ae,{children:[(0,X.jsx)(oe,{children:(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(p,{"data-test-link":`tags-back`,to:`/tags`,children:`Tags`})})}),(0,X.jsx)(se,{}),(0,X.jsxs)(oe,{className:e?`items-baseline gap-2`:`gap-2`,children:[!a&&d?(0,X.jsx)(Me,{className:`h-4 w-40`}):(0,X.jsx)(ie,{className:`truncate`,"data-testid":`tag-detail-title`,children:q}),b?.visibility===`internal`&&(0,X.jsx)(re,{className:e?`leading-none tracking-wider`:`px-1 py-px text-[10px] leading-none tracking-wider`,"data-testid":`tag-detail-internal-badge`,size:e?`md`:`default`,variant:`secondary`,children:e?`Internal`:`INTERNAL`})]})]})})}),K&&O&&(0,X.jsx)(J.Actions,{children:(0,X.jsxs)(J.ActionGroup,{children:[!a&&b&&(0,X.jsxs)(qe,{children:[(0,X.jsx)($e,{asChild:!0,children:(0,X.jsx)(F,{"aria-label":`Tag actions`,className:`size-(--control-height)`,size:`icon`,variant:`subtle`,children:(0,X.jsx)(ne,{size:16})})}),(0,X.jsxs)(Ze,{align:`end`,children:[(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsxs)(`a`,{href:Ct(O,w),rel:`noopener noreferrer`,target:`_blank`,children:[(0,X.jsx)(te,{}),`View posts`]})}),(0,X.jsx)(Xe,{}),(0,X.jsxs)(Je,{className:`text-destructive focus:text-destructive`,disabled:D.isPending||ye,onSelect:()=>de(!0),children:[(0,X.jsx)(ee,{}),`Delete tag`]})]})]}),(0,X.jsx)(F,{className:`min-w-16`,disabled:xe,variant:De,onClick:W,children:G})]})})]})}),(0,X.jsxs)(et.Body,{children:[S&&(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3`,"data-testid":`tag-detail-load-error`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Couldn’t load this tag.`}),(0,X.jsx)(F,{variant:`outline`,onClick:()=>void g(),children:`Retry`})]}),K&&O&&(0,X.jsx)(`div`,{className:`flex flex-col gap-8`,children:(0,X.jsx)(Ft,{blogUrl:w,disabled:D.isPending||V,draft:O,errors:A,onChange:Te,onFieldError:Ee,onImageBusyChange:Ce,onImageUploadPendingChange:we},a?It:b?.id)})]}),!a&&b&&(0,X.jsx)(at,{allowLeaveWithUnsavedChanges:H,displayName:O?.name??b.name,open:ue,tag:b,onOpenChange:de,onPendingChange:fe},b.id),(0,X.jsx)(He,{...Se})]})})})};export{Lt as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-C-_aTlvJ.js","./dist-tI811Kyl.js","./dist-B4jqKAG5.js","./dist-Bmo2j_KH.js","./react-C9lG_SsT.js","./dist-CWHIoxYn.js"])))=>i.map(i=>d[i]);
2
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`6042ca2a-5740-4630-8d2e-c1606be96813`,e._sentryDebugIdIdentifier=`sentry-dbid-6042ca2a-5740-4630-8d2e-c1606be96813`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./react-dom-t7VxfrkA.js";import{r}from"./framework-provider-CIvHFnik.js";import{g as i}from"./hooks-0r7qxGEo.js";import{t as a}from"./jsx-runtime-Bm2_KH-0.js";import{n as o}from"./dist-pogVoW2G.js";import{a as s,i as c,n as l,o as u}from"./tags-OlmRJ6Ps.js";import{t as d}from"./preload-helper-Ba4JejZL.js";import{h as f,n as p}from"./chunk-OB3PAWPO-D3muQBsq.js";import{a as m}from"./router-provider-Cf-bcYZr.js";import{H as h,L as g,r as _}from"./shade-provider-DvrXKKQZ.js";import{t as v}from"./box-BOIwAOVT.js";import{t as y}from"./container-DakAbO79.js";import{t as b}from"./grid-BYJO9x_v.js";import{t as x}from"./inline-Qoyy4r2g.js";import{t as S}from"./stack-C3OmgpUv.js";import{i as C,n as w,r as T,t as E}from"./accordion-BB5V0RD1.js";import{D,E as ee,Nn as te,Pn as ne,Rt as O,X as k,ct as A,gn as j,k as M,nn as N,nt as P,t as F,v as I,yt as L}from"./button-CTHYSI-d.js";import{t as re}from"./badge-DuMiqyUH.js";import{a as ie,i as ae,n as oe,o as se,r as ce,t as le}from"./breadcrumb-BO_Xhq8u.js";import{n as R,t as z}from"./card-Cd6xB_Ok.js";import{a as B,i as ue,n as de,o as V,r as fe,t as pe}from"./lib-Bre6UXdJ.js";import{a as me,i as he,o as ge,r as _e,s as ve,t as ye}from"./dialog-BO1lcy8A.js";import{a as be,i as xe,t as Se}from"./popover-r_3DwMi9.js";import{t as H}from"./label-CxXFmzcd.js";import{i as U}from"./field-DCPPrQDr.js";import{a as Ce,c as we,i as Te,n as Ee,o as W,r as G,s as De,t as K}from"./images-DTZtaIAr.js";import{t as q}from"./input-BHb2A_DU.js";import{a as Oe,i as ke,n as Ae,t as je}from"./input-group-DL5EFP5r.js";import{t as Me}from"./skeleton-C1s6yr9e.js";import{n as Ne}from"./loading-indicator-DaRyGrxv.js";import{t as J}from"./page-header-CxTb0je5.js";import{i as Pe,n as Fe,r as Ie,t as Le}from"./tabs-fHs3A8WC.js";import{t as Re}from"./textarea-B_rfKtjs.js";import{n as ze,t as Be}from"./x-logo-DpF1U_6M.js";import{t as Ve}from"./google-logo-IGBgqBWI.js";import{t as He}from"./dirty-confirm-dialog-CdxPMCA8.js";import{n as Ue,t as We}from"./color-picker-jiQKnLn-.js";import{Ht as Ge,Kt as Ke,ct as qe,ft as Je,g as Ye,gt as Xe,ut as Ze,v as Qe,vt as $e}from"./index-RuRs_qGS.js";import{t as et}from"./detail-page-DkWBi2i0.js";import{n as tt,t as nt}from"./use-unsaved-changes-guard-BkCuSlvU.js";import{t as rt}from"./index.es-rdb1skp_.js";import{t as it}from"./brand-icon-BFOhZhQt.js";var Y=e(t(),1),X=a(),at=({open:e,onOpenChange:t,tag:n,displayName:r,onPendingChange:a,allowLeaveWithUnsavedChanges:o})=>{let s=m(),l=i(),u=c(),d=n.count?.posts??0,f=Y.useRef(!0);Y.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async()=>{a(!0);try{if(await u.mutateAsync(n.id),!f.current)return;t(!1),o(),s(`/tags`)}catch(e){f.current&&l(e)}finally{f.current&&a(!1)}};return(0,X.jsx)(ye,{open:e,onOpenChange:e=>{u.isPending||t(e)},children:(0,X.jsxs)(_e,{"data-testid":`delete-tag-modal`,children:[(0,X.jsxs)(ge,{children:[(0,X.jsx)(ve,{children:`Are you sure you want to delete this tag?`}),(0,X.jsxs)(he,{children:[`You’re about to delete the tag "`,(0,X.jsx)(`strong`,{children:r}),`".`,` `,d>0&&(0,X.jsxs)(X.Fragment,{children:[`It will be removed from`,` `,(0,X.jsxs)(`span`,{"data-testid":`delete-tag-posts-count`,children:[h(d),` `,d===1?`post`:`posts`]}),`.`,` `]}),`This is permanent! We warned you, k?`]})]}),(0,X.jsxs)(me,{children:[(0,X.jsx)(F,{"data-testid":`cancel-delete-tag`,disabled:u.isPending,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(F,{"data-testid":`confirm-delete-tag`,disabled:u.isPending,variant:`destructive`,autoFocus:!0,onClick:()=>void p(),children:u.isPending?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ne,{size:`sm`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Deleting`})]}):`Delete`})]})]})})},ot=/#[0-9A-Fa-f]{6}$/,st=({value:e,disabled:t,errorId:n,onChange:r,onError:i})=>{let[a,o]=Y.useState(e.replace(/^#/,``)),s=Y.useRef(e),c=Y.useRef(!1);Y.useEffect(()=>{e!==s.current&&(s.current=e,o(e.replace(/^#/,``)))},[e]);let l=t=>{if(i(null),t===``){e!==``&&(s.current=``,r(``));return}let n=t;if(n[0]!==`#`&&(n=`#${n}`),ot.test(n)){if(n===e)return;s.current=n,o(n.replace(/^#/,``)),r(n)}else i(`The colour should be in valid hex format`)};return(0,X.jsxs)(Se,{onOpenChange:()=>c.current=!1,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-accent-color`,children:`Color`}),(0,X.jsxs)(je,{className:`w-28`,"data-disabled":t?`true`:void 0,children:[(0,X.jsxs)(Ae,{align:`inline-start`,children:[(0,X.jsx)(be,{asChild:!0,children:(0,X.jsx)(Ue,{"aria-label":`Accent color picker`,className:`-ml-1`,disabled:t,value:e||`#ffffff`})}),(0,X.jsx)(Oe,{className:`font-mono`,children:`#`})]}),(0,X.jsx)(ke,{"aria-describedby":n,"aria-invalid":!!n,"aria-label":`Accent color hex value`,autoCorrect:`off`,className:`font-mono`,disabled:t,id:`tag-accent-color`,maxLength:6,placeholder:`15171A`,value:a,onBlur:e=>l(e.target.value),onChange:e=>{o(e.target.value),l(e.target.value)}})]})]}),(0,X.jsx)(xe,{align:`start`,className:`w-auto p-4`,children:(0,X.jsx)(`div`,{onInputCapture:()=>c.current=!0,onKeyDownCapture:()=>c.current=!0,onPointerDownCapture:()=>c.current=!0,children:(0,X.jsx)(We,{value:e||`#ffffff`,onChange:e=>{c.current&&(o(e.replace(/^#/,``)),l(e))}})})})]})},ct=[()=>d(()=>import(`./dist-C-_aTlvJ.js`).then(e=>e.html()),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)],lt=({disabled:e,headerValue:t,footerValue:n,onHeaderChange:r,onFooterChange:i})=>(0,X.jsx)(z,{"data-testid":`tag-code-injection-card`,children:(0,X.jsx)(E,{defaultValue:t.trim()||n.trim()?`code-injection`:void 0,type:`single`,collapsible:!0,children:(0,X.jsxs)(T,{className:`border-b-0`,value:`code-injection`,children:[(0,X.jsx)(C,{className:`px-6 py-5 hover:no-underline`,children:(0,X.jsxs)(S,{className:`text-left`,gap:`none`,children:[(0,X.jsx)(`span`,{className:`text-[14px] font-semibold`,children:`Code injection`}),(0,X.jsx)(`span`,{className:`text-[13px] leading-[16px] font-normal tracking-normal text-muted-foreground`,children:`Add styles/scripts to the header and footer.`})]})}),(0,X.jsx)(w,{className:`px-6`,children:(0,X.jsxs)(S,{className:`pt-1`,gap:`lg`,children:[(0,X.jsx)(V,{"data-testid":`codeinjection-head`,editable:!e,extensions:ct,height:`192px`,title:(0,X.jsxs)(X.Fragment,{children:[`Tag header `,(0,X.jsx)(`code`,{className:`ml-1 font-normal`,children:`{{ghost_head}}`})]}),value:t,onChange:r}),(0,X.jsx)(V,{"data-testid":`codeinjection-foot`,editable:!e,extensions:ct,height:`192px`,title:(0,X.jsxs)(X.Fragment,{children:[`Tag footer `,(0,X.jsx)(`code`,{className:`ml-1 font-normal`,children:`{{ghost_foot}}`})]}),value:n,onChange:i})]})})]})})}),ut=e(n(),1),dt=`image`,ft=({id:e,label:t,uploadText:n,value:i,disabled:a,unsplashEnabled:s,onChange:c,onBusyChange:l,onUploadPendingChange:u})=>{let{mutateAsync:d,isPending:f}=Ee(),{unsplashConfig:p}=r(),m=B({disabled:a}),[h,g]=Y.useState(!1),[_,v]=Y.useState(!1),y=Y.useRef(!0),b=Y.useRef(!1),x=Y.useRef(l);x.current=l;let C=Y.useRef(u);C.current=u,Y.useEffect(()=>(y.current=!0,()=>{y.current=!1,x.current?.(!1),C.current?.(!1)}),[]);let w=_||h||m.isOpen;Y.useEffect(()=>{x.current?.(w)},[w]),Y.useEffect(()=>{C.current?.(_)},[_]),Y.useEffect(()=>{f&&g(!1)},[f]);let T=async e=>{if(b.current)return!1;b.current=!0,v(!0);try{let t=await d({file:e});return y.current&&c(K(t)),!0}catch(e){return y.current&&o.error(ue(e,dt)),!1}finally{b.current=!1,y.current&&v(!1)}},E=a||_||f;return(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:e,children:t}),(0,X.jsx)(G,{className:`h-40`,children:i?(0,X.jsxs)(we,{children:[(0,X.jsx)(De,{alt:``,src:i}),(0,X.jsxs)(Ce,{children:[m.isEnabled&&(0,X.jsx)(Te,{"aria-label":`Edit ${t.toLowerCase()}`,disabled:E,onClick:()=>m.openEditor({image:i,handleSave:T}),children:(0,X.jsx)(L,{})}),(0,X.jsx)(Te,{"aria-label":`Remove ${t.toLowerCase()}`,disabled:E,onClick:()=>c(``),children:(0,X.jsx)(D,{})})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{accept:de,className:`group/dropzone transition-colors hover:bg-interactive-hover`,disabled:E,inputAriaLabel:n,inputId:e,onDropAccepted:e=>{e[0]&&T(e[0])},onDropRejected:()=>o.error(fe),children:f?(0,X.jsx)(Ne,{size:`sm`}):(0,X.jsxs)(S,{align:`center`,gap:`sm`,children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-6 stroke-[1.5px] text-muted-foreground transition-colors group-hover/dropzone:text-foreground`}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground transition-colors group-hover/dropzone:text-foreground`,children:n})]})}),s&&(0,X.jsx)(Ce,{className:`top-1 right-1 opacity-100`,children:(0,X.jsx)(F,{"aria-label":`Select ${t.toLowerCase()} from Unsplash`,className:`group/unsplash hover:bg-button-hover`,disabled:E,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>g(!0),children:(0,X.jsx)(it,{className:`size-4 text-muted-foreground transition-colors group-hover/unsplash:text-foreground`,name:`unsplash`})})})]})}),h&&(0,ut.createPortal)((0,X.jsx)(rt,{unsplashProviderConfig:p,onClose:()=>g(!1),onImageInsert:e=>{e.src&&c(e.src),g(!1)}}),document.body)]})},pt=pe();function mt(e){return{name:e.name??``,slug:e.slug??``,description:e.description??``,featureImage:e.feature_image??``,metaTitle:e.meta_title??``,metaDescription:e.meta_description??``,canonicalUrl:e.canonical_url??``,twitterImage:e.twitter_image??``,twitterTitle:e.twitter_title??``,twitterDescription:e.twitter_description??``,ogImage:e.og_image??``,ogTitle:e.og_title??``,ogDescription:e.og_description??``,codeinjectionHead:e.codeinjection_head??``,codeinjectionFoot:e.codeinjection_foot??``,accentColor:e.accent_color??``}}function ht(e,t){let n={};for(let r of Object.keys(e))n[r]=r!==`codeinjectionHead`&&r!==`codeinjectionFoot`&&(!t||t.has(r))?e[r].trim():e[r];return n}function gt(e){return/^#/.test(e)?`internal`:`public`}function _t(e){let t=(0,pt.slugify)(e);return/^#/.test(e)&&(t=`hash-${t}`),t}function Z(e){return Array.from(e).length}function vt(e,t){let n=t[e].trim();switch(e){case`name`:return n===``?`You must specify a name for the tag.`:/^,/.test(n)?`Tag names can't start with commas.`:Z(n)>191?`Tag names cannot be longer than 191 characters.`:null;case`slug`:return Z(n)>191?`URL cannot be longer than 191 characters.`:null;case`description`:return Z(n)>500?`Description cannot be longer than 500 characters.`:null;case`metaTitle`:return Z(n)>300?`Meta Title cannot be longer than 300 characters.`:null;case`metaDescription`:return Z(n)>500?`Meta Description cannot be longer than 500 characters.`:null;case`canonicalUrl`:return yt(n);default:return null}}function yt(e){if(e===``)return null;try{return new URL(e),null}catch{return`The url should be a valid url`}}var bt=[`name`,`slug`,`description`,`metaTitle`,`metaDescription`,`canonicalUrl`];function xt(e){let t={};for(let n of bt){let r=vt(n,e);r&&(t[n]=r)}return t}function St(e,t,n){let r=ht(e,n),i={name:r.name,slug:r.slug,description:r.description,feature_image:r.featureImage||null,meta_title:r.metaTitle||null,meta_description:r.metaDescription||null,canonical_url:r.canonicalUrl||null,twitter_image:r.twitterImage||null,twitter_title:r.twitterTitle||null,twitter_description:r.twitterDescription||null,og_image:r.ogImage||null,og_title:r.ogTitle||null,og_description:r.ogDescription||null,codeinjection_head:r.codeinjectionHead||null,codeinjection_foot:r.codeinjectionFoot||null,accent_color:r.accentColor||null};return(t===null||r.name!==t)&&(i.visibility=gt(r.name)),i}function Ct(e,t){let n=e.canonicalUrl||`${t}/tag/${e.slug}`;return n.endsWith(`/`)||(n+=`/`),n}function wt(e,t){let n=t.indexOf(`://`);return`${n===-1?t:t.slice(n+3)}/tag/${e?`${e}/`:``}`}function Tt(e,t=140){let n=t-3;return e.length>n?`${e.substring(0,n)}...`:e}function Et(e,t){let n=t?`${e.name} - ${t}`:e.name,r=e.metaTitle||n;return r.length>70&&(r=`${r.substring(0,70).trim()}…`),r}function Dt(e){let t=e.metaDescription||e.description;return t.length>156&&(t=`${t.substring(0,156).trim()}…`),t}function Ot(e,t){let n=Ct(e,t);return n.length>70&&(n=`${n.substring(0,70).trim()}…`),n}function kt(e){return e.replace(/^[a-zA-Z0-9-]+:\/\//,``).replace(/\/$/,``)}var At=`Search engines will automatically show a custom preview of content related to the search term here if no custom meta description is set.`,jt=({url:e,title:t,description:n})=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`seo-preview`,children:[(0,X.jsxs)(`div`,{className:`mb-6 flex items-center gap-4`,children:[(0,X.jsx)(Ve,{className:`h-6`}),(0,X.jsx)(`div`,{className:`flex h-9 flex-1 items-center justify-end rounded-full border border-border px-3`,children:(0,X.jsx)(P,{className:`size-4 text-muted-foreground`})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:e}),(0,X.jsx)(`span`,{className:`text-lg`,"data-testid":`seo-preview-title`,children:t}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`seo-preview-description`,children:n?Tt(n,149):At})]})]}),Mt=()=>(0,X.jsxs)(`div`,{className:`mt-2 mb-3 flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`h-2 w-full rounded-sm bg-muted`}),(0,X.jsx)(`span`,{className:`h-2 w-3/5 rounded-sm bg-muted`})]}),Nt=({siteHeader:e,domain:t,image:n,title:r,description:i})=>(0,X.jsx)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`x-card-preview`,children:(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[(0,X.jsx)(Be,{className:`mt-1 size-5 shrink-0`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold`,children:e}),(0,X.jsxs)(`span`,{className:`ml-1 text-sm text-muted-foreground`,children:[h(12),` hrs`]}),(0,X.jsx)(Mt,{}),(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[n&&(0,X.jsx)(`div`,{className:`h-32 bg-muted bg-cover bg-center`,style:{backgroundImage:`url(${n})`}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:[(0,X.jsx)(`span`,{className:`truncate text-sm font-semibold`,"data-testid":`x-card-preview-title`,children:r}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`x-card-preview-description`,children:Tt(i)}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-muted-foreground`,children:[(0,X.jsx)(N,{className:`size-3.5`}),t]})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-6 text-sm text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(O,{className:`size-3.5`}),h(2)]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(A,{className:`size-3.5`}),h(11)]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(j,{className:`size-3.5`}),h(32)]}),(0,X.jsx)(`span`,{className:`flex items-center gap-1`,children:(0,X.jsx)(k,{className:`size-3.5`})})]})]})]})}),Pt=({siteHeader:e,domain:t,image:n,title:r,description:i})=>(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated p-4`,"data-testid":`facebook-card-preview`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(ze,{className:`size-10 shrink-0`}),(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold`,children:e}),(0,X.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[h(12),` hrs`]})]})]}),(0,X.jsx)(Mt,{}),(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[n&&(0,X.jsx)(`div`,{className:`h-32 bg-muted bg-cover bg-center`,style:{backgroundImage:`url(${n})`}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase`,children:t}),(0,X.jsx)(`span`,{className:`truncate text-sm font-semibold`,"data-testid":`facebook-card-preview-title`,children:Tt(r)}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`facebook-card-preview-description`,children:Tt(i)})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(M,{className:`size-3.5`}),h(182)]}),(0,X.jsxs)(`span`,{children:[h(7),` comments`]}),(0,X.jsxs)(`span`,{children:[h(2),` shares`]})]})]}),Q=e=>`tag-${e}-error`,$=({value:e,limit:t,prefix:n})=>{let r=Z(e);return(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n,`: `,h(t),` characters. You’ve used`,` `,(0,X.jsx)(`span`,{className:g(`font-semibold`,r>t?`text-destructive`:`text-state-success`),children:h(r)})]})},Ft=({draft:e,errors:t,blogUrl:n,disabled:r,onChange:i,onFieldError:a,onImageBusyChange:o,onImageUploadPendingChange:s})=>{let{data:c}=Ke({}),l=Ge(c?.settings??[],`title`)??``,u=Ge(c?.settings??[],`meta_title`)??``,d=Ge(c?.settings??[],`meta_description`)??``,f=Ge(c?.settings??[],`unsplash`)??!1,p=t=>{a(t,vt(t,e))},m=Et(e,l),h=Dt(e),g=Ot(e,n),_=u||l,v=kt(n);return(0,X.jsxs)(b,{align:`start`,className:`lg:grid-cols-2 sidebarlg:grid-cols-[minmax(0,5fr)_minmax(0,3fr)]`,"data-testid":`tag-detail-form`,gap:`2xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(z,{"data-testid":`tag-core-data-card`,children:(0,X.jsx)(R,{className:`p-6`,children:(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsxs)(x,{align:`start`,gap:`md`,children:[(0,X.jsxs)(S,{className:`min-w-0 flex-1`,gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-name`,children:`Name`}),(0,X.jsx)(q,{"aria-describedby":t.name?Q(`name`):void 0,"aria-invalid":!!t.name,disabled:r,id:`tag-name`,value:e.name,onBlur:()=>p(`name`),onChange:e=>i({name:e.target.value})})]}),(0,X.jsx)(st,{disabled:r,errorId:t.accentColor?Q(`accentColor`):void 0,value:e.accentColor,onChange:e=>i({accentColor:e}),onError:e=>a(`accentColor`,e)})]}),(0,X.jsxs)(S,{gap:`xs`,children:[(0,X.jsx)(U,{className:`text-sm`,id:Q(`name`),children:t.name}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`accentColor`),children:t.accentColor}),(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Start with # to create internal tags.`,` `,(0,X.jsx)(`a`,{className:`underline`,href:`https://ghost.org/help/organising-content/#private-tags`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]})]})]}),(0,X.jsx)(ft,{disabled:r,id:`tag-image`,label:`Tag image`,unsplashEnabled:f,uploadText:`Upload tag image`,value:e.featureImage,onBusyChange:e=>o(`featureImage`,e),onChange:e=>i({featureImage:e}),onUploadPendingChange:e=>s(`featureImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-slug`,children:`Slug`}),(0,X.jsx)(q,{"aria-describedby":t.slug?Q(`slug`):void 0,"aria-invalid":!!t.slug,disabled:r,id:`tag-slug`,value:e.slug,onBlur:()=>p(`slug`),onChange:e=>i({slug:e.target.value})}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`tag-slug-preview`,children:wt(e.slug,n)}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`slug`),children:t.slug})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`tag-description`,children:`Description`}),(0,X.jsx)(Re,{"aria-describedby":t.description?Q(`description`):void 0,"aria-invalid":!!t.description,className:`min-h-24`,disabled:r,id:`tag-description`,value:e.description,onBlur:()=>p(`description`),onChange:e=>i({description:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`description`),children:t.description}),(0,X.jsx)($,{limit:500,prefix:`Maximum`,value:e.description})]})]})})}),(0,X.jsx)(lt,{disabled:r,footerValue:e.codeinjectionFoot,headerValue:e.codeinjectionHead,onFooterChange:e=>i({codeinjectionFoot:e}),onHeaderChange:e=>i({codeinjectionHead:e})})]}),(0,X.jsx)(z,{className:`overflow-hidden`,"data-testid":`tag-metadata-card`,children:(0,X.jsx)(R,{className:`p-6`,children:(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`none`,children:[(0,X.jsx)(`span`,{className:`text-[14px] font-semibold`,children:`Meta data`}),(0,X.jsx)(`span`,{className:`text-[13px] leading-[16px] font-normal tracking-normal text-muted-foreground`,children:`Extra content for search engines and social accounts.`})]}),(0,X.jsxs)(Le,{defaultValue:`search`,variant:`underline`,children:[(0,X.jsxs)(Ie,{"aria-label":`Tag metadata`,children:[(0,X.jsx)(Pe,{value:`search`,children:`Search`}),(0,X.jsx)(Pe,{value:`x-card`,children:`X card`}),(0,X.jsx)(Pe,{value:`facebook-card`,children:`Facebook card`})]}),(0,X.jsx)(Fe,{className:`pt-5`,value:`search`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`meta-title`,children:`Meta title`}),(0,X.jsx)(q,{"aria-describedby":t.metaTitle?Q(`metaTitle`):void 0,"aria-invalid":!!t.metaTitle,disabled:r,id:`meta-title`,placeholder:e.name,value:e.metaTitle,onBlur:()=>p(`metaTitle`),onChange:e=>i({metaTitle:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`metaTitle`),children:t.metaTitle}),(0,X.jsx)($,{limit:70,prefix:`Recommended`,value:e.metaTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`meta-description`,children:`Meta description`}),(0,X.jsx)(Re,{"aria-describedby":t.metaDescription?Q(`metaDescription`):void 0,"aria-invalid":!!t.metaDescription,disabled:r,id:`meta-description`,placeholder:e.description,value:e.metaDescription,onBlur:()=>p(`metaDescription`),onChange:e=>i({metaDescription:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`metaDescription`),children:t.metaDescription}),(0,X.jsx)($,{limit:156,prefix:`Recommended`,value:e.metaDescription})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`canonical-url`,children:`Canonical URL`}),(0,X.jsx)(q,{"aria-describedby":t.canonicalUrl?Q(`canonicalUrl`):void 0,"aria-invalid":!!t.canonicalUrl,disabled:r,id:`canonical-url`,value:e.canonicalUrl,onBlur:()=>p(`canonicalUrl`),onChange:e=>i({canonicalUrl:e.target.value})}),(0,X.jsx)(U,{className:`text-sm`,id:Q(`canonicalUrl`),children:t.canonicalUrl})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`search-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`Search Engine Result Preview`}),(0,X.jsx)(jt,{description:h,title:m,url:g})]})]})}),(0,X.jsx)(Fe,{className:`pt-5`,value:`x-card`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(ft,{disabled:r,id:`twitter-image`,label:`X image`,unsplashEnabled:f,uploadText:`Add X image`,value:e.twitterImage,onBusyChange:e=>o(`twitterImage`,e),onChange:e=>i({twitterImage:e}),onUploadPendingChange:e=>s(`twitterImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`twitter-title`,children:`X title`}),(0,X.jsx)(q,{disabled:r,id:`twitter-title`,placeholder:e.name,value:e.twitterTitle,onChange:e=>i({twitterTitle:e.target.value})}),(0,X.jsx)($,{limit:70,prefix:`Recommended`,value:e.twitterTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`twitter-description`,children:`X description`}),(0,X.jsx)(Re,{disabled:r,id:`twitter-description`,placeholder:e.description,value:e.twitterDescription,onChange:e=>i({twitterDescription:e.target.value})}),(0,X.jsx)($,{limit:125,prefix:`Recommended`,value:e.twitterDescription})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`x-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`X preview`}),(0,X.jsx)(Nt,{description:e.twitterDescription||h||d||``,domain:v,image:e.twitterImage||e.featureImage,siteHeader:_,title:e.twitterTitle||m})]})]})}),(0,X.jsx)(Fe,{className:`pt-5`,value:`facebook-card`,children:(0,X.jsxs)(S,{gap:`xl`,children:[(0,X.jsxs)(S,{gap:`lg`,children:[(0,X.jsx)(ft,{disabled:r,id:`og-image`,label:`Facebook image`,unsplashEnabled:f,uploadText:`Add Facebook image`,value:e.ogImage,onBusyChange:e=>o(`ogImage`,e),onChange:e=>i({ogImage:e}),onUploadPendingChange:e=>s(`ogImage`,e)}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`og-title`,children:`Facebook title`}),(0,X.jsx)(q,{disabled:r,id:`og-title`,placeholder:e.name,value:e.ogTitle,onChange:e=>i({ogTitle:e.target.value})}),(0,X.jsx)($,{limit:100,prefix:`Recommended`,value:e.ogTitle})]}),(0,X.jsxs)(S,{gap:`sm`,children:[(0,X.jsx)(H,{htmlFor:`og-description`,children:`Facebook description`}),(0,X.jsx)(Re,{disabled:r,id:`og-description`,placeholder:e.description,value:e.ogDescription,onChange:e=>i({ogDescription:e.target.value})}),(0,X.jsx)($,{limit:65,prefix:`Recommended`,value:e.ogDescription})]})]}),(0,X.jsxs)(S,{className:`-mx-6 -mb-6 bg-preview-canvas px-6 pt-5 pb-[34px]`,"data-testid":`facebook-preview-surface`,gap:`sm`,children:[(0,X.jsx)(H,{children:`Facebook preview`}),(0,X.jsx)(Pt,{description:h||d||``,domain:v,image:e.ogImage||e.featureImage,siteHeader:_,title:e.ogTitle||m})]})]})})]})]})})})]})},It=`new`,Lt=()=>{let{isAdmin7:e}=_(),{tagSlug:t=``}=f(),n=m(),r=i(),a=t===It,{data:c,isLoading:d,error:h,refetch:g}=u(t,{enabled:!!t&&!a,searchParams:{include:`count.posts`},defaultErrorHandler:!1}),b=c?.tags?.[0],x=!a&&!d&&h?.response?.status===404,S=!a&&!d&&!!h&&!x,{data:C}=Ye(),w=C?.site.url.replace(/\/$/,``)??``,T=s(),E=l(),D=a?E:T,[O,k]=Y.useState(void 0),[A,j]=Y.useState({}),M=Y.useRef(void 0),N=Y.useRef(void 0),P=Y.useRef(new Set),I=Y.useRef(t);I.current=t;let L=Y.useRef(null),R=Y.useRef(!1),[z,B]=Y.useState(`idle`),[ue,de]=Y.useState(!1),[V,fe]=Y.useState(!1),[pe,me]=Y.useState(new Set),[he,ge]=Y.useState(new Set);Y.useEffect(()=>{if(a){if(M.current!==It){M.current=It,R.current=!1,P.current.clear();let e=mt({});N.current=e,k(e),j({})}return}if(!b)return;let e=mt(b);if(M.current!==b.id){M.current=b.id,P.current.clear(),N.current=e,k(e),j({});return}let t=N.current;N.current=e,k(n=>!n||t&&tt(ht(n,P.current),t)?e:n)},[b,a]),Y.useEffect(()=>{de(!1),fe(!1),me(new Set),ge(new Set),B(L.current===t?`success`:`idle`),L.current=null,E.reset(),T.reset()},[t]);let _e=N.current,ve=!!O&&!!_e&&!tt(ht(O,P.current),_e),ye=pe.size>0,be=he.size>0,xe=D.isPending||ye||V||ue,{dialogProps:Se,bypassNextNavigation:H,resumeBlockedNavigationAfterSave:U}=nt({when:D.isPending||be||V||ve,isSaving:D.isPending}),Ce=Y.useCallback((e,t)=>{me(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),we=Y.useCallback((e,t)=>{ge(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),Te=e=>{z===`error`&&D.reset(),B(`idle`);let t=e.slug!==void 0;for(let t of Object.keys(e))P.current.add(t);a&&e.name!==void 0&&!R.current&&(e={...e,slug:_t(e.name)}),t&&(R.current=!!e.slug),k(t=>t&&{...t,...e})},Ee=(e,t)=>{j(n=>{if(t===null){if(!(e in n))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},W=Y.useCallback(()=>{if(!O||xe||!a&&(!b||M.current!==b.id))return;let e={...xt(O)};A.accentColor&&(e.accentColor=A.accentColor),j(e);let i=Object.values(e)[0];if(i){B(`idle`),o.error(i);return}let s=t,c=b?.id;B(`pending`);let l=e=>{if(I.current!==s)return;let r=e.tags?.[0];if(!r){B(`error`),o.error(`Couldn’t save the tag.`);return}let i=mt(r);N.current=i,k(i),P.current.clear(),B(`success`),!U()&&r.slug!==t&&(L.current=r.slug,H(),n(`/tags/${r.slug}`,{replace:!0}))},u=e=>{I.current===s&&(B(`error`),r(e))};if(a){E.mutate(St(O,null,P.current),{onSuccess:l,onError:u});return}b&&T.mutate({id:b.id,...St(O,mt(b).name,P.current)},{onSuccess:e=>{I.current!==s||M.current!==c||l(e)},onError:u})},[O,A.accentColor,a,b,t,xe,E,T,n,r,H,U]);Y.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),W())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[W]);let G=`Save`,De=`default`;z===`pending`?G=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ne,{size:`sm`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Saving`})]}):z===`error`?(G=`Retry`,De=`destructive`):z===`success`&&!ve&&(G=`Saved`);let K=!!O&&!!w&&(a||!!b),q=``;return a?q=`New tag`:O&&K?q=O.name:b&&(q=b.name),x?(0,X.jsx)(Qe,{}):(0,X.jsx)(v,{className:`size-full`,children:(0,X.jsx)(y,{className:`relative flex h-full flex-col`,size:`page`,children:(0,X.jsxs)(et,{"data-testid":`tag-detail`,children:[(0,X.jsx)(et.Header,{children:(0,X.jsxs)(J,{blurredBackground:!1,sticky:!1,children:[(0,X.jsx)(J.Left,{children:(0,X.jsx)(le,{children:(0,X.jsxs)(ae,{children:[(0,X.jsx)(oe,{children:(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(p,{"data-test-link":`tags-back`,to:`/tags`,children:`Tags`})})}),(0,X.jsx)(se,{}),(0,X.jsxs)(oe,{className:e?`items-baseline gap-2`:`gap-2`,children:[!a&&d?(0,X.jsx)(Me,{className:`h-4 w-40`}):(0,X.jsx)(ie,{className:`truncate`,"data-testid":`tag-detail-title`,children:q}),b?.visibility===`internal`&&(0,X.jsx)(re,{className:e?`leading-none tracking-wider`:`px-1 py-px text-[10px] leading-none tracking-wider`,"data-testid":`tag-detail-internal-badge`,size:e?`md`:`default`,variant:`secondary`,children:e?`Internal`:`INTERNAL`})]})]})})}),K&&O&&(0,X.jsx)(J.Actions,{children:(0,X.jsxs)(J.ActionGroup,{children:[!a&&b&&(0,X.jsxs)(qe,{children:[(0,X.jsx)($e,{asChild:!0,children:(0,X.jsx)(F,{"aria-label":`Tag actions`,className:`size-(--control-height)`,size:`icon`,variant:`subtle`,children:(0,X.jsx)(ne,{size:16})})}),(0,X.jsxs)(Ze,{align:`end`,children:[(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsxs)(`a`,{href:Ct(O,w),rel:`noopener noreferrer`,target:`_blank`,children:[(0,X.jsx)(te,{}),`View posts`]})}),(0,X.jsx)(Xe,{}),(0,X.jsxs)(Je,{className:`text-destructive focus:text-destructive`,disabled:D.isPending||ye,onSelect:()=>de(!0),children:[(0,X.jsx)(ee,{}),`Delete tag`]})]})]}),(0,X.jsx)(F,{className:`min-w-16`,disabled:xe,variant:De,onClick:W,children:G})]})})]})}),(0,X.jsxs)(et.Body,{children:[S&&(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3`,"data-testid":`tag-detail-load-error`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`Couldn’t load this tag.`}),(0,X.jsx)(F,{variant:`outline`,onClick:()=>void g(),children:`Retry`})]}),K&&O&&(0,X.jsx)(`div`,{className:`flex flex-col gap-8`,children:(0,X.jsx)(Ft,{blogUrl:w,disabled:D.isPending||V,draft:O,errors:A,onChange:Te,onFieldError:Ee,onImageBusyChange:Ce,onImageUploadPendingChange:we},a?It:b?.id)})]}),!a&&b&&(0,X.jsx)(at,{allowLeaveWithUnsavedChanges:H,displayName:O?.name??b.name,open:ue,tag:b,onOpenChange:de,onPendingChange:fe},b.id),(0,X.jsx)(He,{...Se})]})})})};export{Lt as default};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`7dff62b0-f428-462e-a04a-5cc2a4d697e8`,e._sentryDebugIdIdentifier=`sentry-dbid-7dff62b0-f428-462e-a04a-5cc2a4d697e8`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{t as r}from"./src-BwdakGcc.js";import{r as i}from"./tags-ZhqbPPc6.js";import{J as a,L as o}from"./shade-provider-DvrXKKQZ.js";import{a as s,ar as c,dt as l,or as ee}from"./button-CTHYSI-d.js";import{t as u}from"./badge-DuMiqyUH.js";import{c as d,d as f,f as p,i as m,l as h,n as te,o as g,p as _,r as v,t as y,u as b}from"./sortable.esm-ERukM7Vc.js";import{m as x}from"./label-picker-GTIIlBQ6.js";import{n as S}from"./index.module-CnPepLB9.js";var C=e(t(),1),w=n(),T=e(a(),1);function E(e){return e.name??``}function D(e){return e.trim()}function O(e){return e.visibility===`internal`||E(e).startsWith(`#`)}function k(e,t){return e.id&&t.id?e.id===t.id:E(e).toLowerCase()===E(t).toLowerCase()}function A(e){return e.map(e=>e.id?{id:e.id}:{name:E(e)})}function j(e){return e.id??`new:${E(e).toLowerCase()}`}function M(e,t){return E(t)===``||e.some(e=>k(e,t))?e:[...e,t]}function N(e,t){return e.filter(e=>j(e)!==t)}function P(e){return[...e].sort((e,t)=>E(e).localeCompare(E(t),void 0,{ignorePunctuation:!0}))}function F(e,t,n){if(e===``)return!1;let r=e.toLowerCase();return![...t,...n].some(e=>E(e).toLowerCase()===r)}function I(e){return e.utcOffset()===0?`(UTC)`:`(UTC${e.format(`Z`).replace(/([+-])0/,`$1`).replace(/:00/,``)})`}function L(e,{timezone:t=`etc/UTC`,scheduled:n,absolute:r,short:i,now:a}={}){if(!e)return``;let o=T.default.tz(e,t),s=T.default.tz(a??T.default.utc(),t);if(!o.isValid())return``;let c=I(o);if(Math.abs(s.diff(o,`hours`,!0))<=12)return o.from(s);if(o.isSame(s,`day`)){let e=o.format(`HH:mm [${c}] [Today]`);return n?`at ${e}`:e}return r&&o.isSame(s.clone().subtract(1,`days`).startOf(`day`),`day`)?i?o.format(`[Yesterday]`):o.format(`HH:mm [${c}] [yesterday]`):n&&o.isSame(s.clone().add(1,`days`).startOf(`day`),`day`)?o.format(`[at] HH:mm [${c}] [tomorrow]`):n?o.format(`[at] HH:mm [${c}] [on] DD MMM YYYY`):i?o.format(`DD MMM YYYY`):o.format(`HH:mm [${c}] DD MMM YYYY`)}var ne=e=>e.trim(),re=64;function R({options:e,selected:t,getKey:n,getLabel:r,isChosen:i,renderOption:a,chipVariant:s,chipClassName:l,onAdd:ee,onRemove:u,onReorder:d,hideSelected:f=!1,matches:p,normalizeTerm:m=ne,createRow:h,onSearchChange:g,onOpenChange:_,onEndReached:v,reopenOnRemove:y=!1,notice:b,inputRef:S,emptyMessage:T,placeholder:E,inputLabel:D,inputId:O,describedBy:k,invalid:A,maxLength:j,testIds:M}){let N=(0,C.useId)(),[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(``),[R,B]=(0,C.useState)(0),V=(0,C.useRef)(null),H=S??V,U=(0,C.useRef)(null),W=(0,C.useRef)(null),G=(0,C.useRef)(null),K=(0,C.useRef)(v);K.current=v;let q=(0,C.useCallback)(()=>{let e=G.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=re&&K.current?.()},[]),J=m(I),oe=e=>{L(e),g?.(e)},Y=()=>{F(!0),_?.(!0)},se=(0,C.useCallback)(()=>{F(!1),_?.(!1)},[_]),X=(0,C.useCallback)(()=>{F(!1),_?.(!1),L(``),g?.(``)},[_,g]);(0,C.useEffect)(()=>{if(!P)return;let e=e=>{U.current&&!U.current.contains(e.target)&&X()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[X,P]),(0,C.useEffect)(()=>{if(!P)return;let e=e=>{e.isComposing||e.keyCode===229||e.key===`Escape`&&(e.preventDefault(),se())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[se,P]),(0,C.useEffect)(()=>{B(0)},[J]);let Z=e=>t.find(t=>i?i(e,t):n(e)===n(t)),ce=p&&J!==``?e.filter(e=>p(e,J)):e,le=f?ce.filter(e=>!Z(e)):ce,Q=b?[]:[...le.map(e=>({kind:`option`,key:n(e),option:e,chosen:!!Z(e)})),...h?.offer(J,le)?[{kind:`create`,key:`create`}]:[]],$=Math.min(R,Math.max(Q.length-1,0));(0,C.useEffect)(()=>{P&&q()},[P,q,Q.length]),(0,C.useEffect)(()=>{W.current?.querySelector(`[data-highlighted="true"]`)?.scrollIntoView({block:`nearest`})},[$,P]);let ue=e=>{if(e.kind===`create`)h?.onSelect(J);else{let t=Z(e.option);t?u(n(t)):ee(e.option)}oe(``)},de=e=>{if(!(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)){if(e.key===`Backspace`&&I===``&&t.length>0){u(n(t[t.length-1])),y&&Y();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!P){Y();return}if(Q.length>0){let t=e.key===`ArrowDown`?1:-1;B(($+t+Q.length)%Q.length)}return}(e.key===`Enter`||e.key===`Tab`&&J!==``)&&P&&Q[$]&&(e.preventDefault(),ue(Q[$]))}},fe=e=>`${N}-option-${e}`;return(0,w.jsxs)(`div`,{ref:U,className:`relative`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||X()},children:[(0,w.jsxs)(`div`,{className:o(x.field,`pr-8`),"data-testid":M?.field,onClick:()=>{H.current?.focus(),Y()},children:[d?(0,w.jsx)(ae,{keys:t.map(n),labelFor:e=>{let i=t.find(t=>n(t)===e);return i?r(i):e},onMove:(e,n)=>d(te([...t],e,n)),children:t.map(e=>(0,w.jsx)(ie,{className:l?.(e),id:n(e),label:r(e),testId:M?.chip,variant:s?.(e)??`default`,onRemove:()=>u(n(e))},n(e)))}):t.map(e=>(0,w.jsx)(z,{className:l?.(e),label:r(e),testId:M?.chip,variant:s?.(e)??`default`,onRemove:()=>u(n(e))},n(e))),(0,w.jsx)(`input`,{ref:H,"aria-activedescendant":P&&Q[$]?fe($):void 0,"aria-autocomplete":`list`,"aria-controls":P?N:void 0,"aria-describedby":k,"aria-expanded":P,"aria-invalid":A,"aria-label":O?void 0:D,className:x.input,"data-testid":M?.input,id:O,maxLength:j,placeholder:t.length===0?E:``,role:`combobox`,value:I,onChange:e=>{oe(e.target.value),Y()},onKeyDown:de}),(0,w.jsx)(c,{className:x.chevron})]}),P&&(0,w.jsxs)(`div`,{ref:G,className:`absolute top-full left-0 z-50 mt-1 max-h-64 w-full overflow-y-auto rounded-md border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-md dark:border-border/30`,onScroll:v?q:void 0,children:[b,(0,w.jsxs)(`div`,{ref:W,"aria-label":D,"data-testid":M?.list,id:N,role:`listbox`,children:[!b&&Q.length===0&&(0,w.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:T}),Q.map((e,t)=>{let n=t===$,i=e.kind===`option`&&e.chosen;return(0,w.jsx)(`div`,{"aria-selected":i,className:o(`flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm`,n&&`bg-accent text-accent-foreground`),"data-highlighted":n,id:fe(t),role:`option`,onClick:()=>ue(e),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>B(t),children:e.kind===`create`?h?.render(J):a?.(e.option,{chosen:i})??(0,w.jsx)(`span`,{className:`truncate`,children:r(e.option)})},e.key)})]})]})]})}function z({label:e,variant:t,testId:n,onRemove:r,setRef:i,listeners:a,className:c,style:l}){return(0,w.jsx)(u,{className:o(x.chip,c),variant:t,asChild:!0,children:(0,w.jsxs)(`button`,{ref:i,"aria-label":`Remove ${e}`,"data-testid":n,style:l,type:`button`,...a,onClick:e=>{e.stopPropagation(),r()},children:[(0,w.jsx)(`span`,{className:`truncate`,children:e}),(0,w.jsx)(s,{className:`size-3`})]})})}function ie({id:e,...t}){let{listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:s}=m({id:e});return(0,w.jsx)(z,{...t,className:o(`touch-manipulation`,s&&`z-10`,t.className),listeners:n,setRef:r,style:{transform:_.Translate.toString(i),transition:a}})}var B={draggable:``};function ae({keys:e,labelFor:t,onMove:n,children:r}){let i=p(f(d,{activationConstraint:{distance:4}}),f(h,{activationConstraint:{delay:200,tolerance:5}})),a=(0,C.useRef)({keys:e,labelFor:t});a.current={keys:e,labelFor:t};let o=(0,C.useMemo)(()=>{let e=e=>a.current.labelFor(String(e)),t=e=>`position ${a.current.keys.indexOf(String(e))+1} of ${a.current.keys.length}`;return{onDragStart:({active:t})=>`Picked up ${e(t.id)}.`,onDragOver:({active:n,over:r})=>r&&r.id!==n.id?`${e(n.id)} moved to ${t(r.id)}.`:void 0,onDragEnd:({active:n,over:r})=>r&&r.id!==n.id?`${e(n.id)} was dropped at ${t(r.id)}.`:`${e(n.id)} was dropped.`,onDragCancel:({active:t})=>`Moving ${e(t.id)} was cancelled.`}},[]);return(0,w.jsx)(g,{accessibility:{announcements:o,screenReaderInstructions:B},collisionDetection:b,sensors:i,onDragEnd:({active:t,over:r})=>{if(!r||t.id===r.id)return;let i=e.indexOf(String(t.id)),a=e.indexOf(String(r.id));i!==-1&&a!==-1&&n(i,a)},children:(0,w.jsx)(y,{items:e,strategy:v,children:r})})}var V=250,H=`100`;function U({selected:e,onAdd:t,onRemove:n,onReorder:a,inputLabel:o,inputId:s,hideSelected:c=!1,deferSearch:u=!1,requestOptions:d,defaultErrorHandler:f,onSearchChange:p,maxLength:m,testIds:h}){let[te,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(``),y=D(_),[b]=S(y,V),{data:x,isFetching:T,hasNextPage:A,fetchNextPage:M}=i({filter:{},enabled:u?te:void 0,defaultErrorHandler:f,requestOptions:d,searchParams:{limit:H,order:`name asc`,...b?{filter:`tags.name:~${r(b)}`}:{}}}),N=x?.tags??[],I=!T&&y===b,L=(0,C.useCallback)(e=>{v(e),p?.(e)},[p]);return(0,w.jsx)(R,{chipClassName:e=>O(e)?`border-border bg-secondary/30 text-secondary-foreground/70`:void 0,chipVariant:e=>O(e)?`outline`:`secondary`,createRow:{offer:(t,n)=>I&&F(t,n,e),render:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l,{className:`size-4 shrink-0`}),(0,w.jsxs)(`span`,{className:`truncate`,children:[`Create “`,e,`”`]})]}),onSelect:e=>t({name:e})},emptyMessage:`No tags found`,getKey:j,getLabel:E,hideSelected:c,inputId:s,inputLabel:o,isChosen:(e,t)=>k(t,e),matches:(e,t)=>E(e).toLowerCase().includes(t.toLowerCase()),maxLength:m,normalizeTerm:D,options:P(N),placeholder:`Select or enter tags...`,renderOption:(e,{chosen:t})=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`truncate`,children:e.name}),(0,w.jsx)(`span`,{className:`ms-auto truncate font-mono text-xs text-muted-foreground`,children:e.slug}),t&&(0,w.jsx)(ee,{className:`size-4 shrink-0 text-primary`})]}),selected:e,testIds:{field:h?.field??`tag-picker`,input:h?.input,list:h?.list,chip:h?.chip},onAdd:e=>t({id:e.id,name:e.name,slug:e.slug}),onEndReached:()=>{A&&I&&M()},onOpenChange:g,onRemove:n,onReorder:a,onSearchChange:L})}export{N as a,j as c,M as i,R as n,k as o,L as r,A as s,U as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`7dff62b0-f428-462e-a04a-5cc2a4d697e8`,e._sentryDebugIdIdentifier=`sentry-dbid-7dff62b0-f428-462e-a04a-5cc2a4d697e8`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{t as r}from"./src-BwdakGcc.js";import{r as i}from"./tags-OlmRJ6Ps.js";import{J as a,L as o}from"./shade-provider-DvrXKKQZ.js";import{a as s,ar as c,dt as l,or as ee}from"./button-CTHYSI-d.js";import{t as u}from"./badge-DuMiqyUH.js";import{c as d,d as f,f as p,i as m,l as h,n as te,o as g,p as _,r as v,t as y,u as b}from"./sortable.esm-ERukM7Vc.js";import{m as x}from"./label-picker-DaivLdMw.js";import{n as S}from"./index.module-CnPepLB9.js";var C=e(t(),1),w=n(),T=e(a(),1);function E(e){return e.name??``}function D(e){return e.trim()}function O(e){return e.visibility===`internal`||E(e).startsWith(`#`)}function k(e,t){return e.id&&t.id?e.id===t.id:E(e).toLowerCase()===E(t).toLowerCase()}function A(e){return e.map(e=>e.id?{id:e.id}:{name:E(e)})}function j(e){return e.id??`new:${E(e).toLowerCase()}`}function M(e,t){return E(t)===``||e.some(e=>k(e,t))?e:[...e,t]}function N(e,t){return e.filter(e=>j(e)!==t)}function P(e){return[...e].sort((e,t)=>E(e).localeCompare(E(t),void 0,{ignorePunctuation:!0}))}function F(e,t,n){if(e===``)return!1;let r=e.toLowerCase();return![...t,...n].some(e=>E(e).toLowerCase()===r)}function I(e){return e.utcOffset()===0?`(UTC)`:`(UTC${e.format(`Z`).replace(/([+-])0/,`$1`).replace(/:00/,``)})`}function L(e,{timezone:t=`etc/UTC`,scheduled:n,absolute:r,short:i,now:a}={}){if(!e)return``;let o=T.default.tz(e,t),s=T.default.tz(a??T.default.utc(),t);if(!o.isValid())return``;let c=I(o);if(Math.abs(s.diff(o,`hours`,!0))<=12)return o.from(s);if(o.isSame(s,`day`)){let e=o.format(`HH:mm [${c}] [Today]`);return n?`at ${e}`:e}return r&&o.isSame(s.clone().subtract(1,`days`).startOf(`day`),`day`)?i?o.format(`[Yesterday]`):o.format(`HH:mm [${c}] [yesterday]`):n&&o.isSame(s.clone().add(1,`days`).startOf(`day`),`day`)?o.format(`[at] HH:mm [${c}] [tomorrow]`):n?o.format(`[at] HH:mm [${c}] [on] DD MMM YYYY`):i?o.format(`DD MMM YYYY`):o.format(`HH:mm [${c}] DD MMM YYYY`)}var ne=e=>e.trim(),re=64;function R({options:e,selected:t,getKey:n,getLabel:r,isChosen:i,renderOption:a,chipVariant:s,chipClassName:l,onAdd:ee,onRemove:u,onReorder:d,hideSelected:f=!1,matches:p,normalizeTerm:m=ne,createRow:h,onSearchChange:g,onOpenChange:_,onEndReached:v,reopenOnRemove:y=!1,notice:b,inputRef:S,emptyMessage:T,placeholder:E,inputLabel:D,inputId:O,describedBy:k,invalid:A,maxLength:j,testIds:M}){let N=(0,C.useId)(),[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(``),[R,B]=(0,C.useState)(0),V=(0,C.useRef)(null),H=S??V,U=(0,C.useRef)(null),W=(0,C.useRef)(null),G=(0,C.useRef)(null),K=(0,C.useRef)(v);K.current=v;let q=(0,C.useCallback)(()=>{let e=G.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=re&&K.current?.()},[]),J=m(I),oe=e=>{L(e),g?.(e)},Y=()=>{F(!0),_?.(!0)},se=(0,C.useCallback)(()=>{F(!1),_?.(!1)},[_]),X=(0,C.useCallback)(()=>{F(!1),_?.(!1),L(``),g?.(``)},[_,g]);(0,C.useEffect)(()=>{if(!P)return;let e=e=>{U.current&&!U.current.contains(e.target)&&X()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[X,P]),(0,C.useEffect)(()=>{if(!P)return;let e=e=>{e.isComposing||e.keyCode===229||e.key===`Escape`&&(e.preventDefault(),se())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[se,P]),(0,C.useEffect)(()=>{B(0)},[J]);let Z=e=>t.find(t=>i?i(e,t):n(e)===n(t)),ce=p&&J!==``?e.filter(e=>p(e,J)):e,le=f?ce.filter(e=>!Z(e)):ce,Q=b?[]:[...le.map(e=>({kind:`option`,key:n(e),option:e,chosen:!!Z(e)})),...h?.offer(J,le)?[{kind:`create`,key:`create`}]:[]],$=Math.min(R,Math.max(Q.length-1,0));(0,C.useEffect)(()=>{P&&q()},[P,q,Q.length]),(0,C.useEffect)(()=>{W.current?.querySelector(`[data-highlighted="true"]`)?.scrollIntoView({block:`nearest`})},[$,P]);let ue=e=>{if(e.kind===`create`)h?.onSelect(J);else{let t=Z(e.option);t?u(n(t)):ee(e.option)}oe(``)},de=e=>{if(!(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)){if(e.key===`Backspace`&&I===``&&t.length>0){u(n(t[t.length-1])),y&&Y();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!P){Y();return}if(Q.length>0){let t=e.key===`ArrowDown`?1:-1;B(($+t+Q.length)%Q.length)}return}(e.key===`Enter`||e.key===`Tab`&&J!==``)&&P&&Q[$]&&(e.preventDefault(),ue(Q[$]))}},fe=e=>`${N}-option-${e}`;return(0,w.jsxs)(`div`,{ref:U,className:`relative`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||X()},children:[(0,w.jsxs)(`div`,{className:o(x.field,`pr-8`),"data-testid":M?.field,onClick:()=>{H.current?.focus(),Y()},children:[d?(0,w.jsx)(ae,{keys:t.map(n),labelFor:e=>{let i=t.find(t=>n(t)===e);return i?r(i):e},onMove:(e,n)=>d(te([...t],e,n)),children:t.map(e=>(0,w.jsx)(ie,{className:l?.(e),id:n(e),label:r(e),testId:M?.chip,variant:s?.(e)??`default`,onRemove:()=>u(n(e))},n(e)))}):t.map(e=>(0,w.jsx)(z,{className:l?.(e),label:r(e),testId:M?.chip,variant:s?.(e)??`default`,onRemove:()=>u(n(e))},n(e))),(0,w.jsx)(`input`,{ref:H,"aria-activedescendant":P&&Q[$]?fe($):void 0,"aria-autocomplete":`list`,"aria-controls":P?N:void 0,"aria-describedby":k,"aria-expanded":P,"aria-invalid":A,"aria-label":O?void 0:D,className:x.input,"data-testid":M?.input,id:O,maxLength:j,placeholder:t.length===0?E:``,role:`combobox`,value:I,onChange:e=>{oe(e.target.value),Y()},onKeyDown:de}),(0,w.jsx)(c,{className:x.chevron})]}),P&&(0,w.jsxs)(`div`,{ref:G,className:`absolute top-full left-0 z-50 mt-1 max-h-64 w-full overflow-y-auto rounded-md border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-md dark:border-border/30`,onScroll:v?q:void 0,children:[b,(0,w.jsxs)(`div`,{ref:W,"aria-label":D,"data-testid":M?.list,id:N,role:`listbox`,children:[!b&&Q.length===0&&(0,w.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:T}),Q.map((e,t)=>{let n=t===$,i=e.kind===`option`&&e.chosen;return(0,w.jsx)(`div`,{"aria-selected":i,className:o(`flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm`,n&&`bg-accent text-accent-foreground`),"data-highlighted":n,id:fe(t),role:`option`,onClick:()=>ue(e),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>B(t),children:e.kind===`create`?h?.render(J):a?.(e.option,{chosen:i})??(0,w.jsx)(`span`,{className:`truncate`,children:r(e.option)})},e.key)})]})]})]})}function z({label:e,variant:t,testId:n,onRemove:r,setRef:i,listeners:a,className:c,style:l}){return(0,w.jsx)(u,{className:o(x.chip,c),variant:t,asChild:!0,children:(0,w.jsxs)(`button`,{ref:i,"aria-label":`Remove ${e}`,"data-testid":n,style:l,type:`button`,...a,onClick:e=>{e.stopPropagation(),r()},children:[(0,w.jsx)(`span`,{className:`truncate`,children:e}),(0,w.jsx)(s,{className:`size-3`})]})})}function ie({id:e,...t}){let{listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:s}=m({id:e});return(0,w.jsx)(z,{...t,className:o(`touch-manipulation`,s&&`z-10`,t.className),listeners:n,setRef:r,style:{transform:_.Translate.toString(i),transition:a}})}var B={draggable:``};function ae({keys:e,labelFor:t,onMove:n,children:r}){let i=p(f(d,{activationConstraint:{distance:4}}),f(h,{activationConstraint:{delay:200,tolerance:5}})),a=(0,C.useRef)({keys:e,labelFor:t});a.current={keys:e,labelFor:t};let o=(0,C.useMemo)(()=>{let e=e=>a.current.labelFor(String(e)),t=e=>`position ${a.current.keys.indexOf(String(e))+1} of ${a.current.keys.length}`;return{onDragStart:({active:t})=>`Picked up ${e(t.id)}.`,onDragOver:({active:n,over:r})=>r&&r.id!==n.id?`${e(n.id)} moved to ${t(r.id)}.`:void 0,onDragEnd:({active:n,over:r})=>r&&r.id!==n.id?`${e(n.id)} was dropped at ${t(r.id)}.`:`${e(n.id)} was dropped.`,onDragCancel:({active:t})=>`Moving ${e(t.id)} was cancelled.`}},[]);return(0,w.jsx)(g,{accessibility:{announcements:o,screenReaderInstructions:B},collisionDetection:b,sensors:i,onDragEnd:({active:t,over:r})=>{if(!r||t.id===r.id)return;let i=e.indexOf(String(t.id)),a=e.indexOf(String(r.id));i!==-1&&a!==-1&&n(i,a)},children:(0,w.jsx)(y,{items:e,strategy:v,children:r})})}var V=250,H=`100`;function U({selected:e,onAdd:t,onRemove:n,onReorder:a,inputLabel:o,inputId:s,hideSelected:c=!1,deferSearch:u=!1,requestOptions:d,defaultErrorHandler:f,onSearchChange:p,maxLength:m,testIds:h}){let[te,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(``),y=D(_),[b]=S(y,V),{data:x,isFetching:T,hasNextPage:A,fetchNextPage:M}=i({filter:{},enabled:u?te:void 0,defaultErrorHandler:f,requestOptions:d,searchParams:{limit:H,order:`name asc`,...b?{filter:`tags.name:~${r(b)}`}:{}}}),N=x?.tags??[],I=!T&&y===b,L=(0,C.useCallback)(e=>{v(e),p?.(e)},[p]);return(0,w.jsx)(R,{chipClassName:e=>O(e)?`border-border bg-secondary/30 text-secondary-foreground/70`:void 0,chipVariant:e=>O(e)?`outline`:`secondary`,createRow:{offer:(t,n)=>I&&F(t,n,e),render:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l,{className:`size-4 shrink-0`}),(0,w.jsxs)(`span`,{className:`truncate`,children:[`Create “`,e,`”`]})]}),onSelect:e=>t({name:e})},emptyMessage:`No tags found`,getKey:j,getLabel:E,hideSelected:c,inputId:s,inputLabel:o,isChosen:(e,t)=>k(t,e),matches:(e,t)=>E(e).toLowerCase().includes(t.toLowerCase()),maxLength:m,normalizeTerm:D,options:P(N),placeholder:`Select or enter tags...`,renderOption:(e,{chosen:t})=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`truncate`,children:e.name}),(0,w.jsx)(`span`,{className:`ms-auto truncate font-mono text-xs text-muted-foreground`,children:e.slug}),t&&(0,w.jsx)(ee,{className:`size-4 shrink-0 text-primary`})]}),selected:e,testIds:{field:h?.field??`tag-picker`,input:h?.input,list:h?.list,chip:h?.chip},onAdd:e=>t({id:e.id,name:e.name,slug:e.slug}),onEndReached:()=>{A&&I&&M()},onOpenChange:g,onRemove:n,onReorder:a,onSearchChange:L})}export{N as a,j as c,M as i,R as n,k as o,L as r,A as s,U as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`ef7ed2ab-0244-4f83-9981-371d636dc336`,e._sentryDebugIdIdentifier=`sentry-dbid-ef7ed2ab-0244-4f83-9981-371d636dc336`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{r}from"./tags-ZhqbPPc6.js";import{_ as i,n as a}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as o,L as s,r as c}from"./shade-provider-DvrXKKQZ.js";import{t as l}from"./box-BOIwAOVT.js";import{t as u}from"./container-DakAbO79.js";import{F as d,Pn as f,dt as p,t as m,yt as h}from"./button-CTHYSI-d.js";import{t as g}from"./empty-indicator-BhVwqSVH.js";import{n as _}from"./loading-indicator-DaRyGrxv.js";import{t as v}from"./page-header-Baymg6VR.js";import{a as y,c as b,n as x,r as S,s as C,t as w}from"./table-DQ63Yu4a.js";import{n as T,t as E}from"./toggle-group-D7ly9OGa.js";import{lt as D,s as O}from"./index-CuDhPtkB.js";import{t as k}from"./list-page-BnOuLOBb.js";import{i as A,r as j,t as M}from"./virtual-list-qPFukjyT.js";var N=e(t(),1),P=n(),F=({height:e})=>(0,P.jsx)(`tr`,{"aria-hidden":`true`,className:`flex lg:table-row`,children:(0,P.jsx)(`td`,{className:`flex lg:table-cell`,style:{height:e}})}),I=(0,N.forwardRef)(function(e,t){return(0,P.jsx)(b,{ref:t,...e,"aria-hidden":`true`,className:`relative flex flex-col lg:table-row`,children:(0,P.jsx)(S,{className:`relative z-10 h-24 animate-pulse`,children:(0,P.jsx)(`div`,{className:`h-full rounded-md bg-muted`,"data-testid":`loading-placeholder`})})})});function L({items:e,totalItems:t,hasNextPage:n,isFetchingNextPage:r,fetchNextPage:i}){let{isAdmin7:a}=c(),l=(0,N.useRef)(null),{visibleItemCount:u,canLoadMore:d,loadMore:f}=j(t),{visibleItems:p,spaceBefore:g,spaceAfter:_}=A({items:e,totalItems:u,hasNextPage:n,isFetchingNextPage:r,fetchNextPage:i,parentRef:l});return(0,P.jsxs)(`div`,{ref:l,className:`overflow-hidden`,children:[(0,P.jsxs)(w,{className:`flex table-fixed flex-col lg:table`,"data-testid":`tags-list`,children:[(0,P.jsx)(C,{className:`hidden lg:visible! lg:table-header-group!`,children:(0,P.jsxs)(b,{children:[(0,P.jsx)(y,{className:`w-auto px-4`,children:`Tag`}),(0,P.jsx)(y,{className:`w-1/5 px-4`,children:`Slug`}),(0,P.jsx)(y,{className:`w-1/5 px-4`,children:`No. of posts`}),!a&&(0,P.jsx)(y,{className:`w-20 px-4`})]})}),(0,P.jsxs)(x,{className:`flex flex-col lg:table-row-group`,children:[(0,P.jsx)(F,{height:g}),p.map(({key:t,virtualItem:n,item:r,props:i})=>n.index>e.length-1?(0,P.jsx)(I,{...i},t):(0,P.jsxs)(b,{...i,className:s(`group grid w-full items-center gap-x-4 p-2 lg:table-row lg:p-0`,a?`grid-cols-1 md:grid-cols-[1fr_auto]`:`grid-cols-[1fr_5rem] md:grid-cols-[1fr_auto_5rem]`),"data-testid":`tag-list-row`,children:[(0,P.jsxs)(S,{className:`static col-start-1 col-end-1 row-start-1 row-end-1 flex min-w-0 flex-col p-0 md:relative lg:table-cell lg:w-1/2 lg:p-4 xl:w-3/5`,children:[(0,P.jsx)(O,{className:`before:absolute before:top-0 before:left-0 before:z-10 before:h-full before:w-[100vw]`,to:`/tags/${r.slug}`,children:(0,P.jsx)(`span`,{className:`block truncate text-base text-md font-semibold`,children:r.name})}),(0,P.jsx)(`span`,{className:`block truncate text-muted-foreground`,children:r.description})]}),(0,P.jsx)(S,{className:`col-start-1 col-end-1 row-start-2 row-end-2 flex p-0 lg:table-cell lg:p-4`,children:(0,P.jsx)(`span`,{className:`block truncate`,children:r.slug})}),(0,P.jsx)(S,{className:`col-start-1 col-end-1 row-start-3 row-end-3 flex p-0 md:col-start-2 md:col-end-2 md:row-start-1 md:row-end-3 lg:table-cell lg:p-4`,children:r.count?.posts?(0,P.jsx)(`a`,{className:`relative z-10 -m-4 inline-block p-4 hover:underline`,href:`#/posts?tag=${r.slug}`,children:`${o(r.count?.posts)} ${r.count?.posts===1?`post`:`posts`}`}):(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:`0 posts`})}),!a&&(0,P.jsx)(S,{className:`col-start-2 col-end-2 row-start-1 row-end-3 p-0 md:col-start-3 md:col-end-3 lg:table-cell lg:p-4`,children:(0,P.jsx)(m,{"aria-hidden":`true`,className:`opacity-0 transition-all group-hover:opacity-100`,size:`icon`,tabIndex:-1,variant:`outline`,children:(0,P.jsx)(h,{})})})]},t)),(0,P.jsx)(F,{height:_})]})]}),d&&(0,P.jsx)(M,{isLoading:r,onClick:f})]})}var R=()=>{let{isAdmin7:e}=c(),[t,n]=i(),o=t.get(`type`)??`public`,{data:s,isError:h,isLoading:y,isFetchingNextPage:b,fetchNextPage:x,hasNextPage:S}=r({filter:{visibility:o}});return(0,P.jsx)(l,{className:`size-full`,children:(0,P.jsx)(u,{className:`relative flex h-full flex-col`,size:`page`,children:(0,P.jsxs)(k,{"data-testid":`tags-page`,children:[(0,P.jsx)(k.Header,{children:(0,P.jsxs)(v,{blurredBackground:!1,sticky:!1,children:[(0,P.jsx)(v.Left,{children:(0,P.jsx)(v.Title,{children:`Tags`})}),(0,P.jsxs)(v.Actions,{children:[(0,P.jsxs)(v.ActionGroup,{children:[(0,P.jsxs)(E,{"data-testid":`tags-header-tabs`,size:`button`,type:`single`,value:o,children:[(0,P.jsx)(T,{"aria-label":`Public tags`,value:`public`,asChild:!0,children:(0,P.jsx)(a,{to:`/tags`,children:`Public tags`})}),(0,P.jsx)(T,{"aria-label":`Internal tags`,value:`internal`,asChild:!0,children:(0,P.jsx)(a,{to:`/tags?type=internal`,children:`Internal tags`})})]}),(0,P.jsxs)(v.ActionGroup.MobileMenu,{children:[(0,P.jsx)(v.ActionGroup.MobileMenuTrigger,{children:(0,P.jsx)(m,{"aria-label":`More tag actions`,size:e?`icon`:void 0,variant:`subtle`,children:(0,P.jsx)(f,{className:`size-4`})})}),(0,P.jsxs)(v.ActionGroup.MobileMenuContent,{children:[(0,P.jsx)(D,{checked:o===`public`,onCheckedChange:()=>n({}),children:`Public tags`}),(0,P.jsx)(D,{checked:o===`internal`,onCheckedChange:()=>n({type:`internal`}),children:`Internal tags`})]})]})]}),(0,P.jsx)(v.ActionGroup,{children:(0,P.jsx)(m,{asChild:!0,children:(0,P.jsxs)(O,{className:`font-bold`,to:`/tags/new`,children:[(0,P.jsx)(p,{className:`size-4`}),(0,P.jsx)(`span`,{className:`hidden sm:inline`,children:`New tag`})]})})})]})]})}),(0,P.jsx)(k.Body,{children:y?(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,P.jsx)(_,{size:`lg`})}):h?(0,P.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:[(0,P.jsx)(`h2`,{className:`mb-2 text-xl font-medium`,children:`Error loading tags`}),(0,P.jsx)(`p`,{className:`mb-4 text-muted-foreground`,children:`Please reload the page to try again`}),(0,P.jsx)(m,{onClick:()=>window.location.reload(),children:`Reload page`})]}):s?.tags.length?(0,P.jsx)(L,{fetchNextPage:()=>void x(),hasNextPage:S,isFetchingNextPage:b,items:s?.tags??[],totalItems:s?.meta?.pagination?.total??0}):(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,P.jsx)(g,{actions:(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(O,{to:`/tags/new`,children:`Create a new tag`})}),title:`Start organizing your content`,children:(0,P.jsx)(d,{})})})})]})})})};export{R as default};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`ef7ed2ab-0244-4f83-9981-371d636dc336`,e._sentryDebugIdIdentifier=`sentry-dbid-ef7ed2ab-0244-4f83-9981-371d636dc336`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{r}from"./tags-OlmRJ6Ps.js";import{_ as i,n as a}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as o,L as s,r as c}from"./shade-provider-DvrXKKQZ.js";import{t as l}from"./box-BOIwAOVT.js";import{t as u}from"./container-DakAbO79.js";import{F as d,Pn as f,dt as p,t as m,yt as h}from"./button-CTHYSI-d.js";import{t as g}from"./empty-indicator-BhVwqSVH.js";import{n as _}from"./loading-indicator-DaRyGrxv.js";import{t as v}from"./page-header-CxTb0je5.js";import{a as y,c as b,n as x,r as S,s as C,t as w}from"./table-DQ63Yu4a.js";import{n as T,t as E}from"./toggle-group-BFWCtH3p.js";import{lt as D,s as O}from"./index-RuRs_qGS.js";import{t as k}from"./list-page-BnOuLOBb.js";import{i as A,r as j,t as M}from"./virtual-list-qPFukjyT.js";var N=e(t(),1),P=n(),F=({height:e})=>(0,P.jsx)(`tr`,{"aria-hidden":`true`,className:`flex lg:table-row`,children:(0,P.jsx)(`td`,{className:`flex lg:table-cell`,style:{height:e}})}),I=(0,N.forwardRef)(function(e,t){return(0,P.jsx)(b,{ref:t,...e,"aria-hidden":`true`,className:`relative flex flex-col lg:table-row`,children:(0,P.jsx)(S,{className:`relative z-10 h-24 animate-pulse`,children:(0,P.jsx)(`div`,{className:`h-full rounded-md bg-muted`,"data-testid":`loading-placeholder`})})})});function L({items:e,totalItems:t,hasNextPage:n,isFetchingNextPage:r,fetchNextPage:i}){let{isAdmin7:a}=c(),l=(0,N.useRef)(null),{visibleItemCount:u,canLoadMore:d,loadMore:f}=j(t),{visibleItems:p,spaceBefore:g,spaceAfter:_}=A({items:e,totalItems:u,hasNextPage:n,isFetchingNextPage:r,fetchNextPage:i,parentRef:l});return(0,P.jsxs)(`div`,{ref:l,className:`overflow-hidden`,children:[(0,P.jsxs)(w,{className:`flex table-fixed flex-col lg:table`,"data-testid":`tags-list`,children:[(0,P.jsx)(C,{className:`hidden lg:visible! lg:table-header-group!`,children:(0,P.jsxs)(b,{children:[(0,P.jsx)(y,{className:`w-auto px-4`,children:`Tag`}),(0,P.jsx)(y,{className:`w-1/5 px-4`,children:`Slug`}),(0,P.jsx)(y,{className:`w-1/5 px-4`,children:`No. of posts`}),!a&&(0,P.jsx)(y,{className:`w-20 px-4`})]})}),(0,P.jsxs)(x,{className:`flex flex-col lg:table-row-group`,children:[(0,P.jsx)(F,{height:g}),p.map(({key:t,virtualItem:n,item:r,props:i})=>n.index>e.length-1?(0,P.jsx)(I,{...i},t):(0,P.jsxs)(b,{...i,className:s(`group grid w-full items-center gap-x-4 p-2 lg:table-row lg:p-0`,a?`grid-cols-1 md:grid-cols-[1fr_auto]`:`grid-cols-[1fr_5rem] md:grid-cols-[1fr_auto_5rem]`),"data-testid":`tag-list-row`,children:[(0,P.jsxs)(S,{className:`static col-start-1 col-end-1 row-start-1 row-end-1 flex min-w-0 flex-col p-0 md:relative lg:table-cell lg:w-1/2 lg:p-4 xl:w-3/5`,children:[(0,P.jsx)(O,{className:`before:absolute before:top-0 before:left-0 before:z-10 before:h-full before:w-[100vw]`,to:`/tags/${r.slug}`,children:(0,P.jsx)(`span`,{className:`block truncate text-base text-md font-semibold`,children:r.name})}),(0,P.jsx)(`span`,{className:`block truncate text-muted-foreground`,children:r.description})]}),(0,P.jsx)(S,{className:`col-start-1 col-end-1 row-start-2 row-end-2 flex p-0 lg:table-cell lg:p-4`,children:(0,P.jsx)(`span`,{className:`block truncate`,children:r.slug})}),(0,P.jsx)(S,{className:`col-start-1 col-end-1 row-start-3 row-end-3 flex p-0 md:col-start-2 md:col-end-2 md:row-start-1 md:row-end-3 lg:table-cell lg:p-4`,children:r.count?.posts?(0,P.jsx)(`a`,{className:`relative z-10 -m-4 inline-block p-4 hover:underline`,href:`#/posts?tag=${r.slug}`,children:`${o(r.count?.posts)} ${r.count?.posts===1?`post`:`posts`}`}):(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:`0 posts`})}),!a&&(0,P.jsx)(S,{className:`col-start-2 col-end-2 row-start-1 row-end-3 p-0 md:col-start-3 md:col-end-3 lg:table-cell lg:p-4`,children:(0,P.jsx)(m,{"aria-hidden":`true`,className:`opacity-0 transition-all group-hover:opacity-100`,size:`icon`,tabIndex:-1,variant:`outline`,children:(0,P.jsx)(h,{})})})]},t)),(0,P.jsx)(F,{height:_})]})]}),d&&(0,P.jsx)(M,{isLoading:r,onClick:f})]})}var R=()=>{let{isAdmin7:e}=c(),[t,n]=i(),o=t.get(`type`)??`public`,{data:s,isError:h,isLoading:y,isFetchingNextPage:b,fetchNextPage:x,hasNextPage:S}=r({filter:{visibility:o}});return(0,P.jsx)(l,{className:`size-full`,children:(0,P.jsx)(u,{className:`relative flex h-full flex-col`,size:`page`,children:(0,P.jsxs)(k,{"data-testid":`tags-page`,children:[(0,P.jsx)(k.Header,{children:(0,P.jsxs)(v,{blurredBackground:!1,sticky:!1,children:[(0,P.jsx)(v.Left,{children:(0,P.jsx)(v.Title,{children:`Tags`})}),(0,P.jsxs)(v.Actions,{children:[(0,P.jsxs)(v.ActionGroup,{children:[(0,P.jsxs)(E,{"data-testid":`tags-header-tabs`,size:`button`,type:`single`,value:o,children:[(0,P.jsx)(T,{"aria-label":`Public tags`,value:`public`,asChild:!0,children:(0,P.jsx)(a,{to:`/tags`,children:`Public tags`})}),(0,P.jsx)(T,{"aria-label":`Internal tags`,value:`internal`,asChild:!0,children:(0,P.jsx)(a,{to:`/tags?type=internal`,children:`Internal tags`})})]}),(0,P.jsxs)(v.ActionGroup.MobileMenu,{children:[(0,P.jsx)(v.ActionGroup.MobileMenuTrigger,{children:(0,P.jsx)(m,{"aria-label":`More tag actions`,size:e?`icon`:void 0,variant:`subtle`,children:(0,P.jsx)(f,{className:`size-4`})})}),(0,P.jsxs)(v.ActionGroup.MobileMenuContent,{children:[(0,P.jsx)(D,{checked:o===`public`,onCheckedChange:()=>n({}),children:`Public tags`}),(0,P.jsx)(D,{checked:o===`internal`,onCheckedChange:()=>n({type:`internal`}),children:`Internal tags`})]})]})]}),(0,P.jsx)(v.ActionGroup,{children:(0,P.jsx)(m,{asChild:!0,children:(0,P.jsxs)(O,{className:`font-bold`,to:`/tags/new`,children:[(0,P.jsx)(p,{className:`size-4`}),(0,P.jsx)(`span`,{className:`hidden sm:inline`,children:`New tag`})]})})})]})]})}),(0,P.jsx)(k.Body,{children:y?(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,P.jsx)(_,{size:`lg`})}):h?(0,P.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:[(0,P.jsx)(`h2`,{className:`mb-2 text-xl font-medium`,children:`Error loading tags`}),(0,P.jsx)(`p`,{className:`mb-4 text-muted-foreground`,children:`Please reload the page to try again`}),(0,P.jsx)(m,{onClick:()=>window.location.reload(),children:`Reload page`})]}):s?.tags.length?(0,P.jsx)(L,{fetchNextPage:()=>void x(),hasNextPage:S,isFetchingNextPage:b,items:s?.tags??[],totalItems:s?.meta?.pagination?.total??0}):(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,P.jsx)(g,{actions:(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(O,{to:`/tags/new`,children:`Create a new tag`})}),title:`Start organizing your content`,children:(0,P.jsx)(d,{})})})})]})})})};export{R as default};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`155c788e-e251-42fd-af18-fb1c80f9a19d`,e._sentryDebugIdIdentifier=`sentry-dbid-155c788e-e251-42fd-af18-fb1c80f9a19d`)}catch{}})();import{i as e,n as t,t as n}from"./hooks-C-BDQ6Hs.js";var r=`TagsResponseType`,i=r,a=n({dataType:r,path:`/tags/`,defaultNextPageParams:(e,t)=>e.meta?.pagination.next?{...t,page:(e.meta?.pagination.next||1).toString()}:void 0,returnData:e=>{let{pages:t}=e,n=t.flatMap(e=>e.tags),r=t[t.length-1].meta;return{tags:n,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),o=({filter:e,...t})=>{let n=Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`,`);return a({...t,searchParams:{limit:`100`,order:`name asc`,include:`count.posts`,filter:n,...t.searchParams}})},s=e({dataType:r,path:e=>`/tags/slug/${e}/`}),c=t({method:`POST`,path:()=>`/tags/`,searchParams:()=>({include:`count.posts`}),body:e=>({tags:[e]}),invalidateQueries:{dataType:r}}),l=t({method:`PUT`,path:({id:e})=>`/tags/${e}/`,searchParams:()=>({include:`count.posts`}),body:({id:e,...t})=>({tags:[{id:e,...t}]}),invalidateQueries:{dataType:r}}),u=t({method:`DELETE`,path:e=>`/tags/${e}/`,invalidateQueries:{dataType:r}});export{l as a,u as i,c as n,s as o,o as r,i as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`155c788e-e251-42fd-af18-fb1c80f9a19d`,e._sentryDebugIdIdentifier=`sentry-dbid-155c788e-e251-42fd-af18-fb1c80f9a19d`)}catch{}})();import{i as e,n as t,t as n}from"./hooks-0r7qxGEo.js";var r=`TagsResponseType`,i=r,a=n({dataType:r,path:`/tags/`,defaultNextPageParams:(e,t)=>e.meta?.pagination.next?{...t,page:(e.meta?.pagination.next||1).toString()}:void 0,returnData:e=>{let{pages:t}=e,n=t.flatMap(e=>e.tags),r=t[t.length-1].meta;return{tags:n,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),o=({filter:e,...t})=>{let n=Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`,`);return a({...t,searchParams:{limit:`100`,order:`name asc`,include:`count.posts`,filter:n,...t.searchParams}})},s=e({dataType:r,path:e=>`/tags/slug/${e}/`}),c=t({method:`POST`,path:()=>`/tags/`,searchParams:()=>({include:`count.posts`}),body:e=>({tags:[e]}),invalidateQueries:{dataType:r}}),l=t({method:`PUT`,path:({id:e})=>`/tags/${e}/`,searchParams:()=>({include:`count.posts`}),body:({id:e,...t})=>({tags:[{id:e,...t}]}),invalidateQueries:{dataType:r}}),u=t({method:`DELETE`,path:e=>`/tags/${e}/`,invalidateQueries:{dataType:r}});export{l as a,u as i,c as n,s as o,o as r,i as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`31dad5d3-d2c3-4051-8e1a-1fc0a59ee916`,e._sentryDebugIdIdentifier=`sentry-dbid-31dad5d3-d2c3-4051-8e1a-1fc0a59ee916`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n}from"./hooks-C-BDQ6Hs.js";import{t as r}from"./jsx-runtime-Bm2_KH-0.js";import{n as i}from"./dist-pogVoW2G.js";import{t as a}from"./use-form-ElCUnbKi.js";import{t as o}from"./button-CTHYSI-d.js";import{t as s}from"./avatar-YbECDnBI.js";import{a as c,i as l,o as u,t as d}from"./field-DCPPrQDr.js";import{n as f}from"./loading-indicator-DaRyGrxv.js";import{i as p,n as m,o as h,s as g,t as _}from"./select-DeloOYCg.js";import{t as v}from"./textarea-B_rfKtjs.js";import{p as y}from"./label-picker-GTIIlBQ6.js";import{t as b}from"./settings-modal-3x4v8abr.js";import{Ut as x}from"./index-CuDhPtkB.js";import{t as S}from"./use-settings-navigation-CO2nUqDW.js";import{n as C}from"./global-data-context-ogIy0FUG.js";var w=``+new URL(`ali-abdaal-DqO7DmHM.png`,import.meta.url).href,T=``+new URL(`isaac-saul-WLit1kCf.png`,import.meta.url).href,E=``+new URL(`joel-warner-DUevCA8i.png`,import.meta.url).href,D=e(t(),1),O=r(),k=()=>{let e=D.useId(),{updateRoute:t}=S(),r=n(),{settings:k,currentUser:A,siteData:j,config:M}=C(),N=M.exploreTestimonialsUrl,P=j.site_uuid,[F]=x(k,[`title`]),I=A.name,L=A.email,R=A.roles[0].name,z=A.profile_image,{formState:B,updateForm:V,saveState:H,handleSave:U,errors:W,clearError:G}=a({initialState:{content:``,prev_platform:``},onSave:async()=>{let e=[`none`,`other`,``].includes(B.prev_platform)?void 0:B.prev_platform,n={ghost_uuid:P,staff_user_email:L,content:B.content,prev_platform:e};if(!N||!(await fetch(N,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)})).ok)throw Error(`Something went wrong, please try again later.`);i.success(`Thank you for your testimonial!`),t(`explore`)},onSaveError:r,onValidate:()=>{let e={};return B.content.trim()||(e.content=`This field is required`),e}}),K=[{value:`none`,label:`None -\xA0This is a new site`},{value:`substack`,label:`Substack`},{value:`beehiiv`,label:`BeeHiiv`},{value:`wordpress`,label:`WordPress`},{value:`newspack`,label:`Newspack`},{value:`medium`,label:`Medium`},{value:`squarespace`,label:`Squarespace`},{value:`wix`,label:`Wix`},{value:`patreon`,label:`Patreon`},{value:`memberful`,label:`Memberful`},{value:`other`,label:`Other`}];return(0,O.jsx)(b,{cancelLabel:``,footer:!1,padding:!1,testId:`explore-testimonials-modal`,title:``,topRightContent:`close`,width:920,onClose:()=>{t(`explore`)},children:(0,O.jsx)(c,{className:`gap-8`,children:(0,O.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,O.jsxs)(`div`,{className:`hidden w-full flex-col justify-between bg-gradient-to-tl from-gray-100/50 to-gray-100/80 p-8 dark:from-gray-900/40 dark:to-gray-900/60 [@media(min-width:905px)]:visible! [@media(min-width:905px)]:flex!`,children:[(0,O.jsxs)(`div`,{className:`pr-6`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`Moving to Ghost has proven to be one of the best business decisions we’ve made as an independent media outlet.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] ml-2 flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${E})`}}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Joel Warner`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`Lever News`})]})]})]}),(0,O.jsxs)(`div`,{className:`mt-8 ml-6`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:right-5 before:-bottom-1.5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`It has now been one year since I quit my full-time job to go all in on Tangle. Today, we have 50,000+ paying subscribers. That’s roughly $5M in gross yearly revenue ... it’s the best paying job I’ve ever had.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] mr-2 flex items-center justify-end gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Isaac Saul`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`Tangle`})]}),(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${T})`}})]})]}),(0,O.jsxs)(`div`,{className:`mt-8 hidden pr-6 [@media(min-width:940px)]:visible! [@media(min-width:940px)]:block!`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`You should be using Ghost because it’s absolutely amazing and I love it. It’s what I’ve been using for all my sites since 2016.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] ml-2 flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${w})`}}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Ali Abdaal`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`YouTuber`})]})]})]})]}),(0,O.jsxs)(`div`,{className:`flex grow flex-col justify-between gap-6 p-8 [@media(min-width:905px)]:min-w-[520px] [@media(min-width:940px)]:min-w-[460px]`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`flex size-[60px] items-center justify-center rounded-full bg-gradient-to-t from-[#CFB0FF] to-[#B27EFF]`,children:(0,O.jsx)(`svg`,{fill:`none`,height:`26`,viewBox:`0 0 32 26`,width:`32`,xmlns:`http://www.w3.org/2000/svg`,children:(0,O.jsx)(`path`,{d:`M19.9967 26L18.1562 21.4542C23.4268 19.1176 25.7693 16.5261 26.2712 11.7255C25.5183 12.3627 24.5562 12.7026 23.3431 12.7026C20.1641 12.7026 17.4869 10.1536 17.4869 6.41503C17.4869 2.80392 20.3732 9.72736e-07 24.2634 6.32644e-07C28.2791 2.81581e-07 31.5 3.10131 31.5 8.96405C31.5 17.5458 27.4425 23.0261 19.9967 26ZM3.0098 26L1.12745 21.4543C6.43987 19.1176 8.78235 16.5261 9.24248 11.7255C8.53137 12.3627 7.56928 12.7026 6.35621 12.7026C3.17712 12.7026 0.499999 10.1536 0.499998 6.41504C0.499998 2.80393 3.38627 2.45778e-06 7.23464 2.12135e-06C11.2503 1.77028e-06 14.5131 3.10131 14.5131 8.96405C14.5131 17.5458 10.4556 23.0261 3.0098 26Z`,fill:`white`})})}),(0,O.jsxs)(`div`,{className:`mt-6`,children:[(0,O.jsx)(`div`,{className:`text-2xl font-semibold tracking-tight`,children:`A quote about Ghost`}),(0,O.jsx)(`div`,{className:`mt-2 text-pretty`,children:`We feature quotes from publishers to showcase their work, including a logo and a link! If you'd like to be included, share a quote we can use to highlight you.`})]}),(0,O.jsx)(`div`,{className:`mt-8`,children:(0,O.jsxs)(d,{"data-invalid":!!W.content||void 0,children:[(0,O.jsx)(u,{className:`sr-only`,htmlFor:`testimonial-content`,children:`Quote`}),(0,O.jsx)(v,{"aria-invalid":!!W.content||void 0,id:`testimonial-content`,placeholder:`What changed for the better since you switched to Ghost?`,rows:7,value:B.content,autoFocus:!0,onChange:e=>V(t=>({...t,content:e.target.value})),onKeyDown:()=>G(`content`)}),W.content&&(0,O.jsx)(l,{children:W.content})]})}),(0,O.jsx)(`div`,{className:`mt-4 ml-0.5`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(s,{className:`size-10`,...y({name:I,email:L}),src:z}),(0,O.jsxs)(`div`,{className:`flex flex-col`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`By `,I||L]}),(0,O.jsxs)(`span`,{className:`text-sm text-gray-700`,children:[R,` — `,F]})]})]})})]}),(0,O.jsx)(`div`,{children:(0,O.jsxs)(`div`,{className:`mt-2 flex items-center gap-4`,children:[(0,O.jsx)(`div`,{className:`grow`,children:(0,O.jsxs)(d,{"data-invalid":!!W.prev_platform||void 0,children:[(0,O.jsx)(u,{className:`sr-only`,children:`Previous platform`}),(0,O.jsxs)(_,{value:B.prev_platform,onValueChange:e=>{V(t=>({...t,prev_platform:e})),G(`prev_platform`)},children:[(0,O.jsx)(h,{"aria-describedby":W.prev_platform?e:void 0,"aria-invalid":!!W.prev_platform||void 0,"aria-label":`Previous platform`,"data-testid":`migrated-from`,children:(0,O.jsx)(g,{placeholder:`Previous platform`})}),(0,O.jsx)(m,{children:K.map(e=>(0,O.jsx)(p,{value:e.value,children:e.label},e.value))})]}),W.prev_platform&&(0,O.jsx)(l,{id:e,children:W.prev_platform})]})}),(0,O.jsxs)(o,{disabled:H===`saving`,type:`button`,onClick:()=>void U(),children:[H===`saving`&&(0,O.jsx)(f,{size:`sm`}),`Send testimonial`]})]})})]})]})})})};export{k as default};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`52f6ee1e-321a-4517-9a4d-4e71097caab1`,e._sentryDebugIdIdentifier=`sentry-dbid-52f6ee1e-321a-4517-9a4d-4e71097caab1`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n}from"./hooks-0r7qxGEo.js";import{t as r}from"./jsx-runtime-Bm2_KH-0.js";import{n as i}from"./dist-pogVoW2G.js";import{t as a}from"./use-form-ElCUnbKi.js";import{t as o}from"./button-CTHYSI-d.js";import{t as s}from"./avatar-YbECDnBI.js";import{a as c,i as l,o as u,t as d}from"./field-DCPPrQDr.js";import{n as f}from"./loading-indicator-DaRyGrxv.js";import{i as p,n as m,o as h,s as g,t as _}from"./select-DeloOYCg.js";import{t as v}from"./textarea-B_rfKtjs.js";import{p as y}from"./label-picker-DaivLdMw.js";import{t as b}from"./settings-modal-3x4v8abr.js";import{Ut as x}from"./index-RuRs_qGS.js";import{t as S}from"./use-settings-navigation-CO2nUqDW.js";import{n as C}from"./global-data-context-ogIy0FUG.js";var w=``+new URL(`ali-abdaal-DqO7DmHM.png`,import.meta.url).href,T=``+new URL(`isaac-saul-WLit1kCf.png`,import.meta.url).href,E=``+new URL(`joel-warner-DUevCA8i.png`,import.meta.url).href,D=e(t(),1),O=r(),k=()=>{let e=D.useId(),{updateRoute:t}=S(),r=n(),{settings:k,currentUser:A,siteData:j,config:M}=C(),N=M.exploreTestimonialsUrl,P=j.site_uuid,[F]=x(k,[`title`]),I=A.name,L=A.email,R=A.roles[0].name,z=A.profile_image,{formState:B,updateForm:V,saveState:H,handleSave:U,errors:W,clearError:G}=a({initialState:{content:``,prev_platform:``},onSave:async()=>{let e=[`none`,`other`,``].includes(B.prev_platform)?void 0:B.prev_platform,n={ghost_uuid:P,staff_user_email:L,content:B.content,prev_platform:e};if(!N||!(await fetch(N,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)})).ok)throw Error(`Something went wrong, please try again later.`);i.success(`Thank you for your testimonial!`),t(`explore`)},onSaveError:r,onValidate:()=>{let e={};return B.content.trim()||(e.content=`This field is required`),e}}),K=[{value:`none`,label:`None -\xA0This is a new site`},{value:`substack`,label:`Substack`},{value:`beehiiv`,label:`BeeHiiv`},{value:`wordpress`,label:`WordPress`},{value:`newspack`,label:`Newspack`},{value:`medium`,label:`Medium`},{value:`squarespace`,label:`Squarespace`},{value:`wix`,label:`Wix`},{value:`patreon`,label:`Patreon`},{value:`memberful`,label:`Memberful`},{value:`other`,label:`Other`}];return(0,O.jsx)(b,{cancelLabel:``,footer:!1,padding:!1,testId:`explore-testimonials-modal`,title:``,topRightContent:`close`,width:920,onClose:()=>{t(`explore`)},children:(0,O.jsx)(c,{className:`gap-8`,children:(0,O.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,O.jsxs)(`div`,{className:`hidden w-full flex-col justify-between bg-gradient-to-tl from-gray-100/50 to-gray-100/80 p-8 dark:from-gray-900/40 dark:to-gray-900/60 [@media(min-width:905px)]:visible! [@media(min-width:905px)]:flex!`,children:[(0,O.jsxs)(`div`,{className:`pr-6`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`Moving to Ghost has proven to be one of the best business decisions we’ve made as an independent media outlet.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] ml-2 flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${E})`}}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Joel Warner`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`Lever News`})]})]})]}),(0,O.jsxs)(`div`,{className:`mt-8 ml-6`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:right-5 before:-bottom-1.5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`It has now been one year since I quit my full-time job to go all in on Tangle. Today, we have 50,000+ paying subscribers. That’s roughly $5M in gross yearly revenue ... it’s the best paying job I’ve ever had.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] mr-2 flex items-center justify-end gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Isaac Saul`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`Tangle`})]}),(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${T})`}})]})]}),(0,O.jsxs)(`div`,{className:`mt-8 hidden pr-6 [@media(min-width:940px)]:visible! [@media(min-width:940px)]:block!`,children:[(0,O.jsx)(`div`,{className:`relative rounded-xl bg-white px-3 py-2.5 text-md text-gray-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-gray-300 dark:before:bg-black`,children:`You should be using Ghost because it’s absolutely amazing and I love it. It’s what I’ve been using for all my sites since 2016.`}),(0,O.jsxs)(`div`,{className:`mt-[14px] ml-2 flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale`,style:{backgroundImage:`url(${w})`}}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-medium text-black dark:text-white`,children:`Ali Abdaal`}),(0,O.jsx)(`div`,{className:`-mt-0.5 text-gray-700`,children:`YouTuber`})]})]})]})]}),(0,O.jsxs)(`div`,{className:`flex grow flex-col justify-between gap-6 p-8 [@media(min-width:905px)]:min-w-[520px] [@media(min-width:940px)]:min-w-[460px]`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`flex size-[60px] items-center justify-center rounded-full bg-gradient-to-t from-[#CFB0FF] to-[#B27EFF]`,children:(0,O.jsx)(`svg`,{fill:`none`,height:`26`,viewBox:`0 0 32 26`,width:`32`,xmlns:`http://www.w3.org/2000/svg`,children:(0,O.jsx)(`path`,{d:`M19.9967 26L18.1562 21.4542C23.4268 19.1176 25.7693 16.5261 26.2712 11.7255C25.5183 12.3627 24.5562 12.7026 23.3431 12.7026C20.1641 12.7026 17.4869 10.1536 17.4869 6.41503C17.4869 2.80392 20.3732 9.72736e-07 24.2634 6.32644e-07C28.2791 2.81581e-07 31.5 3.10131 31.5 8.96405C31.5 17.5458 27.4425 23.0261 19.9967 26ZM3.0098 26L1.12745 21.4543C6.43987 19.1176 8.78235 16.5261 9.24248 11.7255C8.53137 12.3627 7.56928 12.7026 6.35621 12.7026C3.17712 12.7026 0.499999 10.1536 0.499998 6.41504C0.499998 2.80393 3.38627 2.45778e-06 7.23464 2.12135e-06C11.2503 1.77028e-06 14.5131 3.10131 14.5131 8.96405C14.5131 17.5458 10.4556 23.0261 3.0098 26Z`,fill:`white`})})}),(0,O.jsxs)(`div`,{className:`mt-6`,children:[(0,O.jsx)(`div`,{className:`text-2xl font-semibold tracking-tight`,children:`A quote about Ghost`}),(0,O.jsx)(`div`,{className:`mt-2 text-pretty`,children:`We feature quotes from publishers to showcase their work, including a logo and a link! If you'd like to be included, share a quote we can use to highlight you.`})]}),(0,O.jsx)(`div`,{className:`mt-8`,children:(0,O.jsxs)(d,{"data-invalid":!!W.content||void 0,children:[(0,O.jsx)(u,{className:`sr-only`,htmlFor:`testimonial-content`,children:`Quote`}),(0,O.jsx)(v,{"aria-invalid":!!W.content||void 0,id:`testimonial-content`,placeholder:`What changed for the better since you switched to Ghost?`,rows:7,value:B.content,autoFocus:!0,onChange:e=>V(t=>({...t,content:e.target.value})),onKeyDown:()=>G(`content`)}),W.content&&(0,O.jsx)(l,{children:W.content})]})}),(0,O.jsx)(`div`,{className:`mt-4 ml-0.5`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(s,{className:`size-10`,...y({name:I,email:L}),src:z}),(0,O.jsxs)(`div`,{className:`flex flex-col`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`By `,I||L]}),(0,O.jsxs)(`span`,{className:`text-sm text-gray-700`,children:[R,` — `,F]})]})]})})]}),(0,O.jsx)(`div`,{children:(0,O.jsxs)(`div`,{className:`mt-2 flex items-center gap-4`,children:[(0,O.jsx)(`div`,{className:`grow`,children:(0,O.jsxs)(d,{"data-invalid":!!W.prev_platform||void 0,children:[(0,O.jsx)(u,{className:`sr-only`,children:`Previous platform`}),(0,O.jsxs)(_,{value:B.prev_platform,onValueChange:e=>{V(t=>({...t,prev_platform:e})),G(`prev_platform`)},children:[(0,O.jsx)(h,{"aria-describedby":W.prev_platform?e:void 0,"aria-invalid":!!W.prev_platform||void 0,"aria-label":`Previous platform`,"data-testid":`migrated-from`,children:(0,O.jsx)(g,{placeholder:`Previous platform`})}),(0,O.jsx)(m,{children:K.map(e=>(0,O.jsx)(p,{value:e.value,children:e.label},e.value))})]}),W.prev_platform&&(0,O.jsx)(l,{id:e,children:W.prev_platform})]})}),(0,O.jsxs)(o,{disabled:H===`saving`,type:`button`,onClick:()=>void U(),children:[H===`saving`&&(0,O.jsx)(f,{size:`sm`}),`Send testimonial`]})]})})]})]})})})};export{k as default};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`87116182-b8e0-47b2-bd54-9d5ab2326ee1`,e._sentryDebugIdIdentifier=`sentry-dbid-87116182-b8e0-47b2-bd54-9d5ab2326ee1`)}catch{}})();import{n as e,r as t}from"./hooks-C-BDQ6Hs.js";var n=`CustomThemeSettingsResponseType`,r=n,i=t({dataType:n,path:`/custom_theme_settings/`}),a=e({method:`PUT`,path:()=>`/custom_theme_settings/`,body:e=>({custom_theme_settings:e}),updateQueries:{emberUpdateType:`skip`,dataType:n,update:e=>e}});function o(e,t){return e.code===`GS110-NO-MISSING-PAGE-BUILDER-USAGE`&&(e.failures??[]).some(({message:e})=>e?.includes(`@page.${t}`))}var s=`ThemesResponseType`,c=t({dataType:s,path:`/themes/`}),l=t({dataType:s,path:`/themes/active/`}),u=e({method:`PUT`,path:e=>`/themes/${e}/activate/`,updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>({...t,themes:t.themes.map(t=>e.themes.find(({name:e})=>e===t.name)||{...t,active:!1})})},invalidateQueries:{dataType:r}}),d=e({method:`DELETE`,path:e=>`/themes/${e}/`,updateQueries:{dataType:s,emberUpdateType:`delete`,update:(e,t,n)=>({...t,themes:t.themes.filter(e=>e.name!==n)})}}),f=e({method:`POST`,path:()=>`/themes/install/`,searchParams:e=>({source:`github`,ref:e}),updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,themes:[...t.themes,...e.themes]}}}),p=e({method:`POST`,path:()=>`/themes/upload/`,searchParams:({copySettingsFrom:e})=>e?{copy_settings_from:e}:{},body:({file:e})=>{let t=new FormData;return t.append(`file`,e),t},updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,themes:[...t.themes.filter(t=>!e.themes.some(({name:e})=>e===t.name)),...e.themes]}}});function m(e){return e.active}function h(e){return e.name.toLowerCase()===`source`}function g(e){return e.name.toLowerCase()===`casper`}function _(e){return h(e)||g(e)}function v(e){return!h(e)&&!g(e)&&!m(e)}export{g as a,l as c,f as d,p as f,v as i,c as l,a as m,_ as n,o,i as p,h as r,u as s,m as t,d as u};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`87116182-b8e0-47b2-bd54-9d5ab2326ee1`,e._sentryDebugIdIdentifier=`sentry-dbid-87116182-b8e0-47b2-bd54-9d5ab2326ee1`)}catch{}})();import{n as e,r as t}from"./hooks-0r7qxGEo.js";var n=`CustomThemeSettingsResponseType`,r=n,i=t({dataType:n,path:`/custom_theme_settings/`}),a=e({method:`PUT`,path:()=>`/custom_theme_settings/`,body:e=>({custom_theme_settings:e}),updateQueries:{emberUpdateType:`skip`,dataType:n,update:e=>e}});function o(e,t){return e.code===`GS110-NO-MISSING-PAGE-BUILDER-USAGE`&&(e.failures??[]).some(({message:e})=>e?.includes(`@page.${t}`))}var s=`ThemesResponseType`,c=t({dataType:s,path:`/themes/`}),l=t({dataType:s,path:`/themes/active/`}),u=e({method:`PUT`,path:e=>`/themes/${e}/activate/`,updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>({...t,themes:t.themes.map(t=>e.themes.find(({name:e})=>e===t.name)||{...t,active:!1})})},invalidateQueries:{dataType:r}}),d=e({method:`DELETE`,path:e=>`/themes/${e}/`,updateQueries:{dataType:s,emberUpdateType:`delete`,update:(e,t,n)=>({...t,themes:t.themes.filter(e=>e.name!==n)})}}),f=e({method:`POST`,path:()=>`/themes/install/`,searchParams:e=>({source:`github`,ref:e}),updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,themes:[...t.themes,...e.themes]}}}),p=e({method:`POST`,path:()=>`/themes/upload/`,searchParams:({copySettingsFrom:e})=>e?{copy_settings_from:e}:{},body:({file:e})=>{let t=new FormData;return t.append(`file`,e),t},updateQueries:{dataType:s,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,themes:[...t.themes.filter(t=>!e.themes.some(({name:e})=>e===t.name)),...e.themes]}}});function m(e){return e.active}function h(e){return e.name.toLowerCase()===`source`}function g(e){return e.name.toLowerCase()===`casper`}function _(e){return h(e)||g(e)}function v(e){return!h(e)&&!g(e)&&!m(e)}export{g as a,l as c,f as d,p as f,v as i,c as l,a as m,_ as n,o,i as p,h as r,u as s,m as t,d as u};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b14d79e3-ed1e-4769-9d9a-2df4b91e0578`,e._sentryDebugIdIdentifier=`sentry-dbid-b14d79e3-ed1e-4769-9d9a-2df4b91e0578`)}catch{}})();import{i as e,s as t,t as n}from"./react-C9lG_SsT.js";import{A as r,O as i,_ as a,b as o,g as s,n as c,r as l,y as u}from"./hooks-C-BDQ6Hs.js";import{t as d}from"./jsx-runtime-Bm2_KH-0.js";import{n as f}from"./dist-pogVoW2G.js";import{t as p}from"./use-form-ElCUnbKi.js";import{a as m,i as h,n as g,r as _,t as v}from"./currency-DgOqjQBh.js";import{h as y}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as b,L as ee,Z as x,r as te}from"./shade-provider-DvrXKKQZ.js";import{t as S}from"./inline-Qoyy4r2g.js";import{t as ne}from"./text-BnCSdzao.js";import{D as re,dt as ie,or as C,t as w}from"./button-CTHYSI-d.js";import{a as ae,c as oe,n as se,o as T,r as ce,s as E,t as le,u as D}from"./multi-select-combobox-BzBMUFst.js";import{i as ue,n as de,r as fe,t as O}from"./combobox-DDlijta6.js";import{a as k,c as pe,i as A,o as j,r as me,s as he,t as M}from"./field-DCPPrQDr.js";import{t as N}from"./input-BHb2A_DU.js";import{a as ge,i as P,n as F,r as _e,t as I}from"./input-group-DL5EFP5r.js";import{i as ve,n as L,o as ye,s as R,t as z}from"./select-DeloOYCg.js";import{i as be,n as xe,t as Se}from"./use-url-input-DPJ592FB.js";import{t as Ce}from"./switch-BppWscjz.js";import{t as we}from"./settings-modal-3x4v8abr.js";import{a as B,i as Te,o as Ee}from"./tiers-D7aGzwZ-.js";import{B as V,Jt as De,Ut as Oe,Vt as H,st as U}from"./index-CuDhPtkB.js";import{t as W}from"./use-availability-BqL7Dvn_.js";import{c as G,g as K,u as q}from"./member-custom-fields-DPsyP1Hq.js";import{n as J,t as ke}from"./custom-field-type-option-CIatEwIN.js";import{t as Ae}from"./use-settings-navigation-CO2nUqDW.js";import{n as je}from"./confirmation-context-By_jX_cA.js";import{n as Me}from"./global-data-context-ogIy0FUG.js";import{t as Ne}from"./use-setting-group-Bf3vY8br.js";var Y=t(n(),1),X=d();function Z(e,t,n){return D((n??[]).join(` `),t)}function Pe({id:e,label:t,fields:n,value:r,invalid:i,onChange:a,createTypes:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(``),p=n.find(e=>e.key===r),m=!!o?.length,h=()=>{c(!1),u(null),f(``)};return(0,X.jsxs)(O,{open:s,onOpenChange:e=>{e?c(!0):h()},children:[(0,X.jsx)(fe,{"aria-invalid":i||void 0,"aria-label":t,id:e,children:(0,X.jsx)(ue,{placeholder:!p,children:p?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(J,{className:`size-4 shrink-0`,type:p.type}),(0,X.jsx)(`span`,{className:`truncate`,children:p.name})]}):`Select...`})}),(0,X.jsx)(de,{onEscapeKeyDown:e=>{l&&(e.preventDefault(),u(null))},children:l&&o?.length?(0,X.jsx)(Fe,{initialName:l.initialName,label:t,types:o,onCancel:()=>u(null),onCreated:e=>{h(),a(e)}}):(0,X.jsxs)(se,{filter:Z,children:[(0,X.jsx)(T,{placeholder:`Search fields...`,value:d,onValueChange:f}),(0,X.jsxs)(oe,{children:[n.length>0&&(0,X.jsx)(ae,{className:`p-0`,children:n.map(e=>(0,X.jsxs)(E,{keywords:[e.name],value:e.key,onSelect:()=>{h(),a(e.key)},children:[(0,X.jsx)(J,{className:`size-4`,type:e.type}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),r===e.key&&(0,X.jsx)(ce,{})]},e.key))}),m&&(0,X.jsx)(ae,{className:`p-0`,forceMount:!0,children:(0,X.jsxs)(E,{className:`font-semibold text-green`,value:`__create-custom-field__`,forceMount:!0,onSelect:()=>u({initialName:d.trim()}),children:[(0,X.jsx)(ie,{className:`size-4`}),(0,X.jsx)(`span`,{children:`Add custom field`})]})})]})]})})]})}function Fe({initialName:e,label:t,types:n,onCancel:c,onCreated:l}){let[d,f]=(0,Y.useState)(e),[p,m]=(0,Y.useState)(n[0]),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!0),{mutateAsync:ee,isPending:x}=q(),te=s(),S=async()=>{if(!d.trim()){g(`Enter a name for the field`);return}try{let e=(await ee({name:d.trim(),type:p,access:{member:`none`}})).members_metafields?.[0];if(!e){v(`The field was created but could not be selected. Choose it from the list.`),b(!1);return}l(e.key)}catch(e){let t=e instanceof o?e.data?.errors?.[0]:null;if(e instanceof i&&t?.property===`name`){g(r(e,`Invalid name`));return}e instanceof u||te(e,{withToast:!1}),v(r(e,e instanceof a?e.message:`Could not create the custom field, please try again.`)),b(!(e instanceof u)&&t?.type!==`NoPermissionError`)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,onKeyDown:e=>{e.key===`Enter`&&!x&&y&&(e.preventDefault(),S())},children:[(0,X.jsxs)(M,{"data-invalid":!!h||void 0,children:[(0,X.jsx)(j,{className:`text-sm!`,htmlFor:`custom-field-picker-create-name`,children:`New custom field`}),(0,X.jsx)(N,{"aria-invalid":!!h||void 0,"aria-label":`New custom field for ${t}`,autoComplete:`off`,className:`h-8 text-sm!`,id:`custom-field-picker-create-name`,placeholder:`Enter custom field name`,value:d,autoFocus:!0,onChange:e=>{f(e.target.value),g(null),v(null),b(!0)}}),h&&(0,X.jsx)(A,{children:h})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`text-sm!`,children:`Type`}),(0,X.jsxs)(z,{disabled:n.length===1,value:p,onValueChange:e=>m(e),children:[(0,X.jsx)(ye,{"aria-label":`Type`,className:`h-8 text-sm!`,children:(0,X.jsx)(R,{children:(0,X.jsx)(ke,{type:p})})}),(0,X.jsx)(L,{children:n.map(e=>(0,X.jsx)(ve,{value:e,children:(0,X.jsx)(ke,{type:e})},e))})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,X.jsx)(w,{disabled:x,size:`sm`,type:`button`,variant:`outline`,onClick:c,children:`Cancel`}),(0,X.jsx)(w,{disabled:x||!y,size:`sm`,type:`button`,onClick:()=>void S(),children:x?`Saving`:`Save`})]}),_&&(0,X.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:_})]})}var Ie=`AC.AD.AE.AF.AG.AI.AL.AM.AO.AQ.AR.AT.AU.AW.AX.AZ.BA.BB.BD.BE.BF.BG.BH.BI.BJ.BL.BM.BN.BO.BQ.BR.BS.BT.BV.BW.BY.BZ.CA.CD.CF.CG.CH.CI.CK.CL.CM.CN.CO.CR.CV.CW.CY.CZ.DE.DJ.DK.DM.DO.DZ.EC.EE.EG.EH.ER.ES.ET.FI.FJ.FK.FO.FR.GA.GB.GD.GE.GF.GG.GH.GI.GL.GM.GN.GP.GQ.GR.GS.GT.GU.GW.GY.HK.HN.HR.HT.HU.ID.IE.IL.IM.IN.IO.IQ.IS.IT.JE.JM.JO.JP.KE.KG.KH.KI.KM.KN.KR.KW.KY.KZ.LA.LB.LC.LI.LK.LR.LS.LT.LU.LV.LY.MA.MC.MD.ME.MF.MG.MK.ML.MM.MN.MO.MQ.MR.MS.MT.MU.MV.MW.MX.MY.MZ.NA.NC.NE.NG.NI.NL.NO.NP.NR.NU.NZ.OM.PA.PE.PF.PG.PH.PK.PL.PM.PN.PR.PS.PT.PY.QA.RE.RO.RS.RU.RW.SA.SB.SC.SD.SE.SG.SH.SI.SJ.SK.SL.SM.SN.SO.SR.SS.ST.SV.SX.SZ.TA.TC.TD.TF.TG.TH.TJ.TK.TL.TM.TN.TO.TR.TT.TV.TW.TZ.UA.UG.US.UY.UZ.VA.VC.VE.VG.VN.VU.WF.WS.XK.YE.YT.ZA.ZM.ZW.ZZ`.split(`.`);new Set(Ie);var Le=[`shipping_name`,`shipping_address`,`phone`];function Re(e){return Le.includes(e)}var Q={shippingName:`shipping_name`,shippingAddress:`shipping_address`,phone:`phone`},ze={shipping_name:{key:`shipping_name`,name:`Shipping Name`,type:`short_text`},shipping_address:{key:`shipping_address`,name:`Shipping Address`,type:`address`},phone:{key:`shipping_phone`,name:`Shipping Phone`,type:`short_text`}},Be=`TiersCheckoutConfigResponseType`,Ve=l({dataType:Be,path:`/tiers/checkout_config/`}),He=c({method:`PUT`,path:({tierId:e})=>`/tiers/${e}/checkout_config/`,body:({config:e})=>({tiers_checkout_config:[e]}),invalidateQueries:{dataType:Be}}),Ue=Ie.map(e=>({value:e,label:K(e)})).sort((e,t)=>e.label.localeCompare(t.label)),We=[{value:`all`,label:`All countries`,hint:`Everywhere Stripe supports shipping`},{value:`specific`,label:`Specific countries`,hint:`Choose the countries you deliver to`}],Ge={[Q.shippingAddress]:`shippingField`,[Q.shippingName]:`shippingName`,[Q.phone]:`phoneField`},Ke=e=>{let t=(e instanceof o?e.data?.errors?.[0]?.property:null)??``,n=/^checkout\.(\w+)\.custom_field_key$/.exec(t)?.[1];return n&&Re(n)?Ge[n]:void 0},$=(e,t)=>t??ze[e].key,qe=e=>({shipping:e.shipping.collect?{...e.shipping,allowedCountries:e.shipping.countriesMode===`specific`?e.shipping.allowedCountries:[]}:{collect:!1,countriesMode:`all`,allowedCountries:[],addressFieldKey:null,nameFieldKey:null},taxNumber:e.taxNumber,phone:e.phone.collect?e.phone:{collect:!1,customFieldKey:null}}),Je=e=>{let t=e?.shipping,n=t?.allowed_countries;return{shipping:{collect:!!t,addressFieldKey:t?.address.custom_field_key??null,nameFieldKey:t?.name.custom_field_key??null,countriesMode:n?`specific`:`all`,allowedCountries:n??[]},taxNumber:{collect:!!e?.tax_number},phone:{collect:!!e?.phone,customFieldKey:e?.phone?.custom_field_key??null}}};function Ye({children:e}){return(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Checkout`}),(0,X.jsx)(k,{className:`mb-10 gap-6 rounded-sm border border-border-default p-4 md:p-7`,children:e})]})}function Xe({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col content-center gap-4 md:flex-row md:items-center`,children:[(0,X.jsx)(`div`,{className:`w-full min-w-[160px] md:flex-1`,children:e}),(0,X.jsx)(`div`,{className:`w-full md:w-64 md:min-w-0`,children:t})]})}function Ze({checked:e,description:t,id:n,label:r,onCheckedChange:i}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(M,{orientation:`horizontal`,children:[(0,X.jsx)(j,{htmlFor:n,children:r}),(0,X.jsx)(Ce,{checked:e,id:n,onCheckedChange:i})]}),(0,X.jsx)(me,{children:t})]})}function Qe({eligible:e,error:t,id:n,label:r,port:i,value:a,onChange:o}){return(0,X.jsx)(Xe,{label:r,children:(0,X.jsxs)(M,{"data-invalid":!!t||void 0,children:[(0,X.jsx)(Pe,{createTypes:[ze[i].type],fields:e[i],id:n,invalid:!!t,label:r,value:a,onChange:o}),t&&(0,X.jsx)(A,{children:t})]})})}var $e=(0,Y.forwardRef)(({config:e,failed:t,onDirtyChange:n},i)=>{let[a,o]=(0,Y.useState)(()=>Je(e)),[c,l]=(0,Y.useState)({}),[u,d]=(0,Y.useState)(!1),{mutateAsync:f}=He(),p=s(),m=W(),{data:h}=G({enabled:m}),g=h??[],_=Object.fromEntries(Object.entries(ze).map(([e,t])=>[e,g.filter(e=>e.type===t.type)])),v=a.shipping.allowedCountries,y=(0,Y.useMemo)(()=>JSON.stringify(qe(Je(e))),[e]),[b,ee]=(0,Y.useState)(null),x=!t&&JSON.stringify(qe(a))!==(b??y);(0,Y.useEffect)(()=>{n?.(x)},[x,n]);let te=()=>{let e={},t=(e,t)=>{if(!e)return`Choose where this should be kept`;if(h&&!t.some(t=>t.key===e))return`This field is no longer available. Choose another`};return a.shipping.collect&&(m&&(e.shippingField=t(a.shipping.addressFieldKey,_[Q.shippingAddress]),e.shippingName=t(a.shipping.nameFieldKey,_[Q.shippingName])),a.shipping.countriesMode===`specific`&&!a.shipping.allowedCountries.length&&(e.shippingCountries=`Choose at least one country you deliver to`)),a.phone.collect&&m&&(e.phoneField=t(a.phone.customFieldKey,_[Q.phone])),e},S=()=>{if(!x)return l({}),!0;let e=te();return l(e),!Object.values(e).some(Boolean)};return(0,Y.useImperativeHandle)(i,()=>({validate:S,save:async e=>{if(!x)return!0;if(!S())return!1;try{return await f({tierId:e,config:{shipping:a.shipping.collect?{collect:!0,...a.shipping.countriesMode===`specific`?{allowed_countries:a.shipping.allowedCountries}:{},name:{custom_field_key:$(Q.shippingName,a.shipping.nameFieldKey)},address:{custom_field_key:$(Q.shippingAddress,a.shipping.addressFieldKey)}}:{collect:!1},tax_number:{collect:a.taxNumber.collect},phone:a.phone.collect?{collect:!0,custom_field_key:$(Q.phone,a.phone.customFieldKey)}:{collect:!1}}}),ee(JSON.stringify(qe(a))),!0}catch(e){let t=m?Ke(e):void 0;return t?(p(e,{withToast:!1}),l(n=>({...n,[t]:r(e,`This field cannot be used here. Choose another`)})),!1):(p(e),!1)}}}),[m,x,f,h,p,a]),t?(0,X.jsx)(Ye,{children:(0,X.jsx)(ne,{className:`text-sm text-muted-foreground`,children:`Checkout collection settings could not be loaded, so they are not shown. Close and reopen this tier to try again.`})}):(0,X.jsxs)(Ye,{children:[(0,X.jsx)(Ze,{checked:a.shipping.collect,description:`Require a shipping address during checkout`,id:`tier-collect-shipping`,label:`Collect shipping address`,onCheckedChange:e=>o(t=>({...t,shipping:{...t.shipping,collect:e}}))}),a.shipping.collect&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xe,{label:`Ships to`,children:(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`sr-only`,children:`Ships to`}),(0,X.jsxs)(z,{value:a.shipping.countriesMode,onValueChange:e=>{l(e=>({...e,shippingCountries:void 0})),o(t=>({...t,shipping:{...t.shipping,countriesMode:e}}))},children:[(0,X.jsx)(ye,{"aria-label":`Ships to`,children:(0,X.jsx)(R,{children:We.find(e=>e.value===a.shipping.countriesMode)?.label})}),(0,X.jsx)(L,{children:We.map(e=>(0,X.jsx)(ve,{value:e.value,children:(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.hint})]})},e.value))})]})]})}),a.shipping.countriesMode===`specific`&&(0,X.jsx)(Xe,{label:`Select specific countries`,children:(0,X.jsxs)(M,{"data-invalid":!!c.shippingCountries||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,children:`Select specific countries`}),(0,X.jsxs)(O,{open:u,onOpenChange:d,children:[(0,X.jsx)(fe,{"aria-invalid":!!c.shippingCountries||void 0,"aria-label":`Select specific countries`,children:(0,X.jsx)(ue,{placeholder:!v.length,children:v.length?v.map(K).join(`, `):`Select...`})}),(0,X.jsx)(de,{children:(0,X.jsx)(le,{i18n:{searchPlaceholder:`Search countries...`},options:Ue,values:v,onChange:e=>{l(e=>({...e,shippingCountries:void 0})),o(t=>({...t,shipping:{...t.shipping,allowedCountries:e}}))},onClose:()=>d(!1)})})]}),c.shippingCountries&&(0,X.jsx)(A,{children:c.shippingCountries})]})}),m&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qe,{eligible:_,error:c.shippingField,id:`tier-shipping-address-field`,label:`Save address as`,port:Q.shippingAddress,value:a.shipping.addressFieldKey,onChange:e=>{l(e=>({...e,shippingField:void 0})),o(t=>({...t,shipping:{...t.shipping,addressFieldKey:e}}))}}),(0,X.jsx)(Qe,{eligible:_,error:c.shippingName,id:`tier-shipping-name-field`,label:`Save recipient name as`,port:Q.shippingName,value:a.shipping.nameFieldKey,onChange:e=>{l(e=>({...e,shippingName:void 0})),o(t=>({...t,shipping:{...t.shipping,nameFieldKey:e}}))}})]})]}),(0,X.jsx)(U,{}),(0,X.jsx)(Ze,{checked:a.phone.collect,description:`Require a phone number during checkout`,id:`tier-collect-phone`,label:`Collect phone number`,onCheckedChange:e=>o(t=>({...t,phone:{...t.phone,collect:e}}))}),a.phone.collect&&m&&(0,X.jsx)(Qe,{eligible:_,error:c.phoneField,id:`tier-phone-field`,label:`Save to custom field`,port:Q.phone,value:a.phone.customFieldKey,onChange:e=>{l(e=>({...e,phoneField:void 0})),o(t=>({...t,phone:{...t.phone,customFieldKey:e}}))}}),(0,X.jsx)(U,{}),(0,X.jsx)(Ze,{checked:a.taxNumber.collect,description:`Let members add a tax ID to their invoices`,id:`tier-collect-tax`,label:`Collect business tax ID`,onCheckedChange:e=>o(t=>({...t,taxNumber:{...t.taxNumber,collect:e}}))})]})});$e.displayName=`TierCheckoutCollection`;var et=(e,{creating:t=!1}={})=>{let n=V(`stripeCheckoutCollection`),{config:r,settings:i}=Me(),o=n&&H(i||[],r||{}),{data:s,error:c,isError:l,isFetching:u}=Ve({enabled:o,defaultErrorHandler:!1}),d=o&&(e?e.type!==`free`:t),f=l&&!u,p=f&&c instanceof a&&c.response?.status===404,m=d&&!f;return{enabled:m,failed:d&&f&&!p,isReady:!m||!!s,config:s?.tiers_checkout_config?.find(t=>t.tier_id===e?.id)}},tt=({size:e=`md`,trialDays:t})=>t?(0,X.jsxs)(`span`,{className:x(e===`sm`?`px-1.5 py-0.5 text-sm`:`px-2.5 py-1.5`,`relative -mt-1 -mr-1 rounded-full leading-none font-semibold tracking-wide whitespace-nowrap text-gray-900`),children:[(0,X.jsx)(`span`,{className:`absolute inset-0 block rounded-full bg-ghostaccent opacity-20 dark:bg-pink`}),(0,X.jsxs)(`span`,{className:`dark:text-pink`,children:[b(t),` days free`]})]}):null,nt=({benefits:e})=>{if(!e?.length)return(0,X.jsx)(`div`,{className:`mt-4 w-full text-md leading-snug text-gray-900 opacity-30`,children:(0,X.jsxs)(`div`,{className:`mb-2.5 flex items-start`,children:[(0,X.jsx)(C,{className:`mt-[3px] mr-[10px] size-3.5! min-w-[14px] overflow-visible stroke-[3px]!`}),(0,X.jsx)(`div`,{children:`Expert analysis`})]})});let t=new Map;return(0,X.jsx)(X.Fragment,{children:e.map(e=>{let n=(t.get(e)||0)+1;return t.set(e,n),(0,X.jsx)(`div`,{className:`mt-4 w-full text-md leading-snug text-gray-900`,children:(0,X.jsxs)(`div`,{className:`mb-2.5 flex items-start`,children:[(0,X.jsx)(C,{className:`mt-[3px] mr-[10px] size-3.5! min-w-[14px] overflow-visible stroke-[3px]!`}),(0,X.jsx)(`div`,{children:e})]})},`${e}:${n}`)})})},rt=({discount:e})=>e?(0,X.jsxs)(`span`,{className:`mt-1 leading-none font-semibold text-ghostaccent`,children:[b(e),`% discount`]}):null,it=({tier:e,isFreeTier:t})=>{let[n,r]=(0,Y.useState)(!1),i=e?.name||``,a=e?.description||``,o=parseFloat(e?.trial_days||`0`),s=e?.currency||`USD`,c=s?h(s):`$`,l=e?.benefits||[],u=t?0:500,d=t?0:5e3,f=_(e?.monthly_price??u),p=_(e?.yearly_price??d),m=e?.monthly_price&&e?.yearly_price?Math.ceil((f*12-p)/(f*12)*100):0;return(0,X.jsxs)(`div`,{className:`-mt-2`,"data-testid":`tier-preview`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,X.jsx)(ne,{as:`h6`,className:`pb-2 text-base leading-snug`,weight:`medium`,children:t?`Free membership preview`:`Tier preview`}),!t&&(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[(0,X.jsx)(w,{className:n?`h-auto p-0 text-muted-foreground`:`h-auto p-0 text-foreground`,type:`button`,variant:`link`,onClick:()=>r(!1),children:`Monthly`}),(0,X.jsx)(w,{className:n?`ml-2 h-auto p-0 text-foreground`:`ml-2 h-auto p-0 text-muted-foreground`,type:`button`,variant:`link`,onClick:()=>r(!0),children:`Yearly`})]})]}),(0,X.jsx)(`div`,{className:`rounded-sm border border-gray-200 bg-white dark:border-transparent`,children:(0,X.jsxs)(`div`,{className:`relative flex min-h-[200px] w-full max-w-[420px] scale-90 flex-col items-start justify-stretch rounded bg-white p-4`,children:[(0,X.jsxs)(`div`,{className:`min-h-[56px] w-full`,children:[(0,X.jsx)(`h4`,{className:`-mt-1 mb-0 w-full text-lg leading-tight font-semibold break-words text-ghostaccent ${!i&&`opacity-30`}`,children:i||(t?`Free`:`Bronze`)}),(0,X.jsxs)(`div`,{className:`mt-4 flex w-full flex-row flex-wrap items-end justify-between gap-x-1 gap-y-[10px]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap text-black ${(n&&e?.yearly_price===void 0||!n&&e?.monthly_price===void 0)&&!t?`opacity-30`:``}`,children:[(0,X.jsx)(`span`,{className:`self-start text-[2.7rem] leading-[1.115] font-bold uppercase`,children:c}),(0,X.jsx)(`span`,{className:`text-[3.4rem] leading-none font-bold tracking-tight break-all`,children:b(n?p:f,{maximumFractionDigits:20})}),!t&&(0,X.jsxs)(`span`,{className:`ml-1 self-end text-[1.5rem] leading-snug text-gray-800`,children:[`/`,n?`year`:`month`]})]}),(0,X.jsx)(tt,{trialDays:o})]}),n&&m>0&&(0,X.jsx)(rt,{discount:m})]}),(0,X.jsx)(`div`,{className:`flex w-full flex-1 flex-col`,children:(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`mt-4 w-full text-[1.55rem] leading-snug font-semibold text-gray-900 ${!a&&`opacity-30`}`,children:a||(t?`Free preview`:`Full access to premium content`)}),(0,X.jsx)(nt,{benefits:l})]})})]})})]})},at=e=>e.replace(/[^\d.]+/g,``),ot=e=>Math.round(parseFloat(e.match(/[\d]+\.?[\d]{0,2}/)?.[0]||`0`)*100),st=(e,t)=>{let[n,r]=(0,Y.useState)(e===``?``:((e||0)/100).toString()),i=(0,Y.useRef)(e);return(0,Y.useEffect)(()=>{Object.is(e,i.current)||r(e===``?``:((e||0)/100).toString()),i.current=e},[e]),{value:n,onBlur:()=>r((ot(n)/100).toString()),onChange:e=>{let n=ot(e);r(at(e)),i.current=n,t?.(n)}}},ct=e({default:()=>ut}),lt=({tier:e,checkout:t})=>{let{isAdmin7:n}=te(),r=e?.type===`free`,i=t.enabled,a=t.failed,[o,c]=Y.useState(!1),{updateRoute:l}=Ae(),{mutateAsync:u}=Ee(),{mutateAsync:d}=Te(),{mutateAsync:h}=De(),[_,y]=Y.useState(!!e?.trial_days),b=s(),{confirm:x}=je(),{localSettings:ae,siteData:oe}=Ne(),[se]=Oe(ae,[`portal_plans`]),T=JSON.parse(se?.toString()||`[]`),ce=g().flatMap(e=>e.options.map(t=>({...t,metadata:{groupKey:e.key,groupLabel:e.label}}))),E={name:()=>D.name?void 0:`Enter a name for the tier`,monthly_price:()=>D.type===`free`?void 0:m(D.monthly_price||0,D.currency,{allowZero:!1}),yearly_price:()=>D.type===`free`?void 0:m(D.yearly_price||0,D.currency,{allowZero:!1})},{formState:D,saveState:ve,updateForm:L,handleSave:ye,validate:R,errors:z,clearError:B,okProps:V}=p({initialState:{...e||{},trial_days:e?.trial_days?.toString()||``,currency:e?.currency||v[0].isoCode,visibility:e?.visibility||`none`,welcome_page_url:e?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{let e={};return Object.entries(E).forEach(([t,n])=>{e[t]=n?.()}),e},onSave:async()=>{let{trial_days:t,currency:n,...i}=D,a=i;if(a.benefits=a.benefits?.filter(e=>e),r||(a.currency=n,a.trial_days=parseInt(t)),e?.id)await u({...e,...a});else{let e=await d(a);J.current=e.tiers[0]?.id??null}if(r){let e=D.visibility===`public`,t=!1;T.includes(`free`)&&!e&&(T.splice(T.indexOf(`free`),1),t=!0),!T.includes(`free`)&&e&&(T.push(`free`),t=!0),t&&await h([{key:`portal_plans`,value:JSON.stringify(T)}])}},onSaveError:b}),H=st(D.monthly_price||``,e=>L(t=>({...t,monthly_price:e}))),U=st(D.yearly_price||``,e=>L(t=>({...t,yearly_price:e}))),W=Se({baseUrl:oe?.url,nullable:!0,transformPathWithoutSlash:!0,value:D.welcome_page_url||null,onChange:e=>L(t=>({...t,welcome_page_url:e||null}))}),G=xe({items:D.benefits||[],setItems:e=>L(t=>({...t,benefits:e})),blank:``,canAddNewItem:e=>!!e}),K=(0,Y.useRef)(null),q=(0,Y.useRef)(null),J=(0,Y.useRef)(null),[ke,Me]=Y.useState(!1);(0,Y.useEffect)(()=>{i||Me(!1)},[i]);let Z=(0,Y.useRef)(null),Pe=()=>{if(!G.newItem)return;let e=Z.current?.getBoundingClientRect().top;G.addItem(),window.requestAnimationFrame(()=>{let t=Z.current,n=K.current;!t||!n||e===void 0||(t.focus({preventScroll:!0}),n.scrollBy({behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`,top:t.getBoundingClientRect().top-e}))})},Fe=(e,t,r=e=>e)=>n?r((0,X.jsxs)(I,{children:[(0,X.jsx)(P,{...e}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsx)(_e,{...t,shape:`rounded`,size:`icon-xs`})})]})):(0,X.jsxs)(X.Fragment,{children:[r((0,X.jsx)(N,{...e})),(0,X.jsx)(w,{...t})]}),Ie=t=>{t?(y(!0),L(t=>({...t,trial_days:e?.trial_days?e?.trial_days.toString():`7`}))):(y(!1),L(e=>({...e,trial_days:`0`})))},Le=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{Le.current&&(E.monthly_price?.(),E.yearly_price?.()),Le.current=!0},[D.currency]);let Re=()=>{if(e){let t=e.active?`Archive tier`:`Reactivate tier`,n=e.active?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-6`,children:[`Members will no longer be able to subscribe to `,(0,X.jsx)(`strong`,{children:e.name}),` and it will be removed from the list of available tiers in portal.`]}),(0,X.jsx)(`div`,{children:`Existing members on this tier will remain unchanged. Offers using this tier will be disabled.`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-6`,children:[`Reactivating `,(0,X.jsx)(`strong`,{children:e.name}),` will re-enable it as an option in portal and allow new members to subscribe to this tier.`]}),(0,X.jsx)(`div`,{children:`Existing members will remain unchanged.`})]}),r=e.active?`Archive`:`Reactivate`;x({title:t,prompt:n,okLabel:r,cancelLabel:`Cancel`,okVariant:e.active?`destructive`:`default`,onOk:t=>{u({...e,active:!e.active}),t?.remove(),f.success(`Tier ${e.active?`archived`:`reactivated`}`)}})}},Q;return e&&(e.active&&e.type!==`free`?Q=(0,X.jsx)(w,{type:`button`,variant:`destructive-ghost`,onClick:Re,children:`Archive tier`}):e.active||(Q=(0,X.jsx)(w,{className:`text-green hover:text-green`,type:`button`,variant:`ghost`,onClick:Re,children:`Reactivate tier`}))),(0,X.jsx)(we,{ref:K,buttonsDisabled:V.disabled,cancelLabel:`Close`,dirty:ve===`unsaved`||ke,leftButton:Q,okLabel:V.label||`Save`,okVariant:V.variant,size:`lg`,testId:`tier-detail-modal`,title:e?e.active?`Edit tier`:`Edit archived tier`:`New tier`,stickyFooter:!0,onClose:()=>{l(`tiers`)},onOk:async()=>{if(!(q.current?.validate()??!0)){R();return}if(!await ye({fakeWhenUnchanged:!0}))return;let t=e?.id??J.current;t&&await q.current?.save(t)},children:(0,X.jsxs)(`div`,{className:`mt-8 -mb-8 flex items-start gap-8`,children:[(0,X.jsxs)(`div`,{className:`flex grow flex-col gap-8`,children:[(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Basic`}),(0,X.jsxs)(k,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:[(0,X.jsxs)(M,{"data-invalid":!!z.name||void 0,children:[(0,X.jsx)(j,{htmlFor:`tier-name`,children:`Name`}),(0,X.jsx)(N,{"aria-invalid":!!z.name||void 0,autoComplete:`off`,id:`tier-name`,maxLength:191,placeholder:r?`Free`:`Bronze`,value:D.name||``,autoFocus:!0,onChange:e=>L(t=>({...t,name:e.target.value})),onKeyDown:()=>B(`name`)}),z.name&&(0,X.jsx)(A,{children:z.name})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{htmlFor:`tier-description`,children:`Description`}),(0,X.jsx)(N,{autoComplete:`off`,autoFocus:r,id:`tier-description`,maxLength:191,placeholder:r?`Free preview`:`Full access to premium content`,value:D.description||``,onChange:e=>L(t=>({...t,description:e.target.value}))})]}),!r&&(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-10 md:flex-row`,children:[(0,X.jsxs)(`div`,{className:`basis-1/2`,children:[(0,X.jsxs)(`div`,{className:`mb-1 flex h-6 items-center justify-between`,children:[(0,X.jsx)(ne,{as:`h6`,className:`text-base`,weight:`semibold`,children:`Prices`}),(0,X.jsx)(`div`,{children:(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`sr-only`,children:`Currency`}),(0,X.jsxs)(O,{open:o,onOpenChange:c,children:[(0,X.jsx)(fe,{"aria-label":`Currency`,className:`w-auto justify-start border-0 bg-transparent px-0 shadow-none hover:bg-transparent focus-visible:ring-0`,children:(0,X.jsx)(ue,{className:`flex-none`,children:D.currency})}),(0,X.jsx)(de,{align:`end`,className:`w-64`,children:(0,X.jsx)(le,{groupBy:e=>({key:e.metadata?.groupKey,label:e.metadata?.groupLabel}),i18n:{searchPlaceholder:`Search currencies...`},isMultiSelect:!1,options:ce,values:D.currency?[D.currency]:[],autoCloseOnSelect:!0,onChange:e=>{e[0]&&L(t=>({...t,currency:e[0]}))},onClose:()=>c(!1)})})]})]})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(M,{"data-invalid":!!z.monthly_price||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-monthly-price`,children:`Monthly price`}),(0,X.jsxs)(I,{"data-invalid":!!z.monthly_price||void 0,children:[(0,X.jsx)(P,{"aria-invalid":!!z.monthly_price||void 0,id:`tier-monthly-price`,inputMode:`decimal`,placeholder:`5`,value:H.value,onBlur:e=>{H.onBlur(),e.target.value===``&&L(e=>({...e,monthly_price:0}))},onChange:e=>H.onChange(e.target.value),onKeyDown:()=>B(`monthly_price`)}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsxs)(ge,{children:[D.currency,`/month`]})})]}),z.monthly_price&&(0,X.jsx)(A,{children:z.monthly_price})]}),(0,X.jsxs)(M,{"data-invalid":!!z.yearly_price||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-yearly-price`,children:`Yearly price`}),(0,X.jsxs)(I,{"data-invalid":!!z.yearly_price||void 0,children:[(0,X.jsx)(P,{"aria-invalid":!!z.yearly_price||void 0,id:`tier-yearly-price`,inputMode:`decimal`,placeholder:`50`,value:U.value,onBlur:e=>{U.onBlur(),e.target.value===``&&L(e=>({...e,yearly_price:0}))},onChange:e=>U.onChange(e.target.value),onKeyDown:()=>B(`yearly_price`)}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsxs)(ge,{children:[D.currency,`/year`]})})]}),z.yearly_price&&(0,X.jsx)(A,{children:z.yearly_price})]})]})]}),(0,X.jsxs)(`div`,{className:`basis-1/2`,children:[(0,X.jsx)(`div`,{className:`mb-1 flex h-6 flex-col justify-center`,children:(0,X.jsxs)(M,{orientation:`horizontal`,children:[(0,X.jsx)(j,{htmlFor:`tier-free-trial`,children:`Add a free trial`}),(0,X.jsx)(Ce,{checked:_,id:`tier-free-trial`,onCheckedChange:Ie})]})}),(0,X.jsxs)(M,{"data-disabled":!_||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-trial-days`,children:`Trial days`}),(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{disabled:!_,id:`tier-trial-days`,placeholder:`0`,value:D.trial_days,onChange:e=>L(t=>({...t,trial_days:e.target.value.replace(/[^\d]/,``)}))}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsx)(ge,{children:`days`})})]}),(0,X.jsx)(me,{children:(0,X.jsxs)(`span`,{className:`mt-1`,children:[`Members will be subscribed at full price once the trial ends.`,` `,(0,X.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/free-trials/`,rel:`noreferrer`,target:`_blank`,children:`Learn more`})]})})]})]})]})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{htmlFor:`tier-welcome-page`,children:`Welcome page`}),(0,X.jsx)(N,{id:`tier-welcome-page`,maxLength:2e3,placeholder:oe?.url,value:W.displayValue,onBlur:W.commitValue,onChange:e=>W.setDisplayValue(e.target.value),onFocus:W.handleFocus,onKeyDown:W.handleKeyDown}),(0,X.jsxs)(me,{children:[`Redirect to this URL after signup`,r?``:` for premium membership`]})]})]})]}),(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Benefits`}),(0,X.jsxs)(k,{className:ee(`gap-0 rounded-sm border border-border-default p-4 md:p-7`,!i&&!a&&`mb-10`),children:[(0,X.jsx)(be,{getDragHandleLabel:({item:e})=>`Reorder benefit${e?`: ${e}`:``}`,items:G.items,itemSeparator:!1,renderItem:({id:e,item:t})=>(0,X.jsxs)(S,{align:`center`,className:`relative w-full`,gap:`lg`,children:[(0,X.jsx)(S,{align:`center`,className:`absolute top-1/2 left-[-32px] size-6 -translate-y-1/2 bg-background group-hover:hidden`,justify:`center`,children:(0,X.jsx)(C,{className:`size-4`})}),Fe({"aria-label":`Benefit`,className:`grow`,maxLength:191,value:t,onChange:t=>G.updateItem(e,t.target.value)},{"aria-label":`Delete benefit`,className:n?`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`:`absolute top-1/2 right-1 z-10 size-5! -translate-y-1/2 p-0! opacity-0 group-hover:opacity-100`,size:`icon`,type:`button`,variant:`secondary`,onClick:()=>G.removeItem(e),children:(0,X.jsx)(re,{})})]}),onMove:G.moveItem}),(0,X.jsxs)(S,{align:`center`,className:`relative mt-1`,gap:`md`,children:[(0,X.jsx)(C,{className:`size-4`}),Fe({ref:Z,className:`grow`,id:`new-tier-benefit`,maxLength:191,placeholder:`Expert analysis`,value:G.newItem,onChange:e=>G.setNewItem(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Pe())}},{"aria-label":`Add benefit`,variant:`default`,className:n?void 0:`absolute top-1/2 right-1 z-10 size-[22px]! -translate-y-1/2 p-0!`,size:`icon`,type:`button`,onClick:Pe,children:(0,X.jsx)(ie,{})},e=>(0,X.jsxs)(M,{className:`w-100`,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`new-tier-benefit`,children:`New benefit`}),e]}))]})]})]}),(i||a)&&(0,X.jsx)($e,{ref:q,config:t.config,failed:a,onDirtyChange:Me},e?.id??`new`)]}),(0,X.jsx)(`div`,{className:`sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block`,children:(0,X.jsx)(it,{isFreeTier:r,tier:D})})]})})},ut=()=>{let{tierId:e}=y(),{data:{tiers:t,isEnd:n}={},fetchNextPage:r}=B(),i;(0,Y.useEffect)(()=>{e&&!i&&!n&&r()},[r,n,e,i]),e&&(i=t?.find(({id:t})=>t===e));let a=et(i,{creating:!e});return e&&!i||!a.isReady?null:(0,X.jsx)(lt,{checkout:a,tier:i})};export{et as i,st as n,tt as r,ct as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b19b56ca-d880-49b2-a50f-9423fb45d76e`,e._sentryDebugIdIdentifier=`sentry-dbid-b19b56ca-d880-49b2-a50f-9423fb45d76e`)}catch{}})();import{i as e,s as t,t as n}from"./react-C9lG_SsT.js";import{A as r,O as i,_ as a,b as o,g as s,n as c,r as l,y as u}from"./hooks-0r7qxGEo.js";import{t as d}from"./jsx-runtime-Bm2_KH-0.js";import{n as f}from"./dist-pogVoW2G.js";import{t as p}from"./use-form-ElCUnbKi.js";import{a as m,i as h,n as g,r as _,t as v}from"./currency-DgOqjQBh.js";import{h as y}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as b,L as ee,Z as x,r as te}from"./shade-provider-DvrXKKQZ.js";import{t as S}from"./inline-Qoyy4r2g.js";import{t as ne}from"./text-BnCSdzao.js";import{D as re,dt as ie,or as C,t as w}from"./button-CTHYSI-d.js";import{a as ae,c as oe,n as se,o as T,r as ce,s as E,t as le,u as D}from"./multi-select-combobox-BzBMUFst.js";import{i as ue,n as de,r as fe,t as O}from"./combobox-DDlijta6.js";import{a as k,c as pe,i as A,o as j,r as me,s as he,t as M}from"./field-DCPPrQDr.js";import{t as N}from"./input-BHb2A_DU.js";import{a as ge,i as P,n as F,r as _e,t as I}from"./input-group-DL5EFP5r.js";import{i as ve,n as L,o as ye,s as R,t as z}from"./select-DeloOYCg.js";import{i as be,n as xe,t as Se}from"./use-url-input-BeYKYMGh.js";import{t as Ce}from"./switch-BppWscjz.js";import{t as we}from"./settings-modal-3x4v8abr.js";import{a as B,i as Te,o as Ee}from"./tiers-DlvS8D6_.js";import{B as V,Jt as De,Ut as Oe,Vt as H,st as U}from"./index-RuRs_qGS.js";import{t as W}from"./use-availability-CgZC6L_V.js";import{c as G,g as K,u as q}from"./member-custom-fields-CBdiwPD9.js";import{n as J,t as ke}from"./custom-field-type-option-C8Nt4X6x.js";import{t as Ae}from"./use-settings-navigation-CO2nUqDW.js";import{n as je}from"./confirmation-context-By_jX_cA.js";import{n as Me}from"./global-data-context-ogIy0FUG.js";import{t as Ne}from"./use-setting-group-YP84CqrJ.js";var Y=t(n(),1),X=d();function Z(e,t,n){return D((n??[]).join(` `),t)}function Pe({id:e,label:t,fields:n,value:r,invalid:i,onChange:a,createTypes:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(``),p=n.find(e=>e.key===r),m=!!o?.length,h=()=>{c(!1),u(null),f(``)};return(0,X.jsxs)(O,{open:s,onOpenChange:e=>{e?c(!0):h()},children:[(0,X.jsx)(fe,{"aria-invalid":i||void 0,"aria-label":t,id:e,children:(0,X.jsx)(ue,{placeholder:!p,children:p?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(J,{className:`size-4 shrink-0`,type:p.type}),(0,X.jsx)(`span`,{className:`truncate`,children:p.name})]}):`Select...`})}),(0,X.jsx)(de,{onEscapeKeyDown:e=>{l&&(e.preventDefault(),u(null))},children:l&&o?.length?(0,X.jsx)(Fe,{initialName:l.initialName,label:t,types:o,onCancel:()=>u(null),onCreated:e=>{h(),a(e)}}):(0,X.jsxs)(se,{filter:Z,children:[(0,X.jsx)(T,{placeholder:`Search fields...`,value:d,onValueChange:f}),(0,X.jsxs)(oe,{children:[n.length>0&&(0,X.jsx)(ae,{className:`p-0`,children:n.map(e=>(0,X.jsxs)(E,{keywords:[e.name],value:e.key,onSelect:()=>{h(),a(e.key)},children:[(0,X.jsx)(J,{className:`size-4`,type:e.type}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),r===e.key&&(0,X.jsx)(ce,{})]},e.key))}),m&&(0,X.jsx)(ae,{className:`p-0`,forceMount:!0,children:(0,X.jsxs)(E,{className:`font-semibold text-green`,value:`__create-custom-field__`,forceMount:!0,onSelect:()=>u({initialName:d.trim()}),children:[(0,X.jsx)(ie,{className:`size-4`}),(0,X.jsx)(`span`,{children:`Add custom field`})]})})]})]})})]})}function Fe({initialName:e,label:t,types:n,onCancel:c,onCreated:l}){let[d,f]=(0,Y.useState)(e),[p,m]=(0,Y.useState)(n[0]),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!0),{mutateAsync:ee,isPending:x}=q(),te=s(),S=async()=>{if(!d.trim()){g(`Enter a name for the field`);return}try{let e=(await ee({name:d.trim(),type:p,access:{member:`none`}})).members_metafields?.[0];if(!e){v(`The field was created but could not be selected. Choose it from the list.`),b(!1);return}l(e.key)}catch(e){let t=e instanceof o?e.data?.errors?.[0]:null;if(e instanceof i&&t?.property===`name`){g(r(e,`Invalid name`));return}e instanceof u||te(e,{withToast:!1}),v(r(e,e instanceof a?e.message:`Could not create the custom field, please try again.`)),b(!(e instanceof u)&&t?.type!==`NoPermissionError`)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,onKeyDown:e=>{e.key===`Enter`&&!x&&y&&(e.preventDefault(),S())},children:[(0,X.jsxs)(M,{"data-invalid":!!h||void 0,children:[(0,X.jsx)(j,{className:`text-sm!`,htmlFor:`custom-field-picker-create-name`,children:`New custom field`}),(0,X.jsx)(N,{"aria-invalid":!!h||void 0,"aria-label":`New custom field for ${t}`,autoComplete:`off`,className:`h-8 text-sm!`,id:`custom-field-picker-create-name`,placeholder:`Enter custom field name`,value:d,autoFocus:!0,onChange:e=>{f(e.target.value),g(null),v(null),b(!0)}}),h&&(0,X.jsx)(A,{children:h})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`text-sm!`,children:`Type`}),(0,X.jsxs)(z,{disabled:n.length===1,value:p,onValueChange:e=>m(e),children:[(0,X.jsx)(ye,{"aria-label":`Type`,className:`h-8 text-sm!`,children:(0,X.jsx)(R,{children:(0,X.jsx)(ke,{type:p})})}),(0,X.jsx)(L,{children:n.map(e=>(0,X.jsx)(ve,{value:e,children:(0,X.jsx)(ke,{type:e})},e))})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,X.jsx)(w,{disabled:x,size:`sm`,type:`button`,variant:`outline`,onClick:c,children:`Cancel`}),(0,X.jsx)(w,{disabled:x||!y,size:`sm`,type:`button`,onClick:()=>void S(),children:x?`Saving`:`Save`})]}),_&&(0,X.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:_})]})}var Ie=`AC.AD.AE.AF.AG.AI.AL.AM.AO.AQ.AR.AT.AU.AW.AX.AZ.BA.BB.BD.BE.BF.BG.BH.BI.BJ.BL.BM.BN.BO.BQ.BR.BS.BT.BV.BW.BY.BZ.CA.CD.CF.CG.CH.CI.CK.CL.CM.CN.CO.CR.CV.CW.CY.CZ.DE.DJ.DK.DM.DO.DZ.EC.EE.EG.EH.ER.ES.ET.FI.FJ.FK.FO.FR.GA.GB.GD.GE.GF.GG.GH.GI.GL.GM.GN.GP.GQ.GR.GS.GT.GU.GW.GY.HK.HN.HR.HT.HU.ID.IE.IL.IM.IN.IO.IQ.IS.IT.JE.JM.JO.JP.KE.KG.KH.KI.KM.KN.KR.KW.KY.KZ.LA.LB.LC.LI.LK.LR.LS.LT.LU.LV.LY.MA.MC.MD.ME.MF.MG.MK.ML.MM.MN.MO.MQ.MR.MS.MT.MU.MV.MW.MX.MY.MZ.NA.NC.NE.NG.NI.NL.NO.NP.NR.NU.NZ.OM.PA.PE.PF.PG.PH.PK.PL.PM.PN.PR.PS.PT.PY.QA.RE.RO.RS.RU.RW.SA.SB.SC.SD.SE.SG.SH.SI.SJ.SK.SL.SM.SN.SO.SR.SS.ST.SV.SX.SZ.TA.TC.TD.TF.TG.TH.TJ.TK.TL.TM.TN.TO.TR.TT.TV.TW.TZ.UA.UG.US.UY.UZ.VA.VC.VE.VG.VN.VU.WF.WS.XK.YE.YT.ZA.ZM.ZW.ZZ`.split(`.`);new Set(Ie);var Le=[`shipping_name`,`shipping_address`,`phone`];function Re(e){return Le.includes(e)}var Q={shippingName:`shipping_name`,shippingAddress:`shipping_address`,phone:`phone`},ze={shipping_name:{key:`shipping_name`,name:`Shipping Name`,type:`short_text`},shipping_address:{key:`shipping_address`,name:`Shipping Address`,type:`address`},phone:{key:`shipping_phone`,name:`Shipping Phone`,type:`short_text`}},Be=`TiersCheckoutConfigResponseType`,Ve=l({dataType:Be,path:`/tiers/checkout_config/`}),He=c({method:`PUT`,path:({tierId:e})=>`/tiers/${e}/checkout_config/`,body:({config:e})=>({tiers_checkout_config:[e]}),invalidateQueries:{dataType:Be}}),Ue=Ie.map(e=>({value:e,label:K(e)})).sort((e,t)=>e.label.localeCompare(t.label)),We=[{value:`all`,label:`All countries`,hint:`Everywhere Stripe supports shipping`},{value:`specific`,label:`Specific countries`,hint:`Choose the countries you deliver to`}],Ge={[Q.shippingAddress]:`shippingField`,[Q.shippingName]:`shippingName`,[Q.phone]:`phoneField`},Ke=e=>{let t=(e instanceof o?e.data?.errors?.[0]?.property:null)??``,n=/^checkout\.(\w+)\.custom_field_key$/.exec(t)?.[1];return n&&Re(n)?Ge[n]:void 0},$=(e,t)=>t??ze[e].key,qe=e=>({shipping:e.shipping.collect?{...e.shipping,allowedCountries:e.shipping.countriesMode===`specific`?e.shipping.allowedCountries:[]}:{collect:!1,countriesMode:`all`,allowedCountries:[],addressFieldKey:null,nameFieldKey:null},taxNumber:e.taxNumber,phone:e.phone.collect?e.phone:{collect:!1,customFieldKey:null}}),Je=e=>{let t=e?.shipping,n=t?.allowed_countries;return{shipping:{collect:!!t,addressFieldKey:t?.address.custom_field_key??null,nameFieldKey:t?.name.custom_field_key??null,countriesMode:n?`specific`:`all`,allowedCountries:n??[]},taxNumber:{collect:!!e?.tax_number},phone:{collect:!!e?.phone,customFieldKey:e?.phone?.custom_field_key??null}}};function Ye({children:e}){return(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Checkout`}),(0,X.jsx)(k,{className:`mb-10 gap-6 rounded-sm border border-border-default p-4 md:p-7`,children:e})]})}function Xe({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col content-center gap-4 md:flex-row md:items-center`,children:[(0,X.jsx)(`div`,{className:`w-full min-w-[160px] md:flex-1`,children:e}),(0,X.jsx)(`div`,{className:`w-full md:w-64 md:min-w-0`,children:t})]})}function Ze({checked:e,description:t,id:n,label:r,onCheckedChange:i}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(M,{orientation:`horizontal`,children:[(0,X.jsx)(j,{htmlFor:n,children:r}),(0,X.jsx)(Ce,{checked:e,id:n,onCheckedChange:i})]}),(0,X.jsx)(me,{children:t})]})}function Qe({eligible:e,error:t,id:n,label:r,port:i,value:a,onChange:o}){return(0,X.jsx)(Xe,{label:r,children:(0,X.jsxs)(M,{"data-invalid":!!t||void 0,children:[(0,X.jsx)(Pe,{createTypes:[ze[i].type],fields:e[i],id:n,invalid:!!t,label:r,value:a,onChange:o}),t&&(0,X.jsx)(A,{children:t})]})})}var $e=(0,Y.forwardRef)(({config:e,failed:t,onDirtyChange:n},i)=>{let[a,o]=(0,Y.useState)(()=>Je(e)),[c,l]=(0,Y.useState)({}),[u,d]=(0,Y.useState)(!1),{mutateAsync:f}=He(),p=s(),m=W(),{data:h}=G({enabled:m}),g=h??[],_=Object.fromEntries(Object.entries(ze).map(([e,t])=>[e,g.filter(e=>e.type===t.type)])),v=a.shipping.allowedCountries,y=(0,Y.useMemo)(()=>JSON.stringify(qe(Je(e))),[e]),[b,ee]=(0,Y.useState)(null),x=!t&&JSON.stringify(qe(a))!==(b??y);(0,Y.useEffect)(()=>{n?.(x)},[x,n]);let te=()=>{let e={},t=(e,t)=>{if(!e)return`Choose where this should be kept`;if(h&&!t.some(t=>t.key===e))return`This field is no longer available. Choose another`};return a.shipping.collect&&(m&&(e.shippingField=t(a.shipping.addressFieldKey,_[Q.shippingAddress]),e.shippingName=t(a.shipping.nameFieldKey,_[Q.shippingName])),a.shipping.countriesMode===`specific`&&!a.shipping.allowedCountries.length&&(e.shippingCountries=`Choose at least one country you deliver to`)),a.phone.collect&&m&&(e.phoneField=t(a.phone.customFieldKey,_[Q.phone])),e},S=()=>{if(!x)return l({}),!0;let e=te();return l(e),!Object.values(e).some(Boolean)};return(0,Y.useImperativeHandle)(i,()=>({validate:S,save:async e=>{if(!x)return!0;if(!S())return!1;try{return await f({tierId:e,config:{shipping:a.shipping.collect?{collect:!0,...a.shipping.countriesMode===`specific`?{allowed_countries:a.shipping.allowedCountries}:{},name:{custom_field_key:$(Q.shippingName,a.shipping.nameFieldKey)},address:{custom_field_key:$(Q.shippingAddress,a.shipping.addressFieldKey)}}:{collect:!1},tax_number:{collect:a.taxNumber.collect},phone:a.phone.collect?{collect:!0,custom_field_key:$(Q.phone,a.phone.customFieldKey)}:{collect:!1}}}),ee(JSON.stringify(qe(a))),!0}catch(e){let t=m?Ke(e):void 0;return t?(p(e,{withToast:!1}),l(n=>({...n,[t]:r(e,`This field cannot be used here. Choose another`)})),!1):(p(e),!1)}}}),[m,x,f,h,p,a]),t?(0,X.jsx)(Ye,{children:(0,X.jsx)(ne,{className:`text-sm text-muted-foreground`,children:`Checkout collection settings could not be loaded, so they are not shown. Close and reopen this tier to try again.`})}):(0,X.jsxs)(Ye,{children:[(0,X.jsx)(Ze,{checked:a.shipping.collect,description:`Require a shipping address during checkout`,id:`tier-collect-shipping`,label:`Collect shipping address`,onCheckedChange:e=>o(t=>({...t,shipping:{...t.shipping,collect:e}}))}),a.shipping.collect&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xe,{label:`Ships to`,children:(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`sr-only`,children:`Ships to`}),(0,X.jsxs)(z,{value:a.shipping.countriesMode,onValueChange:e=>{l(e=>({...e,shippingCountries:void 0})),o(t=>({...t,shipping:{...t.shipping,countriesMode:e}}))},children:[(0,X.jsx)(ye,{"aria-label":`Ships to`,children:(0,X.jsx)(R,{children:We.find(e=>e.value===a.shipping.countriesMode)?.label})}),(0,X.jsx)(L,{children:We.map(e=>(0,X.jsx)(ve,{value:e.value,children:(0,X.jsxs)(`span`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.hint})]})},e.value))})]})]})}),a.shipping.countriesMode===`specific`&&(0,X.jsx)(Xe,{label:`Select specific countries`,children:(0,X.jsxs)(M,{"data-invalid":!!c.shippingCountries||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,children:`Select specific countries`}),(0,X.jsxs)(O,{open:u,onOpenChange:d,children:[(0,X.jsx)(fe,{"aria-invalid":!!c.shippingCountries||void 0,"aria-label":`Select specific countries`,children:(0,X.jsx)(ue,{placeholder:!v.length,children:v.length?v.map(K).join(`, `):`Select...`})}),(0,X.jsx)(de,{children:(0,X.jsx)(le,{i18n:{searchPlaceholder:`Search countries...`},options:Ue,values:v,onChange:e=>{l(e=>({...e,shippingCountries:void 0})),o(t=>({...t,shipping:{...t.shipping,allowedCountries:e}}))},onClose:()=>d(!1)})})]}),c.shippingCountries&&(0,X.jsx)(A,{children:c.shippingCountries})]})}),m&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qe,{eligible:_,error:c.shippingField,id:`tier-shipping-address-field`,label:`Save address as`,port:Q.shippingAddress,value:a.shipping.addressFieldKey,onChange:e=>{l(e=>({...e,shippingField:void 0})),o(t=>({...t,shipping:{...t.shipping,addressFieldKey:e}}))}}),(0,X.jsx)(Qe,{eligible:_,error:c.shippingName,id:`tier-shipping-name-field`,label:`Save recipient name as`,port:Q.shippingName,value:a.shipping.nameFieldKey,onChange:e=>{l(e=>({...e,shippingName:void 0})),o(t=>({...t,shipping:{...t.shipping,nameFieldKey:e}}))}})]})]}),(0,X.jsx)(U,{}),(0,X.jsx)(Ze,{checked:a.phone.collect,description:`Require a phone number during checkout`,id:`tier-collect-phone`,label:`Collect phone number`,onCheckedChange:e=>o(t=>({...t,phone:{...t.phone,collect:e}}))}),a.phone.collect&&m&&(0,X.jsx)(Qe,{eligible:_,error:c.phoneField,id:`tier-phone-field`,label:`Save to custom field`,port:Q.phone,value:a.phone.customFieldKey,onChange:e=>{l(e=>({...e,phoneField:void 0})),o(t=>({...t,phone:{...t.phone,customFieldKey:e}}))}}),(0,X.jsx)(U,{}),(0,X.jsx)(Ze,{checked:a.taxNumber.collect,description:`Let members add a tax ID to their invoices`,id:`tier-collect-tax`,label:`Collect business tax ID`,onCheckedChange:e=>o(t=>({...t,taxNumber:{...t.taxNumber,collect:e}}))})]})});$e.displayName=`TierCheckoutCollection`;var et=(e,{creating:t=!1}={})=>{let n=V(`stripeCheckoutCollection`),{config:r,settings:i}=Me(),o=n&&H(i||[],r||{}),{data:s,error:c,isError:l,isFetching:u}=Ve({enabled:o,defaultErrorHandler:!1}),d=o&&(e?e.type!==`free`:t),f=l&&!u,p=f&&c instanceof a&&c.response?.status===404,m=d&&!f;return{enabled:m,failed:d&&f&&!p,isReady:!m||!!s,config:s?.tiers_checkout_config?.find(t=>t.tier_id===e?.id)}},tt=({size:e=`md`,trialDays:t})=>t?(0,X.jsxs)(`span`,{className:x(e===`sm`?`px-1.5 py-0.5 text-sm`:`px-2.5 py-1.5`,`relative -mt-1 -mr-1 rounded-full leading-none font-semibold tracking-wide whitespace-nowrap text-gray-900`),children:[(0,X.jsx)(`span`,{className:`absolute inset-0 block rounded-full bg-ghostaccent opacity-20 dark:bg-pink`}),(0,X.jsxs)(`span`,{className:`dark:text-pink`,children:[b(t),` days free`]})]}):null,nt=({benefits:e})=>{if(!e?.length)return(0,X.jsx)(`div`,{className:`mt-4 w-full text-md leading-snug text-gray-900 opacity-30`,children:(0,X.jsxs)(`div`,{className:`mb-2.5 flex items-start`,children:[(0,X.jsx)(C,{className:`mt-[3px] mr-[10px] size-3.5! min-w-[14px] overflow-visible stroke-[3px]!`}),(0,X.jsx)(`div`,{children:`Expert analysis`})]})});let t=new Map;return(0,X.jsx)(X.Fragment,{children:e.map(e=>{let n=(t.get(e)||0)+1;return t.set(e,n),(0,X.jsx)(`div`,{className:`mt-4 w-full text-md leading-snug text-gray-900`,children:(0,X.jsxs)(`div`,{className:`mb-2.5 flex items-start`,children:[(0,X.jsx)(C,{className:`mt-[3px] mr-[10px] size-3.5! min-w-[14px] overflow-visible stroke-[3px]!`}),(0,X.jsx)(`div`,{children:e})]})},`${e}:${n}`)})})},rt=({discount:e})=>e?(0,X.jsxs)(`span`,{className:`mt-1 leading-none font-semibold text-ghostaccent`,children:[b(e),`% discount`]}):null,it=({tier:e,isFreeTier:t})=>{let[n,r]=(0,Y.useState)(!1),i=e?.name||``,a=e?.description||``,o=parseFloat(e?.trial_days||`0`),s=e?.currency||`USD`,c=s?h(s):`$`,l=e?.benefits||[],u=t?0:500,d=t?0:5e3,f=_(e?.monthly_price??u),p=_(e?.yearly_price??d),m=e?.monthly_price&&e?.yearly_price?Math.ceil((f*12-p)/(f*12)*100):0;return(0,X.jsxs)(`div`,{className:`-mt-2`,"data-testid":`tier-preview`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,X.jsx)(ne,{as:`h6`,className:`pb-2 text-base leading-snug`,weight:`medium`,children:t?`Free membership preview`:`Tier preview`}),!t&&(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[(0,X.jsx)(w,{className:n?`h-auto p-0 text-muted-foreground`:`h-auto p-0 text-foreground`,type:`button`,variant:`link`,onClick:()=>r(!1),children:`Monthly`}),(0,X.jsx)(w,{className:n?`ml-2 h-auto p-0 text-foreground`:`ml-2 h-auto p-0 text-muted-foreground`,type:`button`,variant:`link`,onClick:()=>r(!0),children:`Yearly`})]})]}),(0,X.jsx)(`div`,{className:`rounded-sm border border-gray-200 bg-white dark:border-transparent`,children:(0,X.jsxs)(`div`,{className:`relative flex min-h-[200px] w-full max-w-[420px] scale-90 flex-col items-start justify-stretch rounded bg-white p-4`,children:[(0,X.jsxs)(`div`,{className:`min-h-[56px] w-full`,children:[(0,X.jsx)(`h4`,{className:`-mt-1 mb-0 w-full text-lg leading-tight font-semibold break-words text-ghostaccent ${!i&&`opacity-30`}`,children:i||(t?`Free`:`Bronze`)}),(0,X.jsxs)(`div`,{className:`mt-4 flex w-full flex-row flex-wrap items-end justify-between gap-x-1 gap-y-[10px]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap text-black ${(n&&e?.yearly_price===void 0||!n&&e?.monthly_price===void 0)&&!t?`opacity-30`:``}`,children:[(0,X.jsx)(`span`,{className:`self-start text-[2.7rem] leading-[1.115] font-bold uppercase`,children:c}),(0,X.jsx)(`span`,{className:`text-[3.4rem] leading-none font-bold tracking-tight break-all`,children:b(n?p:f,{maximumFractionDigits:20})}),!t&&(0,X.jsxs)(`span`,{className:`ml-1 self-end text-[1.5rem] leading-snug text-gray-800`,children:[`/`,n?`year`:`month`]})]}),(0,X.jsx)(tt,{trialDays:o})]}),n&&m>0&&(0,X.jsx)(rt,{discount:m})]}),(0,X.jsx)(`div`,{className:`flex w-full flex-1 flex-col`,children:(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`mt-4 w-full text-[1.55rem] leading-snug font-semibold text-gray-900 ${!a&&`opacity-30`}`,children:a||(t?`Free preview`:`Full access to premium content`)}),(0,X.jsx)(nt,{benefits:l})]})})]})})]})},at=e=>e.replace(/[^\d.]+/g,``),ot=e=>Math.round(parseFloat(e.match(/[\d]+\.?[\d]{0,2}/)?.[0]||`0`)*100),st=(e,t)=>{let[n,r]=(0,Y.useState)(e===``?``:((e||0)/100).toString()),i=(0,Y.useRef)(e);return(0,Y.useEffect)(()=>{Object.is(e,i.current)||r(e===``?``:((e||0)/100).toString()),i.current=e},[e]),{value:n,onBlur:()=>r((ot(n)/100).toString()),onChange:e=>{let n=ot(e);r(at(e)),i.current=n,t?.(n)}}},ct=e({default:()=>ut}),lt=({tier:e,checkout:t})=>{let{isAdmin7:n}=te(),r=e?.type===`free`,i=t.enabled,a=t.failed,[o,c]=Y.useState(!1),{updateRoute:l}=Ae(),{mutateAsync:u}=Ee(),{mutateAsync:d}=Te(),{mutateAsync:h}=De(),[_,y]=Y.useState(!!e?.trial_days),b=s(),{confirm:x}=je(),{localSettings:ae,siteData:oe}=Ne(),[se]=Oe(ae,[`portal_plans`]),T=JSON.parse(se?.toString()||`[]`),ce=g().flatMap(e=>e.options.map(t=>({...t,metadata:{groupKey:e.key,groupLabel:e.label}}))),E={name:()=>D.name?void 0:`Enter a name for the tier`,monthly_price:()=>D.type===`free`?void 0:m(D.monthly_price||0,D.currency,{allowZero:!1}),yearly_price:()=>D.type===`free`?void 0:m(D.yearly_price||0,D.currency,{allowZero:!1})},{formState:D,saveState:ve,updateForm:L,handleSave:ye,validate:R,errors:z,clearError:B,okProps:V}=p({initialState:{...e||{},trial_days:e?.trial_days?.toString()||``,currency:e?.currency||v[0].isoCode,visibility:e?.visibility||`none`,welcome_page_url:e?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{let e={};return Object.entries(E).forEach(([t,n])=>{e[t]=n?.()}),e},onSave:async()=>{let{trial_days:t,currency:n,...i}=D,a=i;if(a.benefits=a.benefits?.filter(e=>e),r||(a.currency=n,a.trial_days=parseInt(t)),e?.id)await u({...e,...a});else{let e=await d(a);J.current=e.tiers[0]?.id??null}if(r){let e=D.visibility===`public`,t=!1;T.includes(`free`)&&!e&&(T.splice(T.indexOf(`free`),1),t=!0),!T.includes(`free`)&&e&&(T.push(`free`),t=!0),t&&await h([{key:`portal_plans`,value:JSON.stringify(T)}])}},onSaveError:b}),H=st(D.monthly_price||``,e=>L(t=>({...t,monthly_price:e}))),U=st(D.yearly_price||``,e=>L(t=>({...t,yearly_price:e}))),W=Se({baseUrl:oe?.url,nullable:!0,transformPathWithoutSlash:!0,value:D.welcome_page_url||null,onChange:e=>L(t=>({...t,welcome_page_url:e||null}))}),G=xe({items:D.benefits||[],setItems:e=>L(t=>({...t,benefits:e})),blank:``,canAddNewItem:e=>!!e}),K=(0,Y.useRef)(null),q=(0,Y.useRef)(null),J=(0,Y.useRef)(null),[ke,Me]=Y.useState(!1);(0,Y.useEffect)(()=>{i||Me(!1)},[i]);let Z=(0,Y.useRef)(null),Pe=()=>{if(!G.newItem)return;let e=Z.current?.getBoundingClientRect().top;G.addItem(),window.requestAnimationFrame(()=>{let t=Z.current,n=K.current;!t||!n||e===void 0||(t.focus({preventScroll:!0}),n.scrollBy({behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`,top:t.getBoundingClientRect().top-e}))})},Fe=(e,t,r=e=>e)=>n?r((0,X.jsxs)(I,{children:[(0,X.jsx)(P,{...e}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsx)(_e,{...t,shape:`rounded`,size:`icon-xs`})})]})):(0,X.jsxs)(X.Fragment,{children:[r((0,X.jsx)(N,{...e})),(0,X.jsx)(w,{...t})]}),Ie=t=>{t?(y(!0),L(t=>({...t,trial_days:e?.trial_days?e?.trial_days.toString():`7`}))):(y(!1),L(e=>({...e,trial_days:`0`})))},Le=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{Le.current&&(E.monthly_price?.(),E.yearly_price?.()),Le.current=!0},[D.currency]);let Re=()=>{if(e){let t=e.active?`Archive tier`:`Reactivate tier`,n=e.active?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-6`,children:[`Members will no longer be able to subscribe to `,(0,X.jsx)(`strong`,{children:e.name}),` and it will be removed from the list of available tiers in portal.`]}),(0,X.jsx)(`div`,{children:`Existing members on this tier will remain unchanged. Offers using this tier will be disabled.`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-6`,children:[`Reactivating `,(0,X.jsx)(`strong`,{children:e.name}),` will re-enable it as an option in portal and allow new members to subscribe to this tier.`]}),(0,X.jsx)(`div`,{children:`Existing members will remain unchanged.`})]}),r=e.active?`Archive`:`Reactivate`;x({title:t,prompt:n,okLabel:r,cancelLabel:`Cancel`,okVariant:e.active?`destructive`:`default`,onOk:t=>{u({...e,active:!e.active}),t?.remove(),f.success(`Tier ${e.active?`archived`:`reactivated`}`)}})}},Q;return e&&(e.active&&e.type!==`free`?Q=(0,X.jsx)(w,{type:`button`,variant:`destructive-ghost`,onClick:Re,children:`Archive tier`}):e.active||(Q=(0,X.jsx)(w,{className:`text-green hover:text-green`,type:`button`,variant:`ghost`,onClick:Re,children:`Reactivate tier`}))),(0,X.jsx)(we,{ref:K,buttonsDisabled:V.disabled,cancelLabel:`Close`,dirty:ve===`unsaved`||ke,leftButton:Q,okLabel:V.label||`Save`,okVariant:V.variant,size:`lg`,testId:`tier-detail-modal`,title:e?e.active?`Edit tier`:`Edit archived tier`:`New tier`,stickyFooter:!0,onClose:()=>{l(`tiers`)},onOk:async()=>{if(!(q.current?.validate()??!0)){R();return}if(!await ye({fakeWhenUnchanged:!0}))return;let t=e?.id??J.current;t&&await q.current?.save(t)},children:(0,X.jsxs)(`div`,{className:`mt-8 -mb-8 flex items-start gap-8`,children:[(0,X.jsxs)(`div`,{className:`flex grow flex-col gap-8`,children:[(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Basic`}),(0,X.jsxs)(k,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:[(0,X.jsxs)(M,{"data-invalid":!!z.name||void 0,children:[(0,X.jsx)(j,{htmlFor:`tier-name`,children:`Name`}),(0,X.jsx)(N,{"aria-invalid":!!z.name||void 0,autoComplete:`off`,id:`tier-name`,maxLength:191,placeholder:r?`Free`:`Bronze`,value:D.name||``,autoFocus:!0,onChange:e=>L(t=>({...t,name:e.target.value})),onKeyDown:()=>B(`name`)}),z.name&&(0,X.jsx)(A,{children:z.name})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{htmlFor:`tier-description`,children:`Description`}),(0,X.jsx)(N,{autoComplete:`off`,autoFocus:r,id:`tier-description`,maxLength:191,placeholder:r?`Free preview`:`Full access to premium content`,value:D.description||``,onChange:e=>L(t=>({...t,description:e.target.value}))})]}),!r&&(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-10 md:flex-row`,children:[(0,X.jsxs)(`div`,{className:`basis-1/2`,children:[(0,X.jsxs)(`div`,{className:`mb-1 flex h-6 items-center justify-between`,children:[(0,X.jsx)(ne,{as:`h6`,className:`text-base`,weight:`semibold`,children:`Prices`}),(0,X.jsx)(`div`,{children:(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{className:`sr-only`,children:`Currency`}),(0,X.jsxs)(O,{open:o,onOpenChange:c,children:[(0,X.jsx)(fe,{"aria-label":`Currency`,className:`w-auto justify-start border-0 bg-transparent px-0 shadow-none hover:bg-transparent focus-visible:ring-0`,children:(0,X.jsx)(ue,{className:`flex-none`,children:D.currency})}),(0,X.jsx)(de,{align:`end`,className:`w-64`,children:(0,X.jsx)(le,{groupBy:e=>({key:e.metadata?.groupKey,label:e.metadata?.groupLabel}),i18n:{searchPlaceholder:`Search currencies...`},isMultiSelect:!1,options:ce,values:D.currency?[D.currency]:[],autoCloseOnSelect:!0,onChange:e=>{e[0]&&L(t=>({...t,currency:e[0]}))},onClose:()=>c(!1)})})]})]})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(M,{"data-invalid":!!z.monthly_price||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-monthly-price`,children:`Monthly price`}),(0,X.jsxs)(I,{"data-invalid":!!z.monthly_price||void 0,children:[(0,X.jsx)(P,{"aria-invalid":!!z.monthly_price||void 0,id:`tier-monthly-price`,inputMode:`decimal`,placeholder:`5`,value:H.value,onBlur:e=>{H.onBlur(),e.target.value===``&&L(e=>({...e,monthly_price:0}))},onChange:e=>H.onChange(e.target.value),onKeyDown:()=>B(`monthly_price`)}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsxs)(ge,{children:[D.currency,`/month`]})})]}),z.monthly_price&&(0,X.jsx)(A,{children:z.monthly_price})]}),(0,X.jsxs)(M,{"data-invalid":!!z.yearly_price||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-yearly-price`,children:`Yearly price`}),(0,X.jsxs)(I,{"data-invalid":!!z.yearly_price||void 0,children:[(0,X.jsx)(P,{"aria-invalid":!!z.yearly_price||void 0,id:`tier-yearly-price`,inputMode:`decimal`,placeholder:`50`,value:U.value,onBlur:e=>{U.onBlur(),e.target.value===``&&L(e=>({...e,yearly_price:0}))},onChange:e=>U.onChange(e.target.value),onKeyDown:()=>B(`yearly_price`)}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsxs)(ge,{children:[D.currency,`/year`]})})]}),z.yearly_price&&(0,X.jsx)(A,{children:z.yearly_price})]})]})]}),(0,X.jsxs)(`div`,{className:`basis-1/2`,children:[(0,X.jsx)(`div`,{className:`mb-1 flex h-6 flex-col justify-center`,children:(0,X.jsxs)(M,{orientation:`horizontal`,children:[(0,X.jsx)(j,{htmlFor:`tier-free-trial`,children:`Add a free trial`}),(0,X.jsx)(Ce,{checked:_,id:`tier-free-trial`,onCheckedChange:Ie})]})}),(0,X.jsxs)(M,{"data-disabled":!_||void 0,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`tier-trial-days`,children:`Trial days`}),(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{disabled:!_,id:`tier-trial-days`,placeholder:`0`,value:D.trial_days,onChange:e=>L(t=>({...t,trial_days:e.target.value.replace(/[^\d]/,``)}))}),(0,X.jsx)(F,{align:`inline-end`,children:(0,X.jsx)(ge,{children:`days`})})]}),(0,X.jsx)(me,{children:(0,X.jsxs)(`span`,{className:`mt-1`,children:[`Members will be subscribed at full price once the trial ends.`,` `,(0,X.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/free-trials/`,rel:`noreferrer`,target:`_blank`,children:`Learn more`})]})})]})]})]})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{htmlFor:`tier-welcome-page`,children:`Welcome page`}),(0,X.jsx)(N,{id:`tier-welcome-page`,maxLength:2e3,placeholder:oe?.url,value:W.displayValue,onBlur:W.commitValue,onChange:e=>W.setDisplayValue(e.target.value),onFocus:W.handleFocus,onKeyDown:W.handleKeyDown}),(0,X.jsxs)(me,{children:[`Redirect to this URL after signup`,r?``:` for premium membership`]})]})]})]}),(0,X.jsxs)(pe,{children:[(0,X.jsx)(he,{children:`Benefits`}),(0,X.jsxs)(k,{className:ee(`gap-0 rounded-sm border border-border-default p-4 md:p-7`,!i&&!a&&`mb-10`),children:[(0,X.jsx)(be,{getDragHandleLabel:({item:e})=>`Reorder benefit${e?`: ${e}`:``}`,items:G.items,itemSeparator:!1,renderItem:({id:e,item:t})=>(0,X.jsxs)(S,{align:`center`,className:`relative w-full`,gap:`lg`,children:[(0,X.jsx)(S,{align:`center`,className:`absolute top-1/2 left-[-32px] size-6 -translate-y-1/2 bg-background group-hover:hidden`,justify:`center`,children:(0,X.jsx)(C,{className:`size-4`})}),Fe({"aria-label":`Benefit`,className:`grow`,maxLength:191,value:t,onChange:t=>G.updateItem(e,t.target.value)},{"aria-label":`Delete benefit`,className:n?`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`:`absolute top-1/2 right-1 z-10 size-5! -translate-y-1/2 p-0! opacity-0 group-hover:opacity-100`,size:`icon`,type:`button`,variant:`secondary`,onClick:()=>G.removeItem(e),children:(0,X.jsx)(re,{})})]}),onMove:G.moveItem}),(0,X.jsxs)(S,{align:`center`,className:`relative mt-1`,gap:`md`,children:[(0,X.jsx)(C,{className:`size-4`}),Fe({ref:Z,className:`grow`,id:`new-tier-benefit`,maxLength:191,placeholder:`Expert analysis`,value:G.newItem,onChange:e=>G.setNewItem(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Pe())}},{"aria-label":`Add benefit`,variant:`default`,className:n?void 0:`absolute top-1/2 right-1 z-10 size-[22px]! -translate-y-1/2 p-0!`,size:`icon`,type:`button`,onClick:Pe,children:(0,X.jsx)(ie,{})},e=>(0,X.jsxs)(M,{className:`w-100`,children:[(0,X.jsx)(j,{className:`sr-only`,htmlFor:`new-tier-benefit`,children:`New benefit`}),e]}))]})]})]}),(i||a)&&(0,X.jsx)($e,{ref:q,config:t.config,failed:a,onDirtyChange:Me},e?.id??`new`)]}),(0,X.jsx)(`div`,{className:`sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block`,children:(0,X.jsx)(it,{isFreeTier:r,tier:D})})]})})},ut=()=>{let{tierId:e}=y(),{data:{tiers:t,isEnd:n}={},fetchNextPage:r}=B(),i;(0,Y.useEffect)(()=>{e&&!i&&!n&&r()},[r,n,e,i]),e&&(i=t?.find(({id:t})=>t===e));let a=et(i,{creating:!e});return e&&!i||!a.isReady?null:(0,X.jsx)(lt,{checkout:a,tier:i})};export{et as i,st as n,tt as r,ct as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`57a985e3-cfb6-47e9-90e1-20520963f810`,e._sentryDebugIdIdentifier=`sentry-dbid-57a985e3-cfb6-47e9-90e1-20520963f810`)}catch{}})();import{n as e,t}from"./hooks-C-BDQ6Hs.js";import{r as n}from"./update-queries-sbOKc6_E.js";var r=`TiersResponseType`,i=t({dataType:r,path:`/tiers/`,defaultNextPageParams:(e,t)=>{let n=e.meta?.pagination.next;if(n)return{...t,page:n.toString()}},returnData:e=>{let{pages:t}=e,n=t.flatMap(e=>e.tiers),r=t[t.length-1].meta;return{tiers:n,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),a=e({method:`POST`,path:()=>`/tiers/`,body:e=>({tiers:[e]}),invalidateQueries:{dataType:r}}),o=e({method:`PUT`,path:e=>`/tiers/${e.id}/`,body:e=>({tiers:[e]}),updateQueries:{dataType:r,emberUpdateType:`createOrUpdate`,update:n(`tiers`)}});function s(e){return e.filter(e=>e.type===`paid`&&e.active)}function c(e){return e.filter(e=>e.active)}function l(e){return e.filter(e=>!e.active)}export{i as a,a as i,l as n,o,s as r,c as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`57a985e3-cfb6-47e9-90e1-20520963f810`,e._sentryDebugIdIdentifier=`sentry-dbid-57a985e3-cfb6-47e9-90e1-20520963f810`)}catch{}})();import{n as e,t}from"./hooks-0r7qxGEo.js";import{r as n}from"./update-queries-sbOKc6_E.js";var r=`TiersResponseType`,i=t({dataType:r,path:`/tiers/`,defaultNextPageParams:(e,t)=>{let n=e.meta?.pagination.next;if(n)return{...t,page:n.toString()}},returnData:e=>{let{pages:t}=e,n=t.flatMap(e=>e.tiers),r=t[t.length-1].meta;return{tiers:n,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),a=e({method:`POST`,path:()=>`/tiers/`,body:e=>({tiers:[e]}),invalidateQueries:{dataType:r}}),o=e({method:`PUT`,path:e=>`/tiers/${e.id}/`,body:e=>({tiers:[e]}),updateQueries:{dataType:r,emberUpdateType:`createOrUpdate`,update:n(`tiers`)}});function s(e){return e.filter(e=>e.type===`paid`&&e.active)}function c(e){return e.filter(e=>e.active)}function l(e){return e.filter(e=>!e.active)}export{i as a,a as i,l as n,o,s as r,c as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`52fbc7bd-8161-4196-8c6d-9cd90ba7633e`,e._sentryDebugIdIdentifier=`sentry-dbid-52fbc7bd-8161-4196-8c6d-9cd90ba7633e`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{L as r,N as i,O as a,j as o,r as s,u as c,w as l}from"./shade-provider-DvrXKKQZ.js";import{t as u}from"./dist-xChRm5l0.js";import{It as d,Lt as f,Rt as p}from"./index-CuDhPtkB.js";var m=e(t(),1),h=n(),g=`Toggle`,_=m.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[s,u]=c({prop:n,onChange:i,defaultProp:r??!1,caller:g});return(0,h.jsx)(l.button,{type:`button`,"aria-pressed":s,"data-state":s?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:o(e.onClick,()=>{e.disabled||u(!s)})})});_.displayName=g;var v=_,y=`ToggleGroup`,[b,x]=a(y,[p]),S=p(),C=m.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(E,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(D,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${y}\``)});C.displayName=y;var[w,T]=b(y),E=m.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??``,onChange:i,caller:y});return(0,h.jsx)(w,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(A,{...a,ref:t})})}),D=m.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??[],onChange:i,caller:y}),l=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),u=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(w,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:l,onItemDeactivate:u,children:(0,h.jsx)(A,{...a,ref:t})})});C.displayName=y;var[O,k]=b(y),A=m.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,d=S(n),p=u(o),m={dir:p,...c};return(0,h.jsx)(O,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(f,{asChild:!0,...d,orientation:a,dir:p,loop:s,children:(0,h.jsx)(l.div,{...m,ref:t})}):(0,h.jsx)(l.div,{...m,ref:t})})}),j=`ToggleGroupItem`,M=m.forwardRef((e,t)=>{let n=T(j,e.__scopeToggleGroup),r=k(j,e.__scopeToggleGroup),i=S(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(d,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(N,{...s,ref:t})}):(0,h.jsx)(N,{...s,ref:t})});M.displayName=j;var N=m.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=T(j,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,h.jsx)(_,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),P=i(`inline-flex items-center justify-center gap-2 text-control font-medium text-text-secondary transition-colors hover:bg-surface-elevated hover:text-foreground focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm dark:data-[state=on]:bg-tab-active [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]`,{variants:{variant:{default:`bg-transparent`},size:{default:`h-[calc(var(--control-height)-2px)] min-w-[26px] px-2`,button:`h-[calc(var(--control-height)-2px)] min-w-[32px] px-3`},isAdmin7:{true:``,false:``},shape:{rounded:`rounded-control`,pill:`rounded-full`}},compoundVariants:[{isAdmin7:!0,size:[`default`,`button`],className:`h-[calc(var(--control-height)-4px)] data-[state=off]:hover:bg-transparent`}],defaultVariants:{variant:`default`,size:`default`,shape:`pill`,isAdmin7:!0}}),F=m.forwardRef(({className:e,variant:t,size:n,shape:i,...a},o)=>{let{controlShape:c,isAdmin7:l}=s(),u=i??c;return(0,h.jsx)(v,{ref:o,className:r(P({variant:t,size:n,isAdmin7:l,shape:u,className:e})),"data-control-shape":u,...a})});F.displayName=v.displayName;var I=m.createContext({size:`default`,variant:`default`}),L=m.forwardRef(({className:e,variant:t,size:n,shape:i,children:a,...o},c)=>{let{controlShape:l,isAdmin7:u}=s(),d=i??l;return(0,h.jsx)(C,{ref:c,className:r(`inline-flex items-center justify-center gap-0.5 bg-muted p-0.5 dark:border dark:border-border dark:bg-background`,d===`pill`?`rounded-full`:`rounded-(--input-group-radius)`,e),"data-control-shape":d,...o,children:(0,h.jsx)(I.Provider,{value:{variant:t,size:n,isAdmin7:u,shape:d},children:a})})});L.displayName=C.displayName;var R=m.forwardRef(({className:e,children:t,variant:n,size:i,shape:a,...o},s)=>{let c=m.useContext(I),l=a??c.shape;return(0,h.jsx)(M,{ref:s,className:r(P({variant:c.variant||n,isAdmin7:c.isAdmin7,size:c.size||i,shape:l}),e),"data-control-shape":l,...o,children:t})});R.displayName=M.displayName;export{R as n,L as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`52fbc7bd-8161-4196-8c6d-9cd90ba7633e`,e._sentryDebugIdIdentifier=`sentry-dbid-52fbc7bd-8161-4196-8c6d-9cd90ba7633e`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{L as r,N as i,O as a,j as o,r as s,u as c,w as l}from"./shade-provider-DvrXKKQZ.js";import{t as u}from"./dist-xChRm5l0.js";import{It as d,Lt as f,Rt as p}from"./index-RuRs_qGS.js";var m=e(t(),1),h=n(),g=`Toggle`,_=m.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[s,u]=c({prop:n,onChange:i,defaultProp:r??!1,caller:g});return(0,h.jsx)(l.button,{type:`button`,"aria-pressed":s,"data-state":s?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:o(e.onClick,()=>{e.disabled||u(!s)})})});_.displayName=g;var v=_,y=`ToggleGroup`,[b,x]=a(y,[p]),S=p(),C=m.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(E,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(D,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${y}\``)});C.displayName=y;var[w,T]=b(y),E=m.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??``,onChange:i,caller:y});return(0,h.jsx)(w,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(A,{...a,ref:t})})}),D=m.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=c({prop:n,defaultProp:r??[],onChange:i,caller:y}),l=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),u=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(w,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:l,onItemDeactivate:u,children:(0,h.jsx)(A,{...a,ref:t})})});C.displayName=y;var[O,k]=b(y),A=m.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,d=S(n),p=u(o),m={dir:p,...c};return(0,h.jsx)(O,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(f,{asChild:!0,...d,orientation:a,dir:p,loop:s,children:(0,h.jsx)(l.div,{...m,ref:t})}):(0,h.jsx)(l.div,{...m,ref:t})})}),j=`ToggleGroupItem`,M=m.forwardRef((e,t)=>{let n=T(j,e.__scopeToggleGroup),r=k(j,e.__scopeToggleGroup),i=S(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(d,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(N,{...s,ref:t})}):(0,h.jsx)(N,{...s,ref:t})});M.displayName=j;var N=m.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=T(j,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,h.jsx)(_,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),P=i(`inline-flex items-center justify-center gap-2 text-control font-medium text-text-secondary transition-colors hover:bg-surface-elevated hover:text-foreground focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm dark:data-[state=on]:bg-tab-active [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]`,{variants:{variant:{default:`bg-transparent`},size:{default:`h-[calc(var(--control-height)-2px)] min-w-[26px] px-2`,button:`h-[calc(var(--control-height)-2px)] min-w-[32px] px-3`},isAdmin7:{true:``,false:``},shape:{rounded:`rounded-control`,pill:`rounded-full`}},compoundVariants:[{isAdmin7:!0,size:[`default`,`button`],className:`h-[calc(var(--control-height)-4px)] data-[state=off]:hover:bg-transparent`}],defaultVariants:{variant:`default`,size:`default`,shape:`pill`,isAdmin7:!0}}),F=m.forwardRef(({className:e,variant:t,size:n,shape:i,...a},o)=>{let{controlShape:c,isAdmin7:l}=s(),u=i??c;return(0,h.jsx)(v,{ref:o,className:r(P({variant:t,size:n,isAdmin7:l,shape:u,className:e})),"data-control-shape":u,...a})});F.displayName=v.displayName;var I=m.createContext({size:`default`,variant:`default`}),L=m.forwardRef(({className:e,variant:t,size:n,shape:i,children:a,...o},c)=>{let{controlShape:l,isAdmin7:u}=s(),d=i??l;return(0,h.jsx)(C,{ref:c,className:r(`inline-flex items-center justify-center gap-0.5 bg-muted p-0.5 dark:border dark:border-border dark:bg-background`,d===`pill`?`rounded-full`:`rounded-(--input-group-radius)`,e),"data-control-shape":d,...o,children:(0,h.jsx)(I.Provider,{value:{variant:t,size:n,isAdmin7:u,shape:d},children:a})})});L.displayName=C.displayName;var R=m.forwardRef(({className:e,children:t,variant:n,size:i,shape:a,...o},s)=>{let c=m.useContext(I),l=a??c.shape;return(0,h.jsx)(M,{ref:s,className:r(P({variant:c.variant||n,isAdmin7:c.isAdmin7,size:c.size||i,shape:l}),e),"data-control-shape":l,...o,children:t})});R.displayName=M.displayName;export{R as n,L as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c13ef2f6-cb4d-4fe7-95cf-49201e6737bd`,e._sentryDebugIdIdentifier=`sentry-dbid-c13ef2f6-cb4d-4fe7-95cf-49201e6737bd`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{t as r}from"./button-CTHYSI-d.js";import{F as i}from"./use-activity-pub-queries-Gy9_locM.js";var a=e(t(),1),o=n(),s=({currentTopic:e,onTopicChange:t,excludeTopics:n=[]})=>{let{topicsQuery:s}=i(),{data:c}=s,l=[{slug:`following`,name:`Following`},...c?.topics||[]].filter(({slug:e})=>!n.includes(e)),u=(0,a.useRef)(null),d=(0,a.useRef)(null),[f,p]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{u.current&&u.current.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[e]),(0,o.jsxs)(`div`,{className:`relative w-full`,children:[(0,o.jsx)(`div`,{ref:d,className:`flex w-full max-w-full min-w-0 snap-x snap-mandatory gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,onScroll:e=>{let{scrollLeft:t,scrollWidth:n,clientWidth:r}=e.currentTarget;p(t+r<n-1)},children:l.map(({slug:n,name:i})=>(0,o.jsx)(r,{ref:e===n?u:null,className:`h-8 snap-start rounded-full px-3.5 text-sm`,variant:e===n?`default`:`secondary`,onClick:()=>t(n),children:i},n))}),f&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute top-0 right-0 h-full w-12 bg-gradient-to-l from-white to-transparent dark:from-black`})]})};export{s as t};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c13ef2f6-cb4d-4fe7-95cf-49201e6737bd`,e._sentryDebugIdIdentifier=`sentry-dbid-c13ef2f6-cb4d-4fe7-95cf-49201e6737bd`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{t as r}from"./button-CTHYSI-d.js";import{F as i}from"./use-activity-pub-queries-BgR1USeY.js";var a=e(t(),1),o=n(),s=({currentTopic:e,onTopicChange:t,excludeTopics:n=[]})=>{let{topicsQuery:s}=i(),{data:c}=s,l=[{slug:`following`,name:`Following`},...c?.topics||[]].filter(({slug:e})=>!n.includes(e)),u=(0,a.useRef)(null),d=(0,a.useRef)(null),[f,p]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{u.current&&u.current.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[e]),(0,o.jsxs)(`div`,{className:`relative w-full`,children:[(0,o.jsx)(`div`,{ref:d,className:`flex w-full max-w-full min-w-0 snap-x snap-mandatory gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,onScroll:e=>{let{scrollLeft:t,scrollWidth:n,clientWidth:r}=e.currentTarget;p(t+r<n-1)},children:l.map(({slug:n,name:i})=>(0,o.jsx)(r,{ref:e===n?u:null,className:`h-8 snap-start rounded-full px-3.5 text-sm`,variant:e===n?`default`:`secondary`,onClick:()=>t(n),children:i},n))}),f&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute top-0 right-0 h-full w-12 bg-gradient-to-l from-white to-transparent dark:from-black`})]})};export{s as t};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`47f67c4b-d73e-4dfd-b593-63833e928505`,e._sentryDebugIdIdentifier=`sentry-dbid-47f67c4b-d73e-4dfd-b593-63833e928505`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,m as r}from"./hooks-C-BDQ6Hs.js";import{t as i}from"./jsx-runtime-Bm2_KH-0.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./field-DCPPrQDr.js";import{t as d}from"./switch-BppWscjz.js";import{t as f}from"./use-host-limits-CNh4AAEs.js";import{t as p}from"./settings-modal-3x4v8abr.js";import{Jt as m,Ut as h}from"./index-CuDhPtkB.js";import{t as g}from"./brand-icon-BFOhZhQt.js";import{t as _}from"./use-settings-navigation-CO2nUqDW.js";import{n as v}from"./confirmation-context-By_jX_cA.js";import{n as y}from"./global-data-context-ogIy0FUG.js";import{n as b}from"./integrations-BRo5DwA5.js";import{t as x}from"./api-keys-COZMaKEL.js";import{t as S}from"./integration-header-CrqD-b0Z.js";import{t as C}from"./api-keys-CoeerpwI.js";``+new URL(`ghost-transistor-sWk3BgP7.png`,import.meta.url).href;var w=e(t(),1),T=i();function E(){let{updateRoute:e}=_(),{settings:t}=y(),{mutateAsync:i}=m(),{data:{integrations:E}={integrations:[]}}=b(),{mutateAsync:D}=C(),O=n(),{confirm:k}=v(),[A,j]=(0,w.useState)(!1),M=f()?.customIntegrations?.disabled,[N]=h(t,[`transistor`]),[P,F]=(0,w.useState)(!!N),[I,L]=(0,w.useState)(`Save`);(0,w.useEffect)(()=>{F(N||!1)},[N]),(0,w.useEffect)(()=>{M&&e(`integrations`)},[M,e]);let R=E.find(({slug:e})=>e===`transistor`),z=R?.api_keys?.find(e=>e.type===`admin`);return(0,T.jsxs)(p,{cancelLabel:`Close`,dirty:P!==N,okLabel:I,okVariant:`default`,testId:`transistor-modal`,title:``,onClose:()=>{e(`integrations`)},onOk:async()=>{let e=[{key:`transistor`,value:P}];try{L(`Saving...`),await Promise.all([i(e),new Promise(e=>{setTimeout(e,1e3)})]),L(`Saved`)}catch(e){O(e)}finally{setTimeout(()=>L(`Save`),1e3)}},children:[(0,T.jsx)(S,{detail:`Give your members access to private podcasts`,icon:(0,T.jsx)(g,{name:`transistor`,size:56}),title:`Transistor.fm`}),(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(o,{className:`gap-0`,children:(0,T.jsxs)(a,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:[(0,T.jsxs)(u,{orientation:`horizontal`,children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(c,{htmlFor:`transistor-enabled`,children:`Enable Transistor`}),(0,T.jsxs)(l,{children:[`Connect your Ghost site with`,` `,(0,T.jsx)(`a`,{className:`text-green`,href:`https://transistor.fm`,rel:`noopener noreferrer`,target:`_blank`,children:`Transistor.fm`}),` `,`to offer members private podcasts.`]})]}),(0,T.jsx)(d,{checked:P,id:`transistor-enabled`,onCheckedChange:F})]}),P&&(0,T.jsx)(x,{keys:[{id:`admin-api-key`,label:`Admin API key`,text:z?.secret,hint:A?(0,T.jsx)(`div`,{className:`text-green`,children:`Admin API Key was successfully regenerated`}):void 0,onRegenerate:()=>{if(!R||!z)throw Error(`Transistor integration or Admin API key not found`);j(!1),k({title:`Regenerate Admin API Key`,prompt:`You will need to update the API key in your Transistor account settings after regenerating.`,okLabel:`Regenerate Admin API Key`,onOk:async e=>{try{await D({integrationId:R.id,apiKeyId:z.id}),j(!0),e?.remove()}catch(e){O(e)}}})}},{id:`api-url`,label:`API URL`,text:window.location.origin+r().subdir}]})]})}),P&&(0,T.jsx)(`div`,{className:`mt-5 flex flex-col items-center`,children:(0,T.jsxs)(`a`,{className:`flex w-100 flex-col items-stretch justify-between overflow-hidden rounded-md bg-gray-50 transition-all hover:border-gray-400 hover:bg-gray-100 md:flex-row dark:bg-gray-900 dark:hover:bg-gray-950`,href:`https://ghost.org/integrations/transistor/`,rel:`noopener noreferrer`,target:`_blank`,children:[(0,T.jsxs)(`div`,{className:`order-2 px-7 py-5 md:order-1`,children:[(0,T.jsx)(`div`,{className:`text-md font-semibold`,children:`How to use Transistor in Ghost`}),(0,T.jsx)(`div`,{className:`mt-1 text-gray-800 dark:text-gray-500`,children:`Learn more about connecting Transistor with Ghost to offer members access to private podcasts in Portal or as an embed in posts and pages with a custom Transistor card.`})]}),(0,T.jsx)(`div`,{className:`order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!`,children:(0,T.jsx)(`img`,{alt:`Bookmark Thumb`,className:`min-h-full min-w-full shrink-0`,src:``+new URL(`ghost-transistor-sWk3BgP7.png`,import.meta.url).href})})]})})]})]})}export{E as default};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`7007c692-818a-4031-bb03-0d69ebc5a01d`,e._sentryDebugIdIdentifier=`sentry-dbid-7007c692-818a-4031-bb03-0d69ebc5a01d`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,m as r}from"./hooks-0r7qxGEo.js";import{t as i}from"./jsx-runtime-Bm2_KH-0.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./field-DCPPrQDr.js";import{t as d}from"./switch-BppWscjz.js";import{t as f}from"./use-host-limits-BZx7rzRI.js";import{t as p}from"./settings-modal-3x4v8abr.js";import{Jt as m,Ut as h}from"./index-RuRs_qGS.js";import{t as g}from"./brand-icon-BFOhZhQt.js";import{t as _}from"./use-settings-navigation-CO2nUqDW.js";import{n as v}from"./confirmation-context-By_jX_cA.js";import{n as y}from"./global-data-context-ogIy0FUG.js";import{n as b}from"./integrations-Deg9-u8X.js";import{t as x}from"./api-keys-COZMaKEL.js";import{t as S}from"./integration-header-CrqD-b0Z.js";import{t as C}from"./api-keys-CqKJHuAV.js";``+new URL(`ghost-transistor-sWk3BgP7.png`,import.meta.url).href;var w=e(t(),1),T=i();function E(){let{updateRoute:e}=_(),{settings:t}=y(),{mutateAsync:i}=m(),{data:{integrations:E}={integrations:[]}}=b(),{mutateAsync:D}=C(),O=n(),{confirm:k}=v(),[A,j]=(0,w.useState)(!1),M=f()?.customIntegrations?.disabled,[N]=h(t,[`transistor`]),[P,F]=(0,w.useState)(!!N),[I,L]=(0,w.useState)(`Save`);(0,w.useEffect)(()=>{F(N||!1)},[N]),(0,w.useEffect)(()=>{M&&e(`integrations`)},[M,e]);let R=E.find(({slug:e})=>e===`transistor`),z=R?.api_keys?.find(e=>e.type===`admin`);return(0,T.jsxs)(p,{cancelLabel:`Close`,dirty:P!==N,okLabel:I,okVariant:`default`,testId:`transistor-modal`,title:``,onClose:()=>{e(`integrations`)},onOk:async()=>{let e=[{key:`transistor`,value:P}];try{L(`Saving...`),await Promise.all([i(e),new Promise(e=>{setTimeout(e,1e3)})]),L(`Saved`)}catch(e){O(e)}finally{setTimeout(()=>L(`Save`),1e3)}},children:[(0,T.jsx)(S,{detail:`Give your members access to private podcasts`,icon:(0,T.jsx)(g,{name:`transistor`,size:56}),title:`Transistor.fm`}),(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(o,{className:`gap-0`,children:(0,T.jsxs)(a,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:[(0,T.jsxs)(u,{orientation:`horizontal`,children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(c,{htmlFor:`transistor-enabled`,children:`Enable Transistor`}),(0,T.jsxs)(l,{children:[`Connect your Ghost site with`,` `,(0,T.jsx)(`a`,{className:`text-green`,href:`https://transistor.fm`,rel:`noopener noreferrer`,target:`_blank`,children:`Transistor.fm`}),` `,`to offer members private podcasts.`]})]}),(0,T.jsx)(d,{checked:P,id:`transistor-enabled`,onCheckedChange:F})]}),P&&(0,T.jsx)(x,{keys:[{id:`admin-api-key`,label:`Admin API key`,text:z?.secret,hint:A?(0,T.jsx)(`div`,{className:`text-green`,children:`Admin API Key was successfully regenerated`}):void 0,onRegenerate:()=>{if(!R||!z)throw Error(`Transistor integration or Admin API key not found`);j(!1),k({title:`Regenerate Admin API Key`,prompt:`You will need to update the API key in your Transistor account settings after regenerating.`,okLabel:`Regenerate Admin API Key`,onOk:async e=>{try{await D({integrationId:R.id,apiKeyId:z.id}),j(!0),e?.remove()}catch(e){O(e)}}})}},{id:`api-url`,label:`API URL`,text:window.location.origin+r().subdir}]})]})}),P&&(0,T.jsx)(`div`,{className:`mt-5 flex flex-col items-center`,children:(0,T.jsxs)(`a`,{className:`flex w-100 flex-col items-stretch justify-between overflow-hidden rounded-md bg-gray-50 transition-all hover:border-gray-400 hover:bg-gray-100 md:flex-row dark:bg-gray-900 dark:hover:bg-gray-950`,href:`https://ghost.org/integrations/transistor/`,rel:`noopener noreferrer`,target:`_blank`,children:[(0,T.jsxs)(`div`,{className:`order-2 px-7 py-5 md:order-1`,children:[(0,T.jsx)(`div`,{className:`text-md font-semibold`,children:`How to use Transistor in Ghost`}),(0,T.jsx)(`div`,{className:`mt-1 text-gray-800 dark:text-gray-500`,children:`Learn more about connecting Transistor with Ghost to offer members access to private podcasts in Portal or as an embed in posts and pages with a custom Transistor card.`})]}),(0,T.jsx)(`div`,{className:`order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!`,children:(0,T.jsx)(`img`,{alt:`Bookmark Thumb`,className:`min-h-full min-w-full shrink-0`,src:``+new URL(`ghost-transistor-sWk3BgP7.png`,import.meta.url).href})})]})})]})]})}export{E as default};
@@ -1 +1 @@
1
- (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`62b29c2f-270a-4477-9a89-65fb366703f8`,e._sentryDebugIdIdentifier=`sentry-dbid-62b29c2f-270a-4477-9a89-65fb366703f8`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n}from"./hooks-C-BDQ6Hs.js";import{t as r}from"./jsx-runtime-Bm2_KH-0.js";import{a as i,n as a,o,r as s,t as c}from"./field-DCPPrQDr.js";import{t as l}from"./switch-BppWscjz.js";import{t as u}from"./settings-modal-3x4v8abr.js";import{Jt as d,Ut as f}from"./index-CuDhPtkB.js";import{t as p}from"./brand-icon-BFOhZhQt.js";import{t as m}from"./use-settings-navigation-CO2nUqDW.js";import{n as h}from"./global-data-context-ogIy0FUG.js";import{t as g}from"./integration-header-CrqD-b0Z.js";var _=e(t(),1),v=r();function y(){let{updateRoute:e}=m(),{settings:t}=h(),[r]=f(t,[`unsplash`]),{mutateAsync:y}=d(),b=n(),[x,S]=(0,_.useState)(`Save`),[C,w]=(0,_.useState)(!!r);return(0,_.useEffect)(()=>{w(r||!1)},[r]),(0,v.jsxs)(u,{cancelLabel:`Close`,dirty:C!==r,okLabel:x,okVariant:`default`,testId:`unsplash-modal`,title:``,onClose:()=>{e(`integrations`)},onOk:async()=>{let e=[{key:`unsplash`,value:C}];try{S(`Saving...`),await Promise.all([y(e),new Promise(e=>{setTimeout(e,1e3)})]),S(`Saved`)}catch(e){b(e)}finally{setTimeout(()=>S(`Save`),1e3)}},children:[(0,v.jsx)(g,{detail:`Beautiful, free photos`,icon:(0,v.jsx)(p,{name:`unsplash`,size:48}),title:`Unsplash`}),(0,v.jsx)(`div`,{className:`mt-7`,children:(0,v.jsx)(i,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:(0,v.jsxs)(c,{orientation:`horizontal`,children:[(0,v.jsxs)(a,{children:[(0,v.jsx)(o,{htmlFor:`unsplash-enabled`,children:`Enable Unsplash`}),(0,v.jsxs)(s,{children:[`Enable`,` `,(0,v.jsx)(`a`,{className:`text-green`,href:`https://unsplash.com`,rel:`noopener noreferrer`,target:`_blank`,children:`Unsplash`}),` `,`image integration for your posts`]})]}),(0,v.jsx)(l,{checked:C,id:`unsplash-enabled`,onCheckedChange:w})]})})})]})}export{y as default};
1
+ (function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`6b8c1d9e-ded3-4e01-b56e-f5eb7a40d104`,e._sentryDebugIdIdentifier=`sentry-dbid-6b8c1d9e-ded3-4e01-b56e-f5eb7a40d104`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n}from"./hooks-0r7qxGEo.js";import{t as r}from"./jsx-runtime-Bm2_KH-0.js";import{a as i,n as a,o,r as s,t as c}from"./field-DCPPrQDr.js";import{t as l}from"./switch-BppWscjz.js";import{t as u}from"./settings-modal-3x4v8abr.js";import{Jt as d,Ut as f}from"./index-RuRs_qGS.js";import{t as p}from"./brand-icon-BFOhZhQt.js";import{t as m}from"./use-settings-navigation-CO2nUqDW.js";import{n as h}from"./global-data-context-ogIy0FUG.js";import{t as g}from"./integration-header-CrqD-b0Z.js";var _=e(t(),1),v=r();function y(){let{updateRoute:e}=m(),{settings:t}=h(),[r]=f(t,[`unsplash`]),{mutateAsync:y}=d(),b=n(),[x,S]=(0,_.useState)(`Save`),[C,w]=(0,_.useState)(!!r);return(0,_.useEffect)(()=>{w(r||!1)},[r]),(0,v.jsxs)(u,{cancelLabel:`Close`,dirty:C!==r,okLabel:x,okVariant:`default`,testId:`unsplash-modal`,title:``,onClose:()=>{e(`integrations`)},onOk:async()=>{let e=[{key:`unsplash`,value:C}];try{S(`Saving...`),await Promise.all([y(e),new Promise(e=>{setTimeout(e,1e3)})]),S(`Saved`)}catch(e){b(e)}finally{setTimeout(()=>S(`Save`),1e3)}},children:[(0,v.jsx)(g,{detail:`Beautiful, free photos`,icon:(0,v.jsx)(p,{name:`unsplash`,size:48}),title:`Unsplash`}),(0,v.jsx)(`div`,{className:`mt-7`,children:(0,v.jsx)(i,{className:`gap-8 rounded-sm border border-border-default p-4 md:p-7`,children:(0,v.jsxs)(c,{orientation:`horizontal`,children:[(0,v.jsxs)(a,{children:[(0,v.jsx)(o,{htmlFor:`unsplash-enabled`,children:`Enable Unsplash`}),(0,v.jsxs)(s,{children:[`Enable`,` `,(0,v.jsx)(`a`,{className:`text-green`,href:`https://unsplash.com`,rel:`noopener noreferrer`,target:`_blank`,children:`Unsplash`}),` `,`image integration for your posts`]})]}),(0,v.jsx)(l,{checked:C,id:`unsplash-enabled`,onCheckedChange:w})]})})})]})}export{y as default};