ghost 6.37.1 → 6.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-i18n-0.0.0.tgz +0 -0
- package/core/boot.js +13 -9
- package/core/bridge.js +10 -6
- package/core/built/admin/assets/{PolarAngleAxis-Cavik65s.js → PolarAngleAxis-CB-FJBDa.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-CnqN6ZMT.js → _baseAssignValue-BEAjPAfy.js} +1 -1
- package/core/built/admin/assets/{a-large-small-Wi4LtZX-.js → a-large-small-L1BJa6mG.js} +1 -1
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
- package/core/built/admin/assets/admin-x-settings/{code-editor-view-Cf8T5Jfd.mjs → code-editor-view-bOZzJ3a1.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-BMWEh-vR.mjs → index-BRuMxaCz.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-Aj-hFSnY.mjs → index-CTAQj489.mjs} +5 -5
- package/core/built/admin/assets/admin-x-settings/{index-DjBJrXYn.mjs → index-WoKKBOe4.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-8WpWZZdI.mjs → modals-BQ5M-RTA.mjs} +3 -3
- package/core/built/admin/assets/{arrow-right-BiAOKOto.js → arrow-right-B2j-ecEK.js} +1 -1
- package/core/built/admin/assets/{at-sign-z5gBMxDW.js → at-sign-CtAw8_lw.js} +1 -1
- package/core/built/admin/assets/{audience-DxNilLIv.js → audience-CvSOqHuo.js} +1 -1
- package/core/built/admin/assets/automations-BVUNuVOh.js +1 -0
- package/core/built/admin/assets/automations-Bi9RJq5E.js +1 -0
- package/core/built/admin/assets/{avatar-flipboard-5OzseZFV.js → avatar-flipboard-DocLTXLh.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-D9YcSpW8.js → bluesky-sharing-DafX2lE1.js} +1 -1
- package/core/built/admin/assets/chart-BRQeD9eh.js +67 -0
- package/core/built/admin/assets/{chevron-up-DVt6fhV3.js → chevron-up-v4_QwmnL.js} +1 -1
- package/core/built/admin/assets/{chunk.524.fcd26ef812d73e2b0620.js → chunk.524.c3d844070c24d7984fd7.js} +4 -4
- package/core/built/admin/assets/{chunk.582.b61ffaad1c2fa4aba820.js → chunk.582.0e0ede1eac12926acceb.js} +6 -6
- package/core/built/admin/assets/{chunk.383.adb5a3fe32b6b98c43ff.js → chunk.995.4b32363ab39da3e7f5d7.js} +3 -3
- package/core/built/admin/assets/circle-alert-Dbz54fYb.js +1 -0
- package/core/built/admin/assets/{code-editor-view-CbQIqTrK.js → code-editor-view-D-pYCcdu.js} +1 -1
- package/core/built/admin/assets/comments-DSv09jRn.js +1 -0
- package/core/built/admin/assets/{content-helpers-jANWGIfA.js → content-helpers-DQdPPDGb.js} +1 -1
- package/core/built/admin/assets/{copy-BBLeLEnG.js → copy-BULQsPZ4.js} +1 -1
- package/core/built/admin/assets/{data-list-BveeOSGI.js → data-list-WxXC0iKE.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-DupAEk4P.js → deleted-feed-item-ZBLfgRkK.js} +1 -1
- package/core/built/admin/assets/{dropzone-D3PSdAHN.js → dropzone-B8mAoWrn.js} +1 -1
- package/core/built/admin/assets/{edit-profile-NrCR9_bi.js → edit-profile-Bj3th8H0.js} +1 -1
- package/core/built/admin/assets/editor-BZV40eAE.css +1 -0
- package/core/built/admin/assets/editor-u20VuPzn.js +7 -0
- package/core/built/admin/assets/{empty-indicator-Dhi_KeYX.js → empty-indicator-P3IsUguf.js} +1 -1
- package/core/built/admin/assets/{en-BontI3SP.js → en-C9bUnuy7.js} +1 -1
- package/core/built/admin/assets/{feed-B3Kfiz5R.js → feed-B94mO944.js} +1 -1
- package/core/built/admin/assets/{filter-query-core-Dwh4Qulu.js → filter-query-core-CM0KKIr2.js} +1 -1
- package/core/built/admin/assets/filters-D52FTE0z.js +1 -0
- package/core/built/admin/assets/gh-chart-Xa6Nvzwz.js +1 -0
- package/core/built/admin/assets/{ghost-c25434d5bbf5a5429883d4c3590f1946.js → ghost-82f1c4ffe0e1cd058ce4b66b5253b620.js} +159 -201
- package/core/built/admin/assets/{ghost-dark-52df27573e5f2a75e6cf4b1d06eea9e4.css → ghost-dark-9897cf5102772faedf566e5e54d4fbee.css} +1 -1
- package/core/built/admin/assets/{ghost-fcf460028e04192f392f16e173f2e3a8.css → ghost-e11f1814be0f38e98bb77b49eba11178.css} +1 -1
- package/core/built/admin/assets/{growth-DRH8zUIJ.js → growth-D3TW3JIB.js} +1 -1
- package/core/built/admin/assets/{hash-UvX5iOa9.js → hash-CstXS-iB.js} +1 -1
- package/core/built/admin/assets/{header-G1a38jnf.js → header-StkTITw-.js} +1 -1
- package/core/built/admin/assets/{inbox-By7HZskI.js → inbox-D1RM3kVF.js} +1 -1
- package/core/built/admin/assets/index-BEkJ9xtY.css +1 -0
- package/core/built/admin/assets/{index-CS_ZmI8F.js → index-BJx5Uas5.js} +1 -1
- package/core/built/admin/assets/index-BKzg6OE7.js +1 -0
- package/core/built/admin/assets/{index-D7JyKf1m.js → index-BM-MBdD0.js} +1 -1
- package/core/built/admin/assets/index-BRzvVuXt.js +2 -0
- package/core/built/admin/assets/index-B_3xqeM9.js +1 -0
- package/core/built/admin/assets/{index-ydyrczVl.js → index-C-OdR2wJ.js} +1 -1
- package/core/built/admin/assets/{index-X-MG1ikg.js → index-C59QlJqT.js} +1 -1
- package/core/built/admin/assets/{index-CJo0Qh4V.js → index-CCq_1tCo.js} +1 -1
- package/core/built/admin/assets/{index-qHUvPjQB.js → index-CYyEyBYw.js} +11 -11
- package/core/built/admin/assets/{index-CX4ztLSk.js → index-DHbiBjyq.js} +1 -1
- package/core/built/admin/assets/{index-BP6hBbPK.js → index-DTVgSMyL.js} +2 -2
- package/core/built/admin/assets/{index-vZMbI8e8.js → index-DiUjEgRw.js} +1 -1
- package/core/built/admin/assets/{index-YM4ZplGj.js → index-DugxKzA6.js} +1 -1
- package/core/built/admin/assets/{index-D8InZCr2.js → index-DzVHlhO1.js} +1 -1
- package/core/built/admin/assets/{index-D4b7U6K-.js → index-LsaD9Cq7.js} +1 -1
- package/core/built/admin/assets/{index-DRUPF8nN.js → index-x0hNfyqU.js} +1 -1
- package/core/built/admin/assets/{inline-Bc9zHR7e.js → inline-B4cWemrJ.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-B-ZnqRE1.js → koenig-lexical-BOdeH3QJ.js} +1 -1
- package/core/built/admin/assets/{kpi-card-zyi5Onb0.js → kpi-card-P7zSpcx0.js} +1 -1
- package/core/built/admin/assets/{kpi-card-CzlPIEPE.js → kpi-card-plhYOEtA.js} +1 -1
- package/core/built/admin/assets/{kpi-tabs-Dsa5ldXK.js → kpi-tabs-DZw2Qktb.js} +1 -1
- package/core/built/admin/assets/{kpis-Cw5ZRQhk.js → kpis-CDHM0xhW.js} +1 -1
- package/core/built/admin/assets/{label-BvxmsD1M.js → label-Ckacdx14.js} +1 -1
- package/core/built/admin/assets/{links-CiS5BPKS.js → links-BtXE5d0Y.js} +1 -1
- package/core/built/admin/assets/{list-filter-zmkB7rg4.js → list-filter-DLjjiktn.js} +1 -1
- package/core/built/admin/assets/{list-header-Cp779e3H.js → list-header-Cc7Ia3nr.js} +1 -1
- package/core/built/admin/assets/loader-circle-DLJd-dNm.js +1 -0
- package/core/built/admin/assets/{mail-i2qs8CIG.js → mail-B97w28e2.js} +1 -1
- package/core/built/admin/assets/{main-layout-KCvKOX8F.js → main-layout-bwWvzc9B.js} +1 -1
- package/core/built/admin/assets/{members-w601v5JJ.js → members-CokS8MI2.js} +5 -5
- package/core/built/admin/assets/{message-square-text-bG9IoWIt.js → message-square-text-D3rsjDFR.js} +1 -1
- package/core/built/admin/assets/minus-BzXQVmMw.js +1 -0
- package/core/built/admin/assets/{modals-lNzhiL0o.js → modals-D0lip-iy.js} +2 -2
- package/core/built/admin/assets/{moderation-CyfNRSWj.js → moderation-Dv7AadCV.js} +1 -1
- package/core/built/admin/assets/newsletter-BazC5rIj.js +1 -0
- package/core/built/admin/assets/{newsletters-B8xSXSr_.js → newsletters-m6HQgU5J.js} +1 -1
- package/core/built/admin/assets/{note-dNfKEpxw.js → note-CCGiEKz-.js} +1 -1
- package/core/built/admin/assets/{onboarding-route-Drbw0QtT.js → onboarding-route-Cbt7qWNE.js} +1 -1
- package/core/built/admin/assets/overview-TN50tzUh.js +1 -0
- package/core/built/admin/assets/{pagemenu-VJXMoMB4.js → pagemenu-BXrHWtsU.js} +1 -1
- package/core/built/admin/assets/{pencil-DHNmlLjO.js → pencil-BL1r8KVy.js} +1 -1
- package/core/built/admin/assets/{post-analytics-PsqLsS2e.js → post-analytics-BqEXi6Ps.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-QLZsZCFg.js → post-analytics-context-DekYNlb3.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-PecXsIT-.js → post-analytics-header-AkNbn6uc.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-B4Rvo7W1.js → post-share-modal-CXDGVKoQ.js} +1 -1
- package/core/built/admin/assets/posts/{app-utils-DIc5TmxO.mjs → app-utils-DxA7edI_.mjs} +2 -2
- package/core/built/admin/assets/posts/{automations-BZpT35kJ.mjs → automations-Cwu_gHl4.mjs} +64 -67
- package/core/built/admin/assets/posts/automations-D81hV_2c.mjs +13 -0
- package/core/built/admin/assets/posts/{avatar-K63cvqSS.mjs → avatar-IkjEzEjI.mjs} +19 -19
- package/core/built/admin/assets/posts/{button-ufGBCcsV.mjs → button-KaJZKcou.mjs} +21 -21
- package/core/built/admin/assets/posts/{check-IcEnuTpD.mjs → check-Cf74RvZ1.mjs} +21 -21
- package/core/built/admin/assets/posts/{comments-CyJU9Ums.mjs → comments-pdKhYbYG.mjs} +54 -52
- package/core/built/admin/assets/posts/createLucideIcon-Cj7h3r9g.mjs +320 -0
- package/core/built/admin/assets/posts/{dialog-D6_lBvtT.mjs → dialog-Ci3W8fjx.mjs} +71 -76
- package/core/built/admin/assets/posts/{dropdown-menu-BSSmAory.mjs → dropdown-menu-DZ9XCHSw.mjs} +5 -5
- package/core/built/admin/assets/posts/editor-Bb-xle0o.mjs +6084 -0
- package/core/built/admin/assets/posts/ellipsis-ChhZo9aT.mjs +10 -0
- package/core/built/admin/assets/posts/{empty-indicator-DvGCvRAX.mjs → empty-indicator-DnFs7hDy.mjs} +2 -2
- package/core/built/admin/assets/posts/{filters-BLBaHhJz.mjs → filters-CO_FUPX-.mjs} +42 -40
- package/core/built/admin/assets/posts/get-site-timezone-C21yKZT_.mjs +87 -0
- package/core/built/admin/assets/posts/{growth-Bz1ChJNB.mjs → growth-CtX9Efm2.mjs} +12 -12
- package/core/built/admin/assets/posts/heading-DZ_KtDTL.mjs +138 -0
- package/core/built/admin/assets/posts/{hooks-BEngBys9.mjs → hooks-DVhBDVlA.mjs} +3 -2
- package/core/built/admin/assets/posts/{index-BAF0YXsp.mjs → index-B4db8w_H.mjs} +181 -172
- package/core/built/admin/assets/posts/{inline-C2YFQAdU.mjs → inline-BfB-SNk0.mjs} +2 -2
- package/core/built/admin/assets/posts/{input-surface-TqJlNSp_.mjs → input-surface-CNwZJloi.mjs} +2 -2
- package/core/built/admin/assets/posts/{kpis-DAX5_0-Q.mjs → kpis-BvY_5Y1u.mjs} +8792 -8803
- package/core/built/admin/assets/posts/{links-A1YTsBbF.mjs → links-Ck-h7SKg.mjs} +57 -57
- package/core/built/admin/assets/posts/{loading-indicator-BZsjmp8g.mjs → loading-indicator-B_rU9Lie.mjs} +3 -3
- package/core/built/admin/assets/posts/mail-DiZ3oKEW.mjs +9 -0
- package/core/built/admin/assets/posts/{main-layout-D_HHTP_n.mjs → main-layout-aYo6qOBZ.mjs} +2 -2
- package/core/built/admin/assets/posts/{newsletter-BRzgjOIa.mjs → newsletter-BQc53TF2.mjs} +31 -30
- package/core/built/admin/assets/posts/{overview-C41VFjn7.mjs → overview-blz9Ak9q.mjs} +42 -41
- package/core/built/admin/assets/posts/plus-YVjtYaK3.mjs +15 -0
- package/core/built/admin/assets/posts/{post-analytics-DGgMkFaf.mjs → post-analytics-BQbWGoeu.mjs} +6 -6
- package/core/built/admin/assets/posts/{post-analytics-context-B1r3HBrp.mjs → post-analytics-context-Be7THgnd.mjs} +7 -7
- package/core/built/admin/assets/posts/{post-analytics-header-DTWSO0Aq.mjs → post-analytics-header-iDFy7Bao.mjs} +2762 -2764
- package/core/built/admin/assets/posts/{post-share-modal-ohHwk0Yt.mjs → post-share-modal-akP16idN.mjs} +50 -48
- package/core/built/admin/assets/posts/posts.js +2 -1
- package/core/built/admin/assets/posts/{settings-CZYL6Jhr.mjs → settings-BdQhfHxY.mjs} +2 -2
- package/core/built/admin/assets/posts/{sheet-D7YesQJE.mjs → sheet-3dBlKeXf.mjs} +14 -13
- package/core/built/admin/assets/posts/{skeleton-S1k58YKa.mjs → skeleton-DMgSvYqr.mjs} +11 -11
- package/core/built/admin/assets/posts/{source-icon-DnpCy5N4.mjs → source-icon-Bp5Qxq1E.mjs} +4 -4
- package/core/built/admin/assets/posts/{stats-CbOpowXb.mjs → stats-DJx9qc_u.mjs} +4 -4
- package/core/built/admin/assets/posts/{table-Cw3Wxf1C.mjs → table-BpVwuzeH.mjs} +2 -2
- package/core/built/admin/assets/posts/{data-list-BnZARP88.mjs → tabs-CbZCpxfI.mjs} +4885 -5284
- package/core/built/admin/assets/posts/{tags-BoMt6Ce3.mjs → tags-CNtvDS6f.mjs} +33 -33
- package/core/built/admin/assets/posts/{tags-CNdsvTtZ.mjs → tags-DFOoFZ_3.mjs} +2 -2
- package/core/built/admin/assets/posts/{tooltip-CTcyINxz.mjs → tooltip-Cc_09RDU.mjs} +106 -117
- package/core/built/admin/assets/posts/value-CwGM7M-1.mjs +410 -0
- package/core/built/admin/assets/posts/{virtual-list-window-Bs88yrut.mjs → virtual-list-window-D6nRoL0y.mjs} +5 -5
- package/core/built/admin/assets/posts/{web-Bsd8eTP6.mjs → web-yfPssEt8.mjs} +1042 -1040
- package/core/built/admin/assets/posts/x-DrUGcpfp.mjs +9 -0
- package/core/built/admin/assets/posts/zap-DAN0ur-o.mjs +24 -0
- package/core/built/admin/assets/posts-D-jyPPE6.js +1 -0
- package/core/built/admin/assets/power-Cc5ncYVl.js +1 -0
- package/core/built/admin/assets/{referrers-kcBT5smx.js → referrers-qnXsKsuv.js} +1 -1
- package/core/built/admin/assets/{repeat-Cn2sKd-L.js → repeat-BGIBynZH.js} +1 -1
- package/core/built/admin/assets/{reply-D7E-ZMd5.js → reply-DOKdAsL_.js} +1 -1
- package/core/built/admin/assets/{rocket-DnH0XAGW.js → rocket-CAN2NB82.js} +1 -1
- package/core/built/admin/assets/{select-f0MMMQWu.js → select-8S9kYGSM.js} +1 -1
- package/core/built/admin/assets/{settings-BAQNP3gU.js → settings-DeD-bmZc.js} +4 -4
- package/core/built/admin/assets/{settings-ORttG1jT.js → settings-e4IB9sx6.js} +1 -1
- package/core/built/admin/assets/{share-modal-CXU4tGY8.js → share-modal-CBavk20I.js} +1 -1
- package/core/built/admin/assets/{sort-button-BXMrChFu.js → sort-button-DlSKBzUq.js} +1 -1
- package/core/built/admin/assets/{source-icon-cjy79jGT.js → source-icon-27VIJSXr.js} +1 -1
- package/core/built/admin/assets/{sprout-DZ4tZ78G.js → sprout-D66nqc79.js} +1 -1
- package/core/built/admin/assets/{square-vOzqJf7x.js → square-DccaXQWe.js} +1 -1
- package/core/built/admin/assets/stats/{audience-5NeJICtP.mjs → audience-B84ClTDM.mjs} +3 -3
- package/core/built/admin/assets/stats/{content-helpers-DFSTl3uB.mjs → content-helpers-CBAddUg7.mjs} +4 -4
- package/core/built/admin/assets/stats/{index-C4T7u699.mjs → index-Bz5oVpED.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-B8bp6qe2.mjs → index-Cs8i1uR4.mjs} +74 -75
- package/core/built/admin/assets/stats/{index-wvi17m79.mjs → index-DEsP_Tbd.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-CFfAYHdD.mjs → index-Ds-pM47x.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-Chqk7VlR.mjs → index-Wzk1IcAz.mjs} +6 -6
- package/core/built/admin/assets/stats/{kpi-tabs-Df9yOI2P.mjs → kpi-tabs-Cs4l8B_M.mjs} +7 -7
- package/core/built/admin/assets/stats/{sort-button-Doi8OgMU.mjs → sort-button-rR-GA9Hu.mjs} +3 -3
- package/core/built/admin/assets/stats/{stats-FXeCefyd.mjs → stats-RFpEJpEq.mjs} +34 -34
- package/core/built/admin/assets/stats/stats.js +1 -1
- package/core/built/admin/assets/stats/{use-growth-stats-93C_3EZk.mjs → use-growth-stats-DwgFzbq9.mjs} +3 -3
- package/core/built/admin/assets/{stats-CIGz2Win.js → stats-B4OybenW.js} +1 -1
- package/core/built/admin/assets/{stats-view-BTKRxYTQ.js → stats-view-BuExwFXa.js} +1 -1
- package/core/built/admin/assets/{step-1-BSMHbT-q.js → step-1-D_5LOQrC.js} +1 -1
- package/core/built/admin/assets/{step-2-_YC0LCZv.js → step-2-BZLBj8cj.js} +1 -1
- package/core/built/admin/assets/{step-3-DWMqP2bO.js → step-3-s5uNbcOH.js} +1 -1
- package/core/built/admin/assets/{table-mHKjXQba.js → table-pGS7EeJe.js} +1 -1
- package/core/built/admin/assets/{tabs-B93IVRBz.js → tabs-CjdKssUe.js} +1 -1
- package/core/built/admin/assets/{tags-DCb-x2ZB.js → tags-B0vRk0A6.js} +1 -1
- package/core/built/admin/assets/{tags-kUHJ1MZo.js → tags-Dso4-FA_.js} +1 -1
- package/core/built/admin/assets/{textarea-DswCtM7_.js → textarea-DzFnun0_.js} +1 -1
- package/core/built/admin/assets/{tiers-DueraQKd.js → tiers-4Vkr_D-L.js} +1 -1
- package/core/built/admin/assets/{toggle-group-ChTo8MPD.js → toggle-group-hDsr47IB.js} +1 -1
- package/core/built/admin/assets/{topic-filter-DrW3fYWo.js → topic-filter-C7TpPe1G.js} +1 -1
- package/core/built/admin/assets/{trash-B2ESGftj.js → trash-DCVuk7ZX.js} +1 -1
- package/core/built/admin/assets/{underline-vo-bPRac.js → underline-CjK8la2G.js} +1 -1
- package/core/built/admin/assets/{upload-DXQRkBBq.js → upload-CPYhmtWZ.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-CoB8-lsd.js → use-growth-stats-CaFSgp_R.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-Y_Wv2N6g.js → use-simple-pagination-D0vJBMvF.js} +1 -1
- package/core/built/admin/assets/{user-round-check-Dp9a2x-e.js → user-round-check-CzQQeFd8.js} +1 -1
- package/core/built/admin/assets/{user-round-x-DwCTGlxc.js → user-round-x-BDFm8yQj.js} +1 -1
- package/core/built/admin/assets/value-BGBiTkF3.js +1 -0
- package/core/built/admin/assets/{vendor-17f3b979ba6f3898d1a8c5249cc22ff1.js → vendor-ce3fc901ccbcf37f36eb791b4e454138.js} +29 -31
- package/core/built/admin/assets/{virtual-list-window-BF7IvGMC.js → virtual-list-window-EKtWZ5cP.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-IEmcxJvG.js → wallet-cards-C1NOBbWE.js} +1 -1
- package/core/built/admin/assets/web-DCA7HR1S.js +1 -0
- package/core/built/admin/index.html +8 -8
- package/core/frontend/helpers/social_accounts.js +91 -0
- package/core/frontend/services/sitemap/handler.js +14 -2
- package/core/frontend/services/sitemap/site-map-manager.js +133 -9
- package/core/frontend/web/middleware/handle-image-sizes.js +4 -0
- package/core/server/api/endpoints/automations.js +38 -45
- package/core/server/models/member.js +30 -25
- package/core/server/services/automations/automations-api.js +58 -0
- package/core/server/services/automations/automations-api.ts +71 -0
- package/core/server/services/automations/automations-repository.js +2 -0
- package/core/server/services/automations/automations-repository.ts +63 -0
- package/core/server/services/automations/fake-database-automations-repository.js +210 -0
- package/core/server/services/automations/fake-database-automations-repository.ts +273 -0
- package/core/server/services/automations/temporary-fake-database.js +5 -4
- package/core/server/services/gifts/email-templates/gift-purchase-confirmation.hbs +10 -32
- package/core/server/services/gifts/email-templates/gift-purchase-confirmation.js +6 -8
- package/core/server/services/gifts/email-templates/gift-purchase-confirmation.ts +6 -8
- package/core/server/services/gifts/email-templates/gift-reminder.hbs +12 -37
- package/core/server/services/gifts/email-templates/gift-reminder.js +5 -9
- package/core/server/services/gifts/email-templates/gift-reminder.ts +5 -9
- package/core/server/services/gifts/gift-service.js +1 -1
- package/core/server/services/gifts/gift-service.ts +2 -2
- package/core/server/services/member-welcome-emails/service.js +0 -1
- package/core/server/services/members/members-api/controllers/router-controller.js +52 -7
- package/core/server/services/members/members-api/services/member-bread-service.js +0 -8
- package/core/server/services/route-settings/route-settings.js +18 -2
- package/core/server/services/staff/email-templates/gift.hbs +1 -1
- package/core/server/services/staff/email-templates/gift.txt.js +1 -1
- package/core/server/services/staff/email-templates/new-gift-subscription.hbs +1 -1
- package/core/server/services/staff/email-templates/new-gift-subscription.txt.js +1 -1
- package/core/server/services/staff/staff-service-emails.js +1 -1
- package/core/server/services/url/index.js +16 -1
- package/core/server/services/url/lazy-find-resource.js +49 -0
- package/core/server/services/url/lazy-find-resource.ts +62 -0
- package/core/server/services/url/lazy-url-service.js +220 -0
- package/core/server/services/url/lazy-url-service.ts +265 -0
- package/core/server/web/api/endpoints/admin/routes.js +1 -0
- package/core/server/web/gift-preview/Inter.ttf +0 -0
- package/core/server/web/gift-preview/controller.js +56 -6
- package/core/server/web/gift-preview/gift-card-noise.png +0 -0
- package/core/server/web/gift-preview/gift-card-orb.png +0 -0
- package/core/server/web/gift-preview/image.js +170 -43
- package/core/shared/config/defaults.json +1 -0
- package/core/shared/one-at-a-time.js +28 -33
- package/core/shared/one-at-a-time.ts +58 -0
- package/package.json +18 -16
- package/pnpm-lock.yaml +989 -356
- package/core/built/admin/assets/automations-D1uMjd06.js +0 -1
- package/core/built/admin/assets/chart-_EXssQtm.js +0 -67
- package/core/built/admin/assets/comments-E00h1SbR.js +0 -1
- package/core/built/admin/assets/filters-CC7XfjOS.js +0 -1
- package/core/built/admin/assets/gh-chart-B9_ywrJJ.js +0 -1
- package/core/built/admin/assets/index-AsV-aY0z.css +0 -1
- package/core/built/admin/assets/index-B0y_ynZw.js +0 -1
- package/core/built/admin/assets/index-Bs6wWbLA.js +0 -2
- package/core/built/admin/assets/index-Cb4641XW.js +0 -1
- package/core/built/admin/assets/loader-circle-B5UPqSok.js +0 -1
- package/core/built/admin/assets/minus-DWx9VUtr.js +0 -1
- package/core/built/admin/assets/newsletter-fkQye9OK.js +0 -1
- package/core/built/admin/assets/overview-CZ-VrnXy.js +0 -1
- package/core/built/admin/assets/posts/createLucideIcon-DcUfTBt_.mjs +0 -454
- package/core/built/admin/assets/posts/get-site-timezone-DlXmHA3y.mjs +0 -93
- package/core/built/admin/assets/posts-Bx1RWrub.js +0 -1
- package/core/built/admin/assets/web-DSME3e8c.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n,r as S,aF as me,t as Ve,dE as cv,aQ as uv,au as dv,aS as fv,at as Ei,av as bu,aU as pv,aw as Jc,aT as lh,as as hv,az as ch,ax as mv,ay as gv,dF as qe,dG as xv,dH as bv,dI as wv,dJ as vv,ah as Gr,b4 as Ze,di as Rs,dv as jr,dK as ot,dL as rt,ch as uh,df as dh,dM as fh,dN as Mf,dO as yv,dP as Pn,dQ as _v,dR as Mv,dS as kv,dT as ph,dU as wu,dV as jv,dW as Nv,dX as Tv,dY as Mr,dZ as yi,d_ as vu,d$ as Ev,e0 as Cv,aB as Iv,e1 as Sv,dx as fi,e2 as Av,e3 as Ia,e4 as Dv,e5 as $v,aj as Ov,aV as Rv,e6 as Lv,e7 as hh,e8 as mh,e9 as kf,cu as Tt,ea as As,eb as eu,ec as Fv,ed as Ds,ee as Pv,ef as Hv,eg as zv,eh as Ra,ei as Uv,ej as Bv,ek as tu,ag as Wv,el as Yv,em as qv,en as Gv,eo as Xv,ep as wr,eq as jf,er as Nf,es as Kv}from"./index-qHUvPjQB.js";import{H as lt,a as Hn,S as $s,B as Ie,x as Ci,K as Zv,y as Lt,z as Vv,A as jt,M as ct,C as Fn,F as Qv,G as kr,J as Jv,O as Ii,Q as ge,U as He,V as ey,W as Si,X as Ue,Y as sr,Z as Nr,_ as xt,$ as Xr,a0 as nn,a1 as ty,a2 as Ye,a3 as _e,a4 as Tf,a5 as Ef,a6 as Be,a7 as gh,a8 as xh,a9 as ny,aa as Cf,ab as ry,ac as sy,ad as ay,ae as Ls,af as Fs,ag as zn,ah as or,ai as Da,aj as oy,ak as iy,al as ly,am as cy,an as uy,ao as _i,ap as Mi,aq as Un,ar as dy,as as If,at as Sf,au as fy,av as Ps,aw as ar,ax as rr,ay as bh,az as py,aA as yu,aB as hy,aC as wh,aD as vh,aE as yh,aF as _h,aG as my,aH as gy,aI as yn,aJ as Af,aK as Mh,aL as kh,aM as jh,aN as nu,aO as xy,aP as by,aQ as wy,aR as ru,aS as _u,aT as wi,aU as vy,aV as yy,aW as Df,aX as _y,aY as Nh,aZ as Mu,a_ as ku,a$ as su,b0 as My,b1 as ky,b2 as jy,b3 as Ny}from"./settings-BAQNP3gU.js";import{a as Ty,u as Th,b as Eh}from"./newsletters-B8xSXSr_.js";import{C as Ey,a as Cy}from"./index-YM4ZplGj.js";import{u as Ch}from"./posts-Bx1RWrub.js";import{r as Ih}from"./index-D8InZCr2.js";import{a as Sh,b as Ah,u as ju,c as Nu,d as Iy}from"./dropzone-D3PSdAHN.js";import{u as Kr,a as Tu,b as Sy,g as Ba}from"./tiers-DueraQKd.js";import{A as Ay,L as Dy}from"./list-filter-zmkB7rg4.js";import"./tabs-B93IVRBz.js";import"./typeof-QjJsDpFa.js";import"./referrers-kcBT5smx.js";import"./select-f0MMMQWu.js";import"./chevron-up-DVt6fhV3.js";import"./underline-vo-bPRac.js";import"./toggle-group-ChTo8MPD.js";import"./textarea-DswCtM7_.js";import"./index-DRUPF8nN.js";const Dh=({children:t,...a})=>n.jsx("div",{className:"flex size-full flex-col px-8",...a,children:n.jsx("div",{className:"size-full overflow-hidden rounded-t-[4px] shadow-sm",children:t})}),$h=({children:t,...a})=>n.jsx("div",{className:"flex h-[775px] w-[380px] flex-col rounded-3xl bg-white p-2 shadow-xl dark:bg-grey-900",...a,children:n.jsx("div",{className:"h-100 w-100 grow overflow-auto rounded-2xl border border-grey-100 dark:border-grey-950",children:t})}),$y=({title:t,label:a,value:s,onChange:i,disabled:f,error:p,hint:x,checked:h,separator:b,testId:g})=>{const m=S.useId(),w=v=>{i(v===!0)};return n.jsxs("div",{children:[n.jsxs("div",{className:`flex flex-col gap-1 ${b&&"pb-2"}`,children:[t&&n.jsx(lt,{grey:!0,level:6,children:t}),n.jsxs("label",{className:`flex cursor-pointer items-start ${t&&"mt-1 -mb-1"}`,htmlFor:m,children:[n.jsx(Ey,{className:"mt-0.5 flex size-4 cursor-pointer appearance-none items-center justify-center rounded-[3px] border border-solid border-grey-500 bg-white outline-hidden data-[state=checked]:border-black data-[state=checked]:bg-black data-[state=indeterminate]:border-black data-[state=indeterminate]:bg-black","data-testid":g,defaultChecked:h,disabled:f,id:m,value:s,onCheckedChange:w,children:n.jsx(Cy,{children:n.jsx("svg",{fill:"none",height:"11",viewBox:"0 0 10 11",width:"10",children:n.jsx("path",{d:"M1 5.88889L4.6 9L9 1",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})})}),n.jsxs("div",{className:`ml-2 flex flex-col ${x&&"mb-2"}`,children:[n.jsx("span",{className:`inline-block text-[1.425rem] dark:text-white ${x&&"-mb-1"}`,children:a}),x&&n.jsx(Hn,{color:p?"red":"",children:x})]})]})]}),(b||p)&&n.jsx($s,{className:p?"border-red":""})]})},au=({title:t,checkboxes:a,hint:s,error:i})=>n.jsxs("div",{children:[t&&n.jsx(lt,{grey:!0,level:6,children:t}),n.jsx("div",{className:"mt-2 flex flex-col gap-1",children:a?.map(({key:f,...p})=>n.jsx($y,{...p},f))}),n.jsx("div",{className:`flex flex-col ${s&&"mb-2"}`,children:s&&n.jsx(Hn,{color:i?"red":"",children:s})})]}),Oy=({hex:t,value:a,title:s,size:i="md",isSelected:f,onSelect:p})=>{const x=S.useRef(null),h=m=>{m.preventDefault(),p(a!==void 0?a:t)},b=t.length===4&&t[3]==="0"||t.length===8&&t.slice(6)==="00";let g="h-5 w-5";return i==="lg"&&(g="w-6 h-6"),n.jsx("button",{ref:x,className:me("relative flex shrink-0 cursor-pointer items-center rounded-full border border-grey-300 dark:border-grey-800",g,f&&"outline outline-2 outline-green"),style:{backgroundColor:t},title:s,type:"button",onClick:h,children:b&&n.jsx("div",{className:"absolute top-0 left-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})},Oh=({title:t,value:a,swatches:s,swatchSize:i="md",onSwatchChange:f,onTogglePicker:p,isExpanded:x,picker:h=!0,containerClassName:b})=>{const g=s.find(w=>w.value===a||w.hex===a);b=me("flex flex-col gap-3");const m=x||!h;return n.jsxs("div",{className:b,children:[t&&n.jsx(lt,{useLabelTag:!0,children:t}),n.jsxs("div",{className:"flex gap-1",children:[m&&n.jsx("div",{className:"flex items-center gap-1",children:s.map(({customContent:w,...v})=>w?n.jsx(S.Fragment,{children:w},v.title):n.jsx(Oy,{isSelected:g?.title===v.title,size:i,onSelect:f,...v},v.title))}),h&&n.jsxs("button",{"aria-label":"Pick color",className:"relative size-6 cursor-pointer rounded-full border border-grey-250 dark:border-grey-800",type:"button",onClick:p,children:[n.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%))]"}),g&&n.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:g.hex},children:g.hex==="transparent"&&n.jsx("div",{className:"absolute top-[3px] left-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})}),!g&&a&&n.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:a},children:a==="transparent"&&n.jsx("div",{className:"absolute top-[3px] left-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})]})]})]})};function Hs(){return(Hs=Object.assign||function(t){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}).apply(this,arguments)}function Ai(t,a){if(t==null)return{};var s,i,f={},p=Object.keys(t);for(i=0;i<p.length;i++)a.indexOf(s=p[i])>=0||(f[s]=t[s]);return f}function La(t){var a=S.useRef(t),s=S.useRef(function(i){a.current&&a.current(i)});return a.current=t,s.current}var Fa=function(t,a,s){return a===void 0&&(a=0),s===void 0&&(s=1),t>s?s:t<a?a:t},$a=function(t){return"touches"in t},ou=function(t){return t&&t.ownerDocument.defaultView||self},$f=function(t,a,s){var i=t.getBoundingClientRect(),f=$a(a)?(function(p,x){for(var h=0;h<p.length;h++)if(p[h].identifier===x)return p[h];return p[0]})(a.touches,s):a;return{left:Fa((f.pageX-(i.left+ou(t).pageXOffset))/i.width),top:Fa((f.pageY-(i.top+ou(t).pageYOffset))/i.height)}},Of=function(t){!$a(t)&&t.preventDefault()},Rh=Ve.memo(function(t){var a=t.onMove,s=t.onKey,i=Ai(t,["onMove","onKey"]),f=S.useRef(null),p=La(a),x=La(s),h=S.useRef(null),b=S.useRef(!1),g=S.useMemo(function(){var y=function(N){Of(N),($a(N)?N.touches.length>0:N.buttons>0)&&f.current?p($f(f.current,N,h.current)):j(!1)},C=function(){return j(!1)};function j(N){var T=b.current,A=ou(f.current),R=N?A.addEventListener:A.removeEventListener;R(T?"touchmove":"mousemove",y),R(T?"touchend":"mouseup",C)}return[function(N){var T=N.nativeEvent,A=f.current;if(A&&(Of(T),!(function($,L){return L&&!$a($)})(T,b.current)&&A)){if($a(T)){b.current=!0;var R=T.changedTouches||[];R.length&&(h.current=R[0].identifier)}A.focus(),p($f(A,T,h.current)),j(!0)}},function(N){var T=N.which||N.keyCode;T<37||T>40||(N.preventDefault(),x({left:T===39?.05:T===37?-.05:0,top:T===40?.05:T===38?-.05:0}))},j]},[x,p]),m=g[0],w=g[1],v=g[2];return S.useEffect(function(){return v},[v]),Ve.createElement("div",Hs({},i,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:f,onKeyDown:w,tabIndex:0,role:"slider"}))}),Eu=function(t){return t.filter(Boolean).join(" ")},Lh=function(t){var a=t.color,s=t.left,i=t.top,f=i===void 0?.5:i,p=Eu(["react-colorful__pointer",t.className]);return Ve.createElement("div",{className:p,style:{top:100*f+"%",left:100*s+"%"}},Ve.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:a}}))},Rt=function(t,a,s){return a===void 0&&(a=0),s===void 0&&(s=Math.pow(10,a)),Math.round(s*t)/s},Ry=function(t){return zy(iu(t))},iu=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Rt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Rt(parseInt(t.substring(6,8),16)/255,2):1}},Ly=function(t){return Hy(Py(t))},Fy=function(t){var a=t.s,s=t.v,i=t.a,f=(200-a)*s/100;return{h:Rt(t.h),s:Rt(f>0&&f<200?a*s/100/(f<=100?f:200-f)*100:0),l:Rt(f/2),a:Rt(i,2)}},lu=function(t){var a=Fy(t);return"hsl("+a.h+", "+a.s+"%, "+a.l+"%)"},Py=function(t){var a=t.h,s=t.s,i=t.v,f=t.a;a=a/360*6,s/=100,i/=100;var p=Math.floor(a),x=i*(1-s),h=i*(1-(a-p)*s),b=i*(1-(1-a+p)*s),g=p%6;return{r:Rt(255*[i,h,x,x,b,i][g]),g:Rt(255*[b,i,i,h,x,x][g]),b:Rt(255*[x,x,b,i,i,h][g]),a:Rt(f,2)}},pi=function(t){var a=t.toString(16);return a.length<2?"0"+a:a},Hy=function(t){var a=t.r,s=t.g,i=t.b,f=t.a,p=f<1?pi(Rt(255*f)):"";return"#"+pi(a)+pi(s)+pi(i)+p},zy=function(t){var a=t.r,s=t.g,i=t.b,f=t.a,p=Math.max(a,s,i),x=p-Math.min(a,s,i),h=x?p===a?(s-i)/x:p===s?2+(i-a)/x:4+(a-s)/x:0;return{h:Rt(60*(h<0?h+6:h)),s:Rt(p?x/p*100:0),v:Rt(p/255*100),a:f}},Uy=Ve.memo(function(t){var a=t.hue,s=t.onChange,i=Eu(["react-colorful__hue",t.className]);return Ve.createElement("div",{className:i},Ve.createElement(Rh,{onMove:function(f){s({h:360*f.left})},onKey:function(f){s({h:Fa(a+360*f.left,0,360)})},"aria-label":"Hue","aria-valuenow":Rt(a),"aria-valuemax":"360","aria-valuemin":"0"},Ve.createElement(Lh,{className:"react-colorful__hue-pointer",left:a/360,color:lu({h:a,s:100,v:100,a:1})})))}),By=Ve.memo(function(t){var a=t.hsva,s=t.onChange,i={backgroundColor:lu({h:a.h,s:100,v:100,a:1})};return Ve.createElement("div",{className:"react-colorful__saturation",style:i},Ve.createElement(Rh,{onMove:function(f){s({s:100*f.left,v:100-100*f.top})},onKey:function(f){s({s:Fa(a.s+100*f.left,0,100),v:Fa(a.v-100*f.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Rt(a.s)+"%, Brightness "+Rt(a.v)+"%"},Ve.createElement(Lh,{className:"react-colorful__saturation-pointer",top:1-a.v/100,left:a.s/100,color:lu(a)})))}),Fh=function(t,a){if(t===a)return!0;for(var s in t)if(t[s]!==a[s])return!1;return!0},Wy=function(t,a){return t.toLowerCase()===a.toLowerCase()||Fh(iu(t),iu(a))};function Yy(t,a,s){var i=La(s),f=S.useState(function(){return t.toHsva(a)}),p=f[0],x=f[1],h=S.useRef({color:a,hsva:p});S.useEffect(function(){if(!t.equal(a,h.current.color)){var g=t.toHsva(a);h.current={hsva:g,color:a},x(g)}},[a,t]),S.useEffect(function(){var g;Fh(p,h.current.hsva)||t.equal(g=t.fromHsva(p),h.current.color)||(h.current={hsva:p,color:g},i(g))},[p,t,i]);var b=S.useCallback(function(g){x(function(m){return Object.assign({},m,g)})},[]);return[p,b]}var qy=typeof window<"u"?S.useLayoutEffect:S.useEffect,Gy=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Rf=new Map,Xy=function(t){qy(function(){var a=t.current?t.current.ownerDocument:document;if(a!==void 0&&!Rf.has(a)){var s=a.createElement("style");s.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Rf.set(a,s);var i=Gy();i&&s.setAttribute("nonce",i),a.head.appendChild(s)}},[])},Ky=function(t){var a=t.className,s=t.colorModel,i=t.color,f=i===void 0?s.defaultColor:i,p=t.onChange,x=Ai(t,["className","colorModel","color","onChange"]),h=S.useRef(null);Xy(h);var b=Yy(s,f,p),g=b[0],m=b[1],w=Eu(["react-colorful",a]);return Ve.createElement("div",Hs({},x,{ref:h,className:w}),Ve.createElement(By,{hsva:g,onChange:m}),Ve.createElement(Uy,{hue:g.h,onChange:m,className:"react-colorful__last-control"}))},Zy={defaultColor:"000",toHsva:Ry,fromHsva:function(t){return Ly({h:t.h,s:t.s,v:t.v,a:1})},equal:Wy},Vy=function(t){return Ve.createElement(Ky,Hs({},t,{colorModel:Zy}))},Qy=/^#?([0-9A-F]{3,8})$/i,Jy=function(t){var a=t.color,s=a===void 0?"":a,i=t.onChange,f=t.onBlur,p=t.escape,x=t.validate,h=t.format,b=t.process,g=Ai(t,["color","onChange","onBlur","escape","validate","format","process"]),m=S.useState(function(){return p(s)}),w=m[0],v=m[1],y=La(i),C=La(f),j=S.useCallback(function(T){var A=p(T.target.value);v(A),x(A)&&y(b?b(A):A)},[p,b,x,y]),N=S.useCallback(function(T){x(T.target.value)||v(p(s)),C(T)},[s,p,x,C]);return S.useEffect(function(){v(p(s))},[s,p]),Ve.createElement("input",Hs({},g,{value:h?h(w):w,spellCheck:"false",onChange:j,onBlur:N}))},Lf=function(t){return"#"+t},e1=function(t){var a=t.prefixed,s=t.alpha,i=Ai(t,["prefixed","alpha"]),f=S.useCallback(function(x){return x.replace(/([^0-9A-F]+)/gi,"").substring(0,s?8:6)},[s]),p=S.useCallback(function(x){return(function(h,b){var g=Qy.exec(h),m=g?g[1].length:0;return m===3||m===6||!!b&&m===4||!!b&&m===8})(x,s)},[s]);return Ve.createElement(Jy,Hs({},i,{escape:f,format:a?Lf:void 0,process:Lf,validate:p}))};const t1=({hexValue:t,eyedropper:a,clearButtonValue:s,containerClassName:i,onChange:f})=>{const p=S.useRef(null),x=S.useCallback(v=>{var y,C,j;v.stopPropagation();const N=(y=p.current)==null?void 0:y.querySelector("input");v.target!==N&&((j=(C=p.current)==null?void 0:C.querySelector("input"))==null||j.focus(),v.preventDefault())},[]),h=S.useRef(!1),b=S.useCallback(()=>{var v,y;h.current=!1,(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus(),document.removeEventListener("mouseup",b),document.removeEventListener("touchend",b)},[]),g=S.useCallback(()=>{h.current=!0,document.addEventListener("mouseup",b),document.addEventListener("touchend",b)},[b]),m=S.useCallback(v=>{if(v.preventDefault(),!window.EyeDropper)return;h.current=!0,document.body.style.setProperty("pointer-events","none"),new window.EyeDropper().open().then(C=>f?.(C.sRGBHex)).finally(()=>{var C,j;h.current=!1,document.body.style.removeProperty("pointer-events"),(j=(C=p.current)==null?void 0:C.querySelector("input"))==null||j.focus()})},[f]);S.useEffect(()=>{var v,y;(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus()},[]);const w=S.useCallback(()=>{var v,y;(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus()},[]);return i=me("mt-2",i),n.jsxs("div",{className:i,onMouseDown:x,onTouchStart:x,children:[n.jsx(Vy,{className:"w-full",color:t||"#ffffff",onChange:f,onMouseDown:g,onTouchStart:g}),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsxs("div",{ref:p,className:"peer relative order-2 flex h-10 w-full items-center",onClick:w,children:[n.jsx("span",{className:"absolute top-[9px] left-2 z-10 mr-2 ml-1 text-grey-700",children:"#"}),n.jsx(e1,{"aria-label":"Color value",className:"z-[1] w-full rounded-md border border-transparent bg-grey-150 p-2 pl-6 transition-all hover:bg-grey-100 focus:border-green focus:bg-white focus:shadow-[0_0_0_1px_rgba(48,207,67,1)] dark:bg-grey-900 dark:text-white dark:focus:bg-grey-925",color:t,onChange:f}),a&&!!window.EyeDropper&&n.jsx("button",{className:"absolute inset-y-0 right-3 z-50 my-auto size-4 p-[1px]",type:"button",onClick:m,children:n.jsx(cv,{className:"size-full"})})]}),s!==void 0&&n.jsx(Ie,{color:"grey",value:"Clear",onClick:()=>f?.(s)})]})]})},n1=S.createContext({colorPickers:[]}),Ff=t=>t.length===4?t.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3"):t,Ln=({testId:t,title:a,direction:s,value:i,hint:f,error:p,eyedropper:x,clearButtonValue:h,onChange:b,swatches:g=[],alwaysOpen:m=!1,debounceMs:w})=>{const[v,y]=S.useState(!1),[C,j]=S.useState(i),N=S.useContext(n1),T=S.useId();S.useEffect(()=>{j(P=>Ff(P||"")===i?P:i)},[i]),S.useEffect(()=>(N.colorPickers.push({id:T,setExpanded:y}),()=>{N.colorPickers=N.colorPickers.filter(P=>P.id!==T)}),[N,T]),S.useEffect(()=>{if(v){N.colorPickers.filter(D=>D.id!==T).forEach(D=>D.setExpanded(!1));const P=()=>{y(!1)};return document.addEventListener("click",P),()=>{document.removeEventListener("click",P)}}},[N,T,v]);const A=S.useMemo(()=>b&&w?Ci(b,w):b,[w,b]),R=P=>{j(P),A?.(P?Ff(P):null)};let $=n.jsx(Oh,{isExpanded:v,swatches:g,value:C,onSwatchChange:P=>{R(P),y(!1)},onTogglePicker:()=>!m&&y(!v)});a&&($=n.jsxs("div",{className:me("flex w-full cursor-pointer items-start first:mt-0 dark:text-white",s==="rtl"&&"flex-row-reverse"),children:[n.jsx("div",{className:"shrink-0",children:$}),n.jsxs("div",{className:me("flex-1",s==="rtl"?"pr-2":"pl-2",f?"mt-[-2px]":"mt-[1px]"),onClick:()=>!m&&y(!v),children:[a,f&&n.jsx("div",{className:`text-xs ${p?"text-red":"text-grey-700"}`,children:f})]})]}));const L=g.find(P=>P.value===C);return n.jsxs("div",{className:"flex-col","data-testid":t,onClick:P=>P.stopPropagation(),children:[$,(m||v)&&n.jsx(t1,{clearButtonValue:h,eyedropper:x,hexValue:L?.hex||C||void 0,onChange:R})]})},r1=({value:t,onChange:a,singleParagraph:s=!0,...i})=>{const f=S.useCallback(p=>{const h=new DOMParser().parseFromString(p,"text/html");h.querySelectorAll("*").forEach(g=>{g.style.removeProperty("white-space"),g.getAttribute("style")||g.removeAttribute("style")}),h.body.innerHTML!==t&&a?.(h.body.innerHTML)},[t,a]);return n.jsx(Zv,{...i,singleParagraph:s,children:p=>n.jsx(p.HtmlOutputPlugin,{html:t,setHtml:f})})},Cu=({title:t,hideTitle:a,error:s,hint:i,value:f,clearBg:p=!1,className:x="",containerClassName:h="",hintClassName:b="",unstyled:g=!1,...m})=>{const w=g?"":me("flex min-h-[32px] items-center rounded-md border border-transparent py-1.5 md:min-h-[36px]",p?"bg-transparent":"bg-grey-150 px-3 dark:bg-grey-900",s?"border-red":"transition-all hover:bg-grey-100 has-[:focus]:border-green has-[:focus]:bg-white has-[:focus]:shadow-[0_0_0_1px_rgba(48,207,67,1)] dark:selection:bg-[rgba(88,101,116,0.99)] dark:hover:bg-grey-925 dark:has-[:focus]:bg-grey-950",t&&!a&&!p&&"mt-2",x);return n.jsxs("div",{className:`flex flex-col ${h}`,children:[t&&n.jsx(lt,{className:a?"sr-only":"",grey:!0,useLabelTag:!0,children:t}),n.jsx("div",{className:w,children:n.jsx(r1,{...m,value:f})}),i&&n.jsx(Hn,{className:b,color:s?"red":"",children:i})]})};var Iu="Radio",[s1,Ph]=ch(Iu),[a1,o1]=s1(Iu),Hh=S.forwardRef((t,a)=>{const{__scopeRadio:s,name:i,checked:f=!1,required:p,disabled:x,value:h="on",onCheck:b,form:g,...m}=t,[w,v]=S.useState(null),y=bu(a,N=>v(N)),C=S.useRef(!1),j=w?g||!!w.closest("form"):!0;return n.jsxs(a1,{scope:s,checked:f,disabled:x,children:[n.jsx(Ei.button,{type:"button",role:"radio","aria-checked":f,"data-state":Wh(f),"data-disabled":x?"":void 0,disabled:x,value:h,...m,ref:y,onClick:Jc(t.onClick,N=>{f||b?.(),j&&(C.current=N.isPropagationStopped(),C.current||N.stopPropagation())})}),j&&n.jsx(Bh,{control:w,bubbles:!C.current,name:i,value:h,checked:f,required:p,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});Hh.displayName=Iu;var zh="RadioIndicator",Uh=S.forwardRef((t,a)=>{const{__scopeRadio:s,forceMount:i,...f}=t,p=o1(zh,s);return n.jsx(hv,{present:i||p.checked,children:n.jsx(Ei.span,{"data-state":Wh(p.checked),"data-disabled":p.disabled?"":void 0,...f,ref:a})})});Uh.displayName=zh;var i1="RadioBubbleInput",Bh=S.forwardRef(({__scopeRadio:t,control:a,checked:s,bubbles:i=!0,...f},p)=>{const x=S.useRef(null),h=bu(x,p),b=mv(s),g=gv(a);return S.useEffect(()=>{const m=x.current;if(!m)return;const w=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(w,"checked").set;if(b!==s&&y){const C=new Event("click",{bubbles:i});y.call(m,s),m.dispatchEvent(C)}},[b,s,i]),n.jsx(Ei.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...f,tabIndex:-1,ref:h,style:{...f.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Bh.displayName=i1;function Wh(t){return t?"checked":"unchecked"}var l1=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Di="RadioGroup",[c1]=ch(Di,[lh,Ph]),Yh=lh(),qh=Ph(),[u1,d1]=c1(Di),Gh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,name:i,defaultValue:f,value:p,required:x=!1,disabled:h=!1,orientation:b,dir:g,loop:m=!0,onValueChange:w,...v}=t,y=Yh(s),C=uv(g),[j,N]=dv({prop:p,defaultProp:f??null,onChange:w,caller:Di});return n.jsx(u1,{scope:s,name:i,required:x,disabled:h,value:j,onValueChange:N,children:n.jsx(fv,{asChild:!0,...y,orientation:b,dir:C,loop:m,children:n.jsx(Ei.div,{role:"radiogroup","aria-required":x,"aria-orientation":b,"data-disabled":h?"":void 0,dir:C,...v,ref:a})})})});Gh.displayName=Di;var Xh="RadioGroupItem",Kh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,disabled:i,...f}=t,p=d1(Xh,s),x=p.disabled||i,h=Yh(s),b=qh(s),g=S.useRef(null),m=bu(a,g),w=p.value===f.value,v=S.useRef(!1);return S.useEffect(()=>{const y=j=>{l1.includes(j.key)&&(v.current=!0)},C=()=>v.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",C)}},[]),n.jsx(pv,{asChild:!0,...h,focusable:!x,active:w,children:n.jsx(Hh,{disabled:x,required:p.required,checked:w,...b,...f,name:p.name,ref:m,onCheck:()=>p.onValueChange(f.value),onKeyDown:Jc(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:Jc(f.onFocus,()=>{v.current&&g.current?.click()})})})});Kh.displayName=Xh;var f1="RadioGroupIndicator",Zh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,...i}=t,f=qh(s);return n.jsx(Uh,{...f,...i,ref:a})});Zh.displayName=f1;var p1=Gh,h1=Kh,m1=Zh;const g1=({id:t,title:a,options:s,onSelect:i,error:f,hint:p,selectedOption:x,separator:h})=>n.jsxs(p1,{defaultValue:x,name:t,onValueChange:i,children:[n.jsxs("div",{className:`flex flex-col gap-2 ${h&&"pb-2"}`,children:[a&&n.jsx(lt,{level:6,children:a}),s.map(b=>n.jsxs("label",{className:`flex cursor-pointer items-start ${a&&"mt-1 -mb-1"}`,htmlFor:b.value,children:[n.jsx(h1,{className:"relative float-left mt-[3px] size-4 min-w-[16px] appearance-none rounded-full border-2 border-solid border-grey-300 hover:cursor-pointer focus:shadow-none focus:ring-0 focus:outline-hidden data-[state=checked]:border-green data-[state=checked]:focus:border-green dark:border-grey-800 dark:text-white dark:data-[state=checked]:border-green dark:data-[state=checked]:focus:border-green",id:b.value,value:b.value,children:n.jsx(m1,{className:"flex size-full items-center justify-center after:block after:size-[6px] after:rounded-full after:border-green after:bg-green after:content-[''] dark:after:border-green dark:after:bg-green"})}),n.jsxs("div",{className:`ml-2 flex flex-col ${b.hint&&"mb-2"}`,children:[n.jsx("span",{className:`inline-block text-md dark:text-white ${b.hint&&"-mb-1"}`,children:b.label}),b.hint&&n.jsx(Hn,{children:b.hint})]})]},b.value)),p&&n.jsx(Hn,{color:f?"red":"",children:p})]}),(h||f)&&n.jsx($s,{className:f?"border-red":""})]}),ki=({children:t,gap:a="md",className:s})=>{let i="gap-3";switch(a){case"sm":i="gap-2";break;case"md":i="gap-3";break;case"lg":i="gap-4";break}return s=me("flex flex-col",i,s),n.jsx("div",{className:s,children:t})},Su=({heading:t,children:a,className:s})=>(s=me("w-full p-[8vmin] pt-5",s),n.jsxs("div",{className:s,children:[t&&n.jsx(lt,{className:"mb-8",children:t}),a]})),Au=({items:t,backIcon:a=!1,snapBackIcon:s=!0,onBack:i,containerClassName:f,itemClassName:p,activeItemClassName:x,separatorClassName:h})=>{const b=t.length;let g=0;return f=me("flex items-center gap-2 text-sm",f),x=me("font-bold",x),p=me("text-sm",p),n.jsxs("div",{className:f,children:[a&&n.jsx(Ie,{className:s?"mr-1":"mr-6",icon:"arrow-left",iconColorClass:"dark:text-white",size:"sm",link:!0,onClick:i}),t.map(m=>{const w=g===b-1?n.jsx("span",{className:x,children:m.label}):n.jsxs(n.Fragment,{children:[n.jsx("button",{className:`${p} ${m.onClick&&"-mx-1 cursor-pointer rounded-sm px-1 py-px hover:bg-grey-100 dark:hover:bg-grey-900"}`,type:"button",onClick:m.onClick,children:m.label},`bc-${g}`),n.jsx("span",{className:h,children:"/"})]});return g=g+1,w})]})},Zr=({testId:t,title:a,titleHeadingLevel:s=4,size:i="full",width:f,height:p,sidebar:x="",preview:h,dirty:b=!1,cancelLabel:g="Cancel",okLabel:m="OK",okColor:w="black",previewToolbar:v=!0,leftToolbar:y=!0,rightToolbar:C=!0,deviceSelector:j=!0,siteLink:N,previewToolbarURLs:T,previewBgColor:A="grey",selectedURL:R,previewToolbarTabs:$,previewToolbarBreadcrumbs:L,buttonsDisabled:P,sidebarButtons:D,sidebarHeader:q,sidebarPadding:Y=!0,sidebarContentClasses:z,enableCMDS:G=!0,backDropClick:te,onCancel:fe,onOk:Me,afterClose:K,onSelectURL:Q,onSelectDesktopView:Ne,onSelectMobileView:ue,onBreadcrumbsBack:we})=>{const ee=Lt(),{setGlobalDirtyState:pe}=Vv();S.useEffect(()=>{pe(b)},[b,pe]),S.useEffect(()=>{if(Me){const ve=De=>{(De.metaKey||De.ctrlKey)&&De.key==="s"&&(De.preventDefault(),Me())};if(G)return window.addEventListener("keydown",ve),()=>{window.removeEventListener("keydown",ve)}}});const[le,de]=S.useState("desktop");if(le==="mobile"&&j?h=n.jsx($h,{"data-testid":"preview-mobile",children:h}):le==="desktop"&&j&&(h=n.jsx(Dh,{"data-testid":"preview-desktop",children:h})),v){let ve=n.jsx(n.Fragment,{});T?ve=n.jsx(jt,{options:T,selectedOption:T.find(Je=>Je.value===R),onSelect:Je=>Je&&Q?.(Je.value)}):$?ve=n.jsx(kr,{border:!1,selectedTab:R,tabs:$,width:"wide",onTabChange:Q}):L&&(ve=n.jsx(Au,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:L,separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:we}));const De="text-black dark:text-green",Qe="text-grey-500 dark:text-grey-600",Dt=[{icon:"laptop",label:"Desktop",hideLabel:!0,link:!0,size:"sm",iconColorClass:le==="desktop"?De:Qe,onClick:Ne||(()=>{de("desktop")})},{icon:"mobile",label:"Mobile",hideLabel:!0,link:!0,size:"sm",iconColorClass:le==="mobile"?De:Qe,onClick:ue||(()=>{de("mobile")})}],Gt=j&&n.jsx(Fn,{buttons:Dt});let ae="";A==="grey"?ae="bg-grey-50 dark:bg-black":A==="greygradient"&&(ae="bg-gradient-to-tr from-white to-[#f9f9fa] dark:from-grey-950 dark:to-black");const $e=me("absolute inset-y-0 right-[400px] left-0 flex w-full min-w-100 grow flex-col overflow-y-auto",ae);let Ft;N&&(Ft=n.jsx("div",{className:"ml-3 border-l border-grey-400 dark:border-grey-800",children:n.jsxs("a",{className:"ml-3 flex items-center gap-1 text-sm",href:N,rel:"noopener noreferrer",target:"_blank",children:["View site ",n.jsx(qe,{name:"arrow-top-right",size:"xs"})]})})),h=n.jsxs("div",{className:$e,children:[v&&n.jsxs("header",{className:"relative flex h-[80px] shrink-0 items-center justify-center px-8 py-5","data-testid":"design-toolbar",children:[y&&n.jsx("div",{className:"absolute left-8 flex h-full items-center",children:ve}),C&&n.jsxs("div",{className:"absolute right-8 flex h-full items-center",children:[Gt,Ft]})]}),n.jsx("div",{className:"flex grow items-center justify-center text-sm text-grey-400",children:h})]})}const V=[];return D||(V.push({key:"cancel-modal",label:g,onClick:fe||(()=>{Qv(b,()=>{ee.remove(),K?.()})}),disabled:P}),V.push({key:"ok-modal",label:m,color:w,onClick:Me,disabled:P})),n.jsx(ct,{afterClose:K,animate:!1,backDropClick:te,dirty:b,footer:!1,height:p,padding:!1,size:i,testId:t,title:"",width:f,hideXOnMobile:!0,children:n.jsxs("div",{className:"flex h-full grow",children:[n.jsx("div",{className:`relative hidden grow flex-col [@media(min-width:801px)]:!visible [@media(min-width:801px)]:!flex ${A==="grey"?"bg-grey-50":"bg-white dark:bg-black"}`,children:h}),x&&n.jsxs("div",{className:"relative flex size-full flex-col border-l border-grey-100 dark:border-grey-900 [@media(min-width:801px)]:w-auto [@media(min-width:801px)]:basis-[400px]",children:[q||n.jsxs("div",{className:"flex max-h-[82px] items-center justify-between gap-3 px-7 py-6",children:[n.jsx(lt,{level:s,children:a}),D||n.jsx(Fn,{buttons:V})]}),n.jsx("div",{className:`${q?"":"absolute inset-x-0 top-[80px] bottom-0 grow"} ${Y&&"p-7 pt-0"} flex flex-col justify-between overflow-y-auto ${z&&z}`,children:x})]})]})})},x1=({offset:t,onTrigger:a})=>{const s=S.useRef(null);return S.useEffect(()=>{const i=new IntersectionObserver(f=>{f[0].intersectionRatio<=0||a()});return s.current&&i.observe(s.current),()=>i.disconnect()},[a]),n.jsx("div",{ref:s,className:"absolute w-full",style:{bottom:t}})},Du=({trigger:t,children:a,position:s="start",side:i="bottom",closeOnItemClick:f,open:p,setOpen:x})=>{const[h,b]=S.useState(!1),g=p!==void 0?p:h,m=x||b,w=()=>{f&&m(!1)};return n.jsxs(xv,{open:g,onOpenChange:m,children:[n.jsx(bv,{asChild:!0,children:n.jsx(wv,{asChild:!0,onClick:v=>v.stopPropagation(),children:t})}),n.jsx(vv,{align:s,className:"z-[9999] origin-top-right rounded bg-white shadow-md ring-1 ring-[rgba(0,0,0,0.01)] focus:outline-hidden dark:bg-grey-900 dark:text-white","data-testid":"popover-content",side:i,sideOffset:8,onClick:w,children:a})]})},Vh=({trigger:t,triggerButtonProps:a,items:s,position:i="start",open:f,setOpen:p})=>(t||(t=n.jsx(Ie,{icon:"ellipsis",label:"Menu",hideLabel:!0,...a})),n.jsx(Du,{open:f,position:i,setOpen:p,trigger:t,closeOnItemClick:!0,children:n.jsx("div",{className:"flex min-w-[160px] flex-col justify-stretch py-1",role:"none",children:s.map(x=>n.jsx("button",{className:`mx-1 block cursor-pointer rounded-[2.5px] px-4 py-1.5 text-left text-sm hover:bg-grey-100 dark:hover:bg-grey-925 ${x.destructive&&" text-red-500"}`,type:"button",onClick:h=>{x.onClick&&x.onClick(h)},children:x.label},x.id))})}));var Qh=typeof global=="object"&&global&&global.Object===Object&&global,b1=typeof self=="object"&&self&&self.Object===Object&&self,ir=Qh||b1||Function("return this")(),Os=ir.Symbol,Jh=Object.prototype,w1=Jh.hasOwnProperty,v1=Jh.toString,Sa=Os?Os.toStringTag:void 0;function y1(t){var a=w1.call(t,Sa),s=t[Sa];try{t[Sa]=void 0;var i=!0}catch{}var f=v1.call(t);return i&&(a?t[Sa]=s:delete t[Sa]),f}var _1=Object.prototype,M1=_1.toString;function k1(t){return M1.call(t)}var j1="[object Null]",N1="[object Undefined]",Pf=Os?Os.toStringTag:void 0;function Wa(t){return t==null?t===void 0?N1:j1:Pf&&Pf in Object(t)?y1(t):k1(t)}function Pa(t){return t!=null&&typeof t=="object"}var ji=Array.isArray;function em(t){var a=typeof t;return t!=null&&(a=="object"||a=="function")}var T1="[object AsyncFunction]",E1="[object Function]",C1="[object GeneratorFunction]",I1="[object Proxy]";function tm(t){if(!em(t))return!1;var a=Wa(t);return a==E1||a==C1||a==T1||a==I1}var Ac=ir["__core-js_shared__"],Hf=(function(){var t=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function S1(t){return!!Hf&&Hf in t}var A1=Function.prototype,D1=A1.toString;function Vr(t){if(t!=null){try{return D1.call(t)}catch{}try{return t+""}catch{}}return""}var $1=/[\\^$.*+?()[\]{}|]/g,O1=/^\[object .+?Constructor\]$/,R1=Function.prototype,L1=Object.prototype,F1=R1.toString,P1=L1.hasOwnProperty,H1=RegExp("^"+F1.call(P1).replace($1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z1(t){if(!em(t)||S1(t))return!1;var a=tm(t)?H1:O1;return a.test(Vr(t))}function U1(t,a){return t?.[a]}function zs(t,a){var s=U1(t,a);return z1(s)?s:void 0}var cu=zs(ir,"WeakMap"),B1=9007199254740991,W1=/^(?:0|[1-9]\d*)$/;function Y1(t,a){var s=typeof t;return a=a??B1,!!a&&(s=="number"||s!="symbol"&&W1.test(t))&&t>-1&&t%1==0&&t<a}function nm(t,a){return t===a||t!==t&&a!==a}var q1=9007199254740991;function rm(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=q1}function G1(t){return t!=null&&rm(t.length)&&!tm(t)}var X1=Object.prototype;function K1(t){var a=t&&t.constructor,s=typeof a=="function"&&a.prototype||X1;return t===s}function Z1(t,a){for(var s=-1,i=Array(t);++s<t;)i[s]=a(s);return i}var V1="[object Arguments]";function zf(t){return Pa(t)&&Wa(t)==V1}var sm=Object.prototype,Q1=sm.hasOwnProperty,J1=sm.propertyIsEnumerable,e_=zf((function(){return arguments})())?zf:function(t){return Pa(t)&&Q1.call(t,"callee")&&!J1.call(t,"callee")};function t_(){return!1}var am=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uf=am&&typeof module=="object"&&module&&!module.nodeType&&module,n_=Uf&&Uf.exports===am,Bf=n_?ir.Buffer:void 0,r_=Bf?Bf.isBuffer:void 0,uu=r_||t_,s_="[object Arguments]",a_="[object Array]",o_="[object Boolean]",i_="[object Date]",l_="[object Error]",c_="[object Function]",u_="[object Map]",d_="[object Number]",f_="[object Object]",p_="[object RegExp]",h_="[object Set]",m_="[object String]",g_="[object WeakMap]",x_="[object ArrayBuffer]",b_="[object DataView]",w_="[object Float32Array]",v_="[object Float64Array]",y_="[object Int8Array]",__="[object Int16Array]",M_="[object Int32Array]",k_="[object Uint8Array]",j_="[object Uint8ClampedArray]",N_="[object Uint16Array]",T_="[object Uint32Array]",pt={};pt[w_]=pt[v_]=pt[y_]=pt[__]=pt[M_]=pt[k_]=pt[j_]=pt[N_]=pt[T_]=!0;pt[s_]=pt[a_]=pt[x_]=pt[o_]=pt[b_]=pt[i_]=pt[l_]=pt[c_]=pt[u_]=pt[d_]=pt[f_]=pt[p_]=pt[h_]=pt[m_]=pt[g_]=!1;function E_(t){return Pa(t)&&rm(t.length)&&!!pt[Wa(t)]}function C_(t){return function(a){return t(a)}}var om=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oa=om&&typeof module=="object"&&module&&!module.nodeType&&module,I_=Oa&&Oa.exports===om,Dc=I_&&Qh.process,Wf=(function(){try{var t=Oa&&Oa.require&&Oa.require("util").types;return t||Dc&&Dc.binding&&Dc.binding("util")}catch{}})(),Yf=Wf&&Wf.isTypedArray,im=Yf?C_(Yf):E_,S_=Object.prototype,A_=S_.hasOwnProperty;function D_(t,a){var s=ji(t),i=!s&&e_(t),f=!s&&!i&&uu(t),p=!s&&!i&&!f&&im(t),x=s||i||f||p,h=x?Z1(t.length,String):[],b=h.length;for(var g in t)A_.call(t,g)&&!(x&&(g=="length"||f&&(g=="offset"||g=="parent")||p&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||Y1(g,b)))&&h.push(g);return h}function $_(t,a){return function(s){return t(a(s))}}var O_=$_(Object.keys,Object),R_=Object.prototype,L_=R_.hasOwnProperty;function F_(t){if(!K1(t))return O_(t);var a=[];for(var s in Object(t))L_.call(t,s)&&s!="constructor"&&a.push(s);return a}function P_(t){return G1(t)?D_(t):F_(t)}var Ha=zs(Object,"create");function H_(){this.__data__=Ha?Ha(null):{},this.size=0}function z_(t){var a=this.has(t)&&delete this.__data__[t];return this.size-=a?1:0,a}var U_="__lodash_hash_undefined__",B_=Object.prototype,W_=B_.hasOwnProperty;function Y_(t){var a=this.__data__;if(Ha){var s=a[t];return s===U_?void 0:s}return W_.call(a,t)?a[t]:void 0}var q_=Object.prototype,G_=q_.hasOwnProperty;function X_(t){var a=this.__data__;return Ha?a[t]!==void 0:G_.call(a,t)}var K_="__lodash_hash_undefined__";function Z_(t,a){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=Ha&&a===void 0?K_:a,this}function qr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}qr.prototype.clear=H_;qr.prototype.delete=z_;qr.prototype.get=Y_;qr.prototype.has=X_;qr.prototype.set=Z_;function V_(){this.__data__=[],this.size=0}function $i(t,a){for(var s=t.length;s--;)if(nm(t[s][0],a))return s;return-1}var Q_=Array.prototype,J_=Q_.splice;function e3(t){var a=this.__data__,s=$i(a,t);if(s<0)return!1;var i=a.length-1;return s==i?a.pop():J_.call(a,s,1),--this.size,!0}function t3(t){var a=this.__data__,s=$i(a,t);return s<0?void 0:a[s][1]}function n3(t){return $i(this.__data__,t)>-1}function r3(t,a){var s=this.__data__,i=$i(s,t);return i<0?(++this.size,s.push([t,a])):s[i][1]=a,this}function lr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}lr.prototype.clear=V_;lr.prototype.delete=e3;lr.prototype.get=t3;lr.prototype.has=n3;lr.prototype.set=r3;var za=zs(ir,"Map");function s3(){this.size=0,this.__data__={hash:new qr,map:new(za||lr),string:new qr}}function a3(t){var a=typeof t;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?t!=="__proto__":t===null}function Oi(t,a){var s=t.__data__;return a3(a)?s[typeof a=="string"?"string":"hash"]:s.map}function o3(t){var a=Oi(this,t).delete(t);return this.size-=a?1:0,a}function i3(t){return Oi(this,t).get(t)}function l3(t){return Oi(this,t).has(t)}function c3(t,a){var s=Oi(this,t),i=s.size;return s.set(t,a),this.size+=s.size==i?0:1,this}function Qr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}Qr.prototype.clear=s3;Qr.prototype.delete=o3;Qr.prototype.get=i3;Qr.prototype.has=l3;Qr.prototype.set=c3;function u3(t,a){for(var s=-1,i=a.length,f=t.length;++s<i;)t[f+s]=a[s];return t}function d3(){this.__data__=new lr,this.size=0}function f3(t){var a=this.__data__,s=a.delete(t);return this.size=a.size,s}function p3(t){return this.__data__.get(t)}function h3(t){return this.__data__.has(t)}var m3=200;function g3(t,a){var s=this.__data__;if(s instanceof lr){var i=s.__data__;if(!za||i.length<m3-1)return i.push([t,a]),this.size=++s.size,this;s=this.__data__=new Qr(i)}return s.set(t,a),this.size=s.size,this}function _r(t){var a=this.__data__=new lr(t);this.size=a.size}_r.prototype.clear=d3;_r.prototype.delete=f3;_r.prototype.get=p3;_r.prototype.has=h3;_r.prototype.set=g3;function x3(t,a){for(var s=-1,i=t==null?0:t.length,f=0,p=[];++s<i;){var x=t[s];a(x,s,t)&&(p[f++]=x)}return p}function b3(){return[]}var w3=Object.prototype,v3=w3.propertyIsEnumerable,qf=Object.getOwnPropertySymbols,y3=qf?function(t){return t==null?[]:(t=Object(t),x3(qf(t),function(a){return v3.call(t,a)}))}:b3;function _3(t,a,s){var i=a(t);return ji(t)?i:u3(i,s(t))}function Gf(t){return _3(t,P_,y3)}var du=zs(ir,"DataView"),fu=zs(ir,"Promise"),pu=zs(ir,"Set"),Xf="[object Map]",M3="[object Object]",Kf="[object Promise]",Zf="[object Set]",Vf="[object WeakMap]",Qf="[object DataView]",k3=Vr(du),j3=Vr(za),N3=Vr(fu),T3=Vr(pu),E3=Vr(cu),yr=Wa;(du&&yr(new du(new ArrayBuffer(1)))!=Qf||za&&yr(new za)!=Xf||fu&&yr(fu.resolve())!=Kf||pu&&yr(new pu)!=Zf||cu&&yr(new cu)!=Vf)&&(yr=function(t){var a=Wa(t),s=a==M3?t.constructor:void 0,i=s?Vr(s):"";if(i)switch(i){case k3:return Qf;case j3:return Xf;case N3:return Kf;case T3:return Zf;case E3:return Vf}return a});var Jf=ir.Uint8Array,C3="__lodash_hash_undefined__";function I3(t){return this.__data__.set(t,C3),this}function S3(t){return this.__data__.has(t)}function Ni(t){var a=-1,s=t==null?0:t.length;for(this.__data__=new Qr;++a<s;)this.add(t[a])}Ni.prototype.add=Ni.prototype.push=I3;Ni.prototype.has=S3;function A3(t,a){for(var s=-1,i=t==null?0:t.length;++s<i;)if(a(t[s],s,t))return!0;return!1}function D3(t,a){return t.has(a)}var $3=1,O3=2;function lm(t,a,s,i,f,p){var x=s&$3,h=t.length,b=a.length;if(h!=b&&!(x&&b>h))return!1;var g=p.get(t),m=p.get(a);if(g&&m)return g==a&&m==t;var w=-1,v=!0,y=s&O3?new Ni:void 0;for(p.set(t,a),p.set(a,t);++w<h;){var C=t[w],j=a[w];if(i)var N=x?i(j,C,w,a,t,p):i(C,j,w,t,a,p);if(N!==void 0){if(N)continue;v=!1;break}if(y){if(!A3(a,function(T,A){if(!D3(y,A)&&(C===T||f(C,T,s,i,p)))return y.push(A)})){v=!1;break}}else if(!(C===j||f(C,j,s,i,p))){v=!1;break}}return p.delete(t),p.delete(a),v}function R3(t){var a=-1,s=Array(t.size);return t.forEach(function(i,f){s[++a]=[f,i]}),s}function L3(t){var a=-1,s=Array(t.size);return t.forEach(function(i){s[++a]=i}),s}var F3=1,P3=2,H3="[object Boolean]",z3="[object Date]",U3="[object Error]",B3="[object Map]",W3="[object Number]",Y3="[object RegExp]",q3="[object Set]",G3="[object String]",X3="[object Symbol]",K3="[object ArrayBuffer]",Z3="[object DataView]",ep=Os?Os.prototype:void 0,$c=ep?ep.valueOf:void 0;function V3(t,a,s,i,f,p,x){switch(s){case Z3:if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case K3:return!(t.byteLength!=a.byteLength||!p(new Jf(t),new Jf(a)));case H3:case z3:case W3:return nm(+t,+a);case U3:return t.name==a.name&&t.message==a.message;case Y3:case G3:return t==a+"";case B3:var h=R3;case q3:var b=i&F3;if(h||(h=L3),t.size!=a.size&&!b)return!1;var g=x.get(t);if(g)return g==a;i|=P3,x.set(t,a);var m=lm(h(t),h(a),i,f,p,x);return x.delete(t),m;case X3:if($c)return $c.call(t)==$c.call(a)}return!1}var Q3=1,J3=Object.prototype,eM=J3.hasOwnProperty;function tM(t,a,s,i,f,p){var x=s&Q3,h=Gf(t),b=h.length,g=Gf(a),m=g.length;if(b!=m&&!x)return!1;for(var w=b;w--;){var v=h[w];if(!(x?v in a:eM.call(a,v)))return!1}var y=p.get(t),C=p.get(a);if(y&&C)return y==a&&C==t;var j=!0;p.set(t,a),p.set(a,t);for(var N=x;++w<b;){v=h[w];var T=t[v],A=a[v];if(i)var R=x?i(A,T,v,a,t,p):i(T,A,v,t,a,p);if(!(R===void 0?T===A||f(T,A,s,i,p):R)){j=!1;break}N||(N=v=="constructor")}if(j&&!N){var $=t.constructor,L=a.constructor;$!=L&&"constructor"in t&&"constructor"in a&&!(typeof $=="function"&&$ instanceof $&&typeof L=="function"&&L instanceof L)&&(j=!1)}return p.delete(t),p.delete(a),j}var nM=1,tp="[object Arguments]",np="[object Array]",hi="[object Object]",rM=Object.prototype,rp=rM.hasOwnProperty;function sM(t,a,s,i,f,p){var x=ji(t),h=ji(a),b=x?np:yr(t),g=h?np:yr(a);b=b==tp?hi:b,g=g==tp?hi:g;var m=b==hi,w=g==hi,v=b==g;if(v&&uu(t)){if(!uu(a))return!1;x=!0,m=!1}if(v&&!m)return p||(p=new _r),x||im(t)?lm(t,a,s,i,f,p):V3(t,a,b,s,i,f,p);if(!(s&nM)){var y=m&&rp.call(t,"__wrapped__"),C=w&&rp.call(a,"__wrapped__");if(y||C){var j=y?t.value():t,N=C?a.value():a;return p||(p=new _r),f(j,N,s,i,p)}}return v?(p||(p=new _r),tM(t,a,s,i,f,p)):!1}function cm(t,a,s,i,f){return t===a?!0:t==null||a==null||!Pa(t)&&!Pa(a)?t!==t&&a!==a:sM(t,a,s,i,cm,f)}function aM(t,a){return cm(t,a)}const sp=({className:t,children:a,colSpan:s,sticky:i=!1,...f})=>{const p=me("py-2! pr-6! pl-0! text-left align-top",i&&"sticky top-0 bg-white",f.onClick&&"hover:cursor-pointer",t);return n.jsx("th",{className:p,colSpan:s,...f,children:n.jsx(lt,{className:"whitespace-nowrap",level:6,children:a})})},um=({left:t,center:a,right:s,sticky:i=!0,containerClassName:f,children:p})=>{const x=me("z-50 h-22 min-h-[92px] p-8",!p&&"flex items-center justify-between gap-3",i&&"sticky top-0",f);if(!p){if(t){const h=me("flex flex-auto items-center",s&&a&&"basis-1/3",!s&&a&&"basis-1/2");t=n.jsx("div",{className:h,children:t})}if(a){const h=me("flex flex-auto items-center justify-center",t&&s&&"basis-1/3",(t&&!s||!t&&s)&&"basis-1/2");a=n.jsx("div",{className:h,children:a})}if(s){const h=me("flex flex-auto items-center justify-end",t&&a&&"basis-1/3",!t&&a&&"basis-1/2");s=n.jsx("div",{className:h,children:s})}}return n.jsx("div",{className:x,children:p||n.jsxs(n.Fragment,{children:[t,a,s]})})},dm=({items:t,setItems:a,blank:s,canAddNewItem:i})=>{const[f,p]=S.useState(t.map((v,y)=>({item:v,id:y.toString()}))),[x,h]=S.useState(s);return S.useEffect(()=>{const v=f.map(({item:y})=>y);i(x)&&v.push(x),aM(JSON.parse(JSON.stringify(v)),JSON.parse(JSON.stringify(t)))||a(v)},[f,x,t,a,i]),{items:f,updateItem:(v,y)=>{const C=f.map(j=>j.id===v?{...j,item:y}:j);p(C),a(C.map(j=>j.item))},addItem:()=>{if(i(x)){const v=f.reduce((C,j)=>Math.max(C,parseInt(j.id)),0),y=f.concat({item:x,id:(v+1).toString()});p(y),a(y.map(C=>C.item)),h(s)}},removeItem:v=>{const y=f.filter(C=>C.id!==v);p(y),a(y.map(C=>C.item))},moveItem:(v,y)=>{if(v!==y){const C=f.findIndex(T=>T.id===v),j=y?f.findIndex(T=>T.id===y):0,N=Jv(f,C,j);p(N),a(N.map(T=>T.item))}},newItem:x,setNewItem:h}},oM=({label:t,text:a="",hint:s,onRegenerate:i})=>{const[f,p]=S.useState(!1),x=()=>{navigator.clipboard.writeText(a),p(!0),setTimeout(()=>p(!1),2e3)},h=me("group/api-keys relative -mt-1 mb-1 w-full overflow-hidden border-b border-transparent py-2 hover:border-grey-300 dark:hover:border-grey-600");return n.jsxs("div",{className:"mb-3 grid grid-cols-1",children:[t&&n.jsx(lt,{level:6,grey:!0,children:t}),n.jsxs("div",{className:h,children:[n.jsx("span",{children:a}),s,n.jsxs("div",{className:"visible absolute top-1/2 right-0 flex translate-y-[-50%] gap-1 bg-white pl-1 text-sm group-hover/api-keys:visible md:invisible dark:bg-black",children:[i&&n.jsx(Ie,{color:"outline",label:"Regenerate",size:"sm",onClick:i}),n.jsx(Ie,{color:"outline",label:f?"Copied":"Copy",size:"sm",onClick:x})]})]})]})},Ya=({keys:t})=>n.jsx("div",{"data-testid":"api-keys",children:t.map(a=>n.jsx(oM,{...a},a.label))}),Jr=({icon:t,title:a,detail:s,extra:i})=>n.jsxs("div",{className:"-mx-8 -mt-8 flex flex-col gap-4 bg-grey-75 p-8 md:flex-row dark:bg-grey-950",children:[n.jsx("div",{className:"size-14",children:t}),n.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-1 flex-col",children:[n.jsx("h3",{children:a}),n.jsx("div",{children:s}),i&&n.jsx("div",{className:"mt-4",children:i})]})]}),iM=""+new URL("zapier-logo-D8a11oW_.svg",import.meta.url).href,$u=Gr({method:"POST",path:({integrationId:t,apiKeyId:a})=>`/integrations/${t}/api_key/${a}/refresh/`,body:({integrationId:t})=>({integrations:[{id:t}]}),updateQueries:{emberUpdateType:"createOrUpdate",dataType:Ii,update:(t,a)=>a&&{...a,integrations:a.integrations.map(s=>t.integrations.find(({id:f})=>f===s.id)||s)}}}),lM=ge.create(()=>{const t=ge.useModal(),{updateRoute:a}=He(),{zapierTemplates:s}=ey(),{data:{integrations:i}={integrations:[]}}=Si(),{config:f}=Ue(),{mutateAsync:p}=$u(),x=Ze(),[h,b]=S.useState(!1),g=f.hostSettings?.limits?.customIntegrations?.disabled,m=i.find(({slug:y})=>y==="zapier"),w=m?.api_keys?.find(y=>y.type==="admin");S.useEffect(()=>{g&&a("integrations")},[g,a]);const v=()=>{!m||!w||(b(!1),ge.show(xt,{title:"Regenerate Admin API Key",prompt:'You will need to locate the Ghost App within your Zapier account and click on "Reconnect" to enter the new Admin API Key.',okLabel:"Regenerate Admin API Key",onOk:async y=>{try{await p({integrationId:m.id,apiKeyId:w.id}),b(!0),y?.remove()}catch(C){x(C)}}}))};return n.jsxs(ct,{afterClose:()=>{a("integrations")},cancelLabel:"",footer:n.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[n.jsxs("a",{className:"mt-1 self-baseline text-sm font-bold",href:"https://zapier.com/apps/ghost/integrations?utm_medium=partner_api&utm_source=widget&utm_campaign=Widget",rel:"noopener noreferrer",target:"_blank",children:["View more Ghost integrations powered by ",n.jsx("span",{children:n.jsx("img",{alt:"Zapier",className:"relative top-[-2px] inline-block",src:iM})})]}),n.jsx(Ie,{color:"black",label:"Close",onClick:()=>{t.remove()}})]}),okColor:"black",okLabel:"Close",testId:"zapier-modal",title:"",stickyFooter:!0,onOk:()=>{a("integrations"),t.remove()},children:[n.jsx(Jr,{detail:"Automation for your favorite apps",extra:n.jsx("div",{className:"mt-1 -mb-4",children:n.jsx(Ya,{keys:[{label:"Admin API key",text:w?.secret,hint:h?n.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:v},{label:"API URL",text:window.location.origin+Rs().subdir}]})}),icon:n.jsx(qe,{name:"zapier",size:56}),title:"Zapier"}),n.jsx(sr,{children:s.map(y=>n.jsx(Nr,{action:n.jsx(Ie,{className:"text-sm font-semibold whitespace-nowrap text-[#FF4A00]",href:y.url,label:"Use this Zap",tag:"a",target:"_blank",link:!0,unstyled:!0}),bgOnHover:!1,className:"flex items-center gap-3 py-2 pl-3",title:n.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[n.jsxs("div",{className:"flex shrink-0 flex-nowrap items-center gap-2",children:[n.jsx("img",{className:"size-8 object-contain dark:invert",role:"presentation",src:y.ghostImage}),n.jsx(qe,{name:"arrow-right",size:"xs"}),n.jsx("img",{className:"size-8 object-contain",role:"presentation",src:y.appImage})]}),n.jsx("span",{className:"text-sm",children:y.title})]}),hideActions:!0}))})]})}),cM=({tier:t})=>{const a=t?.type==="free",{updateRoute:s}=He(),{mutateAsync:i}=Tu(),{mutateAsync:f}=Sy(),{mutateAsync:p}=jr(),[x,h]=Ve.useState(!!t?.trial_days),b=Ze(),{localSettings:g,siteData:m}=Xr(),[w]=ot(g,["portal_plans"]),v=JSON.parse(w?.toString()||"[]"),y={name:()=>C.name?void 0:"Enter a name for the tier",monthly_price:()=>C.type!=="free"?Cf(C.monthly_price||0,C.currency,{allowZero:!1}):void 0,yearly_price:()=>C.type!=="free"?Cf(C.yearly_price||0,C.currency,{allowZero:!1}):void 0},{formState:C,saveState:j,updateForm:N,handleSave:T,errors:A,clearError:R,okProps:$}=nn({initialState:{...t||{},trial_days:t?.trial_days?.toString()||"",currency:t?.currency||ty[0].isoCode,visibility:t?.visibility||"none",welcome_page_url:t?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{const z={};return Object.entries(y).forEach(([G,te])=>{z[G]=te?.()}),z},onSave:async()=>{const{trial_days:z,currency:G,...te}=C,fe=te;if(fe.benefits=fe.benefits?.filter(Me=>Me),a||(fe.currency=G,fe.trial_days=parseInt(z)),t?.id?await i({...t,...fe}):await f(fe),a){const Me=C.visibility==="public";let K=!1;v.includes("free")&&!Me&&(v.splice(v.indexOf("free"),1),K=!0),!v.includes("free")&&Me&&(v.push("free"),K=!0),K&&await p([{key:"portal_plans",value:JSON.stringify(v)}])}},onSaveError:b}),L=dm({items:C.benefits||[],setItems:z=>N(G=>({...G,benefits:z})),blank:"",canAddNewItem:z=>!!z}),P=z=>{z.target.checked?(h(!0),N(G=>({...G,trial_days:t?.trial_days?t?.trial_days.toString():"7"}))):(h(!1),N(G=>({...G,trial_days:"0"})))},D=S.useRef(!1);S.useEffect(()=>{D.current&&(y.monthly_price?.(),y.yearly_price?.()),D.current=!0},[C.currency]);const q=()=>{if(t){const z=t.active?"Archive tier":"Reactivate tier",G=t.active?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Members will no longer be able to subscribe to ",n.jsx("strong",{children:t.name})," and it will be removed from the list of available tiers in portal."]}),n.jsx("div",{children:"Existing members on this tier will remain unchanged. Offers using this tier will be disabled."})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Reactivating ",n.jsx("strong",{children:t.name})," will re-enable it as an option in portal and allow new members to subscribe to this tier."]}),n.jsx("div",{children:"Existing members will remain unchanged."})]}),te=t.active?"Archive":"Reactivate";ge.show(xt,{title:z,prompt:G,okLabel:te,cancelLabel:"Cancel",okColor:t.active?"red":"black",onOk:fe=>{i({...t,active:!t.active}),fe?.remove(),rt({type:"success",title:`Tier ${t.active?"archived":"reactivated"}`})}})}};let Y={};return t&&(t.active&&t.type!=="free"?Y={label:"Archive tier",color:"red",link:!0,onClick:q}:t.active||(Y={label:"Reactivate tier",color:"green",link:!0,onClick:q})),n.jsx(ct,{afterClose:()=>{s("tiers")},buttonsDisabled:$.disabled,cancelLabel:"Close",dirty:j==="unsaved",leftButtonProps:Y,okColor:$.color,okLabel:$.label||"Save",size:"lg",testId:"tier-detail-modal",title:t?t.active?"Edit tier":"Edit archived tier":"New tier",stickyFooter:!0,onOk:async()=>{await T({fakeWhenUnchanged:!0})},children:n.jsxs("div",{className:"mt-8 -mb-8 flex items-start gap-8",children:[n.jsxs("div",{className:"flex grow flex-col gap-8",children:[n.jsxs(Ye,{marginBottom:!1,title:"Basic",grouped:!0,children:[n.jsx(_e,{autoComplete:"off",error:!!A.name,hint:A.name,maxLength:191,placeholder:a?"Free":"Bronze",title:"Name",value:C.name||"",autoFocus:!0,onChange:z=>N(G=>({...G,name:z.target.value})),onKeyDown:()=>R("name")}),n.jsx(_e,{autoComplete:"off",autoFocus:a,maxLength:191,placeholder:a?"Free preview":"Full access to premium content",title:"Description",value:C.description||"",onChange:z=>N(G=>({...G,description:z.target.value}))}),!a&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"flex flex-col gap-10 md:flex-row",children:[n.jsxs("div",{className:"basis-1/2",children:[n.jsxs("div",{className:"mb-1 flex h-6 items-center justify-between",children:[n.jsx(lt,{level:6,children:"Prices"}),n.jsx("div",{className:"-mr-2 w-[50px]",children:n.jsx(jt,{border:!1,containerClassName:"font-medium",controlClasses:{menu:"w-18"},options:Tf(),selectedOption:Tf().flatMap(z=>z.options).find(z=>z.value===C.currency),size:"xs",clearBg:!0,isSearchable:!0,onSelect:z=>N(G=>({...G,currency:z?.value}))})})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(Ef,{error:!!A.monthly_price,hint:A.monthly_price,placeholder:"5",rightPlaceholder:`${C.currency}/month`,title:"Monthly price",valueInCents:C.monthly_price||"",hideTitle:!0,onBlur:z=>z.target.value===""?N(G=>({...G,monthly_price:0})):null,onChange:z=>N(G=>({...G,monthly_price:z})),onKeyDown:()=>R("monthly_price")}),n.jsx(Ef,{error:!!A.yearly_price,hint:A.yearly_price,placeholder:"50",rightPlaceholder:`${C.currency}/year`,title:"Yearly price",valueInCents:C.yearly_price||"",hideTitle:!0,onBlur:z=>z.target.value===""?N(G=>({...G,yearly_price:0})):null,onChange:z=>N(G=>({...G,yearly_price:z})),onKeyDown:()=>R("yearly_price")})]})]}),n.jsxs("div",{className:"basis-1/2",children:[n.jsx("div",{className:"mb-1 flex h-6 flex-col justify-center",children:n.jsx(Be,{checked:x,label:"Add a free trial",labelStyle:"heading",onChange:P})}),n.jsx(_e,{disabled:!x,hint:n.jsxs("div",{className:"mt-1",children:["Members will be subscribed at full price once the trial ends. ",n.jsx("a",{className:"text-green",href:"https://ghost.org/help/free-trials/",rel:"noreferrer",target:"_blank",children:"Learn more"})]}),placeholder:"0",rightPlaceholder:"days",title:"Trial days",value:C.trial_days,hideTitle:!0,onChange:z=>N(G=>({...G,trial_days:z.target.value.replace(/[^\d]/,"")}))})]})]})}),n.jsx(gh,{baseUrl:m?.url,hint:`Redirect to this URL after signup ${a?"":" for premium membership"}`,maxLength:2e3,placeholder:m?.url,title:"Welcome page",value:C.welcome_page_url||null,nullable:!0,transformPathWithoutSlash:!0,onChange:z=>N(G=>({...G,welcome_page_url:z||null}))})]}),n.jsxs(Ye,{gap:"none",title:"Benefits",grouped:!0,children:[n.jsx("div",{className:"-mt-3",children:n.jsx(xh,{items:L.items,itemSeparator:!1,renderItem:({id:z,item:G})=>n.jsxs("div",{className:"relative flex w-full items-center gap-5",children:[n.jsx("div",{className:"absolute top-[7px] left-[-32px] flex size-6 items-center justify-center bg-white group-hover:hidden dark:bg-black",children:n.jsx(qe,{name:"check",size:"sm"})}),n.jsx(_e,{maxLength:191,value:G,onChange:te=>L.updateItem(z,te.target.value)}),n.jsx(Ie,{className:"absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100",color:"grey",icon:"trash",size:"sm",onClick:()=>L.removeItem(z)})]}),onMove:L.moveItem})}),n.jsxs("div",{className:"relative mt-1 flex items-center gap-3",children:[n.jsx(qe,{className:"dark:text-white",name:"check",size:"sm"}),n.jsx(_e,{className:"grow",containerClassName:"w-100",maxLength:191,placeholder:"Expert analysis",title:"New benefit",value:L.newItem,hideTitle:!0,onChange:z=>L.setNewItem(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.addItem()}}),n.jsx(Ie,{className:"absolute top-[5px] right-[5px] z-10",color:"green",icon:"add",iconColorClass:"text-white",label:"Add",size:"sm",hideLabel:!0,onClick:()=>L.addItem()})]})]})]}),n.jsx("div",{className:"sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block",children:n.jsx(ny,{isFreeTier:a,tier:C})})]})})},uM=({params:t})=>{const{data:{tiers:a,isEnd:s}={},fetchNextPage:i}=Kr();let f;return S.useEffect(()=>{t?.id&&!f&&!s&&i()},[i,s,t?.id,f]),t?.id&&(f=a?.find(({id:p})=>p===t?.id),!f)?null:n.jsx(cM,{tier:f})},dM=ge.create(uM);var Oc,ap;function fm(){if(ap)return Oc;ap=1;var t={};return Oc=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...s)=>console.error("SEMVER",...s):()=>{},Oc}var Rc,op;function pm(){if(op)return Rc;op=1;const t="2.0.0",a=256,s=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,f=a-6;return Rc={MAX_LENGTH:a,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:f,MAX_SAFE_INTEGER:s,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Rc}var mi={exports:{}},ip;function fM(){return ip||(ip=1,(function(t,a){const{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:f}=pm(),p=fm();a=t.exports={};const x=a.re=[],h=a.safeRe=[],b=a.src=[],g=a.safeSrc=[],m=a.t={};let w=0;const v="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",f],[v,i]],C=N=>{for(const[T,A]of y)N=N.split(`${T}*`).join(`${T}{0,${A}}`).split(`${T}+`).join(`${T}{1,${A}}`);return N},j=(N,T,A)=>{const R=C(T),$=w++;p(N,$,T),m[N]=$,b[$]=T,g[$]=R,x[$]=new RegExp(T,A?"g":void 0),h[$]=new RegExp(R,A?"g":void 0)};j("NUMERICIDENTIFIER","0|[1-9]\\d*"),j("NUMERICIDENTIFIERLOOSE","\\d+"),j("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${v}*`),j("MAINVERSION",`(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})`),j("MAINVERSIONLOOSE",`(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})`),j("PRERELEASEIDENTIFIER",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIER]})`),j("PRERELEASEIDENTIFIERLOOSE",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIERLOOSE]})`),j("PRERELEASE",`(?:-(${b[m.PRERELEASEIDENTIFIER]}(?:\\.${b[m.PRERELEASEIDENTIFIER]})*))`),j("PRERELEASELOOSE",`(?:-?(${b[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[m.PRERELEASEIDENTIFIERLOOSE]})*))`),j("BUILDIDENTIFIER",`${v}+`),j("BUILD",`(?:\\+(${b[m.BUILDIDENTIFIER]}(?:\\.${b[m.BUILDIDENTIFIER]})*))`),j("FULLPLAIN",`v?${b[m.MAINVERSION]}${b[m.PRERELEASE]}?${b[m.BUILD]}?`),j("FULL",`^${b[m.FULLPLAIN]}$`),j("LOOSEPLAIN",`[v=\\s]*${b[m.MAINVERSIONLOOSE]}${b[m.PRERELEASELOOSE]}?${b[m.BUILD]}?`),j("LOOSE",`^${b[m.LOOSEPLAIN]}$`),j("GTLT","((?:<|>)?=?)"),j("XRANGEIDENTIFIERLOOSE",`${b[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),j("XRANGEIDENTIFIER",`${b[m.NUMERICIDENTIFIER]}|x|X|\\*`),j("XRANGEPLAIN",`[v=\\s]*(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:${b[m.PRERELEASE]})?${b[m.BUILD]}?)?)?`),j("XRANGEPLAINLOOSE",`[v=\\s]*(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:${b[m.PRERELEASELOOSE]})?${b[m.BUILD]}?)?)?`),j("XRANGE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAIN]}$`),j("XRANGELOOSE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAINLOOSE]}$`),j("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),j("COERCE",`${b[m.COERCEPLAIN]}(?:$|[^\\d])`),j("COERCEFULL",b[m.COERCEPLAIN]+`(?:${b[m.PRERELEASE]})?(?:${b[m.BUILD]})?(?:$|[^\\d])`),j("COERCERTL",b[m.COERCE],!0),j("COERCERTLFULL",b[m.COERCEFULL],!0),j("LONETILDE","(?:~>?)"),j("TILDETRIM",`(\\s*)${b[m.LONETILDE]}\\s+`,!0),a.tildeTrimReplace="$1~",j("TILDE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAIN]}$`),j("TILDELOOSE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAINLOOSE]}$`),j("LONECARET","(?:\\^)"),j("CARETTRIM",`(\\s*)${b[m.LONECARET]}\\s+`,!0),a.caretTrimReplace="$1^",j("CARET",`^${b[m.LONECARET]}${b[m.XRANGEPLAIN]}$`),j("CARETLOOSE",`^${b[m.LONECARET]}${b[m.XRANGEPLAINLOOSE]}$`),j("COMPARATORLOOSE",`^${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]})$|^$`),j("COMPARATOR",`^${b[m.GTLT]}\\s*(${b[m.FULLPLAIN]})$|^$`),j("COMPARATORTRIM",`(\\s*)${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]}|${b[m.XRANGEPLAIN]})`,!0),a.comparatorTrimReplace="$1$2$3",j("HYPHENRANGE",`^\\s*(${b[m.XRANGEPLAIN]})\\s+-\\s+(${b[m.XRANGEPLAIN]})\\s*$`),j("HYPHENRANGELOOSE",`^\\s*(${b[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[m.XRANGEPLAINLOOSE]})\\s*$`),j("STAR","(<|>)?=?\\s*\\*"),j("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),j("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(mi,mi.exports)),mi.exports}var Lc,lp;function pM(){if(lp)return Lc;lp=1;const t=Object.freeze({loose:!0}),a=Object.freeze({});return Lc=i=>i?typeof i!="object"?t:i:a,Lc}var Fc,cp;function hM(){if(cp)return Fc;cp=1;const t=/^[0-9]+$/,a=(i,f)=>{if(typeof i=="number"&&typeof f=="number")return i===f?0:i<f?-1:1;const p=t.test(i),x=t.test(f);return p&&x&&(i=+i,f=+f),i===f?0:p&&!x?-1:x&&!p?1:i<f?-1:1};return Fc={compareIdentifiers:a,rcompareIdentifiers:(i,f)=>a(f,i)},Fc}var Pc,up;function mM(){if(up)return Pc;up=1;const t=fm(),{MAX_LENGTH:a,MAX_SAFE_INTEGER:s}=pm(),{safeRe:i,t:f}=fM(),p=pM(),{compareIdentifiers:x}=hM();class h{constructor(g,m){if(m=p(m),g instanceof h){if(g.loose===!!m.loose&&g.includePrerelease===!!m.includePrerelease)return g;g=g.version}else if(typeof g!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof g}".`);if(g.length>a)throw new TypeError(`version is longer than ${a} characters`);t("SemVer",g,m),this.options=m,this.loose=!!m.loose,this.includePrerelease=!!m.includePrerelease;const w=g.trim().match(m.loose?i[f.LOOSE]:i[f.FULL]);if(!w)throw new TypeError(`Invalid Version: ${g}`);if(this.raw=g,this.major=+w[1],this.minor=+w[2],this.patch=+w[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");w[4]?this.prerelease=w[4].split(".").map(v=>{if(/^[0-9]+$/.test(v)){const y=+v;if(y>=0&&y<s)return y}return v}):this.prerelease=[],this.build=w[5]?w[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(g){if(t("SemVer.compare",this.version,this.options,g),!(g instanceof h)){if(typeof g=="string"&&g===this.version)return 0;g=new h(g,this.options)}return g.version===this.version?0:this.compareMain(g)||this.comparePre(g)}compareMain(g){return g instanceof h||(g=new h(g,this.options)),this.major<g.major?-1:this.major>g.major?1:this.minor<g.minor?-1:this.minor>g.minor?1:this.patch<g.patch?-1:this.patch>g.patch?1:0}comparePre(g){if(g instanceof h||(g=new h(g,this.options)),this.prerelease.length&&!g.prerelease.length)return-1;if(!this.prerelease.length&&g.prerelease.length)return 1;if(!this.prerelease.length&&!g.prerelease.length)return 0;let m=0;do{const w=this.prerelease[m],v=g.prerelease[m];if(t("prerelease compare",m,w,v),w===void 0&&v===void 0)return 0;if(v===void 0)return 1;if(w===void 0)return-1;if(w===v)continue;return x(w,v)}while(++m)}compareBuild(g){g instanceof h||(g=new h(g,this.options));let m=0;do{const w=this.build[m],v=g.build[m];if(t("build compare",m,w,v),w===void 0&&v===void 0)return 0;if(v===void 0)return 1;if(w===void 0)return-1;if(w===v)continue;return x(w,v)}while(++m)}inc(g,m,w){if(g.startsWith("pre")){if(!m&&w===!1)throw new Error("invalid increment argument: identifier is empty");if(m){const v=`-${m}`.match(this.options.loose?i[f.PRERELEASELOOSE]:i[f.PRERELEASE]);if(!v||v[1]!==m)throw new Error(`invalid identifier: ${m}`)}}switch(g){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",m,w);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",m,w);break;case"prepatch":this.prerelease.length=0,this.inc("patch",m,w),this.inc("pre",m,w);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",m,w),this.inc("pre",m,w);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const v=Number(w)?1:0;if(this.prerelease.length===0)this.prerelease=[v];else{let y=this.prerelease.length;for(;--y>=0;)typeof this.prerelease[y]=="number"&&(this.prerelease[y]++,y=-2);if(y===-1){if(m===this.prerelease.join(".")&&w===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(v)}}if(m){let y=[m,v];w===!1&&(y=[m]),x(this.prerelease[0],m)===0?isNaN(this.prerelease[1])&&(this.prerelease=y):this.prerelease=y}break}default:throw new Error(`invalid increment argument: ${g}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Pc=h,Pc}var Hc,dp;function gM(){if(dp)return Hc;dp=1;const t=mM();return Hc=(s,i,f=!1)=>{if(s instanceof t)return s;try{return new t(s,i)}catch(p){if(!f)return null;throw p}},Hc}var xM=gM();const bM=uh(xM);function wM(t){if(!t)return"";const a=t.indexOf("+"),s=a!==-1?t.slice(a+1):"",i=a!==-1?t.slice(0,a):t;if(s&&s!=="moya"){const f=s.split("."),p=f[f.length-1];if(p&&/^[0-9a-f]{7,40}$/.test(p))return`https://github.com/TryGhost/Ghost/commit/${p}`}try{const p=bM(i,{includePrerelease:!0})?.prerelease;if(p&&p.length>0){const h=String(p[0]).split("-")[1];return h?.startsWith("g")?`https://github.com/TryGhost/Ghost/commit/${h.slice(1)}`:""}}catch{return""}return`https://github.com/TryGhost/Ghost/releases/tag/v${i}`}function vM(t,a){const s=!!t.match?.(/production/i);return!!(s&&a!=="mysql8"||!s&&a==="mysql5")}function yM({label:t,version:a}){const s=wM(a);return n.jsxs("div",{children:[n.jsxs("strong",{children:[t,":"]})," ",s?n.jsx("a",{className:"text-green",href:s,rel:"noopener noreferrer",target:"_blank",children:a}):a]})}const _M=ge.create(({})=>{const{updateRoute:t}=He();let s=Ue().config;const i=ry();function f(){return new Date().getFullYear()}function p(){return!!s.enableDeveloperExperiments}function x(){return!s.hostSettings?.siteId}return n.jsx(ct,{afterClose:()=>{t("")},cancelLabel:"",footer:n.jsx(n.Fragment,{}),topRightContent:"close",width:540,children:n.jsxs("div",{className:"flex flex-col gap-4 pb-7 text-sm",children:[n.jsx(sy,{className:"h-auto w-[120px] dark:invert"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[i?.message&&n.jsxs("div",{className:"gh-prose-links mb-4 rounded-sm border border-green p-5",children:[n.jsx("strong",{children:"Update available!"}),n.jsx("div",{dangerouslySetInnerHTML:{__html:i.message}})]}),n.jsx(yM,{label:"Version",version:s.version}),x()&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("strong",{children:"Environment:"})," ",s.environment]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Database:"})," ",s.database]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Mail:"})," ",s.mail?s.mail:"Native"]})]}),p()&&n.jsxs("div",{children:[n.jsx("strong",{children:"Developer experiments:"})," Enabled"]}),x()&&vM(s.environment,s.database)&&n.jsxs("div",{className:"text-red-500 dark:text-red-400",children:["You are running an unsupported database in production. Please ",n.jsx("a",{href:"https://ghost.org/docs/faq/supported-databases/",rel:"noopener noreferrer",target:"_blank",children:"upgrade to MySQL 8"}),"."]})]}),n.jsx($s,{}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://ghost.org/docs/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"book-open",size:"sm"})," User documentation"]}),n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://forum.ghost.org/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"question-circle",size:"sm"})," Get help with Ghost"]}),n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://ghost.org/docs/contributing/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"angle-brackets",size:"sm"})," Get involved"]})]}),n.jsx($s,{}),n.jsxs("p",{className:"max-w-[460px] text-xs",children:["Copyright © 2013 – ",f()," Ghost Foundation, released under the ",n.jsx("a",{className:"text-green",href:"https://github.com/TryGhost/Ghost/blob/main/LICENSE",rel:"noopener noreferrer",target:"_blank",children:"MIT license"}),". ",n.jsx("a",{className:"text-green",href:"https://ghost.org/",rel:"noopener noreferrer",target:"_blank",children:"Ghost"})," is a registered trademark of ",n.jsx("a",{className:"text-green",href:"https://ghost.org/trademark/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Foundation Ltd"}),"."]})]})})}),MM=()=>{const t=Lt(),{updateRoute:a}=He(),[s,i]=S.useState(""),[f,p]=S.useState({name:""}),{mutateAsync:x}=ay(),h=Ls(),b=Ze();return S.useEffect(()=>{h?.isLimited("customIntegrations")&&h.errorIfWouldGoOverLimit("customIntegrations").catch(g=>{g instanceof Fs&&(ge.show(zn,{prompt:g.message||"Your current plan doesn't support more custom integrations.",onOk:()=>a({route:"/pro",isExternal:!0})}),t.remove(),a("integrations"))})},[h,t,a]),n.jsx(ct,{afterClose:()=>{a("integrations")},okColor:"black",okLabel:"Add",size:"sm",testId:"add-integration-modal",title:"Add integration",onOk:async()=>{if(!s){p({name:"Name is required"});return}try{const g=await x({name:s});t.remove(),a({route:`integrations/${g.integrations[0].id}`})}catch(g){b(g)}},children:n.jsx("div",{className:"mt-5",children:n.jsx(Ye,{marginBottom:!1,marginTop:!1,children:n.jsx(_e,{autoFocus:!0,error:!!f.name,hint:f.name,maxLength:191,placeholder:"Custom integration",title:"Name",value:s,onChange:g=>i(g.target.value),onInput:()=>{f.name&&p({name:""})}})})})})},kM=ge.create(MM),jM=()=>{const t=Lt(),{updateRoute:a}=He(),s=Ze(),[i,f]=S.useState(!0),[p,x]=S.useState(null),{data:h}=dh({searchParams:{filter:"newsletters.status:active+email_disabled:0",limit:"1",page:"1",include:"newsletters,labels"}}),{mutateAsync:b}=Ty(),{formState:g,updateForm:m,saveState:w,handleSave:v,errors:y,clearError:C}=nn({initialState:{name:"",description:"",optInExistingSubscribers:!0},onSave:async()=>{const T=await b({name:g.name,description:g.description,opt_in_existing:g.optInExistingSubscribers,feedback_enabled:!0});a({route:`newsletters/${T.newsletters[0].id}`})},onSaveError:s,onValidate:()=>{const T={};return g.name||(T.name="A name is required for your newsletter"),T}}),j=Ls();S.useEffect(()=>{if(!j){f(!1);return}j.errorIfWouldGoOverLimit("newsletters").catch(T=>{if(T instanceof Fs)x(T);else throw T}).finally(()=>{f(!1)})},[j]);const N=h?.meta?.pagination.total;return S.useEffect(()=>{p&&(ge.show(zn,{prompt:p.message||"Your current plan doesn't support more newsletters.",onOk:()=>a({route:"/pro",isExternal:!0})}),t.remove(),a("newsletters"))},[p,t,a]),i||p?null:n.jsx(ct,{afterClose:()=>{a("newsletters")},backDropClick:!1,okColor:"black",okDisabled:w==="saving",okLabel:"Create",okLoading:w==="saving",size:"sm",testId:"add-newsletter-modal",title:"Create newsletter",onOk:async()=>{await v()&&t.remove()},children:n.jsxs(Ye,{marginBottom:!1,marginTop:!0,children:[n.jsx(_e,{autoFocus:!0,error:!!y.name,hint:y.name,maxLength:191,placeholder:"Weekly roundup",title:"Name",value:g.name,onChange:T=>m(A=>({...A,name:T.target.value})),onKeyDown:()=>C("name")}),n.jsx(or,{maxLength:2e3,title:"Description",value:g.description,onChange:T=>m(A=>({...A,description:T.target.value}))}),n.jsx(Be,{checked:g.optInExistingSubscribers,direction:"rtl",hint:g.optInExistingSubscribers?`This newsletter will be available to all members. Your ${N===void 0?"":Da(N)} existing subscriber${h?.meta?.pagination.total===1?"":"s"} will also be opted-in to receive it.`:"The newsletter will be available to all new members. Existing members won’t be subscribed, but may visit their account area to opt-in to future emails.",label:"Opt-in existing subscribers",labelStyle:"heading",onChange:T=>m(A=>({...A,optInExistingSubscribers:T.target.checked}))})]})})},NM=ge.create(jM),TM=ge.create(()=>{const t=ge.useModal(),{updateRoute:a}=He(),{data:{integrations:s}={integrations:[]}}=Si(),f=s.find(({slug:p})=>p==="ghost-core-content")?.api_keys?.find(p=>p.type==="content");return n.jsxs(ct,{afterClose:()=>{a("integrations")},cancelLabel:"",footer:n.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[n.jsx(Ie,{color:"outline",href:"https://ghost.org/docs/content-api/",label:n.jsxs("span",{className:"flex items-center gap-1",children:["Open docs ",n.jsx(qe,{name:"arrow-top-right",size:"xs"})]}),rel:"noopener noreferrer",tag:"a",target:"_blank"}),n.jsx(Ie,{color:"black",label:"Close",onClick:()=>{a("integrations"),t.remove()}})]}),testId:"content-api-modal",title:"",stickyFooter:!0,children:[n.jsx(Jr,{detail:"Access your content programmatically",icon:n.jsx(qe,{name:"angle-brackets",size:56}),title:"Content API"}),n.jsxs("div",{className:"mt-7",children:[n.jsx("p",{className:"mb-6 text-sm text-grey-700",children:"This key provides read-only access to your published content. For full read/write access, create a custom integration."}),n.jsx(Ya,{keys:[{label:"Content API key",text:f?.secret},{label:"API URL",text:window.location.origin+Rs().subdir}]})]})]})}),EM=({recommendation:t,animate:a})=>{const s=Lt(),{updateRoute:i,route:f}=He(),{mutateAsync:p}=oy(),x=Ze(),{formState:h,updateForm:b,handleSave:g,saveState:m,errors:w,clearError:v,setErrors:y}=nn({initialState:{...t},onSave:async T=>{await p(T),s.remove(),rt({title:"Recommendation added",type:"success"}),ly("Recommendation Added",{oneClickSubscribe:T.one_click_subscribe}),i("recommendations")},onSaveError:x,onValidate:T=>iy(T)});let C="Add",j=!1;m==="saving"?j=!0:m==="saved"&&(C="Added");let N={label:"Back",icon:"arrow-left",iconColorClass:"text-black dark:text-white",link:!0,size:"sm",onClick:()=>{m!=="saving"&&(s.remove(),ge.show(hm,{pathName:f,animate:!1,recommendation:{...h}}))}};return n.jsx(ct,{afterClose:()=>{i("recommendations")},animate:a??!0,backDropClick:!1,cancelLabel:"Cancel",dirty:!0,leftButtonProps:N,okColor:"black",okLabel:C,okLoading:j,size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",stickyFooter:!0,onCancel:()=>{m!=="saving"&&(s.remove(),i("recommendations"))},onOk:async()=>{if(m!=="saving"){fh();try{await g({force:!0})}catch{rt({type:"error",title:"Something went wrong when adding this recommendation, please try again."})}}},children:n.jsx(cy,{clearError:v,errors:w,formState:h,setErrors:y,showURL:!1,updateForm:b})})},CM=ge.create(EM),fp=t=>_i(t).save||"",IM=function(t,a){try{new URL(a).hostname.includes(".")?delete t.url:t.url="Enter a valid URL"}catch{t.url="Enter a valid URL"}return t},SM=({searchParams:t,recommendation:a,animate:s})=>{const[i,f]=S.useState(!1),p=Lt(),{updateRoute:x}=He(),{mutateAsync:h}=uy(),b=a?"":t?.get("url")??"",{save:g}=b?_i(b):{save:""},m=Ve.useRef(!1),[w,v]=Ve.useState(!!g),{formState:y,updateForm:C,handleSave:j,errors:N,saveState:T,clearError:A}=nn({initialState:a??{title:"",url:g||"",description:"",excerpt:null,featured_image:null,favicon:null,one_click_subscribe:!1},onSave:async()=>{let $;$=new URL(y.url);const L=$.hostname.replace("www.",""),P={...y,url:$.toString()},{recommendations:D=[]}=await h($);if(!D||D.length===0)return;const q=D[0];if(q.id)throw new Mf("A recommendation with this URL already exists.");P.title=q.title??L,P.excerpt=q.excerpt??P.excerpt,P.featured_image=q.featured_image??P.featured_image??null,P.favicon=q.favicon??P.favicon??null,P.one_click_subscribe=q.one_click_subscribe??P.one_click_subscribe??!1,P.description=P.excerpt||null,p.remove(),ge.show(CM,{animate:!1,recommendation:P})},onValidate:()=>{const $={};return IM($,y.url),w&&v(Object.keys($).length===0),$}}),R=Ve.useCallback(async()=>{if(T!=="saving"){fh();try{if(await j({force:!0}))return}catch($){const L=$ instanceof Mf?$.message:"Something went wrong while checking this URL, please try again.";rt({type:"error",title:L})}w&&v(!1)}},[j,T,w,v]);return Ve.useEffect(()=>{w&&!m.current&&(m.current=!0,R())},[w,R]),S.useEffect(()=>{i&&(R(),f(!1))},[y]),w?n.jsx(ct,{afterClose:()=>{x("recommendations")},animate:s??!0,backDropClick:!1,footer:!1,header:!1,size:"sm",children:n.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:n.jsx(Mi,{})})}):n.jsxs(ct,{afterClose:()=>{x("recommendations")},animate:s??!0,backDropClick:!1,okColor:"black",okLabel:"Next",okLoading:T==="saving",size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",onOk:R,children:[n.jsxs("p",{className:"mt-4",children:["You can recommend ",n.jsx("strong",{children:"any site"})," your audience will find valuable, not just those published on Ghost."]}),n.jsx(Ye,{marginBottom:!1,marginTop:!0,children:n.jsx(_e,{autoFocus:!0,error:!!N.url,hint:N.url||n.jsxs(n.Fragment,{children:["Need inspiration? ",n.jsx("a",{className:"text-green",href:"https://www.ghost.org/explore",rel:"noopener noreferrer",target:"_blank",children:"Explore thousands of sites"})," to recommend"]}),maxLength:2e3,placeholder:"https://www.example.com",title:"URL",value:y.url,onBlur:()=>{const $=fp(y.url);C(L=>({...L,url:$}))},onChange:$=>{A?.("url"),C(L=>({...L,url:$.target.value}))},onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),C(L=>({...L,url:fp(y.url)})),f(!0))}})})]})},hm=ge.create(SM);function AM(t,a){let s;return function(...f){const p=()=>{clearTimeout(s),t(...f)};clearTimeout(s),s=setTimeout(p,a)}}const Ou=({generateContent:t,className:a,height:s,width:i,parentClassName:f,testId:p,addDelay:x=!1})=>{const[h,b]=S.useState(0),g=[S.useRef(null),S.useRef(null)],[m,w]=S.useState(0);return S.useEffect(()=>{const v=h===0?1:0,y=g[v].current;if(y){t(y);const C=()=>{x?setTimeout(()=>{b(v)},500):b(v)};return y.addEventListener("load",C),()=>{y.removeEventListener("load",C)}}},[t]),S.useEffect(()=>{const v=g[h].current,y=AM(()=>{w(v?.contentWindow?.scrollY||0)},250);return v?.contentWindow?.addEventListener("scroll",y),()=>{v?.contentWindow?.removeEventListener("scroll",y)}},[h,g]),S.useEffect(()=>{const v=g[h].current;if(v)try{v.contentWindow?.scrollTo(0,m)}catch(y){yv(y)}},[m,h,g]),n.jsxs("div",{className:f,"data-testid":p,children:[n.jsx("iframe",{ref:g[0],className:`${a} ${h!==0?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===0,frameBorder:"0",height:s,title:"Buffered Preview 1",width:i}),n.jsx("iframe",{ref:g[1],className:`${a} ${h!==1?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===1,frameBorder:"0",height:s,title:"Buffered Preview 2",width:i})]})},DM=(t,a,s)=>{const i=new URLSearchParams;return i.append("announcement_bg",t||"accent"),i.append("announcement",a||""),s&&s.length>0&&i.append("announcement_vis",s?.join(",")||""),i.toString()},$M=({announcementBackgroundColor:t,announcementContent:a,url:s,visibility:i})=>{const f=S.useMemo(()=>i,[i?.join(",")]),p=S.useCallback(x=>{s&&fetch(s,{method:"POST",headers:{"Content-Type":"text/html;charset=utf-8","x-ghost-preview":DM(t,a,f),Accept:"text/plain"},mode:"cors",credentials:"include"}).then(h=>h.text()).then(h=>{const b="html { pointer-events: none; }",m=new DOMParser().parseFromString(h,"text/html"),w=m.querySelector("style"),v=w.innerHTML;w.innerHTML=`${v}
|
|
1
|
+
import{j as n,r as S,aF as me,t as Ve,dG as cv,aQ as uv,au as dv,aS as fv,at as Ei,av as bu,aU as pv,aw as Jc,aT as lh,as as hv,az as ch,ax as mv,ay as gv,dH as qe,dI as xv,dJ as bv,dK as wv,dL as vv,ai as Gr,b4 as Ze,di as Rs,dv as jr,dM as ot,dN as rt,ch as uh,df as dh,dO as fh,dP as Mf,dQ as yv,dR as Pn,dS as _v,dT as Mv,dU as kv,dV as ph,dW as wu,dX as jv,dY as Nv,dZ as Tv,d_ as Mr,d$ as yi,e0 as vu,e1 as Ev,e2 as Cv,aB as Iv,e3 as Sv,dx as fi,e4 as Av,e5 as Ia,e6 as Dv,e7 as $v,aj as Ov,aV as Rv,e8 as Lv,e9 as hh,ea as mh,eb as kf,cu as Tt,ec as As,ed as eu,ee as Fv,ef as Ds,eg as Pv,eh as Hv,ei as zv,ej as Ra,ek as Uv,el as Bv,em as tu,ad as Wv,en as Yv,eo as qv,ep as Gv,eq as Xv,er as wr,es as jf,et as Nf,eu as Kv}from"./index-CYyEyBYw.js";import{H as lt,a as Hn,S as $s,B as Ie,x as Ci,K as Zv,y as Lt,z as Vv,A as jt,M as ct,C as Fn,F as Qv,G as kr,J as Jv,O as Ii,Q as ge,U as He,V as ey,W as Si,X as Ue,Y as sr,Z as Nr,_ as xt,$ as Xr,a0 as nn,a1 as ty,a2 as Ye,a3 as _e,a4 as Tf,a5 as Ef,a6 as Be,a7 as gh,a8 as xh,a9 as ny,aa as Cf,ab as ry,ac as sy,ad as ay,ae as Ls,af as Fs,ag as zn,ah as or,ai as Da,aj as oy,ak as iy,al as ly,am as cy,an as uy,ao as _i,ap as Mi,aq as Un,ar as dy,as as If,at as Sf,au as fy,av as Ps,aw as ar,ax as rr,ay as bh,az as py,aA as yu,aB as hy,aC as wh,aD as vh,aE as yh,aF as _h,aG as my,aH as gy,aI as yn,aJ as Af,aK as Mh,aL as kh,aM as jh,aN as nu,aO as xy,aP as by,aQ as wy,aR as ru,aS as _u,aT as wi,aU as vy,aV as yy,aW as Df,aX as _y,aY as Nh,aZ as Mu,a_ as ku,a$ as su,b0 as My,b1 as ky,b2 as jy,b3 as Ny}from"./settings-DeD-bmZc.js";import{a as Ty,u as Th,b as Eh}from"./newsletters-m6HQgU5J.js";import{C as Ey,a as Cy}from"./index-DugxKzA6.js";import{u as Ch}from"./posts-D-jyPPE6.js";import{r as Ih}from"./index-DzVHlhO1.js";import{a as Sh,b as Ah,u as ju,c as Nu,d as Iy}from"./dropzone-B8mAoWrn.js";import{u as Kr,a as Tu,b as Sy,g as Ba}from"./tiers-4Vkr_D-L.js";import{A as Ay,L as Dy}from"./list-filter-DLjjiktn.js";import"./tabs-CjdKssUe.js";import"./typeof-QjJsDpFa.js";import"./referrers-qnXsKsuv.js";import"./select-8S9kYGSM.js";import"./chevron-up-v4_QwmnL.js";import"./underline-CjK8la2G.js";import"./toggle-group-hDsr47IB.js";import"./textarea-DzFnun0_.js";import"./index-x0hNfyqU.js";const Dh=({children:t,...a})=>n.jsx("div",{className:"flex size-full flex-col px-8",...a,children:n.jsx("div",{className:"size-full overflow-hidden rounded-t-[4px] shadow-sm",children:t})}),$h=({children:t,...a})=>n.jsx("div",{className:"flex h-[775px] w-[380px] flex-col rounded-3xl bg-white p-2 shadow-xl dark:bg-grey-900",...a,children:n.jsx("div",{className:"h-100 w-100 grow overflow-auto rounded-2xl border border-grey-100 dark:border-grey-950",children:t})}),$y=({title:t,label:a,value:s,onChange:i,disabled:f,error:p,hint:x,checked:h,separator:b,testId:g})=>{const m=S.useId(),w=v=>{i(v===!0)};return n.jsxs("div",{children:[n.jsxs("div",{className:`flex flex-col gap-1 ${b&&"pb-2"}`,children:[t&&n.jsx(lt,{grey:!0,level:6,children:t}),n.jsxs("label",{className:`flex cursor-pointer items-start ${t&&"mt-1 -mb-1"}`,htmlFor:m,children:[n.jsx(Ey,{className:"mt-0.5 flex size-4 cursor-pointer appearance-none items-center justify-center rounded-[3px] border border-solid border-grey-500 bg-white outline-hidden data-[state=checked]:border-black data-[state=checked]:bg-black data-[state=indeterminate]:border-black data-[state=indeterminate]:bg-black","data-testid":g,defaultChecked:h,disabled:f,id:m,value:s,onCheckedChange:w,children:n.jsx(Cy,{children:n.jsx("svg",{fill:"none",height:"11",viewBox:"0 0 10 11",width:"10",children:n.jsx("path",{d:"M1 5.88889L4.6 9L9 1",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})})}),n.jsxs("div",{className:`ml-2 flex flex-col ${x&&"mb-2"}`,children:[n.jsx("span",{className:`inline-block text-[1.425rem] dark:text-white ${x&&"-mb-1"}`,children:a}),x&&n.jsx(Hn,{color:p?"red":"",children:x})]})]})]}),(b||p)&&n.jsx($s,{className:p?"border-red":""})]})},au=({title:t,checkboxes:a,hint:s,error:i})=>n.jsxs("div",{children:[t&&n.jsx(lt,{grey:!0,level:6,children:t}),n.jsx("div",{className:"mt-2 flex flex-col gap-1",children:a?.map(({key:f,...p})=>n.jsx($y,{...p},f))}),n.jsx("div",{className:`flex flex-col ${s&&"mb-2"}`,children:s&&n.jsx(Hn,{color:i?"red":"",children:s})})]}),Oy=({hex:t,value:a,title:s,size:i="md",isSelected:f,onSelect:p})=>{const x=S.useRef(null),h=m=>{m.preventDefault(),p(a!==void 0?a:t)},b=t.length===4&&t[3]==="0"||t.length===8&&t.slice(6)==="00";let g="h-5 w-5";return i==="lg"&&(g="w-6 h-6"),n.jsx("button",{ref:x,className:me("relative flex shrink-0 cursor-pointer items-center rounded-full border border-grey-300 dark:border-grey-800",g,f&&"outline outline-2 outline-green"),style:{backgroundColor:t},title:s,type:"button",onClick:h,children:b&&n.jsx("div",{className:"absolute top-0 left-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})},Oh=({title:t,value:a,swatches:s,swatchSize:i="md",onSwatchChange:f,onTogglePicker:p,isExpanded:x,picker:h=!0,containerClassName:b})=>{const g=s.find(w=>w.value===a||w.hex===a);b=me("flex flex-col gap-3");const m=x||!h;return n.jsxs("div",{className:b,children:[t&&n.jsx(lt,{useLabelTag:!0,children:t}),n.jsxs("div",{className:"flex gap-1",children:[m&&n.jsx("div",{className:"flex items-center gap-1",children:s.map(({customContent:w,...v})=>w?n.jsx(S.Fragment,{children:w},v.title):n.jsx(Oy,{isSelected:g?.title===v.title,size:i,onSelect:f,...v},v.title))}),h&&n.jsxs("button",{"aria-label":"Pick color",className:"relative size-6 cursor-pointer rounded-full border border-grey-250 dark:border-grey-800",type:"button",onClick:p,children:[n.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%))]"}),g&&n.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:g.hex},children:g.hex==="transparent"&&n.jsx("div",{className:"absolute top-[3px] left-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})}),!g&&a&&n.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:a},children:a==="transparent"&&n.jsx("div",{className:"absolute top-[3px] left-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})]})]})]})};function Hs(){return(Hs=Object.assign||function(t){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}).apply(this,arguments)}function Ai(t,a){if(t==null)return{};var s,i,f={},p=Object.keys(t);for(i=0;i<p.length;i++)a.indexOf(s=p[i])>=0||(f[s]=t[s]);return f}function La(t){var a=S.useRef(t),s=S.useRef(function(i){a.current&&a.current(i)});return a.current=t,s.current}var Fa=function(t,a,s){return a===void 0&&(a=0),s===void 0&&(s=1),t>s?s:t<a?a:t},$a=function(t){return"touches"in t},ou=function(t){return t&&t.ownerDocument.defaultView||self},$f=function(t,a,s){var i=t.getBoundingClientRect(),f=$a(a)?(function(p,x){for(var h=0;h<p.length;h++)if(p[h].identifier===x)return p[h];return p[0]})(a.touches,s):a;return{left:Fa((f.pageX-(i.left+ou(t).pageXOffset))/i.width),top:Fa((f.pageY-(i.top+ou(t).pageYOffset))/i.height)}},Of=function(t){!$a(t)&&t.preventDefault()},Rh=Ve.memo(function(t){var a=t.onMove,s=t.onKey,i=Ai(t,["onMove","onKey"]),f=S.useRef(null),p=La(a),x=La(s),h=S.useRef(null),b=S.useRef(!1),g=S.useMemo(function(){var y=function(N){Of(N),($a(N)?N.touches.length>0:N.buttons>0)&&f.current?p($f(f.current,N,h.current)):j(!1)},C=function(){return j(!1)};function j(N){var T=b.current,A=ou(f.current),R=N?A.addEventListener:A.removeEventListener;R(T?"touchmove":"mousemove",y),R(T?"touchend":"mouseup",C)}return[function(N){var T=N.nativeEvent,A=f.current;if(A&&(Of(T),!(function($,L){return L&&!$a($)})(T,b.current)&&A)){if($a(T)){b.current=!0;var R=T.changedTouches||[];R.length&&(h.current=R[0].identifier)}A.focus(),p($f(A,T,h.current)),j(!0)}},function(N){var T=N.which||N.keyCode;T<37||T>40||(N.preventDefault(),x({left:T===39?.05:T===37?-.05:0,top:T===40?.05:T===38?-.05:0}))},j]},[x,p]),m=g[0],w=g[1],v=g[2];return S.useEffect(function(){return v},[v]),Ve.createElement("div",Hs({},i,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:f,onKeyDown:w,tabIndex:0,role:"slider"}))}),Eu=function(t){return t.filter(Boolean).join(" ")},Lh=function(t){var a=t.color,s=t.left,i=t.top,f=i===void 0?.5:i,p=Eu(["react-colorful__pointer",t.className]);return Ve.createElement("div",{className:p,style:{top:100*f+"%",left:100*s+"%"}},Ve.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:a}}))},Rt=function(t,a,s){return a===void 0&&(a=0),s===void 0&&(s=Math.pow(10,a)),Math.round(s*t)/s},Ry=function(t){return zy(iu(t))},iu=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Rt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Rt(parseInt(t.substring(6,8),16)/255,2):1}},Ly=function(t){return Hy(Py(t))},Fy=function(t){var a=t.s,s=t.v,i=t.a,f=(200-a)*s/100;return{h:Rt(t.h),s:Rt(f>0&&f<200?a*s/100/(f<=100?f:200-f)*100:0),l:Rt(f/2),a:Rt(i,2)}},lu=function(t){var a=Fy(t);return"hsl("+a.h+", "+a.s+"%, "+a.l+"%)"},Py=function(t){var a=t.h,s=t.s,i=t.v,f=t.a;a=a/360*6,s/=100,i/=100;var p=Math.floor(a),x=i*(1-s),h=i*(1-(a-p)*s),b=i*(1-(1-a+p)*s),g=p%6;return{r:Rt(255*[i,h,x,x,b,i][g]),g:Rt(255*[b,i,i,h,x,x][g]),b:Rt(255*[x,x,b,i,i,h][g]),a:Rt(f,2)}},pi=function(t){var a=t.toString(16);return a.length<2?"0"+a:a},Hy=function(t){var a=t.r,s=t.g,i=t.b,f=t.a,p=f<1?pi(Rt(255*f)):"";return"#"+pi(a)+pi(s)+pi(i)+p},zy=function(t){var a=t.r,s=t.g,i=t.b,f=t.a,p=Math.max(a,s,i),x=p-Math.min(a,s,i),h=x?p===a?(s-i)/x:p===s?2+(i-a)/x:4+(a-s)/x:0;return{h:Rt(60*(h<0?h+6:h)),s:Rt(p?x/p*100:0),v:Rt(p/255*100),a:f}},Uy=Ve.memo(function(t){var a=t.hue,s=t.onChange,i=Eu(["react-colorful__hue",t.className]);return Ve.createElement("div",{className:i},Ve.createElement(Rh,{onMove:function(f){s({h:360*f.left})},onKey:function(f){s({h:Fa(a+360*f.left,0,360)})},"aria-label":"Hue","aria-valuenow":Rt(a),"aria-valuemax":"360","aria-valuemin":"0"},Ve.createElement(Lh,{className:"react-colorful__hue-pointer",left:a/360,color:lu({h:a,s:100,v:100,a:1})})))}),By=Ve.memo(function(t){var a=t.hsva,s=t.onChange,i={backgroundColor:lu({h:a.h,s:100,v:100,a:1})};return Ve.createElement("div",{className:"react-colorful__saturation",style:i},Ve.createElement(Rh,{onMove:function(f){s({s:100*f.left,v:100-100*f.top})},onKey:function(f){s({s:Fa(a.s+100*f.left,0,100),v:Fa(a.v-100*f.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Rt(a.s)+"%, Brightness "+Rt(a.v)+"%"},Ve.createElement(Lh,{className:"react-colorful__saturation-pointer",top:1-a.v/100,left:a.s/100,color:lu(a)})))}),Fh=function(t,a){if(t===a)return!0;for(var s in t)if(t[s]!==a[s])return!1;return!0},Wy=function(t,a){return t.toLowerCase()===a.toLowerCase()||Fh(iu(t),iu(a))};function Yy(t,a,s){var i=La(s),f=S.useState(function(){return t.toHsva(a)}),p=f[0],x=f[1],h=S.useRef({color:a,hsva:p});S.useEffect(function(){if(!t.equal(a,h.current.color)){var g=t.toHsva(a);h.current={hsva:g,color:a},x(g)}},[a,t]),S.useEffect(function(){var g;Fh(p,h.current.hsva)||t.equal(g=t.fromHsva(p),h.current.color)||(h.current={hsva:p,color:g},i(g))},[p,t,i]);var b=S.useCallback(function(g){x(function(m){return Object.assign({},m,g)})},[]);return[p,b]}var qy=typeof window<"u"?S.useLayoutEffect:S.useEffect,Gy=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Rf=new Map,Xy=function(t){qy(function(){var a=t.current?t.current.ownerDocument:document;if(a!==void 0&&!Rf.has(a)){var s=a.createElement("style");s.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Rf.set(a,s);var i=Gy();i&&s.setAttribute("nonce",i),a.head.appendChild(s)}},[])},Ky=function(t){var a=t.className,s=t.colorModel,i=t.color,f=i===void 0?s.defaultColor:i,p=t.onChange,x=Ai(t,["className","colorModel","color","onChange"]),h=S.useRef(null);Xy(h);var b=Yy(s,f,p),g=b[0],m=b[1],w=Eu(["react-colorful",a]);return Ve.createElement("div",Hs({},x,{ref:h,className:w}),Ve.createElement(By,{hsva:g,onChange:m}),Ve.createElement(Uy,{hue:g.h,onChange:m,className:"react-colorful__last-control"}))},Zy={defaultColor:"000",toHsva:Ry,fromHsva:function(t){return Ly({h:t.h,s:t.s,v:t.v,a:1})},equal:Wy},Vy=function(t){return Ve.createElement(Ky,Hs({},t,{colorModel:Zy}))},Qy=/^#?([0-9A-F]{3,8})$/i,Jy=function(t){var a=t.color,s=a===void 0?"":a,i=t.onChange,f=t.onBlur,p=t.escape,x=t.validate,h=t.format,b=t.process,g=Ai(t,["color","onChange","onBlur","escape","validate","format","process"]),m=S.useState(function(){return p(s)}),w=m[0],v=m[1],y=La(i),C=La(f),j=S.useCallback(function(T){var A=p(T.target.value);v(A),x(A)&&y(b?b(A):A)},[p,b,x,y]),N=S.useCallback(function(T){x(T.target.value)||v(p(s)),C(T)},[s,p,x,C]);return S.useEffect(function(){v(p(s))},[s,p]),Ve.createElement("input",Hs({},g,{value:h?h(w):w,spellCheck:"false",onChange:j,onBlur:N}))},Lf=function(t){return"#"+t},e1=function(t){var a=t.prefixed,s=t.alpha,i=Ai(t,["prefixed","alpha"]),f=S.useCallback(function(x){return x.replace(/([^0-9A-F]+)/gi,"").substring(0,s?8:6)},[s]),p=S.useCallback(function(x){return(function(h,b){var g=Qy.exec(h),m=g?g[1].length:0;return m===3||m===6||!!b&&m===4||!!b&&m===8})(x,s)},[s]);return Ve.createElement(Jy,Hs({},i,{escape:f,format:a?Lf:void 0,process:Lf,validate:p}))};const t1=({hexValue:t,eyedropper:a,clearButtonValue:s,containerClassName:i,onChange:f})=>{const p=S.useRef(null),x=S.useCallback(v=>{var y,C,j;v.stopPropagation();const N=(y=p.current)==null?void 0:y.querySelector("input");v.target!==N&&((j=(C=p.current)==null?void 0:C.querySelector("input"))==null||j.focus(),v.preventDefault())},[]),h=S.useRef(!1),b=S.useCallback(()=>{var v,y;h.current=!1,(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus(),document.removeEventListener("mouseup",b),document.removeEventListener("touchend",b)},[]),g=S.useCallback(()=>{h.current=!0,document.addEventListener("mouseup",b),document.addEventListener("touchend",b)},[b]),m=S.useCallback(v=>{if(v.preventDefault(),!window.EyeDropper)return;h.current=!0,document.body.style.setProperty("pointer-events","none"),new window.EyeDropper().open().then(C=>f?.(C.sRGBHex)).finally(()=>{var C,j;h.current=!1,document.body.style.removeProperty("pointer-events"),(j=(C=p.current)==null?void 0:C.querySelector("input"))==null||j.focus()})},[f]);S.useEffect(()=>{var v,y;(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus()},[]);const w=S.useCallback(()=>{var v,y;(y=(v=p.current)==null?void 0:v.querySelector("input"))==null||y.focus()},[]);return i=me("mt-2",i),n.jsxs("div",{className:i,onMouseDown:x,onTouchStart:x,children:[n.jsx(Vy,{className:"w-full",color:t||"#ffffff",onChange:f,onMouseDown:g,onTouchStart:g}),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsxs("div",{ref:p,className:"peer relative order-2 flex h-10 w-full items-center",onClick:w,children:[n.jsx("span",{className:"absolute top-[9px] left-2 z-10 mr-2 ml-1 text-grey-700",children:"#"}),n.jsx(e1,{"aria-label":"Color value",className:"z-[1] w-full rounded-md border border-transparent bg-grey-150 p-2 pl-6 transition-all hover:bg-grey-100 focus:border-green focus:bg-white focus:shadow-[0_0_0_1px_rgba(48,207,67,1)] dark:bg-grey-900 dark:text-white dark:focus:bg-grey-925",color:t,onChange:f}),a&&!!window.EyeDropper&&n.jsx("button",{className:"absolute inset-y-0 right-3 z-50 my-auto size-4 p-[1px]",type:"button",onClick:m,children:n.jsx(cv,{className:"size-full"})})]}),s!==void 0&&n.jsx(Ie,{color:"grey",value:"Clear",onClick:()=>f?.(s)})]})]})},n1=S.createContext({colorPickers:[]}),Ff=t=>t.length===4?t.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3"):t,Ln=({testId:t,title:a,direction:s,value:i,hint:f,error:p,eyedropper:x,clearButtonValue:h,onChange:b,swatches:g=[],alwaysOpen:m=!1,debounceMs:w})=>{const[v,y]=S.useState(!1),[C,j]=S.useState(i),N=S.useContext(n1),T=S.useId();S.useEffect(()=>{j(P=>Ff(P||"")===i?P:i)},[i]),S.useEffect(()=>(N.colorPickers.push({id:T,setExpanded:y}),()=>{N.colorPickers=N.colorPickers.filter(P=>P.id!==T)}),[N,T]),S.useEffect(()=>{if(v){N.colorPickers.filter(D=>D.id!==T).forEach(D=>D.setExpanded(!1));const P=()=>{y(!1)};return document.addEventListener("click",P),()=>{document.removeEventListener("click",P)}}},[N,T,v]);const A=S.useMemo(()=>b&&w?Ci(b,w):b,[w,b]),R=P=>{j(P),A?.(P?Ff(P):null)};let $=n.jsx(Oh,{isExpanded:v,swatches:g,value:C,onSwatchChange:P=>{R(P),y(!1)},onTogglePicker:()=>!m&&y(!v)});a&&($=n.jsxs("div",{className:me("flex w-full cursor-pointer items-start first:mt-0 dark:text-white",s==="rtl"&&"flex-row-reverse"),children:[n.jsx("div",{className:"shrink-0",children:$}),n.jsxs("div",{className:me("flex-1",s==="rtl"?"pr-2":"pl-2",f?"mt-[-2px]":"mt-[1px]"),onClick:()=>!m&&y(!v),children:[a,f&&n.jsx("div",{className:`text-xs ${p?"text-red":"text-grey-700"}`,children:f})]})]}));const L=g.find(P=>P.value===C);return n.jsxs("div",{className:"flex-col","data-testid":t,onClick:P=>P.stopPropagation(),children:[$,(m||v)&&n.jsx(t1,{clearButtonValue:h,eyedropper:x,hexValue:L?.hex||C||void 0,onChange:R})]})},r1=({value:t,onChange:a,singleParagraph:s=!0,...i})=>{const f=S.useCallback(p=>{const h=new DOMParser().parseFromString(p,"text/html");h.querySelectorAll("*").forEach(g=>{g.style.removeProperty("white-space"),g.getAttribute("style")||g.removeAttribute("style")}),h.body.innerHTML!==t&&a?.(h.body.innerHTML)},[t,a]);return n.jsx(Zv,{...i,singleParagraph:s,children:p=>n.jsx(p.HtmlOutputPlugin,{html:t,setHtml:f})})},Cu=({title:t,hideTitle:a,error:s,hint:i,value:f,clearBg:p=!1,className:x="",containerClassName:h="",hintClassName:b="",unstyled:g=!1,...m})=>{const w=g?"":me("flex min-h-[32px] items-center rounded-md border border-transparent py-1.5 md:min-h-[36px]",p?"bg-transparent":"bg-grey-150 px-3 dark:bg-grey-900",s?"border-red":"transition-all hover:bg-grey-100 has-[:focus]:border-green has-[:focus]:bg-white has-[:focus]:shadow-[0_0_0_1px_rgba(48,207,67,1)] dark:selection:bg-[rgba(88,101,116,0.99)] dark:hover:bg-grey-925 dark:has-[:focus]:bg-grey-950",t&&!a&&!p&&"mt-2",x);return n.jsxs("div",{className:`flex flex-col ${h}`,children:[t&&n.jsx(lt,{className:a?"sr-only":"",grey:!0,useLabelTag:!0,children:t}),n.jsx("div",{className:w,children:n.jsx(r1,{...m,value:f})}),i&&n.jsx(Hn,{className:b,color:s?"red":"",children:i})]})};var Iu="Radio",[s1,Ph]=ch(Iu),[a1,o1]=s1(Iu),Hh=S.forwardRef((t,a)=>{const{__scopeRadio:s,name:i,checked:f=!1,required:p,disabled:x,value:h="on",onCheck:b,form:g,...m}=t,[w,v]=S.useState(null),y=bu(a,N=>v(N)),C=S.useRef(!1),j=w?g||!!w.closest("form"):!0;return n.jsxs(a1,{scope:s,checked:f,disabled:x,children:[n.jsx(Ei.button,{type:"button",role:"radio","aria-checked":f,"data-state":Wh(f),"data-disabled":x?"":void 0,disabled:x,value:h,...m,ref:y,onClick:Jc(t.onClick,N=>{f||b?.(),j&&(C.current=N.isPropagationStopped(),C.current||N.stopPropagation())})}),j&&n.jsx(Bh,{control:w,bubbles:!C.current,name:i,value:h,checked:f,required:p,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});Hh.displayName=Iu;var zh="RadioIndicator",Uh=S.forwardRef((t,a)=>{const{__scopeRadio:s,forceMount:i,...f}=t,p=o1(zh,s);return n.jsx(hv,{present:i||p.checked,children:n.jsx(Ei.span,{"data-state":Wh(p.checked),"data-disabled":p.disabled?"":void 0,...f,ref:a})})});Uh.displayName=zh;var i1="RadioBubbleInput",Bh=S.forwardRef(({__scopeRadio:t,control:a,checked:s,bubbles:i=!0,...f},p)=>{const x=S.useRef(null),h=bu(x,p),b=mv(s),g=gv(a);return S.useEffect(()=>{const m=x.current;if(!m)return;const w=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(w,"checked").set;if(b!==s&&y){const C=new Event("click",{bubbles:i});y.call(m,s),m.dispatchEvent(C)}},[b,s,i]),n.jsx(Ei.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...f,tabIndex:-1,ref:h,style:{...f.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Bh.displayName=i1;function Wh(t){return t?"checked":"unchecked"}var l1=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Di="RadioGroup",[c1]=ch(Di,[lh,Ph]),Yh=lh(),qh=Ph(),[u1,d1]=c1(Di),Gh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,name:i,defaultValue:f,value:p,required:x=!1,disabled:h=!1,orientation:b,dir:g,loop:m=!0,onValueChange:w,...v}=t,y=Yh(s),C=uv(g),[j,N]=dv({prop:p,defaultProp:f??null,onChange:w,caller:Di});return n.jsx(u1,{scope:s,name:i,required:x,disabled:h,value:j,onValueChange:N,children:n.jsx(fv,{asChild:!0,...y,orientation:b,dir:C,loop:m,children:n.jsx(Ei.div,{role:"radiogroup","aria-required":x,"aria-orientation":b,"data-disabled":h?"":void 0,dir:C,...v,ref:a})})})});Gh.displayName=Di;var Xh="RadioGroupItem",Kh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,disabled:i,...f}=t,p=d1(Xh,s),x=p.disabled||i,h=Yh(s),b=qh(s),g=S.useRef(null),m=bu(a,g),w=p.value===f.value,v=S.useRef(!1);return S.useEffect(()=>{const y=j=>{l1.includes(j.key)&&(v.current=!0)},C=()=>v.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",C)}},[]),n.jsx(pv,{asChild:!0,...h,focusable:!x,active:w,children:n.jsx(Hh,{disabled:x,required:p.required,checked:w,...b,...f,name:p.name,ref:m,onCheck:()=>p.onValueChange(f.value),onKeyDown:Jc(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:Jc(f.onFocus,()=>{v.current&&g.current?.click()})})})});Kh.displayName=Xh;var f1="RadioGroupIndicator",Zh=S.forwardRef((t,a)=>{const{__scopeRadioGroup:s,...i}=t,f=qh(s);return n.jsx(Uh,{...f,...i,ref:a})});Zh.displayName=f1;var p1=Gh,h1=Kh,m1=Zh;const g1=({id:t,title:a,options:s,onSelect:i,error:f,hint:p,selectedOption:x,separator:h})=>n.jsxs(p1,{defaultValue:x,name:t,onValueChange:i,children:[n.jsxs("div",{className:`flex flex-col gap-2 ${h&&"pb-2"}`,children:[a&&n.jsx(lt,{level:6,children:a}),s.map(b=>n.jsxs("label",{className:`flex cursor-pointer items-start ${a&&"mt-1 -mb-1"}`,htmlFor:b.value,children:[n.jsx(h1,{className:"relative float-left mt-[3px] size-4 min-w-[16px] appearance-none rounded-full border-2 border-solid border-grey-300 hover:cursor-pointer focus:shadow-none focus:ring-0 focus:outline-hidden data-[state=checked]:border-green data-[state=checked]:focus:border-green dark:border-grey-800 dark:text-white dark:data-[state=checked]:border-green dark:data-[state=checked]:focus:border-green",id:b.value,value:b.value,children:n.jsx(m1,{className:"flex size-full items-center justify-center after:block after:size-[6px] after:rounded-full after:border-green after:bg-green after:content-[''] dark:after:border-green dark:after:bg-green"})}),n.jsxs("div",{className:`ml-2 flex flex-col ${b.hint&&"mb-2"}`,children:[n.jsx("span",{className:`inline-block text-md dark:text-white ${b.hint&&"-mb-1"}`,children:b.label}),b.hint&&n.jsx(Hn,{children:b.hint})]})]},b.value)),p&&n.jsx(Hn,{color:f?"red":"",children:p})]}),(h||f)&&n.jsx($s,{className:f?"border-red":""})]}),ki=({children:t,gap:a="md",className:s})=>{let i="gap-3";switch(a){case"sm":i="gap-2";break;case"md":i="gap-3";break;case"lg":i="gap-4";break}return s=me("flex flex-col",i,s),n.jsx("div",{className:s,children:t})},Su=({heading:t,children:a,className:s})=>(s=me("w-full p-[8vmin] pt-5",s),n.jsxs("div",{className:s,children:[t&&n.jsx(lt,{className:"mb-8",children:t}),a]})),Au=({items:t,backIcon:a=!1,snapBackIcon:s=!0,onBack:i,containerClassName:f,itemClassName:p,activeItemClassName:x,separatorClassName:h})=>{const b=t.length;let g=0;return f=me("flex items-center gap-2 text-sm",f),x=me("font-bold",x),p=me("text-sm",p),n.jsxs("div",{className:f,children:[a&&n.jsx(Ie,{className:s?"mr-1":"mr-6",icon:"arrow-left",iconColorClass:"dark:text-white",size:"sm",link:!0,onClick:i}),t.map(m=>{const w=g===b-1?n.jsx("span",{className:x,children:m.label}):n.jsxs(n.Fragment,{children:[n.jsx("button",{className:`${p} ${m.onClick&&"-mx-1 cursor-pointer rounded-sm px-1 py-px hover:bg-grey-100 dark:hover:bg-grey-900"}`,type:"button",onClick:m.onClick,children:m.label},`bc-${g}`),n.jsx("span",{className:h,children:"/"})]});return g=g+1,w})]})},Zr=({testId:t,title:a,titleHeadingLevel:s=4,size:i="full",width:f,height:p,sidebar:x="",preview:h,dirty:b=!1,cancelLabel:g="Cancel",okLabel:m="OK",okColor:w="black",previewToolbar:v=!0,leftToolbar:y=!0,rightToolbar:C=!0,deviceSelector:j=!0,siteLink:N,previewToolbarURLs:T,previewBgColor:A="grey",selectedURL:R,previewToolbarTabs:$,previewToolbarBreadcrumbs:L,buttonsDisabled:P,sidebarButtons:D,sidebarHeader:q,sidebarPadding:Y=!0,sidebarContentClasses:z,enableCMDS:G=!0,backDropClick:te,onCancel:fe,onOk:Me,afterClose:K,onSelectURL:Q,onSelectDesktopView:Ne,onSelectMobileView:ue,onBreadcrumbsBack:we})=>{const ee=Lt(),{setGlobalDirtyState:pe}=Vv();S.useEffect(()=>{pe(b)},[b,pe]),S.useEffect(()=>{if(Me){const ve=De=>{(De.metaKey||De.ctrlKey)&&De.key==="s"&&(De.preventDefault(),Me())};if(G)return window.addEventListener("keydown",ve),()=>{window.removeEventListener("keydown",ve)}}});const[le,de]=S.useState("desktop");if(le==="mobile"&&j?h=n.jsx($h,{"data-testid":"preview-mobile",children:h}):le==="desktop"&&j&&(h=n.jsx(Dh,{"data-testid":"preview-desktop",children:h})),v){let ve=n.jsx(n.Fragment,{});T?ve=n.jsx(jt,{options:T,selectedOption:T.find(Je=>Je.value===R),onSelect:Je=>Je&&Q?.(Je.value)}):$?ve=n.jsx(kr,{border:!1,selectedTab:R,tabs:$,width:"wide",onTabChange:Q}):L&&(ve=n.jsx(Au,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:L,separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:we}));const De="text-black dark:text-green",Qe="text-grey-500 dark:text-grey-600",Dt=[{icon:"laptop",label:"Desktop",hideLabel:!0,link:!0,size:"sm",iconColorClass:le==="desktop"?De:Qe,onClick:Ne||(()=>{de("desktop")})},{icon:"mobile",label:"Mobile",hideLabel:!0,link:!0,size:"sm",iconColorClass:le==="mobile"?De:Qe,onClick:ue||(()=>{de("mobile")})}],Gt=j&&n.jsx(Fn,{buttons:Dt});let ae="";A==="grey"?ae="bg-grey-50 dark:bg-black":A==="greygradient"&&(ae="bg-gradient-to-tr from-white to-[#f9f9fa] dark:from-grey-950 dark:to-black");const $e=me("absolute inset-y-0 right-[400px] left-0 flex w-full min-w-100 grow flex-col overflow-y-auto",ae);let Ft;N&&(Ft=n.jsx("div",{className:"ml-3 border-l border-grey-400 dark:border-grey-800",children:n.jsxs("a",{className:"ml-3 flex items-center gap-1 text-sm",href:N,rel:"noopener noreferrer",target:"_blank",children:["View site ",n.jsx(qe,{name:"arrow-top-right",size:"xs"})]})})),h=n.jsxs("div",{className:$e,children:[v&&n.jsxs("header",{className:"relative flex h-[80px] shrink-0 items-center justify-center px-8 py-5","data-testid":"design-toolbar",children:[y&&n.jsx("div",{className:"absolute left-8 flex h-full items-center",children:ve}),C&&n.jsxs("div",{className:"absolute right-8 flex h-full items-center",children:[Gt,Ft]})]}),n.jsx("div",{className:"flex grow items-center justify-center text-sm text-grey-400",children:h})]})}const V=[];return D||(V.push({key:"cancel-modal",label:g,onClick:fe||(()=>{Qv(b,()=>{ee.remove(),K?.()})}),disabled:P}),V.push({key:"ok-modal",label:m,color:w,onClick:Me,disabled:P})),n.jsx(ct,{afterClose:K,animate:!1,backDropClick:te,dirty:b,footer:!1,height:p,padding:!1,size:i,testId:t,title:"",width:f,hideXOnMobile:!0,children:n.jsxs("div",{className:"flex h-full grow",children:[n.jsx("div",{className:`relative hidden grow flex-col [@media(min-width:801px)]:!visible [@media(min-width:801px)]:!flex ${A==="grey"?"bg-grey-50":"bg-white dark:bg-black"}`,children:h}),x&&n.jsxs("div",{className:"relative flex size-full flex-col border-l border-grey-100 dark:border-grey-900 [@media(min-width:801px)]:w-auto [@media(min-width:801px)]:basis-[400px]",children:[q||n.jsxs("div",{className:"flex max-h-[82px] items-center justify-between gap-3 px-7 py-6",children:[n.jsx(lt,{level:s,children:a}),D||n.jsx(Fn,{buttons:V})]}),n.jsx("div",{className:`${q?"":"absolute inset-x-0 top-[80px] bottom-0 grow"} ${Y&&"p-7 pt-0"} flex flex-col justify-between overflow-y-auto ${z&&z}`,children:x})]})]})})},x1=({offset:t,onTrigger:a})=>{const s=S.useRef(null);return S.useEffect(()=>{const i=new IntersectionObserver(f=>{f[0].intersectionRatio<=0||a()});return s.current&&i.observe(s.current),()=>i.disconnect()},[a]),n.jsx("div",{ref:s,className:"absolute w-full",style:{bottom:t}})},Du=({trigger:t,children:a,position:s="start",side:i="bottom",closeOnItemClick:f,open:p,setOpen:x})=>{const[h,b]=S.useState(!1),g=p!==void 0?p:h,m=x||b,w=()=>{f&&m(!1)};return n.jsxs(xv,{open:g,onOpenChange:m,children:[n.jsx(bv,{asChild:!0,children:n.jsx(wv,{asChild:!0,onClick:v=>v.stopPropagation(),children:t})}),n.jsx(vv,{align:s,className:"z-[9999] origin-top-right rounded bg-white shadow-md ring-1 ring-[rgba(0,0,0,0.01)] focus:outline-hidden dark:bg-grey-900 dark:text-white","data-testid":"popover-content",side:i,sideOffset:8,onClick:w,children:a})]})},Vh=({trigger:t,triggerButtonProps:a,items:s,position:i="start",open:f,setOpen:p})=>(t||(t=n.jsx(Ie,{icon:"ellipsis",label:"Menu",hideLabel:!0,...a})),n.jsx(Du,{open:f,position:i,setOpen:p,trigger:t,closeOnItemClick:!0,children:n.jsx("div",{className:"flex min-w-[160px] flex-col justify-stretch py-1",role:"none",children:s.map(x=>n.jsx("button",{className:`mx-1 block cursor-pointer rounded-[2.5px] px-4 py-1.5 text-left text-sm hover:bg-grey-100 dark:hover:bg-grey-925 ${x.destructive&&" text-red-500"}`,type:"button",onClick:h=>{x.onClick&&x.onClick(h)},children:x.label},x.id))})}));var Qh=typeof global=="object"&&global&&global.Object===Object&&global,b1=typeof self=="object"&&self&&self.Object===Object&&self,ir=Qh||b1||Function("return this")(),Os=ir.Symbol,Jh=Object.prototype,w1=Jh.hasOwnProperty,v1=Jh.toString,Sa=Os?Os.toStringTag:void 0;function y1(t){var a=w1.call(t,Sa),s=t[Sa];try{t[Sa]=void 0;var i=!0}catch{}var f=v1.call(t);return i&&(a?t[Sa]=s:delete t[Sa]),f}var _1=Object.prototype,M1=_1.toString;function k1(t){return M1.call(t)}var j1="[object Null]",N1="[object Undefined]",Pf=Os?Os.toStringTag:void 0;function Wa(t){return t==null?t===void 0?N1:j1:Pf&&Pf in Object(t)?y1(t):k1(t)}function Pa(t){return t!=null&&typeof t=="object"}var ji=Array.isArray;function em(t){var a=typeof t;return t!=null&&(a=="object"||a=="function")}var T1="[object AsyncFunction]",E1="[object Function]",C1="[object GeneratorFunction]",I1="[object Proxy]";function tm(t){if(!em(t))return!1;var a=Wa(t);return a==E1||a==C1||a==T1||a==I1}var Ac=ir["__core-js_shared__"],Hf=(function(){var t=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function S1(t){return!!Hf&&Hf in t}var A1=Function.prototype,D1=A1.toString;function Vr(t){if(t!=null){try{return D1.call(t)}catch{}try{return t+""}catch{}}return""}var $1=/[\\^$.*+?()[\]{}|]/g,O1=/^\[object .+?Constructor\]$/,R1=Function.prototype,L1=Object.prototype,F1=R1.toString,P1=L1.hasOwnProperty,H1=RegExp("^"+F1.call(P1).replace($1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z1(t){if(!em(t)||S1(t))return!1;var a=tm(t)?H1:O1;return a.test(Vr(t))}function U1(t,a){return t?.[a]}function zs(t,a){var s=U1(t,a);return z1(s)?s:void 0}var cu=zs(ir,"WeakMap"),B1=9007199254740991,W1=/^(?:0|[1-9]\d*)$/;function Y1(t,a){var s=typeof t;return a=a??B1,!!a&&(s=="number"||s!="symbol"&&W1.test(t))&&t>-1&&t%1==0&&t<a}function nm(t,a){return t===a||t!==t&&a!==a}var q1=9007199254740991;function rm(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=q1}function G1(t){return t!=null&&rm(t.length)&&!tm(t)}var X1=Object.prototype;function K1(t){var a=t&&t.constructor,s=typeof a=="function"&&a.prototype||X1;return t===s}function Z1(t,a){for(var s=-1,i=Array(t);++s<t;)i[s]=a(s);return i}var V1="[object Arguments]";function zf(t){return Pa(t)&&Wa(t)==V1}var sm=Object.prototype,Q1=sm.hasOwnProperty,J1=sm.propertyIsEnumerable,e_=zf((function(){return arguments})())?zf:function(t){return Pa(t)&&Q1.call(t,"callee")&&!J1.call(t,"callee")};function t_(){return!1}var am=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uf=am&&typeof module=="object"&&module&&!module.nodeType&&module,n_=Uf&&Uf.exports===am,Bf=n_?ir.Buffer:void 0,r_=Bf?Bf.isBuffer:void 0,uu=r_||t_,s_="[object Arguments]",a_="[object Array]",o_="[object Boolean]",i_="[object Date]",l_="[object Error]",c_="[object Function]",u_="[object Map]",d_="[object Number]",f_="[object Object]",p_="[object RegExp]",h_="[object Set]",m_="[object String]",g_="[object WeakMap]",x_="[object ArrayBuffer]",b_="[object DataView]",w_="[object Float32Array]",v_="[object Float64Array]",y_="[object Int8Array]",__="[object Int16Array]",M_="[object Int32Array]",k_="[object Uint8Array]",j_="[object Uint8ClampedArray]",N_="[object Uint16Array]",T_="[object Uint32Array]",pt={};pt[w_]=pt[v_]=pt[y_]=pt[__]=pt[M_]=pt[k_]=pt[j_]=pt[N_]=pt[T_]=!0;pt[s_]=pt[a_]=pt[x_]=pt[o_]=pt[b_]=pt[i_]=pt[l_]=pt[c_]=pt[u_]=pt[d_]=pt[f_]=pt[p_]=pt[h_]=pt[m_]=pt[g_]=!1;function E_(t){return Pa(t)&&rm(t.length)&&!!pt[Wa(t)]}function C_(t){return function(a){return t(a)}}var om=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oa=om&&typeof module=="object"&&module&&!module.nodeType&&module,I_=Oa&&Oa.exports===om,Dc=I_&&Qh.process,Wf=(function(){try{var t=Oa&&Oa.require&&Oa.require("util").types;return t||Dc&&Dc.binding&&Dc.binding("util")}catch{}})(),Yf=Wf&&Wf.isTypedArray,im=Yf?C_(Yf):E_,S_=Object.prototype,A_=S_.hasOwnProperty;function D_(t,a){var s=ji(t),i=!s&&e_(t),f=!s&&!i&&uu(t),p=!s&&!i&&!f&&im(t),x=s||i||f||p,h=x?Z1(t.length,String):[],b=h.length;for(var g in t)A_.call(t,g)&&!(x&&(g=="length"||f&&(g=="offset"||g=="parent")||p&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||Y1(g,b)))&&h.push(g);return h}function $_(t,a){return function(s){return t(a(s))}}var O_=$_(Object.keys,Object),R_=Object.prototype,L_=R_.hasOwnProperty;function F_(t){if(!K1(t))return O_(t);var a=[];for(var s in Object(t))L_.call(t,s)&&s!="constructor"&&a.push(s);return a}function P_(t){return G1(t)?D_(t):F_(t)}var Ha=zs(Object,"create");function H_(){this.__data__=Ha?Ha(null):{},this.size=0}function z_(t){var a=this.has(t)&&delete this.__data__[t];return this.size-=a?1:0,a}var U_="__lodash_hash_undefined__",B_=Object.prototype,W_=B_.hasOwnProperty;function Y_(t){var a=this.__data__;if(Ha){var s=a[t];return s===U_?void 0:s}return W_.call(a,t)?a[t]:void 0}var q_=Object.prototype,G_=q_.hasOwnProperty;function X_(t){var a=this.__data__;return Ha?a[t]!==void 0:G_.call(a,t)}var K_="__lodash_hash_undefined__";function Z_(t,a){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=Ha&&a===void 0?K_:a,this}function qr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}qr.prototype.clear=H_;qr.prototype.delete=z_;qr.prototype.get=Y_;qr.prototype.has=X_;qr.prototype.set=Z_;function V_(){this.__data__=[],this.size=0}function $i(t,a){for(var s=t.length;s--;)if(nm(t[s][0],a))return s;return-1}var Q_=Array.prototype,J_=Q_.splice;function e3(t){var a=this.__data__,s=$i(a,t);if(s<0)return!1;var i=a.length-1;return s==i?a.pop():J_.call(a,s,1),--this.size,!0}function t3(t){var a=this.__data__,s=$i(a,t);return s<0?void 0:a[s][1]}function n3(t){return $i(this.__data__,t)>-1}function r3(t,a){var s=this.__data__,i=$i(s,t);return i<0?(++this.size,s.push([t,a])):s[i][1]=a,this}function lr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}lr.prototype.clear=V_;lr.prototype.delete=e3;lr.prototype.get=t3;lr.prototype.has=n3;lr.prototype.set=r3;var za=zs(ir,"Map");function s3(){this.size=0,this.__data__={hash:new qr,map:new(za||lr),string:new qr}}function a3(t){var a=typeof t;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?t!=="__proto__":t===null}function Oi(t,a){var s=t.__data__;return a3(a)?s[typeof a=="string"?"string":"hash"]:s.map}function o3(t){var a=Oi(this,t).delete(t);return this.size-=a?1:0,a}function i3(t){return Oi(this,t).get(t)}function l3(t){return Oi(this,t).has(t)}function c3(t,a){var s=Oi(this,t),i=s.size;return s.set(t,a),this.size+=s.size==i?0:1,this}function Qr(t){var a=-1,s=t==null?0:t.length;for(this.clear();++a<s;){var i=t[a];this.set(i[0],i[1])}}Qr.prototype.clear=s3;Qr.prototype.delete=o3;Qr.prototype.get=i3;Qr.prototype.has=l3;Qr.prototype.set=c3;function u3(t,a){for(var s=-1,i=a.length,f=t.length;++s<i;)t[f+s]=a[s];return t}function d3(){this.__data__=new lr,this.size=0}function f3(t){var a=this.__data__,s=a.delete(t);return this.size=a.size,s}function p3(t){return this.__data__.get(t)}function h3(t){return this.__data__.has(t)}var m3=200;function g3(t,a){var s=this.__data__;if(s instanceof lr){var i=s.__data__;if(!za||i.length<m3-1)return i.push([t,a]),this.size=++s.size,this;s=this.__data__=new Qr(i)}return s.set(t,a),this.size=s.size,this}function _r(t){var a=this.__data__=new lr(t);this.size=a.size}_r.prototype.clear=d3;_r.prototype.delete=f3;_r.prototype.get=p3;_r.prototype.has=h3;_r.prototype.set=g3;function x3(t,a){for(var s=-1,i=t==null?0:t.length,f=0,p=[];++s<i;){var x=t[s];a(x,s,t)&&(p[f++]=x)}return p}function b3(){return[]}var w3=Object.prototype,v3=w3.propertyIsEnumerable,qf=Object.getOwnPropertySymbols,y3=qf?function(t){return t==null?[]:(t=Object(t),x3(qf(t),function(a){return v3.call(t,a)}))}:b3;function _3(t,a,s){var i=a(t);return ji(t)?i:u3(i,s(t))}function Gf(t){return _3(t,P_,y3)}var du=zs(ir,"DataView"),fu=zs(ir,"Promise"),pu=zs(ir,"Set"),Xf="[object Map]",M3="[object Object]",Kf="[object Promise]",Zf="[object Set]",Vf="[object WeakMap]",Qf="[object DataView]",k3=Vr(du),j3=Vr(za),N3=Vr(fu),T3=Vr(pu),E3=Vr(cu),yr=Wa;(du&&yr(new du(new ArrayBuffer(1)))!=Qf||za&&yr(new za)!=Xf||fu&&yr(fu.resolve())!=Kf||pu&&yr(new pu)!=Zf||cu&&yr(new cu)!=Vf)&&(yr=function(t){var a=Wa(t),s=a==M3?t.constructor:void 0,i=s?Vr(s):"";if(i)switch(i){case k3:return Qf;case j3:return Xf;case N3:return Kf;case T3:return Zf;case E3:return Vf}return a});var Jf=ir.Uint8Array,C3="__lodash_hash_undefined__";function I3(t){return this.__data__.set(t,C3),this}function S3(t){return this.__data__.has(t)}function Ni(t){var a=-1,s=t==null?0:t.length;for(this.__data__=new Qr;++a<s;)this.add(t[a])}Ni.prototype.add=Ni.prototype.push=I3;Ni.prototype.has=S3;function A3(t,a){for(var s=-1,i=t==null?0:t.length;++s<i;)if(a(t[s],s,t))return!0;return!1}function D3(t,a){return t.has(a)}var $3=1,O3=2;function lm(t,a,s,i,f,p){var x=s&$3,h=t.length,b=a.length;if(h!=b&&!(x&&b>h))return!1;var g=p.get(t),m=p.get(a);if(g&&m)return g==a&&m==t;var w=-1,v=!0,y=s&O3?new Ni:void 0;for(p.set(t,a),p.set(a,t);++w<h;){var C=t[w],j=a[w];if(i)var N=x?i(j,C,w,a,t,p):i(C,j,w,t,a,p);if(N!==void 0){if(N)continue;v=!1;break}if(y){if(!A3(a,function(T,A){if(!D3(y,A)&&(C===T||f(C,T,s,i,p)))return y.push(A)})){v=!1;break}}else if(!(C===j||f(C,j,s,i,p))){v=!1;break}}return p.delete(t),p.delete(a),v}function R3(t){var a=-1,s=Array(t.size);return t.forEach(function(i,f){s[++a]=[f,i]}),s}function L3(t){var a=-1,s=Array(t.size);return t.forEach(function(i){s[++a]=i}),s}var F3=1,P3=2,H3="[object Boolean]",z3="[object Date]",U3="[object Error]",B3="[object Map]",W3="[object Number]",Y3="[object RegExp]",q3="[object Set]",G3="[object String]",X3="[object Symbol]",K3="[object ArrayBuffer]",Z3="[object DataView]",ep=Os?Os.prototype:void 0,$c=ep?ep.valueOf:void 0;function V3(t,a,s,i,f,p,x){switch(s){case Z3:if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case K3:return!(t.byteLength!=a.byteLength||!p(new Jf(t),new Jf(a)));case H3:case z3:case W3:return nm(+t,+a);case U3:return t.name==a.name&&t.message==a.message;case Y3:case G3:return t==a+"";case B3:var h=R3;case q3:var b=i&F3;if(h||(h=L3),t.size!=a.size&&!b)return!1;var g=x.get(t);if(g)return g==a;i|=P3,x.set(t,a);var m=lm(h(t),h(a),i,f,p,x);return x.delete(t),m;case X3:if($c)return $c.call(t)==$c.call(a)}return!1}var Q3=1,J3=Object.prototype,eM=J3.hasOwnProperty;function tM(t,a,s,i,f,p){var x=s&Q3,h=Gf(t),b=h.length,g=Gf(a),m=g.length;if(b!=m&&!x)return!1;for(var w=b;w--;){var v=h[w];if(!(x?v in a:eM.call(a,v)))return!1}var y=p.get(t),C=p.get(a);if(y&&C)return y==a&&C==t;var j=!0;p.set(t,a),p.set(a,t);for(var N=x;++w<b;){v=h[w];var T=t[v],A=a[v];if(i)var R=x?i(A,T,v,a,t,p):i(T,A,v,t,a,p);if(!(R===void 0?T===A||f(T,A,s,i,p):R)){j=!1;break}N||(N=v=="constructor")}if(j&&!N){var $=t.constructor,L=a.constructor;$!=L&&"constructor"in t&&"constructor"in a&&!(typeof $=="function"&&$ instanceof $&&typeof L=="function"&&L instanceof L)&&(j=!1)}return p.delete(t),p.delete(a),j}var nM=1,tp="[object Arguments]",np="[object Array]",hi="[object Object]",rM=Object.prototype,rp=rM.hasOwnProperty;function sM(t,a,s,i,f,p){var x=ji(t),h=ji(a),b=x?np:yr(t),g=h?np:yr(a);b=b==tp?hi:b,g=g==tp?hi:g;var m=b==hi,w=g==hi,v=b==g;if(v&&uu(t)){if(!uu(a))return!1;x=!0,m=!1}if(v&&!m)return p||(p=new _r),x||im(t)?lm(t,a,s,i,f,p):V3(t,a,b,s,i,f,p);if(!(s&nM)){var y=m&&rp.call(t,"__wrapped__"),C=w&&rp.call(a,"__wrapped__");if(y||C){var j=y?t.value():t,N=C?a.value():a;return p||(p=new _r),f(j,N,s,i,p)}}return v?(p||(p=new _r),tM(t,a,s,i,f,p)):!1}function cm(t,a,s,i,f){return t===a?!0:t==null||a==null||!Pa(t)&&!Pa(a)?t!==t&&a!==a:sM(t,a,s,i,cm,f)}function aM(t,a){return cm(t,a)}const sp=({className:t,children:a,colSpan:s,sticky:i=!1,...f})=>{const p=me("py-2! pr-6! pl-0! text-left align-top",i&&"sticky top-0 bg-white",f.onClick&&"hover:cursor-pointer",t);return n.jsx("th",{className:p,colSpan:s,...f,children:n.jsx(lt,{className:"whitespace-nowrap",level:6,children:a})})},um=({left:t,center:a,right:s,sticky:i=!0,containerClassName:f,children:p})=>{const x=me("z-50 h-22 min-h-[92px] p-8",!p&&"flex items-center justify-between gap-3",i&&"sticky top-0",f);if(!p){if(t){const h=me("flex flex-auto items-center",s&&a&&"basis-1/3",!s&&a&&"basis-1/2");t=n.jsx("div",{className:h,children:t})}if(a){const h=me("flex flex-auto items-center justify-center",t&&s&&"basis-1/3",(t&&!s||!t&&s)&&"basis-1/2");a=n.jsx("div",{className:h,children:a})}if(s){const h=me("flex flex-auto items-center justify-end",t&&a&&"basis-1/3",!t&&a&&"basis-1/2");s=n.jsx("div",{className:h,children:s})}}return n.jsx("div",{className:x,children:p||n.jsxs(n.Fragment,{children:[t,a,s]})})},dm=({items:t,setItems:a,blank:s,canAddNewItem:i})=>{const[f,p]=S.useState(t.map((v,y)=>({item:v,id:y.toString()}))),[x,h]=S.useState(s);return S.useEffect(()=>{const v=f.map(({item:y})=>y);i(x)&&v.push(x),aM(JSON.parse(JSON.stringify(v)),JSON.parse(JSON.stringify(t)))||a(v)},[f,x,t,a,i]),{items:f,updateItem:(v,y)=>{const C=f.map(j=>j.id===v?{...j,item:y}:j);p(C),a(C.map(j=>j.item))},addItem:()=>{if(i(x)){const v=f.reduce((C,j)=>Math.max(C,parseInt(j.id)),0),y=f.concat({item:x,id:(v+1).toString()});p(y),a(y.map(C=>C.item)),h(s)}},removeItem:v=>{const y=f.filter(C=>C.id!==v);p(y),a(y.map(C=>C.item))},moveItem:(v,y)=>{if(v!==y){const C=f.findIndex(T=>T.id===v),j=y?f.findIndex(T=>T.id===y):0,N=Jv(f,C,j);p(N),a(N.map(T=>T.item))}},newItem:x,setNewItem:h}},oM=({label:t,text:a="",hint:s,onRegenerate:i})=>{const[f,p]=S.useState(!1),x=()=>{navigator.clipboard.writeText(a),p(!0),setTimeout(()=>p(!1),2e3)},h=me("group/api-keys relative -mt-1 mb-1 w-full overflow-hidden border-b border-transparent py-2 hover:border-grey-300 dark:hover:border-grey-600");return n.jsxs("div",{className:"mb-3 grid grid-cols-1",children:[t&&n.jsx(lt,{level:6,grey:!0,children:t}),n.jsxs("div",{className:h,children:[n.jsx("span",{children:a}),s,n.jsxs("div",{className:"visible absolute top-1/2 right-0 flex translate-y-[-50%] gap-1 bg-white pl-1 text-sm group-hover/api-keys:visible md:invisible dark:bg-black",children:[i&&n.jsx(Ie,{color:"outline",label:"Regenerate",size:"sm",onClick:i}),n.jsx(Ie,{color:"outline",label:f?"Copied":"Copy",size:"sm",onClick:x})]})]})]})},Ya=({keys:t})=>n.jsx("div",{"data-testid":"api-keys",children:t.map(a=>n.jsx(oM,{...a},a.label))}),Jr=({icon:t,title:a,detail:s,extra:i})=>n.jsxs("div",{className:"-mx-8 -mt-8 flex flex-col gap-4 bg-grey-75 p-8 md:flex-row dark:bg-grey-950",children:[n.jsx("div",{className:"size-14",children:t}),n.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-1 flex-col",children:[n.jsx("h3",{children:a}),n.jsx("div",{children:s}),i&&n.jsx("div",{className:"mt-4",children:i})]})]}),iM=""+new URL("zapier-logo-D8a11oW_.svg",import.meta.url).href,$u=Gr({method:"POST",path:({integrationId:t,apiKeyId:a})=>`/integrations/${t}/api_key/${a}/refresh/`,body:({integrationId:t})=>({integrations:[{id:t}]}),updateQueries:{emberUpdateType:"createOrUpdate",dataType:Ii,update:(t,a)=>a&&{...a,integrations:a.integrations.map(s=>t.integrations.find(({id:f})=>f===s.id)||s)}}}),lM=ge.create(()=>{const t=ge.useModal(),{updateRoute:a}=He(),{zapierTemplates:s}=ey(),{data:{integrations:i}={integrations:[]}}=Si(),{config:f}=Ue(),{mutateAsync:p}=$u(),x=Ze(),[h,b]=S.useState(!1),g=f.hostSettings?.limits?.customIntegrations?.disabled,m=i.find(({slug:y})=>y==="zapier"),w=m?.api_keys?.find(y=>y.type==="admin");S.useEffect(()=>{g&&a("integrations")},[g,a]);const v=()=>{!m||!w||(b(!1),ge.show(xt,{title:"Regenerate Admin API Key",prompt:'You will need to locate the Ghost App within your Zapier account and click on "Reconnect" to enter the new Admin API Key.',okLabel:"Regenerate Admin API Key",onOk:async y=>{try{await p({integrationId:m.id,apiKeyId:w.id}),b(!0),y?.remove()}catch(C){x(C)}}}))};return n.jsxs(ct,{afterClose:()=>{a("integrations")},cancelLabel:"",footer:n.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[n.jsxs("a",{className:"mt-1 self-baseline text-sm font-bold",href:"https://zapier.com/apps/ghost/integrations?utm_medium=partner_api&utm_source=widget&utm_campaign=Widget",rel:"noopener noreferrer",target:"_blank",children:["View more Ghost integrations powered by ",n.jsx("span",{children:n.jsx("img",{alt:"Zapier",className:"relative top-[-2px] inline-block",src:iM})})]}),n.jsx(Ie,{color:"black",label:"Close",onClick:()=>{t.remove()}})]}),okColor:"black",okLabel:"Close",testId:"zapier-modal",title:"",stickyFooter:!0,onOk:()=>{a("integrations"),t.remove()},children:[n.jsx(Jr,{detail:"Automation for your favorite apps",extra:n.jsx("div",{className:"mt-1 -mb-4",children:n.jsx(Ya,{keys:[{label:"Admin API key",text:w?.secret,hint:h?n.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:v},{label:"API URL",text:window.location.origin+Rs().subdir}]})}),icon:n.jsx(qe,{name:"zapier",size:56}),title:"Zapier"}),n.jsx(sr,{children:s.map(y=>n.jsx(Nr,{action:n.jsx(Ie,{className:"text-sm font-semibold whitespace-nowrap text-[#FF4A00]",href:y.url,label:"Use this Zap",tag:"a",target:"_blank",link:!0,unstyled:!0}),bgOnHover:!1,className:"flex items-center gap-3 py-2 pl-3",title:n.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[n.jsxs("div",{className:"flex shrink-0 flex-nowrap items-center gap-2",children:[n.jsx("img",{className:"size-8 object-contain dark:invert",role:"presentation",src:y.ghostImage}),n.jsx(qe,{name:"arrow-right",size:"xs"}),n.jsx("img",{className:"size-8 object-contain",role:"presentation",src:y.appImage})]}),n.jsx("span",{className:"text-sm",children:y.title})]}),hideActions:!0}))})]})}),cM=({tier:t})=>{const a=t?.type==="free",{updateRoute:s}=He(),{mutateAsync:i}=Tu(),{mutateAsync:f}=Sy(),{mutateAsync:p}=jr(),[x,h]=Ve.useState(!!t?.trial_days),b=Ze(),{localSettings:g,siteData:m}=Xr(),[w]=ot(g,["portal_plans"]),v=JSON.parse(w?.toString()||"[]"),y={name:()=>C.name?void 0:"Enter a name for the tier",monthly_price:()=>C.type!=="free"?Cf(C.monthly_price||0,C.currency,{allowZero:!1}):void 0,yearly_price:()=>C.type!=="free"?Cf(C.yearly_price||0,C.currency,{allowZero:!1}):void 0},{formState:C,saveState:j,updateForm:N,handleSave:T,errors:A,clearError:R,okProps:$}=nn({initialState:{...t||{},trial_days:t?.trial_days?.toString()||"",currency:t?.currency||ty[0].isoCode,visibility:t?.visibility||"none",welcome_page_url:t?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{const z={};return Object.entries(y).forEach(([G,te])=>{z[G]=te?.()}),z},onSave:async()=>{const{trial_days:z,currency:G,...te}=C,fe=te;if(fe.benefits=fe.benefits?.filter(Me=>Me),a||(fe.currency=G,fe.trial_days=parseInt(z)),t?.id?await i({...t,...fe}):await f(fe),a){const Me=C.visibility==="public";let K=!1;v.includes("free")&&!Me&&(v.splice(v.indexOf("free"),1),K=!0),!v.includes("free")&&Me&&(v.push("free"),K=!0),K&&await p([{key:"portal_plans",value:JSON.stringify(v)}])}},onSaveError:b}),L=dm({items:C.benefits||[],setItems:z=>N(G=>({...G,benefits:z})),blank:"",canAddNewItem:z=>!!z}),P=z=>{z.target.checked?(h(!0),N(G=>({...G,trial_days:t?.trial_days?t?.trial_days.toString():"7"}))):(h(!1),N(G=>({...G,trial_days:"0"})))},D=S.useRef(!1);S.useEffect(()=>{D.current&&(y.monthly_price?.(),y.yearly_price?.()),D.current=!0},[C.currency]);const q=()=>{if(t){const z=t.active?"Archive tier":"Reactivate tier",G=t.active?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Members will no longer be able to subscribe to ",n.jsx("strong",{children:t.name})," and it will be removed from the list of available tiers in portal."]}),n.jsx("div",{children:"Existing members on this tier will remain unchanged. Offers using this tier will be disabled."})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Reactivating ",n.jsx("strong",{children:t.name})," will re-enable it as an option in portal and allow new members to subscribe to this tier."]}),n.jsx("div",{children:"Existing members will remain unchanged."})]}),te=t.active?"Archive":"Reactivate";ge.show(xt,{title:z,prompt:G,okLabel:te,cancelLabel:"Cancel",okColor:t.active?"red":"black",onOk:fe=>{i({...t,active:!t.active}),fe?.remove(),rt({type:"success",title:`Tier ${t.active?"archived":"reactivated"}`})}})}};let Y={};return t&&(t.active&&t.type!=="free"?Y={label:"Archive tier",color:"red",link:!0,onClick:q}:t.active||(Y={label:"Reactivate tier",color:"green",link:!0,onClick:q})),n.jsx(ct,{afterClose:()=>{s("tiers")},buttonsDisabled:$.disabled,cancelLabel:"Close",dirty:j==="unsaved",leftButtonProps:Y,okColor:$.color,okLabel:$.label||"Save",size:"lg",testId:"tier-detail-modal",title:t?t.active?"Edit tier":"Edit archived tier":"New tier",stickyFooter:!0,onOk:async()=>{await T({fakeWhenUnchanged:!0})},children:n.jsxs("div",{className:"mt-8 -mb-8 flex items-start gap-8",children:[n.jsxs("div",{className:"flex grow flex-col gap-8",children:[n.jsxs(Ye,{marginBottom:!1,title:"Basic",grouped:!0,children:[n.jsx(_e,{autoComplete:"off",error:!!A.name,hint:A.name,maxLength:191,placeholder:a?"Free":"Bronze",title:"Name",value:C.name||"",autoFocus:!0,onChange:z=>N(G=>({...G,name:z.target.value})),onKeyDown:()=>R("name")}),n.jsx(_e,{autoComplete:"off",autoFocus:a,maxLength:191,placeholder:a?"Free preview":"Full access to premium content",title:"Description",value:C.description||"",onChange:z=>N(G=>({...G,description:z.target.value}))}),!a&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"flex flex-col gap-10 md:flex-row",children:[n.jsxs("div",{className:"basis-1/2",children:[n.jsxs("div",{className:"mb-1 flex h-6 items-center justify-between",children:[n.jsx(lt,{level:6,children:"Prices"}),n.jsx("div",{className:"-mr-2 w-[50px]",children:n.jsx(jt,{border:!1,containerClassName:"font-medium",controlClasses:{menu:"w-18"},options:Tf(),selectedOption:Tf().flatMap(z=>z.options).find(z=>z.value===C.currency),size:"xs",clearBg:!0,isSearchable:!0,onSelect:z=>N(G=>({...G,currency:z?.value}))})})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(Ef,{error:!!A.monthly_price,hint:A.monthly_price,placeholder:"5",rightPlaceholder:`${C.currency}/month`,title:"Monthly price",valueInCents:C.monthly_price||"",hideTitle:!0,onBlur:z=>z.target.value===""?N(G=>({...G,monthly_price:0})):null,onChange:z=>N(G=>({...G,monthly_price:z})),onKeyDown:()=>R("monthly_price")}),n.jsx(Ef,{error:!!A.yearly_price,hint:A.yearly_price,placeholder:"50",rightPlaceholder:`${C.currency}/year`,title:"Yearly price",valueInCents:C.yearly_price||"",hideTitle:!0,onBlur:z=>z.target.value===""?N(G=>({...G,yearly_price:0})):null,onChange:z=>N(G=>({...G,yearly_price:z})),onKeyDown:()=>R("yearly_price")})]})]}),n.jsxs("div",{className:"basis-1/2",children:[n.jsx("div",{className:"mb-1 flex h-6 flex-col justify-center",children:n.jsx(Be,{checked:x,label:"Add a free trial",labelStyle:"heading",onChange:P})}),n.jsx(_e,{disabled:!x,hint:n.jsxs("div",{className:"mt-1",children:["Members will be subscribed at full price once the trial ends. ",n.jsx("a",{className:"text-green",href:"https://ghost.org/help/free-trials/",rel:"noreferrer",target:"_blank",children:"Learn more"})]}),placeholder:"0",rightPlaceholder:"days",title:"Trial days",value:C.trial_days,hideTitle:!0,onChange:z=>N(G=>({...G,trial_days:z.target.value.replace(/[^\d]/,"")}))})]})]})}),n.jsx(gh,{baseUrl:m?.url,hint:`Redirect to this URL after signup ${a?"":" for premium membership"}`,maxLength:2e3,placeholder:m?.url,title:"Welcome page",value:C.welcome_page_url||null,nullable:!0,transformPathWithoutSlash:!0,onChange:z=>N(G=>({...G,welcome_page_url:z||null}))})]}),n.jsxs(Ye,{gap:"none",title:"Benefits",grouped:!0,children:[n.jsx("div",{className:"-mt-3",children:n.jsx(xh,{items:L.items,itemSeparator:!1,renderItem:({id:z,item:G})=>n.jsxs("div",{className:"relative flex w-full items-center gap-5",children:[n.jsx("div",{className:"absolute top-[7px] left-[-32px] flex size-6 items-center justify-center bg-white group-hover:hidden dark:bg-black",children:n.jsx(qe,{name:"check",size:"sm"})}),n.jsx(_e,{maxLength:191,value:G,onChange:te=>L.updateItem(z,te.target.value)}),n.jsx(Ie,{className:"absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100",color:"grey",icon:"trash",size:"sm",onClick:()=>L.removeItem(z)})]}),onMove:L.moveItem})}),n.jsxs("div",{className:"relative mt-1 flex items-center gap-3",children:[n.jsx(qe,{className:"dark:text-white",name:"check",size:"sm"}),n.jsx(_e,{className:"grow",containerClassName:"w-100",maxLength:191,placeholder:"Expert analysis",title:"New benefit",value:L.newItem,hideTitle:!0,onChange:z=>L.setNewItem(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.addItem()}}),n.jsx(Ie,{className:"absolute top-[5px] right-[5px] z-10",color:"green",icon:"add",iconColorClass:"text-white",label:"Add",size:"sm",hideLabel:!0,onClick:()=>L.addItem()})]})]})]}),n.jsx("div",{className:"sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block",children:n.jsx(ny,{isFreeTier:a,tier:C})})]})})},uM=({params:t})=>{const{data:{tiers:a,isEnd:s}={},fetchNextPage:i}=Kr();let f;return S.useEffect(()=>{t?.id&&!f&&!s&&i()},[i,s,t?.id,f]),t?.id&&(f=a?.find(({id:p})=>p===t?.id),!f)?null:n.jsx(cM,{tier:f})},dM=ge.create(uM);var Oc,ap;function fm(){if(ap)return Oc;ap=1;var t={};return Oc=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...s)=>console.error("SEMVER",...s):()=>{},Oc}var Rc,op;function pm(){if(op)return Rc;op=1;const t="2.0.0",a=256,s=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,f=a-6;return Rc={MAX_LENGTH:a,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:f,MAX_SAFE_INTEGER:s,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Rc}var mi={exports:{}},ip;function fM(){return ip||(ip=1,(function(t,a){const{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:f}=pm(),p=fm();a=t.exports={};const x=a.re=[],h=a.safeRe=[],b=a.src=[],g=a.safeSrc=[],m=a.t={};let w=0;const v="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",f],[v,i]],C=N=>{for(const[T,A]of y)N=N.split(`${T}*`).join(`${T}{0,${A}}`).split(`${T}+`).join(`${T}{1,${A}}`);return N},j=(N,T,A)=>{const R=C(T),$=w++;p(N,$,T),m[N]=$,b[$]=T,g[$]=R,x[$]=new RegExp(T,A?"g":void 0),h[$]=new RegExp(R,A?"g":void 0)};j("NUMERICIDENTIFIER","0|[1-9]\\d*"),j("NUMERICIDENTIFIERLOOSE","\\d+"),j("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${v}*`),j("MAINVERSION",`(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})`),j("MAINVERSIONLOOSE",`(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})`),j("PRERELEASEIDENTIFIER",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIER]})`),j("PRERELEASEIDENTIFIERLOOSE",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIERLOOSE]})`),j("PRERELEASE",`(?:-(${b[m.PRERELEASEIDENTIFIER]}(?:\\.${b[m.PRERELEASEIDENTIFIER]})*))`),j("PRERELEASELOOSE",`(?:-?(${b[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[m.PRERELEASEIDENTIFIERLOOSE]})*))`),j("BUILDIDENTIFIER",`${v}+`),j("BUILD",`(?:\\+(${b[m.BUILDIDENTIFIER]}(?:\\.${b[m.BUILDIDENTIFIER]})*))`),j("FULLPLAIN",`v?${b[m.MAINVERSION]}${b[m.PRERELEASE]}?${b[m.BUILD]}?`),j("FULL",`^${b[m.FULLPLAIN]}$`),j("LOOSEPLAIN",`[v=\\s]*${b[m.MAINVERSIONLOOSE]}${b[m.PRERELEASELOOSE]}?${b[m.BUILD]}?`),j("LOOSE",`^${b[m.LOOSEPLAIN]}$`),j("GTLT","((?:<|>)?=?)"),j("XRANGEIDENTIFIERLOOSE",`${b[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),j("XRANGEIDENTIFIER",`${b[m.NUMERICIDENTIFIER]}|x|X|\\*`),j("XRANGEPLAIN",`[v=\\s]*(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:${b[m.PRERELEASE]})?${b[m.BUILD]}?)?)?`),j("XRANGEPLAINLOOSE",`[v=\\s]*(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:${b[m.PRERELEASELOOSE]})?${b[m.BUILD]}?)?)?`),j("XRANGE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAIN]}$`),j("XRANGELOOSE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAINLOOSE]}$`),j("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),j("COERCE",`${b[m.COERCEPLAIN]}(?:$|[^\\d])`),j("COERCEFULL",b[m.COERCEPLAIN]+`(?:${b[m.PRERELEASE]})?(?:${b[m.BUILD]})?(?:$|[^\\d])`),j("COERCERTL",b[m.COERCE],!0),j("COERCERTLFULL",b[m.COERCEFULL],!0),j("LONETILDE","(?:~>?)"),j("TILDETRIM",`(\\s*)${b[m.LONETILDE]}\\s+`,!0),a.tildeTrimReplace="$1~",j("TILDE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAIN]}$`),j("TILDELOOSE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAINLOOSE]}$`),j("LONECARET","(?:\\^)"),j("CARETTRIM",`(\\s*)${b[m.LONECARET]}\\s+`,!0),a.caretTrimReplace="$1^",j("CARET",`^${b[m.LONECARET]}${b[m.XRANGEPLAIN]}$`),j("CARETLOOSE",`^${b[m.LONECARET]}${b[m.XRANGEPLAINLOOSE]}$`),j("COMPARATORLOOSE",`^${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]})$|^$`),j("COMPARATOR",`^${b[m.GTLT]}\\s*(${b[m.FULLPLAIN]})$|^$`),j("COMPARATORTRIM",`(\\s*)${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]}|${b[m.XRANGEPLAIN]})`,!0),a.comparatorTrimReplace="$1$2$3",j("HYPHENRANGE",`^\\s*(${b[m.XRANGEPLAIN]})\\s+-\\s+(${b[m.XRANGEPLAIN]})\\s*$`),j("HYPHENRANGELOOSE",`^\\s*(${b[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[m.XRANGEPLAINLOOSE]})\\s*$`),j("STAR","(<|>)?=?\\s*\\*"),j("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),j("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(mi,mi.exports)),mi.exports}var Lc,lp;function pM(){if(lp)return Lc;lp=1;const t=Object.freeze({loose:!0}),a=Object.freeze({});return Lc=i=>i?typeof i!="object"?t:i:a,Lc}var Fc,cp;function hM(){if(cp)return Fc;cp=1;const t=/^[0-9]+$/,a=(i,f)=>{if(typeof i=="number"&&typeof f=="number")return i===f?0:i<f?-1:1;const p=t.test(i),x=t.test(f);return p&&x&&(i=+i,f=+f),i===f?0:p&&!x?-1:x&&!p?1:i<f?-1:1};return Fc={compareIdentifiers:a,rcompareIdentifiers:(i,f)=>a(f,i)},Fc}var Pc,up;function mM(){if(up)return Pc;up=1;const t=fm(),{MAX_LENGTH:a,MAX_SAFE_INTEGER:s}=pm(),{safeRe:i,t:f}=fM(),p=pM(),{compareIdentifiers:x}=hM();class h{constructor(g,m){if(m=p(m),g instanceof h){if(g.loose===!!m.loose&&g.includePrerelease===!!m.includePrerelease)return g;g=g.version}else if(typeof g!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof g}".`);if(g.length>a)throw new TypeError(`version is longer than ${a} characters`);t("SemVer",g,m),this.options=m,this.loose=!!m.loose,this.includePrerelease=!!m.includePrerelease;const w=g.trim().match(m.loose?i[f.LOOSE]:i[f.FULL]);if(!w)throw new TypeError(`Invalid Version: ${g}`);if(this.raw=g,this.major=+w[1],this.minor=+w[2],this.patch=+w[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");w[4]?this.prerelease=w[4].split(".").map(v=>{if(/^[0-9]+$/.test(v)){const y=+v;if(y>=0&&y<s)return y}return v}):this.prerelease=[],this.build=w[5]?w[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(g){if(t("SemVer.compare",this.version,this.options,g),!(g instanceof h)){if(typeof g=="string"&&g===this.version)return 0;g=new h(g,this.options)}return g.version===this.version?0:this.compareMain(g)||this.comparePre(g)}compareMain(g){return g instanceof h||(g=new h(g,this.options)),this.major<g.major?-1:this.major>g.major?1:this.minor<g.minor?-1:this.minor>g.minor?1:this.patch<g.patch?-1:this.patch>g.patch?1:0}comparePre(g){if(g instanceof h||(g=new h(g,this.options)),this.prerelease.length&&!g.prerelease.length)return-1;if(!this.prerelease.length&&g.prerelease.length)return 1;if(!this.prerelease.length&&!g.prerelease.length)return 0;let m=0;do{const w=this.prerelease[m],v=g.prerelease[m];if(t("prerelease compare",m,w,v),w===void 0&&v===void 0)return 0;if(v===void 0)return 1;if(w===void 0)return-1;if(w===v)continue;return x(w,v)}while(++m)}compareBuild(g){g instanceof h||(g=new h(g,this.options));let m=0;do{const w=this.build[m],v=g.build[m];if(t("build compare",m,w,v),w===void 0&&v===void 0)return 0;if(v===void 0)return 1;if(w===void 0)return-1;if(w===v)continue;return x(w,v)}while(++m)}inc(g,m,w){if(g.startsWith("pre")){if(!m&&w===!1)throw new Error("invalid increment argument: identifier is empty");if(m){const v=`-${m}`.match(this.options.loose?i[f.PRERELEASELOOSE]:i[f.PRERELEASE]);if(!v||v[1]!==m)throw new Error(`invalid identifier: ${m}`)}}switch(g){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",m,w);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",m,w);break;case"prepatch":this.prerelease.length=0,this.inc("patch",m,w),this.inc("pre",m,w);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",m,w),this.inc("pre",m,w);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const v=Number(w)?1:0;if(this.prerelease.length===0)this.prerelease=[v];else{let y=this.prerelease.length;for(;--y>=0;)typeof this.prerelease[y]=="number"&&(this.prerelease[y]++,y=-2);if(y===-1){if(m===this.prerelease.join(".")&&w===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(v)}}if(m){let y=[m,v];w===!1&&(y=[m]),x(this.prerelease[0],m)===0?isNaN(this.prerelease[1])&&(this.prerelease=y):this.prerelease=y}break}default:throw new Error(`invalid increment argument: ${g}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Pc=h,Pc}var Hc,dp;function gM(){if(dp)return Hc;dp=1;const t=mM();return Hc=(s,i,f=!1)=>{if(s instanceof t)return s;try{return new t(s,i)}catch(p){if(!f)return null;throw p}},Hc}var xM=gM();const bM=uh(xM);function wM(t){if(!t)return"";const a=t.indexOf("+"),s=a!==-1?t.slice(a+1):"",i=a!==-1?t.slice(0,a):t;if(s&&s!=="moya"){const f=s.split("."),p=f[f.length-1];if(p&&/^[0-9a-f]{7,40}$/.test(p))return`https://github.com/TryGhost/Ghost/commit/${p}`}try{const p=bM(i,{includePrerelease:!0})?.prerelease;if(p&&p.length>0){const h=String(p[0]).split("-")[1];return h?.startsWith("g")?`https://github.com/TryGhost/Ghost/commit/${h.slice(1)}`:""}}catch{return""}return`https://github.com/TryGhost/Ghost/releases/tag/v${i}`}function vM(t,a){const s=!!t.match?.(/production/i);return!!(s&&a!=="mysql8"||!s&&a==="mysql5")}function yM({label:t,version:a}){const s=wM(a);return n.jsxs("div",{children:[n.jsxs("strong",{children:[t,":"]})," ",s?n.jsx("a",{className:"text-green",href:s,rel:"noopener noreferrer",target:"_blank",children:a}):a]})}const _M=ge.create(({})=>{const{updateRoute:t}=He();let s=Ue().config;const i=ry();function f(){return new Date().getFullYear()}function p(){return!!s.enableDeveloperExperiments}function x(){return!s.hostSettings?.siteId}return n.jsx(ct,{afterClose:()=>{t("")},cancelLabel:"",footer:n.jsx(n.Fragment,{}),topRightContent:"close",width:540,children:n.jsxs("div",{className:"flex flex-col gap-4 pb-7 text-sm",children:[n.jsx(sy,{className:"h-auto w-[120px] dark:invert"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[i?.message&&n.jsxs("div",{className:"gh-prose-links mb-4 rounded-sm border border-green p-5",children:[n.jsx("strong",{children:"Update available!"}),n.jsx("div",{dangerouslySetInnerHTML:{__html:i.message}})]}),n.jsx(yM,{label:"Version",version:s.version}),x()&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("strong",{children:"Environment:"})," ",s.environment]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Database:"})," ",s.database]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Mail:"})," ",s.mail?s.mail:"Native"]})]}),p()&&n.jsxs("div",{children:[n.jsx("strong",{children:"Developer experiments:"})," Enabled"]}),x()&&vM(s.environment,s.database)&&n.jsxs("div",{className:"text-red-500 dark:text-red-400",children:["You are running an unsupported database in production. Please ",n.jsx("a",{href:"https://ghost.org/docs/faq/supported-databases/",rel:"noopener noreferrer",target:"_blank",children:"upgrade to MySQL 8"}),"."]})]}),n.jsx($s,{}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://ghost.org/docs/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"book-open",size:"sm"})," User documentation"]}),n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://forum.ghost.org/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"question-circle",size:"sm"})," Get help with Ghost"]}),n.jsxs("a",{className:"flex items-center gap-2 hover:text-grey-900 dark:hover:text-grey-400",href:"https://ghost.org/docs/contributing/",rel:"noopener noreferrer",target:"_blank",children:[n.jsx(qe,{name:"angle-brackets",size:"sm"})," Get involved"]})]}),n.jsx($s,{}),n.jsxs("p",{className:"max-w-[460px] text-xs",children:["Copyright © 2013 – ",f()," Ghost Foundation, released under the ",n.jsx("a",{className:"text-green",href:"https://github.com/TryGhost/Ghost/blob/main/LICENSE",rel:"noopener noreferrer",target:"_blank",children:"MIT license"}),". ",n.jsx("a",{className:"text-green",href:"https://ghost.org/",rel:"noopener noreferrer",target:"_blank",children:"Ghost"})," is a registered trademark of ",n.jsx("a",{className:"text-green",href:"https://ghost.org/trademark/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Foundation Ltd"}),"."]})]})})}),MM=()=>{const t=Lt(),{updateRoute:a}=He(),[s,i]=S.useState(""),[f,p]=S.useState({name:""}),{mutateAsync:x}=ay(),h=Ls(),b=Ze();return S.useEffect(()=>{h?.isLimited("customIntegrations")&&h.errorIfWouldGoOverLimit("customIntegrations").catch(g=>{g instanceof Fs&&(ge.show(zn,{prompt:g.message||"Your current plan doesn't support more custom integrations.",onOk:()=>a({route:"/pro",isExternal:!0})}),t.remove(),a("integrations"))})},[h,t,a]),n.jsx(ct,{afterClose:()=>{a("integrations")},okColor:"black",okLabel:"Add",size:"sm",testId:"add-integration-modal",title:"Add integration",onOk:async()=>{if(!s){p({name:"Name is required"});return}try{const g=await x({name:s});t.remove(),a({route:`integrations/${g.integrations[0].id}`})}catch(g){b(g)}},children:n.jsx("div",{className:"mt-5",children:n.jsx(Ye,{marginBottom:!1,marginTop:!1,children:n.jsx(_e,{autoFocus:!0,error:!!f.name,hint:f.name,maxLength:191,placeholder:"Custom integration",title:"Name",value:s,onChange:g=>i(g.target.value),onInput:()=>{f.name&&p({name:""})}})})})})},kM=ge.create(MM),jM=()=>{const t=Lt(),{updateRoute:a}=He(),s=Ze(),[i,f]=S.useState(!0),[p,x]=S.useState(null),{data:h}=dh({searchParams:{filter:"newsletters.status:active+email_disabled:0",limit:"1",page:"1",include:"newsletters,labels"}}),{mutateAsync:b}=Ty(),{formState:g,updateForm:m,saveState:w,handleSave:v,errors:y,clearError:C}=nn({initialState:{name:"",description:"",optInExistingSubscribers:!0},onSave:async()=>{const T=await b({name:g.name,description:g.description,opt_in_existing:g.optInExistingSubscribers,feedback_enabled:!0});a({route:`newsletters/${T.newsletters[0].id}`})},onSaveError:s,onValidate:()=>{const T={};return g.name||(T.name="A name is required for your newsletter"),T}}),j=Ls();S.useEffect(()=>{if(!j){f(!1);return}j.errorIfWouldGoOverLimit("newsletters").catch(T=>{if(T instanceof Fs)x(T);else throw T}).finally(()=>{f(!1)})},[j]);const N=h?.meta?.pagination.total;return S.useEffect(()=>{p&&(ge.show(zn,{prompt:p.message||"Your current plan doesn't support more newsletters.",onOk:()=>a({route:"/pro",isExternal:!0})}),t.remove(),a("newsletters"))},[p,t,a]),i||p?null:n.jsx(ct,{afterClose:()=>{a("newsletters")},backDropClick:!1,okColor:"black",okDisabled:w==="saving",okLabel:"Create",okLoading:w==="saving",size:"sm",testId:"add-newsletter-modal",title:"Create newsletter",onOk:async()=>{await v()&&t.remove()},children:n.jsxs(Ye,{marginBottom:!1,marginTop:!0,children:[n.jsx(_e,{autoFocus:!0,error:!!y.name,hint:y.name,maxLength:191,placeholder:"Weekly roundup",title:"Name",value:g.name,onChange:T=>m(A=>({...A,name:T.target.value})),onKeyDown:()=>C("name")}),n.jsx(or,{maxLength:2e3,title:"Description",value:g.description,onChange:T=>m(A=>({...A,description:T.target.value}))}),n.jsx(Be,{checked:g.optInExistingSubscribers,direction:"rtl",hint:g.optInExistingSubscribers?`This newsletter will be available to all members. Your ${N===void 0?"":Da(N)} existing subscriber${h?.meta?.pagination.total===1?"":"s"} will also be opted-in to receive it.`:"The newsletter will be available to all new members. Existing members won’t be subscribed, but may visit their account area to opt-in to future emails.",label:"Opt-in existing subscribers",labelStyle:"heading",onChange:T=>m(A=>({...A,optInExistingSubscribers:T.target.checked}))})]})})},NM=ge.create(jM),TM=ge.create(()=>{const t=ge.useModal(),{updateRoute:a}=He(),{data:{integrations:s}={integrations:[]}}=Si(),f=s.find(({slug:p})=>p==="ghost-core-content")?.api_keys?.find(p=>p.type==="content");return n.jsxs(ct,{afterClose:()=>{a("integrations")},cancelLabel:"",footer:n.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[n.jsx(Ie,{color:"outline",href:"https://ghost.org/docs/content-api/",label:n.jsxs("span",{className:"flex items-center gap-1",children:["Open docs ",n.jsx(qe,{name:"arrow-top-right",size:"xs"})]}),rel:"noopener noreferrer",tag:"a",target:"_blank"}),n.jsx(Ie,{color:"black",label:"Close",onClick:()=>{a("integrations"),t.remove()}})]}),testId:"content-api-modal",title:"",stickyFooter:!0,children:[n.jsx(Jr,{detail:"Access your content programmatically",icon:n.jsx(qe,{name:"angle-brackets",size:56}),title:"Content API"}),n.jsxs("div",{className:"mt-7",children:[n.jsx("p",{className:"mb-6 text-sm text-grey-700",children:"This key provides read-only access to your published content. For full read/write access, create a custom integration."}),n.jsx(Ya,{keys:[{label:"Content API key",text:f?.secret},{label:"API URL",text:window.location.origin+Rs().subdir}]})]})]})}),EM=({recommendation:t,animate:a})=>{const s=Lt(),{updateRoute:i,route:f}=He(),{mutateAsync:p}=oy(),x=Ze(),{formState:h,updateForm:b,handleSave:g,saveState:m,errors:w,clearError:v,setErrors:y}=nn({initialState:{...t},onSave:async T=>{await p(T),s.remove(),rt({title:"Recommendation added",type:"success"}),ly("Recommendation Added",{oneClickSubscribe:T.one_click_subscribe}),i("recommendations")},onSaveError:x,onValidate:T=>iy(T)});let C="Add",j=!1;m==="saving"?j=!0:m==="saved"&&(C="Added");let N={label:"Back",icon:"arrow-left",iconColorClass:"text-black dark:text-white",link:!0,size:"sm",onClick:()=>{m!=="saving"&&(s.remove(),ge.show(hm,{pathName:f,animate:!1,recommendation:{...h}}))}};return n.jsx(ct,{afterClose:()=>{i("recommendations")},animate:a??!0,backDropClick:!1,cancelLabel:"Cancel",dirty:!0,leftButtonProps:N,okColor:"black",okLabel:C,okLoading:j,size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",stickyFooter:!0,onCancel:()=>{m!=="saving"&&(s.remove(),i("recommendations"))},onOk:async()=>{if(m!=="saving"){fh();try{await g({force:!0})}catch{rt({type:"error",title:"Something went wrong when adding this recommendation, please try again."})}}},children:n.jsx(cy,{clearError:v,errors:w,formState:h,setErrors:y,showURL:!1,updateForm:b})})},CM=ge.create(EM),fp=t=>_i(t).save||"",IM=function(t,a){try{new URL(a).hostname.includes(".")?delete t.url:t.url="Enter a valid URL"}catch{t.url="Enter a valid URL"}return t},SM=({searchParams:t,recommendation:a,animate:s})=>{const[i,f]=S.useState(!1),p=Lt(),{updateRoute:x}=He(),{mutateAsync:h}=uy(),b=a?"":t?.get("url")??"",{save:g}=b?_i(b):{save:""},m=Ve.useRef(!1),[w,v]=Ve.useState(!!g),{formState:y,updateForm:C,handleSave:j,errors:N,saveState:T,clearError:A}=nn({initialState:a??{title:"",url:g||"",description:"",excerpt:null,featured_image:null,favicon:null,one_click_subscribe:!1},onSave:async()=>{let $;$=new URL(y.url);const L=$.hostname.replace("www.",""),P={...y,url:$.toString()},{recommendations:D=[]}=await h($);if(!D||D.length===0)return;const q=D[0];if(q.id)throw new Mf("A recommendation with this URL already exists.");P.title=q.title??L,P.excerpt=q.excerpt??P.excerpt,P.featured_image=q.featured_image??P.featured_image??null,P.favicon=q.favicon??P.favicon??null,P.one_click_subscribe=q.one_click_subscribe??P.one_click_subscribe??!1,P.description=P.excerpt||null,p.remove(),ge.show(CM,{animate:!1,recommendation:P})},onValidate:()=>{const $={};return IM($,y.url),w&&v(Object.keys($).length===0),$}}),R=Ve.useCallback(async()=>{if(T!=="saving"){fh();try{if(await j({force:!0}))return}catch($){const L=$ instanceof Mf?$.message:"Something went wrong while checking this URL, please try again.";rt({type:"error",title:L})}w&&v(!1)}},[j,T,w,v]);return Ve.useEffect(()=>{w&&!m.current&&(m.current=!0,R())},[w,R]),S.useEffect(()=>{i&&(R(),f(!1))},[y]),w?n.jsx(ct,{afterClose:()=>{x("recommendations")},animate:s??!0,backDropClick:!1,footer:!1,header:!1,size:"sm",children:n.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:n.jsx(Mi,{})})}):n.jsxs(ct,{afterClose:()=>{x("recommendations")},animate:s??!0,backDropClick:!1,okColor:"black",okLabel:"Next",okLoading:T==="saving",size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",onOk:R,children:[n.jsxs("p",{className:"mt-4",children:["You can recommend ",n.jsx("strong",{children:"any site"})," your audience will find valuable, not just those published on Ghost."]}),n.jsx(Ye,{marginBottom:!1,marginTop:!0,children:n.jsx(_e,{autoFocus:!0,error:!!N.url,hint:N.url||n.jsxs(n.Fragment,{children:["Need inspiration? ",n.jsx("a",{className:"text-green",href:"https://www.ghost.org/explore",rel:"noopener noreferrer",target:"_blank",children:"Explore thousands of sites"})," to recommend"]}),maxLength:2e3,placeholder:"https://www.example.com",title:"URL",value:y.url,onBlur:()=>{const $=fp(y.url);C(L=>({...L,url:$}))},onChange:$=>{A?.("url"),C(L=>({...L,url:$.target.value}))},onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),C(L=>({...L,url:fp(y.url)})),f(!0))}})})]})},hm=ge.create(SM);function AM(t,a){let s;return function(...f){const p=()=>{clearTimeout(s),t(...f)};clearTimeout(s),s=setTimeout(p,a)}}const Ou=({generateContent:t,className:a,height:s,width:i,parentClassName:f,testId:p,addDelay:x=!1})=>{const[h,b]=S.useState(0),g=[S.useRef(null),S.useRef(null)],[m,w]=S.useState(0);return S.useEffect(()=>{const v=h===0?1:0,y=g[v].current;if(y){t(y);const C=()=>{x?setTimeout(()=>{b(v)},500):b(v)};return y.addEventListener("load",C),()=>{y.removeEventListener("load",C)}}},[t]),S.useEffect(()=>{const v=g[h].current,y=AM(()=>{w(v?.contentWindow?.scrollY||0)},250);return v?.contentWindow?.addEventListener("scroll",y),()=>{v?.contentWindow?.removeEventListener("scroll",y)}},[h,g]),S.useEffect(()=>{const v=g[h].current;if(v)try{v.contentWindow?.scrollTo(0,m)}catch(y){yv(y)}},[m,h,g]),n.jsxs("div",{className:f,"data-testid":p,children:[n.jsx("iframe",{ref:g[0],className:`${a} ${h!==0?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===0,frameBorder:"0",height:s,title:"Buffered Preview 1",width:i}),n.jsx("iframe",{ref:g[1],className:`${a} ${h!==1?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===1,frameBorder:"0",height:s,title:"Buffered Preview 2",width:i})]})},DM=(t,a,s)=>{const i=new URLSearchParams;return i.append("announcement_bg",t||"accent"),i.append("announcement",a||""),s&&s.length>0&&i.append("announcement_vis",s?.join(",")||""),i.toString()},$M=({announcementBackgroundColor:t,announcementContent:a,url:s,visibility:i})=>{const f=S.useMemo(()=>i,[i?.join(",")]),p=S.useCallback(x=>{s&&fetch(s,{method:"POST",headers:{"Content-Type":"text/html;charset=utf-8","x-ghost-preview":DM(t,a,f),Accept:"text/plain"},mode:"cors",credentials:"include"}).then(h=>h.text()).then(h=>{const b="html { pointer-events: none; }",m=new DOMParser().parseFromString(h,"text/html"),w=m.querySelector("style"),v=w.innerHTML;w.innerHTML=`${v}
|
|
2
2
|
|
|
3
3
|
${b}`;let C=(m.doctype?new XMLSerializer().serializeToString(m.doctype):"")+m.documentElement.outerHTML;x.contentDocument?.open(),x.contentDocument?.write(C),x.contentDocument?.close()}).catch(()=>{})},[t,a,s,f]);return n.jsx(Ou,{addDelay:!0,className:"absolute size-[110%] origin-top-left scale-[.90909] bg-white max-[1600px]:size-[130%] max-[1600px]:scale-[.76923]",generateContent:p,height:"100%",parentClassName:"relative h-full w-full",testId:"announcement-bar-preview-iframe",width:"100%"})},OM=({announcementContent:t,announcementTextHandler:a,accentColor:s,announcementBackgroundColor:i,toggleColorSwatch:f,toggleVisibility:p,visibility:x=[],paidMembersEnabled:h,onBlur:b})=>{const g=[{label:"Public visitors",onChange:m=>{p("visitors",m)},value:"visitors",checked:x.includes("visitors")},{label:"Free members",onChange:m=>{p("free_members",m)},value:"free_members",checked:x.includes("free_members")},...h?[{label:"Paid members",onChange:m=>{p("paid_members",m)},value:"paid_members",checked:x.includes("paid_members")}]:[]];return n.jsxs(Ye,{children:[n.jsx(Cu,{nodes:"MINIMAL_NODES",placeholder:"Highlight breaking news, offers or updates",title:"Announcement",value:t,onBlur:b,onChange:a}),n.jsx(Oh,{isExpanded:!1,picker:!1,swatches:[{hex:"#08090c",title:"Dark",value:"dark"},{hex:"#ffffff",title:"Light",value:"light"},{hex:s||"#ffdd00",title:"Accent",value:"accent"}],swatchSize:"lg",title:"Background color",value:i,onSwatchChange:m=>{m!==null&&f(m)},onTogglePicker:()=>{}}),n.jsx(au,{checkboxes:g,title:"Visibility"})]})},RM=()=>{const{siteData:t}=Ue(),{localSettings:a,updateSetting:s,handleSave:i,okProps:f}=Xr({savingDelay:500}),[p]=ot(a,["announcement_content"]),[x]=ot(a,["accent_color"]),[h]=ot(a,["announcement_background"]),[b]=ot(a,["announcement_visibility"]),[g]=ot(a,["paid_members_enabled"]),m=JSON.parse(b?.toString()||"[]"),{updateRoute:w}=He(),[v,y]=S.useState("homepage"),C=D=>{s("announcement_background",D)},j=(D,q)=>{const Y=m.indexOf(D);Y===-1&&q?m.push(D):m.splice(Y,1),s("announcement_visibility",JSON.stringify(m))},N=S.useRef(Ci(D=>{s("announcement_content",D)},500)),T=n.jsx(OM,{accentColor:x,announcementBackgroundColor:h,announcementContent:p,announcementTextHandler:D=>{N.current(D)},paidMembersEnabled:g,toggleColorSwatch:C,toggleVisibility:j,visibility:b,onBlur:()=>{}}),{data:{posts:[A]}={posts:[]}}=Ch({searchParams:{filter:"status:published",order:"published_at DESC",limit:"1",fields:"id,url"}});let R=[];A&&(R=[{id:"homepage",title:"Homepage"},{id:"post",title:"Post"}]);const $=D=>{R.length&&y(D)};let L=Pn(t);switch(v){case"homepage":L=Pn(t);break;case"post":L=A.url;break}const P=n.jsx($M,{announcementBackgroundColor:h,announcementContent:p,url:L,visibility:m});return n.jsx(Zr,{afterClose:()=>{w("announcement-bar")},buttonsDisabled:f.disabled,cancelLabel:"Close",deviceSelector:!0,dirty:!1,okColor:f.color,okLabel:f.label||"Save",preview:P,previewBgColor:"greygradient",previewToolbarTabs:R,selectedURL:v,sidebar:T,testId:"announcement-bar-modal",title:"Announcement",titleHeadingLevel:5,onOk:async()=>{await i({fakeWhenUnchanged:!0})||rt({type:"error",message:"An error occurred while saving your changes. Please try again."})},onSelectURL:$})},LM=ge.create(RM),hu=[{label:"Global",options:[{value:"site.changed",label:"Site changed (rebuild)"}]},{label:"Posts",options:[{value:"post.added",label:"Post created"},{value:"post.deleted",label:"Post deleted"},{value:"post.edited",label:"Post updated"},{value:"post.published",label:"Post published"},{value:"post.published.edited",label:"Published post updated"},{value:"post.unpublished",label:"Post unpublished"},{value:"post.scheduled",label:"Post scheduled"},{value:"post.unscheduled",label:"Post unscheduled"},{value:"post.tag.attached",label:"Tag added to post"},{value:"post.tag.detached",label:"Tag removed from post"}]},{label:"Pages",options:[{value:"page.added",label:"Page created"},{value:"page.deleted",label:"Page deleted"},{value:"page.edited",label:"Page updated"},{value:"page.published",label:"Page published"},{value:"page.published.edited",label:"Published page updated"},{value:"page.unpublished",label:"Page unpublished"},{value:"page.tag.attached",label:"Tag added to page"},{value:"page.tag.detached",label:"Tag removed from page"}]},{label:"Tags",options:[{value:"tag.added",label:"Tag created"},{value:"tag.edited",label:"Tag updated"},{value:"tag.deleted",label:"Tag deleted"}]},{label:"Members",options:[{value:"member.added",label:"Member added"},{value:"member.edited",label:"Member updated"},{value:"member.deleted",label:"Member deleted"}]}],FM=t=>hu.flatMap(({options:s})=>s).find(s=>s.value===t)?.label,PM=Gr({method:"POST",path:()=>"/webhooks/",body:t=>({webhooks:[t]}),updateQueries:{dataType:Ii,emberUpdateType:"createOrUpdate",update:(t,a)=>a&&{...a,integrations:a.integrations.map(s=>{const i=t.webhooks[0];return i.integration_id===s.id?{...s,webhooks:[...s.webhooks||[],i]}:s})}}}),HM=Gr({method:"PUT",path:t=>`/webhooks/${t.id}/`,body:t=>({webhooks:[t]}),updateQueries:{dataType:Ii,emberUpdateType:"createOrUpdate",update:(t,a)=>a&&{...a,integrations:a.integrations.map(s=>({...s,webhooks:s.webhooks?.map(i=>i.id===t.webhooks[0].id?t.webhooks[0]:i)}))}}}),zM=Gr({method:"DELETE",path:t=>`/webhooks/${t}/`,updateQueries:{dataType:Ii,emberUpdateType:"createOrUpdate",update:(t,a,s)=>({...a,integrations:a.integrations.map(i=>({...i,webhooks:i.webhooks?.filter(f=>f.id!==s)}))})}}),UM=({webhook:t,integrationId:a})=>{const s=Lt(),{mutateAsync:i}=PM(),{mutateAsync:f}=HM(),p=Ze(),{formState:x,updateForm:h,handleSave:b,errors:g,clearError:m}=nn({initialState:t||{},onSave:async()=>{x.id?await f(x):await i({...x,integration_id:a})},onSaveError:p,onValidate:()=>{const w={};return x.name||(w.name="Enter a name"),x.event||(w.event="Select an event"),x.target_url||(w.target_url="Enter a target URL"),x.target_url&&!Un.isURL(x.target_url,{require_tld:!1})&&(w.target_url="Enter a valid URL"),w}});return n.jsx(ct,{okColor:"black",okLabel:t?"Update":"Add",size:"sm",testId:"webhook-modal",title:"Add webhook",formSheet:!0,onOk:async()=>{await b()&&s.remove()},children:n.jsx("div",{className:"mt-5",children:n.jsxs(Ye,{marginBottom:!1,marginTop:!1,children:[n.jsx(_e,{error:!!g.name,hint:g.name,maxLength:191,placeholder:"Custom webhook",title:"Name",value:x.name,onChange:w=>h(v=>({...v,name:w.target.value})),onKeyDown:()=>m("name")}),n.jsx(jt,{error:!!g.event,hint:g.event,options:hu,prompt:"Select an event",selectedOption:hu.flatMap(w=>w.options).find(w=>w.value===x.event),testId:"event-select",title:"Event",hideTitle:!0,onSelect:w=>{h(v=>({...v,event:w?.value})),m("event")}}),n.jsx(_e,{error:!!g.target_url,hint:g.target_url,maxLength:2e3,placeholder:"https://example.com",title:"Target URL",type:"url",value:x.target_url,onChange:w=>h(v=>({...v,target_url:w.target.value})),onKeyDown:()=>m("target_url")}),n.jsx(_e,{maxLength:191,placeholder:"https://example.com",title:"Secret",value:x.secret||void 0,onChange:w=>h(v=>({...v,secret:w.target.value}))})]})})})},pp=ge.create(UM),BM=({integration:t})=>{const{mutateAsync:a}=zM(),s=Ze(),i=f=>{ge.show(xt,{title:"Are you sure?",prompt:"Deleting this webhook may prevent the integration from functioning.",okColor:"red",okLabel:"Delete Webhook",onOk:async p=>{try{await a(f),p?.remove(),rt({message:"Webhook deleted",type:"info"})}catch(x){s(x)}}})};return n.jsxs("div",{children:[n.jsxs(dy,{children:[n.jsxs(If,{bgOnHover:!1,children:[n.jsxs(sp,{children:[t.webhooks?.length||0," ",t.webhooks?.length===1?"webhook":"webhooks"]}),n.jsx(sp,{children:"Last triggered"})]}),t.webhooks?.map(f=>n.jsxs(If,{action:n.jsx(Ie,{color:"red",label:"Delete",link:!0,onClick:p=>{p?.stopPropagation(),i(f.id)}}),bgOnHover:!1,hideActions:!0,onClick:()=>{ge.show(pp,{webhook:f,integrationId:t.id})},children:[n.jsxs(Sf,{className:"w-3/4",children:[n.jsx("div",{className:"text-sm font-semibold",children:f.name}),n.jsxs("div",{className:"grid grid-cols-[max-content_1fr] gap-x-1 text-xs leading-snug",children:[n.jsx("span",{className:"text-grey-600",children:"Event:"}),n.jsx("span",{children:FM(f.event)}),n.jsx("span",{className:"text-grey-600",children:"URL:"}),n.jsx("span",{className:"line-clamp-3 break-all",title:f.target_url,children:f.target_url})]})]}),n.jsx(Sf,{className:"w-1/4 text-sm",children:f.last_triggered_at&&new Date(f.last_triggered_at).toLocaleString("default",{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}))]}),n.jsx("div",{className:"mt-5",children:n.jsx(Ie,{color:"green",icon:"add",iconColorClass:"text-green",label:"Add webhook",size:"sm",link:!0,onClick:()=>{ge.show(pp,{integrationId:t.id})}})})]})},WM=({integration:t})=>{const a=Lt(),{updateRoute:s}=He(),{mutateAsync:i}=fy(),{mutateAsync:f}=$u(),{mutateAsync:p}=Ps(),x=Ze(),{formState:h,updateForm:b,handleSave:g,saveState:m,errors:w,clearError:v,okProps:y}=nn({initialState:t,savingDelay:500,savedDelay:500,onSave:async()=>{await i(h)},onSavedStateReset:()=>{s("integrations")},onSaveError:x,onValidate:()=>{const L={};return h.name||(L.name="Enter integration title"),L}}),C=t.api_keys?.find(L=>L.type==="admin"),j=t.api_keys?.find(L=>L.type==="content"),[N,T]=S.useState(!1),[A,R]=S.useState(!1);S.useEffect(()=>{t.type!=="custom"&&(a.remove(),s("integrations"))},[t.type,a,s]);const $=(L,P)=>{P(!1);const D=L.type==="content"?"Content":"Admin";ge.show(xt,{title:`Regenerate ${D} API Key`,prompt:`You can regenerate ${D} API Key any time, but any scripts or applications using it will need to be updated.`,okLabel:`Regenerate ${D} API Key`,onOk:async q=>{try{await f({integrationId:t.id,apiKeyId:L.id}),P(!0),q?.remove()}catch(Y){x(Y)}}})};return n.jsxs(ct,{afterClose:()=>{s("integrations")},buttonsDisabled:y.disabled,cancelLabel:"Close",dirty:m==="unsaved",okColor:y.color,okLabel:y.label||"Save",size:"md",testId:"custom-integration-modal",title:h.name||"Custom integration",stickyFooter:!0,onOk:async()=>{await g({fakeWhenUnchanged:!0})},children:[n.jsxs("div",{className:"mt-7 flex w-full flex-col gap-7 md:flex-row",children:[n.jsx("div",{children:n.jsx(ar,{height:"100px",id:"custom-integration-icon",imageURL:h.icon_image||void 0,width:"100px",onDelete:()=>b(L=>({...L,icon_image:null})),onUpload:async L=>{try{const P=rr(await p({file:L}));b(D=>({...D,icon_image:P}))}catch(P){const D=P;D.response.status===415&&(D.message="Unsupported file type"),x(D)}},children:"Upload icon"})}),n.jsx("div",{className:"flex grow flex-col",children:n.jsxs(Ye,{children:[n.jsx(_e,{error:!!w.name,hint:w.name,maxLength:191,title:"Title",value:h.name,onChange:L=>b(P=>({...P,name:L.target.value})),onKeyDown:()=>v("name")}),n.jsx(_e,{maxLength:2e3,title:"Description",value:h.description||"",onChange:L=>b(P=>({...P,description:L.target.value}))}),n.jsx(Ya,{keys:[{label:"Content API key",text:j?.secret,hint:A?n.jsx("div",{className:"text-green",children:"Content API Key was successfully regenerated"}):void 0,onRegenerate:()=>j&&$(j,R)},{label:"Admin API key",text:C?.secret,hint:N?n.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:()=>C&&$(C,T)},{label:"API URL",text:window.location.origin+Rs().subdir}]})]})})]}),n.jsx("div",{children:n.jsx(BM,{integration:t})})]})},YM=({params:t})=>{const{data:{integrations:a}={}}=Si(),s=a?.find(({id:i})=>i===t?.id);return s?n.jsx(WM,{integration:s}):null},qM=ge.create(YM),GM=({problem:t})=>{const[a,s]=S.useState(!1),i=()=>{s(!a)};return n.jsx(Nr,{title:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`${t.level==="error"?"before:bg-red":"before:bg-yellow"} relative px-4 text-sm before:absolute before:top-1.5 before:left-0 before:block before:size-2 before:rounded-full before:content-['']`,children:[t?.fatal?n.jsx("strong",{children:"Fatal: "}):n.jsx("strong",{children:t.level==="error"?"Error: ":"Warning: "}),n.jsx("span",{dangerouslySetInnerHTML:{__html:t.rule}}),n.jsx("div",{className:"absolute top-1 -right-4",children:n.jsx(Ie,{color:"green",icon:a?"chevron-down":"chevron-right",iconColorClass:"text-grey-700",size:"sm",link:!0,onClick:()=>i()})})]}),a?n.jsxs("div",{className:"mt-2 px-4 text-[13px]",children:[n.jsx("div",{dangerouslySetInnerHTML:{__html:t.details},className:"mb-4"}),n.jsx(lt,{level:6,children:"Affected files:"}),n.jsx("ul",{className:"mt-1",children:t.failures.map(f=>n.jsxs("li",{children:[n.jsx("code",{children:f.ref}),f.message?`: ${f.message}`:""]}))})]}):null]}),hideActions:!0,separator:!0})},XM=({title:t,prompt:a,fatalErrors:s,onRetry:i})=>{let f=null;return s&&(f=n.jsx("div",{className:"mt-10",children:n.jsx(sr,{title:"Errors",children:s.map(p=>typeof p.details=="object"&&p.details.errors&&p.details.errors.length>0?p.details.errors.map(x=>n.jsx(GM,{problem:x})):typeof p.details=="string"?n.jsx(Nr,{title:p.details}):null)})})),n.jsx(bh,{cancelLabel:"Close",okColor:"black",okLabel:"Retry",prompt:n.jsxs(n.Fragment,{children:[a,f]}),title:t,onOk:i})},mm=ge.create(XM),Ru=()=>{const t=_v(),s=!t.data?.themes[0]?.warnings?.some(f=>f.code==="GS051-CUSTOM-FONTS"),i=S.useCallback(()=>{t.refetch()},[t]);return{supportsCustomFonts:s,refreshActiveThemeData:i}};function KM(t){let a=t.package?.name||t.name;return Mv(t)?a+=" (default)":kv(t)?a+=" (legacy)":t.package?.name!==t.name&&(a=n.jsxs("span",{className:"text-sm md:text-base",children:[a," ",n.jsxs("span",{className:"text-grey-600",children:["(",t.name,")"]})]})),ph(t)&&(a=n.jsxs("span",{className:"text-sm font-bold md:text-base",children:[a," — ",n.jsx("span",{className:"text-green",children:" Active"})]})),a}function ZM(t){return t.package?.version||"1.0"}const VM=({theme:t})=>{const{mutateAsync:a}=wu(),{mutateAsync:s}=jv(),{refreshActiveThemeData:i}=Ru(),f=Ze(),p=async()=>{try{await a(t.name),i(),rt({title:"Theme activated",type:"success",message:n.jsxs("div",{children:[n.jsx("span",{className:"capitalize",children:t.name})," is now your active theme"]})})}catch(w){let v=null;w instanceof Mr&&w.response?.status===422&&w.data?.errors?v=w.data.errors:f(w);let y="Invalid Theme",C=n.jsx(n.Fragment,{children:"This theme is invalid and cannot be activated. Fix the following errors and re-upload the theme"});v&&ge.show(mm,{title:y,prompt:C,fatalErrors:v,onRetry:async j=>{j?.remove(),p()}})}},x=async()=>{const{apiRoot:w}=Rs();Tv(`${w}/themes/${t.name}/download`)},h=async()=>{ge.show(xt,{title:"Are you sure you want to delete this?",prompt:n.jsxs(n.Fragment,{children:["You are about to delete ",n.jsxs("strong",{children:['"',t.name,'".']})," This is permanent! We warned you, k? Maybe download"," ",n.jsx("span",{className:"cursor-pointer text-green-500",onClick:()=>{x()},children:"your theme before continuing"})]}),okLabel:"Delete",okRunningLabel:"Deleting",okColor:"red",onOk:async w=>{try{await s(t.name),w?.remove()}catch(v){f(v)}}})};let b=[];ph(t)||b.push(n.jsx(Ie,{className:"ml-2",color:"green",label:"Activate",link:!0,onClick:p},"activate"));let g=[{id:"download",label:"Download",onClick:x}];Nv(t)&&g.push({id:"delete",label:"Delete",onClick:h});const m={iconColorClass:"text-base",size:"sm"};return n.jsxs("div",{className:"-mr-3 flex items-center gap-4",children:[b,n.jsx(Vh,{items:g,position:"end",triggerButtonProps:m})]})},QM=({themes:t})=>(t.sort((a,s)=>a.active&&!s.active?-1:!a.active&&s.active?1:a.package?.name&&s.package?.name?a.package.name.localeCompare(s.package.name):a.name.localeCompare(s.name)),n.jsx(sr,{pageTitle:"Installed themes",children:t.map(a=>{const s=KM(a),i=ZM(a);return n.jsx(Nr,{action:n.jsx(VM,{theme:a}),detail:i,id:`theme-${a.name}`,separator:!1,testId:"theme-list-item",title:s},a.name)})})),JM=({themes:t})=>n.jsx(Su,{children:n.jsx(QM,{themes:t})}),e8=""+new URL("footer-marketplace-bg-BpIYEF6z.png",import.meta.url).href,t8=3e3,hp=t=>t.variants&&t.variants.length>0,zc=t=>{const a=[{category:t.category,previewUrl:t.previewUrl,image:t.image}];return t.variants&&t.variants.length>0&&a.push(...t.variants),a},n8=({onSelectTheme:t})=>{const a=py(),[s,i]=S.useState(null),[f,p]=S.useState(0),x=h=>{i(h),p(h!==null&&hp(h)&&zc(h).length>1?1:0)};return S.useEffect(()=>{if(s===null)return;const h=setInterval(()=>{p((f+1)%(zc(s).length||0))},t8);return()=>clearInterval(h)},[s,f]),n.jsxs(Su,{heading:"Themes",children:[n.jsx("div",{className:"mt-[6vmin] grid grid-cols-1 gap-[6vmin] sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",children:a.map(h=>{const b=hp(h),g=zc(h),m=s===h;return n.jsxs("button",{className:"flex cursor-pointer flex-col gap-3 text-left",type:"button",onClick:()=>{t?.(h)},children:[n.jsx("div",{className:"relative w-full bg-grey-100 shadow-md transition-all duration-500 hover:scale-[1.05]",onMouseEnter:()=>x(h),onMouseLeave:()=>x(null),children:b?n.jsx(n.Fragment,{children:g.map((w,v)=>n.jsx("img",{alt:`${h.name} Theme - ${w.category}`,className:me("size-full object-contain opacity-0 transition-opacity duration-500",{"opacity-100":v===f&&m||!m&&v===0,relative:v===f,absolute:v!==f,"left-0":v!==f,"top-0":v!==f}),src:w.image},`theme-variant-${w.category.toLowerCase()}`))}):n.jsx("img",{alt:`${h.name} Theme`,className:"size-full object-contain",src:h.image})}),n.jsxs("div",{className:"relative mt-3",children:[n.jsx(lt,{level:4,children:h.name}),b?g.map((w,v)=>n.jsx("span",{className:me("absolute left-0 translate-y-px text-sm text-grey-700 opacity-0",{"opacity-100":v===f&&m||!m&&v===0}),children:w.category})):n.jsx("span",{className:"text-sm text-grey-700",children:h.category})]})]},h.name)})}),n.jsxs("div",{className:"mx-[-8vmin] mt-[8vmin] mb-[-8vmin] bg-black px-[8vmin] py-16 text-center text-lg text-white",style:{background:`#15171a url(${e8}) 100% 100% / 35vw no-repeat`},children:["Find and buy third-party, premium themes from independent developers in the ",n.jsx("a",{className:"inline-block font-semibold text-lime",href:"https://ghost.org/themes/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Marketplace →"})]})]})},mp=({problem:t})=>{const[a,s]=S.useState(!1);return n.jsx(Nr,{title:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`${t.level==="error"?"before:bg-red":"before:bg-yellow"} relative px-4 text-sm before:absolute before:top-1.5 before:left-0 before:block before:size-2 before:rounded-full before:content-['']`,children:[n.jsx("strong",{children:t.level==="error"?"Error: ":"Warning: "}),n.jsx("span",{dangerouslySetInnerHTML:{__html:t.rule}}),n.jsx("div",{className:"absolute top-1 -right-4",children:n.jsx(Ie,{color:"green",icon:a?"chevron-down":"chevron-right",iconColorClass:"text-grey-700",size:"sm",link:!0,onClick:()=>s(!a)})})]}),a?n.jsxs("div",{className:"mt-2 px-4 text-[13px]",children:[n.jsx("div",{dangerouslySetInnerHTML:{__html:t.details},className:"mb-4"}),n.jsx(lt,{level:6,children:"Affected files:"}),n.jsx("ul",{className:"mt-1",children:t.failures.map(i=>n.jsxs("li",{children:[n.jsx("code",{children:i.ref}),i.message?`: ${i.message}`:""]},i.ref))})]}):null]}),hideActions:!0,separator:!0})},r8=({title:t,prompt:a,installedTheme:s,onActivate:i})=>{const{mutateAsync:f}=wu(),{refreshActiveThemeData:p}=Ru(),x=Ze();let h=null;s&&s.errors&&(h=n.jsx("div",{className:"mt-6",children:n.jsx(sr,{hint:n.jsxs(n.Fragment,{children:["Highly recommended to fix, functionality ",n.jsx("strong",{children:"could"})," be restricted"]}),title:"Errors",children:s.errors?.map((m,w)=>n.jsx(mp,{problem:m},w))})}));let b=null;s&&s.warnings&&(b=n.jsx("div",{className:"mt-10",children:n.jsx(sr,{title:"Warnings",children:s.warnings?.map((m,w)=>n.jsx(mp,{problem:m},w))})}));let g=`Activate${s.errors?.length?" with errors":""}`;return s.active&&(g="OK"),n.jsx(bh,{cancelLabel:"Close",okColor:"black",okLabel:g,okRunningLabel:"Activating...",prompt:n.jsxs(n.Fragment,{children:[a,h,b]}),title:t,onOk:async m=>{if(!s.active)try{const v=(await f(s.name)).themes[0];p(),rt({title:"Theme activated",type:"success",message:n.jsxs("div",{children:[n.jsx("span",{className:"capitalize",children:v.name})," is now your active theme."]})})}catch(w){x(w)}i?.(),m?.remove()}})},gm=ge.create(r8),gp=t=>t.variants&&t.variants.length>0,xp=t=>{const a=[{image:t.image,category:t.category,previewUrl:t.previewUrl}];return t.variants&&t.variants.length>0&&a.push(...t.variants),a},bp=t=>t.category.toLowerCase(),s8=({selectedTheme:t,isInstalling:a,installedTheme:s,onBack:i,onInstall:f})=>{const[p,x]=S.useState("desktop"),[h,b]=S.useState(void 0);if(!t)return null;let g=t.previewUrl;const m=xp(t).map(j=>({label:j.category,value:bp(j)}));gp(t)&&(h===void 0&&b(m[0]),g=xp(t).find(j=>bp(j)===h?.value)?.previewUrl||g);let w=`Install ${t.name}`;a?w="Installing...":yi(t)&&!s?.active?w=`Activate ${t.name}`:s&&(w=`Update ${t.name}`);const v=()=>{f?.()},y=n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Au,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:[{label:"Change theme",onClick:i},{label:t.name}],separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:i}),gp(t)?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"hidden md:!visible md:!block",children:"–"}),n.jsx(jt,{border:!1,containerClassName:"text-sm font-bold",controlClasses:{menu:"min-w-max"},fullWidth:!1,options:m,selectedOption:h,clearBg:!0,onSelect:j=>{b(j||void 0)}})]}):null]}),C=n.jsxs("div",{className:"flex justify-end gap-8",children:[n.jsx(Fn,{buttons:[{icon:"laptop",iconColorClass:p==="desktop"?"text-black dark:text-green":"text-grey-500 dark:text-grey-600",link:!0,size:"sm",onClick:()=>{x("desktop")}},{icon:"mobile",iconColorClass:p==="mobile"?"text-black dark:text-green":"text-grey-500 dark:text-grey-600",link:!0,size:"sm",onClick:()=>{x("mobile")}}]}),n.jsx(Ie,{color:"green",disabled:a,label:a?"Installing...":w,onClick:v})]});return n.jsxs("div",{className:"absolute inset-0 z-[100]",children:[n.jsx(um,{containerClassName:"bg-grey-50 dark:bg-black z-[100]",left:y,right:C,sticky:!1}),n.jsx("div",{className:"flex h-[calc(100%-92px)] grow flex-col items-center justify-center bg-grey-50 dark:bg-black",children:p==="desktop"?n.jsx(Dh,{children:n.jsx("iframe",{className:"size-full",src:g,title:"Theme preview"})}):n.jsx($h,{children:n.jsx("iframe",{className:"size-full",src:g,title:"Theme preview"})})})]})},a8=({onUpload:t})=>{const a=Lt();return n.jsx("div",{className:"-mb-6",children:n.jsx(hy,{id:"theme-upload",onUpload:s=>{a.remove(),t(s)},children:n.jsx("div",{className:"cursor-pointer bg-grey-75 p-10 text-center dark:bg-grey-950",children:"Click to select or drag & drop zip file"})})})},o8=({currentTab:t,setCurrentTab:a,themes:s})=>{const i=Lt(),{updateRoute:f}=He(),{mutateAsync:p}=Cv(),{checkThemeLimitError:x,isThemeLimited:h}=yu(),b=Ze(),[g,m]=S.useState(),[w,v]=S.useState(!1);S.useEffect(()=>{(async()=>{if(h){const $=await x(".");m({enabled:!1,error:$||"Your current plan doesn't support uploading custom themes."})}else m({enabled:!0})})()},[x,h]);const y=()=>{i.remove(),f("/")},C=async R=>{const $=R?.name.replace(/\.zip$/,""),L=s.map(P=>P.name);yi({name:$})?ge.show(xt,{title:"Upload failed",cancelLabel:"Cancel",okLabel:"",prompt:n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:["The default ",n.jsx("strong",{children:$})," theme cannot be overwritten."]}),n.jsx("p",{children:"Rename your zip file and try again."})]}),onOk:async P=>{P?.remove()}}):L.includes($)?ge.show(xt,{title:"Overwrite theme",prompt:n.jsxs(n.Fragment,{children:["The theme ",n.jsx("strong",{children:$})," already exists. Do you want to overwrite it?"]}),okLabel:"Overwrite",cancelLabel:"Cancel",okRunningLabel:"Overwriting...",okColor:"red",onOk:async P=>{v(!0);const D=L.indexOf($);s.splice(D,1),await j({file:R,onActivate:y}),v(!1),a("installed"),P?.remove()}}):(a("installed"),j({file:R,onActivate:y}))},j=async({file:R,onActivate:$})=>{let L,P=null;try{v(!0),L=await p({file:R}),v(!1)}catch(z){v(!1),z instanceof Mr&&z.response?.status===422&&z.data?.errors?P=z.data.errors:b(z)}if(P&&!L){let z="Invalid Theme",G=n.jsx(n.Fragment,{children:"This theme is invalid and cannot be activated. Fix the following errors and re-upload the theme"});ge.show(mm,{title:z,prompt:G,fatalErrors:P,onRetry:async()=>{i?.remove(),T()}})}if(!L)return;const D=L.themes[0];let q="Upload successful",Y=n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:D.name})," uploaded"]});if(D.active||(Y=n.jsxs(n.Fragment,{children:[Y," ","Do you want to activate it now?"]})),D?.errors?.length||D.warnings?.length){const z=D?.errors?.length;q=`Upload successful with ${z?"errors":"warnings"}`,Y=n.jsxs(n.Fragment,{children:["The theme ",n.jsxs("strong",{children:['"',D.name,'"']})," was installed but we detected some ",z?"errors":"warnings","."]}),D.active||(Y=n.jsxs(n.Fragment,{children:[Y,"You are still able to activate and use the theme but it is recommended to fix these ",z?"errors":"warnings"," before you do so."]}))}ge.show(gm,{title:q,prompt:Y,installedTheme:D,onActivate:$})},N=n.jsx("div",{className:"hidden md:!visible md:!block",children:n.jsx(kr,{border:!1,selectedTab:t,tabs:[{id:"official",title:"Official themes"},{id:"installed",title:"Installed"}],onTabChange:R=>{a(R)}})}),T=()=>{g&&(g.enabled?ge.show(xt,{title:"Upload theme",prompt:n.jsx(a8,{onUpload:C}),okLabel:"",formSheet:!1}):ge.show(zn,{title:"Upgrade to enable custom themes",prompt:g.error||n.jsxs(n.Fragment,{children:["Your current plan only supports official themes. You can install them from the ",n.jsx("a",{href:"https://ghost.org/marketplace/",children:"Ghost theme marketplace"}),"."]}),onOk:()=>f({route:"/pro",isExternal:!0})}))},A=n.jsx("div",{className:"flex items-center gap-14",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Ie,{label:"Close",onClick:()=>{i.remove(),y()}}),n.jsx(Ie,{color:"black",label:"Upload theme",loading:w,onClick:T})]})});return n.jsxs(n.Fragment,{children:[n.jsx(um,{containerClassName:"bg-white dark:bg-black",left:N,right:A}),n.jsx("div",{className:"px-[8vmin] md:hidden",children:n.jsx(kr,{border:!1,selectedTab:t,tabs:[{id:"official",title:"Official themes"},{id:"installed",title:"Installed"}],onTabChange:R=>{a(R)}})})]})},i8=({currentTab:t,onSelectTheme:a,themes:s})=>{switch(t){case"official":return n.jsx(n8,{onSelectTheme:a});case"installed":return n.jsx(JM,{themes:s})}return null},wp=({source:t,themeRef:a})=>{const[s,i]=S.useState("official"),[f,p]=S.useState(null),[x,h]=S.useState("desktop"),[b,g]=S.useState(!1),[m,w]=S.useState(!1),[v,y]=S.useState(!1),{updateRoute:C}=He(),j=Lt(),{data:{themes:N}={}}=vu(),{mutateAsync:T}=Ev(),{mutateAsync:A}=wu(),{checkThemeLimitError:R}=yu(),$=Ze(),L=q=>{p(q)};if(S.useEffect(()=>{y(!0)},[]),S.useEffect(()=>{(async()=>{if(t&&a&&!m&&v){const Y=a.split("/")[1];if(await R(Y)){j.remove();return}let G="Install Theme";const te=N?.map(Ne=>Ne.name)||[];let fe=te.includes(Y.toLowerCase());const Me=te.indexOf(Y.toLowerCase()),K=N?.[Me];let Q=n.jsxs(n.Fragment,{children:["By clicking below, ",n.jsx("strong",{children:Y})," will automatically be activated as the theme for your site.",fe&&n.jsxs(n.Fragment,{children:[n.jsx("br",{}),n.jsx("br",{}),"This will overwrite your existing version of ",n.jsx("strong",{children:Y}),K?.active?" which is your active theme":"",". All custom changes will be lost."]})]});ge.show(xt,{title:G,prompt:Q,okLabel:"Install",cancelLabel:"Cancel",okRunningLabel:"Installing...",okColor:"black",onOk:async Ne=>{let ue;w(!0);try{fe&&N&&N.splice(Me,1),ue=await T(a),ue?.themes[0]&&(await A(ue.themes[0].name),rt({title:"Theme activated",type:"success",message:n.jsxs("div",{children:[n.jsx("span",{className:"capitalize",children:ue.themes[0].name})," is now your active theme"]})})),Ne?.remove(),C("")}catch(we){$(we)}}})}})()},[a,t,T,$,A,C,N,m,R,j,v]),!N)return;let P,D;if(f){P=N.find(Y=>Y.name.toLowerCase()===f.name.toLowerCase()),D=async()=>{const Y=await R(f.name);if(Y){ge.show(zn,{prompt:Y,onOk:()=>C({route:"/pro",isExternal:!0})});return}return P&&!yi(f)?new Promise(z=>{ge.show(xt,{title:"Overwrite theme",prompt:n.jsxs(n.Fragment,{children:["This will overwrite your existing version of ",f.name,P?.active?", which is your active theme":"",". All custom changes will be lost."]}),okLabel:"Overwrite",okRunningLabel:"Installing...",cancelLabel:"Cancel",okColor:"red",onOk:async G=>{G?.remove(),await q(),z()}})}):q()};const q=async()=>{let Y="Success",z=n.jsx(n.Fragment,{});if(yi(f))Y="Activate theme",z=n.jsxs(n.Fragment,{children:["By clicking below, ",n.jsx("strong",{children:f.name})," will automatically be activated as the theme for your site."]});else{g(!0);let G;try{G=await T(f.ref)}catch(fe){$(fe)}finally{g(!1)}if(!G)return;const te=G.themes[0];if(Y="Success",z=n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:te.name})," has been successfully installed."]}),te.active||(z=n.jsxs(n.Fragment,{children:[z," ","Do you want to activate it now?"]})),te.errors?.length||te.warnings?.length){const fe=te.errors?.length;Y=`Installed with ${fe?"errors":"warnings"}`,z=n.jsxs(n.Fragment,{children:["The theme ",n.jsxs("strong",{children:['"',te.name,'"']})," was installed successfully but we detected some ",fe?"errors":"warnings","."]}),te.active||(z=n.jsxs(n.Fragment,{children:[z,"You are still able to activate and use the theme but it is recommended to contact the theme developer fix these ",fe?"errors":"warnings"," before you do so."]}))}P=te}ge.show(gm,{title:Y,prompt:z,installedTheme:P,onActivate:()=>{j.remove(),C("")}})}}return n.jsx(ct,{afterClose:()=>{C("")},animate:!1,cancelLabel:"",footer:!1,padding:!1,size:"full",testId:"theme-modal",title:"",scrolling:!0,onCancel:()=>{j.remove(),C("")},children:n.jsx("div",{className:"flex h-full justify-between",children:n.jsxs("div",{className:"grow",children:[f&&n.jsx(s8,{installedTheme:P,isInstalling:b,selectedTheme:f,onBack:()=>{p(null)},onClose:()=>{C("")},onInstall:D}),n.jsx(o8,{currentTab:s,modal:j,previewMode:x,selectedTheme:f,setCurrentTab:i,setPreviewMode:h,setSelectedTheme:p,themes:N}),!f&&n.jsx(i8,{currentTab:s,themes:N,onSelectTheme:L})]})})})},l8=({children:t,to:a,classNames:s})=>{const i=a||document.body;if(!i)return n.jsx(n.Fragment,{children:t});const f=p=>{p.stopPropagation()};return Iv.createPortal(n.jsx("div",{className:s,onMouseDown:f,children:n.jsx("div",{children:t})}),i)};var c8=class{columnCount;columns=[];columnHeights;constructor(t=3){this.columnCount=t,this.columns=[[]],this.columnHeights=null}reset(){let t=[],a=[];for(let s=0;s<this.columnCount;s+=1)t[s]=[],a[s]=0;this.columns=t,this.columnHeights=a}addColumns(){for(let t=0;t<this.columnCount;t++)this.columns.push([]),this.columnHeights.push(0)}addPhotoToColumns(t){this.columns||this.reset();let a=Math.min(...this.columnHeights),s=this.columnHeights.indexOf(a);this.columnHeights[s]+=300*t.ratio,this.columns[s].push(t)}getColumns(){return this.columns}changeColumnCount(t){t!==this.columnCount&&(this.columnCount=t,this.reset())}},u8={heart:t=>n.jsx("svg",{viewBox:"0 0 32 32",...t,children:n.jsx("path",{d:"M17.4 29c-.8.8-2 .8-2.8 0L2.3 16.2C-.8 13.1-.8 8 2.3 4.8c3.1-3.1 8.2-3.1 11.3 0L16 7.6l2.3-2.8c3.1-3.1 8.2-3.1 11.3 0 3.1 3.1 3.1 8.2 0 11.4L17.4 29z"})}),download:t=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t,children:n.jsx("path",{d:"M20 5.5l-8 8-8-8m-3.5 13h23",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,fill:"none"})})},Uc=({icon:t,label:a,...s})=>{let i=null;return t&&(i=u8[t]),n.jsxs("a",{className:"text-grey-700 flex h-8 shrink-0 cursor-pointer items-center rounded-md bg-white px-3 py-2 font-sans text-sm font-medium leading-6 opacity-90 transition-all ease-in-out hover:opacity-100",onClick:f=>f.stopPropagation(),...s,children:[t&&i&&n.jsx(i,{className:`size-4 ${t==="heart"?"fill-red":""} stroke-[3px] ${a&&"mr-1"}`}),a&&n.jsx("span",{children:a})]})},xm=({payload:t,srcUrl:a,links:s,likes:i,user:f,alt:p,urls:x,height:h,width:b,zoomed:g,insertImage:m,selectImg:w})=>n.jsxs("div",{className:`relative mb-6 block ${g?"h-full w-[max-content] cursor-zoom-out":"w-full cursor-zoom-in"}`,style:{backgroundColor:t.color||"transparent"},"data-kg-unsplash-gallery-item":!0,onClick:v=>{v.stopPropagation(),w(g?null:t)},children:[n.jsx("img",{alt:p,className:`${g?"h-full w-auto object-contain":"block h-auto"}`,height:h,loading:"lazy",src:a,width:b,"data-kg-unsplash-gallery-img":!0}),n.jsxs("div",{className:"absolute inset-0 flex flex-col justify-between bg-gradient-to-b from-black/5 via-black/5 to-black/30 p-5 opacity-0 transition-all ease-in-out hover:opacity-100",children:[n.jsxs("div",{className:"flex items-center justify-end gap-3",children:[n.jsx(Uc,{"data-kg-button":"unsplash-like",href:`${s.html}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit`,icon:"heart",label:i.toString(),rel:"noopener noreferrer",target:"_blank"}),n.jsx(Uc,{"data-kg-button":"unsplash-download",href:`${s.download}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit&force=true`,icon:"download"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("img",{alt:"author",className:"mr-2 size-8 rounded-full",src:f.profile_image.medium}),n.jsx("div",{className:"mr-2 truncate font-sans text-sm font-medium text-white",children:f.name})]}),n.jsx(Uc,{label:"Insert image","data-kg-unsplash-insert-button":!0,onClick:v=>{v.stopPropagation(),m({src:x.regular.replace(/&w=1080/,"&w=2000"),caption:`<span>Photo by <a href="${f.links.html}">${f.name}</a> / <a href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit">Unsplash</a></span>`,height:h,width:b,alt:p,links:s})}})]})]})]}),d8=({payload:t,insertImage:a,selectImg:s,zoomed:i})=>n.jsx("div",{className:"flex h-full grow basis-0 justify-center","data-kg-unsplash-zoomed":!0,onClick:()=>s(null),children:n.jsx(xm,{alt:t.alt_description,height:t.height,insertImage:a,likes:t.likes,links:t.links,payload:t,selectImg:s,srcUrl:t.urls.regular,urls:t.urls,user:t.user,width:t.width,zoomed:i})}),f8=()=>n.jsx("div",{className:"absolute inset-y-0 left-0 flex w-full items-center justify-center overflow-hidden pb-[8vh]","data-kg-loader":!0,children:n.jsx("div",{className:"animate-spin before:bg-grey-800 relative inline-block size-[50px] rounded-full border border-black/10 before:z-10 before:mt-[7px] before:block before:size-[7px] before:rounded-full"})}),p8=t=>n.jsx("div",{className:"mr-6 flex grow basis-0 flex-col justify-start last-of-type:mr-0",children:t.children}),h8=t=>t?.columns?t?.columns.map((a,s)=>n.jsx(p8,{children:a.map(i=>n.jsx(xm,{alt:i.alt_description,height:i.height,insertImage:t?.insertImage,likes:i.likes,links:i.links,payload:i,selectImg:t?.selectImg,srcUrl:i.urls.regular,urls:i.urls,user:i.user,width:i.width,zoomed:t?.zoomed||null},i.id))},a[0]?.id??`empty-${s}`)):null,Bc=t=>n.jsx("div",{className:"relative h-full overflow-hidden","data-kg-unsplash-gallery":!0,children:n.jsxs("div",{ref:t.galleryRef,className:`flex size-full justify-center overflow-auto px-20 ${t?.zoomed?"pb-10":""}`,"data-kg-unsplash-gallery-scrollref":!0,children:[t.children,t?.isLoading&&n.jsx(f8,{})]})}),m8=({zoomed:t,error:a,galleryRef:s,isLoading:i,dataset:f,selectImg:p,insertImage:x})=>t?n.jsx(Bc,{galleryRef:s,zoomed:t,children:n.jsx(d8,{alt:t.alt_description,height:t.height,insertImage:x,likes:t.likes,links:t.links,payload:t,selectImg:p,srcUrl:t.urls.regular,urls:t.urls,user:t.user,width:t.width,zoomed:t})}):a?n.jsx(Bc,{galleryRef:s,zoomed:t,children:n.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[n.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Error"}),n.jsx("p",{className:"text-lg font-medium",children:a})]})}):n.jsx(Bc,{galleryRef:s,isLoading:i,zoomed:t,children:n.jsx(h8,{columns:f,insertImage:x,selectImg:p,zoomed:t})}),g8=t=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",strokeWidth:1.5,viewBox:"0 0 24 24",...t,children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})}),x8=t=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",strokeWidth:1.5,viewBox:"0 0 24 24",...t,children:n.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.472 13.357a9.063 9.063 0 1 0 16.682-7.09 9.063 9.063 0 1 0-16.682 7.09Zm14.749 2.863 7.029 7.03"})}),b8=t=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 122.43 122.41",...t,children:n.jsx("path",{d:"M83.86 54.15v34.13H38.57V54.15H0v68.26h122.43V54.15H83.86zM38.57 0h45.3v34.13h-45.3z"})}),w8=({closeModal:t,handleSearch:a,children:s})=>n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 h-[100vh] bg-black opacity-60"}),n.jsxs("div",{className:"not-kg-prose fixed inset-8 z-50 overflow-hidden rounded bg-white shadow-xl","data-kg-modal":"unsplash",children:[n.jsx("button",{className:"absolute right-6 top-6 cursor-pointer",type:"button",children:n.jsx(g8,{className:"text-grey-400 size-4 stroke-2","data-kg-modal-close-button":!0,onClick:()=>t()})}),n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("header",{className:"flex shrink-0 items-center justify-between px-20 py-10",children:[n.jsxs("h1",{className:"flex items-center gap-2 font-sans text-3xl font-bold text-black",children:[n.jsx(b8,{className:"mb-1"}),"Unsplash"]}),n.jsxs("div",{className:"relative w-full max-w-sm",children:[n.jsx(x8,{className:"text-grey-700 absolute left-4 top-1/2 size-4 -translate-y-2"}),n.jsx("input",{className:"border-grey-300 focus:border-grey-400 h-10 w-full rounded-full border border-solid pl-10 pr-8 font-sans text-md font-normal text-black focus-visible:outline-none",placeholder:"Search free high-resolution photos",autoFocus:!0,"data-kg-unsplash-search":!0,onChange:a})]})]}),s]})]})]}),v8=JSON.parse(`[{"id":"TA5hw14Coh4","slug":"a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4","alternative_slugs":{"en":"a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4"},"created_at":"2024-02-07T22:39:36Z","updated_at":"2024-03-07T23:46:14Z","promoted_at":null,"width":8640,"height":5760,"color":"#8c5940","blur_hash":"LKD]brE2IUr?Lgwci_NaDjR*ofoe","description":"NEOM will be home to one of the world’s largest nature reserves: a 25,000 sq km stretch of wilderness, encompassing two deserts divided by a mountain range. | NEOM, Saudi Arabia","alt_description":"a person standing on a sand dune in the desert","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707345512638-997d31a10eaa"},"links":{"self":"https://api.unsplash.com/photos/a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4","html":"https://unsplash.com/photos/a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4","download":"https://unsplash.com/photos/TA5hw14Coh4/download?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/TA5hw14Coh4/download?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":226,"liked_by_user":false,"current_user_collections":[],"sponsorship":{"impression_urls":[],"tagline":"Made to Change","tagline_url":"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral","sponsor":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},"topic_submissions":{},"user":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},{"id":"UArA9A02Kvk","slug":"a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk","alternative_slugs":{"en":"a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk"},"created_at":"2024-03-05T15:48:31Z","updated_at":"2024-03-11T06:59:25Z","promoted_at":"2024-03-11T06:59:25Z","width":2160,"height":2700,"color":"#262626","blur_hash":"L78;S$~p00oLD%D%IVay9F9ZIUay","description":null,"alt_description":"a black and white photo of a man with his head in his hands","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709653688483-fc2b356c1f36"},"links":{"self":"https://api.unsplash.com/photos/a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk","html":"https://unsplash.com/photos/a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk","download":"https://unsplash.com/photos/UArA9A02Kvk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/UArA9A02Kvk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":20,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"gwWL9kMcm2g","updated_at":"2024-03-11T10:14:07Z","username":"nickandreka","name":"Nick Andréka","first_name":"Nick","last_name":"Andréka","twitter_username":null,"portfolio_url":null,"bio":null,"location":null,"links":{"self":"https://api.unsplash.com/users/nickandreka","html":"https://unsplash.com/@nickandreka","photos":"https://api.unsplash.com/users/nickandreka/photos","likes":"https://api.unsplash.com/users/nickandreka/likes","portfolio":"https://api.unsplash.com/users/nickandreka/portfolio","following":"https://api.unsplash.com/users/nickandreka/following","followers":"https://api.unsplash.com/users/nickandreka/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"andreka.art","total_collections":0,"total_likes":8,"total_photos":35,"total_promoted_photos":19,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"andreka.art","portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"QX_7m4Lh2qg","slug":"a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg","alternative_slugs":{"en":"a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg"},"created_at":"2024-03-10T16:46:33Z","updated_at":"2024-03-11T06:59:11Z","promoted_at":"2024-03-11T06:59:11Z","width":4000,"height":5751,"color":"#f3f3f3","blur_hash":"LAQJiu~X-;9G-:?cIURj~qD%00xt","description":null,"alt_description":"a black and white photo of a lighthouse","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710088912041-34d1767d376a?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710088912041-34d1767d376a"},"links":{"self":"https://api.unsplash.com/photos/a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg","html":"https://unsplash.com/photos/a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg","download":"https://unsplash.com/photos/QX_7m4Lh2qg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/QX_7m4Lh2qg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":21,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"ue6QWAAHoIQ","updated_at":"2024-03-11T08:53:54Z","username":"huzhewseh","name":"Volodymyr M","first_name":"Volodymyr","last_name":"M","twitter_username":"huzhewseh","portfolio_url":null,"bio":null,"location":null,"links":{"self":"https://api.unsplash.com/users/huzhewseh","html":"https://unsplash.com/@huzhewseh","photos":"https://api.unsplash.com/users/huzhewseh/photos","likes":"https://api.unsplash.com/users/huzhewseh/likes","portfolio":"https://api.unsplash.com/users/huzhewseh/portfolio","following":"https://api.unsplash.com/users/huzhewseh/following","followers":"https://api.unsplash.com/users/huzhewseh/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"huzhewseh","total_collections":0,"total_likes":0,"total_photos":18,"total_promoted_photos":3,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"huzhewseh","portfolio_url":null,"twitter_username":"huzhewseh","paypal_email":null}}},{"id":"fMNP7XVcct0","slug":"a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0","alternative_slugs":{"en":"a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0"},"created_at":"2024-03-09T08:40:07Z","updated_at":"2024-03-11T06:58:58Z","promoted_at":"2024-03-11T06:58:58Z","width":3264,"height":4928,"color":"#262626","blur_hash":"L35hY|xu00D%-;xuIUD%00j[?bWB","description":null,"alt_description":"a woman standing in a dark room with her eyes closed","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709973540503-77d699279634?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709973540503-77d699279634"},"links":{"self":"https://api.unsplash.com/photos/a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0","html":"https://unsplash.com/photos/a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0","download":"https://unsplash.com/photos/fMNP7XVcct0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/fMNP7XVcct0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":7,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"lSlibqdw_c8","updated_at":"2024-03-11T08:54:13Z","username":"vitaliyshev89","name":"Vitaliy Shevchenko","first_name":"Vitaliy","last_name":"Shevchenko","twitter_username":null,"portfolio_url":null,"bio":null,"location":"Kharkiv, Ukraine","links":{"self":"https://api.unsplash.com/users/vitaliyshev89","html":"https://unsplash.com/@vitaliyshev89","photos":"https://api.unsplash.com/users/vitaliyshev89/photos","likes":"https://api.unsplash.com/users/vitaliyshev89/likes","portfolio":"https://api.unsplash.com/users/vitaliyshev89/portfolio","following":"https://api.unsplash.com/users/vitaliyshev89/following","followers":"https://api.unsplash.com/users/vitaliyshev89/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":null,"total_collections":0,"total_likes":1,"total_photos":205,"total_promoted_photos":29,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":null,"portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"b4kKyX0BQvc","slug":"a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc","alternative_slugs":{"en":"a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc"},"created_at":"2024-03-08T21:58:28Z","updated_at":"2024-03-11T06:57:35Z","promoted_at":"2024-03-11T06:57:27Z","width":6000,"height":4000,"color":"#0c2626","blur_hash":"LSDJS6kD9Zxu~qkDM|xaS%j]xaV@","description":"Stunning metro train station \\"Elbbrücken\\" in Hamburg, Germany during sunset","alt_description":"a train station with a train on the tracks","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709934645859-f1ed8d3a4954"},"links":{"self":"https://api.unsplash.com/photos/a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc","html":"https://unsplash.com/photos/a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc","download":"https://unsplash.com/photos/b4kKyX0BQvc/download?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/b4kKyX0BQvc/download?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":8,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"street-photography":{"status":"approved","approved_on":"2024-03-11T06:57:35Z"}},"user":{"id":"TffftDPlBPk","updated_at":"2024-03-11T06:59:04Z","username":"christianlue","name":"Christian Lue","first_name":"Christian","last_name":"Lue","twitter_username":"chrrischii","portfolio_url":null,"bio":null,"location":"Frankfurt / Berlin","links":{"self":"https://api.unsplash.com/users/christianlue","html":"https://unsplash.com/@christianlue","photos":"https://api.unsplash.com/users/christianlue/photos","likes":"https://api.unsplash.com/users/christianlue/likes","portfolio":"https://api.unsplash.com/users/christianlue/portfolio","following":"https://api.unsplash.com/users/christianlue/following","followers":"https://api.unsplash.com/users/christianlue/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":null,"total_collections":7,"total_likes":15,"total_photos":571,"total_promoted_photos":103,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":null,"portfolio_url":null,"twitter_username":"chrrischii","paypal_email":null}}},{"id":"9633dHhioC8","slug":"a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8","alternative_slugs":{"en":"a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8"},"created_at":"2023-04-28T15:30:26Z","updated_at":"2024-03-10T10:46:58Z","promoted_at":"2023-05-13T12:02:35Z","width":8316,"height":5544,"color":"#734026","blur_hash":"LVHdd89G57-o.9IBsSR-~pD*M{xt","description":"Amongst expansive red sands and spectacular sandstone rock formations, Hisma Desert – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.","alt_description":"a person walking through a canyon in the desert","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682695795255-b236b1f1267d"},"links":{"self":"https://api.unsplash.com/photos/a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8","html":"https://unsplash.com/photos/a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8","download":"https://unsplash.com/photos/9633dHhioC8/download?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/9633dHhioC8/download?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":631,"liked_by_user":false,"current_user_collections":[],"sponsorship":{"impression_urls":["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515595&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515798&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],"tagline":"Made to Change","tagline_url":"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral","sponsor":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},"topic_submissions":{},"user":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},{"id":"4PmYYBFhwFM","slug":"a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM","alternative_slugs":{"en":"a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM"},"created_at":"2024-03-09T18:40:37Z","updated_at":"2024-03-11T06:57:23Z","promoted_at":"2024-03-11T06:57:23Z","width":5248,"height":7872,"color":"#a6a6a6","blur_hash":"LHDA40%MbGxu%L?bt7of_N%gIBRj","description":null,"alt_description":"a close up of a car door with the word budder on it","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710009439657-c0dfdc051a28"},"links":{"self":"https://api.unsplash.com/photos/a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM","html":"https://unsplash.com/photos/a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM","download":"https://unsplash.com/photos/4PmYYBFhwFM/download?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/4PmYYBFhwFM/download?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":5,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"Xz7_QPPM2So","updated_at":"2024-03-11T08:27:09Z","username":"tiago_f_ferreira","name":"Tiago Ferreira","first_name":"Tiago","last_name":"Ferreira","twitter_username":null,"portfolio_url":"https://tiagoferreira765.wixsite.com/photographyandmusic","bio":"Photography - a hobby, a passion.\\r\\nPlanet earth 🌎, a creative space to enjoy.","location":"Lisboa, Portugal","links":{"self":"https://api.unsplash.com/users/tiago_f_ferreira","html":"https://unsplash.com/@tiago_f_ferreira","photos":"https://api.unsplash.com/users/tiago_f_ferreira/photos","likes":"https://api.unsplash.com/users/tiago_f_ferreira/likes","portfolio":"https://api.unsplash.com/users/tiago_f_ferreira/portfolio","following":"https://api.unsplash.com/users/tiago_f_ferreira/following","followers":"https://api.unsplash.com/users/tiago_f_ferreira/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"tiago_f_ferreira","total_collections":1,"total_likes":144,"total_photos":205,"total_promoted_photos":8,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"tiago_f_ferreira","portfolio_url":"https://tiagoferreira765.wixsite.com/photographyandmusic","twitter_username":null,"paypal_email":null}}},{"id":"BUhVFtY-890","slug":"a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890","alternative_slugs":{"en":"a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890"},"created_at":"2024-03-09T10:03:28Z","updated_at":"2024-03-11T06:57:20Z","promoted_at":"2024-03-11T06:57:20Z","width":3511,"height":2231,"color":"#262626","blur_hash":"L24epEWB0eMx$*t8OEV@RPj]baay","description":null,"alt_description":"a close up of a bird with a red head","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709978601970-036e92662b46?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709978601970-036e92662b46"},"links":{"self":"https://api.unsplash.com/photos/a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890","html":"https://unsplash.com/photos/a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890","download":"https://unsplash.com/photos/BUhVFtY-890/download?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/BUhVFtY-890/download?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":8,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"textures-patterns":{"status":"rejected"},"spring":{"status":"rejected"},"earth-hour":{"status":"approved","approved_on":"2024-03-10T12:31:10Z"},"health":{"status":"unevaluated"},"animals":{"status":"unevaluated"},"film":{"status":"unevaluated"},"travel":{"status":"unevaluated"},"nature":{"status":"unevaluated"},"wallpapers":{"status":"unevaluated"}},"user":{"id":"3SCC0WcF-wA","updated_at":"2024-03-11T09:44:02Z","username":"refargotohp","name":"refargotohp","first_name":"refargotohp","last_name":null,"twitter_username":null,"portfolio_url":null,"bio":"Hello 👋🏼 My name is Pavel, and I am a photographer. I enjoy the photo in any of its manifestations. Sequential shooting, street, studio, portraiture - it's all me. Waiting for you on my social networks - @refargotohp","location":null,"links":{"self":"https://api.unsplash.com/users/refargotohp","html":"https://unsplash.com/@refargotohp","photos":"https://api.unsplash.com/users/refargotohp/photos","likes":"https://api.unsplash.com/users/refargotohp/likes","portfolio":"https://api.unsplash.com/users/refargotohp/portfolio","following":"https://api.unsplash.com/users/refargotohp/following","followers":"https://api.unsplash.com/users/refargotohp/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"refargotohp","total_collections":1,"total_likes":86,"total_photos":132,"total_promoted_photos":61,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"refargotohp","portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"99clkpyauJI","slug":"there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI","alternative_slugs":{"en":"there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI"},"created_at":"2024-03-10T00:15:28Z","updated_at":"2024-03-11T06:56:32Z","promoted_at":"2024-03-11T06:56:32Z","width":4299,"height":3448,"color":"#f3f3f3","blur_hash":"LjJuGn?bM{xu~qoKRPM{9FM{t6M_","description":null,"alt_description":"there are bottles of beer on a shelf in front of a window","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710029721414-9e2125e155c3"},"links":{"self":"https://api.unsplash.com/photos/there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI","html":"https://unsplash.com/photos/there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI","download":"https://unsplash.com/photos/99clkpyauJI/download?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA","download_location":"https://api.unsplash.com/photos/99clkpyauJI/download?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA"},"likes":2,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"film":{"status":"approved","approved_on":"2024-03-10T16:39:06Z"}},"user":{"id":"TPCcwPbQzmY","updated_at":"2024-03-11T06:59:01Z","username":"suzm4film","name":"szm 4","first_name":"szm","last_name":"4","twitter_username":null,"portfolio_url":null,"bio":null,"location":"Japan","links":{"self":"https://api.unsplash.com/users/suzm4film","html":"https://unsplash.com/@suzm4film","photos":"https://api.unsplash.com/users/suzm4film/photos","likes":"https://api.unsplash.com/users/suzm4film/likes","portfolio":"https://api.unsplash.com/users/suzm4film/portfolio","following":"https://api.unsplash.com/users/suzm4film/following","followers":"https://api.unsplash.com/users/suzm4film/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":null,"total_collections":0,"total_likes":0,"total_photos":189,"total_promoted_photos":19,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":null,"portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"Lbt-cZyOUM4","slug":"an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4","alternative_slugs":{"en":"an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4"},"created_at":"2024-03-09T16:58:57Z","updated_at":"2024-03-11T06:57:06Z","promoted_at":"2024-03-11T06:55:38Z","width":5783,"height":3848,"color":"#0c2626","blur_hash":"LkG[.y01Ri-:?bM{RjofM{xuRkWB","description":null,"alt_description":"an old fashioned typewriter sitting on a table in front of a window","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710003364549-de37d4ed3413"},"links":{"self":"https://api.unsplash.com/photos/an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4","html":"https://unsplash.com/photos/an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4","download":"https://unsplash.com/photos/Lbt-cZyOUM4/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/Lbt-cZyOUM4/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":3,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"8D4VFtkiIuw","updated_at":"2024-03-11T07:28:57Z","username":"tama66","name":"Peter Herrmann","first_name":"Peter","last_name":"Herrmann","twitter_username":null,"portfolio_url":null,"bio":"Everything... but not boring! Instagram@Tiefstapler66","location":"Leverkusen/Germany","links":{"self":"https://api.unsplash.com/users/tama66","html":"https://unsplash.com/@tama66","photos":"https://api.unsplash.com/users/tama66/photos","likes":"https://api.unsplash.com/users/tama66/likes","portfolio":"https://api.unsplash.com/users/tama66/portfolio","following":"https://api.unsplash.com/users/tama66/following","followers":"https://api.unsplash.com/users/tama66/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"tiefstapler66","total_collections":1,"total_likes":149,"total_photos":363,"total_promoted_photos":152,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"tiefstapler66","portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"D1jr0Mevs-c","slug":"an-aerial-view-of-a-body-of-water-D1jr0Mevs-c","alternative_slugs":{"en":"an-aerial-view-of-a-body-of-water-D1jr0Mevs-c"},"created_at":"2024-02-07T22:34:15Z","updated_at":"2024-03-10T10:54:36Z","promoted_at":null,"width":5280,"height":2970,"color":"#0c2626","blur_hash":"LH9[JL0i+HM{^}Ezw#R.b@n$nhbb","description":"The Islands of NEOM are home to kaleidoscopic-coloured coral reefs and an abundance of diverse marine life | Islands of NEOM – NEOM, Saudi Arabia","alt_description":"an aerial view of a body of water","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707343843982-f8275f3994c5"},"links":{"self":"https://api.unsplash.com/photos/an-aerial-view-of-a-body-of-water-D1jr0Mevs-c","html":"https://unsplash.com/photos/an-aerial-view-of-a-body-of-water-D1jr0Mevs-c","download":"https://unsplash.com/photos/D1jr0Mevs-c/download?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/D1jr0Mevs-c/download?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":308,"liked_by_user":false,"current_user_collections":[],"sponsorship":{"impression_urls":[],"tagline":"Made to Change","tagline_url":"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral","sponsor":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},"topic_submissions":{},"user":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},{"id":"0RBEUjWQBBA","slug":"a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA","alternative_slugs":{"en":"a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA"},"created_at":"2024-03-10T10:15:48Z","updated_at":"2024-03-11T06:55:22Z","promoted_at":"2024-03-11T06:55:22Z","width":4672,"height":7008,"color":"#262626","blur_hash":"LOG8o{t7WBWB~DofR*j@D%NGR%WB","description":null,"alt_description":"a woman standing under a cherry blossom tree","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710065574765-a685385c6d9a"},"links":{"self":"https://api.unsplash.com/photos/a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA","html":"https://unsplash.com/photos/a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA","download":"https://unsplash.com/photos/0RBEUjWQBBA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/0RBEUjWQBBA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":11,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"ePlndXHeIiM","updated_at":"2024-03-11T09:04:03Z","username":"lwdzl","name":"Jack Dong","first_name":"Jack","last_name":"Dong","twitter_username":null,"portfolio_url":"https://www.xiaohongshu.com/user/profile/5f11b998000000000101d8d2?xhsshare=CopyLink&appuid=5f11b998000000000101d8d2&apptime=1696562673","bio":null,"location":null,"links":{"self":"https://api.unsplash.com/users/lwdzl","html":"https://unsplash.com/@lwdzl","photos":"https://api.unsplash.com/users/lwdzl/photos","likes":"https://api.unsplash.com/users/lwdzl/likes","portfolio":"https://api.unsplash.com/users/lwdzl/portfolio","following":"https://api.unsplash.com/users/lwdzl/following","followers":"https://api.unsplash.com/users/lwdzl/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":null,"total_collections":0,"total_likes":101,"total_photos":640,"total_promoted_photos":112,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":null,"portfolio_url":"https://www.xiaohongshu.com/user/profile/5f11b998000000000101d8d2?xhsshare=CopyLink&appuid=5f11b998000000000101d8d2&apptime=1696562673","twitter_username":null,"paypal_email":null}}},{"id":"2IGDvJa2Bd0","slug":"a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0","alternative_slugs":{"en":"a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0"},"created_at":"2024-02-21T14:32:53Z","updated_at":"2024-03-11T06:54:06Z","promoted_at":"2024-03-11T06:54:06Z","width":4672,"height":5840,"color":"#f3f3f3","blur_hash":"L#Gv00ofD%ay~qoeM_ay%NafWVj[","description":null,"alt_description":"a path in the middle of a foggy forest","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708525736169-534ee3e24e99"},"links":{"self":"https://api.unsplash.com/photos/a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0","html":"https://unsplash.com/photos/a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0","download":"https://unsplash.com/photos/2IGDvJa2Bd0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/2IGDvJa2Bd0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":11,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"zL5HAN1fnJw","updated_at":"2024-03-11T06:58:57Z","username":"viklukphotography","name":"Viktor Mischke","first_name":"Viktor","last_name":"Mischke","twitter_username":null,"portfolio_url":"https://www.istockphoto.com/de/portfolio/snoviktor","bio":null,"location":"Schloss Holte-Stukenbrock","links":{"self":"https://api.unsplash.com/users/viklukphotography","html":"https://unsplash.com/@viklukphotography","photos":"https://api.unsplash.com/users/viklukphotography/photos","likes":"https://api.unsplash.com/users/viklukphotography/likes","portfolio":"https://api.unsplash.com/users/viklukphotography/portfolio","following":"https://api.unsplash.com/users/viklukphotography/following","followers":"https://api.unsplash.com/users/viklukphotography/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"viktormischke","total_collections":0,"total_likes":141,"total_photos":38,"total_promoted_photos":8,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"viktormischke","portfolio_url":"https://www.istockphoto.com/de/portfolio/snoviktor","twitter_username":null,"paypal_email":null}}},{"id":"PZfeP0uwBpQ","slug":"a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ","alternative_slugs":{"en":"a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ"},"created_at":"2024-02-24T10:57:49Z","updated_at":"2024-03-11T06:53:56Z","promoted_at":"2024-03-11T06:53:56Z","width":2720,"height":4080,"color":"#404026","blur_hash":"LIB:Tx%K56NGORbYxas:0KRj-poe","description":"A woman wearing a traditional coolie hat kneels in a field of green vegetables, carefully harvesting the crops.","alt_description":"a person with a hat on their head in a field","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708771641703-0df3d179cec3"},"links":{"self":"https://api.unsplash.com/photos/a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ","html":"https://unsplash.com/photos/a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ","download":"https://unsplash.com/photos/PZfeP0uwBpQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/PZfeP0uwBpQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":2,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"people":{"status":"rejected"},"experimental":{"status":"rejected"}},"user":{"id":"mWjiXj5vQuQ","updated_at":"2024-03-11T06:58:57Z","username":"chanwei_snap","name":"Chanwei","first_name":"Chanwei","last_name":null,"twitter_username":null,"portfolio_url":null,"bio":"👋 Just a snap-happy amateur sharing my photos with you!\\r\\n📍Instagram: @chanwei.snap\\r\\n","location":"Taipei, Taiwan","links":{"self":"https://api.unsplash.com/users/chanwei_snap","html":"https://unsplash.com/@chanwei_snap","photos":"https://api.unsplash.com/users/chanwei_snap/photos","likes":"https://api.unsplash.com/users/chanwei_snap/likes","portfolio":"https://api.unsplash.com/users/chanwei_snap/portfolio","following":"https://api.unsplash.com/users/chanwei_snap/following","followers":"https://api.unsplash.com/users/chanwei_snap/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"chanwei.snap","total_collections":15,"total_likes":63,"total_photos":150,"total_promoted_photos":2,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"chanwei.snap","portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"1JwHaWeSK9s","slug":"a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s","alternative_slugs":{"en":"a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s"},"created_at":"2024-03-10T11:33:51Z","updated_at":"2024-03-11T06:57:09Z","promoted_at":"2024-03-11T06:53:39Z","width":3586,"height":3917,"color":"#f3f3d9","blur_hash":"LIQ0T^j=_4%M%MxbM{M{_4jZITbH","description":"Title: Christmas eve Artist: Callowhill, James Publisher: L. Prang & Co. Name on Item: JC Date: [ca. 1861–1897] https://www.digitalcommonwealth.org/search/commonwealth:7w62f880r","alt_description":"a picture of some white flowers on a white background","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710069455079-2059d3cefe91"},"links":{"self":"https://api.unsplash.com/photos/a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s","html":"https://unsplash.com/photos/a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s","download":"https://unsplash.com/photos/1JwHaWeSK9s/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/1JwHaWeSK9s/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":7,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"piFVWeoWxU8","updated_at":"2024-03-11T07:28:12Z","username":"bostonpubliclibrary","name":"Boston Public Library","first_name":"Boston","last_name":"Public Library","twitter_username":null,"portfolio_url":"https://www.bpl.org/","bio":"Considered a pioneer of public library service in the United States, the Boston Public Library is among the three largest collections in the country and is committed to be ‘Free for All’.","location":"Boston, USA","links":{"self":"https://api.unsplash.com/users/bostonpubliclibrary","html":"https://unsplash.com/@bostonpubliclibrary","photos":"https://api.unsplash.com/users/bostonpubliclibrary/photos","likes":"https://api.unsplash.com/users/bostonpubliclibrary/likes","portfolio":"https://api.unsplash.com/users/bostonpubliclibrary/portfolio","following":"https://api.unsplash.com/users/bostonpubliclibrary/following","followers":"https://api.unsplash.com/users/bostonpubliclibrary/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":null,"total_collections":6,"total_likes":0,"total_photos":510,"total_promoted_photos":62,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":null,"portfolio_url":"https://www.bpl.org/","twitter_username":null,"paypal_email":null}}},{"id":"efzvMAIpfWY","slug":"a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY","alternative_slugs":{"en":"a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY"},"created_at":"2023-04-28T12:46:16Z","updated_at":"2024-03-11T09:48:19Z","promoted_at":null,"width":9504,"height":6336,"color":"#c07359","blur_hash":"LELo7xNHxa~Bz:s9S4nO~VbwoLS~","description":"Amongst expansive red sands and spectacular sandstone rock formations, Hisma Desert – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.","alt_description":"a couple of people that are standing in the dirt","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682685797742-42c9987a2c34"},"links":{"self":"https://api.unsplash.com/photos/a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY","html":"https://unsplash.com/photos/a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY","download":"https://unsplash.com/photos/efzvMAIpfWY/download?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/efzvMAIpfWY/download?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":211,"liked_by_user":false,"current_user_collections":[],"sponsorship":{"impression_urls":["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515544&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515747&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],"tagline":"Made to Change","tagline_url":"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral","sponsor":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},"topic_submissions":{},"user":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},{"id":"j39-6Uto9QQ","slug":"a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ","alternative_slugs":{"en":"a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ"},"created_at":"2024-03-09T22:12:40Z","updated_at":"2024-03-11T07:57:13Z","promoted_at":"2024-03-11T06:51:56Z","width":3759,"height":5639,"color":"#26260c","blur_hash":"L79tDG?H4;IURu%MM{RP~oohIoIo","description":null,"alt_description":"a forest filled with lots of tall trees","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710020339360-ce951881b835?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710020339360-ce951881b835"},"links":{"self":"https://api.unsplash.com/photos/a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ","html":"https://unsplash.com/photos/a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ","download":"https://unsplash.com/photos/j39-6Uto9QQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/j39-6Uto9QQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":1,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"MarIhx6ztc0","updated_at":"2024-03-11T06:51:56Z","username":"brice_cooper18","name":"Brice Cooper","first_name":"Brice","last_name":"Cooper","twitter_username":null,"portfolio_url":null,"bio":"Always down for an adventure, capturing those adventures one photo at a time. Never stop exploring!","location":"Florida","links":{"self":"https://api.unsplash.com/users/brice_cooper18","html":"https://unsplash.com/@brice_cooper18","photos":"https://api.unsplash.com/users/brice_cooper18/photos","likes":"https://api.unsplash.com/users/brice_cooper18/likes","portfolio":"https://api.unsplash.com/users/brice_cooper18/portfolio","following":"https://api.unsplash.com/users/brice_cooper18/following","followers":"https://api.unsplash.com/users/brice_cooper18/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"brice_cooper18","total_collections":14,"total_likes":0,"total_photos":1467,"total_promoted_photos":51,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"brice_cooper18","portfolio_url":null,"twitter_username":null,"paypal_email":null}}},{"id":"oTE1p2Awp3I","slug":"a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I","alternative_slugs":{"en":"a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I"},"created_at":"2024-02-27T22:15:01Z","updated_at":"2024-03-11T06:51:52Z","promoted_at":"2024-03-11T06:51:52Z","width":4000,"height":5333,"color":"#c0c0c0","blur_hash":"LLE:C[u5IooJ_N%gE1ax~ps8Vsoe","description":null,"alt_description":"a couple of people standing on top of a cliff next to the ocean","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709071784840-cf3ecc434749"},"links":{"self":"https://api.unsplash.com/photos/a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I","html":"https://unsplash.com/photos/a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I","download":"https://unsplash.com/photos/oTE1p2Awp3I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/oTE1p2Awp3I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":8,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"khtnjqjzcq0","updated_at":"2024-03-11T06:51:53Z","username":"mitchorr","name":"Mitchell Orr","first_name":"Mitchell","last_name":"Orr","twitter_username":null,"portfolio_url":"https://mitchorr.darkroom.tech/","bio":"If you feel you would like to support my work, any donations no matter how small, would be extremely helpful. \\r\\nThanks for looking!","location":"Wirral","links":{"self":"https://api.unsplash.com/users/mitchorr","html":"https://unsplash.com/@mitchorr","photos":"https://api.unsplash.com/users/mitchorr/photos","likes":"https://api.unsplash.com/users/mitchorr/likes","portfolio":"https://api.unsplash.com/users/mitchorr/portfolio","following":"https://api.unsplash.com/users/mitchorr/following","followers":"https://api.unsplash.com/users/mitchorr/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"mitchorr1","total_collections":0,"total_likes":41,"total_photos":358,"total_promoted_photos":118,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"mitchorr1","portfolio_url":"https://mitchorr.darkroom.tech/","twitter_username":null,"paypal_email":null}}},{"id":"ihmo0uRQ3jA","slug":"a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA","alternative_slugs":{"en":"a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA"},"created_at":"2024-02-24T20:00:04Z","updated_at":"2024-03-11T06:51:48Z","promoted_at":"2024-03-11T06:51:48Z","width":4000,"height":6000,"color":"#260c0c","blur_hash":"L78;b;?I4Xx?tcIUD+xt03oy-.M|","description":null,"alt_description":"a bed sitting in a bedroom next to a window","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708804309492-5ef3f3458c33"},"links":{"self":"https://api.unsplash.com/photos/a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA","html":"https://unsplash.com/photos/a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA","download":"https://unsplash.com/photos/ihmo0uRQ3jA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/ihmo0uRQ3jA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":20,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"Og5qBrDjufI","updated_at":"2024-03-11T06:51:49Z","username":"mariailves","name":"Maria Ilves","first_name":"Maria","last_name":"Ilves","twitter_username":null,"portfolio_url":"http://www.mariailves.com","bio":null,"location":"Ambleside","links":{"self":"https://api.unsplash.com/users/mariailves","html":"https://unsplash.com/@mariailves","photos":"https://api.unsplash.com/users/mariailves/photos","likes":"https://api.unsplash.com/users/mariailves/likes","portfolio":"https://api.unsplash.com/users/mariailves/portfolio","following":"https://api.unsplash.com/users/mariailves/following","followers":"https://api.unsplash.com/users/mariailves/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"mariailves_","total_collections":0,"total_likes":0,"total_photos":38,"total_promoted_photos":4,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"mariailves_","portfolio_url":"http://www.mariailves.com","twitter_username":null,"paypal_email":null}}},{"id":"UvQtTVdFi9I","slug":"UvQtTVdFi9I","alternative_slugs":{"en":"UvQtTVdFi9I"},"created_at":"2016-08-12T16:12:25Z","updated_at":"2024-03-11T06:50:27Z","promoted_at":"2024-03-11T06:50:27Z","width":3648,"height":5472,"color":"#8ca673","blur_hash":"LGG9g4IAVax[.Zxus=kB9HtQ%LRj","description":null,"alt_description":null,"breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1471018289981-5d9f06e2bf45"},"links":{"self":"https://api.unsplash.com/photos/UvQtTVdFi9I","html":"https://unsplash.com/photos/UvQtTVdFi9I","download":"https://unsplash.com/photos/UvQtTVdFi9I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/UvQtTVdFi9I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":60,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"dhG1THiRwtA","updated_at":"2024-03-11T06:50:28Z","username":"clarissemeyer","name":"Clarisse Meyer","first_name":"Clarisse","last_name":"Meyer","twitter_username":"claireymeyer","portfolio_url":"https://www.clarisserae.com","bio":"Photo | Video | Design - Southern California & Beyond\\r\\nInstagram: @clarisse.rae","location":"Orange County, CA","links":{"self":"https://api.unsplash.com/users/clarissemeyer","html":"https://unsplash.com/@clarissemeyer","photos":"https://api.unsplash.com/users/clarissemeyer/photos","likes":"https://api.unsplash.com/users/clarissemeyer/likes","portfolio":"https://api.unsplash.com/users/clarissemeyer/portfolio","following":"https://api.unsplash.com/users/clarissemeyer/following","followers":"https://api.unsplash.com/users/clarissemeyer/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"clarisse.rae","total_collections":2,"total_likes":139,"total_photos":99,"total_promoted_photos":58,"accepted_tos":false,"for_hire":false,"social":{"instagram_username":"clarisse.rae","portfolio_url":"https://www.clarisserae.com","twitter_username":"claireymeyer","paypal_email":null}}},{"id":"iswshBYbTBk","slug":"a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk","alternative_slugs":{"en":"a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk"},"created_at":"2024-02-27T19:26:10Z","updated_at":"2024-03-11T06:48:50Z","promoted_at":"2024-03-11T06:48:50Z","width":3940,"height":2634,"color":"#73a673","blur_hash":"LEDn~t%{y:WXDPVtH[jt8{o|VGk9","description":null,"alt_description":"a woman riding an escalator down an escalator","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709061965707-9a89ffb23103"},"links":{"self":"https://api.unsplash.com/photos/a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk","html":"https://unsplash.com/photos/a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk","download":"https://unsplash.com/photos/iswshBYbTBk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/iswshBYbTBk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":4,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"people":{"status":"rejected"}},"user":{"id":"d-2o2yQwtxY","updated_at":"2024-03-11T06:48:59Z","username":"vitalymazur","name":"Vitalii Mazur","first_name":"Vitalii","last_name":"Mazur","twitter_username":"@madebyvitalii","portfolio_url":"https://www.behance.net/vitaliimazur","bio":"Life through photography 🌿 \\r\\nFeel free to support me via PayPal (vitaly.mazur@icloud.com) if you like to use my shots. Also I'm available for a photoshoot in Toronto 📸🇨🇦","location":"Toronto, Canada","links":{"self":"https://api.unsplash.com/users/vitalymazur","html":"https://unsplash.com/@vitalymazur","photos":"https://api.unsplash.com/users/vitalymazur/photos","likes":"https://api.unsplash.com/users/vitalymazur/likes","portfolio":"https://api.unsplash.com/users/vitalymazur/portfolio","following":"https://api.unsplash.com/users/vitalymazur/following","followers":"https://api.unsplash.com/users/vitalymazur/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"vitalymazur ","total_collections":14,"total_likes":773,"total_photos":263,"total_promoted_photos":15,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"vitalymazur ","portfolio_url":"https://www.behance.net/vitaliimazur","twitter_username":"@madebyvitalii","paypal_email":null}}},{"id":"uSNuKKh7wpA","slug":"a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA","alternative_slugs":{"en":"a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA"},"created_at":"2024-03-01T10:58:28Z","updated_at":"2024-03-11T06:48:07Z","promoted_at":"2024-03-11T06:48:07Z","width":9600,"height":5400,"color":"#d9d9d9","blur_hash":"LJLq]_WI_3%eo$xa?cRi~qobITM|","description":"Made in blender 4.0","alt_description":"a picture of a green object with a white background","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709290649154-54c725bd4484?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709290649154-54c725bd4484"},"links":{"self":"https://api.unsplash.com/photos/a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA","html":"https://unsplash.com/photos/a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA","download":"https://unsplash.com/photos/uSNuKKh7wpA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/uSNuKKh7wpA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":42,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"3d-renders":{"status":"approved","approved_on":"2024-03-06T08:20:20Z"},"experimental":{"status":"approved","approved_on":"2024-03-06T07:38:30Z"}},"user":{"id":"5TCQxdaW0wE","updated_at":"2024-03-11T10:04:04Z","username":"theshubhamdhage","name":"Shubham Dhage","first_name":"Shubham","last_name":"Dhage","twitter_username":"theshubhamdhage","portfolio_url":"https://theshubhamdhage.com/","bio":"Creating things is my passion.","location":"Pune, India","links":{"self":"https://api.unsplash.com/users/theshubhamdhage","html":"https://unsplash.com/@theshubhamdhage","photos":"https://api.unsplash.com/users/theshubhamdhage/photos","likes":"https://api.unsplash.com/users/theshubhamdhage/likes","portfolio":"https://api.unsplash.com/users/theshubhamdhage/portfolio","following":"https://api.unsplash.com/users/theshubhamdhage/following","followers":"https://api.unsplash.com/users/theshubhamdhage/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"theshubhamdhage","total_collections":2,"total_likes":296,"total_photos":734,"total_promoted_photos":147,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"theshubhamdhage","portfolio_url":"https://theshubhamdhage.com/","twitter_username":"theshubhamdhage","paypal_email":null}}},{"id":"7lN8MJPnlXs","slug":"a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs","alternative_slugs":{"en":"a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs"},"created_at":"2024-03-06T19:31:23Z","updated_at":"2024-03-11T06:47:23Z","promoted_at":"2024-03-11T06:47:23Z","width":6720,"height":4480,"color":"#26260c","blur_hash":"L05OKD},~lR7TJRj%d^$_0E49Is:","description":null,"alt_description":"a close up of a pine tree with lots of needles","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709753422610-39ed7ddf9e08"},"links":{"self":"https://api.unsplash.com/photos/a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs","html":"https://unsplash.com/photos/a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs","download":"https://unsplash.com/photos/7lN8MJPnlXs/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/7lN8MJPnlXs/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":5,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"textures-patterns":{"status":"approved","approved_on":"2024-03-11T06:47:18Z"}},"user":{"id":"gMFqynHNocY","updated_at":"2024-03-11T06:48:57Z","username":"blakecheekk","name":"Blake Cheek","first_name":"Blake","last_name":"Cheek","twitter_username":"blakecheekk","portfolio_url":"http://blakecheek.com","bio":"Photographer and Videographer. Lover of coffee and Jesus. ","location":"Atlanta, Ga","links":{"self":"https://api.unsplash.com/users/blakecheekk","html":"https://unsplash.com/@blakecheekk","photos":"https://api.unsplash.com/users/blakecheekk/photos","likes":"https://api.unsplash.com/users/blakecheekk/likes","portfolio":"https://api.unsplash.com/users/blakecheekk/portfolio","following":"https://api.unsplash.com/users/blakecheekk/following","followers":"https://api.unsplash.com/users/blakecheekk/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"blakecheekk","total_collections":4,"total_likes":0,"total_photos":423,"total_promoted_photos":165,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"blakecheekk","portfolio_url":"http://blakecheek.com","twitter_username":"blakecheekk","paypal_email":null}}},{"id":"Fw8vp9G6FtE","slug":"the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE","alternative_slugs":{"en":"the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE"},"created_at":"2024-03-10T00:43:31Z","updated_at":"2024-03-11T06:46:50Z","promoted_at":"2024-03-11T06:46:50Z","width":6240,"height":4160,"color":"#262626","blur_hash":"LIINNov{ae}=56I]eToaEmWC^iI;","description":null,"alt_description":"the contents of a backpack laid out on a table","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710031407576-135a680d6e10?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710031407576-135a680d6e10"},"links":{"self":"https://api.unsplash.com/photos/the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE","html":"https://unsplash.com/photos/the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE","download":"https://unsplash.com/photos/Fw8vp9G6FtE/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/Fw8vp9G6FtE/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":4,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"UmKpkFAcSDE","updated_at":"2024-03-11T06:46:50Z","username":"taylorheeryphoto","name":"Taylor Heery","first_name":"Taylor","last_name":"Heery","twitter_username":"tahegri","portfolio_url":"http://www.taylorheery.com","bio":"VENMO: @taylorheeryphoto\\r\\nFujifilm fanatic.","location":"Hendersonville, NC","links":{"self":"https://api.unsplash.com/users/taylorheeryphoto","html":"https://unsplash.com/@taylorheeryphoto","photos":"https://api.unsplash.com/users/taylorheeryphoto/photos","likes":"https://api.unsplash.com/users/taylorheeryphoto/likes","portfolio":"https://api.unsplash.com/users/taylorheeryphoto/portfolio","following":"https://api.unsplash.com/users/taylorheeryphoto/following","followers":"https://api.unsplash.com/users/taylorheeryphoto/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"taylorheeryphoto","total_collections":0,"total_likes":107,"total_photos":520,"total_promoted_photos":209,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"taylorheeryphoto","portfolio_url":"http://www.taylorheery.com","twitter_username":"tahegri","paypal_email":null}}},{"id":"e75CfMG0Sgo","slug":"a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo","alternative_slugs":{"en":"a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo"},"created_at":"2023-04-28T12:46:16Z","updated_at":"2024-03-10T11:50:20Z","promoted_at":null,"width":5429,"height":3619,"color":"#a6c0d9","blur_hash":"LnHLYm%0IAi_?wn$ngj[OtRjs:f6","description":"Nature Reserve – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.","alt_description":"a person with a backpack looking at mountains","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1682685796002-e05458d61f07?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682685796002-e05458d61f07"},"links":{"self":"https://api.unsplash.com/photos/a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo","html":"https://unsplash.com/photos/a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo","download":"https://unsplash.com/photos/e75CfMG0Sgo/download?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/e75CfMG0Sgo/download?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":174,"liked_by_user":false,"current_user_collections":[],"sponsorship":{"impression_urls":["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515577&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515780&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],"tagline":"Made to Change","tagline_url":"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral","sponsor":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},"topic_submissions":{},"user":{"id":"mYizSrdJkkU","updated_at":"2024-03-11T08:54:08Z","username":"neom","name":"NEOM","first_name":"NEOM","last_name":null,"twitter_username":"neom","portfolio_url":"http://www.neom.com","bio":"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.","location":"NEOM, Saudi Arabia","links":{"self":"https://api.unsplash.com/users/neom","html":"https://unsplash.com/@neom","photos":"https://api.unsplash.com/users/neom/photos","likes":"https://api.unsplash.com/users/neom/likes","portfolio":"https://api.unsplash.com/users/neom/portfolio","following":"https://api.unsplash.com/users/neom/following","followers":"https://api.unsplash.com/users/neom/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"discoverneom","total_collections":7,"total_likes":1,"total_photos":222,"total_promoted_photos":72,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"discoverneom","portfolio_url":"http://www.neom.com","twitter_username":"neom","paypal_email":null}}},{"id":"jSjHcyHFOdQ","slug":"a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ","alternative_slugs":{"en":"a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ"},"created_at":"2024-02-08T15:36:25Z","updated_at":"2024-03-11T06:46:46Z","promoted_at":"2024-03-11T06:46:46Z","width":8400,"height":5600,"color":"#0c260c","blur_hash":"L44CLsVuD7pF.Po2R7R*-.oyX5My","description":null,"alt_description":"a picture of a green plant in a dark room","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707406543260-ed14bbd0d086"},"links":{"self":"https://api.unsplash.com/photos/a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ","html":"https://unsplash.com/photos/a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ","download":"https://unsplash.com/photos/jSjHcyHFOdQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/jSjHcyHFOdQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":14,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"ogQykx6hk_c","updated_at":"2024-03-11T06:46:46Z","username":"pawel_czerwinski","name":"Pawel Czerwinski","first_name":"Pawel","last_name":"Czerwinski","twitter_username":"pm_cze","portfolio_url":"http://paypal.me/pmcze","bio":"Questions about how you can use the photos? help.unsplash.com/en/collections/1463188-unsplash-license 👍","location":"Poland","links":{"self":"https://api.unsplash.com/users/pawel_czerwinski","html":"https://unsplash.com/@pawel_czerwinski","photos":"https://api.unsplash.com/users/pawel_czerwinski/photos","likes":"https://api.unsplash.com/users/pawel_czerwinski/likes","portfolio":"https://api.unsplash.com/users/pawel_czerwinski/portfolio","following":"https://api.unsplash.com/users/pawel_czerwinski/following","followers":"https://api.unsplash.com/users/pawel_czerwinski/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"pmcze","total_collections":7,"total_likes":39154,"total_photos":2137,"total_promoted_photos":1760,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"pmcze","portfolio_url":"http://paypal.me/pmcze","twitter_username":"pm_cze","paypal_email":null}}},{"id":"OfGHUYX0CCg","slug":"a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg","alternative_slugs":{"en":"a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg"},"created_at":"2024-03-06T14:06:51Z","updated_at":"2024-03-11T08:56:52Z","promoted_at":"2024-03-11T06:45:54Z","width":8192,"height":5460,"color":"#260c0c","blur_hash":"LUF{kg=cj@fQ}XxFS3azxFfjS2WW","description":null,"alt_description":"a body of water that has some waves on it","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709733167477-25398ca709c0?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709733167477-25398ca709c0"},"links":{"self":"https://api.unsplash.com/photos/a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg","html":"https://unsplash.com/photos/a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg","download":"https://unsplash.com/photos/OfGHUYX0CCg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/OfGHUYX0CCg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":16,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{"earth-hour":{"status":"approved","approved_on":"2024-03-07T09:43:45Z"}},"user":{"id":"uFFemR6e1vs","updated_at":"2024-03-11T06:48:56Z","username":"marcospradobr","name":"Marcos Paulo Prado","first_name":"Marcos Paulo","last_name":"Prado","twitter_username":null,"portfolio_url":"https://www.instagram.com/eusoumarcosprado","bio":"People and commercial photographer based in Rio de Janeiro, Brasil","location":"Rio de Janeiro, Brazil","links":{"self":"https://api.unsplash.com/users/marcospradobr","html":"https://unsplash.com/@marcospradobr","photos":"https://api.unsplash.com/users/marcospradobr/photos","likes":"https://api.unsplash.com/users/marcospradobr/likes","portfolio":"https://api.unsplash.com/users/marcospradobr/portfolio","following":"https://api.unsplash.com/users/marcospradobr/following","followers":"https://api.unsplash.com/users/marcospradobr/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"eusoumarcosprado","total_collections":0,"total_likes":306,"total_photos":413,"total_promoted_photos":139,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"eusoumarcosprado","portfolio_url":"https://www.instagram.com/eusoumarcosprado","twitter_username":null,"paypal_email":null}}},{"id":"VKQpbzeWbrk","slug":"a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk","alternative_slugs":{"en":"a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk"},"created_at":"2024-03-09T21:24:04Z","updated_at":"2024-03-11T06:45:51Z","promoted_at":"2024-03-11T06:45:51Z","width":2592,"height":3872,"color":"#8c2626","blur_hash":"LFI2{Exr0gE}Dlo|=_W-5RE3O=xH","description":null,"alt_description":"a bouquet of orange and white tulips on a red door","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1710018337941-58197591d55a?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710018337941-58197591d55a"},"links":{"self":"https://api.unsplash.com/photos/a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk","html":"https://unsplash.com/photos/a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk","download":"https://unsplash.com/photos/VKQpbzeWbrk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/VKQpbzeWbrk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":3,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"H8-Yyg-eX4A","updated_at":"2024-03-11T06:48:56Z","username":"jaelphotos","name":"Jael Coon","first_name":"Jael","last_name":"Coon","twitter_username":null,"portfolio_url":"https://linktr.ee/jaelcoon","bio":"Coffee drinker, photographer, artist and chef/baker","location":"USA","links":{"self":"https://api.unsplash.com/users/jaelphotos","html":"https://unsplash.com/@jaelphotos","photos":"https://api.unsplash.com/users/jaelphotos/photos","likes":"https://api.unsplash.com/users/jaelphotos/likes","portfolio":"https://api.unsplash.com/users/jaelphotos/portfolio","following":"https://api.unsplash.com/users/jaelphotos/following","followers":"https://api.unsplash.com/users/jaelphotos/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"jaelcoon","total_collections":51,"total_likes":0,"total_photos":230,"total_promoted_photos":3,"accepted_tos":true,"for_hire":false,"social":{"instagram_username":"jaelcoon","portfolio_url":"https://linktr.ee/jaelcoon","twitter_username":null,"paypal_email":null}}},{"id":"W6AqsLH6HOg","slug":"a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg","alternative_slugs":{"en":"a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg"},"created_at":"2024-03-06T06:59:15Z","updated_at":"2024-03-11T06:45:45Z","promoted_at":"2024-03-11T06:45:45Z","width":6000,"height":4000,"color":"#595959","blur_hash":"LYE_]gO?}qOsW--Ux]$%RPoeX9oz","description":null,"alt_description":"a license plate on the back of a car","breadcrumbs":[],"urls":{"raw":"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3","full":"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85","regular":"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080","small":"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400","thumb":"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709708210553-490ba885fcf6"},"links":{"self":"https://api.unsplash.com/photos/a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg","html":"https://unsplash.com/photos/a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg","download":"https://unsplash.com/photos/W6AqsLH6HOg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw","download_location":"https://api.unsplash.com/photos/W6AqsLH6HOg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},"likes":3,"liked_by_user":false,"current_user_collections":[],"sponsorship":null,"topic_submissions":{},"user":{"id":"VNV70zPYNto","updated_at":"2024-03-11T06:48:56Z","username":"venajeborec","name":"Václav Pechar","first_name":"Václav","last_name":"Pechar","twitter_username":null,"portfolio_url":null,"bio":"Photographer from South Bohemia ✌🏻\\r\\nBe free to contact me to book a shoot 🙏🏻","location":"Czech Republic - Písek","links":{"self":"https://api.unsplash.com/users/venajeborec","html":"https://unsplash.com/@venajeborec","photos":"https://api.unsplash.com/users/venajeborec/photos","likes":"https://api.unsplash.com/users/venajeborec/likes","portfolio":"https://api.unsplash.com/users/venajeborec/portfolio","following":"https://api.unsplash.com/users/venajeborec/following","followers":"https://api.unsplash.com/users/venajeborec/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32","medium":"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64","large":"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},"instagram_username":"amazingvena","total_collections":0,"total_likes":7,"total_photos":324,"total_promoted_photos":30,"accepted_tos":true,"for_hire":true,"social":{"instagram_username":"amazingvena","portfolio_url":null,"twitter_username":null,"paypal_email":null}}}]`),y8=class{photos=v8;PAGINATION={};REQUEST_IS_RUNNING=!1;SEARCH_IS_RUNNING=!1;LAST_REQUEST_URL="";ERROR=null;IS_LOADING=!1;currentPage=1;async fetchPhotos(){this.IS_LOADING=!0;let t=(this.currentPage-1)*30,a=this.currentPage*30;return this.currentPage+=1,this.IS_LOADING=!1,this.photos.slice(t,a)}async fetchNextPage(){if(this.REQUEST_IS_RUNNING||this.SEARCH_IS_RUNNING)return null;let t=await this.fetchPhotos();return t.length>0?t:null}async searchPhotos(t){this.SEARCH_IS_RUNNING=!0;let a=this.photos.filter(s=>s.description&&s.description.toLowerCase().includes(t.toLowerCase())||s.alt_description&&s.alt_description.toLowerCase().includes(t.toLowerCase()));return this.SEARCH_IS_RUNNING=!1,a}searchIsRunning(){return this.SEARCH_IS_RUNNING}triggerDownload(t){}},_8=class{_provider;constructor(t){this._provider=t}async fetchPhotos(){return await this._provider.fetchPhotos()}async searchPhotos(t){return await this._provider.searchPhotos(t)}async triggerDownload(t){this._provider.triggerDownload(t)}async fetchNextPage(){return await this._provider.fetchNextPage()||null}searchIsRunning(){return this._provider.searchIsRunning()}},M8=class{API_URL="https://api.unsplash.com";HEADERS;ERROR=null;PAGINATION={};REQUEST_IS_RUNNING=!1;SEARCH_IS_RUNNING=!1;LAST_REQUEST_URL="";IS_LOADING=!1;constructor(t){this.HEADERS=t}async makeRequest(t){if(this.REQUEST_IS_RUNNING)return null;this.LAST_REQUEST_URL=t;let a={method:"GET",headers:this.HEADERS};try{this.REQUEST_IS_RUNNING=!0,this.IS_LOADING=!0;let s=await fetch(t,a),i=await this.checkStatus(s);this.extractPagination(i);let f=await i.json();return"results"in f?f.results:f}catch(s){return this.ERROR=s,null}finally{this.REQUEST_IS_RUNNING=!1,this.IS_LOADING=!1}}extractPagination(t){let a=RegExp('<(.*)>; rel="(.*)"'),s=[],i={};for(let f of t.headers.entries())f[0]==="link"&&s.push(f[1]);return s&&s.toString().split(",").forEach(f=>{if(f){let p=a.exec(f);p&&(i[p[2]]=p[1])}}),this.PAGINATION=i,t}async fetchPhotos(){let t=`${this.API_URL}/photos?per_page=30`;return await this.makeRequest(t)}async fetchNextPage(){if(this.REQUEST_IS_RUNNING||this.SEARCH_IS_RUNNING)return null;if(this.PAGINATION.next){let t=`${this.PAGINATION.next}`,a=await this.makeRequest(t);if(a)return a}return null}async searchPhotos(t){let a=`${this.API_URL}/search/photos?query=${t}&per_page=30`;return await this.makeRequest(a)||[]}async triggerDownload(t){t.links.download_location&&await this.makeRequest(t.links.download_location)}async checkStatus(t){if(t.status>=200&&t.status<300)return t;let a="",s,i=t.headers.get("content-type");if(i==="application/json")s=t.json().then(f=>f.errors[0]);else if(i==="text/xml")s=t.text();else throw Error("Unsupported content type");return s.then(f=>{throw t.status===403&&t.headers.get("x-ratelimit-remaining")==="0"&&(a="Unsplash API rate limit reached, please try again later."),a=a||f||`Error ${t.status}: Uh-oh! Trouble reaching the Unsplash API`,this.ERROR=a,Error(a)})}searchIsRunning(){return this.SEARCH_IS_RUNNING}},k8=class{photoUseCases;masonryService;photos=[];constructor(t,a){this.photoUseCases=t,this.masonryService=a}async loadNew(){let t=await this.photoUseCases.fetchPhotos();this.photos=t,await this.layoutPhotos()}async layoutPhotos(){this.masonryService.reset(),this.photos&&this.photos.forEach(t=>{t.ratio=t.height/t.width,this.masonryService.addPhotoToColumns(t)})}getColumns(){return this.masonryService.getColumns()}async updateSearch(t){let a=await this.photoUseCases.searchPhotos(t);this.photos=a,this.layoutPhotos()}async loadNextPage(){let t=await this.photoUseCases.fetchNextPage()||[];this.photos=[...this.photos,...t],this.layoutPhotos()}clearPhotos(){this.photos=[]}triggerDownload(t){this.photoUseCases.triggerDownload(t)}searchIsRunning(){return this.photoUseCases.searchIsRunning()}},j8=({onClose:t,onImageInsert:a,unsplashProviderConfig:s})=>{let i=S.useMemo(()=>s?new M8(s):new y8,[s]),f=S.useMemo(()=>new _8(i),[i]),p=S.useMemo(()=>new c8(3),[]),x=S.useMemo(()=>new k8(f,p),[f,p]),h=S.useRef(null),[b,g]=S.useState(0),[m,w]=S.useState(0),[v,y]=S.useState(x.searchIsRunning()||!0),C=S.useRef(!1),[j,N]=S.useState(""),[T,A]=S.useState(null),[R,$]=S.useState([]);Ve.useEffect(()=>{h.current&&T===null&&m!==0&&(h.current.scrollTop=m,w(0))},[T,b,m]),Ve.useEffect(()=>{let G=te=>{te.key==="Escape"&&t()};return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[t]),Ve.useEffect(()=>{let G=h.current;if(!T)return G&&G.addEventListener("scroll",()=>{g(G.scrollTop)}),()=>{G&&G.removeEventListener("scroll",()=>{g(G.scrollTop)})}},[h,T]);let L=Ve.useCallback(async()=>{(C.current===!1||j.length===0)&&($([]),x.clearPhotos(),await x.loadNew(),$(x.getColumns()||[]),h.current&&h.current.scrollTop!==0&&(h.current.scrollTop=0),y(!1))},[x,j]),P=async G=>{let te=G.target.value;te.length>2&&(A(null),N(te)),te.length===0&&(N(""),C.current=!1,await L())},D=Ve.useCallback(async()=>{if(j){y(!0),$([]),x.clearPhotos(),await x.updateSearch(j);let G=x.getColumns();G&&$(G),h.current&&h.current.scrollTop!==0&&(h.current.scrollTop=0),y(!1)}},[j,x]);Ve.useEffect(()=>{let G=setTimeout(async()=>{j.length>2?await D():await L()},300);return()=>{C.current=!0,clearTimeout(G)}},[j,D,L]);let q=Ve.useCallback(async()=>{y(!0),await x.loadNextPage(),$(x.getColumns()||[]),y(!1)},[x]);Ve.useEffect(()=>{let G=h.current;if(G){let te=async()=>{T===null&&G.scrollTop+G.clientHeight>=G.scrollHeight-1e3&&await q()};return G.addEventListener("scroll",te),()=>{G.removeEventListener("scroll",te)}}},[h,q,T]);let Y=G=>{G&&(A(G),w(b)),G===null&&(A(null),h.current&&(h.current.scrollTop=m))};async function z(G){G.src&&(x.triggerDownload(G),a(G))}return n.jsx(w8,{closeModal:t,handleSearch:P,children:n.jsx(m8,{dataset:R,error:null,galleryRef:h,insertImage:z,isLoading:v,selectImg:Y,zoomed:T})})};const N8=({unsplashProviderConfig:t,onClose:a,onImageInsert:s})=>n.jsx(l8,{classNames:"admin-x-settings",children:n.jsx(j8,{unsplashProviderConfig:t,onClose:a,onImageInsert:s})}),Ss={heading:[{name:"Cardo",creator:"David Perry"},{name:"Chakra Petch",creator:"Cadson Demak"},{name:"Fira Mono",creator:"Carrois Apostrophe"},{name:"Fira Sans",creator:"Carrois Apostrophe"},{name:"IBM Plex Serif",creator:"Mike Abbink"},{name:"Inter",creator:"Rasmus Andersson"},{name:"JetBrains Mono",creator:"JetBrains"},{name:"Libre Baskerville",creator:"Impallari Type"},{name:"Lora",creator:"Cyreal"},{name:"Manrope",creator:"Mikhail Sharanda"},{name:"Merriweather",creator:"Sorkin Type"},{name:"Noto Sans",creator:"Google"},{name:"Noto Serif",creator:"Google"},{name:"Nunito",creator:"Vernon Adams"},{name:"Old Standard TT",creator:"Alexey Kryukov"},{name:"Poppins",creator:"Indian Type Foundry"},{name:"Roboto",creator:"Christian Robertson"},{name:"Rufina",creator:"Martin Sommaruga"},{name:"Space Grotesk",creator:"Florian Karsten"},{name:"Space Mono",creator:"Colophon Foundry"},{name:"Tenor Sans",creator:"Denis Masharov"}],body:[{name:"Fira Mono",creator:"Carrois Apostrophe"},{name:"Fira Sans",creator:"Carrois Apostrophe"},{name:"IBM Plex Serif",creator:"Mike Abbink"},{name:"Inter",creator:"Rasmus Andersson"},{name:"JetBrains Mono",creator:"JetBrains"},{name:"Lora",creator:"Cyreal"},{name:"Manrope",creator:"Mikhail Sharanda"},{name:"Merriweather",creator:"Sorkin Type"},{name:"Noto Sans",creator:"Google"},{name:"Noto Serif",creator:"Google"},{name:"Nunito",creator:"Vernon Adams"},{name:"Poppins",creator:"Indian Type Foundry"},{name:"Roboto",creator:"Christian Robertson"},{name:"Space Mono",creator:"Colophon Foundry"}]},Cn="Theme default",vp=({children:t,...a})=>n.jsx(vh.SingleValue,{...a,children:n.jsx("div",{className:"group","data-testid":"select-current-option","data-value":a.data.value,children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-md bg-white text-2xl font-bold dark:bg-black",children:"Aa"}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-md",children:t}),n.jsx("span",{className:"font-sans text-xs font-normal text-grey-700 dark:text-grey-600",children:a.data.creator})]})]})})}),yp=({children:t,...a})=>n.jsx(vh.Option,{...a,children:n.jsxs("div",{className:a.isSelected?"relative flex w-full items-center justify-between gap-2":"group","data-testid":"select-option","data-value":a.data.value,children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-md bg-grey-150 text-2xl font-bold group-hover:bg-grey-250 dark:bg-grey-900 dark:group-hover:bg-grey-800",children:"Aa"}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-md",children:t}),n.jsx("span",{className:"font-sans text-xs font-normal text-grey-700 dark:text-grey-600",children:a.data.creator})]})]}),a.isSelected&&n.jsx("span",{children:n.jsx(qe,{name:"check",size:14})})]})}),T8=t=>t.split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),_p=({values:t,updateSetting:a})=>{const{mutateAsync:s}=Ps(),{settings:i}=Ue(),[f]=ot(i,["unsplash"]),[p,x]=S.useState(!1),{unsplashConfig:h}=Sv(),b=Ze(),g=wh(),{data:m}=vu(),w=m?.themes.find(D=>D.active),v=w?`${T8(w.name)} (v${w.package?.version||"1.0"})`:"Loading...",[y,C]=S.useState(Ss.heading.find(D=>D.name===t.headingFont)||{name:Cn,creator:v}),[j,N]=S.useState(Ss.heading.find(D=>D.name===t.bodyFont)||{name:Cn,creator:v}),T=(D,q=!0)=>{let Y="";return D==="Cardo"?Y=me("font-cardo",q&&"font-bold"):D==="Manrope"?Y=me("font-manrope",q&&"font-bold"):D==="Merriweather"?Y=me("font-merriweather",q&&"font-bold"):D==="Nunito"?Y=me("font-nunito",q&&"font-semibold"):D==="Old Standard TT"?Y=me("font-old-standard-tt",q&&"font-bold"):D==="Prata"?Y=me("font-prata",q&&"font-normal"):D==="Roboto"?Y=me("font-roboto",q&&"font-bold"):D==="Rufina"?Y=me("font-rufina",q&&"font-bold"):D==="Tenor Sans"?Y=me("font-tenor-sans",q&&"font-normal"):D==="Chakra Petch"?Y=me("font-chakra-petch",q&&"font-normal"):D==="Fira Mono"?Y=me("font-fira-mono",q&&"font-bold"):D==="Fira Sans"?Y=me("font-fira-sans",q&&"font-bold"):D==="IBM Plex Serif"?Y=me("font-ibm-plex-serif",q&&"font-bold"):D==="Inter"?Y=me("font-inter",q&&"font-bold"):D==="JetBrains Mono"?Y=me("font-jetbrains-mono",q&&"font-bold"):D==="Lora"?Y=me("font-lora",q&&"font-bold"):D==="Noto Sans"?Y=me("font-noto-sans",q&&"font-bold"):D==="Noto Serif"?Y=me("font-noto-serif",q&&"font-bold"):D==="Poppins"?Y=me("font-poppins",q&&"font-bold"):D==="Space Grotesk"?Y=me("font-space-grotesk",q&&"font-bold"):D==="Space Mono"&&(Y=me("font-space-mono",q&&"font-bold")),Y},A=Ss.heading.map(D=>{let q=T(D.name,!0);return{label:D.name,value:D.name,creator:D.creator,className:q}});A.unshift({label:Cn,value:Cn,creator:v,className:"font-sans font-normal"});const R=Ss.body.map(D=>{let q=T(D.name,!1);return{label:D.name,value:D.name,creator:D.creator,className:q}});R.unshift({label:Cn,value:Cn,creator:v,className:"font-sans font-normal"});const $=(D,q)=>D===Cn?"":T(D,q),L={label:y.name,value:y.name,creator:y.creator},P={label:j.name,value:j.name,creator:j.creator};return n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"",children:[n.jsx(Ln,{debounceMs:200,direction:"rtl",testId:"accent-color-picker",title:n.jsx("div",{children:"Accent color"}),value:t.accentColor,onChange:D=>a("accent_color",D)}),n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Publication icon"}),n.jsx(Hn,{className:"mt-0! mr-5 max-w-[160px]",children:"A square, social icon, at least 60x60px"})]}),n.jsx("div",{className:"flex gap-3",children:n.jsx(ar,{deleteButtonClassName:"top-1! right-1!",editButtonClassName:"top-1! right-1!",height:t.icon?"66px":"36px",id:"logo",imageBWCheckedBg:!0,imageURL:t.icon||"",width:t.icon?"66px":"160px",onDelete:()=>a("icon",null),onUpload:async D=>{try{a("icon",rr(await s({file:D})))}catch(q){const Y=q;Y.response.status===415&&(Y.message="Unsupported file type"),b(Y)}},children:"Upload icon"})})]}),n.jsxs("div",{className:`flex items-start justify-between ${t.icon&&"mt-2"}`,children:[n.jsxs("div",{children:[n.jsx("div",{children:"Publication logo"}),n.jsx(Hn,{className:"mt-0! mr-5 max-w-[160px]",children:"Appears usually in the main header of your theme"})]}),n.jsx("div",{children:n.jsx(ar,{deleteButtonClassName:"top-1! right-1!",height:"60px",id:"site-logo",imageBWCheckedBg:!0,imageFit:"contain",imageURL:t.logo||"",width:"160px",onDelete:()=>a("logo",null),onUpload:async D=>{try{a("logo",rr(await s({file:D})))}catch(q){const Y=q;Y.response.status===415&&(Y.message="Unsupported file type"),b(Y)}},children:"Upload logo"})})]}),n.jsxs("div",{className:"mt-2 flex items-start justify-between","data-testid":"publication-cover",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Publication cover"}),n.jsx(Hn,{className:"mt-0! mr-5 max-w-[160px]",children:"Usually as a large banner image on your index pages"})]}),n.jsx(ar,{deleteButtonClassName:"top-1! right-1!",editButtonClassName:"top-1! right-10!",height:"95px",id:"cover",imageURL:t.coverImage||"",openUnsplash:()=>x(!0),pintura:{isEnabled:g.isEnabled,openEditor:async()=>g.openEditor({image:t.coverImage||"",handleSave:async D=>{try{a("cover_image",rr(await s({file:D})))}catch(q){b(q)}}})},unsplashButtonClassName:"bg-transparent! h-6! top-1.5! w-6! right-1.5! z-50",unsplashEnabled:f,width:"160px",onDelete:()=>a("cover_image",null),onUpload:async D=>{try{a("cover_image",rr(await s({file:D})))}catch(q){const Y=q;Y.response.status===415&&(Y.message="Unsupported file type"),b(Y)}},children:"Upload cover"}),p&&h&&f&&n.jsx(N8,{unsplashProviderConfig:h,onClose:()=>{x(!1)},onImageInsert:D=>{D.src&&a("cover_image",D.src),x(!1)}})]})]}),n.jsxs(Ye,{className:"-mt-4",gap:"sm",margins:"lg",title:"Typography",children:[n.jsx(jt,{className:$(L.label,!0),components:{Option:yp,SingleValue:vp},controlClasses:{control:"min-h-16! pl-2!",option:"pl-2!"},hint:"",menuShouldScrollIntoView:!0,options:A,selectedOption:L,testId:"heading-font-select",title:"Heading font",onSelect:D=>{D?.value===Cn?(C({name:Cn,creator:v}),a("heading_font","")):(C({name:D?.value||"",creator:Ss.heading.find(q=>q.name===D?.value)?.creator||""}),a("heading_font",D?.value||""))}}),n.jsx(jt,{className:$(P.label,!1),components:{Option:yp,SingleValue:vp},controlClasses:{control:"min-h-16! pl-2!",option:"pl-2!"},hint:"",maxMenuHeight:200,menuPosition:"fixed",menuShouldScrollIntoView:!0,options:R,selectedOption:P,testId:"body-font-select",title:"Body font",onSelect:D=>{D?.value===Cn?(N({name:Cn,creator:v}),a("body_font","")):(N({name:D?.value||"",creator:Ss.body.find(q=>q.name===D?.value)?.creator||""}),a("body_font",D?.value||""))}})]})]})};var gi={exports:{}},vi={exports:{}},E8=vi.exports,Mp;function C8(){return Mp||(Mp=1,(function(t,a){(function(s,i){t.exports=i()})(E8,(function(){function s(l){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?s=function(c){return typeof c}:s=function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},s(l)}function i(l,c){if(!(l instanceof c))throw new TypeError("Cannot call a class as a function")}function f(l,c){for(var u=0;u<c.length;u++){var _=c[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(l,_.key,_)}}function p(l,c,u){return c&&f(l.prototype,c),l}function x(l,c){return h(l)||b(l,c)||g(l,c)||w()}function h(l){if(Array.isArray(l))return l}function b(l,c){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(l)))){var u=[],_=!0,I=!1,F=void 0;try{for(var W=l[Symbol.iterator](),X;!(_=(X=W.next()).done)&&(u.push(X.value),!(c&&u.length===c));_=!0);}catch(ce){I=!0,F=ce}finally{try{!_&&W.return!=null&&W.return()}finally{if(I)throw F}}return u}}function g(l,c){if(l){if(typeof l=="string")return m(l,c);var u=Object.prototype.toString.call(l).slice(8,-1);if(u==="Object"&&l.constructor&&(u=l.constructor.name),u==="Map"||u==="Set")return Array.from(u);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return m(l,c)}}function m(l,c){(c==null||c>l.length)&&(c=l.length);for(var u=0,_=new Array(c);u<c;u++)_[u]=l[u];return _}function w(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v="null",y="undefined",C="bool",j="boolean",N="number",T="string",A="date",R="regex",$="regexp",L="array",P="object",D="function",q=[v,y,j,N,T,A,$],Y="expression",z="group",G="pipeline",te="projection",fe="query",Me=function(){};Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(c,u){if(this==null)throw new TypeError('"this" is null or not defined');var _=Object(this),I=_.length>>>0;if(I===0)return!1;var F=u|0,W=Math.max(F>=0?F:I-Math.abs(F),0);function X(ce,se){return ce===se||typeof ce=="number"&&typeof se=="number"&&isNaN(ce)&&isNaN(se)}for(;W<I;){if(X(_[W],c))return!0;W++}return!1}});var K=Array.prototype.push;function Q(l,c){l||Wn(c)}function Ne(l){switch(ee(l)){case L:return l.map(Ne);case P:return It(l,Ne);default:return l}}function ue(l){switch(ee(l)){case L:return Pt([],l);case P:return Object.assign({},l);default:return l}}function we(l){return l===null?"Null":l===void 0?"Undefined":l.constructor.name}function ee(l){return we(l).toLowerCase()}function pe(l){return ee(l)===j}function le(l){return ee(l)===T}function de(l){return ee(l)===N}var V=Array.isArray||function(l){return!!l&&l.constructor===Array};function ve(l){return!!l&&l.constructor===Object}function De(l){return l===Object(l)}function Qe(l){return ee(l)===A}function Dt(l){return ee(l)===$}function Gt(l){return ee(l)===D}function ae(l){return l==null}function $e(l){return l===null}function Ft(l){return l===void 0}function Je(l,c){return l.includes(c)}function rn(l,c){return!Je(l,c)}function ht(l){return!!l}function bt(l){return ae(l)||V(l)&&l.length===0||ve(l)&&dt(l).length===0||!l}function Bn(l){return V(l)?l:[l]}function st(l,c){return l.hasOwnProperty(c)}function Wn(l){throw new Error(l)}var dt=Object.keys;function Le(l,c,u){if(c=c.bind(u),V(l))for(var _=0,I=l.length;_<I&&c(l[_],_,l)!==!1;_++);else for(var F in l)if(l.hasOwnProperty(F)&&c(l[F],F,l)===!1)break}function It(l,c,u){c=c.bind(u);for(var _={},I=dt(l),F=0;F<I.length;F++){var W=I[F];_[W]=c(l[W],W)}return _}function pn(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(l===Me)return c;if(c===Me)return l;var _=[l,c];if(!(_.every(ve)||_.every(V)))throw Error("mismatched types. must both be array or object");if(u.flatten=u.flatten||!1,V(l))if(u.flatten){for(var I=0,F=0;I<l.length&&F<c.length;)l[I]=pn(l[I++],c[F++],u);for(;F<c.length;)l.push(c[F++])}else K.apply(l,c);else Object.keys(c).forEach(function(W){l.hasOwnProperty(W)?l[W]=pn(l[W],c[W],u):l[W]=c[W]});return l}function mt(l,c,u){return V(l)?l.reduce(c,u):(Le(l,function(_,I){return u=c(u,_,I,l)}),u)}function Tr(l,c){var u=c.map(hn);return l.filter(function(_){return Je(u,hn(_))})}function Er(l,c){return Pt(Pt([],l),c.filter(rn.bind(null,l)))}function qa(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,u=[];function _(I,F){for(var W=0,X=I.length;W<X;W++)V(I[W])&&(F>0||F<0)?_(I[W],Math.max(-1,F-1)):u.push(I[W])}return _(l,c),u}function Cr(l,c){if(c<1)return l;for(;c--&&V(l)&&l.length===1;)l=l[0];return l}function sn(l,c){for(var u=[l],_=[c];u.length>0;)if(l=u.pop(),c=_.pop(),l!==c){var I=ee(l);if(I!==ee(c)||I===D)return!1;switch(I){case L:if(l.length!==c.length)return!1;Pt(u,l),Pt(_,c);break;case P:var F=dt(l),W=dt(c);if(F.length!==W.length)return!1;F.sort(),W.sort();for(var X=0,ce=F.length;X<ce;X++){var se=F[X];if(se!==W[X])return!1;u.push(l[se]),_.push(c[se])}break;default:if(In(l)!==In(c))return!1}}return u.length===0}function Ir(l){var c={},u=[];return Le(l,function(_){var I=hn(_);st(c,I)||(u.push(_),c[I]=0)}),u}function In(l){var c=ee(l);switch(c){case j:case N:case $:return l.toString();case T:return JSON.stringify(l);case A:return l.toISOString();case v:case y:return c;case L:return"["+l.map(In)+"]";default:var u=c===P?"":"".concat(we(l)),_=dt(l);return _.sort(),"".concat(u,"{")+_.map(function(I){return"".concat(In(I),":").concat(In(l[I]))})+"}"}}function hn(l){if(ae(l))return null;for(var c=0,u=In(l),_=u.length;_;)c=(c<<5)-c^u.charCodeAt(--_);return c>>>0}function Sr(l,c){return l<c?-1:l>c?1:0}function es(l,c,u){var _=[],I=[],F={};if(u=u||Sr,bt(l))return l;for(var W=0;W<l.length;W++){var X=l[W],ce=c(X,W);ae(ce)?I.push(X):(F[ce]?F[ce].push(X):F[ce]=[X],_.push(ce))}_.sort(u);for(var se=0;se<_.length;se++)Pt(I,F[_[se]]);return I}function ts(l,c){var u={keys:[],groups:[]},_={};return Le(l,function(I){var F=c(I),W=hn(F),X=-1;_[W]===void 0&&(X=u.keys.length,_[W]=X,u.keys.push(F),u.groups.push([])),X=_[W],u.groups[X].push(I)}),u}function Pt(l,c){return K.apply(l,c),l}function Us(l,c){for(var u=0,_=l.length-1;u<=_;){var I=Math.round(u+(_-u)/2);if(c<l[I])_=I-1;else if(c>l[I])u=I+1;else return I}return u}function Bs(l){var c=this;return(function(u){return function(){for(var _=arguments.length,I=new Array(_),F=0;F<_;F++)I[F]=arguments[F];var W=hn(I);return st(u,W)||(u[W]=l.apply(c,I)),u[W]}})({})}function Ws(l,c){return De(l)?l[c]:void 0}function an(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_=0;u.meta=u.meta||!1;function I(F,W){for(var X=F,ce=0;ce<W.length;ce++){var se=W[ce],ke=se.match(/^\d+$/)===null;if(ke&&V(X)){if(ce===0&&_>0)break;_+=1,W=W.slice(ce),X=mt(X,function(be,Xe){var Pe=I(Xe,W);return Pe!==void 0&&be.push(Pe),be},[]);break}else X=Ws(X,se);if(X===void 0)break}return X}return l=Je(q,ee(l))?l:I(l,c.split(".")),u.meta?{result:l,depth:_}:l}function Ar(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};u.preserveMissingValues=u.preserveMissingValues||!1;var _=c.split("."),I=_[0],F=_.length===1||_.slice(1).join("."),W=I.match(/^\d+$/)!==null,X=_.length>1,ce,se;try{V(l)?W?(ce=Ws(l,Number(I)),X&&(ce=Ar(ce,F,u)),ce=[ce]):(ce=[],Le(l,function(ke){se=Ar(ke,c,u),u.preserveMissingValues?(se===void 0&&(se=Me),ce.push(se)):se!==void 0&&ce.push(se)})):(se=Ws(l,I),X&&(se=Ar(se,F,u)),Q(se!==void 0),ce={},ce[I]=se)}catch{ce=void 0}return ce}function ns(l){if(V(l))for(var c=l.length-1;c>=0;c--)l[c]===Me?l.splice(c,1):ns(l[c]);else if(ve(l))for(var u in l)l.hasOwnProperty(u)&&ns(l[u]);return l}function rs(l,c,u){var _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,I=c.split("."),F=I[0],W=I.length===1||I.slice(1).join(".");I.length===1?u(l,F):(_===!0&&ae(l[F])&&(l[F]={}),rs(l[F],W,u,_))}function Ys(l,c,u){rs(l,c,function(_,I){_[I]=u},!0)}function qs(l,c){rs(l,c,function(u,_){V(u)&&/^\d+$/.test(_)?u.splice(parseInt(_),1):ve(u)&&delete u[_]})}function Gs(l){return!!l&&l[0]==="$"}function Ga(l){if(Je(q,ee(l)))return Dt(l)?{$regex:l}:{$eq:l};if(De(l)){var c=dt(l);if(!c.some(Gs))return{$eq:l};if(Je(c,"$regex")){var u=l.$regex,_=l.$options||"",I="";le(u)&&(I+=u.ignoreCase||_.indexOf("i")>=0?"i":"",I+=u.multiline||_.indexOf("m")>=0?"m":"",I+=u.global||_.indexOf("g")>=0?"g":"",u=new RegExp(u,I)),l.$regex=u,delete l.$options}}return l}function ss(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return ae(u)?c<0?(c=Math.max(0,l.length+c),u=l.length-c+1):(u=c,c=0):(c<0&&(c=Math.max(0,l.length+c)),Q(u>0,"Invalid argument value for $slice operator. Limit must be a positive number"),u+=c),l.slice(c,u)}function Xa(l,c){var u=mt(l,function(W,X){return W+X},0),_=l.length||1,I=c&&1||0,F=u/_;return Math.sqrt(mt(l,function(W,X){return W+Math.pow(X-F,2)},0)/(_-I))}function Ri(){return{assert:Q,clone:ue,cloneDeep:Ne,each:Le,err:Wn,hashCode:hn,getType:we,has:st,includes:Je.bind(null),isArray:V,isBoolean:pe,isDate:Qe,isEmpty:bt,isEqual:sn,isFunction:Gt,isNil:ae,isNull:$e,isNumber:de,isObject:ve,isRegExp:Dt,isString:le,isUndefined:Ft,keys:dt,reduce:mt,resolve:an,resolveObj:Ar}}var Ka=function(){return Object.assign({computeValue:ie,ops:Xs},Ri())},as={key:"_id"};function Li(l){Object.assign(as,l||{})}var os={$$ROOT:function(c,u,_){return _.root},$$CURRENT:function(c,u,_){return c},$$REMOVE:function(c,u,_){}},Za={$$KEEP:function(c){return c},$$PRUNE:function(){},$$DESCEND:function(c,u,_){if(!st(u,"$cond"))return c;var I;return Le(c,function(F,W){De(F)&&(V(F)?(I=[],Le(F,function(X){ve(X)&&(X=Ks(X,u,_)),ae(X)||I.push(X)})):I=Ks(F,u,_),ae(I)?delete c[W]:c[W]=I)}),c}},Va=dt(os),Qa=dt(Za);function cr(){return as.key}function Xs(){var l=Array.prototype.slice.call(arguments);return mt(l,function(c,u){return Pt(c,dt(ft[u]))},[])}function Dr(l,c,u){if(st(ft[z],c))return ft[z][c](l,u);if(ve(u)){var _={};return Le(u,function(I,F){if(_[F]=Dr(l,F,u[F]),st(ft[z],F))return _=_[F],Q(dt(u).length===1,"Invalid $group expression '"+JSON.stringify(u)+"'"),!1}),_}}function ie(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(_.root=_.root||l,st(ft[Y],u))return ft[Y][u](l,c,_);if(st(ft[z],u))return l=ie(l,c,null,_),Q(V(l),u+" expression must resolve to an array"),ft[z][u](l,null,_);if(le(c)&&c.length>0&&c[0]==="$"){if(Je(Va,c))return os[c](l,null,_);if(Je(Qa,c))return c;var I=Va.filter(function(W){return c.indexOf(W+".")===0});return I.length===1&&(I=I[0],I==="$$ROOT"&&(l=_.root),c=c.substr(I.length)),an(l,c.slice(1))}switch(ee(c)){case L:return c.map(function(W){return ie(l,W)});case P:var F={};return Le(c,function(W,X){if(F[X]=ie(l,W,X,_),[Y,z].some(function(ce){return st(ft[ce],X)}))return Q(dt(c).length===1,"Invalid aggregation expression '"+JSON.stringify(c)+"'"),F=F[X],!1}),F;default:return c}}function Ks(l,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};u.root=u.root||l;var _=ie(l,c,null,u);return Je(Qa,_)?Za[_](l,c,u):_}function Ja(l,c){var u=ie(l,c);return u==null?null:Math.abs(u)}function Fi(l,c){var u=ie(l,c),_=!1,I=mt(u,function(F,W){return Qe(W)&&(Q(!_,"'$add' can only have one date value"),_=!0,W=W.getTime()),F+=W,F},0);return _?new Date(I):I}function Pi(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)||isNaN(u),"$ceil expression must resolve to a number."),Math.ceil(u))}function Hi(l,c){var u=ie(l,c);return u[0]/u[1]}function zi(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)||isNaN(u),"$exp expression must resolve to a number."),Math.exp(u))}function Ui(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)||isNaN(u),"$floor expression must resolve to a number."),Math.floor(u))}function Bi(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)||isNaN(u),"$ln expression must resolve to a number."),Math.log(u))}function is(l,c){var u=ie(l,c),_="$log expression must resolve to array(2) of numbers";return Q(V(u)&&u.length===2,_),u.some(ae)?null:(Q(u.some(isNaN)||u.every(de),_),Math.log10(u[0])/Math.log10(u[1]))}function Wi(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)||isNaN(u),"$log10 expression must resolve to a number."),Math.log10(u))}function ls(l,c){var u=ie(l,c);return u[0]%u[1]}function Yi(l,c){var u=ie(l,c);return mt(u,function(_,I){return _*I},1)}function qi(l,c){var u=ie(l,c);return Q(V(u)&&u.length===2&&u.every(de),"$pow expression must resolve to array(2) of numbers"),Q(!(u[0]===0&&u[1]<0),"$pow cannot raise 0 to a negative exponent"),Math.pow(u[0],u[1])}function Gi(l,c){var u=ie(l,c),_=u[0],I=u[1];return ae(_)||isNaN(_)||Math.abs(_)===1/0?_:(Q(de(_),"$round expression must resolve to a number."),ro(_,I,!0))}function eo(l,c){var u=ie(l,c);return ae(u)?null:(Q(de(u)&&u>0||isNaN(u),"$sqrt expression must resolve to non-negative number."),Math.sqrt(u))}function to(l,c){var u=ie(l,c);return u[0]-u[1]}function no(l,c){var u=ie(l,c),_=u[0],I=u[1];return ae(_)||isNaN(_)||Math.abs(_)===1/0?_:(Q(de(_),"$trunc expression must resolve to a number."),Q(ae(I)||de(I)&&I>-20&&I<100,"$trunc expression has invalid place"),ro(_,I,!1))}function ro(l,c,u){c=c||0;var _=Math.abs(l)===l?1:-1;l=Math.abs(l);var I=Math.trunc(l),F=l-I;if(c===0){var W=Math.trunc(10*F);u&&(I&1)===1&&W>=5&&I++}else if(c>0){var X=Math.pow(10,c),ce=Math.trunc(F*X),se=Math.trunc(F*X*10)%10;u&&se>5&&(ce+=1),I+=ce/X}else if(c<0){var ke=Math.pow(10,-1*c),be=I%ke;if(I=Math.max(0,I-be),u&&_===-1){for(;be>10;)be-=be%10;I>0&&be>=5&&(I+=ke)}}return I*_}function Xi(l,c){var u=ie(l,c);Q(V(u)&&u.length===2,"$arrayElemAt expression must resolve to array(2)"),Q(V(u[0]),"First operand to $arrayElemAt must resolve to an array"),Q(de(u[1]),"Second operand to $arrayElemAt must resolve to an integer");var _=u[1];if(u=u[0],_<0&&Math.abs(_)<=u.length)return u[_+u.length];if(_>=0&&_<u.length)return u[_]}function Ki(l,c){var u=ie(l,c);return Q(V(u),"$arrayToObject expression must resolve to an array"),mt(u,function(_,I){return V(I)&&I.length==2?_[I[0]]=I[1]:(Q(ve(I)&&st(I,"k")&&st(I,"v"),"$arrayToObject expression is invalid."),_[I.k]=I.v),_},{})}function Zi(l,c){var u=ie(l,c,null);return Q(V(u),"$concatArrays must resolve to an array"),u.some(ae)?null:u.reduce(function(_,I){return Pt(_,I)},[])}function so(l,c){var u=ie(l,c.input),_=c.as,I=c.cond;return Q(V(u),"$filter 'input' expression must resolve to an array"),u.filter(function(F){var W={};return W["$"+_]=F,ie(W,I)===!0})}function ao(l,c){var u=ie(l,c[0]),_=ie(l,c[1]);return Q(V(_),"$in second argument must be an array"),_.some(sn.bind(null,u))}function oo(l,c){var u=ie(l,c);if(ae(u))return null;var _=u[0],I=u[1];if(ae(_))return null;Q(V(_),"$indexOfArray expression must resolve to an array.");var F=u[2]||0,W=u[3];return ae(W)&&(W=_.length),F>W?-1:(Q(F>=0&&W>=0,"$indexOfArray expression is invalid"),(F>0||W<_.length)&&(_=_.slice(F,W)),_.findIndex(sn.bind(null,I))+F)}function Zs(l,c){return V(ie(l,c[0]))}function Vi(l,c){var u=ie(l,c.input);Q(V(u),"$map 'input' expression must resolve to an array");var _=c.as,I=c.in,F="$"+_;return u.map(function(W){return l[F]=W,ie(l,I)})}function io(l,c){var u=ie(l,c);Q(ve(u),"$objectToArray expression must resolve to an object");var _=[];return Le(u,function(I,F){return _.push({k:F,v:I})}),_}function cs(l,c){for(var u=ie(l,c),_=u[0],I=u[1],F=u[2]||1,W=[];_<I&&F>0||_>I&&F<0;)W.push(_),_+=F;return W}function lo(l,c){var u=ie(l,c.input),_=ie(l,c.initialValue),I=c.in;return ae(u)?null:(Q(V(u),"$reduce 'input' expression must resolve to an array"),mt(u,function(F,W){return ie({$value:F,$this:W},I)},_))}function Qi(l,c){var u=ie(l,c);if(ae(u))return null;Q(V(u),"$reverseArray expression must resolve to an array");var _=[];return Pt(_,u),_.reverse(),_}function co(l,c){var u=ie(l,c);return V(u)?u.length:void 0}function uo(l,c){var u=ie(l,c);return ss(u[0],u[1],u[2])}function Vs(l,c){var u=ie(l,c.inputs),_=c.useLongestLength||!1;Q(V(u),"'inputs' expression must resolve to an array"),Q(pe(_),"'useLongestLength' must be a boolean"),V(c.defaults)&&Q(ht(_),"'useLongestLength' must be set to true to use 'defaults'");for(var I=0,F=0,W=u.length;F<W;F++){var X=u[F];if(ae(X))return null;Q(V(X),"'inputs' expression values must resolve to an array or null"),I=_?Math.max(I,X.length):Math.min(I||X.length,X.length)}for(var ce=[],se=c.defaults||[],ke=function(Pe){var ut=u.map(function(Ct,$t){return ae(Ct[Pe])?se[$t]||null:Ct[Pe]});ce.push(ut)},be=0;be<I;be++)ke(be);return ce}function Ji(l,c){var u=ie(l,c);return V(u)?mt(u,function(_,I){return Object.assign(_,I)},{}):{}}function fo(l,c){var u=ie(l,c);return ht(u)&&u.every(ht)}function Qs(l,c){var u=ie(l,c);return ht(u)&&u.some(ht)}function Js(l,c){return!ie(l,c[0])}function Et(l){return l instanceof sa?l:new sa(l)}Et.isIterator=ea;function ea(l){return!!l&&s(l)==="object"&&us(l.next)}function us(l){return!!l&&typeof l=="function"}function el(l,c){var u=l.slice(c+1);l.splice(c),Array.prototype.push.apply(l,u)}var ds=new Error,ta=1,na=2,ra=3,po=4;function tl(l,c,u){var _=!1,I=-1,F=0;return function(W){W=W===u;try{e:for(;!_;){var X=l();I++;for(var ce=-1,se=c.length,ke=!1;++ce<se;){var be=c[ce],Xe=be.func,Pe=be.type;switch(Pe){case ta:X=Xe(X,I);break;case na:if(!Xe(X,I))continue e;break;case ra:--be.func,be.func||(ke=!0);break;case po:--be.func,be.func||el(c,ce);continue e;default:break e}}if(_=ke,W)u[F++]=X;else return{value:X,done:!1}}}catch(ut){if(ut!==ds)throw ut}return _=!0,{done:!0}}}var sa=(function(){function l(c){if(i(this,l),this.__iteratees=[],this.__first=!1,this.__done=!1,this.__buf=[],us(c)&&(c={next:c}),ea(c)){var u=c;c=function(){var X=u.next();if(X.done)throw ds;return X.value}}else if(Array.isArray(c)){var _=c,I=_.length,F=0;c=function(){if(F<I)return _[F++];throw ds}}else if(!us(c))throw new Error("Source is not iterable. Must be Array, Function or Object{next:Function}");this.next=tl(c,this.__iteratees,this.__buf)}return p(l,[{key:"_validate",value:function(){if(this.__first)throw new Error("Cannot add iteratee/transform after `first()`")}},{key:"_push",value:function(u){return this._validate(),this.__iteratees.push(u),this}},{key:"map",value:function(u){return this._push({type:ta,func:u})}},{key:"filter",value:function(u){return this._push({type:na,func:u})}},{key:"take",value:function(u){return u>0?this._push({type:ra,func:u}):this}},{key:"drop",value:function(u){return u>0?this._push({type:po,func:u}):this}},{key:"transform",value:function(u){this._validate();var _=this,I;return Et(function(){return I||(I=Et(u(_.value()))),I.next()})}},{key:"first",value:function(){return this.take(1),this.__first=!0,this}},{key:"value",value:function(){return this.__done||(this.__done=this.next(this.__buf).done),this.__first?this.__buf[0]:this.__buf}},{key:"each",value:function(u){for(;;){var _=this.next();if(_.done)break;if(u(_.value)===!1)return!1}return!0}},{key:"reduce",value:function(u,_){var I=this.next(),F=0;for(_===void 0&&!I.done&&(_=I.value,I=this.next(),F++);!I.done;)_=u(_,I.value,F++),I=this.next();return _}},{key:"size",value:function(){return this.reduce(function(u,_){return++u},0)}}]),l})();typeof Symbol=="function"&&(sa.prototype[Symbol.iterator]=function(){return this});var $r=(function(){function l(c,u){i(this,l),this.__operators=c,this.__options=u}return p(l,[{key:"stream",value:function(u,_){var I=this;u=Et(u);var F=ft[G];return bt(this.__operators)||Le(this.__operators,function(W){var X=dt(W);Q(X.length===1&&Je(Xs(G),X[0]),"invalid aggregation operator ".concat(X)),X=X[0],_&&_ instanceof on?u=F[X].call(_,u,W[X],I.__options):u=F[X](u,W[X],I.__options)}),u}},{key:"run",value:function(u,_){return this.stream(u,_).value()}}]),l})();function ho(l,c,u){return Q(V(c),"Aggregation pipeline must be an array"),new $r(c,u).run(l)}var aa=(function(){function l(c,u,_){i(this,l),this.__filterFn=u.test.bind(u),this.__query=u,this.__source=c,this.__projection=_||u.__projection,this.__operators=[],this.__result=null,this.__stack=[],this.__options={}}return p(l,[{key:"_fetch",value:function(){return this.__result?this.__result:(ve(this.__projection)&&this.__operators.push({$project:this.__projection}),this.__result=Et(this.__source).filter(this.__filterFn),this.__operators.length>0&&(this.__result=new $r(this.__operators,this.__options).stream(this.__result,this.__query)),this.__result)}},{key:"all",value:function(){return this._fetch().value()}},{key:"count",value:function(){return this.all().length}},{key:"skip",value:function(u){return this.__operators.push({$skip:u}),this}},{key:"limit",value:function(u){return this.__operators.push({$limit:u}),this}},{key:"sort",value:function(u){return this.__operators.push({$sort:u}),this}},{key:"collation",value:function(u){return this.__options.collation=u,this}},{key:"next",value:function(){if(this.__stack){if(this.__stack.length>0)return this.__stack.pop();var u=this._fetch().next();if(!u.done)return u.value;this.__stack=null}}},{key:"hasNext",value:function(){if(!this.__stack)return!1;if(this.__stack.length>0)return!0;var u=this._fetch().next();return u.done?this.__stack=null:this.__stack.push(u.value),!!this.__stack}},{key:"map",value:function(u){return this._fetch().map(u).value()}},{key:"forEach",value:function(u){this._fetch().each(u)}}]),l})();typeof Symbol=="function"&&(aa.prototype[Symbol.iterator]=function(){return this._fetch()});var on=(function(){function l(c,u){i(this,l),this.__criteria=c,this.__projection=u||{},this.__compiled=[],this._compile()}return p(l,[{key:"_compile",value:function(){var u=this;Q(ve(this.__criteria),"query criteria must be an object");var _;Le(this.__criteria,function(I,F){F==="$where"?_={field:F,expr:I}:F==="$expr"||Je(["$and","$or","$nor"],F)?u._processOperator(F,F,I):(Q(!Gs(F),"unknown top level operator: ".concat(F)),I=Ga(I),Le(I,function(W,X){u._processOperator(F,X,W)})),ve(_)&&u._processOperator(_.field,_.field,_.expr)})}},{key:"_processOperator",value:function(u,_,I){Q(st(ft[fe],_),"invalid query operator ".concat(_," detected")),this.__compiled.push(ft[fe][_](u,I))}},{key:"test",value:function(u){for(var _=0,I=this.__compiled.length;_<I;_++)if(!this.__compiled[_](u))return!1;return!0}},{key:"find",value:function(u,_){return new aa(u,this,_)}},{key:"remove",value:function(u){var _=this;return mt(u,function(I,F){return _.test(F)||I.push(F),I},[])}}]),l})();function nl(l,c,u){return new on(c).find(l,u)}function oa(l,c){return new on(c).remove(l)}function ia(l,c){if(sn(l,c)||ae(l)&&ae(c))return!0;if(V(l)){var u=sn.bind(null,c);return l.some(u)||qa(l,1).some(u)}return!1}function mo(l,c){return!ia(l,c)}function go(l,c){return ae(l)?c.some($e):Tr(Bn(l),c).length>0}function xo(l,c){return!go(l,c)}function bo(l,c){return wt(l,c,function(u,_){return u<_})}function at(l,c){return wt(l,c,function(u,_){return u<=_})}function tt(l,c){return wt(l,c,function(u,_){return u>_})}function wo(l,c){return wt(l,c,function(u,_){return u>=_})}function rl(l,c){return Bn(l).some(function(u){return de(u)&&V(c)&&c.length===2&&u%c[0]===c[1]})}function sl(l,c){l=Bn(l);var u=function(I){return le(I)&&!!I.match(c)};return l.some(u)||qa(l,1).some(u)}function al(l,c){return(c===!1||c===0)&&l===void 0||(c===!0||c===1)&&l!==void 0}function ol(l,c){var u=!1;if(V(l)&&V(c))for(var _=0,I=c.length;_<I;_++)if(ve(c[_])&&Je(dt(c[_]),"$elemMatch"))u=u||la(l,c[_].$elemMatch);else return Tr(c,l).length===I;return u}function il(l,c){return V(l)&&de(c)&&l.length===c}function la(l,c){if(V(l)&&!bt(l)){var u=function(ce){return ce},_=c;dt(c).every(Gs)&&(_={temp:c},u=function(ce){return{temp:ce}});for(var I=new on(_),F=0,W=l.length;F<W;F++)if(I.test(u(l[F])))return!0}return!1}function ll(l,c){switch(c){case 1:case"double":return de(l)&&(l+"").indexOf(".")!==-1;case 2:case T:return le(l);case 3:case P:return ve(l);case 4:case L:return V(l);case 6:case y:return ae(l);case 8:case C:return pe(l);case 9:case A:return Qe(l);case 10:case v:return $e(l);case 11:case R:return Dt(l);case 16:case"int":return de(l)&&l<=2147483647&&(l+"").indexOf(".")===-1;case 18:case"long":return de(l)&&l>2147483647&&l<=9223372036854776e3&&(l+"").indexOf(".")===-1;case 19:case"decimal":return de(l);default:return!1}}function wt(l,c,u){return Bn(l).some(function(_){return we(_)===we(c)&&u(_,c)})}function _n(l){return function(c,u){var _=ie(c,u);return l(_[0],_[1])}}var Yn=_n(ia),vo=_n(mo),ca=_n(tt),Xt=_n(bo),yo=_n(wo),_o=_n(at),Mo=_n(xo);function ko(l,c){var u=ie(l,c);return u[0]>u[1]?1:u[0]<u[1]?-1:0}function jo(l,c){var u,_,I,F="$cond: invalid arguments";V(c)?(Q(c.length===3,F),u=c[0],_=c[1],I=c[2]):(Q(ve(c),F),u=c.if,_=c.then,I=c.else);var W=ie(l,u);return W?ie(l,_):ie(l,I)}function No(l,c){var u="Invalid arguments for $switch operator";Q(c.branches,u);var _=c.branches.find(function(I){return Q(I.case&&I.then,u),ie(l,I.case)});return _?ie(l,_.then):(Q(c.default,u),ie(l,c.default))}function Ut(l,c){Q(V(c)&&c.length===2,"$ifNull expression must resolve to array(2)");var u=ie(l,c);return ae(u[0])?u[1]:u[0]}function To(l,c){var u=ie(l,c),_=new Date(u.getFullYear(),0,0),I=u-_,F=1e3*60*60*24;return Math.round(I/F)}function Ht(l,c){var u=ie(l,c);return u.getDate()}function Eo(l,c){var u=ie(l,c);return u.getDay()+1}function ua(l,c){var u=ie(l,c);return u.getFullYear()}function Mn(l,c){var u=ie(l,c);return u.getMonth()+1}function Or(l,c){var u=ie(l,c);u=new Date(+u),u.setHours(0,0,0),u.setDate(u.getDate()+4-(u.getDay()||7));var _=new Date(u.getFullYear(),0,1);return Math.floor(((u-_)/864e5+1)/7)}function fs(l,c){var u=ie(l,c);return u.getUTCHours()}function it(l,c){var u=ie(l,c);return u.getMinutes()}function kn(l,c){var u=ie(l,c);return u.getSeconds()}function ps(l,c){var u=ie(l,c);return u.getMilliseconds()}var cl={"%Y":[ua,4],"%m":[Mn,2],"%d":[Ht,2],"%H":[fs,2],"%M":[it,2],"%S":[kn,2],"%L":[ps,3],"%j":[To,3],"%w":[Eo,1],"%U":[Or,2],"%%":"%"};function da(l,c){for(var u=c.format,_=ie(l,c.date),I=u.match(/(%%|%Y|%m|%d|%H|%M|%S|%L|%j|%w|%U)/g),F=0,W=I.length;F<W;F++){var X=cl[I[F]],ce=X;if(V(X)){var se=X[0],ke=X[1];ce=ul(se(l,_),ke)}u=u.replace(I[F],ce)}return u}function ul(l,c){return new Array(Math.max(c-String(l).length+1,0)).join("0")+l}function dl(l,c){return c}function fl(l,c){var u=ie(l,c),_=Ir(u[0]),I=Ir(u[1]);return _.length===I.length&&_.length===Tr(_,I).length}function Co(l,c){var u=ie(l,c);return Tr(u[0],u[1])}function hs(l,c){var u=ie(l,c);return u[0].filter(rn.bind(null,u[1]))}function ur(l,c){var u=ie(l,c);return Er(u[0],u[1])}function pl(l,c){var u=ie(l,c);return Tr(u[0],u[1]).length===u[0].length}function Io(l,c){var u=ie(l,c)[0];return u.some(ht)}function So(l,c){var u=ie(l,c)[0];return u.every(ht)}function fa(l,c){var u=ie(l,c);return[null,void 0].some(Je.bind(null,u))?null:u.join("")}function pa(l,c){var u=ie(l,c),_="$indexOfBytes expression resolves to invalid an argument";if(ae(u[0]))return null;Q(le(u[0])&&le(u[1]),_);var I=u[0],F=u[1],W=u[2],X=u[3],ce=ae(W)||de(W)&&W>=0&&Math.round(W)===W;if(ce=ce&&(ae(X)||de(X)&&X>=0&&Math.round(X)===X),Q(ce,_),W=W||0,X=X||I.length,W>X)return-1;var se=I.substring(W,X).indexOf(F);return se>-1?se+W:se}function Ao(l,c){var u=ie(l,c);return ae(u[0])?null:(Q(u.every(le),"$split expression must result to array(2) of strings"),u[0].split(u[1]))}function hl(l,c){return~-encodeURI(ie(l,c)).split(/%..|./).length}function ha(l,c){return ie(l,c).length}function ma(l,c){var u=ie(l,c),_=u[0],I=u[1];return sn(_,I)||u.every(ae)?0:(Q(u.every(le),"$strcasecmp must resolve to array(2) of strings"),_=_.toUpperCase(),I=I.toUpperCase(),_>I&&1||_<I&&-1||0)}function ml(l,c){var u=ie(l,c),_=u[0],I=u[1],F=u[2];Q(le(_)&&de(I)&&I>=0&&de(F)&&F>=0,"$substrBytes: invalid arguments");for(var W=gl(_),X=[],ce=0,se=0;se<W.length;se++)X.push(ce),ce+=W[se].length;var ke=X.indexOf(I),be=X.indexOf(I+F);return Q(ke>-1&&be>-1,"$substrBytes: invalid range, start or end index is a UTF-8 continuation byte."),_.substring(ke,be)}function ga(l,c){var u=ie(l,c),_=u[0],I=u[1],F=u[2];return le(_)?I<0?"":F<0?_.substr(I):_.substr(I,F):""}function Bt(l,c){return ga(l,c)}function xa(l,c){var u=ie(l,c);return bt(u)?"":u.toLowerCase()}function Rr(l,c){var u=ie(l,c);return bt(u)?"":u.toUpperCase()}var Do=[192,224,240];function $o(l){if(l<128)return[l];for(var c=l<2048&&1||l<65536&&2||3,u=Do[c-1],_=[(l>>6*c)+u];c>0;)_.push(128|l>>6*--c&63);return _}function gl(l){for(var c=[],u=0,_=l.length;u<_;u++)c.push($o(l.codePointAt(u)));return c}function xl(l,c){var u=c.vars,_=c.in,I=dt(u);return Le(I,function(F){var W=ie(l,u[F]),X="$"+F;l[X]=W}),ie(l,_)}var bl=Object.freeze({__proto__:null,$abs:Ja,$add:Fi,$ceil:Pi,$divide:Hi,$exp:zi,$floor:Ui,$ln:Bi,$log:is,$log10:Wi,$mod:ls,$multiply:Yi,$pow:qi,$round:Gi,$sqrt:eo,$subtract:to,$trunc:no,$arrayElemAt:Xi,$arrayToObject:Ki,$concatArrays:Zi,$filter:so,$in:ao,$indexOfArray:oo,$isArray:Zs,$map:Vi,$objectToArray:io,$range:cs,$reduce:lo,$reverseArray:Qi,$size:co,$slice:uo,$zip:Vs,$mergeObjects:Ji,$and:fo,$or:Qs,$not:Js,$eq:Yn,$ne:vo,$gt:ca,$lt:Xt,$gte:yo,$lte:_o,$nin:Mo,$cmp:ko,$cond:jo,$switch:No,$ifNull:Ut,$dayOfYear:To,$dayOfMonth:Ht,$dayOfWeek:Eo,$year:ua,$month:Mn,$week:Or,$hour:fs,$minute:it,$second:kn,$millisecond:ps,$dateToString:da,$literal:dl,$setEquals:fl,$setIntersection:Co,$setDifference:hs,$setUnion:ur,$setIsSubset:pl,$anyElementTrue:Io,$allElementsTrue:So,$concat:fa,$indexOfBytes:pa,$split:Ao,$strLenBytes:hl,$strLenCP:ha,$strcasecmp:ma,$substrBytes:ml,$substr:ga,$substrCP:Bt,$toLower:xa,$toUpper:Rr,$let:xl});function Sn(l,c){return ae(c)?l:l.map(function(u){return ie(u,c)})}function wl(l,c){return Ir(Sn(l,c))}function dr(l,c){var u=Sn(l,c).filter(de),_=mt(u,function(I,F){return I+F},0);return _/(u.length||1)}function vl(l,c){return l.length>0?ie(l[0],c):void 0}function yl(l,c){return l.length>0?ie(l[l.length-1],c):void 0}function ba(l,c){return mt(Sn(l,c),function(u,_){return ae(u)||_>u?_:u},void 0)}function Oo(l,c){return mt(l,function(u,_){return Object.assign(u,ie(_,c))},{})}function An(l,c){return mt(Sn(l,c),function(u,_){return ae(u)||_<u?_:u},void 0)}function ms(l,c){return Xa(Sn(l,c).filter(de),!1)}function _l(l,c){return Xa(Sn(l,c).filter(de),!0)}function Ml(l,c){return V(l)?de(c)?l.length*c:mt(Sn(l,c).filter(de),function(u,_){return u+_},0):0}var kl=Object.freeze({__proto__:null,$addToSet:wl,$avg:dr,$first:vl,$last:yl,$max:ba,$mergeObjects:Oo,$min:An,$push:Sn,$stdDevPop:ms,$stdDevSamp:_l,$sum:Ml});function qn(l,c,u){var _=dt(c);return _.length===0?l:l.map(function(I){var F=Ne(I);return Le(_,function(W){var X=ie(I,c[W]);Ys(F,W,X)}),F})}var ln=qn;function Ro(l,c,u){var _=c.boundaries,I=c.default,F=_[0],W=_[_.length-1],X=c.output||{count:{$sum:1}};Q(_.length>2,"$bucket 'boundaries' expression must have at least 3 elements");for(var ce=we(F),se=0,ke=_.length-1;se<ke;se++)Q(ce===we(_[se+1]),"$bucket 'boundaries' must all be of the same type"),Q(_[se]<_[se+1],"$bucket 'boundaries' must be sorted in ascending order");!ae(I)&&we(c.default)===we(F)&&Q(F>c.default||W<c.default,"$bucket 'default' expression must be out of boundaries range");var be={};Le(_,function(Pe){return be[Pe]=[]}),ae(I)||(be[I]=[]);var Xe=!1;return Et(function(){return Xe||(l.each(function(Pe){var ut=ie(Pe,c.groupBy);if(ae(ut)||ut<F||ut>=W)Q(!ae(I),"$bucket require a default for out of range values"),be[I].push(Pe);else{Q(ut>=F&&ut<W,"$bucket 'groupBy' expression must resolve to a value in range of boundaries");var Ct=Us(_,ut),$t=_[Math.max(0,Ct-1)];be[$t].push(Pe)}}),_.pop(),ae(I)||_.push(I),Xe=Et(_).map(function(Pe){var ut=Dr(be[Pe],null,X);return Object.assign(ut,{_id:Pe})})),Xe.next()})}function jl(l,c,u){var _=c.output||{count:{$sum:1}},I=c.groupBy,F=c.buckets;return Q(F>0,"The $bucketAuto 'buckets' field must be greater than 0, but found: "+F),l.transform(function(W){for(var X=Math.max(1,Math.round(W.length/F)),ce=Bs(ie),se={},ke=[],be=es(W,function(Oe){var Fr=ce(Oe,I);return ae(Fr)?ke.push(Oe):(se[Fr]||(se[Fr]=[]),se[Fr].push(Oe)),Fr}),Xe=cr(),Pe=[],ut=0,Ct=0,$t=be.length;Ct<F&&ut<$t;Ct++){for(var Zt={},k=[],Xn=0;Xn<X&&ut<$t;Xn++){var mn=ce(be[ut],I);if(ae(mn)&&(mn=null),Pt(k,ae(mn)?ke:se[mn]),ut+=ae(mn)?ke.length:se[mn].length,st(Zt,"min")||(Zt.min=mn),Pe.length>0){var Vt=Pe[Pe.length-1];Vt[Xe].max=Zt.min}}Ct==F-1&&Pt(k,be.slice(ut)),Pe.push(Object.assign(Dr(k,null,_),{_id:Zt}))}return Pe.length>0&&(Pe[Pe.length-1][Xe].max=ce(be[be.length-1],I)),Pe})}function Nl(l,c,u){return Q(le(c)&&c.trim()!==""&&c.indexOf(".")===-1&&c.trim()[0]!=="$","Invalid expression value for $count"),Et(function(){var _={};return _[c]=l.size(),{value:_,done:!1}}).first()}function Tl(l,c,u){return l.transform(function(_){return[It(c,function(I){return ho(_,I)})]})}function Lo(l,c,u){var _=cr(),I=c[_];return l.transform(function(F){var W=ts(F,function(se){return ie(se,I,I)});c=ue(c),delete c[_];var X=-1,ce=W.keys.length;return function(){if(++X===ce)return{done:!0};var se=W.keys[X],ke={};return se!==void 0&&(ke[_]=se),Le(c,function(be,Xe){ke[Xe]=Dr(W.groups[X],Xe,be)}),{value:ke,done:!1}}})}function El(l,c,u){return l.take(c)}function fr(l,c,u){var _=c.from,I=c.localField,F=c.foreignField,W=c.as;Q(V(_)&&le(F)&&le(I)&&le(W),"$lookup: invalid argument");var X={};return Le(_,function(ce){var se=hn(an(ce,F));X[se]=X[se]||[],X[se].push(ce)}),l.map(function(ce){var se=hn(an(ce,I)),ke=ue(ce);return ke[W]=X[se]||[],ke})}function U(l,c,u){var _=new on(c);return l.filter(function(I){return _.test(I)})}function J(l,c,u){return Q(V(c),"$out expression must be an array"),l.map(function(_){return c.push(_),_})}function Z(l,c,u){if(bt(c))return l;var _=dt(c),I=!1,F=cr();if(Ce(c),Je(_,F)){var W=c[F];(W===0||W===!1)&&(_=_.filter(rn.bind(null,[F])),Q(rn(_,F),"Must not contain collections id key"),I=bt(_))}else _.push(F);return l.map(function(X){return xe(X,c,_,I)})}function xe(l,c,u,_){var I=cr(),F={},W=!1,X=!1,ce=[];return _&&ce.push(I),u.forEach(function(se){var ke,be=c[se];if(se!==I&&Je([0,!1],be)&&(X=!0),se===I&&bt(be))ke=l[se];else if(le(be))ke=ie(l,be,se);else if(!Je([1,!0],be))if(V(be))ke=be.map(function(Zt){var k=ie(l,Zt);return ae(k)?null:k});else if(ve(be)){var Xe=dt(be),Pe=Xe.length>1?!1:Xe[0];if(Je(Xs(te),Pe)){var ut=ft[te];Pe==="$slice"?Bn(be[Pe]).every(de)?(ke=ut[Pe](l,be[Pe],se),W=!0):ke=ie(l,be,se):ke=ut[Pe](l,be[Pe],se)}else if(st(l,se)){Ce(be);var Ct=l[se];ke=V(Ct)?Ct.map(function(Zt){return xe(Zt,be,Xe,!1)}):xe(Ct,be,Xe,!1)}else ke=ie(l,be,se)}else{ce.push(se);return}var $t=Ar(l,se,{preserveMissingValues:!0});$t!==void 0&&pn(F,$t,{flatten:!0}),rn([0,1,!1,!0],be)&&(ke===void 0?qs(F,se):Ys(F,se,ke))}),ns(F),(W||X||_)&&(F=Object.assign({},l,F),ce.length>0&&(F=Ne(F),Le(ce,function(se){return qs(F,se)}))),F}function Ce(l){var c=cr(),u=[!1,!1];Le(l,function(_,I){I!==c&&(_===0||_===!1?u[0]=!0:(_===1||_===!0)&&(u[1]=!0),Q(!(u[0]&&u[1]),"Projection cannot have a mix of inclusion and exclusion."))})}function Ge(l,c,u){return l.map(function(_){return Ks(Ne(_),c)})}function yt(l,c,u){return l.map(function(_){return _=ie(_,c.newRoot),Q(ve(_),"$replaceRoot expression must return an object"),_})}function nt(l,c,u){var _=c.size;return Q(de(_),"$sample size must be a positive integer"),l.transform(function(I){var F=I.length,W=-1;return function(){if(++W===_)return{done:!0};var X=Math.floor(Math.random()*F);return{value:I[X],done:!1}}})}function wa(l,c,u){return l.drop(c)}function Fo(l,c,u){if(bt(c)||!ve(c))return l;u=u||{};var _=Sr,I=u.collation;return ve(I)&&le(I.locale)&&(_=gs(I)),l.transform(function(F){var W=dt(c);return Le(W.reverse(),function(X){var ce=ts(F,function(be){return an(be,X)}),se={},ke=es(ce.keys,function(be,Xe){return se[be]=Xe,be},_);c[X]===-1&&ke.reverse(),F=[],Le(ke,function(be){return Pt(F,ce.groups[se[be]])})}),F})}var Kt={1:"base",2:"accent",3:"variant"};function gs(l){var c={sensitivity:Kt[l.strength||3],caseFirst:l.caseFirst==="off"?"false":l.caseFirst||"false",numeric:l.numericOrdering||!1,ignorePunctuation:l.alternate==="shifted"};(l.caseLevel||!1)===!0&&(c.sensitivity==="base"&&(c.sensitivity="case"),c.sensitivity==="accent"&&(c.sensitivity="variant"));var u=new Intl.Collator(l.locale,c);return function(_,I){if(!le(_)||!le(I))return Sr(_,I);var F=u.compare(_,I);return F<0?-1:F>0?1:0}}function Cl(l,c,u){var _={count:{$sum:1}};return _[cr()]=c,Fo(Lo(l,_),{count:-1},u)}function pr(l,c,u){le(c)&&(c={path:c});var _=c.path.substr(1),I=c.includeArrayIndex||!1,F=c.preserveNullAndEmptyArrays||!1,W=function(se,ke){return I!==!1&&(se[I]=ke),se},X;return Et(function(){for(var ce=function(){if(Et.isIterator(X)){var be=X.next();if(!be.done)return{v:be}}var Xe=l.next();if(Xe.done)return{v:Xe};if(Xe=Xe.value,X=an(Xe,_),V(X))if(X.length===0&&F===!0){X=null;var Pe=Ne(Xe);return qs(Pe,_),{v:{value:W(Pe,null),done:!1}}}else X=Et(X).map(function(Ct,$t){var Zt=Ne(Xe);return Ys(Zt,_,Ct),W(Zt,$t)});else if(!bt(X)||F===!0){var ut=Ne(Xe);return{v:{value:W(ut,null),done:!1}}}};;){var se=ce();if(s(se)==="object")return se.v}})}var xs=Object.freeze({__proto__:null,$addFields:qn,$set:ln,$bucket:Ro,$bucketAuto:jl,$count:Nl,$facet:Tl,$group:Lo,$limit:El,$lookup:fr,$match:U,$out:J,$project:Z,$redact:Ge,$replaceRoot:yt,$sample:nt,$skip:wa,$sort:Fo,$sortByCount:Cl,$unwind:pr});function bs(l,c,u){Wn("$ not implemented")}function Ke(l,c,u){var _=an(l,u),I=new on(c);Q(V(_),"$elemMatch: invalid argument");for(var F=0;F<_.length;F++)if(I.test(_[F]))return[_[F]]}function Il(l,c,u){var _=an(l,u);return V(_)?V(c)?ss(_,c[0],c[1]):(Q(de(c),"$slice: invalid arguments for projection"),ss(_,c)):_}var Po=Object.freeze({__proto__:null,$:bs,$elemMatch:Ke,$slice:Il});function Nt(l){return function(c,u){return function(_){var I=an(_,c,{meta:!0});return I=Cr(I.result,I.depth),l(I,u)}}}var Sl=Nt(ol),Al=Nt(la),Dl=Nt(ia),ws=Nt(al),Dn=Nt(tt),vs=Nt(wo),Ho=Nt(go),ys=Nt(bo),zo=Nt(at),Uo=Nt(rl),_s=Nt(mo),Bo=Nt(xo),Lr=Nt(sl),Gn=Nt(il),Ms=Nt(ll);function $l(l,c){Q(V(c),"Invalid expression: $and expects value to be an Array");var u=[];return Le(c,function(_){return u.push(new on(_))}),function(_){for(var I=0;I<u.length;I++)if(!u[I].test(_))return!1;return!0}}function Wo(l,c){Q(V(c),"Invalid expression. $or expects value to be an Array");var u=[];return Le(c,function(_){return u.push(new on(_))}),function(_){for(var I=0;I<u.length;I++)if(u[I].test(_))return!0;return!1}}function Ol(l,c){Q(V(c),"Invalid expression. $nor expects value to be an Array");var u=Wo("$or",c);return function(_){return!u(_)}}function ks(l,c){var u={};u[l]=Ga(c);var _=new on(u);return function(I){return!_.test(I)}}function js(l,c){return Gt(c)||(c=new Function("return "+c+";")),function(u){return c.call(u)===!0}}function va(l,c){return function(u){return ie(u,c)}}var Rl=Object.freeze({__proto__:null,$all:Sl,$elemMatch:Al,$eq:Dl,$exists:ws,$gt:Dn,$gte:vs,$in:Ho,$lt:ys,$lte:zo,$mod:Uo,$ne:_s,$nin:Bo,$regex:Lr,$size:Gn,$type:Ms,$and:$l,$or:Wo,$nor:Ol,$not:ks,$where:js,$expr:va}),ft={};ft[Y]={},ft[z]={},ft[G]={},ft[te]={},ft[fe]={};var Ll=[[Y,bl],[z,kl],[G,xs],[te,Po],[fe,Rl]];function Fl(){Le(Ll,function(l){var c=x(l,2),u=c[0],_=c[1];Object.assign(ft[u],_)})}function _t(l,c){var u=c(Ka());Q(st(ft,l),"Invalid operator class ".concat(l));var _=ft[l];Le(u,function(F,W){Q(/^\$[a-zA-Z0-9_]*$/.test(W),"Invalid operator name ".concat(W)),Q(!st(_,W),"".concat(W," already exists for '").concat(l,"' operators"))});var I={};switch(l){case fe:Le(u,function(F,W){F=F.bind(u),I[W]=function(X,ce){return function(se){var ke=an(se,X),be=F(X,ke,ce);return Q(pe(be),"".concat(W," must return a boolean")),be}}});break;case te:Le(u,function(F,W){F=F.bind(u),I[W]=function(X,ce,se){var ke=an(X,se);return F(se,ke,ce)}});break;default:Le(u,function(F,W){I[W]=function(){for(var X=arguments.length,ce=new Array(X),se=0;se<X;se++)ce[se]=arguments[se];return F.apply(u,ce)}})}Object.assign(ft[l],I)}var St={query:function(c,u){return new on(c).find(this.toJSON(),u)},aggregate:function(c){return new $r(c).run(this.toJSON())}};Fl();var Pl="2.5.3",Hl={_internal:Ka,Aggregator:$r,CollectionMixin:St,Cursor:aa,Lazy:Et,OP_EXPRESSION:Y,OP_GROUP:z,OP_PIPELINE:G,OP_PROJECTION:te,OP_QUERY:fe,Query:on,VERSION:Pl,addOperators:_t,aggregate:ho,find:nl,remove:oa,setup:Li};return Hl}))})(vi)),vi.exports}var Aa={exports:{}};var I8=Aa.exports,kp;function Lu(){return kp||(kp=1,(function(t,a){(function(){var s,i="4.18.1",f=200,p="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",x="Expected a function",h="Invalid `variable` option passed into `_.template`",b="Invalid `imports` option passed into `_.template`",g="__lodash_hash_undefined__",m=500,w="__lodash_placeholder__",v=1,y=2,C=4,j=1,N=2,T=1,A=2,R=4,$=8,L=16,P=32,D=64,q=128,Y=256,z=512,G=30,te="...",fe=800,Me=16,K=1,Q=2,Ne=3,ue=1/0,we=9007199254740991,ee=17976931348623157e292,pe=NaN,le=4294967295,de=le-1,V=le>>>1,ve=[["ary",q],["bind",T],["bindKey",A],["curry",$],["curryRight",L],["flip",z],["partial",P],["partialRight",D],["rearg",Y]],De="[object Arguments]",Qe="[object Array]",Dt="[object AsyncFunction]",Gt="[object Boolean]",ae="[object Date]",$e="[object DOMException]",Ft="[object Error]",Je="[object Function]",rn="[object GeneratorFunction]",ht="[object Map]",bt="[object Number]",Bn="[object Null]",st="[object Object]",Wn="[object Promise]",dt="[object Proxy]",Le="[object RegExp]",It="[object Set]",pn="[object String]",mt="[object Symbol]",Tr="[object Undefined]",Er="[object WeakMap]",qa="[object WeakSet]",Cr="[object ArrayBuffer]",sn="[object DataView]",Ir="[object Float32Array]",In="[object Float64Array]",hn="[object Int8Array]",Sr="[object Int16Array]",es="[object Int32Array]",ts="[object Uint8Array]",Pt="[object Uint8ClampedArray]",Us="[object Uint16Array]",Bs="[object Uint32Array]",Ws=/\b__p \+= '';/g,an=/\b(__p \+=) '' \+/g,Ar=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ns=/&(?:amp|lt|gt|quot|#39);/g,rs=/[&<>"']/g,Ys=RegExp(ns.source),qs=RegExp(rs.source),Gs=/<%-([\s\S]+?)%>/g,Ga=/<%([\s\S]+?)%>/g,ss=/<%=([\s\S]+?)%>/g,Xa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/,Ka=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,as=/[\\^$.*+?()[\]{}|]/g,Li=RegExp(as.source),os=/^\s+/,Za=/\s/,Va=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qa=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,Xs=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dr=/[()=,{}\[\]\/\s]/,ie=/\\(\\)?/g,Ks=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ja=/\w*$/,Fi=/^[-+]0x[0-9a-f]+$/i,Pi=/^0b[01]+$/i,Hi=/^\[object .+?Constructor\]$/,zi=/^0o[0-7]+$/i,Ui=/^(?:0|[1-9]\d*)$/,Bi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,is=/($^)/,Wi=/['\n\r\u2028\u2029\\]/g,ls="\\ud800-\\udfff",Yi="\\u0300-\\u036f",qi="\\ufe20-\\ufe2f",Gi="\\u20d0-\\u20ff",eo=Yi+qi+Gi,to="\\u2700-\\u27bf",no="a-z\\xdf-\\xf6\\xf8-\\xff",ro="\\xac\\xb1\\xd7\\xf7",Xi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ki="\\u2000-\\u206f",Zi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",so="A-Z\\xc0-\\xd6\\xd8-\\xde",ao="\\ufe0e\\ufe0f",oo=ro+Xi+Ki+Zi,Zs="['’]",Vi="["+ls+"]",io="["+oo+"]",cs="["+eo+"]",lo="\\d+",Qi="["+to+"]",co="["+no+"]",uo="[^"+ls+oo+lo+to+no+so+"]",Vs="\\ud83c[\\udffb-\\udfff]",Ji="(?:"+cs+"|"+Vs+")",fo="[^"+ls+"]",Qs="(?:\\ud83c[\\udde6-\\uddff]){2}",Js="[\\ud800-\\udbff][\\udc00-\\udfff]",Et="["+so+"]",ea="\\u200d",us="(?:"+co+"|"+uo+")",el="(?:"+Et+"|"+uo+")",ds="(?:"+Zs+"(?:d|ll|m|re|s|t|ve))?",ta="(?:"+Zs+"(?:D|LL|M|RE|S|T|VE))?",na=Ji+"?",ra="["+ao+"]?",po="(?:"+ea+"(?:"+[fo,Qs,Js].join("|")+")"+ra+na+")*",tl="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",sa="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",$r=ra+na+po,ho="(?:"+[Qi,Qs,Js].join("|")+")"+$r,aa="(?:"+[fo+cs+"?",cs,Qs,Js,Vi].join("|")+")",on=RegExp(Zs,"g"),nl=RegExp(cs,"g"),oa=RegExp(Vs+"(?="+Vs+")|"+aa+$r,"g"),ia=RegExp([Et+"?"+co+"+"+ds+"(?="+[io,Et,"$"].join("|")+")",el+"+"+ta+"(?="+[io,Et+us,"$"].join("|")+")",Et+"?"+us+"+"+ds,Et+"+"+ta,sa,tl,lo,ho].join("|"),"g"),mo=RegExp("["+ea+ls+eo+ao+"]"),go=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],bo=-1,at={};at[Ir]=at[In]=at[hn]=at[Sr]=at[es]=at[ts]=at[Pt]=at[Us]=at[Bs]=!0,at[De]=at[Qe]=at[Cr]=at[Gt]=at[sn]=at[ae]=at[Ft]=at[Je]=at[ht]=at[bt]=at[st]=at[Le]=at[It]=at[pn]=at[Er]=!1;var tt={};tt[De]=tt[Qe]=tt[Cr]=tt[sn]=tt[Gt]=tt[ae]=tt[Ir]=tt[In]=tt[hn]=tt[Sr]=tt[es]=tt[ht]=tt[bt]=tt[st]=tt[Le]=tt[It]=tt[pn]=tt[mt]=tt[ts]=tt[Pt]=tt[Us]=tt[Bs]=!0,tt[Ft]=tt[Je]=tt[Er]=!1;var wo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},rl={"&":"&","<":"<",">":">",'"':""","'":"'"},sl={"&":"&","<":"<",">":">",""":'"',"'":"'"},al={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ol=parseFloat,il=parseInt,la=typeof fi=="object"&&fi&&fi.Object===Object&&fi,ll=typeof self=="object"&&self&&self.Object===Object&&self,wt=la||ll||Function("return this")(),_n=a&&!a.nodeType&&a,Yn=_n&&!0&&t&&!t.nodeType&&t,vo=Yn&&Yn.exports===_n,ca=vo&&la.process,Xt=(function(){try{var U=Yn&&Yn.require&&Yn.require("util").types;return U||ca&&ca.binding&&ca.binding("util")}catch{}})(),yo=Xt&&Xt.isArrayBuffer,_o=Xt&&Xt.isDate,Mo=Xt&&Xt.isMap,ko=Xt&&Xt.isRegExp,jo=Xt&&Xt.isSet,No=Xt&&Xt.isTypedArray;function Ut(U,J,Z){switch(Z.length){case 0:return U.call(J);case 1:return U.call(J,Z[0]);case 2:return U.call(J,Z[0],Z[1]);case 3:return U.call(J,Z[0],Z[1],Z[2])}return U.apply(J,Z)}function To(U,J,Z,xe){for(var Ce=-1,Ge=U==null?0:U.length;++Ce<Ge;){var yt=U[Ce];J(xe,yt,Z(yt),U)}return xe}function Ht(U,J){for(var Z=-1,xe=U==null?0:U.length;++Z<xe&&J(U[Z],Z,U)!==!1;);return U}function Eo(U,J){for(var Z=U==null?0:U.length;Z--&&J(U[Z],Z,U)!==!1;);return U}function ua(U,J){for(var Z=-1,xe=U==null?0:U.length;++Z<xe;)if(!J(U[Z],Z,U))return!1;return!0}function Mn(U,J){for(var Z=-1,xe=U==null?0:U.length,Ce=0,Ge=[];++Z<xe;){var yt=U[Z];J(yt,Z,U)&&(Ge[Ce++]=yt)}return Ge}function Or(U,J){var Z=U==null?0:U.length;return!!Z&&ur(U,J,0)>-1}function fs(U,J,Z){for(var xe=-1,Ce=U==null?0:U.length;++xe<Ce;)if(Z(J,U[xe]))return!0;return!1}function it(U,J){for(var Z=-1,xe=U==null?0:U.length,Ce=Array(xe);++Z<xe;)Ce[Z]=J(U[Z],Z,U);return Ce}function kn(U,J){for(var Z=-1,xe=J.length,Ce=U.length;++Z<xe;)U[Ce+Z]=J[Z];return U}function ps(U,J,Z,xe){var Ce=-1,Ge=U==null?0:U.length;for(xe&&Ge&&(Z=U[++Ce]);++Ce<Ge;)Z=J(Z,U[Ce],Ce,U);return Z}function cl(U,J,Z,xe){var Ce=U==null?0:U.length;for(xe&&Ce&&(Z=U[--Ce]);Ce--;)Z=J(Z,U[Ce],Ce,U);return Z}function da(U,J){for(var Z=-1,xe=U==null?0:U.length;++Z<xe;)if(J(U[Z],Z,U))return!0;return!1}var ul=fa("length");function dl(U){return U.split("")}function fl(U){return U.match(Xs)||[]}function Co(U,J,Z){var xe;return Z(U,function(Ce,Ge,yt){if(J(Ce,Ge,yt))return xe=Ge,!1}),xe}function hs(U,J,Z,xe){for(var Ce=U.length,Ge=Z+(xe?1:-1);xe?Ge--:++Ge<Ce;)if(J(U[Ge],Ge,U))return Ge;return-1}function ur(U,J,Z){return J===J?Ml(U,J,Z):hs(U,Io,Z)}function pl(U,J,Z,xe){for(var Ce=Z-1,Ge=U.length;++Ce<Ge;)if(xe(U[Ce],J))return Ce;return-1}function Io(U){return U!==U}function So(U,J){var Z=U==null?0:U.length;return Z?ha(U,J)/Z:pe}function fa(U){return function(J){return J==null?s:J[U]}}function pa(U){return function(J){return U==null?s:U[J]}}function Ao(U,J,Z,xe,Ce){return Ce(U,function(Ge,yt,nt){Z=xe?(xe=!1,Ge):J(Z,Ge,yt,nt)}),Z}function hl(U,J){var Z=U.length;for(U.sort(J);Z--;)U[Z]=U[Z].value;return U}function ha(U,J){for(var Z,xe=-1,Ce=U.length;++xe<Ce;){var Ge=J(U[xe]);Ge!==s&&(Z=Z===s?Ge:Z+Ge)}return Z}function ma(U,J){for(var Z=-1,xe=Array(U);++Z<U;)xe[Z]=J(Z);return xe}function ml(U,J){return it(J,function(Z){return[Z,U[Z]]})}function ga(U){return U&&U.slice(0,Ro(U)+1).replace(os,"")}function Bt(U){return function(J){return U(J)}}function xa(U,J){return it(J,function(Z){return U[Z]})}function Rr(U,J){return U.has(J)}function Do(U,J){for(var Z=-1,xe=U.length;++Z<xe&&ur(J,U[Z],0)>-1;);return Z}function $o(U,J){for(var Z=U.length;Z--&&ur(J,U[Z],0)>-1;);return Z}function gl(U,J){for(var Z=U.length,xe=0;Z--;)U[Z]===J&&++xe;return xe}var xl=pa(wo),bl=pa(rl);function Sn(U){return"\\"+al[U]}function wl(U,J){return U==null?s:U[J]}function dr(U){return mo.test(U)}function vl(U){return go.test(U)}function yl(U){for(var J,Z=[];!(J=U.next()).done;)Z.push(J.value);return Z}function ba(U){var J=-1,Z=Array(U.size);return U.forEach(function(xe,Ce){Z[++J]=[Ce,xe]}),Z}function Oo(U,J){return function(Z){return U(J(Z))}}function An(U,J){for(var Z=-1,xe=U.length,Ce=0,Ge=[];++Z<xe;){var yt=U[Z];(yt===J||yt===w)&&(U[Z]=w,Ge[Ce++]=Z)}return Ge}function ms(U){var J=-1,Z=Array(U.size);return U.forEach(function(xe){Z[++J]=xe}),Z}function _l(U){var J=-1,Z=Array(U.size);return U.forEach(function(xe){Z[++J]=[xe,xe]}),Z}function Ml(U,J,Z){for(var xe=Z-1,Ce=U.length;++xe<Ce;)if(U[xe]===J)return xe;return-1}function kl(U,J,Z){for(var xe=Z+1;xe--;)if(U[xe]===J)return xe;return xe}function qn(U){return dr(U)?Nl(U):ul(U)}function ln(U){return dr(U)?Tl(U):dl(U)}function Ro(U){for(var J=U.length;J--&&Za.test(U.charAt(J)););return J}var jl=pa(sl);function Nl(U){for(var J=oa.lastIndex=0;oa.test(U);)++J;return J}function Tl(U){return U.match(oa)||[]}function Lo(U){return U.match(ia)||[]}var El=(function U(J){J=J==null?wt:fr.defaults(wt.Object(),J,fr.pick(wt,xo));var Z=J.Array,xe=J.Date,Ce=J.Error,Ge=J.Function,yt=J.Math,nt=J.Object,wa=J.RegExp,Fo=J.String,Kt=J.TypeError,gs=Z.prototype,Cl=Ge.prototype,pr=nt.prototype,xs=J["__core-js_shared__"],bs=Cl.toString,Ke=pr.hasOwnProperty,Il=0,Po=(function(){var e=/[^.]+$/.exec(xs&&xs.keys&&xs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Nt=pr.toString,Sl=bs.call(nt),Al=wt._,Dl=wa("^"+bs.call(Ke).replace(as,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ws=vo?J.Buffer:s,Dn=J.Symbol,vs=J.Uint8Array,Ho=ws?ws.allocUnsafe:s,ys=Oo(nt.getPrototypeOf,nt),zo=nt.create,Uo=pr.propertyIsEnumerable,_s=gs.splice,Bo=Dn?Dn.isConcatSpreadable:s,Lr=Dn?Dn.iterator:s,Gn=Dn?Dn.toStringTag:s,Ms=(function(){try{var e=Br(nt,"defineProperty");return e({},"",{}),e}catch{}})(),$l=J.clearTimeout!==wt.clearTimeout&&J.clearTimeout,Wo=xe&&xe.now!==wt.Date.now&&xe.now,Ol=J.setTimeout!==wt.setTimeout&&J.setTimeout,ks=yt.ceil,js=yt.floor,va=nt.getOwnPropertySymbols,Rl=ws?ws.isBuffer:s,ft=J.isFinite,Ll=gs.join,Fl=Oo(nt.keys,nt),_t=yt.max,St=yt.min,Pl=xe.now,Hl=J.parseInt,l=yt.random,c=gs.reverse,u=Br(J,"DataView"),_=Br(J,"Map"),I=Br(J,"Promise"),F=Br(J,"Set"),W=Br(J,"WeakMap"),X=Br(nt,"create"),ce=W&&new W,se={},ke=Wr(u),be=Wr(_),Xe=Wr(I),Pe=Wr(F),ut=Wr(W),Ct=Dn?Dn.prototype:s,$t=Ct?Ct.valueOf:s,Zt=Ct?Ct.toString:s;function k(e){if(vt(e)&&!Se(e)&&!(e instanceof Oe)){if(e instanceof Vt)return e;if(Ke.call(e,"__wrapped__"))return Hd(e)}return new Vt(e)}var Xn=(function(){function e(){}return function(r){if(!gt(r))return{};if(zo)return zo(r);e.prototype=r;var o=new e;return e.prototype=s,o}})();function mn(){}function Vt(e,r){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=s}k.templateSettings={escape:Gs,evaluate:Ga,interpolate:ss,variable:"",imports:{_:k}},k.prototype=mn.prototype,k.prototype.constructor=k,Vt.prototype=Xn(mn.prototype),Vt.prototype.constructor=Vt;function Oe(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=le,this.__views__=[]}function Fr(){var e=new Oe(this.__wrapped__);return e.__actions__=Qt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Qt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Qt(this.__views__),e}function km(){if(this.__filtered__){var e=new Oe(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function jm(){var e=this.__wrapped__.value(),r=this.__dir__,o=Se(e),d=r<0,M=o?e.length:0,E=Lg(0,M,this.__views__),O=E.start,H=E.end,B=H-O,ne=d?H:O-1,re=this.__iteratees__,oe=re.length,he=0,ye=St(B,this.__takeCount__);if(!o||!d&&M==B&&ye==B)return cd(e,this.__actions__);var Ee=[];e:for(;B--&&he<ye;){ne+=r;for(var Re=-1,je=e[ne];++Re<oe;){var ze=re[Re],We=ze.iteratee,dn=ze.type,qt=We(je);if(dn==Q)je=qt;else if(!qt){if(dn==K)continue e;break e}}Ee[he++]=je}return Ee}Oe.prototype=Xn(mn.prototype),Oe.prototype.constructor=Oe;function Pr(e){var r=-1,o=e==null?0:e.length;for(this.clear();++r<o;){var d=e[r];this.set(d[0],d[1])}}function Nm(){this.__data__=X?X(null):{},this.size=0}function Tm(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}function Em(e){var r=this.__data__;if(X){var o=r[e];return o===g?s:o}return Ke.call(r,e)?r[e]:s}function Cm(e){var r=this.__data__;return X?r[e]!==s:Ke.call(r,e)}function Im(e,r){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=X&&r===s?g:r,this}Pr.prototype.clear=Nm,Pr.prototype.delete=Tm,Pr.prototype.get=Em,Pr.prototype.has=Cm,Pr.prototype.set=Im;function Kn(e){var r=-1,o=e==null?0:e.length;for(this.clear();++r<o;){var d=e[r];this.set(d[0],d[1])}}function Sm(){this.__data__=[],this.size=0}function Am(e){var r=this.__data__,o=Yo(r,e);if(o<0)return!1;var d=r.length-1;return o==d?r.pop():_s.call(r,o,1),--this.size,!0}function Dm(e){var r=this.__data__,o=Yo(r,e);return o<0?s:r[o][1]}function $m(e){return Yo(this.__data__,e)>-1}function Om(e,r){var o=this.__data__,d=Yo(o,e);return d<0?(++this.size,o.push([e,r])):o[d][1]=r,this}Kn.prototype.clear=Sm,Kn.prototype.delete=Am,Kn.prototype.get=Dm,Kn.prototype.has=$m,Kn.prototype.set=Om;function Zn(e){var r=-1,o=e==null?0:e.length;for(this.clear();++r<o;){var d=e[r];this.set(d[0],d[1])}}function Rm(){this.size=0,this.__data__={hash:new Pr,map:new(_||Kn),string:new Pr}}function Lm(e){var r=ri(this,e).delete(e);return this.size-=r?1:0,r}function Fm(e){return ri(this,e).get(e)}function Pm(e){return ri(this,e).has(e)}function Hm(e,r){var o=ri(this,e),d=o.size;return o.set(e,r),this.size+=o.size==d?0:1,this}Zn.prototype.clear=Rm,Zn.prototype.delete=Lm,Zn.prototype.get=Fm,Zn.prototype.has=Pm,Zn.prototype.set=Hm;function Hr(e){var r=-1,o=e==null?0:e.length;for(this.__data__=new Zn;++r<o;)this.add(e[r])}function zm(e){return this.__data__.set(e,g),this}function Um(e){return this.__data__.has(e)}Hr.prototype.add=Hr.prototype.push=zm,Hr.prototype.has=Um;function jn(e){var r=this.__data__=new Kn(e);this.size=r.size}function Bm(){this.__data__=new Kn,this.size=0}function Wm(e){var r=this.__data__,o=r.delete(e);return this.size=r.size,o}function Ym(e){return this.__data__.get(e)}function qm(e){return this.__data__.has(e)}function Gm(e,r){var o=this.__data__;if(o instanceof Kn){var d=o.__data__;if(!_||d.length<f-1)return d.push([e,r]),this.size=++o.size,this;o=this.__data__=new Zn(d)}return o.set(e,r),this.size=o.size,this}jn.prototype.clear=Bm,jn.prototype.delete=Wm,jn.prototype.get=Ym,jn.prototype.has=qm,jn.prototype.set=Gm;function Hu(e,r){var o=Se(e),d=!o&&Yr(e),M=!o&&!d&&br(e),E=!o&&!d&&!M&&Cs(e),O=o||d||M||E,H=O?ma(e.length,Fo):[],B=H.length;for(var ne in e)(r||Ke.call(e,ne))&&!(O&&(ne=="length"||M&&(ne=="offset"||ne=="parent")||E&&(ne=="buffer"||ne=="byteLength"||ne=="byteOffset")||Jn(ne,B)))&&H.push(ne);return H}function zu(e){var r=e.length;return r?e[Vl(0,r-1)]:s}function Xm(e,r){return si(Qt(e),zr(r,0,e.length))}function Km(e){return si(Qt(e))}function zl(e,r,o){(o!==s&&!Tn(e[r],o)||o===s&&!(r in e))&&$n(e,r,o)}function ya(e,r,o){var d=e[r];(!(Ke.call(e,r)&&Tn(d,o))||o===s&&!(r in e))&&$n(e,r,o)}function Yo(e,r){for(var o=e.length;o--;)if(Tn(e[o][0],r))return o;return-1}function Zm(e,r,o,d){return hr(e,function(M,E,O){r(d,M,o(M),O)}),d}function Uu(e,r){return e&&Rn(r,At(r),e)}function Vm(e,r){return e&&Rn(r,en(r),e)}function $n(e,r,o){r=="__proto__"&&Ms?Ms(e,r,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[r]=o}function Ul(e,r){for(var o=-1,d=r.length,M=Z(d),E=e==null;++o<d;)M[o]=E?s:Mc(e,r[o]);return M}function zr(e,r,o){return e===e&&(o!==s&&(e=e<=o?e:o),r!==s&&(e=e>=r?e:r)),e}function gn(e,r,o,d,M,E){var O,H=r&v,B=r&y,ne=r&C;if(o&&(O=M?o(e,d,M,E):o(e)),O!==s)return O;if(!gt(e))return e;var re=Se(e);if(re){if(O=Pg(e),!H)return Qt(e,O)}else{var oe=zt(e),he=oe==Je||oe==rn;if(br(e))return fd(e,H);if(oe==st||oe==De||he&&!M){if(O=B||he?{}:Sd(e),!H)return B?Eg(e,Vm(O,e)):Tg(e,Uu(O,e))}else{if(!tt[oe])return M?e:{};O=Hg(e,oe,H)}}E||(E=new jn);var ye=E.get(e);if(ye)return ye;E.set(e,O),of(e)?e.forEach(function(je){O.add(gn(je,r,o,je,e,E))}):sf(e)&&e.forEach(function(je,ze){O.set(ze,gn(je,r,o,ze,e,E))});var Ee=ne?B?lc:ic:B?en:At,Re=re?s:Ee(e);return Ht(Re||e,function(je,ze){Re&&(ze=je,je=e[ze]),ya(O,ze,gn(je,r,o,ze,e,E))}),O}function Qm(e){var r=At(e);return function(o){return Bu(o,e,r)}}function Bu(e,r,o){var d=o.length;if(e==null)return!d;for(e=nt(e);d--;){var M=o[d],E=r[M],O=e[M];if(O===s&&!(M in e)||!E(O))return!1}return!0}function Wu(e,r,o){if(typeof e!="function")throw new Kt(x);return Ea(function(){e.apply(s,o)},r)}function _a(e,r,o,d){var M=-1,E=Or,O=!0,H=e.length,B=[],ne=r.length;if(!H)return B;o&&(r=it(r,Bt(o))),d?(E=fs,O=!1):r.length>=f&&(E=Rr,O=!1,r=new Hr(r));e:for(;++M<H;){var re=e[M],oe=o==null?re:o(re);if(re=d||re!==0?re:0,O&&oe===oe){for(var he=ne;he--;)if(r[he]===oe)continue e;B.push(re)}else E(r,oe,d)||B.push(re)}return B}var hr=xd(On),Yu=xd(Wl,!0);function Jm(e,r){var o=!0;return hr(e,function(d,M,E){return o=!!r(d,M,E),o}),o}function qo(e,r,o){for(var d=-1,M=e.length;++d<M;){var E=e[d],O=r(E);if(O!=null&&(H===s?O===O&&!un(O):o(O,H)))var H=O,B=E}return B}function eg(e,r,o,d){var M=e.length;for(o=Ae(o),o<0&&(o=-o>M?0:M+o),d=d===s||d>M?M:Ae(d),d<0&&(d+=M),d=o>d?0:cf(d);o<d;)e[o++]=r;return e}function qu(e,r){var o=[];return hr(e,function(d,M,E){r(d,M,E)&&o.push(d)}),o}function Ot(e,r,o,d,M){var E=-1,O=e.length;for(o||(o=Ug),M||(M=[]);++E<O;){var H=e[E];r>0&&o(H)?r>1?Ot(H,r-1,o,d,M):kn(M,H):d||(M[M.length]=H)}return M}var Bl=bd(),Gu=bd(!0);function On(e,r){return e&&Bl(e,r,At)}function Wl(e,r){return e&&Gu(e,r,At)}function Go(e,r){return Mn(r,function(o){return er(e[o])})}function Ur(e,r){r=gr(r,e);for(var o=0,d=r.length;e!=null&&o<d;)e=e[Nn(r[o++])];return o&&o==d?e:s}function Xu(e,r,o){var d=r(e);return Se(e)?d:kn(d,o(e))}function Wt(e){return e==null?e===s?Tr:Bn:Gn&&Gn in nt(e)?Rg(e):Kg(e)}function Yl(e,r){return e>r}function tg(e,r){return e!=null&&Ke.call(e,r)}function ng(e,r){return e!=null&&r in nt(e)}function rg(e,r,o){return e>=St(r,o)&&e<_t(r,o)}function ql(e,r,o){for(var d=o?fs:Or,M=e[0].length,E=e.length,O=E,H=Z(E),B=1/0,ne=[];O--;){var re=e[O];O&&r&&(re=it(re,Bt(r))),B=St(re.length,B),H[O]=!o&&(r||M>=120&&re.length>=120)?new Hr(O&&re):s}re=e[0];var oe=-1,he=H[0];e:for(;++oe<M&&ne.length<B;){var ye=re[oe],Ee=r?r(ye):ye;if(ye=o||ye!==0?ye:0,!(he?Rr(he,Ee):d(ne,Ee,o))){for(O=E;--O;){var Re=H[O];if(!(Re?Rr(Re,Ee):d(e[O],Ee,o)))continue e}he&&he.push(Ee),ne.push(ye)}}return ne}function sg(e,r,o,d){return On(e,function(M,E,O){r(d,o(M),E,O)}),d}function Ma(e,r,o){r=gr(r,e),e=Od(e,r);var d=e==null?e:e[Nn(bn(r))];return d==null?s:Ut(d,e,o)}function Ku(e){return vt(e)&&Wt(e)==De}function ag(e){return vt(e)&&Wt(e)==Cr}function og(e){return vt(e)&&Wt(e)==ae}function ka(e,r,o,d,M){return e===r?!0:e==null||r==null||!vt(e)&&!vt(r)?e!==e&&r!==r:ig(e,r,o,d,ka,M)}function ig(e,r,o,d,M,E){var O=Se(e),H=Se(r),B=O?Qe:zt(e),ne=H?Qe:zt(r);B=B==De?st:B,ne=ne==De?st:ne;var re=B==st,oe=ne==st,he=B==ne;if(he&&br(e)){if(!br(r))return!1;O=!0,re=!1}if(he&&!re)return E||(E=new jn),O||Cs(e)?Ed(e,r,o,d,M,E):$g(e,r,B,o,d,M,E);if(!(o&j)){var ye=re&&Ke.call(e,"__wrapped__"),Ee=oe&&Ke.call(r,"__wrapped__");if(ye||Ee){var Re=ye?e.value():e,je=Ee?r.value():r;return E||(E=new jn),M(Re,je,o,d,E)}}return he?(E||(E=new jn),Og(e,r,o,d,M,E)):!1}function lg(e){return vt(e)&&zt(e)==ht}function Gl(e,r,o,d){var M=o.length,E=M,O=!d;if(e==null)return!E;for(e=nt(e);M--;){var H=o[M];if(O&&H[2]?H[1]!==e[H[0]]:!(H[0]in e))return!1}for(;++M<E;){H=o[M];var B=H[0],ne=e[B],re=H[1];if(O&&H[2]){if(ne===s&&!(B in e))return!1}else{var oe=new jn;if(d)var he=d(ne,re,B,e,r,oe);if(!(he===s?ka(re,ne,j|N,d,oe):he))return!1}}return!0}function Zu(e){if(!gt(e)||Wg(e))return!1;var r=er(e)?Dl:Hi;return r.test(Wr(e))}function cg(e){return vt(e)&&Wt(e)==Le}function ug(e){return vt(e)&&zt(e)==It}function dg(e){return vt(e)&&ui(e.length)&&!!at[Wt(e)]}function Vu(e){return typeof e=="function"?e:e==null?tn:typeof e=="object"?Se(e)?ed(e[0],e[1]):Ju(e):yf(e)}function Xl(e){if(!Ta(e))return Fl(e);var r=[];for(var o in nt(e))Ke.call(e,o)&&o!="constructor"&&r.push(o);return r}function fg(e){if(!gt(e))return Xg(e);var r=Ta(e),o=[];for(var d in e)d=="constructor"&&(r||!Ke.call(e,d))||o.push(d);return o}function Kl(e,r){return e<r}function Qu(e,r){var o=-1,d=Jt(e)?Z(e.length):[];return hr(e,function(M,E,O){d[++o]=r(M,E,O)}),d}function Ju(e){var r=uc(e);return r.length==1&&r[0][2]?Dd(r[0][0],r[0][1]):function(o){return o===e||Gl(o,e,r)}}function ed(e,r){return fc(e)&&Ad(r)?Dd(Nn(e),r):function(o){var d=Mc(o,e);return d===s&&d===r?kc(o,e):ka(r,d,j|N)}}function Xo(e,r,o,d,M){e!==r&&Bl(r,function(E,O){if(M||(M=new jn),gt(E))pg(e,r,O,o,Xo,d,M);else{var H=d?d(hc(e,O),E,O+"",e,r,M):s;H===s&&(H=E),zl(e,O,H)}},en)}function pg(e,r,o,d,M,E,O){var H=hc(e,o),B=hc(r,o),ne=O.get(B);if(ne){zl(e,o,ne);return}var re=E?E(H,B,o+"",e,r,O):s,oe=re===s;if(oe){var he=Se(B),ye=!he&&br(B),Ee=!he&&!ye&&Cs(B);re=B,he||ye||Ee?Se(H)?re=H:Mt(H)?re=Qt(H):ye?(oe=!1,re=fd(B,!0)):Ee?(oe=!1,re=pd(B,!0)):re=[]:Ca(B)||Yr(B)?(re=H,Yr(H)?re=uf(H):(!gt(H)||er(H))&&(re=Sd(B))):oe=!1}oe&&(O.set(B,re),M(re,B,d,E,O),O.delete(B)),zl(e,o,re)}function td(e,r){var o=e.length;if(o)return r+=r<0?o:0,Jn(r,o)?e[r]:s}function nd(e,r,o){r.length?r=it(r,function(E){return Se(E)?function(O){return Ur(O,E.length===1?E[0]:E)}:E}):r=[tn];var d=-1;r=it(r,Bt(Te()));var M=Qu(e,function(E,O,H){var B=it(r,function(ne){return ne(E)});return{criteria:B,index:++d,value:E}});return hl(M,function(E,O){return Ng(E,O,o)})}function hg(e,r){return rd(e,r,function(o,d){return kc(e,d)})}function rd(e,r,o){for(var d=-1,M=r.length,E={};++d<M;){var O=r[d],H=Ur(e,O);o(H,O)&&ja(E,gr(O,e),H)}return E}function mg(e){return function(r){return Ur(r,e)}}function Zl(e,r,o,d){var M=d?pl:ur,E=-1,O=r.length,H=e;for(e===r&&(r=Qt(r)),o&&(H=it(e,Bt(o)));++E<O;)for(var B=0,ne=r[E],re=o?o(ne):ne;(B=M(H,re,B,d))>-1;)H!==e&&_s.call(H,B,1),_s.call(e,B,1);return e}function sd(e,r){for(var o=e?r.length:0,d=o-1;o--;){var M=r[o];if(o==d||M!==E){var E=M;Jn(M)?_s.call(e,M,1):ec(e,M)}}return e}function Vl(e,r){return e+js(l()*(r-e+1))}function gg(e,r,o,d){for(var M=-1,E=_t(ks((r-e)/(o||1)),0),O=Z(E);E--;)O[d?E:++M]=e,e+=o;return O}function Ql(e,r){var o="";if(!e||r<1||r>we)return o;do r%2&&(o+=e),r=js(r/2),r&&(e+=e);while(r);return o}function Fe(e,r){return mc($d(e,r,tn),e+"")}function xg(e){return zu(Is(e))}function bg(e,r){var o=Is(e);return si(o,zr(r,0,o.length))}function ja(e,r,o,d){if(!gt(e))return e;r=gr(r,e);for(var M=-1,E=r.length,O=E-1,H=e;H!=null&&++M<E;){var B=Nn(r[M]),ne=o;if(B==="__proto__"||B==="constructor"||B==="prototype")return e;if(M!=O){var re=H[B];ne=d?d(re,B,H):s,ne===s&&(ne=gt(re)?re:Jn(r[M+1])?[]:{})}ya(H,B,ne),H=H[B]}return e}var ad=ce?function(e,r){return ce.set(e,r),e}:tn,wg=Ms?function(e,r){return Ms(e,"toString",{configurable:!0,enumerable:!1,value:Nc(r),writable:!0})}:tn;function vg(e){return si(Is(e))}function xn(e,r,o){var d=-1,M=e.length;r<0&&(r=-r>M?0:M+r),o=o>M?M:o,o<0&&(o+=M),M=r>o?0:o-r>>>0,r>>>=0;for(var E=Z(M);++d<M;)E[d]=e[d+r];return E}function yg(e,r){var o;return hr(e,function(d,M,E){return o=r(d,M,E),!o}),!!o}function Ko(e,r,o){var d=0,M=e==null?d:e.length;if(typeof r=="number"&&r===r&&M<=V){for(;d<M;){var E=d+M>>>1,O=e[E];O!==null&&!un(O)&&(o?O<=r:O<r)?d=E+1:M=E}return M}return Jl(e,r,tn,o)}function Jl(e,r,o,d){var M=0,E=e==null?0:e.length;if(E===0)return 0;r=o(r);for(var O=r!==r,H=r===null,B=un(r),ne=r===s;M<E;){var re=js((M+E)/2),oe=o(e[re]),he=oe!==s,ye=oe===null,Ee=oe===oe,Re=un(oe);if(O)var je=d||Ee;else ne?je=Ee&&(d||he):H?je=Ee&&he&&(d||!ye):B?je=Ee&&he&&!ye&&(d||!Re):ye||Re?je=!1:je=d?oe<=r:oe<r;je?M=re+1:E=re}return St(E,de)}function od(e,r){for(var o=-1,d=e.length,M=0,E=[];++o<d;){var O=e[o],H=r?r(O):O;if(!o||!Tn(H,B)){var B=H;E[M++]=O===0?0:O}}return E}function id(e){return typeof e=="number"?e:un(e)?pe:+e}function cn(e){if(typeof e=="string")return e;if(Se(e))return it(e,cn)+"";if(un(e))return Zt?Zt.call(e):"";var r=e+"";return r=="0"&&1/e==-ue?"-0":r}function mr(e,r,o){var d=-1,M=Or,E=e.length,O=!0,H=[],B=H;if(o)O=!1,M=fs;else if(E>=f){var ne=r?null:Ag(e);if(ne)return ms(ne);O=!1,M=Rr,B=new Hr}else B=r?[]:H;e:for(;++d<E;){var re=e[d],oe=r?r(re):re;if(re=o||re!==0?re:0,O&&oe===oe){for(var he=B.length;he--;)if(B[he]===oe)continue e;r&&B.push(oe),H.push(re)}else M(B,oe,o)||(B!==H&&B.push(oe),H.push(re))}return H}function ec(e,r){r=gr(r,e);var o=-1,d=r.length;if(!d)return!0;for(;++o<d;){var M=Nn(r[o]);if(M==="__proto__"&&!Ke.call(e,"__proto__")||(M==="constructor"||M==="prototype")&&o<d-1)return!1}var E=Od(e,r);return E==null||delete E[Nn(bn(r))]}function ld(e,r,o,d){return ja(e,r,o(Ur(e,r)),d)}function Zo(e,r,o,d){for(var M=e.length,E=d?M:-1;(d?E--:++E<M)&&r(e[E],E,e););return o?xn(e,d?0:E,d?E+1:M):xn(e,d?E+1:0,d?M:E)}function cd(e,r){var o=e;return o instanceof Oe&&(o=o.value()),ps(r,function(d,M){return M.func.apply(M.thisArg,kn([d],M.args))},o)}function tc(e,r,o){var d=e.length;if(d<2)return d?mr(e[0]):[];for(var M=-1,E=Z(d);++M<d;)for(var O=e[M],H=-1;++H<d;)H!=M&&(E[M]=_a(E[M]||O,e[H],r,o));return mr(Ot(E,1),r,o)}function ud(e,r,o){for(var d=-1,M=e.length,E=r.length,O={};++d<M;){var H=d<E?r[d]:s;o(O,e[d],H)}return O}function nc(e){return Mt(e)?e:[]}function rc(e){return typeof e=="function"?e:tn}function gr(e,r){return Se(e)?e:fc(e,r)?[e]:Pd(et(e))}var _g=Fe;function xr(e,r,o){var d=e.length;return o=o===s?d:o,!r&&o>=d?e:xn(e,r,o)}var dd=$l||function(e){return wt.clearTimeout(e)};function fd(e,r){if(r)return e.slice();var o=e.length,d=Ho?Ho(o):new e.constructor(o);return e.copy(d),d}function sc(e){var r=new e.constructor(e.byteLength);return new vs(r).set(new vs(e)),r}function Mg(e,r){var o=r?sc(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function kg(e){var r=new e.constructor(e.source,Ja.exec(e));return r.lastIndex=e.lastIndex,r}function jg(e){return $t?nt($t.call(e)):{}}function pd(e,r){var o=r?sc(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function hd(e,r){if(e!==r){var o=e!==s,d=e===null,M=e===e,E=un(e),O=r!==s,H=r===null,B=r===r,ne=un(r);if(!H&&!ne&&!E&&e>r||E&&O&&B&&!H&&!ne||d&&O&&B||!o&&B||!M)return 1;if(!d&&!E&&!ne&&e<r||ne&&o&&M&&!d&&!E||H&&o&&M||!O&&M||!B)return-1}return 0}function Ng(e,r,o){for(var d=-1,M=e.criteria,E=r.criteria,O=M.length,H=o.length;++d<O;){var B=hd(M[d],E[d]);if(B){if(d>=H)return B;var ne=o[d];return B*(ne=="desc"?-1:1)}}return e.index-r.index}function md(e,r,o,d){for(var M=-1,E=e.length,O=o.length,H=-1,B=r.length,ne=_t(E-O,0),re=Z(B+ne),oe=!d;++H<B;)re[H]=r[H];for(;++M<O;)(oe||M<E)&&(re[o[M]]=e[M]);for(;ne--;)re[H++]=e[M++];return re}function gd(e,r,o,d){for(var M=-1,E=e.length,O=-1,H=o.length,B=-1,ne=r.length,re=_t(E-H,0),oe=Z(re+ne),he=!d;++M<re;)oe[M]=e[M];for(var ye=M;++B<ne;)oe[ye+B]=r[B];for(;++O<H;)(he||M<E)&&(oe[ye+o[O]]=e[M++]);return oe}function Qt(e,r){var o=-1,d=e.length;for(r||(r=Z(d));++o<d;)r[o]=e[o];return r}function Rn(e,r,o,d){var M=!o;o||(o={});for(var E=-1,O=r.length;++E<O;){var H=r[E],B=d?d(o[H],e[H],H,o,e):s;B===s&&(B=e[H]),M?$n(o,H,B):ya(o,H,B)}return o}function Tg(e,r){return Rn(e,dc(e),r)}function Eg(e,r){return Rn(e,Cd(e),r)}function Vo(e,r){return function(o,d){var M=Se(o)?To:Zm,E=r?r():{};return M(o,e,Te(d,2),E)}}function Ns(e){return Fe(function(r,o){var d=-1,M=o.length,E=M>1?o[M-1]:s,O=M>2?o[2]:s;for(E=e.length>3&&typeof E=="function"?(M--,E):s,O&&Yt(o[0],o[1],O)&&(E=M<3?s:E,M=1),r=nt(r);++d<M;){var H=o[d];H&&e(r,H,d,E)}return r})}function xd(e,r){return function(o,d){if(o==null)return o;if(!Jt(o))return e(o,d);for(var M=o.length,E=r?M:-1,O=nt(o);(r?E--:++E<M)&&d(O[E],E,O)!==!1;);return o}}function bd(e){return function(r,o,d){for(var M=-1,E=nt(r),O=d(r),H=O.length;H--;){var B=O[e?H:++M];if(o(E[B],B,E)===!1)break}return r}}function Cg(e,r,o){var d=r&T,M=Na(e);function E(){var O=this&&this!==wt&&this instanceof E?M:e;return O.apply(d?o:this,arguments)}return E}function wd(e){return function(r){r=et(r);var o=dr(r)?ln(r):s,d=o?o[0]:r.charAt(0),M=o?xr(o,1).join(""):r.slice(1);return d[e]()+M}}function Ts(e){return function(r){return ps(wf(bf(r).replace(on,"")),e,"")}}function Na(e){return function(){var r=arguments;switch(r.length){case 0:return new e;case 1:return new e(r[0]);case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[1],r[2]);case 4:return new e(r[0],r[1],r[2],r[3]);case 5:return new e(r[0],r[1],r[2],r[3],r[4]);case 6:return new e(r[0],r[1],r[2],r[3],r[4],r[5]);case 7:return new e(r[0],r[1],r[2],r[3],r[4],r[5],r[6])}var o=Xn(e.prototype),d=e.apply(o,r);return gt(d)?d:o}}function Ig(e,r,o){var d=Na(e);function M(){for(var E=arguments.length,O=Z(E),H=E,B=Es(M);H--;)O[H]=arguments[H];var ne=E<3&&O[0]!==B&&O[E-1]!==B?[]:An(O,B);if(E-=ne.length,E<o)return kd(e,r,Qo,M.placeholder,s,O,ne,s,s,o-E);var re=this&&this!==wt&&this instanceof M?d:e;return Ut(re,this,O)}return M}function vd(e){return function(r,o,d){var M=nt(r);if(!Jt(r)){var E=Te(o,3);r=At(r),o=function(H){return E(M[H],H,M)}}var O=e(r,o,d);return O>-1?M[E?r[O]:O]:s}}function yd(e){return Qn(function(r){var o=r.length,d=o,M=Vt.prototype.thru;for(e&&r.reverse();d--;){var E=r[d];if(typeof E!="function")throw new Kt(x);if(M&&!O&&ni(E)=="wrapper")var O=new Vt([],!0)}for(d=O?d:o;++d<o;){E=r[d];var H=ni(E),B=H=="wrapper"?cc(E):s;B&&pc(B[0])&&B[1]==(q|$|P|Y)&&!B[4].length&&B[9]==1?O=O[ni(B[0])].apply(O,B[3]):O=E.length==1&&pc(E)?O[H]():O.thru(E)}return function(){var ne=arguments,re=ne[0];if(O&&ne.length==1&&Se(re))return O.plant(re).value();for(var oe=0,he=o?r[oe].apply(this,ne):re;++oe<o;)he=r[oe].call(this,he);return he}})}function Qo(e,r,o,d,M,E,O,H,B,ne){var re=r&q,oe=r&T,he=r&A,ye=r&($|L),Ee=r&z,Re=he?s:Na(e);function je(){for(var ze=arguments.length,We=Z(ze),dn=ze;dn--;)We[dn]=arguments[dn];if(ye)var qt=Es(je),fn=gl(We,qt);if(d&&(We=md(We,d,M,ye)),E&&(We=gd(We,E,O,ye)),ze-=fn,ye&&ze<ne){var kt=An(We,qt);return kd(e,r,Qo,je.placeholder,o,We,kt,H,B,ne-ze)}var En=oe?o:this,nr=he?En[e]:e;return ze=We.length,H?We=Zg(We,H):Ee&&ze>1&&We.reverse(),re&&B<ze&&(We.length=B),this&&this!==wt&&this instanceof je&&(nr=Re||Na(nr)),nr.apply(En,We)}return je}function _d(e,r){return function(o,d){return sg(o,e,r(d),{})}}function Jo(e,r){return function(o,d){var M;if(o===s&&d===s)return r;if(o!==s&&(M=o),d!==s){if(M===s)return d;typeof o=="string"||typeof d=="string"?(o=cn(o),d=cn(d)):(o=id(o),d=id(d)),M=e(o,d)}return M}}function ac(e){return Qn(function(r){return r=it(r,Bt(Te())),Fe(function(o){var d=this;return e(r,function(M){return Ut(M,d,o)})})})}function ei(e,r){r=r===s?" ":cn(r);var o=r.length;if(o<2)return o?Ql(r,e):r;var d=Ql(r,ks(e/qn(r)));return dr(r)?xr(ln(d),0,e).join(""):d.slice(0,e)}function Sg(e,r,o,d){var M=r&T,E=Na(e);function O(){for(var H=-1,B=arguments.length,ne=-1,re=d.length,oe=Z(re+B),he=this&&this!==wt&&this instanceof O?E:e;++ne<re;)oe[ne]=d[ne];for(;B--;)oe[ne++]=arguments[++H];return Ut(he,M?o:this,oe)}return O}function Md(e){return function(r,o,d){return d&&typeof d!="number"&&Yt(r,o,d)&&(o=d=s),r=tr(r),o===s?(o=r,r=0):o=tr(o),d=d===s?r<o?1:-1:tr(d),gg(r,o,d,e)}}function ti(e){return function(r,o){return typeof r=="string"&&typeof o=="string"||(r=wn(r),o=wn(o)),e(r,o)}}function kd(e,r,o,d,M,E,O,H,B,ne){var re=r&$,oe=re?O:s,he=re?s:O,ye=re?E:s,Ee=re?s:E;r|=re?P:D,r&=~(re?D:P),r&R||(r&=-4);var Re=[e,r,M,ye,oe,Ee,he,H,B,ne],je=o.apply(s,Re);return pc(e)&&Rd(je,Re),je.placeholder=d,Ld(je,e,r)}function oc(e){var r=yt[e];return function(o,d){if(o=wn(o),d=d==null?0:St(Ae(d),292),d&&ft(o)){var M=(et(o)+"e").split("e"),E=r(M[0]+"e"+(+M[1]+d));return M=(et(E)+"e").split("e"),+(M[0]+"e"+(+M[1]-d))}return r(o)}}var Ag=F&&1/ms(new F([,-0]))[1]==ue?function(e){return new F(e)}:Cc;function jd(e){return function(r){var o=zt(r);return o==ht?ba(r):o==It?_l(r):ml(r,e(r))}}function Vn(e,r,o,d,M,E,O,H){var B=r&A;if(!B&&typeof e!="function")throw new Kt(x);var ne=d?d.length:0;if(ne||(r&=-97,d=M=s),O=O===s?O:_t(Ae(O),0),H=H===s?H:Ae(H),ne-=M?M.length:0,r&D){var re=d,oe=M;d=M=s}var he=B?s:cc(e),ye=[e,r,o,d,M,re,oe,E,O,H];if(he&&Gg(ye,he),e=ye[0],r=ye[1],o=ye[2],d=ye[3],M=ye[4],H=ye[9]=ye[9]===s?B?0:e.length:_t(ye[9]-ne,0),!H&&r&($|L)&&(r&=-25),!r||r==T)var Ee=Cg(e,r,o);else r==$||r==L?Ee=Ig(e,r,H):(r==P||r==(T|P))&&!M.length?Ee=Sg(e,r,o,d):Ee=Qo.apply(s,ye);var Re=he?ad:Rd;return Ld(Re(Ee,ye),e,r)}function Nd(e,r,o,d){return e===s||Tn(e,pr[o])&&!Ke.call(d,o)?r:e}function Td(e,r,o,d,M,E){return gt(e)&>(r)&&(E.set(r,e),Xo(e,r,s,Td,E),E.delete(r)),e}function Dg(e){return Ca(e)?s:e}function Ed(e,r,o,d,M,E){var O=o&j,H=e.length,B=r.length;if(H!=B&&!(O&&B>H))return!1;var ne=E.get(e),re=E.get(r);if(ne&&re)return ne==r&&re==e;var oe=-1,he=!0,ye=o&N?new Hr:s;for(E.set(e,r),E.set(r,e);++oe<H;){var Ee=e[oe],Re=r[oe];if(d)var je=O?d(Re,Ee,oe,r,e,E):d(Ee,Re,oe,e,r,E);if(je!==s){if(je)continue;he=!1;break}if(ye){if(!da(r,function(ze,We){if(!Rr(ye,We)&&(Ee===ze||M(Ee,ze,o,d,E)))return ye.push(We)})){he=!1;break}}else if(!(Ee===Re||M(Ee,Re,o,d,E))){he=!1;break}}return E.delete(e),E.delete(r),he}function $g(e,r,o,d,M,E,O){switch(o){case sn:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case Cr:return!(e.byteLength!=r.byteLength||!E(new vs(e),new vs(r)));case Gt:case ae:case bt:return Tn(+e,+r);case Ft:return e.name==r.name&&e.message==r.message;case Le:case pn:return e==r+"";case ht:var H=ba;case It:var B=d&j;if(H||(H=ms),e.size!=r.size&&!B)return!1;var ne=O.get(e);if(ne)return ne==r;d|=N,O.set(e,r);var re=Ed(H(e),H(r),d,M,E,O);return O.delete(e),re;case mt:if($t)return $t.call(e)==$t.call(r)}return!1}function Og(e,r,o,d,M,E){var O=o&j,H=ic(e),B=H.length,ne=ic(r),re=ne.length;if(B!=re&&!O)return!1;for(var oe=B;oe--;){var he=H[oe];if(!(O?he in r:Ke.call(r,he)))return!1}var ye=E.get(e),Ee=E.get(r);if(ye&&Ee)return ye==r&&Ee==e;var Re=!0;E.set(e,r),E.set(r,e);for(var je=O;++oe<B;){he=H[oe];var ze=e[he],We=r[he];if(d)var dn=O?d(We,ze,he,r,e,E):d(ze,We,he,e,r,E);if(!(dn===s?ze===We||M(ze,We,o,d,E):dn)){Re=!1;break}je||(je=he=="constructor")}if(Re&&!je){var qt=e.constructor,fn=r.constructor;qt!=fn&&"constructor"in e&&"constructor"in r&&!(typeof qt=="function"&&qt instanceof qt&&typeof fn=="function"&&fn instanceof fn)&&(Re=!1)}return E.delete(e),E.delete(r),Re}function Qn(e){return mc($d(e,s,Bd),e+"")}function ic(e){return Xu(e,At,dc)}function lc(e){return Xu(e,en,Cd)}var cc=ce?function(e){return ce.get(e)}:Cc;function ni(e){for(var r=e.name+"",o=se[r],d=Ke.call(se,r)?o.length:0;d--;){var M=o[d],E=M.func;if(E==null||E==e)return M.name}return r}function Es(e){var r=Ke.call(k,"placeholder")?k:e;return r.placeholder}function Te(){var e=k.iteratee||Tc;return e=e===Tc?Vu:e,arguments.length?e(arguments[0],arguments[1]):e}function ri(e,r){var o=e.__data__;return Bg(r)?o[typeof r=="string"?"string":"hash"]:o.map}function uc(e){for(var r=At(e),o=r.length;o--;){var d=r[o],M=e[d];r[o]=[d,M,Ad(M)]}return r}function Br(e,r){var o=wl(e,r);return Zu(o)?o:s}function Rg(e){var r=Ke.call(e,Gn),o=e[Gn];try{e[Gn]=s;var d=!0}catch{}var M=Nt.call(e);return d&&(r?e[Gn]=o:delete e[Gn]),M}var dc=va?function(e){return e==null?[]:(e=nt(e),Mn(va(e),function(r){return Uo.call(e,r)}))}:Ic,Cd=va?function(e){for(var r=[];e;)kn(r,dc(e)),e=ys(e);return r}:Ic,zt=Wt;(u&&zt(new u(new ArrayBuffer(1)))!=sn||_&&zt(new _)!=ht||I&&zt(I.resolve())!=Wn||F&&zt(new F)!=It||W&&zt(new W)!=Er)&&(zt=function(e){var r=Wt(e),o=r==st?e.constructor:s,d=o?Wr(o):"";if(d)switch(d){case ke:return sn;case be:return ht;case Xe:return Wn;case Pe:return It;case ut:return Er}return r});function Lg(e,r,o){for(var d=-1,M=o.length;++d<M;){var E=o[d],O=E.size;switch(E.type){case"drop":e+=O;break;case"dropRight":r-=O;break;case"take":r=St(r,e+O);break;case"takeRight":e=_t(e,r-O);break}}return{start:e,end:r}}function Fg(e){var r=e.match(Qa);return r?r[1].split(cr):[]}function Id(e,r,o){r=gr(r,e);for(var d=-1,M=r.length,E=!1;++d<M;){var O=Nn(r[d]);if(!(E=e!=null&&o(e,O)))break;e=e[O]}return E||++d!=M?E:(M=e==null?0:e.length,!!M&&ui(M)&&Jn(O,M)&&(Se(e)||Yr(e)))}function Pg(e){var r=e.length,o=new e.constructor(r);return r&&typeof e[0]=="string"&&Ke.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function Sd(e){return typeof e.constructor=="function"&&!Ta(e)?Xn(ys(e)):{}}function Hg(e,r,o){var d=e.constructor;switch(r){case Cr:return sc(e);case Gt:case ae:return new d(+e);case sn:return Mg(e,o);case Ir:case In:case hn:case Sr:case es:case ts:case Pt:case Us:case Bs:return pd(e,o);case ht:return new d;case bt:case pn:return new d(e);case Le:return kg(e);case It:return new d;case mt:return jg(e)}}function zg(e,r){var o=r.length;if(!o)return e;var d=o-1;return r[d]=(o>1?"& ":"")+r[d],r=r.join(o>2?", ":" "),e.replace(Va,`{
|
|
@@ -30,4 +30,4 @@ ${x}`:b.head.innerHTML+=`<style>${x}</style>`;let v=(b.doctype?new XMLSerializer
|
|
|
30
30
|
</head>
|
|
31
31
|
<body>${t}</body>
|
|
32
32
|
</html>
|
|
33
|
-
`;f.open(),f.write(p),f.close()};return n.jsx(Ou,{className:"absolute size-full overflow-hidden transition-opacity duration-500",generateContent:s,height:"100%",parentClassName:"relative h-full w-full",width:"100%"})},V8=({selectedLayout:t,accentColor:a,handleColorToggle:s,selectedColor:i,selectedLabels:f,handleLabelClick:p,embedScript:x,handleLayoutSelect:h,handleCopyClick:b,isCopied:g})=>{const{loadData:m}=_h({path:"/labels/",filterKey:"name",responseKey:"labels"}),w=async(v,y)=>{const C=await m(v);y(C.map(j=>({label:j.name,value:j.name})))};return n.jsxs("div",{className:"flex h-[calc(100vh-16vmin)] max-h-[645px] flex-col justify-between overflow-y-scroll border-l border-grey-200 p-6 pb-0 dark:border-grey-900",children:[n.jsxs("div",{children:[n.jsx(lt,{className:"mb-8",level:4,children:"Embed signup form"}),n.jsxs(Ye,{gap:"sm",children:[n.jsxs("div",{className:"flex w-full items-center justify-between",children:[n.jsx("div",{children:"Layout"}),n.jsx(Fn,{activeKey:t,buttons:[{key:"all-in-one",label:"Branded",size:"md",className:"w-auto px-3!",onClick:()=>h("all-in-one")},{key:"minimal",label:"Minimal",size:"md",className:"w-auto px-3!",onClick:()=>h("minimal")}],clearBg:!1})]}),t==="all-in-one"&&n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{hex:"#08090c",title:"Dark",value:"#08090c"},{hex:"#ffffff",title:"Light",value:"#ffffff"},{hex:a||"#d74780",title:"Accent",value:a||"#d74780"}],title:"Background color",value:i,onChange:v=>{v&&s(v)}}),n.jsx(my,{hint:"Will be applied to all members signing up via this form",loadOptions:Ci(w,500),placeholder:"Pick one or more labels (optional)",title:"Labels at signup",values:f||[],async:!0,canCreate:!0,defaultOptions:!0,onChange:p}),n.jsx(or,{className:"text-grey-800",fontStyle:"mono",hint:"Paste this code onto any website where you'd like your signup to appear.",title:"Embed code",value:`${x}`,onChange:()=>{}})]})]}),n.jsx(gy,{height:74,children:n.jsx("div",{className:"flex w-full justify-end",children:n.jsx(Ie,{color:g?"green":"black",label:g?"Copied!":"Copy code",onClick:b})})})]})};function Rp(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}const Lp=({preview:t,config:a,settings:s,labels:i,backgroundColor:f,layout:p})=>{const x=a.blogUrl,h=a.signupForm.url.replace("{version}",a.signupForm.version);let b={site:x,locale:s.locale,"button-color":s.accentColor,"button-text-color":yn(s.accentColor).hex()};for(const[C,j]of i.entries())b[`label-${C+1}`]=j.name;let g="min-height: 58px;max-width: 440px;margin: 0 auto;width: 100%";p==="all-in-one"&&(s.icon&&s.icon!==""&&(b.icon=s.icon.replace(/\/content\/images\//,"/content/images/size/w192h192/")),b.title=s.title,b.description=s.description,b["background-color"]=f,b["text-color"]=yn(f).hex(),g="height: 40vmin;min-height: 360px"),t&&(p==="minimal"?g="min-height: 58px; max-width: 440px;width: 100%;position: absolute; left: 50%; top:50%; transform: translate(-50%, -50%);":g="height: 100vh");let m="";const w=["background-color","text-color","button-color","button-text-color","title","description","icon","site","locale"],v=Object.keys(b).sort((C,j)=>w.indexOf(C)-w.indexOf(j));for(const C of v){const j=b[C];m+=` data-${C}="${Rp(j)}"`}const y=`<div style="${Rp(g)}"><script src="${encodeURI(h)}"${m} async><\/script></div>`;return t&&p==="minimal"?`<div style="position: absolute; z-index: -1; top: 0; left: 0; width: 100%; height: 100%; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);background-size: 16px 16px;background-position: 0 0, 8px 8px;;"></div>${y}`:y},Q8=ge.create(()=>{const[t,a]=S.useState("#08090c"),[s,i]=S.useState([]),[f,p]=S.useState("all-in-one"),[x,h]=S.useState(""),[b,g]=S.useState(""),[m,w]=S.useState(!1),{updateRoute:v}=He(),{config:y}=Ue(),{localSettings:C,siteData:j}=Xr(),[N,T,A,R,$]=ot(C,["accent_color","title","description","locale","icon"]),[L,P]=S.useState({active:!1});S.useEffect(()=>{if(!j)return;const z={config:{blogUrl:j.url,signupForm:{url:y?.signupForm?.url,version:y?.signupForm?.version}},settings:{accentColor:N||"#d74780",title:T||"",locale:R||"en",icon:$||"",description:A||""},labels:s.map(({label:fe})=>({name:fe})),backgroundColor:t||"#08090c",layout:f},G=Lp({preview:!0,...z});h(G);const te=Lp({preview:!1,...z});g(te)},[j,N,s,y,T,t,f,R,$,A]);const D=async()=>{try{await navigator.clipboard.writeText(b),w(!0),setTimeout(()=>w(!1),2e3)}catch(z){console.error("Failed to copy text: ",z)}},q=z=>{a(z)},Y=z=>{if(z?.length){const G=z?.map(({value:te})=>({label:te,value:te}));i(G)}else i([])};return n.jsx(ct,{afterClose:()=>{v("embed-signup-form")},cancelLabel:"",footer:!1,height:645,padding:!1,testId:"embed-signup-form",title:"",topRightContent:"close",width:1120,children:n.jsxs("div",{className:"grid grid-cols-[5.2fr_2.8fr]",children:[n.jsx(Z8,{html:x,style:f}),n.jsx(V8,{accentColor:N,customColor:L,embedScript:b,handleColorToggle:q,handleCopyClick:D,handleLabelClick:Y,handleLayoutSelect:p,isCopied:m,selectedColor:t,selectedLabels:s,selectedLayout:f,setCustomColor:P})]})})}),J8=ge.create(()=>{const{updateRoute:t}=He(),{settings:a}=Ue(),{mutateAsync:s}=jr(),i=Ze(),[f,p]=S.useState(""),[x]=ot(a,["firstpromoter"]),[h]=ot(a,["firstpromoter_id"]),[b,g]=S.useState("Save"),[m,w]=S.useState(!!x);S.useEffect(()=>{w(x||!1),p(h||null)},[x,h]);const v=async()=>{const y=[{key:"firstpromoter",value:m},{key:"firstpromoter_id",value:f}];try{g("Saving..."),await Promise.all([s(y),new Promise(C=>{setTimeout(C,1e3)})]),g("Saved")}catch(C){i(C)}finally{setTimeout(()=>g("Save"),1e3)}};return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:m!==x||f!==h,okColor:b==="Saved"?"green":"black",okLabel:b,testId:"firstpromoter-modal",title:"",onOk:async()=>{try{await v()}catch(y){i(y)}},children:[n.jsx(Jr,{detail:"Launch your own member referral program",icon:n.jsx(qe,{className:"-mt-2",name:"firstpromoter",size:56}),title:"FirstPromoter"}),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{marginBottom:!1,title:"FirstPromoter configuration",grouped:!0,children:[n.jsx(Be,{checked:m,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://firstpromoter.com/?fpr=ghost&fp_sid=admin",rel:"noopener noreferrer",target:"_blank",children:"FirstPromoter"})," for tracking referrals"]}),label:"Enable FirstPromoter",onChange:y=>{w(y.target.checked)}}),m&&n.jsx(_e,{hint:n.jsxs(n.Fragment,{children:["Affiliate and referral tracking, find your ID ",n.jsx("a",{className:"text-green",href:"https://ghost.org/help/firstpromoter-id/",rel:"noopener noreferrer",target:"_blank",children:"here"})]}),placeholder:"XXXXXXXX",title:"FirstPromoter account ID",value:f||"",onChange:y=>{p(y.target.value)}})]})})]})}),e2="ActionsResponseType",t2=Ov({dataType:e2,path:"/actions/",returnData:t=>{const{pages:a}=t;let s=a.flatMap(p=>p.actions.map(({context:x,...h})=>({...h,context:JSON.parse(x)})));s=s.reverse();let i=1;s.forEach((p,x)=>{const h=s[x+1];h&&p.resource_id===h.resource_id&&p.event===h.event?(p.skip=!0,i+=1):i>1&&(p.count=i,i=1)});const f=a[a.length-1].meta;return{actions:s.reverse(),meta:f,isEnd:f?f.pagination.pages===f.pagination.page:!0}}}),n2=t=>{let a=t.resource_type;if(t.event!=="deleted")switch(t.resource_type){case"page":case"post":return!t.resource||!t.resource.id?void 0:(a==="post"&&t.context?.type&&(a=t.context?.type),{isExternal:!0,route:`editor/${a}/${t.resource.id}`,models:[a,t.resource.id]});case"integration":return!t.resource||!t.resource.id?void 0:{route:`integrations/${t.resource.id}`};case"offer":return!t.resource||!t.resource.id?void 0:{isExternal:!0,route:`offers/${t.resource.id}`,models:[t.resource.id]};case"tag":return!t.resource||!t.resource.slug?void 0:{isExternal:!0,route:"tag",models:[t.resource.slug]};case"product":return{route:"tiers"};case"user":return!t.resource||!t.resource.slug?void 0:{route:`staff/${t.resource.slug}`}}},r2=t=>{let a=t.resource_type;a==="api_key"?a="API key":a==="setting"?a="settings":a==="product"&&(a="tier"),a==="post"&&t.context?.type&&(a=t.context?.type);let s=t.event;return t.event==="edited"&&t.context?.action_name&&(s=t.context?.action_name),t.context?.count&&t.context?.count>1?`${t.context?.count} ${a}s ${s}`:`${a.slice(0,1).toUpperCase()}${a.slice(1)} ${s}`},s2=t=>{if(t.resource_type==="setting"&&t.context?.group&&t.context?.key)return{group:t.context?.group,key:t.context?.key}},Fp=t=>typeof t.context?.count=="number"&&t.context?.count>1,a2=({action:t})=>{let a="pen";switch(t.event){case"added":a="add";break;case"deleted":a="trash";break}return n.jsx(qe,{name:a,size:"xs"})},o2=({action:t})=>n.jsxs("div",{className:"relative shrink-0",children:[n.jsx(Mh,{bgColor:jh(t.actor?.name||t.actor?.slug||""),image:t.actor?.image??void 0,label:kh(t.actor?.name||t.actor?.slug),labelColor:"white",size:"md"}),n.jsx("div",{className:"absolute -right-1 -bottom-1 z-30 flex items-center justify-center rounded-full border border-grey-100 bg-white p-1 shadow-sm dark:border-grey-900 dark:bg-black",children:n.jsx(a2,{action:t})})]}),vr=({label:t,item:a,excludedItems:s,toggleItem:i})=>n.jsx(Be,{checked:!s.includes(a),direction:"rtl",label:t,labelClasses:"text-sm",onChange:f=>i(a,f.target.checked)}),i2=({excludedEvents:t,excludedResources:a,toggleEventType:s,toggleResourceType:i})=>{const{updateRoute:f}=He(),p=_h({path:"/users/",filterKey:"name",responseKey:"users"}),x=async(m,w)=>{const v=await p.loadData(m);w(v.map(y=>({label:y.name,value:y.id})))},[h,b]=S.useState(),g=()=>{b(null)};return n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx(Du,{position:"end",trigger:n.jsx(Ie,{color:"outline",label:"Filter"}),children:n.jsxs("div",{className:"flex w-[220px] flex-col gap-8 p-5",children:[n.jsxs(ki,{children:[n.jsx(vr,{excludedItems:t,item:"added",label:"Added",toggleItem:s}),n.jsx(vr,{excludedItems:t,item:"edited",label:"Edited",toggleItem:s}),n.jsx(vr,{excludedItems:t,item:"deleted",label:"Deleted",toggleItem:s})]}),n.jsxs(ki,{children:[n.jsx(vr,{excludedItems:a,item:"post",label:"Posts",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"page",label:"Pages",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"tag",label:"Tags",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"offer,product",label:"Tiers & offers",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"api_key,integration,setting,user,webhook",label:"Settings & staff",toggleItem:i})]})]})}),n.jsx("div",{className:"w-[200px]",children:n.jsx(jt,{loadOptions:Ci(x,500),placeholder:"Search staff",value:h,async:!0,defaultOptions:!0,isClearable:!0,onSelect:m=>{m?(b(m),f(`history/view/${m.value}`)):(g(),f("history/view"))}})})]})},l2=({action:t})=>{const{updateRoute:a}=He(),s=s2(t);if(s){const{group:i,key:f}=s;return n.jsxs(n.Fragment,{children:[i.slice(0,1).toUpperCase(),i.slice(1),i!==f&&n.jsxs("span",{className:"text-xs",children:[" ",n.jsxs("code",{className:"mb-1 bg-white text-grey-800 dark:bg-grey-900 dark:text-white",children:["(",f,")"]})]})]})}else if(t.resource?.title||t.resource?.name||t.context?.primary_name){const i=n2(t);return i?n.jsx("a",{className:"cursor-pointer font-bold",onClick:f=>{f.preventDefault(),a(i)},children:t.resource?.title||t.resource?.name}):n.jsx(n.Fragment,{children:t.resource?.title||t.resource?.name||t.context?.primary_name})}else return n.jsx("span",{className:"text-grey-500",children:"(unknown)"})},c2=t=>{const s=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(t).reduce((i,{type:f,value:p})=>({...i,[f]:p}),{});return`${s.year}-${s.month}-${s.day} ${s.hour}:${s.minute}:${s.second}`},u2=200,d2=ge.create(({params:t})=>{const a=Lt(),{updateRoute:s}=He(),[i,f]=S.useState([]),[p,x]=S.useState(["label"]),{data:h,fetchNextPage:b,isFetchingNextPage:g}=t2({searchParams:{include:"actor,resource",limit:u2.toString(),filter:[i.length&&`event:-[${i.join(",")}]`,p.length&&`resource_type:-[${p.join(",")}]`,t?.user&&`actor_id:'${t.user}'`].filter(Boolean).join("+")},getNextPageParams:(y,C)=>({...C,filter:[C.filter,y.actions.length&&`created_at:<'${c2(new Date(y.actions[y.actions.length-1].created_at))}'`].join("+")}),keepPreviousData:!0}),m=S.useCallback(()=>{h?.isEnd||b()},[h?.isEnd,b]),w=(y,C,j)=>{y(N=>j?N.concat(C):N.filter(T=>T!==C))},v=i.length>0||p.length>0||t?.user;return n.jsx(ct,{afterClose:()=>{s("history")},cancelLabel:"",okLabel:"Close",scrolling:!0,size:"md",stickyFooter:!0,stickyHeader:!0,testId:"history-modal",title:"History",topRightContent:n.jsx(i2,{excludedEvents:i,excludedResources:p,toggleEventType:(y,C)=>w(f,y,!C),toggleResourceType:(y,C)=>w(x,y,!C),userId:t?.user}),onOk:()=>{a.remove(),s("history")},children:n.jsx("div",{className:"relative mt-6",children:n.jsx(sr,{hint:h?.isEnd&&h.actions.length>0?"End of history log":void 0,children:h?.actions?h.actions.length>0?n.jsxs(n.Fragment,{children:[n.jsx(x1,{offset:250,onTrigger:m}),h.actions.map(y=>!y.skip&&n.jsx(Nr,{avatar:n.jsx(o2,{action:y}),detail:[new Date(y.created_at).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"}),new Date(y.created_at).toLocaleTimeString("default",{hour:"2-digit",minute:"2-digit",second:"2-digit"})].join(" | "),title:n.jsxs("div",{className:"text-sm",children:[r2(y),Fp(y)?"":": ",!Fp(y)&&n.jsx(l2,{action:y}),y.count?n.jsxs(n.Fragment,{children:[" ",y.count," times"]}):null,n.jsxs("span",{children:[" — by ",y.actor?.name||y.actor?.slug]})]}),separator:!0})),g&&n.jsx("div",{className:"flex items-center justify-center p-5",children:n.jsx(Mi,{size:"md"})})]}):n.jsx(Af,{icon:"time-back",children:v?"No entries match your current filters.":"No history entries found."}):h===void 0?n.jsx("div",{className:"flex items-center justify-center px-5 pt-12 pb-10",children:n.jsx(Mi,{})}):n.jsx(Af,{children:"No entries found."})})})})}),f2=ge.create(()=>{const t=ge.useModal(),a=nu(),s=nu({searchParams:{limit:"100",permissions:"assign"}}),i=Ls(),{updateRoute:f}=He(),{config:p}=Ue(),x=p.labs.superEditors,h=S.useRef(null),[b,g]=S.useState(""),[m,w]=S.useState(""),[v,y]=S.useState("contributor"),[C,j]=S.useState({}),{data:{users:N}={}}=Rv(),{data:{invites:T}={}}=xy(),{mutateAsync:A}=by(),R=Ze();if(S.useEffect(()=>{h.current&&h.current.focus()},[]),S.useEffect(()=>{m==="saved"&&setTimeout(()=>{w("")},2e3)},[m]),S.useEffect(()=>{v!=="contributor"&&i?.isLimited("staff")?i.errorIfWouldGoOverLimit("staff").then(()=>{j(z=>({...z,role:void 0}))}).catch(z=>{if(z instanceof Fs){j(G=>({...G,role:z.message}));return}else throw z}):j(z=>({...z,role:void 0}))},[i,v]),!a.data?.roles||!s.data?.roles)return null;const $=a.data.roles,L=s.data.roles;let P="Send invitation";m==="saving"?P="Sending...":m==="saved"?P="Invite sent!":m==="error"&&(P="Retry");const D=async()=>{if(m!=="saving"){if(!Un.isEmail(b)){j({email:"Please enter a valid email address."});return}if(N?.some(({email:z})=>z===b)){j({email:"A user with that email address already exists."});return}if(T?.some(({email:z})=>z===b)){j({email:"A user with that email address was already invited."});return}if(!C.role){w("saving");try{await A({email:b,roleId:$.find(({name:z})=>z.toLowerCase()===v.toLowerCase()).id}),w("saved"),rt({title:"Invitation sent",message:`${b}`,type:"success"}),t.remove(),f("staff?tab=invited")}catch(z){w("error");let G="Failed to send invitation",te=n.jsxs("span",{children:["If the problem persists, ",n.jsxs("a",{href:"https://ghost.org/contact",children:[n.jsx("u",{children:"contact support"}),"."]}),"."]});z instanceof Lv&&z.data?.errors?.[0]?.type==="EmailError"&&(te=n.jsx("span",{children:"Check your Mailgun configuration."})),rt({title:G,message:te,type:"error"}),R(z,{withToast:!1});return}}}},q=[{hint:"Can create and edit their own posts, but cannot publish. An Editor needs to approve and publish for them.",label:"Contributor",value:"contributor"},{hint:"A trusted user who can create, edit and publish their own posts, but can’t modify others.",label:"Author",value:"author"},{hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site.",label:"Editor",value:"editor"},{hint:"Trusted staff user who should be able to manage all content and users, as well as site settings and options.",label:"Administrator",value:"administrator"}];x&&(q[2]={hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site. Can manage members and moderate comments.",label:"Editor (beta mode)",value:"super editor"});const Y=q.filter(z=>L.some(G=>G.name===z.label||G.name==="Super Editor"&&z.label==="Editor (beta mode)"));return C.email&&(P="Retry"),n.jsx(ct,{afterClose:()=>{f("staff")},cancelLabel:"",okColor:m==="error"||C.email?"red":"black",okLabel:P,testId:"invite-user-modal",title:"Invite a new staff user",width:540,onOk:D,children:n.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[n.jsx("p",{children:"Send an invitation for a new person to create a staff account on your site, and select a role that matches what you’d like them to be able to do."}),n.jsx(_e,{error:!!C.email,hint:C.email,inputRef:h,placeholder:"jamie@example.com",title:"Email address",value:b,onChange:z=>{g(z.target.value)},onKeyDown:()=>j(z=>({...z,email:void 0}))}),n.jsx("div",{children:n.jsx(g1,{error:!!C.role,hint:C.role,id:"role",options:Y,selectedOption:v,separator:!0,title:"Role",onSelect:z=>{y(z)}})})]})})}),Pp=({items:t,setItems:a})=>{const s=v=>!!(v.label&&!v.label.match(/^\s*$/)||v.url!=="/"),i=dm({items:t.map(v=>({...v,errors:{}})),setItems:v=>a(v.map(({url:y,label:C})=>({url:y,label:C}))),blank:{url:"/",label:"",errors:{}},canAddNewItem:s}),f=new RegExp(/^(\/|#|[a-zA-Z0-9-]+:)/),p=v=>{const y={};return(!v.label||v.label.match(/^\s*$/))&&(y.label="You must specify a label"),(!v.url||v.url.match(/\s/)||!Un.isURL(v.url,{require_protocol:!0})&&!v.url.match(f))&&(y.url="You must specify a valid URL or relative path"),y},x=(v,y)=>{const C=i.items.find(j=>j.id===v);i.updateItem(v,{...C.item,...y})},h=()=>{const v=p(i.newItem);Object.values(v).some(y=>y)?i.setNewItem({...i.newItem,errors:v}):i.addItem()},b=v=>{i.removeItem(v)},g=(v,y)=>{i.moveItem(v,y)},m="new",w=(v,y)=>{if(v===m)i.setNewItem({...i.newItem,errors:{...i.newItem.errors,[y]:void 0}});else{const C=i.items.find(j=>j.id===v).item;i.updateItem(v,{...C,errors:{...C.errors,[y]:void 0}})}};return{items:i.items.map(({item:v,id:y})=>({...v,id:y})),updateItem:x,addItem:h,removeItem:b,moveItem:g,newItem:{...i.newItem,id:m},setNewItem:v=>i.setNewItem({...i.newItem,...v}),clearError:w,validate:()=>{let v=!0;if(i.items.forEach(({item:y,id:C})=>{let j=p(y);Object.values(j).some(N=>N)&&(v=!1,i.updateItem(C,{...y,errors:j}))}),s(i.newItem)){const y=p(i.newItem);Object.values(y).some(C=>C)&&(v=!1,i.setNewItem({...i.newItem,errors:y}))}return v}}},Hp=({baseUrl:t,item:a,updateItem:s,addItem:i,clearError:f,labelPlaceholder:p,unstyled:x,textFieldClasses:h,action:b,className:g,...m})=>n.jsxs("div",{className:me("flex w-full items-start gap-3",g),"data-testid":"navigation-item-editor",...m,children:[n.jsx("div",{className:"flex flex-1 pt-1",children:n.jsx(_e,{className:h,containerClassName:"grow",error:!!a.errors.label,hint:a.errors.label,placeholder:p,title:"Label",unstyled:x,value:a.label,hideTitle:!0,onChange:w=>s?.({label:w.target.value}),onKeyDown:w=>{s?.({label:w.target.value}),w.key==="Enter"&&(w.preventDefault(),i?.()),a.errors.label&&f?.("label")}})}),n.jsx("div",{className:"flex flex-1 pt-1",children:n.jsx(gh,{baseUrl:t,className:h,containerClassName:"grow",error:!!a.errors.url,hint:a.errors.url,title:"URL",unstyled:x,value:a.url,hideTitle:!0,onChange:w=>s?.({url:w||""}),onKeyDown:w=>{const v=_i(w.target.value,t,!0);s?.({url:v.save||""})},onKeyUp:w=>{if(w.key==="Enter"){w.preventDefault();const v=_i(w.target.value,t,!0);s?.({url:v.save||""}),i?.()}a.errors.url&&f?.("url")}})}),b]}),zp=({baseUrl:t,navigation:a})=>n.jsxs("div",{className:"w-full pt-2",children:[n.jsx(xh,{items:a.items,itemSeparator:!1,renderItem:s=>n.jsx(Hp,{action:n.jsx(Ie,{className:"mt-1 self-center",icon:"trash",iconColorClass:"dark:text-white",size:"sm",onClick:()=>a.removeItem(s.id)}),baseUrl:t,clearError:i=>a.clearError(s.id,i),item:s,updateItem:i=>a.updateItem(s.id,i)}),onMove:a.moveItem}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(qe,{colorClass:"text-grey-300 dark:text-grey-900 mt-1",name:"add",size:"sm"}),n.jsx(Hp,{action:n.jsx(Ie,{className:"mx-2 mt-1 self-center rounded bg-green p-1","data-testid":"add-button",icon:"add",iconColorClass:"text-white",size:"sm",unstyled:!0,onClick:a.addItem}),addItem:a.addItem,baseUrl:t,className:"mt-1",clearError:s=>a.clearError(a.newItem.id,s),"data-testid":"new-navigation-item",item:a.newItem,labelPlaceholder:"New item label",updateItem:a.setNewItem})]})]}),p2=ge.create(()=>{const t=Lt(),{updateRoute:a}=He(),{localSettings:s,updateSetting:i,saveState:f,handleSave:p,siteData:x}=Xr(),[h,b]=ot(s,["navigation","secondary_navigation"]).map(y=>JSON.parse(y||"[]")),g=Pp({items:h,setItems:y=>{i("navigation",JSON.stringify(y))}}),m=Pp({items:b,setItems:y=>i("secondary_navigation",JSON.stringify(y))}),[w,v]=S.useState("primary-nav");return n.jsx(ct,{afterClose:()=>{a("navigation")},buttonsDisabled:f==="saving",cancelLabel:"Close",dirty:s.some(y=>y.dirty),okLabel:f==="saving"?"Saving...":"Save",scrolling:!0,size:"lg",stickyFooter:!0,testId:"navigation-modal",title:"Navigation",onOk:async()=>{g.validate()&&m.validate()&&(await p(),t.remove(),a("navigation"))},children:n.jsx("div",{className:"mt-6 mb-1",children:n.jsx(kr,{selectedTab:w,tabs:[{id:"primary-nav",title:"Primary",contents:n.jsx(zp,{baseUrl:x.url,navigation:g})},{id:"secondary-nav",title:"Secondary",contents:n.jsx(zp,{baseUrl:x.url,navigation:m})}],onTabChange:v})})})}),h2=""+new URL("user-cover-yM4cP_Mo.jpg",import.meta.url).href,m2=""+new URL("latest-posts-1-D7-ilqhR.jpg",import.meta.url).href,g2=""+new URL("latest-posts-2-BPfbGB8B.jpg",import.meta.url).href,x2=""+new URL("latest-posts-3-D72O3dn8.jpg",import.meta.url).href,b2=({senderName:t,senderEmail:a,senderReplyTo:s,headerImage:i,headerIcon:f,headerTitle:p,headerSubtitle:x,showPostTitleSection:h,showExcerpt:b,titleAlignment:g,titleFontCategory:m,titleFontWeight:w,bodyFontCategory:v,authorPlaceholder:y,showCommentCta:C,showFeatureImage:j,showFeedback:N,showShareButton:T,showLatestPosts:A,showSubscriptionDetails:R,siteTitle:$,footerContent:L,showBadge:P,backgroundColor:D,headerBackgroundColor:q,accentColor:Y,textColor:z,secondaryTextColor:G,headerTextColor:te,secondaryHeaderTextColor:fe,postTitleColor:Me,sectionTitleColor:K,dividerColor:Q,buttonColor:Ne,buttonTextColor:ue,linkColor:we,buttonCorners:ee,buttonStyle:pe,imageCorners:le,linkStyle:de,dividerStyle:V})=>{const ve=f||p,{config:De}=Ue(),Qe=new Date().toLocaleDateString("default",{year:"numeric",month:"short",day:"numeric"}),Dt=new Date().getFullYear(),Gt=L?L.replace(/<a/g,'<a target="_blank" rel="noopener noreferrer"'):"";let ae;hh(De)?ae=n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"From: "}),n.jsxs("span",{children:[t," (",a,")"]})]}),n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"Reply-to: "}),s||a]})]}):ae=n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:t}),n.jsxs("span",{children:[" ",a]})]}),n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"To:"})," Jamie Larson jamie@example.com"]})]});let $e="mb-5 text-pretty leading-[1.7] text-black";return m==="serif"&&v==="serif"?$e=me($e,"mb-8 font-serif text-[2.0rem] leading-tight"):m!=="serif"&&v==="serif"?$e=me($e,"mb-8 text-[1.7rem] leading-tight tracking-tight"):m==="serif"&&v!=="serif"?$e=me($e,"mb-8 font-serif text-[2.0rem] leading-tight"):$e=me($e,"mb-8 text-[1.9rem] leading-tight tracking-tight"),g==="center"&&($e=me($e,"text-center")),n.jsx("div",{className:"relative flex grow flex-col",children:n.jsx("div",{className:"absolute inset-0 m-5 flex items-center justify-center",children:n.jsxs("div",{className:"mx-auto my-0 flex max-h-full w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm",children:[n.jsx("div",{className:"flex-column flex min-h-[77px] justify-center rounded-t-sm border-b border-grey-200 bg-white px-6 text-sm text-grey-700",children:ae}),n.jsxs("div",{className:"overflow-y-auto text-sm",style:{backgroundColor:D},children:[n.jsxs("div",{className:"px-[7rem]",style:{backgroundColor:q},children:[i&&n.jsx("div",{children:n.jsx("img",{alt:"",className:"mb-4 block pt-6",src:i})}),ve&&n.jsxs("div",{className:"py-3",children:[f&&n.jsx("img",{alt:"",className:"mx-auto mb-2 size-10",role:"presentation",src:f}),p&&n.jsx("h4",{className:"mb-1 text-center text-[1.6rem] leading-tight font-bold tracking-tight text-grey-900 uppercase",style:{color:te},children:p}),x&&n.jsx("h5",{className:"mb-1 text-center text-[1.3rem] font-normal text-grey-700",style:{color:fe},children:x})]}),h&&n.jsxs("div",{className:me("flex flex-col py-8",g==="center"?"items-center":"items-start"),children:[n.jsx("h2",{className:me("text-4xl leading-supertight font-bold text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold",g==="center"?"text-center":"text-left",b?"mb-2":"mb-8"),style:{color:Me},children:"Your email newsletter"}),b&&n.jsx("p",{className:$e,style:{color:te},children:"A subtitle to highlight key points and engage your readers."}),n.jsxs("div",{className:me("flex w-full justify-between text-center text-md leading-none text-grey-700",g==="center"?"flex-col gap-1":"flex-row"),children:[n.jsxs("p",{className:"pb-1 text-[1.3rem]",style:{color:fe},children:["By ",y,n.jsx("span",{className:"before:pr-1 before:pl-0.5 before:content-['•']",children:Qe})]}),n.jsx("p",{className:"pb-1 text-[1.3rem] underline",style:{color:fe},children:n.jsx("span",{children:"View in browser"})})]})]}),j&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:me("h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat",h?"":"pt-6"),children:n.jsx("img",{alt:"Feature",className:me("min-h-full min-w-full shrink-0",le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:h2})}),n.jsx("div",{className:"mt-1 w-full max-w-[600px] pb-8 text-center text-[1.3rem] text-grey-700",style:{color:fe},children:"Feature image caption"})]})]}),n.jsxs("div",{className:me("px-[7rem]",q!=="transparent"&&"pt-10"),children:[n.jsxs("div",{className:me("max-w-[600px] border-b border-grey-200 pb-[52px] leading-[27.2px] text-black",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted",v==="serif"?"font-serif text-[1.8rem]":"text-[1.7rem] tracking-tight",j||h?"":"pt-8"),style:{borderColor:Q},children:[n.jsx("p",{className:"mb-6",style:{color:z},children:"This is what your content will look like when you send one of your posts as an email newsletter to your subscribers."}),n.jsx("p",{className:"mb-6",style:{color:z},children:"Over there on the right you'll see some settings that allow you to customize the look and feel of this template – from colors and typography to layout and buttons – to make it perfectly suited to your brand."}),n.jsx("p",{className:"mb-[52px]",style:{color:z},children:"Email templates are exceptionally finnicky to make, but we've spent a long time optimising this one to make it work beautifully across devices, email clients and content types. So, you can trust that every email you send with Ghost will look great and work well. Just like the rest of your site."}),n.jsx("hr",{className:me("my-[52px] border-[#e0e7eb]",V==="dashed"&&"border-dashed",V==="dotted"&&"border-t-0 border-b-2 border-dotted"),style:{borderColor:Q}}),n.jsx("h3",{className:me("mb-[13px] text-[2.6rem] leading-supertight",m==="serif"&&"font-serif",m==="sans_serif"&&"font-sans",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"Need inspiration?"}),n.jsxs("p",{className:"mb-[27px]",style:{color:z},children:["We've put together a ",n.jsx("a",{className:me(de==="underline"&&"underline",de==="bold"&&"font-bold"),href:"https://ghost.org/help/email-design/",rel:"noopener noreferrer",style:{color:we||Y},target:"_blank",children:"quick guide"})," that walks through all of the available settings, along with a few examples of what's possible."]}),n.jsx("a",{className:me("inline-block border px-[18px] py-2 font-sans text-[15px]",ee==="rounded"&&"rounded-[6px]",ee==="pill"&&"rounded-full",ee==="square"&&"rounded-none",pe==="outline"?"bg-transparent":"border-transparent text-white",de==="bold"?"font-bold":"font-semibold"),href:"https://ghost.org/help/email-design/",rel:"noopener noreferrer",style:pe==="outline"?{borderColor:Ne||Y,color:Ne||Y}:{backgroundColor:Ne||Y,color:ue},target:"_blank",children:"Learn more"})]}),(N||C||T)&&n.jsx("div",{className:me("grid gap-5 border-b border-grey-200 px-6 py-5",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:n.jsxs("div",{className:"grid auto-cols-fr grid-flow-col gap-4",children:[N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"thumbs-up",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"More like this"})]}),n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"thumbs-down",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Less like this"})]})]}),C&&n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"comment",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Comment"})]}),T&&n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"share",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Share"})]})]})}),A&&n.jsxs("div",{className:me("border-b border-grey-200 py-6",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:[n.jsx("h3",{className:"mt-2 mb-4 pb-1 text-[1.2rem] font-semibold tracking-wide text-black uppercase",style:{color:z},children:"Keep reading"}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"The three latest posts published on your site"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Posts sent as an email only will never be shown here."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:m2})})]}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"Displayed at the bottom of each newsletter"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Giving your readers one more place to discover your stories."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:g2})})]}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"To keep your work front and center"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Making sure that your audience stays engaged."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:x2})})]})]}),R&&n.jsxs("div",{className:me("border-b border-grey-200 py-8",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:[n.jsx("h4",{className:"mb-3 text-[1.2rem] tracking-wide text-black uppercase",style:{color:z},children:"Subscription details"}),n.jsxs("p",{className:"m-0 mb-4 text-base",style:{color:z},children:["You are receiving this because you are a paid subscriber to ",$,". Your subscription will renew on 17 Jul 2024."]}),n.jsxs("div",{className:"flex",children:[n.jsxs("div",{className:"shrink-0 text-base",children:[n.jsx("p",{style:{color:z},children:"Name: Jamie Larson"}),n.jsx("p",{style:{color:z},children:"Email: jamie@example.com"}),n.jsx("p",{style:{color:z},children:"Member since: 17 July 2023"})]}),n.jsx("span",{className:me("w-full self-end text-right text-base whitespace-nowrap",de==="underline"&&"underline",de==="bold"&&"font-bold"),style:{color:we||Y},children:"Manage subscription"})]})]}),n.jsxs("div",{className:"flex flex-col items-center pt-10",children:[n.jsx("div",{dangerouslySetInnerHTML:{__html:Gt||""},className:"text px-8 py-3 text-center text-[1.3rem] leading-base break-words text-grey-700 [&_a]:underline",style:{color:G}}),n.jsxs("div",{className:"px-8 pt-3 pb-14 text-center text-[1.3rem] text-grey-700",children:[n.jsxs("span",{style:{color:G},children:[$," © ",Dt," — "]}),n.jsx("span",{className:"pointer-events-none cursor-auto underline",style:{color:G},children:"Unsubscribe"})]}),P&&n.jsx("div",{className:"flex flex-col items-center pt-[10px] pb-[40px]",children:n.jsxs("a",{className:"pointer-events-none inline-flex cursor-auto items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight text-grey-900",href:"https://ghost.org",style:{color:z},children:[n.jsx(wy,{className:"mr-[6px] size-4"}),n.jsx("span",{children:"Powered by Ghost"})]})})]})]})]})]})})})},w2=({newsletter:t})=>{const{currentUser:a,settings:s,siteData:i,config:f}=Ue(),[p,x,h,b,g]=ot(s,["title","icon","comments_enabled","support_email_address","default_email_address"]);let m=null;t.show_header_title?m=p||null:t.show_header_name&&(m=t.name);const w=t.show_header_title&&t.show_header_name?t.name:void 0,v=t.show_comment_cta&&h!=="off",y=t.feedback_enabled,C=t.show_share_button,j=()=>{const te=t.background_color;return/#([0-9a-f]{3}){1,2}$/i.test(te)?te:"#ffffff"},N=()=>{const te=t.header_background_color;return!te||te==="transparent"?"transparent":/#([0-9a-f]{3}){1,2}$/i.test(te)?te:"transparent"},T=()=>{const te=t.button_color;if(/#([0-9a-f]{3}){1,2}$/i.test(te||""))return te;if(te===null){const Me=j();return yn(Me).hex()}return i.accent_color},A=()=>{const te=t.button_style,fe=T();if(fe&&te==="fill")return yn(fe).hex()},R=()=>{const te=t.link_color===void 0?"accent":t.link_color,fe=/#([0-9a-f]{3}){1,2}$/i;return te==="accent"?i.accent_color:fe.test(te||"")?te:yn(j()).hex()},$=()=>{const te=t.post_title_color;if(/#([0-9a-f]{3}){1,2}$/i.test(te||""))return te;if(te==="accent")return i.accent_color;const Me=N(),K=Me==="transparent"?j():Me;return yn(K).hex()},L=()=>{const te=t.section_title_color;return/#([0-9a-f]{3}){1,2}$/i.test(te||"")?te:te==="accent"?i.accent_color:yn(j()).hex()},P=()=>{const te=t.divider_color;return/#([0-9a-f]{3}){1,2}$/i.test(te||"")?te:te==="accent"?i.accent_color:"#e0e7eb"},D=yn(j()).hex(),q=yn(j()).alpha(.5).toString(),Y=N()==="transparent"?D:yn(N()).hex(),z=N()==="transparent"?q:yn(N()).alpha(.5).toString(),G={backgroundColor:j(),headerBackgroundColor:N(),postTitleColor:$()||void 0,sectionTitleColor:L()||void 0,buttonColor:T()||void 0,buttonTextColor:A()||void 0,linkColor:R()||void 0,dividerColor:P()||void 0,textColor:D,secondaryTextColor:q,headerTextColor:Y,secondaryHeaderTextColor:z};return n.jsx(b2,{accentColor:i.accent_color,authorPlaceholder:a.name||a.email,backgroundColor:G.backgroundColor||"#ffffff",bodyFontCategory:t.body_font_category,buttonCorners:t.button_corners||"rounded",buttonStyle:t.button_style||"fill",dividerStyle:t.divider_style||"solid",footerContent:t.footer_content,headerBackgroundColor:G.headerBackgroundColor||"transparent",headerIcon:t.show_header_icon?x:void 0,headerImage:t.header_image,headerSubtitle:w,headerTitle:m,imageCorners:t.image_corners||"square",linkStyle:t.link_style||"underline",senderEmail:_u(t,f,g),senderName:t.sender_name||p,senderReplyTo:ru(t,f,b,g),showBadge:t.show_badge,showCommentCta:v,showExcerpt:t.show_excerpt,showFeatureImage:t.show_feature_image,showFeedback:y,showLatestPosts:t.show_latest_posts,showPostTitleSection:t.show_post_title_section,showShareButton:C,showSubscriptionDetails:t.show_subscription_details,siteTitle:p,titleAlignment:t.title_alignment,titleFontCategory:t.title_font_category,titleFontWeight:t.title_font_weight||"bold",...G})},v2=({newsletter:t,updateNewsletter:a,errors:s,clearError:i})=>{const{settings:f,config:p}=Ue(),[x,h]=ot(f,["default_email_address","support_email_address"]),[b,g]=S.useState(ru(t,p,h,x)||"");let m=_u(t,p,x);const w=S.useCallback(y=>{g(y.target.value),a({sender_reply_to:y.target.value||"newsletter"})},[a,g]),v=()=>{const y=ru(t,p,h,x)||"";g(y)};return n.jsx(_e,{error:!!s.sender_reply_to,hint:s.sender_reply_to,maxLength:191,placeholder:m||"",title:"Reply-to email",value:b,onBlur:v,onChange:w,onKeyDown:()=>i("sender_reply_to")})},y2=({newsletter:t,onlyOne:a,updateNewsletter:s,validate:i,errors:f,clearError:p})=>{const{updateRoute:x}=He(),{mutateAsync:h}=Eh(),b=Ls(),{settings:g,config:m,siteData:w}=Ue(),[v,y]=ot(g,["icon","default_email_address"]),{mutateAsync:C}=Ps(),[j,N]=S.useState("generalSettings"),{localSettings:T}=Xr(),[A]=ot(T,["title"]),R=Ze(),{data:{newsletters:$}={}}=Th(),L=["all","paid"].includes(Tt(g,"comments_enabled")||"");let P=_u(t,m,y);const[D,q]=S.useState($||[]),Y=D.filter(ee=>ee.status==="active");S.useEffect(()=>{q($||[])},[$]);const z=[{value:"serif",label:"Elegant serif",className:"font-serif"},{value:"sans_serif",label:"Clean sans-serif"}],G={sans_serif:{options:[{value:"normal",label:"Regular",className:"font-normal"},{value:"medium",label:"Medium",className:"font-medium"},{value:"semibold",label:"Semi-bold",className:"font-semibold"},{value:"bold",label:"Bold",className:"font-bold"}]},serif:{options:[{value:"normal",label:"Regular",className:"font-normal"},{value:"bold",label:"Bold",className:"font-bold"}],map:{medium:"normal",semibold:"bold"}}},te=()=>t.background_color==="light"?!1:yn(t.background_color).hex().toLowerCase()==="#ffffff",fe=async()=>{if(t.status==="active")ge.show(xt,{title:"Archive newsletter",prompt:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Your newsletter ",n.jsx("strong",{children:t.name})," will no longer be visible to members or available as an option when publishing new posts."]}),n.jsx("div",{children:"Existing posts previously sent as this newsletter will remain unchanged."})]}),okLabel:"Archive",okColor:"red",onOk:async ee=>{try{await h({...t,status:"archived"}),ee?.remove(),rt({type:"success",message:"Newsletter archived"})}catch(pe){R(pe)}}});else{try{await b?.errorIfWouldGoOverLimit("newsletters")}catch(ee){if(ee instanceof Fs){ge.show(zn,{prompt:ee.message||"Your current plan doesn't support more newsletters.",onOk:()=>x({route:"/pro",isExternal:!0})});return}else throw ee}ge.show(xt,{title:"Reactivate newsletter",prompt:n.jsxs(n.Fragment,{children:["Reactivating ",n.jsx("strong",{children:t.name})," will immediately make it visible to members and re-enable it as an option when publishing new posts."]}),okLabel:"Reactivate",onOk:async ee=>{await h({...t,status:"active"}),ee?.remove(),rt({type:"success",message:"Newsletter reactivated"})}})}},Me=()=>{if(!hh(m))return n.jsx(_e,{error:!!f.sender_email,hint:f.sender_email,placeholder:P||"",title:"Sender email address",value:t.sender_email||"",onChange:ee=>s({sender_email:ee.target.value}),onKeyDown:()=>p("sender_email")});if(mh(m))return n.jsx(_e,{error:!!f.sender_email,hint:f.sender_email,maxLength:191,placeholder:y,title:"Sender email address",value:t.sender_email||"",onChange:ee=>{s({sender_email:ee.target.value})},onKeyDown:()=>p("sender_email")})},K=G[t.title_font_category||"sans_serif"].options,Q=()=>{const ee=t.title_font_category||"sans_serif",pe=t.title_font_weight,le=G[ee].map,de=le&&le[pe]||pe;return K.find(ve=>ve.value===de)||K[0]},Ne=ee=>{const pe=ee?.value||"sans_serif",le=t.title_font_weight;let de=le;return G[pe].options.find(V=>V.value===le)||(de=G[pe].map?.[le]||"bold"),s({title_font_category:pe,title_font_weight:de})},ue=[{id:"generalSettings",title:"General",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Name and description",children:[n.jsx(_e,{error:!!f.name,hint:f.name,maxLength:191,placeholder:"Weekly Roundup",title:"Name",value:t.name||"",onChange:ee=>s({name:ee.target.value}),onKeyDown:()=>p("name")}),n.jsx(or,{maxLength:2e3,rows:2,title:"Description",value:t.description||"",onChange:ee=>s({description:ee.target.value})})]}),n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Email info",children:[n.jsx(_e,{maxLength:191,placeholder:A,title:"Sender name",value:t.sender_name||"",onChange:ee=>s({sender_name:ee.target.value})}),Me(),n.jsx(v2,{clearError:p,errors:f,newsletter:t,updateNewsletter:s,validate:i})]}),n.jsx(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Member settings",children:n.jsx(Be,{checked:t.subscribe_on_signup,direction:"rtl",label:"Subscribe new members on signup",labelStyle:"value",onChange:ee=>s({subscribe_on_signup:ee.target.checked})})}),n.jsx("div",{className:"mt-10 mb-5",children:t.status==="active"?!a&&n.jsx(Ie,{color:"red",disabled:Y.length===1,label:"Archive newsletter",link:!0,onClick:fe}):n.jsx(Ie,{color:"green",label:"Reactivate newsletter",link:!0,onClick:fe})})]})},{id:"content",title:"Content",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Header",children:[n.jsxs("div",{children:[n.jsx("div",{children:n.jsx(lt,{className:"mb-2",level:6,children:"Header image"})}),n.jsxs("div",{className:"flex-column flex gap-1",children:[n.jsx(ar,{deleteButtonClassName:"top-1! right-1!",height:t.header_image?"66px":"64px",id:"logo",imageURL:t.header_image||void 0,onDelete:()=>{s({header_image:null})},onUpload:async ee=>{try{const pe=rr(await C({file:ee}));s({header_image:pe})}catch(pe){R(pe)}},children:n.jsx(qe,{colorClass:"text-grey-700 dark:text-grey-300",name:"picture"})}),n.jsx(Hn,{children:"1200×600 recommended. Use a transparent PNG for best results on any background."})]})]}),n.jsxs(ki,{children:[v&&n.jsx(Be,{checked:t.show_header_icon,direction:"rtl",label:"Publication icon",onChange:ee=>s({show_header_icon:ee.target.checked})}),n.jsx(Be,{checked:t.show_header_title,direction:"rtl",label:"Publication title",onChange:ee=>s({show_header_title:ee.target.checked})}),n.jsx(Be,{checked:t.show_header_name,direction:"rtl",label:"Newsletter name",onChange:ee=>s({show_header_name:ee.target.checked})})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Title section",children:[n.jsx(Be,{checked:t.show_post_title_section,direction:"rtl",label:"Post title",onChange:ee=>s({show_post_title_section:ee.target.checked})}),t.show_post_title_section&&n.jsx(Be,{checked:t.show_excerpt,direction:"rtl",label:"Post excerpt",onChange:ee=>s({show_excerpt:ee.target.checked})}),n.jsx(Be,{checked:t.show_feature_image,direction:"rtl",label:"Feature image",onChange:ee=>s({show_feature_image:ee.target.checked})})]}),n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Footer",children:[n.jsxs(ki,{gap:"lg",children:[n.jsx(Be,{checked:t.feedback_enabled,direction:"rtl",label:"Ask your readers for feedback",onChange:ee=>s({feedback_enabled:ee.target.checked})}),L&&n.jsx(Be,{checked:t.show_comment_cta,direction:"rtl",label:"Add a link to your comments",onChange:ee=>s({show_comment_cta:ee.target.checked})}),n.jsx(Be,{checked:t.show_share_button,direction:"rtl",label:"Show share button",onChange:ee=>s({show_share_button:ee.target.checked})}),n.jsx(Be,{checked:t.show_latest_posts,direction:"rtl",label:"Share your latest posts",onChange:ee=>s({show_latest_posts:ee.target.checked})}),n.jsx(Be,{checked:t.show_subscription_details,direction:"rtl",label:"Show subscription details",onChange:ee=>s({show_subscription_details:ee.target.checked})})]}),n.jsx(Cu,{hint:"Any extra information or legal text",nodes:"MINIMAL_NODES",placeholder:" ",title:"Email footer",value:t.footer_content||"",onChange:ee=>s({footer_content:ee})})]}),n.jsx($s,{}),n.jsxs("div",{className:"my-5 flex w-full items-start",children:[n.jsx("span",{children:n.jsx(qe,{className:"mt-[-1px] mr-2",colorClass:"text-red",name:"heart"})}),n.jsx(Ye,{marginBottom:!1,children:n.jsx(Be,{checked:t.show_badge,direction:"rtl",label:n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-sm md:text-base",children:"Promote independent publishing"}),n.jsx("span",{className:"text-[11px] leading-tight text-grey-700 md:text-xs md:leading-tight",children:"Show you're a part of the indie publishing movement with a small badge in the footer"})]}),labelStyle:"value",onChange:ee=>s({show_badge:ee.target.checked})})})]})]})},{id:"design",title:"Design",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Global",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{hex:"#ffffff",value:"light",title:"White"}],title:"Background color",value:t.background_color||"light",onChange:ee=>s({background_color:ee})})}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Heading font"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:z,selectedOption:z.find(ee=>ee.value===t.title_font_category),onSelect:Ne})]}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Heading weight"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:K,selectedOption:Q(),onSelect:ee=>s({title_font_weight:ee?.value})})]}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Body font"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:z,selectedOption:z.find(ee=>ee.value===t.body_font_category),testId:"body-font-select",onSelect:ee=>s({body_font_category:ee?.value})})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Header",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"transparent",title:"Transparent",hex:"#00000000"}],title:"Header background color",value:t.header_background_color||"transparent",onChange:ee=>s({header_background_color:ee})})}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Post title color",value:t.post_title_color,onChange:ee=>s({post_title_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Title alignment"}),n.jsx(Fn,{activeKey:t.title_alignment,buttons:[{key:"left",icon:"align-left",iconSize:14,label:"Align left",tooltip:"Left",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({title_alignment:"left"}),disabled:!t.show_post_title_section},{key:"center",icon:"align-center",iconSize:14,label:"Align center",tooltip:"Center",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({title_alignment:"center"}),disabled:!t.show_post_title_section}],clearBg:!1})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Body",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Section title color",value:t.section_title_color,onChange:ee=>s({section_title_color:ee})})}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"accent",title:"Accent",hex:w.accent_color},{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"}],title:"Button color",value:t.button_color,onChange:ee=>s({button_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Button style"}),n.jsx(Fn,{activeKey:t.button_style||"fill",buttons:[{key:"fill",icon:"squircle-fill",iconSize:14,label:"Fill",tooltip:"Fill",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_style:"fill"})},{key:"outline",icon:"squircle",iconSize:14,label:"Outline",tooltip:"Outline",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_style:"outline"})}],clearBg:!1})]}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Button corners"}),n.jsx(Fn,{activeKey:t.button_corners||"rounded",buttons:[{key:"square",icon:"square",iconSize:14,label:"Square",tooltip:"Squared",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"square"})},{key:"rounded",icon:"squircle",iconSize:14,label:"Rounded",tooltip:"Rounded",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"rounded"})},{key:"pill",icon:"circle",iconSize:14,label:"Pill",tooltip:"Pill",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"pill"})}],clearBg:!1})]}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"accent",title:"Accent",hex:w.accent_color},{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"}],title:"Link color",value:t.link_color,onChange:ee=>s({link_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Link style"}),n.jsx(Fn,{activeKey:t.link_style||"underline",buttons:[{key:"underline",icon:"text-underline",iconSize:14,label:"Underline",tooltip:"Underline",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"underline"})},{key:"regular",icon:"text-regular",iconSize:14,label:"Regular",tooltip:"Regular",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"regular"})},{key:"bold",icon:"text-bold",iconSize:14,label:"Bold",tooltip:"Bold",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"bold"})}],clearBg:!1})]}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Image corners"}),n.jsx(Fn,{activeKey:t.image_corners||"square",buttons:[{key:"square",icon:"square",iconSize:14,label:"Square",tooltip:"Squared",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({image_corners:"square"})},{key:"rounded",icon:"squircle",iconSize:14,label:"Rounded",tooltip:"Rounded",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({image_corners:"rounded"})}],clearBg:!1})]}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"light",title:"Light",hex:"#e0e7eb"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Divider color",value:t.divider_color||"light",onChange:ee=>s({divider_color:ee})})})]})]})}],we=ee=>{N(ee)};return n.jsx("div",{className:"flex flex-col",children:n.jsx("div",{className:"px-7 pt-0 pb-7",children:n.jsx(kr,{selectedTab:j,stickyHeader:!0,tabs:ue,onTabChange:we})})})},_2=({newsletter:t,onlyOne:a})=>{const{config:s}=Ue(),{mutateAsync:i}=Eh(),{updateRoute:f}=He(),p=Ze(),{formState:x,saveState:h,updateForm:b,setFormState:g,handleSave:m,validate:w,errors:v,clearError:y,okProps:C}=nn({initialState:t,savingDelay:500,onSave:async()=>{const{meta:{sent_email_verification:[A]=[]}={}}=await i(x);let R;A&&A==="sender_email"?R=n.jsx("div",{children:"We‘ve sent a confirmation email to the new address."}):A&&A==="sender_reply_to"&&(R=n.jsx("div",{children:"We‘ve sent a confirmation email to the new address."})),R&&rt({icon:"email",message:R,type:"info"})},onSaveError:p,onValidate:()=>{const A={};return x.name||(A.name="A name is required for your newsletter"),x.sender_email&&!Un.isEmail(x.sender_email)?A.sender_email="Enter a valid email address":x.sender_email&&mh(s)&&x.sender_email.split("@")[1]!==kf(s)&&(A.sender_email=`Email address must end with @${kf(s)}`),x.sender_reply_to&&!Un.isEmail(x.sender_reply_to)&&!["newsletter","support"].includes(x.sender_reply_to)&&(A.sender_reply_to="Enter a valid email address"),A}}),j=A=>{b(R=>({...R,...A}))};S.useEffect(()=>{g(()=>t)},[g,t]);const N=n.jsx(w2,{newsletter:x}),T=n.jsx(y2,{clearError:y,errors:v,newsletter:x,onlyOne:a,updateNewsletter:j,validate:w});return n.jsx(Zr,{afterClose:()=>f("newsletters"),buttonsDisabled:C.disabled,cancelLabel:"Close",deviceSelector:!1,dirty:h==="unsaved",okColor:C.color,okLabel:C.label||"Save",preview:N,previewBgColor:"grey",previewToolbar:!1,sidebar:T,sidebarPadding:!1,testId:"newsletter-modal",title:"Newsletter",onOk:async()=>{await m({fakeWhenUnchanged:!0})}})},M2=({params:t})=>{const{data:{newsletters:a,isEnd:s}={},fetchNextPage:i}=Th(),f=a?.find(({id:p})=>p===t?.id);return S.useEffect(()=>{!f&&!s&&i()},[i,s,f]),f?n.jsx(_2,{newsletter:f,onlyOne:a.length===1}):null},k2=ge.create(M2),wm=({id:t})=>{const{updateRoute:a}=He(),{data:{offers:s=[]}={}}=Sh(t||""),[i,f]=S.useState(),[p,x]=S.useState(""),{siteData:h}=Ue();S.useEffect(()=>{if(s.length>0){const j=s[0],N=`${Pn(h)}${j?.code}`;x(N),f(j)}},[s,h]);const[b,g]=S.useState(!1),m=()=>{let j="";switch(i?.type){case"percent":j=i?.amount+"% discount";break;case"fixed":j=Da(wi(i?.amount))+" "+i?.currency+" discount";break;case"trial":j=i?.amount+" days free trial";break}return`${encodeURIComponent(i?.name||"")} — Check out ${encodeURIComponent(j)} on:`},w=async()=>{await navigator.clipboard.writeText(p),g(!0),setTimeout(()=>g(!1),2e3)},v=()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURI(p)}&text=${m()}`,"_blank")},y=()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURI(p)}`,"_blank")},C=()=>{window.open(`http://www.linkedin.com/shareArticle?mini=true&url=${encodeURI(p)}&title=${m()}`,"_blank")};return n.jsx(ct,{afterClose:()=>{a("offers")},animate:!1,backDropClick:!1,footer:!1,height:"full",size:"lg",testId:"offer-success-modal",topRightContent:"close",width:1140,children:n.jsxs("div",{className:"-mt-6 flex h-full flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"absolute top-5 left-6",children:n.jsx(Au,{activeItemClassName:"hidden md:block! md:visible!",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:block! md:visible!",items:[{label:"Offers",onClick:()=>{a("offers/edit")}},{label:i?.name||""}],separatorClassName:"hidden md:block! md:visible!",backIcon:!0,onBack:()=>{a("offers/edit")}})}),n.jsx(qe,{colorClass:"text-grey-700 -mt-4",name:"tags-check",size:"xl"}),n.jsx("h1",{className:"mt-6 text-4xl",children:"Your new offer is live!"}),n.jsx("p",{className:"mt-3 max-w-[510px] text-[1.6rem]",children:"You can share the link anywhere. In your newsletter, social media, a podcast, or in-person. It all just works."}),n.jsxs("div",{className:"mt-8 flex w-full max-w-md flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col-reverse gap-2",children:[n.jsx(_e,{name:"offer-url",type:"url",value:p,disabled:!0}),n.jsx(Ie,{color:"green",label:b?"Copied!":"Copy link",fullWidth:!0,onClick:w})]}),n.jsx("div",{className:'flex items-center gap-4 text-xs font-medium before:h-px before:grow before:bg-grey-300 before:content-[""] after:h-px after:grow after:bg-grey-300 after:content-[""] dark:before:bg-grey-800 dark:after:bg-grey-800',children:"OR"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"twitter-x",iconColorClass:"w-[14px] h-[14px]",size:"sm",fullWidth:!0,onClick:v}),n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"facebook",size:"sm",fullWidth:!0,onClick:y}),n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"linkedin",size:"sm",fullWidth:!0,onClick:C})]})]})]})})},Ua=({href:t,onDestroyed:a,selectedTab:s,portalParent:i})=>{s||(s="signup");const f=S.useRef(null),[p,x]=S.useState(!1),[h,b]=S.useState(!0),g=S.useCallback(()=>{setTimeout(()=>{f.current&&b(!1)},300)},[f]);if(S.useEffect(()=>{const v=y=>{if(!t)return;new URL(y.origin).origin===new URL(t).origin&&y?.data?.type==="portal-preview-ready"&&g()};return window.addEventListener("message",v,!0),()=>{window.removeEventListener("message",v,!0),a?.()}},[t,a,g,p]),!t)return null;let m="mt-[-7%] flex h-screen items-center justify-center",w="hidden";return i==="preview"?(m="absolute z-50 mt-[-7%] flex h-screen items-center justify-center",w="invisible"):i==="offers"&&(m="absolute z-50 flex w-full h-full items-center justify-center",w="invisible"),n.jsxs(n.Fragment,{children:[h&&n.jsx("div",{className:m,children:n.jsx("span",{children:n.jsx(Mi,{})})}),n.jsx("iframe",{ref:f,className:!h&&p?"":w,"data-testid":"portal-preview",height:"100%",src:t,title:"Portal Preview",width:"100%",onLoad:()=>{x(!0)}})]})},Fu=(t,a)=>{const{disableBackground:s=!1,name:i,code:f,displayTitle:p="",displayDescription:x="",type:h,cadence:b,amount:g=0,duration:m,durationInMonths:w,currency:v="usd",status:y,tierId:C,redemptionType:j="signup"}=t;a=a.replace(/\/$/,"");const N="/?v=modal-portal-offer#/portal/preview/offer",T=new URLSearchParams;return T.append("disableBackground","false"),T.append("name",encodeURIComponent(i)),T.append("code",encodeURIComponent(f)),T.append("display_title",encodeURIComponent(p)),T.append("display_description",encodeURIComponent(x)),T.append("type",encodeURIComponent(h)),T.append("cadence",encodeURIComponent(b)),T.append("amount",encodeURIComponent(g)),T.append("duration",encodeURIComponent(m)),T.append("duration_in_months",encodeURIComponent(w)),T.append("currency",encodeURIComponent(v)),T.append("status",encodeURIComponent(y)),T.append("tier_id",encodeURIComponent(C)),T.append("redemption_type",encodeURIComponent(j)),s&&T.append("disableBackground","true"),`${a}${N}?${T.toString()}`},j2=t=>{const a=[];return t.forEach(s=>{a.push({label:`${s.name} - Monthly`,value:`${s.id}-month-${s.currency}`}),a.push({label:`${s.name} - Yearly`,value:`${s.id}-year-${s.currency}`})}),a};function N2(t){return t.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-")}const Up=191,Ti=({type:t,checked:a,onClick:s})=>{const i=a?"bg-black text-white dark:bg-white dark:text-black":"border border-grey-300 dark:border-grey-800";return n.jsx("button",{className:"text-left",type:"button",onClick:s,children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx("div",{className:`mt-0.5 flex size-4 items-center justify-center rounded-full ${i}`,children:a?n.jsx(qe,{className:"w-[7px] stroke-[4]",name:"check",size:"custom"}):null}),n.jsxs("div",{className:"-mt-px flex flex-col",children:[n.jsx("span",{children:t.title}),n.jsx("span",{className:"text-sm",children:t.description})]})]})})},Bp=t=>{const{fixedAmount:a=0,percentAmount:s=0,trialAmount:i=0,amount:f=0}=t;switch(t.type){case"fixed":return a*100;case"percent":return s;case"trial":return i;default:return f}},T2=({tierOptions:t,handleTierChange:a,selectedTier:s,typeOptions:i,durationOptions:f,handleTypeChange:p,handleDurationChange:x,overrides:h,handleAmountTypeChange:b,handleNameInput:g,handleTextAreaInput:m,handleDisplayTitleInput:w,handleDurationInMonthsInput:v,handleAmountInput:y,handleCodeInput:C,clearError:j,errors:N,testId:T,handleTrialAmountInput:A,amountOptions:R})=>{const $=h.cadence==="year",L=$?f.filter(K=>K.value!=="repeating"):f,[P,D]=S.useState(0),q=P>40?"text-red":"text-green",{siteData:Y}=Ue(),[z,G]=S.useState(!1),te=Pn(Y),fe=`${te}${h.code.value}`,Me=async()=>{await navigator.clipboard.writeText(fe),G(!0),setTimeout(()=>G(!1),2e3)};return n.jsx("div",{className:"pt-7","data-testId":T,children:n.jsxs(Ye,{children:[n.jsxs("section",{children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{error:!!N.name,hint:N.name||n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Visible to members on Stripe Checkout page"}),n.jsxs("strong",{children:[n.jsx("span",{className:`${q}`,children:P})," / 40"]})]}),maxLength:40,placeholder:"Black Friday",title:"Offer name",onChange:K=>{g(K),D(K.target.value.length)},onKeyDown:()=>j("name")}),n.jsx(_e,{error:!!N.displayTitle,hint:N.displayTitle,maxLength:Up,placeholder:"Black Friday Special",title:"Display title",value:h.displayTitle.value,onChange:K=>{w(K)},onKeyDown:()=>j("displayTitle")}),n.jsx(or,{maxLength:Up,placeholder:"Take advantage of this limited-time offer.",title:"Display description",value:h.displayDescription,onChange:K=>{m(K)}})]})]}),n.jsxs("section",{className:"mt-4",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"Details"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsxs("div",{className:"flex flex-col gap-4 rounded-md border border-grey-200 p-4 dark:border-grey-800",children:[n.jsx(Ti,{checked:h.type!=="trial",type:i[0],onClick:()=>{p("percent")}}),n.jsx(Ti,{checked:h.type==="trial",type:i[1],onClick:()=>{p("trial")}})]}),n.jsx(jt,{options:t,selectedOption:s,testId:"tier-cadence-select-offers",title:"Tier — Cadence",onSelect:K=>{K&&a(K)}}),h.type!=="trial"&&n.jsxs(n.Fragment,{children:[" ",n.jsxs("div",{className:"relative",children:[n.jsx(_e,{error:!!N.amount,hint:N.amount,title:"Amount off",type:"number",value:h.type==="fixed"?h.fixedAmount===0?"":h.fixedAmount?.toString():h.percentAmount===0?"":h.percentAmount?.toString(),onChange:K=>{y(K)},onKeyDown:()=>j("amount")}),n.jsx("div",{className:"absolute top-6 right-1.5 z-10",children:n.jsx(jt,{clearBg:!0,controlClasses:{menu:"w-20 right-0"},options:R,selectedOption:h.type==="percent"?R[0]:R[1],testId:"amount-type-select-offers",onSelect:K=>{b(K?.value||"")}})})]}),n.jsx(jt,{options:L,selectedOption:L.find(K=>K.value===h.duration),testId:"duration-select-offers",title:"Duration",onSelect:K=>{j("durationInMonths"),x(K?.value||"")}}),h.duration==="repeating"&&!$&&n.jsx("div",{className:"-mt-4",children:n.jsx(_e,{"data-testid":"duration-months-input",error:!!N.durationInMonths,hint:N.durationInMonths,rightPlaceholder:`${h.durationInMonths===1?"month":"months"}`,type:"number",value:h.durationInMonths===0?"":String(h.durationInMonths),onChange:K=>{v(K)},onKeyDown:()=>j("durationInMonths")})})]}),h.type==="trial"&&n.jsx(_e,{error:!!N.amount,hint:N.amount,title:"Trial duration",type:"number",value:h.trialAmount?.toString(),onChange:K=>{A(K)},onKeyDown:()=>j("amount")}),n.jsx(_e,{error:!!N.code,hint:N.code||(h.code.value!==""?n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[te,n.jsx("span",{className:"font-bold",children:h.code.value})]}),n.jsx("span",{}),n.jsx(Ie,{className:"text-xs",color:"green",label:`${z?"Copied":"Copy"}`,size:"sm",link:!0,onClick:Me})]}):null),placeholder:"black-friday",title:"Offer code",value:h.code.value,onChange:K=>{C(K)},onKeyDown:()=>j("code")})]})]})]})})},bi=t=>{const[a,s,i]=t.split("-");if(!a||!s||!i)throw new Error("Invalid input format. Expected format is: id-period-currency");return{id:a,period:s,currency:i}},E2=()=>{const{siteData:t}=Ue(),a=[{title:"Discount",description:"Offer a special reduced price",value:"percent"},{title:"Free trial",description:"Give free access for a limited time",value:"trial"}],s=[{value:"once",label:"First-payment"},{value:"repeating",label:"Multiple-months"},{value:"forever",label:"Forever"}],[i,f]=S.useState(""),{updateRoute:p}=He(),{data:{tiers:x}={}}=Kr(),h=Ba(x||[]),b=j2(h),{mutateAsync:g}=Ah(),[m,w]=S.useState({tier:b[0]||{},dataset:{id:b[0]?.value?bi(b[0]?.value).id:"",period:b[0]?.value?bi(b[0]?.value).period:"",currency:b[0]?.value?bi(b[0]?.value).currency:""}}),{data:{offers:v=[]}={}}=ju(),{formState:y,updateForm:C,handleSave:j,saveState:N,okProps:T,validate:A,errors:R,clearError:$}=nn({initialState:{disableBackground:!1,name:"",code:{isDirty:!1,value:""},displayTitle:{isDirty:!1,value:""},displayDescription:"",type:"percent",cadence:m?.dataset?.period||"",amount:0,duration:"once",durationInMonths:1,currency:m?.dataset?.currency||"USD",status:"active",tierId:m?.dataset?.id||"",trialAmount:7,fixedAmount:0,percentAmount:0},onSave:async()=>{const pe=y.type==="trial"?"trial":y.duration,le={name:y.name,code:y.code.value,display_title:y.displayTitle.value,display_description:y.displayDescription,cadence:y.cadence,amount:Bp(y)||0,duration:pe,...pe==="repeating"?{duration_in_months:y.durationInMonths}:{},currency:y.currency,status:y.status,redemption_type:"signup",tier:{id:y.tierId},type:y.type,currency_restriction:!1},de=await g(le);de&&de.offers&&de.offers.length>0&&p(`offers/success/${de.offers[0].id}`)},onSaveError:()=>{},onValidate:()=>{const pe={};return!y.name&&y.name.length===0&&(pe.name="Name is required"),!y.code.value&&y.code.value.length===0&&(pe.code="Code is required"),!y.displayTitle.value&&y.displayTitle.value.length===0&&(pe.displayTitle="Display title is required"),y.type==="percent"&&y.percentAmount===0&&(pe.amount="Enter an amount greater than 0."),y.type==="percent"&&(y.percentAmount<1||y.percentAmount>100)&&(pe.amount="Enter an amount between 1 and 100%."),(y.type==="fixed"&&y.fixedAmount===0||y.type==="fixed"&&y.fixedAmount<1)&&(pe.amount="Enter an amount greater than 0."),y.type==="trial"&&y.trialAmount===0&&(pe.amount="Enter an amount greater than 0."),y.type==="trial"&&y.trialAmount<1&&(pe.amount="Free trial must be at least 1 day."),y.type!=="trial"&&y.duration==="repeating"&&(!Number.isInteger(y.durationInMonths)||y.durationInMonths<1)&&(pe.durationInMonths="Enter a whole number of months (1 or more)."),pe},savingDelay:500}),L=[{value:"percent",label:"%"},{value:"fixed",label:y.currency}],P=pe=>{const le=bi(pe.value),de=le.period==="year";w({tier:pe,dataset:le}),C(V=>({...V,cadence:le.period,currency:le.currency,tierId:le.id,duration:de&&V.duration==="repeating"?"once":V.duration})),de&&$("durationInMonths")},D=pe=>{pe==="trial"&&($("amount"),$("durationInMonths")),C(le=>({...le,type:pe}))},q=pe=>{C(le=>({...le,type:pe==="percent"?"percent":"fixed"}))},Y=pe=>{const le=pe.target;y.type==="fixed"?C(de=>({...de,fixedAmount:Number(le.value)})):y.type==="percent"?C(de=>({...de,percentAmount:Number(le.value)})):C(de=>({...de,amount:Number(le.value)}))},z=pe=>{const le=pe.target,de=Number(le.value);C(V=>({...V,durationInMonths:Number.isNaN(de)?0:de}))},G=pe=>{const le=pe.target.value;C(de=>{let V={...de};return V.name=le,de.code.isDirty||($("code"),V.code={...de.code,value:N2(le)}),de.displayTitle.isDirty||($("displayTitle"),V.displayTitle={...de.displayTitle,value:le}),V})},te=pe=>{const le=pe.target;C(de=>({...de,displayTitle:{...de.displayTitle,isDirty:!0,value:le.value}}))},fe=pe=>{const le=pe.target;C(de=>({...de,displayDescription:le.value}))},Me=pe=>{const le=pe.target;C(de=>({...de,trialAmount:Number(le.value)}))},K=pe=>{C(le=>({...le,duration:pe}))},Q=pe=>{const le=pe.target;C(de=>({...de,code:{...de.code,isDirty:!0,value:le.value}}))},Ne=()=>{v.length>0?p("offers/edit"):p("offers")},ue=S.useMemo(()=>({name:y.name||"",code:y.code.value||"",displayTitle:y.displayTitle.value||"",displayDescription:y.displayDescription||"",type:y.type||"percent",cadence:y.cadence||"month",amount:Bp(y)||0,duration:y.type==="trial"?"trial":y.duration||"once",durationInMonths:y.durationInMonths||0,currency:y.currency||"USD",status:y.status||"active",tierId:y.tierId||h[0]?.id,redemptionType:"signup"}),[y,h]);S.useEffect(()=>{const pe=Fu(ue,t.url);f(pe)},[y,t.url,y.type,ue]);const we=n.jsx(T2,{amountOptions:L,clearError:$,durationOptions:s,errors:R,handleAmountInput:Y,handleAmountTypeChange:q,handleCodeInput:Q,handleDisplayTitleInput:te,handleDurationChange:K,handleDurationInMonthsInput:z,handleNameInput:G,handleTextAreaInput:fe,handleTierChange:P,handleTrialAmountInput:Me,handleTypeChange:D,overrides:y,selectedTier:m.tier,testId:"add-offer-sidebar",tierOptions:b,typeOptions:a,validate:A}),ee=n.jsx(Ua,{href:i||"",portalParent:"offers"});return n.jsx(Zr,{afterClose:()=>{p("offers")},backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:N==="unsaved",height:"full",okColor:T.color,okLabel:"Publish",preview:ee,previewToolbar:!1,sidebar:we,size:"lg",testId:"add-offer-modal",title:"Offer",width:1140,onCancel:Ne,onOk:async()=>{if(A(),!Object.values(R).every(le=>!le)){As.remove(),rt({title:"Can't save offer",type:"info",message:"Make sure you filled all required fields"});return}try{if(await j({force:!0}))return}catch(le){let de;le instanceof Mr&&le.data&&le.data.errors[0]&&(de=le.data.errors[0].context||le.data.errors[0].message),As.remove(),de&&rt({title:"Can't save offer",type:"error",message:de||"Please try again later"})}}})},Wp=40,C2=t=>new Date(t).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"}),Pu=t=>{const a="/ghost/#/members",s=`offer_redemptions:[${t.join(",")}]`;return`${a}?filter=${encodeURIComponent(s)}`},vm=t=>Pu([t]),I2=({amount:t,duration:a})=>t===100&&a==="repeating",Yp=(t,a)=>`Retention ${t} (${a})`,S2=({amount:t,duration:a,durationInMonths:s})=>I2({amount:t,duration:a})?`${s} ${s===1?"month":"months"} free`:a==="once"?`${t}% off once`:a==="repeating"?`${t}% off for ${s} mo`:`${t}% off forever`,A2=(t,a)=>{const s=a.trim(),i=S2(t),f=Yp(i,s);if(f.length<=Wp)return f;const p=f.length-Wp,x=Math.max(3,s.length-p);return Yp(i,s.slice(0,x))};function qp(t){return new Date(t).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"})}const D2=({clearError:t,errors:a,offer:s,updateOffer:i})=>{const{siteData:f}=Ue(),[p,x]=S.useState(!1),h=Ze(),{mutateAsync:b}=Nu(),[g,m]=S.useState(s?.name.length||0),w=g>40?"text-red":"text-green",{updateRoute:v}=He();S.useEffect(()=>{s?.name&&m(s?.name.length)},[s?.name]);const y=Pn(f),C=`${y}${s?.code}`,j=async()=>{await navigator.clipboard.writeText(C),x(!0),setTimeout(()=>x(!1),2e3)},N=async()=>{s?.status==="active"?ge.show(xt,{title:"Archive offer",prompt:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"New members will no longer be able to subscribe using this offer."}),n.jsxs("p",{children:["All members that previously redeemed ",n.jsx("strong",{children:s?.name})," will remain unchanged."]})]}),okLabel:"Archive",okColor:"red",onOk:async T=>{try{await b({...s,status:"archived"}),T?.remove(),rt({type:"success",title:"Offer archived"}),v("offers/edit")}catch(A){h(A)}}}):ge.show(xt,{title:"Reactivate offer",prompt:n.jsx(n.Fragment,{children:n.jsxs("p",{children:["Reactivating ",n.jsx("strong",{children:s?.name})," will allow new members to subscribe using this offer. Existing members will remain unchanged."]})}),okLabel:"Reactivate",onOk:async T=>{try{await b({...s,status:"active"}),T?.remove(),rt({type:"success",title:"Offer reactivated"}),v("offers/edit")}catch(A){h(A)}}})};return n.jsxs("div",{className:"flex grow flex-col pt-2",children:[n.jsxs(Ye,{className:" grow",children:[n.jsx("section",{children:n.jsxs("div",{className:"flex flex-col gap-5 rounded-md border border-grey-300 p-4 pb-3.5 dark:border-grey-800",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Created on"}),n.jsx("span",{children:qp(s?.created_at?s.created_at:"")})]}),n.jsxs("div",{className:"flex items-end justify-between",children:[n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Performance"}),n.jsxs("span",{children:[s?.redemption_count," ",s?.redemption_count===1?"redemption":"redemptions"]})]}),s?.redemption_count>0&&s?.last_redeemed?n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Last redemption"}),n.jsx("span",{children:qp(s?.last_redeemed)})]}):null]}),s?.redemption_count>0?n.jsx("a",{className:"font-semibold text-green",href:vm(s?.id),children:"See members →"}):null]})]})}),n.jsxs("section",{className:"mt-2",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{error:!!a.name,hint:a.name||n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Visible to members on Stripe Checkout page"}),n.jsxs("strong",{children:[n.jsx("span",{className:`${w}`,children:g})," / 40"]})]}),maxLength:40,placeholder:"Black Friday",title:"Offer name",value:s?.name,onChange:T=>{m(T.target.value.length),i({name:T.target.value})},onKeyDown:()=>t("name")}),n.jsx(_e,{containerClassName:"group",error:!!a.code,hint:a.code||(s?.code!==""?n.jsxs("span",{className:"truncate text-grey-700",children:[y,n.jsx("span",{className:"font-bold text-black dark:text-white",children:s?.code})]}):null),placeholder:"black-friday",rightPlaceholder:s?.code!==""?n.jsx(Ie,{className:"mt-1 mr-0.5",color:"green",label:p?"Copied!":"Copy link",size:"sm",onClick:j}):null,title:"Offer code",value:s?.code,onChange:T=>i({code:T.target.value}),onKeyDown:()=>t("code")}),n.jsx(_e,{error:!!a.displayTitle,hint:a.displayTitle,placeholder:"Black Friday Special",title:"Display title",value:s?.display_title,onChange:T=>i({display_title:T.target.value}),onKeyDown:()=>t("displayTitle")}),n.jsx(or,{placeholder:"Take advantage of this limited-time offer.",title:"Display description",value:s?.display_description,onChange:T=>i({display_description:T.target.value})})]})]})]}),n.jsx("div",{className:"mb-2",children:s?.status==="active"?n.jsx(Ie,{color:"red",label:"Archive offer",link:!0,onClick:N}):n.jsx(Ie,{color:"green",label:"Reactivate offer",link:!0,onClick:N})})]})},$2=({id:t})=>{const{siteData:a}=Ue(),{updateRoute:s}=He(),i=Ze(),{mutateAsync:f}=Nu(),[p,x]=S.useState(""),{data:{offers:h=[]}={}}=Sh(t||""),{formState:b,saveState:g,updateForm:m,setFormState:w,handleSave:v,validate:y,errors:C,clearError:j,okProps:N}=nn({initialState:h[0],savingDelay:500,onSave:async()=>{await f(b)},onSaveError:i,onValidate:()=>{const L={};return b?.name||(L.name="Name is required"),b?.display_title||(L.displayTitle="Display title is required"),b?.code||(L.code="Please enter a code"),L}});S.useEffect(()=>{w(()=>h[0])},[w,h]);const T=L=>{m(P=>({...P,...L}))},A=n.jsx(D2,{clearError:j,errors:C,offer:b,updateOffer:T,validate:y});S.useEffect(()=>{const L={name:b?.name||"",code:b?.code||"",displayTitle:b?.display_title||"",displayDescription:b?.display_description||"",type:b?.type||"",cadence:b?.cadence||"",amount:b?.amount,duration:b?.duration||"",durationInMonths:b?.duration_in_months||0,currency:b?.currency||"",status:b?.status||"",tierId:b?.tier?.id||"",redemptionType:"signup"},P=Fu(L,a.url);x(P)},[b,a]);const R=n.jsx(Ua,{href:p||"",portalParent:"offers"}),$=()=>{s("offers/edit")};return h?n.jsx(Zr,{afterClose:()=>{s("offers")},backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:g==="unsaved",height:"full",okColor:N.color,okLabel:N.label||"Save",preview:R,previewToolbarBreadcrumbs:[{label:"Offers",onClick:$},{label:b?.name||"Offer"}],sidebar:A,size:"lg",testId:"offer-update-modal",title:"Offer",width:1140,onBreadcrumbsBack:$,onCancel:$,onOk:async()=>{try{if(await v({force:!0}))return}catch(L){let P;L instanceof Mr&&L.data&&L.data.errors[0]&&(P=L.data.errors[0].context||L.data.errors[0].message),As.remove(),P&&rt({title:"Can't save offer",type:"error",message:"Please try again later"})}}}):null},Gp=[{title:"Percentage discount",description:"Offer a special reduced price"},{title:"Free month(s)",description:"Give free access for a limited time"}],Xp=[{value:"once",label:"First-payment"},{value:"repeating",label:"Multiple-months"},{value:"forever",label:"Forever"}],Kp=191,ym=99,Zp=`Enter a whole number of months between 1 and ${ym}.`,Vp=t=>{const a=Number.isFinite(t)?Math.trunc(t):0;return Math.max(1,a)},O2=({type:t,percentAmount:a,freeMonths:s,lastPercentAmount:i,lastFreeMonths:f})=>t==="free_months"?s>0?s:f:a>0?a:i,gu=(t="monthly")=>({enabled:!1,displayTitle:"",displayDescription:"",type:t==="yearly"?"percent":"free_months",percentAmount:20,duration:"once",durationInMonths:1,freeMonths:1}),R2=t=>t.type==="percent"&&t.amount===100&&t.duration==="repeating",L2=(t,a="monthly")=>{const s=gu(a);if(!t)return s;const i=R2(t),f=t.type==="percent"&&!i,p=t.duration==="repeating"&&t.duration_in_months?t.duration_in_months:s.durationInMonths;return{enabled:t.status==="active",displayTitle:t.display_title||"",displayDescription:t.display_description||"",type:i?"free_months":"percent",percentAmount:f?t.amount:s.percentAmount,duration:f?t.duration:s.duration,durationInMonths:p,freeMonths:i&&t.duration_in_months||s.freeMonths}},Qp=({formState:t,lastPercentAmount:a,lastFreeMonths:s})=>{const i=O2({type:t.type,percentAmount:t.percentAmount,freeMonths:t.freeMonths,lastPercentAmount:a,lastFreeMonths:s});if(t.type==="free_months")return{type:"percent",amount:100,duration:"repeating",durationInMonths:Vp(i)};const f=t.duration,p=f==="repeating"?Vp(t.durationInMonths):0;return{type:"percent",amount:i,duration:f,durationInMonths:p}},F2=t=>{if(!t)return null;const a=t.duration_in_months??0;return{type:"percent",amount:t.amount,duration:t.duration,durationInMonths:a}},Jp=t=>t?`${t.type}:${t.amount}:${t.duration}:${t.durationInMonths}`:"",eh=t=>Number.isInteger(t)&&t>0&&t<=ym,P2=(t,a)=>t.displayTitle!==a.displayTitle||t.displayDescription!==a.displayDescription||t.type!==a.type||t.percentAmount!==a.percentAmount||t.duration!==a.duration||t.durationInMonths!==a.durationInMonths||t.freeMonths!==a.freeMonths,H2=({formState:t,updateForm:a,clearError:s,errors:i,cadence:f,lastRedeemed:p,membersFilterUrl:x,redemptions:h})=>{const b=f==="yearly"?Xp.filter(g=>g.value!=="repeating"):Xp;return n.jsx("div",{className:"flex grow flex-col pt-2",children:n.jsxs(Ye,{className:"grow",children:[n.jsx("section",{children:n.jsx("div",{className:"flex flex-col gap-5 rounded-md border border-grey-300 p-4 pb-3.5 dark:border-grey-800",children:n.jsx("div",{className:"flex flex-col gap-1.5",children:n.jsxs("div",{className:"flex items-end justify-between",children:[n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Performance"}),n.jsxs("span",{children:[h," ",h===1?"redemption":"redemptions"]})]}),h>0&&p?n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Last redemption"}),n.jsx("span",{children:C2(p)})]}):null]}),h>0&&x?n.jsx("a",{className:"font-semibold text-green",href:x,children:"See members →"}):null]})})})}),n.jsx("section",{className:"mt-2",children:n.jsx(Be,{align:"center",checked:t.enabled,direction:"rtl",hint:f==="monthly"?"Applied to monthly plans":"Applied to annual plans",label:`Enable ${f} retention`,onChange:g=>{a(m=>({...m,enabled:g.target.checked}))}},`retention-toggle-${f}-${t.enabled?"enabled":"disabled"}`)}),t.enabled&&n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"mt-2",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{maxLength:Kp,placeholder:"Before you go",title:"Display title",value:t.displayTitle,onChange:g=>{a(m=>({...m,displayTitle:g.target.value}))}}),n.jsx(or,{maxLength:Kp,placeholder:"We'd hate to see you leave. How about a special offer to stay?",title:"Display description",value:t.displayDescription,onChange:g=>{a(m=>({...m,displayDescription:g.target.value}))}})]})]}),n.jsxs("section",{className:"mt-4",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"Details"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[f==="monthly"&&n.jsxs("div",{className:"flex flex-col gap-4 rounded-md border border-grey-200 p-4 dark:border-grey-800",children:[n.jsx(Ti,{checked:t.type==="percent",type:Gp[0],onClick:()=>{s("amount"),s("durationInMonths"),a(g=>({...g,type:"percent",percentAmount:g.percentAmount}))}}),n.jsx(Ti,{checked:t.type==="free_months",type:Gp[1],onClick:()=>{s("amount"),s("durationInMonths"),a(g=>({...g,type:"free_months"}))}})]}),t.type==="percent"&&n.jsxs(n.Fragment,{children:[n.jsx(_e,{error:!!i.amount,hint:i.amount,rightPlaceholder:"%",title:"Amount off",type:"number",value:t.percentAmount===0?"":String(t.percentAmount),onChange:g=>{const m=Number(g.target.value),w=Number.isNaN(m)?0:m;a(v=>({...v,percentAmount:w}))},onKeyDown:()=>s("amount")}),n.jsx(jt,{options:b,selectedOption:b.find(g=>g.value===t.duration),title:"Duration",onSelect:g=>{g&&(s("durationInMonths"),a(m=>({...m,duration:g.value})))}}),t.duration==="repeating"&&n.jsx("div",{className:"-mt-4",children:n.jsx(_e,{"data-testid":"duration-months-input",error:!!i.durationInMonths,hint:i.durationInMonths,rightPlaceholder:`${t.durationInMonths===1?"month":"months"}`,type:"number",value:t.durationInMonths===0?"":String(t.durationInMonths),onChange:g=>{const m=Number(g.target.value);a(w=>({...w,durationInMonths:Number.isNaN(m)?0:m}))},onKeyDown:()=>s("durationInMonths")})})]}),t.type==="free_months"&&n.jsx(_e,{error:!!i.amount,hint:i.amount,rightPlaceholder:`${t.freeMonths===1?"month":"months"}`,title:"Free months",type:"number",value:t.freeMonths===0?"":String(t.freeMonths),onChange:g=>{const m=Number(g.target.value);a(w=>({...w,freeMonths:Number.isNaN(m)?0:m}))},onKeyDown:()=>s("amount")})]})]})]})]})})},z2=({id:t})=>{const{updateRoute:a}=He(),{siteData:s}=Ue(),{data:{tiers:i=[]}={}}=Kr(),{data:{offers:f=[]}={},isFetched:p,isFetching:x}=ju(),{mutateAsync:h}=Ah(),{mutateAsync:b}=Nu(),g=Iy(),[m,w]=S.useState(""),v=t==="monthly"?"monthly":"yearly",y=v==="monthly"?"Monthly retention":"Yearly retention",C=v==="monthly"?"month":"year",j=Ba(i||[]),N=S.useMemo(()=>f.filter(ae=>ae.redemption_type==="retention"&&ae.cadence===C).sort((ae,$e)=>{const Ft=ae.created_at?new Date(ae.created_at).getTime():0;return($e.created_at?new Date($e.created_at).getTime():0)-Ft}),[f,C]),T=S.useMemo(()=>N.find(ae=>ae.status==="active")||null,[N]),A=N[0]||null,R=T||A,$=S.useMemo(()=>N.reduce((ae,$e)=>ae+($e.redemption_count||0),0),[N]),L=S.useMemo(()=>N.map(ae=>ae.id),[N]),P=S.useMemo(()=>N.map(ae=>ae.last_redeemed).filter(ae=>!!ae).sort((ae,$e)=>new Date($e).getTime()-new Date(ae).getTime())[0]||null,[N]),D=S.useMemo(()=>$===0||L.length===0?null:Pu(L),[L,$]),[q,Y]=S.useState(20),[z,G]=S.useState(1),[te,fe]=S.useState(null),Me=ae=>{let $e="Please try again later";ae instanceof Mr&&ae.data&&ae.data.errors[0]&&($e=ae.data.errors[0].context||ae.data.errors[0].message||$e),As.remove(),rt({title:"Failed to save offer",type:"error",message:$e})},{formState:K,setFormState:Q,updateForm:Ne,handleSave:ue,saveState:we,okProps:ee,errors:pe,clearError:le}=nn({initialState:gu(v),savingDelay:500,onSave:async()=>{let ae=!1;const $e=Qp({formState:K,lastPercentAmount:q,lastFreeMonths:z}),Ft=F2(R),Je=Jp(Ft)!==Jp($e),rn=K.enabled?"active":"archived",ht=K.displayTitle||"",bt=K.displayDescription||"",Bn=R?ht!==(R.display_title||"")||bt!==(R.display_description||""):ht!==""||bt!=="",st=gu(v),Wn=!K.enabled&&!R&&P2(K,st),dt=async It=>{const pn=crypto.getRandomValues(new Uint32Array(1))[0].toString(16).padStart(8,"0"),mt=A2($e,pn);await h({name:mt,code:pn,display_title:ht,display_description:bt,cadence:C,amount:$e.amount,duration:$e.duration,duration_in_months:$e.duration==="repeating"?$e.durationInMonths:null,currency:null,status:It,redemption_type:"retention",tier:null,type:$e.type,currency_restriction:!1}),ae=!0},Le=async()=>{ae&&await g()};if(!(!R&&!K.enabled&&!Wn)){if(Je){!K.enabled&&T&&(await b({...T,status:"archived"}),ae=!0),await dt(rn),await Le();return}if(R){const It=R.status!==rn;(Bn||It)&&(await b({...R,display_title:ht,display_description:bt,status:rn}),ae=!0),await Le();return}(K.enabled||Wn)&&await dt(rn),await Le()}},onSaveError:Me,onValidate:()=>{const ae={};return K.enabled&&(K.type==="percent"&&((K.percentAmount<1||K.percentAmount>100)&&(ae.amount="Enter an amount between 1 and 100%."),K.duration==="repeating"&&!eh(K.durationInMonths)&&(ae.durationInMonths=Zp)),K.type==="free_months"&&(eh(K.freeMonths)||(ae.amount=Zp))),ae}}),de=R?.id||"none",V=`${t}:${de}`;S.useEffect(()=>{!p||x||we==="unsaved"||te===V||(Q(()=>L2(R,v)),fe(V))},[v,V,R,p,te,x,we,Q]),S.useEffect(()=>{K.percentAmount>0&&Y(K.percentAmount)},[K.percentAmount]),S.useEffect(()=>{K.freeMonths>0&&G(K.freeMonths)},[K.freeMonths]);const ve=()=>{a("offers/edit")},De=n.jsx(H2,{cadence:v,clearError:le,errors:pe,formState:K,lastRedeemed:P,membersFilterUrl:D,redemptions:$,updateForm:Ne}),Qe=async()=>{try{await ue({force:!0})&&ve()}catch{}},Dt=S.useMemo(()=>{const ae=Qp({formState:K,lastPercentAmount:q,lastFreeMonths:z}),$e=j.find(Ft=>C==="month"?Ft.monthly_price:Ft.yearly_price);return{enabled:K.enabled,name:`${v} retention`,code:`${v}-retention`,displayTitle:K.displayTitle||"",displayDescription:K.displayDescription||"",type:ae.type,cadence:C,amount:ae.amount,duration:ae.duration,durationInMonths:ae.durationInMonths,currency:"",status:"active",tierId:$e?.id||"",redemptionType:"retention"}},[j,v,K,z,q,C]);S.useEffect(()=>{if(!s.url){w("");return}const ae=Fu(Dt,s.url);w(ae)},[Dt,s.url]);const Gt=n.jsx(Ua,{href:m||"",portalParent:"offers"});return n.jsx(Zr,{afterClose:()=>a("offers"),backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:we==="unsaved",height:"full",okColor:ee.color,okLabel:ee.label||"Save",preview:Gt,previewToolbarBreadcrumbs:[{label:"Offers",onClick:ve},{label:y}],sidebar:De,size:"lg",testId:"retention-offer-modal",title:"Offer",width:1140,onBreadcrumbsBack:ve,onCancel:ve,onOk:Qe})},th=(t,a)=>t.find(s=>s.redemption_type==="retention"&&s.cadence===a&&s.status==="active")||null,nh=(t,a)=>t.reduce((s,i)=>i.redemption_type!=="retention"||i.cadence!==a?s:s+(i.redemption_count||0),0),rh=(t,a)=>t.filter(s=>s.redemption_type==="retention"&&s.cadence===a).map(s=>s.id),_m=t=>t.type==="percent"&&t.amount===100&&t.duration==="repeating",sh=t=>{if(!t)return null;if(_m(t)){const a=t.duration_in_months||0;return`${a} ${a===1?"month":"months"} free`}return t.type==="percent"?`${t.amount}% OFF`:null},ah=t=>{if(!t)return null;if(_m(t))return"";if(t.duration==="once")return"First payment";if(t.duration==="repeating"&&t.duration_in_months){const a=t.duration_in_months===1?"month":"months";return`For ${t.duration_in_months} ${a}`}return t.duration==="forever"?"Forever":null},U2=t=>{const a=th(t,"month"),s=th(t,"year"),i=rh(t,"month"),f=rh(t,"year"),p=nh(t,"month"),x=nh(t,"year");return[{id:"monthly",name:"Monthly retention",description:"Applied to monthly plans",terms:sh(a),termsDetail:ah(a),redemptionOfferIds:i,redemptions:p,status:a?"active":"inactive"},{id:"yearly",name:"Yearly retention",description:"Applied to annual plans",terms:sh(s),termsDetail:ah(s),redemptionOfferIds:f,redemptions:x,status:s?"active":"inactive"}]},B2=t=>t==="month"?"monthly":"yearly",W2=t=>t==="once"?"First payment":t==="repeating"?"Repeating":"Forever",Y2=(t,a,s,i,f)=>{let p="",x="";const h=s==="month"?f?.monthly_price??0:f?.yearly_price??0;let b=h;const g=v=>parseFloat(v.toFixed(2));let m=Df(i)+Da(g(wi(h)));switch(t){case"percent":p="text-green",x=a+"% off",b=h-h*a/100;break;case"fixed":p="text-blue",x=Da(g(wi(a)))+" "+i+" off",b=h-a;break;case"trial":p="text-pink",x=a+" days free",m="";break}b<0&&(b=0);const w=Df(i)+Da(g(wi(b)));return{discountColor:p,discountOffer:x,originalPriceWithCurrency:m,updatedPriceWithCurrency:w}},q2=({showArchived:t,setShowArchived:a,sortOption:s,sortDirection:i,onSortChange:f,onDirectionChange:p})=>n.jsx(Du,{position:"end",trigger:n.jsx(Ie,{"aria-label":"Filter options",className:"p-1 hover:text-black dark:hover:text-white",label:n.jsx(Dy,{size:16,strokeWidth:1.5}),unstyled:!0}),children:n.jsxs("div",{className:"flex min-w-[200px] flex-col p-1 normal-case",children:[n.jsx("div",{className:"cursor-default pt-2 pl-3 text-xs font-medium tracking-wide text-grey-700 uppercase select-none",children:"Sort by"}),n.jsx("div",{className:"flex flex-col py-1",children:[{id:"date-added",label:"Date added"},{id:"name",label:"Name"},{id:"redemptions",label:"Redemptions"}].map(x=>n.jsxs("div",{className:"group relative mx-1 flex items-center rounded-[2.5px] hover:bg-grey-100 dark:hover:bg-grey-800",children:[n.jsxs("button",{className:"flex w-full cursor-pointer items-center px-8 py-1.5 pr-12 text-left text-sm text-black dark:text-white",type:"button",onClick:()=>f(x.id),children:[s===x.id&&n.jsx(qe,{className:"absolute left-2",name:"check",size:"xs"}),x.label]}),s===x.id&&n.jsx("button",{className:"absolute right-1 flex size-6 cursor-pointer items-center justify-center rounded-full hover:bg-grey-300 dark:hover:bg-grey-700",title:i==="asc"?"Ascending":"Descending",type:"button",onClick:()=>p(),children:n.jsx(qe,{name:i==="asc"?"arrow-up":"arrow-down",size:"xs"})})]},x.id))}),n.jsx("div",{className:"-mx-1 mt-1 border-t border-t-grey-200 dark:border-t-grey-800",children:n.jsx("div",{className:"group relative mx-2 mt-1 flex items-center rounded-[2.5px] py-1",children:n.jsxs("div",{className:"flex w-full items-center px-8 py-1.5 pr-2 text-sm text-black dark:text-white",children:[n.jsx(Ay,{className:"absolute left-2 -mt-0.5 text-black dark:text-white",size:14,strokeWidth:1.5}),n.jsx("div",{className:"grow [&>div]:w-full",children:n.jsx(Be,{checked:t,direction:"rtl",label:"Show archived",labelClasses:"text-sm text-black dark:text-white",onChange:x=>{a(x.target.checked)}})})]})})})]})}),G2=({offer:t,onClick:a})=>{const s=t.redemptions>0&&t.redemptionOfferIds.length>0?Pu(t.redemptionOfferIds):void 0;return n.jsxs("tr",{className:"group relative border-b border-b-grey-200 dark:border-grey-800","data-testid":"retention-offer-item",children:[n.jsx("td",{className:"sticky left-0 z-10 bg-white p-0 dark:bg-black",children:n.jsxs("button",{className:"block w-full cursor-pointer p-5 pl-0 text-left",type:"button",onClick:a,children:[n.jsx("span",{className:"font-semibold",children:t.name}),n.jsx("br",{}),n.jsx("span",{className:"text-sm text-grey-700",children:t.description})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:t.terms?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-[1.3rem] font-medium uppercase",children:t.terms}),n.jsx("br",{}),n.jsx("span",{className:"text-grey-700",children:t.termsDetail})]}):n.jsx("span",{className:"text-grey-700",children:"–"})})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:n.jsx("span",{className:"text-grey-700",children:"–"})})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:s?n.jsx("a",{className:"block cursor-pointer p-5 hover:underline","data-testid":`retention-redemptions-link-${t.id}`,href:s,children:t.redemptions}):n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left","data-testid":`retention-redemptions-link-${t.id}`,type:"button",onClick:a,children:t.redemptions})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:t.status==="active"?n.jsx("span",{className:"inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-2 py-0.5 text-2xs font-semibold tracking-wide text-green uppercase",children:"Active"}):n.jsx("span",{className:"inline-flex items-center rounded-full bg-grey-200 px-2 py-0.5 text-2xs font-semibold tracking-wide text-grey-700 uppercase dark:bg-grey-900 dark:text-grey-500",children:"Inactive"})})})]})},oh=()=>{const t=Lt(),{updateRoute:a}=He(),{data:{offers:s=[]}={}}=ju(),{data:{tiers:i}={}}=Kr(),f=s.filter(D=>D.redemption_type==="signup"),p=U2(s),{sortingState:x,setSortingState:h}=vy(),b=x?.find(D=>D.type==="offers"),{offersShowArchived:g,setOffersShowArchived:m}=yy(),w=b?.option||"date-added",v=b?.direction||"desc",y=D=>{D&&a(`offers/edit/${D}`)},C=D=>{a(`offers/edit/retention/${D}`)},j=f.sort((D,q)=>{const Y=v==="desc"?-1:1;switch(w){case"name":return Y*D.name.localeCompare(q.name);case"redemptions":return Y*(D.redemption_count-q.redemption_count);default:return Y*((D.created_at?new Date(D.created_at).getTime():0)-(q.created_at?new Date(q.created_at).getTime():0))}}),N=Ba(i||[]),T=j.filter(D=>{const q=i?.find(G=>G.id===D?.tier?.id),Y=D.status==="active"&&q&&q.active===!0,z=D.status==="archived"||q&&q.active===!1;return!!(Y||g&&z)}),A=D=>{h?.([{type:"offers",option:D,direction:v}])},R=()=>{h?.([{type:"offers",option:w,direction:v==="asc"?"desc":"asc"}])},$=D=>{const q=i?.find(Y=>Y.id===D?.tier?.id);return D.status==="archived"||q&&q.active===!1},L=[{key:"cancel-modal",label:"Close",onClick:()=>{t.remove(),a("offers")}},{key:"new-offer",icon:"add",label:"New offer",color:"green",onClick:()=>{N.length===0?rt({type:"info",title:"You must have an active tier to create an offer."}):a("offers/new")}}],P=n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"m-0 min-w-[900px]",children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-[25%]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[220px]"})]}),n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-b-grey-200 dark:border-grey-800",children:[n.jsx("th",{className:"sticky left-0 z-10 bg-white p-0 pb-2.5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase dark:bg-black",children:"Name"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Terms"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Price"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Redemptions"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:n.jsxs("span",{className:"flex items-center justify-between",children:["Status",n.jsx(q2,{setShowArchived:m,showArchived:g,sortDirection:v,sortOption:w,onDirectionChange:R,onSortChange:A})]})})]})}),n.jsxs("tbody",{children:[p.map(D=>n.jsx(G2,{offer:D,onClick:()=>C(D.id)},D.id)),T.map(D=>{const q=i?.find(fe=>fe.id===D?.tier?.id);if(!q)return null;const Y=$(D),{discountOffer:z,originalPriceWithCurrency:G,updatedPriceWithCurrency:te}=Y2(D.type,D.amount,D.cadence,D.currency||"USD",q);return n.jsxs("tr",{className:`group relative border-b border-b-grey-200 dark:border-grey-800 ${Y?"opacity-60":""}`,"data-testid":"offer-item",children:[n.jsx("td",{className:"sticky left-0 z-10 bg-white p-0 dark:bg-black",children:n.jsxs("a",{className:"block cursor-pointer p-5 pl-0",onClick:()=>y(D.id),children:[n.jsx("span",{className:"font-semibold",children:D?.name}),n.jsx("br",{}),n.jsxs("span",{className:"text-sm text-grey-700",children:[q.name," ",B2(D.cadence)]})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsxs("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:[n.jsx("span",{className:"text-[1.3rem] font-medium uppercase",children:z}),n.jsx("br",{}),n.jsx("span",{className:"text-grey-700",children:D.type!=="trial"?W2(D.duration):"Trial period"})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsxs("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:[n.jsx("span",{className:"font-medium",children:te})," ",D.type!=="trial"?n.jsx("span",{className:'relative text-xs text-grey-700 before:absolute before:-inset-x-0.5 before:top-1/2 before:rotate-[-20deg] before:border-t before:content-[""]',children:G}):null]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("a",{className:`block cursor-pointer p-5 ${D.redemption_count===0?"":"hover:underline"}`,href:D.redemption_count>0&&D.id?vm(D.id):void 0,onClick:D.redemption_count===0&&D.id?()=>y(D.id):void 0,children:D.redemption_count})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:Y?n.jsx("span",{className:"inline-flex items-center rounded-full bg-grey-200 px-2 py-0.5 text-2xs font-semibold tracking-wide text-grey-700 uppercase dark:bg-grey-900 dark:text-grey-500",children:"Archived"}):n.jsx("span",{className:"inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-2 py-0.5 text-2xs font-semibold tracking-wide text-green uppercase",children:"Active"})})})]},D.id)})]})]})});return n.jsx(ct,{afterClose:()=>{a("offers")},animate:!1,backDropClick:!1,cancelLabel:"",footer:!1,height:"full",size:"lg",testId:"offers-modal",title:"Offers",topRightContent:n.jsx(Fn,{buttons:L}),width:1140,children:n.jsx("div",{className:"flex h-full flex-col pt-8",children:P})})},X2=({route:t})=>{if(t==="offers/new")return n.jsx(E2,{});if(t.startsWith("offers/edit/retention/")&&t.length>22){const a=t.split("/").pop();return n.jsx(z2,{id:a||""})}else{if(t==="offers/edit/retention/"||t==="offers/edit/retention")return n.jsx(oh,{});if(t.startsWith("offers/edit/")&&t.length>12){const a=t.split("/").pop();return n.jsx($2,{id:a||""})}else if(t.startsWith("offers/success/")&&t.length>15){const a=t.split("/").pop();return n.jsx(wm,{id:a||""})}else if(t==="offers/edit"||t==="offers/edit/")return n.jsx(oh,{})}},K2=()=>{const{route:t}=He();return n.jsx(X2,{route:t})},Z2=ge.create(K2),V2=""+new URL("pintura-screenshot-1gRQGS4m.png",import.meta.url).href,Q2=Gr({method:"POST",path:()=>"/files/upload/",body:({file:t})=>{const a=new FormData;return a.append("file",t),a}}),J2=ge.create(()=>{const{updateRoute:t}=He(),[a,s]=S.useState({js:!1,css:!1}),{settings:i,config:f}=Ue(),[p]=ot(i,["pintura"]),{mutateAsync:x}=jr(),{mutateAsync:h}=Q2(),b=Ze();S.useEffect(()=>{v(p||!1)},[p]);const[g,m]=S.useState("Save"),[w,v]=S.useState(!!p),y=async()=>{const R=[{key:"pintura",value:w}];try{m("Saving..."),await Promise.all([x(R),new Promise($=>{setTimeout($,1e3)})]),m("Saved")}catch($){b($)}finally{setTimeout(()=>m("Save"),1e3)}},C=S.useRef(null),j=S.useRef(null),N=R=>{R==="js"&&C.current?.click(),R==="css"&&j.current?.click()},T=async(R,$)=>{try{s(Y=>({...Y,[$]:!0}));const L=R.target?.files?.[0];if(!L)return;const{files:P}=await h({file:L}),D=P[0].url,q=[{key:`pintura_${$}_url`,value:D}];await x(q),s(Y=>({...Y,[$]:!1})),rt({type:"success",title:`Pintura ${$} uploaded`})}catch(L){s({js:!1,css:!1}),b(L)}},A=w!==p;return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:A,okColor:g==="Saved"?"green":"black",okLabel:g,testId:"pintura-modal",title:"",onOk:y,children:[n.jsx(Jr,{detail:"Advanced image editing",icon:n.jsx(qe,{name:"pintura",size:48}),title:"Pintura"}),n.jsxs("div",{className:"mt-7",children:[!f.pintura&&n.jsxs("div",{className:"mb-7 flex flex-col items-stretch justify-between gap-4 rounded-sm bg-grey-75 p-4 md:flex-row md:p-7 dark:bg-grey-950",children:[n.jsxs("div",{className:"md:basis-1/2",children:[n.jsx("p",{className:"mb-4 font-bold",children:"Add advanced image editing to Ghost, with Pintura"}),n.jsx("p",{className:"mb-4 text-sm",children:"Pintura is a powerful JavaScript image editor that allows you to crop, rotate, annotate and modify images directly inside Ghost."}),n.jsx("p",{className:"text-sm",children:"Try a demo, purchase a license, and download the required CSS/JS files from pqina.nl/pintura/ to activate this feature."})]}),n.jsxs("div",{className:"flex grow flex-col items-end justify-between gap-2 md:basis-1/2 md:gap-0",children:[n.jsx("img",{alt:"Pintura screenshot",src:V2}),n.jsx("a",{className:"-mb-1 text-sm font-bold text-green",href:"https://pqina.nl/pintura/ghost/?ref=ghost.org",rel:"noopener noreferrer",target:"_blank",children:"Find out more →"})]})]}),n.jsxs(Ye,{marginBottom:!1,title:"Pintura configuration",grouped:!0,children:[n.jsx(Be,{checked:w,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://pqina.nl/pintura/ghost/?ref=ghost.org",rel:"noopener noreferrer",target:"_blank",children:"Pintura"})," for editing your images in Ghost"]}),label:"Enable Pintura",onChange:R=>{v(R.target.checked)}}),w&&!f.pintura&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-col justify-between gap-1 md:flex-row md:items-center",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Upload Pintura script"}),n.jsxs("div",{className:"text-xs text-grey-600",children:["Upload the ",n.jsx("code",{children:"pintura-umd.js"})," file from the Pintura package"]})]}),n.jsx("input",{ref:C,accept:".js",type:"file",hidden:!0,onChange:async R=>{await T(R,"js")}}),n.jsx(Ie,{color:"outline",disabled:a.js,label:"Upload",onClick:()=>{N("js")}})]}),n.jsxs("div",{className:"flex flex-col justify-between gap-1 md:flex-row md:items-center",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Upload Pintura styles"}),n.jsxs("div",{className:"text-xs text-grey-600",children:["Upload the ",n.jsx("code",{children:"pintura.css"})," file from the Pintura package"]})]}),n.jsx("input",{ref:j,accept:".css",type:"file",hidden:!0,onChange:async R=>{await T(R,"css")}}),n.jsx(Ie,{color:"outline",disabled:a.css,label:"Upload",onClick:()=>{N("css")}})]})]})]})]})]})}),ek=({localSettings:t,updateSetting:a})=>{const[s,i,f,p,x,h]=ot(t,["transistor","transistor_portal_enabled","transistor_portal_heading","transistor_portal_description","transistor_portal_button_text","transistor_portal_url_template"]);if(!(s===!0))return null;const g=i===!0,m=f,w=p,v=x,y=h;return n.jsxs(n.Fragment,{children:[n.jsx($s,{}),n.jsx(lt,{level:5,children:"Transistor"}),n.jsx(Be,{checked:g,direction:"rtl",hint:"Show a section on the account page for members to access private podcasts",label:"Enable Transistor integration",onChange:C=>a("transistor_portal_enabled",C.target.checked)}),g&&n.jsxs(n.Fragment,{children:[n.jsx(_e,{hint:"The heading displayed above the Transistor section",placeholder:"Podcasts",title:"Heading",value:m,onChange:C=>a("transistor_portal_heading",C.target.value)}),n.jsx(_e,{hint:"A short description of what members can do",placeholder:"Access your RSS feeds",title:"Description",value:w,onChange:C=>a("transistor_portal_description",C.target.value)}),n.jsx(_e,{hint:"The text displayed on the button",placeholder:"Manage",title:"Button text",value:v,onChange:C=>a("transistor_portal_button_text",C.target.value)}),n.jsx(_e,{hint:"Use {memberUuid} as a placeholder for the member ID",placeholder:"https://partner.transistor.fm/ghost/{memberUuid}",title:"URL template",value:y,onChange:C=>a("transistor_portal_url_template",C.target.value)})]})]})},tk=({localSettings:t,updateSetting:a,errors:s,setError:i})=>{const{siteData:f,settings:p,config:x}=Ue(),[h,b]=ot(p,["members_support_address","support_email_address"]),g=b?.toString()||eu(h?.toString()||"",f,x),m=Fv(f,x),[w,v]=S.useState(g),y=C=>{let j=C.target.value;j?Un.isEmail(j)?i("members_support_address",""):i("members_support_address","Enter a valid email address"):i("members_support_address","Enter an email address");let N=m&&j===`noreply@${m}`?"noreply":j;a("members_support_address",N),v(eu(N,f,x))};return S.useEffect(()=>{v(g)},[g]),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(_e,{error:!!s.members_support_address,hint:s.members_support_address,title:"Support email address",value:w,onBlur:y,onChange:C=>v(C.target.value)}),n.jsx(ek,{localSettings:t,updateSetting:a})]})})},Qc=[{icon:"portal-icon-1",value:"icon-1"},{icon:"portal-icon-2",value:"icon-2"},{icon:"portal-icon-3",value:"icon-3"},{icon:"portal-icon-4",value:"icon-4"},{icon:"portal-icon-5",value:"icon-5"}],nk=({localSettings:t,updateSetting:a})=>{const{mutateAsync:s}=Ps(),i=Ze(),[f,p,x,h]=ot(t,["portal_button","portal_button_style","portal_button_icon","portal_button_signup_text"]),b=x||Qc[0].value,g=Qc.map(({value:j})=>j).includes(b),[m,w]=S.useState(g?void 0:b),v=async j=>{try{const N=rr(await s({file:j}));a("portal_button_icon",N),w(N)}catch(N){const T=N;T.response.status===415&&(T.message="Unsupported file type"),i(T)}},y=()=>{a("portal_button_icon",null),w(void 0)},C=[{value:"icon-and-text",label:"Icon and text"},{value:"icon-only",label:"Icon only"},{value:"text-only",label:"Text only"}];return n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(Be,{checked:!!f,direction:"rtl",label:"Show portal button",onChange:j=>a("portal_button",j.target.checked)}),f&&n.jsxs(n.Fragment,{children:[n.jsx(jt,{options:C,selectedOption:C.find(j=>j.value===p),title:"Button style",onSelect:j=>a("portal_button_style",j?.value||null)}),p?.toString()?.includes("icon")&&n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(lt,{level:6,grey:!0,children:"Icon"}),n.jsxs("div",{className:"flex justify-between",children:[Qc.map(j=>n.jsx("button",{className:me("border p-3",b===j.value?"border-green":"border-transparent"),type:"button",onClick:()=>a("portal_button_icon",j.value),children:n.jsx(qe,{className:`size-5 ${b===j.value?"text-green":"text-black opacity-70 transition-all hover:opacity-100 dark:text-white"}`,name:j.icon})},j.value)),n.jsx("div",{className:me("relative w-[46px] border",b===m?"border-green":"border-transparent"),children:n.jsx(ar,{deleteButtonClassName:"invisible absolute -right-2 -top-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-full bg-[rgba(0,0,0,0.75)] text-white hover:bg-black group-hover:visible!",deleteButtonContent:n.jsx(qe,{colorClass:"text-white",name:"trash",size:"sm"}),height:"46px",id:"test",imageClassName:"cursor-pointer",imageURL:m,width:"46px",deleteButtonUnstyled:!0,onDelete:y,onImageClick:()=>m&&a("portal_button_icon",m),onUpload:v,children:n.jsx(qe,{className:"dark:text-white",name:"upload",size:"md"})})})]})]}),p?.toString()?.includes("text")&&n.jsx(_e,{title:"Signup button text",value:h,onChange:j=>a("portal_button_signup_text",j.target.value)})]})]})})},Mm=t=>{const{config:a}=Ue();return a.labs[t]||!1},vn=({name:t,value:a})=>{const s=S.useId();return n.jsx(Nr,{action:n.jsx(Ie,{color:"black",label:"Copy",link:!0,onClick:i=>{navigator.clipboard.writeText(a);const f=i?.target;f.innerText="Copied",setTimeout(()=>{f.innerText="Copy"},1e3)}}),separator:!0,children:n.jsxs("div",{className:"flex w-full grow flex-col py-3 lg:flex-row lg:items-center lg:gap-5",children:[n.jsxs("label",{className:"inline-block whitespace-nowrap lg:w-[180px] lg:min-w-[180px]",htmlFor:s,children:[t,":"]}),n.jsx(_e,{className:"grow border-b-grey-500 bg-transparent py-1 text-grey-700 lg:p-1",id:s,value:a,disabled:!0,unstyled:!0})]})})},rk=()=>{const[t,a]=S.useState(!1),[s,i]=S.useState(""),{siteData:f}=Ue(),{data:{tiers:p}={}}=Kr(),x=Ba(p||[]),h=Mm("giftSubscriptions"),b=()=>{a(!t)};S.useEffect(()=>{x?.length&&!s&&i(x[0].id)},[x,s]);const g=x?.map(w=>({label:w.name,value:w.id})),m=Pn(f);return n.jsxs(Su,{className:"max-w-[920px] text-base text-black dark:text-white",heading:"Links",children:[n.jsxs("p",{className:"-mt-6 mb-16",children:["Use these ",t?"data attributes":"links"," in your theme to show pages of Portal."]}),n.jsxs(sr,{actions:n.jsx(Ie,{color:"green",label:t?"Links":"Data attributes",link:!0,onClick:b}),title:"Generic",titleSize:"lg",children:[n.jsx(vn,{name:"Default",value:t?"data-portal":`${m}#/portal`}),n.jsx(vn,{name:"Sign in",value:t?'data-portal="signin"':`${m}#/portal/signin`}),n.jsx(vn,{name:"Sign up",value:t?'data-portal="signup"':`${m}#/portal/signup`}),h&&n.jsx(vn,{name:"Gift subscription",value:t?'data-portal="gift"':`${m}#/portal/gift`})]}),n.jsxs(sr,{className:"mt-14",title:"Tiers",titleSize:"lg",children:[n.jsx(Nr,{hideActions:!0,separator:!0,children:n.jsxs("div",{className:"flex w-full items-center gap-2 py-2",children:[n.jsx("span",{className:"inline-block w-[180px] min-w-[180px] shrink-0",children:"Tier:"}),n.jsx(jt,{options:g,selectedOption:g.find(w=>w.value===s),onSelect:w=>{w&&i(w?.value)}})]})}),n.jsx(vn,{name:"Signup / Monthly",value:t?`data-portal="signup/${s}/monthly"`:`${m}#/portal/signup/${s}/monthly`}),n.jsx(vn,{name:"Signup / Yearly",value:t?`data-portal="signup/${s}/yearly"`:`${m}#/portal/signup/${s}/yearly`}),n.jsx(vn,{name:"Signup / Free",value:t?'data-portal="signup/free"':`${m}#/portal/signup/free`})]}),n.jsxs(sr,{className:"mt-14",title:"Account",titleSize:"lg",children:[n.jsx(vn,{name:"Account",value:t?'data-portal="account"':`${m}#/portal/account`}),n.jsx(vn,{name:"Account / Plans",value:t?'data-portal="account/plans"':`${m}#/portal/account/plans`}),n.jsx(vn,{name:"Account / Profile",value:t?'data-portal="account/profile"':`${m}#/portal/account/profile`}),n.jsx(vn,{name:"Account / Newsletters",value:t?'data-portal="account/newsletters"':`${m}#/portal/account/newsletters`}),n.jsx(vn,{name:"Account / Newsletter help",value:t?'data-portal="account/newsletters/help"':`${m}#/portal/account/newsletters/help`})]})]})},sk=({settings:t,config:a,tiers:s,siteData:i,selectedTab:f})=>{if(!i?.url)return null;let p=s.filter(y=>y.visibility==="public"&&y.type==="paid").map(y=>y.id);const x=i.url.replace(/\/$/,""),h="/?v=modal-portal-settings#/portal/preview",b=JSON.parse(Tt(t,"portal_plans")||""),g=new URLSearchParams;g.append("button",Tt(t,"portal_button")?"true":"false"),g.append("name",Tt(t,"portal_name")?"true":"false"),g.append("isFree",b.includes("free")?"true":"false"),g.append("isMonthly",Ds(t,a)&&b.includes("monthly")?"true":"false"),g.append("isYearly",Ds(t,a)&&b.includes("yearly")?"true":"false"),g.append("page",f==="account"?"accountHome":"signup"),g.append("buttonIcon",encodeURIComponent(Tt(t,"portal_button_icon")||"icon-1")),g.append("signupButtonText",encodeURIComponent(Tt(t,"portal_button_signup_text")||"")),g.append("membersSignupAccess",Tt(t,"members_signup_access")||"all"),g.append("allowSelfSignup",Tt(t,"allow_self_signup")||"false"),g.append("signupTermsHtml",Tt(t,"portal_signup_terms_html")||""),g.append("signupCheckboxRequired",Tt(t,"portal_signup_checkbox_required")?"true":"false"),g.append("portalProducts",p.join(","));const m=Tt(t,"portal_default_plan");m&&g.append("portalDefaultPlan",m),b&&b.length&&g.append("portalPrices",encodeURIComponent(b.join(",")));const w=Tt(t,"accent_color");w!=null&&g.append("accentColor",encodeURIComponent(w));const v=Tt(t,"portal_button_style");return v&&g.append("buttonStyle",encodeURIComponent(v)),g.append("disableBackground","false"),Tt(t,"transistor")&&g.append("transistorPortalSettings",JSON.stringify({enabled:Tt(t,"transistor_portal_enabled"),heading:Tt(t,"transistor_portal_heading")||"Podcasts",description:Tt(t,"transistor_portal_description")||"Access your RSS feeds",button_text:Tt(t,"transistor_portal_button_text")||"Manage",url_template:Tt(t,"transistor_portal_url_template")||"https://partner.transistor.fm/ghost/{memberUuid}"})),`${x}${h}?${g.toString()}`},ak=({selectedTab:t="signup",localSettings:a,localTiers:s})=>{const{siteData:i,config:f}=Ue(),p=sk({settings:a,tiers:s,selectedTab:t,siteData:i,config:f});let x=n.jsx(n.Fragment,{});switch(t){case"account":x=n.jsx(n.Fragment,{children:n.jsx(Ua,{href:p||"",portalParent:"preview",selectedTab:t})});break;case"links":x=n.jsx(rk,{});break;default:x=n.jsx(n.Fragment,{children:n.jsx(Ua,{href:p||"",portalParent:"preview",selectedTab:t})});break}return x},ok=({localSettings:t,updateSetting:a,localTiers:s,updateTier:i,errors:f,setError:p})=>{const{config:x}=Ue(),[h,b,g,m,w,v]=ot(t,["members_signup_access","portal_name","portal_signup_terms_html","portal_signup_checkbox_required","portal_plans","portal_default_plan"]),y=JSON.parse(w?.toString()||"[]"),C=115,j=S.useMemo(()=>{const Y=document.createElement("div");return Y.innerHTML=g?.toString()||"",Y.innerText.length},[g]),N=S.useCallback((Y,z)=>{p(Y,z)},[]);S.useEffect(()=>{j>C?N("portal_signup_terms_html","Signup notice is too long"):N("portal_signup_terms_html",void 0)},[j,N]);const T=Y=>{const z=y.indexOf(Y);z===-1?y.push(Y):y.splice(z,1),a("portal_plans",JSON.stringify(y)),v==="yearly"?!y.includes("yearly")&&y.includes("monthly")&&a("portal_default_plan","monthly"):v==="monthly"&&(y.includes("monthly")||a("portal_default_plan","yearly"))},A=h==="all"||h==="paid",R=h==="all",$=Ds(t,x);let L=[];s&&s.forEach(Y=>{Y.type==="free"&&R&&L.push({checked:y.includes("free"),disabled:!A,label:Y.name,value:"free",testId:"free-tier-checkbox",onChange:z=>{y.includes("free")&&!z&&y.splice(y.indexOf("free"),1),!y.includes("free")&&z&&y.push("free"),a("portal_plans",JSON.stringify(y)),i({...Y,visibility:z?"public":"none"})}})});const P=Ba(s)||[],D=[{value:"yearly",label:"Yearly"},{value:"monthly",label:"Monthly"}];$&&P.length>0&&P.forEach(Y=>{L.push({checked:Y.visibility==="public",label:Y.name,value:Y.id,onChange:(z=>i({...Y,visibility:z?"public":"none"}))})});const q=$&&P.length>0&&P.some(Y=>Y.visibility==="public");return n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(Be,{checked:!!b,direction:"rtl",disabled:!A,label:"Display name in signup form",onChange:Y=>a("portal_name",Y.target.checked)}),n.jsx(au,{checkboxes:L,title:"Available tiers"}),q&&n.jsxs(n.Fragment,{children:[n.jsx(au,{checkboxes:[{checked:y.includes("monthly"),disabled:!A,label:"Monthly",value:"monthly",onChange:()=>{T("monthly")}},{checked:y.includes("yearly"),disabled:!A,label:"Yearly",value:"yearly",onChange:()=>{T("yearly")}}],title:"Available prices"}),y.includes("yearly")&&y.includes("monthly")&&n.jsx(jt,{options:D,selectedOption:D.find(Y=>Y.value===v),title:"Default price at signup",onSelect:Y=>{a("portal_default_plan",Y?.value??"yearly")}})]}),n.jsx(Cu,{error:!!f.portal_signup_terms_html,hint:f.portal_signup_terms_html||n.jsxs(n.Fragment,{children:["Recommended: ",n.jsx("strong",{children:"115"})," characters. You've used ",n.jsx("strong",{className:"text-green",children:j})]}),nodes:"MINIMAL_NODES",placeholder:"By signing up, I agree to receive emails from ...",title:"Display notice at signup",value:g?.toString(),onChange:Y=>a("portal_signup_terms_html",Y)}),g?.toString()&&n.jsx(Be,{checked:!!m,disabled:!A,label:"Require agreement",labelStyle:"heading",onChange:Y=>a("portal_signup_checkbox_required",Y.target.checked)})]})})},ik="SettingsResponseType",lk=Gr({path:()=>"/settings/verifications",method:"PUT",body:({token:t})=>({token:t}),updateQueries:{dataType:ik,emberUpdateType:"createOrUpdate",update:t=>({...t,settings:t.settings})}}),ck=({localSettings:t,updateSetting:a,localTiers:s,updateTier:i,errors:f,setError:p,selectedTab:x,onTabChange:h})=>{const b=[{id:"signupOptions",title:"Signup options",contents:n.jsx(ok,{errors:f,localSettings:t,localTiers:s,setError:p,updateSetting:a,updateTier:i})},{id:"lookAndFeel",title:"Look & feel",contents:n.jsx(nk,{localSettings:t,updateSetting:a})},{id:"accountPage",title:"Account page",contents:n.jsx(tk,{errors:f,localSettings:t,setError:p,updateSetting:a})}];return n.jsx("div",{className:"pt-4",children:n.jsx(kr,{selectedTab:x,tabs:b,onTabChange:h})})},uk=()=>{const{updateRoute:t}=He(),[a,s]=S.useState("signup"),[i,f]=S.useState("signupOptions"),p=Ze(),{settings:x,siteData:h,config:b}=Ue(),{mutateAsync:g}=jr(),{data:{tiers:m}={}}=Kr(),{mutateAsync:w}=Tu(),{mutateAsync:v}=lk(),{getParam:y}=yh(),C=y("verifyEmail");S.useEffect(()=>{C&&(async({token:Q})=>{try{let{settings:Ne}=await v({token:Q});const[ue]=ot(Ne,["members_support_address"]);ge.show(xt,{title:"Support address verified",prompt:n.jsxs(n.Fragment,{children:["Your support email address has been changed to ",n.jsx("strong",{children:ue}),"."]}),okLabel:"Close",cancelLabel:"",onOk:we=>we?.remove()})}catch(Ne){let ue="There was an error verifying your email address. Please try again.";Ne?.message==="Token expired"&&(ue="Verification link has expired."),ge.show(xt,{title:"Error verifying support address",prompt:ue,okLabel:"Close",cancelLabel:"",onOk:we=>we?.remove()}),p(Ne,{withToast:!1})}})({token:C})},[p,C,v]);const{formState:j,setFormState:N,saveState:T,handleSave:A,updateForm:R,okProps:$}=nn({initialState:{settings:x,tiers:m||[]},savingDelay:500,onSave:async()=>{await Promise.all(j.tiers.filter(({dirty:ue})=>ue).map(ue=>w(ue))),N(ue=>({...ue,tiers:j.tiers.map(we=>({...we,dirty:!1}))}));const K=j.settings.filter(ue=>ue.dirty);if(!K.length)return;const{meta:Q,settings:Ne}=await g(K);if(N(ue=>({...ue,settings:j.settings.map(we=>({...we,dirty:!1}))})),Q?.sent_email_verification){const ue=j.settings.find(ee=>ee.key==="members_support_address")?.value,we=Ne.find(ee=>ee.key==="support_email_address")?.value||eu(Ne.find(ee=>ee.key==="members_support_address")?.value?.toString()||"noreply",h,b);ge.show(xt,{title:"Confirm email address",prompt:n.jsxs(n.Fragment,{children:["We've sent a confirmation email to ",n.jsx("strong",{children:ue}),". Until verified, your support email address will remain ",we,"."]}),okLabel:"Close",cancelLabel:"",onOk:ee=>ee?.remove()})}},onSaveError:p});S.useEffect(()=>{!j.tiers.length&&m?.length&&N(K=>({...K,tiers:m}))},[m,j.tiers,N]);const[L,P]=S.useState({}),D=(K,Q)=>{R(Ne=>({...Ne,settings:Ne.settings.map(ue=>ue.key===K?{...ue,value:Q,dirty:!0}:ue)}))},q=(K,Q)=>{P(Ne=>({...Ne,[K]:Q}))},Y=K=>{R(Q=>({...Q,tiers:Q.tiers.map(Ne=>Ne.id===K.id?{...K,dirty:!0}:Ne)}))},z=K=>{s(K),K==="signup"?f("signupOptions"):K==="account"&&f("accountPage")},G=K=>{f(K),K==="signupOptions"?s("signup"):K==="accountPage"&&s("account")},te=n.jsx(ck,{errors:L,localSettings:j.settings,localTiers:j.tiers,selectedTab:i,setError:q,updateSetting:D,updateTier:Y,onTabChange:G}),fe=n.jsx(ak,{localSettings:j.settings,localTiers:j.tiers,selectedTab:a});let Me=[{id:"signup",title:"Signup"},{id:"account",title:"Account page"},{id:"links",title:"Links"}];return n.jsx(Zr,{afterClose:()=>{t("portal")},buttonsDisabled:$.disabled,cancelLabel:"Close",deviceSelector:!1,dirty:T==="unsaved",okColor:$.color,okLabel:$.label||"Save",preview:fe,previewBgColor:a==="links"?"white":"greygradient",previewToolbarTabs:Me,selectedURL:a,sidebar:te,testId:"portal-modal",title:"Portal",onOk:async()=>{Object.values(L).filter(Boolean).length||await A({force:!0})},onSelectURL:z})},dk=ge.create(uk),fk=ge.create(()=>{const{updateRoute:t}=He(),{localSettings:a,updateSetting:s,handleSave:i,validate:f,errors:p,clearError:x,okProps:h}=Xr({onValidate:()=>{const y={};return b&&!Un.isURL(b,{require_protocol:!0})&&(y.slackUrl="The URL must be in a format like https://hooks.slack.com/services/<your personal key>"),y},savingDelay:500}),[b,g]=ot(a,["slack_url","slack_username"]),{mutateAsync:m}=Pv(),w=async()=>{As.remove(),await i()&&(await m(null),rt({title:"Check your Slack channel for the test message",type:"info"}))},v=a.some(y=>y.dirty);return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:v,okColor:h.color,okLabel:h.label||"Save",testId:"slack-modal",title:"",onOk:async()=>{As.remove(),await i()},children:[n.jsx(Jr,{detail:"A messaging app for teams",icon:n.jsx(qe,{name:"slack",size:56}),title:"Slack"}),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{marginBottom:!1,title:"Slack configuration",grouped:!0,children:[n.jsx(_e,{error:!!p.slackUrl,hint:p.slackUrl||n.jsxs(n.Fragment,{children:["Automatically send newly published posts to a channel in Slack or any Slack-compatible service like Discord or Mattermost. Set up a new incoming webhook ",n.jsx("a",{href:"https://my.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks",children:"here"}),", and grab the URL."]}),placeholder:"https://hooks.slack.com/services/...",title:"Webhook URL",value:b,onBlur:f,onChange:y=>s("slack_url",y.target.value),onKeyDown:()=>x("slackUrl")}),n.jsxs("div",{className:"flex w-full flex-col gap-2 md:flex-row md:items-center",children:[n.jsx(_e,{containerClassName:"grow",hint:"The username to display messages from",title:"Username",value:g,onChange:y=>s("slack_username",y.target.value)}),n.jsx(Ie,{color:"outline",label:"Send test notification",onClick:w})]})]})})]})}),pk=""+new URL("stripe-thumb-Cu2h4McY.jpg",import.meta.url).href,hk=""+new URL("orb-squircle-e1heFqOI.png",import.meta.url).href,mk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20400%20400'%20style='enable-background:new%200%200%20400%20400'%20xml:space='preserve'%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635bff'%20d='M0%200h400v400H0z'/%3e%3cpath%20d='M184.4%20155.5c0-9.4%207.7-13.1%2020.5-13.1%2018.4%200%2041.6%205.6%2060%2015.5v-56.8C244.8%2093.1%20225%2090%20205%2090c-49.1%200-81.7%2025.6-81.7%2068.4%200%2066.7%2091.9%2056.1%2091.9%2084.9%200%2011.1-9.7%2014.7-23.2%2014.7-20.1%200-45.7-8.2-66-19.3v57.5c22.5%209.7%2045.2%2013.8%2066%2013.8%2050.3%200%2084.9-24.9%2084.9-68.2-.4-72-92.5-59.2-92.5-86.3z'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23fff'/%3e%3c/svg%3e",gk=""+new URL("stripe-verified-DM7Q8nrY.svg",import.meta.url).href,xu=1e3,xk=15*xu,bk=({onNext:t})=>n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(lt,{level:3,children:"Getting paid"}),n.jsx("img",{alt:"Stripe Verified Partner Badge",src:gk})]}),n.jsxs("div",{className:"mt-6 mb-7",children:["Stripe is our exclusive direct payments partner. Ghost collects ",n.jsx("strong",{children:"no fees"})," on any payments! If you don’t have a Stripe account yet, you can ",n.jsx("a",{className:"underline",href:"https://stripe.com",rel:"noopener noreferrer",target:"_blank",children:"sign up here"}),"."]}),n.jsx(Nh,{label:n.jsx(n.Fragment,{children:"I have a Stripe account, let's go →"}),onClick:t})]}),wk=()=>{const[t,a]=S.useState(!1),[s,i]=S.useState(""),[f,p]=S.useState(!1),[x,h]=S.useState(""),{refetch:b}=Kr({searchParams:{filter:"type:paid+active:true"},enabled:!1}),{mutateAsync:g}=Tu(),{mutateAsync:m}=jr(),w=Ze(),v=T=>{i(T.target.value),a(!!T.target.value)},y=async()=>{const{data:T}=await b(),A=T?.pages[0].tiers[0];if(A){A.monthly_price=500,A.yearly_price=5e3,A.currency="USD";let R=0;for(;R<xk;){await new Promise($=>{setTimeout($,xu)});try{await g(A);break}catch($){if($ instanceof Mr&&$.data?.errors?.[0].code==="STRIPE_NOT_CONFIGURED"){R+=xu;continue}else{w($);return}}}}},C=async()=>{if(h(""),s)try{await m([{key:"stripe_connect_integration_token",value:s}]),await y(),await m([{key:"portal_plans",value:JSON.stringify(["free","monthly","yearly"])}])}catch(T){if(T instanceof Mr&&T.data?.errors){h("Invalid secure key");return}else{w(T);return}}else h("Please enter a secure key")},{apiRoot:j}=Rs(),N=`${j}/members/stripe_connect?mode=${f?"test":"live"}`;return n.jsxs("div",{children:[n.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[n.jsx(lt,{level:3,children:"Connect with Stripe"}),n.jsx(Be,{direction:"rtl",label:"Test mode",labelClasses:`text-sm translate-y-[1px] ${f?"text-[#EC6803]":"text-grey-800"}`,toggleBg:"stripetest",onChange:T=>p(T.target.checked)})]}),n.jsxs(lt,{level:6,grey:!0,children:["Step 1 — ",n.jsx("span",{className:"text-black dark:text-white",children:"Generate secure key"})]}),n.jsxs("div",{className:"mt-2 mb-4",children:["Click on the ",n.jsx("strong",{children:"“Connect with Stripe”"})," button to generate a secure key that connects your Ghost site with Stripe."]}),n.jsx(Nh,{href:N,tag:"a",target:"_blank"}),n.jsxs(lt,{className:"mt-8 mb-2",level:6,grey:!0,children:["Step 2 — ",n.jsx("span",{className:"text-black dark:text-white",children:"Paste secure key"})]}),n.jsx(or,{error:!!x,hint:x||void 0,placeholder:"Paste your secure key here",onChange:v}),t&&n.jsx(Ie,{className:"mt-5",color:"green",label:"Save Stripe settings",onClick:C})]})},vk=({onClose:t})=>{const{settings:a}=Ue(),[s,i]=ot(a,["stripe_connect_display_name","stripe_connect_livemode"]),{refetch:f,isFetching:p}=dh({searchParams:{filter:"status:paid",limit:"0"},enabled:!1}),{mutateAsync:x}=Hv(),h=Ze(),b=async()=>{const{data:g}=await f(),m=!!g?.meta?.pagination.total;ge.show(xt,{title:"Disconnect Stripe",prompt:m?"Cannot disconnect while there are members with active Stripe subscriptions.":n.jsxs(n.Fragment,{children:["You‘re about to disconnect your Stripe account ",s," from this site. This will automatically turn off paid memberships on this site."]}),okLabel:m?"":"Disconnect",onOk:async w=>{try{await x(null),w?.remove(),t?.()}catch(v){h(v)}}})};return n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Ie,{color:"red",disabled:p,icon:"link-broken",iconColorClass:"text-red",label:"Disconnect",link:!0,onClick:b}),n.jsx(Ie,{icon:"close",iconColorClass:"dark:text-white",label:"Close",size:"sm",hideLabel:!0,link:!0,onClick:t})]}),n.jsxs("div",{className:"my-20 flex flex-col items-center",children:[n.jsxs("div",{className:"relative h-20 w-[200px]",children:[n.jsx("img",{alt:"Ghost Logo",className:"absolute left-10 size-16",src:hk}),n.jsx("img",{alt:"Stripe Logo",className:"absolute right-10 size-16 rounded-2xl shadow-[-1.5px_0_0_1.5px_#fff] dark:shadow-[-1.5px_0_0_1.5px_black]",src:mk})]}),n.jsxs(lt,{className:"text-center",level:3,children:["You are connected with Stripe!",i?null:" (Test mode)"]}),n.jsxs("div",{className:"mt-1",children:["Connected to ",n.jsx("strong",{children:s||"Test mode"})]})]}),n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(lt,{level:6,children:"Read next"}),n.jsxs("a",{className:"mt-5 flex w-100 flex-col items-stretch justify-between rounded-sm border border-grey-200 transition-all hover:border-grey-400 md:flex-row dark:border-grey-900",href:"https://ghost.org/resources/managing-your-stripe-account/?ref=admin",rel:"noopener noreferrer",target:"_blank",children:[n.jsxs("div",{className:"order-2 p-4 md:order-1",children:[n.jsx("div",{className:"font-bold",children:"How to setup and manage your Stripe account"}),n.jsx("div",{className:"mt-1 text-sm text-grey-800 dark:text-grey-500",children:"Learn how to configure your Stripe account to work with Ghost, from custom branding to payment receipt emails."}),n.jsxs("div",{className:"mt-3 flex items-center gap-1 text-sm text-grey-800 dark:text-grey-500",children:[n.jsx("img",{alt:"Ghost Logo",className:"size-4",src:_y}),n.jsx("strong",{children:"Ghost Resources"}),n.jsx("span",{children:"·"}),n.jsx("span",{children:"by Kym Ellis"})]})]}),n.jsx("div",{className:"order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!",children:n.jsx("img",{alt:"Bookmark Thumb",className:"min-h-full min-w-full shrink-0",src:pk})})]})]})]})},yk=({onClose:t})=>{const{localSettings:a,updateSetting:s,handleSave:i,saveState:f}=Xr(),[p,x]=ot(a,["stripe_publishable_key","stripe_secret_key"]),h=async()=>{try{zv.remove(),await i(),t()}catch(b){if(b instanceof Mr){rt({title:"Failed to save settings",type:"error",message:"Check you copied both keys correctly"});return}throw b}};return n.jsxs("div",{children:[n.jsx(lt,{level:3,children:"Connect Stripe"}),n.jsxs(Ye,{marginBottom:!1,marginTop:!0,children:[n.jsx(_e,{title:"Publishable key",value:p?.toString(),onChange:b=>s("stripe_publishable_key",b.target.value)}),n.jsx(_e,{title:"Secure key",value:x?.toString(),onChange:b=>s("stripe_secret_key",b.target.value)}),n.jsx(Ie,{className:"mt-5",color:"green",disabled:f==="saving",label:"Save Stripe settings",onClick:h})]})]})},_k=()=>{const{config:t,settings:a}=Ue(),s=Tt(a,"stripe_connect_account_id"),{updateRoute:i}=He(),[f,p]=S.useState("start"),x=Lt(),h=Ls(),b=Ds(a,t),g=h?.isDisabled("limitStripeConnect");S.useEffect(()=>{(async()=>{if(g&&!b)try{await h?.errorIfWouldGoOverLimit("limitStripeConnect")}catch(C){C instanceof Fs&&(x.remove(),ge.show(zn,{prompt:C.message||"Your current plan doesn't support Stripe Connect.",onOk:()=>i({route:"/pro",isExternal:!0})}))}})()},[h,x,i,b,g]);const m=()=>{p("connect")},w=()=>{x.remove(),i("tiers")};let v;return t?.stripeDirect||Ds(a||[],t||{})&&!s?v=n.jsx(yk,{onClose:w}):s?v=n.jsx(vk,{onClose:w}):f==="start"?v=n.jsx(bk,{onNext:m}):v=n.jsx(wk,{}),n.jsx(ct,{afterClose:()=>{i("tiers")},cancelLabel:"",footer:n.jsx("div",{className:"mt-8"}),testId:"stripe-modal",title:"",width:s?740:520,hideXOnMobile:!0,children:v})},Mk=ge.create(_k),kk=""+new URL("ali-abdaal-C_tOLbSs.png",import.meta.url).href,jk=""+new URL("isaac-saul-DhERrV-4.png",import.meta.url).href,Nk=""+new URL("joel-warner-CHe_ZipQ.png",import.meta.url).href,Tk=ge.create(()=>{const{updateRoute:t}=He(),a=Ze(),s=Lt(),{settings:i,currentUser:f,siteData:p,config:x}=Ue(),h=x.exploreTestimonialsUrl,b=p.site_uuid,[g]=ot(i,["title"]),m=f.name,w=f.email,v=f.roles[0].name,y=f.profile_image,{formState:C,updateForm:j,saveState:N,handleSave:T,errors:A,clearError:R}=nn({initialState:{content:"",prev_platform:""},onSave:async()=>{const L=["none","other",""].includes(C.prev_platform)?void 0:C.prev_platform,P={ghost_uuid:b,staff_user_email:w,content:C.content,prev_platform:L};if(!h)throw new Error("Something went wrong, please try again later.");if(!(await fetch(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(P)})).ok)throw new Error("Something went wrong, please try again later.");rt({message:"Thank you for your testimonial!",type:"success"}),t("explore"),s.remove()},onSaveError:a,onValidate:()=>{const L={};return C.content.trim()||(L.content="This field is required"),L}}),$=[{value:"none",label:"None - This is a new site"},{value:"substack",label:"Substack"},{value:"beehiiv",label:"BeeHiiv"},{value:"wordpress",label:"WordPress"},{value:"newspack",label:"Newspack"},{value:"medium",label:"Medium"},{value:"squarespace",label:"Squarespace"},{value:"wix",label:"Wix"},{value:"patreon",label:"Patreon"},{value:"memberful",label:"Memberful"},{value:"other",label:"Other"}];return n.jsx(ct,{afterClose:()=>{t("explore")},cancelLabel:"",footer:!1,padding:!1,testId:"explore-testimonials-modal",title:"",topRightContent:"close",width:920,children:n.jsx(Ye,{className:"mb-0!",children:n.jsxs("div",{className:"flex items-stretch",children:[n.jsxs("div",{className:"hidden w-full flex-col justify-between bg-gradient-to-tl from-grey-100/50 to-grey-100/80 p-8 dark:from-grey-900/40 dark:to-grey-900/60 [@media(min-width:905px)]:visible! [@media(min-width:905px)]:flex!",children:[n.jsxs("div",{className:"pr-6",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"Moving to Ghost has proven to be one of the best business decisions we’ve made as an independent media outlet."}),n.jsxs("div",{className:"mt-[14px] ml-2 flex items-center gap-2 text-sm",children:[n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${Nk})`}}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Joel Warner"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"Lever News"})]})]})]}),n.jsxs("div",{className:"mt-8 ml-6",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:right-5 before:-bottom-1.5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"It has now been one year since I quit my full-time job to go all in on Tangle. Today, we have 50,000+ paying subscribers. That’s roughly $5M in gross yearly revenue ... it’s the best paying job I’ve ever had."}),n.jsxs("div",{className:"mt-[14px] mr-2 flex items-center justify-end gap-2 text-sm",children:[n.jsxs("div",{className:"flex flex-col items-end",children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Isaac Saul"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"Tangle"})]}),n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${jk})`}})]})]}),n.jsxs("div",{className:"mt-8 hidden pr-6 [@media(min-width:940px)]:visible! [@media(min-width:940px)]:block!",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"You should be using Ghost because it’s absolutely amazing and I love it. It’s what I’ve been using for all my sites since 2016."}),n.jsxs("div",{className:"mt-[14px] ml-2 flex items-center gap-2 text-sm",children:[n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${kk})`}}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Ali Abdaal"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"YouTuber"})]})]})]})]}),n.jsxs("div",{className:"flex grow flex-col justify-between gap-6 p-8 [@media(min-width:905px)]:min-w-[520px] [@media(min-width:940px)]:min-w-[460px]",children:[n.jsxs("div",{children:[n.jsx("div",{className:"flex size-[60px] items-center justify-center rounded-full bg-gradient-to-t from-[#CFB0FF] to-[#B27EFF]",children:n.jsx("svg",{fill:"none",height:"26",viewBox:"0 0 32 26",width:"32",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M19.9967 26L18.1562 21.4542C23.4268 19.1176 25.7693 16.5261 26.2712 11.7255C25.5183 12.3627 24.5562 12.7026 23.3431 12.7026C20.1641 12.7026 17.4869 10.1536 17.4869 6.41503C17.4869 2.80392 20.3732 9.72736e-07 24.2634 6.32644e-07C28.2791 2.81581e-07 31.5 3.10131 31.5 8.96405C31.5 17.5458 27.4425 23.0261 19.9967 26ZM3.0098 26L1.12745 21.4543C6.43987 19.1176 8.78235 16.5261 9.24248 11.7255C8.53137 12.3627 7.56928 12.7026 6.35621 12.7026C3.17712 12.7026 0.499999 10.1536 0.499998 6.41504C0.499998 2.80393 3.38627 2.45778e-06 7.23464 2.12135e-06C11.2503 1.77028e-06 14.5131 3.10131 14.5131 8.96405C14.5131 17.5458 10.4556 23.0261 3.0098 26Z",fill:"white"})})}),n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-2xl font-semibold tracking-tight",children:"A quote about Ghost"}),n.jsx("div",{className:"mt-2 text-pretty",children:"We feature quotes from publishers to showcase their work, including a logo and a link! If you'd like to be included, share a quote we can use to highlight you."})]}),n.jsx("div",{className:"mt-8",children:n.jsx(or,{error:!!A.content,hint:A.content,placeholder:"What changed for the better since you switched to Ghost?",rows:7,value:C.content,autoFocus:!0,onChange:L=>j(P=>({...P,content:L.target.value})),onKeyDown:()=>R("content")})}),n.jsx("div",{className:"mt-4 ml-0.5",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Mh,{bgColor:jh(m||w),image:y??void 0,label:kh(m),labelColor:"white",size:"md"}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"text-sm font-medium",children:["By ",m||w]}),n.jsxs("span",{className:"text-xs text-grey-700",children:[v," — ",g]})]})]})})]}),n.jsx("div",{children:n.jsxs("div",{className:"mt-2 flex items-center gap-4",children:[n.jsx("div",{className:"grow",children:n.jsx(jt,{error:!!A.prev_platform,hint:A.prev_platform,options:$,placeholder:"Previous platform",selectedOption:$.find(L=>L.value===C.prev_platform),testId:"migrated-from",onSelect:L=>{j(P=>({...P,prev_platform:L?.value||""})),R("prev_platform")}})}),n.jsx(Ie,{className:"h-[38px]! rounded-lg",color:"black",disabled:N==="saving",label:"Send testimonial",loading:N==="saving",onClick:async()=>{await T()}})]})})]})]})})})}),Ek=""+new URL("ghost-transistor-BXCFhTPG.png",import.meta.url).href,Ck=ge.create(()=>{const{updateRoute:t}=He(),{config:a,settings:s}=Ue(),{mutateAsync:i}=jr(),{data:{integrations:f}={integrations:[]}}=Si(),{mutateAsync:p}=$u(),x=Ze(),[h,b]=S.useState(!1),g=a.hostSettings?.limits?.customIntegrations?.disabled,[m]=ot(s,["transistor"]),[w,v]=S.useState(!!m),[y,C]=S.useState("Save");S.useEffect(()=>{v(m||!1)},[m]),S.useEffect(()=>{g&&t("integrations")},[g,t]);const j=f.find(({slug:R})=>R==="transistor"),N=j?.api_keys?.find(R=>R.type==="admin"),T=()=>{if(!j||!N)throw new Error("Transistor integration or Admin API key not found");b(!1),ge.show(xt,{title:"Regenerate Admin API Key",prompt:"You will need to update the API key in your Transistor account settings after regenerating.",okLabel:"Regenerate Admin API Key",onOk:async R=>{try{await p({integrationId:j.id,apiKeyId:N.id}),b(!0),R?.remove()}catch($){x($)}}})},A=async()=>{const R=[{key:"transistor",value:w}];try{C("Saving..."),await Promise.all([i(R),new Promise($=>{setTimeout($,1e3)})]),C("Saved")}catch($){x($)}finally{setTimeout(()=>C("Save"),1e3)}};return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:w!==m,okColor:y==="Saved"?"green":"black",okLabel:y,testId:"transistor-modal",title:"",onOk:A,children:[n.jsx(Jr,{detail:"Give your members access to private podcasts",icon:n.jsx(qe,{name:"transistor",size:56}),title:"Transistor.fm"}),n.jsxs("div",{className:"mt-7",children:[n.jsxs(Ye,{marginBottom:!1,title:"Transistor configuration",grouped:!0,children:[n.jsx(Be,{checked:w,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Connect your Ghost site with ",n.jsx("a",{className:"text-green",href:"https://transistor.fm",rel:"noopener noreferrer",target:"_blank",children:"Transistor.fm"})," to offer members private podcasts."]}),label:"Enable Transistor",onChange:R=>{v(R.target.checked)}}),w&&n.jsx(Ya,{keys:[{label:"Admin API key",text:N?.secret,hint:h?n.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:T},{label:"API URL",text:window.location.origin+Rs().subdir}]})]}),w&&n.jsx("div",{className:"mt-5 flex flex-col items-center",children:n.jsxs("a",{className:"flex w-100 flex-col items-stretch justify-between overflow-hidden rounded-md bg-grey-75 transition-all hover:border-grey-400 hover:bg-grey-100 md:flex-row dark:bg-grey-925 dark:hover:bg-grey-950",href:"https://ghost.org/integrations/transistor/",rel:"noopener noreferrer",target:"_blank",children:[n.jsxs("div",{className:"order-2 px-7 py-5 md:order-1",children:[n.jsx("div",{className:"font-semibold",children:"How to use Transistor in Ghost"}),n.jsx("div",{className:"mt-1 text-sm text-grey-800 dark:text-grey-500",children:"Learn more about connecting Transistor with Ghost to offer members access to private podcasts in Portal or as an embed in posts and pages with a custom Transistor card."})]}),n.jsx("div",{className:"order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!",children:n.jsx("img",{alt:"Bookmark Thumb",className:"min-h-full min-w-full shrink-0",src:Ek})})]})})]})]})}),Ik=ge.create(()=>{const{updateRoute:t}=He(),{settings:a}=Ue(),[s]=ot(a,["unsplash"]),{mutateAsync:i}=jr(),f=Ze(),[p,x]=S.useState("Save"),[h,b]=S.useState(!!s);S.useEffect(()=>{b(s||!1)},[s]);const g=async()=>{const w=[{key:"unsplash",value:h}];try{x("Saving..."),await Promise.all([i(w),new Promise(v=>{setTimeout(v,1e3)})]),x("Saved")}catch(v){f(v)}finally{setTimeout(()=>x("Save"),1e3)}},m=h!==s;return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:m,okColor:p==="Saved"?"green":"black",okLabel:p,testId:"unsplash-modal",title:"",onOk:g,children:[n.jsx(Jr,{detail:"Beautiful, free photos",icon:n.jsx(qe,{name:"unsplash",size:48}),title:"Unsplash"}),n.jsx("div",{className:"mt-7",children:n.jsx(Ye,{marginBottom:!1,grouped:!0,children:n.jsx(Be,{checked:h,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://unsplash.com",rel:"noopener noreferrer",target:"_blank",children:"Unsplash"})," image integration for your posts"]}),label:"Enable Unsplash",onChange:w=>{b(w.target.checked)}})})})]})}),Sk=({user:t,setUserData:a})=>{const{config:s,settings:i}=Ue(),f=Ds(i||[],s||{}),p=Mm("giftSubscriptions");return n.jsxs(ku,{children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Engagement"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.comment_notifications,direction:"rtl",hint:"Every time a member comments on one of your posts",label:"Comments",onChange:x=>{a?.({...t,comment_notifications:x.target.checked})}}),Ra(t)&&n.jsx(Be,{align:"center",checked:t.recommendation_notifications,direction:"rtl",hint:"Every time another publisher recommends you to their audience",label:"Recommendations",onChange:x=>{a?.({...t,recommendation_notifications:x.target.checked})}})]})]}),Ra(t)&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Members"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.free_member_signup_notification,direction:"rtl",hint:"Every time a new free member signs up",label:"New signups",onChange:x=>{a?.({...t,free_member_signup_notification:x.target.checked})}}),f&&n.jsxs(n.Fragment,{children:[n.jsx(Be,{align:"center",checked:t.paid_subscription_started_notification,direction:"rtl",hint:"Every time a member starts a new paid subscription",label:"New paid members",onChange:x=>{a?.({...t,paid_subscription_started_notification:x.target.checked})}}),n.jsx(Be,{align:"center",checked:t.paid_subscription_canceled_notification,direction:"rtl",hint:"Every time a member cancels their paid subscription",label:"Paid member cancellations",onChange:x=>{a?.({...t,paid_subscription_canceled_notification:x.target.checked})}})]})]})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Revenue"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.milestone_notifications,direction:"rtl",hint:f?"Occasional summaries of your audience & revenue growth":"Occasional summaries of your audience growth",label:"Milestones",onChange:x=>{a?.({...t,milestone_notifications:x.target.checked})}}),f&&n.jsx(Be,{align:"center",checked:t.donation_notifications,direction:"rtl",hint:"Every time you receive a one-time payment",label:"Tips & donations",onChange:x=>{a?.({...t,donation_notifications:x.target.checked})}}),f&&p&&n.jsx(Be,{align:"center",checked:t.gift_subscription_purchase_notification,direction:"rtl",hint:"Every time someone purchases or redeems a gift subscription",label:"Gift subscriptions",onChange:x=>{a?.({...t,gift_subscription_purchase_notification:x.target.checked})}})]})]})]})]})},Ak=({user:t,setUserData:a})=>n.jsx(Mu,{border:!1,children:n.jsx(Sk,{setUserData:a,user:t})}),Dk=["1234567890","qwertyuiop","qwertzuiop","asdfghjkl;","abcdefghij","0987654321","1q2w3e4r5t","12345asdfg"],$k=["ghost","password","passw0rd"],Ok=t=>{let a={},s,i=!0;s=t.length/2;for(let f=0;f<t.length;f+=1)a[t[f]]?a[t[f]]+=1:a[t[f]]=1;for(let f in a)if(a[f]>=s)return i=!1,i;return i},Rk=({user:t})=>{const{currentUser:a,config:s,siteData:i}=Ue(),[f,p]=S.useState(!1),[x,h]=S.useState(""),[b,g]=S.useState(""),[m,w]=S.useState(""),[v,y]=S.useState(""),[C,j]=S.useState({}),N=S.useRef(null),T=S.useRef(null),A=S.useRef(null),{mutateAsync:R}=Uv(),$=Ze(),L=t.id===a.id,P=({password:G,confirmPassword:te})=>{if(L&&!x)return{oldPassword:"Your current password is required to set a new one"};if(G!==te)return{newPassword:"Your new passwords do not match",confirmNewPassword:"Your new passwords do not match"};let fe=s.blogUrl||window.location.host,Me=i.title,K;if(fe=fe.replace(/^http(s?):\/\//,""),K=fe.match(/\/$/)?fe:`${fe}/`,Me=Me&&Me.trim().toLowerCase(),G.length<10)return{newPassword:"Password must be at least 10 characters long."};G=G.toString();for(const Q of Dk)if(Q===G)return{newPassword:"Sorry, you cannot use an insecure password."};if(G.toLowerCase()===t.email.toLowerCase())return{newPassword:"Sorry, you cannot use an insecure password."};for(const Q of $k)if(G.toLowerCase().indexOf(Q)>=0)return{newPassword:"Sorry, you cannot use an insecure password."};return G.toLowerCase()===Me?{newPassword:"Sorry, you cannot use an insecure password."}:G.toLowerCase()===fe||G.toLowerCase()===K?{newPassword:"Sorry, you cannot use an insecure password."}:Ok(G)?{}:{newPassword:"Sorry, you cannot use an insecure password."}};S.useEffect(()=>{v==="saved"&&setTimeout(()=>{y(""),p(!1)},2500)},[v]),S.useEffect(()=>{f&&setTimeout(()=>{L?A.current?.focus():N.current?.focus()},100)},[f,L]);const D=()=>{p(!0)};let q="Save password";v==="saving"?q="Saving...":v==="saved"&&(q="Saved");const Y=n.jsxs(n.Fragment,{children:[L&&n.jsx(_e,{"data-testid":"old-password",error:!!C.oldPassword,hint:C.oldPassword,inputRef:A,title:"Old password",type:"password",value:x,onChange:G=>{h(G.target.value)}}),n.jsx(_e,{"data-testid":"new-password",error:!!C.newPassword,hint:C.newPassword,inputRef:N,title:"New password",type:"password",value:b,onChange:G=>{g(G.target.value)}}),n.jsx(_e,{"data-testid":"confirm-password",error:!!C.confirmNewPassword,hint:C.confirmNewPassword,inputRef:T,title:"Confirm new password",type:"password",value:m,onChange:G=>{w(G.target.value)}}),n.jsxs("div",{className:"mt-1 flex items-center justify-end gap-3",children:[n.jsx(Ie,{color:"outline",label:"Cancel",onClick:()=>{p(!1),h(""),g(""),w(""),j({})}}),n.jsx(Ie,{color:"green","data-testid":"save-password-button",label:q,onClick:async()=>{y("saving");const G=P({password:b,confirmPassword:m});if(j(G),Object.keys(G).length>0){y("");return}try{await R({newPassword:b,confirmNewPassword:m,oldPassword:x,userId:t?.id}),y("saved")}catch(te){y(""),rt({type:"error",title:te instanceof Bv?te.message:"Couldn't update password. Please try again."}),$(te,{withToast:!1})}}})]})]}),z=n.jsxs("div",{className:"relative flex flex-col",children:[n.jsx(_e,{containerClassName:"grow",disabled:!0,title:"Password",type:"password",value:"••••••••••••"}),n.jsx(Ie,{className:"absolute top-0 right-0",color:"green","data-testid":"change-password-button",label:"Change",link:!0,onClick:D})]});return n.jsx(n.Fragment,{children:f?Y:z})},Lk=({user:t,setUserData:a})=>{const{data:{roles:s}={}}=nu(),{config:i}=Ue(),f=i.labs.superEditors;let p=[{hint:"Can write and edit their own posts, but cannot publish them.",label:"Contributor",value:"contributor"},{hint:"Can create, edit and publish their own posts, but can’t modify others.",label:"Author",value:"author"},{hint:"Can edit and publish any posts, and manage Authors and Contributors.",label:"Editor",value:"editor"},{hint:"Trusted user who has full access to all content, settings, and user management.",label:"Administrator",value:"administrator"}];if(f&&(p=p.map(x=>x.value==="editor"?{...x,label:"Editor (beta mode)",value:"super editor",hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site. Can manage members and moderate comments."}:x)),tu(t)){const x={label:"Owner",value:"owner"};return n.jsx("div",{children:n.jsx(jt,{disabled:!0,hint:n.jsxs(n.Fragment,{children:["This user is the owner of the site. ",n.jsx("a",{className:"font-medium text-grey-800 transition-colors hover:text-grey-900 dark:text-grey-500 dark:hover:text-grey-400",href:"https://ghost.org/help/transfer-publication-ownership/",rel:"noopener noreferrer",target:"_blank",children:"Transfer ownership"})," first to change their role."]}),options:[x],selectedOption:x,title:"Role",onSelect:()=>{}})})}return n.jsx(jt,{options:p,selectedOption:p.find(x=>x.value===t.roles[0].name.toLowerCase()),testId:"role-select",title:"Role",onSelect:x=>{if(x){const h=s?.find(b=>b.name.toLowerCase()===x.value.toLowerCase());h&&a?.({...t,roles:[h]})}}})},Fk="StaffTokenResponseType",Pk=Wv({dataType:Fk,path:"/users/me/token/"}),Hk=Gr({path:()=>"/users/me/token/",method:"PUT"}),zk=()=>{const{refetch:t}=Pk({enabled:!1}),a=Ze(),[s,i]=S.useState(""),{mutateAsync:f}=Hk();S.useEffect(()=>{(async()=>{const h=await t();h?.data?.apiKey&&i(`${h.data.apiKey.id}:${h.data.apiKey.secret}`)})()},[t]);const p=()=>{ge.show(xt,{title:"Regenerate your Staff Access Token",prompt:"You can regenerate your Staff Access Token any time, but any scripts or applications using it will need to be updated.",okLabel:"Regenerate your Staff Access Token",okColor:"red",onOk:async x=>{try{const h=await f([]);i(`${h.apiKey.id}:${h.apiKey.secret}`),x?.remove()}catch(h){a(h)}}})};return n.jsxs("div",{children:[n.jsx(lt,{className:"mb-2",level:6,grey:!0,children:"Staff access token"}),n.jsx(Ya,{hasLabel:!1,keys:[{text:s||"",onRegenerate:p}]})]})},Uk=({errors:t,clearError:a,user:s,setUserData:i})=>{const{currentUser:f,siteData:p}=Ue(),x=Pn(p);return n.jsxs(ku,{children:[n.jsx(_e,{error:!!t?.email,hint:t?.email||"Used for notifications",maxLength:191,title:"Email",value:s.email,onChange:h=>{i({...s,email:h.target.value})},onKeyDown:()=>a("email")}),n.jsx(Rk,{user:s}),Ra(f)&&n.jsx(Lk,{setUserData:i,user:s}),n.jsx(_e,{error:!!t?.name,hint:t?.name||"Use your real name so people can recognize you",maxLength:191,title:"Full name",value:s.name,onChange:h=>{i({...s,name:h.target.value})},onKeyDown:()=>a("name")}),n.jsx(_e,{hint:`${x}author/${s.slug}`,maxLength:191,title:"Slug",value:s.slug,onChange:h=>{i({...s,slug:h.target.value})}}),n.jsx(_e,{error:!!t?.location,hint:t?.location||"Where in the world do you live?",maxLength:65535,title:"Location",value:s.location||"",onChange:h=>{i({...s,location:h.target.value})},onKeyDown:()=>a("location")}),n.jsx(or,{error:!!t?.bio,hint:t?.bio||n.jsxs(n.Fragment,{children:["Recommended: 250 characters. You‘ve used ",n.jsx("span",{className:"font-bold",children:s.bio?.length||0})]}),maxLength:65535,title:"Bio",value:s.bio||"",onChange:h=>{i({...s,bio:h.target.value})},onKeyDown:()=>a("bio")}),s.id===f.id&&n.jsx(zk,{})]})},Bk=t=>n.jsx(Mu,{border:!1,children:n.jsx(Uk,{...t})}),Wk=({errors:t,clearError:a,validateField:s,user:i,setUserData:f})=>{const[p,x]=S.useState(()=>Object.fromEntries(su.map(h=>{const b=i[h.key];return[h.key,h.toDisplayValue(b)]})));return n.jsxs(ku,{children:[n.jsx(_e,{"data-testid":"website-input",error:!!t?.website,hint:t?.website,maxLength:2e3,placeholder:"https://example.com",title:"Website",value:i.website||"",onChange:h=>{f({...i,website:h.target.value})},onKeyDown:()=>a("website")}),su.map(h=>n.jsx(_e,{"data-testid":h.testId,error:!!t?.[h.key],hint:t?.[h.key],maxLength:2e3,placeholder:h.placeholder,title:h.staffTitle,value:p[h.key],onBlur:b=>{if(s(h.key,b.target.value)){const{displayValue:g,storedValue:m}=My(h.key,b.target.value);x(w=>({...w,[h.key]:g})),f({...i,[h.key]:m})}},onChange:b=>{x(g=>({...g,[h.key]:b.target.value}))},onKeyDown:()=>a(h.key)},h.key))]})},Yk=t=>n.jsx(Mu,{border:!1,children:n.jsx(Wk,{...t})}),ih={name:({name:t})=>{let a="";return t||(a="Name is required"),t&&t.length>191&&(a="Name is too long"),a},email:({email:t})=>Un.isEmail(t||"")?"":"Enter a valid email address",url:({url:t})=>!t||Un.isURL(t,{require_tld:!1})?"":"Enter a valid URL",bio:({bio:t})=>!t||t.length<=250?"":"Bio is too long",location:({location:t})=>!t||t.length<=150?"":"Location is too long",website:({website:t})=>!t||Un.isURL(t)&&t.length<=2e3?"":"Enter a valid URL",...Object.fromEntries(su.map(t=>[t.key,a=>jy(t.key,a[t.key])]))},qk=({user:t})=>{const{updateRoute:a,route:s}=He(),i=V=>{const ve=V.split("/").pop()||"";return ve==="social-links"||ve==="email-notifications"?ve:"profile"},{ownerUser:f}=ky(),{currentUser:p}=Ue(),x=Ze(),{formState:h,setFormState:b,saveState:g,handleSave:m,updateForm:w,errors:v,setErrors:y,clearError:C,okProps:j}=nn({initialState:t,savingDelay:500,savedDelay:500,onValidate:V=>Object.entries(ih).reduce((ve,[De,Qe])=>{const Dt=Qe(V);return Dt&&(ve[De]=Dt),ve},{}),onSave:async V=>{await $?.(V)},onSaveError:x}),N=V=>w(()=>V),T=(V,ve)=>{const De=ih[V]?.({[V]:ve});return De?(y({...v,[V]:De}),!1):(C(V),!0)},A=Lt(),{mutateAsync:R}=Ps(),{mutateAsync:$}=qv(),{mutateAsync:L}=Gv(),{mutateAsync:P}=Xv(),D=Ls(),q=wh(),Y=S.useCallback(()=>{wr(p)?a("staff"):a({isExternal:!0,route:""})},[p,a]),z=async V=>{if(V.status==="inactive"&&V.roles[0].name!=="Contributor")try{await D?.errorIfWouldGoOverLimit("staff")}catch(De){if(De instanceof Fs){ge.show(zn,{formSheet:!0,prompt:De.message||"Your current plan doesn't support more users.",onOk:()=>a({route:"/pro",isExternal:!0})});return}else throw De}let ve="This user will no longer be able to log in but their posts will be kept.";V.status==="inactive"&&(ve="This user will be able to log in again and will have the same permissions they had previously."),ge.show(xt,{title:"Are you sure you want to suspend this user?",prompt:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"WARNING:"})," ",ve]}),okLabel:V.status==="inactive"?"Un-suspend":"Suspend",okRunningLabel:V.status==="inactive"?"Un-suspending...":"Suspending...",okColor:"red",onOk:async De=>{const Qe={...V,status:V.status==="inactive"?"active":"inactive"};try{await $(Qe),b(()=>Qe),De?.remove(),rt({title:V.status==="inactive"?"User un-suspended":"User suspended",type:"success"})}catch(Dt){x(Dt)}}})},G=(V,{owner:ve})=>{ge.show(xt,{title:"Are you sure you want to delete this user?",prompt:n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"mb-3",children:[n.jsx("span",{className:"font-bold",children:V.name||V.email})," will be permanently deleted and all their posts will be automatically assigned to ",n.jsx("span",{className:"font-bold",children:ve.name}),"."]}),n.jsxs("p",{children:["To make these easy to find in the future, each post will be given an internal tag of ",n.jsxs("span",{className:"font-bold",children:["#",t.slug]})]})]}),okLabel:"Delete user",okColor:"red",onOk:async De=>{try{await L(V?.id),De?.remove(),A?.remove(),Y(),rt({title:"User deleted",type:"success"})}catch(Qe){x(Qe)}}})},te=()=>{ge.show(xt,{title:"Transfer Ownership",prompt:"Are you sure you want to transfer the ownership of this blog? You will not be able to undo this action.",okLabel:"Yep — I'm sure",okColor:"red",onOk:async V=>{try{await P(t.id),V?.remove(),rt({title:"Ownership transferred",type:"success"})}catch(ve){x(ve)}}})},fe=async(V,ve)=>{try{const De=rr(await R({file:ve}));switch(V){case"cover_image":w(Qe=>({...Qe,cover_image:De}));break;case"profile_image":w(Qe=>({...Qe,profile_image:De}));break}}catch(De){const Qe=De;Qe.response.status===415&&(Qe.message="Unsupported file type"),x(Qe)}},Me=V=>{switch(V){case"cover_image":w(ve=>({...ve,cover_image:""}));break;case"profile_image":w(ve=>({...ve,profile_image:""}));break}},K=Ra(p)||jf(p)&&Nf(t);let Q=[];if(tu(p)&&Kv(h)&&h.status!=="inactive"&&Q.push({id:"make-owner",label:"Make owner",onClick:te}),Q.push({id:"view-user-activity",label:"View user activity",onClick:()=>{A.remove(),a(`history/view/${h.id}`)}}),h.id!==p.id&&(Ra(p)&&!tu(t)||jf(p)&&Nf(t))){let V=h.status==="inactive"?"Un-suspend user":"Suspend user";Q.push({id:"suspend-user",label:V,onClick:()=>{z(h)}},{id:"delete-user",label:"Delete user",destructive:!0,onClick:()=>{G(t,{owner:f})}})}const Ne="rounded text-sm flex flex-nowrap items-center justify-center px-3 h-8 transition-all cursor-pointer font-medium border border-grey-300 bg-transparent text-black dark:border-grey-800 dark:text-white",ue="flex flex-nowrap items-center justify-center px-3 h-8 opacity-80 hover:opacity-100 bg-[rgba(0,0,0,0.75)] rounded text-sm text-white transition-all cursor-pointer font-medium nowrap",we=h.status==="inactive"?" (Suspended)":"",ee=i(s),[pe,le]=S.useState(ee),de=V=>{const ve=V==="profile"?"":`/${V}`;a(`staff/${t.slug}${ve}`),le(V)};return n.jsx(ct,{afterClose:Y,animate:wr(p),backDrop:wr(p),buttonsDisabled:j.disabled,cancelLabel:"Close",dirty:g==="unsaved",okColor:j.color,okLabel:j.label||"Save",size:wr(p)?"md":"bleed",stickyFooter:!0,testId:"user-detail-modal",width:wr(p)?600:"full",onOk:async()=>{await m({fakeWhenUnchanged:!0})},children:n.jsxs("div",{children:[n.jsx("div",{className:`relative ${wr(p)?"-mx-8 -mt-8 rounded-t":"-mx-10 -mt-10"}`,children:n.jsx("div",{className:`flex flex-wrap items-end justify-between gap-8 p-8 ${h.cover_image?"bg-cover bg-center":""} ${!wr(p)&&"min-h-[30vmin]"}`,style:{backgroundImage:h.cover_image?`url(${h.cover_image})`:"none"},children:n.jsxs("div",{className:"flex w-full flex-col gap-2",children:[n.jsxs("div",{className:"flex flex-nowrap items-start justify-between gap-3",children:[n.jsx("div",{children:n.jsx(ar,{deleteButtonClassName:"md:invisible absolute pr-3 -right-2 -top-2 flex h-8 w-10 cursor-pointer items-center justify-end rounded-full bg-[rgba(0,0,0,0.75)] text-white group-hover:visible!",deleteButtonContent:n.jsx(qe,{colorClass:"text-white",name:"trash",size:"sm"}),editButtonClassName:"md:invisible absolute right-[22px] -top-2 flex h-8 w-8 cursor-pointer items-center justify-center text-white group-hover:visible! z-20",fileUploadClassName:"rounded-full bg-black flex items-center justify-center opacity-80 transition hover:opacity-100 -ml-2 cursor-pointer h-[80px] w-[80px]",fileUploadProps:{dragIndicatorClassName:"rounded-full"},id:"avatar",imageClassName:"w-full h-full object-cover rounded-full shrink-0",imageContainerClassName:"relative group bg-cover bg-center -ml-1 h-16 w-16 md:h-18 md:w-18 shrink-0",imageURL:h.profile_image??void 0,pintura:{isEnabled:q.isEnabled,openEditor:async()=>q.openEditor({image:h.profile_image||"",handleSave:async V=>{fe("profile_image",V)}})},unstyled:!0,width:"80px",onDelete:()=>{Me("profile_image")},onUpload:V=>{fe("profile_image",V)},children:n.jsx(qe,{colorClass:"black",name:"user-add",size:"lg"})})}),n.jsxs("div",{className:"flex flex-nowrap items-start gap-3",children:[n.jsx(ar,{buttonContainerClassName:"flex items-end gap-4 justify-end flex-nowrap",deleteButtonClassName:ue,deleteButtonContent:"Delete cover image",editButtonClassName:ue,fileUploadClassName:Ne,id:"cover-image",imageClassName:"hidden",imageURL:h.cover_image||"",pintura:{isEnabled:q.isEnabled,openEditor:async()=>q.openEditor({image:h.cover_image||"",handleSave:async V=>{fe("cover_image",V)}})},unstyled:!0,onDelete:()=>{Me("cover_image")},onUpload:V=>{fe("cover_image",V)},children:"Upload cover image"}),K&&n.jsx("div",{className:"z-10",children:n.jsx(Vh,{items:Q,position:"end",trigger:n.jsxs("button",{className:me("flex h-8 cursor-pointer items-center justify-center rounded px-3",h.cover_image?"bg-[rgba(0,0,0,0.75)] opacity-80 hover:opacity-100":"border border-grey-300 bg-transparent text-black dark:border-grey-800 dark:text-white"),type:"button",children:[n.jsx("span",{className:"sr-only",children:"Actions"}),n.jsx(qe,{colorClass:h.cover_image?"text-white":void 0,name:"ellipsis",size:"md"})]})})})]})]}),n.jsxs("div",{children:[n.jsxs(lt,{level:3,styles:me("break-words md:break-normal",h.cover_image?"text-white":"text-black dark:text-white"),children:[t.name,we]}),n.jsx("span",{className:me("text-md font-medium capitalize",h.cover_image?"text-white":"text-black dark:text-white"),children:t.roles[0].name.toLowerCase()})]})]})})}),n.jsx("div",{className:`${!wr(p)&&"mx-auto max-w-[536px]"} mt-6 flex flex-col`,children:n.jsx(kr,{selectedTab:pe,tabs:[{id:"profile",title:"Profile",contents:n.jsx(Bk,{clearError:C,errors:v,setUserData:N,user:h,validateField:T})},{id:"social-links",title:"Social Links",contents:n.jsx(Yk,{clearError:C,errors:v,setUserData:N,user:h,validateField:T})},{id:"email-notifications",title:"Email Notifications",contents:n.jsx(Ak,{setUserData:N,user:h})}],onTabChange:de})})]})})},Gk=({params:t})=>{const{currentUser:a}=Ue(),s=a.slug===t?.slug,{data:i}=Yv(t?.slug||"",{enabled:!s&&!!t?.slug}),f=s?a:i?.users?.[0];return f?n.jsx(qk,{user:f}):null},Xk=ge.create(Gk),pj={AddIntegrationModal:kM,AddNewsletterModal:NM,ContentApiModal:TM,AddRecommendationModal:hm,CustomIntegrationModal:qM,DesignAndThemeModal:K8,EditRecommendationModal:Ny,FirstPromoterModal:J8,HistoryModal:d2,InviteUserModal:f2,NavigationModal:p2,NewsletterDetailModal:k2,PinturaModal:J2,PortalModal:dk,SlackModal:fk,StripeConnectModal:Mk,TestimonialsModal:Tk,TierDetailModal:dM,TransistorModal:Ck,UnsplashModal:Ik,UserDetailModal:Xk,ZapierModal:lM,AnnouncementBarModal:LM,EmbedSignupFormModal:Q8,OffersContainerModal:Z2,AboutModal:_M,OfferSuccess:wm};export{pj as default};
|
|
33
|
+
`;f.open(),f.write(p),f.close()};return n.jsx(Ou,{className:"absolute size-full overflow-hidden transition-opacity duration-500",generateContent:s,height:"100%",parentClassName:"relative h-full w-full",width:"100%"})},V8=({selectedLayout:t,accentColor:a,handleColorToggle:s,selectedColor:i,selectedLabels:f,handleLabelClick:p,embedScript:x,handleLayoutSelect:h,handleCopyClick:b,isCopied:g})=>{const{loadData:m}=_h({path:"/labels/",filterKey:"name",responseKey:"labels"}),w=async(v,y)=>{const C=await m(v);y(C.map(j=>({label:j.name,value:j.name})))};return n.jsxs("div",{className:"flex h-[calc(100vh-16vmin)] max-h-[645px] flex-col justify-between overflow-y-scroll border-l border-grey-200 p-6 pb-0 dark:border-grey-900",children:[n.jsxs("div",{children:[n.jsx(lt,{className:"mb-8",level:4,children:"Embed signup form"}),n.jsxs(Ye,{gap:"sm",children:[n.jsxs("div",{className:"flex w-full items-center justify-between",children:[n.jsx("div",{children:"Layout"}),n.jsx(Fn,{activeKey:t,buttons:[{key:"all-in-one",label:"Branded",size:"md",className:"w-auto px-3!",onClick:()=>h("all-in-one")},{key:"minimal",label:"Minimal",size:"md",className:"w-auto px-3!",onClick:()=>h("minimal")}],clearBg:!1})]}),t==="all-in-one"&&n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{hex:"#08090c",title:"Dark",value:"#08090c"},{hex:"#ffffff",title:"Light",value:"#ffffff"},{hex:a||"#d74780",title:"Accent",value:a||"#d74780"}],title:"Background color",value:i,onChange:v=>{v&&s(v)}}),n.jsx(my,{hint:"Will be applied to all members signing up via this form",loadOptions:Ci(w,500),placeholder:"Pick one or more labels (optional)",title:"Labels at signup",values:f||[],async:!0,canCreate:!0,defaultOptions:!0,onChange:p}),n.jsx(or,{className:"text-grey-800",fontStyle:"mono",hint:"Paste this code onto any website where you'd like your signup to appear.",title:"Embed code",value:`${x}`,onChange:()=>{}})]})]}),n.jsx(gy,{height:74,children:n.jsx("div",{className:"flex w-full justify-end",children:n.jsx(Ie,{color:g?"green":"black",label:g?"Copied!":"Copy code",onClick:b})})})]})};function Rp(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}const Lp=({preview:t,config:a,settings:s,labels:i,backgroundColor:f,layout:p})=>{const x=a.blogUrl,h=a.signupForm.url.replace("{version}",a.signupForm.version);let b={site:x,locale:s.locale,"button-color":s.accentColor,"button-text-color":yn(s.accentColor).hex()};for(const[C,j]of i.entries())b[`label-${C+1}`]=j.name;let g="min-height: 58px;max-width: 440px;margin: 0 auto;width: 100%";p==="all-in-one"&&(s.icon&&s.icon!==""&&(b.icon=s.icon.replace(/\/content\/images\//,"/content/images/size/w192h192/")),b.title=s.title,b.description=s.description,b["background-color"]=f,b["text-color"]=yn(f).hex(),g="height: 40vmin;min-height: 360px"),t&&(p==="minimal"?g="min-height: 58px; max-width: 440px;width: 100%;position: absolute; left: 50%; top:50%; transform: translate(-50%, -50%);":g="height: 100vh");let m="";const w=["background-color","text-color","button-color","button-text-color","title","description","icon","site","locale"],v=Object.keys(b).sort((C,j)=>w.indexOf(C)-w.indexOf(j));for(const C of v){const j=b[C];m+=` data-${C}="${Rp(j)}"`}const y=`<div style="${Rp(g)}"><script src="${encodeURI(h)}"${m} async><\/script></div>`;return t&&p==="minimal"?`<div style="position: absolute; z-index: -1; top: 0; left: 0; width: 100%; height: 100%; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);background-size: 16px 16px;background-position: 0 0, 8px 8px;;"></div>${y}`:y},Q8=ge.create(()=>{const[t,a]=S.useState("#08090c"),[s,i]=S.useState([]),[f,p]=S.useState("all-in-one"),[x,h]=S.useState(""),[b,g]=S.useState(""),[m,w]=S.useState(!1),{updateRoute:v}=He(),{config:y}=Ue(),{localSettings:C,siteData:j}=Xr(),[N,T,A,R,$]=ot(C,["accent_color","title","description","locale","icon"]),[L,P]=S.useState({active:!1});S.useEffect(()=>{if(!j)return;const z={config:{blogUrl:j.url,signupForm:{url:y?.signupForm?.url,version:y?.signupForm?.version}},settings:{accentColor:N||"#d74780",title:T||"",locale:R||"en",icon:$||"",description:A||""},labels:s.map(({label:fe})=>({name:fe})),backgroundColor:t||"#08090c",layout:f},G=Lp({preview:!0,...z});h(G);const te=Lp({preview:!1,...z});g(te)},[j,N,s,y,T,t,f,R,$,A]);const D=async()=>{try{await navigator.clipboard.writeText(b),w(!0),setTimeout(()=>w(!1),2e3)}catch(z){console.error("Failed to copy text: ",z)}},q=z=>{a(z)},Y=z=>{if(z?.length){const G=z?.map(({value:te})=>({label:te,value:te}));i(G)}else i([])};return n.jsx(ct,{afterClose:()=>{v("embed-signup-form")},cancelLabel:"",footer:!1,height:645,padding:!1,testId:"embed-signup-form",title:"",topRightContent:"close",width:1120,children:n.jsxs("div",{className:"grid grid-cols-[5.2fr_2.8fr]",children:[n.jsx(Z8,{html:x,style:f}),n.jsx(V8,{accentColor:N,customColor:L,embedScript:b,handleColorToggle:q,handleCopyClick:D,handleLabelClick:Y,handleLayoutSelect:p,isCopied:m,selectedColor:t,selectedLabels:s,selectedLayout:f,setCustomColor:P})]})})}),J8=ge.create(()=>{const{updateRoute:t}=He(),{settings:a}=Ue(),{mutateAsync:s}=jr(),i=Ze(),[f,p]=S.useState(""),[x]=ot(a,["firstpromoter"]),[h]=ot(a,["firstpromoter_id"]),[b,g]=S.useState("Save"),[m,w]=S.useState(!!x);S.useEffect(()=>{w(x||!1),p(h||null)},[x,h]);const v=async()=>{const y=[{key:"firstpromoter",value:m},{key:"firstpromoter_id",value:f}];try{g("Saving..."),await Promise.all([s(y),new Promise(C=>{setTimeout(C,1e3)})]),g("Saved")}catch(C){i(C)}finally{setTimeout(()=>g("Save"),1e3)}};return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:m!==x||f!==h,okColor:b==="Saved"?"green":"black",okLabel:b,testId:"firstpromoter-modal",title:"",onOk:async()=>{try{await v()}catch(y){i(y)}},children:[n.jsx(Jr,{detail:"Launch your own member referral program",icon:n.jsx(qe,{className:"-mt-2",name:"firstpromoter",size:56}),title:"FirstPromoter"}),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{marginBottom:!1,title:"FirstPromoter configuration",grouped:!0,children:[n.jsx(Be,{checked:m,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://firstpromoter.com/?fpr=ghost&fp_sid=admin",rel:"noopener noreferrer",target:"_blank",children:"FirstPromoter"})," for tracking referrals"]}),label:"Enable FirstPromoter",onChange:y=>{w(y.target.checked)}}),m&&n.jsx(_e,{hint:n.jsxs(n.Fragment,{children:["Affiliate and referral tracking, find your ID ",n.jsx("a",{className:"text-green",href:"https://ghost.org/help/firstpromoter-id/",rel:"noopener noreferrer",target:"_blank",children:"here"})]}),placeholder:"XXXXXXXX",title:"FirstPromoter account ID",value:f||"",onChange:y=>{p(y.target.value)}})]})})]})}),e2="ActionsResponseType",t2=Ov({dataType:e2,path:"/actions/",returnData:t=>{const{pages:a}=t;let s=a.flatMap(p=>p.actions.map(({context:x,...h})=>({...h,context:JSON.parse(x)})));s=s.reverse();let i=1;s.forEach((p,x)=>{const h=s[x+1];h&&p.resource_id===h.resource_id&&p.event===h.event?(p.skip=!0,i+=1):i>1&&(p.count=i,i=1)});const f=a[a.length-1].meta;return{actions:s.reverse(),meta:f,isEnd:f?f.pagination.pages===f.pagination.page:!0}}}),n2=t=>{let a=t.resource_type;if(t.event!=="deleted")switch(t.resource_type){case"page":case"post":return!t.resource||!t.resource.id?void 0:(a==="post"&&t.context?.type&&(a=t.context?.type),{isExternal:!0,route:`editor/${a}/${t.resource.id}`,models:[a,t.resource.id]});case"integration":return!t.resource||!t.resource.id?void 0:{route:`integrations/${t.resource.id}`};case"offer":return!t.resource||!t.resource.id?void 0:{isExternal:!0,route:`offers/${t.resource.id}`,models:[t.resource.id]};case"tag":return!t.resource||!t.resource.slug?void 0:{isExternal:!0,route:"tag",models:[t.resource.slug]};case"product":return{route:"tiers"};case"user":return!t.resource||!t.resource.slug?void 0:{route:`staff/${t.resource.slug}`}}},r2=t=>{let a=t.resource_type;a==="api_key"?a="API key":a==="setting"?a="settings":a==="product"&&(a="tier"),a==="post"&&t.context?.type&&(a=t.context?.type);let s=t.event;return t.event==="edited"&&t.context?.action_name&&(s=t.context?.action_name),t.context?.count&&t.context?.count>1?`${t.context?.count} ${a}s ${s}`:`${a.slice(0,1).toUpperCase()}${a.slice(1)} ${s}`},s2=t=>{if(t.resource_type==="setting"&&t.context?.group&&t.context?.key)return{group:t.context?.group,key:t.context?.key}},Fp=t=>typeof t.context?.count=="number"&&t.context?.count>1,a2=({action:t})=>{let a="pen";switch(t.event){case"added":a="add";break;case"deleted":a="trash";break}return n.jsx(qe,{name:a,size:"xs"})},o2=({action:t})=>n.jsxs("div",{className:"relative shrink-0",children:[n.jsx(Mh,{bgColor:jh(t.actor?.name||t.actor?.slug||""),image:t.actor?.image??void 0,label:kh(t.actor?.name||t.actor?.slug),labelColor:"white",size:"md"}),n.jsx("div",{className:"absolute -right-1 -bottom-1 z-30 flex items-center justify-center rounded-full border border-grey-100 bg-white p-1 shadow-sm dark:border-grey-900 dark:bg-black",children:n.jsx(a2,{action:t})})]}),vr=({label:t,item:a,excludedItems:s,toggleItem:i})=>n.jsx(Be,{checked:!s.includes(a),direction:"rtl",label:t,labelClasses:"text-sm",onChange:f=>i(a,f.target.checked)}),i2=({excludedEvents:t,excludedResources:a,toggleEventType:s,toggleResourceType:i})=>{const{updateRoute:f}=He(),p=_h({path:"/users/",filterKey:"name",responseKey:"users"}),x=async(m,w)=>{const v=await p.loadData(m);w(v.map(y=>({label:y.name,value:y.id})))},[h,b]=S.useState(),g=()=>{b(null)};return n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx(Du,{position:"end",trigger:n.jsx(Ie,{color:"outline",label:"Filter"}),children:n.jsxs("div",{className:"flex w-[220px] flex-col gap-8 p-5",children:[n.jsxs(ki,{children:[n.jsx(vr,{excludedItems:t,item:"added",label:"Added",toggleItem:s}),n.jsx(vr,{excludedItems:t,item:"edited",label:"Edited",toggleItem:s}),n.jsx(vr,{excludedItems:t,item:"deleted",label:"Deleted",toggleItem:s})]}),n.jsxs(ki,{children:[n.jsx(vr,{excludedItems:a,item:"post",label:"Posts",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"page",label:"Pages",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"tag",label:"Tags",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"offer,product",label:"Tiers & offers",toggleItem:i}),n.jsx(vr,{excludedItems:a,item:"api_key,integration,setting,user,webhook",label:"Settings & staff",toggleItem:i})]})]})}),n.jsx("div",{className:"w-[200px]",children:n.jsx(jt,{loadOptions:Ci(x,500),placeholder:"Search staff",value:h,async:!0,defaultOptions:!0,isClearable:!0,onSelect:m=>{m?(b(m),f(`history/view/${m.value}`)):(g(),f("history/view"))}})})]})},l2=({action:t})=>{const{updateRoute:a}=He(),s=s2(t);if(s){const{group:i,key:f}=s;return n.jsxs(n.Fragment,{children:[i.slice(0,1).toUpperCase(),i.slice(1),i!==f&&n.jsxs("span",{className:"text-xs",children:[" ",n.jsxs("code",{className:"mb-1 bg-white text-grey-800 dark:bg-grey-900 dark:text-white",children:["(",f,")"]})]})]})}else if(t.resource?.title||t.resource?.name||t.context?.primary_name){const i=n2(t);return i?n.jsx("a",{className:"cursor-pointer font-bold",onClick:f=>{f.preventDefault(),a(i)},children:t.resource?.title||t.resource?.name}):n.jsx(n.Fragment,{children:t.resource?.title||t.resource?.name||t.context?.primary_name})}else return n.jsx("span",{className:"text-grey-500",children:"(unknown)"})},c2=t=>{const s=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(t).reduce((i,{type:f,value:p})=>({...i,[f]:p}),{});return`${s.year}-${s.month}-${s.day} ${s.hour}:${s.minute}:${s.second}`},u2=200,d2=ge.create(({params:t})=>{const a=Lt(),{updateRoute:s}=He(),[i,f]=S.useState([]),[p,x]=S.useState(["label"]),{data:h,fetchNextPage:b,isFetchingNextPage:g}=t2({searchParams:{include:"actor,resource",limit:u2.toString(),filter:[i.length&&`event:-[${i.join(",")}]`,p.length&&`resource_type:-[${p.join(",")}]`,t?.user&&`actor_id:'${t.user}'`].filter(Boolean).join("+")},getNextPageParams:(y,C)=>({...C,filter:[C.filter,y.actions.length&&`created_at:<'${c2(new Date(y.actions[y.actions.length-1].created_at))}'`].join("+")}),keepPreviousData:!0}),m=S.useCallback(()=>{h?.isEnd||b()},[h?.isEnd,b]),w=(y,C,j)=>{y(N=>j?N.concat(C):N.filter(T=>T!==C))},v=i.length>0||p.length>0||t?.user;return n.jsx(ct,{afterClose:()=>{s("history")},cancelLabel:"",okLabel:"Close",scrolling:!0,size:"md",stickyFooter:!0,stickyHeader:!0,testId:"history-modal",title:"History",topRightContent:n.jsx(i2,{excludedEvents:i,excludedResources:p,toggleEventType:(y,C)=>w(f,y,!C),toggleResourceType:(y,C)=>w(x,y,!C),userId:t?.user}),onOk:()=>{a.remove(),s("history")},children:n.jsx("div",{className:"relative mt-6",children:n.jsx(sr,{hint:h?.isEnd&&h.actions.length>0?"End of history log":void 0,children:h?.actions?h.actions.length>0?n.jsxs(n.Fragment,{children:[n.jsx(x1,{offset:250,onTrigger:m}),h.actions.map(y=>!y.skip&&n.jsx(Nr,{avatar:n.jsx(o2,{action:y}),detail:[new Date(y.created_at).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"}),new Date(y.created_at).toLocaleTimeString("default",{hour:"2-digit",minute:"2-digit",second:"2-digit"})].join(" | "),title:n.jsxs("div",{className:"text-sm",children:[r2(y),Fp(y)?"":": ",!Fp(y)&&n.jsx(l2,{action:y}),y.count?n.jsxs(n.Fragment,{children:[" ",y.count," times"]}):null,n.jsxs("span",{children:[" — by ",y.actor?.name||y.actor?.slug]})]}),separator:!0})),g&&n.jsx("div",{className:"flex items-center justify-center p-5",children:n.jsx(Mi,{size:"md"})})]}):n.jsx(Af,{icon:"time-back",children:v?"No entries match your current filters.":"No history entries found."}):h===void 0?n.jsx("div",{className:"flex items-center justify-center px-5 pt-12 pb-10",children:n.jsx(Mi,{})}):n.jsx(Af,{children:"No entries found."})})})})}),f2=ge.create(()=>{const t=ge.useModal(),a=nu(),s=nu({searchParams:{limit:"100",permissions:"assign"}}),i=Ls(),{updateRoute:f}=He(),{config:p}=Ue(),x=p.labs.superEditors,h=S.useRef(null),[b,g]=S.useState(""),[m,w]=S.useState(""),[v,y]=S.useState("contributor"),[C,j]=S.useState({}),{data:{users:N}={}}=Rv(),{data:{invites:T}={}}=xy(),{mutateAsync:A}=by(),R=Ze();if(S.useEffect(()=>{h.current&&h.current.focus()},[]),S.useEffect(()=>{m==="saved"&&setTimeout(()=>{w("")},2e3)},[m]),S.useEffect(()=>{v!=="contributor"&&i?.isLimited("staff")?i.errorIfWouldGoOverLimit("staff").then(()=>{j(z=>({...z,role:void 0}))}).catch(z=>{if(z instanceof Fs){j(G=>({...G,role:z.message}));return}else throw z}):j(z=>({...z,role:void 0}))},[i,v]),!a.data?.roles||!s.data?.roles)return null;const $=a.data.roles,L=s.data.roles;let P="Send invitation";m==="saving"?P="Sending...":m==="saved"?P="Invite sent!":m==="error"&&(P="Retry");const D=async()=>{if(m!=="saving"){if(!Un.isEmail(b)){j({email:"Please enter a valid email address."});return}if(N?.some(({email:z})=>z===b)){j({email:"A user with that email address already exists."});return}if(T?.some(({email:z})=>z===b)){j({email:"A user with that email address was already invited."});return}if(!C.role){w("saving");try{await A({email:b,roleId:$.find(({name:z})=>z.toLowerCase()===v.toLowerCase()).id}),w("saved"),rt({title:"Invitation sent",message:`${b}`,type:"success"}),t.remove(),f("staff?tab=invited")}catch(z){w("error");let G="Failed to send invitation",te=n.jsxs("span",{children:["If the problem persists, ",n.jsxs("a",{href:"https://ghost.org/contact",children:[n.jsx("u",{children:"contact support"}),"."]}),"."]});z instanceof Lv&&z.data?.errors?.[0]?.type==="EmailError"&&(te=n.jsx("span",{children:"Check your Mailgun configuration."})),rt({title:G,message:te,type:"error"}),R(z,{withToast:!1});return}}}},q=[{hint:"Can create and edit their own posts, but cannot publish. An Editor needs to approve and publish for them.",label:"Contributor",value:"contributor"},{hint:"A trusted user who can create, edit and publish their own posts, but can’t modify others.",label:"Author",value:"author"},{hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site.",label:"Editor",value:"editor"},{hint:"Trusted staff user who should be able to manage all content and users, as well as site settings and options.",label:"Administrator",value:"administrator"}];x&&(q[2]={hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site. Can manage members and moderate comments.",label:"Editor (beta mode)",value:"super editor"});const Y=q.filter(z=>L.some(G=>G.name===z.label||G.name==="Super Editor"&&z.label==="Editor (beta mode)"));return C.email&&(P="Retry"),n.jsx(ct,{afterClose:()=>{f("staff")},cancelLabel:"",okColor:m==="error"||C.email?"red":"black",okLabel:P,testId:"invite-user-modal",title:"Invite a new staff user",width:540,onOk:D,children:n.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[n.jsx("p",{children:"Send an invitation for a new person to create a staff account on your site, and select a role that matches what you’d like them to be able to do."}),n.jsx(_e,{error:!!C.email,hint:C.email,inputRef:h,placeholder:"jamie@example.com",title:"Email address",value:b,onChange:z=>{g(z.target.value)},onKeyDown:()=>j(z=>({...z,email:void 0}))}),n.jsx("div",{children:n.jsx(g1,{error:!!C.role,hint:C.role,id:"role",options:Y,selectedOption:v,separator:!0,title:"Role",onSelect:z=>{y(z)}})})]})})}),Pp=({items:t,setItems:a})=>{const s=v=>!!(v.label&&!v.label.match(/^\s*$/)||v.url!=="/"),i=dm({items:t.map(v=>({...v,errors:{}})),setItems:v=>a(v.map(({url:y,label:C})=>({url:y,label:C}))),blank:{url:"/",label:"",errors:{}},canAddNewItem:s}),f=new RegExp(/^(\/|#|[a-zA-Z0-9-]+:)/),p=v=>{const y={};return(!v.label||v.label.match(/^\s*$/))&&(y.label="You must specify a label"),(!v.url||v.url.match(/\s/)||!Un.isURL(v.url,{require_protocol:!0})&&!v.url.match(f))&&(y.url="You must specify a valid URL or relative path"),y},x=(v,y)=>{const C=i.items.find(j=>j.id===v);i.updateItem(v,{...C.item,...y})},h=()=>{const v=p(i.newItem);Object.values(v).some(y=>y)?i.setNewItem({...i.newItem,errors:v}):i.addItem()},b=v=>{i.removeItem(v)},g=(v,y)=>{i.moveItem(v,y)},m="new",w=(v,y)=>{if(v===m)i.setNewItem({...i.newItem,errors:{...i.newItem.errors,[y]:void 0}});else{const C=i.items.find(j=>j.id===v).item;i.updateItem(v,{...C,errors:{...C.errors,[y]:void 0}})}};return{items:i.items.map(({item:v,id:y})=>({...v,id:y})),updateItem:x,addItem:h,removeItem:b,moveItem:g,newItem:{...i.newItem,id:m},setNewItem:v=>i.setNewItem({...i.newItem,...v}),clearError:w,validate:()=>{let v=!0;if(i.items.forEach(({item:y,id:C})=>{let j=p(y);Object.values(j).some(N=>N)&&(v=!1,i.updateItem(C,{...y,errors:j}))}),s(i.newItem)){const y=p(i.newItem);Object.values(y).some(C=>C)&&(v=!1,i.setNewItem({...i.newItem,errors:y}))}return v}}},Hp=({baseUrl:t,item:a,updateItem:s,addItem:i,clearError:f,labelPlaceholder:p,unstyled:x,textFieldClasses:h,action:b,className:g,...m})=>n.jsxs("div",{className:me("flex w-full items-start gap-3",g),"data-testid":"navigation-item-editor",...m,children:[n.jsx("div",{className:"flex flex-1 pt-1",children:n.jsx(_e,{className:h,containerClassName:"grow",error:!!a.errors.label,hint:a.errors.label,placeholder:p,title:"Label",unstyled:x,value:a.label,hideTitle:!0,onChange:w=>s?.({label:w.target.value}),onKeyDown:w=>{s?.({label:w.target.value}),w.key==="Enter"&&(w.preventDefault(),i?.()),a.errors.label&&f?.("label")}})}),n.jsx("div",{className:"flex flex-1 pt-1",children:n.jsx(gh,{baseUrl:t,className:h,containerClassName:"grow",error:!!a.errors.url,hint:a.errors.url,title:"URL",unstyled:x,value:a.url,hideTitle:!0,onChange:w=>s?.({url:w||""}),onKeyDown:w=>{const v=_i(w.target.value,t,!0);s?.({url:v.save||""})},onKeyUp:w=>{if(w.key==="Enter"){w.preventDefault();const v=_i(w.target.value,t,!0);s?.({url:v.save||""}),i?.()}a.errors.url&&f?.("url")}})}),b]}),zp=({baseUrl:t,navigation:a})=>n.jsxs("div",{className:"w-full pt-2",children:[n.jsx(xh,{items:a.items,itemSeparator:!1,renderItem:s=>n.jsx(Hp,{action:n.jsx(Ie,{className:"mt-1 self-center",icon:"trash",iconColorClass:"dark:text-white",size:"sm",onClick:()=>a.removeItem(s.id)}),baseUrl:t,clearError:i=>a.clearError(s.id,i),item:s,updateItem:i=>a.updateItem(s.id,i)}),onMove:a.moveItem}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(qe,{colorClass:"text-grey-300 dark:text-grey-900 mt-1",name:"add",size:"sm"}),n.jsx(Hp,{action:n.jsx(Ie,{className:"mx-2 mt-1 self-center rounded bg-green p-1","data-testid":"add-button",icon:"add",iconColorClass:"text-white",size:"sm",unstyled:!0,onClick:a.addItem}),addItem:a.addItem,baseUrl:t,className:"mt-1",clearError:s=>a.clearError(a.newItem.id,s),"data-testid":"new-navigation-item",item:a.newItem,labelPlaceholder:"New item label",updateItem:a.setNewItem})]})]}),p2=ge.create(()=>{const t=Lt(),{updateRoute:a}=He(),{localSettings:s,updateSetting:i,saveState:f,handleSave:p,siteData:x}=Xr(),[h,b]=ot(s,["navigation","secondary_navigation"]).map(y=>JSON.parse(y||"[]")),g=Pp({items:h,setItems:y=>{i("navigation",JSON.stringify(y))}}),m=Pp({items:b,setItems:y=>i("secondary_navigation",JSON.stringify(y))}),[w,v]=S.useState("primary-nav");return n.jsx(ct,{afterClose:()=>{a("navigation")},buttonsDisabled:f==="saving",cancelLabel:"Close",dirty:s.some(y=>y.dirty),okLabel:f==="saving"?"Saving...":"Save",scrolling:!0,size:"lg",stickyFooter:!0,testId:"navigation-modal",title:"Navigation",onOk:async()=>{g.validate()&&m.validate()&&(await p(),t.remove(),a("navigation"))},children:n.jsx("div",{className:"mt-6 mb-1",children:n.jsx(kr,{selectedTab:w,tabs:[{id:"primary-nav",title:"Primary",contents:n.jsx(zp,{baseUrl:x.url,navigation:g})},{id:"secondary-nav",title:"Secondary",contents:n.jsx(zp,{baseUrl:x.url,navigation:m})}],onTabChange:v})})})}),h2=""+new URL("user-cover-yM4cP_Mo.jpg",import.meta.url).href,m2=""+new URL("latest-posts-1-D7-ilqhR.jpg",import.meta.url).href,g2=""+new URL("latest-posts-2-BPfbGB8B.jpg",import.meta.url).href,x2=""+new URL("latest-posts-3-D72O3dn8.jpg",import.meta.url).href,b2=({senderName:t,senderEmail:a,senderReplyTo:s,headerImage:i,headerIcon:f,headerTitle:p,headerSubtitle:x,showPostTitleSection:h,showExcerpt:b,titleAlignment:g,titleFontCategory:m,titleFontWeight:w,bodyFontCategory:v,authorPlaceholder:y,showCommentCta:C,showFeatureImage:j,showFeedback:N,showShareButton:T,showLatestPosts:A,showSubscriptionDetails:R,siteTitle:$,footerContent:L,showBadge:P,backgroundColor:D,headerBackgroundColor:q,accentColor:Y,textColor:z,secondaryTextColor:G,headerTextColor:te,secondaryHeaderTextColor:fe,postTitleColor:Me,sectionTitleColor:K,dividerColor:Q,buttonColor:Ne,buttonTextColor:ue,linkColor:we,buttonCorners:ee,buttonStyle:pe,imageCorners:le,linkStyle:de,dividerStyle:V})=>{const ve=f||p,{config:De}=Ue(),Qe=new Date().toLocaleDateString("default",{year:"numeric",month:"short",day:"numeric"}),Dt=new Date().getFullYear(),Gt=L?L.replace(/<a/g,'<a target="_blank" rel="noopener noreferrer"'):"";let ae;hh(De)?ae=n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"From: "}),n.jsxs("span",{children:[t," (",a,")"]})]}),n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"Reply-to: "}),s||a]})]}):ae=n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:t}),n.jsxs("span",{children:[" ",a]})]}),n.jsxs("p",{className:"leading-normal",children:[n.jsx("span",{className:"font-semibold text-grey-900",children:"To:"})," Jamie Larson jamie@example.com"]})]});let $e="mb-5 text-pretty leading-[1.7] text-black";return m==="serif"&&v==="serif"?$e=me($e,"mb-8 font-serif text-[2.0rem] leading-tight"):m!=="serif"&&v==="serif"?$e=me($e,"mb-8 text-[1.7rem] leading-tight tracking-tight"):m==="serif"&&v!=="serif"?$e=me($e,"mb-8 font-serif text-[2.0rem] leading-tight"):$e=me($e,"mb-8 text-[1.9rem] leading-tight tracking-tight"),g==="center"&&($e=me($e,"text-center")),n.jsx("div",{className:"relative flex grow flex-col",children:n.jsx("div",{className:"absolute inset-0 m-5 flex items-center justify-center",children:n.jsxs("div",{className:"mx-auto my-0 flex max-h-full w-full max-w-[700px] flex-col overflow-hidden rounded-[4px] text-black shadow-sm",children:[n.jsx("div",{className:"flex-column flex min-h-[77px] justify-center rounded-t-sm border-b border-grey-200 bg-white px-6 text-sm text-grey-700",children:ae}),n.jsxs("div",{className:"overflow-y-auto text-sm",style:{backgroundColor:D},children:[n.jsxs("div",{className:"px-[7rem]",style:{backgroundColor:q},children:[i&&n.jsx("div",{children:n.jsx("img",{alt:"",className:"mb-4 block pt-6",src:i})}),ve&&n.jsxs("div",{className:"py-3",children:[f&&n.jsx("img",{alt:"",className:"mx-auto mb-2 size-10",role:"presentation",src:f}),p&&n.jsx("h4",{className:"mb-1 text-center text-[1.6rem] leading-tight font-bold tracking-tight text-grey-900 uppercase",style:{color:te},children:p}),x&&n.jsx("h5",{className:"mb-1 text-center text-[1.3rem] font-normal text-grey-700",style:{color:fe},children:x})]}),h&&n.jsxs("div",{className:me("flex flex-col py-8",g==="center"?"items-center":"items-start"),children:[n.jsx("h2",{className:me("text-4xl leading-supertight font-bold text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold",g==="center"?"text-center":"text-left",b?"mb-2":"mb-8"),style:{color:Me},children:"Your email newsletter"}),b&&n.jsx("p",{className:$e,style:{color:te},children:"A subtitle to highlight key points and engage your readers."}),n.jsxs("div",{className:me("flex w-full justify-between text-center text-md leading-none text-grey-700",g==="center"?"flex-col gap-1":"flex-row"),children:[n.jsxs("p",{className:"pb-1 text-[1.3rem]",style:{color:fe},children:["By ",y,n.jsx("span",{className:"before:pr-1 before:pl-0.5 before:content-['•']",children:Qe})]}),n.jsx("p",{className:"pb-1 text-[1.3rem] underline",style:{color:fe},children:n.jsx("span",{children:"View in browser"})})]})]}),j&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:me("h-[unset] w-full max-w-[600px] bg-cover bg-no-repeat",h?"":"pt-6"),children:n.jsx("img",{alt:"Feature",className:me("min-h-full min-w-full shrink-0",le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:h2})}),n.jsx("div",{className:"mt-1 w-full max-w-[600px] pb-8 text-center text-[1.3rem] text-grey-700",style:{color:fe},children:"Feature image caption"})]})]}),n.jsxs("div",{className:me("px-[7rem]",q!=="transparent"&&"pt-10"),children:[n.jsxs("div",{className:me("max-w-[600px] border-b border-grey-200 pb-[52px] leading-[27.2px] text-black",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted",v==="serif"?"font-serif text-[1.8rem]":"text-[1.7rem] tracking-tight",j||h?"":"pt-8"),style:{borderColor:Q},children:[n.jsx("p",{className:"mb-6",style:{color:z},children:"This is what your content will look like when you send one of your posts as an email newsletter to your subscribers."}),n.jsx("p",{className:"mb-6",style:{color:z},children:"Over there on the right you'll see some settings that allow you to customize the look and feel of this template – from colors and typography to layout and buttons – to make it perfectly suited to your brand."}),n.jsx("p",{className:"mb-[52px]",style:{color:z},children:"Email templates are exceptionally finnicky to make, but we've spent a long time optimising this one to make it work beautifully across devices, email clients and content types. So, you can trust that every email you send with Ghost will look great and work well. Just like the rest of your site."}),n.jsx("hr",{className:me("my-[52px] border-[#e0e7eb]",V==="dashed"&&"border-dashed",V==="dotted"&&"border-t-0 border-b-2 border-dotted"),style:{borderColor:Q}}),n.jsx("h3",{className:me("mb-[13px] text-[2.6rem] leading-supertight",m==="serif"&&"font-serif",m==="sans_serif"&&"font-sans",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"Need inspiration?"}),n.jsxs("p",{className:"mb-[27px]",style:{color:z},children:["We've put together a ",n.jsx("a",{className:me(de==="underline"&&"underline",de==="bold"&&"font-bold"),href:"https://ghost.org/help/email-design/",rel:"noopener noreferrer",style:{color:we||Y},target:"_blank",children:"quick guide"})," that walks through all of the available settings, along with a few examples of what's possible."]}),n.jsx("a",{className:me("inline-block border px-[18px] py-2 font-sans text-[15px]",ee==="rounded"&&"rounded-[6px]",ee==="pill"&&"rounded-full",ee==="square"&&"rounded-none",pe==="outline"?"bg-transparent":"border-transparent text-white",de==="bold"?"font-bold":"font-semibold"),href:"https://ghost.org/help/email-design/",rel:"noopener noreferrer",style:pe==="outline"?{borderColor:Ne||Y,color:Ne||Y}:{backgroundColor:Ne||Y,color:ue},target:"_blank",children:"Learn more"})]}),(N||C||T)&&n.jsx("div",{className:me("grid gap-5 border-b border-grey-200 px-6 py-5",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:n.jsxs("div",{className:"grid auto-cols-fr grid-flow-col gap-4",children:[N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"thumbs-up",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"More like this"})]}),n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"thumbs-down",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Less like this"})]})]}),C&&n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"comment",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Comment"})]}),T&&n.jsxs("div",{className:"pointer-events-none flex min-w-[120px] cursor-default flex-col items-center gap-[11px] text-center",children:[n.jsx("span",{className:"inline-flex size-[54px] items-center justify-center rounded-full border",style:{borderColor:Q,color:z},children:n.jsx(qe,{colorClass:"",name:"share",size:"md"})}),n.jsx("span",{className:"font-sans text-[1.3rem] leading-[1.4] font-medium",style:{color:z},children:"Share"})]})]})}),A&&n.jsxs("div",{className:me("border-b border-grey-200 py-6",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:[n.jsx("h3",{className:"mt-2 mb-4 pb-1 text-[1.2rem] font-semibold tracking-wide text-black uppercase",style:{color:z},children:"Keep reading"}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"The three latest posts published on your site"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Posts sent as an email only will never be shown here."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:m2})})]}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"Displayed at the bottom of each newsletter"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Giving your readers one more place to discover your stories."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:g2})})]}),n.jsxs("div",{className:"flex justify-between gap-4 py-2",children:[n.jsxs("div",{children:[n.jsx("h4",{className:me("mt-0.5 text-[1.9rem] text-black",m==="serif"&&"font-serif",w==="normal"&&"font-normal",w==="medium"&&"font-medium",w==="semibold"&&"font-semibold",w==="bold"&&"font-bold"),style:{color:K},children:"To keep your work front and center"}),n.jsx("p",{className:"m-0 text-base text-grey-700",style:{color:G},children:"Making sure that your audience stays engaged."})]}),n.jsx("div",{className:"aspect-square h-auto w-full max-w-[100px] bg-cover bg-no-repeat",children:n.jsx("img",{alt:"Latest post",className:me(le==="square"&&"rounded-none",le==="rounded"&&"rounded-md"),src:x2})})]})]}),R&&n.jsxs("div",{className:me("border-b border-grey-200 py-8",V==="dashed"&&"border-dashed",V==="dotted"&&"border-b-2 border-dotted"),style:{borderColor:Q},children:[n.jsx("h4",{className:"mb-3 text-[1.2rem] tracking-wide text-black uppercase",style:{color:z},children:"Subscription details"}),n.jsxs("p",{className:"m-0 mb-4 text-base",style:{color:z},children:["You are receiving this because you are a paid subscriber to ",$,". Your subscription will renew on 17 Jul 2024."]}),n.jsxs("div",{className:"flex",children:[n.jsxs("div",{className:"shrink-0 text-base",children:[n.jsx("p",{style:{color:z},children:"Name: Jamie Larson"}),n.jsx("p",{style:{color:z},children:"Email: jamie@example.com"}),n.jsx("p",{style:{color:z},children:"Member since: 17 July 2023"})]}),n.jsx("span",{className:me("w-full self-end text-right text-base whitespace-nowrap",de==="underline"&&"underline",de==="bold"&&"font-bold"),style:{color:we||Y},children:"Manage subscription"})]})]}),n.jsxs("div",{className:"flex flex-col items-center pt-10",children:[n.jsx("div",{dangerouslySetInnerHTML:{__html:Gt||""},className:"text px-8 py-3 text-center text-[1.3rem] leading-base break-words text-grey-700 [&_a]:underline",style:{color:G}}),n.jsxs("div",{className:"px-8 pt-3 pb-14 text-center text-[1.3rem] text-grey-700",children:[n.jsxs("span",{style:{color:G},children:[$," © ",Dt," — "]}),n.jsx("span",{className:"pointer-events-none cursor-auto underline",style:{color:G},children:"Unsubscribe"})]}),P&&n.jsx("div",{className:"flex flex-col items-center pt-[10px] pb-[40px]",children:n.jsxs("a",{className:"pointer-events-none inline-flex cursor-auto items-center px-2 py-1 text-[1.25rem] font-semibold tracking-tight text-grey-900",href:"https://ghost.org",style:{color:z},children:[n.jsx(wy,{className:"mr-[6px] size-4"}),n.jsx("span",{children:"Powered by Ghost"})]})})]})]})]})]})})})},w2=({newsletter:t})=>{const{currentUser:a,settings:s,siteData:i,config:f}=Ue(),[p,x,h,b,g]=ot(s,["title","icon","comments_enabled","support_email_address","default_email_address"]);let m=null;t.show_header_title?m=p||null:t.show_header_name&&(m=t.name);const w=t.show_header_title&&t.show_header_name?t.name:void 0,v=t.show_comment_cta&&h!=="off",y=t.feedback_enabled,C=t.show_share_button,j=()=>{const te=t.background_color;return/#([0-9a-f]{3}){1,2}$/i.test(te)?te:"#ffffff"},N=()=>{const te=t.header_background_color;return!te||te==="transparent"?"transparent":/#([0-9a-f]{3}){1,2}$/i.test(te)?te:"transparent"},T=()=>{const te=t.button_color;if(/#([0-9a-f]{3}){1,2}$/i.test(te||""))return te;if(te===null){const Me=j();return yn(Me).hex()}return i.accent_color},A=()=>{const te=t.button_style,fe=T();if(fe&&te==="fill")return yn(fe).hex()},R=()=>{const te=t.link_color===void 0?"accent":t.link_color,fe=/#([0-9a-f]{3}){1,2}$/i;return te==="accent"?i.accent_color:fe.test(te||"")?te:yn(j()).hex()},$=()=>{const te=t.post_title_color;if(/#([0-9a-f]{3}){1,2}$/i.test(te||""))return te;if(te==="accent")return i.accent_color;const Me=N(),K=Me==="transparent"?j():Me;return yn(K).hex()},L=()=>{const te=t.section_title_color;return/#([0-9a-f]{3}){1,2}$/i.test(te||"")?te:te==="accent"?i.accent_color:yn(j()).hex()},P=()=>{const te=t.divider_color;return/#([0-9a-f]{3}){1,2}$/i.test(te||"")?te:te==="accent"?i.accent_color:"#e0e7eb"},D=yn(j()).hex(),q=yn(j()).alpha(.5).toString(),Y=N()==="transparent"?D:yn(N()).hex(),z=N()==="transparent"?q:yn(N()).alpha(.5).toString(),G={backgroundColor:j(),headerBackgroundColor:N(),postTitleColor:$()||void 0,sectionTitleColor:L()||void 0,buttonColor:T()||void 0,buttonTextColor:A()||void 0,linkColor:R()||void 0,dividerColor:P()||void 0,textColor:D,secondaryTextColor:q,headerTextColor:Y,secondaryHeaderTextColor:z};return n.jsx(b2,{accentColor:i.accent_color,authorPlaceholder:a.name||a.email,backgroundColor:G.backgroundColor||"#ffffff",bodyFontCategory:t.body_font_category,buttonCorners:t.button_corners||"rounded",buttonStyle:t.button_style||"fill",dividerStyle:t.divider_style||"solid",footerContent:t.footer_content,headerBackgroundColor:G.headerBackgroundColor||"transparent",headerIcon:t.show_header_icon?x:void 0,headerImage:t.header_image,headerSubtitle:w,headerTitle:m,imageCorners:t.image_corners||"square",linkStyle:t.link_style||"underline",senderEmail:_u(t,f,g),senderName:t.sender_name||p,senderReplyTo:ru(t,f,b,g),showBadge:t.show_badge,showCommentCta:v,showExcerpt:t.show_excerpt,showFeatureImage:t.show_feature_image,showFeedback:y,showLatestPosts:t.show_latest_posts,showPostTitleSection:t.show_post_title_section,showShareButton:C,showSubscriptionDetails:t.show_subscription_details,siteTitle:p,titleAlignment:t.title_alignment,titleFontCategory:t.title_font_category,titleFontWeight:t.title_font_weight||"bold",...G})},v2=({newsletter:t,updateNewsletter:a,errors:s,clearError:i})=>{const{settings:f,config:p}=Ue(),[x,h]=ot(f,["default_email_address","support_email_address"]),[b,g]=S.useState(ru(t,p,h,x)||"");let m=_u(t,p,x);const w=S.useCallback(y=>{g(y.target.value),a({sender_reply_to:y.target.value||"newsletter"})},[a,g]),v=()=>{const y=ru(t,p,h,x)||"";g(y)};return n.jsx(_e,{error:!!s.sender_reply_to,hint:s.sender_reply_to,maxLength:191,placeholder:m||"",title:"Reply-to email",value:b,onBlur:v,onChange:w,onKeyDown:()=>i("sender_reply_to")})},y2=({newsletter:t,onlyOne:a,updateNewsletter:s,validate:i,errors:f,clearError:p})=>{const{updateRoute:x}=He(),{mutateAsync:h}=Eh(),b=Ls(),{settings:g,config:m,siteData:w}=Ue(),[v,y]=ot(g,["icon","default_email_address"]),{mutateAsync:C}=Ps(),[j,N]=S.useState("generalSettings"),{localSettings:T}=Xr(),[A]=ot(T,["title"]),R=Ze(),{data:{newsletters:$}={}}=Th(),L=["all","paid"].includes(Tt(g,"comments_enabled")||"");let P=_u(t,m,y);const[D,q]=S.useState($||[]),Y=D.filter(ee=>ee.status==="active");S.useEffect(()=>{q($||[])},[$]);const z=[{value:"serif",label:"Elegant serif",className:"font-serif"},{value:"sans_serif",label:"Clean sans-serif"}],G={sans_serif:{options:[{value:"normal",label:"Regular",className:"font-normal"},{value:"medium",label:"Medium",className:"font-medium"},{value:"semibold",label:"Semi-bold",className:"font-semibold"},{value:"bold",label:"Bold",className:"font-bold"}]},serif:{options:[{value:"normal",label:"Regular",className:"font-normal"},{value:"bold",label:"Bold",className:"font-bold"}],map:{medium:"normal",semibold:"bold"}}},te=()=>t.background_color==="light"?!1:yn(t.background_color).hex().toLowerCase()==="#ffffff",fe=async()=>{if(t.status==="active")ge.show(xt,{title:"Archive newsletter",prompt:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-6",children:["Your newsletter ",n.jsx("strong",{children:t.name})," will no longer be visible to members or available as an option when publishing new posts."]}),n.jsx("div",{children:"Existing posts previously sent as this newsletter will remain unchanged."})]}),okLabel:"Archive",okColor:"red",onOk:async ee=>{try{await h({...t,status:"archived"}),ee?.remove(),rt({type:"success",message:"Newsletter archived"})}catch(pe){R(pe)}}});else{try{await b?.errorIfWouldGoOverLimit("newsletters")}catch(ee){if(ee instanceof Fs){ge.show(zn,{prompt:ee.message||"Your current plan doesn't support more newsletters.",onOk:()=>x({route:"/pro",isExternal:!0})});return}else throw ee}ge.show(xt,{title:"Reactivate newsletter",prompt:n.jsxs(n.Fragment,{children:["Reactivating ",n.jsx("strong",{children:t.name})," will immediately make it visible to members and re-enable it as an option when publishing new posts."]}),okLabel:"Reactivate",onOk:async ee=>{await h({...t,status:"active"}),ee?.remove(),rt({type:"success",message:"Newsletter reactivated"})}})}},Me=()=>{if(!hh(m))return n.jsx(_e,{error:!!f.sender_email,hint:f.sender_email,placeholder:P||"",title:"Sender email address",value:t.sender_email||"",onChange:ee=>s({sender_email:ee.target.value}),onKeyDown:()=>p("sender_email")});if(mh(m))return n.jsx(_e,{error:!!f.sender_email,hint:f.sender_email,maxLength:191,placeholder:y,title:"Sender email address",value:t.sender_email||"",onChange:ee=>{s({sender_email:ee.target.value})},onKeyDown:()=>p("sender_email")})},K=G[t.title_font_category||"sans_serif"].options,Q=()=>{const ee=t.title_font_category||"sans_serif",pe=t.title_font_weight,le=G[ee].map,de=le&&le[pe]||pe;return K.find(ve=>ve.value===de)||K[0]},Ne=ee=>{const pe=ee?.value||"sans_serif",le=t.title_font_weight;let de=le;return G[pe].options.find(V=>V.value===le)||(de=G[pe].map?.[le]||"bold"),s({title_font_category:pe,title_font_weight:de})},ue=[{id:"generalSettings",title:"General",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Name and description",children:[n.jsx(_e,{error:!!f.name,hint:f.name,maxLength:191,placeholder:"Weekly Roundup",title:"Name",value:t.name||"",onChange:ee=>s({name:ee.target.value}),onKeyDown:()=>p("name")}),n.jsx(or,{maxLength:2e3,rows:2,title:"Description",value:t.description||"",onChange:ee=>s({description:ee.target.value})})]}),n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Email info",children:[n.jsx(_e,{maxLength:191,placeholder:A,title:"Sender name",value:t.sender_name||"",onChange:ee=>s({sender_name:ee.target.value})}),Me(),n.jsx(v2,{clearError:p,errors:f,newsletter:t,updateNewsletter:s,validate:i})]}),n.jsx(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Member settings",children:n.jsx(Be,{checked:t.subscribe_on_signup,direction:"rtl",label:"Subscribe new members on signup",labelStyle:"value",onChange:ee=>s({subscribe_on_signup:ee.target.checked})})}),n.jsx("div",{className:"mt-10 mb-5",children:t.status==="active"?!a&&n.jsx(Ie,{color:"red",disabled:Y.length===1,label:"Archive newsletter",link:!0,onClick:fe}):n.jsx(Ie,{color:"green",label:"Reactivate newsletter",link:!0,onClick:fe})})]})},{id:"content",title:"Content",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Header",children:[n.jsxs("div",{children:[n.jsx("div",{children:n.jsx(lt,{className:"mb-2",level:6,children:"Header image"})}),n.jsxs("div",{className:"flex-column flex gap-1",children:[n.jsx(ar,{deleteButtonClassName:"top-1! right-1!",height:t.header_image?"66px":"64px",id:"logo",imageURL:t.header_image||void 0,onDelete:()=>{s({header_image:null})},onUpload:async ee=>{try{const pe=rr(await C({file:ee}));s({header_image:pe})}catch(pe){R(pe)}},children:n.jsx(qe,{colorClass:"text-grey-700 dark:text-grey-300",name:"picture"})}),n.jsx(Hn,{children:"1200×600 recommended. Use a transparent PNG for best results on any background."})]})]}),n.jsxs(ki,{children:[v&&n.jsx(Be,{checked:t.show_header_icon,direction:"rtl",label:"Publication icon",onChange:ee=>s({show_header_icon:ee.target.checked})}),n.jsx(Be,{checked:t.show_header_title,direction:"rtl",label:"Publication title",onChange:ee=>s({show_header_title:ee.target.checked})}),n.jsx(Be,{checked:t.show_header_name,direction:"rtl",label:"Newsletter name",onChange:ee=>s({show_header_name:ee.target.checked})})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Title section",children:[n.jsx(Be,{checked:t.show_post_title_section,direction:"rtl",label:"Post title",onChange:ee=>s({show_post_title_section:ee.target.checked})}),t.show_post_title_section&&n.jsx(Be,{checked:t.show_excerpt,direction:"rtl",label:"Post excerpt",onChange:ee=>s({show_excerpt:ee.target.checked})}),n.jsx(Be,{checked:t.show_feature_image,direction:"rtl",label:"Feature image",onChange:ee=>s({show_feature_image:ee.target.checked})})]}),n.jsxs(Ye,{className:"mt-6",gap:"sm",margins:"lg",title:"Footer",children:[n.jsxs(ki,{gap:"lg",children:[n.jsx(Be,{checked:t.feedback_enabled,direction:"rtl",label:"Ask your readers for feedback",onChange:ee=>s({feedback_enabled:ee.target.checked})}),L&&n.jsx(Be,{checked:t.show_comment_cta,direction:"rtl",label:"Add a link to your comments",onChange:ee=>s({show_comment_cta:ee.target.checked})}),n.jsx(Be,{checked:t.show_share_button,direction:"rtl",label:"Show share button",onChange:ee=>s({show_share_button:ee.target.checked})}),n.jsx(Be,{checked:t.show_latest_posts,direction:"rtl",label:"Share your latest posts",onChange:ee=>s({show_latest_posts:ee.target.checked})}),n.jsx(Be,{checked:t.show_subscription_details,direction:"rtl",label:"Show subscription details",onChange:ee=>s({show_subscription_details:ee.target.checked})})]}),n.jsx(Cu,{hint:"Any extra information or legal text",nodes:"MINIMAL_NODES",placeholder:" ",title:"Email footer",value:t.footer_content||"",onChange:ee=>s({footer_content:ee})})]}),n.jsx($s,{}),n.jsxs("div",{className:"my-5 flex w-full items-start",children:[n.jsx("span",{children:n.jsx(qe,{className:"mt-[-1px] mr-2",colorClass:"text-red",name:"heart"})}),n.jsx(Ye,{marginBottom:!1,children:n.jsx(Be,{checked:t.show_badge,direction:"rtl",label:n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-sm md:text-base",children:"Promote independent publishing"}),n.jsx("span",{className:"text-[11px] leading-tight text-grey-700 md:text-xs md:leading-tight",children:"Show you're a part of the indie publishing movement with a small badge in the footer"})]}),labelStyle:"value",onChange:ee=>s({show_badge:ee.target.checked})})})]})]})},{id:"design",title:"Design",contents:n.jsxs(n.Fragment,{children:[n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Global",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{hex:"#ffffff",value:"light",title:"White"}],title:"Background color",value:t.background_color||"light",onChange:ee=>s({background_color:ee})})}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Heading font"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:z,selectedOption:z.find(ee=>ee.value===t.title_font_category),onSelect:Ne})]}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Heading weight"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:K,selectedOption:Q(),onSelect:ee=>s({title_font_weight:ee?.value})})]}),n.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[n.jsx("div",{className:"shrink-0",children:"Body font"}),n.jsx(jt,{containerClassName:"max-w-[200px]",options:z,selectedOption:z.find(ee=>ee.value===t.body_font_category),testId:"body-font-select",onSelect:ee=>s({body_font_category:ee?.value})})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Header",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"transparent",title:"Transparent",hex:"#00000000"}],title:"Header background color",value:t.header_background_color||"transparent",onChange:ee=>s({header_background_color:ee})})}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Post title color",value:t.post_title_color,onChange:ee=>s({post_title_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Title alignment"}),n.jsx(Fn,{activeKey:t.title_alignment,buttons:[{key:"left",icon:"align-left",iconSize:14,label:"Align left",tooltip:"Left",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({title_alignment:"left"}),disabled:!t.show_post_title_section},{key:"center",icon:"align-center",iconSize:14,label:"Align center",tooltip:"Center",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({title_alignment:"center"}),disabled:!t.show_post_title_section}],clearBg:!1})]})]}),n.jsxs(Ye,{className:"mt-6",gap:"xs",margins:"lg",title:"Body",children:[n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Section title color",value:t.section_title_color,onChange:ee=>s({section_title_color:ee})})}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"accent",title:"Accent",hex:w.accent_color},{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"}],title:"Button color",value:t.button_color,onChange:ee=>s({button_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Button style"}),n.jsx(Fn,{activeKey:t.button_style||"fill",buttons:[{key:"fill",icon:"squircle-fill",iconSize:14,label:"Fill",tooltip:"Fill",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_style:"fill"})},{key:"outline",icon:"squircle",iconSize:14,label:"Outline",tooltip:"Outline",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_style:"outline"})}],clearBg:!1})]}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Button corners"}),n.jsx(Fn,{activeKey:t.button_corners||"rounded",buttons:[{key:"square",icon:"square",iconSize:14,label:"Square",tooltip:"Squared",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"square"})},{key:"rounded",icon:"squircle",iconSize:14,label:"Rounded",tooltip:"Rounded",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"rounded"})},{key:"pill",icon:"circle",iconSize:14,label:"Pill",tooltip:"Pill",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({button_corners:"pill"})}],clearBg:!1})]}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"accent",title:"Accent",hex:w.accent_color},{value:null,title:"Auto",hex:te()?"#ffffff":"#000000"}],title:"Link color",value:t.link_color,onChange:ee=>s({link_color:ee})})}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Link style"}),n.jsx(Fn,{activeKey:t.link_style||"underline",buttons:[{key:"underline",icon:"text-underline",iconSize:14,label:"Underline",tooltip:"Underline",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"underline"})},{key:"regular",icon:"text-regular",iconSize:14,label:"Regular",tooltip:"Regular",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"regular"})},{key:"bold",icon:"text-bold",iconSize:14,label:"Bold",tooltip:"Bold",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({link_style:"bold"})}],clearBg:!1})]}),n.jsxs("div",{className:"flex w-full justify-between",children:[n.jsx("div",{children:"Image corners"}),n.jsx(Fn,{activeKey:t.image_corners||"square",buttons:[{key:"square",icon:"square",iconSize:14,label:"Square",tooltip:"Squared",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({image_corners:"square"})},{key:"rounded",icon:"squircle",iconSize:14,label:"Rounded",tooltip:"Rounded",hideLabel:!0,link:!1,size:"sm",onClick:()=>s({image_corners:"rounded"})}],clearBg:!1})]}),n.jsx("div",{className:"mb-1",children:n.jsx(Ln,{direction:"rtl",eyedropper:!0,swatches:[{value:"light",title:"Light",hex:"#e0e7eb"},{value:"accent",title:"Accent",hex:w.accent_color}],title:"Divider color",value:t.divider_color||"light",onChange:ee=>s({divider_color:ee})})})]})]})}],we=ee=>{N(ee)};return n.jsx("div",{className:"flex flex-col",children:n.jsx("div",{className:"px-7 pt-0 pb-7",children:n.jsx(kr,{selectedTab:j,stickyHeader:!0,tabs:ue,onTabChange:we})})})},_2=({newsletter:t,onlyOne:a})=>{const{config:s}=Ue(),{mutateAsync:i}=Eh(),{updateRoute:f}=He(),p=Ze(),{formState:x,saveState:h,updateForm:b,setFormState:g,handleSave:m,validate:w,errors:v,clearError:y,okProps:C}=nn({initialState:t,savingDelay:500,onSave:async()=>{const{meta:{sent_email_verification:[A]=[]}={}}=await i(x);let R;A&&A==="sender_email"?R=n.jsx("div",{children:"We‘ve sent a confirmation email to the new address."}):A&&A==="sender_reply_to"&&(R=n.jsx("div",{children:"We‘ve sent a confirmation email to the new address."})),R&&rt({icon:"email",message:R,type:"info"})},onSaveError:p,onValidate:()=>{const A={};return x.name||(A.name="A name is required for your newsletter"),x.sender_email&&!Un.isEmail(x.sender_email)?A.sender_email="Enter a valid email address":x.sender_email&&mh(s)&&x.sender_email.split("@")[1]!==kf(s)&&(A.sender_email=`Email address must end with @${kf(s)}`),x.sender_reply_to&&!Un.isEmail(x.sender_reply_to)&&!["newsletter","support"].includes(x.sender_reply_to)&&(A.sender_reply_to="Enter a valid email address"),A}}),j=A=>{b(R=>({...R,...A}))};S.useEffect(()=>{g(()=>t)},[g,t]);const N=n.jsx(w2,{newsletter:x}),T=n.jsx(y2,{clearError:y,errors:v,newsletter:x,onlyOne:a,updateNewsletter:j,validate:w});return n.jsx(Zr,{afterClose:()=>f("newsletters"),buttonsDisabled:C.disabled,cancelLabel:"Close",deviceSelector:!1,dirty:h==="unsaved",okColor:C.color,okLabel:C.label||"Save",preview:N,previewBgColor:"grey",previewToolbar:!1,sidebar:T,sidebarPadding:!1,testId:"newsletter-modal",title:"Newsletter",onOk:async()=>{await m({fakeWhenUnchanged:!0})}})},M2=({params:t})=>{const{data:{newsletters:a,isEnd:s}={},fetchNextPage:i}=Th(),f=a?.find(({id:p})=>p===t?.id);return S.useEffect(()=>{!f&&!s&&i()},[i,s,f]),f?n.jsx(_2,{newsletter:f,onlyOne:a.length===1}):null},k2=ge.create(M2),wm=({id:t})=>{const{updateRoute:a}=He(),{data:{offers:s=[]}={}}=Sh(t||""),[i,f]=S.useState(),[p,x]=S.useState(""),{siteData:h}=Ue();S.useEffect(()=>{if(s.length>0){const j=s[0],N=`${Pn(h)}${j?.code}`;x(N),f(j)}},[s,h]);const[b,g]=S.useState(!1),m=()=>{let j="";switch(i?.type){case"percent":j=i?.amount+"% discount";break;case"fixed":j=Da(wi(i?.amount))+" "+i?.currency+" discount";break;case"trial":j=i?.amount+" days free trial";break}return`${encodeURIComponent(i?.name||"")} — Check out ${encodeURIComponent(j)} on:`},w=async()=>{await navigator.clipboard.writeText(p),g(!0),setTimeout(()=>g(!1),2e3)},v=()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURI(p)}&text=${m()}`,"_blank")},y=()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURI(p)}`,"_blank")},C=()=>{window.open(`http://www.linkedin.com/shareArticle?mini=true&url=${encodeURI(p)}&title=${m()}`,"_blank")};return n.jsx(ct,{afterClose:()=>{a("offers")},animate:!1,backDropClick:!1,footer:!1,height:"full",size:"lg",testId:"offer-success-modal",topRightContent:"close",width:1140,children:n.jsxs("div",{className:"-mt-6 flex h-full flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"absolute top-5 left-6",children:n.jsx(Au,{activeItemClassName:"hidden md:block! md:visible!",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:block! md:visible!",items:[{label:"Offers",onClick:()=>{a("offers/edit")}},{label:i?.name||""}],separatorClassName:"hidden md:block! md:visible!",backIcon:!0,onBack:()=>{a("offers/edit")}})}),n.jsx(qe,{colorClass:"text-grey-700 -mt-4",name:"tags-check",size:"xl"}),n.jsx("h1",{className:"mt-6 text-4xl",children:"Your new offer is live!"}),n.jsx("p",{className:"mt-3 max-w-[510px] text-[1.6rem]",children:"You can share the link anywhere. In your newsletter, social media, a podcast, or in-person. It all just works."}),n.jsxs("div",{className:"mt-8 flex w-full max-w-md flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col-reverse gap-2",children:[n.jsx(_e,{name:"offer-url",type:"url",value:p,disabled:!0}),n.jsx(Ie,{color:"green",label:b?"Copied!":"Copy link",fullWidth:!0,onClick:w})]}),n.jsx("div",{className:'flex items-center gap-4 text-xs font-medium before:h-px before:grow before:bg-grey-300 before:content-[""] after:h-px after:grow after:bg-grey-300 after:content-[""] dark:before:bg-grey-800 dark:after:bg-grey-800',children:"OR"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"twitter-x",iconColorClass:"w-[14px] h-[14px]",size:"sm",fullWidth:!0,onClick:v}),n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"facebook",size:"sm",fullWidth:!0,onClick:y}),n.jsx(Ie,{className:"h-8 border border-grey-300 dark:border-grey-800",icon:"linkedin",size:"sm",fullWidth:!0,onClick:C})]})]})]})})},Ua=({href:t,onDestroyed:a,selectedTab:s,portalParent:i})=>{s||(s="signup");const f=S.useRef(null),[p,x]=S.useState(!1),[h,b]=S.useState(!0),g=S.useCallback(()=>{setTimeout(()=>{f.current&&b(!1)},300)},[f]);if(S.useEffect(()=>{const v=y=>{if(!t)return;new URL(y.origin).origin===new URL(t).origin&&y?.data?.type==="portal-preview-ready"&&g()};return window.addEventListener("message",v,!0),()=>{window.removeEventListener("message",v,!0),a?.()}},[t,a,g,p]),!t)return null;let m="mt-[-7%] flex h-screen items-center justify-center",w="hidden";return i==="preview"?(m="absolute z-50 mt-[-7%] flex h-screen items-center justify-center",w="invisible"):i==="offers"&&(m="absolute z-50 flex w-full h-full items-center justify-center",w="invisible"),n.jsxs(n.Fragment,{children:[h&&n.jsx("div",{className:m,children:n.jsx("span",{children:n.jsx(Mi,{})})}),n.jsx("iframe",{ref:f,className:!h&&p?"":w,"data-testid":"portal-preview",height:"100%",src:t,title:"Portal Preview",width:"100%",onLoad:()=>{x(!0)}})]})},Fu=(t,a)=>{const{disableBackground:s=!1,name:i,code:f,displayTitle:p="",displayDescription:x="",type:h,cadence:b,amount:g=0,duration:m,durationInMonths:w,currency:v="usd",status:y,tierId:C,redemptionType:j="signup"}=t;a=a.replace(/\/$/,"");const N="/?v=modal-portal-offer#/portal/preview/offer",T=new URLSearchParams;return T.append("disableBackground","false"),T.append("name",encodeURIComponent(i)),T.append("code",encodeURIComponent(f)),T.append("display_title",encodeURIComponent(p)),T.append("display_description",encodeURIComponent(x)),T.append("type",encodeURIComponent(h)),T.append("cadence",encodeURIComponent(b)),T.append("amount",encodeURIComponent(g)),T.append("duration",encodeURIComponent(m)),T.append("duration_in_months",encodeURIComponent(w)),T.append("currency",encodeURIComponent(v)),T.append("status",encodeURIComponent(y)),T.append("tier_id",encodeURIComponent(C)),T.append("redemption_type",encodeURIComponent(j)),s&&T.append("disableBackground","true"),`${a}${N}?${T.toString()}`},j2=t=>{const a=[];return t.forEach(s=>{a.push({label:`${s.name} - Monthly`,value:`${s.id}-month-${s.currency}`}),a.push({label:`${s.name} - Yearly`,value:`${s.id}-year-${s.currency}`})}),a};function N2(t){return t.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-")}const Up=191,Ti=({type:t,checked:a,onClick:s})=>{const i=a?"bg-black text-white dark:bg-white dark:text-black":"border border-grey-300 dark:border-grey-800";return n.jsx("button",{className:"text-left",type:"button",onClick:s,children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx("div",{className:`mt-0.5 flex size-4 items-center justify-center rounded-full ${i}`,children:a?n.jsx(qe,{className:"w-[7px] stroke-[4]",name:"check",size:"custom"}):null}),n.jsxs("div",{className:"-mt-px flex flex-col",children:[n.jsx("span",{children:t.title}),n.jsx("span",{className:"text-sm",children:t.description})]})]})})},Bp=t=>{const{fixedAmount:a=0,percentAmount:s=0,trialAmount:i=0,amount:f=0}=t;switch(t.type){case"fixed":return a*100;case"percent":return s;case"trial":return i;default:return f}},T2=({tierOptions:t,handleTierChange:a,selectedTier:s,typeOptions:i,durationOptions:f,handleTypeChange:p,handleDurationChange:x,overrides:h,handleAmountTypeChange:b,handleNameInput:g,handleTextAreaInput:m,handleDisplayTitleInput:w,handleDurationInMonthsInput:v,handleAmountInput:y,handleCodeInput:C,clearError:j,errors:N,testId:T,handleTrialAmountInput:A,amountOptions:R})=>{const $=h.cadence==="year",L=$?f.filter(K=>K.value!=="repeating"):f,[P,D]=S.useState(0),q=P>40?"text-red":"text-green",{siteData:Y}=Ue(),[z,G]=S.useState(!1),te=Pn(Y),fe=`${te}${h.code.value}`,Me=async()=>{await navigator.clipboard.writeText(fe),G(!0),setTimeout(()=>G(!1),2e3)};return n.jsx("div",{className:"pt-7","data-testId":T,children:n.jsxs(Ye,{children:[n.jsxs("section",{children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{error:!!N.name,hint:N.name||n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Visible to members on Stripe Checkout page"}),n.jsxs("strong",{children:[n.jsx("span",{className:`${q}`,children:P})," / 40"]})]}),maxLength:40,placeholder:"Black Friday",title:"Offer name",onChange:K=>{g(K),D(K.target.value.length)},onKeyDown:()=>j("name")}),n.jsx(_e,{error:!!N.displayTitle,hint:N.displayTitle,maxLength:Up,placeholder:"Black Friday Special",title:"Display title",value:h.displayTitle.value,onChange:K=>{w(K)},onKeyDown:()=>j("displayTitle")}),n.jsx(or,{maxLength:Up,placeholder:"Take advantage of this limited-time offer.",title:"Display description",value:h.displayDescription,onChange:K=>{m(K)}})]})]}),n.jsxs("section",{className:"mt-4",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"Details"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsxs("div",{className:"flex flex-col gap-4 rounded-md border border-grey-200 p-4 dark:border-grey-800",children:[n.jsx(Ti,{checked:h.type!=="trial",type:i[0],onClick:()=>{p("percent")}}),n.jsx(Ti,{checked:h.type==="trial",type:i[1],onClick:()=>{p("trial")}})]}),n.jsx(jt,{options:t,selectedOption:s,testId:"tier-cadence-select-offers",title:"Tier — Cadence",onSelect:K=>{K&&a(K)}}),h.type!=="trial"&&n.jsxs(n.Fragment,{children:[" ",n.jsxs("div",{className:"relative",children:[n.jsx(_e,{error:!!N.amount,hint:N.amount,title:"Amount off",type:"number",value:h.type==="fixed"?h.fixedAmount===0?"":h.fixedAmount?.toString():h.percentAmount===0?"":h.percentAmount?.toString(),onChange:K=>{y(K)},onKeyDown:()=>j("amount")}),n.jsx("div",{className:"absolute top-6 right-1.5 z-10",children:n.jsx(jt,{clearBg:!0,controlClasses:{menu:"w-20 right-0"},options:R,selectedOption:h.type==="percent"?R[0]:R[1],testId:"amount-type-select-offers",onSelect:K=>{b(K?.value||"")}})})]}),n.jsx(jt,{options:L,selectedOption:L.find(K=>K.value===h.duration),testId:"duration-select-offers",title:"Duration",onSelect:K=>{j("durationInMonths"),x(K?.value||"")}}),h.duration==="repeating"&&!$&&n.jsx("div",{className:"-mt-4",children:n.jsx(_e,{"data-testid":"duration-months-input",error:!!N.durationInMonths,hint:N.durationInMonths,rightPlaceholder:`${h.durationInMonths===1?"month":"months"}`,type:"number",value:h.durationInMonths===0?"":String(h.durationInMonths),onChange:K=>{v(K)},onKeyDown:()=>j("durationInMonths")})})]}),h.type==="trial"&&n.jsx(_e,{error:!!N.amount,hint:N.amount,title:"Trial duration",type:"number",value:h.trialAmount?.toString(),onChange:K=>{A(K)},onKeyDown:()=>j("amount")}),n.jsx(_e,{error:!!N.code,hint:N.code||(h.code.value!==""?n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[te,n.jsx("span",{className:"font-bold",children:h.code.value})]}),n.jsx("span",{}),n.jsx(Ie,{className:"text-xs",color:"green",label:`${z?"Copied":"Copy"}`,size:"sm",link:!0,onClick:Me})]}):null),placeholder:"black-friday",title:"Offer code",value:h.code.value,onChange:K=>{C(K)},onKeyDown:()=>j("code")})]})]})]})})},bi=t=>{const[a,s,i]=t.split("-");if(!a||!s||!i)throw new Error("Invalid input format. Expected format is: id-period-currency");return{id:a,period:s,currency:i}},E2=()=>{const{siteData:t}=Ue(),a=[{title:"Discount",description:"Offer a special reduced price",value:"percent"},{title:"Free trial",description:"Give free access for a limited time",value:"trial"}],s=[{value:"once",label:"First-payment"},{value:"repeating",label:"Multiple-months"},{value:"forever",label:"Forever"}],[i,f]=S.useState(""),{updateRoute:p}=He(),{data:{tiers:x}={}}=Kr(),h=Ba(x||[]),b=j2(h),{mutateAsync:g}=Ah(),[m,w]=S.useState({tier:b[0]||{},dataset:{id:b[0]?.value?bi(b[0]?.value).id:"",period:b[0]?.value?bi(b[0]?.value).period:"",currency:b[0]?.value?bi(b[0]?.value).currency:""}}),{data:{offers:v=[]}={}}=ju(),{formState:y,updateForm:C,handleSave:j,saveState:N,okProps:T,validate:A,errors:R,clearError:$}=nn({initialState:{disableBackground:!1,name:"",code:{isDirty:!1,value:""},displayTitle:{isDirty:!1,value:""},displayDescription:"",type:"percent",cadence:m?.dataset?.period||"",amount:0,duration:"once",durationInMonths:1,currency:m?.dataset?.currency||"USD",status:"active",tierId:m?.dataset?.id||"",trialAmount:7,fixedAmount:0,percentAmount:0},onSave:async()=>{const pe=y.type==="trial"?"trial":y.duration,le={name:y.name,code:y.code.value,display_title:y.displayTitle.value,display_description:y.displayDescription,cadence:y.cadence,amount:Bp(y)||0,duration:pe,...pe==="repeating"?{duration_in_months:y.durationInMonths}:{},currency:y.currency,status:y.status,redemption_type:"signup",tier:{id:y.tierId},type:y.type,currency_restriction:!1},de=await g(le);de&&de.offers&&de.offers.length>0&&p(`offers/success/${de.offers[0].id}`)},onSaveError:()=>{},onValidate:()=>{const pe={};return!y.name&&y.name.length===0&&(pe.name="Name is required"),!y.code.value&&y.code.value.length===0&&(pe.code="Code is required"),!y.displayTitle.value&&y.displayTitle.value.length===0&&(pe.displayTitle="Display title is required"),y.type==="percent"&&y.percentAmount===0&&(pe.amount="Enter an amount greater than 0."),y.type==="percent"&&(y.percentAmount<1||y.percentAmount>100)&&(pe.amount="Enter an amount between 1 and 100%."),(y.type==="fixed"&&y.fixedAmount===0||y.type==="fixed"&&y.fixedAmount<1)&&(pe.amount="Enter an amount greater than 0."),y.type==="trial"&&y.trialAmount===0&&(pe.amount="Enter an amount greater than 0."),y.type==="trial"&&y.trialAmount<1&&(pe.amount="Free trial must be at least 1 day."),y.type!=="trial"&&y.duration==="repeating"&&(!Number.isInteger(y.durationInMonths)||y.durationInMonths<1)&&(pe.durationInMonths="Enter a whole number of months (1 or more)."),pe},savingDelay:500}),L=[{value:"percent",label:"%"},{value:"fixed",label:y.currency}],P=pe=>{const le=bi(pe.value),de=le.period==="year";w({tier:pe,dataset:le}),C(V=>({...V,cadence:le.period,currency:le.currency,tierId:le.id,duration:de&&V.duration==="repeating"?"once":V.duration})),de&&$("durationInMonths")},D=pe=>{pe==="trial"&&($("amount"),$("durationInMonths")),C(le=>({...le,type:pe}))},q=pe=>{C(le=>({...le,type:pe==="percent"?"percent":"fixed"}))},Y=pe=>{const le=pe.target;y.type==="fixed"?C(de=>({...de,fixedAmount:Number(le.value)})):y.type==="percent"?C(de=>({...de,percentAmount:Number(le.value)})):C(de=>({...de,amount:Number(le.value)}))},z=pe=>{const le=pe.target,de=Number(le.value);C(V=>({...V,durationInMonths:Number.isNaN(de)?0:de}))},G=pe=>{const le=pe.target.value;C(de=>{let V={...de};return V.name=le,de.code.isDirty||($("code"),V.code={...de.code,value:N2(le)}),de.displayTitle.isDirty||($("displayTitle"),V.displayTitle={...de.displayTitle,value:le}),V})},te=pe=>{const le=pe.target;C(de=>({...de,displayTitle:{...de.displayTitle,isDirty:!0,value:le.value}}))},fe=pe=>{const le=pe.target;C(de=>({...de,displayDescription:le.value}))},Me=pe=>{const le=pe.target;C(de=>({...de,trialAmount:Number(le.value)}))},K=pe=>{C(le=>({...le,duration:pe}))},Q=pe=>{const le=pe.target;C(de=>({...de,code:{...de.code,isDirty:!0,value:le.value}}))},Ne=()=>{v.length>0?p("offers/edit"):p("offers")},ue=S.useMemo(()=>({name:y.name||"",code:y.code.value||"",displayTitle:y.displayTitle.value||"",displayDescription:y.displayDescription||"",type:y.type||"percent",cadence:y.cadence||"month",amount:Bp(y)||0,duration:y.type==="trial"?"trial":y.duration||"once",durationInMonths:y.durationInMonths||0,currency:y.currency||"USD",status:y.status||"active",tierId:y.tierId||h[0]?.id,redemptionType:"signup"}),[y,h]);S.useEffect(()=>{const pe=Fu(ue,t.url);f(pe)},[y,t.url,y.type,ue]);const we=n.jsx(T2,{amountOptions:L,clearError:$,durationOptions:s,errors:R,handleAmountInput:Y,handleAmountTypeChange:q,handleCodeInput:Q,handleDisplayTitleInput:te,handleDurationChange:K,handleDurationInMonthsInput:z,handleNameInput:G,handleTextAreaInput:fe,handleTierChange:P,handleTrialAmountInput:Me,handleTypeChange:D,overrides:y,selectedTier:m.tier,testId:"add-offer-sidebar",tierOptions:b,typeOptions:a,validate:A}),ee=n.jsx(Ua,{href:i||"",portalParent:"offers"});return n.jsx(Zr,{afterClose:()=>{p("offers")},backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:N==="unsaved",height:"full",okColor:T.color,okLabel:"Publish",preview:ee,previewToolbar:!1,sidebar:we,size:"lg",testId:"add-offer-modal",title:"Offer",width:1140,onCancel:Ne,onOk:async()=>{if(A(),!Object.values(R).every(le=>!le)){As.remove(),rt({title:"Can't save offer",type:"info",message:"Make sure you filled all required fields"});return}try{if(await j({force:!0}))return}catch(le){let de;le instanceof Mr&&le.data&&le.data.errors[0]&&(de=le.data.errors[0].context||le.data.errors[0].message),As.remove(),de&&rt({title:"Can't save offer",type:"error",message:de||"Please try again later"})}}})},Wp=40,C2=t=>new Date(t).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"}),Pu=t=>{const a="/ghost/#/members",s=`offer_redemptions:[${t.join(",")}]`;return`${a}?filter=${encodeURIComponent(s)}`},vm=t=>Pu([t]),I2=({amount:t,duration:a})=>t===100&&a==="repeating",Yp=(t,a)=>`Retention ${t} (${a})`,S2=({amount:t,duration:a,durationInMonths:s})=>I2({amount:t,duration:a})?`${s} ${s===1?"month":"months"} free`:a==="once"?`${t}% off once`:a==="repeating"?`${t}% off for ${s} mo`:`${t}% off forever`,A2=(t,a)=>{const s=a.trim(),i=S2(t),f=Yp(i,s);if(f.length<=Wp)return f;const p=f.length-Wp,x=Math.max(3,s.length-p);return Yp(i,s.slice(0,x))};function qp(t){return new Date(t).toLocaleDateString("default",{year:"numeric",month:"short",day:"2-digit"})}const D2=({clearError:t,errors:a,offer:s,updateOffer:i})=>{const{siteData:f}=Ue(),[p,x]=S.useState(!1),h=Ze(),{mutateAsync:b}=Nu(),[g,m]=S.useState(s?.name.length||0),w=g>40?"text-red":"text-green",{updateRoute:v}=He();S.useEffect(()=>{s?.name&&m(s?.name.length)},[s?.name]);const y=Pn(f),C=`${y}${s?.code}`,j=async()=>{await navigator.clipboard.writeText(C),x(!0),setTimeout(()=>x(!1),2e3)},N=async()=>{s?.status==="active"?ge.show(xt,{title:"Archive offer",prompt:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"New members will no longer be able to subscribe using this offer."}),n.jsxs("p",{children:["All members that previously redeemed ",n.jsx("strong",{children:s?.name})," will remain unchanged."]})]}),okLabel:"Archive",okColor:"red",onOk:async T=>{try{await b({...s,status:"archived"}),T?.remove(),rt({type:"success",title:"Offer archived"}),v("offers/edit")}catch(A){h(A)}}}):ge.show(xt,{title:"Reactivate offer",prompt:n.jsx(n.Fragment,{children:n.jsxs("p",{children:["Reactivating ",n.jsx("strong",{children:s?.name})," will allow new members to subscribe using this offer. Existing members will remain unchanged."]})}),okLabel:"Reactivate",onOk:async T=>{try{await b({...s,status:"active"}),T?.remove(),rt({type:"success",title:"Offer reactivated"}),v("offers/edit")}catch(A){h(A)}}})};return n.jsxs("div",{className:"flex grow flex-col pt-2",children:[n.jsxs(Ye,{className:" grow",children:[n.jsx("section",{children:n.jsxs("div",{className:"flex flex-col gap-5 rounded-md border border-grey-300 p-4 pb-3.5 dark:border-grey-800",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Created on"}),n.jsx("span",{children:qp(s?.created_at?s.created_at:"")})]}),n.jsxs("div",{className:"flex items-end justify-between",children:[n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Performance"}),n.jsxs("span",{children:[s?.redemption_count," ",s?.redemption_count===1?"redemption":"redemptions"]})]}),s?.redemption_count>0&&s?.last_redeemed?n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Last redemption"}),n.jsx("span",{children:qp(s?.last_redeemed)})]}):null]}),s?.redemption_count>0?n.jsx("a",{className:"font-semibold text-green",href:vm(s?.id),children:"See members →"}):null]})]})}),n.jsxs("section",{className:"mt-2",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{error:!!a.name,hint:a.name||n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Visible to members on Stripe Checkout page"}),n.jsxs("strong",{children:[n.jsx("span",{className:`${w}`,children:g})," / 40"]})]}),maxLength:40,placeholder:"Black Friday",title:"Offer name",value:s?.name,onChange:T=>{m(T.target.value.length),i({name:T.target.value})},onKeyDown:()=>t("name")}),n.jsx(_e,{containerClassName:"group",error:!!a.code,hint:a.code||(s?.code!==""?n.jsxs("span",{className:"truncate text-grey-700",children:[y,n.jsx("span",{className:"font-bold text-black dark:text-white",children:s?.code})]}):null),placeholder:"black-friday",rightPlaceholder:s?.code!==""?n.jsx(Ie,{className:"mt-1 mr-0.5",color:"green",label:p?"Copied!":"Copy link",size:"sm",onClick:j}):null,title:"Offer code",value:s?.code,onChange:T=>i({code:T.target.value}),onKeyDown:()=>t("code")}),n.jsx(_e,{error:!!a.displayTitle,hint:a.displayTitle,placeholder:"Black Friday Special",title:"Display title",value:s?.display_title,onChange:T=>i({display_title:T.target.value}),onKeyDown:()=>t("displayTitle")}),n.jsx(or,{placeholder:"Take advantage of this limited-time offer.",title:"Display description",value:s?.display_description,onChange:T=>i({display_description:T.target.value})})]})]})]}),n.jsx("div",{className:"mb-2",children:s?.status==="active"?n.jsx(Ie,{color:"red",label:"Archive offer",link:!0,onClick:N}):n.jsx(Ie,{color:"green",label:"Reactivate offer",link:!0,onClick:N})})]})},$2=({id:t})=>{const{siteData:a}=Ue(),{updateRoute:s}=He(),i=Ze(),{mutateAsync:f}=Nu(),[p,x]=S.useState(""),{data:{offers:h=[]}={}}=Sh(t||""),{formState:b,saveState:g,updateForm:m,setFormState:w,handleSave:v,validate:y,errors:C,clearError:j,okProps:N}=nn({initialState:h[0],savingDelay:500,onSave:async()=>{await f(b)},onSaveError:i,onValidate:()=>{const L={};return b?.name||(L.name="Name is required"),b?.display_title||(L.displayTitle="Display title is required"),b?.code||(L.code="Please enter a code"),L}});S.useEffect(()=>{w(()=>h[0])},[w,h]);const T=L=>{m(P=>({...P,...L}))},A=n.jsx(D2,{clearError:j,errors:C,offer:b,updateOffer:T,validate:y});S.useEffect(()=>{const L={name:b?.name||"",code:b?.code||"",displayTitle:b?.display_title||"",displayDescription:b?.display_description||"",type:b?.type||"",cadence:b?.cadence||"",amount:b?.amount,duration:b?.duration||"",durationInMonths:b?.duration_in_months||0,currency:b?.currency||"",status:b?.status||"",tierId:b?.tier?.id||"",redemptionType:"signup"},P=Fu(L,a.url);x(P)},[b,a]);const R=n.jsx(Ua,{href:p||"",portalParent:"offers"}),$=()=>{s("offers/edit")};return h?n.jsx(Zr,{afterClose:()=>{s("offers")},backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:g==="unsaved",height:"full",okColor:N.color,okLabel:N.label||"Save",preview:R,previewToolbarBreadcrumbs:[{label:"Offers",onClick:$},{label:b?.name||"Offer"}],sidebar:A,size:"lg",testId:"offer-update-modal",title:"Offer",width:1140,onBreadcrumbsBack:$,onCancel:$,onOk:async()=>{try{if(await v({force:!0}))return}catch(L){let P;L instanceof Mr&&L.data&&L.data.errors[0]&&(P=L.data.errors[0].context||L.data.errors[0].message),As.remove(),P&&rt({title:"Can't save offer",type:"error",message:"Please try again later"})}}}):null},Gp=[{title:"Percentage discount",description:"Offer a special reduced price"},{title:"Free month(s)",description:"Give free access for a limited time"}],Xp=[{value:"once",label:"First-payment"},{value:"repeating",label:"Multiple-months"},{value:"forever",label:"Forever"}],Kp=191,ym=99,Zp=`Enter a whole number of months between 1 and ${ym}.`,Vp=t=>{const a=Number.isFinite(t)?Math.trunc(t):0;return Math.max(1,a)},O2=({type:t,percentAmount:a,freeMonths:s,lastPercentAmount:i,lastFreeMonths:f})=>t==="free_months"?s>0?s:f:a>0?a:i,gu=(t="monthly")=>({enabled:!1,displayTitle:"",displayDescription:"",type:t==="yearly"?"percent":"free_months",percentAmount:20,duration:"once",durationInMonths:1,freeMonths:1}),R2=t=>t.type==="percent"&&t.amount===100&&t.duration==="repeating",L2=(t,a="monthly")=>{const s=gu(a);if(!t)return s;const i=R2(t),f=t.type==="percent"&&!i,p=t.duration==="repeating"&&t.duration_in_months?t.duration_in_months:s.durationInMonths;return{enabled:t.status==="active",displayTitle:t.display_title||"",displayDescription:t.display_description||"",type:i?"free_months":"percent",percentAmount:f?t.amount:s.percentAmount,duration:f?t.duration:s.duration,durationInMonths:p,freeMonths:i&&t.duration_in_months||s.freeMonths}},Qp=({formState:t,lastPercentAmount:a,lastFreeMonths:s})=>{const i=O2({type:t.type,percentAmount:t.percentAmount,freeMonths:t.freeMonths,lastPercentAmount:a,lastFreeMonths:s});if(t.type==="free_months")return{type:"percent",amount:100,duration:"repeating",durationInMonths:Vp(i)};const f=t.duration,p=f==="repeating"?Vp(t.durationInMonths):0;return{type:"percent",amount:i,duration:f,durationInMonths:p}},F2=t=>{if(!t)return null;const a=t.duration_in_months??0;return{type:"percent",amount:t.amount,duration:t.duration,durationInMonths:a}},Jp=t=>t?`${t.type}:${t.amount}:${t.duration}:${t.durationInMonths}`:"",eh=t=>Number.isInteger(t)&&t>0&&t<=ym,P2=(t,a)=>t.displayTitle!==a.displayTitle||t.displayDescription!==a.displayDescription||t.type!==a.type||t.percentAmount!==a.percentAmount||t.duration!==a.duration||t.durationInMonths!==a.durationInMonths||t.freeMonths!==a.freeMonths,H2=({formState:t,updateForm:a,clearError:s,errors:i,cadence:f,lastRedeemed:p,membersFilterUrl:x,redemptions:h})=>{const b=f==="yearly"?Xp.filter(g=>g.value!=="repeating"):Xp;return n.jsx("div",{className:"flex grow flex-col pt-2",children:n.jsxs(Ye,{className:"grow",children:[n.jsx("section",{children:n.jsx("div",{className:"flex flex-col gap-5 rounded-md border border-grey-300 p-4 pb-3.5 dark:border-grey-800",children:n.jsx("div",{className:"flex flex-col gap-1.5",children:n.jsxs("div",{className:"flex items-end justify-between",children:[n.jsxs("div",{className:"flex flex-col gap-5",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Performance"}),n.jsxs("span",{children:[h," ",h===1?"redemption":"redemptions"]})]}),h>0&&p?n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-xs leading-none font-semibold text-grey-700",children:"Last redemption"}),n.jsx("span",{children:C2(p)})]}):null]}),h>0&&x?n.jsx("a",{className:"font-semibold text-green",href:x,children:"See members →"}):null]})})})}),n.jsx("section",{className:"mt-2",children:n.jsx(Be,{align:"center",checked:t.enabled,direction:"rtl",hint:f==="monthly"?"Applied to monthly plans":"Applied to annual plans",label:`Enable ${f} retention`,onChange:g=>{a(m=>({...m,enabled:g.target.checked}))}},`retention-toggle-${f}-${t.enabled?"enabled":"disabled"}`)}),t.enabled&&n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"mt-2",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"General"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx(_e,{maxLength:Kp,placeholder:"Before you go",title:"Display title",value:t.displayTitle,onChange:g=>{a(m=>({...m,displayTitle:g.target.value}))}}),n.jsx(or,{maxLength:Kp,placeholder:"We'd hate to see you leave. How about a special offer to stay?",title:"Display description",value:t.displayDescription,onChange:g=>{a(m=>({...m,displayDescription:g.target.value}))}})]})]}),n.jsxs("section",{className:"mt-4",children:[n.jsx("h2",{className:"mb-4 text-lg",children:"Details"}),n.jsxs("div",{className:"flex flex-col gap-6",children:[f==="monthly"&&n.jsxs("div",{className:"flex flex-col gap-4 rounded-md border border-grey-200 p-4 dark:border-grey-800",children:[n.jsx(Ti,{checked:t.type==="percent",type:Gp[0],onClick:()=>{s("amount"),s("durationInMonths"),a(g=>({...g,type:"percent",percentAmount:g.percentAmount}))}}),n.jsx(Ti,{checked:t.type==="free_months",type:Gp[1],onClick:()=>{s("amount"),s("durationInMonths"),a(g=>({...g,type:"free_months"}))}})]}),t.type==="percent"&&n.jsxs(n.Fragment,{children:[n.jsx(_e,{error:!!i.amount,hint:i.amount,rightPlaceholder:"%",title:"Amount off",type:"number",value:t.percentAmount===0?"":String(t.percentAmount),onChange:g=>{const m=Number(g.target.value),w=Number.isNaN(m)?0:m;a(v=>({...v,percentAmount:w}))},onKeyDown:()=>s("amount")}),n.jsx(jt,{options:b,selectedOption:b.find(g=>g.value===t.duration),title:"Duration",onSelect:g=>{g&&(s("durationInMonths"),a(m=>({...m,duration:g.value})))}}),t.duration==="repeating"&&n.jsx("div",{className:"-mt-4",children:n.jsx(_e,{"data-testid":"duration-months-input",error:!!i.durationInMonths,hint:i.durationInMonths,rightPlaceholder:`${t.durationInMonths===1?"month":"months"}`,type:"number",value:t.durationInMonths===0?"":String(t.durationInMonths),onChange:g=>{const m=Number(g.target.value);a(w=>({...w,durationInMonths:Number.isNaN(m)?0:m}))},onKeyDown:()=>s("durationInMonths")})})]}),t.type==="free_months"&&n.jsx(_e,{error:!!i.amount,hint:i.amount,rightPlaceholder:`${t.freeMonths===1?"month":"months"}`,title:"Free months",type:"number",value:t.freeMonths===0?"":String(t.freeMonths),onChange:g=>{const m=Number(g.target.value);a(w=>({...w,freeMonths:Number.isNaN(m)?0:m}))},onKeyDown:()=>s("amount")})]})]})]})]})})},z2=({id:t})=>{const{updateRoute:a}=He(),{siteData:s}=Ue(),{data:{tiers:i=[]}={}}=Kr(),{data:{offers:f=[]}={},isFetched:p,isFetching:x}=ju(),{mutateAsync:h}=Ah(),{mutateAsync:b}=Nu(),g=Iy(),[m,w]=S.useState(""),v=t==="monthly"?"monthly":"yearly",y=v==="monthly"?"Monthly retention":"Yearly retention",C=v==="monthly"?"month":"year",j=Ba(i||[]),N=S.useMemo(()=>f.filter(ae=>ae.redemption_type==="retention"&&ae.cadence===C).sort((ae,$e)=>{const Ft=ae.created_at?new Date(ae.created_at).getTime():0;return($e.created_at?new Date($e.created_at).getTime():0)-Ft}),[f,C]),T=S.useMemo(()=>N.find(ae=>ae.status==="active")||null,[N]),A=N[0]||null,R=T||A,$=S.useMemo(()=>N.reduce((ae,$e)=>ae+($e.redemption_count||0),0),[N]),L=S.useMemo(()=>N.map(ae=>ae.id),[N]),P=S.useMemo(()=>N.map(ae=>ae.last_redeemed).filter(ae=>!!ae).sort((ae,$e)=>new Date($e).getTime()-new Date(ae).getTime())[0]||null,[N]),D=S.useMemo(()=>$===0||L.length===0?null:Pu(L),[L,$]),[q,Y]=S.useState(20),[z,G]=S.useState(1),[te,fe]=S.useState(null),Me=ae=>{let $e="Please try again later";ae instanceof Mr&&ae.data&&ae.data.errors[0]&&($e=ae.data.errors[0].context||ae.data.errors[0].message||$e),As.remove(),rt({title:"Failed to save offer",type:"error",message:$e})},{formState:K,setFormState:Q,updateForm:Ne,handleSave:ue,saveState:we,okProps:ee,errors:pe,clearError:le}=nn({initialState:gu(v),savingDelay:500,onSave:async()=>{let ae=!1;const $e=Qp({formState:K,lastPercentAmount:q,lastFreeMonths:z}),Ft=F2(R),Je=Jp(Ft)!==Jp($e),rn=K.enabled?"active":"archived",ht=K.displayTitle||"",bt=K.displayDescription||"",Bn=R?ht!==(R.display_title||"")||bt!==(R.display_description||""):ht!==""||bt!=="",st=gu(v),Wn=!K.enabled&&!R&&P2(K,st),dt=async It=>{const pn=crypto.getRandomValues(new Uint32Array(1))[0].toString(16).padStart(8,"0"),mt=A2($e,pn);await h({name:mt,code:pn,display_title:ht,display_description:bt,cadence:C,amount:$e.amount,duration:$e.duration,duration_in_months:$e.duration==="repeating"?$e.durationInMonths:null,currency:null,status:It,redemption_type:"retention",tier:null,type:$e.type,currency_restriction:!1}),ae=!0},Le=async()=>{ae&&await g()};if(!(!R&&!K.enabled&&!Wn)){if(Je){!K.enabled&&T&&(await b({...T,status:"archived"}),ae=!0),await dt(rn),await Le();return}if(R){const It=R.status!==rn;(Bn||It)&&(await b({...R,display_title:ht,display_description:bt,status:rn}),ae=!0),await Le();return}(K.enabled||Wn)&&await dt(rn),await Le()}},onSaveError:Me,onValidate:()=>{const ae={};return K.enabled&&(K.type==="percent"&&((K.percentAmount<1||K.percentAmount>100)&&(ae.amount="Enter an amount between 1 and 100%."),K.duration==="repeating"&&!eh(K.durationInMonths)&&(ae.durationInMonths=Zp)),K.type==="free_months"&&(eh(K.freeMonths)||(ae.amount=Zp))),ae}}),de=R?.id||"none",V=`${t}:${de}`;S.useEffect(()=>{!p||x||we==="unsaved"||te===V||(Q(()=>L2(R,v)),fe(V))},[v,V,R,p,te,x,we,Q]),S.useEffect(()=>{K.percentAmount>0&&Y(K.percentAmount)},[K.percentAmount]),S.useEffect(()=>{K.freeMonths>0&&G(K.freeMonths)},[K.freeMonths]);const ve=()=>{a("offers/edit")},De=n.jsx(H2,{cadence:v,clearError:le,errors:pe,formState:K,lastRedeemed:P,membersFilterUrl:D,redemptions:$,updateForm:Ne}),Qe=async()=>{try{await ue({force:!0})&&ve()}catch{}},Dt=S.useMemo(()=>{const ae=Qp({formState:K,lastPercentAmount:q,lastFreeMonths:z}),$e=j.find(Ft=>C==="month"?Ft.monthly_price:Ft.yearly_price);return{enabled:K.enabled,name:`${v} retention`,code:`${v}-retention`,displayTitle:K.displayTitle||"",displayDescription:K.displayDescription||"",type:ae.type,cadence:C,amount:ae.amount,duration:ae.duration,durationInMonths:ae.durationInMonths,currency:"",status:"active",tierId:$e?.id||"",redemptionType:"retention"}},[j,v,K,z,q,C]);S.useEffect(()=>{if(!s.url){w("");return}const ae=Fu(Dt,s.url);w(ae)},[Dt,s.url]);const Gt=n.jsx(Ua,{href:m||"",portalParent:"offers"});return n.jsx(Zr,{afterClose:()=>a("offers"),backDropClick:!1,cancelLabel:"Cancel",deviceSelector:!1,dirty:we==="unsaved",height:"full",okColor:ee.color,okLabel:ee.label||"Save",preview:Gt,previewToolbarBreadcrumbs:[{label:"Offers",onClick:ve},{label:y}],sidebar:De,size:"lg",testId:"retention-offer-modal",title:"Offer",width:1140,onBreadcrumbsBack:ve,onCancel:ve,onOk:Qe})},th=(t,a)=>t.find(s=>s.redemption_type==="retention"&&s.cadence===a&&s.status==="active")||null,nh=(t,a)=>t.reduce((s,i)=>i.redemption_type!=="retention"||i.cadence!==a?s:s+(i.redemption_count||0),0),rh=(t,a)=>t.filter(s=>s.redemption_type==="retention"&&s.cadence===a).map(s=>s.id),_m=t=>t.type==="percent"&&t.amount===100&&t.duration==="repeating",sh=t=>{if(!t)return null;if(_m(t)){const a=t.duration_in_months||0;return`${a} ${a===1?"month":"months"} free`}return t.type==="percent"?`${t.amount}% OFF`:null},ah=t=>{if(!t)return null;if(_m(t))return"";if(t.duration==="once")return"First payment";if(t.duration==="repeating"&&t.duration_in_months){const a=t.duration_in_months===1?"month":"months";return`For ${t.duration_in_months} ${a}`}return t.duration==="forever"?"Forever":null},U2=t=>{const a=th(t,"month"),s=th(t,"year"),i=rh(t,"month"),f=rh(t,"year"),p=nh(t,"month"),x=nh(t,"year");return[{id:"monthly",name:"Monthly retention",description:"Applied to monthly plans",terms:sh(a),termsDetail:ah(a),redemptionOfferIds:i,redemptions:p,status:a?"active":"inactive"},{id:"yearly",name:"Yearly retention",description:"Applied to annual plans",terms:sh(s),termsDetail:ah(s),redemptionOfferIds:f,redemptions:x,status:s?"active":"inactive"}]},B2=t=>t==="month"?"monthly":"yearly",W2=t=>t==="once"?"First payment":t==="repeating"?"Repeating":"Forever",Y2=(t,a,s,i,f)=>{let p="",x="";const h=s==="month"?f?.monthly_price??0:f?.yearly_price??0;let b=h;const g=v=>parseFloat(v.toFixed(2));let m=Df(i)+Da(g(wi(h)));switch(t){case"percent":p="text-green",x=a+"% off",b=h-h*a/100;break;case"fixed":p="text-blue",x=Da(g(wi(a)))+" "+i+" off",b=h-a;break;case"trial":p="text-pink",x=a+" days free",m="";break}b<0&&(b=0);const w=Df(i)+Da(g(wi(b)));return{discountColor:p,discountOffer:x,originalPriceWithCurrency:m,updatedPriceWithCurrency:w}},q2=({showArchived:t,setShowArchived:a,sortOption:s,sortDirection:i,onSortChange:f,onDirectionChange:p})=>n.jsx(Du,{position:"end",trigger:n.jsx(Ie,{"aria-label":"Filter options",className:"p-1 hover:text-black dark:hover:text-white",label:n.jsx(Dy,{size:16,strokeWidth:1.5}),unstyled:!0}),children:n.jsxs("div",{className:"flex min-w-[200px] flex-col p-1 normal-case",children:[n.jsx("div",{className:"cursor-default pt-2 pl-3 text-xs font-medium tracking-wide text-grey-700 uppercase select-none",children:"Sort by"}),n.jsx("div",{className:"flex flex-col py-1",children:[{id:"date-added",label:"Date added"},{id:"name",label:"Name"},{id:"redemptions",label:"Redemptions"}].map(x=>n.jsxs("div",{className:"group relative mx-1 flex items-center rounded-[2.5px] hover:bg-grey-100 dark:hover:bg-grey-800",children:[n.jsxs("button",{className:"flex w-full cursor-pointer items-center px-8 py-1.5 pr-12 text-left text-sm text-black dark:text-white",type:"button",onClick:()=>f(x.id),children:[s===x.id&&n.jsx(qe,{className:"absolute left-2",name:"check",size:"xs"}),x.label]}),s===x.id&&n.jsx("button",{className:"absolute right-1 flex size-6 cursor-pointer items-center justify-center rounded-full hover:bg-grey-300 dark:hover:bg-grey-700",title:i==="asc"?"Ascending":"Descending",type:"button",onClick:()=>p(),children:n.jsx(qe,{name:i==="asc"?"arrow-up":"arrow-down",size:"xs"})})]},x.id))}),n.jsx("div",{className:"-mx-1 mt-1 border-t border-t-grey-200 dark:border-t-grey-800",children:n.jsx("div",{className:"group relative mx-2 mt-1 flex items-center rounded-[2.5px] py-1",children:n.jsxs("div",{className:"flex w-full items-center px-8 py-1.5 pr-2 text-sm text-black dark:text-white",children:[n.jsx(Ay,{className:"absolute left-2 -mt-0.5 text-black dark:text-white",size:14,strokeWidth:1.5}),n.jsx("div",{className:"grow [&>div]:w-full",children:n.jsx(Be,{checked:t,direction:"rtl",label:"Show archived",labelClasses:"text-sm text-black dark:text-white",onChange:x=>{a(x.target.checked)}})})]})})})]})}),G2=({offer:t,onClick:a})=>{const s=t.redemptions>0&&t.redemptionOfferIds.length>0?Pu(t.redemptionOfferIds):void 0;return n.jsxs("tr",{className:"group relative border-b border-b-grey-200 dark:border-grey-800","data-testid":"retention-offer-item",children:[n.jsx("td",{className:"sticky left-0 z-10 bg-white p-0 dark:bg-black",children:n.jsxs("button",{className:"block w-full cursor-pointer p-5 pl-0 text-left",type:"button",onClick:a,children:[n.jsx("span",{className:"font-semibold",children:t.name}),n.jsx("br",{}),n.jsx("span",{className:"text-sm text-grey-700",children:t.description})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:t.terms?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-[1.3rem] font-medium uppercase",children:t.terms}),n.jsx("br",{}),n.jsx("span",{className:"text-grey-700",children:t.termsDetail})]}):n.jsx("span",{className:"text-grey-700",children:"–"})})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:n.jsx("span",{className:"text-grey-700",children:"–"})})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:s?n.jsx("a",{className:"block cursor-pointer p-5 hover:underline","data-testid":`retention-redemptions-link-${t.id}`,href:s,children:t.redemptions}):n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left","data-testid":`retention-redemptions-link-${t.id}`,type:"button",onClick:a,children:t.redemptions})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("button",{className:"block w-full cursor-pointer p-5 text-left",type:"button",onClick:a,children:t.status==="active"?n.jsx("span",{className:"inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-2 py-0.5 text-2xs font-semibold tracking-wide text-green uppercase",children:"Active"}):n.jsx("span",{className:"inline-flex items-center rounded-full bg-grey-200 px-2 py-0.5 text-2xs font-semibold tracking-wide text-grey-700 uppercase dark:bg-grey-900 dark:text-grey-500",children:"Inactive"})})})]})},oh=()=>{const t=Lt(),{updateRoute:a}=He(),{data:{offers:s=[]}={}}=ju(),{data:{tiers:i}={}}=Kr(),f=s.filter(D=>D.redemption_type==="signup"),p=U2(s),{sortingState:x,setSortingState:h}=vy(),b=x?.find(D=>D.type==="offers"),{offersShowArchived:g,setOffersShowArchived:m}=yy(),w=b?.option||"date-added",v=b?.direction||"desc",y=D=>{D&&a(`offers/edit/${D}`)},C=D=>{a(`offers/edit/retention/${D}`)},j=f.sort((D,q)=>{const Y=v==="desc"?-1:1;switch(w){case"name":return Y*D.name.localeCompare(q.name);case"redemptions":return Y*(D.redemption_count-q.redemption_count);default:return Y*((D.created_at?new Date(D.created_at).getTime():0)-(q.created_at?new Date(q.created_at).getTime():0))}}),N=Ba(i||[]),T=j.filter(D=>{const q=i?.find(G=>G.id===D?.tier?.id),Y=D.status==="active"&&q&&q.active===!0,z=D.status==="archived"||q&&q.active===!1;return!!(Y||g&&z)}),A=D=>{h?.([{type:"offers",option:D,direction:v}])},R=()=>{h?.([{type:"offers",option:w,direction:v==="asc"?"desc":"asc"}])},$=D=>{const q=i?.find(Y=>Y.id===D?.tier?.id);return D.status==="archived"||q&&q.active===!1},L=[{key:"cancel-modal",label:"Close",onClick:()=>{t.remove(),a("offers")}},{key:"new-offer",icon:"add",label:"New offer",color:"green",onClick:()=>{N.length===0?rt({type:"info",title:"You must have an active tier to create an offer."}):a("offers/new")}}],P=n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"m-0 min-w-[900px]",children:[n.jsxs("colgroup",{children:[n.jsx("col",{className:"w-[25%]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[200px]"}),n.jsx("col",{className:"w-[220px]"})]}),n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-b-grey-200 dark:border-grey-800",children:[n.jsx("th",{className:"sticky left-0 z-10 bg-white p-0 pb-2.5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase dark:bg-black",children:"Name"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Terms"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Price"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Redemptions"}),n.jsx("th",{className:"p-0 pb-2.5 pl-5 text-left text-xs font-medium tracking-wide text-grey-700 uppercase",children:n.jsxs("span",{className:"flex items-center justify-between",children:["Status",n.jsx(q2,{setShowArchived:m,showArchived:g,sortDirection:v,sortOption:w,onDirectionChange:R,onSortChange:A})]})})]})}),n.jsxs("tbody",{children:[p.map(D=>n.jsx(G2,{offer:D,onClick:()=>C(D.id)},D.id)),T.map(D=>{const q=i?.find(fe=>fe.id===D?.tier?.id);if(!q)return null;const Y=$(D),{discountOffer:z,originalPriceWithCurrency:G,updatedPriceWithCurrency:te}=Y2(D.type,D.amount,D.cadence,D.currency||"USD",q);return n.jsxs("tr",{className:`group relative border-b border-b-grey-200 dark:border-grey-800 ${Y?"opacity-60":""}`,"data-testid":"offer-item",children:[n.jsx("td",{className:"sticky left-0 z-10 bg-white p-0 dark:bg-black",children:n.jsxs("a",{className:"block cursor-pointer p-5 pl-0",onClick:()=>y(D.id),children:[n.jsx("span",{className:"font-semibold",children:D?.name}),n.jsx("br",{}),n.jsxs("span",{className:"text-sm text-grey-700",children:[q.name," ",B2(D.cadence)]})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsxs("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:[n.jsx("span",{className:"text-[1.3rem] font-medium uppercase",children:z}),n.jsx("br",{}),n.jsx("span",{className:"text-grey-700",children:D.type!=="trial"?W2(D.duration):"Trial period"})]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsxs("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:[n.jsx("span",{className:"font-medium",children:te})," ",D.type!=="trial"?n.jsx("span",{className:'relative text-xs text-grey-700 before:absolute before:-inset-x-0.5 before:top-1/2 before:rotate-[-20deg] before:border-t before:content-[""]',children:G}):null]})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("a",{className:`block cursor-pointer p-5 ${D.redemption_count===0?"":"hover:underline"}`,href:D.redemption_count>0&&D.id?vm(D.id):void 0,onClick:D.redemption_count===0&&D.id?()=>y(D.id):void 0,children:D.redemption_count})}),n.jsx("td",{className:"p-0 text-sm whitespace-nowrap",children:n.jsx("a",{className:"block cursor-pointer p-5",onClick:()=>y(D.id),children:Y?n.jsx("span",{className:"inline-flex items-center rounded-full bg-grey-200 px-2 py-0.5 text-2xs font-semibold tracking-wide text-grey-700 uppercase dark:bg-grey-900 dark:text-grey-500",children:"Archived"}):n.jsx("span",{className:"inline-flex items-center rounded-full bg-[rgba(48,207,67,0.15)] px-2 py-0.5 text-2xs font-semibold tracking-wide text-green uppercase",children:"Active"})})})]},D.id)})]})]})});return n.jsx(ct,{afterClose:()=>{a("offers")},animate:!1,backDropClick:!1,cancelLabel:"",footer:!1,height:"full",size:"lg",testId:"offers-modal",title:"Offers",topRightContent:n.jsx(Fn,{buttons:L}),width:1140,children:n.jsx("div",{className:"flex h-full flex-col pt-8",children:P})})},X2=({route:t})=>{if(t==="offers/new")return n.jsx(E2,{});if(t.startsWith("offers/edit/retention/")&&t.length>22){const a=t.split("/").pop();return n.jsx(z2,{id:a||""})}else{if(t==="offers/edit/retention/"||t==="offers/edit/retention")return n.jsx(oh,{});if(t.startsWith("offers/edit/")&&t.length>12){const a=t.split("/").pop();return n.jsx($2,{id:a||""})}else if(t.startsWith("offers/success/")&&t.length>15){const a=t.split("/").pop();return n.jsx(wm,{id:a||""})}else if(t==="offers/edit"||t==="offers/edit/")return n.jsx(oh,{})}},K2=()=>{const{route:t}=He();return n.jsx(X2,{route:t})},Z2=ge.create(K2),V2=""+new URL("pintura-screenshot-1gRQGS4m.png",import.meta.url).href,Q2=Gr({method:"POST",path:()=>"/files/upload/",body:({file:t})=>{const a=new FormData;return a.append("file",t),a}}),J2=ge.create(()=>{const{updateRoute:t}=He(),[a,s]=S.useState({js:!1,css:!1}),{settings:i,config:f}=Ue(),[p]=ot(i,["pintura"]),{mutateAsync:x}=jr(),{mutateAsync:h}=Q2(),b=Ze();S.useEffect(()=>{v(p||!1)},[p]);const[g,m]=S.useState("Save"),[w,v]=S.useState(!!p),y=async()=>{const R=[{key:"pintura",value:w}];try{m("Saving..."),await Promise.all([x(R),new Promise($=>{setTimeout($,1e3)})]),m("Saved")}catch($){b($)}finally{setTimeout(()=>m("Save"),1e3)}},C=S.useRef(null),j=S.useRef(null),N=R=>{R==="js"&&C.current?.click(),R==="css"&&j.current?.click()},T=async(R,$)=>{try{s(Y=>({...Y,[$]:!0}));const L=R.target?.files?.[0];if(!L)return;const{files:P}=await h({file:L}),D=P[0].url,q=[{key:`pintura_${$}_url`,value:D}];await x(q),s(Y=>({...Y,[$]:!1})),rt({type:"success",title:`Pintura ${$} uploaded`})}catch(L){s({js:!1,css:!1}),b(L)}},A=w!==p;return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:A,okColor:g==="Saved"?"green":"black",okLabel:g,testId:"pintura-modal",title:"",onOk:y,children:[n.jsx(Jr,{detail:"Advanced image editing",icon:n.jsx(qe,{name:"pintura",size:48}),title:"Pintura"}),n.jsxs("div",{className:"mt-7",children:[!f.pintura&&n.jsxs("div",{className:"mb-7 flex flex-col items-stretch justify-between gap-4 rounded-sm bg-grey-75 p-4 md:flex-row md:p-7 dark:bg-grey-950",children:[n.jsxs("div",{className:"md:basis-1/2",children:[n.jsx("p",{className:"mb-4 font-bold",children:"Add advanced image editing to Ghost, with Pintura"}),n.jsx("p",{className:"mb-4 text-sm",children:"Pintura is a powerful JavaScript image editor that allows you to crop, rotate, annotate and modify images directly inside Ghost."}),n.jsx("p",{className:"text-sm",children:"Try a demo, purchase a license, and download the required CSS/JS files from pqina.nl/pintura/ to activate this feature."})]}),n.jsxs("div",{className:"flex grow flex-col items-end justify-between gap-2 md:basis-1/2 md:gap-0",children:[n.jsx("img",{alt:"Pintura screenshot",src:V2}),n.jsx("a",{className:"-mb-1 text-sm font-bold text-green",href:"https://pqina.nl/pintura/ghost/?ref=ghost.org",rel:"noopener noreferrer",target:"_blank",children:"Find out more →"})]})]}),n.jsxs(Ye,{marginBottom:!1,title:"Pintura configuration",grouped:!0,children:[n.jsx(Be,{checked:w,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://pqina.nl/pintura/ghost/?ref=ghost.org",rel:"noopener noreferrer",target:"_blank",children:"Pintura"})," for editing your images in Ghost"]}),label:"Enable Pintura",onChange:R=>{v(R.target.checked)}}),w&&!f.pintura&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-col justify-between gap-1 md:flex-row md:items-center",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Upload Pintura script"}),n.jsxs("div",{className:"text-xs text-grey-600",children:["Upload the ",n.jsx("code",{children:"pintura-umd.js"})," file from the Pintura package"]})]}),n.jsx("input",{ref:C,accept:".js",type:"file",hidden:!0,onChange:async R=>{await T(R,"js")}}),n.jsx(Ie,{color:"outline",disabled:a.js,label:"Upload",onClick:()=>{N("js")}})]}),n.jsxs("div",{className:"flex flex-col justify-between gap-1 md:flex-row md:items-center",children:[n.jsxs("div",{children:[n.jsx("div",{children:"Upload Pintura styles"}),n.jsxs("div",{className:"text-xs text-grey-600",children:["Upload the ",n.jsx("code",{children:"pintura.css"})," file from the Pintura package"]})]}),n.jsx("input",{ref:j,accept:".css",type:"file",hidden:!0,onChange:async R=>{await T(R,"css")}}),n.jsx(Ie,{color:"outline",disabled:a.css,label:"Upload",onClick:()=>{N("css")}})]})]})]})]})]})}),ek=({localSettings:t,updateSetting:a})=>{const[s,i,f,p,x,h]=ot(t,["transistor","transistor_portal_enabled","transistor_portal_heading","transistor_portal_description","transistor_portal_button_text","transistor_portal_url_template"]);if(!(s===!0))return null;const g=i===!0,m=f,w=p,v=x,y=h;return n.jsxs(n.Fragment,{children:[n.jsx($s,{}),n.jsx(lt,{level:5,children:"Transistor"}),n.jsx(Be,{checked:g,direction:"rtl",hint:"Show a section on the account page for members to access private podcasts",label:"Enable Transistor integration",onChange:C=>a("transistor_portal_enabled",C.target.checked)}),g&&n.jsxs(n.Fragment,{children:[n.jsx(_e,{hint:"The heading displayed above the Transistor section",placeholder:"Podcasts",title:"Heading",value:m,onChange:C=>a("transistor_portal_heading",C.target.value)}),n.jsx(_e,{hint:"A short description of what members can do",placeholder:"Access your RSS feeds",title:"Description",value:w,onChange:C=>a("transistor_portal_description",C.target.value)}),n.jsx(_e,{hint:"The text displayed on the button",placeholder:"Manage",title:"Button text",value:v,onChange:C=>a("transistor_portal_button_text",C.target.value)}),n.jsx(_e,{hint:"Use {memberUuid} as a placeholder for the member ID",placeholder:"https://partner.transistor.fm/ghost/{memberUuid}",title:"URL template",value:y,onChange:C=>a("transistor_portal_url_template",C.target.value)})]})]})},tk=({localSettings:t,updateSetting:a,errors:s,setError:i})=>{const{siteData:f,settings:p,config:x}=Ue(),[h,b]=ot(p,["members_support_address","support_email_address"]),g=b?.toString()||eu(h?.toString()||"",f,x),m=Fv(f,x),[w,v]=S.useState(g),y=C=>{let j=C.target.value;j?Un.isEmail(j)?i("members_support_address",""):i("members_support_address","Enter a valid email address"):i("members_support_address","Enter an email address");let N=m&&j===`noreply@${m}`?"noreply":j;a("members_support_address",N),v(eu(N,f,x))};return S.useEffect(()=>{v(g)},[g]),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(_e,{error:!!s.members_support_address,hint:s.members_support_address,title:"Support email address",value:w,onBlur:y,onChange:C=>v(C.target.value)}),n.jsx(ek,{localSettings:t,updateSetting:a})]})})},Qc=[{icon:"portal-icon-1",value:"icon-1"},{icon:"portal-icon-2",value:"icon-2"},{icon:"portal-icon-3",value:"icon-3"},{icon:"portal-icon-4",value:"icon-4"},{icon:"portal-icon-5",value:"icon-5"}],nk=({localSettings:t,updateSetting:a})=>{const{mutateAsync:s}=Ps(),i=Ze(),[f,p,x,h]=ot(t,["portal_button","portal_button_style","portal_button_icon","portal_button_signup_text"]),b=x||Qc[0].value,g=Qc.map(({value:j})=>j).includes(b),[m,w]=S.useState(g?void 0:b),v=async j=>{try{const N=rr(await s({file:j}));a("portal_button_icon",N),w(N)}catch(N){const T=N;T.response.status===415&&(T.message="Unsupported file type"),i(T)}},y=()=>{a("portal_button_icon",null),w(void 0)},C=[{value:"icon-and-text",label:"Icon and text"},{value:"icon-only",label:"Icon only"},{value:"text-only",label:"Text only"}];return n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(Be,{checked:!!f,direction:"rtl",label:"Show portal button",onChange:j=>a("portal_button",j.target.checked)}),f&&n.jsxs(n.Fragment,{children:[n.jsx(jt,{options:C,selectedOption:C.find(j=>j.value===p),title:"Button style",onSelect:j=>a("portal_button_style",j?.value||null)}),p?.toString()?.includes("icon")&&n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(lt,{level:6,grey:!0,children:"Icon"}),n.jsxs("div",{className:"flex justify-between",children:[Qc.map(j=>n.jsx("button",{className:me("border p-3",b===j.value?"border-green":"border-transparent"),type:"button",onClick:()=>a("portal_button_icon",j.value),children:n.jsx(qe,{className:`size-5 ${b===j.value?"text-green":"text-black opacity-70 transition-all hover:opacity-100 dark:text-white"}`,name:j.icon})},j.value)),n.jsx("div",{className:me("relative w-[46px] border",b===m?"border-green":"border-transparent"),children:n.jsx(ar,{deleteButtonClassName:"invisible absolute -right-2 -top-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-full bg-[rgba(0,0,0,0.75)] text-white hover:bg-black group-hover:visible!",deleteButtonContent:n.jsx(qe,{colorClass:"text-white",name:"trash",size:"sm"}),height:"46px",id:"test",imageClassName:"cursor-pointer",imageURL:m,width:"46px",deleteButtonUnstyled:!0,onDelete:y,onImageClick:()=>m&&a("portal_button_icon",m),onUpload:v,children:n.jsx(qe,{className:"dark:text-white",name:"upload",size:"md"})})})]})]}),p?.toString()?.includes("text")&&n.jsx(_e,{title:"Signup button text",value:h,onChange:j=>a("portal_button_signup_text",j.target.value)})]})]})})},Mm=t=>{const{config:a}=Ue();return a.labs[t]||!1},vn=({name:t,value:a})=>{const s=S.useId();return n.jsx(Nr,{action:n.jsx(Ie,{color:"black",label:"Copy",link:!0,onClick:i=>{navigator.clipboard.writeText(a);const f=i?.target;f.innerText="Copied",setTimeout(()=>{f.innerText="Copy"},1e3)}}),separator:!0,children:n.jsxs("div",{className:"flex w-full grow flex-col py-3 lg:flex-row lg:items-center lg:gap-5",children:[n.jsxs("label",{className:"inline-block whitespace-nowrap lg:w-[180px] lg:min-w-[180px]",htmlFor:s,children:[t,":"]}),n.jsx(_e,{className:"grow border-b-grey-500 bg-transparent py-1 text-grey-700 lg:p-1",id:s,value:a,disabled:!0,unstyled:!0})]})})},rk=()=>{const[t,a]=S.useState(!1),[s,i]=S.useState(""),{siteData:f}=Ue(),{data:{tiers:p}={}}=Kr(),x=Ba(p||[]),h=Mm("giftSubscriptions"),b=()=>{a(!t)};S.useEffect(()=>{x?.length&&!s&&i(x[0].id)},[x,s]);const g=x?.map(w=>({label:w.name,value:w.id})),m=Pn(f);return n.jsxs(Su,{className:"max-w-[920px] text-base text-black dark:text-white",heading:"Links",children:[n.jsxs("p",{className:"-mt-6 mb-16",children:["Use these ",t?"data attributes":"links"," in your theme to show pages of Portal."]}),n.jsxs(sr,{actions:n.jsx(Ie,{color:"green",label:t?"Links":"Data attributes",link:!0,onClick:b}),title:"Generic",titleSize:"lg",children:[n.jsx(vn,{name:"Default",value:t?"data-portal":`${m}#/portal`}),n.jsx(vn,{name:"Sign in",value:t?'data-portal="signin"':`${m}#/portal/signin`}),n.jsx(vn,{name:"Sign up",value:t?'data-portal="signup"':`${m}#/portal/signup`}),h&&n.jsx(vn,{name:"Gift subscriptions",value:t?'data-portal="gift"':`${m}#/portal/gift`})]}),n.jsxs(sr,{className:"mt-14",title:"Tiers",titleSize:"lg",children:[n.jsx(Nr,{hideActions:!0,separator:!0,children:n.jsxs("div",{className:"flex w-full items-center gap-2 py-2",children:[n.jsx("span",{className:"inline-block w-[180px] min-w-[180px] shrink-0",children:"Tier:"}),n.jsx(jt,{options:g,selectedOption:g.find(w=>w.value===s),onSelect:w=>{w&&i(w?.value)}})]})}),n.jsx(vn,{name:"Signup / Monthly",value:t?`data-portal="signup/${s}/monthly"`:`${m}#/portal/signup/${s}/monthly`}),n.jsx(vn,{name:"Signup / Yearly",value:t?`data-portal="signup/${s}/yearly"`:`${m}#/portal/signup/${s}/yearly`}),n.jsx(vn,{name:"Signup / Free",value:t?'data-portal="signup/free"':`${m}#/portal/signup/free`})]}),n.jsxs(sr,{className:"mt-14",title:"Account",titleSize:"lg",children:[n.jsx(vn,{name:"Account",value:t?'data-portal="account"':`${m}#/portal/account`}),n.jsx(vn,{name:"Account / Plans",value:t?'data-portal="account/plans"':`${m}#/portal/account/plans`}),n.jsx(vn,{name:"Account / Profile",value:t?'data-portal="account/profile"':`${m}#/portal/account/profile`}),n.jsx(vn,{name:"Account / Newsletters",value:t?'data-portal="account/newsletters"':`${m}#/portal/account/newsletters`}),n.jsx(vn,{name:"Account / Newsletter help",value:t?'data-portal="account/newsletters/help"':`${m}#/portal/account/newsletters/help`})]})]})},sk=({settings:t,config:a,tiers:s,siteData:i,selectedTab:f})=>{if(!i?.url)return null;let p=s.filter(y=>y.visibility==="public"&&y.type==="paid").map(y=>y.id);const x=i.url.replace(/\/$/,""),h="/?v=modal-portal-settings#/portal/preview",b=JSON.parse(Tt(t,"portal_plans")||""),g=new URLSearchParams;g.append("button",Tt(t,"portal_button")?"true":"false"),g.append("name",Tt(t,"portal_name")?"true":"false"),g.append("isFree",b.includes("free")?"true":"false"),g.append("isMonthly",Ds(t,a)&&b.includes("monthly")?"true":"false"),g.append("isYearly",Ds(t,a)&&b.includes("yearly")?"true":"false"),g.append("page",f==="account"?"accountHome":"signup"),g.append("buttonIcon",encodeURIComponent(Tt(t,"portal_button_icon")||"icon-1")),g.append("signupButtonText",encodeURIComponent(Tt(t,"portal_button_signup_text")||"")),g.append("membersSignupAccess",Tt(t,"members_signup_access")||"all"),g.append("allowSelfSignup",Tt(t,"allow_self_signup")||"false"),g.append("signupTermsHtml",Tt(t,"portal_signup_terms_html")||""),g.append("signupCheckboxRequired",Tt(t,"portal_signup_checkbox_required")?"true":"false"),g.append("portalProducts",p.join(","));const m=Tt(t,"portal_default_plan");m&&g.append("portalDefaultPlan",m),b&&b.length&&g.append("portalPrices",encodeURIComponent(b.join(",")));const w=Tt(t,"accent_color");w!=null&&g.append("accentColor",encodeURIComponent(w));const v=Tt(t,"portal_button_style");return v&&g.append("buttonStyle",encodeURIComponent(v)),g.append("disableBackground","false"),Tt(t,"transistor")&&g.append("transistorPortalSettings",JSON.stringify({enabled:Tt(t,"transistor_portal_enabled"),heading:Tt(t,"transistor_portal_heading")||"Podcasts",description:Tt(t,"transistor_portal_description")||"Access your RSS feeds",button_text:Tt(t,"transistor_portal_button_text")||"Manage",url_template:Tt(t,"transistor_portal_url_template")||"https://partner.transistor.fm/ghost/{memberUuid}"})),`${x}${h}?${g.toString()}`},ak=({selectedTab:t="signup",localSettings:a,localTiers:s})=>{const{siteData:i,config:f}=Ue(),p=sk({settings:a,tiers:s,selectedTab:t,siteData:i,config:f});let x=n.jsx(n.Fragment,{});switch(t){case"account":x=n.jsx(n.Fragment,{children:n.jsx(Ua,{href:p||"",portalParent:"preview",selectedTab:t})});break;case"links":x=n.jsx(rk,{});break;default:x=n.jsx(n.Fragment,{children:n.jsx(Ua,{href:p||"",portalParent:"preview",selectedTab:t})});break}return x},ok=({localSettings:t,updateSetting:a,localTiers:s,updateTier:i,errors:f,setError:p})=>{const{config:x}=Ue(),[h,b,g,m,w,v]=ot(t,["members_signup_access","portal_name","portal_signup_terms_html","portal_signup_checkbox_required","portal_plans","portal_default_plan"]),y=JSON.parse(w?.toString()||"[]"),C=115,j=S.useMemo(()=>{const Y=document.createElement("div");return Y.innerHTML=g?.toString()||"",Y.innerText.length},[g]),N=S.useCallback((Y,z)=>{p(Y,z)},[]);S.useEffect(()=>{j>C?N("portal_signup_terms_html","Signup notice is too long"):N("portal_signup_terms_html",void 0)},[j,N]);const T=Y=>{const z=y.indexOf(Y);z===-1?y.push(Y):y.splice(z,1),a("portal_plans",JSON.stringify(y)),v==="yearly"?!y.includes("yearly")&&y.includes("monthly")&&a("portal_default_plan","monthly"):v==="monthly"&&(y.includes("monthly")||a("portal_default_plan","yearly"))},A=h==="all"||h==="paid",R=h==="all",$=Ds(t,x);let L=[];s&&s.forEach(Y=>{Y.type==="free"&&R&&L.push({checked:y.includes("free"),disabled:!A,label:Y.name,value:"free",testId:"free-tier-checkbox",onChange:z=>{y.includes("free")&&!z&&y.splice(y.indexOf("free"),1),!y.includes("free")&&z&&y.push("free"),a("portal_plans",JSON.stringify(y)),i({...Y,visibility:z?"public":"none"})}})});const P=Ba(s)||[],D=[{value:"yearly",label:"Yearly"},{value:"monthly",label:"Monthly"}];$&&P.length>0&&P.forEach(Y=>{L.push({checked:Y.visibility==="public",label:Y.name,value:Y.id,onChange:(z=>i({...Y,visibility:z?"public":"none"}))})});const q=$&&P.length>0&&P.some(Y=>Y.visibility==="public");return n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{children:[n.jsx(Be,{checked:!!b,direction:"rtl",disabled:!A,label:"Display name in signup form",onChange:Y=>a("portal_name",Y.target.checked)}),n.jsx(au,{checkboxes:L,title:"Available tiers"}),q&&n.jsxs(n.Fragment,{children:[n.jsx(au,{checkboxes:[{checked:y.includes("monthly"),disabled:!A,label:"Monthly",value:"monthly",onChange:()=>{T("monthly")}},{checked:y.includes("yearly"),disabled:!A,label:"Yearly",value:"yearly",onChange:()=>{T("yearly")}}],title:"Available prices"}),y.includes("yearly")&&y.includes("monthly")&&n.jsx(jt,{options:D,selectedOption:D.find(Y=>Y.value===v),title:"Default price at signup",onSelect:Y=>{a("portal_default_plan",Y?.value??"yearly")}})]}),n.jsx(Cu,{error:!!f.portal_signup_terms_html,hint:f.portal_signup_terms_html||n.jsxs(n.Fragment,{children:["Recommended: ",n.jsx("strong",{children:"115"})," characters. You've used ",n.jsx("strong",{className:"text-green",children:j})]}),nodes:"MINIMAL_NODES",placeholder:"By signing up, I agree to receive emails from ...",title:"Display notice at signup",value:g?.toString(),onChange:Y=>a("portal_signup_terms_html",Y)}),g?.toString()&&n.jsx(Be,{checked:!!m,disabled:!A,label:"Require agreement",labelStyle:"heading",onChange:Y=>a("portal_signup_checkbox_required",Y.target.checked)})]})})},ik="SettingsResponseType",lk=Gr({path:()=>"/settings/verifications",method:"PUT",body:({token:t})=>({token:t}),updateQueries:{dataType:ik,emberUpdateType:"createOrUpdate",update:t=>({...t,settings:t.settings})}}),ck=({localSettings:t,updateSetting:a,localTiers:s,updateTier:i,errors:f,setError:p,selectedTab:x,onTabChange:h})=>{const b=[{id:"signupOptions",title:"Signup options",contents:n.jsx(ok,{errors:f,localSettings:t,localTiers:s,setError:p,updateSetting:a,updateTier:i})},{id:"lookAndFeel",title:"Look & feel",contents:n.jsx(nk,{localSettings:t,updateSetting:a})},{id:"accountPage",title:"Account page",contents:n.jsx(tk,{errors:f,localSettings:t,setError:p,updateSetting:a})}];return n.jsx("div",{className:"pt-4",children:n.jsx(kr,{selectedTab:x,tabs:b,onTabChange:h})})},uk=()=>{const{updateRoute:t}=He(),[a,s]=S.useState("signup"),[i,f]=S.useState("signupOptions"),p=Ze(),{settings:x,siteData:h,config:b}=Ue(),{mutateAsync:g}=jr(),{data:{tiers:m}={}}=Kr(),{mutateAsync:w}=Tu(),{mutateAsync:v}=lk(),{getParam:y}=yh(),C=y("verifyEmail");S.useEffect(()=>{C&&(async({token:Q})=>{try{let{settings:Ne}=await v({token:Q});const[ue]=ot(Ne,["members_support_address"]);ge.show(xt,{title:"Support address verified",prompt:n.jsxs(n.Fragment,{children:["Your support email address has been changed to ",n.jsx("strong",{children:ue}),"."]}),okLabel:"Close",cancelLabel:"",onOk:we=>we?.remove()})}catch(Ne){let ue="There was an error verifying your email address. Please try again.";Ne?.message==="Token expired"&&(ue="Verification link has expired."),ge.show(xt,{title:"Error verifying support address",prompt:ue,okLabel:"Close",cancelLabel:"",onOk:we=>we?.remove()}),p(Ne,{withToast:!1})}})({token:C})},[p,C,v]);const{formState:j,setFormState:N,saveState:T,handleSave:A,updateForm:R,okProps:$}=nn({initialState:{settings:x,tiers:m||[]},savingDelay:500,onSave:async()=>{await Promise.all(j.tiers.filter(({dirty:ue})=>ue).map(ue=>w(ue))),N(ue=>({...ue,tiers:j.tiers.map(we=>({...we,dirty:!1}))}));const K=j.settings.filter(ue=>ue.dirty);if(!K.length)return;const{meta:Q,settings:Ne}=await g(K);if(N(ue=>({...ue,settings:j.settings.map(we=>({...we,dirty:!1}))})),Q?.sent_email_verification){const ue=j.settings.find(ee=>ee.key==="members_support_address")?.value,we=Ne.find(ee=>ee.key==="support_email_address")?.value||eu(Ne.find(ee=>ee.key==="members_support_address")?.value?.toString()||"noreply",h,b);ge.show(xt,{title:"Confirm email address",prompt:n.jsxs(n.Fragment,{children:["We've sent a confirmation email to ",n.jsx("strong",{children:ue}),". Until verified, your support email address will remain ",we,"."]}),okLabel:"Close",cancelLabel:"",onOk:ee=>ee?.remove()})}},onSaveError:p});S.useEffect(()=>{!j.tiers.length&&m?.length&&N(K=>({...K,tiers:m}))},[m,j.tiers,N]);const[L,P]=S.useState({}),D=(K,Q)=>{R(Ne=>({...Ne,settings:Ne.settings.map(ue=>ue.key===K?{...ue,value:Q,dirty:!0}:ue)}))},q=(K,Q)=>{P(Ne=>({...Ne,[K]:Q}))},Y=K=>{R(Q=>({...Q,tiers:Q.tiers.map(Ne=>Ne.id===K.id?{...K,dirty:!0}:Ne)}))},z=K=>{s(K),K==="signup"?f("signupOptions"):K==="account"&&f("accountPage")},G=K=>{f(K),K==="signupOptions"?s("signup"):K==="accountPage"&&s("account")},te=n.jsx(ck,{errors:L,localSettings:j.settings,localTiers:j.tiers,selectedTab:i,setError:q,updateSetting:D,updateTier:Y,onTabChange:G}),fe=n.jsx(ak,{localSettings:j.settings,localTiers:j.tiers,selectedTab:a});let Me=[{id:"signup",title:"Signup"},{id:"account",title:"Account page"},{id:"links",title:"Links"}];return n.jsx(Zr,{afterClose:()=>{t("portal")},buttonsDisabled:$.disabled,cancelLabel:"Close",deviceSelector:!1,dirty:T==="unsaved",okColor:$.color,okLabel:$.label||"Save",preview:fe,previewBgColor:a==="links"?"white":"greygradient",previewToolbarTabs:Me,selectedURL:a,sidebar:te,testId:"portal-modal",title:"Portal",onOk:async()=>{Object.values(L).filter(Boolean).length||await A({force:!0})},onSelectURL:z})},dk=ge.create(uk),fk=ge.create(()=>{const{updateRoute:t}=He(),{localSettings:a,updateSetting:s,handleSave:i,validate:f,errors:p,clearError:x,okProps:h}=Xr({onValidate:()=>{const y={};return b&&!Un.isURL(b,{require_protocol:!0})&&(y.slackUrl="The URL must be in a format like https://hooks.slack.com/services/<your personal key>"),y},savingDelay:500}),[b,g]=ot(a,["slack_url","slack_username"]),{mutateAsync:m}=Pv(),w=async()=>{As.remove(),await i()&&(await m(null),rt({title:"Check your Slack channel for the test message",type:"info"}))},v=a.some(y=>y.dirty);return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:v,okColor:h.color,okLabel:h.label||"Save",testId:"slack-modal",title:"",onOk:async()=>{As.remove(),await i()},children:[n.jsx(Jr,{detail:"A messaging app for teams",icon:n.jsx(qe,{name:"slack",size:56}),title:"Slack"}),n.jsx("div",{className:"mt-7",children:n.jsxs(Ye,{marginBottom:!1,title:"Slack configuration",grouped:!0,children:[n.jsx(_e,{error:!!p.slackUrl,hint:p.slackUrl||n.jsxs(n.Fragment,{children:["Automatically send newly published posts to a channel in Slack or any Slack-compatible service like Discord or Mattermost. Set up a new incoming webhook ",n.jsx("a",{href:"https://my.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks",children:"here"}),", and grab the URL."]}),placeholder:"https://hooks.slack.com/services/...",title:"Webhook URL",value:b,onBlur:f,onChange:y=>s("slack_url",y.target.value),onKeyDown:()=>x("slackUrl")}),n.jsxs("div",{className:"flex w-full flex-col gap-2 md:flex-row md:items-center",children:[n.jsx(_e,{containerClassName:"grow",hint:"The username to display messages from",title:"Username",value:g,onChange:y=>s("slack_username",y.target.value)}),n.jsx(Ie,{color:"outline",label:"Send test notification",onClick:w})]})]})})]})}),pk=""+new URL("stripe-thumb-Cu2h4McY.jpg",import.meta.url).href,hk=""+new URL("orb-squircle-e1heFqOI.png",import.meta.url).href,mk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20400%20400'%20style='enable-background:new%200%200%20400%20400'%20xml:space='preserve'%3e%3cpath%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23635bff'%20d='M0%200h400v400H0z'/%3e%3cpath%20d='M184.4%20155.5c0-9.4%207.7-13.1%2020.5-13.1%2018.4%200%2041.6%205.6%2060%2015.5v-56.8C244.8%2093.1%20225%2090%20205%2090c-49.1%200-81.7%2025.6-81.7%2068.4%200%2066.7%2091.9%2056.1%2091.9%2084.9%200%2011.1-9.7%2014.7-23.2%2014.7-20.1%200-45.7-8.2-66-19.3v57.5c22.5%209.7%2045.2%2013.8%2066%2013.8%2050.3%200%2084.9-24.9%2084.9-68.2-.4-72-92.5-59.2-92.5-86.3z'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23fff'/%3e%3c/svg%3e",gk=""+new URL("stripe-verified-DM7Q8nrY.svg",import.meta.url).href,xu=1e3,xk=15*xu,bk=({onNext:t})=>n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(lt,{level:3,children:"Getting paid"}),n.jsx("img",{alt:"Stripe Verified Partner Badge",src:gk})]}),n.jsxs("div",{className:"mt-6 mb-7",children:["Stripe is our exclusive direct payments partner. Ghost collects ",n.jsx("strong",{children:"no fees"})," on any payments! If you don’t have a Stripe account yet, you can ",n.jsx("a",{className:"underline",href:"https://stripe.com",rel:"noopener noreferrer",target:"_blank",children:"sign up here"}),"."]}),n.jsx(Nh,{label:n.jsx(n.Fragment,{children:"I have a Stripe account, let's go →"}),onClick:t})]}),wk=()=>{const[t,a]=S.useState(!1),[s,i]=S.useState(""),[f,p]=S.useState(!1),[x,h]=S.useState(""),{refetch:b}=Kr({searchParams:{filter:"type:paid+active:true"},enabled:!1}),{mutateAsync:g}=Tu(),{mutateAsync:m}=jr(),w=Ze(),v=T=>{i(T.target.value),a(!!T.target.value)},y=async()=>{const{data:T}=await b(),A=T?.pages[0].tiers[0];if(A){A.monthly_price=500,A.yearly_price=5e3,A.currency="USD";let R=0;for(;R<xk;){await new Promise($=>{setTimeout($,xu)});try{await g(A);break}catch($){if($ instanceof Mr&&$.data?.errors?.[0].code==="STRIPE_NOT_CONFIGURED"){R+=xu;continue}else{w($);return}}}}},C=async()=>{if(h(""),s)try{await m([{key:"stripe_connect_integration_token",value:s}]),await y(),await m([{key:"portal_plans",value:JSON.stringify(["free","monthly","yearly"])}])}catch(T){if(T instanceof Mr&&T.data?.errors){h("Invalid secure key");return}else{w(T);return}}else h("Please enter a secure key")},{apiRoot:j}=Rs(),N=`${j}/members/stripe_connect?mode=${f?"test":"live"}`;return n.jsxs("div",{children:[n.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[n.jsx(lt,{level:3,children:"Connect with Stripe"}),n.jsx(Be,{direction:"rtl",label:"Test mode",labelClasses:`text-sm translate-y-[1px] ${f?"text-[#EC6803]":"text-grey-800"}`,toggleBg:"stripetest",onChange:T=>p(T.target.checked)})]}),n.jsxs(lt,{level:6,grey:!0,children:["Step 1 — ",n.jsx("span",{className:"text-black dark:text-white",children:"Generate secure key"})]}),n.jsxs("div",{className:"mt-2 mb-4",children:["Click on the ",n.jsx("strong",{children:"“Connect with Stripe”"})," button to generate a secure key that connects your Ghost site with Stripe."]}),n.jsx(Nh,{href:N,tag:"a",target:"_blank"}),n.jsxs(lt,{className:"mt-8 mb-2",level:6,grey:!0,children:["Step 2 — ",n.jsx("span",{className:"text-black dark:text-white",children:"Paste secure key"})]}),n.jsx(or,{error:!!x,hint:x||void 0,placeholder:"Paste your secure key here",onChange:v}),t&&n.jsx(Ie,{className:"mt-5",color:"green",label:"Save Stripe settings",onClick:C})]})},vk=({onClose:t})=>{const{settings:a}=Ue(),[s,i]=ot(a,["stripe_connect_display_name","stripe_connect_livemode"]),{refetch:f,isFetching:p}=dh({searchParams:{filter:"status:paid",limit:"0"},enabled:!1}),{mutateAsync:x}=Hv(),h=Ze(),b=async()=>{const{data:g}=await f(),m=!!g?.meta?.pagination.total;ge.show(xt,{title:"Disconnect Stripe",prompt:m?"Cannot disconnect while there are members with active Stripe subscriptions.":n.jsxs(n.Fragment,{children:["You‘re about to disconnect your Stripe account ",s," from this site. This will automatically turn off paid memberships on this site."]}),okLabel:m?"":"Disconnect",onOk:async w=>{try{await x(null),w?.remove(),t?.()}catch(v){h(v)}}})};return n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Ie,{color:"red",disabled:p,icon:"link-broken",iconColorClass:"text-red",label:"Disconnect",link:!0,onClick:b}),n.jsx(Ie,{icon:"close",iconColorClass:"dark:text-white",label:"Close",size:"sm",hideLabel:!0,link:!0,onClick:t})]}),n.jsxs("div",{className:"my-20 flex flex-col items-center",children:[n.jsxs("div",{className:"relative h-20 w-[200px]",children:[n.jsx("img",{alt:"Ghost Logo",className:"absolute left-10 size-16",src:hk}),n.jsx("img",{alt:"Stripe Logo",className:"absolute right-10 size-16 rounded-2xl shadow-[-1.5px_0_0_1.5px_#fff] dark:shadow-[-1.5px_0_0_1.5px_black]",src:mk})]}),n.jsxs(lt,{className:"text-center",level:3,children:["You are connected with Stripe!",i?null:" (Test mode)"]}),n.jsxs("div",{className:"mt-1",children:["Connected to ",n.jsx("strong",{children:s||"Test mode"})]})]}),n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(lt,{level:6,children:"Read next"}),n.jsxs("a",{className:"mt-5 flex w-100 flex-col items-stretch justify-between rounded-sm border border-grey-200 transition-all hover:border-grey-400 md:flex-row dark:border-grey-900",href:"https://ghost.org/resources/managing-your-stripe-account/?ref=admin",rel:"noopener noreferrer",target:"_blank",children:[n.jsxs("div",{className:"order-2 p-4 md:order-1",children:[n.jsx("div",{className:"font-bold",children:"How to setup and manage your Stripe account"}),n.jsx("div",{className:"mt-1 text-sm text-grey-800 dark:text-grey-500",children:"Learn how to configure your Stripe account to work with Ghost, from custom branding to payment receipt emails."}),n.jsxs("div",{className:"mt-3 flex items-center gap-1 text-sm text-grey-800 dark:text-grey-500",children:[n.jsx("img",{alt:"Ghost Logo",className:"size-4",src:_y}),n.jsx("strong",{children:"Ghost Resources"}),n.jsx("span",{children:"·"}),n.jsx("span",{children:"by Kym Ellis"})]})]}),n.jsx("div",{className:"order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!",children:n.jsx("img",{alt:"Bookmark Thumb",className:"min-h-full min-w-full shrink-0",src:pk})})]})]})]})},yk=({onClose:t})=>{const{localSettings:a,updateSetting:s,handleSave:i,saveState:f}=Xr(),[p,x]=ot(a,["stripe_publishable_key","stripe_secret_key"]),h=async()=>{try{zv.remove(),await i(),t()}catch(b){if(b instanceof Mr){rt({title:"Failed to save settings",type:"error",message:"Check you copied both keys correctly"});return}throw b}};return n.jsxs("div",{children:[n.jsx(lt,{level:3,children:"Connect Stripe"}),n.jsxs(Ye,{marginBottom:!1,marginTop:!0,children:[n.jsx(_e,{title:"Publishable key",value:p?.toString(),onChange:b=>s("stripe_publishable_key",b.target.value)}),n.jsx(_e,{title:"Secure key",value:x?.toString(),onChange:b=>s("stripe_secret_key",b.target.value)}),n.jsx(Ie,{className:"mt-5",color:"green",disabled:f==="saving",label:"Save Stripe settings",onClick:h})]})]})},_k=()=>{const{config:t,settings:a}=Ue(),s=Tt(a,"stripe_connect_account_id"),{updateRoute:i}=He(),[f,p]=S.useState("start"),x=Lt(),h=Ls(),b=Ds(a,t),g=h?.isDisabled("limitStripeConnect");S.useEffect(()=>{(async()=>{if(g&&!b)try{await h?.errorIfWouldGoOverLimit("limitStripeConnect")}catch(C){C instanceof Fs&&(x.remove(),ge.show(zn,{prompt:C.message||"Your current plan doesn't support Stripe Connect.",onOk:()=>i({route:"/pro",isExternal:!0})}))}})()},[h,x,i,b,g]);const m=()=>{p("connect")},w=()=>{x.remove(),i("tiers")};let v;return t?.stripeDirect||Ds(a||[],t||{})&&!s?v=n.jsx(yk,{onClose:w}):s?v=n.jsx(vk,{onClose:w}):f==="start"?v=n.jsx(bk,{onNext:m}):v=n.jsx(wk,{}),n.jsx(ct,{afterClose:()=>{i("tiers")},cancelLabel:"",footer:n.jsx("div",{className:"mt-8"}),testId:"stripe-modal",title:"",width:s?740:520,hideXOnMobile:!0,children:v})},Mk=ge.create(_k),kk=""+new URL("ali-abdaal-C_tOLbSs.png",import.meta.url).href,jk=""+new URL("isaac-saul-DhERrV-4.png",import.meta.url).href,Nk=""+new URL("joel-warner-CHe_ZipQ.png",import.meta.url).href,Tk=ge.create(()=>{const{updateRoute:t}=He(),a=Ze(),s=Lt(),{settings:i,currentUser:f,siteData:p,config:x}=Ue(),h=x.exploreTestimonialsUrl,b=p.site_uuid,[g]=ot(i,["title"]),m=f.name,w=f.email,v=f.roles[0].name,y=f.profile_image,{formState:C,updateForm:j,saveState:N,handleSave:T,errors:A,clearError:R}=nn({initialState:{content:"",prev_platform:""},onSave:async()=>{const L=["none","other",""].includes(C.prev_platform)?void 0:C.prev_platform,P={ghost_uuid:b,staff_user_email:w,content:C.content,prev_platform:L};if(!h)throw new Error("Something went wrong, please try again later.");if(!(await fetch(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(P)})).ok)throw new Error("Something went wrong, please try again later.");rt({message:"Thank you for your testimonial!",type:"success"}),t("explore"),s.remove()},onSaveError:a,onValidate:()=>{const L={};return C.content.trim()||(L.content="This field is required"),L}}),$=[{value:"none",label:"None - This is a new site"},{value:"substack",label:"Substack"},{value:"beehiiv",label:"BeeHiiv"},{value:"wordpress",label:"WordPress"},{value:"newspack",label:"Newspack"},{value:"medium",label:"Medium"},{value:"squarespace",label:"Squarespace"},{value:"wix",label:"Wix"},{value:"patreon",label:"Patreon"},{value:"memberful",label:"Memberful"},{value:"other",label:"Other"}];return n.jsx(ct,{afterClose:()=>{t("explore")},cancelLabel:"",footer:!1,padding:!1,testId:"explore-testimonials-modal",title:"",topRightContent:"close",width:920,children:n.jsx(Ye,{className:"mb-0!",children:n.jsxs("div",{className:"flex items-stretch",children:[n.jsxs("div",{className:"hidden w-full flex-col justify-between bg-gradient-to-tl from-grey-100/50 to-grey-100/80 p-8 dark:from-grey-900/40 dark:to-grey-900/60 [@media(min-width:905px)]:visible! [@media(min-width:905px)]:flex!",children:[n.jsxs("div",{className:"pr-6",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"Moving to Ghost has proven to be one of the best business decisions we’ve made as an independent media outlet."}),n.jsxs("div",{className:"mt-[14px] ml-2 flex items-center gap-2 text-sm",children:[n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${Nk})`}}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Joel Warner"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"Lever News"})]})]})]}),n.jsxs("div",{className:"mt-8 ml-6",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:right-5 before:-bottom-1.5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"It has now been one year since I quit my full-time job to go all in on Tangle. Today, we have 50,000+ paying subscribers. That’s roughly $5M in gross yearly revenue ... it’s the best paying job I’ve ever had."}),n.jsxs("div",{className:"mt-[14px] mr-2 flex items-center justify-end gap-2 text-sm",children:[n.jsxs("div",{className:"flex flex-col items-end",children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Isaac Saul"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"Tangle"})]}),n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${jk})`}})]})]}),n.jsxs("div",{className:"mt-8 hidden pr-6 [@media(min-width:940px)]:visible! [@media(min-width:940px)]:block!",children:[n.jsx("div",{className:"relative rounded-xl bg-white px-3 py-2.5 text-grey-700 italic shadow-lg before:absolute before:-bottom-1.5 before:left-5 before:block before:size-3 before:rotate-45 before:bg-white dark:bg-black dark:text-grey-300 before:dark:bg-black",children:"You should be using Ghost because it’s absolutely amazing and I love it. It’s what I’ve been using for all my sites since 2016."}),n.jsxs("div",{className:"mt-[14px] ml-2 flex items-center gap-2 text-sm",children:[n.jsx("div",{className:"size-9 rounded-full bg-white bg-cover bg-center opacity-90 grayscale",style:{backgroundImage:`url(${kk})`}}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-black dark:text-white",children:"Ali Abdaal"}),n.jsx("div",{className:"-mt-0.5 text-grey-700",children:"YouTuber"})]})]})]})]}),n.jsxs("div",{className:"flex grow flex-col justify-between gap-6 p-8 [@media(min-width:905px)]:min-w-[520px] [@media(min-width:940px)]:min-w-[460px]",children:[n.jsxs("div",{children:[n.jsx("div",{className:"flex size-[60px] items-center justify-center rounded-full bg-gradient-to-t from-[#CFB0FF] to-[#B27EFF]",children:n.jsx("svg",{fill:"none",height:"26",viewBox:"0 0 32 26",width:"32",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M19.9967 26L18.1562 21.4542C23.4268 19.1176 25.7693 16.5261 26.2712 11.7255C25.5183 12.3627 24.5562 12.7026 23.3431 12.7026C20.1641 12.7026 17.4869 10.1536 17.4869 6.41503C17.4869 2.80392 20.3732 9.72736e-07 24.2634 6.32644e-07C28.2791 2.81581e-07 31.5 3.10131 31.5 8.96405C31.5 17.5458 27.4425 23.0261 19.9967 26ZM3.0098 26L1.12745 21.4543C6.43987 19.1176 8.78235 16.5261 9.24248 11.7255C8.53137 12.3627 7.56928 12.7026 6.35621 12.7026C3.17712 12.7026 0.499999 10.1536 0.499998 6.41504C0.499998 2.80393 3.38627 2.45778e-06 7.23464 2.12135e-06C11.2503 1.77028e-06 14.5131 3.10131 14.5131 8.96405C14.5131 17.5458 10.4556 23.0261 3.0098 26Z",fill:"white"})})}),n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-2xl font-semibold tracking-tight",children:"A quote about Ghost"}),n.jsx("div",{className:"mt-2 text-pretty",children:"We feature quotes from publishers to showcase their work, including a logo and a link! If you'd like to be included, share a quote we can use to highlight you."})]}),n.jsx("div",{className:"mt-8",children:n.jsx(or,{error:!!A.content,hint:A.content,placeholder:"What changed for the better since you switched to Ghost?",rows:7,value:C.content,autoFocus:!0,onChange:L=>j(P=>({...P,content:L.target.value})),onKeyDown:()=>R("content")})}),n.jsx("div",{className:"mt-4 ml-0.5",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Mh,{bgColor:jh(m||w),image:y??void 0,label:kh(m),labelColor:"white",size:"md"}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"text-sm font-medium",children:["By ",m||w]}),n.jsxs("span",{className:"text-xs text-grey-700",children:[v," — ",g]})]})]})})]}),n.jsx("div",{children:n.jsxs("div",{className:"mt-2 flex items-center gap-4",children:[n.jsx("div",{className:"grow",children:n.jsx(jt,{error:!!A.prev_platform,hint:A.prev_platform,options:$,placeholder:"Previous platform",selectedOption:$.find(L=>L.value===C.prev_platform),testId:"migrated-from",onSelect:L=>{j(P=>({...P,prev_platform:L?.value||""})),R("prev_platform")}})}),n.jsx(Ie,{className:"h-[38px]! rounded-lg",color:"black",disabled:N==="saving",label:"Send testimonial",loading:N==="saving",onClick:async()=>{await T()}})]})})]})]})})})}),Ek=""+new URL("ghost-transistor-BXCFhTPG.png",import.meta.url).href,Ck=ge.create(()=>{const{updateRoute:t}=He(),{config:a,settings:s}=Ue(),{mutateAsync:i}=jr(),{data:{integrations:f}={integrations:[]}}=Si(),{mutateAsync:p}=$u(),x=Ze(),[h,b]=S.useState(!1),g=a.hostSettings?.limits?.customIntegrations?.disabled,[m]=ot(s,["transistor"]),[w,v]=S.useState(!!m),[y,C]=S.useState("Save");S.useEffect(()=>{v(m||!1)},[m]),S.useEffect(()=>{g&&t("integrations")},[g,t]);const j=f.find(({slug:R})=>R==="transistor"),N=j?.api_keys?.find(R=>R.type==="admin"),T=()=>{if(!j||!N)throw new Error("Transistor integration or Admin API key not found");b(!1),ge.show(xt,{title:"Regenerate Admin API Key",prompt:"You will need to update the API key in your Transistor account settings after regenerating.",okLabel:"Regenerate Admin API Key",onOk:async R=>{try{await p({integrationId:j.id,apiKeyId:N.id}),b(!0),R?.remove()}catch($){x($)}}})},A=async()=>{const R=[{key:"transistor",value:w}];try{C("Saving..."),await Promise.all([i(R),new Promise($=>{setTimeout($,1e3)})]),C("Saved")}catch($){x($)}finally{setTimeout(()=>C("Save"),1e3)}};return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:w!==m,okColor:y==="Saved"?"green":"black",okLabel:y,testId:"transistor-modal",title:"",onOk:A,children:[n.jsx(Jr,{detail:"Give your members access to private podcasts",icon:n.jsx(qe,{name:"transistor",size:56}),title:"Transistor.fm"}),n.jsxs("div",{className:"mt-7",children:[n.jsxs(Ye,{marginBottom:!1,title:"Transistor configuration",grouped:!0,children:[n.jsx(Be,{checked:w,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Connect your Ghost site with ",n.jsx("a",{className:"text-green",href:"https://transistor.fm",rel:"noopener noreferrer",target:"_blank",children:"Transistor.fm"})," to offer members private podcasts."]}),label:"Enable Transistor",onChange:R=>{v(R.target.checked)}}),w&&n.jsx(Ya,{keys:[{label:"Admin API key",text:N?.secret,hint:h?n.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:T},{label:"API URL",text:window.location.origin+Rs().subdir}]})]}),w&&n.jsx("div",{className:"mt-5 flex flex-col items-center",children:n.jsxs("a",{className:"flex w-100 flex-col items-stretch justify-between overflow-hidden rounded-md bg-grey-75 transition-all hover:border-grey-400 hover:bg-grey-100 md:flex-row dark:bg-grey-925 dark:hover:bg-grey-950",href:"https://ghost.org/integrations/transistor/",rel:"noopener noreferrer",target:"_blank",children:[n.jsxs("div",{className:"order-2 px-7 py-5 md:order-1",children:[n.jsx("div",{className:"font-semibold",children:"How to use Transistor in Ghost"}),n.jsx("div",{className:"mt-1 text-sm text-grey-800 dark:text-grey-500",children:"Learn more about connecting Transistor with Ghost to offer members access to private podcasts in Portal or as an embed in posts and pages with a custom Transistor card."})]}),n.jsx("div",{className:"order-1 hidden w-[200px] shrink-0 items-center justify-center overflow-hidden md:visible! md:order-2 md:flex!",children:n.jsx("img",{alt:"Bookmark Thumb",className:"min-h-full min-w-full shrink-0",src:Ek})})]})})]})]})}),Ik=ge.create(()=>{const{updateRoute:t}=He(),{settings:a}=Ue(),[s]=ot(a,["unsplash"]),{mutateAsync:i}=jr(),f=Ze(),[p,x]=S.useState("Save"),[h,b]=S.useState(!!s);S.useEffect(()=>{b(s||!1)},[s]);const g=async()=>{const w=[{key:"unsplash",value:h}];try{x("Saving..."),await Promise.all([i(w),new Promise(v=>{setTimeout(v,1e3)})]),x("Saved")}catch(v){f(v)}finally{setTimeout(()=>x("Save"),1e3)}},m=h!==s;return n.jsxs(ct,{afterClose:()=>{t("integrations")},cancelLabel:"Close",dirty:m,okColor:p==="Saved"?"green":"black",okLabel:p,testId:"unsplash-modal",title:"",onOk:g,children:[n.jsx(Jr,{detail:"Beautiful, free photos",icon:n.jsx(qe,{name:"unsplash",size:48}),title:"Unsplash"}),n.jsx("div",{className:"mt-7",children:n.jsx(Ye,{marginBottom:!1,grouped:!0,children:n.jsx(Be,{checked:h,direction:"rtl",hint:n.jsxs(n.Fragment,{children:["Enable ",n.jsx("a",{className:"text-green",href:"https://unsplash.com",rel:"noopener noreferrer",target:"_blank",children:"Unsplash"})," image integration for your posts"]}),label:"Enable Unsplash",onChange:w=>{b(w.target.checked)}})})})]})}),Sk=({user:t,setUserData:a})=>{const{config:s,settings:i}=Ue(),f=Ds(i||[],s||{}),p=Mm("giftSubscriptions");return n.jsxs(ku,{children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Engagement"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.comment_notifications,direction:"rtl",hint:"Every time a member comments on one of your posts",label:"Comments",onChange:x=>{a?.({...t,comment_notifications:x.target.checked})}}),Ra(t)&&n.jsx(Be,{align:"center",checked:t.recommendation_notifications,direction:"rtl",hint:"Every time another publisher recommends you to their audience",label:"Recommendations",onChange:x=>{a?.({...t,recommendation_notifications:x.target.checked})}})]})]}),Ra(t)&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Members"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.free_member_signup_notification,direction:"rtl",hint:"Every time a new free member signs up",label:"New signups",onChange:x=>{a?.({...t,free_member_signup_notification:x.target.checked})}}),f&&n.jsxs(n.Fragment,{children:[n.jsx(Be,{align:"center",checked:t.paid_subscription_started_notification,direction:"rtl",hint:"Every time a member starts a new paid subscription",label:"New paid members",onChange:x=>{a?.({...t,paid_subscription_started_notification:x.target.checked})}}),n.jsx(Be,{align:"center",checked:t.paid_subscription_canceled_notification,direction:"rtl",hint:"Every time a member cancels their paid subscription",label:"Paid member cancellations",onChange:x=>{a?.({...t,paid_subscription_canceled_notification:x.target.checked})}})]})]})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium tracking-wide text-grey-700 uppercase",children:"Revenue"}),n.jsxs("div",{className:"mt-3 flex flex-col gap-4",children:[n.jsx(Be,{align:"center",checked:t.milestone_notifications,direction:"rtl",hint:f?"Occasional summaries of your audience & revenue growth":"Occasional summaries of your audience growth",label:"Milestones",onChange:x=>{a?.({...t,milestone_notifications:x.target.checked})}}),f&&n.jsx(Be,{align:"center",checked:t.donation_notifications,direction:"rtl",hint:"Every time you receive a one-time payment",label:"Tips & donations",onChange:x=>{a?.({...t,donation_notifications:x.target.checked})}}),f&&p&&n.jsx(Be,{align:"center",checked:t.gift_subscription_purchase_notification,direction:"rtl",hint:"Every time someone purchases or redeems a gift subscription",label:"Gift subscriptions",onChange:x=>{a?.({...t,gift_subscription_purchase_notification:x.target.checked})}})]})]})]})]})},Ak=({user:t,setUserData:a})=>n.jsx(Mu,{border:!1,children:n.jsx(Sk,{setUserData:a,user:t})}),Dk=["1234567890","qwertyuiop","qwertzuiop","asdfghjkl;","abcdefghij","0987654321","1q2w3e4r5t","12345asdfg"],$k=["ghost","password","passw0rd"],Ok=t=>{let a={},s,i=!0;s=t.length/2;for(let f=0;f<t.length;f+=1)a[t[f]]?a[t[f]]+=1:a[t[f]]=1;for(let f in a)if(a[f]>=s)return i=!1,i;return i},Rk=({user:t})=>{const{currentUser:a,config:s,siteData:i}=Ue(),[f,p]=S.useState(!1),[x,h]=S.useState(""),[b,g]=S.useState(""),[m,w]=S.useState(""),[v,y]=S.useState(""),[C,j]=S.useState({}),N=S.useRef(null),T=S.useRef(null),A=S.useRef(null),{mutateAsync:R}=Uv(),$=Ze(),L=t.id===a.id,P=({password:G,confirmPassword:te})=>{if(L&&!x)return{oldPassword:"Your current password is required to set a new one"};if(G!==te)return{newPassword:"Your new passwords do not match",confirmNewPassword:"Your new passwords do not match"};let fe=s.blogUrl||window.location.host,Me=i.title,K;if(fe=fe.replace(/^http(s?):\/\//,""),K=fe.match(/\/$/)?fe:`${fe}/`,Me=Me&&Me.trim().toLowerCase(),G.length<10)return{newPassword:"Password must be at least 10 characters long."};G=G.toString();for(const Q of Dk)if(Q===G)return{newPassword:"Sorry, you cannot use an insecure password."};if(G.toLowerCase()===t.email.toLowerCase())return{newPassword:"Sorry, you cannot use an insecure password."};for(const Q of $k)if(G.toLowerCase().indexOf(Q)>=0)return{newPassword:"Sorry, you cannot use an insecure password."};return G.toLowerCase()===Me?{newPassword:"Sorry, you cannot use an insecure password."}:G.toLowerCase()===fe||G.toLowerCase()===K?{newPassword:"Sorry, you cannot use an insecure password."}:Ok(G)?{}:{newPassword:"Sorry, you cannot use an insecure password."}};S.useEffect(()=>{v==="saved"&&setTimeout(()=>{y(""),p(!1)},2500)},[v]),S.useEffect(()=>{f&&setTimeout(()=>{L?A.current?.focus():N.current?.focus()},100)},[f,L]);const D=()=>{p(!0)};let q="Save password";v==="saving"?q="Saving...":v==="saved"&&(q="Saved");const Y=n.jsxs(n.Fragment,{children:[L&&n.jsx(_e,{"data-testid":"old-password",error:!!C.oldPassword,hint:C.oldPassword,inputRef:A,title:"Old password",type:"password",value:x,onChange:G=>{h(G.target.value)}}),n.jsx(_e,{"data-testid":"new-password",error:!!C.newPassword,hint:C.newPassword,inputRef:N,title:"New password",type:"password",value:b,onChange:G=>{g(G.target.value)}}),n.jsx(_e,{"data-testid":"confirm-password",error:!!C.confirmNewPassword,hint:C.confirmNewPassword,inputRef:T,title:"Confirm new password",type:"password",value:m,onChange:G=>{w(G.target.value)}}),n.jsxs("div",{className:"mt-1 flex items-center justify-end gap-3",children:[n.jsx(Ie,{color:"outline",label:"Cancel",onClick:()=>{p(!1),h(""),g(""),w(""),j({})}}),n.jsx(Ie,{color:"green","data-testid":"save-password-button",label:q,onClick:async()=>{y("saving");const G=P({password:b,confirmPassword:m});if(j(G),Object.keys(G).length>0){y("");return}try{await R({newPassword:b,confirmNewPassword:m,oldPassword:x,userId:t?.id}),y("saved")}catch(te){y(""),rt({type:"error",title:te instanceof Bv?te.message:"Couldn't update password. Please try again."}),$(te,{withToast:!1})}}})]})]}),z=n.jsxs("div",{className:"relative flex flex-col",children:[n.jsx(_e,{containerClassName:"grow",disabled:!0,title:"Password",type:"password",value:"••••••••••••"}),n.jsx(Ie,{className:"absolute top-0 right-0",color:"green","data-testid":"change-password-button",label:"Change",link:!0,onClick:D})]});return n.jsx(n.Fragment,{children:f?Y:z})},Lk=({user:t,setUserData:a})=>{const{data:{roles:s}={}}=nu(),{config:i}=Ue(),f=i.labs.superEditors;let p=[{hint:"Can write and edit their own posts, but cannot publish them.",label:"Contributor",value:"contributor"},{hint:"Can create, edit and publish their own posts, but can’t modify others.",label:"Author",value:"author"},{hint:"Can edit and publish any posts, and manage Authors and Contributors.",label:"Editor",value:"editor"},{hint:"Trusted user who has full access to all content, settings, and user management.",label:"Administrator",value:"administrator"}];if(f&&(p=p.map(x=>x.value==="editor"?{...x,label:"Editor (beta mode)",value:"super editor",hint:"Can invite and manage other Authors and Contributors, as well as edit and publish any posts on the site. Can manage members and moderate comments."}:x)),tu(t)){const x={label:"Owner",value:"owner"};return n.jsx("div",{children:n.jsx(jt,{disabled:!0,hint:n.jsxs(n.Fragment,{children:["This user is the owner of the site. ",n.jsx("a",{className:"font-medium text-grey-800 transition-colors hover:text-grey-900 dark:text-grey-500 dark:hover:text-grey-400",href:"https://ghost.org/help/transfer-publication-ownership/",rel:"noopener noreferrer",target:"_blank",children:"Transfer ownership"})," first to change their role."]}),options:[x],selectedOption:x,title:"Role",onSelect:()=>{}})})}return n.jsx(jt,{options:p,selectedOption:p.find(x=>x.value===t.roles[0].name.toLowerCase()),testId:"role-select",title:"Role",onSelect:x=>{if(x){const h=s?.find(b=>b.name.toLowerCase()===x.value.toLowerCase());h&&a?.({...t,roles:[h]})}}})},Fk="StaffTokenResponseType",Pk=Wv({dataType:Fk,path:"/users/me/token/"}),Hk=Gr({path:()=>"/users/me/token/",method:"PUT"}),zk=()=>{const{refetch:t}=Pk({enabled:!1}),a=Ze(),[s,i]=S.useState(""),{mutateAsync:f}=Hk();S.useEffect(()=>{(async()=>{const h=await t();h?.data?.apiKey&&i(`${h.data.apiKey.id}:${h.data.apiKey.secret}`)})()},[t]);const p=()=>{ge.show(xt,{title:"Regenerate your Staff Access Token",prompt:"You can regenerate your Staff Access Token any time, but any scripts or applications using it will need to be updated.",okLabel:"Regenerate your Staff Access Token",okColor:"red",onOk:async x=>{try{const h=await f([]);i(`${h.apiKey.id}:${h.apiKey.secret}`),x?.remove()}catch(h){a(h)}}})};return n.jsxs("div",{children:[n.jsx(lt,{className:"mb-2",level:6,grey:!0,children:"Staff access token"}),n.jsx(Ya,{hasLabel:!1,keys:[{text:s||"",onRegenerate:p}]})]})},Uk=({errors:t,clearError:a,user:s,setUserData:i})=>{const{currentUser:f,siteData:p}=Ue(),x=Pn(p);return n.jsxs(ku,{children:[n.jsx(_e,{error:!!t?.email,hint:t?.email||"Used for notifications",maxLength:191,title:"Email",value:s.email,onChange:h=>{i({...s,email:h.target.value})},onKeyDown:()=>a("email")}),n.jsx(Rk,{user:s}),Ra(f)&&n.jsx(Lk,{setUserData:i,user:s}),n.jsx(_e,{error:!!t?.name,hint:t?.name||"Use your real name so people can recognize you",maxLength:191,title:"Full name",value:s.name,onChange:h=>{i({...s,name:h.target.value})},onKeyDown:()=>a("name")}),n.jsx(_e,{hint:`${x}author/${s.slug}`,maxLength:191,title:"Slug",value:s.slug,onChange:h=>{i({...s,slug:h.target.value})}}),n.jsx(_e,{error:!!t?.location,hint:t?.location||"Where in the world do you live?",maxLength:65535,title:"Location",value:s.location||"",onChange:h=>{i({...s,location:h.target.value})},onKeyDown:()=>a("location")}),n.jsx(or,{error:!!t?.bio,hint:t?.bio||n.jsxs(n.Fragment,{children:["Recommended: 250 characters. You‘ve used ",n.jsx("span",{className:"font-bold",children:s.bio?.length||0})]}),maxLength:65535,title:"Bio",value:s.bio||"",onChange:h=>{i({...s,bio:h.target.value})},onKeyDown:()=>a("bio")}),s.id===f.id&&n.jsx(zk,{})]})},Bk=t=>n.jsx(Mu,{border:!1,children:n.jsx(Uk,{...t})}),Wk=({errors:t,clearError:a,validateField:s,user:i,setUserData:f})=>{const[p,x]=S.useState(()=>Object.fromEntries(su.map(h=>{const b=i[h.key];return[h.key,h.toDisplayValue(b)]})));return n.jsxs(ku,{children:[n.jsx(_e,{"data-testid":"website-input",error:!!t?.website,hint:t?.website,maxLength:2e3,placeholder:"https://example.com",title:"Website",value:i.website||"",onChange:h=>{f({...i,website:h.target.value})},onKeyDown:()=>a("website")}),su.map(h=>n.jsx(_e,{"data-testid":h.testId,error:!!t?.[h.key],hint:t?.[h.key],maxLength:2e3,placeholder:h.placeholder,title:h.staffTitle,value:p[h.key],onBlur:b=>{if(s(h.key,b.target.value)){const{displayValue:g,storedValue:m}=My(h.key,b.target.value);x(w=>({...w,[h.key]:g})),f({...i,[h.key]:m})}},onChange:b=>{x(g=>({...g,[h.key]:b.target.value}))},onKeyDown:()=>a(h.key)},h.key))]})},Yk=t=>n.jsx(Mu,{border:!1,children:n.jsx(Wk,{...t})}),ih={name:({name:t})=>{let a="";return t||(a="Name is required"),t&&t.length>191&&(a="Name is too long"),a},email:({email:t})=>Un.isEmail(t||"")?"":"Enter a valid email address",url:({url:t})=>!t||Un.isURL(t,{require_tld:!1})?"":"Enter a valid URL",bio:({bio:t})=>!t||t.length<=250?"":"Bio is too long",location:({location:t})=>!t||t.length<=150?"":"Location is too long",website:({website:t})=>!t||Un.isURL(t)&&t.length<=2e3?"":"Enter a valid URL",...Object.fromEntries(su.map(t=>[t.key,a=>jy(t.key,a[t.key])]))},qk=({user:t})=>{const{updateRoute:a,route:s}=He(),i=V=>{const ve=V.split("/").pop()||"";return ve==="social-links"||ve==="email-notifications"?ve:"profile"},{ownerUser:f}=ky(),{currentUser:p}=Ue(),x=Ze(),{formState:h,setFormState:b,saveState:g,handleSave:m,updateForm:w,errors:v,setErrors:y,clearError:C,okProps:j}=nn({initialState:t,savingDelay:500,savedDelay:500,onValidate:V=>Object.entries(ih).reduce((ve,[De,Qe])=>{const Dt=Qe(V);return Dt&&(ve[De]=Dt),ve},{}),onSave:async V=>{await $?.(V)},onSaveError:x}),N=V=>w(()=>V),T=(V,ve)=>{const De=ih[V]?.({[V]:ve});return De?(y({...v,[V]:De}),!1):(C(V),!0)},A=Lt(),{mutateAsync:R}=Ps(),{mutateAsync:$}=qv(),{mutateAsync:L}=Gv(),{mutateAsync:P}=Xv(),D=Ls(),q=wh(),Y=S.useCallback(()=>{wr(p)?a("staff"):a({isExternal:!0,route:""})},[p,a]),z=async V=>{if(V.status==="inactive"&&V.roles[0].name!=="Contributor")try{await D?.errorIfWouldGoOverLimit("staff")}catch(De){if(De instanceof Fs){ge.show(zn,{formSheet:!0,prompt:De.message||"Your current plan doesn't support more users.",onOk:()=>a({route:"/pro",isExternal:!0})});return}else throw De}let ve="This user will no longer be able to log in but their posts will be kept.";V.status==="inactive"&&(ve="This user will be able to log in again and will have the same permissions they had previously."),ge.show(xt,{title:"Are you sure you want to suspend this user?",prompt:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"WARNING:"})," ",ve]}),okLabel:V.status==="inactive"?"Un-suspend":"Suspend",okRunningLabel:V.status==="inactive"?"Un-suspending...":"Suspending...",okColor:"red",onOk:async De=>{const Qe={...V,status:V.status==="inactive"?"active":"inactive"};try{await $(Qe),b(()=>Qe),De?.remove(),rt({title:V.status==="inactive"?"User un-suspended":"User suspended",type:"success"})}catch(Dt){x(Dt)}}})},G=(V,{owner:ve})=>{ge.show(xt,{title:"Are you sure you want to delete this user?",prompt:n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"mb-3",children:[n.jsx("span",{className:"font-bold",children:V.name||V.email})," will be permanently deleted and all their posts will be automatically assigned to ",n.jsx("span",{className:"font-bold",children:ve.name}),"."]}),n.jsxs("p",{children:["To make these easy to find in the future, each post will be given an internal tag of ",n.jsxs("span",{className:"font-bold",children:["#",t.slug]})]})]}),okLabel:"Delete user",okColor:"red",onOk:async De=>{try{await L(V?.id),De?.remove(),A?.remove(),Y(),rt({title:"User deleted",type:"success"})}catch(Qe){x(Qe)}}})},te=()=>{ge.show(xt,{title:"Transfer Ownership",prompt:"Are you sure you want to transfer the ownership of this blog? You will not be able to undo this action.",okLabel:"Yep — I'm sure",okColor:"red",onOk:async V=>{try{await P(t.id),V?.remove(),rt({title:"Ownership transferred",type:"success"})}catch(ve){x(ve)}}})},fe=async(V,ve)=>{try{const De=rr(await R({file:ve}));switch(V){case"cover_image":w(Qe=>({...Qe,cover_image:De}));break;case"profile_image":w(Qe=>({...Qe,profile_image:De}));break}}catch(De){const Qe=De;Qe.response.status===415&&(Qe.message="Unsupported file type"),x(Qe)}},Me=V=>{switch(V){case"cover_image":w(ve=>({...ve,cover_image:""}));break;case"profile_image":w(ve=>({...ve,profile_image:""}));break}},K=Ra(p)||jf(p)&&Nf(t);let Q=[];if(tu(p)&&Kv(h)&&h.status!=="inactive"&&Q.push({id:"make-owner",label:"Make owner",onClick:te}),Q.push({id:"view-user-activity",label:"View user activity",onClick:()=>{A.remove(),a(`history/view/${h.id}`)}}),h.id!==p.id&&(Ra(p)&&!tu(t)||jf(p)&&Nf(t))){let V=h.status==="inactive"?"Un-suspend user":"Suspend user";Q.push({id:"suspend-user",label:V,onClick:()=>{z(h)}},{id:"delete-user",label:"Delete user",destructive:!0,onClick:()=>{G(t,{owner:f})}})}const Ne="rounded text-sm flex flex-nowrap items-center justify-center px-3 h-8 transition-all cursor-pointer font-medium border border-grey-300 bg-transparent text-black dark:border-grey-800 dark:text-white",ue="flex flex-nowrap items-center justify-center px-3 h-8 opacity-80 hover:opacity-100 bg-[rgba(0,0,0,0.75)] rounded text-sm text-white transition-all cursor-pointer font-medium nowrap",we=h.status==="inactive"?" (Suspended)":"",ee=i(s),[pe,le]=S.useState(ee),de=V=>{const ve=V==="profile"?"":`/${V}`;a(`staff/${t.slug}${ve}`),le(V)};return n.jsx(ct,{afterClose:Y,animate:wr(p),backDrop:wr(p),buttonsDisabled:j.disabled,cancelLabel:"Close",dirty:g==="unsaved",okColor:j.color,okLabel:j.label||"Save",size:wr(p)?"md":"bleed",stickyFooter:!0,testId:"user-detail-modal",width:wr(p)?600:"full",onOk:async()=>{await m({fakeWhenUnchanged:!0})},children:n.jsxs("div",{children:[n.jsx("div",{className:`relative ${wr(p)?"-mx-8 -mt-8 rounded-t":"-mx-10 -mt-10"}`,children:n.jsx("div",{className:`flex flex-wrap items-end justify-between gap-8 p-8 ${h.cover_image?"bg-cover bg-center":""} ${!wr(p)&&"min-h-[30vmin]"}`,style:{backgroundImage:h.cover_image?`url(${h.cover_image})`:"none"},children:n.jsxs("div",{className:"flex w-full flex-col gap-2",children:[n.jsxs("div",{className:"flex flex-nowrap items-start justify-between gap-3",children:[n.jsx("div",{children:n.jsx(ar,{deleteButtonClassName:"md:invisible absolute pr-3 -right-2 -top-2 flex h-8 w-10 cursor-pointer items-center justify-end rounded-full bg-[rgba(0,0,0,0.75)] text-white group-hover:visible!",deleteButtonContent:n.jsx(qe,{colorClass:"text-white",name:"trash",size:"sm"}),editButtonClassName:"md:invisible absolute right-[22px] -top-2 flex h-8 w-8 cursor-pointer items-center justify-center text-white group-hover:visible! z-20",fileUploadClassName:"rounded-full bg-black flex items-center justify-center opacity-80 transition hover:opacity-100 -ml-2 cursor-pointer h-[80px] w-[80px]",fileUploadProps:{dragIndicatorClassName:"rounded-full"},id:"avatar",imageClassName:"w-full h-full object-cover rounded-full shrink-0",imageContainerClassName:"relative group bg-cover bg-center -ml-1 h-16 w-16 md:h-18 md:w-18 shrink-0",imageURL:h.profile_image??void 0,pintura:{isEnabled:q.isEnabled,openEditor:async()=>q.openEditor({image:h.profile_image||"",handleSave:async V=>{fe("profile_image",V)}})},unstyled:!0,width:"80px",onDelete:()=>{Me("profile_image")},onUpload:V=>{fe("profile_image",V)},children:n.jsx(qe,{colorClass:"black",name:"user-add",size:"lg"})})}),n.jsxs("div",{className:"flex flex-nowrap items-start gap-3",children:[n.jsx(ar,{buttonContainerClassName:"flex items-end gap-4 justify-end flex-nowrap",deleteButtonClassName:ue,deleteButtonContent:"Delete cover image",editButtonClassName:ue,fileUploadClassName:Ne,id:"cover-image",imageClassName:"hidden",imageURL:h.cover_image||"",pintura:{isEnabled:q.isEnabled,openEditor:async()=>q.openEditor({image:h.cover_image||"",handleSave:async V=>{fe("cover_image",V)}})},unstyled:!0,onDelete:()=>{Me("cover_image")},onUpload:V=>{fe("cover_image",V)},children:"Upload cover image"}),K&&n.jsx("div",{className:"z-10",children:n.jsx(Vh,{items:Q,position:"end",trigger:n.jsxs("button",{className:me("flex h-8 cursor-pointer items-center justify-center rounded px-3",h.cover_image?"bg-[rgba(0,0,0,0.75)] opacity-80 hover:opacity-100":"border border-grey-300 bg-transparent text-black dark:border-grey-800 dark:text-white"),type:"button",children:[n.jsx("span",{className:"sr-only",children:"Actions"}),n.jsx(qe,{colorClass:h.cover_image?"text-white":void 0,name:"ellipsis",size:"md"})]})})})]})]}),n.jsxs("div",{children:[n.jsxs(lt,{level:3,styles:me("break-words md:break-normal",h.cover_image?"text-white":"text-black dark:text-white"),children:[t.name,we]}),n.jsx("span",{className:me("text-md font-medium capitalize",h.cover_image?"text-white":"text-black dark:text-white"),children:t.roles[0].name.toLowerCase()})]})]})})}),n.jsx("div",{className:`${!wr(p)&&"mx-auto max-w-[536px]"} mt-6 flex flex-col`,children:n.jsx(kr,{selectedTab:pe,tabs:[{id:"profile",title:"Profile",contents:n.jsx(Bk,{clearError:C,errors:v,setUserData:N,user:h,validateField:T})},{id:"social-links",title:"Social Links",contents:n.jsx(Yk,{clearError:C,errors:v,setUserData:N,user:h,validateField:T})},{id:"email-notifications",title:"Email Notifications",contents:n.jsx(Ak,{setUserData:N,user:h})}],onTabChange:de})})]})})},Gk=({params:t})=>{const{currentUser:a}=Ue(),s=a.slug===t?.slug,{data:i}=Yv(t?.slug||"",{enabled:!s&&!!t?.slug}),f=s?a:i?.users?.[0];return f?n.jsx(qk,{user:f}):null},Xk=ge.create(Gk),pj={AddIntegrationModal:kM,AddNewsletterModal:NM,ContentApiModal:TM,AddRecommendationModal:hm,CustomIntegrationModal:qM,DesignAndThemeModal:K8,EditRecommendationModal:Ny,FirstPromoterModal:J8,HistoryModal:d2,InviteUserModal:f2,NavigationModal:p2,NewsletterDetailModal:k2,PinturaModal:J2,PortalModal:dk,SlackModal:fk,StripeConnectModal:Mk,TestimonialsModal:Tk,TierDetailModal:dM,TransistorModal:Ck,UnsplashModal:Ik,UserDetailModal:Xk,ZapierModal:lM,AnnouncementBarModal:LM,EmbedSignupFormModal:Q8,OffersContainerModal:Z2,AboutModal:_M,OfferSuccess:wm};export{pj as default};
|