ghost 6.52.0 → 6.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-kg-card-factory-5.2.3.tgz +0 -0
- package/components/tryghost-kg-clean-basic-html-4.3.3.tgz +0 -0
- package/components/tryghost-kg-converters-1.2.3.tgz +0 -0
- package/components/tryghost-kg-default-cards-10.3.3.tgz +0 -0
- package/components/tryghost-kg-default-nodes-2.1.3.tgz +0 -0
- package/components/tryghost-kg-default-transforms-1.3.3.tgz +0 -0
- package/components/tryghost-kg-html-to-lexical-1.3.3.tgz +0 -0
- package/components/tryghost-kg-lexical-html-renderer-1.4.3.tgz +0 -0
- package/components/tryghost-kg-markdown-html-renderer-7.2.3.tgz +0 -0
- package/components/tryghost-kg-utils-1.1.3.tgz +0 -0
- package/core/built/admin/assets/Growth-CczbRexv.js +3 -0
- package/core/built/admin/assets/Newsletters-rFycX4x8.js +1 -0
- package/core/built/admin/assets/Overview-DFubBJaR.js +1 -0
- package/core/built/admin/assets/Web-BDE2lN4_.js +2 -0
- package/core/built/admin/assets/{account-migration-DiS76mRS.js → account-migration-gvH5a8ea.js} +1 -1
- package/core/built/admin/assets/audience-CMWMCxFS.js +1 -0
- package/core/built/admin/assets/{automated-emails-Cel18g7S.js → automated-emails-293Lcj5S.js} +1 -1
- package/core/built/admin/assets/automations-BxnjfCKn.js +1 -0
- package/core/built/admin/assets/automations-kPr44AmD.js +1 -0
- package/core/built/admin/assets/bluesky-sharing-Cww54F3Y.js +1 -0
- package/core/built/admin/assets/{chunk.912.9d6df5a6da679d905bbf.js → chunk.251.dd82df30188bb633b4ae.js} +9 -9
- package/core/built/admin/assets/{chunk.730.2457b7fede040aa52c88.js → chunk.341.20e7d2936dfa5877deea.js} +3 -3
- package/core/built/admin/assets/{chunk.524.d6d399b571454ea0234d.js → chunk.524.697bf0ded48e7c994fc3.js} +5 -5
- package/core/built/admin/assets/{chunk.582.50a9a5cbab6996daf0fe.js → chunk.582.6b742e9ba932688c442c.js} +6 -6
- package/core/built/admin/assets/{code-editor-view-BLGzcLub.js → code-editor-view-DSY5RHLf.js} +1 -1
- package/core/built/admin/assets/comments-BwNUmaNM.js +1 -0
- package/core/built/admin/assets/constants-c-JNF9c2.js +1 -0
- package/core/built/admin/assets/container-CD33Rm0u.js +1 -0
- package/core/built/admin/assets/content-helpers-CNBPrwsi.js +1 -0
- package/core/built/admin/assets/date-range-select-BkkNN98H.js +1 -0
- package/core/built/admin/assets/disabled-sources-indicator-ChHTF69d.js +1 -0
- package/core/built/admin/assets/{domain-2REz20SO.js → domain-CGk9SMa-.js} +1 -1
- package/core/built/admin/assets/dropzone-9zocztX0.js +5 -0
- package/core/built/admin/assets/{edit-profile-7QEh0VtN.js → edit-profile-C0B2Kbsl.js} +1 -1
- package/core/built/admin/assets/editor-Bz2Sm2O8.js +8 -0
- package/core/built/admin/assets/{esm-CEtFqV1y.js → esm-CsHLKmLh.js} +1 -1
- package/core/built/admin/assets/explore-CpRAMnx7.js +1 -0
- package/core/built/admin/assets/feed-BRoOWghO.js +1 -0
- package/core/built/admin/assets/filter-sources-DhxqZID1.js +1 -0
- package/core/built/admin/assets/{filters-DUy8rzI5.js → filters-B8nLLYGO.js} +1 -1
- package/core/built/admin/assets/{gh-chart-DdBGmBS8.js → gh-chart-Cqy9gGq7.js} +1 -1
- package/core/built/admin/assets/{gift-link-modal-CSgyxenA.js → gift-link-modal-v55u0VUL.js} +1 -1
- package/core/built/admin/assets/growth-BIfM3w1p.js +1 -0
- package/core/built/admin/assets/{inbox-CTD-ix6u.js → inbox-CDX57fXK.js} +11 -11
- package/core/built/admin/assets/index-B5yxmQNp.js +69 -0
- package/core/built/admin/assets/inline-DdrWe7D3.js +1 -0
- package/core/built/admin/assets/{input-group-DkR63-nk.js → input-group-DUPGQck1.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-D09TwwLs.js → koenig-lexical-CUVpp-dC.js} +1 -1
- package/core/built/admin/assets/{kpi-card-Fr_HJH78.js → kpi-card-DyDbok3h.js} +1 -1
- package/core/built/admin/assets/kpi-helpers-Bx9IHIMq.js +1 -0
- package/core/built/admin/assets/{kpi-tabs-Dc4Nt4a5.js → kpi-tabs-DmUcThFc.js} +1 -1
- package/core/built/admin/assets/labels-DLL8dl-7.js +1 -0
- package/core/built/admin/assets/layout-B7K3SmL0.js +1 -0
- package/core/built/admin/assets/{links-CfAB2Yeq.js → link-helpers-DHG_8GIT.js} +1 -1
- package/core/built/admin/assets/list-page-COAUFrmV.js +1 -0
- package/core/built/admin/assets/members-BxWs_mjq.js +10 -0
- package/core/built/admin/assets/{modals-Bu-1Uxdc.js → modals-DF2sECo6.js} +4 -4
- package/core/built/admin/assets/moderation-DYKTx5x0.js +1 -0
- package/core/built/admin/assets/newsletter-C-ZD1dI8.js +1 -0
- package/core/built/admin/assets/note-oaRdU_5z.js +1 -0
- package/core/built/admin/assets/notifications-BF4fAiP1.js +1 -0
- package/core/built/admin/assets/{nql-lang-CvCSOQG3.js → nql-lang-BoHzkNg5.js} +1 -1
- package/core/built/admin/assets/{onboarding-route-BDaa9hd3.js → onboarding-route-SS-e9Aeb.js} +1 -1
- package/core/built/admin/assets/overview-Cbn6bIoR.js +1 -0
- package/core/built/admin/assets/post-analytics-Bk9-KEgB.js +1 -0
- package/core/built/admin/assets/post-analytics-context-C8t_048I.js +1 -0
- package/core/built/admin/assets/post-analytics-header-xTjcg4H0.js +1 -0
- package/core/built/admin/assets/post-analytics-provider-CqnWwLMk.js +1 -0
- package/core/built/admin/assets/{post-share-modal-59Ujf4t1.js → post-share-modal-ZUCX7JZo.js} +1 -1
- package/core/built/admin/assets/preferences-BgjgxiBB.js +5 -0
- package/core/built/admin/assets/profile-qIwaxKTm.js +1 -0
- package/core/built/admin/assets/{router-provider-DcttGCQn.js → router-provider-S8Wf6jdu.js} +1 -1
- package/core/built/admin/assets/select-Cp27ScMR.js +1 -0
- package/core/built/admin/assets/{settings-dLraw6et.js → settings-CdDfyF90.js} +1 -1
- package/core/built/admin/assets/{settings-CIslWMfh.js → settings-CynBh-YN.js} +4 -4
- package/core/built/admin/assets/{share-modal-CI3E67kW.js → share-modal-DTIFYNI1.js} +1 -1
- package/core/built/admin/assets/social-urls-DVvRfwEp.js +16 -0
- package/core/built/admin/assets/{sort-button-BYwI0xdN.js → sort-button-BHh5Ba1K.js} +1 -1
- package/core/built/admin/assets/source-icon--egCE7iN.js +1 -0
- package/core/built/admin/assets/stats-DkqCtrPh.js +1 -0
- package/core/built/admin/assets/stats-view-BvWWxegf.js +1 -0
- package/core/built/admin/assets/step-1-DWjw7rIn.js +1 -0
- package/core/built/admin/assets/{step-2-CVOvLQ2n.js → step-2-D1LrETIB.js} +1 -1
- package/core/built/admin/assets/{step-3-BsVXcpWU.js → step-3-BAdJdZw4.js} +2 -2
- package/core/built/admin/assets/{tabs-Bw8aEqsd.js → tabs-DSrHPjWP.js} +1 -1
- package/core/built/admin/assets/tags-BWZqBj19.js +1 -0
- package/core/built/admin/assets/{textarea-CNaqhk5P.js → textarea-CUVQjsrM.js} +1 -1
- package/core/built/admin/assets/{toggle-group-CMp1taHd.js → toggle-group-CrFpl-Xz.js} +1 -1
- package/core/built/admin/assets/{topic-filter-D2_9eEw4.js → topic-filter-jAxwwd9I.js} +1 -1
- package/core/built/admin/assets/types-uYQ1HgqL.js +1 -0
- package/core/built/admin/assets/url-helpers-CCyfRrKj.js +1 -0
- package/core/built/admin/assets/use-analytics-data-DXG7mpgK.js +1 -0
- package/core/built/admin/assets/use-filter-params-EoQBXfP3.js +1 -0
- package/core/built/admin/assets/use-growth-stats-DJoXxVfD.js +1 -0
- package/core/built/admin/assets/use-post-referrers-B-onYbuS.js +1 -0
- package/core/built/admin/assets/use-reply-chain-data-D8IFALoz.js +1 -0
- package/core/built/admin/assets/{use-tinybird-query-CNCaUn39.js → use-tinybird-query-BSL3iVCc.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-token-1T80Odca.js → use-tinybird-token-DHgOnrNu.js} +1 -1
- package/core/built/admin/assets/virtual-list-AQrbRAXP.js +1 -0
- package/core/built/admin/assets/web-zEFi98DS.js +1 -0
- package/core/built/admin/index.html +6 -6
- package/core/server/services/automations/automations-api.js +20 -0
- package/core/server/services/automations/automations-api.ts +31 -0
- package/core/server/services/automations/poll.js +7 -7
- package/core/server/services/automations/poll.ts +12 -9
- package/core/server/services/email-analytics/email-analytics-provider-mailgun.js +2 -2
- package/core/server/services/email-analytics/email-analytics-service-wrapper.js +1 -4
- package/core/server/services/email-analytics/email-analytics-service.js +5 -7
- package/core/server/services/webhooks/serialize.js +6 -5
- package/package.json +1 -1
- package/pnpm-lock.yaml +14 -14
- package/pnpm-workspace.yaml +5 -0
- package/core/built/admin/assets/Growth-Dx0vv-BS.js +0 -3
- package/core/built/admin/assets/Newsletters-v1GnbUjW.js +0 -1
- package/core/built/admin/assets/Overview-BgM7o-Z8.js +0 -1
- package/core/built/admin/assets/Web-DRv-83Ow.js +0 -2
- package/core/built/admin/assets/automations-DFLgH14-.js +0 -1
- package/core/built/admin/assets/automations-Dc4DUKBb.js +0 -1
- package/core/built/admin/assets/bluesky-sharing-Dk1RTUaz.js +0 -1
- package/core/built/admin/assets/comments-DgH1rC7w.js +0 -1
- package/core/built/admin/assets/constants-BlvYJTqz.js +0 -1
- package/core/built/admin/assets/content-helpers-BEgGpvyE.js +0 -1
- package/core/built/admin/assets/editor-u3BPqQed.js +0 -8
- package/core/built/admin/assets/en-DA2zVD_n.js +0 -1
- package/core/built/admin/assets/explore-BgHmdFVz.js +0 -1
- package/core/built/admin/assets/feed-Cs7-F3I5.js +0 -1
- package/core/built/admin/assets/filter-query-core-D6GjHUFB.js +0 -1
- package/core/built/admin/assets/growth-IkQZ1ZV9.js +0 -1
- package/core/built/admin/assets/index-BMhs4O3N.js +0 -69
- package/core/built/admin/assets/inline-C1CpHxuO.js +0 -1
- package/core/built/admin/assets/kpis-BTZ8cyw-.js +0 -1
- package/core/built/admin/assets/labels-sA9m188H.js +0 -5
- package/core/built/admin/assets/layout-szLkuQ88.js +0 -1
- package/core/built/admin/assets/list-page-DWkOdljb.js +0 -1
- package/core/built/admin/assets/main-layout-B-K8KliJ.js +0 -1
- package/core/built/admin/assets/members-PNNhalbu.js +0 -10
- package/core/built/admin/assets/moderation-DqnsNTiw.js +0 -1
- package/core/built/admin/assets/newsletter-BhuQeWFL.js +0 -1
- package/core/built/admin/assets/note-DFy2JTpP.js +0 -1
- package/core/built/admin/assets/notifications-BVu-JOkB.js +0 -1
- package/core/built/admin/assets/overview-Bhg8M7VS.js +0 -1
- package/core/built/admin/assets/pagemenu-C4paivNj.js +0 -1
- package/core/built/admin/assets/post-analytics-BhQUmZyA.js +0 -1
- package/core/built/admin/assets/post-analytics-context-Dy17HR1_.js +0 -1
- package/core/built/admin/assets/post-analytics-header-DAQep1VQ.js +0 -1
- package/core/built/admin/assets/posts/_react-dom-Blmuc0OL.js +0 -21
- package/core/built/admin/assets/posts/alert-dialog-DBJeQQTK.js +0 -154
- package/core/built/admin/assets/posts/app-provider-BJr9fdEC.js +0 -22
- package/core/built/admin/assets/posts/app-utils-9O53Czfw.js +0 -83
- package/core/built/admin/assets/posts/automations-BM0oBTjO.js +0 -275
- package/core/built/admin/assets/posts/automations-Dbp-gdHS.js +0 -223
- package/core/built/admin/assets/posts/avatar-kOk1tTvT.js +0 -144
- package/core/built/admin/assets/posts/badge-DnByIHe9.js +0 -25
- package/core/built/admin/assets/posts/button-Dd8Xreln.js +0 -40844
- package/core/built/admin/assets/posts/chunk-KS7C4IRE-ECXkcZq6.js +0 -7740
- package/core/built/admin/assets/posts/comments-D-7hbbdw.js +0 -8032
- package/core/built/admin/assets/posts/data-list-DdD_glQ-.js +0 -14219
- package/core/built/admin/assets/posts/dialog-DDkTy_np.js +0 -229
- package/core/built/admin/assets/posts/editor-D7-01KV_.js +0 -14633
- package/core/built/admin/assets/posts/empty-indicator-Ze-bwJ27.js +0 -38
- package/core/built/admin/assets/posts/filters-CmKfKtpS.js +0 -5611
- package/core/built/admin/assets/posts/get-site-timezone-DVbWc-NA.js +0 -39
- package/core/built/admin/assets/posts/growth-DlhFUzVg.js +0 -299
- package/core/built/admin/assets/posts/heading-BBl-8tMC.js +0 -92
- package/core/built/admin/assets/posts/hooks-gZAmj4Al.js +0 -5429
- package/core/built/admin/assets/posts/input-DuPLeCGW.js +0 -16
- package/core/built/admin/assets/posts/input-surface-ClwNIxfd.js +0 -17
- package/core/built/admin/assets/posts/jsx-runtime-BfZnKD4L.js +0 -95
- package/core/built/admin/assets/posts/koenig-lexical-DCHiJJou.js +0 -77579
- package/core/built/admin/assets/posts/kpis-Fsx0XmYK.js +0 -2061
- package/core/built/admin/assets/posts/label-D1wSl69p.js +0 -32
- package/core/built/admin/assets/posts/links-DLozzgMh.js +0 -1243
- package/core/built/admin/assets/posts/loading-indicator-BgU2kK3v.js +0 -44
- package/core/built/admin/assets/posts/main-layout-DDlTMrnF.js +0 -15
- package/core/built/admin/assets/posts/newsletter-DAQJ1GLe.js +0 -736
- package/core/built/admin/assets/posts/overview-G3MfRm-S.js +0 -426
- package/core/built/admin/assets/posts/page-header-CanFyB95.js +0 -284
- package/core/built/admin/assets/posts/popover-Cta8ZDHJ.js +0 -221
- package/core/built/admin/assets/posts/post-analytics-cS07-wo_.js +0 -121
- package/core/built/admin/assets/posts/post-analytics-context-D868SMoq.js +0 -150
- package/core/built/admin/assets/posts/post-analytics-header-CZYiuaEL.js +0 -42249
- package/core/built/admin/assets/posts/post-share-modal-BJfswZzf.js +0 -352
- package/core/built/admin/assets/posts/posts-CpusjBC0.js +0 -37
- package/core/built/admin/assets/posts/posts-app-context-CPC7dOlt.js +0 -26
- package/core/built/admin/assets/posts/posts.js +0 -145
- package/core/built/admin/assets/posts/router-provider-DrqpOc8m.js +0 -114
- package/core/built/admin/assets/posts/separator-DAZNzARU.js +0 -37
- package/core/built/admin/assets/posts/settings-CMfUn5Hq.js +0 -66
- package/core/built/admin/assets/posts/shade-app-DLbeExcd-NeEZjE3R.js +0 -4764
- package/core/built/admin/assets/posts/sheet-CEuv-0a5.js +0 -62
- package/core/built/admin/assets/posts/site-WJ6ldary.js +0 -10
- package/core/built/admin/assets/posts/skeleton-CO0qCdQF.js +0 -2426
- package/core/built/admin/assets/posts/source-icon-Bs6o84W3.js +0 -143
- package/core/built/admin/assets/posts/stats-B1Z8H0JT.js +0 -92
- package/core/built/admin/assets/posts/table-CbJ9bOpM.js +0 -77
- package/core/built/admin/assets/posts/tabs-BvzzwQ4P.js +0 -242
- package/core/built/admin/assets/posts/tags-D-4TwsD0.js +0 -462
- package/core/built/admin/assets/posts/tooltip-BI7VtFUY.js +0 -380
- package/core/built/admin/assets/posts/update-queries-DiUznIQ1.js +0 -60
- package/core/built/admin/assets/posts/users-UgRPrTKW.js +0 -83
- package/core/built/admin/assets/posts/value-DF_wOhJe.js +0 -415
- package/core/built/admin/assets/posts/virtual-list-window-DP63Onpm.js +0 -853
- package/core/built/admin/assets/posts/web-axp2l3kK.js +0 -8077
- package/core/built/admin/assets/preferences-ChOzBKcF.js +0 -5
- package/core/built/admin/assets/profile-DlcrYKay.js +0 -1
- package/core/built/admin/assets/select-BbtNHCBq.js +0 -1
- package/core/built/admin/assets/social-urls-DVzIHh2W.js +0 -16
- package/core/built/admin/assets/source-icon-Uuhttjun.js +0 -1
- package/core/built/admin/assets/source-utils-BchD0sF0.js +0 -1
- package/core/built/admin/assets/stats-CrlPzgdd.js +0 -1
- package/core/built/admin/assets/stats-view-UNMhTMCZ.js +0 -1
- package/core/built/admin/assets/step-1-C2HY6pyi.js +0 -1
- package/core/built/admin/assets/tags-DjCsJo0X.js +0 -1
- package/core/built/admin/assets/typeof-Ca-duI-z.js +0 -1
- package/core/built/admin/assets/url-helpers-DxA844rA.js +0 -1
- package/core/built/admin/assets/use-growth-stats-DNIGdI8h.js +0 -1
- package/core/built/admin/assets/use-reply-chain-data-DtEC2Azp.js +0 -1
- package/core/built/admin/assets/virtual-list-window-BTXGwpf5.js +0 -1
- package/core/built/admin/assets/web-Cj8VEw3s.js +0 -1
- /package/core/built/admin/assets/{chunk.912.9d6df5a6da679d905bbf.js.LICENSE.txt → chunk.251.dd82df30188bb633b4ae.js.LICENSE.txt} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-editor-view-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./react-dom-C6aoWSfl.js";import{n as r,s as i}from"./framework-provider-i7X1c1ST.js";import{S as a,a as o,d as s,f as c,g as l,h as u,l as d,n as f,p,r as m,u as h,y as g}from"./hooks-tBACnBdQ.js";import{t as _}from"./jsx-runtime-CtMZ-PAS.js";import{a as v}from"./dist-B7kX8alP.js";import{t as y}from"./dist-B_Ahe-Z8.js";import{c as b,d as x,f as S,h as C,l as w,o as ee,p as T,s as te,u as E}from"./esm-CEtFqV1y.js";import{t as D}from"./clsx-CjueKrWZ.js";import{$ as O,$t as k,A as ne,At as re,Bt as ie,C as ae,Ct as oe,D as se,Dt as ce,Et as A,F as le,Ft as ue,Ht as de,I as fe,It as pe,Jt as j,Kt as me,L as he,M as ge,Mt as M,N as _e,O as ve,Ot as ye,P as be,Qt as xe,R as Se,S as N,St as Ce,Tt as we,U as Te,V as Ee,Vt as De,W as Oe,Wt as ke,Yt as Ae,Zt as je,_ as Me,_t as Ne,an as Pe,at as Fe,b as Ie,bt as Le,c as Re,ct as ze,d as Be,dn as Ve,dt as He,en as Ue,ft as P,g as We,gt as Ge,h as Ke,ht as F,i as qe,j as Je,jt as Ye,l as Xe,ln as Ze,lt as I,m as Qe,mt as $e,n as et,nn as tt,o as nt,on as rt,ot as it,p as at,q as ot,qt as st,r as ct,sn as lt,st as ut,t as dt,tn as ft,tt as pt,u as mt,un as L,ut as ht,v as gt,vt as _t,wt as vt,x as yt,xt as bt,y as xt,yt as St,z as Ct,zt as wt}from"./social-urls-DVzIHh2W.js";import{d as Tt,p as Et}from"./Combination-BPFTKsTn.js";import{r as Dt}from"./dist-CsekE4FL.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-Bw8aEqsd.js";import{o as Mt}from"./dist-CaHNiF20.js";import{t as Nt}from"./dist-JLOy8o0Q.js";import{t as Pt}from"./preload-helper-DYl5dUZ5.js";import{n as Ft}from"./dist-duxRDcQu.js";import{t as It}from"./switch-Dy6asCQw.js";import{a as Lt,c as Rt,d as zt,f as Bt,g as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./automated-emails-Cel18g7S.js";import{n as $t}from"./offers-BYodCS47.js";import{$ as en,Gn as tn,It as nn,J as rn,Kn as R,Ot as an,Xn as on,_ as sn,jn as cn,t as ln,v as un}from"./button-DiwO9Rof.js";import{c as dn,i as fn,n as pn,o as mn,s as hn,t as gn}from"./select-BbtNHCBq.js";import{s as _n}from"./labels-sA9m188H.js";import{t as vn}from"./textarea-CNaqhk5P.js";import{n as yn,t as bn}from"./toggle-group-CMp1taHd.js";import{l as xn,o as Sn,t as Cn,u as wn}from"./users-Y8qhvF1q.js";import{$n as Tn,Bn as En,Gn as Dn,Gt as On,Hn as kn,Jn as An,Kn as jn,Mi as Mn,Mn as Nn,Ni as Pn,Nn as Fn,Pn as In,Un as Ln,Vn as Rn,Wn as zn,Zn as Bn,_n as Vn,_r as Hn,di as Un,dn as Wn,ei as Gn,er as Kn,fi as qn,fn as z,hr as Jn,kn as Yn,li as Xn,mn as Zn,ui as Qn,un as $n,vn as er,xr as tr,y as nr,zn as rr}from"./index-BMhs4O3N.js";import{a as ir,i as ar,r as or,t as sr}from"./newsletters-BEvO0JE3.js";import{a as cr,n as lr,r as ur,t as dr}from"./tiers-74aPYtWv.js";import{t as fr}from"./referrers-B0RVWBfE.js";import{i as pr}from"./gift-links-bR_JDdWo.js";var B=e(t(),1),V=_(),mr=B.lazy(()=>Pt(()=>import(`./code-editor-view-BLGzcLub.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url)),hr=(0,B.forwardRef)(function(e,t){return(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(mr,{...e,ref:t})})}),gr=({selectedValue:e=``,onSelect:t,options:n=[],otherOption:r={value:`other`,label:`Other...`},otherPlaceholder:i=`Enter custom value`,otherHint:a,backToListLabel:o=`Choose from list`,defaultListValue:s,validate:c,allowEmpty:l=!1,error:u,hint:d,title:f,testId:p,...m})=>{let{...h}=m,g=B.useMemo(()=>e&&!n.some(t=>t.value===e)&&e!==r.value,[e,n,r.value]),[_,v]=(0,B.useState)(!!g),[y,b]=(0,B.useState)(null),x=e=>{e&&(e.value===r.value?(v(!0),t(``)):(v(!1),t(e.value)))},S=e=>{let n=e.target.value,r=null;c&&(r=c(n)),!r&&!n&&!l&&(r=`Enter a value`),b(r),t(n)},C=()=>{v(!1),b(null),s&&n.find(e=>e.value===s)?t(s):n.length>0&&t(n[0].value)},w=B.useMemo(()=>n.some(e=>e.value===r.value)?n:[...n,r],[n,r]),ee=_||g,T=u||!!y,te=y||(typeof d==`string`?d:``);if(ee)return(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(k,{"data-testid":p,error:T,hideTitle:!f,hint:T?te:a&&typeof a==`string`?a:``,placeholder:i,title:f,value:e,onChange:S}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(`button`,{className:`text-sm text-green-400 hover:text-green-500`,type:`button`,onClick:C,children:o})})]});let E=n.find(t=>t.value===e);return(0,V.jsx)(De,{...h,async:!1,error:u,hint:d,options:w,selectedOption:E,testId:p,title:f,onSelect:x})},_r=({icon:e,iconColorClass:t,children:n})=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(l,{colorClass:t,name:e,size:`sm`}),n]}),vr=({href:e,color:t,className:n,children:r,...i})=>{t||=`green`;let a=t===`black`?`transition text-black hover:text-black-700`:`text-${t} hover:text-${t}-400`;return n&&(a=`${a} ${n}`),(0,V.jsx)(`a`,{className:a,href:e,...i,children:r})},yr=(0,B.forwardRef)(function({title:e,navid:t=``,icon:n,isCurrent:r=!1,isVisible:i=!0,onClick:a=()=>{},...o},s){let c=D(`mt-px flex h-[32px] w-100 cursor-pointer items-center rounded-md px-3 py-2 text-left font-medium transition-all hover:bg-grey-200 focus:bg-grey-100 dark:text-grey-600 dark:hover:bg-grey-950 dark:focus:bg-grey-900`,r?`bg-grey-200 text-black dark:bg-grey-950 dark:text-white`:`text-grey-800`,!i&&`hidden`);return(0,V.jsx)(`li`,{ref:s,...o,children:(0,V.jsxs)(`a`,{className:c,id:t,onClick:a,children:[n&&(0,V.jsx)(l,{className:`mr-[7px] size-[16px]`,name:n,size:`custom`}),e]})})}),br=({title:e,sticky:t=!1})=>(0,V.jsx)(`h2`,{className:D(`z-20 mb-px pb-10 text-2xl font-semibold tracking-tight`,t?`sticky top-0 mt-[calc(-8vmin-4px)] bg-gradient-to-t from-transparent via-white via-20% to-white pt-[calc(8vmin-4px)] dark:bg-black`:`mt-[-5px]`),children:e}),xr=({title:e,isVisible:t=!0,children:n})=>(0,V.jsxs)(`div`,{className:D(`mb-[10vh]`,t?``:`hidden`),children:[e&&(0,V.jsx)(br,{title:e}),n&&(0,V.jsx)(`div`,{className:`mb-10 flex flex-col gap-12`,children:n})]}),Sr=({darkMode:e,fetchKoenigLexical:t,className:n,children:r,...i})=>(0,V.jsx)(`div`,{className:D(`admin-x-base`,n),...i,children:(0,V.jsx)(ee,{darkMode:e,fetchKoenigLexical:t,children:r})}),Cr=e=>(0,V.jsx)(`svg`,{fill:`none`,height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,V.jsx)(`path`,{clipRule:`evenodd`,d:`M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z`,fill:`currentColor`,fillRule:`evenodd`})}),wr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in wr)Object.freeze(wr[e]);var Tr=Object.freeze(wr),Er=Object.create(null);for(let e in Tr)Object.hasOwn(Tr,e)&&(Er[Tr[e]]=e);var H={to:{},get:{}};H.get=function(e){let t=e.slice(0,3).toLowerCase(),n,r;switch(t){case`hsl`:n=H.get.hsl(e),r=`hsl`;break;case`hwb`:n=H.get.hwb(e),r=`hwb`;break;default:n=H.get.rgb(e),r=`rgb`;break}return n?{model:r,value:n}:null},H.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,a=/^(\w+)$/,o=[0,0,0,1],s,c,l;if(s=e.match(n)){for(l=s[2],s=s[1],c=0;c<3;c++){let e=c*2;o[c]=Number.parseInt(s.slice(e,e+2),16)}l&&(o[3]=Number.parseInt(l,16)/255)}else if(s=e.match(t)){for(s=s[1],l=s[3],c=0;c<3;c++)o[c]=Number.parseInt(s[c]+s[c],16);l&&(o[3]=Number.parseInt(l+l,16)/255)}else if(s=e.match(r)){for(c=0;c<3;c++)o[c]=Number.parseFloat(s[c+1]);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(s[c+1])*2.55);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.toLowerCase().match(a))return s[1]===`transparent`?[0,0,0,0]:Object.hasOwn(Tr,s[1])?(o=Tr[s[1]].slice(),o[3]=1,o):null;else return null;for(c=0;c<3;c++)o[c]=Dr(o[c],0,255);return o[3]=Dr(o[3],0,1),o},H.get.hsl=function(e){if(!e)return null;let t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,Dr(Number.parseFloat(t[2]),0,100),Dr(Number.parseFloat(t[3]),0,100),Dr(Number.isNaN(e)?1:e,0,1)]}return null},H.get.hwb=function(e){if(!e)return null;let t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,Dr(Number.parseFloat(t[2]),0,100),Dr(Number.parseFloat(t[3]),0,100),Dr(Number.isNaN(e)?1:e,0,1)]}return null},H.to.hex=function(...e){return`#`+Or(e[0])+Or(e[1])+Or(e[2])+(e[3]<1?Or(Math.round(e[3]*255)):``)},H.to.rgb=function(...e){return e.length<4||e[3]===1?`rgb(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`)`:`rgba(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`, `+e[3]+`)`},H.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?`rgb(`+t+`%, `+n+`%, `+r+`%)`:`rgba(`+t+`%, `+n+`%, `+r+`%, `+e[3]+`)`},H.to.hsl=function(...e){return e.length<4||e[3]===1?`hsl(`+e[0]+`, `+e[1]+`%, `+e[2]+`%)`:`hsla(`+e[0]+`, `+e[1]+`%, `+e[2]+`%, `+e[3]+`)`},H.to.hwb=function(...e){let t=``;return e.length>=4&&e[3]!==1&&(t=`, `+e[3]),`hwb(`+e[0]+`, `+e[1]+`%, `+e[2]+`%`+t+`)`},H.to.keyword=function(...e){return Er[e.slice(0,3)]};function Dr(e,t,n){return Math.min(Math.max(t,e),n)}function Or(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?`0`+t:t}var kr={};for(let e of Object.keys(Tr))kr[Tr[e]]=e;var U={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},oklab:{channels:3,labels:[`okl`,`oka`,`okb`]},lch:{channels:3,labels:`lch`},oklch:{channels:3,labels:[`okl`,`okc`,`okh`]},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},Ar=(6/29)**3;function jr(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Mr(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(U)){if(!(`channels`in U[e]))throw Error(`missing channels property: `+e);if(!(`labels`in U[e]))throw Error(`missing channel labels property: `+e);if(U[e].labels.length!==U[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=U[e];delete U[e].channels,delete U[e].labels,Object.defineProperty(U[e],"channels",{value:t}),Object.defineProperty(U[e],"labels",{value:n})}U.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},U.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},U.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=U.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},U.rgb.oklab=function(e){let t=Mr(e[0]/255),n=Mr(e[1]/255),r=Mr(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},U.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function Nr(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}U.rgb.keyword=function(e){let t=kr[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(Tr)){let i=Tr[t],a=Nr(e,i);a<n&&(n=a,r=t)}return r},U.keyword.rgb=function(e){return[...Tr[e]]},U.rgb.xyz=function(e){let t=Mr(e[0]/255),n=Mr(e[1]/255),r=Mr(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},U.rgb.lab=function(e){let t=U.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>Ar?n**(1/3):7.787*n+16/116,r=r>Ar?r**(1/3):7.787*r+16/116,i=i>Ar?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},U.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},U.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},U.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},U.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},U.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},U.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},U.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=jr(i),a=jr(a),o=jr(o),[i*255,a*255,o*255]},U.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>Ar?t**(1/3):7.787*t+16/116,n=n>Ar?n**(1/3):7.787*n+16/116,r=r>Ar?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},U.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},U.oklab.oklch=function(e){return U.lab.lch(e)},U.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},U.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=jr(4.0767416621*i-3.3077115913*a+.2309699292*o),c=jr(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=jr(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},U.oklch.oklab=function(e){return U.lch.lab(e)},U.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>Ar?s:(a-16/116)/7.787,i=c>Ar?c:(i-16/116)/7.787,o=l>Ar?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},U.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},U.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},U.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?U.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},U.hsv.ansi16=function(e){return U.rgb.ansi16(U.hsv.rgb(e),e[2])},U.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},U.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},U.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},U.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},U.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},U.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},U.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},U.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},U.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},U.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},U.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},U.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},U.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},U.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},U.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},U.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},U.gray.hsl=function(e){return[0,0,e[0]]},U.gray.hsv=U.gray.hsl,U.gray.hwb=function(e){return[0,100,e[0]]},U.gray.cmyk=function(e){return[0,0,0,e[0]]},U.gray.lab=function(e){return[e[0],0,0]},U.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},U.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Pr(){let e={},t=Object.keys(U);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function Fr(e){let t=Pr(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(U[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function Ir(e,t){return function(n){return t(e(n))}}function Lr(e,t){let n=[t[e].parent,e],r=U[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=Ir(U[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function Rr(e){let t=Fr(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=Lr(e,t))}return n}var W={},zr=Object.keys(U);function Br(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function Vr(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of zr){W[e]={},Object.defineProperty(W[e],"channels",{value:U[e].channels}),Object.defineProperty(W[e],"labels",{value:U[e].labels});let t=Rr(e),n=Object.keys(t);for(let r of n){let n=t[r];W[e][r]=Vr(n),W[e][r].raw=Br(n)}}var Hr=[`keyword`,`gray`,`hex`],Ur={};for(let e of Object.keys(W))Ur[[...W[e].labels].sort().join(``)]=e;var Wr={};function G(e,t){if(!(this instanceof G))return new G(e,t);if(t&&t in Hr&&(t=null),t&&!(t in W))throw Error(`Unknown model: `+t);let n,r;if(e==null)this.model=`rgb`,this.color=[0,0,0],this.valpha=1;else if(e instanceof G)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==`string`){let t=H.get(e);if(t===null)throw Error(`Unable to parse color from string: `+e);this.model=t.model,r=W[this.model].channels,this.color=t.value.slice(0,r),this.valpha=typeof t.value[r]==`number`?t.value[r]:1}else if(e.length>0){this.model=t||`rgb`,r=W[this.model].channels;let n=Array.prototype.slice.call(e,0,r);this.color=Jr(n,r),this.valpha=typeof e[r]==`number`?e[r]:1}else if(typeof e==`number`)this.model=`rgb`,this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let t=Object.keys(e);`alpha`in e&&(t.splice(t.indexOf(`alpha`),1),this.valpha=typeof e.alpha==`number`?e.alpha:0);let r=t.sort().join(``);if(!(r in Ur))throw Error(`Unable to parse color from object: `+JSON.stringify(e));this.model=Ur[r];let{labels:i}=W[this.model],a=[];for(n=0;n<i.length;n++)a.push(e[i[n]]);this.color=Jr(a)}if(Wr[this.model])for(r=W[this.model].channels,n=0;n<r;n++){let e=Wr[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}G.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in H.to?this:this.rgb();t=t.round(typeof e==`number`?e:1);let n=t.valpha===1?t.color:[...t.color,this.valpha];return H.to[t.model](...n)},percentString(e){let t=this.rgb().round(typeof e==`number`?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return H.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=W[this.model],{labels:n}=W[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new G([...this.color.map(Kr(e)),this.valpha],this.model)},alpha(e){return e===void 0?this.valpha:new G([...this.color,Math.max(0,Math.min(1,e))],this.model)},red:K(`rgb`,0,q(255)),green:K(`rgb`,1,q(255)),blue:K(`rgb`,2,q(255)),hue:K([`hsl`,`hsv`,`hsl`,`hwb`,`hcg`],0,e=>(e%360+360)%360),saturationl:K(`hsl`,1,q(100)),lightness:K(`hsl`,2,q(100)),saturationv:K(`hsv`,1,q(100)),value:K(`hsv`,2,q(100)),chroma:K(`hcg`,1,q(100)),gray:K(`hcg`,2,q(100)),white:K(`hwb`,1,q(100)),wblack:K(`hwb`,2,q(100)),cyan:K(`cmyk`,0,q(100)),magenta:K(`cmyk`,1,q(100)),yellow:K(`cmyk`,2,q(100)),black:K(`cmyk`,3,q(100)),x:K(`xyz`,0,q(95.047)),y:K(`xyz`,1,q(100)),z:K(`xyz`,2,q(108.833)),l:K(`lab`,0,q(100)),a:K(`lab`,1),b:K(`lab`,2),keyword(e){return e===void 0?W[this.model].keyword(this.color):new G(e)},hex(e){return e===void 0?H.to.hex(...this.rgb().round().color):new G(e)},hexa(e){if(e!==void 0)return new G(e);let t=this.rgb().round().color,n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n=`0`+n),H.to.hex(...t)+n},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[n,r]of e.entries()){let e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?`AAA`:t>=4.5?`AA`:``},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return G.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw Error(`Argument to "mix" was not a Color instance, but rather an instance of `+typeof e);let n=e.rgb(),r=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return G.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(let e of Object.keys(W)){if(Hr.includes(e))continue;let{channels:t}=W[e];G.prototype[e]=function(...t){return this.model===e?new G(this):t.length>0?new G(t,e):new G([...qr(W[this.model][e].raw(this.color)),this.valpha],e)},G[e]=function(...n){let r=n[0];return typeof r==`number`&&(r=Jr(n,t)),new G(r,e)}}function Gr(e,t){return Number(e.toFixed(t))}function Kr(e){return function(t){return Gr(t,e)}}function K(e,t,n){e=Array.isArray(e)?e:[e];for(let r of e)(Wr[r]||=[])[t]=n;return e=e[0],function(r){let i;return r===void 0?(i=this[e]().color[t],n&&(i=n(i)),i):(n&&(r=n(r)),i=this[e](),i.color[t]=r,i)}}function q(e){return function(t){return Math.max(0,Math.min(e,t))}}function qr(e){return Array.isArray(e)?e:[e]}function Jr(e,t){for(let n=0;n<t;n++)typeof e[n]!=`number`&&(e[n]=0);return e}var Yr=[`PageUp`,`PageDown`],Xr=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Zr={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},Qr=`Slider`,[$r,ei,ti]=Pn(Qr),[ni,ri]=Dt(Qr,[ti]),[ii,ai]=ni(Qr),oi=B.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=e,g=B.useRef(new Set),_=B.useRef(0),v=B.useRef(!1),y=o===`horizontal`?li:ui,[b=[],x]=Tt({prop:u,defaultProp:l,onChange:e=>{[...g.current][_.current]?.focus({preventScroll:!0,focusVisible:v.current}),v.current=!1,d(e)}}),S=B.useRef(b);function C(e){T(e,ki(b,e))}function w(e){T(e,_.current)}function ee(){let e=S.current[_.current];b[_.current]!==e&&f(b)}function T(e,t,{commit:n}={commit:!1}){let o=Pi(a),s=dn(Fi(Math.round((e-r)/a)*a+r,o),[r,i]);x((e=[])=>{let r=Ei(e,s,t);if(Mi(r,c*a)){_.current=r.indexOf(s);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}else return e})}return(0,V.jsx)(ii,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:_,thumbs:g.current,values:b,orientation:o,form:m,children:(0,V.jsx)($r.Provider,{scope:e.__scopeSlider,children:(0,V.jsx)($r.Slot,{scope:e.__scopeSlider,children:(0,V.jsx)(y,{"aria-disabled":s,"data-disabled":s?``:void 0,...h,ref:t,onPointerDown:Et(h.onPointerDown,()=>{s||(S.current=b,v.current=!1)}),min:r,max:i,inverted:p,onSlideStart:s?void 0:C,onSlideMove:s?void 0:w,onSlideEnd:s?void 0:ee,onHomeKeyDown:()=>{s||(v.current=!0,T(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(v.current=!0,T(i,b.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){v.current=!0;let n=Yr.includes(e.key)||e.shiftKey&&Xr.includes(e.key)?10:1,r=_.current,i=b[r];T(i+a*n*t,r,{commit:!0})}}})})})})});oi.displayName=Qr;var[si,ci]=ni(Qr,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),li=B.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[d,f]=B.useState(null),p=v(t,f),m=B.useRef(void 0),h=Mn(i),g=h===`ltr`,_=g&&!a||!g&&a;function y(e){let t=m.current||d.getBoundingClientRect(),i=Ni([0,t.width],_?[n,r]:[r,n]);return m.current=t,i(e-t.left)}return(0,V.jsx)(si,{scope:e.__scopeSlider,startEdge:_?`left`:`right`,endEdge:_?`right`:`left`,direction:_?1:-1,size:`width`,children:(0,V.jsx)(di,{dir:h,"data-orientation":`horizontal`,...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{m.current=void 0,c?.()},onStepKeyDown:e=>{let t=Zr[_?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),ui=B.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=B.useRef(null),d=v(t,u),f=B.useRef(void 0),p=!i;function m(e){let t=f.current||u.current.getBoundingClientRect(),i=Ni([0,t.height],p?[r,n]:[n,r]);return f.current=t,i(e-t.top)}return(0,V.jsx)(si,{scope:e.__scopeSlider,startEdge:p?`bottom`:`top`,endEdge:p?`top`:`bottom`,size:`height`,direction:p?1:-1,children:(0,V.jsx)(di,{"data-orientation":`vertical`,...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=m(e.clientY);a?.(t)},onSlideMove:e=>{let t=m(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:e=>{let t=Zr[p?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),di=B.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=ai(Qr,n);return(0,V.jsx)(y.span,{...l,ref:t,onKeyDown:Et(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):Yr.concat(Xr).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:Et(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:Et(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:Et(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),fi=`SliderTrack`,pi=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(fi,n);return(0,V.jsx)(y.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})});pi.displayName=fi;var mi=`SliderRange`,hi=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(mi,n),a=ci(mi,n),o=v(t,B.useRef(null)),s=i.values.length,c=i.values.map(e=>Di(e,i.min,i.max)),l=s>1?Math.min(...c):0,u=100-Math.max(...c);return(0,V.jsx)(y.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:o,style:{...e.style,[a.startEdge]:l+`%`,[a.endEdge]:u+`%`}})});hi.displayName=mi;var gi=`SliderThumb`,[_i,vi]=ni(gi),yi=`SliderThumbProvider`;function bi(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=ai(yi,t),o=ei(t),[s,c]=B.useState(null),l=B.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=Mt(s),d=s?!!a.form||!!s.closest(`form`):!0,f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),m=f===void 0?0:Di(f,a.min,a.max);B.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let h={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:m,size:u};return(0,V.jsx)(_i,{scope:t,...h,children:Ii(i)?i(h):r})}bi.displayName=yi;var xi=`SliderThumbTrigger`,Si=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(xi,n),a=ci(xi,n),{index:o,value:s,percent:c,size:l,onThumbChange:u}=vi(xi,n),d=v(t,u),f=Oi(o,i.values.length),p=l?.[a.size],m=p?Ai(p,c,a.direction):0;return(0,V.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${m}px)`},children:(0,V.jsx)($r.ItemSlot,{scope:n,children:(0,V.jsx)(y.span,{role:`slider`,"aria-label":e[`aria-label`]||f,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:d,style:s===void 0?{display:`none`}:e.style,onFocus:Et(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})});Si.displayName=xi;var Ci=B.forwardRef((e,t)=>{let{__scopeSlider:n,name:r,...i}=e;return(0,V.jsx)(bi,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Si,{...i,ref:t,__scopeSlider:n}),r?(0,V.jsx)(Ti,{__scopeSlider:n},e):null]})})});Ci.displayName=gi;var wi=`SliderBubbleInput`,Ti=B.forwardRef(({__scopeSlider:e,...t},n)=>{let{value:r,name:i,form:a}=vi(wi,e),o=B.useRef(null),s=v(o,n),c=Nt(r);return B.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),(0,V.jsx)(y.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})});Ti.displayName=wi;function Ei(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function Di(e,t,n){return dn(100/(n-t)*(e-t),[0,100])}function Oi(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function ki(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function Ai(e,t,n){let r=e/2;return(r-Ni([0,50],[0,r])(t)*n)*n}function ji(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Mi(e,t){if(t>0){let n=ji(e);return Math.min(...n)>=t}return!0}function Ni(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Pi(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}function Fi(e,t){let n=10**t;return Math.round(e*n)/n}function Ii(e){return typeof e==`function`}var Li=(0,B.createContext)(void 0),Ri=()=>{let e=(0,B.useContext)(Li);if(!e)throw Error(`useColorPicker must be used within a ColorPickerProvider`);return e},zi=({value:e,defaultValue:t=`rgb(0 0 0)`,onChange:n,className:r,...i})=>{let a=G(e??t),[o,s]=(0,B.useState)(a.hue()),[c,l]=(0,B.useState)(a.saturationl()),[u,d]=(0,B.useState)(a.lightness()),[f,p]=(0,B.useState)(a.alpha()*100),[m,h]=(0,B.useState)(`hex`);return(0,B.useEffect)(()=>{if(e){let t=G(e);s(t.hue()),l(t.saturationl()),d(t.lightness()),p(t.alpha()*100)}},[e]),(0,B.useEffect)(()=>{n&&n(G.hsl(o,c,u).alpha(f/100).hex())},[o,c,u,f,n]),(0,V.jsx)(Li.Provider,{value:{hue:o,saturation:c,lightness:u,alpha:f,mode:m,setHue:s,setSaturation:l,setLightness:d,setAlpha:p,setMode:h},children:(0,V.jsx)(`div`,{className:R(`flex size-full flex-col gap-4`,r),...i})})},Bi=(0,B.memo)(({className:e,...t})=>{let n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(0),[s,c]=(0,B.useState)(0),{hue:l,saturation:u,lightness:d,setSaturation:f,setLightness:p}=Ri(),m=(0,B.useMemo)(()=>`linear-gradient(0deg, rgba(0,0,0,1), rgba(0,0,0,0)),
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-editor-view-DSY5RHLf.js","./rolldown-runtime-DAXXjFlN.js","./react-Bb3IsNbi.js","./jsx-runtime-CtMZ-PAS.js","./esm-CsHLKmLh.js","./clsx-CjueKrWZ.js","./dist-duxRDcQu.js","./index-B5yxmQNp.js","./react-dom-C6aoWSfl.js","./framework-provider-i7X1c1ST.js","./hooks-tBACnBdQ.js","./dist-B7kX8alP.js","./dist-B_Ahe-Z8.js","./Combination-BPFTKsTn.js","./dist-CsekE4FL.js","./dist-CaHNiF20.js","./preload-helper-DYl5dUZ5.js","./dist-CqWm6lIL.js","./chunk-KS7C4IRE-DG9HTHQ3.js","./router-provider-S8Wf6jdu.js","./button-DiwO9Rof.js","./users-Y8qhvF1q.js","./update-queries-C4CnvJaW.js","./index-CeWc1b5F.css","./dist-DLRDZ5Qa.js","./dist-CNbTQjTb.js","./dist-DVfKxKHo.js","./dist-DMIqMO5L.js","./dist-CMhLtvG_.js","./dist-C30sqimN.js","./modals-DF2sECo6.js","./social-urls-DVvRfwEp.js","./tabs-DSrHPjWP.js","./labels-DLL8dl-7.js","./nql-BsgFMd93.js","./switch-Dy6asCQw.js","./dist-JLOy8o0Q.js","./isEmail-BOfC647y.js","./automated-emails-293Lcj5S.js","./offers-BYodCS47.js","./posts-D_gBhqmK.js","./analytics-53FOa2wq.js","./newsletters-BEvO0JE3.js","./tiers-74aPYtWv.js","./dist-CNlBOype.js","./nql-lang-BoHzkNg5.js","./koenig-lexical-CUVpp-dC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./react-Bb3IsNbi.js";import{t as n}from"./react-dom-C6aoWSfl.js";import{n as r,s as i}from"./framework-provider-i7X1c1ST.js";import{S as a,a as o,d as s,f as c,g as l,h as u,l as d,n as f,p,r as m,u as h,y as g}from"./hooks-tBACnBdQ.js";import{t as _}from"./jsx-runtime-CtMZ-PAS.js";import{a as v}from"./dist-B7kX8alP.js";import{t as y}from"./dist-B_Ahe-Z8.js";import{c as b,d as x,f as S,h as C,l as w,o as ee,p as T,s as te,u as E}from"./esm-CsHLKmLh.js";import{t as D}from"./clsx-CjueKrWZ.js";import{$ as O,$t as k,A as ne,At as re,Bt as ie,C as ae,Ct as oe,D as se,Dt as ce,Et as A,F as le,Ft as ue,Ht as de,I as fe,It as pe,Jt as j,Kt as me,L as he,M as ge,Mt as M,N as _e,O as ve,Ot as ye,P as be,Qt as xe,R as Se,S as N,St as Ce,Tt as we,U as Te,V as Ee,Vt as De,W as Oe,Wt as ke,Yt as Ae,Zt as je,_ as Me,_t as Ne,an as Pe,at as Fe,b as Ie,bt as Le,c as Re,ct as ze,d as Be,dn as Ve,dt as He,en as Ue,ft as P,g as We,gt as Ge,h as Ke,ht as F,i as qe,j as Je,jt as Ye,l as Xe,ln as Ze,lt as I,m as Qe,mt as $e,n as et,nn as tt,o as nt,on as rt,ot as it,p as at,q as ot,qt as st,r as ct,sn as lt,st as ut,t as dt,tn as ft,tt as pt,u as mt,un as L,ut as ht,v as gt,vt as _t,wt as vt,x as yt,xt as bt,y as xt,yt as St,z as Ct,zt as wt}from"./social-urls-DVvRfwEp.js";import{d as Tt,p as Et}from"./Combination-BPFTKsTn.js";import{r as Dt}from"./dist-CsekE4FL.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-DSrHPjWP.js";import{o as Mt}from"./dist-CaHNiF20.js";import{t as Nt}from"./dist-JLOy8o0Q.js";import{t as Pt}from"./preload-helper-DYl5dUZ5.js";import{n as Ft}from"./dist-duxRDcQu.js";import{t as It}from"./switch-Dy6asCQw.js";import{a as Lt,c as Rt,d as zt,f as Bt,g as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./automated-emails-293Lcj5S.js";import{n as $t}from"./offers-BYodCS47.js";import{$ as en,Gn as tn,It as nn,J as rn,Kn as R,Ot as an,Xn as on,_ as sn,jn as cn,t as ln,v as un}from"./button-DiwO9Rof.js";import{c as dn,i as fn,n as pn,o as mn,s as hn,t as gn}from"./select-Cp27ScMR.js";import{t as _n}from"./dropzone-9zocztX0.js";import{t as vn}from"./textarea-CUVQjsrM.js";import{n as yn,t as bn}from"./toggle-group-CrFpl-Xz.js";import{l as xn,o as Sn,t as Cn,u as wn}from"./users-Y8qhvF1q.js";import{$n as Tn,$r as En,Bn as Dn,Gn as On,Hn as kn,Mi as An,Mn as jn,Nn as Mn,On as Nn,Qn as Pn,Rn as Fn,Un as In,Vn as Ln,Wn as Rn,Wt as zn,Xn as Bn,_n as Vn,br as Hn,ci as Un,di as Wn,dn as z,gn as Gn,gr as Kn,ji as qn,jn as Jn,li as Yn,ln as Xn,mr as Zn,pn as Qn,qn as $n,ui as er,un as tr,v as nr,zn as rr}from"./index-B5yxmQNp.js";import{a as ir,i as ar,r as or,t as sr}from"./newsletters-BEvO0JE3.js";import{a as cr,n as lr,r as ur,t as dr}from"./tiers-74aPYtWv.js";import{t as fr}from"./referrers-B0RVWBfE.js";import{i as pr}from"./gift-links-bR_JDdWo.js";var B=e(t(),1),V=_(),mr=B.lazy(()=>Pt(()=>import(`./code-editor-view-DSY5RHLf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url)),hr=(0,B.forwardRef)(function(e,t){return(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(mr,{...e,ref:t})})}),gr=({selectedValue:e=``,onSelect:t,options:n=[],otherOption:r={value:`other`,label:`Other...`},otherPlaceholder:i=`Enter custom value`,otherHint:a,backToListLabel:o=`Choose from list`,defaultListValue:s,validate:c,allowEmpty:l=!1,error:u,hint:d,title:f,testId:p,...m})=>{let{...h}=m,g=B.useMemo(()=>e&&!n.some(t=>t.value===e)&&e!==r.value,[e,n,r.value]),[_,v]=(0,B.useState)(!!g),[y,b]=(0,B.useState)(null),x=e=>{e&&(e.value===r.value?(v(!0),t(``)):(v(!1),t(e.value)))},S=e=>{let n=e.target.value,r=null;c&&(r=c(n)),!r&&!n&&!l&&(r=`Enter a value`),b(r),t(n)},C=()=>{v(!1),b(null),s&&n.find(e=>e.value===s)?t(s):n.length>0&&t(n[0].value)},w=B.useMemo(()=>n.some(e=>e.value===r.value)?n:[...n,r],[n,r]),ee=_||g,T=u||!!y,te=y||(typeof d==`string`?d:``);if(ee)return(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(k,{"data-testid":p,error:T,hideTitle:!f,hint:T?te:a&&typeof a==`string`?a:``,placeholder:i,title:f,value:e,onChange:S}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(`button`,{className:`text-sm text-green-400 hover:text-green-500`,type:`button`,onClick:C,children:o})})]});let E=n.find(t=>t.value===e);return(0,V.jsx)(De,{...h,async:!1,error:u,hint:d,options:w,selectedOption:E,testId:p,title:f,onSelect:x})},_r=({icon:e,iconColorClass:t,children:n})=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(l,{colorClass:t,name:e,size:`sm`}),n]}),vr=({href:e,color:t,className:n,children:r,...i})=>{t||=`green`;let a=t===`black`?`transition text-black hover:text-black-700`:`text-${t} hover:text-${t}-400`;return n&&(a=`${a} ${n}`),(0,V.jsx)(`a`,{className:a,href:e,...i,children:r})},yr=(0,B.forwardRef)(function({title:e,navid:t=``,icon:n,isCurrent:r=!1,isVisible:i=!0,onClick:a=()=>{},...o},s){let c=D(`mt-px flex h-[32px] w-100 cursor-pointer items-center rounded-md px-3 py-2 text-left font-medium transition-all hover:bg-grey-200 focus:bg-grey-100 dark:text-grey-600 dark:hover:bg-grey-950 dark:focus:bg-grey-900`,r?`bg-grey-200 text-black dark:bg-grey-950 dark:text-white`:`text-grey-800`,!i&&`hidden`);return(0,V.jsx)(`li`,{ref:s,...o,children:(0,V.jsxs)(`a`,{className:c,id:t,onClick:a,children:[n&&(0,V.jsx)(l,{className:`mr-[7px] size-[16px]`,name:n,size:`custom`}),e]})})}),br=({title:e,sticky:t=!1})=>(0,V.jsx)(`h2`,{className:D(`z-20 mb-px pb-10 text-2xl font-semibold tracking-tight`,t?`sticky top-0 mt-[calc(-8vmin-4px)] bg-gradient-to-t from-transparent via-white via-20% to-white pt-[calc(8vmin-4px)] dark:bg-black`:`mt-[-5px]`),children:e}),xr=({title:e,isVisible:t=!0,children:n})=>(0,V.jsxs)(`div`,{className:D(`mb-[10vh]`,t?``:`hidden`),children:[e&&(0,V.jsx)(br,{title:e}),n&&(0,V.jsx)(`div`,{className:`mb-10 flex flex-col gap-12`,children:n})]}),Sr=({darkMode:e,fetchKoenigLexical:t,className:n,children:r,...i})=>(0,V.jsx)(`div`,{className:D(`admin-x-base`,n),...i,children:(0,V.jsx)(ee,{darkMode:e,fetchKoenigLexical:t,children:r})}),Cr=e=>(0,V.jsx)(`svg`,{fill:`none`,height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,V.jsx)(`path`,{clipRule:`evenodd`,d:`M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z`,fill:`currentColor`,fillRule:`evenodd`})}),wr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in wr)Object.freeze(wr[e]);var Tr=Object.freeze(wr),Er=Object.create(null);for(let e in Tr)Object.hasOwn(Tr,e)&&(Er[Tr[e]]=e);var H={to:{},get:{}};H.get=function(e){let t=e.slice(0,3).toLowerCase(),n,r;switch(t){case`hsl`:n=H.get.hsl(e),r=`hsl`;break;case`hwb`:n=H.get.hwb(e),r=`hwb`;break;default:n=H.get.rgb(e),r=`rgb`;break}return n?{model:r,value:n}:null},H.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,a=/^(\w+)$/,o=[0,0,0,1],s,c,l;if(s=e.match(n)){for(l=s[2],s=s[1],c=0;c<3;c++){let e=c*2;o[c]=Number.parseInt(s.slice(e,e+2),16)}l&&(o[3]=Number.parseInt(l,16)/255)}else if(s=e.match(t)){for(s=s[1],l=s[3],c=0;c<3;c++)o[c]=Number.parseInt(s[c]+s[c],16);l&&(o[3]=Number.parseInt(l+l,16)/255)}else if(s=e.match(r)){for(c=0;c<3;c++)o[c]=Number.parseFloat(s[c+1]);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(s[c+1])*2.55);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.toLowerCase().match(a))return s[1]===`transparent`?[0,0,0,0]:Object.hasOwn(Tr,s[1])?(o=Tr[s[1]].slice(),o[3]=1,o):null;else return null;for(c=0;c<3;c++)o[c]=Dr(o[c],0,255);return o[3]=Dr(o[3],0,1),o},H.get.hsl=function(e){if(!e)return null;let t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,Dr(Number.parseFloat(t[2]),0,100),Dr(Number.parseFloat(t[3]),0,100),Dr(Number.isNaN(e)?1:e,0,1)]}return null},H.get.hwb=function(e){if(!e)return null;let t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,Dr(Number.parseFloat(t[2]),0,100),Dr(Number.parseFloat(t[3]),0,100),Dr(Number.isNaN(e)?1:e,0,1)]}return null},H.to.hex=function(...e){return`#`+Or(e[0])+Or(e[1])+Or(e[2])+(e[3]<1?Or(Math.round(e[3]*255)):``)},H.to.rgb=function(...e){return e.length<4||e[3]===1?`rgb(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`)`:`rgba(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`, `+e[3]+`)`},H.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?`rgb(`+t+`%, `+n+`%, `+r+`%)`:`rgba(`+t+`%, `+n+`%, `+r+`%, `+e[3]+`)`},H.to.hsl=function(...e){return e.length<4||e[3]===1?`hsl(`+e[0]+`, `+e[1]+`%, `+e[2]+`%)`:`hsla(`+e[0]+`, `+e[1]+`%, `+e[2]+`%, `+e[3]+`)`},H.to.hwb=function(...e){let t=``;return e.length>=4&&e[3]!==1&&(t=`, `+e[3]),`hwb(`+e[0]+`, `+e[1]+`%, `+e[2]+`%`+t+`)`},H.to.keyword=function(...e){return Er[e.slice(0,3)]};function Dr(e,t,n){return Math.min(Math.max(t,e),n)}function Or(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?`0`+t:t}var kr={};for(let e of Object.keys(Tr))kr[Tr[e]]=e;var U={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},oklab:{channels:3,labels:[`okl`,`oka`,`okb`]},lch:{channels:3,labels:`lch`},oklch:{channels:3,labels:[`okl`,`okc`,`okh`]},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},Ar=(6/29)**3;function jr(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Mr(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(U)){if(!(`channels`in U[e]))throw Error(`missing channels property: `+e);if(!(`labels`in U[e]))throw Error(`missing channel labels property: `+e);if(U[e].labels.length!==U[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=U[e];delete U[e].channels,delete U[e].labels,Object.defineProperty(U[e],"channels",{value:t}),Object.defineProperty(U[e],"labels",{value:n})}U.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},U.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},U.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=U.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},U.rgb.oklab=function(e){let t=Mr(e[0]/255),n=Mr(e[1]/255),r=Mr(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},U.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function Nr(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}U.rgb.keyword=function(e){let t=kr[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(Tr)){let i=Tr[t],a=Nr(e,i);a<n&&(n=a,r=t)}return r},U.keyword.rgb=function(e){return[...Tr[e]]},U.rgb.xyz=function(e){let t=Mr(e[0]/255),n=Mr(e[1]/255),r=Mr(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},U.rgb.lab=function(e){let t=U.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>Ar?n**(1/3):7.787*n+16/116,r=r>Ar?r**(1/3):7.787*r+16/116,i=i>Ar?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},U.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},U.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},U.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},U.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},U.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},U.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},U.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=jr(i),a=jr(a),o=jr(o),[i*255,a*255,o*255]},U.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>Ar?t**(1/3):7.787*t+16/116,n=n>Ar?n**(1/3):7.787*n+16/116,r=r>Ar?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},U.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},U.oklab.oklch=function(e){return U.lab.lch(e)},U.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},U.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=jr(4.0767416621*i-3.3077115913*a+.2309699292*o),c=jr(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=jr(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},U.oklch.oklab=function(e){return U.lch.lab(e)},U.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>Ar?s:(a-16/116)/7.787,i=c>Ar?c:(i-16/116)/7.787,o=l>Ar?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},U.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},U.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},U.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?U.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},U.hsv.ansi16=function(e){return U.rgb.ansi16(U.hsv.rgb(e),e[2])},U.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},U.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},U.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},U.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},U.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},U.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},U.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},U.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},U.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},U.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},U.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},U.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},U.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},U.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},U.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},U.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},U.gray.hsl=function(e){return[0,0,e[0]]},U.gray.hsv=U.gray.hsl,U.gray.hwb=function(e){return[0,100,e[0]]},U.gray.cmyk=function(e){return[0,0,0,e[0]]},U.gray.lab=function(e){return[e[0],0,0]},U.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},U.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Pr(){let e={},t=Object.keys(U);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function Fr(e){let t=Pr(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(U[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function Ir(e,t){return function(n){return t(e(n))}}function Lr(e,t){let n=[t[e].parent,e],r=U[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=Ir(U[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function Rr(e){let t=Fr(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=Lr(e,t))}return n}var W={},zr=Object.keys(U);function Br(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function Vr(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of zr){W[e]={},Object.defineProperty(W[e],"channels",{value:U[e].channels}),Object.defineProperty(W[e],"labels",{value:U[e].labels});let t=Rr(e),n=Object.keys(t);for(let r of n){let n=t[r];W[e][r]=Vr(n),W[e][r].raw=Br(n)}}var Hr=[`keyword`,`gray`,`hex`],Ur={};for(let e of Object.keys(W))Ur[[...W[e].labels].sort().join(``)]=e;var Wr={};function G(e,t){if(!(this instanceof G))return new G(e,t);if(t&&t in Hr&&(t=null),t&&!(t in W))throw Error(`Unknown model: `+t);let n,r;if(e==null)this.model=`rgb`,this.color=[0,0,0],this.valpha=1;else if(e instanceof G)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==`string`){let t=H.get(e);if(t===null)throw Error(`Unable to parse color from string: `+e);this.model=t.model,r=W[this.model].channels,this.color=t.value.slice(0,r),this.valpha=typeof t.value[r]==`number`?t.value[r]:1}else if(e.length>0){this.model=t||`rgb`,r=W[this.model].channels;let n=Array.prototype.slice.call(e,0,r);this.color=Jr(n,r),this.valpha=typeof e[r]==`number`?e[r]:1}else if(typeof e==`number`)this.model=`rgb`,this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let t=Object.keys(e);`alpha`in e&&(t.splice(t.indexOf(`alpha`),1),this.valpha=typeof e.alpha==`number`?e.alpha:0);let r=t.sort().join(``);if(!(r in Ur))throw Error(`Unable to parse color from object: `+JSON.stringify(e));this.model=Ur[r];let{labels:i}=W[this.model],a=[];for(n=0;n<i.length;n++)a.push(e[i[n]]);this.color=Jr(a)}if(Wr[this.model])for(r=W[this.model].channels,n=0;n<r;n++){let e=Wr[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}G.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in H.to?this:this.rgb();t=t.round(typeof e==`number`?e:1);let n=t.valpha===1?t.color:[...t.color,this.valpha];return H.to[t.model](...n)},percentString(e){let t=this.rgb().round(typeof e==`number`?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return H.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=W[this.model],{labels:n}=W[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new G([...this.color.map(Kr(e)),this.valpha],this.model)},alpha(e){return e===void 0?this.valpha:new G([...this.color,Math.max(0,Math.min(1,e))],this.model)},red:K(`rgb`,0,q(255)),green:K(`rgb`,1,q(255)),blue:K(`rgb`,2,q(255)),hue:K([`hsl`,`hsv`,`hsl`,`hwb`,`hcg`],0,e=>(e%360+360)%360),saturationl:K(`hsl`,1,q(100)),lightness:K(`hsl`,2,q(100)),saturationv:K(`hsv`,1,q(100)),value:K(`hsv`,2,q(100)),chroma:K(`hcg`,1,q(100)),gray:K(`hcg`,2,q(100)),white:K(`hwb`,1,q(100)),wblack:K(`hwb`,2,q(100)),cyan:K(`cmyk`,0,q(100)),magenta:K(`cmyk`,1,q(100)),yellow:K(`cmyk`,2,q(100)),black:K(`cmyk`,3,q(100)),x:K(`xyz`,0,q(95.047)),y:K(`xyz`,1,q(100)),z:K(`xyz`,2,q(108.833)),l:K(`lab`,0,q(100)),a:K(`lab`,1),b:K(`lab`,2),keyword(e){return e===void 0?W[this.model].keyword(this.color):new G(e)},hex(e){return e===void 0?H.to.hex(...this.rgb().round().color):new G(e)},hexa(e){if(e!==void 0)return new G(e);let t=this.rgb().round().color,n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n=`0`+n),H.to.hex(...t)+n},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[n,r]of e.entries()){let e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?`AAA`:t>=4.5?`AA`:``},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return G.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw Error(`Argument to "mix" was not a Color instance, but rather an instance of `+typeof e);let n=e.rgb(),r=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return G.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(let e of Object.keys(W)){if(Hr.includes(e))continue;let{channels:t}=W[e];G.prototype[e]=function(...t){return this.model===e?new G(this):t.length>0?new G(t,e):new G([...qr(W[this.model][e].raw(this.color)),this.valpha],e)},G[e]=function(...n){let r=n[0];return typeof r==`number`&&(r=Jr(n,t)),new G(r,e)}}function Gr(e,t){return Number(e.toFixed(t))}function Kr(e){return function(t){return Gr(t,e)}}function K(e,t,n){e=Array.isArray(e)?e:[e];for(let r of e)(Wr[r]||=[])[t]=n;return e=e[0],function(r){let i;return r===void 0?(i=this[e]().color[t],n&&(i=n(i)),i):(n&&(r=n(r)),i=this[e](),i.color[t]=r,i)}}function q(e){return function(t){return Math.max(0,Math.min(e,t))}}function qr(e){return Array.isArray(e)?e:[e]}function Jr(e,t){for(let n=0;n<t;n++)typeof e[n]!=`number`&&(e[n]=0);return e}var Yr=[`PageUp`,`PageDown`],Xr=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Zr={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},Qr=`Slider`,[$r,ei,ti]=An(Qr),[ni,ri]=Dt(Qr,[ti]),[ii,ai]=ni(Qr),oi=B.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=e,g=B.useRef(new Set),_=B.useRef(0),v=B.useRef(!1),y=o===`horizontal`?li:ui,[b=[],x]=Tt({prop:u,defaultProp:l,onChange:e=>{[...g.current][_.current]?.focus({preventScroll:!0,focusVisible:v.current}),v.current=!1,d(e)}}),S=B.useRef(b);function C(e){T(e,ki(b,e))}function w(e){T(e,_.current)}function ee(){let e=S.current[_.current];b[_.current]!==e&&f(b)}function T(e,t,{commit:n}={commit:!1}){let o=Pi(a),s=dn(Fi(Math.round((e-r)/a)*a+r,o),[r,i]);x((e=[])=>{let r=Ei(e,s,t);if(Mi(r,c*a)){_.current=r.indexOf(s);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}else return e})}return(0,V.jsx)(ii,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:_,thumbs:g.current,values:b,orientation:o,form:m,children:(0,V.jsx)($r.Provider,{scope:e.__scopeSlider,children:(0,V.jsx)($r.Slot,{scope:e.__scopeSlider,children:(0,V.jsx)(y,{"aria-disabled":s,"data-disabled":s?``:void 0,...h,ref:t,onPointerDown:Et(h.onPointerDown,()=>{s||(S.current=b,v.current=!1)}),min:r,max:i,inverted:p,onSlideStart:s?void 0:C,onSlideMove:s?void 0:w,onSlideEnd:s?void 0:ee,onHomeKeyDown:()=>{s||(v.current=!0,T(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(v.current=!0,T(i,b.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){v.current=!0;let n=Yr.includes(e.key)||e.shiftKey&&Xr.includes(e.key)?10:1,r=_.current,i=b[r];T(i+a*n*t,r,{commit:!0})}}})})})})});oi.displayName=Qr;var[si,ci]=ni(Qr,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),li=B.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[d,f]=B.useState(null),p=v(t,f),m=B.useRef(void 0),h=qn(i),g=h===`ltr`,_=g&&!a||!g&&a;function y(e){let t=m.current||d.getBoundingClientRect(),i=Ni([0,t.width],_?[n,r]:[r,n]);return m.current=t,i(e-t.left)}return(0,V.jsx)(si,{scope:e.__scopeSlider,startEdge:_?`left`:`right`,endEdge:_?`right`:`left`,direction:_?1:-1,size:`width`,children:(0,V.jsx)(di,{dir:h,"data-orientation":`horizontal`,...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{m.current=void 0,c?.()},onStepKeyDown:e=>{let t=Zr[_?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),ui=B.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=B.useRef(null),d=v(t,u),f=B.useRef(void 0),p=!i;function m(e){let t=f.current||u.current.getBoundingClientRect(),i=Ni([0,t.height],p?[r,n]:[n,r]);return f.current=t,i(e-t.top)}return(0,V.jsx)(si,{scope:e.__scopeSlider,startEdge:p?`bottom`:`top`,endEdge:p?`top`:`bottom`,size:`height`,direction:p?1:-1,children:(0,V.jsx)(di,{"data-orientation":`vertical`,...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=m(e.clientY);a?.(t)},onSlideMove:e=>{let t=m(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:e=>{let t=Zr[p?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),di=B.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=ai(Qr,n);return(0,V.jsx)(y.span,{...l,ref:t,onKeyDown:Et(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):Yr.concat(Xr).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:Et(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:Et(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:Et(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),fi=`SliderTrack`,pi=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(fi,n);return(0,V.jsx)(y.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})});pi.displayName=fi;var mi=`SliderRange`,hi=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(mi,n),a=ci(mi,n),o=v(t,B.useRef(null)),s=i.values.length,c=i.values.map(e=>Di(e,i.min,i.max)),l=s>1?Math.min(...c):0,u=100-Math.max(...c);return(0,V.jsx)(y.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:o,style:{...e.style,[a.startEdge]:l+`%`,[a.endEdge]:u+`%`}})});hi.displayName=mi;var gi=`SliderThumb`,[_i,vi]=ni(gi),yi=`SliderThumbProvider`;function bi(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=ai(yi,t),o=ei(t),[s,c]=B.useState(null),l=B.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=Mt(s),d=s?!!a.form||!!s.closest(`form`):!0,f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),m=f===void 0?0:Di(f,a.min,a.max);B.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let h={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:m,size:u};return(0,V.jsx)(_i,{scope:t,...h,children:Ii(i)?i(h):r})}bi.displayName=yi;var xi=`SliderThumbTrigger`,Si=B.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=ai(xi,n),a=ci(xi,n),{index:o,value:s,percent:c,size:l,onThumbChange:u}=vi(xi,n),d=v(t,u),f=Oi(o,i.values.length),p=l?.[a.size],m=p?Ai(p,c,a.direction):0;return(0,V.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${m}px)`},children:(0,V.jsx)($r.ItemSlot,{scope:n,children:(0,V.jsx)(y.span,{role:`slider`,"aria-label":e[`aria-label`]||f,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:d,style:s===void 0?{display:`none`}:e.style,onFocus:Et(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})});Si.displayName=xi;var Ci=B.forwardRef((e,t)=>{let{__scopeSlider:n,name:r,...i}=e;return(0,V.jsx)(bi,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Si,{...i,ref:t,__scopeSlider:n}),r?(0,V.jsx)(Ti,{__scopeSlider:n},e):null]})})});Ci.displayName=gi;var wi=`SliderBubbleInput`,Ti=B.forwardRef(({__scopeSlider:e,...t},n)=>{let{value:r,name:i,form:a}=vi(wi,e),o=B.useRef(null),s=v(o,n),c=Nt(r);return B.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),(0,V.jsx)(y.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})});Ti.displayName=wi;function Ei(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function Di(e,t,n){return dn(100/(n-t)*(e-t),[0,100])}function Oi(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function ki(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function Ai(e,t,n){let r=e/2;return(r-Ni([0,50],[0,r])(t)*n)*n}function ji(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Mi(e,t){if(t>0){let n=ji(e);return Math.min(...n)>=t}return!0}function Ni(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Pi(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}function Fi(e,t){let n=10**t;return Math.round(e*n)/n}function Ii(e){return typeof e==`function`}var Li=(0,B.createContext)(void 0),Ri=()=>{let e=(0,B.useContext)(Li);if(!e)throw Error(`useColorPicker must be used within a ColorPickerProvider`);return e},zi=({value:e,defaultValue:t=`rgb(0 0 0)`,onChange:n,className:r,...i})=>{let a=G(e??t),[o,s]=(0,B.useState)(a.hue()),[c,l]=(0,B.useState)(a.saturationl()),[u,d]=(0,B.useState)(a.lightness()),[f,p]=(0,B.useState)(a.alpha()*100),[m,h]=(0,B.useState)(`hex`);return(0,B.useEffect)(()=>{if(e){let t=G(e);s(t.hue()),l(t.saturationl()),d(t.lightness()),p(t.alpha()*100)}},[e]),(0,B.useEffect)(()=>{n&&n(G.hsl(o,c,u).alpha(f/100).hex())},[o,c,u,f,n]),(0,V.jsx)(Li.Provider,{value:{hue:o,saturation:c,lightness:u,alpha:f,mode:m,setHue:s,setSaturation:l,setLightness:d,setAlpha:p,setMode:h},children:(0,V.jsx)(`div`,{className:R(`flex size-full flex-col gap-4`,r),...i})})},Bi=(0,B.memo)(({className:e,...t})=>{let n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(0),[s,c]=(0,B.useState)(0),{hue:l,saturation:u,lightness:d,setSaturation:f,setLightness:p}=Ri(),m=(0,B.useMemo)(()=>`linear-gradient(0deg, rgba(0,0,0,1), rgba(0,0,0,0)),
|
|
3
3
|
linear-gradient(90deg, rgba(255,255,255,1), rgba(255,255,255,0)),
|
|
4
|
-
hsl(${l}, 100%, 50%)`,[l]);(0,B.useEffect)(()=>{let e=u/100,t=e<.01?100:50+50*(1-e),n=Math.max(0,Math.min(1,1-d/t));o(e),c(n)},[u,d]);let h=(0,B.useCallback)(e=>{if(!n.current)return;let t=n.current.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),i=Math.max(0,Math.min(1,(e.clientY-t.top)/t.height));o(r),c(i),f(r*100);let a=(r<.01?100:50+50*(1-r))*(1-i);p(a)},[f,p]),g=(0,B.useCallback)(e=>{r&&h(e)},[r,h]);return(0,B.useEffect)(()=>{let e=()=>i(!1);return r&&(window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,e)),()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,e)}},[r,g]),(0,V.jsx)(`div`,{ref:n,className:R(`relative size-full cursor-crosshair rounded`,e),style:{background:m},onPointerDown:e=>{e.preventDefault(),i(!0),h(e.nativeEvent)},...t,children:(0,V.jsx)(`div`,{className:`pointer-events-none absolute size-4 -translate-1/2 rounded-full border-2 border-white`,style:{left:`${a*100}%`,top:`${s*100}%`,boxShadow:`0 0 0 1px rgba(0,0,0,0.5)`}})})});Bi.displayName=`ColorPickerSelection`;var Vi=({className:e,...t})=>{let{hue:n,setHue:r}=Ri();return(0,V.jsxs)(oi,{className:R(`relative flex h-4 w-full touch-none`,e),max:360,step:1,value:[n],onValueChange:([e])=>r(e),...t,children:[(0,V.jsx)(pi,{className:`relative my-0.5 h-3 w-full grow rounded-full bg-[linear-gradient(90deg,red,yellow,lime,aqua,blue,magenta,red)]`,children:(0,V.jsx)(hi,{className:`absolute h-full`})}),(0,V.jsx)(Ci,{className:`block size-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50`})]})},Hi=({className:e,...t})=>{let{setHue:n,setSaturation:r,setLightness:i,setAlpha:a}=Ri();return typeof window<`u`&&`EyeDropper`in window?(0,V.jsx)(ln,{className:R(`size-8 shrink-0 text-muted-foreground`,e),size:`icon`,type:`button`,variant:`outline`,onClick:async()=>{try{let[e,t,o]=G((await new EyeDropper().open()).sRGBHex).hsl().array();n(e),r(t),i(o),a(100)}catch(e){console.error(`EyeDropper failed:`,e)}},...t,children:(0,V.jsx)(en,{size:16})}):null},Ui=[`hex`,`rgb`,`hsl`],Wi=({...e})=>{let{mode:t,setMode:n}=Ri();return(0,V.jsxs)(gn,{value:t,onValueChange:n,children:[(0,V.jsx)(mn,{className:`h-8 w-20 shrink-0 text-xs`,...e,children:(0,V.jsx)(hn,{placeholder:`Mode`})}),(0,V.jsx)(pn,{children:Ui.map(e=>(0,V.jsx)(fn,{className:`text-xs`,value:e,children:e.toUpperCase()},e))})]})},Gi=({className:e,...t})=>{let{hue:n,saturation:r,lightness:i,mode:a,setHue:o,setSaturation:s,setLightness:c,setAlpha:l}=Ri(),u=G.hsl(n,r,i),[d,f]=(0,B.useState)(null),p=(e,t)=>{try{if(a===`hex`){let t=G(e);o(t.hue()),s(t.saturationl()),c(t.lightness()),l(t.alpha()*100)}else if((a===`rgb`||a===`hsl`)&&t!==void 0){let n=u[a]().array().map(e=>Math.round(e));n[t]=parseInt(e,10)||0;let r=G[a](n[0],n[1],n[2]);o(r.hue()),s(r.saturationl()),c(r.lightness())}}catch{}};if(a===`hex`){let n=u.hex();return(0,V.jsx)(`div`,{className:R(`relative flex w-full items-center -space-x-px rounded-md`,e),...t,children:(0,V.jsx)(An,{className:`h-8 px-2 font-mono text-xs shadow-none`,type:`text`,value:d??n,onBlur:()=>{f(null)},onChange:e=>{f(e.target.value),p(e.target.value)}})})}if(a===`rgb`||a===`hsl`){let n=u[a]().array().map(e=>Math.round(e));return(0,V.jsx)(`div`,{className:R(`flex flex-1 items-stretch -space-x-px rounded-md`,e),...t,children:n.map((e,t)=>(0,V.jsx)(An,{className:R(`h-8 flex-1 px-2 font-mono text-xs shadow-none focus:z-10`,t&&`rounded-l-none`,t<n.length-1&&`rounded-r-none`),maxLength:3,size:4,type:`text`,value:e,onChange:e=>{p(e.target.value,t)}},t))})}return null},Ki=e=>(0,V.jsxs)(zi,{className:`w-auto min-w-80`,...e,children:[(0,V.jsx)(Bi,{className:`aspect-square`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Hi,{}),(0,V.jsx)(Vi,{})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Wi,{}),(0,V.jsx)(Gi,{})]})]}),qi=()=>{let{isDirty:e}=x(),t=()=>{window.location.hash=`/`};return(0,V.jsx)(L,{className:`text-grey-700 hover:text-grey-900!`,"data-testid":`exit-settings`,icon:`close`,id:`done-button`,label:``,link:!0,title:`Close (ESC)`,onClick:()=>Ye(e,t)})},Ji=(e,t)=>{let[n,r]=(0,B.useState)(`Save`),[i,a]=(0,B.useState)(!1);return{savingTitle:n,isSaving:i,onSaveClick:async()=>{a(!0),r(`Saving`),await e({fakeWhenUnchanged:t}),setTimeout(()=>{r(`Saved`),setTimeout(()=>{r(`Save`),a(!1)},1e3)},1e3)}}},Yi=w.create(({afterClose:e})=>{let{localSettings:t,handleSave:n,updateSetting:r}=N(),i=E(),[a,o]=z(t,[`codeinjection_head`,`codeinjection_foot`]),[s,c]=(0,B.useState)(`header`),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>Pt(()=>import(`./dist-DVfKxKHo.js`).then(e=>e.html()),__vite__mapDeps([26,24,27,28,1,29,25]),import.meta.url),[]),f={extensions:[d],hint:`Code here will be injected into the {{ghost_head}} tag on every page of the site`,value:a||``,onChange:e=>r(`codeinjection_head`,e)},p={extensions:[d],hint:`Code here will be injected into the {{ghost_foot}} tag on every page of the site`,value:o||``,onChange:e=>r(`codeinjection_foot`,e)},m=[{id:`header`,title:`Site header`,contents:(0,V.jsx)(hr,{height:`full`,...f,ref:l,className:`mt-2`,"data-testid":`header-code`,autoFocus:!0}),tabWrapperClassName:`flex-auto`,containerClassName:`h-full`},{id:`footer`,title:`Site footer`,contents:(0,V.jsx)(hr,{height:`full`,...p,ref:u,className:`mt-2`,"data-testid":`footer-code`}),tabWrapperClassName:`flex-auto`,containerClassName:`h-full`}],{savingTitle:h,isSaving:g,onSaveClick:_}=Ji(n,!0);return(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),_())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}}),(0,V.jsx)(re,{afterClose:e,backDropClick:!1,cancelLabel:`Close`,footer:(0,V.jsx)(V.Fragment,{}),height:`full`,size:`full`,testId:`modal-code-injection`,children:(0,V.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,V.jsx)(T,{level:2,children:`Code injection`}),(0,V.jsx)(ue,{buttons:[{label:`Close`,color:`outline`,onClick:()=>{i.remove(),e?.()}},{disabled:g,label:h,color:h===`Saved`?`green`:`black`,onClick:_}]})]}),(0,V.jsx)(Ze,{containerClassName:`flex-auto flex flex-col mb-16`,selectedTab:s,tabs:m,onTabChange:c})]})})}),J=({keywords:e,navid:t,children:n,...r})=>{let{checkVisible:i,noResult:a,registerComponent:o,unregisterComponent:s}=ot(),{route:c}=P(),[l,u]=(0,B.useState)(!1),{ref:d}=Fe(t),f=(0,B.useId)(),p=ze(t||`component`,f);(0,B.useEffect)(()=>(o(p,e),()=>{s(p)}),[p,e,o,s]),(0,B.useEffect)(()=>{if(u(c===t),c===t){let e=setTimeout(()=>u(!1),2e3);return()=>clearTimeout(e)}},[c,t]);let m=B.Children.toArray(n).some(e=>B.isValidElement(e)&&e.type===`img`)?(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl bg-grey-50 md:-mx-7 md:-mb-7`,children:B.Children.map(n,e=>B.isValidElement(e)&&e.type===`img`?B.cloneElement(e,{className:`${e.props.className||``} h-full w-full rounded-b-xl`.trim()}):e)}):n;return(0,V.jsx)(Ge,{ref:d,highlight:l,isVisible:i(e)||a,navid:t,...r,children:m})},Xi=j(({keywords:e})=>(0,V.jsx)(J,{customHeader:(0,V.jsxs)(`div`,{className:`z-10 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`Add custom code to your publication.`,title:`Code injection`}),(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Open`,size:`sm`,onClick:()=>{w.show(Yi)}})]}),description:`Add custom code to your publication`,keywords:e,navid:`code-injection`,testId:`code-injection`,title:`Code injection`}),`Code injection`),Zi=f({method:`POST`,path:()=>`/db/`,body:e=>{let t=new FormData;return t.append(`importfile`,e),t}}),Qi=f({method:`DELETE`,path:()=>`/db/`}),$i=()=>s(`/db/`),ea=f({method:`POST`,path:()=>`/authentication/reset/`}),ta=j(({keywords:e})=>{let{mutateAsync:t}=Qi(),{mutateAsync:n}=ea(),{mutateAsync:r}=pr(),a=i(),o=p(),{config:s}=I(),{totalUsers:l}=Ct(),d=!!s?.labs?.dangerZoneResetAuth,f=l===1?`You will be signed out and must reset your password before signing back in.`:l>1?`All ${l} staff users, including you, will be signed out and must reset their password before signing back in.`:`All staff users, including you, will be signed out and must reset their password before signing back in.`;return(0,V.jsx)(J,{customHeader:(0,V.jsx)(Ne,{description:`Destructive actions that affect your entire site.`,title:`Danger zone`}),keywords:e,navid:`dangerzone`,testId:`dangerzone`,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Delete all content`,color:`red`,label:`Delete`,onClick:()=>{w.show(M,{title:`Would you really like to delete all content from your blog?`,prompt:`This is permanent! No backups, no restores, no magic undo button. We warned you, k?`,okColor:`red`,okLabel:`Delete`,onOk:async e=>{try{await t(null),u({title:`All content deleted from database.`,type:`success`}),e?.remove(),await a.refetchQueries()}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Permanently delete all posts and tags from the database.`,testId:`delete-all-content`,title:`Delete all content`}),d&&(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Reset all authentication`,color:`red`,label:`Reset`,onClick:()=>{w.show(M,{title:`Reset all authentication?`,prompt:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4`,children:[`This rotates every API key on your site. Any integration using one will stop working until you reconfigure it with the new key from `,(0,V.jsx)(`strong`,{children:`Settings → Advanced → Integrations`}),`.`]}),(0,V.jsxs)(`p`,{children:[f,` Your members aren't affected.`]})]}),okLabel:`Reset all authentication`,okRunningLabel:`Resetting...`,okColor:`red`,onOk:async e=>{try{let t=(await n(null))?.security_action?.[0],r=t?.api_keys_rotated??0,i=t?.users_locked??0;u({title:`Rotated ${r} API ${r===1?`key`:`keys`} and locked ${i} ${i===1?`user`:`users`}. You will be signed out shortly.`,type:`success`}),e?.remove(),window.location.href=c().adminRoot}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Rotate every API key, sign out every staff user, and require a password reset. Use after a suspected credential compromise.`,testId:`reset-all-authentication`,title:`Reset all authentication`}),(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Reset all gift links`,color:`red`,label:`Reset`,onClick:()=>{w.show(M,{title:`Reset all gift links?`,prompt:`This immediately invalidates every active gift link across your site. Anyone holding one will lose access. New gift links can still be created afterwards.`,okLabel:`Reset all gift links`,okRunningLabel:`Resetting...`,okColor:`red`,onOk:async e=>{try{let t=(await r(null))?.meta?.count??0;ae(`All Gift Links Reset`),u({title:`Reset ${t} gift ${t===1?`link`:`links`}.`,type:`success`}),e?.remove()}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Invalidate every active gift link across your site. Anyone holding one will lose access.`,testId:`reset-all-gift-links`,title:`Reset all gift links`})]})})},`Danger zone`),na=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`View history`,size:`sm`,onClick:()=>{t(`history/view`)}}),description:`View system event log`,keywords:e,navid:`history`,testId:`history`,title:`History`})},`History`),ra=``+new URL(`integrations-settings-Ba5Zx8yQ.png`,import.meta.url).href,ia=({icon:e,title:t,detail:n,action:r,onDelete:i,active:a,disabled:o,testId:s,custom:c=!1})=>{let{updateRoute:l}=P(),u=e=>{e?.stopPropagation(),o?l({route:`pro`,isExternal:!0}):r()};return(0,V.jsx)(we,{action:c?(0,V.jsx)(L,{color:`red`,label:`Delete`,link:!0,onClick:e=>{e?.stopPropagation(),i?.()}}):o?(0,V.jsx)(L,{icon:`lock-locked`,label:`Upgrade`,link:!0,onClick:u}):(0,V.jsx)(L,{color:`green`,label:`Configure`,link:!0,onClick:u}),avatar:e,className:o?`opacity-50 saturate-0`:``,detail:n,hideActions:!o,testId:s,title:a?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t,` `,(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-1.5 py-px text-xs font-semibold tracking-wide text-green uppercase`,children:`Active`})]}):t,onClick:u})},aa=()=>{let{config:e}=I(),{updateRoute:t}=P(),n=e=>{t(e)},r=e.hostSettings?.limits?.customIntegrations?.disabled,i=gt(),{settings:a}=I(),[o,s,c,u,d]=z(a,[`unsplash`,`firstpromoter`,`slack_url`,`slack_username`,`transistor`]),f=[{detail:`Automation for your apps`,disabled:r,icon:(0,V.jsx)(l,{name:`zapier`,size:32}),modal:`integrations/zapier`,testId:`zapier-integration`,title:`Zapier`},{active:!!(c&&u),detail:`A messaging app for teams`,icon:(0,V.jsx)(l,{name:`slack`,size:32}),modal:`integrations/slack`,testId:`slack-integration`,title:`Slack`},{active:!!o,detail:`Beautiful, free photos`,icon:(0,V.jsx)(l,{name:`unsplash`,size:32}),modal:`integrations/unsplash`,testId:`unsplash-integration`,title:`Unsplash`},{active:!!s,detail:`Launch your member referral program`,icon:(0,V.jsx)(l,{name:`firstpromoter`,size:32}),modal:`integrations/firstpromoter`,testId:`firstpromoter-integration`,title:`FirstPromoter`},{active:i.isEnabled,detail:`Advanced image editing`,icon:(0,V.jsx)(l,{name:`pintura`,size:32}),modal:`integrations/pintura`,testId:`pintura-integration`,title:`Pintura`},{active:!!d,detail:`Give your members access to private podcasts`,disabled:r,icon:(0,V.jsx)(l,{name:`transistor`,size:32}),modal:`integrations/transistor`,testId:`transistor-integration`,title:`Transistor.fm`},{detail:`Access your content programmatically`,icon:(0,V.jsx)(l,{name:`angle-brackets`,size:32}),modal:`integrations/contentapi`,testId:`content-api-integration`,title:`Content API`}];return(0,V.jsx)(A,{titleSeparator:!1,children:[...f.filter(e=>!e.disabled),...f.filter(e=>e.disabled)].map(e=>(0,V.jsx)(ia,{action:()=>{n(e.modal)},active:e.active,detail:e.detail,disabled:e.disabled,icon:e.icon,testId:e.testId,title:e.title},e.testId))})},oa=({integrations:e})=>{let{updateRoute:t}=P(),{mutateAsync:n}=pt(),r=p();return e.length?(0,V.jsx)(A,{borderTop:!1,children:e.map(e=>(0,V.jsx)(ia,{action:()=>t({route:`integrations/${e.id}`}),detail:(0,V.jsx)(`div`,{className:`line-clamp-2 break-words`,children:(0,V.jsx)(`span`,{title:`${e.name}: ${e.description||`No description`}`,children:e.description||`No description`})}),icon:e.icon_image?(0,V.jsx)(`img`,{className:`size-8 shrink-0 object-cover`,role:`presentation`,src:e.icon_image}):(0,V.jsx)(l,{className:`w-8 shrink-0`,name:`integration`}),title:e.name,custom:!0,onDelete:()=>{w.show(M,{title:`Are you sure?`,prompt:`Deleting this integration will remove all webhooks and api keys associated with it.`,okColor:`red`,okLabel:`Delete Integration`,onOk:async t=>{try{await n(e.id),t?.remove(),u({title:`Integration deleted`,type:`info`,options:{position:`bottom-left`}})}catch(e){r(e)}}})}},e.id))}):(0,V.jsx)(oe,{icon:`integration`,children:`No custom integration.`})},sa=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`built-in`),{data:{integrations:r}={integrations:[]}}=O(),{updateRoute:i}=P(),a=[{id:`built-in`,title:`Built-in`,contents:(0,V.jsx)(aa,{})},{id:`custom`,title:`Custom`,contents:(0,V.jsx)(oa,{integrations:r.filter(e=>e.type===`custom`)})}];return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px] inline-flex h-7 cursor-pointer items-center justify-center rounded px-3 font-semibold whitespace-nowrap text-grey-900 transition hover:bg-grey-200 dark:text-white dark:hover:bg-grey-900 [&:hover]:text-black`,color:`clear`,label:`Add custom integration`,link:!0,onClick:()=>{i(`integrations/new`),n(`custom`)}}),customHeader:(0,V.jsxs)(`div`,{className:`sm:-mt-5 md:-mt-7`,children:[(0,V.jsx)(`div`,{className:`-mx-5 overflow-hidden rounded-t-xl border-b border-grey-200 md:-mx-7 dark:border-grey-800`,children:(0,V.jsx)(`img`,{className:`size-full`,src:ra})}),(0,V.jsxs)(`div`,{className:` z-10 mt-6 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`Make Ghost work with apps and tools.`,title:`Integrations`}),(0,V.jsx)(L,{className:`mt-[-5px] inline-flex h-7 cursor-pointer items-center justify-center rounded px-3 font-semibold whitespace-nowrap text-grey-900 transition hover:bg-grey-200 dark:text-white dark:hover:bg-grey-900 [&:hover]:text-black`,color:`clear`,label:`Add custom integration`,link:!0,onClick:()=>{i(`integrations/new`),n(`custom`)}})]})]}),keywords:e,navid:`integrations`,testId:`integrations`,children:(0,V.jsx)(Ze,{selectedTab:t,tabs:a,onTabChange:n})})},`Integrations`),ca=w.create(({title:e,prompt:t,okLabel:n,okRunningLabel:r=`Enabling...`,onConfirm:i})=>{let a=E(),[o,s]=B.useState(!1);return(0,V.jsx)(re,{backDropClick:!1,buttonsDisabled:o,cancelLabel:`Cancel`,okLabel:o?r:n,testId:`feature-toggle-confirmation-modal`,title:e,width:540,onCancel:()=>{a.remove()},onOk:async()=>{s(!0);try{await i()&&a.remove()}finally{s(!1)}},children:(0,V.jsx)(`div`,{className:`py-4`,children:t})})}),la=({label:e,flag:t,disabled:n,confirmation:r})=>{let{settings:a}=I(),o=JSON.parse(Wn(a,`labs`)||`{}`),{mutateAsync:s}=Vn(),c=i(),l=p(),u=!!o[t],d=async e=>{try{return await s([{key:`labs`,value:JSON.stringify({...o,[t]:e})}]),ae(`Feature Toggled`,{state:e?`on`:`off`,feature:t}),c.setQueriesData([Xn],n=>({config:{...n.config,labs:{...n.config.labs,[t]:e}}})),!0}catch(e){return l(e),!1}};return(0,V.jsx)(wt,{checked:u,disabled:n,label:e,labelClasses:`sr-only`,name:`feature-${t}`,onChange:async()=>{let e=!u;if(r&&e){w.show(ca,{...r,onConfirm:()=>d(e)});return}await d(e)}})},ua=({title:e,detail:t,action:n})=>(0,V.jsx)(we,{action:n,bgOnHover:!1,detail:t,paddingRight:!1,title:e}),da=f({method:`POST`,path:()=>`/redirects/upload/`,body:e=>{let t=new FormData;return t.append(`redirects`,e),t}}),fa=()=>s(`/redirects/download/`),pa=f({method:`POST`,path:()=>`/settings/routes/yaml/`,body:e=>{let t=new FormData;return t.append(`routes`,e),t}}),ma=()=>s(`/settings/routes/yaml/`),ha=()=>{let{settings:e}=I(),{mutateAsync:t}=da(),{mutateAsync:n}=pa(),r=p(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1);return(0,V.jsxs)(A,{titleSeparator:!1,children:[(0,V.jsx)(ua,{action:(0,V.jsx)(la,{confirmation:{title:`Automations (beta)`,prompt:`This is a one-way street. Once enabled, the automations beta can't be turned off. Existing welcome emails will move into your automations automatically.`,okLabel:`Enable`,okRunningLabel:`Enabling...`},disabled:!!JSON.parse(Wn(e,`labs`)||`{}`).automations,flag:`automations`,label:`Automations (beta)`}),detail:(0,V.jsxs)(V.Fragment,{children:[`Build automated email flows for your members, and get early access to new automation features as they ship. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/automations-beta`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more →`})]}),title:`Automations (beta)`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`superEditors`}),detail:(0,V.jsx)(V.Fragment,{children:`Allows newly-assigned editors to manage members and comments in addition to regular roles.`}),title:`Enhanced Editor role (beta)`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`editorExcerpt`}),detail:(0,V.jsx)(V.Fragment,{children:`Adds the excerpt input below the post title in the editor`}),title:`Show post excerpt inline`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`additionalPaymentMethods`}),detail:(0,V.jsxs)(V.Fragment,{children:[`Enable support for CashApp, iDEAL, Bancontact, and others. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/payment-methods`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more →`})]}),title:`Additional payment methods`}),(0,V.jsx)(ua,{action:(0,V.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,V.jsx)(je,{id:`upload-redirects`,onUpload:async e=>{try{a(!0),await t(e),u({title:`Redirects uploaded`,type:`success`})}catch(e){r(e)}finally{a(!1)}},children:(0,V.jsx)(L,{color:`grey`,label:i?`Uploading ...`:`Upload redirects file`,size:`sm`,tag:`div`})}),(0,V.jsx)(L,{color:`green`,label:`Download current redirects`,link:!0,onClick:()=>fa()})]}),detail:(0,V.jsxs)(V.Fragment,{children:[`Configure redirects for old or moved content, `,(0,V.jsx)(`br`,{}),` more info in the `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/tutorials/implementing-redirects/`,rel:`noopener noreferrer`,target:`_blank`,children:`docs`})]}),title:`Redirects`}),(0,V.jsx)(ua,{action:(0,V.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,V.jsx)(je,{id:`upload-routes`,onUpload:async e=>{try{s(!0),await n(e),u({type:`success`,title:`Routes uploaded`})}catch(e){r(e)}finally{s(!1)}},children:(0,V.jsx)(L,{color:`grey`,label:o?`Uploading ...`:`Upload routes file`,size:`sm`,tag:`div`})}),(0,V.jsx)(L,{color:`green`,label:`Download current routes`,link:!0,onClick:()=>ma()})]}),detail:`Configure dynamic routing by modifying the routes.yaml file`,title:`Routes`})]})},ga=`data:image/svg+xml,%3csvg%20width='267'%20height='285'%20viewBox='0%200%20267%20285'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='165'%20cy='183'%20r='102'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='68'%20cy='71'%20r='31'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='99'%20cy='17'%20r='17'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='118'%20cy='70'%20r='7'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='45'%20cy='32'%20r='3'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='12.5'%20cy='83.5'%20r='12.5'%20fill='%23F1F3F4'/%3e%3c/svg%3e`,_a=[{title:`Automations`,description:`Toggle the automations beta. Unexpected problems can occur if you turn this off after previously turning it on.`,flag:`automations`},{title:`Automations analytics`,description:`Show analytics for automations. Assumes the "automations" flag is also on.`,flag:`automationAnalytics`},{title:`Stripe Automatic Tax (private beta)`,description:`Use Stripe Automatic Tax at Stripe Checkout. Needs to be enabled in Stripe`,flag:`stripeAutomaticTax`},{title:`Email customization (internal beta)`,description:`Newsletter customization settings that have been released to Ghost's own production sites`,flag:`emailCustomization`},{title:`Import Member Tier`,description:`Enables tier to be specified when importing members`,flag:`importMemberTier`},{title:`CSV Content Importer`,description:`Enables importing posts from CSV files in the Universal Importer`,flag:`csvContentImporter`},{title:`Admin UI Refresh`,description:`Enable Admin UI refresh (exploration)`,flag:`adminUIRefresh`},{title:`Explore`,description:`Enables keeping in touch with the new Explore API`,flag:`explore`},{title:`Tags X`,description:`Enables the new Tags UI`,flag:`tagsX`},{title:`Email Unique ID`,description:`Enables {uniqueid} variable in emails for unique image URLs to bypass ESP image caching`,flag:`emailUniqueid`},{title:`Updated theme translation (beta)`,description:`Enable theme translation using i18next instead of the old translation package.`,flag:`themeTranslation`},{title:`Featurebase Feedback`,description:`Display a Feedback menu item in the admin sidebar. Requires the new admin experience.`,flag:`featurebaseFeedback`},{title:`Picture Element`,description:`Use the HTML picture element to serve modern image formats (AVIF, WebP) with automatic fallbacks`,flag:`pictureImageFormats`},{title:`Smarter Counts`,description:`Use optimized COUNT queries for API pagination when safe`,flag:`smarterCounts`},{title:`Get helper deduplication`,description:`Deduplicate identical {{#get}} helper queries within a single request to avoid redundant database calls`,flag:`getHelperDeduplication`}],va=()=>{let e=Se(),[t,n]=(0,B.useState)([]);return(0,B.useEffect)(()=>{(async()=>{let t=[];for(let n of _a)if(n.limitName&&e?.isLimited(n.limitName))try{await e.errorIfWouldGoOverLimit(n.limitName),t.push(n)}catch(e){e instanceof he||t.push(n)}else t.push(n);n(t)})()},[e]),(0,V.jsx)(A,{titleSeparator:!1,children:t.map(e=>(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:e.flag,label:e.title}),detail:e.description,title:e.title},e.flag))})};function ya(e){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(!1),{filter:i,getVisibleComponents:a,checkVisible:o}=ot();return(0,B.useEffect)(()=>{i||(r.current=!1)},[i]),(0,B.useEffect)(()=>{if(r.current)return;let t=o(e),s=a(),c=!!i&&t&&s.size===1;n(c)},[i,e,o,a]),{isOpen:t,openManually:()=>{r.current=!0,n(!0)},closeManually:()=>{r.current=!0,n(!1)}}}var ba=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`labs-beta-features`),{config:r}=I(),{isOpen:i,openManually:a,closeManually:o}=ya(e),s=[{id:`labs-beta-features`,title:`Beta features`,contents:(0,V.jsx)(ha,{})},r.enableDeveloperExperiments&&{id:`labs-private-features`,title:`Private features`,contents:(0,V.jsx)(va,{})}].filter(Boolean);return(0,V.jsx)(J,{customHeader:(0,V.jsxs)(`div`,{className:`z-10 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`This is a testing ground for new or experimental features. They may change, break or inexplicably disappear at any time.`,title:`Labs`}),(0,V.jsx)(L,{className:`mt-[-5px]`,color:i?`grey`:`clear`,label:i?`Close`:`Open`,size:`sm`,onClick:i?o:a})]}),isEditing:i,keywords:e,navid:`labs`,testId:`labs`,children:i?(0,V.jsx)(Ze,{selectedTab:t,tabs:s,onTabChange:n}):(0,V.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden opacity-70`,children:(0,V.jsx)(`img`,{className:`absolute -top-6 -right-6 dark:opacity-10`,src:ga})})})},`Labs`),xa=()=>{let[e,t]=B.useState(!1),n=p();return(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 pt-4 md:grid-cols-2 lg:grid-cols-3`,children:[(0,V.jsx)(L,{className:`h-9! font-semibold!`,color:`grey`,icon:`export`,iconColorClass:`h-4! w-auto!`,label:`Content & settings`,onClick:()=>$i()}),(0,V.jsx)(L,{className:`h-9! font-semibold!`,color:`grey`,disabled:e,icon:`baseline-chart`,iconColorClass:`h-4! w-auto!`,label:`Post analytics`,loading:e,testId:`post-analytics-export-button`,onClick:async()=>{if(!e){t(!0);try{await d(`/posts/export/?limit=1000`,`posts.analytics.csv`)}catch(e){n(e)}finally{t(!1)}}}})]})},Sa=w.create(()=>{let e=E(),{mutateAsync:t}=Zi(),[n,r]=(0,B.useState)(!1),i=p();return(0,V.jsx)(re,{backDropClick:!1,footer:(0,V.jsxs)(`div`,{className:`flex w-full items-center justify-between p-8`,children:[(0,V.jsx)(vr,{href:`https://docs.ghost.org/migration/ghost`,target:`_blank`,children:`Learn about importing`}),(0,V.jsx)(L,{color:`outline`,disabled:n,label:`Cancel`,onClick:()=>e.remove()})]}),okLabel:``,size:`sm`,testId:`universal-import-modal`,title:`Universal import`,children:(0,V.jsx)(`div`,{className:`py-4`,children:(0,V.jsx)(je,{accept:`application/json, application/zip`,id:`import-file`,onUpload:async n=>{r(!0);try{await t(n),e.remove(),w.show(M,{title:`Import in progress`,prompt:`Your import is being processed, and you'll receive a confirmation email as soon as it’s complete. Usually this only takes a few minutes, but larger imports may take longer.`,cancelLabel:``,okLabel:`Got it`,onOk:e=>e?.remove(),formSheet:!1})}catch(e){i(e)}finally{r(!1)}},children:(0,V.jsx)(`div`,{className:`-mb-4 cursor-pointer bg-grey-50 p-10 text-center dark:bg-grey-950`,children:n?`Uploading...`:(0,V.jsxs)(V.Fragment,{children:[`Select any JSON or zip file that contains `,(0,V.jsx)(`br`,{}),`posts and settings`]})})})})})}),Ca=({icon:e,title:t,onClick:n})=>{let r=D(`flex h-9 cursor-pointer items-center justify-center gap-2 rounded-md bg-grey-100 px-2 font-semibold transition-all hover:bg-grey-200 dark:bg-grey-900`);return n?(0,V.jsxs)(`button`,{className:r,type:`button`,onClick:n,children:[e,t]}):(0,V.jsx)(V.Fragment,{})},wa=()=>{let{updateRoute:e}=P();return(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 pt-4 md:grid-cols-2 lg:grid-cols-3`,children:[(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`substack`,size:18}),title:`Substack`,onClick:()=>e({isExternal:!0,route:`/migrate/substack`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`beehiiv`,size:18}),title:`beehiiv`,onClick:()=>e({isExternal:!0,route:`/migrate/beehiiv`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`wordpress`,size:18}),title:`WordPress`,onClick:()=>e({isExternal:!0,route:`/migrate/wordpress`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`squarespace`,size:18}),title:`Squarespace`,onClick:()=>e({isExternal:!0,route:`/migrate/squarespace`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto dark:invert`,name:`medium`,size:18}),title:`Medium`,onClick:()=>e({isExternal:!0,route:`/migrate/medium`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`mailchimp`,size:20}),title:`Mailchimp`,onClick:()=>e({isExternal:!0,route:`/migrate/mailchimp`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`import`,size:16}),title:`Universal import`,onClick:()=>{w.show(Sa)}})]})},Ta=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`import`),r=[{id:`import`,title:`Import`,contents:(0,V.jsx)(wa,{})},{id:`export`,title:`Export`,contents:(0,V.jsx)(xa,{})}].filter(Boolean);return(0,V.jsx)(J,{customHeader:(0,V.jsx)(Ne,{description:`Import content, members and subscriptions from other platforms or export your Ghost data.`,title:`Migration tools`}),keywords:e,navid:`migration`,testId:`migrationtools`,children:(0,V.jsx)(Ze,{selectedTab:t,tabs:r,onTabChange:n})})},`Migration tools`),Ea=({keywords:e,...t})=>{let{checkVisible:n,noResult:r}=ot();return(0,V.jsx)(xr,{isVisible:n(e)||r,...t})},Y={integrations:[`advanced`,`integrations`,`zapier`,`slack`,`unsplash`,`first promoter`,`firstpromoter`,`pintura`,`disqus`,`analytics`,`ulysses`,`typeform`,`buffer`,`plausible`,`github`,`webhooks`],migrationtools:[`import`,`export`,`migrate`,`substack`,`substack`,`migration`,`medium`,`wordpress`,`wp`,`squarespace`,`beehiiv`],codeInjection:[`advanced`,`code injection`,`head`,`footer`],labs:[`advanced`,`labs`,`alpha`,`private`,`beta`,`flag`,`routes`,`redirect`,`translation`,`editor`,`portal`],history:[`advanced`,`history`,`log`,`events`,`user events`,`staff`,`audit`,`action`],dangerzone:[`danger zone`,`delete all content`,`delete site`,`reset all authentication`,`reset api keys`,`reset password`,`compromised credentials`,`lock staff users`,`sign out all staff`]},Da=()=>(0,V.jsxs)(Ea,{keywords:Object.values(Y).flat(),title:`Advanced`,children:[(0,V.jsx)(sa,{keywords:Y.integrations}),(0,V.jsx)(Ta,{keywords:Y.migrationtools}),(0,V.jsx)(Xi,{keywords:Y.codeInjection}),(0,V.jsx)(ba,{keywords:Y.labs}),(0,V.jsx)(na,{keywords:Y.history}),(0,V.jsx)(ta,{keywords:Y.dangerzone})]}),Oa=[{label:`Free members`,value:`status:free`,color:`green`},{label:`Paid members`,value:`status:-free`,color:`pink`}],ka=(e,t)=>{let n=Ht({path:`/tiers/`,filterKey:`name`,responseKey:`tiers`}),r=Ht({path:`/labels/`,filterKey:`name`,responseKey:`labels`}),i=Ht({path:`/offers/`,filterKey:`name`,responseKey:`offers`}),[a,o]=(0,B.useState)(null),s=e=>({value:e.id,label:e.name,color:`black`}),c=e=>({value:`label:${e.slug}`,label:e.name,color:`grey`}),l=e=>({value:`offer_redemptions:${e.id}`,label:e.name,color:`black`}),u=async(e,t)=>{let[o,u,f]=await Promise.all([n.loadData(e),r.loadData(e),i.loadData(e)]),p=[{options:Oa.filter(({label:t})=>t.toLowerCase().includes(e.toLowerCase()))},{label:`Active Tiers`,options:o.filter(({active:e,type:t})=>e&&t!==`free`).map(s)||[]},{label:`Archived Tiers`,options:o.filter(({active:e})=>!e).map(s)||[]},{label:`Labels`,options:u.map(c)||[]},{label:`Offers`,options:f.map(l)||[]}];a===null&&d(),t(p.filter(e=>e.options.length>0))},d=async()=>{let e=t?.split(`,`)||[],a=[],u=[],d=[];for(let t of e)t.startsWith(`label:`)?u.push(t.replace(`label:`,``)):t.startsWith(`offer_redemptions:`)?d.push(t.replace(`offer_redemptions:`,``)):be(t)&&a.push(t);let f=await Promise.all([n.loadInitialValues(a,`id`).then(e=>e.map(s)),r.loadInitialValues(u,`slug`).then(e=>e.map(c)),i.loadInitialValues(d,`id`).then(e=>e.map(l))]).then(e=>e.flat());o(e.map(e=>f.find(t=>t.value===e)))};return(0,B.useEffect)(()=>{e===`segment`&&u(``,()=>{})},[e]),{loadOptions:Ue(u,500),selectedSegments:a,setSelectedSegments:o}},Aa=[{label:`Whoever has access to the post`,hint:`Free posts to everyone, premium posts sent to paid members`,value:`visibility`},{label:`All members`,hint:`Everyone who is subscribed to newsletter updates, whether free or paid members`,value:`all-members`},{label:`Paid-members only`,hint:`People who have a premium subscription`,value:`paid-only`},{label:`Specific people`,hint:`Only people with any of the selected tiers or labels`,value:`segment`},{label:`Usually nobody`,hint:`Newsletters are off for new posts, but can be enabled when needed`,value:`none`}];function ja({defaultEmailRecipients:e,defaultEmailRecipientsFilter:t}){return e===`filter`?t===`status:free,status:-free`?`all-members`:t===`status:-free`?`paid-only`:t===null?`none`:`segment`:e}var Ma=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l]=z(t,[`editor_default_email_recipients`,`editor_default_email_recipients_filter`]),[u,d]=(0,B.useState)(ja({defaultEmailRecipients:c,defaultEmailRecipientsFilter:l})),{loadOptions:f,selectedSegments:p,setSelectedSegments:m}=ka(u,l);(0,B.useEffect)(()=>{let e=ja({defaultEmailRecipients:c,defaultEmailRecipientsFilter:l});d(e)},[c,l]);let h=e=>{[`visibility`,`disabled`].includes(e)?(o(`editor_default_email_recipients`,e),o(`editor_default_email_recipients_filter`,null)):o(`editor_default_email_recipients`,`filter`),e===`all-members`&&o(`editor_default_email_recipients_filter`,`status:free,status:-free`),e===`paid-only`&&o(`editor_default_email_recipients_filter`,`status:-free`),e===`none`&&o(`editor_default_email_recipients_filter`,null),d(e),n||s(!0)};return(0,V.jsx)(J,{description:`When you publish new content, who do you usually want to send it to?`,isEditing:n,keywords:e,navid:`default-recipients`,saveState:r,testId:`default-recipients`,title:`Default recipients`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:i,children:(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(De,{hint:`Who should receive your posts by default?`,options:Aa,selectedOption:Aa.find(e=>e.value===u),testId:`default-recipients-select`,title:`Default Newsletter recipients`,onSelect:e=>{e&&h(e.value)}}),u===`segment`&&p&&(0,V.jsx)(de,{loadOptions:f,title:`Filter`,values:p,async:!0,defaultOptions:!0,onChange:e=>{if(m(e),e.length){let t=e?.map(({value:e})=>e).join(`,`);o(`editor_default_email_recipients_filter`,t)}else o(`editor_default_email_recipients_filter`,null),d(`none`);n||s(!0)}})]})})},`Default recipients`),Na=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Vn(),{updateRoute:r}=P(),i=p(),[a,o]=z(t,[`editor_default_email_recipients`,`members_signup_access`]),s=o===`none`;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(wt,{checked:a!==`disabled`&&!s,direction:`rtl`,disabled:s,onChange:async e=>{let t=[{key:`editor_default_email_recipients`,value:e.target.checked?`visibility`:`disabled`}];e.target.checked||t.push({key:`editor_default_email_recipients_filter`,value:null});try{await n(t)}catch(e){i(e)}}})}),description:`Newsletter features are active, posts can be sent by email`,keywords:e,navid:`enable-newsletters`,testId:`enable-newsletters`,title:`Newsletter sending`,children:(0,V.jsx)(F,{columns:1,values:[{key:`private`,value:a!==`disabled`&&!s?(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(l,{colorClass:`text-green`,name:`check`,size:`sm`}),(0,V.jsx)(`span`,{children:`Enabled`})]})}):(0,V.jsxs)(`div`,{className:`w-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-grey-900`,children:[(0,V.jsx)(l,{colorClass:`text-grey-600`,name:`mail-block`,size:`sm`}),(0,V.jsx)(`span`,{children:`Disabled`})]}),s&&(0,V.jsxs)(Ae,{className:`mt-6`,color:`grey`,children:[`Your `,(0,V.jsx)(`button`,{className:`underline!`,type:`button`,onClick:()=>{r(`members`)},children:`Subscription access`}),` is set to ‘Nobody’, which disables all newsletter sending. Change to ‘Invite-only’ to send newsletters to existing members without allowing new signups.`]})]})}]})})},`Newsletter sending`),Pa=[{label:`🇺🇸 US`,value:`https://api.mailgun.net/v3`},{label:`🇪🇺 EU`,value:`https://api.eu.mailgun.net/v3`}],Fa=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),{mutateAsync:c}=Vn(),l=p(),[u,d,f]=z(t,[`mailgun_base_url`,`mailgun_domain`,`mailgun_api_key`]),m=(0,V.jsx)(F,{columns:1,values:d&&f?[{key:`status`,value:(0,V.jsx)(_r,{icon:`check-circle`,iconColorClass:`text-green`,children:`Mailgun is set up`})}]:[{heading:`Status`,key:`status`,value:`Mailgun is not set up`}]}),h=(0,V.jsxs)(V.Fragment,{children:[`Find your Mailgun API keys `,(0,V.jsx)(vr,{href:`https://app.mailgun.com/settings/api_security`,rel:`noopener noreferrer`,target:`_blank`,children:`here`})]}),g=(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`grid grid-cols-[120px_auto] gap-x-3 gap-y-6`,children:[(0,V.jsx)(De,{options:Pa,selectedOption:Pa.find(e=>e.value===u),title:`Mailgun region`,onSelect:e=>{o(`mailgun_base_url`,e?.value||null)}}),(0,V.jsx)(k,{title:`Mailgun domain`,value:d,onChange:e=>{o(`mailgun_domain`,e.target.value)}}),(0,V.jsx)(`div`,{className:`col-span-2`,children:(0,V.jsx)(k,{hint:h,title:`Mailgun private API key`,type:`password`,value:f,onChange:e=>{o(`mailgun_api_key`,e.target.value)}})})]})});return(0,V.jsx)(J,{description:(0,V.jsxs)(V.Fragment,{children:[`The Mailgun API is used for bulk email newsletter delivery. `,(0,V.jsx)(vr,{href:`https://ghost.org/docs/faq/mailgun-newsletters/`,target:`_blank`,children:`Why is this required?`})]}),isEditing:n,keywords:e,navid:`mailgun`,saveState:r,testId:`mailgun`,title:`Mailgun`,onCancel:a,onEditingChange:s,onSave:async()=>{if(!u)try{await c([{key:`mailgun_base_url`,value:Pa[0].value}])}catch(e){l(e);return}i()},children:n?g:m})},`Mailgun`),Ia=({id:e,setRef:t,isDragging:n,style:r,children:i,separator:a,...o})=>{let{updateRoute:s}=P(),c=()=>{s({route:`newsletters/${e}`})},l=(0,V.jsxs)(lt,{ref:t,action:(0,V.jsx)(L,{color:`green`,"data-testid":`edit-newsletter-button`,label:`Edit`,link:!0,onClick:c}),className:n?`opacity-75`:``,hideActions:!1,style:r,onClick:c,children:[(o.dragHandleAttributes||n)&&(0,V.jsx)(_t,{className:`w-10 align-middle!`,children:(0,V.jsx)(Le,{className:`h-10`,isDragging:n||!1,...o})}),i]});return n?(0,V.jsx)(St,{children:l}):l},La=({newsletter:e})=>{let{updateRoute:t}=P(),n=()=>{t({route:`newsletters/${e.id}`})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_t,{className:`w-full`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight text-grey-700`,children:e.description||`No description`})]})}),(0,V.jsx)(_t,{className:`hidden md:visible! md:table-cell! md:min-w-[11rem]`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{children:on(e.count?.active_members||0)}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight whitespace-nowrap text-grey-700`,children:`Subscribers`})]})}),(0,V.jsx)(_t,{className:`hidden md:visible! md:table-cell! md:min-w-[11rem]`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{children:on(e.count?.posts||0)}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight whitespace-nowrap text-grey-700`,children:`Delivered`})]})})]})},Ra=({newsletters:e,isLoading:t,isSortable:n,onSort:r})=>t?(0,V.jsx)(St,{isLoading:!0}):e.length&&n?(0,V.jsx)(bt,{container:e=>(0,V.jsx)(Ia,{...e}),items:e,renderItem:e=>(0,V.jsx)(La,{newsletter:e}),wrapper:St,onMove:(e,t)=>r?.(e,t)}):e.length?(0,V.jsx)(St,{children:e.map(e=>(0,V.jsx)(Ia,{id:e.id,children:(0,V.jsx)(La,{newsletter:e})},e.id))}):(0,V.jsx)(oe,{icon:`mail-block`,children:`No newsletters found.`}),za=({id:e,children:t})=>{let n=E(),{updateRoute:r}=P();return(0,V.jsx)(`button`,{className:`text-green`,type:`button`,onClick:()=>{r(`newsletters/${e}`),n.remove()},children:t})},Ba=j(({keywords:e})=>{let{updateRoute:t}=P(),n=()=>{t(`newsletters/new`)},[r,a]=(0,B.useState)(`active-newsletters`),{data:{newsletters:o,meta:s,isEnd:c}={},isLoading:l,fetchNextPage:u}=or(),{mutateAsync:d}=ar(),f=i(),m=Me().getParam(`verifyEmail`),{mutateAsync:h}=ir(),_=p(),[v,y]=(0,B.useState)(o||[]);(0,B.useEffect)(()=>{y(o||[])},[o]),(0,B.useEffect)(()=>{!m||!window.location.href.includes(`newsletters`)||(async()=>{try{let{newsletters:[e],meta:{email_verified:t}={}}=await h({token:m}),n,r;t&&t===`sender_email`?(n=`Newsletter email verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` will now be sent from `,(0,V.jsx)(`strong`,{children:e.sender_email}),`.`]})):t&&t===`sender_reply_to`?(n=`Reply-to address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` will now use `,(0,V.jsx)(`strong`,{children:e.sender_reply_to}),` as the reply-to address.`]})):(n=`Email address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Email address for newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` has been changed.`]})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),_(e,{withToast:!1})}})()},[m,_,h]);let b=(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Add newsletter`,size:`sm`,onClick:()=>{n()}}),x=v.filter(e=>e.status===`active`).sort((e,t)=>e.sort_order-t.sort_order)||[],S=v.filter(e=>e.status!==`active`);return(0,V.jsxs)(J,{customButtons:b,description:`Edit details and customize your design`,keywords:e,navid:`newsletters`,testId:`newsletters`,title:`Newsletters`,children:[(0,V.jsx)(Ze,{selectedTab:r,tabs:[{id:`active-newsletters`,title:`Active`,contents:(0,V.jsx)(Ra,{isLoading:l,newsletters:x,isSortable:!0,onSort:async(e,t)=>{let n=x.findIndex(t=>t.id===e),r=x.findIndex(e=>e.id===t)||0,i=Ce(x,n,r).map((e,t)=>e.sort_order===t?null:{...e,sort_order:t}).filter(e=>!!e),a=S.map((e,t)=>e.sort_order===t+x.length?null:{...e,sort_order:t}).filter(e=>!!e),o=[...i,...a].sort((e,t)=>e.sort_order-t.sort_order);y(v.map(e=>o.find(t=>t.id===e.id)||e)),f.setQueriesData([sr],e=>{if(e)return{...e,pages:e.pages.map(e=>({...e,newsletters:e.newsletters.map(e=>o.find(t=>t.id===e.id)||e)}))}});for(let e of o)await d(e)}})},{id:`archived-newsletters`,title:`Archived`,contents:(0,V.jsx)(Ra,{isLoading:l,newsletters:S})}],onTabChange:a}),c===!1&&(0,V.jsx)(L,{label:`Load more (showing ${v?.length||0}/${s?.pagination.total||0} newsletters)`,link:!0,onClick:()=>u()})]})},`Newsletters`),Va={enableNewsletters:[`emails`,`newsletters`,`newsletter sending`,`enable`,`disable`,`turn on`,`turn off`],newsletters:[`newsletters`,`emails`,`design`,`customization`],defaultRecipients:[`newsletters`,`default recipients`,`emails`],mailgun:[`mailgun`,`emails`,`newsletters`]},Ha=()=>{let{settings:e,config:t}=I(),[n]=z(e,[`editor_default_email_recipients`]),r=n!==`disabled`,i=r&&!t.mailgunIsConfigured;return(0,V.jsxs)(Ea,{keywords:[Va.enableNewsletters,...r?[Va.defaultRecipients,Va.newsletters]:[],...i?[Va.mailgun]:[]].flat(),title:`Newsletters`,children:[(0,V.jsx)(Na,{keywords:Va.enableNewsletters}),r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ma,{keywords:Va.defaultRecipients}),(0,V.jsx)(Ba,{keywords:Va.newsletters}),i&&(0,V.jsx)(Fa,{keywords:Va.mailgun})]})]})},Ua=({id:e,children:t})=>{let n=E(),{updateRoute:r}=P();return(0,V.jsx)(`button`,{className:`text-green`,type:`button`,onClick:()=>{r(`newsletters/${e}`),n.remove()},children:t})},Wa=()=>{let e=window.location.hash.slice(1),t=new URL(e||`/`,window.location.origin).pathname;return t.startsWith(`/settings/emails`)||t.startsWith(`/settings/newsletters`)},Ga=j(({filter:e})=>{let{data:{newsletters:t,meta:n,isEnd:r}={},isLoading:a,fetchNextPage:o}=or(),{mutateAsync:s}=ar(),c=i(),l=Me().getParam(`verifyEmail`),{mutateAsync:u}=ir(),d=p(),[f,m]=(0,B.useState)(t||[]);(0,B.useEffect)(()=>{m(t||[])},[t]),(0,B.useEffect)(()=>{!l||!Wa()||(async()=>{try{let{newsletters:[e],meta:{email_verified:t}={}}=await u({token:l}),n,r;t&&t===`sender_email`?(n=`Newsletter email verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` will now be sent from `,(0,V.jsx)(`strong`,{children:e.sender_email}),`.`]})):t&&t===`sender_reply_to`?(n=`Reply-to address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` will now use `,(0,V.jsx)(`strong`,{children:e.sender_reply_to}),` as the reply-to address.`]})):(n=`Email address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Email address for newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` has been changed.`]})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),d(e,{withToast:!1})}})()},[l,d,u]);let h=f.filter(e=>e.status===`active`).sort((e,t)=>e.sort_order-t.sort_order)||[],_=f.filter(e=>e.status!==`active`);return(0,V.jsxs)(V.Fragment,{children:[e===`active`?(0,V.jsx)(Ra,{isLoading:a,isSortable:!0,newsletters:h,onSort:async(e,t)=>{let n=h.findIndex(t=>t.id===e),r=h.findIndex(e=>e.id===t)||0,i=Ce(h,n,r).map((e,t)=>e.sort_order===t?null:{...e,sort_order:t}).filter(e=>!!e),a=_.map((e,t)=>e.sort_order===t+h.length?null:{...e,sort_order:t}).filter(e=>!!e),o=[...i,...a].sort((e,t)=>e.sort_order-t.sort_order);m(f.map(e=>o.find(t=>t.id===e.id)||e)),c.setQueriesData([sr],e=>{if(e)return{...e,pages:e.pages.map(e=>({...e,newsletters:e.newsletters.map(e=>o.find(t=>t.id===e.id)||e)}))}});for(let e of o)await s(e)}}):(0,V.jsx)(Ra,{isLoading:a,newsletters:_}),r===!1&&(0,V.jsx)(L,{label:`Load more (showing ${f?.length||0}/${n?.pagination.total||0} newsletters)`,link:!0,onClick:()=>o()})]})},`Newsletters`),Ka=w.create(({title:e=`Are you sure you want to leave this page?`,description:t=(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{children:`Hey there! It looks like you didn't save the changes you made.`}),(0,V.jsx)(`p`,{children:`Save before you go!`})]})})=>{let n=E(),r=(0,B.useRef)(n.visible),i=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{r.current&&!n.visible&&(n.resolveHide(),n.remove()),r.current=n.visible},[n]),(0,V.jsx)(rr,{open:n.visible,onOpenChange:e=>{e||(n.resolve(i.current),i.current=!1,n.hide())},children:(0,V.jsxs)(kn,{"data-testid":`welcome-email-dirty-confirm-modal`,onEscapeKeyDown:e=>{e.stopPropagation()},children:[(0,V.jsxs)(Dn,{children:[(0,V.jsx)(jn,{children:e}),(0,V.jsx)(Ln,{asChild:!0,children:t})]}),(0,V.jsxs)(zn,{children:[(0,V.jsx)(Rn,{asChild:!0,children:(0,V.jsx)(ln,{variant:`outline`,children:`Stay`})}),(0,V.jsx)(En,{asChild:!0,children:(0,V.jsx)(ln,{variant:`destructive`,onClick:()=>{i.current=!0},children:`Leave`})})]})]})})}),qa=({open:e,title:t,preview:n,sidebar:r,dirty:i=!1,isLoading:a=!1,okProps:o,onSave:s,onClose:c,afterClose:l,testId:u})=>{let d=(0,B.useRef)(s),f=(0,B.useRef)(e);(0,B.useEffect)(()=>{d.current=s},[s]),(0,B.useEffect)(()=>{f.current&&!e&&l?.(),f.current=e},[l,e]),(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),d.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let p=async()=>{if(!i){c();return}await w.show(Ka)&&c()};return(0,V.jsx)(Jn,{open:e,onOpenChange:e=>{e||p()},children:(0,V.jsx)(Hn,{"aria-describedby":void 0,className:R(`top-[50%] left-[50%] h-[calc(100vh-8vmin)] w-[calc(100vw-8vmin)] max-w-none translate-[-50%] gap-0 overflow-hidden p-0`),"data-testid":u,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),p()},children:(0,V.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,V.jsx)(`div`,{className:`hidden min-h-0 flex-1 flex-col bg-gray-50 dark:bg-black [@media(min-width:801px)]:flex`,children:(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8`,children:n})}),(0,V.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col border-l border-gray-200 dark:border-gray-900 [@media(min-width:801px)]:w-[400px] [@media(min-width:801px)]:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-5`,children:[(0,V.jsx)(tr,{children:t}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(ln,{variant:`outline`,onClick:()=>p(),children:`Close`}),(0,V.jsx)(ln,{className:o?.color===`green`?`bg-green text-white hover:bg-green/90`:void 0,disabled:a||o?.disabled,variant:o?.color===`red`?`destructive`:`default`,onClick:s,children:o?.label||`Save`})]})]}),r]})]})})})},Ja=/^#(?:[0-9a-f]{3}){1,2}$/i;function Ya(e){return Ja.test(e)?e:`#ffffff`}function Xa(e,t){return!e||e===`transparent`?`transparent`:e===`accent`?t:Ja.test(e)?e:`transparent`}function Za(e,t,n){return Ja.test(e||``)?e:e===null?Ke(n).hex():t}function Qa(e,t){if(e===`fill`)return Ke(t).hex()}function $a(e,t,n){let r=e===void 0?`accent`:e;return r===`accent`?t:Ja.test(r||``)?r:Ke(n).hex()}function eo(e,t,n){return Ja.test(e||``)?e:e===`accent`?t:Ke(n).hex()}function to(e,t){return Ja.test(e||``)?e:e===`accent`?t:`#e0e7eb`}function no(e,t){let n=Ya(e.background_color),r=Xa(e.header_background_color,t),i=Za(e.button_color,t,n),a=Ke(n).hex(),o=Ke(n).alpha(.5).toString(),s=r===`transparent`?a:Ke(r).hex(),c=r===`transparent`?o:Ke(r).alpha(.5).toString();return{backgroundColor:n,headerBackgroundColor:r,sectionTitleColor:eo(e.section_title_color,t,n),buttonColor:i,buttonTextColor:Qa(e.button_style,i),linkColor:$a(e.link_color,t,n),dividerColor:to(e.divider_color,t),textColor:a,secondaryTextColor:o,headerTextColor:s,secondaryHeaderTextColor:c}}function ro(e){return e===`serif`?`Georgia, serif`:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`}function io(e){switch(e){case`square`:return`rounded-none`;case`pill`:return`rounded-full`;default:return`rounded-[6px]`}}function ao(e){return e===`rounded`?`rounded-md`:``}var oo=({senderName:e,senderEmail:t,replyToEmail:n,subject:r,showRecipientLine:i=!0,showSubjectLine:a=!0})=>{let o=n||t,s=e&&t?`${e} (${t})`:e||t;return!s&&!o&&(!a||!r)?null:(0,V.jsxs)(`div`,{className:`flex flex-col justify-center gap-1 border-b border-grey-200 bg-white p-6 text-grey-700`,children:[s&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`From:`}),` `,s]}),i&&t&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`To:`}),` subscriber@example.com`]}),o&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`Reply-to:`}),` `,o]}),a&&r&&(0,V.jsx)(`div`,{className:`text-base font-medium text-grey-900`,children:r})]})},so=({iconUrl:e,showIcon:t,showTitle:n,siteTitle:r,backgroundColor:i,textColor:a})=>!t&&(!n||!r)?null:(0,V.jsxs)(`div`,{className:`px-[7rem] py-3 text-center`,style:{backgroundColor:i===`transparent`?void 0:i},children:[t&&e&&(0,V.jsx)(`img`,{alt:r||`Publication icon`,className:`mx-auto mb-3 size-12 rounded`,src:e}),n&&r&&(0,V.jsx)(`h4`,{className:`mb-1 text-[1.6rem] leading-tight font-bold tracking-tight uppercase`,style:{color:a},children:r})]}),co=({siteTitle:e,footerLinkText:t=`Unsubscribe`,emailFooter:n,showBadge:r,color:i,textColor:a})=>(0,V.jsxs)(`div`,{className:`flex flex-col items-center pt-10`,children:[n&&(0,V.jsx)(`div`,{className:`px-8 py-3 text-center text-[1.3rem] leading-base break-words whitespace-pre-line`,style:{color:i},children:n}),(0,V.jsxs)(`div`,{className:`px-8 pt-3 pb-14 text-center text-[1.3rem]`,children:[(0,V.jsxs)(`span`,{style:{color:i},children:[e||`Your publication`,` © `,new Date().getFullYear(),` — `]}),(0,V.jsx)(`span`,{className:`underline`,style:{color:i},children:t})]}),r&&(0,V.jsx)(`div`,{className:`flex flex-col items-center pt-[10px] pb-[40px]`,children:(0,V.jsxs)(`span`,{className:`inline-flex items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight`,style:{color:a},children:[(0,V.jsx)(Cr,{className:`mr-[6px] size-4`}),(0,V.jsx)(`span`,{children:`Powered by Ghost`})]})})]}),lo=({settings:e,accentColor:t,publicationIcon:n,siteTitle:r,senderName:i,senderEmail:a,replyToEmail:o,subject:s,showRecipientLine:c=!0,showSubjectLine:l=!0,headerImage:u,showPublicationIcon:d=!1,showPublicationTitle:f=!0,showBadge:p=!0,emailFooter:m,footerLinkText:h,children:g})=>{let _=no(e,t),v=ao(e.image_corners),y=r||void 0;return(0,V.jsxs)(`div`,{className:`mx-auto flex max-h-full min-h-0 w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm`,children:[(0,V.jsx)(oo,{replyToEmail:o,senderEmail:a,senderName:i,showRecipientLine:c,showSubjectLine:l,subject:s}),(0,V.jsxs)(`div`,{className:`min-h-0 w-full flex-1 overflow-y-auto`,style:{backgroundColor:_.backgroundColor},children:[(0,V.jsxs)(`div`,{className:`px-[7rem]`,style:{backgroundColor:_.headerBackgroundColor===`transparent`?void 0:_.headerBackgroundColor},children:[u&&(0,V.jsx)(`div`,{className:`pt-8`,children:(0,V.jsx)(`img`,{alt:`Header`,className:R(`h-auto w-full`,v),src:u})}),(0,V.jsx)(so,{backgroundColor:`transparent`,iconUrl:n,showIcon:d&&!!n,showTitle:f,siteTitle:y,textColor:_.headerTextColor})]}),g,(0,V.jsx)(co,{color:_.secondaryTextColor,emailFooter:m,footerLinkText:h,showBadge:p,siteTitle:y,textColor:_.textColor})]})]})},uo=({value:e,onChange:t})=>{let{mutateAsync:n}=yt(),r=async e=>{t(Ie(await n({file:e})))};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`header-image-field`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-header-image`,children:`Header image`}),e?(0,V.jsxs)(`div`,{className:`relative overflow-hidden rounded-md border border-gray-200 dark:border-gray-800`,children:[(0,V.jsx)(`img`,{alt:`Header`,className:`h-auto w-full`,src:e}),(0,V.jsx)(`button`,{className:`absolute top-2 right-2 rounded bg-black/50 px-2 py-1 text-sm text-white hover:bg-black/70`,type:`button`,onClick:()=>t(``),children:`Remove`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_n,{accept:{"image/*":[`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`,`.svg`]},className:`flex h-24 items-center justify-center p-0`,id:`welcome-email-header-image`,onDropAccepted:e=>e[0]&&r(e[0]),children:(0,V.jsx)(`span`,{className:`text-gray-700`,children:`Upload header image`})}),(0,V.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`1200x600 recommended. Use a transparent PNG for best results on any background.`})]})]})},fo=({value:e,onChange:t})=>(0,V.jsxs)(`div`,{className:`mt-6 flex items-start justify-between gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(nn,{className:`mt-0.5 size-4 shrink-0 text-red-500`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{children:`Promote independent publishing`}),(0,V.jsx)(`span`,{className:`text-sm leading-tight text-muted-foreground`,children:`Show you're a part of the indie publishing movement with a small badge in the footer`})]})]}),(0,V.jsx)(It,{checked:e,size:`sm`,onCheckedChange:t})]}),po=``+new URL(`email-design-user-image-BWe5RYS0.jpg`,import.meta.url).href,mo=(0,B.createContext)(void 0),ho=({settings:e,onSettingsChange:t,accentColor:n,children:r})=>(0,V.jsx)(mo.Provider,{value:{settings:e,onSettingsChange:t,accentColor:n},children:r}),go=()=>{let e=(0,B.useContext)(mo);if(!e)throw Error(`useEmailDesign must be used within an EmailDesignProvider`);return e},_o=()=>{let{settings:e,accentColor:t}=go(),n=no(e,t),r=ro(e.body_font_category),i=io(e.button_corners),a=e.button_style===`outline`,o=R(`no-underline`,e.link_style===`underline`&&`underline`,e.link_style===`bold`&&`font-bold`),s=R(`mb-5 text-[2.6rem] tracking-tighter`,e.title_font_category===`serif`&&`font-serif`,e.title_font_category===`sans_serif`&&`font-sans`,e.title_font_weight===`normal`&&`font-normal`,e.title_font_weight===`medium`&&`font-medium`,e.title_font_weight===`semibold`&&`font-semibold`,e.title_font_weight===`bold`&&`font-bold`),c=R(e.body_font_category===`serif`?`font-serif text-[1.8rem]`:`text-[1.7rem]`);return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-[600px] px-10 pt-16`,children:[(0,V.jsx)(`h3`,{className:s,style:{color:n.sectionTitleColor},children:`Your welcome email`}),(0,V.jsxs)(`div`,{className:R(c),style:{color:n.textColor,fontFamily:r},children:[(0,V.jsx)(`p`,{className:`mt-0 mb-6`,children:`This is what your welcome email will look like when someone signs up to your site.`}),(0,V.jsx)(`p`,{className:`mt-0 mb-8`,children:`Use the settings on the right to shape the design — from colors and typography to layout and buttons — so it feels like a natural extension of your brand.`}),(0,V.jsx)(`div`,{className:R(`h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat`),children:(0,V.jsx)(`img`,{alt:`Example cover image`,className:R(`min-h-full min-w-full shrink-0`,ao(e.image_corners)),src:po})}),(0,V.jsx)(`div`,{className:`mt-1 w-full max-w-[600px] pb-8 text-center text-body-sm`,style:{color:n.secondaryTextColor},children:`Image caption`}),(0,V.jsx)(`p`,{className:`mt-0 mb-6`,children:`Welcome emails set the tone for your relationship with new members. We’ve optimized this template to look great across devices and inboxes, so your first impression lands exactly how you want it.`})]}),(0,V.jsx)(`div`,{className:`my-5 py-4`,children:(0,V.jsx)(`hr`,{className:`m-0 border-0 border-t`,style:{borderColor:n.dividerColor}})}),(0,V.jsx)(`h3`,{className:s,style:{color:n.sectionTitleColor},children:`Need inspiration?`}),(0,V.jsx)(`div`,{className:R(c),style:{color:n.textColor,fontFamily:r},children:(0,V.jsxs)(`p`,{className:`mt-0 mb-6`,children:[`We’ve put together a `,(0,V.jsx)(`a`,{className:o,href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:{color:n.linkColor},target:`_blank`,children:`quick guide`}),` that walks through all the available settings, along with a few examples of what’s possible.`]})}),(0,V.jsx)(`div`,{className:`pb-6`,children:(0,V.jsx)(`a`,{className:R(`inline-block border px-[18px] py-2.5 font-sans text-[15px] no-underline`,i,a?`bg-transparent`:`border-transparent`,e.link_style===`bold`?`font-bold`:`font-semibold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:a?{borderColor:n.buttonColor,color:n.buttonColor}:{backgroundColor:n.buttonColor,color:n.buttonTextColor},target:`_blank`,children:`Learn more`})}),(0,V.jsx)(`div`,{className:`py-4`,children:(0,V.jsx)(`hr`,{className:`m-0 border-0 border-t`,style:{borderColor:n.dividerColor}})})]})},vo=e(Rt(),1),yo=`AutomatedEmailDesignResponseType`,bo=m({dataType:yo,path:`/automated_emails/design/`}),xo=f({method:`PUT`,path:()=>`/automated_emails/design/`,body:e=>({automated_email_design:[e]}),updateQueries:{emberUpdateType:`skip`,dataType:yo,update:e=>e}}),So=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Co=(e,t,n=[])=>{if(e&&So.test(e))return e;switch(e){case`accent`:return t&&So.test(t)?t:`#ffffff`;case`light`:return`#ffffff`;case`transparent`:return`#00000000`;default:break}let r=n.find(t=>t.value===e);return r?r.hex:`#ffffff`},wo=e=>{let t=e.toLowerCase();return t.length===5&&t[4]===`0`||t.length===9&&t.slice(7)===`00`},To=()=>(0,V.jsx)(`span`,{className:`pointer-events-none absolute inset-0 overflow-hidden rounded-full`,"data-testid":`transparent-indicator`,"aria-hidden":!0,children:(0,V.jsx)(`span`,{className:`absolute top-1/2 left-[-30%] block h-px w-[160%] -translate-y-1/2 -rotate-45 bg-red`})}),Eo=({title:e,value:t,onChange:n,accentColor:r,swatches:i=[]})=>{let[a,o]=(0,B.useState)(!1),s=Co(t,r,i),c=(0,B.useRef)(!1),l=(0,B.useRef)(!1),u=(0,B.useRef)(null),d=i.find(e=>e.value===t||t&&e.hex.toLowerCase()===t.toLowerCase()),f=()=>{c.current=!1,l.current=!1},p=(0,B.useCallback)(()=>{u.current&&=(window.removeEventListener(`keydown`,u.current,!0),null)},[]),m=()=>{p(),f(),o(!1)},h=()=>{if(u.current)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),m())};u.current=e,window.addEventListener(`keydown`,e,!0)};return(0,B.useEffect)(()=>()=>{p()},[p]),(0,V.jsxs)(Bn,{open:a,onOpenChange:e=>{f(),e?h():p(),o(e)},children:[(0,V.jsx)(Kn,{asChild:!0,children:(0,V.jsxs)(`div`,{className:`flex w-full cursor-pointer items-start justify-between`,children:[(0,V.jsx)(`span`,{className:`mt-px flex-1`,children:e}),(0,V.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[a&&i.length>0&&(0,V.jsx)(`div`,{className:`flex items-center gap-1`,children:i.map(e=>{let t=e.value===void 0?e.hex:e.value,r=d?.title===e.title;return(0,V.jsx)(`button`,{"aria-label":e.title,className:`relative flex size-5 shrink-0 cursor-pointer items-center overflow-hidden rounded-full border border-grey-300 dark:border-grey-800 ${r?`outline-2 outline-green`:``}`,style:{backgroundColor:e.hex},title:e.title,type:`button`,onClick:()=>{c.current=!1,l.current=!0,n(t),m()},children:wo(e.hex)&&(0,V.jsx)(To,{})},e.title)})}),(0,V.jsxs)(`button`,{"aria-label":`Pick color`,className:`relative size-6 cursor-pointer rounded-full border border-grey-200 dark:border-grey-800`,type:`button`,children:[(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-[conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))]`}),(0,V.jsx)(`div`,{className:`absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950`,style:{backgroundColor:s}})]})]})]})}),(0,V.jsx)(Tn,{align:`end`,className:`w-auto p-4`,onEscapeKeyDown:e=>{e.stopPropagation()},children:(0,V.jsx)(`div`,{onInputCapture:()=>{c.current=!0},onKeyDownCapture:()=>{c.current=!0},onMouseDownCapture:()=>{c.current=!0},onPointerDownCapture:()=>{c.current=!0},onTouchStartCapture:()=>{c.current=!0},children:(0,V.jsx)(Ki,{value:s,onChange:e=>{l.current||!c.current||n(e)}})})})]})},Do=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsx)(Eo,{swatches:[{title:`White`,value:`light`,hex:`#ffffff`}],title:`Background color`,value:e.background_color,onChange:e=>e&&t({background_color:e})})},Oo=[{value:`serif`,label:`Elegant serif`},{value:`sans_serif`,label:`Clean sans-serif`}],ko={sans_serif:{options:[{value:`normal`,label:`Regular`},{value:`medium`,label:`Medium`},{value:`semibold`,label:`Semi-bold`},{value:`bold`,label:`Bold`}]},serif:{options:[{value:`normal`,label:`Regular`},{value:`bold`,label:`Bold`}],map:{medium:`normal`,semibold:`bold`}}};function Ao(e,t){let n=ko[e]||ko.sans_serif;return n.options.find(e=>e.value===t)?t:n.map?.[t]||`bold`}var jo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Body font`}),(0,V.jsxs)(gn,{value:e.body_font_category||`sans_serif`,onValueChange:e=>t({body_font_category:e}),children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:Oo.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Mo=/^#(?:[0-9a-f]{3}){1,2}$/i,No=e=>e===`light`?`#ffffff`:Mo.test(e)?e:`#ffffff`,Po=e=>Ke(No(e)).hex(),Fo=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go(),r=Po(e.background_color);return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Accent`,value:`accent`,hex:n},{title:`Auto`,value:null,hex:r}],title:`Button color`,value:e.button_color,onChange:e=>t({button_color:e})})},Io=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Button corners`}),(0,V.jsxs)(bn,{type:`single`,value:e.button_corners||`rounded`,onValueChange:e=>e&&t({button_corners:e}),children:[(0,V.jsx)(yn,{"aria-label":`Square`,value:`square`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Rounded`,value:`rounded`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-sm border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Pill`,value:`pill`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-full border-[1.5px] border-current`})})]})]})},Lo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Button style`}),(0,V.jsxs)(bn,{type:`single`,value:e.button_style||`fill`,onValueChange:e=>e&&t({button_style:e}),children:[(0,V.jsx)(yn,{"aria-label":`Fill`,value:`fill`,children:(0,V.jsx)(`span`,{className:`inline-block h-4 w-5 rounded-sm bg-current`})}),(0,V.jsx)(yn,{"aria-label":`Outline`,value:`outline`,children:(0,V.jsx)(`span`,{className:`inline-block h-4 w-5 rounded-sm border-[1.5px] border-current`})})]})]})},Ro=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go();return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Light`,value:null,hex:`#e0e7eb`},{title:`Accent`,value:`accent`,hex:n}],title:`Divider color`,value:e.divider_color,onChange:e=>t({divider_color:e})})},zo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsx)(Eo,{swatches:[{title:`Transparent`,value:`transparent`,hex:`#00000000`}],title:`Header background color`,value:e.header_background_color,onChange:e=>e&&t({header_background_color:e})})},Bo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Heading font`}),(0,V.jsxs)(gn,{value:e.title_font_category||`sans_serif`,onValueChange:n=>{let r=Ao(n,e.title_font_weight);t({title_font_category:n,title_font_weight:r})},children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:Oo.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Vo=()=>{let{settings:e,onSettingsChange:t}=go(),n=e.title_font_category||`sans_serif`,r=ko[n]?.options||ko.sans_serif.options,i=Ao(n,e.title_font_weight);return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Heading weight`}),(0,V.jsxs)(gn,{value:i,onValueChange:e=>t({title_font_weight:e}),children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:r.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Ho=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Image corners`}),(0,V.jsxs)(bn,{type:`single`,value:e.image_corners||`square`,onValueChange:e=>e&&t({image_corners:e}),children:[(0,V.jsx)(yn,{"aria-label":`Square`,value:`square`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Rounded`,value:`rounded`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-sm border-[1.5px] border-current`})})]})]})},Uo=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go(),r=Po(e.background_color);return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Accent`,value:`accent`,hex:n},{title:`Auto`,value:null,hex:r}],title:`Link color`,value:e.link_color,onChange:e=>t({link_color:e})})},Wo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Link style`}),(0,V.jsxs)(bn,{type:`single`,value:e.link_style||`underline`,onValueChange:e=>e&&t({link_style:e}),children:[(0,V.jsx)(yn,{"aria-label":`Underline`,value:`underline`,children:(0,V.jsx)(sn,{className:`size-4`})}),(0,V.jsx)(yn,{"aria-label":`Regular`,value:`regular`,children:(0,V.jsx)(un,{className:`size-4`})}),(0,V.jsx)(yn,{"aria-label":`Bold`,value:`bold`,children:(0,V.jsx)(cn,{className:`size-4`})})]})]})},Go=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go();return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Auto`,value:null,hex:Po(e.background_color)},{title:`Accent`,value:`accent`,hex:n}],title:`Section title color`,value:e.section_title_color,onChange:e=>t({section_title_color:e})})},Ko={background_color:`light`,title_font_category:`sans_serif`,title_font_weight:`bold`,body_font_category:`sans_serif`,header_background_color:`transparent`,section_title_color:null,button_color:`accent`,button_style:`fill`,button_corners:`rounded`,link_color:`accent`,link_style:`underline`,image_corners:`square`,divider_color:null},qo={free:`member-welcome-email-free`,paid:`member-welcome-email-paid`},Jo=`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Welcome! Thanks for subscribing — it's great to have you here.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"You'll now receive new posts straight to your inbox. You can also log in any time to read the ","type":"extended-text","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"full archive","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"__GHOST_URL__/"},{"detail":0,"format":0,"mode":"normal","style":"","text":" or catch up on new posts as they go live.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"A little housekeeping: If this email landed in spam or promotions, try moving it to your primary inbox and adding this address to your contacts. Small signals like that help your inbox recognize that these messages matter to you.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Have questions or just want to say hi? Feel free to reply directly to this email or any newsletter in the future.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`,Yo=`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Welcome, and thank you for your support — it means a lot.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"As a paid member, you now have full access to everything: the complete archive, and any paid-only content going forward. New posts will land straight to your inbox, and you can log in any time to ","type":"extended-text","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"catch up","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"__GHOST_URL__/"},{"detail":0,"format":0,"mode":"normal","style":"","text":" on anything you've missed.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"A little housekeeping: If this email landed in spam or promotions, try moving it to your primary inbox and adding this address to your contacts. Small signals like that help your inbox recognize that these messages matter to you.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Have questions or just want to say hi? Feel free to reply directly to this email or any newsletter in the future.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`,Xo=(e,t)=>({name:e===`free`?`Free member welcome flow`:`Paid member welcome flow`,slug:qo[e],subject:e===`free`?`Welcome to ${t||`our site`}`:`Welcome to your paid subscription`,lexical:e===`free`?Jo:Yo}),Zo=(e,t)=>({id:``,status:`inactive`,...Xo(e,t),sender_name:null,sender_email:null,sender_reply_to:null,created_at:``,updated_at:null}),Qo=e=>e?.trim()||``,$o=(...e)=>e.map(Qo).find(Boolean)||``,es=({automatedEmails:e=[],config:t,defaultEmailAddress:n,newsletter:r,siteTitle:i,supportEmailAddress:a})=>{let o=e.find(e=>e.slug===qo.free),s=e.find(e=>e.slug===qo.paid),c=$o(o?.sender_name,s?.sender_name),l=$o(o?.sender_email,s?.sender_email),u=$o(o?.sender_reply_to,s?.sender_reply_to),d=Qo(r?.sender_name),f=r?Qo(Qe(r,t,n||void 0)):``,p=r?Qo(at(r,t,a||void 0,n||void 0)):``,m=d||Qo(i)||`Your site name`,h=f||Qo(n),g=p||Qo(a)||Qo(n),_=c||m||`Your Site`,v=l||h||``,y=u||g||``,b=y!==``&&y!==v,x=Un(t),S=Qn(t);return{hasDistinctReplyTo:b,replyToEmailInput:u,replyToEmailPlaceholder:g,resolvedReplyToEmail:y,resolvedSenderEmail:v,resolvedSenderName:_,senderEmailDomain:S?qn(t):null,senderEmailInput:l,senderEmailPlaceholder:h,senderNameInput:c,senderNamePlaceholder:m,showSenderEmailInput:!x||S}},ts=(e=[],{config:t,defaultEmailAddress:n,siteTitle:r,supportEmailAddress:i})=>{let{data:a}=or({searchParams:{filter:`status:active`,limit:`1`}}),o=a?.newsletters?.[0];return(0,B.useMemo)(()=>es({automatedEmails:e,config:t,defaultEmailAddress:n,newsletter:o,siteTitle:r,supportEmailAddress:i}),[e,t,n,o,r,i])},ns=`welcome-email-design-save-error`,rs=new Set(Object.keys(Ko)),is=e=>rs.has(e),as=({generalSettings:e,onGeneralChange:t,showPublicationIconToggle:n,senderNamePlaceholder:r,senderEmailPlaceholder:i,replyToEmailPlaceholder:a,showSenderEmailInput:o,senderNameError:s,senderEmailError:c,replyToEmailError:l})=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 pt-6`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Email info`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-sender-name`,children:`Sender name`}),(0,V.jsx)(An,{id:`welcome-email-sender-name`,placeholder:r,value:e.senderName,onChange:e=>t({senderName:e.target.value})}),s?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:s}):null]}),o?(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-sender-email`,children:`Sender email`}),(0,V.jsx)(An,{id:`welcome-email-sender-email`,placeholder:i,value:e.senderEmail,onChange:e=>t({senderEmail:e.target.value})}),c?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:c}):null]}):null,(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-reply-to-email`,children:`Reply-to email`}),(0,V.jsx)(An,{id:`welcome-email-reply-to-email`,placeholder:a,value:e.replyToEmail,onChange:e=>t({replyToEmail:e.target.value})}),l?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:l}):null]})]})]}),(0,V.jsx)(Nn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Content`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(uo,{value:e.headerImage,onChange:e=>t({headerImage:e})}),n&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Publication icon`}),(0,V.jsx)(It,{checked:e.showPublicationIcon,size:`sm`,onCheckedChange:e=>t({showPublicationIcon:e})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Publication title`}),(0,V.jsx)(It,{checked:e.showPublicationTitle,size:`sm`,onCheckedChange:e=>t({showPublicationTitle:e})})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-footer`,children:`Email footer`}),(0,V.jsx)(vn,{id:`welcome-email-footer`,placeholder:`Any extra information or legal text`,rows:3,value:e.emailFooter,onChange:e=>t({emailFooter:e.target.value})})]}),(0,V.jsx)(fo,{value:e.showBadge,onChange:e=>t({showBadge:e})})]})]})]}),os=()=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 pt-6`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Global`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(Do,{}),(0,V.jsx)(Bo,{}),(0,V.jsx)(Vo,{}),(0,V.jsx)(jo,{})]})]}),(0,V.jsx)(Nn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Header`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,V.jsx)(zo,{})})]}),(0,V.jsx)(Nn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Body`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(Go,{}),(0,V.jsx)(Fo,{}),(0,V.jsx)(Lo,{}),(0,V.jsx)(Io,{}),(0,V.jsx)(Uo,{}),(0,V.jsx)(Wo,{}),(0,V.jsx)(Ho,{}),(0,V.jsx)(Ro,{})]})]})]}),ss=({generalSettings:e,onGeneralChange:t,showPublicationIconToggle:n,senderNamePlaceholder:r,senderEmailPlaceholder:i,replyToEmailPlaceholder:a,showSenderEmailInput:o,senderNameError:s,senderEmailError:c,replyToEmailError:l,isLoading:u,errorMessage:d})=>(0,V.jsxs)(jt,{className:`flex min-h-0 flex-1 flex-col`,defaultValue:`general`,variant:`underline`,children:[(0,V.jsxs)(At,{className:`px-5`,children:[(0,V.jsx)(Ot,{value:`general`,children:`General`}),(0,V.jsx)(Ot,{value:`design`,children:`Design`})]}),u?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,V.jsx)(Yn,{size:`md`})}):d?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-gray-700 dark:text-gray-300`,children:d}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kt,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-5`,value:`general`,children:(0,V.jsx)(as,{generalSettings:e,replyToEmailError:l,replyToEmailPlaceholder:a,senderEmailError:c,senderEmailPlaceholder:i,senderNameError:s,senderNamePlaceholder:r,showPublicationIconToggle:n,showSenderEmailInput:o,onGeneralChange:t})}),(0,V.jsx)(kt,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-5`,value:`design`,children:(0,V.jsx)(os,{})})]})]});function cs(e,t){return{senderName:t.senderName,senderEmail:t.senderEmail,replyToEmail:t.replyToEmail,headerImage:e.header_image||``,showPublicationIcon:e.show_header_icon,showPublicationTitle:e.show_header_title,showBadge:e.show_badge,emailFooter:e.footer_content||``}}function ls(e){return Object.fromEntries(Object.entries(e).filter(([e])=>is(e)))}function us(e){return{...Object.fromEntries(Object.entries(e.designSettings).filter(([e])=>is(e))),header_image:e.generalSettings.headerImage||null,show_header_icon:e.generalSettings.showPublicationIcon,show_header_title:e.generalSettings.showPublicationTitle,show_badge:e.generalSettings.showBadge,footer_content:e.generalSettings.emailFooter||null}}var ds=({message:e})=>(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-gray-700 dark:text-gray-300`,children:e}),fs=e=>e?.trim()||null,ps=w.create(()=>{let e=E(),{siteData:t,settings:n,config:r}=I(),[i,a,o,s]=z(n,[`title`,`default_email_address`,`icon`,`support_email_address`]),c=p(),{data:l,isLoading:u,isError:d}=bo(),{data:f}=Kt(),{mutateAsync:m}=xo(),{mutateAsync:h}=Zt(),{mutateAsync:g}=Ut(),_=fe(`automations`),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(!1),{senderNameInput:S,senderEmailInput:C,replyToEmailInput:w,senderNamePlaceholder:ee,senderEmailPlaceholder:T,replyToEmailPlaceholder:te,showSenderEmailInput:D,senderEmailDomain:O}=ts(f?.automated_emails||[],{config:r,defaultEmailAddress:a,siteTitle:i,supportEmailAddress:s}),k=(0,B.useMemo)(()=>({senderName:S,senderEmail:C,replyToEmail:w,headerImage:``,showPublicationIcon:!0,showPublicationTitle:!0,showBadge:!0,emailFooter:``}),[w,C,S]),ne=(0,B.useCallback)(async()=>{let e=new Map((f?.automated_emails||[]).map(e=>[e.slug,e]));for(let t of[`free`,`paid`]){if(e.has(qo[t]))continue;let n=Xo(t,i),r=(await h({...n,status:`inactive`})).automated_emails?.[0];r&&e.set(r.slug,r)}},[h,f?.automated_emails,i]),{formState:re,saveState:ie,updateForm:ae,setFormState:oe,handleSave:se,okProps:ce,errors:A}=Vt({initialState:{designSettings:{...Ko},generalSettings:k},savingDelay:500,onSave:async e=>{if(!de)throw Gn.error(`Unable to load email design settings. Please try again.`,{id:ns}),y(!0),Error(`Unable to load email design settings`);_||await ne();let t={sender_name:fs(e.generalSettings.senderName),sender_reply_to:fs(e.generalSettings.replyToEmail),...D?{sender_email:fs(e.generalSettings.senderEmail)}:{}},{meta:{sent_email_verification:n=[]}={}}=await g(t);await m(us(e)),n.length>0&&Gn.info(`We’ve sent a confirmation email to the new address.`),y(!1),Gn.dismiss(ns)},onSaveError:e=>{c(e,{withToast:!1}),Gn.error(`Unable to save email design settings. Please try again.`,{id:ns}),y(!0)},onValidate:e=>{let t={},n=e.generalSettings.senderEmail?.trim(),r=e.generalSettings.replyToEmail?.trim();return D&&n&&(vo.default.isEmail(n)?O&&n.split(`@`)[1]?.toLowerCase()!==O.toLowerCase()&&(t.senderEmail=`Email address must end with @${O}`):t.senderEmail=`Enter a valid email address`),r&&!vo.default.isEmail(r)&&(t.replyToEmail=`Enter a valid email address`),t}}),[le,ue]=(0,B.useState)(null),de=l?.automated_email_design?.[0],pe=de?`${de.id}:${de.updated_at??`initial`}`:null,{designSettings:j,generalSettings:me}=re;(0,B.useEffect)(()=>{de&&le===null&&(oe(e=>({designSettings:ls(de),generalSettings:cs(de,e.generalSettings)})),ue(pe))},[de,pe,le,oe]),(0,B.useEffect)(()=>{b||f===void 0||(oe(e=>({...e,generalSettings:{...e.generalSettings,senderName:S,senderEmail:C,replyToEmail:w}})),x(!0))},[f,w,C,b,S,oe]);let he=(0,B.useCallback)(e=>{y(!1),Gn.dismiss(ns),ae(t=>({...t,designSettings:{...t.designSettings,...e}}))},[ae]),ge=(0,B.useCallback)(e=>{y(!1),Gn.dismiss(ns),ae(t=>({...t,generalSettings:{...t.generalSettings,...e}}))},[ae]),M=(0,B.useCallback)(()=>{e.hide()},[e]),_e=`Unable to load email design settings. Please try again.`,ve=v?{...ce,color:`red`,label:`Retry`}:ce;return(0,V.jsx)(ho,{accentColor:t.accent_color,settings:j,onSettingsChange:he,children:(0,V.jsx)(qa,{afterClose:()=>{e.resolveHide(),e.remove()},dirty:ie===`unsaved`,isLoading:u||d,okProps:ve,open:e.visible,preview:d?(0,V.jsx)(ds,{message:_e}):(0,V.jsx)(lo,{accentColor:t.accent_color,emailFooter:me.emailFooter,footerLinkText:`Manage your preferences`,headerImage:me.headerImage,publicationIcon:o,replyToEmail:me.replyToEmail||te||``,senderEmail:me.senderEmail||T||a||``,senderName:me.senderName||ee||i||`Your site`,settings:j,showBadge:me.showBadge,showPublicationIcon:me.showPublicationIcon&&!!o,showPublicationTitle:me.showPublicationTitle,showRecipientLine:!1,showSubjectLine:!1,siteTitle:i,subject:`Welcome to ${me.senderName||ee||i||`our publication`}`,children:(0,V.jsx)(_o,{})}),sidebar:(0,V.jsx)(ss,{errorMessage:d?_e:void 0,generalSettings:me,isLoading:u,replyToEmailError:A.replyToEmail,replyToEmailPlaceholder:te,senderEmailError:A.senderEmail,senderEmailPlaceholder:T,senderNameError:A.senderName,senderNamePlaceholder:ee,showPublicationIconToggle:!!o,showSenderEmailInput:D,onGeneralChange:ge}),testId:`welcome-email-customize-modal`,title:`Welcome emails`,onClose:M,onSave:()=>se({fakeWhenUnchanged:!0})})})}),ms={enableNewsletters:[`emails`,`newsletters`,`newsletter sending`,`enable`,`disable`,`turn on`,`turn off`],emails:[`emails`,`newsletters`,`automation emails`,`transactional`,`design`,`customization`,`automations`,`welcome`],defaultRecipients:[`newsletters`,`default recipients`,`emails`],mailgun:[`mailgun`,`emails`,`newsletters`]},hs=()=>{let e=()=>{w.show(ps)};return(0,V.jsx)(St,{children:(0,V.jsx)(lt,{action:(0,V.jsx)(`button`,{className:`font-semibold text-green hover:opacity-80`,type:`button`,onClick:e,children:`Edit`}),hideActions:!1,testId:`automations-transactional-row`,children:(0,V.jsxs)(`button`,{className:`flex w-full min-w-0 items-center gap-3 py-3 text-left focus-visible:ring-2 focus-visible:ring-green focus-visible:ring-offset-2 focus-visible:outline-none dark:focus-visible:ring-offset-black`,type:`button`,onClick:e,children:[(0,V.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-grey-100 dark:bg-grey-900`,children:(0,V.jsx)(l,{colorClass:`text-grey-700 dark:text-grey-600`,name:`mailplus`,size:`md`})}),(0,V.jsxs)(`div`,{className:`min-w-0 grow`,children:[(0,V.jsx)(`div`,{className:`leading-tight font-medium`,children:`Email design`}),(0,V.jsx)(`div`,{className:`mt-1 text-sm leading-[1.35] text-grey-700 dark:text-grey-600`,children:`Customize the appearance of automation emails`})]})]})})})},gs=()=>{let e=window.location.hash.slice(1);return new URL(e||`/`,window.location.origin).pathname.startsWith(`/settings/memberemails`)},_s=({keywords:e,newslettersEnabled:t})=>{let{updateRoute:n}=P(),r=Me().getParam(`verifyEmail`),{mutateAsync:i}=Xt(),a=p(),o=(0,B.useRef)(null),[s,c]=(0,B.useState)(t?`newsletters`:`transactional`),[l,u]=(0,B.useState)(`active`);return(0,B.useEffect)(()=>{!t&&s===`newsletters`&&c(`transactional`)},[t,s]),(0,B.useEffect)(()=>{!r||!gs()||o.current===r||(o.current=r,c(`transactional`),(async()=>{try{let{meta:{email_verified:e}={}}=await i({token:r}),t=`Sender email verified`,a=(0,V.jsx)(V.Fragment,{children:`Automation email sender settings have been updated.`});e===`sender_reply_to`&&(t=`Reply-to address verified`,a=(0,V.jsx)(V.Fragment,{children:`Automation email reply-to address has been verified and updated.`})),n(`emails`),w.show(M,{title:t,prompt:a,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),n(`emails`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),a(e,{withToast:!1})}})())},[a,n,r,i]),(0,V.jsx)(J,{customButtons:t&&s===`newsletters`?(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Add newsletter`,size:`sm`,onClick:()=>{n(`newsletters/new`)}}):void 0,description:`Manage newsletters and design automation emails.`,keywords:e,navid:`emails`,testId:`emails`,title:`Newsletters & automation emails`,children:(0,V.jsxs)(jt,{value:s,variant:`underline`,onValueChange:e=>c(e),children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between border-b border-grey-200 dark:border-grey-900`,children:[(0,V.jsxs)(At,{className:`border-b-0`,children:[t&&(0,V.jsx)(Ot,{value:`newsletters`,children:`Newsletters`}),(0,V.jsx)(Ot,{value:`transactional`,children:`Automation emails`})]}),t&&s===`newsletters`&&(0,V.jsxs)(gn,{value:l,onValueChange:e=>u(e),children:[(0,V.jsx)(mn,{className:`h-7 w-auto gap-1 border-0 bg-transparent px-2 text-sm shadow-none hover:bg-muted focus:ring-0 focus:ring-offset-0`,"data-testid":`newsletters-filter`,children:(0,V.jsx)(hn,{})}),(0,V.jsxs)(pn,{children:[(0,V.jsx)(fn,{value:`active`,children:`Active`}),(0,V.jsx)(fn,{value:`archived`,children:`Archived`})]})]})]}),t&&(0,V.jsx)(kt,{value:`newsletters`,children:(0,V.jsx)(Ga,{filter:l})}),(0,V.jsx)(kt,{value:`transactional`,children:(0,V.jsx)(hs,{})})]})})},vs=()=>{let{settings:e,config:t}=I(),[n]=z(e,[`editor_default_email_recipients`]),r=n!==`disabled`,i=r&&!t.mailgunIsConfigured;return(0,V.jsxs)(Ea,{keywords:[ms.enableNewsletters,...r?[ms.defaultRecipients]:[],ms.emails,...i?[ms.mailgun]:[]].flat(),title:`Email`,children:[(0,V.jsx)(Na,{keywords:ms.enableNewsletters}),r&&(0,V.jsx)(Ma,{keywords:ms.defaultRecipients}),(0,V.jsx)(_s,{keywords:ms.emails,newslettersEnabled:r}),i&&(0,V.jsx)(Fa,{keywords:ms.mailgun})]})},ys=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l,u,d,f,p]=z(t,[`email_track_opens`,`email_track_clicks`,`members_track_sources`,`outbound_link_tagging`,`web_analytics`,`web_analytics_configured`]),m=Zn(t,`email_track_clicks`),[h,g]=(0,B.useState)(!1),_=Se(),{updateRoute:v}=P();(0,B.useEffect)(()=>{_?.isLimited(`limitAnalytics`)?_.errorIfWouldGoOverLimit(`limitAnalytics`).catch(e=>{e instanceof he&&g(!0)}):g(!1)},[_]);let y=(e,t)=>{o(e,t.target.checked),s(!0)},b=p&&!h;return(0,V.jsxs)(J,{description:`Decide what data you collect across your publication`,isEditing:n,keywords:e,navid:`analytics`,saveState:r,testId:`analytics`,title:`Analytics`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:i,children:[(0,V.jsxs)(F,{className:`analytics-settings gap-y-0!`,columns:1,children:[(0,V.jsx)(wt,{align:`center`,checked:f&&b,containerClasses:`py-4`,direction:`rtl`,disabled:!b,gap:`gap-0`,hint:p?(0,V.jsxs)(V.Fragment,{children:[`Cookie-free, first party traffic analytics for your site, powered by `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/integrations/tinybird`,rel:`noopener noreferrer`,target:`_blank`,children:`Tinybird`})]}):(0,V.jsx)(V.Fragment,{children:`Cookie-free, first party traffic analytics for your site`}),label:`Web analytics`,onChange:e=>{y(`web_analytics`,e)}}),h?(0,V.jsx)(`div`,{className:`mb-5 rounded-md border border-grey-200 bg-grey-50 px-4 py-2.5 dark:border-grey-900 dark:bg-grey-900`,children:(0,V.jsx)(`span`,{className:`flex items-start gap-2`,children:(0,V.jsxs)(`span`,{children:[`Web analytics is available on the Publisher plan and above. `,(0,V.jsx)(`span`,{className:`cursor-pointer text-green`,onClick:()=>v({route:`/pro`,isExternal:!0}),children:`Upgrade now →`})]})})}):p?(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}):(0,V.jsx)(`div`,{className:`mb-5 rounded-md border border-grey-200 bg-grey-50 px-4 py-2.5 dark:border-grey-900 dark:bg-grey-900`,children:(0,V.jsx)(`span`,{className:`flex items-start gap-2`,children:(0,V.jsxs)(`span`,{children:[`Web analytics in Ghost is powered by `,(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://tbrd.co/ghost`,rel:`noopener noreferrer`,target:`_blank`,children:`Tinybird`}),` and requires configuration to start collecting data. `,(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://docs.ghost.org/install/docker#tinybird-integration`,rel:`noopener noreferrer`,target:`_blank`,children:`Get started →`})]})})}),(0,V.jsx)(wt,{align:`center`,checked:c,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Record when a member opens an email`,label:`Newsletter opens`,onChange:e=>{y(`email_track_opens`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:l,containerClasses:`py-4`,direction:`rtl`,disabled:m,gap:`gap-0`,hint:`Record when a member clicks on any link in an email`,label:`Newsletter clicks`,onChange:e=>{y(`email_track_clicks`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:u,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Track the traffic sources and posts that drive the most member growth`,label:`Member sources`,onChange:e=>{y(`members_track_sources`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:d,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Make it easier for other sites to track the traffic you send them in their analytics`,label:`Outbound link tagging`,onChange:e=>{y(`outbound_link_tagging`,e)}})]}),(0,V.jsx)(`div`,{className:`items-center-mt-1 flex justify-between`,children:(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://ghost.org/help/post-analytics/`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn about analytics`})})]})},`Analytics`),bs=[{code:`af`,label:`Afrikaans`},{code:`ar`,label:`Arabic`},{code:`bg`,label:`Bulgarian`},{code:`bn`,label:`Bengali`},{code:`bs`,label:`Bosnian`},{code:`ca`,label:`Catalan`},{code:`cs`,label:`Czech`},{code:`da`,label:`Danish`},{code:`de`,label:`German`},{code:`de-CH`,label:`Swiss German`},{code:`el`,label:`Greek`},{code:`en`,label:`English`},{code:`eo`,label:`Esperanto`},{code:`es`,label:`Spanish`},{code:`et`,label:`Estonian`},{code:`eu`,label:`Basque`},{code:`fa`,label:`Persian/Farsi`},{code:`fi`,label:`Finnish`},{code:`fr`,label:`French`},{code:`gd`,label:`Gaelic (Scottish)`},{code:`he`,label:`Hebrew`},{code:`hi`,label:`Hindi`},{code:`hr`,label:`Croatian`},{code:`hu`,label:`Hungarian`},{code:`id`,label:`Indonesian`},{code:`is`,label:`Icelandic`},{code:`it`,label:`Italian`},{code:`ja`,label:`Japanese`},{code:`ko`,label:`Korean`},{code:`kz`,label:`Kazakh`},{code:`lt`,label:`Lithuanian`},{code:`lv`,label:`Latvian`},{code:`mk`,label:`Macedonian`},{code:`mn`,label:`Mongolian`},{code:`ms`,label:`Malay`},{code:`nb`,label:`Norwegian Bokmål`},{code:`ne`,label:`Nepali`},{code:`nl`,label:`Dutch`},{code:`nn`,label:`Norwegian Nynorsk`},{code:`pa`,label:`Punjabi`},{code:`pl`,label:`Polish`},{code:`pt`,label:`Portuguese`},{code:`pt-BR`,label:`Portuguese (Brazil)`},{code:`ro`,label:`Romanian`},{code:`ru`,label:`Russian`},{code:`si`,label:`Sinhala`},{code:`sk`,label:`Slovak`},{code:`sl`,label:`Slovenian`},{code:`sq`,label:`Albanian`},{code:`sr`,label:`Serbian`},{code:`sr-Cyrl`,label:`Serbian (Cyrillic)`},{code:`sv`,label:`Swedish`},{code:`sw`,label:`Swahili`},{code:`ta`,label:`Tamil`},{code:`th`,label:`Thai`},{code:`tr`,label:`Turkish`},{code:`uk`,label:`Ukrainian`},{code:`ur`,label:`Urdu`},{code:`uz`,label:`Uzbek`},{code:`vi`,label:`Vietnamese`},{code:`zh`,label:`Chinese`},{code:`zh-Hant`,label:`Traditional Chinese`}],xs=new Set(`en-gb-oed.i-ami.i-bnn.i-default.i-enochian.i-hak.i-klingon.i-lux.i-mingo.i-navajo.i-pwn.i-tao.i-tay.i-tsu.sgn-be-fr.sgn-be-nl.sgn-ch-de.art-lojban.cel-gaulish.no-bok.no-nyn.zh-guoyu.zh-hakka.zh-min.zh-min-nan.zh-xiang`.split(`.`)),Ss=e=>{let t=`Invalid locale format. Examples: en, pt-BR, zh-Hant, sr-Cyrl, x-private`;if(!e)return`Enter a value`;let n=e.trim();if(!n)return t;if(xs.has(n.toLowerCase()))return null;if(!/^[a-z0-9]+(-[a-z0-9]+)*$/i.test(n))return t;let r=n.split(`-`);if(r[0].toLowerCase()===`x`){if(r.length<2)return t;for(let e=1;e<r.length;e++)if(r[e].length<1||r[e].length>8)return t;return null}let i=0,a=r[i];if(!/^[a-z]{2,3}$/i.test(a))return t;for(i+=1,i<r.length&&/^[a-z]{4}$/i.test(r[i])&&(i+=1),i<r.length&&/^([a-z]{2}|[0-9]{3})$/i.test(r[i])&&(i+=1);i<r.length&&/^([a-z0-9]{5,8}|[0-9][a-z0-9]{3})$/i.test(r[i]);)i+=1;for(;i<r.length&&/^[0-9a-wy-z]$/i.test(r[i]);){if(i+=1,i>=r.length||!/^[a-z0-9]{2,8}$/i.test(r[i]))return t;for(i+=1;i<r.length&&/^[a-z0-9]{2,8}$/i.test(r[i]);)i+=1}if(i<r.length&&r[i].toLowerCase()===`x`){if(i+=1,i>=r.length)return t;for(;i<r.length;){if(!/^[a-z0-9]+$/i.test(r[i]))return t;i+=1}}if(i!==r.length)return t;let o=r.findIndex(e=>e.toLowerCase()===`x`),s=[`english`,`french`,`spanish`,`german`,`italian`,`chinese`,`japanese`,`korean`,`russian`,`arabic`,`united`,`states`,`kingdom`,`traditional`,`simplified`];for(let e=0;e<r.length;e++){let n=r[e];if(![`i`,`x`,`sgn`,`art`,`cel`,`no`,`zh`].includes(n.toLowerCase())&&!(o!==-1&&e>o)&&(n.length>16||s.includes(n.toLowerCase())))return t}return null},Cs=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,errors:s,handleEditingChange:c}=N({onValidate:()=>{let e=Ss(l);return e?{publicationLanguage:e}:{}}}),[l]=z(t,[`locale`]),u=B.useMemo(()=>bs.map(e=>({value:e.code,label:`${e.label} (${e.code})`})),[]),d=e=>{o(`locale`,e),n||c(!0)},f=(0,V.jsxs)(V.Fragment,{children:[`Default: English (`,(0,V.jsx)(`strong`,{children:`en`}),`); find out more about`,(0,V.jsx)(`a`,{className:`text-green-400`,href:`https://ghost.org/docs/faq/translation/`,rel:`noopener noreferrer`,target:`_blank`,children:` using Ghost in other languages`})]});return(0,V.jsx)(J,{description:`Set the language/locale which is used on your site`,isEditing:n,keywords:e,navid:`publication-language`,saveState:r,testId:`publication-language`,title:`Publication Language`,hideEditButton:!0,onCancel:a,onEditingChange:c,onSave:i,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsx)(gr,{defaultListValue:`en`,error:!!s.publicationLanguage,hint:s.publicationLanguage||f,options:u,otherHint:`Enter a custom locale code.`,otherPlaceholder:`e.g. pt-BR, sr-Cyrl, en`,selectedValue:l,testId:`locale-select`,title:`Site language`,validate:Ss,isSearchable:!0,onSelect:d})})})},`Publication language`),ws=({title:e,description:t,icon:n,url:r})=>{let i=r?.replace(/\/$/,``),a=i?.replace(/^https?:\/\//,``).replace(/\/?$/,``);return(0,V.jsx)(`div`,{children:(0,V.jsxs)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl bg-grey-50 px-5 pt-2 md:-mx-7 md:-mb-7 md:px-7 md:pt-7 dark:bg-grey-950`,children:[(0,V.jsx)(`div`,{className:`-mt-4 mb-2 text-sm text-grey-500 uppercase dark:text-grey-800`,children:`Preview`}),(0,V.jsxs)(`div`,{className:`rounded-t-sm bg-white px-5 py-3 shadow-lg dark:bg-grey-950`,children:[(0,V.jsxs)(`div`,{className:`mt-3 flex items-center`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(Pe,{className:`mr-7 h-7`})}),(0,V.jsx)(`div`,{className:`grow`,children:(0,V.jsx)(`div`,{className:`flex w-full items-center justify-end rounded-full bg-white p-3 px-4 shadow dark:bg-grey-900`,children:(0,V.jsx)(l,{className:`stroke-[2px] text-blue-600`,name:`magnifying-glass`,size:`sm`})})})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 border-t border-grey-200 pt-4 dark:border-grey-900`,children:[(0,V.jsx)(`div`,{className:`flex size-7 items-center justify-center rounded-full bg-grey-200 dark:bg-grey-700`,style:{backgroundImage:n?`url(${n})`:`none`,backgroundSize:`contain`}}),(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{children:a}),(0,V.jsx)(`span`,{className:`-mt-0.5 inline-block text-sm text-grey-600`,children:i})]})]}),(0,V.jsxs)(`div`,{className:`mt-1 flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-lg text-[#1a0dab] dark:text-blue`,children:e}),(0,V.jsx)(`span`,{className:`text-grey-900 dark:text-grey-700`,children:t})]})]})]})})},Ts=j(({keywords:e})=>{let{localSettings:t,saveState:n,siteData:r,focusRef:i,isEditing:a,handleSave:o,handleCancel:s,handleEditingChange:c,updateSetting:l}=N(),u=p(),{mutateAsync:d}=yt(),f=gt(),m=fe(`llmsTxt`),[h,g,_,v,y,b,x,S,C,w]=z(t,[`meta_title`,`meta_description`,`title`,`description`,`og_title`,`og_description`,`og_image`,`twitter_title`,`twitter_description`,`twitter_image`]).map(e=>e||``),[ee]=z(t,[`llms_enabled`]),T=ee!==!1,[te,E]=(0,B.useState)(`metadata`),D=e=>t=>{l(e,t.target.value),a||c(!0)},O=e=>async t=>{try{let n=Ie(await d({file:t}));l(e,n),a||c(!0)}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),u(t)}},ne=e=>()=>{l(e,``),a||c(!0)},re=e=>{l(`llms_enabled`,e.target.checked),a||c(!0)},ie=D(`meta_title`),ae=D(`meta_description`),oe=D(`og_title`),se=D(`og_description`),ce=O(`og_image`),A=ne(`og_image`),le=D(`twitter_title`),ue=D(`twitter_description`),de=O(`twitter_image`),pe=ne(`twitter_image`),j=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(F,{className:`my-6 gap-3`,children:[m&&(0,V.jsx)(wt,{checked:T,direction:`rtl`,label:`Enable structured data for LLMs and AI search engines`,onChange:re}),(0,V.jsx)(k,{hint:`Recommended: 70 characters`,inputRef:i,maxLength:300,placeholder:_,title:`Meta title`,value:h,onChange:ie}),(0,V.jsx)(k,{hint:`Recommended: 156 characters`,maxLength:500,placeholder:v,title:`Meta description`,value:g,onChange:ae})]}),(0,V.jsx)(ws,{description:g||v,icon:r?.icon,title:h||_,url:r?.url})]}),me=(0,V.jsxs)(`div`,{className:`mt-6 md:mx-[52px]`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(tt,{className:`size-10`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`mb-1 leading-none font-semibold text-grey-900 dark:text-grey-300`,children:_}),(0,V.jsx)(`div`,{className:`leading-none text-grey-700`,children:`2h`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`mb-2 h-3 w-full rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsx)(`div`,{className:`mb-4 h-3 w-3/5 rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsxs)(F,{className:`overflow-hidden rounded-md border border-grey-300 dark:border-grey-900`,children:[(0,V.jsx)(ke,{fileUploadClassName:`flex cursor-pointer items-center justify-center rounded rounded-b-none border border-grey-100 border-b-0 bg-grey-50 p-3 font-semibold text-grey-800 hover:text-black dark:border-grey-900`,height:`300px`,id:`facebook-image`,imageURL:x,pintura:{isEnabled:f.isEnabled,openEditor:async()=>f.openEditor({image:x||``,handleSave:async e=>{let t=Ie(await d({file:e}));l(`og_image`,t)}})},onDelete:A,onUpload:ce,children:`Upload Facebook image`}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-x-6 gap-y-7 px-4 pb-7`,children:[(0,V.jsx)(k,{maxLength:300,placeholder:_,title:`Facebook title`,value:y,onChange:oe}),(0,V.jsx)(k,{maxLength:300,placeholder:v,title:`Facebook description`,value:b,onChange:se})]})]})]})]}),he=(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`pt-1`,children:(0,V.jsx)(rt,{className:`-mb-1 size-10`})}),(0,V.jsxs)(`div`,{className:`w-full md:mr-[52px]`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsx)(`span`,{className:`mr-1 font-semibold text-grey-900 dark:text-grey-300`,children:_}),(0,V.jsx)(`span`,{className:`text-grey-700`,children:`· 2h`})]}),(0,V.jsx)(`div`,{className:`mb-2 h-3 w-full rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsx)(`div`,{className:`mb-4 h-3 w-3/5 rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsxs)(F,{className:`overflow-hidden rounded-md border border-grey-300 dark:border-grey-900`,children:[(0,V.jsx)(ke,{fileUploadClassName:`flex cursor-pointer items-center justify-center rounded rounded-b-none border border-grey-100 border-b-0 bg-grey-50 p-3 font-semibold text-grey-800 hover:text-black dark:border-grey-900`,height:`300px`,id:`twitter-image`,imageURL:w,pintura:{isEnabled:f.isEnabled,openEditor:async()=>f.openEditor({image:w||``,handleSave:async e=>{let t=Ie(await d({file:e}));l(`twitter_image`,t)}})},onDelete:pe,onUpload:de,children:`Upload X image`}),(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col gap-x-6 gap-y-7 px-4 pb-7`,children:[(0,V.jsx)(k,{maxLength:300,placeholder:_,title:`X title`,value:S,onChange:le}),(0,V.jsx)(k,{maxLength:300,placeholder:v,title:`X description`,value:C,onChange:ue})]})]})]})]});return(0,V.jsx)(J,{description:`Extra content for search engines and social accounts`,isEditing:a,keywords:e,navid:`metadata`,saveState:n,testId:`seometa`,title:`Meta data`,hideEditButton:!0,onCancel:s,onEditingChange:c,onSave:o,children:(0,V.jsx)(Ze,{selectedTab:te,tabs:[{id:`metadata`,title:`Search`,contents:j},{id:`twitter`,title:`X card`,contents:he},{id:`facebook`,title:`Facebook card`,contents:me}],testId:`seo-tabview`,onTabChange:E})})},`SEO meta`),Es=[`facebook`,`twitter`],Ds=et.filter(e=>!Es.includes(e)),Os=e=>{let t=z(e,[...et]);return Object.fromEntries(dt.map((e,n)=>{let r=t[n];return[e.key,e.toDisplayValue(r)]}))},ks=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(()=>Os(t)),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)({});(0,B.useEffect)(()=>{n||h({})},[n]);let g=z(t,[...et]),_=Ds.some(e=>t?.some(t=>t.key===e)),v=(0,B.useMemo)(()=>_?dt:dt.filter(e=>Es.includes(e.key)),[_]);(0,B.useEffect)(()=>{f||d(Os(t))},[g.map(e=>e??``).join(`|`)]);let y=(e,t)=>{d(n=>({...n,[e]:t})),h(t=>({...t,[e]:!0})),n||s(!0);try{let{storedValue:n}=qe(e,t);o(e,n),c[e]&&l(t=>({...t,[e]:``}))}catch{l(n=>({...n,[e]:ct(e,t)}))}},b=e=>{if(p(t=>t===e?null:t),ct(e,u[e]))return;let{displayValue:t}=qe(e,u[e]);d(n=>({...n,[e]:t}))};return(0,V.jsx)(J,{description:`Link your social accounts for full structured data and rich card support`,isEditing:n,keywords:e,navid:`social-accounts`,saveState:r,testId:`social-accounts`,title:`Social accounts`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:()=>{let e=v.reduce((e,t)=>{if(!m[t.key])return e;let n=ct(t.key,u[t.key]);return n&&(e[t.key]=n),e},{});l(e),Object.keys(e).length===0&&i()},children:(0,V.jsx)(F,{children:v.map(e=>(0,V.jsx)(k,{"data-testid":e.testId,error:!!c[e.key],hint:c[e.key],placeholder:e.placeholder,title:e.publicationTitle,value:u[e.key],onBlur:()=>b(e.key),onChange:t=>y(e.key,t.target.value),onFocus:()=>p(e.key)},e.key))})})},`Social accounts`),As=[{name:`Pacific/Pago_Pago`,label:`Midway Island, Samoa`},{name:`Pacific/Honolulu`,label:`Hawaii`},{name:`America/Anchorage`,label:`Alaska`},{name:`America/Tijuana`,label:`Tijuana`},{name:`America/Los_Angeles`,label:`Pacific Time (US & Canada)`},{name:`America/Mazatlan`,label:`La Paz, Mazatlan`},{name:`America/Phoenix`,label:`Arizona`},{name:`America/Denver`,label:`Mountain Time (US & Canada)`},{name:`America/Chihuahua`,label:`Chihuahua`},{name:`America/Costa_Rica`,label:`Central America`},{name:`America/Chicago`,label:`Central Time (US & Canada)`},{name:`America/Mexico_City`,label:`Guadalajara, Mexico City, Monterrey`},{name:`America/Regina`,label:`Saskatchewan`},{name:`America/Bogota`,label:`Bogota, Lima, Quito`},{name:`America/New_York`,label:`Eastern Time (US & Canada)`},{name:`America/Fort_Wayne`,label:`Indiana (East)`},{name:`America/Caracas`,label:`Caracas, La Paz, Georgetown`},{name:`America/Halifax`,label:`Atlantic Time (Canada); Greenland`},{name:`America/Santiago`,label:`Santiago`},{name:`America/St_Johns`,label:`Newfoundland`},{name:`America/Argentina/Buenos_Aires`,label:`Buenos Aires, Brasilia`},{name:`America/Noronha`,label:`Fernando de Noronha`},{name:`Atlantic/Azores`,label:`Azores`},{name:`Atlantic/Cape_Verde`,label:`Cape Verde Is.`},{name:`Etc/UTC`,label:`UTC`},{name:`Africa/Casablanca`,label:`Casablanca, Monrovia`},{name:`Europe/Dublin`,label:`Dublin, Edinburgh, London`},{name:`Europe/Amsterdam`,label:`Amsterdam, Berlin, Rome, Stockholm, Vienna`},{name:`Europe/Prague`,label:`Belgrade, Bratislava, Budapest, Prague`},{name:`Europe/Paris`,label:`Brussels, Copenhagen, Madrid, Paris`},{name:`Europe/Warsaw`,label:`Sarajevo, Skopje, Warsaw, Zagreb`},{name:`Africa/Lagos`,label:`West Central Africa`},{name:`Europe/Athens`,label:`Athens, Beirut, Bucharest`},{name:`Africa/Cairo`,label:`Cairo, Egypt`},{name:`Africa/Maputo`,label:`Harare`},{name:`Europe/Kiev`,label:`Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius`},{name:`Asia/Jerusalem`,label:`Jerusalem`},{name:`Africa/Johannesburg`,label:`Pretoria`},{name:`Asia/Baghdad`,label:`Baghdad`},{name:`Asia/Riyadh`,label:`Kuwait, Nairobi, Riyadh`},{name:`Europe/Istanbul`,label:`Istanbul, Ankara`},{name:`Europe/Moscow`,label:`Moscow, St. Petersburg, Volgograd`},{name:`Asia/Tehran`,label:`Tehran`},{name:`Asia/Dubai`,label:`Abu Dhabi, Muscat`},{name:`Asia/Baku`,label:`Baku, Tbilisi, Yerevan`},{name:`Asia/Kabul`,label:`Kabul`},{name:`Asia/Almaty`,label:`Almaty, Astana`},{name:`Asia/Karachi`,label:`Islamabad, Karachi, Tashkent`},{name:`Asia/Yekaterinburg`,label:`Yekaterinburg`},{name:`Asia/Kolkata`,label:`Chennai, Kolkata, Mumbai, New Delhi`},{name:`Asia/Colombo`,label:`Colombo, Sri Jayawardenepura`},{name:`Asia/Kathmandu`,label:`Kathmandu`},{name:`Asia/Dhaka`,label:`Dhaka`},{name:`Asia/Rangoon`,label:`Yangon (Rangoon)`},{name:`Asia/Bangkok`,label:`Bangkok, Hanoi, Jakarta`},{name:`Asia/Krasnoyarsk`,label:`Krasnoyarsk, Novosibirsk`},{name:`Asia/Hong_Kong`,label:`Beijing, Chongqing, Hong Kong, Urumqi`},{name:`Asia/Irkutsk`,label:`Irkutsk, Ulaanbaatar`},{name:`Asia/Singapore`,label:`Kuala Lumpur, Perth, Singapore, Taipei`},{name:`Asia/Tokyo`,label:`Osaka, Sapporo, Tokyo`},{name:`Asia/Seoul`,label:`Seoul`},{name:`Asia/Yakutsk`,label:`Yakutsk`},{name:`Australia/Adelaide`,label:`Adelaide`},{name:`Australia/Darwin`,label:`Darwin`},{name:`Australia/Brisbane`,label:`Brisbane, Guam, Port Moresby`},{name:`Australia/Sydney`,label:`Canberra, Hobart, Melbourne, Sydney, Vladivostok`},{name:`Asia/Magadan`,label:`Magadan, Soloman Is., New Caledonia`},{name:`Pacific/Auckland`,label:`Auckland, Wellington`},{name:`Pacific/Fiji`,label:`Fiji, Kamchatka, Marshall Is.`},{name:`Pacific/Kwajalein`,label:`International Date Line West`}],js=e=>{let t={timeZone:e,timeZoneName:`longOffset`};try{let e=new Intl.DateTimeFormat(`en-GB`,t).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(!e)return{offsetString:null,offsetMinutes:0};let n=e.match(/^GMT([+-])(\d{2}):(\d{2})$/);if(!n)return{offsetString:e,offsetMinutes:0};let[,r,i,a]=n,o=parseInt(i,10),s=parseInt(a,10),c=r===`+`?o*60+s:-(o*60+s);return{offsetString:c===0?`GMT`:`GMT ${r}${o}:${s.toString().padStart(2,`0`)}`,offsetMinutes:c}}catch{return{offsetString:null,offsetMinutes:0}}},Ms=(e,t)=>`(${t}) ${e}`,Ns=()=>As.map(({name:e,label:t})=>{let{offsetString:n,offsetMinutes:r}=js(e);return{name:e,label:n?Ms(t,n):t,offsetMinutes:r}}).sort((e,t)=>e.offsetMinutes-t.offsetMinutes),Ps=({timezone:e})=>{let[t,n]=(0,B.useState)(_e(e));return(0,B.useEffect)(()=>{let t=setInterval(()=>{n(_e(e))},1e3);return()=>{clearInterval(t)}},[e]),(0,V.jsxs)(V.Fragment,{children:[`The local time here is currently `,t]})},Fs=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c]=z(t,[`timezone`]),l=Ns().map(e=>({value:e.name,label:e.label})),u=e=>{o(`timezone`,e||null),s(!0)};return(0,V.jsx)(J,{description:`Set the time and date of your publication, used for all published posts`,hideEditButton:!0,isEditing:n,keywords:e,navid:`timezone`,saveState:r,testId:`timezone`,title:`Site timezone`,onCancel:a,onEditingChange:s,onSave:i,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsx)(De,{hint:(0,V.jsx)(Ps,{timezone:c}),options:l,selectedOption:l.find(e=>e.value===c),testId:`timezone-select`,title:`Site timezone`,isSearchable:!0,onSelect:e=>u(e?.value)})})})},`Site timezone`),Is=j(({keywords:e})=>{let{errors:t,localSettings:n,isEditing:r,saveState:i,focusRef:a,clearError:o,handleSave:s,handleCancel:c,updateSetting:l,handleEditingChange:u}=N({onValidate:()=>d?d.length<4?{title:`Please use a site title longer than 3 characters.`}:d.length>63?{title:`Please use a site title shorter than 63 characters.`}:{}:{title:`Please enter a site title.`}}),[d,f]=z(n,[`title`,`description`]),p=e=>{l(`title`,e.target.value)},m=e=>{l(`description`,e.target.value)},h=(0,V.jsx)(F,{columns:2,values:[{heading:`Site title`,key:`site-title`,value:d},{heading:`Site description`,key:`site-description`,value:f}]}),g=(0,V.jsxs)(F,{children:[(0,V.jsx)(k,{error:!!t.title,hint:t.title||`The name of your site`,inputRef:a,maxLength:63,placeholder:`Site title`,title:`Site title`,value:d,onChange:p,onKeyDown:()=>o(`title`)}),(0,V.jsx)(k,{hint:`A short description, used in your theme, meta data and search results`,maxLength:200,placeholder:`Site description`,title:`Site description`,value:f,onChange:m})]});return(0,V.jsx)(J,{description:`The details used to identify your publication around the web`,isEditing:r,keywords:e,navid:`general`,saveState:i,testId:`title-and-description`,title:`Title & description`,onCancel:c,onEditingChange:u,onSave:s,children:r?g:h})},`Title & description`),Ls=({user:e})=>{let{updateRoute:t}=P(),{currentUser:n}=I();return e?(0,V.jsxs)(`div`,{className:D(`group flex gap-3`,Sn(n)&&`cursor-pointer`),"data-testid":`owner-user`,onClick:()=>{Sn(n)&&t({route:`staff/${e.slug}`})},children:[(0,V.jsx)(ce,{bgColor:Je(e.name?e.name:e.email),image:e.profile_image??void 0,label:ge(e.name),labelColor:`white`,size:`lg`}),(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsxs)(`span`,{children:[e.name,` — `,(0,V.jsx)(`strong`,{children:`Owner`}),` `,Sn(n)&&(0,V.jsx)(`button`,{className:`ml-2 inline-block font-semibold text-green group-hover:visible md:invisible`,type:`button`,children:`View profile`})]}),(0,V.jsx)(`span`,{className:`text-sm text-grey-700`,children:e.email})]})]}):null},Rs=({users:e,groupname:t})=>{let{updateRoute:n}=P(),{currentUser:r}=I(),i=e=>{n({route:`staff/${e.slug}`})};return!e||!e.length?(0,V.jsxs)(oe,{icon:`single-user-block`,children:[`No `,t,` found.`]}):(0,V.jsx)(A,{titleSeparator:!1,children:e.map(e=>{let t=e.name||``;e.status===`inactive`&&(t=`${t} (Suspended)`);let n=Sn(r)||wn(r)&&xn(e)||r.id===e.id;return(0,V.jsx)(we,{action:n&&(0,V.jsx)(L,{color:`green`,label:`Edit`,link:!0,onClick:()=>i(e)}),avatar:(0,V.jsx)(ce,{bgColor:Je(e.name?e.name:e.email),image:e.profile_image??void 0,label:ge(e.name),labelColor:`white`}),bgOnHover:n,className:`min-h-[64px]`,detail:e.email,hideActions:!0,id:`list-item-${e.id}`,separator:!1,testId:`user-list-item`,title:t,onClick:()=>n&&i(e)},e.id)})})},zs=({invite:e})=>{let[t,n]=(0,B.useState)(``),[r,i]=(0,B.useState)(``),{mutateAsync:a}=Te(),{mutateAsync:o}=Ee(),s=p(),c=`Revoke`;t===`progress`&&(c=`Revoking...`);let l=`Resend`;return r===`progress`&&(l=`Resending...`),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(L,{color:`red`,label:c,link:!0,onClick:async()=>{try{n(`progress`),await a(e.id),u({title:`Invitation revoked`,message:e.email,type:`success`})}catch(e){s(e)}finally{n(``)}}}),(0,V.jsx)(L,{className:`ml-2`,color:`green`,label:l,link:!0,onClick:async()=>{try{i(`progress`),await a(e.id),await o({email:e.email,roleId:e.role_id}),u({title:`Invitation resent`,message:e.email,type:`success`})}catch(e){s(e)}finally{i(``)}}})]})},Bs=({users:e})=>!e||!e.length?(0,V.jsx)(oe,{icon:`single-user-block`,children:`No invitations found.`}):(0,V.jsx)(A,{children:e.map(e=>(0,V.jsx)(we,{action:(0,V.jsx)(zs,{invite:e}),avatar:(0,V.jsx)(ce,{bgColor:Je(e.email),image:``,label:e.email.charAt(0).toUpperCase(),labelColor:`white`}),className:`min-h-[64px]`,detail:e.role,hideActions:!0,id:`list-item-${e.id}`,separator:!1,testId:`user-invite`,title:e.email,onClick:()=>{}},e.id))}),Vs=j(({keywords:e,highlight:t=!0})=>{let{totalUsers:n,totalInvites:r,users:i,ownerUser:a,adminUsers:o,editorUsers:s,authorUsers:c,contributorUsers:l,invites:u,hasNextPage:d,fetchNextPage:f,invitesHasNextPage:m,fetchNextInvitePage:h}=Ct(),{updateRoute:g}=P(),{settings:_,config:v,currentUser:y}=I(),b=()=>{g(`staff/invite`)},x=(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Invite people`,size:`sm`,linkWithPadding:!0,onClick:()=>{b()}}),S=Me().getParam(`tab`),[w,ee]=(0,B.useState)(S||`administrators`);(0,B.useEffect)(()=>{S&&ee(S)},[S]);let T=e=>{g(`staff?tab=${e}`),ee(e)},te=[{id:`administrators`,title:`Administrators`,contents:(0,V.jsx)(Rs,{groupname:`administrators`,users:o}),counter:o.length?o.length:void 0},{id:`editors`,title:`Editors`,contents:(0,V.jsx)(Rs,{groupname:`editors`,users:s}),counter:s.length?s.length:void 0},{id:`authors`,title:`Authors`,contents:(0,V.jsx)(Rs,{groupname:`authors`,users:c}),counter:c.length?c.length:void 0},{id:`contributors`,title:`Contributors`,contents:(0,V.jsx)(Rs,{groupname:`contributors`,users:l}),counter:l.length?l.length:void 0},{id:`invited`,title:`Invited`,contents:(0,V.jsx)(Bs,{users:u}),counter:r||void 0}],E=Wn(_,`require_email_mfa`)||!1,{mutateAsync:D}=Vn(),O=p();return(0,V.jsxs)(J,{customButtons:x,highlightOnModalClose:t,keywords:e,navid:`staff`,testId:`users`,title:`Staff`,children:[(0,V.jsx)(Ls,{user:a}),(i.length>1||u.length>0)&&(0,V.jsx)(Ze,{selectedTab:w,tabs:te,testId:`user-tabview`,onTabChange:T}),d&&w!==`invited`&&(0,V.jsx)(L,{label:`Load more (showing ${i.length}/${n} users)`,link:!0,onClick:()=>f()}),m&&w===`invited`&&(0,V.jsx)(L,{label:`Load more (showing ${u.length}/${r} invites)`,link:!0,onClick:()=>h()}),v?.security?.staffDeviceVerification&&Sn(y)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 ${i.length>1||u.length>0?`-mt-6`:``}`,children:[(0,V.jsx)(C,{}),(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[1.5rem] font-semibold tracking-tight`,children:`Security settings`}),(0,V.jsx)(`span`,{children:`Require email 2FA codes to be used on all staff logins`})]}),(0,V.jsx)(wt,{checked:E,direction:`rtl`,gap:`gap-0`,onChange:async()=>{let e=!E;try{await D([{key:`require_email_mfa`,value:e}])}catch(e){O(e)}}})]})]})]})},`Staff`),X={titleAndDescription:[`general`,`title and description`,`site title`,`site description`,`title & description`],timeZone:[`general`,`time`,`date`,`site timezone`,`time zone`],publicationLanguage:[`general`,`publication language`,`locale`],users:[`general`,`users and permissions`,`roles`,`staff`,`invite people`,`contributors`,`editors`,`authors`,`administrators`],metadata:[`general`,`metadata`,`title`,`description`,`search`,`engine`,`google`,`meta data`,`twitter card`,`structured data`,`rich cards`,`x card`,`social`,`facebook card`,`llms`,`ai`,`ai search engines`,`llm`],socialAccounts:[`general`,`social accounts`,`facebook`,`twitter`,`threads`,`bluesky`,`mastodon`,`tiktok`,`youtube`,`instagram`,`linkedin`,`structured data`,`rich cards`],analytics:[`general`,`analytics`,`tracking`,`privacy`,`membership`]},Hs=()=>(0,V.jsxs)(Ea,{keywords:Object.values(X).flat(),title:`General settings`,children:[(0,V.jsx)(Is,{keywords:X.titleAndDescription}),(0,V.jsx)(Fs,{keywords:X.timeZone}),(0,V.jsx)(Cs,{keywords:X.publicationLanguage}),(0,V.jsx)(Vs,{keywords:X.users}),(0,V.jsx)(Ts,{keywords:X.metadata}),(0,V.jsx)(ks,{keywords:X.socialAccounts}),(0,V.jsx)(ys,{keywords:X.analytics})]}),Us=({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Embed`,size:`sm`,onClick:()=>{t(`embed-signup-form/show`)}}),description:`Grow your audience from anywhere on the web`,keywords:e,navid:`embed-signup-form`,testId:`embed-signup-form`,title:`Signup forms`})},Ws=``+new URL(`explore-default-logo-P7UjmPqe.png`,import.meta.url).href,Gs=``+new URL(`ghost-explore-BuZQ7HbF.png`,import.meta.url).href,Ks=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Vn(),r=p(),{updateRoute:i}=P(),{refetch:a}=nr({searchParams:{limit:`1`}}),[o,s]=(0,B.useState)(0);(0,B.useEffect)(()=>{(async()=>{let{data:e}=await a(),t=e?.meta?.pagination?.total||0;s(t)})()},[a]);let[c,u]=z(t,[`accent_color`,`icon`]),{localSettings:d,siteData:f}=N(),[m,h]=z(d,[`title`,`description`]),g=!!Wn(t,`explore_ping`),_=!!Wn(t,`explore_ping_growth`),v=f?.url,y=v?.replace(/^https?:\/\//,``).replace(/\/?$/,``),b=c||`#F6414E`,x=async(e,t)=>{let i=[{key:e,value:t.target.checked}];try{await n(i)}catch(e){r(e)}};return(0,V.jsx)(J,{customButtons:(0,V.jsx)(wt,{checked:g,direction:`rtl`,testId:`explore-toggle`,onChange:e=>x(`explore_ping`,e)}),description:`Promote your site across Ghost's website and publishing network`,keywords:e,navid:`explore`,testId:`explore`,title:`Ghost Explore`,children:g?(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(C,{}),(0,V.jsx)(wt,{checked:_,containerClasses:`items-center!`,direction:`rtl`,gap:`gap-0`,hint:`Enabling this will use your revenue/member growth data to rank your site more highly on Ghost Explore. Total member count will be displayed publicly, other data will be kept private.`,label:`Share growth data to rank higher?`,labelClasses:`w-full`,testId:`explore-growth-toggle`,onChange:e=>x(`explore_ping_growth`,e)}),(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 flex flex-col items-center bg-grey-50 px-7 py-10 md:-mx-7 md:-mb-7`,"data-testid":`explore-preview`,children:(0,V.jsxs)(`div`,{className:`relative w-full max-w-[320px] rounded-lg bg-white p-6 text-black shadow-lg`,children:[(0,V.jsx)(`div`,{className:`absolute top-2.5 right-3 text-sm text-grey-300 uppercase`,children:`Preview`}),u?(0,V.jsx)(`div`,{className:`size-9 rounded-sm bg-cover bg-center`,style:{backgroundImage:`url(${u})`}}):(0,V.jsx)(`div`,{className:`flex aspect-square size-10 items-center justify-center overflow-hidden rounded-full p-1 text-white`,style:{backgroundColor:b},children:(0,V.jsx)(`img`,{className:`h-auto w-8`,src:Ws})}),(0,V.jsx)(`div`,{className:`mt-3 text-lg font-semibold tracking-tight`,children:m}),h&&(0,V.jsx)(`div`,{className:`mt-0.5 leading-tight text-grey-700`,children:h}),(0,V.jsxs)(`a`,{className:`group mt-8 flex h-6 w-full items-center justify-between gap-5 hover:cursor-pointer`,href:v,rel:`noopener noreferrer`,target:`_blank`,children:[(0,V.jsx)(`span`,{className:`font-semibold`,children:y}),_?(0,V.jsxs)(`span`,{className:`rounded-sm bg-black px-2 py-0.5 text-sm font-semibold text-white`,"data-testid":`explore-members-count`,children:[tn(o),`\xA0`,o===1?`member`:`members`]}):(0,V.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full border border-black text-black group-hover:bg-black group-hover:text-white`,children:(0,V.jsx)(l,{name:`arrow-right`,size:10})})]})]})}),(0,V.jsxs)(`div`,{className:`-mx-5 -mb-5 flex items-center justify-between gap-4 rounded-b-xl border-t border-[rgba(142,66,255,0.1)] bg-gradient-to-tr from-[rgba(142,66,255,0.07)] to-[rgba(142,66,255,0.02)] p-6 px-7 md:-mx-7 md:-mb-7`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Get featured on the Ghost.org homepage`}),(0,V.jsx)(`span`,{className:`text-pretty text-black/80 dark:text-white/80`,children:`Send us a quote we can use to highlight your site`})]}),(0,V.jsx)(L,{className:`border border-purple bg-white text-purple hover:bg-purple/5 hover:text-purple dark:bg-transparent`,icon:`send`,label:`Send testimonial`,onClick:()=>{i(`explore/testimonial`)}})]})]}):(0,V.jsx)(`img`,{src:Gs})})},`Ghost Explore`),qs=``+new URL(`network-C2Wz-Sfw.png`,import.meta.url).href,Js=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Vn(),r=p(),{updateRoute:i}=P(),a=Se()?.isDisabled(`limitSocialWeb`),{subdir:o}=c(),[s]=z(t,[`is_private`]),u=!!o,d=[`localhost`,`127.0.0.1`,`::1`].includes(window.location.hostname),f=vo.default.isIP(window.location.hostname),m=a||u||d||f,h=!!s,g=m||h,[_]=z(t,[`social_web`]),v=!!_&&!g;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(wt,{checked:v,direction:`rtl`,disabled:g,onChange:async e=>{let t=[{key:`social_web`,value:e.target.checked}];try{await n(t)}catch(e){r(e)}}},`${v}-${g}`),description:`Distribute posts to the social web, so people can discover and follow your content across BlueSky, Threads, Mastodon, Flipboard, WordPress, and more.`,keywords:e,navid:`network`,testId:`network`,title:`Network`,children:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(F,{columns:1,values:[{key:`private`,value:g&&(0,V.jsxs)(`div`,{className:`flex w-full gap-1.5 rounded-md border border-grey-200 bg-grey-50 p-3 dark:border-grey-900 dark:bg-grey-900`,children:[(0,V.jsx)(l,{name:`info`,size:16}),(0,V.jsx)(`div`,{className:`-mt-0.5`,children:h?(0,V.jsxs)(V.Fragment,{children:[`Network is automatically disabled while your site is in `,(0,V.jsx)(`span`,{className:`cursor-pointer text-green`,onClick:()=>i(`members`),children:`private mode`})]}):(0,V.jsxs)(V.Fragment,{children:[`You need to configure a supported custom domain to use this feature. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/social-web/#custom-domain-required`,rel:`noopener noreferrer`,target:`_blank`,children:`Help →`})]})})]})}]}),(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl md:-mx-7 md:-mb-7`,children:(0,V.jsx)(`img`,{className:`dark:opacity-90`,src:qs})})]})})},`Network`),Ys=j(({keywords:e})=>{let{updateRoute:t}=P(),{settings:n,config:r}=I(),{data:{offers:i=[]}={}}=$t(),{data:{tiers:a}={}}=cr(),o=ur(a||[]),s=i.filter(e=>e.redemption_type===`signup`);return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,disabled:!$n(n,r),label:`Manage offers`,size:`sm`,onClick:()=>{t(`offers/edit`)}}),description:(0,V.jsxs)(V.Fragment,{children:[`Create discounts & coupons to boost new subscriptions and retain existing members.`,(0,V.jsx)(`span`,{children:` `}),(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/offers`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]}),keywords:e,navid:`offers`,testId:`offers`,title:`Offers`,children:o.length===0&&s.length===0?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:`You must have an active tier to create an offer.`}),` `,(0,V.jsx)(L,{className:`font-normal`,color:`green`,label:`Manage tiers`,link:!0,linkWithPadding:!0,onClick:()=>{t(`/tiers`)}})]}):``})},`Portal settings`),Xs=({incomingRecommendation:e,stats:t})=>{let{updateRoute:n}=P(),r=(0,B.useMemo)(()=>{let n=e.url;try{n=new URL(e.url).hostname.replace(/^www\./,``)}catch{}return t.reduce((e,t)=>t.source===n?e+t.signups:e,0)},[t,e.url]),i=()=>{n({route:`recommendations/add?url=${e.url}`})},a=()=>{window.open(e.url,`_blank`)},o=r===1?`free member`:`free members`;return(0,V.jsxs)(lt,{action:!e.recommending_back&&(0,V.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,V.jsx)(L,{color:`green`,label:`Recommend back`,size:`sm`,link:!0,onClick:i})}),testId:`incoming-recommendation-list-item`,hideActions:!0,children:[(0,V.jsx)(_t,{className:`w-80`,onClick:a,children:(0,V.jsx)(`div`,{className:`group flex items-center gap-3 hover:cursor-pointer`,children:(0,V.jsx)(`div`,{className:`flex grow flex-col`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(ne,{favicon:e.favicon,featured_image:e.featured_image,title:e.title||e.url}),(0,V.jsx)(`span`,{className:`line-clamp-1 font-medium`,children:e.title||e.url})]})})})}),(0,V.jsx)(_t,{className:`hidden w-auto text-left whitespace-nowrap md:visible! md:table-cell!`,padding:!1,valign:`middle`,onClick:a,children:r===0?(0,V.jsx)(`span`,{className:`text-grey-500 dark:text-grey-900`,children:`-`}):(0,V.jsx)(`div`,{className:`mr-2`,children:(0,V.jsx)(`span`,{children:le(r)})})}),(0,V.jsx)(_t,{className:`hidden w-[1%] whitespace-nowrap md:visible! md:table-cell!`,valign:`middle`,onClick:a,children:r===0?null:(0,V.jsx)(`div`,{className:`-mt-px text-left`,children:(0,V.jsx)(`span`,{className:`-mb-px inline-block min-w-[60px] text-left whitespace-nowrap text-grey-700 lowercase`,children:o})})}),e.recommending_back&&(0,V.jsx)(_t,{className:`w-[1%] whitespace-nowrap group-hover/table-row:visible md:invisible`,children:(0,V.jsx)(`div`,{className:`mt-1 text-right whitespace-nowrap text-grey-700`,children:`Recommending`})})]})},Zs=({incomingRecommendations:e,stats:t,pagination:n,showMore:r,isLoading:i})=>i||e.length?(0,V.jsx)(St,{isLoading:i,pagination:n,showMore:r,hintSeparator:!0,children:e.map(e=>(0,V.jsx)(Xs,{incomingRecommendation:e,stats:t},e.id))}):(0,V.jsx)(oe,{children:(0,V.jsx)(`span`,{className:`max-w-[40ch] text-center`,children:`No one’s recommended you yet. Once they do, you’ll find them here along with how many memberships they’ve driven.`})}),Qs=({recommendation:e})=>{let{route:t}=P(),n=()=>{w.show(We,{pathName:t,animate:!1,recommendation:e})},r=e.one_click_subscribe,i=r&&!!e.count?.subscribers,a=(i?e.count?.subscribers:e.count?.clicks)||0,o=a===1?`signup`:`signups`,s=a===1?`click`:`clicks`;return(0,V.jsxs)(lt,{className:`group hover:cursor-pointer`,testId:`recommendation-list-item`,onClick:n,children:[(0,V.jsx)(_t,{className:`w-80`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(ne,{isGhostSite:r,...e}),(0,V.jsx)(`span`,{className:`line-clamp-1 font-medium`,children:e.title})]})}),(0,V.jsx)(_t,{className:`hidden w-auto text-left align-middle whitespace-nowrap md:visible! md:table-cell!`,children:a===0?(0,V.jsx)(`span`,{className:`text-grey-500 dark:text-grey-900`,children:`-`}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`mr-2`,children:(0,V.jsx)(`span`,{children:le(a)})}),(0,V.jsxs)(`div`,{className:`text-grey-700 lowercase`,children:[(0,V.jsx)(`span`,{children:i?o:s}),(0,V.jsx)(`span`,{className:`invisible group-hover:visible`,children:` from you`})]})]})})})]})},$s=({recommendations:e,pagination:t,showMore:n,isLoading:r})=>{let{siteData:i}=N(),a=`${i?.url.replace(/\/$/,``)}/#/portal/recommendations`,{updateRoute:o}=P(),s=()=>{o(`recommendations/add`)},[c,l]=(0,B.useState)(!1);return r||e.length?(0,V.jsx)(St,{hint:(0,V.jsxs)(`span`,{children:[`Shared with new members after signup, or anytime using `,(0,V.jsx)(vr,{href:a,target:`_blank`,children:`this link`}),(0,V.jsx)(pe,{containerClassName:`ml-1 align-middle leading-none`,content:c?`Copied`:`Copy link`,size:`sm`,children:(0,V.jsx)(L,{color:`clear`,hideLabel:!0,icon:c?`check-circle`:`duplicate`,iconColorClass:c?`text-green w-[14px] h-[14px]`:`text-grey-600 hover:opacity-80 w-[14px] h-[14px]`,label:c?`Copied`:`Copy`,unstyled:!0,onClick:()=>{navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}})})]}),isLoading:r,pagination:t,showMore:n,hintSeparator:!0,children:e&&e.map(e=>(0,V.jsx)(Qs,{recommendation:e},e.id))}):(0,V.jsxs)(oe,{children:[(0,V.jsx)(L,{color:`grey`,label:`Add first recommendation`,size:`sm`,onClick:()=>{s()}}),(0,V.jsxs)(`span`,{className:`mt-2 max-w-[40ch] text-center text-sm`,children:[`Need inspiration? `,(0,V.jsx)(vr,{href:`https://ghost.org/explore`,target:`_blank`,children:`Explore thousands of sites`})]})]})},ec=j(({keywords:e})=>{let{saveState:t,handleSave:n}=N(),{data:{meta:r,recommendations:i}={},isLoading:a,hasNextPage:o,fetchNextPage:s}=ve({searchParams:{include:`count.clicks,count.subscribers`,order:`created_at desc`,limit:`5`},getNextPageParams:(e,t)=>{if(!e.meta)return;let{limit:n,page:r,pages:i}=e.meta.pagination;if(r>=i)return;let a=typeof n==`number`&&n<100?1:r+1;return{...t,page:a.toString(),limit:`100`}},keepPreviousData:!0}),c={hasMore:!!o,loadMore:s},{data:{recommendations:l,meta:u}={},isLoading:d,hasNextPage:f,fetchNextPage:p}=se({searchParams:{limit:`5`,order:`created_at desc`},getNextPageParams:(e,t)=>{if(!e.meta)return;let{limit:n,page:r,pages:i}=e.meta.pagination;if(r>=i)return;let a=typeof n==`number`&&n<100?1:r+1;return{...t,page:a.toString(),limit:`100`}},keepPreviousData:!0}),{data:{stats:m}={},isLoading:h}=fr({}),g={hasMore:!!f,loadMore:p},[_,v]=(0,B.useState)(`your-recommendations`),y=[{id:`your-recommendations`,title:`Your recommendations`,counter:r?.pagination?.total,contents:(0,V.jsx)($s,{isLoading:a,recommendations:i??[],showMore:c})},{id:`recommending-you`,title:`Recommending you`,counter:u?.pagination?.total,contents:(0,V.jsx)(Zs,{incomingRecommendations:l??[],isLoading:d||h,showMore:g,stats:m??[]})}],b=(0,V.jsx)(V.Fragment,{children:`Recommend any publication that your audience will find valuable, and find out when others are recommending you.`}),{updateRoute:x}=P(),S=()=>{x(`recommendations/add`)};return(0,V.jsxs)(J,{beta:!0,customButtons:(0,V.jsx)(L,{className:`mt-[-5px] hidden md:!visible md:!block`,color:`clear`,label:`Add recommendation`,size:`sm`,onClick:()=>{S()}}),description:b,keywords:e,navid:`recommendations`,saveState:t,testId:`recommendations`,title:`Recommendations`,onSave:n,children:[(0,V.jsx)(`div`,{className:`flex justify-center rounded border border-green px-4 py-2 md:hidden`,children:(0,V.jsx)(L,{color:`light-grey`,label:`Add recommendation`,link:!0,onClick:()=>{S()}})}),(0,V.jsx)(Ze,{selectedTab:_,tabs:y,onTabChange:v})]})},`Recommendations`),Z={network:[`growth`,`network`,`activitypub`,`blog`,`fediverse`,`sharing`],explore:[`ghost explore`,`explore`,`growth`,`share`,`list`,`listing`],recommendations:[`growth`,`recommendations`,`recommend`,`blogroll`],embedSignupForm:[`growth`,`embeddable signup form`,`embeddable form`,`embeddable sign up form`,`embeddable sign up`],offers:[`growth`,`offers`,`discounts`,`coupons`,`promotions`]},tc=()=>{let{config:e,settings:t}=I(),n=$n(t||[],e||{});return(0,V.jsxs)(Ea,{keywords:[Z.network,Z.explore,Z.recommendations,Z.embedSignupForm,...n?[Z.offers]:[]].flat(),title:`Growth`,children:[(0,V.jsx)(Js,{keywords:Z.network}),(0,V.jsx)(Ks,{keywords:Z.explore}),(0,V.jsx)(ec,{keywords:Z.recommendations}),(0,V.jsx)(Us,{keywords:Z.embedSignupForm}),n&&(0,V.jsx)(Ys,{keywords:Z.offers})]})},nc=[{value:`public`,label:`Public`,hint:`Anyone can visit and read the website`},{value:`private`,label:`Private`,hint:`Access code required`}],rc=[{value:`all`,label:`Public`,hint:`Anyone can sign up and log in`},{value:`paid`,label:`Paid-members only`,hint:`A paid Stripe subscription is required to sign up`},{value:`invite`,label:`Invite-only`,hint:`People can sign in but won't be able to sign up`},{value:`none`,label:`Nobody`,hint:`Disable all member features, including newsletters`}],ic=[{value:`public`,label:`Public`,hint:`All site visitors to your site, no login required`},{value:`members`,label:`Members only`,hint:`All logged-in members`},{value:`paid`,label:`Paid-members only`,hint:`Only logged-in members with an active Stripe subscription`},{value:`tiers`,label:`Specific tiers`,hint:`Members with any of the selected tiers`}],ac=[{value:`all`,label:`All members`,hint:`Logged-in members`},{value:`paid`,label:`Paid-members only`,hint:`Only logged-in members with an active Stripe subscription`},{value:`off`,label:`Nobody`,hint:`Disable commenting completely`}],oc=j(({keywords:e})=>{let{settings:t}=I(),n=Se()?.isDisabled(`publicSiteAccess`),r=Zn(t,`is_private`)||Zn(t,`password`),{mutateAsync:i}=er(),[a,o]=B.useState(!1),{localSettings:s,isEditing:c,saveState:l,siteData:d,handleSave:f,handleCancel:p,updateSetting:m,handleEditingChange:h,errors:g,clearError:_}=N({onValidate:()=>v&&!y?{password:`Enter an access code`}:{}}),[v,y,b,x,w,ee]=z(s,[`is_private`,`password`,`members_signup_access`,`default_content_visibility`,`default_content_visibility_tiers`,`comments_enabled`]),[T,te]=z(t,[`is_private`,`public_hash`]),E=r?!0:v,{data:{tiers:D}={}}=cr(),O=[{label:`Active Tiers`,options:D?.filter(({active:e})=>e).map(e=>({value:e.id,label:e.name}))||[]},{label:`Archived Tiers`,options:D?.filter(({active:e})=>!e).map(e=>({value:e.id,label:e.name}))||[]}],ne=JSON.parse(w||`[]`),re=O.flatMap(e=>e.options).filter(e=>ne.includes(e.value)),ie=T&&E&&d?.url&&te?`${d.url.replace(/\/$/,``)}/${te}/rss`:null,ae=e=>{let t=e.map(e=>e.value);m(`default_content_visibility_tiers`,JSON.stringify(t))};return(0,V.jsx)(J,{description:`Set up who can browse your site, subscribe, read posts, and comment`,isEditing:c,keywords:e,navid:`members`,saveState:l,testId:`access`,title:`Access`,hideEditButton:!0,onCancel:p,onEditingChange:h,onSave:f,children:(0,V.jsxs)(F,{className:`gap-y-4`,columns:1,children:[n&&(0,V.jsx)(`div`,{className:`-m-5 overflow-hidden p-5`,children:(0,V.jsxs)(Fn,{className:`mb-2 flex w-full cursor-default flex-col gap-4 border-0 p-6 pt-5 transition-none hover:translate-y-0 hover:scale-100 hover:shadow-[-7px_-6px_42px_8px_rgb(75_225_226_/_28%),7px_6px_42px_8px_rgb(202_103_255_/_32%)] md:flex-row md:items-center md:justify-between dark:hover:shadow-[-7px_-6px_42px_8px_rgb(75_225_226_/_36%),7px_6px_42px_8px_rgb(202_103_255_/_38%)]`,size:`lg`,variant:`gradient`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-base font-semibold`,children:`Pre-launch mode`}),(0,V.jsx)(`div`,{className:`mt-2 text-gray-700`,children:`During your free trial, a private access code is required to browse your site. When you're ready to launch, pick a plan to upgrade your account and make everything public.`})]}),(0,V.jsx)(ln,{className:`shrink-0 self-start md:self-center`,asChild:!0,children:(0,V.jsx)(`a`,{href:`#/pro/billing/plans`,children:`Upgrade now`})})]})}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should be able to browse your site?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{containerClassName:r?`relative z-10`:void 0,disabled:r,options:nc,selectedOption:nc.find(e=>e.value===(E?`private`:`public`)),testId:`site-visibility-select`,onSelect:e=>{m(`is_private`,e?.value===`private`),h(!0)}})})]}),(E||r)&&(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row md:items-start`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px] md:pt-3`,children:`What access code should visitors use?`}),(0,V.jsxs)(`div`,{className:`w-full md:flex-1`,children:[(0,V.jsx)(k,{containerClassName:r?`relative z-10`:void 0,"data-testid":`site-access-code`,disabled:r,error:!!g.password,hint:g.password,placeholder:`Enter access code`,rightPlaceholder:(0,V.jsx)(`span`,{className:`flex h-full items-center`,children:(0,V.jsx)(`button`,{"aria-label":`Regenerate access code`,className:`mr-[5px] flex size-5 cursor-pointer items-center justify-center p-0 text-grey-900 disabled:cursor-not-allowed disabled:opacity-40 dark:text-grey-400`,"data-testid":`regenerate-access-code`,disabled:a,title:`Regenerate access code`,type:`button`,onClick:async()=>{o(!0);try{let e=(await i(null)).settings.find(e=>e.key===`password`)?.value;typeof e==`string`&&(m(`password`,e),_(`password`))}catch{u({type:`error`,title:`Could not regenerate access code`})}finally{o(!1)}},children:(0,V.jsx)(rn,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.5})})}),title:`Access code`,value:y||``,hideTitle:!0,onChange:e=>{m(`password`,e.target.value),h(!0)},onKeyDown:()=>_(`password`)}),ie&&!r&&(0,V.jsx)(S,{className:`mt-2`,children:(0,V.jsxs)(V.Fragment,{children:[`A private RSS feed is available `,(0,V.jsx)(`a`,{className:`text-green`,href:ie,rel:`noopener noreferrer`,target:`_blank`,children:`here`})]})})]})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should be able to subscribe to your site?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:rc,selectedOption:rc.find(e=>e.value===b),testId:`subscription-access-select`,onSelect:e=>{m(`members_signup_access`,e?.value||null),h(!0)}})})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should have access to new posts?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:ic,selectedOption:ic.find(e=>e.value===x),testId:`default-post-access-select`,onSelect:e=>{m(`default_content_visibility`,e?.value||null),h(!0)}})})]}),x===`tiers`&&(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Select specific tiers`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(de,{color:`black`,options:O.filter(e=>e.options.length>0),testId:`tiers-select`,values:re,onChange:e=>{ae(e),h(!0)}})})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who can comment on posts?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:ac,selectedOption:ac.find(e=>e.value===ee),testId:`commenting-select`,title:``,onSelect:e=>{m(`comments_enabled`,e?.value||null),h(!0)}})})]})]})})},`Access`),sc=j(({keywords:e})=>{let{siteData:t}=I(),[n,r]=(0,B.useState)(!1),i=`${t?.url.replace(/\/$/,``)}/#/portal/gift`;return(0,V.jsx)(J,{description:(0,V.jsxs)(V.Fragment,{children:[`Allow your readers to share your work by purchasing a gift subscription for a friend or colleague. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/gift-subscriptions/`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]}),keywords:e,navid:`gift-subscriptions`,testId:`gift-subscriptions`,title:`Gift subscriptions`,hideEditButton:!0,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsxs)(`div`,{className:`w-100`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsx)(T,{level:6,children:`Shareable link`})}),(0,V.jsxs)(`div`,{className:`group relative mt-0 flex w-100 items-center justify-between overflow-hidden border-b border-transparent pt-1 pb-2 hover:border-grey-300 dark:hover:border-grey-600`,children:[(0,V.jsx)(`span`,{"data-testid":`gift-url`,children:i}),(0,V.jsxs)(`div`,{className:`invisible flex gap-1 bg-white pl-1 group-hover:visible dark:bg-black`,children:[(0,V.jsx)(L,{color:`clear`,"data-testid":`preview-shareable-link`,label:`Preview`,size:`sm`,onClick:()=>{window.open(i,`_blank`)}}),(0,V.jsx)(L,{color:`light-grey`,"data-testid":`copy-shareable-link`,label:n?`Copied`:`Copy link`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3)}})]})]})]})})})},`Gift subscriptions`),cc=()=>{let{settings:e,siteData:t}=I(),[n,r=!1,i=!1]=z(e,[`members_signup_access`,`donations_enabled`,`recommendations_enabled`]);if(typeof n!=`string`)throw TypeError(`members_signup_access should be a string`);if(typeof r!=`boolean`)throw TypeError(`donations_enabled should be a boolean`);if(typeof i!=`boolean`)throw TypeError(`recommendations_enabled should be a boolean`);return zt({siteUrl:t.url,membersSignupAccess:n,donationsEnabled:r,recommendationsEnabled:i})},lc={useFileUpload:Gt,fileTypes:Jt},uc=R(`pb-10 text-[1.6rem] leading-[1.6] tracking-[-0.01em]`,`dark:text-white dark:selection:bg-[rgba(88,101,116,0.99)]`,`[&_.koenig-lexical-editor-input-placeholder]:font-sans! [&_.koenig-lexical-editor-input-placeholder]:text-[1.6rem] [&_.koenig-lexical-editor-input-placeholder]:tracking-tight`,`[&_:is(h2,h3)]:dark:text-white`,`[&_.koenig-lexical_input]:text-[1.4rem]`,`[&_[data-kg-plus-button]]:top-[-4px]`,`[&_[data-kg-card-selected]]:isolate`,`[&_:is(p,blockquote,aside,ul,ol)]:tracking-tight`,`[&_figcaption_:is(p,blockquote,aside,ul,ol)]:text-[1.4rem] [&_figcaption_:is(p,blockquote,aside,ul,ol)]:tracking-[.025em]`,`[&_figcaption_p]:mb-0`,`[&_:is(h1)]:text-[36px] [&_:is(h1,h2,h3,h4,h5,h6)]:mb-[0.5em] [&_:is(h2)]:text-[32px] [&_:is(h3)]:text-[26px] [&_:is(h4)]:text-[21px] [&_:is(h5)]:text-[19px] [&_:is(h6)]:text-[19px]`,`[&_:is(hr)]:pt-0`,`[&_p]:mb-4 [&_strong]:font-semibold`,`[&_[data-kg-settings-panel]_p]:!mb-0`,`[&_.not-kg-prose>div]:font-sans! [&_.not-kg-prose>div]:text-[1.6rem]! [&_.not-kg-prose>div]:leading-[1.6]! [&_.not-kg-prose>div]:tracking-tight!`,`[&_.kg-inherit-styles_p]:mb-0!`,`[&_.kg-inherit-styles]:pt-[3px]!`,`[&_.koenig-lexical-cta-label_p]:!text-[12.5px]`),dc=({editor:e,darkMode:t,cardConfig:n,initialEditorState:r,placeholder:i,className:a,registerAPI:o,onChange:s})=>{let c=e.read().EmailEditor;return(0,V.jsx)(`div`,{className:R(`koenig-react-editor w-full`,uc,a),children:(0,V.jsx)(c,{cardConfig:n,className:`koenig-lexical koenig-lexical-editor-input`,darkMode:t,fileUploader:lc,initialEditorState:r,placeholderText:i,registerAPI:o,onChange:s})})},fc=B.memo(({value:e,placeholder:t,className:n,onChange:i})=>{let a=(0,B.useRef)(null),o=(0,B.useRef)(e),{unsplashConfig:s}=r(),c=Wt(),{config:l,settings:u}=I(),{fetchAutocompleteLinks:d,searchLinks:f}=cc(),p=Bt(),m=l.klipy?.apiKey?l.klipy:null,{fetchKoenigLexical:h,darkMode:g}=te(),_=(0,B.useMemo)(()=>me(h),[h]),[v]=z(u,[`transistor`]),y=(0,B.useMemo)(()=>({unsplash:s,pinturaConfig:c,klipy:m,fetchEmbed:p,fetchAutocompleteLinks:d,searchLinks:f,feature:{transistor:v},visibilitySettings:`none`}),[s,c,m,p,d,f,v]),b=(0,B.useCallback)(e=>{a.current=e},[]),x=(0,B.useCallback)(e=>{i&&e&&typeof e==`object`&&i(JSON.stringify(e))},[i]),S=(0,B.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&e.stopPropagation()},[]);return(0,V.jsx)(`div`,{className:`h-full`,onKeyDown:S,onMouseDown:e=>{a.current&&Qt(a.current,e)},children:(0,V.jsx)(st,{name:`email-editor`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Ve,{delay:200,size:`lg`}),children:(0,V.jsx)(dc,{cardConfig:y,className:n,darkMode:g,editor:_,initialEditorState:o.current,placeholder:t,registerAPI:b,onChange:x})})})})}),pc=({previewState:e})=>{let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(!1),o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null);function u(){s.current?.disconnect(),s.current=null,c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)}(0,B.useEffect)(()=>(u(),a.current=!1,i(!1),n(null),()=>{u()}),[e.status===`success`?e.html:``,e.status]);function d(){let e=o.current,t=e?.contentDocument;if(!e||!t)return;t.documentElement.style.overflowY=`hidden`,t.body.style.overflowY=`hidden`;let r=Math.max(t.documentElement?.scrollHeight||0,t.body?.scrollHeight||0,t.documentElement?.offsetHeight||0,t.body?.offsetHeight||0);r>0&&(n(e=>e===r?e:r),!a.current&&l.current===null&&(l.current=window.requestAnimationFrame(()=>{l.current=window.requestAnimationFrame(()=>{l.current=null,a.current=!0,i(!0)})})))}function f(){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{c.current=null,d()})}function p(){let e=o.current,t=e?.contentDocument;if(!(!e||!t)&&(u(),f(),typeof ResizeObserver<`u`)){let e=new ResizeObserver(()=>{f()});e.observe(t.documentElement),e.observe(t.body),s.current=e}}return(0,V.jsxs)(`div`,{className:`relative w-full`,"data-testid":`welcome-email-preview`,children:[(e.status===`loading`||e.status===`success`&&!r)&&(0,V.jsx)(`div`,{className:`flex min-h-full items-start justify-center pt-24`,"data-testid":`welcome-email-preview-loading`,style:t?{height:`${t}px`}:void 0,children:(0,V.jsx)(Ve,{})}),e.status===`success`&&(0,V.jsx)(`div`,{"aria-hidden":!r,className:R(`w-full`,!r&&`pointer-events-none absolute top-0 left-0 opacity-0`),children:(0,V.jsx)(`iframe`,{ref:o,className:`w-full rounded bg-white`,"data-testid":`welcome-email-preview-iframe`,sandbox:`allow-same-origin allow-popups allow-popups-to-escape-sandbox`,srcDoc:e.html,style:{height:t?`${t}px`:`600px`},title:`Welcome email preview`,onLoad:p})}),(e.status===`error`||e.status===`invalid`)&&(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-4`,"data-testid":`welcome-email-preview-error`,children:(0,V.jsx)(S,{color:`red`,children:e.message})})]})},mc=e=>{if(!e)return!0;try{let t=JSON.parse(e)?.root?.children;return!t||t.length===0||t.length===1&&t[0].type===`paragraph`&&(!t[0].children||t[0].children.length===0)}catch{return!0}},hc=e=>{let t={};return e.subject?.trim()||(t.subject=`A subject is required`),mc(e.lexical)&&(t.lexical=`Email content is required`),t},gc=e=>{if(typeof DOMParser>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`a[href]`).forEach(e=>{e.target=`_blank`,e.rel=`noopener noreferrer`}),`<!doctype html>${t.documentElement.outerHTML}`},_c=e=>{let t=`Failed to render preview`;return e instanceof a&&e.data?.errors?.[0]?e.data.errors[0].context||e.data.errors[0].message||t:e instanceof Error&&e.message?e.message:t},vc=({automatedEmailId:e,previewWelcomeEmail:t,setErrors:n})=>{let[r,i]=(0,B.useState)({status:`idle`}),a=(0,B.useRef)(0),o=()=>{a.current+=1,i({status:`idle`})},s=async r=>{let o=a.current+1;a.current=o;let s=hc(r);if(n(s),s.subject||s.lexical){i({status:`invalid`,message:s.subject||s.lexical});return}i({status:`loading`});try{let n=await t({id:e,subject:r.subject,lexical:r.lexical});if(a.current!==o)return;let s=n.automated_emails?.[0];if(!s?.html||!s?.plaintext||!s?.subject)throw Error(`Preview response was incomplete`);i({status:`success`,preview:{...s,html:gc(s.html)}})}catch(e){if(a.current!==o)return;i({status:`error`,message:_c(e)})}},c={status:`loading`};return r.status===`success`?c={status:`success`,html:r.preview.html}:(r.status===`error`||r.status===`invalid`)&&(c={status:r.status,message:r.message}),{previewFrameState:c,previewState:r,enterPreview:s,exitPreview:o}},yc=({automatedEmailId:e,subject:t,lexical:n,validateForm:r,onClose:i})=>{let{data:s}=o(),{mutateAsync:c}=qt(),[l,u]=(0,B.useState)(s?.email||``),[d,f]=(0,B.useState)(``),[p,m]=(0,B.useState)(`idle`),h=(0,B.useRef)(null);return(0,B.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]),(0,B.useEffect)(()=>{s?.email&&u(s.email)},[s?.email]),(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),i())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i]),(0,V.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-2 w-[260px] rounded border border-grey-200 bg-white p-4 shadow-lg dark:border-grey-900 dark:bg-grey-950`,"data-testid":`test-email-dropdown`,children:[(0,V.jsxs)(`div`,{className:`mb-3`,children:[(0,V.jsx)(`label`,{className:`mb-2 block font-semibold`,htmlFor:`test-email-input`,children:`Send test email`}),(0,V.jsx)(k,{className:`h-[36px]!`,id:`test-email-input`,placeholder:`you@yoursite.com`,value:l,onChange:e=>{u(e.target.value)}})]}),(0,V.jsx)(L,{className:`w-full`,color:p===`sent`?`green`:`black`,disabled:p===`sending`,label:p===`sent`?`Sent`:p===`sending`?`Sending...`:`Send`,onClick:async()=>{if(f(``),!vo.default.isEmail(l)){f(`Please enter a valid email address`);return}if(!r()){f(`Please complete the required fields`);return}m(`sending`);try{await c({id:e,email:l,subject:t,lexical:n}),m(`sent`),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>m(`idle`),2e3)}catch(e){m(`idle`);let t;e instanceof a&&e.data&&e.data.errors[0]?t=e.data.errors[0].context||e.data.errors[0].message:e instanceof Error&&(t=e.message),f(t||`Failed to send test email`)}}}),d&&(0,V.jsx)(S,{className:`mt-2`,color:`red`,children:d})]})},bc=B.forwardRef(({title:e,centeredHeaderContent:t,headerActions:n,children:r,className:i,isEditMode:a=!1},o)=>(0,V.jsxs)(`div`,{ref:o,className:R(`flex size-full flex-col gap-0 overflow-hidden rounded-xl p-0`,a?`bg-white`:`bg-gray-100`,`dark:bg-gray-950`,i),children:[(0,V.jsxs)(`div`,{className:`sticky top-0 grid shrink-0 grid-cols-[1fr_auto_1fr] items-center border-b border-gray-200 bg-white px-5 py-3 dark:border-gray-900 dark:bg-gray-950`,children:[(0,V.jsx)(`h3`,{className:`justify-self-start text-xl font-semibold`,children:e}),(0,V.jsx)(`div`,{className:`justify-self-center`,children:t}),(0,V.jsx)(`div`,{className:`flex items-center gap-2 justify-self-end`,children:n})]}),(0,V.jsx)(`div`,{className:`flex h-[clamp(0px,calc(100dvh-320px),82vh)] min-h-0 grow flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:r})]}));bc.displayName=`EmailPreviewModalContent`;var xc=({children:e,className:t})=>(0,V.jsx)(`div`,{className:R(`relative isolate z-20 mx-auto w-full max-w-[780px] rounded-t-lg border border-b-0 border-gray-200 bg-white px-6 py-4 transition-[max-width,padding] duration-300 ease-out motion-reduce:transition-none dark:border-grey-900 dark:bg-grey-950`,t),children:e}),Sc=({children:e,className:t})=>(0,V.jsx)(`div`,{className:R(`mx-auto flex w-full max-w-[780px] grow rounded-b-lg transition-[max-width,height,padding] duration-300 ease-out motion-reduce:transition-none dark:border-grey-900 dark:shadow-none`,t),children:e}),Cc=w.create(({emailType:e=`free`,automatedEmail:t})=>{let n=E(),{settings:r,config:i}=I(),[a,o,s]=z(r,[`title`,`default_email_address`,`support_email_address`]),{updateRoute:c}=P(),{mutateAsync:l}=Yt(),{mutateAsync:u}=Lt(),{data:d}=Kt(),[f,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(`edit`),[_,v]=(0,B.useState)(null),y=(0,B.useRef)(null),b=(0,B.useRef)(t?.lexical||``),x=(0,B.useRef)(!1),C=p(),{resolvedSenderName:w,resolvedSenderEmail:ee,resolvedReplyToEmail:T,hasDistinctReplyTo:te}=ts(d?.automated_emails||[],{config:i,defaultEmailAddress:o,siteTitle:a,supportEmailAddress:s}),D=`${e===`paid`?`Paid`:`Free`} members welcome email`,{formState:O,saveState:ne,updateForm:ie,setFormState:ae,setErrors:oe,handleSave:se,okProps:ce,errors:A,validate:le}=Vt({initialState:{subject:t?.subject||`Welcome`,lexical:t?.lexical||``},savingDelay:500,onSave:async e=>{await l({...t,...e})},onSaveError:C,onValidate:hc}),ue=ce.label||`Save`,{previewFrameState:de,enterPreview:fe,exitPreview:pe}=vc({automatedEmailId:t.id,previewWelcomeEmail:u,setErrors:oe}),j=ne===`unsaved`,me=(0,B.useCallback)(()=>{Ye(j,()=>{n.remove()})},[n,j]);(0,B.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&m(!1)};return f&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[f]);let he=(0,B.useRef)(se);(0,B.useEffect)(()=>{he.current=se},[se]),(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),he.current({fakeWhenUnchanged:!0}))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]);let ge=(0,B.useCallback)(e=>{g(e),e===`preview`?(v(null),fe(O)):(m(!1),v(null),pe())},[fe,pe,O]),M=(0,B.useCallback)(e=>{if(!x.current){b.current=e,ae(t=>({...t,lexical:e}));return}e===b.current?ae(t=>({...t,lexical:e})):ie(t=>({...t,lexical:e}))},[ae,ie]);return(0,V.jsx)(re,{afterClose:()=>{c(`memberemails`)},backDropClick:!1,dirty:j,footer:!1,header:!1,padding:!1,scrolling:!1,size:`full`,testId:`welcome-email-modal`,width:`full`,children:(0,V.jsx)(bc,{centeredHeaderContent:(0,V.jsx)(jt,{"data-testid":`welcome-email-mode-toggle`,value:h,variant:`segmented-sm`,onValueChange:e=>e&&ge(e),children:(0,V.jsxs)(At,{className:`grid w-[240px] grid-cols-2 bg-gray-100 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]`,children:[(0,V.jsx)(Ot,{className:`w-full justify-center data-[state=active]:bg-white dark:data-[state=active]:bg-white dark:data-[state=active]:text-black`,"data-testid":`welcome-email-mode-edit`,value:`edit`,children:`Email content`}),(0,V.jsx)(Ot,{className:`w-full justify-center`,"data-testid":`welcome-email-mode-preview`,value:`preview`,children:`Preview`})]})}),className:`dark:bg-[#151719]`,headerActions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ln,{variant:`outline`,onClick:me,children:`Close`}),(0,V.jsx)(ln,{disabled:ce.disabled,onClick:async()=>await se({fakeWhenUnchanged:!0}),children:ue})]}),isEditMode:h===`edit`,title:D,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col items-center p-6`,children:[h===`preview`&&(0,V.jsx)(xc,{className:`border-x-0 border-t-0 border-b`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center py-1`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`From:`}),(0,V.jsx)(`div`,{className:`min-w-0 grow pr-4`,children:(0,V.jsxs)(`span`,{className:`flex gap-1 truncate whitespace-nowrap`,children:[(0,V.jsx)(`span`,{children:w}),(0,V.jsx)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:`<${ee}>`})]})}),(0,V.jsxs)(`div`,{ref:y,className:`relative`,children:[(0,V.jsx)(L,{className:`border border-grey-200 font-semibold hover:border-grey-300 hover:bg-white! dark:border-grey-900 dark:hover:border-grey-800 dark:hover:bg-grey-950!`,color:`clear`,icon:`send`,label:`Test`,onClick:()=>m(!f)}),f&&(0,V.jsx)(yc,{automatedEmailId:t.id,lexical:O.lexical,subject:O.subject,validateForm:le,onClose:()=>m(!1)})]})]}),te&&(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`Reply-to:`}),(0,V.jsx)(`div`,{className:`grow text-gray-500 dark:text-gray-400`,children:T})]}),(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`Subject:`}),(0,V.jsxs)(`div`,{className:`grow`,children:[(0,V.jsx)(k,{className:`w-full`,"data-testid":`welcome-email-preview-subject`,value:_??O.subject,onChange:e=>{let t=e.target.value;v(t),ie(e=>({...e,subject:t}))}}),A.subject&&(0,V.jsx)(S,{className:`mt-2`,color:`red`,children:A.subject})]})]})]})}),(0,V.jsxs)(Sc,{className:R(h===`preview`&&`bg-white shadow-sm dark:bg-grey-950`,h===`edit`&&`px-6`,h===`edit`&&`rounded-lg`,h===`edit`&&A.lexical&&`border border-red-500`),children:[(0,V.jsx)(`div`,{className:R(`mx-auto w-full max-w-[600px] pt-10 pb-8 transition-[max-width,padding] duration-300 ease-out motion-reduce:transition-none`,h===`preview`&&`hidden`),"data-testid":`welcome-email-editor`,onFocus:()=>{x.current=!0},children:(0,V.jsx)(fc,{className:`welcome-email-editor`,placeholder:`Begin writing your email...`,value:O.lexical,onChange:M},t?.id||`new`)}),h===`preview`&&(0,V.jsx)(pc,{previewState:de})]}),h===`edit`&&A.lexical&&(0,V.jsx)(S,{className:`mt-2 max-w-[740px]`,color:`red`,children:A.lexical})]})})})}),wc=({automatedEmail:e,emailType:t,icon:n,title:r,enabled:i,isBusy:a,isInitialLoading:o,onEdit:s,onToggle:c})=>(0,V.jsx)(lt,{action:(0,V.jsxs)(`div`,{className:`flex items-center gap-7 ${a&&!o?`pointer-events-none`:``}`,children:[o?(0,V.jsx)(`div`,{className:`h-4 w-7 rounded-full bg-grey-300 dark:bg-grey-800`}):(0,V.jsx)(wt,{checked:i,onChange:c}),(0,V.jsx)(`button`,{className:`font-semibold text-green hover:opacity-80`,type:`button`,onClick:s,children:`Edit`})]}),hideActions:!1,testId:`${t}-welcome-email-row`,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsxs)(`button`,{className:`flex w-full min-w-0 items-center gap-3 py-3 text-left focus-visible:ring-2 focus-visible:ring-green focus-visible:ring-offset-2 focus-visible:outline-none dark:focus-visible:ring-offset-black`,"data-testid":`${t}-welcome-email-preview`,type:`button`,onClick:s,children:[(0,V.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-grey-100 dark:bg-grey-900`,children:(0,V.jsx)(l,{colorClass:`text-grey-700 dark:text-grey-600`,name:n,size:`md`})}),(0,V.jsxs)(`div`,{className:`min-w-0 grow`,children:[(0,V.jsx)(`div`,{className:`leading-tight font-medium`,"data-testid":`${t}-welcome-email-title`,children:r}),(0,V.jsx)(`div`,{className:`mt-1 text-sm leading-[1.35] text-grey-700 dark:text-grey-600`,children:e.subject})]})]})})}),Tc=({settings:e,config:t,freeEmailForDisplay:n,paidEmailForDisplay:r,freeWelcomeEmailEnabled:i,paidWelcomeEmailEnabled:a,isBusy:o,isLoading:s,onFreeEdit:c,onFreeToggle:l,onPaidEdit:u,onPaidToggle:d})=>(0,V.jsxs)(St,{borderTop:!0,children:[(0,V.jsx)(wc,{automatedEmail:n,emailType:`free`,enabled:i,icon:`user-add`,isBusy:o,isInitialLoading:s,title:`Free members welcome email`,onEdit:c,onToggle:l}),$n(e,t)&&(0,V.jsx)(wc,{automatedEmail:r,emailType:`paid`,enabled:a,icon:`bills`,isBusy:o,isInitialLoading:s,title:`Paid members welcome email`,onEdit:u,onToggle:d})]}),Ec=j(({keywords:e})=>{let{settings:t,config:n}=I(),[r]=z(t,[`title`]),i=Me().getParam(`verifyEmail`),{data:a,isLoading:o}=Kt(),{mutateAsync:s,isLoading:c}=Zt(),{mutateAsync:l,isLoading:d}=Yt(),{mutateAsync:f}=Xt(),m=p(),h=a?.automated_emails||[],_=o||c||d,v=h.find(e=>e.slug===qo.free),y=h.find(e=>e.slug===qo.paid),b=v?.status===`active`,x=y?.status===`active`,S=async(e,t)=>{let n=Xo(e,r);return s({...n,status:t})},C=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!i||!window.location.href.includes(`memberemails`)||C.current===i)return;C.current=i;let e=()=>{let e=window.location.hash.slice(1),t=new URL(e||`/memberemails`,window.location.origin);t.searchParams.delete(`verifyEmail`);let n=t.search?`#${t.pathname}${t.search}`:`#${t.pathname}`;window.history.replaceState(null,``,`${window.location.pathname}${n}`)};(async()=>{try{let{meta:{email_verified:t}={}}=await f({token:i});e();let n=`Sender email verified`,r=(0,V.jsx)(V.Fragment,{children:`Welcome email sender settings have been updated.`});t===`sender_reply_to`&&(n=`Reply-to address verified`,r=(0,V.jsx)(V.Fragment,{children:`Welcome email reply-to address has been verified and updated.`})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(t){let n=`There was an error verifying your email address. Try again later.`;t instanceof g&&t.message===`Token expired`&&(n=`Verification link has expired.`),e(),w.show(M,{title:`Error verifying email address`,prompt:n,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),m(t,{withToast:!1})}})()},[m,i,f]);let ee=async e=>{let t=h.find(t=>t.slug===qo[e]),n=e===`free`?`Free members`:`Paid members`;if(!_)try{t?t.status===`active`?(await l({...t,status:`inactive`}),u({type:`success`,title:`${n} welcome email disabled`})):(await l({...t,status:`active`}),u({type:`success`,title:`${n} welcome email enabled`})):(await S(e,`active`),u({type:`success`,title:`${n} welcome email enabled`}))}catch(e){m(e)}},T=async e=>{let t=h.find(t=>t.slug===qo[e]);if(!_)if(t)w.show(Cc,{emailType:e,automatedEmail:t});else try{let t=(await S(e,`inactive`))?.automated_emails?.[0];t&&w.show(Cc,{emailType:e,automatedEmail:t})}catch(e){m(e)}},te=v||Zo(`free`,r),E=y||Zo(`paid`,r);return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>w.show(ps)}),description:`Create and manage automated emails for your members`,keywords:e,navid:`memberemails`,testId:`memberemails`,title:`Welcome emails`,children:(0,V.jsx)(Tc,{config:n,freeEmailForDisplay:te,freeWelcomeEmailEnabled:b,isBusy:_,isLoading:o,paidEmailForDisplay:E,paidWelcomeEmailEnabled:x,settings:t,onFreeEdit:()=>T(`free`),onFreeToggle:()=>ee(`free`),onPaidEdit:()=>T(`paid`),onPaidToggle:()=>ee(`paid`)})})},`MemberEmails`),Dc=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAQAAADc8cciAAADJ0lEQVR4AYyUA2DsaBCAZ3X2s23btm3btm3btm3btm2VqyT31W3K9DfGkkjNJGaRkeZW8dpl6Zwpz295Al5i2awiCwt5nOQeGxjJUNZ9Or2i5AoRS6xQfW78f1sbTk+6UJ+SpMdEU49HeX4TS8wSWLrEAbU5qZXCDGO0MtF9xHWVB+oGZSjuh0UeipijRe2Umif8Qhd13/kubZOWtAaBZvnpaHpasY2vH4d8DJAtKoHrpOMscTk2r/A8EZNOxMBzr19fTeaJ1wGvKLS3tIrHK6847EGi0c0s8nAIezgxJkMgOf0Hqj0pqxqn1msVGf3LWnU9qx7UfqBzn+neKNqojT/P/CwxdTHX/IcLbNAGnyuv480j/mPLvLSG4WBRq3BLW8C0Zr8HyzggB2MpzS7EuN+tSD1OaEOud7su1wOEXtKAcjTxXeYrxn1GTn5nMytZl8eWRySPvF9ELSozu0ycMmLUu6QgLRXYxMqemQKVdM9jLCXoMjDXQDHqhf4jB39ynHF7W+8V2SvKaBaQl6bdinUToy5WSvI3Sxj3bMKzAAu6WzCY8VTc0jw2yfexLKnoxHrvWd4i3uIowUBGMMo+3S7G/XJFslCc/fYpdhG7PC1FZsYylV2DExnnraMNecnCbu+R3iJiGpSeJMyggTLNfsUec9qbeyejKSUoybr7be+L3PfvvjVcmVlAL3dPLpWJEx16wLs2g9JkYhGLuiYOspC58b8U0LrSnqH+6Ic25tDljS4x89i+LKICBciu3Hzd67W8FglczNOSUc/Zmeb0V8az7Hbl23rxTSKVE55qwESlCAWIo1xWt6iizz9z+d99RzFKbUJHbbk24d2Ad/JOKv1cNcnYvGerO9pSm7z+vRxJOM3+qXHFHClf52dnpjaaHZxX9rpuOFpSjIJkJSNZSEMmGlOV1+5eL3O/lKAuL3VdzGI6V5qSSnFGsJWbXGAFA2lJA7qygItMJ+Hjco91IkfiXzj+0bquBtRSW9OYNgxmGetZSB/iU/pQxkPRoupKXvn4s/I8LO1ZicqUIAfZFb/ZHtY3ZoXIEQaMMNqBRYXdgcWBAVMjAKGlEzkN2rk9AAAAAElFTkSuQmCC`,Oc=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////8IX9KGAAAAFnRSTlMAQI+v38+/cCD/n3/vkFAwYBCAoLBfxGozVwAAAT1JREFUeAHd1NEO2yAMheGTBhL/idtAu73/q67VFIkRAevVpH13KDkYkGX9C9NtDiEuq/3l7wunzTR2o7RrZAH8/jA70jxKnPvPWb9ZAFb1JOBZrF/AoY4Ad5UiLP0CIat0AKam+XrkpXsLh+Na9IdaMqCKQdBp/HEQyOCqHL2A/Pokj/pdR0+ywV1NK8TLFZjUlB3WukBQxxP4Wax34KGeWHZ0vtG5QdHRIZkk2x2IGrDIhwfn46WRvFPwpIHd+VNI4/P4lg4zm9Z5NDoOB2LKOlkKQLDO/75WNe/tOWAO4VAtuZve9ljlcmgUz1lv+dIjO7ipyeqAAUlfBDZY9EUgO0zfBB6dvt/DBxDezrfa2vMqUzr3jZ0TLRTOWQ1ktdjbBME+qok0uHRrOQ5o4fldQKZxQEODMwyY/h+/ADWjEK3gLf0/AAAAAElFTkSuQmCC`,kc=({title:e,color:t,price:n})=>(0,V.jsxs)(`div`,{className:`rounded-lg bg-grey-100/70 px-3 pt-1.5 pb-3`,children:[(0,V.jsx)(`div`,{className:`font-space-grotesk text-[1.5rem] font-bold`,style:{color:t},children:e}),(0,V.jsx)(`div`,{className:`-mt-1 font-space-grotesk text-[1.7rem] font-bold`,children:n}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-1.5`,children:[(0,V.jsx)(`div`,{className:`h-1.5 w-[100%] bg-grey-300/60`}),(0,V.jsx)(`div`,{className:`h-1.5 w-[70%] bg-grey-300/60`}),(0,V.jsx)(`div`,{className:`h-1.5 w-[90%] bg-grey-300/60`})]})]}),Ac=j(({keywords:e})=>{let{updateRoute:t}=P(),{settings:n}=I(),[r,i,a]=z(n,[`accent_color`,`icon`,`members_signup_access`]),o=()=>{t(`portal/edit`)},s=r||`#F6414E`;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,disabled:a===`none`,label:`Customize`,size:`sm`,onClick:o}),description:`Customize members modal signup flow`,keywords:e,navid:`portal`,testId:`portal`,title:`Signup portal`,children:(0,V.jsxs)(`div`,{className:`relative isolate -mx-5 -mb-5 hidden flex-col items-center justify-end overflow-hidden rounded-b-xl bg-grey-50 px-5 pt-6 text-black sm:visible! sm:flex! md:-mx-7 md:-mb-7`,children:[(0,V.jsx)(`div`,{className:`absolute right-6 bottom-6 flex size-12 items-center justify-center rounded-full text-white shadow-lg`,style:{backgroundColor:s},children:(0,V.jsx)(`img`,{className:`size-6`,src:Oc})}),(0,V.jsxs)(`div`,{className:`grid w-full max-w-[440px] grid-cols-3 gap-5 rounded-t-xl bg-white px-9 py-6 shadow-xl`,children:[(0,V.jsxs)(`div`,{className:`col-span-3 mb-1 flex flex-col items-center justify-center`,children:[i?(0,V.jsx)(`div`,{className:`size-6 rounded-sm bg-cover bg-center`,style:{backgroundImage:`url(${i})`}}):(0,V.jsx)(`div`,{className:`flex aspect-square items-center justify-center overflow-hidden rounded-full p-1 text-white`,style:{backgroundColor:s},children:(0,V.jsx)(`img`,{className:`h-auto w-5`,src:Dc})}),(0,V.jsx)(`div`,{className:`mt-1.5 font-space-grotesk text-lg font-bold`,children:`Sign up`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex h-6 w-1/2 items-center rounded border border-grey-200 p-2 text-sm text-grey-700`,children:`jamie@example.com`})]}),(0,V.jsx)(kc,{color:s,price:`$0`,title:`Free`}),(0,V.jsx)(kc,{color:s,price:`$5`,title:`Silver`}),(0,V.jsx)(kc,{color:s,price:`$10`,title:`Gold`})]})]})})},`Portal settings`),jc=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,errors:s,clearError:c,handleEditingChange:l}=N({onValidate:()=>({})}),[u]=z(t,[`blocked_email_domains`]),d=JSON.parse(u||`[]`),[f,p]=B.useState(d.join(`
|
|
4
|
+
hsl(${l}, 100%, 50%)`,[l]);(0,B.useEffect)(()=>{let e=u/100,t=e<.01?100:50+50*(1-e),n=Math.max(0,Math.min(1,1-d/t));o(e),c(n)},[u,d]);let h=(0,B.useCallback)(e=>{if(!n.current)return;let t=n.current.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),i=Math.max(0,Math.min(1,(e.clientY-t.top)/t.height));o(r),c(i),f(r*100);let a=(r<.01?100:50+50*(1-r))*(1-i);p(a)},[f,p]),g=(0,B.useCallback)(e=>{r&&h(e)},[r,h]);return(0,B.useEffect)(()=>{let e=()=>i(!1);return r&&(window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,e)),()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,e)}},[r,g]),(0,V.jsx)(`div`,{ref:n,className:R(`relative size-full cursor-crosshair rounded`,e),style:{background:m},onPointerDown:e=>{e.preventDefault(),i(!0),h(e.nativeEvent)},...t,children:(0,V.jsx)(`div`,{className:`pointer-events-none absolute size-4 -translate-1/2 rounded-full border-2 border-white`,style:{left:`${a*100}%`,top:`${s*100}%`,boxShadow:`0 0 0 1px rgba(0,0,0,0.5)`}})})});Bi.displayName=`ColorPickerSelection`;var Vi=({className:e,...t})=>{let{hue:n,setHue:r}=Ri();return(0,V.jsxs)(oi,{className:R(`relative flex h-4 w-full touch-none`,e),max:360,step:1,value:[n],onValueChange:([e])=>r(e),...t,children:[(0,V.jsx)(pi,{className:`relative my-0.5 h-3 w-full grow rounded-full bg-[linear-gradient(90deg,red,yellow,lime,aqua,blue,magenta,red)]`,children:(0,V.jsx)(hi,{className:`absolute h-full`})}),(0,V.jsx)(Ci,{className:`block size-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50`})]})},Hi=({className:e,...t})=>{let{setHue:n,setSaturation:r,setLightness:i,setAlpha:a}=Ri();return typeof window<`u`&&`EyeDropper`in window?(0,V.jsx)(ln,{className:R(`size-8 shrink-0 text-muted-foreground`,e),size:`icon`,type:`button`,variant:`outline`,onClick:async()=>{try{let[e,t,o]=G((await new EyeDropper().open()).sRGBHex).hsl().array();n(e),r(t),i(o),a(100)}catch(e){console.error(`EyeDropper failed:`,e)}},...t,children:(0,V.jsx)(en,{size:16})}):null},Ui=[`hex`,`rgb`,`hsl`],Wi=({...e})=>{let{mode:t,setMode:n}=Ri();return(0,V.jsxs)(gn,{value:t,onValueChange:n,children:[(0,V.jsx)(mn,{className:`h-8 w-20 shrink-0 text-xs`,...e,children:(0,V.jsx)(hn,{placeholder:`Mode`})}),(0,V.jsx)(pn,{children:Ui.map(e=>(0,V.jsx)(fn,{className:`text-xs`,value:e,children:e.toUpperCase()},e))})]})},Gi=({className:e,...t})=>{let{hue:n,saturation:r,lightness:i,mode:a,setHue:o,setSaturation:s,setLightness:c,setAlpha:l}=Ri(),u=G.hsl(n,r,i),[d,f]=(0,B.useState)(null),p=(e,t)=>{try{if(a===`hex`){let t=G(e);o(t.hue()),s(t.saturationl()),c(t.lightness()),l(t.alpha()*100)}else if((a===`rgb`||a===`hsl`)&&t!==void 0){let n=u[a]().array().map(e=>Math.round(e));n[t]=parseInt(e,10)||0;let r=G[a](n[0],n[1],n[2]);o(r.hue()),s(r.saturationl()),c(r.lightness())}}catch{}};if(a===`hex`){let n=u.hex();return(0,V.jsx)(`div`,{className:R(`relative flex w-full items-center -space-x-px rounded-md`,e),...t,children:(0,V.jsx)($n,{className:`h-8 px-2 font-mono text-xs shadow-none`,type:`text`,value:d??n,onBlur:()=>{f(null)},onChange:e=>{f(e.target.value),p(e.target.value)}})})}if(a===`rgb`||a===`hsl`){let n=u[a]().array().map(e=>Math.round(e));return(0,V.jsx)(`div`,{className:R(`flex flex-1 items-stretch -space-x-px rounded-md`,e),...t,children:n.map((e,t)=>(0,V.jsx)($n,{className:R(`h-8 flex-1 px-2 font-mono text-xs shadow-none focus:z-10`,t&&`rounded-l-none`,t<n.length-1&&`rounded-r-none`),maxLength:3,size:4,type:`text`,value:e,onChange:e=>{p(e.target.value,t)}},t))})}return null},Ki=e=>(0,V.jsxs)(zi,{className:`w-auto min-w-80`,...e,children:[(0,V.jsx)(Bi,{className:`aspect-square`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Hi,{}),(0,V.jsx)(Vi,{})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Wi,{}),(0,V.jsx)(Gi,{})]})]}),qi=()=>{let{isDirty:e}=x(),t=()=>{window.location.hash=`/`};return(0,V.jsx)(L,{className:`text-grey-700 hover:text-grey-900!`,"data-testid":`exit-settings`,icon:`close`,id:`done-button`,label:``,link:!0,title:`Close (ESC)`,onClick:()=>Ye(e,t)})},Ji=(e,t)=>{let[n,r]=(0,B.useState)(`Save`),[i,a]=(0,B.useState)(!1);return{savingTitle:n,isSaving:i,onSaveClick:async()=>{a(!0),r(`Saving`),await e({fakeWhenUnchanged:t}),setTimeout(()=>{r(`Saved`),setTimeout(()=>{r(`Save`),a(!1)},1e3)},1e3)}}},Yi=w.create(({afterClose:e})=>{let{localSettings:t,handleSave:n,updateSetting:r}=N(),i=E(),[a,o]=z(t,[`codeinjection_head`,`codeinjection_foot`]),[s,c]=(0,B.useState)(`header`),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>Pt(()=>import(`./dist-DVfKxKHo.js`).then(e=>e.html()),__vite__mapDeps([26,24,27,28,1,29,25]),import.meta.url),[]),f={extensions:[d],hint:`Code here will be injected into the {{ghost_head}} tag on every page of the site`,value:a||``,onChange:e=>r(`codeinjection_head`,e)},p={extensions:[d],hint:`Code here will be injected into the {{ghost_foot}} tag on every page of the site`,value:o||``,onChange:e=>r(`codeinjection_foot`,e)},m=[{id:`header`,title:`Site header`,contents:(0,V.jsx)(hr,{height:`full`,...f,ref:l,className:`mt-2`,"data-testid":`header-code`,autoFocus:!0}),tabWrapperClassName:`flex-auto`,containerClassName:`h-full`},{id:`footer`,title:`Site footer`,contents:(0,V.jsx)(hr,{height:`full`,...p,ref:u,className:`mt-2`,"data-testid":`footer-code`}),tabWrapperClassName:`flex-auto`,containerClassName:`h-full`}],{savingTitle:h,isSaving:g,onSaveClick:_}=Ji(n,!0);return(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),_())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}}),(0,V.jsx)(re,{afterClose:e,backDropClick:!1,cancelLabel:`Close`,footer:(0,V.jsx)(V.Fragment,{}),height:`full`,size:`full`,testId:`modal-code-injection`,children:(0,V.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,V.jsx)(T,{level:2,children:`Code injection`}),(0,V.jsx)(ue,{buttons:[{label:`Close`,color:`outline`,onClick:()=>{i.remove(),e?.()}},{disabled:g,label:h,color:h===`Saved`?`green`:`black`,onClick:_}]})]}),(0,V.jsx)(Ze,{containerClassName:`flex-auto flex flex-col mb-16`,selectedTab:s,tabs:m,onTabChange:c})]})})}),J=({keywords:e,navid:t,children:n,...r})=>{let{checkVisible:i,noResult:a,registerComponent:o,unregisterComponent:s}=ot(),{route:c}=P(),[l,u]=(0,B.useState)(!1),{ref:d}=Fe(t),f=(0,B.useId)(),p=ze(t||`component`,f);(0,B.useEffect)(()=>(o(p,e),()=>{s(p)}),[p,e,o,s]),(0,B.useEffect)(()=>{if(u(c===t),c===t){let e=setTimeout(()=>u(!1),2e3);return()=>clearTimeout(e)}},[c,t]);let m=B.Children.toArray(n).some(e=>B.isValidElement(e)&&e.type===`img`)?(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl bg-grey-50 md:-mx-7 md:-mb-7`,children:B.Children.map(n,e=>B.isValidElement(e)&&e.type===`img`?B.cloneElement(e,{className:`${e.props.className||``} h-full w-full rounded-b-xl`.trim()}):e)}):n;return(0,V.jsx)(Ge,{ref:d,highlight:l,isVisible:i(e)||a,navid:t,...r,children:m})},Xi=j(({keywords:e})=>(0,V.jsx)(J,{customHeader:(0,V.jsxs)(`div`,{className:`z-10 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`Add custom code to your publication.`,title:`Code injection`}),(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Open`,size:`sm`,onClick:()=>{w.show(Yi)}})]}),description:`Add custom code to your publication`,keywords:e,navid:`code-injection`,testId:`code-injection`,title:`Code injection`}),`Code injection`),Zi=f({method:`POST`,path:()=>`/db/`,body:e=>{let t=new FormData;return t.append(`importfile`,e),t}}),Qi=f({method:`DELETE`,path:()=>`/db/`}),$i=()=>s(`/db/`),ea=f({method:`POST`,path:()=>`/authentication/reset/`}),ta=j(({keywords:e})=>{let{mutateAsync:t}=Qi(),{mutateAsync:n}=ea(),{mutateAsync:r}=pr(),a=i(),o=p(),{config:s}=I(),{totalUsers:l}=Ct(),d=!!s?.labs?.dangerZoneResetAuth,f=l===1?`You will be signed out and must reset your password before signing back in.`:l>1?`All ${l} staff users, including you, will be signed out and must reset their password before signing back in.`:`All staff users, including you, will be signed out and must reset their password before signing back in.`;return(0,V.jsx)(J,{customHeader:(0,V.jsx)(Ne,{description:`Destructive actions that affect your entire site.`,title:`Danger zone`}),keywords:e,navid:`dangerzone`,testId:`dangerzone`,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Delete all content`,color:`red`,label:`Delete`,onClick:()=>{w.show(M,{title:`Would you really like to delete all content from your blog?`,prompt:`This is permanent! No backups, no restores, no magic undo button. We warned you, k?`,okColor:`red`,okLabel:`Delete`,onOk:async e=>{try{await t(null),u({title:`All content deleted from database.`,type:`success`}),e?.remove(),await a.refetchQueries()}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Permanently delete all posts and tags from the database.`,testId:`delete-all-content`,title:`Delete all content`}),d&&(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Reset all authentication`,color:`red`,label:`Reset`,onClick:()=>{w.show(M,{title:`Reset all authentication?`,prompt:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4`,children:[`This rotates every API key on your site. Any integration using one will stop working until you reconfigure it with the new key from `,(0,V.jsx)(`strong`,{children:`Settings → Advanced → Integrations`}),`.`]}),(0,V.jsxs)(`p`,{children:[f,` Your members aren't affected.`]})]}),okLabel:`Reset all authentication`,okRunningLabel:`Resetting...`,okColor:`red`,onOk:async e=>{try{let t=(await n(null))?.security_action?.[0],r=t?.api_keys_rotated??0,i=t?.users_locked??0;u({title:`Rotated ${r} API ${r===1?`key`:`keys`} and locked ${i} ${i===1?`user`:`users`}. You will be signed out shortly.`,type:`success`}),e?.remove(),window.location.href=c().adminRoot}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Rotate every API key, sign out every staff user, and require a password reset. Use after a suspected credential compromise.`,testId:`reset-all-authentication`,title:`Reset all authentication`}),(0,V.jsx)(we,{action:(0,V.jsx)(L,{"aria-label":`Reset all gift links`,color:`red`,label:`Reset`,onClick:()=>{w.show(M,{title:`Reset all gift links?`,prompt:`This immediately invalidates every active gift link across your site. Anyone holding one will lose access. New gift links can still be created afterwards.`,okLabel:`Reset all gift links`,okRunningLabel:`Resetting...`,okColor:`red`,onOk:async e=>{try{let t=(await r(null))?.meta?.count??0;ae(`All Gift Links Reset`),u({title:`Reset ${t} gift ${t===1?`link`:`links`}.`,type:`success`}),e?.remove()}catch(e){o(e)}}})}}),bgOnHover:!1,detail:`Invalidate every active gift link across your site. Anyone holding one will lose access.`,testId:`reset-all-gift-links`,title:`Reset all gift links`})]})})},`Danger zone`),na=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`View history`,size:`sm`,onClick:()=>{t(`history/view`)}}),description:`View system event log`,keywords:e,navid:`history`,testId:`history`,title:`History`})},`History`),ra=``+new URL(`integrations-settings-Ba5Zx8yQ.png`,import.meta.url).href,ia=({icon:e,title:t,detail:n,action:r,onDelete:i,active:a,disabled:o,testId:s,custom:c=!1})=>{let{updateRoute:l}=P(),u=e=>{e?.stopPropagation(),o?l({route:`pro`,isExternal:!0}):r()};return(0,V.jsx)(we,{action:c?(0,V.jsx)(L,{color:`red`,label:`Delete`,link:!0,onClick:e=>{e?.stopPropagation(),i?.()}}):o?(0,V.jsx)(L,{icon:`lock-locked`,label:`Upgrade`,link:!0,onClick:u}):(0,V.jsx)(L,{color:`green`,label:`Configure`,link:!0,onClick:u}),avatar:e,className:o?`opacity-50 saturate-0`:``,detail:n,hideActions:!o,testId:s,title:a?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t,` `,(0,V.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-1.5 py-px text-xs font-semibold tracking-wide text-green uppercase`,children:`Active`})]}):t,onClick:u})},aa=()=>{let{config:e}=I(),{updateRoute:t}=P(),n=e=>{t(e)},r=e.hostSettings?.limits?.customIntegrations?.disabled,i=gt(),{settings:a}=I(),[o,s,c,u,d]=z(a,[`unsplash`,`firstpromoter`,`slack_url`,`slack_username`,`transistor`]),f=[{detail:`Automation for your apps`,disabled:r,icon:(0,V.jsx)(l,{name:`zapier`,size:32}),modal:`integrations/zapier`,testId:`zapier-integration`,title:`Zapier`},{active:!!(c&&u),detail:`A messaging app for teams`,icon:(0,V.jsx)(l,{name:`slack`,size:32}),modal:`integrations/slack`,testId:`slack-integration`,title:`Slack`},{active:!!o,detail:`Beautiful, free photos`,icon:(0,V.jsx)(l,{name:`unsplash`,size:32}),modal:`integrations/unsplash`,testId:`unsplash-integration`,title:`Unsplash`},{active:!!s,detail:`Launch your member referral program`,icon:(0,V.jsx)(l,{name:`firstpromoter`,size:32}),modal:`integrations/firstpromoter`,testId:`firstpromoter-integration`,title:`FirstPromoter`},{active:i.isEnabled,detail:`Advanced image editing`,icon:(0,V.jsx)(l,{name:`pintura`,size:32}),modal:`integrations/pintura`,testId:`pintura-integration`,title:`Pintura`},{active:!!d,detail:`Give your members access to private podcasts`,disabled:r,icon:(0,V.jsx)(l,{name:`transistor`,size:32}),modal:`integrations/transistor`,testId:`transistor-integration`,title:`Transistor.fm`},{detail:`Access your content programmatically`,icon:(0,V.jsx)(l,{name:`angle-brackets`,size:32}),modal:`integrations/contentapi`,testId:`content-api-integration`,title:`Content API`}];return(0,V.jsx)(A,{titleSeparator:!1,children:[...f.filter(e=>!e.disabled),...f.filter(e=>e.disabled)].map(e=>(0,V.jsx)(ia,{action:()=>{n(e.modal)},active:e.active,detail:e.detail,disabled:e.disabled,icon:e.icon,testId:e.testId,title:e.title},e.testId))})},oa=({integrations:e})=>{let{updateRoute:t}=P(),{mutateAsync:n}=pt(),r=p();return e.length?(0,V.jsx)(A,{borderTop:!1,children:e.map(e=>(0,V.jsx)(ia,{action:()=>t({route:`integrations/${e.id}`}),detail:(0,V.jsx)(`div`,{className:`line-clamp-2 break-words`,children:(0,V.jsx)(`span`,{title:`${e.name}: ${e.description||`No description`}`,children:e.description||`No description`})}),icon:e.icon_image?(0,V.jsx)(`img`,{className:`size-8 shrink-0 object-cover`,role:`presentation`,src:e.icon_image}):(0,V.jsx)(l,{className:`w-8 shrink-0`,name:`integration`}),title:e.name,custom:!0,onDelete:()=>{w.show(M,{title:`Are you sure?`,prompt:`Deleting this integration will remove all webhooks and api keys associated with it.`,okColor:`red`,okLabel:`Delete Integration`,onOk:async t=>{try{await n(e.id),t?.remove(),u({title:`Integration deleted`,type:`info`,options:{position:`bottom-left`}})}catch(e){r(e)}}})}},e.id))}):(0,V.jsx)(oe,{icon:`integration`,children:`No custom integration.`})},sa=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`built-in`),{data:{integrations:r}={integrations:[]}}=O(),{updateRoute:i}=P(),a=[{id:`built-in`,title:`Built-in`,contents:(0,V.jsx)(aa,{})},{id:`custom`,title:`Custom`,contents:(0,V.jsx)(oa,{integrations:r.filter(e=>e.type===`custom`)})}];return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px] inline-flex h-7 cursor-pointer items-center justify-center rounded px-3 font-semibold whitespace-nowrap text-grey-900 transition hover:bg-grey-200 dark:text-white dark:hover:bg-grey-900 [&:hover]:text-black`,color:`clear`,label:`Add custom integration`,link:!0,onClick:()=>{i(`integrations/new`),n(`custom`)}}),customHeader:(0,V.jsxs)(`div`,{className:`sm:-mt-5 md:-mt-7`,children:[(0,V.jsx)(`div`,{className:`-mx-5 overflow-hidden rounded-t-xl border-b border-grey-200 md:-mx-7 dark:border-grey-800`,children:(0,V.jsx)(`img`,{className:`size-full`,src:ra})}),(0,V.jsxs)(`div`,{className:` z-10 mt-6 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`Make Ghost work with apps and tools.`,title:`Integrations`}),(0,V.jsx)(L,{className:`mt-[-5px] inline-flex h-7 cursor-pointer items-center justify-center rounded px-3 font-semibold whitespace-nowrap text-grey-900 transition hover:bg-grey-200 dark:text-white dark:hover:bg-grey-900 [&:hover]:text-black`,color:`clear`,label:`Add custom integration`,link:!0,onClick:()=>{i(`integrations/new`),n(`custom`)}})]})]}),keywords:e,navid:`integrations`,testId:`integrations`,children:(0,V.jsx)(Ze,{selectedTab:t,tabs:a,onTabChange:n})})},`Integrations`),ca=w.create(({title:e,prompt:t,okLabel:n,okRunningLabel:r=`Enabling...`,onConfirm:i})=>{let a=E(),[o,s]=B.useState(!1);return(0,V.jsx)(re,{backDropClick:!1,buttonsDisabled:o,cancelLabel:`Cancel`,okLabel:o?r:n,testId:`feature-toggle-confirmation-modal`,title:e,width:540,onCancel:()=>{a.remove()},onOk:async()=>{s(!0);try{await i()&&a.remove()}finally{s(!1)}},children:(0,V.jsx)(`div`,{className:`py-4`,children:t})})}),la=({label:e,flag:t,disabled:n,confirmation:r})=>{let{settings:a}=I(),o=JSON.parse(tr(a,`labs`)||`{}`),{mutateAsync:s}=Gn(),c=i(),l=p(),u=!!o[t],d=async e=>{try{return await s([{key:`labs`,value:JSON.stringify({...o,[t]:e})}]),ae(`Feature Toggled`,{state:e?`on`:`off`,feature:t}),c.setQueriesData([Un],n=>({config:{...n.config,labs:{...n.config.labs,[t]:e}}})),!0}catch(e){return l(e),!1}};return(0,V.jsx)(wt,{checked:u,disabled:n,label:e,labelClasses:`sr-only`,name:`feature-${t}`,onChange:async()=>{let e=!u;if(r&&e){w.show(ca,{...r,onConfirm:()=>d(e)});return}await d(e)}})},ua=({title:e,detail:t,action:n})=>(0,V.jsx)(we,{action:n,bgOnHover:!1,detail:t,paddingRight:!1,title:e}),da=f({method:`POST`,path:()=>`/redirects/upload/`,body:e=>{let t=new FormData;return t.append(`redirects`,e),t}}),fa=()=>s(`/redirects/download/`),pa=f({method:`POST`,path:()=>`/settings/routes/yaml/`,body:e=>{let t=new FormData;return t.append(`routes`,e),t}}),ma=()=>s(`/settings/routes/yaml/`),ha=()=>{let{settings:e}=I(),{mutateAsync:t}=da(),{mutateAsync:n}=pa(),r=p(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1);return(0,V.jsxs)(A,{titleSeparator:!1,children:[(0,V.jsx)(ua,{action:(0,V.jsx)(la,{confirmation:{title:`Automations (beta)`,prompt:`This is a one-way street. Once enabled, the automations beta can't be turned off. Existing welcome emails will move into your automations automatically.`,okLabel:`Enable`,okRunningLabel:`Enabling...`},disabled:!!JSON.parse(tr(e,`labs`)||`{}`).automations,flag:`automations`,label:`Automations (beta)`}),detail:(0,V.jsxs)(V.Fragment,{children:[`Build automated email flows for your members, and get early access to new automation features as they ship. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/automations-beta`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more →`})]}),title:`Automations (beta)`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`superEditors`}),detail:(0,V.jsx)(V.Fragment,{children:`Allows newly-assigned editors to manage members and comments in addition to regular roles.`}),title:`Enhanced Editor role (beta)`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`editorExcerpt`}),detail:(0,V.jsx)(V.Fragment,{children:`Adds the excerpt input below the post title in the editor`}),title:`Show post excerpt inline`}),(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:`additionalPaymentMethods`}),detail:(0,V.jsxs)(V.Fragment,{children:[`Enable support for CashApp, iDEAL, Bancontact, and others. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/payment-methods`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more →`})]}),title:`Additional payment methods`}),(0,V.jsx)(ua,{action:(0,V.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,V.jsx)(je,{id:`upload-redirects`,onUpload:async e=>{try{a(!0),await t(e),u({title:`Redirects uploaded`,type:`success`})}catch(e){r(e)}finally{a(!1)}},children:(0,V.jsx)(L,{color:`grey`,label:i?`Uploading ...`:`Upload redirects file`,size:`sm`,tag:`div`})}),(0,V.jsx)(L,{color:`green`,label:`Download current redirects`,link:!0,onClick:()=>fa()})]}),detail:(0,V.jsxs)(V.Fragment,{children:[`Configure redirects for old or moved content, `,(0,V.jsx)(`br`,{}),` more info in the `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/tutorials/implementing-redirects/`,rel:`noopener noreferrer`,target:`_blank`,children:`docs`})]}),title:`Redirects`}),(0,V.jsx)(ua,{action:(0,V.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,V.jsx)(je,{id:`upload-routes`,onUpload:async e=>{try{s(!0),await n(e),u({type:`success`,title:`Routes uploaded`})}catch(e){r(e)}finally{s(!1)}},children:(0,V.jsx)(L,{color:`grey`,label:o?`Uploading ...`:`Upload routes file`,size:`sm`,tag:`div`})}),(0,V.jsx)(L,{color:`green`,label:`Download current routes`,link:!0,onClick:()=>ma()})]}),detail:`Configure dynamic routing by modifying the routes.yaml file`,title:`Routes`})]})},ga=`data:image/svg+xml,%3csvg%20width='267'%20height='285'%20viewBox='0%200%20267%20285'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='165'%20cy='183'%20r='102'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='68'%20cy='71'%20r='31'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='99'%20cy='17'%20r='17'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='118'%20cy='70'%20r='7'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='45'%20cy='32'%20r='3'%20fill='%23F1F3F4'/%3e%3ccircle%20cx='12.5'%20cy='83.5'%20r='12.5'%20fill='%23F1F3F4'/%3e%3c/svg%3e`,_a=[{title:`Automations`,description:`Toggle the automations beta. Unexpected problems can occur if you turn this off after previously turning it on.`,flag:`automations`},{title:`Automations analytics`,description:`Show analytics for automations. Assumes the "automations" flag is also on.`,flag:`automationAnalytics`},{title:`Stripe Automatic Tax (private beta)`,description:`Use Stripe Automatic Tax at Stripe Checkout. Needs to be enabled in Stripe`,flag:`stripeAutomaticTax`},{title:`Email customization (internal beta)`,description:`Newsletter customization settings that have been released to Ghost's own production sites`,flag:`emailCustomization`},{title:`Import Member Tier`,description:`Enables tier to be specified when importing members`,flag:`importMemberTier`},{title:`CSV Content Importer`,description:`Enables importing posts from CSV files in the Universal Importer`,flag:`csvContentImporter`},{title:`Admin UI Refresh`,description:`Enable Admin UI refresh (exploration)`,flag:`adminUIRefresh`},{title:`Explore`,description:`Enables keeping in touch with the new Explore API`,flag:`explore`},{title:`Tags X`,description:`Enables the new Tags UI`,flag:`tagsX`},{title:`Email Unique ID`,description:`Enables {uniqueid} variable in emails for unique image URLs to bypass ESP image caching`,flag:`emailUniqueid`},{title:`Updated theme translation (beta)`,description:`Enable theme translation using i18next instead of the old translation package.`,flag:`themeTranslation`},{title:`Featurebase Feedback`,description:`Display a Feedback menu item in the admin sidebar. Requires the new admin experience.`,flag:`featurebaseFeedback`},{title:`Picture Element`,description:`Use the HTML picture element to serve modern image formats (AVIF, WebP) with automatic fallbacks`,flag:`pictureImageFormats`},{title:`Smarter Counts`,description:`Use optimized COUNT queries for API pagination when safe`,flag:`smarterCounts`},{title:`Get helper deduplication`,description:`Deduplicate identical {{#get}} helper queries within a single request to avoid redundant database calls`,flag:`getHelperDeduplication`}],va=()=>{let e=Se(),[t,n]=(0,B.useState)([]);return(0,B.useEffect)(()=>{(async()=>{let t=[];for(let n of _a)if(n.limitName&&e?.isLimited(n.limitName))try{await e.errorIfWouldGoOverLimit(n.limitName),t.push(n)}catch(e){e instanceof he||t.push(n)}else t.push(n);n(t)})()},[e]),(0,V.jsx)(A,{titleSeparator:!1,children:t.map(e=>(0,V.jsx)(ua,{action:(0,V.jsx)(la,{flag:e.flag,label:e.title}),detail:e.description,title:e.title},e.flag))})};function ya(e){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(!1),{filter:i,getVisibleComponents:a,checkVisible:o}=ot();return(0,B.useEffect)(()=>{i||(r.current=!1)},[i]),(0,B.useEffect)(()=>{if(r.current)return;let t=o(e),s=a(),c=!!i&&t&&s.size===1;n(c)},[i,e,o,a]),{isOpen:t,openManually:()=>{r.current=!0,n(!0)},closeManually:()=>{r.current=!0,n(!1)}}}var ba=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`labs-beta-features`),{config:r}=I(),{isOpen:i,openManually:a,closeManually:o}=ya(e),s=[{id:`labs-beta-features`,title:`Beta features`,contents:(0,V.jsx)(ha,{})},r.enableDeveloperExperiments&&{id:`labs-private-features`,title:`Private features`,contents:(0,V.jsx)(va,{})}].filter(Boolean);return(0,V.jsx)(J,{customHeader:(0,V.jsxs)(`div`,{className:`z-10 flex items-start justify-between`,children:[(0,V.jsx)(Ne,{description:`This is a testing ground for new or experimental features. They may change, break or inexplicably disappear at any time.`,title:`Labs`}),(0,V.jsx)(L,{className:`mt-[-5px]`,color:i?`grey`:`clear`,label:i?`Close`:`Open`,size:`sm`,onClick:i?o:a})]}),isEditing:i,keywords:e,navid:`labs`,testId:`labs`,children:i?(0,V.jsx)(Ze,{selectedTab:t,tabs:s,onTabChange:n}):(0,V.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden opacity-70`,children:(0,V.jsx)(`img`,{className:`absolute -top-6 -right-6 dark:opacity-10`,src:ga})})})},`Labs`),xa=()=>{let[e,t]=B.useState(!1),n=p();return(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 pt-4 md:grid-cols-2 lg:grid-cols-3`,children:[(0,V.jsx)(L,{className:`h-9! font-semibold!`,color:`grey`,icon:`export`,iconColorClass:`h-4! w-auto!`,label:`Content & settings`,onClick:()=>$i()}),(0,V.jsx)(L,{className:`h-9! font-semibold!`,color:`grey`,disabled:e,icon:`baseline-chart`,iconColorClass:`h-4! w-auto!`,label:`Post analytics`,loading:e,testId:`post-analytics-export-button`,onClick:async()=>{if(!e){t(!0);try{await d(`/posts/export/?limit=1000`,`posts.analytics.csv`)}catch(e){n(e)}finally{t(!1)}}}})]})},Sa=w.create(()=>{let e=E(),{mutateAsync:t}=Zi(),[n,r]=(0,B.useState)(!1),i=p();return(0,V.jsx)(re,{backDropClick:!1,footer:(0,V.jsxs)(`div`,{className:`flex w-full items-center justify-between p-8`,children:[(0,V.jsx)(vr,{href:`https://docs.ghost.org/migration/ghost`,target:`_blank`,children:`Learn about importing`}),(0,V.jsx)(L,{color:`outline`,disabled:n,label:`Cancel`,onClick:()=>e.remove()})]}),okLabel:``,size:`sm`,testId:`universal-import-modal`,title:`Universal import`,children:(0,V.jsx)(`div`,{className:`py-4`,children:(0,V.jsx)(je,{accept:`application/json, application/zip`,id:`import-file`,onUpload:async n=>{r(!0);try{await t(n),e.remove(),w.show(M,{title:`Import in progress`,prompt:`Your import is being processed, and you'll receive a confirmation email as soon as it’s complete. Usually this only takes a few minutes, but larger imports may take longer.`,cancelLabel:``,okLabel:`Got it`,onOk:e=>e?.remove(),formSheet:!1})}catch(e){i(e)}finally{r(!1)}},children:(0,V.jsx)(`div`,{className:`-mb-4 cursor-pointer bg-grey-50 p-10 text-center dark:bg-grey-950`,children:n?`Uploading...`:(0,V.jsxs)(V.Fragment,{children:[`Select any JSON or zip file that contains `,(0,V.jsx)(`br`,{}),`posts and settings`]})})})})})}),Ca=({icon:e,title:t,onClick:n})=>{let r=D(`flex h-9 cursor-pointer items-center justify-center gap-2 rounded-md bg-grey-100 px-2 font-semibold transition-all hover:bg-grey-200 dark:bg-grey-900`);return n?(0,V.jsxs)(`button`,{className:r,type:`button`,onClick:n,children:[e,t]}):(0,V.jsx)(V.Fragment,{})},wa=()=>{let{updateRoute:e}=P();return(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 pt-4 md:grid-cols-2 lg:grid-cols-3`,children:[(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`substack`,size:18}),title:`Substack`,onClick:()=>e({isExternal:!0,route:`/migrate/substack`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`beehiiv`,size:18}),title:`beehiiv`,onClick:()=>e({isExternal:!0,route:`/migrate/beehiiv`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`wordpress`,size:18}),title:`WordPress`,onClick:()=>e({isExternal:!0,route:`/migrate/wordpress`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`squarespace`,size:18}),title:`Squarespace`,onClick:()=>e({isExternal:!0,route:`/migrate/squarespace`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto dark:invert`,name:`medium`,size:18}),title:`Medium`,onClick:()=>e({isExternal:!0,route:`/migrate/medium`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`mailchimp`,size:20}),title:`Mailchimp`,onClick:()=>e({isExternal:!0,route:`/migrate/mailchimp`})}),(0,V.jsx)(Ca,{icon:(0,V.jsx)(l,{className:`w-auto`,name:`import`,size:16}),title:`Universal import`,onClick:()=>{w.show(Sa)}})]})},Ta=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`import`),r=[{id:`import`,title:`Import`,contents:(0,V.jsx)(wa,{})},{id:`export`,title:`Export`,contents:(0,V.jsx)(xa,{})}].filter(Boolean);return(0,V.jsx)(J,{customHeader:(0,V.jsx)(Ne,{description:`Import content, members and subscriptions from other platforms or export your Ghost data.`,title:`Migration tools`}),keywords:e,navid:`migration`,testId:`migrationtools`,children:(0,V.jsx)(Ze,{selectedTab:t,tabs:r,onTabChange:n})})},`Migration tools`),Ea=({keywords:e,...t})=>{let{checkVisible:n,noResult:r}=ot();return(0,V.jsx)(xr,{isVisible:n(e)||r,...t})},Y={integrations:[`advanced`,`integrations`,`zapier`,`slack`,`unsplash`,`first promoter`,`firstpromoter`,`pintura`,`disqus`,`analytics`,`ulysses`,`typeform`,`buffer`,`plausible`,`github`,`webhooks`],migrationtools:[`import`,`export`,`migrate`,`substack`,`substack`,`migration`,`medium`,`wordpress`,`wp`,`squarespace`,`beehiiv`],codeInjection:[`advanced`,`code injection`,`head`,`footer`],labs:[`advanced`,`labs`,`alpha`,`private`,`beta`,`flag`,`routes`,`redirect`,`translation`,`editor`,`portal`],history:[`advanced`,`history`,`log`,`events`,`user events`,`staff`,`audit`,`action`],dangerzone:[`danger zone`,`delete all content`,`delete site`,`reset all authentication`,`reset api keys`,`reset password`,`compromised credentials`,`lock staff users`,`sign out all staff`]},Da=()=>(0,V.jsxs)(Ea,{keywords:Object.values(Y).flat(),title:`Advanced`,children:[(0,V.jsx)(sa,{keywords:Y.integrations}),(0,V.jsx)(Ta,{keywords:Y.migrationtools}),(0,V.jsx)(Xi,{keywords:Y.codeInjection}),(0,V.jsx)(ba,{keywords:Y.labs}),(0,V.jsx)(na,{keywords:Y.history}),(0,V.jsx)(ta,{keywords:Y.dangerzone})]}),Oa=[{label:`Free members`,value:`status:free`,color:`green`},{label:`Paid members`,value:`status:-free`,color:`pink`}],ka=(e,t)=>{let n=Ht({path:`/tiers/`,filterKey:`name`,responseKey:`tiers`}),r=Ht({path:`/labels/`,filterKey:`name`,responseKey:`labels`}),i=Ht({path:`/offers/`,filterKey:`name`,responseKey:`offers`}),[a,o]=(0,B.useState)(null),s=e=>({value:e.id,label:e.name,color:`black`}),c=e=>({value:`label:${e.slug}`,label:e.name,color:`grey`}),l=e=>({value:`offer_redemptions:${e.id}`,label:e.name,color:`black`}),u=async(e,t)=>{let[o,u,f]=await Promise.all([n.loadData(e),r.loadData(e),i.loadData(e)]),p=[{options:Oa.filter(({label:t})=>t.toLowerCase().includes(e.toLowerCase()))},{label:`Active Tiers`,options:o.filter(({active:e,type:t})=>e&&t!==`free`).map(s)||[]},{label:`Archived Tiers`,options:o.filter(({active:e})=>!e).map(s)||[]},{label:`Labels`,options:u.map(c)||[]},{label:`Offers`,options:f.map(l)||[]}];a===null&&d(),t(p.filter(e=>e.options.length>0))},d=async()=>{let e=t?.split(`,`)||[],a=[],u=[],d=[];for(let t of e)t.startsWith(`label:`)?u.push(t.replace(`label:`,``)):t.startsWith(`offer_redemptions:`)?d.push(t.replace(`offer_redemptions:`,``)):be(t)&&a.push(t);let f=await Promise.all([n.loadInitialValues(a,`id`).then(e=>e.map(s)),r.loadInitialValues(u,`slug`).then(e=>e.map(c)),i.loadInitialValues(d,`id`).then(e=>e.map(l))]).then(e=>e.flat());o(e.map(e=>f.find(t=>t.value===e)))};return(0,B.useEffect)(()=>{e===`segment`&&u(``,()=>{})},[e]),{loadOptions:Ue(u,500),selectedSegments:a,setSelectedSegments:o}},Aa=[{label:`Whoever has access to the post`,hint:`Free posts to everyone, premium posts sent to paid members`,value:`visibility`},{label:`All members`,hint:`Everyone who is subscribed to newsletter updates, whether free or paid members`,value:`all-members`},{label:`Paid-members only`,hint:`People who have a premium subscription`,value:`paid-only`},{label:`Specific people`,hint:`Only people with any of the selected tiers or labels`,value:`segment`},{label:`Usually nobody`,hint:`Newsletters are off for new posts, but can be enabled when needed`,value:`none`}];function ja({defaultEmailRecipients:e,defaultEmailRecipientsFilter:t}){return e===`filter`?t===`status:free,status:-free`?`all-members`:t===`status:-free`?`paid-only`:t===null?`none`:`segment`:e}var Ma=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l]=z(t,[`editor_default_email_recipients`,`editor_default_email_recipients_filter`]),[u,d]=(0,B.useState)(ja({defaultEmailRecipients:c,defaultEmailRecipientsFilter:l})),{loadOptions:f,selectedSegments:p,setSelectedSegments:m}=ka(u,l);(0,B.useEffect)(()=>{let e=ja({defaultEmailRecipients:c,defaultEmailRecipientsFilter:l});d(e)},[c,l]);let h=e=>{[`visibility`,`disabled`].includes(e)?(o(`editor_default_email_recipients`,e),o(`editor_default_email_recipients_filter`,null)):o(`editor_default_email_recipients`,`filter`),e===`all-members`&&o(`editor_default_email_recipients_filter`,`status:free,status:-free`),e===`paid-only`&&o(`editor_default_email_recipients_filter`,`status:-free`),e===`none`&&o(`editor_default_email_recipients_filter`,null),d(e),n||s(!0)};return(0,V.jsx)(J,{description:`When you publish new content, who do you usually want to send it to?`,isEditing:n,keywords:e,navid:`default-recipients`,saveState:r,testId:`default-recipients`,title:`Default recipients`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:i,children:(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(De,{hint:`Who should receive your posts by default?`,options:Aa,selectedOption:Aa.find(e=>e.value===u),testId:`default-recipients-select`,title:`Default Newsletter recipients`,onSelect:e=>{e&&h(e.value)}}),u===`segment`&&p&&(0,V.jsx)(de,{loadOptions:f,title:`Filter`,values:p,async:!0,defaultOptions:!0,onChange:e=>{if(m(e),e.length){let t=e?.map(({value:e})=>e).join(`,`);o(`editor_default_email_recipients_filter`,t)}else o(`editor_default_email_recipients_filter`,null),d(`none`);n||s(!0)}})]})})},`Default recipients`),Na=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Gn(),{updateRoute:r}=P(),i=p(),[a,o]=z(t,[`editor_default_email_recipients`,`members_signup_access`]),s=o===`none`;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(wt,{checked:a!==`disabled`&&!s,direction:`rtl`,disabled:s,onChange:async e=>{let t=[{key:`editor_default_email_recipients`,value:e.target.checked?`visibility`:`disabled`}];e.target.checked||t.push({key:`editor_default_email_recipients_filter`,value:null});try{await n(t)}catch(e){i(e)}}})}),description:`Newsletter features are active, posts can be sent by email`,keywords:e,navid:`enable-newsletters`,testId:`enable-newsletters`,title:`Newsletter sending`,children:(0,V.jsx)(F,{columns:1,values:[{key:`private`,value:a!==`disabled`&&!s?(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(l,{colorClass:`text-green`,name:`check`,size:`sm`}),(0,V.jsx)(`span`,{children:`Enabled`})]})}):(0,V.jsxs)(`div`,{className:`w-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-grey-900`,children:[(0,V.jsx)(l,{colorClass:`text-grey-600`,name:`mail-block`,size:`sm`}),(0,V.jsx)(`span`,{children:`Disabled`})]}),s&&(0,V.jsxs)(Ae,{className:`mt-6`,color:`grey`,children:[`Your `,(0,V.jsx)(`button`,{className:`underline!`,type:`button`,onClick:()=>{r(`members`)},children:`Subscription access`}),` is set to ‘Nobody’, which disables all newsletter sending. Change to ‘Invite-only’ to send newsletters to existing members without allowing new signups.`]})]})}]})})},`Newsletter sending`),Pa=[{label:`🇺🇸 US`,value:`https://api.mailgun.net/v3`},{label:`🇪🇺 EU`,value:`https://api.eu.mailgun.net/v3`}],Fa=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),{mutateAsync:c}=Gn(),l=p(),[u,d,f]=z(t,[`mailgun_base_url`,`mailgun_domain`,`mailgun_api_key`]),m=(0,V.jsx)(F,{columns:1,values:d&&f?[{key:`status`,value:(0,V.jsx)(_r,{icon:`check-circle`,iconColorClass:`text-green`,children:`Mailgun is set up`})}]:[{heading:`Status`,key:`status`,value:`Mailgun is not set up`}]}),h=(0,V.jsxs)(V.Fragment,{children:[`Find your Mailgun API keys `,(0,V.jsx)(vr,{href:`https://app.mailgun.com/settings/api_security`,rel:`noopener noreferrer`,target:`_blank`,children:`here`})]}),g=(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`grid grid-cols-[120px_auto] gap-x-3 gap-y-6`,children:[(0,V.jsx)(De,{options:Pa,selectedOption:Pa.find(e=>e.value===u),title:`Mailgun region`,onSelect:e=>{o(`mailgun_base_url`,e?.value||null)}}),(0,V.jsx)(k,{title:`Mailgun domain`,value:d,onChange:e=>{o(`mailgun_domain`,e.target.value)}}),(0,V.jsx)(`div`,{className:`col-span-2`,children:(0,V.jsx)(k,{hint:h,title:`Mailgun private API key`,type:`password`,value:f,onChange:e=>{o(`mailgun_api_key`,e.target.value)}})})]})});return(0,V.jsx)(J,{description:(0,V.jsxs)(V.Fragment,{children:[`The Mailgun API is used for bulk email newsletter delivery. `,(0,V.jsx)(vr,{href:`https://ghost.org/docs/faq/mailgun-newsletters/`,target:`_blank`,children:`Why is this required?`})]}),isEditing:n,keywords:e,navid:`mailgun`,saveState:r,testId:`mailgun`,title:`Mailgun`,onCancel:a,onEditingChange:s,onSave:async()=>{if(!u)try{await c([{key:`mailgun_base_url`,value:Pa[0].value}])}catch(e){l(e);return}i()},children:n?g:m})},`Mailgun`),Ia=({id:e,setRef:t,isDragging:n,style:r,children:i,separator:a,...o})=>{let{updateRoute:s}=P(),c=()=>{s({route:`newsletters/${e}`})},l=(0,V.jsxs)(lt,{ref:t,action:(0,V.jsx)(L,{color:`green`,"data-testid":`edit-newsletter-button`,label:`Edit`,link:!0,onClick:c}),className:n?`opacity-75`:``,hideActions:!1,style:r,onClick:c,children:[(o.dragHandleAttributes||n)&&(0,V.jsx)(_t,{className:`w-10 align-middle!`,children:(0,V.jsx)(Le,{className:`h-10`,isDragging:n||!1,...o})}),i]});return n?(0,V.jsx)(St,{children:l}):l},La=({newsletter:e})=>{let{updateRoute:t}=P(),n=()=>{t({route:`newsletters/${e.id}`})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_t,{className:`w-full`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight text-grey-700`,children:e.description||`No description`})]})}),(0,V.jsx)(_t,{className:`hidden md:visible! md:table-cell! md:min-w-[11rem]`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{children:on(e.count?.active_members||0)}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight whitespace-nowrap text-grey-700`,children:`Subscribers`})]})}),(0,V.jsx)(_t,{className:`hidden md:visible! md:table-cell! md:min-w-[11rem]`,onClick:n,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col`,children:[(0,V.jsx)(`span`,{children:on(e.count?.posts||0)}),(0,V.jsx)(`span`,{className:`mt-0.5 text-sm leading-tight whitespace-nowrap text-grey-700`,children:`Delivered`})]})})]})},Ra=({newsletters:e,isLoading:t,isSortable:n,onSort:r})=>t?(0,V.jsx)(St,{isLoading:!0}):e.length&&n?(0,V.jsx)(bt,{container:e=>(0,V.jsx)(Ia,{...e}),items:e,renderItem:e=>(0,V.jsx)(La,{newsletter:e}),wrapper:St,onMove:(e,t)=>r?.(e,t)}):e.length?(0,V.jsx)(St,{children:e.map(e=>(0,V.jsx)(Ia,{id:e.id,children:(0,V.jsx)(La,{newsletter:e})},e.id))}):(0,V.jsx)(oe,{icon:`mail-block`,children:`No newsletters found.`}),za=({id:e,children:t})=>{let n=E(),{updateRoute:r}=P();return(0,V.jsx)(`button`,{className:`text-green`,type:`button`,onClick:()=>{r(`newsletters/${e}`),n.remove()},children:t})},Ba=j(({keywords:e})=>{let{updateRoute:t}=P(),n=()=>{t(`newsletters/new`)},[r,a]=(0,B.useState)(`active-newsletters`),{data:{newsletters:o,meta:s,isEnd:c}={},isLoading:l,fetchNextPage:u}=or(),{mutateAsync:d}=ar(),f=i(),m=Me().getParam(`verifyEmail`),{mutateAsync:h}=ir(),_=p(),[v,y]=(0,B.useState)(o||[]);(0,B.useEffect)(()=>{y(o||[])},[o]),(0,B.useEffect)(()=>{!m||!window.location.href.includes(`newsletters`)||(async()=>{try{let{newsletters:[e],meta:{email_verified:t}={}}=await h({token:m}),n,r;t&&t===`sender_email`?(n=`Newsletter email verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` will now be sent from `,(0,V.jsx)(`strong`,{children:e.sender_email}),`.`]})):t&&t===`sender_reply_to`?(n=`Reply-to address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` will now use `,(0,V.jsx)(`strong`,{children:e.sender_reply_to}),` as the reply-to address.`]})):(n=`Email address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Email address for newsletter `,(0,V.jsx)(za,{id:e.id,children:e.name}),` has been changed.`]})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),_(e,{withToast:!1})}})()},[m,_,h]);let b=(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Add newsletter`,size:`sm`,onClick:()=>{n()}}),x=v.filter(e=>e.status===`active`).sort((e,t)=>e.sort_order-t.sort_order)||[],S=v.filter(e=>e.status!==`active`);return(0,V.jsxs)(J,{customButtons:b,description:`Edit details and customize your design`,keywords:e,navid:`newsletters`,testId:`newsletters`,title:`Newsletters`,children:[(0,V.jsx)(Ze,{selectedTab:r,tabs:[{id:`active-newsletters`,title:`Active`,contents:(0,V.jsx)(Ra,{isLoading:l,newsletters:x,isSortable:!0,onSort:async(e,t)=>{let n=x.findIndex(t=>t.id===e),r=x.findIndex(e=>e.id===t)||0,i=Ce(x,n,r).map((e,t)=>e.sort_order===t?null:{...e,sort_order:t}).filter(e=>!!e),a=S.map((e,t)=>e.sort_order===t+x.length?null:{...e,sort_order:t}).filter(e=>!!e),o=[...i,...a].sort((e,t)=>e.sort_order-t.sort_order);y(v.map(e=>o.find(t=>t.id===e.id)||e)),f.setQueriesData([sr],e=>{if(e)return{...e,pages:e.pages.map(e=>({...e,newsletters:e.newsletters.map(e=>o.find(t=>t.id===e.id)||e)}))}});for(let e of o)await d(e)}})},{id:`archived-newsletters`,title:`Archived`,contents:(0,V.jsx)(Ra,{isLoading:l,newsletters:S})}],onTabChange:a}),c===!1&&(0,V.jsx)(L,{label:`Load more (showing ${v?.length||0}/${s?.pagination.total||0} newsletters)`,link:!0,onClick:()=>u()})]})},`Newsletters`),Va={enableNewsletters:[`emails`,`newsletters`,`newsletter sending`,`enable`,`disable`,`turn on`,`turn off`],newsletters:[`newsletters`,`emails`,`design`,`customization`],defaultRecipients:[`newsletters`,`default recipients`,`emails`],mailgun:[`mailgun`,`emails`,`newsletters`]},Ha=()=>{let{settings:e,config:t}=I(),[n]=z(e,[`editor_default_email_recipients`]),r=n!==`disabled`,i=r&&!t.mailgunIsConfigured;return(0,V.jsxs)(Ea,{keywords:[Va.enableNewsletters,...r?[Va.defaultRecipients,Va.newsletters]:[],...i?[Va.mailgun]:[]].flat(),title:`Newsletters`,children:[(0,V.jsx)(Na,{keywords:Va.enableNewsletters}),r&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ma,{keywords:Va.defaultRecipients}),(0,V.jsx)(Ba,{keywords:Va.newsletters}),i&&(0,V.jsx)(Fa,{keywords:Va.mailgun})]})]})},Ua=({id:e,children:t})=>{let n=E(),{updateRoute:r}=P();return(0,V.jsx)(`button`,{className:`text-green`,type:`button`,onClick:()=>{r(`newsletters/${e}`),n.remove()},children:t})},Wa=()=>{let e=window.location.hash.slice(1),t=new URL(e||`/`,window.location.origin).pathname;return t.startsWith(`/settings/emails`)||t.startsWith(`/settings/newsletters`)},Ga=j(({filter:e})=>{let{data:{newsletters:t,meta:n,isEnd:r}={},isLoading:a,fetchNextPage:o}=or(),{mutateAsync:s}=ar(),c=i(),l=Me().getParam(`verifyEmail`),{mutateAsync:u}=ir(),d=p(),[f,m]=(0,B.useState)(t||[]);(0,B.useEffect)(()=>{m(t||[])},[t]),(0,B.useEffect)(()=>{!l||!Wa()||(async()=>{try{let{newsletters:[e],meta:{email_verified:t}={}}=await u({token:l}),n,r;t&&t===`sender_email`?(n=`Newsletter email verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` will now be sent from `,(0,V.jsx)(`strong`,{children:e.sender_email}),`.`]})):t&&t===`sender_reply_to`?(n=`Reply-to address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` will now use `,(0,V.jsx)(`strong`,{children:e.sender_reply_to}),` as the reply-to address.`]})):(n=`Email address verified`,r=(0,V.jsxs)(V.Fragment,{children:[`Email address for newsletter `,(0,V.jsx)(Ua,{id:e.id,children:e.name}),` has been changed.`]})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),d(e,{withToast:!1})}})()},[l,d,u]);let h=f.filter(e=>e.status===`active`).sort((e,t)=>e.sort_order-t.sort_order)||[],_=f.filter(e=>e.status!==`active`);return(0,V.jsxs)(V.Fragment,{children:[e===`active`?(0,V.jsx)(Ra,{isLoading:a,isSortable:!0,newsletters:h,onSort:async(e,t)=>{let n=h.findIndex(t=>t.id===e),r=h.findIndex(e=>e.id===t)||0,i=Ce(h,n,r).map((e,t)=>e.sort_order===t?null:{...e,sort_order:t}).filter(e=>!!e),a=_.map((e,t)=>e.sort_order===t+h.length?null:{...e,sort_order:t}).filter(e=>!!e),o=[...i,...a].sort((e,t)=>e.sort_order-t.sort_order);m(f.map(e=>o.find(t=>t.id===e.id)||e)),c.setQueriesData([sr],e=>{if(e)return{...e,pages:e.pages.map(e=>({...e,newsletters:e.newsletters.map(e=>o.find(t=>t.id===e.id)||e)}))}});for(let e of o)await s(e)}}):(0,V.jsx)(Ra,{isLoading:a,newsletters:_}),r===!1&&(0,V.jsx)(L,{label:`Load more (showing ${f?.length||0}/${n?.pagination.total||0} newsletters)`,link:!0,onClick:()=>o()})]})},`Newsletters`),Ka=w.create(({title:e=`Are you sure you want to leave this page?`,description:t=(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{children:`Hey there! It looks like you didn't save the changes you made.`}),(0,V.jsx)(`p`,{children:`Save before you go!`})]})})=>{let n=E(),r=(0,B.useRef)(n.visible),i=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{r.current&&!n.visible&&(n.resolveHide(),n.remove()),r.current=n.visible},[n]),(0,V.jsx)(Fn,{open:n.visible,onOpenChange:e=>{e||(n.resolve(i.current),i.current=!1,n.hide())},children:(0,V.jsxs)(Ln,{"data-testid":`welcome-email-dirty-confirm-modal`,onEscapeKeyDown:e=>{e.stopPropagation()},children:[(0,V.jsxs)(Rn,{children:[(0,V.jsx)(On,{children:e}),(0,V.jsx)(kn,{asChild:!0,children:t})]}),(0,V.jsxs)(In,{children:[(0,V.jsx)(Dn,{asChild:!0,children:(0,V.jsx)(ln,{variant:`outline`,children:`Stay`})}),(0,V.jsx)(rr,{asChild:!0,children:(0,V.jsx)(ln,{variant:`destructive`,onClick:()=>{i.current=!0},children:`Leave`})})]})]})})}),qa=({open:e,title:t,preview:n,sidebar:r,dirty:i=!1,isLoading:a=!1,okProps:o,onSave:s,onClose:c,afterClose:l,testId:u})=>{let d=(0,B.useRef)(s),f=(0,B.useRef)(e);(0,B.useEffect)(()=>{d.current=s},[s]),(0,B.useEffect)(()=>{f.current&&!e&&l?.(),f.current=e},[l,e]),(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),d.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let p=async()=>{if(!i){c();return}await w.show(Ka)&&c()};return(0,V.jsx)(Zn,{open:e,onOpenChange:e=>{e||p()},children:(0,V.jsx)(Kn,{"aria-describedby":void 0,className:R(`top-[50%] left-[50%] h-[calc(100vh-8vmin)] w-[calc(100vw-8vmin)] max-w-none translate-[-50%] gap-0 overflow-hidden p-0`),"data-testid":u,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),p()},children:(0,V.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,V.jsx)(`div`,{className:`hidden min-h-0 flex-1 flex-col bg-gray-50 dark:bg-black [@media(min-width:801px)]:flex`,children:(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8`,children:n})}),(0,V.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col border-l border-gray-200 dark:border-gray-900 [@media(min-width:801px)]:w-[400px] [@media(min-width:801px)]:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-5`,children:[(0,V.jsx)(Hn,{children:t}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(ln,{variant:`outline`,onClick:()=>p(),children:`Close`}),(0,V.jsx)(ln,{className:o?.color===`green`?`bg-green text-white hover:bg-green/90`:void 0,disabled:a||o?.disabled,variant:o?.color===`red`?`destructive`:`default`,onClick:s,children:o?.label||`Save`})]})]}),r]})]})})})},Ja=/^#(?:[0-9a-f]{3}){1,2}$/i;function Ya(e){return Ja.test(e)?e:`#ffffff`}function Xa(e,t){return!e||e===`transparent`?`transparent`:e===`accent`?t:Ja.test(e)?e:`transparent`}function Za(e,t,n){return Ja.test(e||``)?e:e===null?Ke(n).hex():t}function Qa(e,t){if(e===`fill`)return Ke(t).hex()}function $a(e,t,n){let r=e===void 0?`accent`:e;return r===`accent`?t:Ja.test(r||``)?r:Ke(n).hex()}function eo(e,t,n){return Ja.test(e||``)?e:e===`accent`?t:Ke(n).hex()}function to(e,t){return Ja.test(e||``)?e:e===`accent`?t:`#e0e7eb`}function no(e,t){let n=Ya(e.background_color),r=Xa(e.header_background_color,t),i=Za(e.button_color,t,n),a=Ke(n).hex(),o=Ke(n).alpha(.5).toString(),s=r===`transparent`?a:Ke(r).hex(),c=r===`transparent`?o:Ke(r).alpha(.5).toString();return{backgroundColor:n,headerBackgroundColor:r,sectionTitleColor:eo(e.section_title_color,t,n),buttonColor:i,buttonTextColor:Qa(e.button_style,i),linkColor:$a(e.link_color,t,n),dividerColor:to(e.divider_color,t),textColor:a,secondaryTextColor:o,headerTextColor:s,secondaryHeaderTextColor:c}}function ro(e){return e===`serif`?`Georgia, serif`:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`}function io(e){switch(e){case`square`:return`rounded-none`;case`pill`:return`rounded-full`;default:return`rounded-[6px]`}}function ao(e){return e===`rounded`?`rounded-md`:``}var oo=({senderName:e,senderEmail:t,replyToEmail:n,subject:r,showRecipientLine:i=!0,showSubjectLine:a=!0})=>{let o=n||t,s=e&&t?`${e} (${t})`:e||t;return!s&&!o&&(!a||!r)?null:(0,V.jsxs)(`div`,{className:`flex flex-col justify-center gap-1 border-b border-grey-200 bg-white p-6 text-grey-700`,children:[s&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`From:`}),` `,s]}),i&&t&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`To:`}),` subscriber@example.com`]}),o&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold text-grey-900`,children:`Reply-to:`}),` `,o]}),a&&r&&(0,V.jsx)(`div`,{className:`text-base font-medium text-grey-900`,children:r})]})},so=({iconUrl:e,showIcon:t,showTitle:n,siteTitle:r,backgroundColor:i,textColor:a})=>!t&&(!n||!r)?null:(0,V.jsxs)(`div`,{className:`px-[7rem] py-3 text-center`,style:{backgroundColor:i===`transparent`?void 0:i},children:[t&&e&&(0,V.jsx)(`img`,{alt:r||`Publication icon`,className:`mx-auto mb-3 size-12 rounded`,src:e}),n&&r&&(0,V.jsx)(`h4`,{className:`mb-1 text-[1.6rem] leading-tight font-bold tracking-tight uppercase`,style:{color:a},children:r})]}),co=({siteTitle:e,footerLinkText:t=`Unsubscribe`,emailFooter:n,showBadge:r,color:i,textColor:a})=>(0,V.jsxs)(`div`,{className:`flex flex-col items-center pt-10`,children:[n&&(0,V.jsx)(`div`,{className:`px-8 py-3 text-center text-[1.3rem] leading-base break-words whitespace-pre-line`,style:{color:i},children:n}),(0,V.jsxs)(`div`,{className:`px-8 pt-3 pb-14 text-center text-[1.3rem]`,children:[(0,V.jsxs)(`span`,{style:{color:i},children:[e||`Your publication`,` © `,new Date().getFullYear(),` — `]}),(0,V.jsx)(`span`,{className:`underline`,style:{color:i},children:t})]}),r&&(0,V.jsx)(`div`,{className:`flex flex-col items-center pt-[10px] pb-[40px]`,children:(0,V.jsxs)(`span`,{className:`inline-flex items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight`,style:{color:a},children:[(0,V.jsx)(Cr,{className:`mr-[6px] size-4`}),(0,V.jsx)(`span`,{children:`Powered by Ghost`})]})})]}),lo=({settings:e,accentColor:t,publicationIcon:n,siteTitle:r,senderName:i,senderEmail:a,replyToEmail:o,subject:s,showRecipientLine:c=!0,showSubjectLine:l=!0,headerImage:u,showPublicationIcon:d=!1,showPublicationTitle:f=!0,showBadge:p=!0,emailFooter:m,footerLinkText:h,children:g})=>{let _=no(e,t),v=ao(e.image_corners),y=r||void 0;return(0,V.jsxs)(`div`,{className:`mx-auto flex max-h-full min-h-0 w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm`,children:[(0,V.jsx)(oo,{replyToEmail:o,senderEmail:a,senderName:i,showRecipientLine:c,showSubjectLine:l,subject:s}),(0,V.jsxs)(`div`,{className:`min-h-0 w-full flex-1 overflow-y-auto`,style:{backgroundColor:_.backgroundColor},children:[(0,V.jsxs)(`div`,{className:`px-[7rem]`,style:{backgroundColor:_.headerBackgroundColor===`transparent`?void 0:_.headerBackgroundColor},children:[u&&(0,V.jsx)(`div`,{className:`pt-8`,children:(0,V.jsx)(`img`,{alt:`Header`,className:R(`h-auto w-full`,v),src:u})}),(0,V.jsx)(so,{backgroundColor:`transparent`,iconUrl:n,showIcon:d&&!!n,showTitle:f,siteTitle:y,textColor:_.headerTextColor})]}),g,(0,V.jsx)(co,{color:_.secondaryTextColor,emailFooter:m,footerLinkText:h,showBadge:p,siteTitle:y,textColor:_.textColor})]})]})},uo=({value:e,onChange:t})=>{let{mutateAsync:n}=yt(),r=async e=>{t(Ie(await n({file:e})))};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`header-image-field`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-header-image`,children:`Header image`}),e?(0,V.jsxs)(`div`,{className:`relative overflow-hidden rounded-md border border-gray-200 dark:border-gray-800`,children:[(0,V.jsx)(`img`,{alt:`Header`,className:`h-auto w-full`,src:e}),(0,V.jsx)(`button`,{className:`absolute top-2 right-2 rounded bg-black/50 px-2 py-1 text-sm text-white hover:bg-black/70`,type:`button`,onClick:()=>t(``),children:`Remove`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(_n,{accept:{"image/*":[`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`,`.svg`]},className:`flex h-24 items-center justify-center p-0`,id:`welcome-email-header-image`,onDropAccepted:e=>e[0]&&r(e[0]),children:(0,V.jsx)(`span`,{className:`text-gray-700`,children:`Upload header image`})}),(0,V.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`1200x600 recommended. Use a transparent PNG for best results on any background.`})]})]})},fo=({value:e,onChange:t})=>(0,V.jsxs)(`div`,{className:`mt-6 flex items-start justify-between gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(nn,{className:`mt-0.5 size-4 shrink-0 text-red-500`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{children:`Promote independent publishing`}),(0,V.jsx)(`span`,{className:`text-sm leading-tight text-muted-foreground`,children:`Show you're a part of the indie publishing movement with a small badge in the footer`})]})]}),(0,V.jsx)(It,{checked:e,size:`sm`,onCheckedChange:t})]}),po=``+new URL(`email-design-user-image-BWe5RYS0.jpg`,import.meta.url).href,mo=(0,B.createContext)(void 0),ho=({settings:e,onSettingsChange:t,accentColor:n,children:r})=>(0,V.jsx)(mo.Provider,{value:{settings:e,onSettingsChange:t,accentColor:n},children:r}),go=()=>{let e=(0,B.useContext)(mo);if(!e)throw Error(`useEmailDesign must be used within an EmailDesignProvider`);return e},_o=()=>{let{settings:e,accentColor:t}=go(),n=no(e,t),r=ro(e.body_font_category),i=io(e.button_corners),a=e.button_style===`outline`,o=R(`no-underline`,e.link_style===`underline`&&`underline`,e.link_style===`bold`&&`font-bold`),s=R(`mb-5 text-[2.6rem] tracking-tighter`,e.title_font_category===`serif`&&`font-serif`,e.title_font_category===`sans_serif`&&`font-sans`,e.title_font_weight===`normal`&&`font-normal`,e.title_font_weight===`medium`&&`font-medium`,e.title_font_weight===`semibold`&&`font-semibold`,e.title_font_weight===`bold`&&`font-bold`),c=R(e.body_font_category===`serif`?`font-serif text-[1.8rem]`:`text-[1.7rem]`);return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-[600px] px-10 pt-16`,children:[(0,V.jsx)(`h3`,{className:s,style:{color:n.sectionTitleColor},children:`Your welcome email`}),(0,V.jsxs)(`div`,{className:R(c),style:{color:n.textColor,fontFamily:r},children:[(0,V.jsx)(`p`,{className:`mt-0 mb-6`,children:`This is what your welcome email will look like when someone signs up to your site.`}),(0,V.jsx)(`p`,{className:`mt-0 mb-8`,children:`Use the settings on the right to shape the design — from colors and typography to layout and buttons — so it feels like a natural extension of your brand.`}),(0,V.jsx)(`div`,{className:R(`h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat`),children:(0,V.jsx)(`img`,{alt:`Example cover image`,className:R(`min-h-full min-w-full shrink-0`,ao(e.image_corners)),src:po})}),(0,V.jsx)(`div`,{className:`mt-1 w-full max-w-[600px] pb-8 text-center text-body-sm`,style:{color:n.secondaryTextColor},children:`Image caption`}),(0,V.jsx)(`p`,{className:`mt-0 mb-6`,children:`Welcome emails set the tone for your relationship with new members. We’ve optimized this template to look great across devices and inboxes, so your first impression lands exactly how you want it.`})]}),(0,V.jsx)(`div`,{className:`my-5 py-4`,children:(0,V.jsx)(`hr`,{className:`m-0 border-0 border-t`,style:{borderColor:n.dividerColor}})}),(0,V.jsx)(`h3`,{className:s,style:{color:n.sectionTitleColor},children:`Need inspiration?`}),(0,V.jsx)(`div`,{className:R(c),style:{color:n.textColor,fontFamily:r},children:(0,V.jsxs)(`p`,{className:`mt-0 mb-6`,children:[`We’ve put together a `,(0,V.jsx)(`a`,{className:o,href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:{color:n.linkColor},target:`_blank`,children:`quick guide`}),` that walks through all the available settings, along with a few examples of what’s possible.`]})}),(0,V.jsx)(`div`,{className:`pb-6`,children:(0,V.jsx)(`a`,{className:R(`inline-block border px-[18px] py-2.5 font-sans text-[15px] no-underline`,i,a?`bg-transparent`:`border-transparent`,e.link_style===`bold`?`font-bold`:`font-semibold`),href:`https://ghost.org/help/email-design/`,rel:`noopener noreferrer`,style:a?{borderColor:n.buttonColor,color:n.buttonColor}:{backgroundColor:n.buttonColor,color:n.buttonTextColor},target:`_blank`,children:`Learn more`})}),(0,V.jsx)(`div`,{className:`py-4`,children:(0,V.jsx)(`hr`,{className:`m-0 border-0 border-t`,style:{borderColor:n.dividerColor}})})]})},vo=e(Rt(),1),yo=`AutomatedEmailDesignResponseType`,bo=m({dataType:yo,path:`/automated_emails/design/`}),xo=f({method:`PUT`,path:()=>`/automated_emails/design/`,body:e=>({automated_email_design:[e]}),updateQueries:{emberUpdateType:`skip`,dataType:yo,update:e=>e}}),So=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Co=(e,t,n=[])=>{if(e&&So.test(e))return e;switch(e){case`accent`:return t&&So.test(t)?t:`#ffffff`;case`light`:return`#ffffff`;case`transparent`:return`#00000000`;default:break}let r=n.find(t=>t.value===e);return r?r.hex:`#ffffff`},wo=e=>{let t=e.toLowerCase();return t.length===5&&t[4]===`0`||t.length===9&&t.slice(7)===`00`},To=()=>(0,V.jsx)(`span`,{className:`pointer-events-none absolute inset-0 overflow-hidden rounded-full`,"data-testid":`transparent-indicator`,"aria-hidden":!0,children:(0,V.jsx)(`span`,{className:`absolute top-1/2 left-[-30%] block h-px w-[160%] -translate-y-1/2 -rotate-45 bg-red`})}),Eo=({title:e,value:t,onChange:n,accentColor:r,swatches:i=[]})=>{let[a,o]=(0,B.useState)(!1),s=Co(t,r,i),c=(0,B.useRef)(!1),l=(0,B.useRef)(!1),u=(0,B.useRef)(null),d=i.find(e=>e.value===t||t&&e.hex.toLowerCase()===t.toLowerCase()),f=()=>{c.current=!1,l.current=!1},p=(0,B.useCallback)(()=>{u.current&&=(window.removeEventListener(`keydown`,u.current,!0),null)},[]),m=()=>{p(),f(),o(!1)},h=()=>{if(u.current)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),m())};u.current=e,window.addEventListener(`keydown`,e,!0)};return(0,B.useEffect)(()=>()=>{p()},[p]),(0,V.jsxs)(Bn,{open:a,onOpenChange:e=>{f(),e?h():p(),o(e)},children:[(0,V.jsx)(Tn,{asChild:!0,children:(0,V.jsxs)(`div`,{className:`flex w-full cursor-pointer items-start justify-between`,children:[(0,V.jsx)(`span`,{className:`mt-px flex-1`,children:e}),(0,V.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[a&&i.length>0&&(0,V.jsx)(`div`,{className:`flex items-center gap-1`,children:i.map(e=>{let t=e.value===void 0?e.hex:e.value,r=d?.title===e.title;return(0,V.jsx)(`button`,{"aria-label":e.title,className:`relative flex size-5 shrink-0 cursor-pointer items-center overflow-hidden rounded-full border border-grey-300 dark:border-grey-800 ${r?`outline-2 outline-green`:``}`,style:{backgroundColor:e.hex},title:e.title,type:`button`,onClick:()=>{c.current=!1,l.current=!0,n(t),m()},children:wo(e.hex)&&(0,V.jsx)(To,{})},e.title)})}),(0,V.jsxs)(`button`,{"aria-label":`Pick color`,className:`relative size-6 cursor-pointer rounded-full border border-grey-200 dark:border-grey-800`,type:`button`,children:[(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-[conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))]`}),(0,V.jsx)(`div`,{className:`absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950`,style:{backgroundColor:s}})]})]})]})}),(0,V.jsx)(Pn,{align:`end`,className:`w-auto p-4`,onEscapeKeyDown:e=>{e.stopPropagation()},children:(0,V.jsx)(`div`,{onInputCapture:()=>{c.current=!0},onKeyDownCapture:()=>{c.current=!0},onMouseDownCapture:()=>{c.current=!0},onPointerDownCapture:()=>{c.current=!0},onTouchStartCapture:()=>{c.current=!0},children:(0,V.jsx)(Ki,{value:s,onChange:e=>{l.current||!c.current||n(e)}})})})]})},Do=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsx)(Eo,{swatches:[{title:`White`,value:`light`,hex:`#ffffff`}],title:`Background color`,value:e.background_color,onChange:e=>e&&t({background_color:e})})},Oo=[{value:`serif`,label:`Elegant serif`},{value:`sans_serif`,label:`Clean sans-serif`}],ko={sans_serif:{options:[{value:`normal`,label:`Regular`},{value:`medium`,label:`Medium`},{value:`semibold`,label:`Semi-bold`},{value:`bold`,label:`Bold`}]},serif:{options:[{value:`normal`,label:`Regular`},{value:`bold`,label:`Bold`}],map:{medium:`normal`,semibold:`bold`}}};function Ao(e,t){let n=ko[e]||ko.sans_serif;return n.options.find(e=>e.value===t)?t:n.map?.[t]||`bold`}var jo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Body font`}),(0,V.jsxs)(gn,{value:e.body_font_category||`sans_serif`,onValueChange:e=>t({body_font_category:e}),children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:Oo.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Mo=/^#(?:[0-9a-f]{3}){1,2}$/i,No=e=>e===`light`?`#ffffff`:Mo.test(e)?e:`#ffffff`,Po=e=>Ke(No(e)).hex(),Fo=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go(),r=Po(e.background_color);return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Accent`,value:`accent`,hex:n},{title:`Auto`,value:null,hex:r}],title:`Button color`,value:e.button_color,onChange:e=>t({button_color:e})})},Io=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Button corners`}),(0,V.jsxs)(bn,{type:`single`,value:e.button_corners||`rounded`,onValueChange:e=>e&&t({button_corners:e}),children:[(0,V.jsx)(yn,{"aria-label":`Square`,value:`square`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Rounded`,value:`rounded`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-sm border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Pill`,value:`pill`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-full border-[1.5px] border-current`})})]})]})},Lo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Button style`}),(0,V.jsxs)(bn,{type:`single`,value:e.button_style||`fill`,onValueChange:e=>e&&t({button_style:e}),children:[(0,V.jsx)(yn,{"aria-label":`Fill`,value:`fill`,children:(0,V.jsx)(`span`,{className:`inline-block h-4 w-5 rounded-sm bg-current`})}),(0,V.jsx)(yn,{"aria-label":`Outline`,value:`outline`,children:(0,V.jsx)(`span`,{className:`inline-block h-4 w-5 rounded-sm border-[1.5px] border-current`})})]})]})},Ro=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go();return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Light`,value:null,hex:`#e0e7eb`},{title:`Accent`,value:`accent`,hex:n}],title:`Divider color`,value:e.divider_color,onChange:e=>t({divider_color:e})})},zo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsx)(Eo,{swatches:[{title:`Transparent`,value:`transparent`,hex:`#00000000`}],title:`Header background color`,value:e.header_background_color,onChange:e=>e&&t({header_background_color:e})})},Bo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Heading font`}),(0,V.jsxs)(gn,{value:e.title_font_category||`sans_serif`,onValueChange:n=>{let r=Ao(n,e.title_font_weight);t({title_font_category:n,title_font_weight:r})},children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:Oo.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Vo=()=>{let{settings:e,onSettingsChange:t}=go(),n=e.title_font_category||`sans_serif`,r=ko[n]?.options||ko.sans_serif.options,i=Ao(n,e.title_font_weight);return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Heading weight`}),(0,V.jsxs)(gn,{value:i,onValueChange:e=>t({title_font_weight:e}),children:[(0,V.jsx)(mn,{className:`w-[180px]`,children:(0,V.jsx)(hn,{})}),(0,V.jsx)(pn,{onEscapeKeyDown:e=>{e.stopPropagation()},children:r.map(e=>(0,V.jsx)(fn,{value:e.value,children:e.label},e.value))})]})]})},Ho=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Image corners`}),(0,V.jsxs)(bn,{type:`single`,value:e.image_corners||`square`,onValueChange:e=>e&&t({image_corners:e}),children:[(0,V.jsx)(yn,{"aria-label":`Square`,value:`square`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 border-[1.5px] border-current`})}),(0,V.jsx)(yn,{"aria-label":`Rounded`,value:`rounded`,children:(0,V.jsx)(`span`,{className:`inline-block size-4 rounded-sm border-[1.5px] border-current`})})]})]})},Uo=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go(),r=Po(e.background_color);return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Accent`,value:`accent`,hex:n},{title:`Auto`,value:null,hex:r}],title:`Link color`,value:e.link_color,onChange:e=>t({link_color:e})})},Wo=()=>{let{settings:e,onSettingsChange:t}=go();return(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{children:`Link style`}),(0,V.jsxs)(bn,{type:`single`,value:e.link_style||`underline`,onValueChange:e=>e&&t({link_style:e}),children:[(0,V.jsx)(yn,{"aria-label":`Underline`,value:`underline`,children:(0,V.jsx)(sn,{className:`size-4`})}),(0,V.jsx)(yn,{"aria-label":`Regular`,value:`regular`,children:(0,V.jsx)(un,{className:`size-4`})}),(0,V.jsx)(yn,{"aria-label":`Bold`,value:`bold`,children:(0,V.jsx)(cn,{className:`size-4`})})]})]})},Go=()=>{let{settings:e,onSettingsChange:t,accentColor:n}=go();return(0,V.jsx)(Eo,{accentColor:n,swatches:[{title:`Auto`,value:null,hex:Po(e.background_color)},{title:`Accent`,value:`accent`,hex:n}],title:`Section title color`,value:e.section_title_color,onChange:e=>t({section_title_color:e})})},Ko={background_color:`light`,title_font_category:`sans_serif`,title_font_weight:`bold`,body_font_category:`sans_serif`,header_background_color:`transparent`,section_title_color:null,button_color:`accent`,button_style:`fill`,button_corners:`rounded`,link_color:`accent`,link_style:`underline`,image_corners:`square`,divider_color:null},qo={free:`member-welcome-email-free`,paid:`member-welcome-email-paid`},Jo=`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Welcome! Thanks for subscribing — it's great to have you here.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"You'll now receive new posts straight to your inbox. You can also log in any time to read the ","type":"extended-text","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"full archive","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"__GHOST_URL__/"},{"detail":0,"format":0,"mode":"normal","style":"","text":" or catch up on new posts as they go live.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"A little housekeeping: If this email landed in spam or promotions, try moving it to your primary inbox and adding this address to your contacts. Small signals like that help your inbox recognize that these messages matter to you.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Have questions or just want to say hi? Feel free to reply directly to this email or any newsletter in the future.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`,Yo=`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Welcome, and thank you for your support — it means a lot.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"As a paid member, you now have full access to everything: the complete archive, and any paid-only content going forward. New posts will land straight to your inbox, and you can log in any time to ","type":"extended-text","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"catch up","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"__GHOST_URL__/"},{"detail":0,"format":0,"mode":"normal","style":"","text":" on anything you've missed.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"A little housekeeping: If this email landed in spam or promotions, try moving it to your primary inbox and adding this address to your contacts. Small signals like that help your inbox recognize that these messages matter to you.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Have questions or just want to say hi? Feel free to reply directly to this email or any newsletter in the future.","type":"extended-text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`,Xo=(e,t)=>({name:e===`free`?`Free member welcome flow`:`Paid member welcome flow`,slug:qo[e],subject:e===`free`?`Welcome to ${t||`our site`}`:`Welcome to your paid subscription`,lexical:e===`free`?Jo:Yo}),Zo=(e,t)=>({id:``,status:`inactive`,...Xo(e,t),sender_name:null,sender_email:null,sender_reply_to:null,created_at:``,updated_at:null}),Qo=e=>e?.trim()||``,$o=(...e)=>e.map(Qo).find(Boolean)||``,es=({automatedEmails:e=[],config:t,defaultEmailAddress:n,newsletter:r,siteTitle:i,supportEmailAddress:a})=>{let o=e.find(e=>e.slug===qo.free),s=e.find(e=>e.slug===qo.paid),c=$o(o?.sender_name,s?.sender_name),l=$o(o?.sender_email,s?.sender_email),u=$o(o?.sender_reply_to,s?.sender_reply_to),d=Qo(r?.sender_name),f=r?Qo(Qe(r,t,n||void 0)):``,p=r?Qo(at(r,t,a||void 0,n||void 0)):``,m=d||Qo(i)||`Your site name`,h=f||Qo(n),g=p||Qo(a)||Qo(n),_=c||m||`Your Site`,v=l||h||``,y=u||g||``,b=y!==``&&y!==v,x=er(t),S=Yn(t);return{hasDistinctReplyTo:b,replyToEmailInput:u,replyToEmailPlaceholder:g,resolvedReplyToEmail:y,resolvedSenderEmail:v,resolvedSenderName:_,senderEmailDomain:S?Wn(t):null,senderEmailInput:l,senderEmailPlaceholder:h,senderNameInput:c,senderNamePlaceholder:m,showSenderEmailInput:!x||S}},ts=(e=[],{config:t,defaultEmailAddress:n,siteTitle:r,supportEmailAddress:i})=>{let{data:a}=or({searchParams:{filter:`status:active`,limit:`1`}}),o=a?.newsletters?.[0];return(0,B.useMemo)(()=>es({automatedEmails:e,config:t,defaultEmailAddress:n,newsletter:o,siteTitle:r,supportEmailAddress:i}),[e,t,n,o,r,i])},ns=`welcome-email-design-save-error`,rs=new Set(Object.keys(Ko)),is=e=>rs.has(e),as=({generalSettings:e,onGeneralChange:t,showPublicationIconToggle:n,senderNamePlaceholder:r,senderEmailPlaceholder:i,replyToEmailPlaceholder:a,showSenderEmailInput:o,senderNameError:s,senderEmailError:c,replyToEmailError:l})=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 pt-6`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Email info`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-sender-name`,children:`Sender name`}),(0,V.jsx)($n,{id:`welcome-email-sender-name`,placeholder:r,value:e.senderName,onChange:e=>t({senderName:e.target.value})}),s?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:s}):null]}),o?(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-sender-email`,children:`Sender email`}),(0,V.jsx)($n,{id:`welcome-email-sender-email`,placeholder:i,value:e.senderEmail,onChange:e=>t({senderEmail:e.target.value})}),c?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:c}):null]}):null,(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-reply-to-email`,children:`Reply-to email`}),(0,V.jsx)($n,{id:`welcome-email-reply-to-email`,placeholder:a,value:e.replyToEmail,onChange:e=>t({replyToEmail:e.target.value})}),l?(0,V.jsx)(`p`,{className:`text-sm text-red`,children:l}):null]})]})]}),(0,V.jsx)(Jn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Content`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(uo,{value:e.headerImage,onChange:e=>t({headerImage:e})}),n&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Publication icon`}),(0,V.jsx)(It,{checked:e.showPublicationIcon,size:`sm`,onCheckedChange:e=>t({showPublicationIcon:e})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Publication title`}),(0,V.jsx)(It,{checked:e.showPublicationTitle,size:`sm`,onCheckedChange:e=>t({showPublicationTitle:e})})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:[(0,V.jsx)(`label`,{className:`font-medium`,htmlFor:`welcome-email-footer`,children:`Email footer`}),(0,V.jsx)(vn,{id:`welcome-email-footer`,placeholder:`Any extra information or legal text`,rows:3,value:e.emailFooter,onChange:e=>t({emailFooter:e.target.value})})]}),(0,V.jsx)(fo,{value:e.showBadge,onChange:e=>t({showBadge:e})})]})]})]}),os=()=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 pt-6`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Global`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(Do,{}),(0,V.jsx)(Bo,{}),(0,V.jsx)(Vo,{}),(0,V.jsx)(jo,{})]})]}),(0,V.jsx)(Jn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Header`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,V.jsx)(zo,{})})]}),(0,V.jsx)(Jn,{}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:`mb-4 font-semibold md:text-lg`,children:`Body`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(Go,{}),(0,V.jsx)(Fo,{}),(0,V.jsx)(Lo,{}),(0,V.jsx)(Io,{}),(0,V.jsx)(Uo,{}),(0,V.jsx)(Wo,{}),(0,V.jsx)(Ho,{}),(0,V.jsx)(Ro,{})]})]})]}),ss=({generalSettings:e,onGeneralChange:t,showPublicationIconToggle:n,senderNamePlaceholder:r,senderEmailPlaceholder:i,replyToEmailPlaceholder:a,showSenderEmailInput:o,senderNameError:s,senderEmailError:c,replyToEmailError:l,isLoading:u,errorMessage:d})=>(0,V.jsxs)(jt,{className:`flex min-h-0 flex-1 flex-col`,defaultValue:`general`,variant:`underline`,children:[(0,V.jsxs)(At,{className:`px-5`,children:[(0,V.jsx)(Ot,{value:`general`,children:`General`}),(0,V.jsx)(Ot,{value:`design`,children:`Design`})]}),u?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,V.jsx)(Nn,{size:`md`})}):d?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-gray-700 dark:text-gray-300`,children:d}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kt,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-5`,value:`general`,children:(0,V.jsx)(as,{generalSettings:e,replyToEmailError:l,replyToEmailPlaceholder:a,senderEmailError:c,senderEmailPlaceholder:i,senderNameError:s,senderNamePlaceholder:r,showPublicationIconToggle:n,showSenderEmailInput:o,onGeneralChange:t})}),(0,V.jsx)(kt,{className:`min-h-0 flex-1 overflow-y-auto px-5 pb-5`,value:`design`,children:(0,V.jsx)(os,{})})]})]});function cs(e,t){return{senderName:t.senderName,senderEmail:t.senderEmail,replyToEmail:t.replyToEmail,headerImage:e.header_image||``,showPublicationIcon:e.show_header_icon,showPublicationTitle:e.show_header_title,showBadge:e.show_badge,emailFooter:e.footer_content||``}}function ls(e){return Object.fromEntries(Object.entries(e).filter(([e])=>is(e)))}function us(e){return{...Object.fromEntries(Object.entries(e.designSettings).filter(([e])=>is(e))),header_image:e.generalSettings.headerImage||null,show_header_icon:e.generalSettings.showPublicationIcon,show_header_title:e.generalSettings.showPublicationTitle,show_badge:e.generalSettings.showBadge,footer_content:e.generalSettings.emailFooter||null}}var ds=({message:e})=>(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-gray-700 dark:text-gray-300`,children:e}),fs=e=>e?.trim()||null,ps=w.create(()=>{let e=E(),{siteData:t,settings:n,config:r}=I(),[i,a,o,s]=z(n,[`title`,`default_email_address`,`icon`,`support_email_address`]),c=p(),{data:l,isLoading:u,isError:d}=bo(),{data:f}=Kt(),{mutateAsync:m}=xo(),{mutateAsync:h}=Zt(),{mutateAsync:g}=Ut(),_=fe(`automations`),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(!1),{senderNameInput:S,senderEmailInput:C,replyToEmailInput:w,senderNamePlaceholder:ee,senderEmailPlaceholder:T,replyToEmailPlaceholder:te,showSenderEmailInput:D,senderEmailDomain:O}=ts(f?.automated_emails||[],{config:r,defaultEmailAddress:a,siteTitle:i,supportEmailAddress:s}),k=(0,B.useMemo)(()=>({senderName:S,senderEmail:C,replyToEmail:w,headerImage:``,showPublicationIcon:!0,showPublicationTitle:!0,showBadge:!0,emailFooter:``}),[w,C,S]),ne=(0,B.useCallback)(async()=>{let e=new Map((f?.automated_emails||[]).map(e=>[e.slug,e]));for(let t of[`free`,`paid`]){if(e.has(qo[t]))continue;let n=Xo(t,i),r=(await h({...n,status:`inactive`})).automated_emails?.[0];r&&e.set(r.slug,r)}},[h,f?.automated_emails,i]),{formState:re,saveState:ie,updateForm:ae,setFormState:oe,handleSave:se,okProps:ce,errors:A}=Vt({initialState:{designSettings:{...Ko},generalSettings:k},savingDelay:500,onSave:async e=>{if(!de)throw En.error(`Unable to load email design settings. Please try again.`,{id:ns}),y(!0),Error(`Unable to load email design settings`);_||await ne();let t={sender_name:fs(e.generalSettings.senderName),sender_reply_to:fs(e.generalSettings.replyToEmail),...D?{sender_email:fs(e.generalSettings.senderEmail)}:{}},{meta:{sent_email_verification:n=[]}={}}=await g(t);await m(us(e)),n.length>0&&En.info(`We’ve sent a confirmation email to the new address.`),y(!1),En.dismiss(ns)},onSaveError:e=>{c(e,{withToast:!1}),En.error(`Unable to save email design settings. Please try again.`,{id:ns}),y(!0)},onValidate:e=>{let t={},n=e.generalSettings.senderEmail?.trim(),r=e.generalSettings.replyToEmail?.trim();return D&&n&&(vo.default.isEmail(n)?O&&n.split(`@`)[1]?.toLowerCase()!==O.toLowerCase()&&(t.senderEmail=`Email address must end with @${O}`):t.senderEmail=`Enter a valid email address`),r&&!vo.default.isEmail(r)&&(t.replyToEmail=`Enter a valid email address`),t}}),[le,ue]=(0,B.useState)(null),de=l?.automated_email_design?.[0],pe=de?`${de.id}:${de.updated_at??`initial`}`:null,{designSettings:j,generalSettings:me}=re;(0,B.useEffect)(()=>{de&&le===null&&(oe(e=>({designSettings:ls(de),generalSettings:cs(de,e.generalSettings)})),ue(pe))},[de,pe,le,oe]),(0,B.useEffect)(()=>{b||f===void 0||(oe(e=>({...e,generalSettings:{...e.generalSettings,senderName:S,senderEmail:C,replyToEmail:w}})),x(!0))},[f,w,C,b,S,oe]);let he=(0,B.useCallback)(e=>{y(!1),En.dismiss(ns),ae(t=>({...t,designSettings:{...t.designSettings,...e}}))},[ae]),ge=(0,B.useCallback)(e=>{y(!1),En.dismiss(ns),ae(t=>({...t,generalSettings:{...t.generalSettings,...e}}))},[ae]),M=(0,B.useCallback)(()=>{e.hide()},[e]),_e=`Unable to load email design settings. Please try again.`,ve=v?{...ce,color:`red`,label:`Retry`}:ce;return(0,V.jsx)(ho,{accentColor:t.accent_color,settings:j,onSettingsChange:he,children:(0,V.jsx)(qa,{afterClose:()=>{e.resolveHide(),e.remove()},dirty:ie===`unsaved`,isLoading:u||d,okProps:ve,open:e.visible,preview:d?(0,V.jsx)(ds,{message:_e}):(0,V.jsx)(lo,{accentColor:t.accent_color,emailFooter:me.emailFooter,footerLinkText:`Manage your preferences`,headerImage:me.headerImage,publicationIcon:o,replyToEmail:me.replyToEmail||te||``,senderEmail:me.senderEmail||T||a||``,senderName:me.senderName||ee||i||`Your site`,settings:j,showBadge:me.showBadge,showPublicationIcon:me.showPublicationIcon&&!!o,showPublicationTitle:me.showPublicationTitle,showRecipientLine:!1,showSubjectLine:!1,siteTitle:i,subject:`Welcome to ${me.senderName||ee||i||`our publication`}`,children:(0,V.jsx)(_o,{})}),sidebar:(0,V.jsx)(ss,{errorMessage:d?_e:void 0,generalSettings:me,isLoading:u,replyToEmailError:A.replyToEmail,replyToEmailPlaceholder:te,senderEmailError:A.senderEmail,senderEmailPlaceholder:T,senderNameError:A.senderName,senderNamePlaceholder:ee,showPublicationIconToggle:!!o,showSenderEmailInput:D,onGeneralChange:ge}),testId:`welcome-email-customize-modal`,title:`Welcome emails`,onClose:M,onSave:()=>se({fakeWhenUnchanged:!0})})})}),ms={enableNewsletters:[`emails`,`newsletters`,`newsletter sending`,`enable`,`disable`,`turn on`,`turn off`],emails:[`emails`,`newsletters`,`automation emails`,`transactional`,`design`,`customization`,`automations`,`welcome`],defaultRecipients:[`newsletters`,`default recipients`,`emails`],mailgun:[`mailgun`,`emails`,`newsletters`]},hs=()=>{let e=()=>{w.show(ps)};return(0,V.jsx)(St,{children:(0,V.jsx)(lt,{action:(0,V.jsx)(`button`,{className:`font-semibold text-green hover:opacity-80`,type:`button`,onClick:e,children:`Edit`}),hideActions:!1,testId:`automations-transactional-row`,children:(0,V.jsxs)(`button`,{className:`flex w-full min-w-0 items-center gap-3 py-3 text-left focus-visible:ring-2 focus-visible:ring-green focus-visible:ring-offset-2 focus-visible:outline-none dark:focus-visible:ring-offset-black`,type:`button`,onClick:e,children:[(0,V.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-grey-100 dark:bg-grey-900`,children:(0,V.jsx)(l,{colorClass:`text-grey-700 dark:text-grey-600`,name:`mailplus`,size:`md`})}),(0,V.jsxs)(`div`,{className:`min-w-0 grow`,children:[(0,V.jsx)(`div`,{className:`leading-tight font-medium`,children:`Email design`}),(0,V.jsx)(`div`,{className:`mt-1 text-sm leading-[1.35] text-grey-700 dark:text-grey-600`,children:`Customize the appearance of automation emails`})]})]})})})},gs=()=>{let e=window.location.hash.slice(1);return new URL(e||`/`,window.location.origin).pathname.startsWith(`/settings/memberemails`)},_s=({keywords:e,newslettersEnabled:t})=>{let{updateRoute:n}=P(),r=Me().getParam(`verifyEmail`),{mutateAsync:i}=Xt(),a=p(),o=(0,B.useRef)(null),[s,c]=(0,B.useState)(t?`newsletters`:`transactional`),[l,u]=(0,B.useState)(`active`);return(0,B.useEffect)(()=>{!t&&s===`newsletters`&&c(`transactional`)},[t,s]),(0,B.useEffect)(()=>{!r||!gs()||o.current===r||(o.current=r,c(`transactional`),(async()=>{try{let{meta:{email_verified:e}={}}=await i({token:r}),t=`Sender email verified`,a=(0,V.jsx)(V.Fragment,{children:`Automation email sender settings have been updated.`});e===`sender_reply_to`&&(t=`Reply-to address verified`,a=(0,V.jsx)(V.Fragment,{children:`Automation email reply-to address has been verified and updated.`})),n(`emails`),w.show(M,{title:t,prompt:a,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(e){let t=`There was an error verifying your email address. Try again later.`;e instanceof g&&e.message===`Token expired`&&(t=`Verification link has expired.`),n(`emails`),w.show(M,{title:`Error verifying email address`,prompt:t,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),a(e,{withToast:!1})}})())},[a,n,r,i]),(0,V.jsx)(J,{customButtons:t&&s===`newsletters`?(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Add newsletter`,size:`sm`,onClick:()=>{n(`newsletters/new`)}}):void 0,description:`Manage newsletters and design automation emails.`,keywords:e,navid:`emails`,testId:`emails`,title:`Newsletters & automation emails`,children:(0,V.jsxs)(jt,{value:s,variant:`underline`,onValueChange:e=>c(e),children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between border-b border-grey-200 dark:border-grey-900`,children:[(0,V.jsxs)(At,{className:`border-b-0`,children:[t&&(0,V.jsx)(Ot,{value:`newsletters`,children:`Newsletters`}),(0,V.jsx)(Ot,{value:`transactional`,children:`Automation emails`})]}),t&&s===`newsletters`&&(0,V.jsxs)(gn,{value:l,onValueChange:e=>u(e),children:[(0,V.jsx)(mn,{className:`h-7 w-auto gap-1 border-0 bg-transparent px-2 text-sm shadow-none hover:bg-muted focus:ring-0 focus:ring-offset-0`,"data-testid":`newsletters-filter`,children:(0,V.jsx)(hn,{})}),(0,V.jsxs)(pn,{children:[(0,V.jsx)(fn,{value:`active`,children:`Active`}),(0,V.jsx)(fn,{value:`archived`,children:`Archived`})]})]})]}),t&&(0,V.jsx)(kt,{value:`newsletters`,children:(0,V.jsx)(Ga,{filter:l})}),(0,V.jsx)(kt,{value:`transactional`,children:(0,V.jsx)(hs,{})})]})})},vs=()=>{let{settings:e,config:t}=I(),[n]=z(e,[`editor_default_email_recipients`]),r=n!==`disabled`,i=r&&!t.mailgunIsConfigured;return(0,V.jsxs)(Ea,{keywords:[ms.enableNewsletters,...r?[ms.defaultRecipients]:[],ms.emails,...i?[ms.mailgun]:[]].flat(),title:`Email`,children:[(0,V.jsx)(Na,{keywords:ms.enableNewsletters}),r&&(0,V.jsx)(Ma,{keywords:ms.defaultRecipients}),(0,V.jsx)(_s,{keywords:ms.emails,newslettersEnabled:r}),i&&(0,V.jsx)(Fa,{keywords:ms.mailgun})]})},ys=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l,u,d,f,p]=z(t,[`email_track_opens`,`email_track_clicks`,`members_track_sources`,`outbound_link_tagging`,`web_analytics`,`web_analytics_configured`]),m=Qn(t,`email_track_clicks`),[h,g]=(0,B.useState)(!1),_=Se(),{updateRoute:v}=P();(0,B.useEffect)(()=>{_?.isLimited(`limitAnalytics`)?_.errorIfWouldGoOverLimit(`limitAnalytics`).catch(e=>{e instanceof he&&g(!0)}):g(!1)},[_]);let y=(e,t)=>{o(e,t.target.checked),s(!0)},b=p&&!h;return(0,V.jsxs)(J,{description:`Decide what data you collect across your publication`,isEditing:n,keywords:e,navid:`analytics`,saveState:r,testId:`analytics`,title:`Analytics`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:i,children:[(0,V.jsxs)(F,{className:`analytics-settings gap-y-0!`,columns:1,children:[(0,V.jsx)(wt,{align:`center`,checked:f&&b,containerClasses:`py-4`,direction:`rtl`,disabled:!b,gap:`gap-0`,hint:p?(0,V.jsxs)(V.Fragment,{children:[`Cookie-free, first party traffic analytics for your site, powered by `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/integrations/tinybird`,rel:`noopener noreferrer`,target:`_blank`,children:`Tinybird`})]}):(0,V.jsx)(V.Fragment,{children:`Cookie-free, first party traffic analytics for your site`}),label:`Web analytics`,onChange:e=>{y(`web_analytics`,e)}}),h?(0,V.jsx)(`div`,{className:`mb-5 rounded-md border border-grey-200 bg-grey-50 px-4 py-2.5 dark:border-grey-900 dark:bg-grey-900`,children:(0,V.jsx)(`span`,{className:`flex items-start gap-2`,children:(0,V.jsxs)(`span`,{children:[`Web analytics is available on the Publisher plan and above. `,(0,V.jsx)(`span`,{className:`cursor-pointer text-green`,onClick:()=>v({route:`/pro`,isExternal:!0}),children:`Upgrade now →`})]})})}):p?(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}):(0,V.jsx)(`div`,{className:`mb-5 rounded-md border border-grey-200 bg-grey-50 px-4 py-2.5 dark:border-grey-900 dark:bg-grey-900`,children:(0,V.jsx)(`span`,{className:`flex items-start gap-2`,children:(0,V.jsxs)(`span`,{children:[`Web analytics in Ghost is powered by `,(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://tbrd.co/ghost`,rel:`noopener noreferrer`,target:`_blank`,children:`Tinybird`}),` and requires configuration to start collecting data. `,(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://docs.ghost.org/install/docker#tinybird-integration`,rel:`noopener noreferrer`,target:`_blank`,children:`Get started →`})]})})}),(0,V.jsx)(wt,{align:`center`,checked:c,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Record when a member opens an email`,label:`Newsletter opens`,onChange:e=>{y(`email_track_opens`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:l,containerClasses:`py-4`,direction:`rtl`,disabled:m,gap:`gap-0`,hint:`Record when a member clicks on any link in an email`,label:`Newsletter clicks`,onChange:e=>{y(`email_track_clicks`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:u,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Track the traffic sources and posts that drive the most member growth`,label:`Member sources`,onChange:e=>{y(`members_track_sources`,e)}}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsx)(wt,{align:`center`,checked:d,containerClasses:`py-4`,direction:`rtl`,gap:`gap-0`,hint:`Make it easier for other sites to track the traffic you send them in their analytics`,label:`Outbound link tagging`,onChange:e=>{y(`outbound_link_tagging`,e)}})]}),(0,V.jsx)(`div`,{className:`items-center-mt-1 flex justify-between`,children:(0,V.jsx)(`a`,{className:`font-medium text-green`,href:`https://ghost.org/help/post-analytics/`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn about analytics`})})]})},`Analytics`),bs=[{code:`af`,label:`Afrikaans`},{code:`ar`,label:`Arabic`},{code:`bg`,label:`Bulgarian`},{code:`bn`,label:`Bengali`},{code:`bs`,label:`Bosnian`},{code:`ca`,label:`Catalan`},{code:`cs`,label:`Czech`},{code:`da`,label:`Danish`},{code:`de`,label:`German`},{code:`de-CH`,label:`Swiss German`},{code:`el`,label:`Greek`},{code:`en`,label:`English`},{code:`eo`,label:`Esperanto`},{code:`es`,label:`Spanish`},{code:`et`,label:`Estonian`},{code:`eu`,label:`Basque`},{code:`fa`,label:`Persian/Farsi`},{code:`fi`,label:`Finnish`},{code:`fr`,label:`French`},{code:`gd`,label:`Gaelic (Scottish)`},{code:`he`,label:`Hebrew`},{code:`hi`,label:`Hindi`},{code:`hr`,label:`Croatian`},{code:`hu`,label:`Hungarian`},{code:`id`,label:`Indonesian`},{code:`is`,label:`Icelandic`},{code:`it`,label:`Italian`},{code:`ja`,label:`Japanese`},{code:`ko`,label:`Korean`},{code:`kz`,label:`Kazakh`},{code:`lt`,label:`Lithuanian`},{code:`lv`,label:`Latvian`},{code:`mk`,label:`Macedonian`},{code:`mn`,label:`Mongolian`},{code:`ms`,label:`Malay`},{code:`nb`,label:`Norwegian Bokmål`},{code:`ne`,label:`Nepali`},{code:`nl`,label:`Dutch`},{code:`nn`,label:`Norwegian Nynorsk`},{code:`pa`,label:`Punjabi`},{code:`pl`,label:`Polish`},{code:`pt`,label:`Portuguese`},{code:`pt-BR`,label:`Portuguese (Brazil)`},{code:`ro`,label:`Romanian`},{code:`ru`,label:`Russian`},{code:`si`,label:`Sinhala`},{code:`sk`,label:`Slovak`},{code:`sl`,label:`Slovenian`},{code:`sq`,label:`Albanian`},{code:`sr`,label:`Serbian`},{code:`sr-Cyrl`,label:`Serbian (Cyrillic)`},{code:`sv`,label:`Swedish`},{code:`sw`,label:`Swahili`},{code:`ta`,label:`Tamil`},{code:`th`,label:`Thai`},{code:`tr`,label:`Turkish`},{code:`uk`,label:`Ukrainian`},{code:`ur`,label:`Urdu`},{code:`uz`,label:`Uzbek`},{code:`vi`,label:`Vietnamese`},{code:`zh`,label:`Chinese`},{code:`zh-Hant`,label:`Traditional Chinese`}],xs=new Set(`en-gb-oed.i-ami.i-bnn.i-default.i-enochian.i-hak.i-klingon.i-lux.i-mingo.i-navajo.i-pwn.i-tao.i-tay.i-tsu.sgn-be-fr.sgn-be-nl.sgn-ch-de.art-lojban.cel-gaulish.no-bok.no-nyn.zh-guoyu.zh-hakka.zh-min.zh-min-nan.zh-xiang`.split(`.`)),Ss=e=>{let t=`Invalid locale format. Examples: en, pt-BR, zh-Hant, sr-Cyrl, x-private`;if(!e)return`Enter a value`;let n=e.trim();if(!n)return t;if(xs.has(n.toLowerCase()))return null;if(!/^[a-z0-9]+(-[a-z0-9]+)*$/i.test(n))return t;let r=n.split(`-`);if(r[0].toLowerCase()===`x`){if(r.length<2)return t;for(let e=1;e<r.length;e++)if(r[e].length<1||r[e].length>8)return t;return null}let i=0,a=r[i];if(!/^[a-z]{2,3}$/i.test(a))return t;for(i+=1,i<r.length&&/^[a-z]{4}$/i.test(r[i])&&(i+=1),i<r.length&&/^([a-z]{2}|[0-9]{3})$/i.test(r[i])&&(i+=1);i<r.length&&/^([a-z0-9]{5,8}|[0-9][a-z0-9]{3})$/i.test(r[i]);)i+=1;for(;i<r.length&&/^[0-9a-wy-z]$/i.test(r[i]);){if(i+=1,i>=r.length||!/^[a-z0-9]{2,8}$/i.test(r[i]))return t;for(i+=1;i<r.length&&/^[a-z0-9]{2,8}$/i.test(r[i]);)i+=1}if(i<r.length&&r[i].toLowerCase()===`x`){if(i+=1,i>=r.length)return t;for(;i<r.length;){if(!/^[a-z0-9]+$/i.test(r[i]))return t;i+=1}}if(i!==r.length)return t;let o=r.findIndex(e=>e.toLowerCase()===`x`),s=[`english`,`french`,`spanish`,`german`,`italian`,`chinese`,`japanese`,`korean`,`russian`,`arabic`,`united`,`states`,`kingdom`,`traditional`,`simplified`];for(let e=0;e<r.length;e++){let n=r[e];if(![`i`,`x`,`sgn`,`art`,`cel`,`no`,`zh`].includes(n.toLowerCase())&&!(o!==-1&&e>o)&&(n.length>16||s.includes(n.toLowerCase())))return t}return null},Cs=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,errors:s,handleEditingChange:c}=N({onValidate:()=>{let e=Ss(l);return e?{publicationLanguage:e}:{}}}),[l]=z(t,[`locale`]),u=B.useMemo(()=>bs.map(e=>({value:e.code,label:`${e.label} (${e.code})`})),[]),d=e=>{o(`locale`,e),n||c(!0)},f=(0,V.jsxs)(V.Fragment,{children:[`Default: English (`,(0,V.jsx)(`strong`,{children:`en`}),`); find out more about`,(0,V.jsx)(`a`,{className:`text-green-400`,href:`https://ghost.org/docs/faq/translation/`,rel:`noopener noreferrer`,target:`_blank`,children:` using Ghost in other languages`})]});return(0,V.jsx)(J,{description:`Set the language/locale which is used on your site`,isEditing:n,keywords:e,navid:`publication-language`,saveState:r,testId:`publication-language`,title:`Publication Language`,hideEditButton:!0,onCancel:a,onEditingChange:c,onSave:i,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsx)(gr,{defaultListValue:`en`,error:!!s.publicationLanguage,hint:s.publicationLanguage||f,options:u,otherHint:`Enter a custom locale code.`,otherPlaceholder:`e.g. pt-BR, sr-Cyrl, en`,selectedValue:l,testId:`locale-select`,title:`Site language`,validate:Ss,isSearchable:!0,onSelect:d})})})},`Publication language`),ws=({title:e,description:t,icon:n,url:r})=>{let i=r?.replace(/\/$/,``),a=i?.replace(/^https?:\/\//,``).replace(/\/?$/,``);return(0,V.jsx)(`div`,{children:(0,V.jsxs)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl bg-grey-50 px-5 pt-2 md:-mx-7 md:-mb-7 md:px-7 md:pt-7 dark:bg-grey-950`,children:[(0,V.jsx)(`div`,{className:`-mt-4 mb-2 text-sm text-grey-500 uppercase dark:text-grey-800`,children:`Preview`}),(0,V.jsxs)(`div`,{className:`rounded-t-sm bg-white px-5 py-3 shadow-lg dark:bg-grey-950`,children:[(0,V.jsxs)(`div`,{className:`mt-3 flex items-center`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(Pe,{className:`mr-7 h-7`})}),(0,V.jsx)(`div`,{className:`grow`,children:(0,V.jsx)(`div`,{className:`flex w-full items-center justify-end rounded-full bg-white p-3 px-4 shadow dark:bg-grey-900`,children:(0,V.jsx)(l,{className:`stroke-[2px] text-blue-600`,name:`magnifying-glass`,size:`sm`})})})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 border-t border-grey-200 pt-4 dark:border-grey-900`,children:[(0,V.jsx)(`div`,{className:`flex size-7 items-center justify-center rounded-full bg-grey-200 dark:bg-grey-700`,style:{backgroundImage:n?`url(${n})`:`none`,backgroundSize:`contain`}}),(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{children:a}),(0,V.jsx)(`span`,{className:`-mt-0.5 inline-block text-sm text-grey-600`,children:i})]})]}),(0,V.jsxs)(`div`,{className:`mt-1 flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-lg text-[#1a0dab] dark:text-blue`,children:e}),(0,V.jsx)(`span`,{className:`text-grey-900 dark:text-grey-700`,children:t})]})]})]})})},Ts=j(({keywords:e})=>{let{localSettings:t,saveState:n,siteData:r,focusRef:i,isEditing:a,handleSave:o,handleCancel:s,handleEditingChange:c,updateSetting:l}=N(),u=p(),{mutateAsync:d}=yt(),f=gt(),m=fe(`llmsTxt`),[h,g,_,v,y,b,x,S,C,w]=z(t,[`meta_title`,`meta_description`,`title`,`description`,`og_title`,`og_description`,`og_image`,`twitter_title`,`twitter_description`,`twitter_image`]).map(e=>e||``),[ee]=z(t,[`llms_enabled`]),T=ee!==!1,[te,E]=(0,B.useState)(`metadata`),D=e=>t=>{l(e,t.target.value),a||c(!0)},O=e=>async t=>{try{let n=Ie(await d({file:t}));l(e,n),a||c(!0)}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),u(t)}},ne=e=>()=>{l(e,``),a||c(!0)},re=e=>{l(`llms_enabled`,e.target.checked),a||c(!0)},ie=D(`meta_title`),ae=D(`meta_description`),oe=D(`og_title`),se=D(`og_description`),ce=O(`og_image`),A=ne(`og_image`),le=D(`twitter_title`),ue=D(`twitter_description`),de=O(`twitter_image`),pe=ne(`twitter_image`),j=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(F,{className:`my-6 gap-3`,children:[m&&(0,V.jsx)(wt,{checked:T,direction:`rtl`,label:`Enable structured data for LLMs and AI search engines`,onChange:re}),(0,V.jsx)(k,{hint:`Recommended: 70 characters`,inputRef:i,maxLength:300,placeholder:_,title:`Meta title`,value:h,onChange:ie}),(0,V.jsx)(k,{hint:`Recommended: 156 characters`,maxLength:500,placeholder:v,title:`Meta description`,value:g,onChange:ae})]}),(0,V.jsx)(ws,{description:g||v,icon:r?.icon,title:h||_,url:r?.url})]}),me=(0,V.jsxs)(`div`,{className:`mt-6 md:mx-[52px]`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(tt,{className:`size-10`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`mb-1 leading-none font-semibold text-grey-900 dark:text-grey-300`,children:_}),(0,V.jsx)(`div`,{className:`leading-none text-grey-700`,children:`2h`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`mb-2 h-3 w-full rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsx)(`div`,{className:`mb-4 h-3 w-3/5 rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsxs)(F,{className:`overflow-hidden rounded-md border border-grey-300 dark:border-grey-900`,children:[(0,V.jsx)(ke,{fileUploadClassName:`flex cursor-pointer items-center justify-center rounded rounded-b-none border border-grey-100 border-b-0 bg-grey-50 p-3 font-semibold text-grey-800 hover:text-black dark:border-grey-900`,height:`300px`,id:`facebook-image`,imageURL:x,pintura:{isEnabled:f.isEnabled,openEditor:async()=>f.openEditor({image:x||``,handleSave:async e=>{let t=Ie(await d({file:e}));l(`og_image`,t)}})},onDelete:A,onUpload:ce,children:`Upload Facebook image`}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-x-6 gap-y-7 px-4 pb-7`,children:[(0,V.jsx)(k,{maxLength:300,placeholder:_,title:`Facebook title`,value:y,onChange:oe}),(0,V.jsx)(k,{maxLength:300,placeholder:v,title:`Facebook description`,value:b,onChange:se})]})]})]})]}),he=(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`pt-1`,children:(0,V.jsx)(rt,{className:`-mb-1 size-10`})}),(0,V.jsxs)(`div`,{className:`w-full md:mr-[52px]`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsx)(`span`,{className:`mr-1 font-semibold text-grey-900 dark:text-grey-300`,children:_}),(0,V.jsx)(`span`,{className:`text-grey-700`,children:`· 2h`})]}),(0,V.jsx)(`div`,{className:`mb-2 h-3 w-full rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsx)(`div`,{className:`mb-4 h-3 w-3/5 rounded bg-grey-200 dark:bg-grey-900`}),(0,V.jsxs)(F,{className:`overflow-hidden rounded-md border border-grey-300 dark:border-grey-900`,children:[(0,V.jsx)(ke,{fileUploadClassName:`flex cursor-pointer items-center justify-center rounded rounded-b-none border border-grey-100 border-b-0 bg-grey-50 p-3 font-semibold text-grey-800 hover:text-black dark:border-grey-900`,height:`300px`,id:`twitter-image`,imageURL:w,pintura:{isEnabled:f.isEnabled,openEditor:async()=>f.openEditor({image:w||``,handleSave:async e=>{let t=Ie(await d({file:e}));l(`twitter_image`,t)}})},onDelete:pe,onUpload:de,children:`Upload X image`}),(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col gap-x-6 gap-y-7 px-4 pb-7`,children:[(0,V.jsx)(k,{maxLength:300,placeholder:_,title:`X title`,value:S,onChange:le}),(0,V.jsx)(k,{maxLength:300,placeholder:v,title:`X description`,value:C,onChange:ue})]})]})]})]});return(0,V.jsx)(J,{description:`Extra content for search engines and social accounts`,isEditing:a,keywords:e,navid:`metadata`,saveState:n,testId:`seometa`,title:`Meta data`,hideEditButton:!0,onCancel:s,onEditingChange:c,onSave:o,children:(0,V.jsx)(Ze,{selectedTab:te,tabs:[{id:`metadata`,title:`Search`,contents:j},{id:`twitter`,title:`X card`,contents:he},{id:`facebook`,title:`Facebook card`,contents:me}],testId:`seo-tabview`,onTabChange:E})})},`SEO meta`),Es=[`facebook`,`twitter`],Ds=et.filter(e=>!Es.includes(e)),Os=e=>{let t=z(e,[...et]);return Object.fromEntries(dt.map((e,n)=>{let r=t[n];return[e.key,e.toDisplayValue(r)]}))},ks=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(()=>Os(t)),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)({});(0,B.useEffect)(()=>{n||h({})},[n]);let g=z(t,[...et]),_=Ds.some(e=>t?.some(t=>t.key===e)),v=(0,B.useMemo)(()=>_?dt:dt.filter(e=>Es.includes(e.key)),[_]);(0,B.useEffect)(()=>{f||d(Os(t))},[g.map(e=>e??``).join(`|`)]);let y=(e,t)=>{d(n=>({...n,[e]:t})),h(t=>({...t,[e]:!0})),n||s(!0);try{let{storedValue:n}=qe(e,t);o(e,n),c[e]&&l(t=>({...t,[e]:``}))}catch{l(n=>({...n,[e]:ct(e,t)}))}},b=e=>{if(p(t=>t===e?null:t),ct(e,u[e]))return;let{displayValue:t}=qe(e,u[e]);d(n=>({...n,[e]:t}))};return(0,V.jsx)(J,{description:`Link your social accounts for full structured data and rich card support`,isEditing:n,keywords:e,navid:`social-accounts`,saveState:r,testId:`social-accounts`,title:`Social accounts`,hideEditButton:!0,onCancel:a,onEditingChange:s,onSave:()=>{let e=v.reduce((e,t)=>{if(!m[t.key])return e;let n=ct(t.key,u[t.key]);return n&&(e[t.key]=n),e},{});l(e),Object.keys(e).length===0&&i()},children:(0,V.jsx)(F,{children:v.map(e=>(0,V.jsx)(k,{"data-testid":e.testId,error:!!c[e.key],hint:c[e.key],placeholder:e.placeholder,title:e.publicationTitle,value:u[e.key],onBlur:()=>b(e.key),onChange:t=>y(e.key,t.target.value),onFocus:()=>p(e.key)},e.key))})})},`Social accounts`),As=[{name:`Pacific/Pago_Pago`,label:`Midway Island, Samoa`},{name:`Pacific/Honolulu`,label:`Hawaii`},{name:`America/Anchorage`,label:`Alaska`},{name:`America/Tijuana`,label:`Tijuana`},{name:`America/Los_Angeles`,label:`Pacific Time (US & Canada)`},{name:`America/Mazatlan`,label:`La Paz, Mazatlan`},{name:`America/Phoenix`,label:`Arizona`},{name:`America/Denver`,label:`Mountain Time (US & Canada)`},{name:`America/Chihuahua`,label:`Chihuahua`},{name:`America/Costa_Rica`,label:`Central America`},{name:`America/Chicago`,label:`Central Time (US & Canada)`},{name:`America/Mexico_City`,label:`Guadalajara, Mexico City, Monterrey`},{name:`America/Regina`,label:`Saskatchewan`},{name:`America/Bogota`,label:`Bogota, Lima, Quito`},{name:`America/New_York`,label:`Eastern Time (US & Canada)`},{name:`America/Fort_Wayne`,label:`Indiana (East)`},{name:`America/Caracas`,label:`Caracas, La Paz, Georgetown`},{name:`America/Halifax`,label:`Atlantic Time (Canada); Greenland`},{name:`America/Santiago`,label:`Santiago`},{name:`America/St_Johns`,label:`Newfoundland`},{name:`America/Argentina/Buenos_Aires`,label:`Buenos Aires, Brasilia`},{name:`America/Noronha`,label:`Fernando de Noronha`},{name:`Atlantic/Azores`,label:`Azores`},{name:`Atlantic/Cape_Verde`,label:`Cape Verde Is.`},{name:`Etc/UTC`,label:`UTC`},{name:`Africa/Casablanca`,label:`Casablanca, Monrovia`},{name:`Europe/Dublin`,label:`Dublin, Edinburgh, London`},{name:`Europe/Amsterdam`,label:`Amsterdam, Berlin, Rome, Stockholm, Vienna`},{name:`Europe/Prague`,label:`Belgrade, Bratislava, Budapest, Prague`},{name:`Europe/Paris`,label:`Brussels, Copenhagen, Madrid, Paris`},{name:`Europe/Warsaw`,label:`Sarajevo, Skopje, Warsaw, Zagreb`},{name:`Africa/Lagos`,label:`West Central Africa`},{name:`Europe/Athens`,label:`Athens, Beirut, Bucharest`},{name:`Africa/Cairo`,label:`Cairo, Egypt`},{name:`Africa/Maputo`,label:`Harare`},{name:`Europe/Kiev`,label:`Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius`},{name:`Asia/Jerusalem`,label:`Jerusalem`},{name:`Africa/Johannesburg`,label:`Pretoria`},{name:`Asia/Baghdad`,label:`Baghdad`},{name:`Asia/Riyadh`,label:`Kuwait, Nairobi, Riyadh`},{name:`Europe/Istanbul`,label:`Istanbul, Ankara`},{name:`Europe/Moscow`,label:`Moscow, St. Petersburg, Volgograd`},{name:`Asia/Tehran`,label:`Tehran`},{name:`Asia/Dubai`,label:`Abu Dhabi, Muscat`},{name:`Asia/Baku`,label:`Baku, Tbilisi, Yerevan`},{name:`Asia/Kabul`,label:`Kabul`},{name:`Asia/Almaty`,label:`Almaty, Astana`},{name:`Asia/Karachi`,label:`Islamabad, Karachi, Tashkent`},{name:`Asia/Yekaterinburg`,label:`Yekaterinburg`},{name:`Asia/Kolkata`,label:`Chennai, Kolkata, Mumbai, New Delhi`},{name:`Asia/Colombo`,label:`Colombo, Sri Jayawardenepura`},{name:`Asia/Kathmandu`,label:`Kathmandu`},{name:`Asia/Dhaka`,label:`Dhaka`},{name:`Asia/Rangoon`,label:`Yangon (Rangoon)`},{name:`Asia/Bangkok`,label:`Bangkok, Hanoi, Jakarta`},{name:`Asia/Krasnoyarsk`,label:`Krasnoyarsk, Novosibirsk`},{name:`Asia/Hong_Kong`,label:`Beijing, Chongqing, Hong Kong, Urumqi`},{name:`Asia/Irkutsk`,label:`Irkutsk, Ulaanbaatar`},{name:`Asia/Singapore`,label:`Kuala Lumpur, Perth, Singapore, Taipei`},{name:`Asia/Tokyo`,label:`Osaka, Sapporo, Tokyo`},{name:`Asia/Seoul`,label:`Seoul`},{name:`Asia/Yakutsk`,label:`Yakutsk`},{name:`Australia/Adelaide`,label:`Adelaide`},{name:`Australia/Darwin`,label:`Darwin`},{name:`Australia/Brisbane`,label:`Brisbane, Guam, Port Moresby`},{name:`Australia/Sydney`,label:`Canberra, Hobart, Melbourne, Sydney, Vladivostok`},{name:`Asia/Magadan`,label:`Magadan, Soloman Is., New Caledonia`},{name:`Pacific/Auckland`,label:`Auckland, Wellington`},{name:`Pacific/Fiji`,label:`Fiji, Kamchatka, Marshall Is.`},{name:`Pacific/Kwajalein`,label:`International Date Line West`}],js=e=>{let t={timeZone:e,timeZoneName:`longOffset`};try{let e=new Intl.DateTimeFormat(`en-GB`,t).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(!e)return{offsetString:null,offsetMinutes:0};let n=e.match(/^GMT([+-])(\d{2}):(\d{2})$/);if(!n)return{offsetString:e,offsetMinutes:0};let[,r,i,a]=n,o=parseInt(i,10),s=parseInt(a,10),c=r===`+`?o*60+s:-(o*60+s);return{offsetString:c===0?`GMT`:`GMT ${r}${o}:${s.toString().padStart(2,`0`)}`,offsetMinutes:c}}catch{return{offsetString:null,offsetMinutes:0}}},Ms=(e,t)=>`(${t}) ${e}`,Ns=()=>As.map(({name:e,label:t})=>{let{offsetString:n,offsetMinutes:r}=js(e);return{name:e,label:n?Ms(t,n):t,offsetMinutes:r}}).sort((e,t)=>e.offsetMinutes-t.offsetMinutes),Ps=({timezone:e})=>{let[t,n]=(0,B.useState)(_e(e));return(0,B.useEffect)(()=>{let t=setInterval(()=>{n(_e(e))},1e3);return()=>{clearInterval(t)}},[e]),(0,V.jsxs)(V.Fragment,{children:[`The local time here is currently `,t]})},Fs=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,handleEditingChange:s}=N(),[c]=z(t,[`timezone`]),l=Ns().map(e=>({value:e.name,label:e.label})),u=e=>{o(`timezone`,e||null),s(!0)};return(0,V.jsx)(J,{description:`Set the time and date of your publication, used for all published posts`,hideEditButton:!0,isEditing:n,keywords:e,navid:`timezone`,saveState:r,testId:`timezone`,title:`Site timezone`,onCancel:a,onEditingChange:s,onSave:i,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsx)(De,{hint:(0,V.jsx)(Ps,{timezone:c}),options:l,selectedOption:l.find(e=>e.value===c),testId:`timezone-select`,title:`Site timezone`,isSearchable:!0,onSelect:e=>u(e?.value)})})})},`Site timezone`),Is=j(({keywords:e})=>{let{errors:t,localSettings:n,isEditing:r,saveState:i,focusRef:a,clearError:o,handleSave:s,handleCancel:c,updateSetting:l,handleEditingChange:u}=N({onValidate:()=>d?d.length<4?{title:`Please use a site title longer than 3 characters.`}:d.length>63?{title:`Please use a site title shorter than 63 characters.`}:{}:{title:`Please enter a site title.`}}),[d,f]=z(n,[`title`,`description`]),p=e=>{l(`title`,e.target.value)},m=e=>{l(`description`,e.target.value)},h=(0,V.jsx)(F,{columns:2,values:[{heading:`Site title`,key:`site-title`,value:d},{heading:`Site description`,key:`site-description`,value:f}]}),g=(0,V.jsxs)(F,{children:[(0,V.jsx)(k,{error:!!t.title,hint:t.title||`The name of your site`,inputRef:a,maxLength:63,placeholder:`Site title`,title:`Site title`,value:d,onChange:p,onKeyDown:()=>o(`title`)}),(0,V.jsx)(k,{hint:`A short description, used in your theme, meta data and search results`,maxLength:200,placeholder:`Site description`,title:`Site description`,value:f,onChange:m})]});return(0,V.jsx)(J,{description:`The details used to identify your publication around the web`,isEditing:r,keywords:e,navid:`general`,saveState:i,testId:`title-and-description`,title:`Title & description`,onCancel:c,onEditingChange:u,onSave:s,children:r?g:h})},`Title & description`),Ls=({user:e})=>{let{updateRoute:t}=P(),{currentUser:n}=I();return e?(0,V.jsxs)(`div`,{className:D(`group flex gap-3`,Sn(n)&&`cursor-pointer`),"data-testid":`owner-user`,onClick:()=>{Sn(n)&&t({route:`staff/${e.slug}`})},children:[(0,V.jsx)(ce,{bgColor:Je(e.name?e.name:e.email),image:e.profile_image??void 0,label:ge(e.name),labelColor:`white`,size:`lg`}),(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsxs)(`span`,{children:[e.name,` — `,(0,V.jsx)(`strong`,{children:`Owner`}),` `,Sn(n)&&(0,V.jsx)(`button`,{className:`ml-2 inline-block font-semibold text-green group-hover:visible md:invisible`,type:`button`,children:`View profile`})]}),(0,V.jsx)(`span`,{className:`text-sm text-grey-700`,children:e.email})]})]}):null},Rs=({users:e,groupname:t})=>{let{updateRoute:n}=P(),{currentUser:r}=I(),i=e=>{n({route:`staff/${e.slug}`})};return!e||!e.length?(0,V.jsxs)(oe,{icon:`single-user-block`,children:[`No `,t,` found.`]}):(0,V.jsx)(A,{titleSeparator:!1,children:e.map(e=>{let t=e.name||``;e.status===`inactive`&&(t=`${t} (Suspended)`);let n=Sn(r)||wn(r)&&xn(e)||r.id===e.id;return(0,V.jsx)(we,{action:n&&(0,V.jsx)(L,{color:`green`,label:`Edit`,link:!0,onClick:()=>i(e)}),avatar:(0,V.jsx)(ce,{bgColor:Je(e.name?e.name:e.email),image:e.profile_image??void 0,label:ge(e.name),labelColor:`white`}),bgOnHover:n,className:`min-h-[64px]`,detail:e.email,hideActions:!0,id:`list-item-${e.id}`,separator:!1,testId:`user-list-item`,title:t,onClick:()=>n&&i(e)},e.id)})})},zs=({invite:e})=>{let[t,n]=(0,B.useState)(``),[r,i]=(0,B.useState)(``),{mutateAsync:a}=Te(),{mutateAsync:o}=Ee(),s=p(),c=`Revoke`;t===`progress`&&(c=`Revoking...`);let l=`Resend`;return r===`progress`&&(l=`Resending...`),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(L,{color:`red`,label:c,link:!0,onClick:async()=>{try{n(`progress`),await a(e.id),u({title:`Invitation revoked`,message:e.email,type:`success`})}catch(e){s(e)}finally{n(``)}}}),(0,V.jsx)(L,{className:`ml-2`,color:`green`,label:l,link:!0,onClick:async()=>{try{i(`progress`),await a(e.id),await o({email:e.email,roleId:e.role_id}),u({title:`Invitation resent`,message:e.email,type:`success`})}catch(e){s(e)}finally{i(``)}}})]})},Bs=({users:e})=>!e||!e.length?(0,V.jsx)(oe,{icon:`single-user-block`,children:`No invitations found.`}):(0,V.jsx)(A,{children:e.map(e=>(0,V.jsx)(we,{action:(0,V.jsx)(zs,{invite:e}),avatar:(0,V.jsx)(ce,{bgColor:Je(e.email),image:``,label:e.email.charAt(0).toUpperCase(),labelColor:`white`}),className:`min-h-[64px]`,detail:e.role,hideActions:!0,id:`list-item-${e.id}`,separator:!1,testId:`user-invite`,title:e.email,onClick:()=>{}},e.id))}),Vs=j(({keywords:e,highlight:t=!0})=>{let{totalUsers:n,totalInvites:r,users:i,ownerUser:a,adminUsers:o,editorUsers:s,authorUsers:c,contributorUsers:l,invites:u,hasNextPage:d,fetchNextPage:f,invitesHasNextPage:m,fetchNextInvitePage:h}=Ct(),{updateRoute:g}=P(),{settings:_,config:v,currentUser:y}=I(),b=()=>{g(`staff/invite`)},x=(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Invite people`,size:`sm`,linkWithPadding:!0,onClick:()=>{b()}}),S=Me().getParam(`tab`),[w,ee]=(0,B.useState)(S||`administrators`);(0,B.useEffect)(()=>{S&&ee(S)},[S]);let T=e=>{g(`staff?tab=${e}`),ee(e)},te=[{id:`administrators`,title:`Administrators`,contents:(0,V.jsx)(Rs,{groupname:`administrators`,users:o}),counter:o.length?o.length:void 0},{id:`editors`,title:`Editors`,contents:(0,V.jsx)(Rs,{groupname:`editors`,users:s}),counter:s.length?s.length:void 0},{id:`authors`,title:`Authors`,contents:(0,V.jsx)(Rs,{groupname:`authors`,users:c}),counter:c.length?c.length:void 0},{id:`contributors`,title:`Contributors`,contents:(0,V.jsx)(Rs,{groupname:`contributors`,users:l}),counter:l.length?l.length:void 0},{id:`invited`,title:`Invited`,contents:(0,V.jsx)(Bs,{users:u}),counter:r||void 0}],E=tr(_,`require_email_mfa`)||!1,{mutateAsync:D}=Gn(),O=p();return(0,V.jsxs)(J,{customButtons:x,highlightOnModalClose:t,keywords:e,navid:`staff`,testId:`users`,title:`Staff`,children:[(0,V.jsx)(Ls,{user:a}),(i.length>1||u.length>0)&&(0,V.jsx)(Ze,{selectedTab:w,tabs:te,testId:`user-tabview`,onTabChange:T}),d&&w!==`invited`&&(0,V.jsx)(L,{label:`Load more (showing ${i.length}/${n} users)`,link:!0,onClick:()=>f()}),m&&w===`invited`&&(0,V.jsx)(L,{label:`Load more (showing ${u.length}/${r} invites)`,link:!0,onClick:()=>h()}),v?.security?.staffDeviceVerification&&Sn(y)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 ${i.length>1||u.length>0?`-mt-6`:``}`,children:[(0,V.jsx)(C,{}),(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[1.5rem] font-semibold tracking-tight`,children:`Security settings`}),(0,V.jsx)(`span`,{children:`Require email 2FA codes to be used on all staff logins`})]}),(0,V.jsx)(wt,{checked:E,direction:`rtl`,gap:`gap-0`,onChange:async()=>{let e=!E;try{await D([{key:`require_email_mfa`,value:e}])}catch(e){O(e)}}})]})]})]})},`Staff`),X={titleAndDescription:[`general`,`title and description`,`site title`,`site description`,`title & description`],timeZone:[`general`,`time`,`date`,`site timezone`,`time zone`],publicationLanguage:[`general`,`publication language`,`locale`],users:[`general`,`users and permissions`,`roles`,`staff`,`invite people`,`contributors`,`editors`,`authors`,`administrators`],metadata:[`general`,`metadata`,`title`,`description`,`search`,`engine`,`google`,`meta data`,`twitter card`,`structured data`,`rich cards`,`x card`,`social`,`facebook card`,`llms`,`ai`,`ai search engines`,`llm`],socialAccounts:[`general`,`social accounts`,`facebook`,`twitter`,`threads`,`bluesky`,`mastodon`,`tiktok`,`youtube`,`instagram`,`linkedin`,`structured data`,`rich cards`],analytics:[`general`,`analytics`,`tracking`,`privacy`,`membership`]},Hs=()=>(0,V.jsxs)(Ea,{keywords:Object.values(X).flat(),title:`General settings`,children:[(0,V.jsx)(Is,{keywords:X.titleAndDescription}),(0,V.jsx)(Fs,{keywords:X.timeZone}),(0,V.jsx)(Cs,{keywords:X.publicationLanguage}),(0,V.jsx)(Vs,{keywords:X.users}),(0,V.jsx)(Ts,{keywords:X.metadata}),(0,V.jsx)(ks,{keywords:X.socialAccounts}),(0,V.jsx)(ys,{keywords:X.analytics})]}),Us=({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Embed`,size:`sm`,onClick:()=>{t(`embed-signup-form/show`)}}),description:`Grow your audience from anywhere on the web`,keywords:e,navid:`embed-signup-form`,testId:`embed-signup-form`,title:`Signup forms`})},Ws=``+new URL(`explore-default-logo-P7UjmPqe.png`,import.meta.url).href,Gs=``+new URL(`ghost-explore-BuZQ7HbF.png`,import.meta.url).href,Ks=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Gn(),r=p(),{updateRoute:i}=P(),{refetch:a}=nr({searchParams:{limit:`1`}}),[o,s]=(0,B.useState)(0);(0,B.useEffect)(()=>{(async()=>{let{data:e}=await a(),t=e?.meta?.pagination?.total||0;s(t)})()},[a]);let[c,u]=z(t,[`accent_color`,`icon`]),{localSettings:d,siteData:f}=N(),[m,h]=z(d,[`title`,`description`]),g=!!tr(t,`explore_ping`),_=!!tr(t,`explore_ping_growth`),v=f?.url,y=v?.replace(/^https?:\/\//,``).replace(/\/?$/,``),b=c||`#F6414E`,x=async(e,t)=>{let i=[{key:e,value:t.target.checked}];try{await n(i)}catch(e){r(e)}};return(0,V.jsx)(J,{customButtons:(0,V.jsx)(wt,{checked:g,direction:`rtl`,testId:`explore-toggle`,onChange:e=>x(`explore_ping`,e)}),description:`Promote your site across Ghost's website and publishing network`,keywords:e,navid:`explore`,testId:`explore`,title:`Ghost Explore`,children:g?(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(C,{}),(0,V.jsx)(wt,{checked:_,containerClasses:`items-center!`,direction:`rtl`,gap:`gap-0`,hint:`Enabling this will use your revenue/member growth data to rank your site more highly on Ghost Explore. Total member count will be displayed publicly, other data will be kept private.`,label:`Share growth data to rank higher?`,labelClasses:`w-full`,testId:`explore-growth-toggle`,onChange:e=>x(`explore_ping_growth`,e)}),(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 flex flex-col items-center bg-grey-50 px-7 py-10 md:-mx-7 md:-mb-7`,"data-testid":`explore-preview`,children:(0,V.jsxs)(`div`,{className:`relative w-full max-w-[320px] rounded-lg bg-white p-6 text-black shadow-lg`,children:[(0,V.jsx)(`div`,{className:`absolute top-2.5 right-3 text-sm text-grey-300 uppercase`,children:`Preview`}),u?(0,V.jsx)(`div`,{className:`size-9 rounded-sm bg-cover bg-center`,style:{backgroundImage:`url(${u})`}}):(0,V.jsx)(`div`,{className:`flex aspect-square size-10 items-center justify-center overflow-hidden rounded-full p-1 text-white`,style:{backgroundColor:b},children:(0,V.jsx)(`img`,{className:`h-auto w-8`,src:Ws})}),(0,V.jsx)(`div`,{className:`mt-3 text-lg font-semibold tracking-tight`,children:m}),h&&(0,V.jsx)(`div`,{className:`mt-0.5 leading-tight text-grey-700`,children:h}),(0,V.jsxs)(`a`,{className:`group mt-8 flex h-6 w-full items-center justify-between gap-5 hover:cursor-pointer`,href:v,rel:`noopener noreferrer`,target:`_blank`,children:[(0,V.jsx)(`span`,{className:`font-semibold`,children:y}),_?(0,V.jsxs)(`span`,{className:`rounded-sm bg-black px-2 py-0.5 text-sm font-semibold text-white`,"data-testid":`explore-members-count`,children:[tn(o),`\xA0`,o===1?`member`:`members`]}):(0,V.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full border border-black text-black group-hover:bg-black group-hover:text-white`,children:(0,V.jsx)(l,{name:`arrow-right`,size:10})})]})]})}),(0,V.jsxs)(`div`,{className:`-mx-5 -mb-5 flex items-center justify-between gap-4 rounded-b-xl border-t border-[rgba(142,66,255,0.1)] bg-gradient-to-tr from-[rgba(142,66,255,0.07)] to-[rgba(142,66,255,0.02)] p-6 px-7 md:-mx-7 md:-mb-7`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Get featured on the Ghost.org homepage`}),(0,V.jsx)(`span`,{className:`text-pretty text-black/80 dark:text-white/80`,children:`Send us a quote we can use to highlight your site`})]}),(0,V.jsx)(L,{className:`border border-purple bg-white text-purple hover:bg-purple/5 hover:text-purple dark:bg-transparent`,icon:`send`,label:`Send testimonial`,onClick:()=>{i(`explore/testimonial`)}})]})]}):(0,V.jsx)(`img`,{src:Gs})})},`Ghost Explore`),qs=``+new URL(`network-C2Wz-Sfw.png`,import.meta.url).href,Js=j(({keywords:e})=>{let{settings:t}=I(),{mutateAsync:n}=Gn(),r=p(),{updateRoute:i}=P(),a=Se()?.isDisabled(`limitSocialWeb`),{subdir:o}=c(),[s]=z(t,[`is_private`]),u=!!o,d=[`localhost`,`127.0.0.1`,`::1`].includes(window.location.hostname),f=vo.default.isIP(window.location.hostname),m=a||u||d||f,h=!!s,g=m||h,[_]=z(t,[`social_web`]),v=!!_&&!g;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(wt,{checked:v,direction:`rtl`,disabled:g,onChange:async e=>{let t=[{key:`social_web`,value:e.target.checked}];try{await n(t)}catch(e){r(e)}}},`${v}-${g}`),description:`Distribute posts to the social web, so people can discover and follow your content across BlueSky, Threads, Mastodon, Flipboard, WordPress, and more.`,keywords:e,navid:`network`,testId:`network`,title:`Network`,children:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(F,{columns:1,values:[{key:`private`,value:g&&(0,V.jsxs)(`div`,{className:`flex w-full gap-1.5 rounded-md border border-grey-200 bg-grey-50 p-3 dark:border-grey-900 dark:bg-grey-900`,children:[(0,V.jsx)(l,{name:`info`,size:16}),(0,V.jsx)(`div`,{className:`-mt-0.5`,children:h?(0,V.jsxs)(V.Fragment,{children:[`Network is automatically disabled while your site is in `,(0,V.jsx)(`span`,{className:`cursor-pointer text-green`,onClick:()=>i(`members`),children:`private mode`})]}):(0,V.jsxs)(V.Fragment,{children:[`You need to configure a supported custom domain to use this feature. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/social-web/#custom-domain-required`,rel:`noopener noreferrer`,target:`_blank`,children:`Help →`})]})})]})}]}),(0,V.jsx)(`div`,{className:`-mx-5 -mb-5 overflow-hidden rounded-b-xl md:-mx-7 md:-mb-7`,children:(0,V.jsx)(`img`,{className:`dark:opacity-90`,src:qs})})]})})},`Network`),Ys=j(({keywords:e})=>{let{updateRoute:t}=P(),{settings:n,config:r}=I(),{data:{offers:i=[]}={}}=$t(),{data:{tiers:a}={}}=cr(),o=ur(a||[]),s=i.filter(e=>e.redemption_type===`signup`);return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,disabled:!Xn(n,r),label:`Manage offers`,size:`sm`,onClick:()=>{t(`offers/edit`)}}),description:(0,V.jsxs)(V.Fragment,{children:[`Create discounts & coupons to boost new subscriptions and retain existing members.`,(0,V.jsx)(`span`,{children:` `}),(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/offers`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]}),keywords:e,navid:`offers`,testId:`offers`,title:`Offers`,children:o.length===0&&s.length===0?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:`You must have an active tier to create an offer.`}),` `,(0,V.jsx)(L,{className:`font-normal`,color:`green`,label:`Manage tiers`,link:!0,linkWithPadding:!0,onClick:()=>{t(`/tiers`)}})]}):``})},`Portal settings`),Xs=({incomingRecommendation:e,stats:t})=>{let{updateRoute:n}=P(),r=(0,B.useMemo)(()=>{let n=e.url;try{n=new URL(e.url).hostname.replace(/^www\./,``)}catch{}return t.reduce((e,t)=>t.source===n?e+t.signups:e,0)},[t,e.url]),i=()=>{n({route:`recommendations/add?url=${e.url}`})},a=()=>{window.open(e.url,`_blank`)},o=r===1?`free member`:`free members`;return(0,V.jsxs)(lt,{action:!e.recommending_back&&(0,V.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,V.jsx)(L,{color:`green`,label:`Recommend back`,size:`sm`,link:!0,onClick:i})}),testId:`incoming-recommendation-list-item`,hideActions:!0,children:[(0,V.jsx)(_t,{className:`w-80`,onClick:a,children:(0,V.jsx)(`div`,{className:`group flex items-center gap-3 hover:cursor-pointer`,children:(0,V.jsx)(`div`,{className:`flex grow flex-col`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(ne,{favicon:e.favicon,featured_image:e.featured_image,title:e.title||e.url}),(0,V.jsx)(`span`,{className:`line-clamp-1 font-medium`,children:e.title||e.url})]})})})}),(0,V.jsx)(_t,{className:`hidden w-auto text-left whitespace-nowrap md:visible! md:table-cell!`,padding:!1,valign:`middle`,onClick:a,children:r===0?(0,V.jsx)(`span`,{className:`text-grey-500 dark:text-grey-900`,children:`-`}):(0,V.jsx)(`div`,{className:`mr-2`,children:(0,V.jsx)(`span`,{children:le(r)})})}),(0,V.jsx)(_t,{className:`hidden w-[1%] whitespace-nowrap md:visible! md:table-cell!`,valign:`middle`,onClick:a,children:r===0?null:(0,V.jsx)(`div`,{className:`-mt-px text-left`,children:(0,V.jsx)(`span`,{className:`-mb-px inline-block min-w-[60px] text-left whitespace-nowrap text-grey-700 lowercase`,children:o})})}),e.recommending_back&&(0,V.jsx)(_t,{className:`w-[1%] whitespace-nowrap group-hover/table-row:visible md:invisible`,children:(0,V.jsx)(`div`,{className:`mt-1 text-right whitespace-nowrap text-grey-700`,children:`Recommending`})})]})},Zs=({incomingRecommendations:e,stats:t,pagination:n,showMore:r,isLoading:i})=>i||e.length?(0,V.jsx)(St,{isLoading:i,pagination:n,showMore:r,hintSeparator:!0,children:e.map(e=>(0,V.jsx)(Xs,{incomingRecommendation:e,stats:t},e.id))}):(0,V.jsx)(oe,{children:(0,V.jsx)(`span`,{className:`max-w-[40ch] text-center`,children:`No one’s recommended you yet. Once they do, you’ll find them here along with how many memberships they’ve driven.`})}),Qs=({recommendation:e})=>{let{route:t}=P(),n=()=>{w.show(We,{pathName:t,animate:!1,recommendation:e})},r=e.one_click_subscribe,i=r&&!!e.count?.subscribers,a=(i?e.count?.subscribers:e.count?.clicks)||0,o=a===1?`signup`:`signups`,s=a===1?`click`:`clicks`;return(0,V.jsxs)(lt,{className:`group hover:cursor-pointer`,testId:`recommendation-list-item`,onClick:n,children:[(0,V.jsx)(_t,{className:`w-80`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(ne,{isGhostSite:r,...e}),(0,V.jsx)(`span`,{className:`line-clamp-1 font-medium`,children:e.title})]})}),(0,V.jsx)(_t,{className:`hidden w-auto text-left align-middle whitespace-nowrap md:visible! md:table-cell!`,children:a===0?(0,V.jsx)(`span`,{className:`text-grey-500 dark:text-grey-900`,children:`-`}):(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`mr-2`,children:(0,V.jsx)(`span`,{children:le(a)})}),(0,V.jsxs)(`div`,{className:`text-grey-700 lowercase`,children:[(0,V.jsx)(`span`,{children:i?o:s}),(0,V.jsx)(`span`,{className:`invisible group-hover:visible`,children:` from you`})]})]})})})]})},$s=({recommendations:e,pagination:t,showMore:n,isLoading:r})=>{let{siteData:i}=N(),a=`${i?.url.replace(/\/$/,``)}/#/portal/recommendations`,{updateRoute:o}=P(),s=()=>{o(`recommendations/add`)},[c,l]=(0,B.useState)(!1);return r||e.length?(0,V.jsx)(St,{hint:(0,V.jsxs)(`span`,{children:[`Shared with new members after signup, or anytime using `,(0,V.jsx)(vr,{href:a,target:`_blank`,children:`this link`}),(0,V.jsx)(pe,{containerClassName:`ml-1 align-middle leading-none`,content:c?`Copied`:`Copy link`,size:`sm`,children:(0,V.jsx)(L,{color:`clear`,hideLabel:!0,icon:c?`check-circle`:`duplicate`,iconColorClass:c?`text-green w-[14px] h-[14px]`:`text-grey-600 hover:opacity-80 w-[14px] h-[14px]`,label:c?`Copied`:`Copy`,unstyled:!0,onClick:()=>{navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}})})]}),isLoading:r,pagination:t,showMore:n,hintSeparator:!0,children:e&&e.map(e=>(0,V.jsx)(Qs,{recommendation:e},e.id))}):(0,V.jsxs)(oe,{children:[(0,V.jsx)(L,{color:`grey`,label:`Add first recommendation`,size:`sm`,onClick:()=>{s()}}),(0,V.jsxs)(`span`,{className:`mt-2 max-w-[40ch] text-center text-sm`,children:[`Need inspiration? `,(0,V.jsx)(vr,{href:`https://ghost.org/explore`,target:`_blank`,children:`Explore thousands of sites`})]})]})},ec=j(({keywords:e})=>{let{saveState:t,handleSave:n}=N(),{data:{meta:r,recommendations:i}={},isLoading:a,hasNextPage:o,fetchNextPage:s}=ve({searchParams:{include:`count.clicks,count.subscribers`,order:`created_at desc`,limit:`5`},getNextPageParams:(e,t)=>{if(!e.meta)return;let{limit:n,page:r,pages:i}=e.meta.pagination;if(r>=i)return;let a=typeof n==`number`&&n<100?1:r+1;return{...t,page:a.toString(),limit:`100`}},keepPreviousData:!0}),c={hasMore:!!o,loadMore:s},{data:{recommendations:l,meta:u}={},isLoading:d,hasNextPage:f,fetchNextPage:p}=se({searchParams:{limit:`5`,order:`created_at desc`},getNextPageParams:(e,t)=>{if(!e.meta)return;let{limit:n,page:r,pages:i}=e.meta.pagination;if(r>=i)return;let a=typeof n==`number`&&n<100?1:r+1;return{...t,page:a.toString(),limit:`100`}},keepPreviousData:!0}),{data:{stats:m}={},isLoading:h}=fr({}),g={hasMore:!!f,loadMore:p},[_,v]=(0,B.useState)(`your-recommendations`),y=[{id:`your-recommendations`,title:`Your recommendations`,counter:r?.pagination?.total,contents:(0,V.jsx)($s,{isLoading:a,recommendations:i??[],showMore:c})},{id:`recommending-you`,title:`Recommending you`,counter:u?.pagination?.total,contents:(0,V.jsx)(Zs,{incomingRecommendations:l??[],isLoading:d||h,showMore:g,stats:m??[]})}],b=(0,V.jsx)(V.Fragment,{children:`Recommend any publication that your audience will find valuable, and find out when others are recommending you.`}),{updateRoute:x}=P(),S=()=>{x(`recommendations/add`)};return(0,V.jsxs)(J,{beta:!0,customButtons:(0,V.jsx)(L,{className:`mt-[-5px] hidden md:!visible md:!block`,color:`clear`,label:`Add recommendation`,size:`sm`,onClick:()=>{S()}}),description:b,keywords:e,navid:`recommendations`,saveState:t,testId:`recommendations`,title:`Recommendations`,onSave:n,children:[(0,V.jsx)(`div`,{className:`flex justify-center rounded border border-green px-4 py-2 md:hidden`,children:(0,V.jsx)(L,{color:`light-grey`,label:`Add recommendation`,link:!0,onClick:()=>{S()}})}),(0,V.jsx)(Ze,{selectedTab:_,tabs:y,onTabChange:v})]})},`Recommendations`),Z={network:[`growth`,`network`,`activitypub`,`blog`,`fediverse`,`sharing`],explore:[`ghost explore`,`explore`,`growth`,`share`,`list`,`listing`],recommendations:[`growth`,`recommendations`,`recommend`,`blogroll`],embedSignupForm:[`growth`,`embeddable signup form`,`embeddable form`,`embeddable sign up form`,`embeddable sign up`],offers:[`growth`,`offers`,`discounts`,`coupons`,`promotions`]},tc=()=>{let{config:e,settings:t}=I(),n=Xn(t||[],e||{});return(0,V.jsxs)(Ea,{keywords:[Z.network,Z.explore,Z.recommendations,Z.embedSignupForm,...n?[Z.offers]:[]].flat(),title:`Growth`,children:[(0,V.jsx)(Js,{keywords:Z.network}),(0,V.jsx)(Ks,{keywords:Z.explore}),(0,V.jsx)(ec,{keywords:Z.recommendations}),(0,V.jsx)(Us,{keywords:Z.embedSignupForm}),n&&(0,V.jsx)(Ys,{keywords:Z.offers})]})},nc=[{value:`public`,label:`Public`,hint:`Anyone can visit and read the website`},{value:`private`,label:`Private`,hint:`Access code required`}],rc=[{value:`all`,label:`Public`,hint:`Anyone can sign up and log in`},{value:`paid`,label:`Paid-members only`,hint:`A paid Stripe subscription is required to sign up`},{value:`invite`,label:`Invite-only`,hint:`People can sign in but won't be able to sign up`},{value:`none`,label:`Nobody`,hint:`Disable all member features, including newsletters`}],ic=[{value:`public`,label:`Public`,hint:`All site visitors to your site, no login required`},{value:`members`,label:`Members only`,hint:`All logged-in members`},{value:`paid`,label:`Paid-members only`,hint:`Only logged-in members with an active Stripe subscription`},{value:`tiers`,label:`Specific tiers`,hint:`Members with any of the selected tiers`}],ac=[{value:`all`,label:`All members`,hint:`Logged-in members`},{value:`paid`,label:`Paid-members only`,hint:`Only logged-in members with an active Stripe subscription`},{value:`off`,label:`Nobody`,hint:`Disable commenting completely`}],oc=j(({keywords:e})=>{let{settings:t}=I(),n=Se()?.isDisabled(`publicSiteAccess`),r=Qn(t,`is_private`)||Qn(t,`password`),{mutateAsync:i}=Vn(),[a,o]=B.useState(!1),{localSettings:s,isEditing:c,saveState:l,siteData:d,handleSave:f,handleCancel:p,updateSetting:m,handleEditingChange:h,errors:g,clearError:_}=N({onValidate:()=>v&&!y?{password:`Enter an access code`}:{}}),[v,y,b,x,w,ee]=z(s,[`is_private`,`password`,`members_signup_access`,`default_content_visibility`,`default_content_visibility_tiers`,`comments_enabled`]),[T,te]=z(t,[`is_private`,`public_hash`]),E=r?!0:v,{data:{tiers:D}={}}=cr(),O=[{label:`Active Tiers`,options:D?.filter(({active:e})=>e).map(e=>({value:e.id,label:e.name}))||[]},{label:`Archived Tiers`,options:D?.filter(({active:e})=>!e).map(e=>({value:e.id,label:e.name}))||[]}],ne=JSON.parse(w||`[]`),re=O.flatMap(e=>e.options).filter(e=>ne.includes(e.value)),ie=T&&E&&d?.url&&te?`${d.url.replace(/\/$/,``)}/${te}/rss`:null,ae=e=>{let t=e.map(e=>e.value);m(`default_content_visibility_tiers`,JSON.stringify(t))};return(0,V.jsx)(J,{description:`Set up who can browse your site, subscribe, read posts, and comment`,isEditing:c,keywords:e,navid:`members`,saveState:l,testId:`access`,title:`Access`,hideEditButton:!0,onCancel:p,onEditingChange:h,onSave:f,children:(0,V.jsxs)(F,{className:`gap-y-4`,columns:1,children:[n&&(0,V.jsx)(`div`,{className:`-m-5 overflow-hidden p-5`,children:(0,V.jsxs)(jn,{className:`mb-2 flex w-full cursor-default flex-col gap-4 border-0 p-6 pt-5 transition-none hover:translate-y-0 hover:scale-100 hover:shadow-[-7px_-6px_42px_8px_rgb(75_225_226_/_28%),7px_6px_42px_8px_rgb(202_103_255_/_32%)] md:flex-row md:items-center md:justify-between dark:hover:shadow-[-7px_-6px_42px_8px_rgb(75_225_226_/_36%),7px_6px_42px_8px_rgb(202_103_255_/_38%)]`,size:`lg`,variant:`gradient`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-base font-semibold`,children:`Pre-launch mode`}),(0,V.jsx)(`div`,{className:`mt-2 text-gray-700`,children:`During your free trial, a private access code is required to browse your site. When you're ready to launch, pick a plan to upgrade your account and make everything public.`})]}),(0,V.jsx)(ln,{className:`shrink-0 self-start md:self-center`,asChild:!0,children:(0,V.jsx)(`a`,{href:`#/pro/billing/plans`,children:`Upgrade now`})})]})}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should be able to browse your site?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{containerClassName:r?`relative z-10`:void 0,disabled:r,options:nc,selectedOption:nc.find(e=>e.value===(E?`private`:`public`)),testId:`site-visibility-select`,onSelect:e=>{m(`is_private`,e?.value===`private`),h(!0)}})})]}),(E||r)&&(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row md:items-start`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px] md:pt-3`,children:`What access code should visitors use?`}),(0,V.jsxs)(`div`,{className:`w-full md:flex-1`,children:[(0,V.jsx)(k,{containerClassName:r?`relative z-10`:void 0,"data-testid":`site-access-code`,disabled:r,error:!!g.password,hint:g.password,placeholder:`Enter access code`,rightPlaceholder:(0,V.jsx)(`span`,{className:`flex h-full items-center`,children:(0,V.jsx)(`button`,{"aria-label":`Regenerate access code`,className:`mr-[5px] flex size-5 cursor-pointer items-center justify-center p-0 text-grey-900 disabled:cursor-not-allowed disabled:opacity-40 dark:text-grey-400`,"data-testid":`regenerate-access-code`,disabled:a,title:`Regenerate access code`,type:`button`,onClick:async()=>{o(!0);try{let e=(await i(null)).settings.find(e=>e.key===`password`)?.value;typeof e==`string`&&(m(`password`,e),_(`password`))}catch{u({type:`error`,title:`Could not regenerate access code`})}finally{o(!1)}},children:(0,V.jsx)(rn,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.5})})}),title:`Access code`,value:y||``,hideTitle:!0,onChange:e=>{m(`password`,e.target.value),h(!0)},onKeyDown:()=>_(`password`)}),ie&&!r&&(0,V.jsx)(S,{className:`mt-2`,children:(0,V.jsxs)(V.Fragment,{children:[`A private RSS feed is available `,(0,V.jsx)(`a`,{className:`text-green`,href:ie,rel:`noopener noreferrer`,target:`_blank`,children:`here`})]})})]})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should be able to subscribe to your site?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:rc,selectedOption:rc.find(e=>e.value===b),testId:`subscription-access-select`,onSelect:e=>{m(`members_signup_access`,e?.value||null),h(!0)}})})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who should have access to new posts?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:ic,selectedOption:ic.find(e=>e.value===x),testId:`default-post-access-select`,onSelect:e=>{m(`default_content_visibility`,e?.value||null),h(!0)}})})]}),x===`tiers`&&(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Select specific tiers`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(de,{color:`black`,options:O.filter(e=>e.options.length>0),testId:`tiers-select`,values:re,onChange:e=>{ae(e),h(!0)}})})]}),(0,V.jsx)(C,{className:`border-grey-200 dark:border-grey-900`}),(0,V.jsxs)(`div`,{className:`flex flex-col content-center items-center gap-4 md:flex-row`,children:[(0,V.jsx)(`div`,{className:`w-full max-w-none min-w-[160px] md:w-2/3 md:max-w-[320px]`,children:`Who can comment on posts?`}),(0,V.jsx)(`div`,{className:`w-full md:flex-1`,children:(0,V.jsx)(De,{options:ac,selectedOption:ac.find(e=>e.value===ee),testId:`commenting-select`,title:``,onSelect:e=>{m(`comments_enabled`,e?.value||null),h(!0)}})})]})]})})},`Access`),sc=j(({keywords:e})=>{let{siteData:t}=I(),[n,r]=(0,B.useState)(!1),i=`${t?.url.replace(/\/$/,``)}/#/portal/gift`;return(0,V.jsx)(J,{description:(0,V.jsxs)(V.Fragment,{children:[`Allow your readers to share your work by purchasing a gift subscription for a friend or colleague. `,(0,V.jsx)(`a`,{className:`text-green`,href:`https://ghost.org/help/gift-subscriptions/`,rel:`noopener noreferrer`,target:`_blank`,children:`Learn more`})]}),keywords:e,navid:`gift-subscriptions`,testId:`gift-subscriptions`,title:`Gift subscriptions`,hideEditButton:!0,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsxs)(`div`,{className:`w-100`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsx)(T,{level:6,children:`Shareable link`})}),(0,V.jsxs)(`div`,{className:`group relative mt-0 flex w-100 items-center justify-between overflow-hidden border-b border-transparent pt-1 pb-2 hover:border-grey-300 dark:hover:border-grey-600`,children:[(0,V.jsx)(`span`,{"data-testid":`gift-url`,children:i}),(0,V.jsxs)(`div`,{className:`invisible flex gap-1 bg-white pl-1 group-hover:visible dark:bg-black`,children:[(0,V.jsx)(L,{color:`clear`,"data-testid":`preview-shareable-link`,label:`Preview`,size:`sm`,onClick:()=>{window.open(i,`_blank`)}}),(0,V.jsx)(L,{color:`light-grey`,"data-testid":`copy-shareable-link`,label:n?`Copied`:`Copy link`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3)}})]})]})]})})})},`Gift subscriptions`),cc=()=>{let{settings:e,siteData:t}=I(),[n,r=!1,i=!1]=z(e,[`members_signup_access`,`donations_enabled`,`recommendations_enabled`]);if(typeof n!=`string`)throw TypeError(`members_signup_access should be a string`);if(typeof r!=`boolean`)throw TypeError(`donations_enabled should be a boolean`);if(typeof i!=`boolean`)throw TypeError(`recommendations_enabled should be a boolean`);return zt({siteUrl:t.url,membersSignupAccess:n,donationsEnabled:r,recommendationsEnabled:i})},lc={useFileUpload:Gt,fileTypes:Jt},uc=R(`pb-10 text-[1.6rem] leading-[1.6] tracking-[-0.01em]`,`dark:text-white dark:selection:bg-[rgba(88,101,116,0.99)]`,`[&_.koenig-lexical-editor-input-placeholder]:font-sans! [&_.koenig-lexical-editor-input-placeholder]:text-[1.6rem] [&_.koenig-lexical-editor-input-placeholder]:tracking-tight`,`[&_:is(h2,h3)]:dark:text-white`,`[&_.koenig-lexical_input]:text-[1.4rem]`,`[&_[data-kg-plus-button]]:top-[-4px]`,`[&_[data-kg-card-selected]]:isolate`,`[&_:is(p,blockquote,aside,ul,ol)]:tracking-tight`,`[&_figcaption_:is(p,blockquote,aside,ul,ol)]:text-[1.4rem] [&_figcaption_:is(p,blockquote,aside,ul,ol)]:tracking-[.025em]`,`[&_figcaption_p]:mb-0`,`[&_:is(h1)]:text-[36px] [&_:is(h1,h2,h3,h4,h5,h6)]:mb-[0.5em] [&_:is(h2)]:text-[32px] [&_:is(h3)]:text-[26px] [&_:is(h4)]:text-[21px] [&_:is(h5)]:text-[19px] [&_:is(h6)]:text-[19px]`,`[&_:is(hr)]:pt-0`,`[&_p]:mb-4 [&_strong]:font-semibold`,`[&_[data-kg-settings-panel]_p]:!mb-0`,`[&_.not-kg-prose>div]:font-sans! [&_.not-kg-prose>div]:text-[1.6rem]! [&_.not-kg-prose>div]:leading-[1.6]! [&_.not-kg-prose>div]:tracking-tight!`,`[&_.kg-inherit-styles_p]:mb-0!`,`[&_.kg-inherit-styles]:pt-[3px]!`,`[&_.koenig-lexical-cta-label_p]:!text-[12.5px]`),dc=({editor:e,darkMode:t,cardConfig:n,initialEditorState:r,placeholder:i,className:a,registerAPI:o,onChange:s})=>{let c=e.read().EmailEditor;return(0,V.jsx)(`div`,{className:R(`koenig-react-editor w-full`,uc,a),children:(0,V.jsx)(c,{cardConfig:n,className:`koenig-lexical koenig-lexical-editor-input`,darkMode:t,fileUploader:lc,initialEditorState:r,placeholderText:i,registerAPI:o,onChange:s})})},fc=B.memo(({value:e,placeholder:t,className:n,onChange:i})=>{let a=(0,B.useRef)(null),o=(0,B.useRef)(e),{unsplashConfig:s}=r(),c=Wt(),{config:l,settings:u}=I(),{fetchAutocompleteLinks:d,searchLinks:f}=cc(),p=Bt(),m=l.klipy?.apiKey?l.klipy:null,{fetchKoenigLexical:h,darkMode:g}=te(),_=(0,B.useMemo)(()=>me(h),[h]),[v]=z(u,[`transistor`]),y=(0,B.useMemo)(()=>({unsplash:s,pinturaConfig:c,klipy:m,fetchEmbed:p,fetchAutocompleteLinks:d,searchLinks:f,feature:{transistor:v},visibilitySettings:`none`}),[s,c,m,p,d,f,v]),b=(0,B.useCallback)(e=>{a.current=e},[]),x=(0,B.useCallback)(e=>{i&&e&&typeof e==`object`&&i(JSON.stringify(e))},[i]),S=(0,B.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&e.stopPropagation()},[]);return(0,V.jsx)(`div`,{className:`h-full`,onKeyDown:S,onMouseDown:e=>{a.current&&Qt(a.current,e)},children:(0,V.jsx)(st,{name:`email-editor`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Ve,{delay:200,size:`lg`}),children:(0,V.jsx)(dc,{cardConfig:y,className:n,darkMode:g,editor:_,initialEditorState:o.current,placeholder:t,registerAPI:b,onChange:x})})})})}),pc=({previewState:e})=>{let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(!1),o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null);function u(){s.current?.disconnect(),s.current=null,c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)}(0,B.useEffect)(()=>(u(),a.current=!1,i(!1),n(null),()=>{u()}),[e.status===`success`?e.html:``,e.status]);function d(){let e=o.current,t=e?.contentDocument;if(!e||!t)return;t.documentElement.style.overflowY=`hidden`,t.body.style.overflowY=`hidden`;let r=Math.max(t.documentElement?.scrollHeight||0,t.body?.scrollHeight||0,t.documentElement?.offsetHeight||0,t.body?.offsetHeight||0);r>0&&(n(e=>e===r?e:r),!a.current&&l.current===null&&(l.current=window.requestAnimationFrame(()=>{l.current=window.requestAnimationFrame(()=>{l.current=null,a.current=!0,i(!0)})})))}function f(){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{c.current=null,d()})}function p(){let e=o.current,t=e?.contentDocument;if(!(!e||!t)&&(u(),f(),typeof ResizeObserver<`u`)){let e=new ResizeObserver(()=>{f()});e.observe(t.documentElement),e.observe(t.body),s.current=e}}return(0,V.jsxs)(`div`,{className:`relative w-full`,"data-testid":`welcome-email-preview`,children:[(e.status===`loading`||e.status===`success`&&!r)&&(0,V.jsx)(`div`,{className:`flex min-h-full items-start justify-center pt-24`,"data-testid":`welcome-email-preview-loading`,style:t?{height:`${t}px`}:void 0,children:(0,V.jsx)(Ve,{})}),e.status===`success`&&(0,V.jsx)(`div`,{"aria-hidden":!r,className:R(`w-full`,!r&&`pointer-events-none absolute top-0 left-0 opacity-0`),children:(0,V.jsx)(`iframe`,{ref:o,className:`w-full rounded bg-white`,"data-testid":`welcome-email-preview-iframe`,sandbox:`allow-same-origin allow-popups allow-popups-to-escape-sandbox`,srcDoc:e.html,style:{height:t?`${t}px`:`600px`},title:`Welcome email preview`,onLoad:p})}),(e.status===`error`||e.status===`invalid`)&&(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center px-4`,"data-testid":`welcome-email-preview-error`,children:(0,V.jsx)(S,{color:`red`,children:e.message})})]})},mc=e=>{if(!e)return!0;try{let t=JSON.parse(e)?.root?.children;return!t||t.length===0||t.length===1&&t[0].type===`paragraph`&&(!t[0].children||t[0].children.length===0)}catch{return!0}},hc=e=>{let t={};return e.subject?.trim()||(t.subject=`A subject is required`),mc(e.lexical)&&(t.lexical=`Email content is required`),t},gc=e=>{if(typeof DOMParser>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`a[href]`).forEach(e=>{e.target=`_blank`,e.rel=`noopener noreferrer`}),`<!doctype html>${t.documentElement.outerHTML}`},_c=e=>{let t=`Failed to render preview`;return e instanceof a&&e.data?.errors?.[0]?e.data.errors[0].context||e.data.errors[0].message||t:e instanceof Error&&e.message?e.message:t},vc=({automatedEmailId:e,previewWelcomeEmail:t,setErrors:n})=>{let[r,i]=(0,B.useState)({status:`idle`}),a=(0,B.useRef)(0),o=()=>{a.current+=1,i({status:`idle`})},s=async r=>{let o=a.current+1;a.current=o;let s=hc(r);if(n(s),s.subject||s.lexical){i({status:`invalid`,message:s.subject||s.lexical});return}i({status:`loading`});try{let n=await t({id:e,subject:r.subject,lexical:r.lexical});if(a.current!==o)return;let s=n.automated_emails?.[0];if(!s?.html||!s?.plaintext||!s?.subject)throw Error(`Preview response was incomplete`);i({status:`success`,preview:{...s,html:gc(s.html)}})}catch(e){if(a.current!==o)return;i({status:`error`,message:_c(e)})}},c={status:`loading`};return r.status===`success`?c={status:`success`,html:r.preview.html}:(r.status===`error`||r.status===`invalid`)&&(c={status:r.status,message:r.message}),{previewFrameState:c,previewState:r,enterPreview:s,exitPreview:o}},yc=({automatedEmailId:e,subject:t,lexical:n,validateForm:r,onClose:i})=>{let{data:s}=o(),{mutateAsync:c}=qt(),[l,u]=(0,B.useState)(s?.email||``),[d,f]=(0,B.useState)(``),[p,m]=(0,B.useState)(`idle`),h=(0,B.useRef)(null);return(0,B.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]),(0,B.useEffect)(()=>{s?.email&&u(s.email)},[s?.email]),(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),i())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i]),(0,V.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-2 w-[260px] rounded border border-grey-200 bg-white p-4 shadow-lg dark:border-grey-900 dark:bg-grey-950`,"data-testid":`test-email-dropdown`,children:[(0,V.jsxs)(`div`,{className:`mb-3`,children:[(0,V.jsx)(`label`,{className:`mb-2 block font-semibold`,htmlFor:`test-email-input`,children:`Send test email`}),(0,V.jsx)(k,{className:`h-[36px]!`,id:`test-email-input`,placeholder:`you@yoursite.com`,value:l,onChange:e=>{u(e.target.value)}})]}),(0,V.jsx)(L,{className:`w-full`,color:p===`sent`?`green`:`black`,disabled:p===`sending`,label:p===`sent`?`Sent`:p===`sending`?`Sending...`:`Send`,onClick:async()=>{if(f(``),!vo.default.isEmail(l)){f(`Please enter a valid email address`);return}if(!r()){f(`Please complete the required fields`);return}m(`sending`);try{await c({id:e,email:l,subject:t,lexical:n}),m(`sent`),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>m(`idle`),2e3)}catch(e){m(`idle`);let t;e instanceof a&&e.data&&e.data.errors[0]?t=e.data.errors[0].context||e.data.errors[0].message:e instanceof Error&&(t=e.message),f(t||`Failed to send test email`)}}}),d&&(0,V.jsx)(S,{className:`mt-2`,color:`red`,children:d})]})},bc=B.forwardRef(({title:e,centeredHeaderContent:t,headerActions:n,children:r,className:i,isEditMode:a=!1},o)=>(0,V.jsxs)(`div`,{ref:o,className:R(`flex size-full flex-col gap-0 overflow-hidden rounded-xl p-0`,a?`bg-white`:`bg-gray-100`,`dark:bg-gray-950`,i),children:[(0,V.jsxs)(`div`,{className:`sticky top-0 grid shrink-0 grid-cols-[1fr_auto_1fr] items-center border-b border-gray-200 bg-white px-5 py-3 dark:border-gray-900 dark:bg-gray-950`,children:[(0,V.jsx)(`h3`,{className:`justify-self-start text-xl font-semibold`,children:e}),(0,V.jsx)(`div`,{className:`justify-self-center`,children:t}),(0,V.jsx)(`div`,{className:`flex items-center gap-2 justify-self-end`,children:n})]}),(0,V.jsx)(`div`,{className:`flex h-[clamp(0px,calc(100dvh-320px),82vh)] min-h-0 grow flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:r})]}));bc.displayName=`EmailPreviewModalContent`;var xc=({children:e,className:t})=>(0,V.jsx)(`div`,{className:R(`relative isolate z-20 mx-auto w-full max-w-[780px] rounded-t-lg border border-b-0 border-gray-200 bg-white px-6 py-4 transition-[max-width,padding] duration-300 ease-out motion-reduce:transition-none dark:border-grey-900 dark:bg-grey-950`,t),children:e}),Sc=({children:e,className:t})=>(0,V.jsx)(`div`,{className:R(`mx-auto flex w-full max-w-[780px] grow rounded-b-lg transition-[max-width,height,padding] duration-300 ease-out motion-reduce:transition-none dark:border-grey-900 dark:shadow-none`,t),children:e}),Cc=w.create(({emailType:e=`free`,automatedEmail:t})=>{let n=E(),{settings:r,config:i}=I(),[a,o,s]=z(r,[`title`,`default_email_address`,`support_email_address`]),{updateRoute:c}=P(),{mutateAsync:l}=Yt(),{mutateAsync:u}=Lt(),{data:d}=Kt(),[f,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(`edit`),[_,v]=(0,B.useState)(null),y=(0,B.useRef)(null),b=(0,B.useRef)(t?.lexical||``),x=(0,B.useRef)(!1),C=p(),{resolvedSenderName:w,resolvedSenderEmail:ee,resolvedReplyToEmail:T,hasDistinctReplyTo:te}=ts(d?.automated_emails||[],{config:i,defaultEmailAddress:o,siteTitle:a,supportEmailAddress:s}),D=`${e===`paid`?`Paid`:`Free`} members welcome email`,{formState:O,saveState:ne,updateForm:ie,setFormState:ae,setErrors:oe,handleSave:se,okProps:ce,errors:A,validate:le}=Vt({initialState:{subject:t?.subject||`Welcome`,lexical:t?.lexical||``},savingDelay:500,onSave:async e=>{await l({...t,...e})},onSaveError:C,onValidate:hc}),ue=ce.label||`Save`,{previewFrameState:de,enterPreview:fe,exitPreview:pe}=vc({automatedEmailId:t.id,previewWelcomeEmail:u,setErrors:oe}),j=ne===`unsaved`,me=(0,B.useCallback)(()=>{Ye(j,()=>{n.remove()})},[n,j]);(0,B.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&m(!1)};return f&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[f]);let he=(0,B.useRef)(se);(0,B.useEffect)(()=>{he.current=se},[se]),(0,B.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),he.current({fakeWhenUnchanged:!0}))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]);let ge=(0,B.useCallback)(e=>{g(e),e===`preview`?(v(null),fe(O)):(m(!1),v(null),pe())},[fe,pe,O]),M=(0,B.useCallback)(e=>{if(!x.current){b.current=e,ae(t=>({...t,lexical:e}));return}e===b.current?ae(t=>({...t,lexical:e})):ie(t=>({...t,lexical:e}))},[ae,ie]);return(0,V.jsx)(re,{afterClose:()=>{c(`memberemails`)},backDropClick:!1,dirty:j,footer:!1,header:!1,padding:!1,scrolling:!1,size:`full`,testId:`welcome-email-modal`,width:`full`,children:(0,V.jsx)(bc,{centeredHeaderContent:(0,V.jsx)(jt,{"data-testid":`welcome-email-mode-toggle`,value:h,variant:`segmented-sm`,onValueChange:e=>e&&ge(e),children:(0,V.jsxs)(At,{className:`grid w-[240px] grid-cols-2 bg-gray-100 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]`,children:[(0,V.jsx)(Ot,{className:`w-full justify-center data-[state=active]:bg-white dark:data-[state=active]:bg-white dark:data-[state=active]:text-black`,"data-testid":`welcome-email-mode-edit`,value:`edit`,children:`Email content`}),(0,V.jsx)(Ot,{className:`w-full justify-center`,"data-testid":`welcome-email-mode-preview`,value:`preview`,children:`Preview`})]})}),className:`dark:bg-[#151719]`,headerActions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ln,{variant:`outline`,onClick:me,children:`Close`}),(0,V.jsx)(ln,{disabled:ce.disabled,onClick:async()=>await se({fakeWhenUnchanged:!0}),children:ue})]}),isEditMode:h===`edit`,title:D,children:(0,V.jsxs)(`div`,{className:`flex grow flex-col items-center p-6`,children:[h===`preview`&&(0,V.jsx)(xc,{className:`border-x-0 border-t-0 border-b`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center py-1`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`From:`}),(0,V.jsx)(`div`,{className:`min-w-0 grow pr-4`,children:(0,V.jsxs)(`span`,{className:`flex gap-1 truncate whitespace-nowrap`,children:[(0,V.jsx)(`span`,{children:w}),(0,V.jsx)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:`<${ee}>`})]})}),(0,V.jsxs)(`div`,{ref:y,className:`relative`,children:[(0,V.jsx)(L,{className:`border border-grey-200 font-semibold hover:border-grey-300 hover:bg-white! dark:border-grey-900 dark:hover:border-grey-800 dark:hover:bg-grey-950!`,color:`clear`,icon:`send`,label:`Test`,onClick:()=>m(!f)}),f&&(0,V.jsx)(yc,{automatedEmailId:t.id,lexical:O.lexical,subject:O.subject,validateForm:le,onClose:()=>m(!1)})]})]}),te&&(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`Reply-to:`}),(0,V.jsx)(`div`,{className:`grow text-gray-500 dark:text-gray-400`,children:T})]}),(0,V.jsxs)(`div`,{className:`flex items-center`,children:[(0,V.jsx)(`div`,{className:`w-20 shrink-0 font-semibold`,children:`Subject:`}),(0,V.jsxs)(`div`,{className:`grow`,children:[(0,V.jsx)(k,{className:`w-full`,"data-testid":`welcome-email-preview-subject`,value:_??O.subject,onChange:e=>{let t=e.target.value;v(t),ie(e=>({...e,subject:t}))}}),A.subject&&(0,V.jsx)(S,{className:`mt-2`,color:`red`,children:A.subject})]})]})]})}),(0,V.jsxs)(Sc,{className:R(h===`preview`&&`bg-white shadow-sm dark:bg-grey-950`,h===`edit`&&`px-6`,h===`edit`&&`rounded-lg`,h===`edit`&&A.lexical&&`border border-red-500`),children:[(0,V.jsx)(`div`,{className:R(`mx-auto w-full max-w-[600px] pt-10 pb-8 transition-[max-width,padding] duration-300 ease-out motion-reduce:transition-none`,h===`preview`&&`hidden`),"data-testid":`welcome-email-editor`,onFocus:()=>{x.current=!0},children:(0,V.jsx)(fc,{className:`welcome-email-editor`,placeholder:`Begin writing your email...`,value:O.lexical,onChange:M},t?.id||`new`)}),h===`preview`&&(0,V.jsx)(pc,{previewState:de})]}),h===`edit`&&A.lexical&&(0,V.jsx)(S,{className:`mt-2 max-w-[740px]`,color:`red`,children:A.lexical})]})})})}),wc=({automatedEmail:e,emailType:t,icon:n,title:r,enabled:i,isBusy:a,isInitialLoading:o,onEdit:s,onToggle:c})=>(0,V.jsx)(lt,{action:(0,V.jsxs)(`div`,{className:`flex items-center gap-7 ${a&&!o?`pointer-events-none`:``}`,children:[o?(0,V.jsx)(`div`,{className:`h-4 w-7 rounded-full bg-grey-300 dark:bg-grey-800`}):(0,V.jsx)(wt,{checked:i,onChange:c}),(0,V.jsx)(`button`,{className:`font-semibold text-green hover:opacity-80`,type:`button`,onClick:s,children:`Edit`})]}),hideActions:!1,testId:`${t}-welcome-email-row`,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsxs)(`button`,{className:`flex w-full min-w-0 items-center gap-3 py-3 text-left focus-visible:ring-2 focus-visible:ring-green focus-visible:ring-offset-2 focus-visible:outline-none dark:focus-visible:ring-offset-black`,"data-testid":`${t}-welcome-email-preview`,type:`button`,onClick:s,children:[(0,V.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-grey-100 dark:bg-grey-900`,children:(0,V.jsx)(l,{colorClass:`text-grey-700 dark:text-grey-600`,name:n,size:`md`})}),(0,V.jsxs)(`div`,{className:`min-w-0 grow`,children:[(0,V.jsx)(`div`,{className:`leading-tight font-medium`,"data-testid":`${t}-welcome-email-title`,children:r}),(0,V.jsx)(`div`,{className:`mt-1 text-sm leading-[1.35] text-grey-700 dark:text-grey-600`,children:e.subject})]})]})})}),Tc=({settings:e,config:t,freeEmailForDisplay:n,paidEmailForDisplay:r,freeWelcomeEmailEnabled:i,paidWelcomeEmailEnabled:a,isBusy:o,isLoading:s,onFreeEdit:c,onFreeToggle:l,onPaidEdit:u,onPaidToggle:d})=>(0,V.jsxs)(St,{borderTop:!0,children:[(0,V.jsx)(wc,{automatedEmail:n,emailType:`free`,enabled:i,icon:`user-add`,isBusy:o,isInitialLoading:s,title:`Free members welcome email`,onEdit:c,onToggle:l}),Xn(e,t)&&(0,V.jsx)(wc,{automatedEmail:r,emailType:`paid`,enabled:a,icon:`bills`,isBusy:o,isInitialLoading:s,title:`Paid members welcome email`,onEdit:u,onToggle:d})]}),Ec=j(({keywords:e})=>{let{settings:t,config:n}=I(),[r]=z(t,[`title`]),i=Me().getParam(`verifyEmail`),{data:a,isLoading:o}=Kt(),{mutateAsync:s,isLoading:c}=Zt(),{mutateAsync:l,isLoading:d}=Yt(),{mutateAsync:f}=Xt(),m=p(),h=a?.automated_emails||[],_=o||c||d,v=h.find(e=>e.slug===qo.free),y=h.find(e=>e.slug===qo.paid),b=v?.status===`active`,x=y?.status===`active`,S=async(e,t)=>{let n=Xo(e,r);return s({...n,status:t})},C=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!i||!window.location.href.includes(`memberemails`)||C.current===i)return;C.current=i;let e=()=>{let e=window.location.hash.slice(1),t=new URL(e||`/memberemails`,window.location.origin);t.searchParams.delete(`verifyEmail`);let n=t.search?`#${t.pathname}${t.search}`:`#${t.pathname}`;window.history.replaceState(null,``,`${window.location.pathname}${n}`)};(async()=>{try{let{meta:{email_verified:t}={}}=await f({token:i});e();let n=`Sender email verified`,r=(0,V.jsx)(V.Fragment,{children:`Welcome email sender settings have been updated.`});t===`sender_reply_to`&&(n=`Reply-to address verified`,r=(0,V.jsx)(V.Fragment,{children:`Welcome email reply-to address has been verified and updated.`})),w.show(M,{title:n,prompt:r,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()})}catch(t){let n=`There was an error verifying your email address. Try again later.`;t instanceof g&&t.message===`Token expired`&&(n=`Verification link has expired.`),e(),w.show(M,{title:`Error verifying email address`,prompt:n,okLabel:`Close`,cancelLabel:``,onOk:e=>e?.remove()}),m(t,{withToast:!1})}})()},[m,i,f]);let ee=async e=>{let t=h.find(t=>t.slug===qo[e]),n=e===`free`?`Free members`:`Paid members`;if(!_)try{t?t.status===`active`?(await l({...t,status:`inactive`}),u({type:`success`,title:`${n} welcome email disabled`})):(await l({...t,status:`active`}),u({type:`success`,title:`${n} welcome email enabled`})):(await S(e,`active`),u({type:`success`,title:`${n} welcome email enabled`}))}catch(e){m(e)}},T=async e=>{let t=h.find(t=>t.slug===qo[e]);if(!_)if(t)w.show(Cc,{emailType:e,automatedEmail:t});else try{let t=(await S(e,`inactive`))?.automated_emails?.[0];t&&w.show(Cc,{emailType:e,automatedEmail:t})}catch(e){m(e)}},te=v||Zo(`free`,r),E=y||Zo(`paid`,r);return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>w.show(ps)}),description:`Create and manage automated emails for your members`,keywords:e,navid:`memberemails`,testId:`memberemails`,title:`Welcome emails`,children:(0,V.jsx)(Tc,{config:n,freeEmailForDisplay:te,freeWelcomeEmailEnabled:b,isBusy:_,isLoading:o,paidEmailForDisplay:E,paidWelcomeEmailEnabled:x,settings:t,onFreeEdit:()=>T(`free`),onFreeToggle:()=>ee(`free`),onPaidEdit:()=>T(`paid`),onPaidToggle:()=>ee(`paid`)})})},`MemberEmails`),Dc=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAQAAADc8cciAAADJ0lEQVR4AYyUA2DsaBCAZ3X2s23btm3btm3btm3btm2VqyT31W3K9DfGkkjNJGaRkeZW8dpl6Zwpz295Al5i2awiCwt5nOQeGxjJUNZ9Or2i5AoRS6xQfW78f1sbTk+6UJ+SpMdEU49HeX4TS8wSWLrEAbU5qZXCDGO0MtF9xHWVB+oGZSjuh0UeipijRe2Umif8Qhd13/kubZOWtAaBZvnpaHpasY2vH4d8DJAtKoHrpOMscTk2r/A8EZNOxMBzr19fTeaJ1wGvKLS3tIrHK6847EGi0c0s8nAIezgxJkMgOf0Hqj0pqxqn1msVGf3LWnU9qx7UfqBzn+neKNqojT/P/CwxdTHX/IcLbNAGnyuv480j/mPLvLSG4WBRq3BLW8C0Zr8HyzggB2MpzS7EuN+tSD1OaEOud7su1wOEXtKAcjTxXeYrxn1GTn5nMytZl8eWRySPvF9ELSozu0ycMmLUu6QgLRXYxMqemQKVdM9jLCXoMjDXQDHqhf4jB39ynHF7W+8V2SvKaBaQl6bdinUToy5WSvI3Sxj3bMKzAAu6WzCY8VTc0jw2yfexLKnoxHrvWd4i3uIowUBGMMo+3S7G/XJFslCc/fYpdhG7PC1FZsYylV2DExnnraMNecnCbu+R3iJiGpSeJMyggTLNfsUec9qbeyejKSUoybr7be+L3PfvvjVcmVlAL3dPLpWJEx16wLs2g9JkYhGLuiYOspC58b8U0LrSnqH+6Ic25tDljS4x89i+LKICBciu3Hzd67W8FglczNOSUc/Zmeb0V8az7Hbl23rxTSKVE55qwESlCAWIo1xWt6iizz9z+d99RzFKbUJHbbk24d2Ad/JOKv1cNcnYvGerO9pSm7z+vRxJOM3+qXHFHClf52dnpjaaHZxX9rpuOFpSjIJkJSNZSEMmGlOV1+5eL3O/lKAuL3VdzGI6V5qSSnFGsJWbXGAFA2lJA7qygItMJ+Hjco91IkfiXzj+0bquBtRSW9OYNgxmGetZSB/iU/pQxkPRoupKXvn4s/I8LO1ZicqUIAfZFb/ZHtY3ZoXIEQaMMNqBRYXdgcWBAVMjAKGlEzkN2rk9AAAAAElFTkSuQmCC`,Oc=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////8IX9KGAAAAFnRSTlMAQI+v38+/cCD/n3/vkFAwYBCAoLBfxGozVwAAAT1JREFUeAHd1NEO2yAMheGTBhL/idtAu73/q67VFIkRAevVpH13KDkYkGX9C9NtDiEuq/3l7wunzTR2o7RrZAH8/jA70jxKnPvPWb9ZAFb1JOBZrF/AoY4Ad5UiLP0CIat0AKam+XrkpXsLh+Na9IdaMqCKQdBp/HEQyOCqHL2A/Pokj/pdR0+ywV1NK8TLFZjUlB3WukBQxxP4Wax34KGeWHZ0vtG5QdHRIZkk2x2IGrDIhwfn46WRvFPwpIHd+VNI4/P4lg4zm9Z5NDoOB2LKOlkKQLDO/75WNe/tOWAO4VAtuZve9ljlcmgUz1lv+dIjO7ipyeqAAUlfBDZY9EUgO0zfBB6dvt/DBxDezrfa2vMqUzr3jZ0TLRTOWQ1ktdjbBME+qok0uHRrOQ5o4fldQKZxQEODMwyY/h+/ADWjEK3gLf0/AAAAAElFTkSuQmCC`,kc=({title:e,color:t,price:n})=>(0,V.jsxs)(`div`,{className:`rounded-lg bg-grey-100/70 px-3 pt-1.5 pb-3`,children:[(0,V.jsx)(`div`,{className:`font-space-grotesk text-[1.5rem] font-bold`,style:{color:t},children:e}),(0,V.jsx)(`div`,{className:`-mt-1 font-space-grotesk text-[1.7rem] font-bold`,children:n}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-1.5`,children:[(0,V.jsx)(`div`,{className:`h-1.5 w-[100%] bg-grey-300/60`}),(0,V.jsx)(`div`,{className:`h-1.5 w-[70%] bg-grey-300/60`}),(0,V.jsx)(`div`,{className:`h-1.5 w-[90%] bg-grey-300/60`})]})]}),Ac=j(({keywords:e})=>{let{updateRoute:t}=P(),{settings:n}=I(),[r,i,a]=z(n,[`accent_color`,`icon`,`members_signup_access`]),o=()=>{t(`portal/edit`)},s=r||`#F6414E`;return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,disabled:a===`none`,label:`Customize`,size:`sm`,onClick:o}),description:`Customize members modal signup flow`,keywords:e,navid:`portal`,testId:`portal`,title:`Signup portal`,children:(0,V.jsxs)(`div`,{className:`relative isolate -mx-5 -mb-5 hidden flex-col items-center justify-end overflow-hidden rounded-b-xl bg-grey-50 px-5 pt-6 text-black sm:visible! sm:flex! md:-mx-7 md:-mb-7`,children:[(0,V.jsx)(`div`,{className:`absolute right-6 bottom-6 flex size-12 items-center justify-center rounded-full text-white shadow-lg`,style:{backgroundColor:s},children:(0,V.jsx)(`img`,{className:`size-6`,src:Oc})}),(0,V.jsxs)(`div`,{className:`grid w-full max-w-[440px] grid-cols-3 gap-5 rounded-t-xl bg-white px-9 py-6 shadow-xl`,children:[(0,V.jsxs)(`div`,{className:`col-span-3 mb-1 flex flex-col items-center justify-center`,children:[i?(0,V.jsx)(`div`,{className:`size-6 rounded-sm bg-cover bg-center`,style:{backgroundImage:`url(${i})`}}):(0,V.jsx)(`div`,{className:`flex aspect-square items-center justify-center overflow-hidden rounded-full p-1 text-white`,style:{backgroundColor:s},children:(0,V.jsx)(`img`,{className:`h-auto w-5`,src:Dc})}),(0,V.jsx)(`div`,{className:`mt-1.5 font-space-grotesk text-lg font-bold`,children:`Sign up`}),(0,V.jsx)(`div`,{className:`mt-1.5 flex h-6 w-1/2 items-center rounded border border-grey-200 p-2 text-sm text-grey-700`,children:`jamie@example.com`})]}),(0,V.jsx)(kc,{color:s,price:`$0`,title:`Free`}),(0,V.jsx)(kc,{color:s,price:`$5`,title:`Silver`}),(0,V.jsx)(kc,{color:s,price:`$10`,title:`Gold`})]})]})})},`Portal settings`),jc=j(({keywords:e})=>{let{localSettings:t,isEditing:n,saveState:r,handleSave:i,handleCancel:a,updateSetting:o,errors:s,clearError:c,handleEditingChange:l}=N({onValidate:()=>({})}),[u]=z(t,[`blocked_email_domains`]),d=JSON.parse(u||`[]`),[f,p]=B.useState(d.join(`
|
|
5
5
|
`)),m=e=>{let t=e.target.value;p(t);let r=t.split(/[\s,]+/).map(e=>e.trim().toLowerCase().split(`@`).pop()).filter(e=>e&&e.includes(`.`));o(`blocked_email_domains`,JSON.stringify(r)),n||l(!0)},h=(0,V.jsxs)(V.Fragment,{children:[`Prevent unwanted signups by blocking email domains. Add one domain per line, e.g., `,(0,V.jsx)(`code`,{children:`spam.xyz`}),` to block signups from email addresses like `,(0,V.jsx)(`code`,{children:`hello@spam.xyz`}),`.`]});return(0,V.jsx)(J,{description:`Protect your member signups from spam`,isEditing:n,keywords:e,navid:`spam-filters`,saveState:r,testId:`spam-filters`,title:`Spam filters`,hideEditButton:!0,onCancel:a,onEditingChange:l,onSave:i,children:(0,V.jsx)(F,{columns:1,children:(0,V.jsx)(ie,{className:`h-[86px]`,error:!!s.blockedEmailDomains,hint:s.blockedEmailDomains||h,placeholder:`spam.xyz
|
|
6
|
-
junk.com`,resize:`vertical`,title:`Blocked email domains`,value:f,onChange:m,onKeyDown:()=>c(`spam-filters`)})})})},`Spam Filters`),Mc=D(`group/tiercard flex cursor-pointer flex-col items-start justify-between gap-4 self-stretch rounded-sm border border-transparent bg-grey-100 p-4 transition-all hover:border-grey-100 hover:bg-grey-50 hover:shadow-sm min-[900px]:min-h-[200px] dark:bg-grey-950 dark:hover:border-grey-800`),Nc=({tier:e})=>{let{updateRoute:t}=P(),n=e?.currency||`USD`,r=n?mt(n):`$`;return(0,V.jsx)(`div`,{className:Mc,"data-testid":`tier-card`,"data-tier":e.slug,children:(0,V.jsxs)(`div`,{className:`w-full grow`,onClick:()=>{t({route:`tiers/${e.id}`})},children:[(0,V.jsx)(`div`,{className:`text-[1.65rem] leading-tight font-bold tracking-tight text-black dark:text-white`,children:e.name}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-baseline`,children:[(0,V.jsx)(`span`,{className:`ml-1 translate-y-[-3px] text-md font-bold uppercase`,children:r}),(0,V.jsx)(`span`,{className:`text-xl font-bold tracking-tighter`,children:le(Xe(e.monthly_price||0))}),e.monthly_price&&e.monthly_price>0&&(0,V.jsx)(`span`,{className:`text-grey-700`,children:`/month`})]}),e.trial_days?(0,V.jsx)(`div`,{className:`mt-1 mb-4`,children:(0,V.jsx)(nt,{size:`sm`,trialDays:e.trial_days})}):``,(0,V.jsx)(`div`,{className:`mt-2 line-clamp-2 text-[1.4rem] font-medium`,children:e.description||(0,V.jsx)(`span`,{className:`opacity-30`,children:`No description`})})]})})},Pc=({tab:e,tiers:t})=>{let{updateRoute:n}=P(),r=()=>{n(`tiers/add`)};return t.length?(0,V.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 min-[900px]:grid-cols-3`,children:[t.map(e=>(0,V.jsx)(Nc,{tier:e},e.id)),e===`active-tiers`&&(0,V.jsx)(`button`,{className:`${Mc} group cursor-pointer`,type:`button`,onClick:()=>{r()},children:(0,V.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center`,children:[(0,V.jsx)(`div`,{className:`translate-y-[15px] transition-all group-hover:translate-y-0`,children:(0,V.jsx)(l,{colorClass:`text-green`,name:`add`})}),(0,V.jsx)(`div`,{className:`mt-2 translate-y-[-10px] font-semibold text-green opacity-0 transition-all group-hover:translate-y-0 group-hover:opacity-100`,children:`Add tier`})]})})})]}):(0,V.jsxs)(oe,{icon:`money-bags`,children:[`No `,e===`active-tiers`?`active`:`archived`,` tiers found.`]})},Fc=({className:e,onClick:t})=>(e=D(`group flex shrink-0 items-center justify-center rounded border border-grey-300 px-3 py-1.5 font-semibold whitespace-nowrap text-grey-900 transition-all hover:border-grey-500 dark:border-grey-900 dark:text-white`,e),(0,V.jsxs)(`button`,{className:e,"data-testid":`stripe-connected`,type:`button`,onClick:t,children:[(0,V.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-green transition-all group-hover:bg-[#625BF6]`}),(0,V.jsx)(`span`,{className:`ml-2`,children:`Connected to Stripe`})]})),Ic=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`active-tiers`),{settings:r,config:i}=I(),{data:{tiers:a,meta:o,isEnd:s}={},fetchNextPage:c}=cr(),l=dr(a||[]),u=lr(a||[]),{updateRoute:d}=P(),f=Se(),p=async()=>{if(f?.isDisabled(`limitStripeConnect`)&&!$n(r,i))try{await f.errorIfWouldGoOverLimit(`limitStripeConnect`)}catch(e){if(e instanceof he){w.show(ye,{prompt:e.message||`Your current plan doesn't support Stripe Connect.`,onOk:()=>d({route:`/pro`,isExternal:!0})});return}}d(`stripe-connect`)},m=e=>[...e].sort((e,t)=>(e.monthly_price??0)-(t.monthly_price??0)),h=[{id:`active-tiers`,title:`Active`,contents:(0,V.jsx)(Pc,{tab:`active-tiers`,tiers:m(l)})},{id:`archived-tiers`,title:`Archived`,contents:(0,V.jsx)(Pc,{tab:`archive-tiers`,tiers:m(u)})}],g;return g=$n(r,i)?(0,V.jsx)(Ze,{selectedTab:t,tabs:h,onTabChange:n}):(0,V.jsx)(Pc,{tab:`free-tier`,tiers:l.filter(e=>e.type===`free`)}),(0,V.jsxs)(J,{customButtons:$n(r,i)?(0,V.jsx)(Fc,{className:`hidden tablet:!visible tablet:!block`,onClick:p}):(0,V.jsx)($e,{className:`hidden tablet:!visible tablet:!block`,onClick:p}),description:`Set prices and paid member sign up settings`,keywords:e,navid:`tiers`,testId:`tiers`,title:`Tiers`,children:[(0,V.jsx)(`div`,{className:`w-full tablet:hidden`,children:$n(r,i)?(0,V.jsx)(Fc,{className:`w-full`,onClick:p}):(0,V.jsx)($e,{onClick:p})}),g,s===!1&&(0,V.jsx)(L,{label:`Load more (showing ${a?.length||0}/${o?.pagination.total||0} tiers)`,link:!0,onClick:()=>c()})]})},`Tiers`),Lc=1e4,Rc=j(({keywords:e})=>{let{localSettings:t,siteData:n,updateSetting:r,saveState:i,handleSave:a,handleCancel:o,focusRef:s,errors:c,validate:l,clearError:u,handleEditingChange:d}=N({onValidate:()=>({donationsSuggestedAmount:Be(m,f,{maxAmount:Lc})})}),[f=`USD`,p=`500`]=z(t,[`donations_currency`,`donations_suggested_amount`]),m=parseInt(p),h=`${n?.url.replace(/\/$/,``)}/#/portal/support`;(0,B.useEffect)(()=>{l()},[f]);let[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1);(0,B.useEffect)(()=>{t.some(e=>e.dirty)&&!v&&(y(!0),d(!0))},[t,v,d]);let b=()=>{navigator.clipboard.writeText(h),_(!0),setTimeout(()=>_(!1),2e3)},x=()=>{Ye(i===`unsaved`,()=>window.open(h,`_blank`))},S=(e,t)=>{r(e,t)};return(0,V.jsxs)(J,{description:`Give your audience a simple way to support your work with one-time payments.`,isEditing:v,keywords:e,navid:`tips-and-donations`,saveState:i,testId:`tips-and-donations`,title:`Tips & donations`,hideEditButton:!0,onCancel:()=>{o(),y(!1)},onEditingChange:y,onSave:async()=>{await a()&&y(!1)},children:[(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(`div`,{className:`flex max-w-[180px] items-end gap-[.6rem]`,children:(0,V.jsx)(xe,{error:!!c.donationsSuggestedAmount,hint:c.donationsSuggestedAmount,inputRef:s,placeholder:`5`,rightPlaceholder:(0,V.jsx)(De,{border:!1,clearBg:!0,containerClassName:`w-14`,fullWidth:!1,options:Re(),selectedOption:Re().flatMap(e=>e.options).find(e=>e.value===f),title:`Currency`,hideTitle:!0,isSearchable:!0,onSelect:e=>S(`donations_currency`,e?.value||`USD`)}),title:`Suggested amount`,valueInCents:parseInt(p),onBlur:l,onChange:e=>S(`donations_suggested_amount`,e.toString()),onKeyDown:()=>u(`donationsSuggestedAmount`)},p)}),(0,V.jsxs)(`div`,{className:`w-100`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsx)(T,{level:6,children:`Shareable link`})}),(0,V.jsxs)(`div`,{className:`group relative mt-0 flex w-100 items-center justify-between overflow-hidden border-b border-transparent pt-1 pb-2 hover:border-grey-300 dark:hover:border-grey-600`,children:[(0,V.jsx)(`span`,{"data-testid":`donate-url`,children:h}),(0,V.jsxs)(`div`,{className:`invisible flex gap-1 bg-white pl-1 group-hover:visible dark:bg-black`,children:[(0,V.jsx)(L,{color:`clear`,"data-testid":`preview-shareable-link`,label:`Preview`,size:`sm`,onClick:x}),(0,V.jsx)(L,{color:`light-grey`,"data-testid":`copy-shareable-link`,label:g?`Copied`:`Copy link`,size:`sm`,onClick:b})]})]})]})]}),(0,V.jsxs)(`div`,{className:`items-center-mt-1 flex`,children:[`All tips and donations are subject to Stripe's `,(0,V.jsx)(`a`,{className:`ml-1 font-medium text-green`,href:`https://ghost.org/help/tips-donations/`,rel:`noopener noreferrer`,target:`_blank`,children:` tipping policy`}),`.`]})]})},`Tips & donations`),Q={access:[`membership`,`default`,`access`,`subscription`,`post`,`membership`,`comments`,`commenting`,`signup`,`sign up`,`spam`,`filters`,`prevention`,`prevent`,`block`,`domains`,`email`,`password protection`,`lock site`,`private site`,`private site mode`,`make this site private`],tiers:[`membership`,`tiers`,`payment`,`paid`,`stripe`],portal:[`membership`,`portal`,`signup`,`sign up`,`signin`,`sign in`,`login`,`account`,`membership`,`support`,`email`,`address`,`support email address`,`support address`],giftSubscriptions:[`membership`,`gift`,`gifts`,`gift subscriptions`,`present`,`share`,`shareable link`],memberEmails:[`membership`,`signup`,`welcome email`,`welcome emails`,`email`,`new user`,`new member`,`account`],tips:[`membership`,`tips`,`donations`,`one time`,`payment`]},zc=()=>{let{config:e,settings:t}=I(),[n,r]=z(t,[`donations_enabled`,`paid_members_enabled`]),i=$n(t||[],e||{}),a=fe(`automations`);return(0,V.jsxs)(Ea,{keywords:[Q.access,Q.tiers,Q.portal,...r?[Q.giftSubscriptions]:[],...a?[]:[Q.memberEmails],...n&&i?[Q.tips]:[]].flat(),title:`Membership`,children:[(0,V.jsx)(oc,{keywords:Q.access}),(0,V.jsx)(jc,{keywords:Q.access}),(0,V.jsx)(Ic,{keywords:Q.tiers}),(0,V.jsx)(Ac,{keywords:Q.portal}),r&&(0,V.jsx)(sc,{keywords:Q.giftSubscriptions}),!a&&(0,V.jsx)(Ec,{keywords:Q.memberEmails}),n&&i&&(0,V.jsx)(Rc,{keywords:Q.tips})]})},Bc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`announcement-bar/edit`)}}),description:`Highlight important updates or offers`,keywords:e,navid:`announcement-bar`,testId:`announcement-bar`,title:`Announcement bar`})},`Announcement bar`),Vc=j(({keywords:e})=>{let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),{checkThemeLimitError:a}=xt(),{route:o,updateRoute:s}=P(),{data:l}=On(),u=l?.themes.find(e=>e.active);(0,B.useEffect)(()=>{(async()=>{i(!0);let e=await a();n(e),i(!1)})()},[a]);let d=async()=>{r||(t?w.show(ye,{prompt:t,onOk:()=>s({route:`/pro`,isExternal:!0})}):s(`design/change-theme`))},f=(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(T,{grey:!1,level:6,children:`Active theme`}),(0,V.jsxs)(`div`,{className:`mt-1 flex w-full items-center justify-between gap-4`,children:[(0,V.jsx)(`div`,{children:u?`${u.name} (v${u.package?.version||`1.0`})`:`Loading...`}),(0,V.jsx)(`div`,{className:`-mr-3`,children:(0,V.jsx)(vt,{items:[{id:`edit-code`,label:`Edit code`,onClick:async()=>{if(!u)return;let e=await a(`.`);if(e){w.show(ye,{prompt:e,onOk:()=>s({route:`/pro`,isExternal:!0})});return}s(`theme/edit/${encodeURIComponent(u.name)}?from=${encodeURIComponent(o??``)}`)}},{id:`download`,label:`Download`,onClick:()=>{if(!u)return;let{apiRoot:e}=c();h(`${e}/themes/${u.name}/download`)}}],position:`end`,triggerButtonProps:{disabled:!u,iconColorClass:`text-base`,size:`sm`}})})]})]})});return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Change theme`,size:`sm`,onClick:d}),description:`Browse and install official themes or upload one`,keywords:e,navid:`theme`,testId:`theme`,title:`Theme`,children:f})},`Branding and design`),Hc=``+new URL(`design-settings-R1OjGW68.png`,import.meta.url).href,Uc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`design/edit`)}}),description:`Customize the style and layout of your site`,keywords:e,navid:`design`,testId:`design`,title:`Design & branding`,children:(0,V.jsx)(`img`,{src:Hc})})},`Branding and design`),Wc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`navigation/edit`)}}),description:`Set up primary and secondary menus`,keywords:e,navid:`navigation`,testId:`navigation`,title:`Navigation`})},`Navigation`),Gc={design:[`site`,`logo`,`cover`,`colors`,`fonts`,`background`,`themes`,`appearance`,`style`,`design & branding`,`design and branding`],theme:[`theme`,`template`,`upload`],navigation:[`site`,`navigation`,`menus`,`primary`,`secondary`,`links`],announcementBar:[`site`,`announcement bar`,`important`,`banner`]},Kc=()=>(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(Ea,{keywords:Object.values(Gc).flat(),title:`Site`,children:[(0,V.jsx)(Uc,{keywords:Gc.design}),(0,V.jsx)(Vc,{keywords:Gc.theme}),(0,V.jsx)(Wc,{keywords:Gc.navigation}),(0,V.jsx)(Bc,{keywords:Gc.announcementBar})]})}),qc=()=>{let e=fe(`automations`);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`mb-[60vh] px-8 pt-16 tablet:max-w-[760px] tablet:px-14 tablet:pt-0`,children:[(0,V.jsx)(Hs,{}),(0,V.jsx)(Kc,{}),(0,V.jsx)(zc,{}),e?(0,V.jsx)(vs,{}):(0,V.jsx)(Ha,{}),(0,V.jsx)(tc,{}),(0,V.jsx)(Da,{})]})})},$=({keywords:e,navid:t,...n})=>{let{ref:r,props:i}=ut(t),{currentSection:a}=it(),{checkVisible:o}=ot();return(0,V.jsx)(yr,{ref:r,isCurrent:(Array.isArray(t)?t:[t]).includes(a||``),isVisible:o(e),navid:Array.isArray(t)?t[0]:t,...i,...n})},Jc=()=>(0,V.jsxs)(In,{className:`gap-1 border-transparent bg-orange-100 px-1.5 py-0 text-[11px] leading-5 font-semibold text-orange-700 shadow-[0_0_0_1px_rgba(255,255,255,0.55)] dark:bg-orange-500/20 dark:text-orange-300 dark:shadow-[0_0_0_1px_rgba(255,255,255,0.12)]`,variant:`secondary`,children:[(0,V.jsx)(an,{className:`size-3`,strokeWidth:2.25}),`Private`]}),Yc=()=>{let{filter:e,setFilter:t,checkVisible:n,noResult:r,setNoResult:i}=ot(),{updateRoute:a}=P(),o=(0,B.useRef)(null),{isAnyTextFieldFocused:s}=b(),{settings:c,config:u}=I(),[d,f,p,m]=z(c,[`donations_enabled`,`is_private`,`paid_members_enabled`,`editor_default_email_recipients`]),h=$n(c||[],u||{}),g=fe(`automations`),_=m!==`disabled`,v=!!u.mailgunIsConfigured,y=_&&!v,x=B.useMemo(()=>[Q.access,Q.tiers,Q.portal,...p?[Q.giftSubscriptions]:[],...g?[]:[Q.memberEmails],...d&&h?[Q.tips]:[]].flat(),[h,d,p,g]),S=B.useMemo(()=>{let e=g?ms:Va;return[e.enableNewsletters,..._?[e.defaultRecipients]:[],...g?[ms.emails]:_?[Va.newsletters]:[],...y?[e.mailgun]:[]].flat()},[g,_,y]),C=B.useMemo(()=>[Z.network,Z.explore,Z.recommendations,Z.embedSignupForm,...h?[Z.offers]:[]].flat(),[h]);(0,B.useEffect)(()=>{let e=e=>{e.target instanceof HTMLElement&&(e.target.nodeName===`INPUT`||e.target.nodeName===`TEXTAREA`||e.target.isContentEditable)||e.key===`/`&&!s&&(e?.preventDefault(),o.current&&o.current.focus())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}}),(0,B.useEffect)(()=>{o.current&&o.current.focus()},[]),(0,B.useEffect)(()=>{!n(Object.values(X).flat())&&!n(Object.values(Gc).flat())&&!n([...x,...S])&&!n(C)&&!n(Object.values(Y).flat())?i(!0):i(!1)},[n,i,e,S,x,C]),(0,B.useEffect)(()=>{let t=o.current,n=t=>{t.key===`Escape`&&e&&(o.current?.blur(),t.stopPropagation())};return t?.addEventListener(`keydown`,n),()=>{t?.removeEventListener(`keydown`,n)}},[e]);let w=e=>{e&&(t(``),i(!1),a(e.currentTarget.id))},ee=e=>{t(e.target.value),e.target.value&&document.querySelector(`.admin-x-settings`)?.scrollTo({top:0,left:0})},T=D(`hidden pt-10 tablet:visible! tablet:block!`);return(0,V.jsxs)(`div`,{className:`ml-auto flex w-full flex-col pt-0 tablet:max-w-[240px]`,"data-testid":`sidebar`,children:[(0,V.jsx)(`div`,{className:`sticky top-0 flex content-stretch items-end tablet:h-20 tablet:bg-grey-50 xl:h-20 dark:bg-grey-950 dark:tablet:bg-[#101114]`,children:(0,V.jsxs)(`div`,{className:`relative w-full`,children:[(0,V.jsx)(l,{className:`absolute top-2.5 left-3 z-10`,colorClass:`text-grey-500`,name:`magnifying-glass`,size:`sm`}),(0,V.jsx)(k,{autoComplete:`off`,autoCorrect:`off`,className:`mr-8 flex h-9 w-full items-center rounded-full border border-transparent bg-white px-[33px] py-1.5 shadow-[0_0_1px_rgba(21,23,26,0.25),0_1px_3px_rgba(0,0,0,0.03),0_8px_10px_-12px_rgba(0,0,0,.1)] transition-colors hover:shadow-sm focus:border-green focus:bg-white focus:shadow-[0_0_0_2px_rgba(48,207,67,0.25)] tablet:mr-0 dark:border-transparent dark:bg-grey-900 dark:text-white dark:placeholder:text-grey-800 dark:focus:border-green dark:focus:bg-grey-950`,containerClassName:`w-100`,inputRef:o,placeholder:`Search settings`,title:`Search`,value:e,clearBg:!0,hideTitle:!0,unstyled:!0,onChange:ee}),e?(0,V.jsx)(L,{className:`absolute top-3 right-14 p-1 tablet:right-3`,icon:`close`,iconColorClass:`text-grey-700 w-[10px]! h-[10px]!`,size:`sm`,unstyled:!0,onClick:()=>{t(``),o.current?.focus()}}):(0,V.jsx)(`div`,{className:`absolute top-[7px] -right-1/2 hidden rounded border border-grey-400 bg-white px-1.5 py-0.5 text-2xs font-semibold tracking-wider text-grey-600 uppercase shadow-[0px_1px_#CED4D9] tablet:visible! tablet:right-3 tablet:block! dark:border-grey-800 dark:bg-grey-900 dark:text-grey-500 dark:shadow-[0px_1px_#626D79]`,children:`/`})]})}),(0,V.jsxs)(`nav`,{className:T,id:`admin-x-settings-sidebar`,children:[r&&(0,V.jsxs)(`div`,{className:`ml-2 text-base text-grey-700`,children:[(0,V.jsx)(`h2`,{className:`mb-2 text-base font-semibold tracking-normal text-black dark:text-white`,children:`No result`}),(0,V.jsxs)(`div`,{children:[`We couldn't find any setting matching '${e}'`,`.`]})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(X).flat()),title:`General settings`,children:[(0,V.jsx)($,{icon:`textfield`,keywords:X.titleAndDescription,navid:`general`,title:`Title & description`,onClick:w}),(0,V.jsx)($,{icon:`world-clock`,keywords:X.timeZone,navid:`timezone`,title:`Timezone`,onClick:w}),(0,V.jsx)($,{icon:`language`,keywords:X.publicationLanguage,navid:`publication-language`,title:`Publication language`,onClick:w}),(0,V.jsx)($,{icon:`user-pen`,keywords:X.users,navid:`staff`,title:`Staff`,onClick:w}),(0,V.jsx)($,{icon:`layer`,keywords:X.metadata,navid:`metadata`,title:`Meta data`,onClick:w}),(0,V.jsx)($,{icon:`like`,keywords:X.socialAccounts,navid:`social-accounts`,title:`Social accounts`,onClick:w}),(0,V.jsx)($,{icon:`baseline-chart`,keywords:X.analytics,navid:`analytics`,title:`Analytics`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(Gc).flat()),title:`Site`,children:[(0,V.jsx)($,{icon:`palette`,keywords:Gc.design,navid:`design`,title:`Design & branding`,onClick:w}),(0,V.jsx)($,{icon:`layout-2-col`,keywords:Gc.theme,navid:`theme`,title:`Theme`,onClick:w}),(0,V.jsx)($,{icon:`navigation`,keywords:Gc.navigation,navid:`navigation`,title:`Navigation`,onClick:w}),(0,V.jsx)($,{icon:`megaphone`,keywords:Gc.announcementBar,navid:`announcement-bar`,title:`Announcement bar`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n([...x,...S]),title:`Membership`,children:[(0,V.jsx)($,{icon:`key`,keywords:Q.access,navid:[`members`,`spam-filters`],title:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:`Access`}),f&&(0,V.jsx)(Jc,{})]}),onClick:w}),(0,V.jsx)($,{icon:`bills`,keywords:Q.tiers,navid:`tiers`,title:`Tiers`,onClick:w}),(0,V.jsx)($,{icon:`portal`,keywords:Q.portal,navid:`portal`,title:`Signup portal`,onClick:w}),p&&(0,V.jsx)($,{icon:`gift`,keywords:Q.giftSubscriptions,navid:`gift-subscriptions`,title:`Gift subscriptions`,onClick:w}),!g&&(0,V.jsx)($,{icon:`mailplus`,keywords:Q.memberEmails,navid:`memberemails`,title:`Welcome emails`,onClick:w}),d&&h&&(0,V.jsx)($,{icon:`piggybank`,keywords:Q.tips,navid:`tips-and-donations`,title:`Tips & donations`,onClick:w}),g?(0,V.jsx)($,{icon:`email`,keywords:S,navid:[`enable-newsletters`,`default-recipients`,`emails`,`mailgun`],title:`Email`,onClick:w}):(0,V.jsx)($,{icon:`email`,keywords:S,navid:[`enable-newsletters`,`default-recipients`,`newsletters`,`mailgun`],title:`Newsletters`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(C),title:`Growth`,children:[(0,V.jsx)($,{icon:`ap-network`,keywords:Z.network,navid:`network`,title:`Network`,onClick:w}),(0,V.jsx)($,{icon:`globe-simple`,keywords:Z.explore,navid:`explore`,title:`Ghost Explore`,onClick:w}),(0,V.jsx)($,{icon:`heart`,keywords:Z.recommendations,navid:`recommendations`,title:`Recommendations`,onClick:w}),(0,V.jsx)($,{icon:`emailfield`,keywords:Z.embedSignupForm,navid:`embed-signup-form`,title:`Signup forms`,onClick:w}),h&&(0,V.jsx)($,{icon:`discount`,keywords:Z.offers,navid:`offers`,title:`Offers`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(Y).flat()),title:`Advanced`,children:[(0,V.jsx)($,{icon:`modules-3`,keywords:Y.integrations,navid:`integrations`,title:`Integrations`,onClick:w}),(0,V.jsx)($,{icon:`download`,keywords:Y.migrationtools,navid:`migration`,title:`Import/Export`,onClick:w}),(0,V.jsx)($,{icon:`brackets`,keywords:Y.codeInjection,navid:`code-injection`,title:`Code injection`,onClick:w}),(0,V.jsx)($,{icon:`labs-flask`,keywords:Y.labs,navid:`labs`,title:`Labs`,onClick:w}),(0,V.jsx)($,{icon:`time-back`,keywords:Y.history,navid:`history`,title:`History`,onClick:w}),(0,V.jsx)($,{icon:`warning`,keywords:Y.dangerzone,navid:`dangerzone`,title:`Danger zone`,onClick:w})]}),!e&&(0,V.jsxs)(`a`,{className:`mt-1 mb-10 flex h-[38px] w-100 cursor-pointer items-center rounded-lg px-3 py-2 text-left text-[14px] font-medium text-grey-800 transition-all hover:bg-grey-200 focus:bg-grey-100 dark:text-grey-600 dark:hover:bg-grey-950 dark:focus:bg-grey-900`,onClick:()=>{a(`about`)},children:[(0,V.jsx)(`img`,{alt:`Ghost Logo`,className:`mr-[7px] size-[18px]`,src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAC9FBMVEUAAAB+J/tXRf9mPP99M/9bQP9XQ/9VRv9VRv9WRf9WRP9XRP9XRf9VRf9cQP9aP/9bQP9ZQf9WRf9bQf9VRf9VRf9YRP9cPv9hPf9hPf9gPf9XPf9qN/9kOv9kOv9oOP9WQv9jOv9tNf9pN/9mOv9bP/95Kv9zMP9uNf9yMP9sNP9xMf9sM/9qNv9iPv9fP/9dQP9eP/96LP94Lv9yMf9oOP9qOP9hPf9mO/9fPv+FJP+DJf95LP+DIv93Lf94Lv92L/9uNv9kPP9lO/+BJ/+MH/9/Jv+HI/+FJf+AKf9+Kv9dP/+UGv+QHf+KH/+PG/+JIv+HI/+bFP+NIP+UGf9tNf+eFP+aFf+WGP+UGv+VGf9yMv+hEv+oDP+cE/+dFP+bFf95Lf+hDf+cFv+rCf+uB/+vCP+rC/+jEP+lDv+xB/+vB/+4A/+FJf+9BPa9AP64A/6wCP+vCP+NH/+IJP+FIf+2Bv+5Av+9AP64Bv6/AP6OHv/KAPfFAPrEAPvEAPrDAPvCAPi+AP66Af7HAPjCAPzFAPnRAPLMAPbNAPbQAPXNAPfhAPPXAPPTAPTKAPSpCv/UAPTUAPPQAPbGAPerC//VAPPUAPPXAPS2BP/bAPK1BP/dAPHeAPLgAPLdAPDcHO65AP+4Av/lAPXfAPLfAPC8AP3rAfDoAPHeAPHgAPDGAPryAfDlAPHsAPLyAPLoAPDzHPP1DvHsAPHzAPPvAPLpAPL7APP6APHzAPPOAPbNAPbRAPX0APH5A/L4APPvAPPLAPb4BPP+BfPyAPL3APP5APLdAO//GfH/Ku/8CvL/Nev/L+3/Ke//HfH/EfP8BPLxAPH9O+f1APDfAPH/QOn/POr/MO3/MO7/K+/8APH4AvLjAPL/Sef/Ref/ROj/Nuz/Nez/H/D2APDuAe7mAO//SOr/Rej/Ref/Qej/Qen/POr/LO37BvL/R+j/N+v/M+z/F/H+E/L/QOj/R+f/R+f/Ner/SOr/Suf/Qej/Tej/R+axG5kdAAAA/HRSTlMABQ4SCStddYWDfGhhVU04IDWViX9vZD5vmIAZi4ZoUUYmk3RiMCJsfVg5MitItayeWY+GPrrXzam+fW5cMC670J1ea1x3HoS1xp55aYlFLK1VdJg8mUx9XqaVpGdrRJacry+MTXk1iaBFXnGRqQ9mR6ZVT7skHn5YJoO0LGleo5lYt01xxzkmZJ2EzR1flzI9smy8P7tYw6moTb01mtZuB3iWGLllQk5Jej3ANovJjmIKE2ykf3Q5W5aNr0pRhcBnKjB5d39tK1WRpXV3hrDHYUIOKzd6mn6n0XFevluglbfHZUQ0Lhdtgom2pV5WpWuIdE1HnLFTL1+QOFCCqXMxAAAELklEQVR4AYXVtZ4jRxSF8XOru5rFtMzMu2ZmptjsFzDzEzgzQ2hKzJSZmdle5mEeSSN1S2qoWtSwNP/4fr8TXsI0RARIFqKFqQEnIhBFKp1QmitI1U2QC4DsShwA0ZDAdMpEOo+bzNMjJ3TqeuAHgTbGpZGrtFpYSBRoREUwQBjmiJDCIciqsEqzLixXVUX3vNhQkDdqDhN6lI0Cr2GGLDSWjokZC2tCTidAKGPFvCdzIOqqM5iez0N1Te+QmBooW13HYyDDFe58AgnFs+Eeb+AxJgMtM6IWpwTnU90kUNF3HKL+vhIAZT3laFewRjR6F+5T5gXokBPBleSSIkl4MapU9qOJJbZ3LNu9hO2vqKyRrlVkM7iaqo4HimJEB/djiuUretwUUcb4vbgQR5vBjSAiDMUN+hAzbC5q+e5IYsOfK3YGABTgalOJGLyUrnyAmQYXh9m15bNGxWjcHgXAgKTPDZhZi94jzES7zAVa9c96aEZ+AYACdavJaglVDd4hiVnQoL6gUD+zx2ZclAGGu8j1M1VS3obEbCT+ODAISHIX0QaAgSGTZDlDk4RWfqhuKZ4nOZZKgEGL19Hg8hVItPSvg36x7Gh/RgG7j/sxK85ttEGhJjYuwS3LcAGYgXScOVDRhsRzq2HWsNVIQlWgCK2KZ9BWeHTLKvq4kAWYEh/TkElhLof16i2FFQADsmVT0TCHPB3O7fcPrAADZA6KgvbuCyNN40kNpNpEVLXKaM/2IxgC6ALjnEsLGbRXQN6EDUCyToSGZXC0t9Osb5awLzTAnjcNrc4Z2iFo6wKowdp9BhhUFboX3oc2JGKMHZTYHSShgqmKLtkWtPNao+986hhZ1rkBKvQKl3pgop19jtiteGcfOvM2MNyZMjUf6jtoicDX+KY4e9T9H2AAh5lM6vJNtCI/Zjs1fxQH8dTJQIOmSW5lPkYrf5ib5IL1R+NxnAxuTnCuNRgYWnj5oh1HL+pHXC4AoAIIbOKwPPbNpZjFJ0fZzsjm2PFz4R4ABADf0XDCsznR+Zju570Nb2GxrI3Ykj2BZoBfyA8cV5eN6s2Y5E1eiw+lvBrzt2rfaP6TE8HHC4RCx/XHnI6TyX+fXVNM9NSAktN9zb9yW+WbzIorMRHgP4U8m6gkSyuGLdv1BBBGWRzRypsruy79dQW6uh7GSSpO2oJDBnmsQGQw2+3na3a6OKc+kExtodShfy9FMeiY8XZ7qQaLqGZ15K2DWN1lDSgd/Nyuxf8EZ9GP+a47gZMYmhbM3ylr3BUyHTuyjg8uN7aWF64trvnHirA3P9a8B2GKChFc1R+BtyqyQpT6eTW+fGfux3vQpGKKGGoUDS2NSV5KHsq5FLdWlmT5fEwgzNCb7bIdv5QfskQiUjz9q1swiYoZFgD/JbhURRqIqHcLpiC09NoO/HUPpjsGm6qha0KGUP0AAAAASUVORK5CYII=`}),`About Ghost`]})]})]})},Xc=[],Zc=`:is([role="dialog"], [role="alertdialog"])[data-state="open"]`,Qc=({children:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed top-2 right-0 z-50 m-8 flex justify-end bg-transparent tablet:fixed tablet:top-0`,id:`done-button-container`,children:(0,V.jsx)(qi,{})}),(0,V.jsx)(`div`,{className:`fixed top-0 left-0 flex size-full bg-grey-50 dark:bg-grey-950 dark:tablet:bg-[#101114]`,id:`admin-x-settings-content`,children:e})]}),$c=()=>{let{currentUser:e}=I(),{loadingModal:t}=P(),{isDirty:n}=x(),r=e=>{window.location.hash=e},i=()=>document.getElementById(`modal-backdrop`)?!0:!!document.querySelector(Zc);return(0,B.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(i())return;Ye(n,()=>{r(`/`)})}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n]),(0,B.useEffect)(()=>{Ft.remove()},[]),Cn(e)?wn(e)?(0,V.jsx)(Qc,{children:(0,V.jsx)(`div`,{className:`flex-1 bg-white dark:bg-grey-950`,children:(0,V.jsx)(`div`,{className:`h-full overflow-y-auto overscroll-y-contain`,id:`admin-x-settings-scroller`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-5xl px-[5vmin] tablet:mt-16 xl:mt-10`,children:[(0,V.jsx)(T,{className:`mb-[5vmin]`,children:`Settings`}),(0,V.jsx)(Vs,{highlight:!1,keywords:Xc})]})})})}):(0,V.jsxs)(Qc,{children:[t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-40 h-[calc(100vh-55px)] w-[100vw] tablet:h-[100vh] bg-[rgba(98,109,121,0.2)] backdrop-blur-[3px]`}),(0,V.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-[35] max-w-[calc(100%-16px)] flex-1 basis-[320px] overscroll-y-contain bg-white p-8 tablet:relative tablet:inset-x-auto tablet:top-auto tablet:h-full tablet:overflow-y-scroll tablet:bg-grey-50 tablet:py-0 dark:bg-grey-950 dark:tablet:bg-[#101114]`,id:`admin-x-settings-sidebar-scroller`,children:(0,V.jsx)(`div`,{className:`relative w-full`,children:(0,V.jsx)(Yc,{})})}),(0,V.jsx)(`div`,{className:`h-full flex-1 bg-white tablet:basis-[800px] dark:bg-grey-950 dark:tablet:bg-black`,children:(0,V.jsx)(`div`,{className:`relative h-full overflow-y-scroll overscroll-y-contain pt-13`,id:`admin-x-settings-scroller`,children:(0,V.jsx)(qc,{})})})]}):null},el={"design/change-theme":`DesignAndThemeModal`,"design/edit":`DesignAndThemeModal`,"theme/install":`DesignAndThemeModal`,"theme/edit/:name":`DesignAndThemeModal`,"navigation/edit":`NavigationModal`,"staff/invite":`InviteUserModal`,"staff/:slug/social-links":`UserDetailModal`,"staff/:slug/email-notifications":`UserDetailModal`,"staff/:slug/edit":`UserDetailModal`,"staff/:slug":`UserDetailModal`,"portal/edit":`PortalModal`,"tiers/add":`TierDetailModal`,"tiers/:id":`TierDetailModal`,"stripe-connect":`StripeConnectModal`,"newsletters/new":`AddNewsletterModal`,"newsletters/:id":`NewsletterDetailModal`,"history/view":`HistoryModal`,"history/view/:user":`HistoryModal`,"integrations/contentapi":`ContentApiModal`,"integrations/zapier":`ZapierModal`,"integrations/transistor":`TransistorModal`,"integrations/slack":`SlackModal`,"integrations/unsplash":`UnsplashModal`,"integrations/firstpromoter":`FirstPromoterModal`,"integrations/pintura":`PinturaModal`,"integrations/new":`AddIntegrationModal`,"integrations/:id":`CustomIntegrationModal`,"recommendations/add":`AddRecommendationModal`,"recommendations/edit":`EditRecommendationModal`,"announcement-bar/edit":`AnnouncementBarModal`,"embed-signup-form/show":`EmbedSignupFormModal`,"offers/edit":`OffersContainerModal`,"offers/edit/:id":`OffersContainerModal`,"offers/edit/retention/:id":`OffersContainerModal`,"offers/new":`OffersContainerModal`,"explore/testimonial":`TestimonialsModal`,about:`AboutModal`},tl=()=>Pt(()=>import(`./modals-Bu-1Uxdc.js`),__vite__mapDeps([30,1,2,8,9,3,10,5,6,11,12,4,7,13,14,15,16,17,18,19,20,21,22,23,24,25,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url),nl=()=>{let{updateNavigatedSection:e,scrollToSection:t}=it(),{route:n,updateRoute:r}=P();return He((e,n)=>{e===n&&t(e.split(`/`)[0])},[t]),(0,B.useEffect)(()=>{if(n!==void 0){if(n.split(`/`)[0]===`locksite`){r(`members`);return}e(n.split(`/`)[0])}},[n,e,r]),null};function rl({designSystem:e,upgradeStatus:t}){return(0,V.jsx)(Oe,{upgradeStatus:t,children:(0,V.jsx)(w.Provider,{children:(0,V.jsx)(ht,{basePath:`settings`,modals:{paths:el,load:tl},children:(0,V.jsxs)(Sr,{className:`admin-x-settings`,...e,children:[(0,V.jsx)(nl,{}),(0,V.jsx)($c,{})]})})})})}var il=e(n(),1);async function al(){return await Pt(()=>import(`./koenig-lexical-D09TwwLs.js`),__vite__mapDeps([46,1,2,8,3,16,7,9,10,5,6,11,12,13,14,15,17,18,19,20,21,22,23]),import.meta.url)}function ol(){return(0,il.createPortal)((0,V.jsx)(`div`,{className:`shade shade-admin`,style:{position:`absolute`,inset:0,zIndex:20},children:(0,V.jsx)(rl,{designSystem:{darkMode:!1,fetchKoenigLexical:al}})}),document.body)}export{ol as default};
|
|
6
|
+
junk.com`,resize:`vertical`,title:`Blocked email domains`,value:f,onChange:m,onKeyDown:()=>c(`spam-filters`)})})})},`Spam Filters`),Mc=D(`group/tiercard flex cursor-pointer flex-col items-start justify-between gap-4 self-stretch rounded-sm border border-transparent bg-grey-100 p-4 transition-all hover:border-grey-100 hover:bg-grey-50 hover:shadow-sm min-[900px]:min-h-[200px] dark:bg-grey-950 dark:hover:border-grey-800`),Nc=({tier:e})=>{let{updateRoute:t}=P(),n=e?.currency||`USD`,r=n?mt(n):`$`;return(0,V.jsx)(`div`,{className:Mc,"data-testid":`tier-card`,"data-tier":e.slug,children:(0,V.jsxs)(`div`,{className:`w-full grow`,onClick:()=>{t({route:`tiers/${e.id}`})},children:[(0,V.jsx)(`div`,{className:`text-[1.65rem] leading-tight font-bold tracking-tight text-black dark:text-white`,children:e.name}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-baseline`,children:[(0,V.jsx)(`span`,{className:`ml-1 translate-y-[-3px] text-md font-bold uppercase`,children:r}),(0,V.jsx)(`span`,{className:`text-xl font-bold tracking-tighter`,children:le(Xe(e.monthly_price||0))}),e.monthly_price&&e.monthly_price>0&&(0,V.jsx)(`span`,{className:`text-grey-700`,children:`/month`})]}),e.trial_days?(0,V.jsx)(`div`,{className:`mt-1 mb-4`,children:(0,V.jsx)(nt,{size:`sm`,trialDays:e.trial_days})}):``,(0,V.jsx)(`div`,{className:`mt-2 line-clamp-2 text-[1.4rem] font-medium`,children:e.description||(0,V.jsx)(`span`,{className:`opacity-30`,children:`No description`})})]})})},Pc=({tab:e,tiers:t})=>{let{updateRoute:n}=P(),r=()=>{n(`tiers/add`)};return t.length?(0,V.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 min-[900px]:grid-cols-3`,children:[t.map(e=>(0,V.jsx)(Nc,{tier:e},e.id)),e===`active-tiers`&&(0,V.jsx)(`button`,{className:`${Mc} group cursor-pointer`,type:`button`,onClick:()=>{r()},children:(0,V.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center`,children:[(0,V.jsx)(`div`,{className:`translate-y-[15px] transition-all group-hover:translate-y-0`,children:(0,V.jsx)(l,{colorClass:`text-green`,name:`add`})}),(0,V.jsx)(`div`,{className:`mt-2 translate-y-[-10px] font-semibold text-green opacity-0 transition-all group-hover:translate-y-0 group-hover:opacity-100`,children:`Add tier`})]})})})]}):(0,V.jsxs)(oe,{icon:`money-bags`,children:[`No `,e===`active-tiers`?`active`:`archived`,` tiers found.`]})},Fc=({className:e,onClick:t})=>(e=D(`group flex shrink-0 items-center justify-center rounded border border-grey-300 px-3 py-1.5 font-semibold whitespace-nowrap text-grey-900 transition-all hover:border-grey-500 dark:border-grey-900 dark:text-white`,e),(0,V.jsxs)(`button`,{className:e,"data-testid":`stripe-connected`,type:`button`,onClick:t,children:[(0,V.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-green transition-all group-hover:bg-[#625BF6]`}),(0,V.jsx)(`span`,{className:`ml-2`,children:`Connected to Stripe`})]})),Ic=j(({keywords:e})=>{let[t,n]=(0,B.useState)(`active-tiers`),{settings:r,config:i}=I(),{data:{tiers:a,meta:o,isEnd:s}={},fetchNextPage:c}=cr(),l=dr(a||[]),u=lr(a||[]),{updateRoute:d}=P(),f=Se(),p=async()=>{if(f?.isDisabled(`limitStripeConnect`)&&!Xn(r,i))try{await f.errorIfWouldGoOverLimit(`limitStripeConnect`)}catch(e){if(e instanceof he){w.show(ye,{prompt:e.message||`Your current plan doesn't support Stripe Connect.`,onOk:()=>d({route:`/pro`,isExternal:!0})});return}}d(`stripe-connect`)},m=e=>[...e].sort((e,t)=>(e.monthly_price??0)-(t.monthly_price??0)),h=[{id:`active-tiers`,title:`Active`,contents:(0,V.jsx)(Pc,{tab:`active-tiers`,tiers:m(l)})},{id:`archived-tiers`,title:`Archived`,contents:(0,V.jsx)(Pc,{tab:`archive-tiers`,tiers:m(u)})}],g;return g=Xn(r,i)?(0,V.jsx)(Ze,{selectedTab:t,tabs:h,onTabChange:n}):(0,V.jsx)(Pc,{tab:`free-tier`,tiers:l.filter(e=>e.type===`free`)}),(0,V.jsxs)(J,{customButtons:Xn(r,i)?(0,V.jsx)(Fc,{className:`hidden tablet:!visible tablet:!block`,onClick:p}):(0,V.jsx)($e,{className:`hidden tablet:!visible tablet:!block`,onClick:p}),description:`Set prices and paid member sign up settings`,keywords:e,navid:`tiers`,testId:`tiers`,title:`Tiers`,children:[(0,V.jsx)(`div`,{className:`w-full tablet:hidden`,children:Xn(r,i)?(0,V.jsx)(Fc,{className:`w-full`,onClick:p}):(0,V.jsx)($e,{onClick:p})}),g,s===!1&&(0,V.jsx)(L,{label:`Load more (showing ${a?.length||0}/${o?.pagination.total||0} tiers)`,link:!0,onClick:()=>c()})]})},`Tiers`),Lc=1e4,Rc=j(({keywords:e})=>{let{localSettings:t,siteData:n,updateSetting:r,saveState:i,handleSave:a,handleCancel:o,focusRef:s,errors:c,validate:l,clearError:u,handleEditingChange:d}=N({onValidate:()=>({donationsSuggestedAmount:Be(m,f,{maxAmount:Lc})})}),[f=`USD`,p=`500`]=z(t,[`donations_currency`,`donations_suggested_amount`]),m=parseInt(p),h=`${n?.url.replace(/\/$/,``)}/#/portal/support`;(0,B.useEffect)(()=>{l()},[f]);let[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1);(0,B.useEffect)(()=>{t.some(e=>e.dirty)&&!v&&(y(!0),d(!0))},[t,v,d]);let b=()=>{navigator.clipboard.writeText(h),_(!0),setTimeout(()=>_(!1),2e3)},x=()=>{Ye(i===`unsaved`,()=>window.open(h,`_blank`))},S=(e,t)=>{r(e,t)};return(0,V.jsxs)(J,{description:`Give your audience a simple way to support your work with one-time payments.`,isEditing:v,keywords:e,navid:`tips-and-donations`,saveState:i,testId:`tips-and-donations`,title:`Tips & donations`,hideEditButton:!0,onCancel:()=>{o(),y(!1)},onEditingChange:y,onSave:async()=>{await a()&&y(!1)},children:[(0,V.jsxs)(F,{columns:1,children:[(0,V.jsx)(`div`,{className:`flex max-w-[180px] items-end gap-[.6rem]`,children:(0,V.jsx)(xe,{error:!!c.donationsSuggestedAmount,hint:c.donationsSuggestedAmount,inputRef:s,placeholder:`5`,rightPlaceholder:(0,V.jsx)(De,{border:!1,clearBg:!0,containerClassName:`w-14`,fullWidth:!1,options:Re(),selectedOption:Re().flatMap(e=>e.options).find(e=>e.value===f),title:`Currency`,hideTitle:!0,isSearchable:!0,onSelect:e=>S(`donations_currency`,e?.value||`USD`)}),title:`Suggested amount`,valueInCents:parseInt(p),onBlur:l,onChange:e=>S(`donations_suggested_amount`,e.toString()),onKeyDown:()=>u(`donationsSuggestedAmount`)},p)}),(0,V.jsxs)(`div`,{className:`w-100`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsx)(T,{level:6,children:`Shareable link`})}),(0,V.jsxs)(`div`,{className:`group relative mt-0 flex w-100 items-center justify-between overflow-hidden border-b border-transparent pt-1 pb-2 hover:border-grey-300 dark:hover:border-grey-600`,children:[(0,V.jsx)(`span`,{"data-testid":`donate-url`,children:h}),(0,V.jsxs)(`div`,{className:`invisible flex gap-1 bg-white pl-1 group-hover:visible dark:bg-black`,children:[(0,V.jsx)(L,{color:`clear`,"data-testid":`preview-shareable-link`,label:`Preview`,size:`sm`,onClick:x}),(0,V.jsx)(L,{color:`light-grey`,"data-testid":`copy-shareable-link`,label:g?`Copied`:`Copy link`,size:`sm`,onClick:b})]})]})]})]}),(0,V.jsxs)(`div`,{className:`items-center-mt-1 flex`,children:[`All tips and donations are subject to Stripe's `,(0,V.jsx)(`a`,{className:`ml-1 font-medium text-green`,href:`https://ghost.org/help/tips-donations/`,rel:`noopener noreferrer`,target:`_blank`,children:` tipping policy`}),`.`]})]})},`Tips & donations`),Q={access:[`membership`,`default`,`access`,`subscription`,`post`,`membership`,`comments`,`commenting`,`signup`,`sign up`,`spam`,`filters`,`prevention`,`prevent`,`block`,`domains`,`email`,`password protection`,`lock site`,`private site`,`private site mode`,`make this site private`],tiers:[`membership`,`tiers`,`payment`,`paid`,`stripe`],portal:[`membership`,`portal`,`signup`,`sign up`,`signin`,`sign in`,`login`,`account`,`membership`,`support`,`email`,`address`,`support email address`,`support address`],giftSubscriptions:[`membership`,`gift`,`gifts`,`gift subscriptions`,`present`,`share`,`shareable link`],memberEmails:[`membership`,`signup`,`welcome email`,`welcome emails`,`email`,`new user`,`new member`,`account`],tips:[`membership`,`tips`,`donations`,`one time`,`payment`]},zc=()=>{let{config:e,settings:t}=I(),[n,r]=z(t,[`donations_enabled`,`paid_members_enabled`]),i=Xn(t||[],e||{}),a=fe(`automations`);return(0,V.jsxs)(Ea,{keywords:[Q.access,Q.tiers,Q.portal,...r?[Q.giftSubscriptions]:[],...a?[]:[Q.memberEmails],...n&&i?[Q.tips]:[]].flat(),title:`Membership`,children:[(0,V.jsx)(oc,{keywords:Q.access}),(0,V.jsx)(jc,{keywords:Q.access}),(0,V.jsx)(Ic,{keywords:Q.tiers}),(0,V.jsx)(Ac,{keywords:Q.portal}),r&&(0,V.jsx)(sc,{keywords:Q.giftSubscriptions}),!a&&(0,V.jsx)(Ec,{keywords:Q.memberEmails}),n&&i&&(0,V.jsx)(Rc,{keywords:Q.tips})]})},Bc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`announcement-bar/edit`)}}),description:`Highlight important updates or offers`,keywords:e,navid:`announcement-bar`,testId:`announcement-bar`,title:`Announcement bar`})},`Announcement bar`),Vc=j(({keywords:e})=>{let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),{checkThemeLimitError:a}=xt(),{route:o,updateRoute:s}=P(),{data:l}=zn(),u=l?.themes.find(e=>e.active);(0,B.useEffect)(()=>{(async()=>{i(!0);let e=await a();n(e),i(!1)})()},[a]);let d=async()=>{r||(t?w.show(ye,{prompt:t,onOk:()=>s({route:`/pro`,isExternal:!0})}):s(`design/change-theme`))},f=(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(T,{grey:!1,level:6,children:`Active theme`}),(0,V.jsxs)(`div`,{className:`mt-1 flex w-full items-center justify-between gap-4`,children:[(0,V.jsx)(`div`,{children:u?`${u.name} (v${u.package?.version||`1.0`})`:`Loading...`}),(0,V.jsx)(`div`,{className:`-mr-3`,children:(0,V.jsx)(vt,{items:[{id:`edit-code`,label:`Edit code`,onClick:async()=>{if(!u)return;let e=await a(`.`);if(e){w.show(ye,{prompt:e,onOk:()=>s({route:`/pro`,isExternal:!0})});return}s(`theme/edit/${encodeURIComponent(u.name)}?from=${encodeURIComponent(o??``)}`)}},{id:`download`,label:`Download`,onClick:()=>{if(!u)return;let{apiRoot:e}=c();h(`${e}/themes/${u.name}/download`)}}],position:`end`,triggerButtonProps:{disabled:!u,iconColorClass:`text-base`,size:`sm`}})})]})]})});return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Change theme`,size:`sm`,onClick:d}),description:`Browse and install official themes or upload one`,keywords:e,navid:`theme`,testId:`theme`,title:`Theme`,children:f})},`Branding and design`),Hc=``+new URL(`design-settings-R1OjGW68.png`,import.meta.url).href,Uc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`design/edit`)}}),description:`Customize the style and layout of your site`,keywords:e,navid:`design`,testId:`design`,title:`Design & branding`,children:(0,V.jsx)(`img`,{src:Hc})})},`Branding and design`),Wc=j(({keywords:e})=>{let{updateRoute:t}=P();return(0,V.jsx)(J,{customButtons:(0,V.jsx)(L,{className:`mt-[-5px]`,color:`clear`,label:`Customize`,size:`sm`,onClick:()=>{t(`navigation/edit`)}}),description:`Set up primary and secondary menus`,keywords:e,navid:`navigation`,testId:`navigation`,title:`Navigation`})},`Navigation`),Gc={design:[`site`,`logo`,`cover`,`colors`,`fonts`,`background`,`themes`,`appearance`,`style`,`design & branding`,`design and branding`],theme:[`theme`,`template`,`upload`],navigation:[`site`,`navigation`,`menus`,`primary`,`secondary`,`links`],announcementBar:[`site`,`announcement bar`,`important`,`banner`]},Kc=()=>(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(Ea,{keywords:Object.values(Gc).flat(),title:`Site`,children:[(0,V.jsx)(Uc,{keywords:Gc.design}),(0,V.jsx)(Vc,{keywords:Gc.theme}),(0,V.jsx)(Wc,{keywords:Gc.navigation}),(0,V.jsx)(Bc,{keywords:Gc.announcementBar})]})}),qc=()=>{let e=fe(`automations`);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`mb-[60vh] px-8 pt-16 tablet:max-w-[760px] tablet:px-14 tablet:pt-0`,children:[(0,V.jsx)(Hs,{}),(0,V.jsx)(Kc,{}),(0,V.jsx)(zc,{}),e?(0,V.jsx)(vs,{}):(0,V.jsx)(Ha,{}),(0,V.jsx)(tc,{}),(0,V.jsx)(Da,{})]})})},$=({keywords:e,navid:t,...n})=>{let{ref:r,props:i}=ut(t),{currentSection:a}=it(),{checkVisible:o}=ot();return(0,V.jsx)(yr,{ref:r,isCurrent:(Array.isArray(t)?t:[t]).includes(a||``),isVisible:o(e),navid:Array.isArray(t)?t[0]:t,...i,...n})},Jc=()=>(0,V.jsxs)(Mn,{className:`gap-1 border-transparent bg-orange-100 px-1.5 py-0 text-[11px] leading-5 font-semibold text-orange-700 shadow-[0_0_0_1px_rgba(255,255,255,0.55)] dark:bg-orange-500/20 dark:text-orange-300 dark:shadow-[0_0_0_1px_rgba(255,255,255,0.12)]`,variant:`secondary`,children:[(0,V.jsx)(an,{className:`size-3`,strokeWidth:2.25}),`Private`]}),Yc=()=>{let{filter:e,setFilter:t,checkVisible:n,noResult:r,setNoResult:i}=ot(),{updateRoute:a}=P(),o=(0,B.useRef)(null),{isAnyTextFieldFocused:s}=b(),{settings:c,config:u}=I(),[d,f,p,m]=z(c,[`donations_enabled`,`is_private`,`paid_members_enabled`,`editor_default_email_recipients`]),h=Xn(c||[],u||{}),g=fe(`automations`),_=m!==`disabled`,v=!!u.mailgunIsConfigured,y=_&&!v,x=B.useMemo(()=>[Q.access,Q.tiers,Q.portal,...p?[Q.giftSubscriptions]:[],...g?[]:[Q.memberEmails],...d&&h?[Q.tips]:[]].flat(),[h,d,p,g]),S=B.useMemo(()=>{let e=g?ms:Va;return[e.enableNewsletters,..._?[e.defaultRecipients]:[],...g?[ms.emails]:_?[Va.newsletters]:[],...y?[e.mailgun]:[]].flat()},[g,_,y]),C=B.useMemo(()=>[Z.network,Z.explore,Z.recommendations,Z.embedSignupForm,...h?[Z.offers]:[]].flat(),[h]);(0,B.useEffect)(()=>{let e=e=>{e.target instanceof HTMLElement&&(e.target.nodeName===`INPUT`||e.target.nodeName===`TEXTAREA`||e.target.isContentEditable)||e.key===`/`&&!s&&(e?.preventDefault(),o.current&&o.current.focus())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}}),(0,B.useEffect)(()=>{o.current&&o.current.focus()},[]),(0,B.useEffect)(()=>{!n(Object.values(X).flat())&&!n(Object.values(Gc).flat())&&!n([...x,...S])&&!n(C)&&!n(Object.values(Y).flat())?i(!0):i(!1)},[n,i,e,S,x,C]),(0,B.useEffect)(()=>{let t=o.current,n=t=>{t.key===`Escape`&&e&&(o.current?.blur(),t.stopPropagation())};return t?.addEventListener(`keydown`,n),()=>{t?.removeEventListener(`keydown`,n)}},[e]);let w=e=>{e&&(t(``),i(!1),a(e.currentTarget.id))},ee=e=>{t(e.target.value),e.target.value&&document.querySelector(`.admin-x-settings`)?.scrollTo({top:0,left:0})},T=D(`hidden pt-10 tablet:visible! tablet:block!`);return(0,V.jsxs)(`div`,{className:`ml-auto flex w-full flex-col pt-0 tablet:max-w-[240px]`,"data-testid":`sidebar`,children:[(0,V.jsx)(`div`,{className:`sticky top-0 flex content-stretch items-end tablet:h-20 tablet:bg-grey-50 xl:h-20 dark:bg-grey-950 dark:tablet:bg-[#101114]`,children:(0,V.jsxs)(`div`,{className:`relative w-full`,children:[(0,V.jsx)(l,{className:`absolute top-2.5 left-3 z-10`,colorClass:`text-grey-500`,name:`magnifying-glass`,size:`sm`}),(0,V.jsx)(k,{autoComplete:`off`,autoCorrect:`off`,className:`mr-8 flex h-9 w-full items-center rounded-full border border-transparent bg-white px-[33px] py-1.5 shadow-[0_0_1px_rgba(21,23,26,0.25),0_1px_3px_rgba(0,0,0,0.03),0_8px_10px_-12px_rgba(0,0,0,.1)] transition-colors hover:shadow-sm focus:border-green focus:bg-white focus:shadow-[0_0_0_2px_rgba(48,207,67,0.25)] tablet:mr-0 dark:border-transparent dark:bg-grey-900 dark:text-white dark:placeholder:text-grey-800 dark:focus:border-green dark:focus:bg-grey-950`,containerClassName:`w-100`,inputRef:o,placeholder:`Search settings`,title:`Search`,value:e,clearBg:!0,hideTitle:!0,unstyled:!0,onChange:ee}),e?(0,V.jsx)(L,{className:`absolute top-3 right-14 p-1 tablet:right-3`,icon:`close`,iconColorClass:`text-grey-700 w-[10px]! h-[10px]!`,size:`sm`,unstyled:!0,onClick:()=>{t(``),o.current?.focus()}}):(0,V.jsx)(`div`,{className:`absolute top-[7px] -right-1/2 hidden rounded border border-grey-400 bg-white px-1.5 py-0.5 text-2xs font-semibold tracking-wider text-grey-600 uppercase shadow-[0px_1px_#CED4D9] tablet:visible! tablet:right-3 tablet:block! dark:border-grey-800 dark:bg-grey-900 dark:text-grey-500 dark:shadow-[0px_1px_#626D79]`,children:`/`})]})}),(0,V.jsxs)(`nav`,{className:T,id:`admin-x-settings-sidebar`,children:[r&&(0,V.jsxs)(`div`,{className:`ml-2 text-base text-grey-700`,children:[(0,V.jsx)(`h2`,{className:`mb-2 text-base font-semibold tracking-normal text-black dark:text-white`,children:`No result`}),(0,V.jsxs)(`div`,{children:[`We couldn't find any setting matching '${e}'`,`.`]})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(X).flat()),title:`General settings`,children:[(0,V.jsx)($,{icon:`textfield`,keywords:X.titleAndDescription,navid:`general`,title:`Title & description`,onClick:w}),(0,V.jsx)($,{icon:`world-clock`,keywords:X.timeZone,navid:`timezone`,title:`Timezone`,onClick:w}),(0,V.jsx)($,{icon:`language`,keywords:X.publicationLanguage,navid:`publication-language`,title:`Publication language`,onClick:w}),(0,V.jsx)($,{icon:`user-pen`,keywords:X.users,navid:`staff`,title:`Staff`,onClick:w}),(0,V.jsx)($,{icon:`layer`,keywords:X.metadata,navid:`metadata`,title:`Meta data`,onClick:w}),(0,V.jsx)($,{icon:`like`,keywords:X.socialAccounts,navid:`social-accounts`,title:`Social accounts`,onClick:w}),(0,V.jsx)($,{icon:`baseline-chart`,keywords:X.analytics,navid:`analytics`,title:`Analytics`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(Gc).flat()),title:`Site`,children:[(0,V.jsx)($,{icon:`palette`,keywords:Gc.design,navid:`design`,title:`Design & branding`,onClick:w}),(0,V.jsx)($,{icon:`layout-2-col`,keywords:Gc.theme,navid:`theme`,title:`Theme`,onClick:w}),(0,V.jsx)($,{icon:`navigation`,keywords:Gc.navigation,navid:`navigation`,title:`Navigation`,onClick:w}),(0,V.jsx)($,{icon:`megaphone`,keywords:Gc.announcementBar,navid:`announcement-bar`,title:`Announcement bar`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n([...x,...S]),title:`Membership`,children:[(0,V.jsx)($,{icon:`key`,keywords:Q.access,navid:[`members`,`spam-filters`],title:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:`Access`}),f&&(0,V.jsx)(Jc,{})]}),onClick:w}),(0,V.jsx)($,{icon:`bills`,keywords:Q.tiers,navid:`tiers`,title:`Tiers`,onClick:w}),(0,V.jsx)($,{icon:`portal`,keywords:Q.portal,navid:`portal`,title:`Signup portal`,onClick:w}),p&&(0,V.jsx)($,{icon:`gift`,keywords:Q.giftSubscriptions,navid:`gift-subscriptions`,title:`Gift subscriptions`,onClick:w}),!g&&(0,V.jsx)($,{icon:`mailplus`,keywords:Q.memberEmails,navid:`memberemails`,title:`Welcome emails`,onClick:w}),d&&h&&(0,V.jsx)($,{icon:`piggybank`,keywords:Q.tips,navid:`tips-and-donations`,title:`Tips & donations`,onClick:w}),g?(0,V.jsx)($,{icon:`email`,keywords:S,navid:[`enable-newsletters`,`default-recipients`,`emails`,`mailgun`],title:`Email`,onClick:w}):(0,V.jsx)($,{icon:`email`,keywords:S,navid:[`enable-newsletters`,`default-recipients`,`newsletters`,`mailgun`],title:`Newsletters`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(C),title:`Growth`,children:[(0,V.jsx)($,{icon:`ap-network`,keywords:Z.network,navid:`network`,title:`Network`,onClick:w}),(0,V.jsx)($,{icon:`globe-simple`,keywords:Z.explore,navid:`explore`,title:`Ghost Explore`,onClick:w}),(0,V.jsx)($,{icon:`heart`,keywords:Z.recommendations,navid:`recommendations`,title:`Recommendations`,onClick:w}),(0,V.jsx)($,{icon:`emailfield`,keywords:Z.embedSignupForm,navid:`embed-signup-form`,title:`Signup forms`,onClick:w}),h&&(0,V.jsx)($,{icon:`discount`,keywords:Z.offers,navid:`offers`,title:`Offers`,onClick:w})]}),(0,V.jsxs)(ft,{isVisible:n(Object.values(Y).flat()),title:`Advanced`,children:[(0,V.jsx)($,{icon:`modules-3`,keywords:Y.integrations,navid:`integrations`,title:`Integrations`,onClick:w}),(0,V.jsx)($,{icon:`download`,keywords:Y.migrationtools,navid:`migration`,title:`Import/Export`,onClick:w}),(0,V.jsx)($,{icon:`brackets`,keywords:Y.codeInjection,navid:`code-injection`,title:`Code injection`,onClick:w}),(0,V.jsx)($,{icon:`labs-flask`,keywords:Y.labs,navid:`labs`,title:`Labs`,onClick:w}),(0,V.jsx)($,{icon:`time-back`,keywords:Y.history,navid:`history`,title:`History`,onClick:w}),(0,V.jsx)($,{icon:`warning`,keywords:Y.dangerzone,navid:`dangerzone`,title:`Danger zone`,onClick:w})]}),!e&&(0,V.jsxs)(`a`,{className:`mt-1 mb-10 flex h-[38px] w-100 cursor-pointer items-center rounded-lg px-3 py-2 text-left text-[14px] font-medium text-grey-800 transition-all hover:bg-grey-200 focus:bg-grey-100 dark:text-grey-600 dark:hover:bg-grey-950 dark:focus:bg-grey-900`,onClick:()=>{a(`about`)},children:[(0,V.jsx)(`img`,{alt:`Ghost Logo`,className:`mr-[7px] size-[18px]`,src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAC9FBMVEUAAAB+J/tXRf9mPP99M/9bQP9XQ/9VRv9VRv9WRf9WRP9XRP9XRf9VRf9cQP9aP/9bQP9ZQf9WRf9bQf9VRf9VRf9YRP9cPv9hPf9hPf9gPf9XPf9qN/9kOv9kOv9oOP9WQv9jOv9tNf9pN/9mOv9bP/95Kv9zMP9uNf9yMP9sNP9xMf9sM/9qNv9iPv9fP/9dQP9eP/96LP94Lv9yMf9oOP9qOP9hPf9mO/9fPv+FJP+DJf95LP+DIv93Lf94Lv92L/9uNv9kPP9lO/+BJ/+MH/9/Jv+HI/+FJf+AKf9+Kv9dP/+UGv+QHf+KH/+PG/+JIv+HI/+bFP+NIP+UGf9tNf+eFP+aFf+WGP+UGv+VGf9yMv+hEv+oDP+cE/+dFP+bFf95Lf+hDf+cFv+rCf+uB/+vCP+rC/+jEP+lDv+xB/+vB/+4A/+FJf+9BPa9AP64A/6wCP+vCP+NH/+IJP+FIf+2Bv+5Av+9AP64Bv6/AP6OHv/KAPfFAPrEAPvEAPrDAPvCAPi+AP66Af7HAPjCAPzFAPnRAPLMAPbNAPbQAPXNAPfhAPPXAPPTAPTKAPSpCv/UAPTUAPPQAPbGAPerC//VAPPUAPPXAPS2BP/bAPK1BP/dAPHeAPLgAPLdAPDcHO65AP+4Av/lAPXfAPLfAPC8AP3rAfDoAPHeAPHgAPDGAPryAfDlAPHsAPLyAPLoAPDzHPP1DvHsAPHzAPPvAPLpAPL7APP6APHzAPPOAPbNAPbRAPX0APH5A/L4APPvAPPLAPb4BPP+BfPyAPL3APP5APLdAO//GfH/Ku/8CvL/Nev/L+3/Ke//HfH/EfP8BPLxAPH9O+f1APDfAPH/QOn/POr/MO3/MO7/K+/8APH4AvLjAPL/Sef/Ref/ROj/Nuz/Nez/H/D2APDuAe7mAO//SOr/Rej/Ref/Qej/Qen/POr/LO37BvL/R+j/N+v/M+z/F/H+E/L/QOj/R+f/R+f/Ner/SOr/Suf/Qej/Tej/R+axG5kdAAAA/HRSTlMABQ4SCStddYWDfGhhVU04IDWViX9vZD5vmIAZi4ZoUUYmk3RiMCJsfVg5MitItayeWY+GPrrXzam+fW5cMC670J1ea1x3HoS1xp55aYlFLK1VdJg8mUx9XqaVpGdrRJacry+MTXk1iaBFXnGRqQ9mR6ZVT7skHn5YJoO0LGleo5lYt01xxzkmZJ2EzR1flzI9smy8P7tYw6moTb01mtZuB3iWGLllQk5Jej3ANovJjmIKE2ykf3Q5W5aNr0pRhcBnKjB5d39tK1WRpXV3hrDHYUIOKzd6mn6n0XFevluglbfHZUQ0Lhdtgom2pV5WpWuIdE1HnLFTL1+QOFCCqXMxAAAELklEQVR4AYXVtZ4jRxSF8XOru5rFtMzMu2ZmptjsFzDzEzgzQ2hKzJSZmdle5mEeSSN1S2qoWtSwNP/4fr8TXsI0RARIFqKFqQEnIhBFKp1QmitI1U2QC4DsShwA0ZDAdMpEOo+bzNMjJ3TqeuAHgTbGpZGrtFpYSBRoREUwQBjmiJDCIciqsEqzLixXVUX3vNhQkDdqDhN6lI0Cr2GGLDSWjokZC2tCTidAKGPFvCdzIOqqM5iez0N1Te+QmBooW13HYyDDFe58AgnFs+Eeb+AxJgMtM6IWpwTnU90kUNF3HKL+vhIAZT3laFewRjR6F+5T5gXokBPBleSSIkl4MapU9qOJJbZ3LNu9hO2vqKyRrlVkM7iaqo4HimJEB/djiuUretwUUcb4vbgQR5vBjSAiDMUN+hAzbC5q+e5IYsOfK3YGABTgalOJGLyUrnyAmQYXh9m15bNGxWjcHgXAgKTPDZhZi94jzES7zAVa9c96aEZ+AYACdavJaglVDd4hiVnQoL6gUD+zx2ZclAGGu8j1M1VS3obEbCT+ODAISHIX0QaAgSGTZDlDk4RWfqhuKZ4nOZZKgEGL19Hg8hVItPSvg36x7Gh/RgG7j/sxK85ttEGhJjYuwS3LcAGYgXScOVDRhsRzq2HWsNVIQlWgCK2KZ9BWeHTLKvq4kAWYEh/TkElhLof16i2FFQADsmVT0TCHPB3O7fcPrAADZA6KgvbuCyNN40kNpNpEVLXKaM/2IxgC6ALjnEsLGbRXQN6EDUCyToSGZXC0t9Osb5awLzTAnjcNrc4Z2iFo6wKowdp9BhhUFboX3oc2JGKMHZTYHSShgqmKLtkWtPNao+986hhZ1rkBKvQKl3pgop19jtiteGcfOvM2MNyZMjUf6jtoicDX+KY4e9T9H2AAh5lM6vJNtCI/Zjs1fxQH8dTJQIOmSW5lPkYrf5ib5IL1R+NxnAxuTnCuNRgYWnj5oh1HL+pHXC4AoAIIbOKwPPbNpZjFJ0fZzsjm2PFz4R4ABADf0XDCsznR+Zju570Nb2GxrI3Ykj2BZoBfyA8cV5eN6s2Y5E1eiw+lvBrzt2rfaP6TE8HHC4RCx/XHnI6TyX+fXVNM9NSAktN9zb9yW+WbzIorMRHgP4U8m6gkSyuGLdv1BBBGWRzRypsruy79dQW6uh7GSSpO2oJDBnmsQGQw2+3na3a6OKc+kExtodShfy9FMeiY8XZ7qQaLqGZ15K2DWN1lDSgd/Nyuxf8EZ9GP+a47gZMYmhbM3ylr3BUyHTuyjg8uN7aWF64trvnHirA3P9a8B2GKChFc1R+BtyqyQpT6eTW+fGfux3vQpGKKGGoUDS2NSV5KHsq5FLdWlmT5fEwgzNCb7bIdv5QfskQiUjz9q1swiYoZFgD/JbhURRqIqHcLpiC09NoO/HUPpjsGm6qha0KGUP0AAAAASUVORK5CYII=`}),`About Ghost`]})]})]})},Xc=[],Zc=`:is([role="dialog"], [role="alertdialog"])[data-state="open"]`,Qc=({children:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed top-2 right-0 z-50 m-8 flex justify-end bg-transparent tablet:fixed tablet:top-0`,id:`done-button-container`,children:(0,V.jsx)(qi,{})}),(0,V.jsx)(`div`,{className:`fixed top-0 left-0 flex size-full bg-grey-50 dark:bg-grey-950 dark:tablet:bg-[#101114]`,id:`admin-x-settings-content`,children:e})]}),$c=()=>{let{currentUser:e}=I(),{loadingModal:t}=P(),{isDirty:n}=x(),r=e=>{window.location.hash=e},i=()=>document.getElementById(`modal-backdrop`)?!0:!!document.querySelector(Zc);return(0,B.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(i())return;Ye(n,()=>{r(`/`)})}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n]),(0,B.useEffect)(()=>{Ft.remove()},[]),Cn(e)?wn(e)?(0,V.jsx)(Qc,{children:(0,V.jsx)(`div`,{className:`flex-1 bg-white dark:bg-grey-950`,children:(0,V.jsx)(`div`,{className:`h-full overflow-y-auto overscroll-y-contain`,id:`admin-x-settings-scroller`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-5xl px-[5vmin] tablet:mt-16 xl:mt-10`,children:[(0,V.jsx)(T,{className:`mb-[5vmin]`,children:`Settings`}),(0,V.jsx)(Vs,{highlight:!1,keywords:Xc})]})})})}):(0,V.jsxs)(Qc,{children:[t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-40 h-[calc(100vh-55px)] w-[100vw] tablet:h-[100vh] bg-[rgba(98,109,121,0.2)] backdrop-blur-[3px]`}),(0,V.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-[35] max-w-[calc(100%-16px)] flex-1 basis-[320px] overscroll-y-contain bg-white p-8 tablet:relative tablet:inset-x-auto tablet:top-auto tablet:h-full tablet:overflow-y-scroll tablet:bg-grey-50 tablet:py-0 dark:bg-grey-950 dark:tablet:bg-[#101114]`,id:`admin-x-settings-sidebar-scroller`,children:(0,V.jsx)(`div`,{className:`relative w-full`,children:(0,V.jsx)(Yc,{})})}),(0,V.jsx)(`div`,{className:`h-full flex-1 bg-white tablet:basis-[800px] dark:bg-grey-950 dark:tablet:bg-black`,children:(0,V.jsx)(`div`,{className:`relative h-full overflow-y-scroll overscroll-y-contain pt-13`,id:`admin-x-settings-scroller`,children:(0,V.jsx)(qc,{})})})]}):null},el={"design/change-theme":`DesignAndThemeModal`,"design/edit":`DesignAndThemeModal`,"theme/install":`DesignAndThemeModal`,"theme/edit/:name":`DesignAndThemeModal`,"navigation/edit":`NavigationModal`,"staff/invite":`InviteUserModal`,"staff/:slug/social-links":`UserDetailModal`,"staff/:slug/email-notifications":`UserDetailModal`,"staff/:slug/edit":`UserDetailModal`,"staff/:slug":`UserDetailModal`,"portal/edit":`PortalModal`,"tiers/add":`TierDetailModal`,"tiers/:id":`TierDetailModal`,"stripe-connect":`StripeConnectModal`,"newsletters/new":`AddNewsletterModal`,"newsletters/:id":`NewsletterDetailModal`,"history/view":`HistoryModal`,"history/view/:user":`HistoryModal`,"integrations/contentapi":`ContentApiModal`,"integrations/zapier":`ZapierModal`,"integrations/transistor":`TransistorModal`,"integrations/slack":`SlackModal`,"integrations/unsplash":`UnsplashModal`,"integrations/firstpromoter":`FirstPromoterModal`,"integrations/pintura":`PinturaModal`,"integrations/new":`AddIntegrationModal`,"integrations/:id":`CustomIntegrationModal`,"recommendations/add":`AddRecommendationModal`,"recommendations/edit":`EditRecommendationModal`,"announcement-bar/edit":`AnnouncementBarModal`,"embed-signup-form/show":`EmbedSignupFormModal`,"offers/edit":`OffersContainerModal`,"offers/edit/:id":`OffersContainerModal`,"offers/edit/retention/:id":`OffersContainerModal`,"offers/new":`OffersContainerModal`,"explore/testimonial":`TestimonialsModal`,about:`AboutModal`},tl=()=>Pt(()=>import(`./modals-DF2sECo6.js`),__vite__mapDeps([30,1,2,8,9,3,10,5,6,11,12,4,7,13,14,15,16,17,18,19,20,21,22,23,24,25,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url),nl=()=>{let{updateNavigatedSection:e,scrollToSection:t}=it(),{route:n,updateRoute:r}=P();return He((e,n)=>{e===n&&t(e.split(`/`)[0])},[t]),(0,B.useEffect)(()=>{if(n!==void 0){if(n.split(`/`)[0]===`locksite`){r(`members`);return}e(n.split(`/`)[0])}},[n,e,r]),null};function rl({designSystem:e,upgradeStatus:t}){return(0,V.jsx)(Oe,{upgradeStatus:t,children:(0,V.jsx)(w.Provider,{children:(0,V.jsx)(ht,{basePath:`settings`,modals:{paths:el,load:tl},children:(0,V.jsxs)(Sr,{className:`admin-x-settings`,...e,children:[(0,V.jsx)(nl,{}),(0,V.jsx)($c,{})]})})})})}var il=e(n(),1);async function al(){return await Pt(()=>import(`./koenig-lexical-CUVpp-dC.js`),__vite__mapDeps([46,1,2,8,3,16,7,9,10,5,6,11,12,13,14,15,17,18,19,20,21,22,23]),import.meta.url)}function ol(){return(0,il.createPortal)((0,V.jsx)(`div`,{className:`shade shade-admin`,style:{position:`absolute`,inset:0,zIndex:20},children:(0,V.jsx)(rl,{designSystem:{darkMode:!1,fetchKoenigLexical:al}})}),document.body)}export{ol as default};
|