ghost 6.17.1 → 6.17.2
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-6.17.2.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.17.1.tgz → tryghost-parse-email-address-6.17.2.tgz} +0 -0
- package/content/themes/source/package.json +1 -1
- package/core/built/admin/assets/{PolarAngleAxis-DVj7Sw2n.js → PolarAngleAxis-B8JrAxf_.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-CrCkbXur.js → _baseAssignValue-Bbalamaq.js} +1 -1
- package/core/built/admin/assets/{a-large-small-BLquRSNr.js → a-large-small-CgWPeKpi.js} +1 -1
- package/core/built/admin/assets/{at-sign-Cj4_ORaa.js → at-sign-BottTo2X.js} +1 -1
- package/core/built/admin/assets/{audience-ACTBvUSt.js → audience-CcGOt5Fb.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-BeKL4BEF.js → avatar-flipboard-MxW2k124.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-CP7ej5rz.js → bluesky-sharing-BBmDBlxr.js} +1 -1
- package/core/built/admin/assets/{chart-B6jk72FT.js → chart-pimL5Chk.js} +1 -1
- package/core/built/admin/assets/{chunk.524.6c12997c856012ea06f5.js → chunk.524.9a8f5123fd3ecf3e4451.js} +6 -6
- package/core/built/admin/assets/{chunk.582.a0abd5b93eb1bc50335a.js → chunk.582.41886d06af2895d571bd.js} +7 -7
- package/core/built/admin/assets/{code-editor-view-CVRtsOBM.js → code-editor-view-tCZOpc_h.js} +1 -1
- package/core/built/admin/assets/{comments-CxjhZH_T.js → comments-OXqhcC0t.js} +1 -1
- package/core/built/admin/assets/{copy-YhtJexiS.js → copy-aC0WUVtq.js} +1 -1
- package/core/built/admin/assets/{data-list-BPSXm3ej.js → data-list-BOdyZGWI.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-D8BHDEHh.js → deleted-feed-item-BnUJ8bWP.js} +1 -1
- package/core/built/admin/assets/{edit-profile-FrkkXMG7.js → edit-profile-CEgPhWMJ.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-SsCyCd50.js → empty-indicator-CR_9BHAH.js} +1 -1
- package/core/built/admin/assets/{en-ZWZBSdFY.js → en-ajofhc7o.js} +1 -1
- package/core/built/admin/assets/{feed-BvVJCTy8.js → feed-Ci-ODCHE.js} +1 -1
- package/core/built/admin/assets/{filters-BupJ4mUj.js → filters-CmJJOv3I.js} +1 -1
- package/core/built/admin/assets/{gh-chart-Dp9VXeON.js → gh-chart-hn7wEnik.js} +1 -1
- package/core/built/admin/assets/{growth-CRDHOGrZ.js → growth-CQceZQ1g.js} +1 -1
- package/core/built/admin/assets/{hash-CPAX2PwN.js → hash-BcaWmkw5.js} +1 -1
- package/core/built/admin/assets/{inbox-DuT2edmx.js → inbox-D9hID-rO.js} +1 -1
- package/core/built/admin/assets/{index-bl5YmBtG.js → index-B1rKIiOr.js} +1 -1
- package/core/built/admin/assets/{index-B2oDZJ9B.js → index-BJS8H75W.js} +1 -1
- package/core/built/admin/assets/{index-BPYePamp.js → index-BmK6ThYl.js} +1 -1
- package/core/built/admin/assets/{index-BX3kQzlo.js → index-CZ3lARQ2.js} +1 -1
- package/core/built/admin/assets/{index-8ECl7z0l.js → index-Cl2eSBwg.js} +1 -1
- package/core/built/admin/assets/{index-BwUQiVrX.js → index-D8syEvSm.js} +1 -1
- package/core/built/admin/assets/{index-Dk-Wh_Fw.js → index-DJDgMk-T.js} +1 -1
- package/core/built/admin/assets/{index-DnY4rls4.js → index-DO76vL0R.js} +1 -1
- package/core/built/admin/assets/{index-CjzFwwKZ.js → index-DYM1MbXR.js} +1 -1
- package/core/built/admin/assets/{index-B1rQYn0h.js → index-Do091GLu.js} +1 -1
- package/core/built/admin/assets/{index-CQP2hNBo.js → index-d_UH71zm.js} +1 -1
- package/core/built/admin/assets/{index-exFCQBCk.js → index-f5Lv9kLb.js} +9 -9
- package/core/built/admin/assets/{index--Nwo3958.js → index-g4BWcHhl.js} +1 -1
- package/core/built/admin/assets/{index-ByYZ5TiM.js → index-kXF42nga.js} +1 -1
- package/core/built/admin/assets/{index-CeFAaI2v.js → index-rluYcfd-.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-eRS1y7PS.js → koenig-lexical-D2XHvS2J.js} +1 -1
- package/core/built/admin/assets/{kpi-card-DShFKtte.js → kpi-card-Dga9rFZ5.js} +1 -1
- package/core/built/admin/assets/{kpis-Bxyr_zYY.js → kpis-BbnqD1za.js} +1 -1
- package/core/built/admin/assets/{label-hgdYQhmm.js → label-D8WHEOe0.js} +1 -1
- package/core/built/admin/assets/{links-5NNDFN65.js → links-dgwx7ko1.js} +1 -1
- package/core/built/admin/assets/{lucide-react-f58FO8MB.js → lucide-react-BARFK2PZ.js} +1 -1
- package/core/built/admin/assets/{main-layout-BDz_2UZs.js → main-layout-CcjtCuF_.js} +1 -1
- package/core/built/admin/assets/{message-square-text-6dTKbQKA.js → message-square-text-BxquqPhA.js} +1 -1
- package/core/built/admin/assets/{minus-D2C19Fiu.js → minus-Ziy4LSYD.js} +1 -1
- package/core/built/admin/assets/{modals-DzetQgXf.js → modals-fMQzR7L6.js} +1 -1
- package/core/built/admin/assets/{moderation-87QsKbyf.js → moderation-Ci9UNwiZ.js} +1 -1
- package/core/built/admin/assets/{newsletter-BhI9Lgkn.js → newsletter-DnrS7Fvi.js} +1 -1
- package/core/built/admin/assets/{newsletters-adLgF_Re.js → newsletters-D78pgnas.js} +1 -1
- package/core/built/admin/assets/{note-BbPR57Yw.js → note-BAfNweZN.js} +1 -1
- package/core/built/admin/assets/{overview-CqyRlIVM.js → overview-CWQPNOF0.js} +1 -1
- package/core/built/admin/assets/{pagemenu-DlQF5jN4.js → pagemenu-DjSqq3Wu.js} +1 -1
- package/core/built/admin/assets/{post-analytics-BudH7GCA.js → post-analytics-c8kRV0YB.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-CxuzZluw.js → post-analytics-context-CEqWyqgm.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-BV_8onIF.js → post-analytics-header-CpPPBAz4.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-CnM21JFK.js → post-share-modal-Dln0kZhn.js} +1 -1
- package/core/built/admin/assets/{posts-C5zAbpdG.js → posts-C1Eh5Ypq.js} +1 -1
- package/core/built/admin/assets/{repeat-BbSnXois.js → repeat-CN4fiG5H.js} +1 -1
- package/core/built/admin/assets/{reply-CuCJJfZj.js → reply-BfWgvH7y.js} +1 -1
- package/core/built/admin/assets/{select-Bv-dkHeU.js → select-B_0NBkLz.js} +1 -1
- package/core/built/admin/assets/{settings-Cit2-dRQ.js → settings-BqaVcJee.js} +4 -4
- package/core/built/admin/assets/{settings-wlK_oNsg.js → settings-Dk9E7Fqv.js} +1 -1
- package/core/built/admin/assets/{sort-button-Dmyldyzm.js → sort-button-C2M35dLh.js} +1 -1
- package/core/built/admin/assets/{source-icon-DjyV6RS6.js → source-icon-DkGi13e_.js} +1 -1
- package/core/built/admin/assets/{sprout-jOQR37se.js → sprout-BKiwQsGn.js} +1 -1
- package/core/built/admin/assets/{square-IrYxuAJL.js → square-BEpRc_fY.js} +1 -1
- package/core/built/admin/assets/{stats-C4LbW8IV.js → stats-CRgy_cWm.js} +1 -1
- package/core/built/admin/assets/{stats-view-BwaLDryw.js → stats-view-CTQ4qO3S.js} +1 -1
- package/core/built/admin/assets/{step-1-C0QApeYD.js → step-1-CNbdmB8C.js} +1 -1
- package/core/built/admin/assets/{step-2-h0b6Njyb.js → step-2-Ddrl2uae.js} +1 -1
- package/core/built/admin/assets/{step-3-CaM-Hz3F.js → step-3-CbqkEtwh.js} +1 -1
- package/core/built/admin/assets/{table-P4FGxGxN.js → table-Dw9xFlFd.js} +1 -1
- package/core/built/admin/assets/{tabs-Cj65mCsJ.js → tabs-DCHagOip.js} +1 -1
- package/core/built/admin/assets/{tags-CDvEkvxr.js → tags-BsDlfsPN.js} +1 -1
- package/core/built/admin/assets/{tags-Dnv6zTag.js → tags-DV2SSdMK.js} +1 -1
- package/core/built/admin/assets/{tiers-Y3OCOT03.js → tiers-tc5tafWV.js} +1 -1
- package/core/built/admin/assets/{toggle-group-kZZo_vdJ.js → toggle-group-DS-ZVhCr.js} +1 -1
- package/core/built/admin/assets/{topic-filter-Cn1_Z9I7.js → topic-filter-BfoEqHRD.js} +1 -1
- package/core/built/admin/assets/{trash-ln90Rlgi.js → trash-CpnxYen-.js} +1 -1
- package/core/built/admin/assets/{url-helpers-B5_oMSPb.js → url-helpers-wKPPeCtD.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-DQsJauHH.js → use-growth-stats-CbHIETF_.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-4OIpSNMH.js → use-infinite-virtual-scroll-DU1EUhyj.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-BedA-MMT.js → use-simple-pagination-X6kmRz2u.js} +1 -1
- package/core/built/admin/assets/{user-round-check-CYI147XP.js → user-round-check-DYkrjHxF.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-xpilOd6G.js → wallet-cards-CSdWOmJE.js} +1 -1
- package/core/built/admin/assets/{web-VPMnLvnh.js → web-C39IKnvl.js} +1 -1
- package/core/built/admin/index.html +2 -2
- package/core/server/services/email-address/email-address-service-wrapper.js +3 -0
- package/core/server/services/email-address/email-address-service.js +11 -0
- package/core/server/services/email-address/email-address-service.ts +13 -0
- package/core/server/services/members/api.js +3 -1
- package/core/server/services/members/members-api/controllers/router-controller.js +5 -2
- package/core/server/services/members/members-api/members-api.js +4 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/components/tryghost-i18n-6.17.1.tgz +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s,r as D,aH as we,e as at,d7 as i_,av as $g,aq as l_,ar as c_,as as Lg,aw as u_,au as Vi,aE as Kf,ax as f_,ay as Sf,az as d_,aF as p_,aG as h_,d8 as ut,ad as ns,bM as ot,d9 as no,da as Rn,db as gt,dc as xt,cF as Pg,cW as Fg,dd as Ug,de as ah,df as m_,dg as ln,dh as g_,di as ts,aB as x_,dj as b_,d6 as Zf,d5 as Hs,dk as Ha,ak as v_,aN as w_,dl as y_,dm as Qi,dn as Vf,dp as oh,dq as dr,dr as Za,ds as Nf,dt as __,du as Ws,dv as k_,dw as M_,dx as j_,dy as Hi,dz as E_,dA as T_,dB as Af,ac as S_,dC as N_,dD as A_,dE as I_,dF as C_,dG as Nn,dH as ih,dI as lh,dJ as D_}from"./index-exFCQBCk.js";import{H as bt,a as Gr,S as Va,B as Ue,x as Ji,K as R_,y as Zt,z as O_,A as Lt,M as yt,C as an,F as $_,G as Dn,J as zg,O as L_,Q as el,U as ye,V as Qe,W as P_,X as Qf,Y as Je,Z as cn,_ as On,$ as Et,a0 as Nt,a1 as ss,a2 as kr,a3 as F_,a4 as ch,a5 as tt,a6 as Ae,a7 as uh,a8 as fh,a9 as st,aa as Hg,ab as Bg,ac as U_,ad as z_,ae as H_,af as B_,ag as Ys,ah as Gs,ai as Xr,aj as $n,ak as Wg,al as W_,am as q_,an as Y_,ao as G_,ap as X_,aq as Bi,ar as Wi,as as K_,at as dh,au as ph,av as Z_,aw as Xs,ax as un,ay as on,az as qg,aA as V_,aB as Q_,aC as J_,aD as Yg,aE as Jf,aF as e2,aG as t2,aH as r2,aI as qi,aJ as ed,aK as n2,aL as td,aM as s2,aN as a2,aO as Gg,aP as Xg,aQ as rd,aR as o2,aS as i2,aT as l2,aU as Kg,aV as Zg,aW as c2,aX as u2,aY as hh,aZ as Vg,a_ as Qg,a$ as Jg,b0 as If,b1 as f2,b2 as d2,b3 as p2,b4 as e0,b5 as h2,b6 as m2,b7 as g2,b8 as t0,b9 as x2,ba as b2,bb as v2,bc as r0,bd as nd,be as w2,bf as sd,bg as y2,bh as _2,bi as n0,bj as k2,bk as s0,bl as M2,bm as j2,bn as E2}from"./settings-Cit2-dRQ.js";import{a as T2,u as a0,b as o0}from"./newsletters-adLgF_Re.js";import{C as S2,a as N2}from"./index--Nwo3958.js";import{u as i0}from"./posts-C5zAbpdG.js";import{a as so,b as ad,c as A2,g as od}from"./tiers-Y3OCOT03.js";import"./index-DnY4rls4.js";function I2(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const l0=({children:e,...n})=>s.jsx("div",{className:"flex h-full w-full flex-col px-8",...n,children:s.jsx("div",{className:"h-full w-full overflow-hidden rounded-t-[4px] shadow-sm",children:e})}),c0=({children:e,...n})=>s.jsx("div",{className:"flex h-[775px] w-[380px] flex-col rounded-3xl bg-white p-2 shadow-xl dark:bg-grey-900",...n,children:s.jsx("div",{className:"w-100 h-100 grow overflow-auto rounded-2xl border border-grey-100 dark:border-grey-950",children:e})}),C2=({title:e,label:n,value:a,onChange:o,disabled:c,error:m,hint:y,checked:h,separator:l,testId:f})=>{const u=D.useId(),p=x=>{o(x===!0)};return s.jsxs("div",{children:[s.jsxs("div",{className:`flex flex-col gap-1 ${l&&"pb-2"}`,children:[e&&s.jsx(bt,{grey:!0,level:6,children:e}),s.jsxs("label",{className:`flex cursor-pointer items-start ${e&&"-mb-1 mt-1"}`,htmlFor:u,children:[s.jsx(S2,{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-none data-[state=checked]:border-black data-[state=indeterminate]:border-black data-[state=checked]:bg-black data-[state=indeterminate]:bg-black","data-testid":f,defaultChecked:h,disabled:c,id:u,value:a,onCheckedChange:p,children:s.jsx(N2,{children:s.jsx("svg",{fill:"none",height:"11",viewBox:"0 0 10 11",width:"10",children:s.jsx("path",{d:"M1 5.88889L4.6 9L9 1",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})})}),s.jsxs("div",{className:`ml-2 flex flex-col ${y&&"mb-2"}`,children:[s.jsx("span",{className:`inline-block text-[1.425rem] dark:text-white ${y&&"-mb-1"}`,children:n}),y&&s.jsx(Gr,{color:m?"red":"",children:y})]})]})]}),(l||m)&&s.jsx(Va,{className:m?"border-red":""})]})},Cf=({title:e,checkboxes:n,hint:a,error:o})=>s.jsxs("div",{children:[e&&s.jsx(bt,{grey:!0,level:6,children:e}),s.jsx("div",{className:"mt-2 flex flex-col gap-1",children:n?.map(({key:c,...m})=>s.jsx(C2,{...m},c))}),s.jsx("div",{className:`flex flex-col ${a&&"mb-2"}`,children:a&&s.jsx(Gr,{color:o?"red":"",children:a})})]}),D2=({hex:e,value:n,title:a,size:o="md",isSelected:c,onSelect:m})=>{const y=D.useRef(null),h=u=>{u.preventDefault(),m(n!==void 0?n:e)},l=e.length===4&&e[3]==="0"||e.length===8&&e.slice(6)==="00";let f="h-5 w-5";switch(o){case"lg":f="w-6 h-6";break}return s.jsx("button",{ref:y,className:we("relative flex shrink-0 cursor-pointer items-center rounded-full border border-grey-300 dark:border-grey-800",f,c&&"outline outline-2 outline-green"),style:{backgroundColor:e},title:a,type:"button",onClick:h,children:l&&s.jsx("div",{className:"absolute left-0 top-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})},u0=({title:e,value:n,swatches:a,swatchSize:o="md",onSwatchChange:c,onTogglePicker:m,isExpanded:y,picker:h=!0,containerClassName:l})=>{const f=a.find(p=>p.value===n||p.hex===n);l=we("flex flex-col gap-3");const u=y||!h;return s.jsxs("div",{className:l,children:[e&&s.jsx(bt,{useLabelTag:!0,children:e}),s.jsxs("div",{className:"flex gap-1",children:[u&&s.jsx("div",{className:"flex items-center gap-1",children:a.map(({customContent:p,...x})=>p?s.jsx(D.Fragment,{children:p},x.title):s.jsx(D2,{isSelected:f?.title===x.title,size:o,onSelect:c,...x},x.title))}),h&&s.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:m,children:[s.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%))]"}),f&&s.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:f.hex},children:f.hex==="transparent"&&s.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})}),!f&&n&&s.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:n},children:n==="transparent"&&s.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})]})]})]})};function Ks(){return(Ks=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e}).apply(this,arguments)}function tl(e,n){if(e==null)return{};var a,o,c={},m=Object.keys(e);for(o=0;o<m.length;o++)n.indexOf(a=m[o])>=0||(c[a]=e[a]);return c}function Qa(e){var n=D.useRef(e),a=D.useRef(function(o){n.current&&n.current(o)});return n.current=e,a.current}var Ja=function(e,n,a){return n===void 0&&(n=0),a===void 0&&(a=1),e>a?a:e<n?n:e},Xa=function(e){return"touches"in e},Df=function(e){return e&&e.ownerDocument.defaultView||self},mh=function(e,n,a){var o=e.getBoundingClientRect(),c=Xa(n)?(function(m,y){for(var h=0;h<m.length;h++)if(m[h].identifier===y)return m[h];return m[0]})(n.touches,a):n;return{left:Ja((c.pageX-(o.left+Df(e).pageXOffset))/o.width),top:Ja((c.pageY-(o.top+Df(e).pageYOffset))/o.height)}},gh=function(e){!Xa(e)&&e.preventDefault()},f0=at.memo(function(e){var n=e.onMove,a=e.onKey,o=tl(e,["onMove","onKey"]),c=D.useRef(null),m=Qa(n),y=Qa(a),h=D.useRef(null),l=D.useRef(!1),f=D.useMemo(function(){var v=function(M){gh(M),(Xa(M)?M.touches.length>0:M.buttons>0)&&c.current?m(mh(c.current,M,h.current)):k(!1)},_=function(){return k(!1)};function k(M){var T=l.current,A=Df(c.current),C=M?A.addEventListener:A.removeEventListener;C(T?"touchmove":"mousemove",v),C(T?"touchend":"mouseup",_)}return[function(M){var T=M.nativeEvent,A=c.current;if(A&&(gh(T),!(function(O,$){return $&&!Xa(O)})(T,l.current)&&A)){if(Xa(T)){l.current=!0;var C=T.changedTouches||[];C.length&&(h.current=C[0].identifier)}A.focus(),m(mh(A,T,h.current)),k(!0)}},function(M){var T=M.which||M.keyCode;T<37||T>40||(M.preventDefault(),y({left:T===39?.05:T===37?-.05:0,top:T===40?.05:T===38?-.05:0}))},k]},[y,m]),u=f[0],p=f[1],x=f[2];return D.useEffect(function(){return x},[x]),at.createElement("div",Ks({},o,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:c,onKeyDown:p,tabIndex:0,role:"slider"}))}),id=function(e){return e.filter(Boolean).join(" ")},d0=function(e){var n=e.color,a=e.left,o=e.top,c=o===void 0?.5:o,m=id(["react-colorful__pointer",e.className]);return at.createElement("div",{className:m,style:{top:100*c+"%",left:100*a+"%"}},at.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:n}}))},Yt=function(e,n,a){return n===void 0&&(n=0),a===void 0&&(a=Math.pow(10,n)),Math.round(a*e)/a},R2=function(e){return F2(Rf(e))},Rf=function(e){return e[0]==="#"&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Yt(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?Yt(parseInt(e.substring(6,8),16)/255,2):1}},O2=function(e){return P2(L2(e))},$2=function(e){var n=e.s,a=e.v,o=e.a,c=(200-n)*a/100;return{h:Yt(e.h),s:Yt(c>0&&c<200?n*a/100/(c<=100?c:200-c)*100:0),l:Yt(c/2),a:Yt(o,2)}},Of=function(e){var n=$2(e);return"hsl("+n.h+", "+n.s+"%, "+n.l+"%)"},L2=function(e){var n=e.h,a=e.s,o=e.v,c=e.a;n=n/360*6,a/=100,o/=100;var m=Math.floor(n),y=o*(1-a),h=o*(1-(n-m)*a),l=o*(1-(1-n+m)*a),f=m%6;return{r:Yt(255*[o,h,y,y,l,o][f]),g:Yt(255*[l,o,o,h,y,y][f]),b:Yt(255*[y,y,l,o,o,h][f]),a:Yt(c,2)}},Di=function(e){var n=e.toString(16);return n.length<2?"0"+n:n},P2=function(e){var n=e.r,a=e.g,o=e.b,c=e.a,m=c<1?Di(Yt(255*c)):"";return"#"+Di(n)+Di(a)+Di(o)+m},F2=function(e){var n=e.r,a=e.g,o=e.b,c=e.a,m=Math.max(n,a,o),y=m-Math.min(n,a,o),h=y?m===n?(a-o)/y:m===a?2+(o-n)/y:4+(n-a)/y:0;return{h:Yt(60*(h<0?h+6:h)),s:Yt(m?y/m*100:0),v:Yt(m/255*100),a:c}},U2=at.memo(function(e){var n=e.hue,a=e.onChange,o=id(["react-colorful__hue",e.className]);return at.createElement("div",{className:o},at.createElement(f0,{onMove:function(c){a({h:360*c.left})},onKey:function(c){a({h:Ja(n+360*c.left,0,360)})},"aria-label":"Hue","aria-valuenow":Yt(n),"aria-valuemax":"360","aria-valuemin":"0"},at.createElement(d0,{className:"react-colorful__hue-pointer",left:n/360,color:Of({h:n,s:100,v:100,a:1})})))}),z2=at.memo(function(e){var n=e.hsva,a=e.onChange,o={backgroundColor:Of({h:n.h,s:100,v:100,a:1})};return at.createElement("div",{className:"react-colorful__saturation",style:o},at.createElement(f0,{onMove:function(c){a({s:100*c.left,v:100-100*c.top})},onKey:function(c){a({s:Ja(n.s+100*c.left,0,100),v:Ja(n.v-100*c.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Yt(n.s)+"%, Brightness "+Yt(n.v)+"%"},at.createElement(d0,{className:"react-colorful__saturation-pointer",top:1-n.v/100,left:n.s/100,color:Of(n)})))}),p0=function(e,n){if(e===n)return!0;for(var a in e)if(e[a]!==n[a])return!1;return!0},H2=function(e,n){return e.toLowerCase()===n.toLowerCase()||p0(Rf(e),Rf(n))};function B2(e,n,a){var o=Qa(a),c=D.useState(function(){return e.toHsva(n)}),m=c[0],y=c[1],h=D.useRef({color:n,hsva:m});D.useEffect(function(){if(!e.equal(n,h.current.color)){var f=e.toHsva(n);h.current={hsva:f,color:n},y(f)}},[n,e]),D.useEffect(function(){var f;p0(m,h.current.hsva)||e.equal(f=e.fromHsva(m),h.current.color)||(h.current={hsva:m,color:f},o(f))},[m,e,o]);var l=D.useCallback(function(f){y(function(u){return Object.assign({},u,f)})},[]);return[m,l]}var W2=typeof window<"u"?D.useLayoutEffect:D.useEffect,q2=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},xh=new Map,Y2=function(e){W2(function(){var n=e.current?e.current.ownerDocument:document;if(n!==void 0&&!xh.has(n)){var a=n.createElement("style");a.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}`,xh.set(n,a);var o=q2();o&&a.setAttribute("nonce",o),n.head.appendChild(a)}},[])},G2=function(e){var n=e.className,a=e.colorModel,o=e.color,c=o===void 0?a.defaultColor:o,m=e.onChange,y=tl(e,["className","colorModel","color","onChange"]),h=D.useRef(null);Y2(h);var l=B2(a,c,m),f=l[0],u=l[1],p=id(["react-colorful",n]);return at.createElement("div",Ks({},y,{ref:h,className:p}),at.createElement(z2,{hsva:f,onChange:u}),at.createElement(U2,{hue:f.h,onChange:u,className:"react-colorful__last-control"}))},X2={defaultColor:"000",toHsva:R2,fromHsva:function(e){return O2({h:e.h,s:e.s,v:e.v,a:1})},equal:H2},K2=function(e){return at.createElement(G2,Ks({},e,{colorModel:X2}))},Z2=/^#?([0-9A-F]{3,8})$/i,V2=function(e){var n=e.color,a=n===void 0?"":n,o=e.onChange,c=e.onBlur,m=e.escape,y=e.validate,h=e.format,l=e.process,f=tl(e,["color","onChange","onBlur","escape","validate","format","process"]),u=D.useState(function(){return m(a)}),p=u[0],x=u[1],v=Qa(o),_=Qa(c),k=D.useCallback(function(T){var A=m(T.target.value);x(A),y(A)&&v(l?l(A):A)},[m,l,y,v]),M=D.useCallback(function(T){y(T.target.value)||x(m(a)),_(T)},[a,m,y,_]);return D.useEffect(function(){x(m(a))},[a,m]),at.createElement("input",Ks({},f,{value:h?h(p):p,spellCheck:"false",onChange:k,onBlur:M}))},bh=function(e){return"#"+e},Q2=function(e){var n=e.prefixed,a=e.alpha,o=tl(e,["prefixed","alpha"]),c=D.useCallback(function(y){return y.replace(/([^0-9A-F]+)/gi,"").substring(0,a?8:6)},[a]),m=D.useCallback(function(y){return(function(h,l){var f=Z2.exec(h),u=f?f[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(y,a)},[a]);return at.createElement(V2,Ks({},o,{escape:c,format:n?bh:void 0,process:bh,validate:m}))};const J2=({hexValue:e,eyedropper:n,clearButtonValue:a,containerClassName:o,onChange:c})=>{const m=D.useRef(null),y=D.useCallback(x=>{var v,_,k;x.stopPropagation();const M=(v=m.current)==null?void 0:v.querySelector("input");x.target!==M&&((k=(_=m.current)==null?void 0:_.querySelector("input"))==null||k.focus(),x.preventDefault())},[]),h=D.useRef(!1),l=D.useCallback(()=>{var x,v;h.current=!1,(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus(),document.removeEventListener("mouseup",l),document.removeEventListener("touchend",l)},[]),f=D.useCallback(()=>{h.current=!0,document.addEventListener("mouseup",l),document.addEventListener("touchend",l)},[l]),u=D.useCallback(x=>{if(x.preventDefault(),!window.EyeDropper)return;h.current=!0,document.body.style.setProperty("pointer-events","none"),new window.EyeDropper().open().then(_=>c?.(_.sRGBHex)).finally(()=>{var _,k;h.current=!1,document.body.style.removeProperty("pointer-events"),(k=(_=m.current)==null?void 0:_.querySelector("input"))==null||k.focus()})},[c]);D.useEffect(()=>{var x,v;(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus()},[]);const p=D.useCallback(()=>{var x,v;(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus()},[]);return o=we("mt-2",o),s.jsxs("div",{className:o,onMouseDown:y,onTouchStart:y,children:[s.jsx(K2,{className:"w-full",color:e||"#ffffff",onChange:c,onMouseDown:f,onTouchStart:f}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsxs("div",{ref:m,className:"peer relative order-2 flex h-10 w-full items-center",onClick:p,children:[s.jsx("span",{className:"absolute left-2 top-[9px] z-10 ml-1 mr-2 text-grey-700",children:"#"}),s.jsx(Q2,{"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:e,onChange:c}),n&&!!window.EyeDropper&&s.jsx("button",{className:"absolute inset-y-0 right-3 z-50 my-auto h-4 w-4 p-[1px]",type:"button",onClick:u,children:s.jsx(i_,{className:"h-full w-full"})})]}),a!==void 0&&s.jsx(Ue,{color:"grey",value:"Clear",onClick:()=>c?.(a)})]})]})},e3=D.createContext({colorPickers:[]}),vh=e=>e.length===4?e.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3"):e,Yr=({testId:e,title:n,direction:a,value:o,hint:c,error:m,eyedropper:y,clearButtonValue:h,onChange:l,swatches:f=[],alwaysOpen:u=!1,debounceMs:p})=>{const[x,v]=D.useState(!1),[_,k]=D.useState(o),M=D.useContext(e3),T=D.useId();D.useEffect(()=>{k(W=>vh(W||"")===o?W:o)},[o]),D.useEffect(()=>(M.colorPickers.push({id:T,setExpanded:v}),()=>{M.colorPickers=M.colorPickers.filter(W=>W.id!==T)}),[M,T]),D.useEffect(()=>{if(x){M.colorPickers.filter(R=>R.id!==T).forEach(R=>R.setExpanded(!1));const W=()=>{v(!1)};return document.addEventListener("click",W),()=>{document.removeEventListener("click",W)}}},[M,T,x]);const A=D.useMemo(()=>l&&p?Ji(l,p):l,[p,l]),C=W=>{k(W),A?.(W?vh(W):null)};let O=s.jsx(u0,{isExpanded:x,swatches:f,value:_,onSwatchChange:W=>{C(W),v(!1)},onTogglePicker:()=>!u&&v(!x)});n&&(O=s.jsxs("div",{className:we("flex w-full cursor-pointer items-start first:mt-0 dark:text-white",a==="rtl"&&"flex-row-reverse"),children:[s.jsx("div",{className:"shrink-0",children:O}),s.jsxs("div",{className:we("flex-1",a==="rtl"?"pr-2":"pl-2",c?"mt-[-2px]":"mt-[1px]"),onClick:()=>!u&&v(!x),children:[n,c&&s.jsx("div",{className:`text-xs ${m?"text-red":"text-grey-700"}`,children:c})]})]}));const $=f.find(W=>W.value===_);return s.jsxs("div",{className:"flex-col","data-testid":e,onClick:W=>W.stopPropagation(),children:[O,(u||x)&&s.jsx(J2,{clearButtonValue:h,eyedropper:y,hexValue:$?.hex||_||void 0,onChange:C})]})},t3=({value:e,onChange:n,singleParagraph:a=!0,...o})=>{const c=D.useCallback(m=>{const h=new DOMParser().parseFromString(m,"text/html");h.querySelectorAll("*").forEach(f=>{f.style.removeProperty("white-space"),f.getAttribute("style")||f.removeAttribute("style")}),h.body.innerHTML!==e&&n?.(h.body.innerHTML)},[e,n]);return s.jsx(R_,{...o,singleParagraph:a,children:m=>s.jsx(m.HtmlOutputPlugin,{html:e,setHtml:c})})},ld=({title:e,hideTitle:n,error:a,hint:o,value:c,clearBg:m=!1,className:y="",containerClassName:h="",hintClassName:l="",unstyled:f=!1,...u})=>{const p=f?"":we("flex min-h-[32px] items-center rounded-md border border-transparent py-1.5 md:min-h-[36px]",m?"bg-transparent":"bg-grey-150 px-3 dark:bg-grey-900",a?"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",e&&!n&&!m&&"mt-2",y);return s.jsxs("div",{className:`flex flex-col ${h}`,children:[e&&s.jsx(bt,{className:n?"sr-only":"",grey:!0,useLabelTag:!0,children:e}),s.jsx("div",{className:p,children:s.jsx(t3,{...u,value:c})}),o&&s.jsx(Gr,{className:l,color:a?"red":"",children:o})]})};var cd="Radio",[r3,h0]=Lg(cd),[n3,s3]=r3(cd),m0=D.forwardRef((e,n)=>{const{__scopeRadio:a,name:o,checked:c=!1,required:m,disabled:y,value:h="on",onCheck:l,form:f,...u}=e,[p,x]=D.useState(null),v=Kf(n,M=>x(M)),_=D.useRef(!1),k=p?f||!!p.closest("form"):!0;return s.jsxs(n3,{scope:a,checked:c,disabled:y,children:[s.jsx(Vi.button,{type:"button",role:"radio","aria-checked":c,"data-state":v0(c),"data-disabled":y?"":void 0,disabled:y,value:h,...u,ref:v,onClick:Sf(e.onClick,M=>{c||l?.(),k&&(_.current=M.isPropagationStopped(),_.current||M.stopPropagation())})}),k&&s.jsx(b0,{control:p,bubbles:!_.current,name:o,value:h,checked:c,required:m,disabled:y,form:f,style:{transform:"translateX(-100%)"}})]})});m0.displayName=cd;var g0="RadioIndicator",x0=D.forwardRef((e,n)=>{const{__scopeRadio:a,forceMount:o,...c}=e,m=s3(g0,a);return s.jsx(d_,{present:o||m.checked,children:s.jsx(Vi.span,{"data-state":v0(m.checked),"data-disabled":m.disabled?"":void 0,...c,ref:n})})});x0.displayName=g0;var a3="RadioBubbleInput",b0=D.forwardRef(({__scopeRadio:e,control:n,checked:a,bubbles:o=!0,...c},m)=>{const y=D.useRef(null),h=Kf(y,m),l=p_(a),f=h_(n);return D.useEffect(()=>{const u=y.current;if(!u)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(l!==a&&v){const _=new Event("click",{bubbles:o});v.call(u,a),u.dispatchEvent(_)}},[l,a,o]),s.jsx(Vi.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...c,tabIndex:-1,ref:h,style:{...c.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});b0.displayName=a3;function v0(e){return e?"checked":"unchecked"}var o3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],rl="RadioGroup",[i3]=Lg(rl,[$g,h0]),w0=$g(),y0=h0(),[l3,c3]=i3(rl),_0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,name:o,defaultValue:c,value:m,required:y=!1,disabled:h=!1,orientation:l,dir:f,loop:u=!0,onValueChange:p,...x}=e,v=w0(a),_=l_(f),[k,M]=c_({prop:m,defaultProp:c??null,onChange:p,caller:rl});return s.jsx(l3,{scope:a,name:o,required:y,disabled:h,value:k,onValueChange:M,children:s.jsx(u_,{asChild:!0,...v,orientation:l,dir:_,loop:u,children:s.jsx(Vi.div,{role:"radiogroup","aria-required":y,"aria-orientation":l,"data-disabled":h?"":void 0,dir:_,...x,ref:n})})})});_0.displayName=rl;var k0="RadioGroupItem",M0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,disabled:o,...c}=e,m=c3(k0,a),y=m.disabled||o,h=w0(a),l=y0(a),f=D.useRef(null),u=Kf(n,f),p=m.value===c.value,x=D.useRef(!1);return D.useEffect(()=>{const v=k=>{o3.includes(k.key)&&(x.current=!0)},_=()=>x.current=!1;return document.addEventListener("keydown",v),document.addEventListener("keyup",_),()=>{document.removeEventListener("keydown",v),document.removeEventListener("keyup",_)}},[]),s.jsx(f_,{asChild:!0,...h,focusable:!y,active:p,children:s.jsx(m0,{disabled:y,required:m.required,checked:p,...l,...c,name:m.name,ref:u,onCheck:()=>m.onValueChange(c.value),onKeyDown:Sf(v=>{v.key==="Enter"&&v.preventDefault()}),onFocus:Sf(c.onFocus,()=>{x.current&&f.current?.click()})})})});M0.displayName=k0;var u3="RadioGroupIndicator",j0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,...o}=e,c=y0(a);return s.jsx(x0,{...c,...o,ref:n})});j0.displayName=u3;var f3=_0,d3=M0,p3=j0;const h3=({id:e,title:n,options:a,onSelect:o,error:c,hint:m,selectedOption:y,separator:h})=>s.jsxs(f3,{defaultValue:y,name:e,onValueChange:o,children:[s.jsxs("div",{className:`flex flex-col gap-2 ${h&&"pb-2"}`,children:[n&&s.jsx(bt,{level:6,children:n}),a.map(l=>s.jsxs("label",{className:`flex cursor-pointer items-start ${n&&"-mb-1 mt-1"}`,htmlFor:l.value,children:[s.jsx(d3,{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:outline-none focus:ring-0 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:l.value,value:l.value,children:s.jsx(p3,{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"})}),s.jsxs("div",{className:`ml-2 flex flex-col ${l.hint&&"mb-2"}`,children:[s.jsx("span",{className:`inline-block text-md dark:text-white ${l.hint&&"-mb-1"}`,children:l.label}),l.hint&&s.jsx(Gr,{children:l.hint})]})]},l.value)),m&&s.jsx(Gr,{color:c?"red":"",children:m})]}),(h||c)&&s.jsx(Va,{className:c?"border-red":""})]}),Yi=({children:e,gap:n="md",className:a})=>{let o="gap-3";switch(n){case"sm":o="gap-2";break;case"md":o="gap-3";break;case"lg":o="gap-4";break}return a=we("flex flex-col",o,a),s.jsx("div",{className:a,children:e})},ud=({heading:e,children:n,className:a})=>(a=we("w-full p-[8vmin] pt-5",a),s.jsxs("div",{className:a,children:[e&&s.jsx(bt,{className:"mb-8",children:e}),n]})),fd=({items:e,backIcon:n=!1,snapBackIcon:a=!0,onBack:o,containerClassName:c,itemClassName:m,activeItemClassName:y,separatorClassName:h})=>{const l=e.length;let f=0;return c=we("flex items-center gap-2 text-sm",c),y=we("font-bold",y),m=we("text-sm",m),s.jsxs("div",{className:c,children:[n&&s.jsx(Ue,{className:a?"mr-1":"mr-6",icon:"arrow-left",iconColorClass:"dark:text-white",size:"sm",link:!0,onClick:o}),e.map(u=>{const p=f===l-1?s.jsx("span",{className:y,children:u.label}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`${m} ${u.onClick&&"-mx-1 cursor-pointer rounded-sm px-1 py-px hover:bg-grey-100 dark:hover:bg-grey-900"}`,type:"button",onClick:u.onClick,children:u.label},`bc-${f}`),s.jsx("span",{className:h,children:"/"})]});return f=f+1,p})]})},Zs=({testId:e,title:n,titleHeadingLevel:a=4,size:o="full",width:c,height:m,sidebar:y="",preview:h,dirty:l=!1,cancelLabel:f="Cancel",okLabel:u="OK",okColor:p="black",previewToolbar:x=!0,leftToolbar:v=!0,rightToolbar:_=!0,deviceSelector:k=!0,siteLink:M,previewToolbarURLs:T,previewBgColor:A="grey",selectedURL:C,previewToolbarTabs:O,previewToolbarBreadcrumbs:$,buttonsDisabled:W,sidebarButtons:R,sidebarHeader:Z,sidebarPadding:X=!0,sidebarContentClasses:q,enableCMDS:B=!0,backDropClick:Y,onCancel:ae,onOk:ee,afterClose:re,onSelectURL:Q,onSelectDesktopView:ne,onSelectMobileView:be,onBreadcrumbsBack:je})=>{const H=Zt(),{setGlobalDirtyState:he}=O_();D.useEffect(()=>{he(l)},[l,he]),D.useEffect(()=>{if(ee){const J=xe=>{(xe.metaKey||xe.ctrlKey)&&xe.key==="s"&&(xe.preventDefault(),ee())};if(B)return window.addEventListener("keydown",J),()=>{window.removeEventListener("keydown",J)}}});const[ge,F]=D.useState("desktop");if(ge==="mobile"&&k?h=s.jsx(c0,{"data-testid":"preview-mobile",children:h}):ge==="desktop"&&k&&(h=s.jsx(l0,{"data-testid":"preview-desktop",children:h})),x){let J=s.jsx(s.Fragment,{});T?J=s.jsx(Lt,{options:T,selectedOption:T.find(Ie=>Ie.value===C),onSelect:Ie=>Ie&&Q?.(Ie.value)}):O?J=s.jsx(Dn,{border:!1,selectedTab:C,tabs:O,width:"wide",onTabChange:Q}):$&&(J=s.jsx(fd,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:$,separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:je}));const xe="text-black dark:text-green",Te="text-grey-500 dark:text-grey-600",De=[{icon:"laptop",label:"Desktop",hideLabel:!0,link:!0,size:"sm",iconColorClass:ge==="desktop"?xe:Te,onClick:ne||(()=>{F("desktop")})},{icon:"mobile",label:"Mobile",hideLabel:!0,link:!0,size:"sm",iconColorClass:ge==="mobile"?xe:Te,onClick:be||(()=>{F("mobile")})}],Me=k&&s.jsx(an,{buttons:De});let oe="";A==="grey"?oe="bg-grey-50 dark:bg-black":A==="greygradient"&&(oe="bg-gradient-to-tr from-white to-[#f9f9fa] dark:from-grey-950 dark:to-black");const Ee=we("min-w-100 absolute inset-y-0 left-0 right-[400px] flex w-full grow flex-col overflow-y-auto",oe);let Ne;M&&(Ne=s.jsx("div",{className:"ml-3 border-l border-grey-400 dark:border-grey-800",children:s.jsxs("a",{className:"ml-3 flex items-center gap-1 text-sm",href:M,rel:"noopener noreferrer",target:"_blank",children:["View site ",s.jsx(ut,{name:"arrow-top-right",size:"xs"})]})})),h=s.jsxs("div",{className:Ee,children:[x&&s.jsxs("header",{className:"relative flex h-[80px] shrink-0 items-center justify-center px-8 py-5","data-testid":"design-toolbar",children:[v&&s.jsx("div",{className:"absolute left-8 flex h-full items-center",children:J}),_&&s.jsxs("div",{className:"absolute right-8 flex h-full items-center",children:[Me,Ne]})]}),s.jsx("div",{className:"flex grow items-center justify-center text-sm text-grey-400",children:h})]})}const L=[];return R||(L.push({key:"cancel-modal",label:f,onClick:ae||(()=>{$_(l,()=>{H.remove(),re?.()})}),disabled:W}),L.push({key:"ok-modal",label:u,color:p,onClick:ee,disabled:W})),s.jsx(yt,{afterClose:re,animate:!1,backDropClick:Y,dirty:l,footer:!1,height:m,padding:!1,size:o,testId:e,title:"",width:c,hideXOnMobile:!0,children:s.jsxs("div",{className:"flex h-full grow",children:[s.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}),y&&s.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:[Z||s.jsxs("div",{className:"flex max-h-[82px] items-center justify-between gap-3 px-7 py-6",children:[s.jsx(bt,{level:a,children:n}),R||s.jsx(an,{buttons:L})]}),s.jsx("div",{className:`${Z?"":"absolute inset-x-0 bottom-0 top-[80px] grow"} ${X&&"p-7 pt-0"} flex flex-col justify-between overflow-y-auto ${q&&q}`,children:y})]})]})})},m3=({offset:e,onTrigger:n})=>{const a=D.useRef(null);return D.useEffect(()=>{const o=new IntersectionObserver(c=>{c[0].intersectionRatio<=0||n()});return a.current&&o.observe(a.current),()=>o.disconnect()},[n]),s.jsx("div",{ref:a,className:"absolute w-full",style:{bottom:e}})},E0=({trigger:e,triggerButtonProps:n,items:a,position:o="start",open:c,setOpen:m})=>(e||(e=s.jsx(Ue,{icon:"ellipsis",label:"Menu",hideLabel:!0,...n})),s.jsx(zg,{open:c,position:o,setOpen:m,trigger:e,closeOnItemClick:!0,children:s.jsx("div",{className:"flex min-w-[160px] flex-col justify-stretch py-1",role:"none",children:a.map(y=>s.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 ${y.destructive&&" text-red-500"}`,type:"button",onClick:h=>{y.onClick&&y.onClick(h)},children:y.label},y.id))})}));var T0=typeof global=="object"&&global&&global.Object===Object&&global,g3=typeof self=="object"&&self&&self.Object===Object&&self,fn=T0||g3||Function("return this")(),qs=fn.Symbol,S0=Object.prototype,x3=S0.hasOwnProperty,b3=S0.toString,Ba=qs?qs.toStringTag:void 0;function v3(e){var n=x3.call(e,Ba),a=e[Ba];try{e[Ba]=void 0;var o=!0}catch{}var c=b3.call(e);return o&&(n?e[Ba]=a:delete e[Ba]),c}var w3=Object.prototype,y3=w3.toString;function _3(e){return y3.call(e)}var k3="[object Null]",M3="[object Undefined]",wh=qs?qs.toStringTag:void 0;function ao(e){return e==null?e===void 0?M3:k3:wh&&wh in Object(e)?v3(e):_3(e)}function eo(e){return e!=null&&typeof e=="object"}var Gi=Array.isArray;function N0(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var j3="[object AsyncFunction]",E3="[object Function]",T3="[object GeneratorFunction]",S3="[object Proxy]";function A0(e){if(!N0(e))return!1;var n=ao(e);return n==E3||n==T3||n==j3||n==S3}var ru=fn["__core-js_shared__"],yh=(function(){var e=/[^.]+$/.exec(ru&&ru.keys&&ru.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function N3(e){return!!yh&&yh in e}var A3=Function.prototype,I3=A3.toString;function as(e){if(e!=null){try{return I3.call(e)}catch{}try{return e+""}catch{}}return""}var C3=/[\\^$.*+?()[\]{}|]/g,D3=/^\[object .+?Constructor\]$/,R3=Function.prototype,O3=Object.prototype,$3=R3.toString,L3=O3.hasOwnProperty,P3=RegExp("^"+$3.call(L3).replace(C3,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function F3(e){if(!N0(e)||N3(e))return!1;var n=A0(e)?P3:D3;return n.test(as(e))}function U3(e,n){return e?.[n]}function Vs(e,n){var a=U3(e,n);return F3(a)?a:void 0}var $f=Vs(fn,"WeakMap"),z3=9007199254740991,H3=/^(?:0|[1-9]\d*)$/;function B3(e,n){var a=typeof e;return n=n??z3,!!n&&(a=="number"||a!="symbol"&&H3.test(e))&&e>-1&&e%1==0&&e<n}function I0(e,n){return e===n||e!==e&&n!==n}var W3=9007199254740991;function C0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=W3}function q3(e){return e!=null&&C0(e.length)&&!A0(e)}var Y3=Object.prototype;function G3(e){var n=e&&e.constructor,a=typeof n=="function"&&n.prototype||Y3;return e===a}function X3(e,n){for(var a=-1,o=Array(e);++a<e;)o[a]=n(a);return o}var K3="[object Arguments]";function _h(e){return eo(e)&&ao(e)==K3}var D0=Object.prototype,Z3=D0.hasOwnProperty,V3=D0.propertyIsEnumerable,Q3=_h((function(){return arguments})())?_h:function(e){return eo(e)&&Z3.call(e,"callee")&&!V3.call(e,"callee")};function J3(){return!1}var R0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kh=R0&&typeof module=="object"&&module&&!module.nodeType&&module,e8=kh&&kh.exports===R0,Mh=e8?fn.Buffer:void 0,t8=Mh?Mh.isBuffer:void 0,Lf=t8||J3,r8="[object Arguments]",n8="[object Array]",s8="[object Boolean]",a8="[object Date]",o8="[object Error]",i8="[object Function]",l8="[object Map]",c8="[object Number]",u8="[object Object]",f8="[object RegExp]",d8="[object Set]",p8="[object String]",h8="[object WeakMap]",m8="[object ArrayBuffer]",g8="[object DataView]",x8="[object Float32Array]",b8="[object Float64Array]",v8="[object Int8Array]",w8="[object Int16Array]",y8="[object Int32Array]",_8="[object Uint8Array]",k8="[object Uint8ClampedArray]",M8="[object Uint16Array]",j8="[object Uint32Array]",wt={};wt[x8]=wt[b8]=wt[v8]=wt[w8]=wt[y8]=wt[_8]=wt[k8]=wt[M8]=wt[j8]=!0;wt[r8]=wt[n8]=wt[m8]=wt[s8]=wt[g8]=wt[a8]=wt[o8]=wt[i8]=wt[l8]=wt[c8]=wt[u8]=wt[f8]=wt[d8]=wt[p8]=wt[h8]=!1;function E8(e){return eo(e)&&C0(e.length)&&!!wt[ao(e)]}function T8(e){return function(n){return e(n)}}var O0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ka=O0&&typeof module=="object"&&module&&!module.nodeType&&module,S8=Ka&&Ka.exports===O0,nu=S8&&T0.process,jh=(function(){try{var e=Ka&&Ka.require&&Ka.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}})(),Eh=jh&&jh.isTypedArray,$0=Eh?T8(Eh):E8,N8=Object.prototype,A8=N8.hasOwnProperty;function I8(e,n){var a=Gi(e),o=!a&&Q3(e),c=!a&&!o&&Lf(e),m=!a&&!o&&!c&&$0(e),y=a||o||c||m,h=y?X3(e.length,String):[],l=h.length;for(var f in e)A8.call(e,f)&&!(y&&(f=="length"||c&&(f=="offset"||f=="parent")||m&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||B3(f,l)))&&h.push(f);return h}function C8(e,n){return function(a){return e(n(a))}}var D8=C8(Object.keys,Object),R8=Object.prototype,O8=R8.hasOwnProperty;function $8(e){if(!G3(e))return D8(e);var n=[];for(var a in Object(e))O8.call(e,a)&&a!="constructor"&&n.push(a);return n}function L8(e){return q3(e)?I8(e):$8(e)}var to=Vs(Object,"create");function P8(){this.__data__=to?to(null):{},this.size=0}function F8(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var U8="__lodash_hash_undefined__",z8=Object.prototype,H8=z8.hasOwnProperty;function B8(e){var n=this.__data__;if(to){var a=n[e];return a===U8?void 0:a}return H8.call(n,e)?n[e]:void 0}var W8=Object.prototype,q8=W8.hasOwnProperty;function Y8(e){var n=this.__data__;return to?n[e]!==void 0:q8.call(n,e)}var G8="__lodash_hash_undefined__";function X8(e,n){var a=this.__data__;return this.size+=this.has(e)?0:1,a[e]=to&&n===void 0?G8:n,this}function rs(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}rs.prototype.clear=P8;rs.prototype.delete=F8;rs.prototype.get=B8;rs.prototype.has=Y8;rs.prototype.set=X8;function K8(){this.__data__=[],this.size=0}function nl(e,n){for(var a=e.length;a--;)if(I0(e[a][0],n))return a;return-1}var Z8=Array.prototype,V8=Z8.splice;function Q8(e){var n=this.__data__,a=nl(n,e);if(a<0)return!1;var o=n.length-1;return a==o?n.pop():V8.call(n,a,1),--this.size,!0}function J8(e){var n=this.__data__,a=nl(n,e);return a<0?void 0:n[a][1]}function ek(e){return nl(this.__data__,e)>-1}function tk(e,n){var a=this.__data__,o=nl(a,e);return o<0?(++this.size,a.push([e,n])):a[o][1]=n,this}function dn(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}dn.prototype.clear=K8;dn.prototype.delete=Q8;dn.prototype.get=J8;dn.prototype.has=ek;dn.prototype.set=tk;var ro=Vs(fn,"Map");function rk(){this.size=0,this.__data__={hash:new rs,map:new(ro||dn),string:new rs}}function nk(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function sl(e,n){var a=e.__data__;return nk(n)?a[typeof n=="string"?"string":"hash"]:a.map}function sk(e){var n=sl(this,e).delete(e);return this.size-=n?1:0,n}function ak(e){return sl(this,e).get(e)}function ok(e){return sl(this,e).has(e)}function ik(e,n){var a=sl(this,e),o=a.size;return a.set(e,n),this.size+=a.size==o?0:1,this}function os(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}os.prototype.clear=rk;os.prototype.delete=sk;os.prototype.get=ak;os.prototype.has=ok;os.prototype.set=ik;function lk(e,n){for(var a=-1,o=n.length,c=e.length;++a<o;)e[c+a]=n[a];return e}function ck(){this.__data__=new dn,this.size=0}function uk(e){var n=this.__data__,a=n.delete(e);return this.size=n.size,a}function fk(e){return this.__data__.get(e)}function dk(e){return this.__data__.has(e)}var pk=200;function hk(e,n){var a=this.__data__;if(a instanceof dn){var o=a.__data__;if(!ro||o.length<pk-1)return o.push([e,n]),this.size=++a.size,this;a=this.__data__=new os(o)}return a.set(e,n),this.size=a.size,this}function Cn(e){var n=this.__data__=new dn(e);this.size=n.size}Cn.prototype.clear=ck;Cn.prototype.delete=uk;Cn.prototype.get=fk;Cn.prototype.has=dk;Cn.prototype.set=hk;function mk(e,n){for(var a=-1,o=e==null?0:e.length,c=0,m=[];++a<o;){var y=e[a];n(y,a,e)&&(m[c++]=y)}return m}function gk(){return[]}var xk=Object.prototype,bk=xk.propertyIsEnumerable,Th=Object.getOwnPropertySymbols,vk=Th?function(e){return e==null?[]:(e=Object(e),mk(Th(e),function(n){return bk.call(e,n)}))}:gk;function wk(e,n,a){var o=n(e);return Gi(e)?o:lk(o,a(e))}function Sh(e){return wk(e,L8,vk)}var Pf=Vs(fn,"DataView"),Ff=Vs(fn,"Promise"),Uf=Vs(fn,"Set"),Nh="[object Map]",yk="[object Object]",Ah="[object Promise]",Ih="[object Set]",Ch="[object WeakMap]",Dh="[object DataView]",_k=as(Pf),kk=as(ro),Mk=as(Ff),jk=as(Uf),Ek=as($f),In=ao;(Pf&&In(new Pf(new ArrayBuffer(1)))!=Dh||ro&&In(new ro)!=Nh||Ff&&In(Ff.resolve())!=Ah||Uf&&In(new Uf)!=Ih||$f&&In(new $f)!=Ch)&&(In=function(e){var n=ao(e),a=n==yk?e.constructor:void 0,o=a?as(a):"";if(o)switch(o){case _k:return Dh;case kk:return Nh;case Mk:return Ah;case jk:return Ih;case Ek:return Ch}return n});var Rh=fn.Uint8Array,Tk="__lodash_hash_undefined__";function Sk(e){return this.__data__.set(e,Tk),this}function Nk(e){return this.__data__.has(e)}function Xi(e){var n=-1,a=e==null?0:e.length;for(this.__data__=new os;++n<a;)this.add(e[n])}Xi.prototype.add=Xi.prototype.push=Sk;Xi.prototype.has=Nk;function Ak(e,n){for(var a=-1,o=e==null?0:e.length;++a<o;)if(n(e[a],a,e))return!0;return!1}function Ik(e,n){return e.has(n)}var Ck=1,Dk=2;function L0(e,n,a,o,c,m){var y=a&Ck,h=e.length,l=n.length;if(h!=l&&!(y&&l>h))return!1;var f=m.get(e),u=m.get(n);if(f&&u)return f==n&&u==e;var p=-1,x=!0,v=a&Dk?new Xi:void 0;for(m.set(e,n),m.set(n,e);++p<h;){var _=e[p],k=n[p];if(o)var M=y?o(k,_,p,n,e,m):o(_,k,p,e,n,m);if(M!==void 0){if(M)continue;x=!1;break}if(v){if(!Ak(n,function(T,A){if(!Ik(v,A)&&(_===T||c(_,T,a,o,m)))return v.push(A)})){x=!1;break}}else if(!(_===k||c(_,k,a,o,m))){x=!1;break}}return m.delete(e),m.delete(n),x}function Rk(e){var n=-1,a=Array(e.size);return e.forEach(function(o,c){a[++n]=[c,o]}),a}function Ok(e){var n=-1,a=Array(e.size);return e.forEach(function(o){a[++n]=o}),a}var $k=1,Lk=2,Pk="[object Boolean]",Fk="[object Date]",Uk="[object Error]",zk="[object Map]",Hk="[object Number]",Bk="[object RegExp]",Wk="[object Set]",qk="[object String]",Yk="[object Symbol]",Gk="[object ArrayBuffer]",Xk="[object DataView]",Oh=qs?qs.prototype:void 0,su=Oh?Oh.valueOf:void 0;function Kk(e,n,a,o,c,m,y){switch(a){case Xk:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case Gk:return!(e.byteLength!=n.byteLength||!m(new Rh(e),new Rh(n)));case Pk:case Fk:case Hk:return I0(+e,+n);case Uk:return e.name==n.name&&e.message==n.message;case Bk:case qk:return e==n+"";case zk:var h=Rk;case Wk:var l=o&$k;if(h||(h=Ok),e.size!=n.size&&!l)return!1;var f=y.get(e);if(f)return f==n;o|=Lk,y.set(e,n);var u=L0(h(e),h(n),o,c,m,y);return y.delete(e),u;case Yk:if(su)return su.call(e)==su.call(n)}return!1}var Zk=1,Vk=Object.prototype,Qk=Vk.hasOwnProperty;function Jk(e,n,a,o,c,m){var y=a&Zk,h=Sh(e),l=h.length,f=Sh(n),u=f.length;if(l!=u&&!y)return!1;for(var p=l;p--;){var x=h[p];if(!(y?x in n:Qk.call(n,x)))return!1}var v=m.get(e),_=m.get(n);if(v&&_)return v==n&&_==e;var k=!0;m.set(e,n),m.set(n,e);for(var M=y;++p<l;){x=h[p];var T=e[x],A=n[x];if(o)var C=y?o(A,T,x,n,e,m):o(T,A,x,e,n,m);if(!(C===void 0?T===A||c(T,A,a,o,m):C)){k=!1;break}M||(M=x=="constructor")}if(k&&!M){var O=e.constructor,$=n.constructor;O!=$&&"constructor"in e&&"constructor"in n&&!(typeof O=="function"&&O instanceof O&&typeof $=="function"&&$ instanceof $)&&(k=!1)}return m.delete(e),m.delete(n),k}var eM=1,$h="[object Arguments]",Lh="[object Array]",Ri="[object Object]",tM=Object.prototype,Ph=tM.hasOwnProperty;function rM(e,n,a,o,c,m){var y=Gi(e),h=Gi(n),l=y?Lh:In(e),f=h?Lh:In(n);l=l==$h?Ri:l,f=f==$h?Ri:f;var u=l==Ri,p=f==Ri,x=l==f;if(x&&Lf(e)){if(!Lf(n))return!1;y=!0,u=!1}if(x&&!u)return m||(m=new Cn),y||$0(e)?L0(e,n,a,o,c,m):Kk(e,n,l,a,o,c,m);if(!(a&eM)){var v=u&&Ph.call(e,"__wrapped__"),_=p&&Ph.call(n,"__wrapped__");if(v||_){var k=v?e.value():e,M=_?n.value():n;return m||(m=new Cn),c(k,M,a,o,m)}}return x?(m||(m=new Cn),Jk(e,n,a,o,c,m)):!1}function P0(e,n,a,o,c){return e===n?!0:e==null||n==null||!eo(e)&&!eo(n)?e!==e&&n!==n:rM(e,n,a,o,P0,c)}function nM(e,n){return P0(e,n)}const Fh=({className:e,children:n,colSpan:a,sticky:o=!1,...c})=>{const m=we("!py-2 !pl-0 !pr-6 text-left align-top",o&&"sticky top-0 bg-white",c.onClick&&"hover:cursor-pointer",e);return s.jsx("th",{className:m,colSpan:a,...c,children:s.jsx(bt,{className:"whitespace-nowrap",level:6,children:n})})},F0=({left:e,center:n,right:a,sticky:o=!0,containerClassName:c,children:m})=>{const y=we("z-50 h-22 min-h-[92px] p-8",!m&&"flex items-center justify-between gap-3",o&&"sticky top-0",c);if(!m){if(e){const h=we("flex flex-auto items-center",a&&n&&"basis-1/3",!a&&n&&"basis-1/2");e=s.jsx("div",{className:h,children:e})}if(n){const h=we("flex flex-auto items-center justify-center",e&&a&&"basis-1/3",(e&&!a||!e&&a)&&"basis-1/2");n=s.jsx("div",{className:h,children:n})}if(a){const h=we("flex flex-auto items-center justify-end",e&&n&&"basis-1/3",!e&&n&&"basis-1/2");a=s.jsx("div",{className:h,children:a})}}return s.jsx("div",{className:y,children:m||s.jsxs(s.Fragment,{children:[e,n,a]})})},U0=({items:e,setItems:n,blank:a,canAddNewItem:o})=>{const[c,m]=D.useState(e.map((x,v)=>({item:x,id:v.toString()}))),[y,h]=D.useState(a);return D.useEffect(()=>{const x=c.map(({item:v})=>v);o(y)&&x.push(y),nM(JSON.parse(JSON.stringify(x)),JSON.parse(JSON.stringify(e)))||n(x)},[c,y,e,n,o]),{items:c,updateItem:(x,v)=>{const _=c.map(k=>k.id===x?{...k,item:v}:k);m(_),n(_.map(k=>k.item))},addItem:()=>{if(o(y)){const x=c.reduce((_,k)=>Math.max(_,parseInt(k.id)),0),v=c.concat({item:y,id:(x+1).toString()});m(v),n(v.map(_=>_.item)),h(a)}},removeItem:x=>{const v=c.filter(_=>_.id!==x);m(v),n(v.map(_=>_.item))},moveItem:(x,v)=>{if(x!==v){const _=c.findIndex(T=>T.id===x),k=v?c.findIndex(T=>T.id===v):0,M=L_(c,_,k);m(M),n(M.map(T=>T.item))}},newItem:y,setNewItem:h}},sM=({label:e,text:n="",hint:a,onRegenerate:o})=>{const[c,m]=D.useState(!1),y=()=>{navigator.clipboard.writeText(n),m(!0),setTimeout(()=>m(!1),2e3)},h=we("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 s.jsxs("div",{className:"mb-3 grid grid-cols-1",children:[e&&s.jsx(bt,{level:6,grey:!0,children:e}),s.jsxs("div",{className:h,children:[s.jsx("span",{children:n}),a,s.jsxs("div",{className:"visible absolute right-0 top-1/2 flex translate-y-[-50%] gap-1 bg-white pl-1 text-sm group-hover/api-keys:visible md:invisible dark:bg-black",children:[o&&s.jsx(Ue,{color:"outline",label:"Regenerate",size:"sm",onClick:o}),s.jsx(Ue,{color:"outline",label:c?"Copied":"Copy",size:"sm",onClick:y})]})]})]})},al=({keys:e})=>s.jsx("div",{"data-testid":"api-keys",children:e.map(n=>s.jsx(sM,{...n},n.label))}),Qs=({icon:e,title:n,detail:a,extra:o})=>s.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:[s.jsx("div",{className:"size-14",children:e}),s.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-1 flex-col",children:[s.jsx("h3",{children:n}),s.jsx("div",{children:a}),o&&s.jsx("div",{className:"mt-4",children:o})]})]}),dd=ns({method:"POST",path:({integrationId:e,apiKeyId:n})=>`/integrations/${e}/api_key/${n}/refresh/`,body:({integrationId:e})=>({integrations:[{id:e}]}),updateQueries:{emberUpdateType:"createOrUpdate",dataType:el,update:(e,n)=>n&&{...n,integrations:n.integrations.map(a=>e.integrations.find(({id:c})=>c===a.id)||a)}}}),aM=ye.create(()=>{const e=ye.useModal(),{updateRoute:n}=Qe(),{zapierTemplates:a}=P_(),{data:{integrations:o}={integrations:[]}}=Qf(),{config:c}=Je(),{mutateAsync:m}=dd(),y=ot(),[h,l]=D.useState(!1),f=c.hostSettings?.limits?.customIntegrations?.disabled,u=o.find(({slug:v})=>v==="zapier"),p=u?.api_keys?.find(v=>v.type==="admin");D.useEffect(()=>{f&&n("integrations")},[f,n]);const x=()=>{!u||!p||(l(!1),ye.show(Et,{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 v=>{try{await m({integrationId:u.id,apiKeyId:p.id}),l(!0),v?.remove()}catch(_){y(_)}}}))};return s.jsxs(yt,{afterClose:()=>{n("integrations")},cancelLabel:"",footer:s.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[s.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 ",s.jsx("span",{children:s.jsx(ut,{className:"relative top-[-2px] inline-block",name:"zapier-logo",size:24})})]}),s.jsx(Ue,{color:"black",label:"Close",onClick:()=>{e.remove()}})]}),okColor:"black",okLabel:"Close",testId:"zapier-modal",title:"",stickyFooter:!0,onOk:()=>{n("integrations"),e.remove()},children:[s.jsx(Qs,{detail:"Automation for your favorite apps",extra:s.jsx("div",{className:"-mb-4 mt-1",children:s.jsx(al,{keys:[{label:"Admin API key",text:p?.secret,hint:h?s.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:x},{label:"API URL",text:window.location.origin+no().subdir}]})}),icon:s.jsx(ut,{name:"zapier",size:56}),title:"Zapier"}),s.jsx(cn,{children:a.map(v=>s.jsx(On,{action:s.jsx(Ue,{className:"whitespace-nowrap text-sm font-semibold text-[#FF4A00]",href:v.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:s.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[s.jsxs("div",{className:"flex shrink-0 flex-nowrap items-center gap-2",children:[s.jsx("img",{className:"size-8 object-contain dark:invert",role:"presentation",src:v.ghostImage}),s.jsx(ut,{name:"arrow-right",size:"xs"}),s.jsx("img",{className:"size-8 object-contain",role:"presentation",src:v.appImage})]}),s.jsx("span",{className:"text-sm",children:v.title})]}),hideActions:!0}))})]})});function z0(e){const n="The URL must be in a format like https://www.threads.net/@yourUsername";if(!e)return"";if(e.startsWith("http")){if(!e.includes("threads.net")&&!e.includes("threads.com"))throw new Error(n);if(e=e.replace("threads.com","threads.net"),e.includes("www.")||(e=e.replace("https://","https://www.")),!Nt.isURL(e))throw new Error(n);if(!e.match(/^https:\/\/www\.threads\.net\/@?[a-zA-Z0-9._]+$/))throw new Error(n);return e}if(!e.includes("/")){if(e.startsWith("@")&&(e=e.slice(1)),!e.match(/^[a-zA-Z0-9._]+$/))throw new Error(n);return`https://www.threads.net/@${e}`}throw new Error(n)}const oM=e=>`https://www.threads.net/${e}`,iM=e=>{const n=e.match(/(?:https:\/\/)(?:www\.)?(?:threads\.(?:com|net))(?:\/)?(?:#!\/)?@?([^/]*)/)?.[1];return n?`@${n}`:null},Bs={INVALID_USERNAME:"Your Username is not a valid Bluesky Username",INVALID_URL:"The URL must be in a format like https://bsky.app/profile/yourUsername"};function H0(e){return[/^did:plc:[a-z2-7]{24}$/,/^[a-zA-Z0-9._]{1,15}$/,/^(?=.{1,191}$)[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$/].some(a=>a.test(e))}function zf(e){let n=e.trim();return n.startsWith("@")&&(n=n.slice(1)),n.startsWith("did:plc:")?n.toLowerCase():n}function B0(e){if(!e)return"";let n;if(e.startsWith("http")||e.startsWith("www.")||e.includes("bsky.app")){if(!e.includes("bsky.app"))throw new Error(Bs.INVALID_URL);const o=e.match(/bsky\.app\/profile\/@?([^/]+)/);if(!o)throw new Error(Bs.INVALID_URL);n=zf(o[1])}else n=zf(e);if(!H0(n))throw new Error(Bs.INVALID_USERNAME);const a=`https://bsky.app/profile/${n}`;if(!Nt.isURL(a))throw new Error(Bs.INVALID_URL);return a}const lM=e=>{if(!e)throw new Error(Bs.INVALID_USERNAME);let n=zf(e);if(!H0(n))throw new Error(Bs.INVALID_USERNAME);return`https://bsky.app/profile/${n}`},cM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?bsky\.app\/profile\/@?([^/]*)/);return n?`${n[1]}`:null},es={INVALID_URL:"The URL must be in a format like https://www.linkedin.com/in/yourUsername",INVALID_USERNAME:"Your Username is not a valid LinkedIn Username"},uM=["in","pub","company","school"],fM=/^[a-zA-Z0-9-]{3,100}$/,dM=/^[a-zA-Z0-9-]{3,100}(?:\/[a-zA-Z0-9-]*)*$/,W0=/^(?:https?:\/\/)?(?:www\.)?(?:([a-z]{2})\.)?linkedin\.com\/(in|pub|company|school)\/([^?#]+)/i,Hf=e=>e.trim().replace(/^@/,""),q0=e=>{if(/^(https?:\/\/|www\.)/.test(e)||e.includes("linkedin.com")){const o=e.match(W0);if(!o)throw new Error(es.INVALID_URL);if(o[0].length!==e.length)throw new Error(es.INVALID_USERNAME);const[,c,m,y]=o,h=Hf(y);if(c&&!/^[A-Z]{2}$/.test(c.toUpperCase()))throw new Error(es.INVALID_URL);return{regional:c,pathType:m,username:h}}const n=Hf(e),a=n.indexOf("/");if(a!==-1){const o=n.substring(0,a);if(uM.includes(o))return{pathType:o,username:n.substring(a+1)}}return{username:n}},Y0=(e,n)=>(e==="pub"?dM:fM).test(n),G0=({regional:e,pathType:n,username:a})=>{const c=`https://${e?`${e.toLowerCase()}.`:"www."}linkedin.com/${n}/${a}`;if(!Nt.isURL(c))throw new Error(es.INVALID_URL);return c};function X0(e){if(!e)return"";const{regional:n,pathType:a="in",username:o}=q0(e);if(!Y0(a,o))throw new Error(es.INVALID_USERNAME);return G0({regional:n,pathType:a,username:o})}const pM=e=>{if(!e)throw new Error(es.INVALID_USERNAME);const{regional:n,pathType:a="in",username:o}=q0(e);if(!Y0(a,o))throw new Error(es.INVALID_USERNAME);return G0({regional:n,pathType:a,username:o})},hM=e=>{const n=e.match(W0);if(!n)return null;const[,,a,o]=n,c=Hf(o);return a==="in"?c:`${a}/${c}`};function K0(e){const n="The URL must be in a format like https://www.instagram.com/yourUsername",a="Your Username is not a valid Instagram Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("instagram.com")){if(!e.includes("instagram.com"))throw new Error(n);const m=e.match(/(?:https?:\/\/)?(?:www\.)?instagram\.com\/@?([^/]+)/);if(!m)throw new Error(n);o=m[1]}else o=e.startsWith("@")?e.slice(1):e;if(!o.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,28}[a-zA-Z0-9_]$/)||o.includes("..")||o.length>30)throw new Error(a);const c=`https://www.instagram.com/${o}`;if(!Nt.isURL(c))throw new Error(n);return c}const mM=e=>{const n="Your Username is not a valid Instagram Username";if(!e)throw new Error(n);let a=e;if(a.startsWith("@")&&(a=a.slice(1)),!a.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,28}[a-zA-Z0-9_]$/)||a.includes("..")||a.length>30)throw new Error(n);return`https://www.instagram.com/${a}`},gM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?instagram\.com\/@?([^/]*)/);return n?`${n[1]}`:null};function Z0(e){const n="The URL must be in a format like https://www.youtube.com/@yourUsername, https://www.youtube.com/user/yourUsername, or https://www.youtube.com/channel/yourChannelId",a="Your Username is not a valid YouTube Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("youtube.com")){if(!e.includes("youtube.com"))throw new Error(n);const m=e.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/((?:@|user\/|channel\/)[^/]+)/);if(!m)throw new Error(n);o=m[1]}else o=e;if(o.startsWith("@")){const m=o.slice(1);if(!m.match(/^[a-zA-Z0-9][a-zA-Z0-9._-]{1,28}[a-zA-Z0-9]$/)||m.includes("..")||m.length>30)throw new Error(a)}else if(o.startsWith("user/")){if(!o.slice(5).match(/^[a-zA-Z0-9._-]{1,50}$/))throw new Error(a)}else if(o.startsWith("channel/")){if(!o.slice(8).match(/^UC[a-zA-Z0-9_-]{22}$/))throw new Error(a)}else throw new Error(n);const c=`https://www.youtube.com/${o}`;if(!Nt.isURL(c))throw new Error(n);return c}const xM=e=>{const n="Your Username is not a valid YouTube Username";if(!e)throw new Error(n);if(e.startsWith("@")){const a=e.slice(1);if(!a.match(/^[a-zA-Z0-9][a-zA-Z0-9._-]{1,28}[a-zA-Z0-9]$/)||a.includes("..")||a.length>30)throw new Error(n)}else if(e.startsWith("user/")){if(!e.slice(5).match(/^[a-zA-Z0-9._-]{1,50}$/))throw new Error(n)}else if(e.startsWith("channel/")){if(!e.slice(8).match(/^UC[a-zA-Z0-9_-]{22}$/))throw new Error(n)}else throw new Error("The handle must be in a format like @yourUsername, user/yourUsername, or channel/yourChannelId");return`https://www.youtube.com/${e}`},bM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/((?:@|user\/|channel\/)[^/]*)/);return n?n[1]:null};function V0(e){const n="The URL must be in a format like https://www.tiktok.com/@yourUsername",a="Your Username is not a valid TikTok Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("tiktok.com")){if(!e.includes("tiktok.com"))throw new Error(n);const y=e.match(/(?:https?:\/\/)?(?:www\.)?tiktok\.com\/(@[^/]+)/);if(!y)throw new Error(n);o=y[1]}else o=e.startsWith("@")?e:`@${e}`;const c=o.slice(1);if(!c.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,22}[a-zA-Z0-9_]$/)||c.includes("..")||c.length<2||c.length>24)throw new Error(a);const m=`https://www.tiktok.com/${o}`;if(!Nt.isURL(m))throw new Error(n);return m}const vM=e=>{const n="Your Username is not a valid TikTok Username";if(!e)throw new Error(n);const a=e.startsWith("@")?e:`@${e}`,o=a.slice(1);if(!o.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,22}[a-zA-Z0-9_]$/)||o.includes("..")||o.length<2||o.length>24)throw new Error(n);return`https://www.tiktok.com/${a}`},wM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?tiktok\.com\/(@[^/]*)/);return n?n[1]:null};function Q0(e){const n="The URL must be in a format like @username@instance.tld or https://instance.tld/@username or https://website.com/@username@instance.tld";if(!e)return"";let a=e;if(a=a.replace(/^https?:\/\//,""),a.match(/^@[^@]+@[^/]+$/)){const[o,c]=a.split("@").slice(1);if(!Nt.isFQDN(c))throw new Error(n);return`https://${c}/@${o}`}if(a.match(/^[^/]+\.[^/]+\/@[^/]+(@[^/]+)?$/)){const[o,c]=a.split("/@");if(!Nt.isFQDN(o))throw new Error(n);if(c.includes("@")){const[,m]=c.split("@");if(!Nt.isFQDN(m))throw new Error(n)}return`https://${a}`}throw new Error(n)}const yM=e=>{const n="Your Username is not a valid Mastodon Username";if(!e)throw new Error(n);if(e.match(/^@[^@]+@[^/]+$/)){const[a,o]=e.split("@").slice(1);if(!Nt.isFQDN(o))throw new Error(n);return`https://${o}/@${a}`}if(e.match(/^[^/]+\.[^/]+\/@[^/]+(@[^/]+)?$/)){const[a,o]=e.split("/@");if(!Nt.isFQDN(a))throw new Error(n);if(o.includes("@")){const[,c]=o.split("@");if(!Nt.isFQDN(c))throw new Error(n)}return`https://${e}`}throw new Error(n)},_M=e=>e.replace(/^https?:\/\//,""),kM=({tier:e})=>{const n=e?.type==="free",{updateRoute:a}=Qe(),{mutateAsync:o}=ad(),{mutateAsync:c}=A2(),{mutateAsync:m}=Rn(),[y,h]=at.useState(!!e?.trial_days),l=ot(),{localSettings:f,siteData:u}=ss(),[p]=gt(f,["portal_plans"]),x=JSON.parse(p?.toString()||"[]"),v={name:()=>_.name?void 0:"Enter a name for the tier",monthly_price:()=>_.type!=="free"?ch(_.monthly_price||0,_.currency,{allowZero:!1}):void 0,yearly_price:()=>_.type!=="free"?ch(_.yearly_price||0,_.currency,{allowZero:!1}):void 0},{formState:_,saveState:k,updateForm:M,handleSave:T,errors:A,clearError:C,okProps:O}=kr({initialState:{...e||{},trial_days:e?.trial_days?.toString()||"",currency:e?.currency||F_[0].isoCode,visibility:e?.visibility||"none",welcome_page_url:e?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{const q={};return Object.entries(v).forEach(([B,Y])=>{q[B]=Y?.()}),q},onSave:async()=>{const{trial_days:q,currency:B,...Y}=_,ae=Y;if(ae.benefits=ae.benefits?.filter(ee=>ee),n||(ae.currency=B,ae.trial_days=parseInt(q)),e?.id?await o({...e,...ae}):await c(ae),n){const ee=_.visibility==="public";let re=!1;x.includes("free")&&!ee&&(x.splice(x.indexOf("free"),1),re=!0),!x.includes("free")&&ee&&(x.push("free"),re=!0),re&&await m([{key:"portal_plans",value:JSON.stringify(x)}])}},onSaveError:l}),$=U0({items:_.benefits||[],setItems:q=>M(B=>({...B,benefits:q})),blank:"",canAddNewItem:q=>!!q}),W=q=>{q.target.checked?(h(!0),M(B=>({...B,trial_days:e?.trial_days?e?.trial_days.toString():"7"}))):(h(!1),M(B=>({...B,trial_days:"0"})))},R=D.useRef(!1);D.useEffect(()=>{R.current&&(v.monthly_price?.(),v.yearly_price?.()),R.current=!0},[_.currency]);const Z=()=>{if(e){const q=e.active?"Archive tier":"Reactivate tier",B=e.active?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:["Members will no longer be able to subscribe to ",s.jsx("strong",{children:e.name})," and it will be removed from the list of available tiers in portal."]}),s.jsx("div",{children:"Existing members on this tier will remain unchanged. Offers using this tier will be disabled."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:["Reactivating ",s.jsx("strong",{children:e.name})," will re-enable it as an option in portal and allow new members to subscribe to this tier."]}),s.jsx("div",{children:"Existing members will remain unchanged."})]}),Y=e.active?"Archive":"Reactivate";ye.show(Et,{title:q,prompt:B,okLabel:Y,cancelLabel:"Cancel",okColor:e.active?"red":"black",onOk:ae=>{o({...e,active:!e.active}),ae?.remove(),xt({type:"success",title:`Tier ${e.active?"archived":"reactivated"}`})}})}};let X={};return e&&(e.active&&e.type!=="free"?X={label:"Archive tier",color:"red",link:!0,onClick:Z}:e.active||(X={label:"Reactivate tier",color:"green",link:!0,onClick:Z})),s.jsx(yt,{afterClose:()=>{a("tiers")},buttonsDisabled:O.disabled,cancelLabel:"Close",dirty:k==="unsaved",leftButtonProps:X,okColor:O.color,okLabel:O.label||"Save",size:"lg",testId:"tier-detail-modal",title:e?e.active?"Edit tier":"Edit archived tier":"New tier",stickyFooter:!0,onOk:async()=>{await T({fakeWhenUnchanged:!0})},children:s.jsxs("div",{className:"-mb-8 mt-8 flex items-start gap-8",children:[s.jsxs("div",{className:"flex grow flex-col gap-8",children:[s.jsxs(tt,{marginBottom:!1,title:"Basic",grouped:!0,children:[s.jsx(Ae,{autoComplete:"off",error:!!A.name,hint:A.name,maxLength:191,placeholder:n?"Free":"Bronze",title:"Name",value:_.name||"",autoFocus:!0,onChange:q=>M(B=>({...B,name:q.target.value})),onKeyDown:()=>C("name")}),s.jsx(Ae,{autoComplete:"off",autoFocus:n,maxLength:191,placeholder:n?"Free preview":"Full access to premium content",title:"Description",value:_.description||"",onChange:q=>M(B=>({...B,description:q.target.value}))}),!n&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"flex flex-col gap-10 md:flex-row",children:[s.jsxs("div",{className:"basis-1/2",children:[s.jsxs("div",{className:"mb-1 flex h-6 items-center justify-between",children:[s.jsx(bt,{level:6,children:"Prices"}),s.jsx("div",{className:"-mr-2 w-[50px]",children:s.jsx(Lt,{border:!1,containerClassName:"font-medium",controlClasses:{menu:"w-18"},options:uh(),selectedOption:uh().flatMap(q=>q.options).find(q=>q.value===_.currency),size:"xs",clearBg:!0,isSearchable:!0,onSelect:q=>M(B=>({...B,currency:q?.value}))})})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(fh,{error:!!A.monthly_price,hint:A.monthly_price,placeholder:"5",rightPlaceholder:`${_.currency}/month`,title:"Monthly price",valueInCents:_.monthly_price||"",hideTitle:!0,onBlur:q=>q.target.value===""?M(B=>({...B,monthly_price:0})):null,onChange:q=>M(B=>({...B,monthly_price:q})),onKeyDown:()=>C("monthly_price")}),s.jsx(fh,{error:!!A.yearly_price,hint:A.yearly_price,placeholder:"50",rightPlaceholder:`${_.currency}/year`,title:"Yearly price",valueInCents:_.yearly_price||"",hideTitle:!0,onBlur:q=>q.target.value===""?M(B=>({...B,yearly_price:0})):null,onChange:q=>M(B=>({...B,yearly_price:q})),onKeyDown:()=>C("yearly_price")})]})]}),s.jsxs("div",{className:"basis-1/2",children:[s.jsx("div",{className:"mb-1 flex h-6 flex-col justify-center",children:s.jsx(st,{checked:y,label:"Add a free trial",labelStyle:"heading",onChange:W})}),s.jsx(Ae,{disabled:!y,hint:s.jsxs("div",{className:"mt-1",children:["Members will be subscribed at full price once the trial ends. ",s.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:_.trial_days,hideTitle:!0,onChange:q=>M(B=>({...B,trial_days:q.target.value.replace(/[^\d]/,"")}))})]})]})}),s.jsx(Hg,{baseUrl:u?.url,hint:`Redirect to this URL after signup ${n?"":" for premium membership"}`,maxLength:2e3,placeholder:u?.url,title:"Welcome page",value:_.welcome_page_url||null,nullable:!0,transformPathWithoutSlash:!0,onChange:q=>M(B=>({...B,welcome_page_url:q||null}))})]}),s.jsxs(tt,{gap:"none",title:"Benefits",grouped:!0,children:[s.jsx("div",{className:"-mt-3",children:s.jsx(Bg,{items:$.items,itemSeparator:!1,renderItem:({id:q,item:B})=>s.jsxs("div",{className:"relative flex w-full items-center gap-5",children:[s.jsx("div",{className:"absolute left-[-32px] top-[7px] flex size-6 items-center justify-center bg-white group-hover:hidden dark:bg-black",children:s.jsx(ut,{name:"check",size:"sm"})}),s.jsx(Ae,{maxLength:191,value:B,onChange:Y=>$.updateItem(q,Y.target.value)}),s.jsx(Ue,{className:"absolute right-1 top-1 z-10 opacity-0 group-hover:opacity-100",color:"grey",icon:"trash",size:"sm",onClick:()=>$.removeItem(q)})]}),onMove:$.moveItem})}),s.jsxs("div",{className:"relative mt-1 flex items-center gap-3",children:[s.jsx(ut,{className:"dark:text-white",name:"check",size:"sm"}),s.jsx(Ae,{className:"grow",containerClassName:"w-100",maxLength:191,placeholder:"Expert analysis",title:"New benefit",value:$.newItem,hideTitle:!0,onChange:q=>$.setNewItem(q.target.value),onKeyDown:q=>{q.key==="Enter"&&$.addItem()}}),s.jsx(Ue,{className:"absolute right-[5px] top-[5px] z-10",color:"green",icon:"add",iconColorClass:"text-white",label:"Add",size:"sm",hideLabel:!0,onClick:()=>$.addItem()})]})]})]}),s.jsx("div",{className:"sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block",children:s.jsx(U_,{isFreeTier:n,tier:_})})]})})},MM=({params:e})=>{const{data:{tiers:n,isEnd:a}={},fetchNextPage:o}=so();let c;return D.useEffect(()=>{e?.id&&!c&&!a&&o()},[o,a,e?.id,c]),e?.id&&(c=n?.find(({id:m})=>m===e?.id),!c)?null:s.jsx(kM,{tier:c})},jM=ye.create(MM);var au,Uh;function J0(){if(Uh)return au;Uh=1;var e={};return au=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{},au}var ou,zh;function ex(){if(zh)return ou;zh=1;const e="2.0.0",n=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,o=16,c=n-6;return ou={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:o,MAX_SAFE_BUILD_LENGTH:c,MAX_SAFE_INTEGER:a,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},ou}var Oi={exports:{}},Hh;function EM(){return Hh||(Hh=1,(function(e,n){const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:c}=ex(),m=J0();n=e.exports={};const y=n.re=[],h=n.safeRe=[],l=n.src=[],f=n.safeSrc=[],u=n.t={};let p=0;const x="[a-zA-Z0-9-]",v=[["\\s",1],["\\d",c],[x,o]],_=M=>{for(const[T,A]of v)M=M.split(`${T}*`).join(`${T}{0,${A}}`).split(`${T}+`).join(`${T}{1,${A}}`);return M},k=(M,T,A)=>{const C=_(T),O=p++;m(M,O,T),u[M]=O,l[O]=T,f[O]=C,y[O]=new RegExp(T,A?"g":void 0),h[O]=new RegExp(C,A?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*"),k("NUMERICIDENTIFIERLOOSE","\\d+"),k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),k("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),k("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),k("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`),k("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`),k("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),k("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),k("BUILDIDENTIFIER",`${x}+`),k("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),k("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),k("FULL",`^${l[u.FULLPLAIN]}$`),k("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),k("LOOSE",`^${l[u.LOOSEPLAIN]}$`),k("GTLT","((?:<|>)?=?)"),k("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),k("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),k("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),k("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),k("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),k("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),k("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`),k("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`),k("COERCERTL",l[u.COERCE],!0),k("COERCERTLFULL",l[u.COERCEFULL],!0),k("LONETILDE","(?:~>?)"),k("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",k("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),k("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),k("LONECARET","(?:\\^)"),k("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",k("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),k("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),k("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),k("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),k("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",k("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),k("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),k("STAR","(<|>)?=?\\s*\\*"),k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Oi,Oi.exports)),Oi.exports}var iu,Bh;function TM(){if(Bh)return iu;Bh=1;const e=Object.freeze({loose:!0}),n=Object.freeze({});return iu=o=>o?typeof o!="object"?e:o:n,iu}var lu,Wh;function SM(){if(Wh)return lu;Wh=1;const e=/^[0-9]+$/,n=(o,c)=>{if(typeof o=="number"&&typeof c=="number")return o===c?0:o<c?-1:1;const m=e.test(o),y=e.test(c);return m&&y&&(o=+o,c=+c),o===c?0:m&&!y?-1:y&&!m?1:o<c?-1:1};return lu={compareIdentifiers:n,rcompareIdentifiers:(o,c)=>n(c,o)},lu}var cu,qh;function NM(){if(qh)return cu;qh=1;const e=J0(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:a}=ex(),{safeRe:o,t:c}=EM(),m=TM(),{compareIdentifiers:y}=SM();class h{constructor(f,u){if(u=m(u),f instanceof h){if(f.loose===!!u.loose&&f.includePrerelease===!!u.includePrerelease)return f;f=f.version}else if(typeof f!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof f}".`);if(f.length>n)throw new TypeError(`version is longer than ${n} characters`);e("SemVer",f,u),this.options=u,this.loose=!!u.loose,this.includePrerelease=!!u.includePrerelease;const p=f.trim().match(u.loose?o[c.LOOSE]:o[c.FULL]);if(!p)throw new TypeError(`Invalid Version: ${f}`);if(this.raw=f,this.major=+p[1],this.minor=+p[2],this.patch=+p[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");p[4]?this.prerelease=p[4].split(".").map(x=>{if(/^[0-9]+$/.test(x)){const v=+x;if(v>=0&&v<a)return v}return x}):this.prerelease=[],this.build=p[5]?p[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(f){if(e("SemVer.compare",this.version,this.options,f),!(f instanceof h)){if(typeof f=="string"&&f===this.version)return 0;f=new h(f,this.options)}return f.version===this.version?0:this.compareMain(f)||this.comparePre(f)}compareMain(f){return f instanceof h||(f=new h(f,this.options)),this.major<f.major?-1:this.major>f.major?1:this.minor<f.minor?-1:this.minor>f.minor?1:this.patch<f.patch?-1:this.patch>f.patch?1:0}comparePre(f){if(f instanceof h||(f=new h(f,this.options)),this.prerelease.length&&!f.prerelease.length)return-1;if(!this.prerelease.length&&f.prerelease.length)return 1;if(!this.prerelease.length&&!f.prerelease.length)return 0;let u=0;do{const p=this.prerelease[u],x=f.prerelease[u];if(e("prerelease compare",u,p,x),p===void 0&&x===void 0)return 0;if(x===void 0)return 1;if(p===void 0)return-1;if(p===x)continue;return y(p,x)}while(++u)}compareBuild(f){f instanceof h||(f=new h(f,this.options));let u=0;do{const p=this.build[u],x=f.build[u];if(e("build compare",u,p,x),p===void 0&&x===void 0)return 0;if(x===void 0)return 1;if(p===void 0)return-1;if(p===x)continue;return y(p,x)}while(++u)}inc(f,u,p){if(f.startsWith("pre")){if(!u&&p===!1)throw new Error("invalid increment argument: identifier is empty");if(u){const x=`-${u}`.match(this.options.loose?o[c.PRERELEASELOOSE]:o[c.PRERELEASE]);if(!x||x[1]!==u)throw new Error(`invalid identifier: ${u}`)}}switch(f){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",u,p);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",u,p);break;case"prepatch":this.prerelease.length=0,this.inc("patch",u,p),this.inc("pre",u,p);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",u,p),this.inc("pre",u,p);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 x=Number(p)?1:0;if(this.prerelease.length===0)this.prerelease=[x];else{let v=this.prerelease.length;for(;--v>=0;)typeof this.prerelease[v]=="number"&&(this.prerelease[v]++,v=-2);if(v===-1){if(u===this.prerelease.join(".")&&p===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(x)}}if(u){let v=[u,x];p===!1&&(v=[u]),y(this.prerelease[0],u)===0?isNaN(this.prerelease[1])&&(this.prerelease=v):this.prerelease=v}break}default:throw new Error(`invalid increment argument: ${f}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return cu=h,cu}var uu,Yh;function AM(){if(Yh)return uu;Yh=1;const e=NM();return uu=(a,o,c=!1)=>{if(a instanceof e)return a;try{return new e(a,o)}catch(m){if(!c)return null;throw m}},uu}var IM=AM();const CM=Pg(IM);function Gh(e){if(!e)return"";const n=e.replace("+moya","");try{const o=CM(n,{includePrerelease:!0})?.prerelease;if(o&&o?.length>0){const m=String(o[0]).split("-")[1];return!m||!m.startsWith("g")?"":`https://github.com/TryGhost/Ghost/commit/${m.slice(1)}`}return`https://github.com/TryGhost/Ghost/releases/tag/v${n}`}catch{return""}}function DM(e,n){const a=!!e.match?.(/production/i);return!!(a&&n!=="mysql8"||!a&&n==="mysql5")}const RM=ye.create(({})=>{const{updateRoute:e}=Qe();let a=Je().config;const o=z_();function c(){return new Date().getFullYear()}function m(){return!!a.enableDeveloperExperiments}function y(){return!a.hostSettings?.siteId}return s.jsx(yt,{afterClose:()=>{e("")},cancelLabel:"",footer:s.jsx(s.Fragment,{}),topRightContent:"close",width:540,children:s.jsxs("div",{className:"flex flex-col gap-4 pb-7 text-sm",children:[s.jsx(H_,{className:"h-auto w-[120px] dark:invert"}),s.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[o?.message&&s.jsxs("div",{className:"gh-prose-links mb-4 rounded-sm border border-green p-5",children:[s.jsx("strong",{children:"Update available!"}),s.jsx("div",{dangerouslySetInnerHTML:{__html:o.message}})]}),Gh(a.version)&&s.jsxs("div",{children:[s.jsx("strong",{children:"Version:"})," ",s.jsx("a",{className:"text-green",href:Gh(a.version),rel:"noopener noreferrer",target:"_blank",children:a.version})]})||s.jsxs("div",{children:[s.jsx("strong",{children:"Version:"})," ",a.version]}),y()&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Environment:"})," ",a.environment]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Database:"})," ",a.database]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Mail:"})," ",a.mail?a.mail:"Native"]})]}),m()&&s.jsxs("div",{children:[s.jsx("strong",{children:"Developer experiments:"})," Enabled"]}),y()&&DM(a.environment,a.database)&&s.jsxs("div",{className:"text-red-500 dark:text-red-400",children:["You are running an unsupported database in production. Please ",s.jsx("a",{href:"https://ghost.org/docs/faq/supported-databases/",rel:"noopener noreferrer",target:"_blank",children:"upgrade to MySQL 8"}),"."]})]}),s.jsx(Va,{}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.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:[s.jsx(ut,{name:"book-open",size:"sm"})," User documentation"]}),s.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:[s.jsx(ut,{name:"question-circle",size:"sm"})," Get help with Ghost"]}),s.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:[s.jsx(ut,{name:"angle-brackets",size:"sm"})," Get involved"]})]}),s.jsx(Va,{}),s.jsxs("p",{className:"max-w-[460px] text-xs",children:["Copyright © 2013 – ",c()," Ghost Foundation, released under the ",s.jsx("a",{className:"text-green",href:"https://github.com/TryGhost/Ghost/blob/main/LICENSE",rel:"noopener noreferrer",target:"_blank",children:"MIT license"}),". ",s.jsx("a",{className:"text-green",href:"https://ghost.org/",rel:"noopener noreferrer",target:"_blank",children:"Ghost"})," is a registered trademark of ",s.jsx("a",{className:"text-green",href:"https://ghost.org/trademark/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Foundation Ltd"}),"."]})]})})}),OM=()=>{const e=Zt(),{updateRoute:n}=Qe(),[a,o]=D.useState(""),[c,m]=D.useState({name:""}),{mutateAsync:y}=B_(),h=Ys(),l=ot();return D.useEffect(()=>{h?.isLimited("customIntegrations")&&h.errorIfWouldGoOverLimit("customIntegrations").catch(f=>{f instanceof Gs&&(ye.show(Xr,{prompt:f.message||"Your current plan doesn't support more custom integrations.",onOk:()=>n({route:"/pro",isExternal:!0})}),e.remove(),n("integrations"))})},[h,e,n]),s.jsx(yt,{afterClose:()=>{n("integrations")},okColor:"black",okLabel:"Add",size:"sm",testId:"add-integration-modal",title:"Add integration",onOk:async()=>{if(!a){m({name:"Name is required"});return}try{const f=await y({name:a});e.remove(),n({route:`integrations/${f.integrations[0].id}`})}catch(f){l(f)}},children:s.jsx("div",{className:"mt-5",children:s.jsx(tt,{marginBottom:!1,marginTop:!1,children:s.jsx(Ae,{autoFocus:!0,error:!!c.name,hint:c.name,maxLength:191,placeholder:"Custom integration",title:"Name",value:a,onChange:f=>o(f.target.value),onInput:()=>{c.name&&m({name:""})}})})})})},$M=ye.create(OM),LM=()=>{const e=Zt(),{updateRoute:n}=Qe(),a=ot(),[o,c]=D.useState(!0),[m,y]=D.useState(null),{data:h}=Fg({searchParams:{filter:"newsletters.status:active+email_disabled:0",limit:"1",page:"1",include:"newsletters,labels"}}),{mutateAsync:l}=T2(),{formState:f,updateForm:u,saveState:p,handleSave:x,errors:v,clearError:_}=kr({initialState:{name:"",description:"",optInExistingSubscribers:!0},onSave:async()=>{const T=await l({name:f.name,description:f.description,opt_in_existing:f.optInExistingSubscribers,feedback_enabled:!0});n({route:`newsletters/${T.newsletters[0].id}`})},onSaveError:a,onValidate:()=>{const T={};return f.name||(T.name="A name is required for your newsletter"),T}}),k=Ys();D.useEffect(()=>{if(!k){c(!1);return}k.errorIfWouldGoOverLimit("newsletters").catch(T=>{if(T instanceof Gs)y(T);else throw T}).finally(()=>{c(!1)})},[k]);const M=h?.meta?.pagination.total;return D.useEffect(()=>{m&&(ye.show(Xr,{prompt:m.message||"Your current plan doesn't support more newsletters.",onOk:()=>n({route:"/pro",isExternal:!0})}),e.remove(),n("newsletters"))},[m,e,n]),o||m?null:s.jsx(yt,{afterClose:()=>{n("newsletters")},backDropClick:!1,okColor:"black",okDisabled:p==="saving",okLabel:"Create",okLoading:p==="saving",size:"sm",testId:"add-newsletter-modal",title:"Create newsletter",onOk:async()=>{await x()&&e.remove()},children:s.jsxs(tt,{marginBottom:!1,marginTop:!0,children:[s.jsx(Ae,{autoFocus:!0,error:!!v.name,hint:v.name,maxLength:191,placeholder:"Weekly roundup",title:"Name",value:f.name,onChange:T=>u(A=>({...A,name:T.target.value})),onKeyDown:()=>_("name")}),s.jsx($n,{maxLength:2e3,title:"Description",value:f.description,onChange:T=>u(A=>({...A,description:T.target.value}))}),s.jsx(st,{checked:f.optInExistingSubscribers,direction:"rtl",hint:f.optInExistingSubscribers?`This newsletter will be available to all members. Your ${M===void 0?"":Wg(M)} 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=>u(A=>({...A,optInExistingSubscribers:T.target.checked}))})]})})},PM=ye.create(LM),FM=({recommendation:e,animate:n})=>{const a=Zt(),{updateRoute:o,route:c}=Qe(),{mutateAsync:m}=W_(),y=ot(),{formState:h,updateForm:l,handleSave:f,saveState:u,errors:p,clearError:x,setErrors:v}=kr({initialState:{...e},onSave:async T=>{await m(T),a.remove(),xt({title:"Recommendation added",type:"success"}),Y_("Recommendation Added",{oneClickSubscribe:T.one_click_subscribe}),o("recommendations")},onSaveError:y,onValidate:T=>q_(T)});let _="Add",k=!1;u==="saving"?k=!0:u==="saved"&&(_="Added");let M={label:"Back",icon:"arrow-left",iconColorClass:"text-black dark:text-white",link:!0,size:"sm",onClick:()=>{u!=="saving"&&(a.remove(),ye.show(tx,{pathName:c,animate:!1,recommendation:{...h}}))}};return s.jsx(yt,{afterClose:()=>{o("recommendations")},animate:n??!0,backDropClick:!1,cancelLabel:"Cancel",dirty:!0,leftButtonProps:M,okColor:"black",okLabel:_,okLoading:k,size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",stickyFooter:!0,onCancel:()=>{u!=="saving"&&(a.remove(),o("recommendations"))},onOk:async()=>{if(u!=="saving"){Ug();try{await f({force:!0})}catch{xt({type:"error",title:"Something went wrong when adding this recommendation, please try again."})}}},children:s.jsx(G_,{clearError:x,errors:p,formState:h,setErrors:v,showURL:!1,updateForm:l})})},UM=ye.create(FM),Xh=e=>Bi(e).save||"",zM=function(e,n){try{new URL(n).hostname.includes(".")?delete e.url:e.url="Enter a valid URL"}catch{e.url="Enter a valid URL"}return e},HM=({searchParams:e,recommendation:n,animate:a})=>{const[o,c]=D.useState(!1),m=Zt(),{updateRoute:y}=Qe(),{mutateAsync:h}=X_(),l=n?"":e?.get("url")??"",{save:f}=l?Bi(l):{save:""},u=at.useRef(!1),[p,x]=at.useState(!!f),{formState:v,updateForm:_,handleSave:k,errors:M,saveState:T,clearError:A}=kr({initialState:n??{title:"",url:f||"",description:"",excerpt:null,featured_image:null,favicon:null,one_click_subscribe:!1},onSave:async()=>{let O;O=new URL(v.url);const $=O.hostname.replace("www.",""),W={...v,url:O.toString()},{recommendations:R=[]}=await h(O);if(!R||R.length===0)return;const Z=R[0];if(Z.id)throw new ah("A recommendation with this URL already exists.");W.title=Z.title??$,W.excerpt=Z.excerpt??W.excerpt,W.featured_image=Z.featured_image??W.featured_image??null,W.favicon=Z.favicon??W.favicon??null,W.one_click_subscribe=Z.one_click_subscribe??W.one_click_subscribe??!1,W.description=W.excerpt||null,m.remove(),ye.show(UM,{animate:!1,recommendation:W})},onValidate:()=>{const O={};return zM(O,v.url),p&&x(Object.keys(O).length===0),O}}),C=at.useCallback(async()=>{if(T!=="saving"){Ug();try{if(await k({force:!0}))return}catch(O){const $=O instanceof ah?O.message:"Something went wrong while checking this URL, please try again.";xt({type:"error",title:$})}p&&x(!1)}},[k,T,p,x]);return at.useEffect(()=>{p&&!u.current&&(u.current=!0,C())},[p,C]),D.useEffect(()=>{o&&(C(),c(!1))},[v]),p?s.jsx(yt,{afterClose:()=>{y("recommendations")},animate:a??!0,backDropClick:!1,footer:!1,header:!1,size:"sm",children:s.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:s.jsx(Wi,{})})}):s.jsxs(yt,{afterClose:()=>{y("recommendations")},animate:a??!0,backDropClick:!1,okColor:"black",okLabel:"Next",okLoading:T==="saving",size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",onOk:C,children:[s.jsxs("p",{className:"mt-4",children:["You can recommend ",s.jsx("strong",{children:"any site"})," your audience will find valuable, not just those published on Ghost."]}),s.jsx(tt,{marginBottom:!1,marginTop:!0,children:s.jsx(Ae,{autoFocus:!0,error:!!M.url,hint:M.url||s.jsxs(s.Fragment,{children:["Need inspiration? ",s.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:v.url,onBlur:()=>{const O=Xh(v.url);_($=>({...$,url:O}))},onChange:O=>{A?.("url"),_($=>({...$,url:O.target.value}))},onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),_($=>({...$,url:Xh(v.url)})),c(!0))}})})]})},tx=ye.create(HM);function BM(e,n){let a;return function(...c){const m=()=>{clearTimeout(a),e(...c)};clearTimeout(a),a=setTimeout(m,n)}}const pd=({generateContent:e,className:n,height:a,width:o,parentClassName:c,testId:m,addDelay:y=!1})=>{const[h,l]=D.useState(0),f=[D.useRef(null),D.useRef(null)],[u,p]=D.useState(0);return D.useEffect(()=>{const x=h===0?1:0,v=f[x].current;if(v){e(v);const _=()=>{y?setTimeout(()=>{l(x)},500):l(x)};return v.addEventListener("load",_),()=>{v.removeEventListener("load",_)}}},[e]),D.useEffect(()=>{const x=f[h].current,v=BM(()=>{p(x?.contentWindow?.scrollY||0)},250);return x?.contentWindow?.addEventListener("scroll",v),()=>{x?.contentWindow?.removeEventListener("scroll",v)}},[h,f]),D.useEffect(()=>{const x=f[h].current;if(x)try{x.contentWindow?.scrollTo(0,u)}catch(v){m_(v)}},[u,h,f]),s.jsxs("div",{className:c,"data-testid":m,children:[s.jsx("iframe",{ref:f[0],className:`${n} ${h!==0?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===0,frameBorder:"0",height:a,title:"Buffered Preview 1",width:o}),s.jsx("iframe",{ref:f[1],className:`${n} ${h!==1?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===1,frameBorder:"0",height:a,title:"Buffered Preview 2",width:o})]})},WM=(e,n,a)=>{const o=new URLSearchParams;return o.append("announcement_bg",e||"accent"),o.append("announcement",n||""),a&&a.length>0&&o.append("announcement_vis",a?.join(",")||""),o.toString()},qM=({announcementBackgroundColor:e,announcementContent:n,url:a,visibility:o})=>{const c=D.useMemo(()=>o,[o?.join(",")]),m=D.useCallback(y=>{a&&fetch(a,{method:"POST",headers:{"Content-Type":"text/html;charset=utf-8","x-ghost-preview":WM(e,n,c),Accept:"text/plain"},mode:"cors",credentials:"include"}).then(h=>h.text()).then(h=>{const l="html { pointer-events: none; }",u=new DOMParser().parseFromString(h,"text/html"),p=u.querySelector("style"),x=p.innerHTML;p.innerHTML=`${x}
|
|
1
|
+
import{j as s,r as D,aH as we,e as at,d7 as i_,av as $g,aq as l_,ar as c_,as as Lg,aw as u_,au as Vi,aE as Kf,ax as f_,ay as Sf,az as d_,aF as p_,aG as h_,d8 as ut,ad as ns,bM as ot,d9 as no,da as Rn,db as gt,dc as xt,cF as Pg,cW as Fg,dd as Ug,de as ah,df as m_,dg as ln,dh as g_,di as ts,aB as x_,dj as b_,d6 as Zf,d5 as Hs,dk as Ha,ak as v_,aN as w_,dl as y_,dm as Qi,dn as Vf,dp as oh,dq as dr,dr as Za,ds as Nf,dt as __,du as Ws,dv as k_,dw as M_,dx as j_,dy as Hi,dz as E_,dA as T_,dB as Af,ac as S_,dC as N_,dD as A_,dE as I_,dF as C_,dG as Nn,dH as ih,dI as lh,dJ as D_}from"./index-f5Lv9kLb.js";import{H as bt,a as Gr,S as Va,B as Ue,x as Ji,K as R_,y as Zt,z as O_,A as Lt,M as yt,C as an,F as $_,G as Dn,J as zg,O as L_,Q as el,U as ye,V as Qe,W as P_,X as Qf,Y as Je,Z as cn,_ as On,$ as Et,a0 as Nt,a1 as ss,a2 as kr,a3 as F_,a4 as ch,a5 as tt,a6 as Ae,a7 as uh,a8 as fh,a9 as st,aa as Hg,ab as Bg,ac as U_,ad as z_,ae as H_,af as B_,ag as Ys,ah as Gs,ai as Xr,aj as $n,ak as Wg,al as W_,am as q_,an as Y_,ao as G_,ap as X_,aq as Bi,ar as Wi,as as K_,at as dh,au as ph,av as Z_,aw as Xs,ax as un,ay as on,az as qg,aA as V_,aB as Q_,aC as J_,aD as Yg,aE as Jf,aF as e2,aG as t2,aH as r2,aI as qi,aJ as ed,aK as n2,aL as td,aM as s2,aN as a2,aO as Gg,aP as Xg,aQ as rd,aR as o2,aS as i2,aT as l2,aU as Kg,aV as Zg,aW as c2,aX as u2,aY as hh,aZ as Vg,a_ as Qg,a$ as Jg,b0 as If,b1 as f2,b2 as d2,b3 as p2,b4 as e0,b5 as h2,b6 as m2,b7 as g2,b8 as t0,b9 as x2,ba as b2,bb as v2,bc as r0,bd as nd,be as w2,bf as sd,bg as y2,bh as _2,bi as n0,bj as k2,bk as s0,bl as M2,bm as j2,bn as E2}from"./settings-BqaVcJee.js";import{a as T2,u as a0,b as o0}from"./newsletters-D78pgnas.js";import{C as S2,a as N2}from"./index-g4BWcHhl.js";import{u as i0}from"./posts-C1Eh5Ypq.js";import{a as so,b as ad,c as A2,g as od}from"./tiers-tc5tafWV.js";import"./index-DO76vL0R.js";function I2(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const l0=({children:e,...n})=>s.jsx("div",{className:"flex h-full w-full flex-col px-8",...n,children:s.jsx("div",{className:"h-full w-full overflow-hidden rounded-t-[4px] shadow-sm",children:e})}),c0=({children:e,...n})=>s.jsx("div",{className:"flex h-[775px] w-[380px] flex-col rounded-3xl bg-white p-2 shadow-xl dark:bg-grey-900",...n,children:s.jsx("div",{className:"w-100 h-100 grow overflow-auto rounded-2xl border border-grey-100 dark:border-grey-950",children:e})}),C2=({title:e,label:n,value:a,onChange:o,disabled:c,error:m,hint:y,checked:h,separator:l,testId:f})=>{const u=D.useId(),p=x=>{o(x===!0)};return s.jsxs("div",{children:[s.jsxs("div",{className:`flex flex-col gap-1 ${l&&"pb-2"}`,children:[e&&s.jsx(bt,{grey:!0,level:6,children:e}),s.jsxs("label",{className:`flex cursor-pointer items-start ${e&&"-mb-1 mt-1"}`,htmlFor:u,children:[s.jsx(S2,{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-none data-[state=checked]:border-black data-[state=indeterminate]:border-black data-[state=checked]:bg-black data-[state=indeterminate]:bg-black","data-testid":f,defaultChecked:h,disabled:c,id:u,value:a,onCheckedChange:p,children:s.jsx(N2,{children:s.jsx("svg",{fill:"none",height:"11",viewBox:"0 0 10 11",width:"10",children:s.jsx("path",{d:"M1 5.88889L4.6 9L9 1",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})})}),s.jsxs("div",{className:`ml-2 flex flex-col ${y&&"mb-2"}`,children:[s.jsx("span",{className:`inline-block text-[1.425rem] dark:text-white ${y&&"-mb-1"}`,children:n}),y&&s.jsx(Gr,{color:m?"red":"",children:y})]})]})]}),(l||m)&&s.jsx(Va,{className:m?"border-red":""})]})},Cf=({title:e,checkboxes:n,hint:a,error:o})=>s.jsxs("div",{children:[e&&s.jsx(bt,{grey:!0,level:6,children:e}),s.jsx("div",{className:"mt-2 flex flex-col gap-1",children:n?.map(({key:c,...m})=>s.jsx(C2,{...m},c))}),s.jsx("div",{className:`flex flex-col ${a&&"mb-2"}`,children:a&&s.jsx(Gr,{color:o?"red":"",children:a})})]}),D2=({hex:e,value:n,title:a,size:o="md",isSelected:c,onSelect:m})=>{const y=D.useRef(null),h=u=>{u.preventDefault(),m(n!==void 0?n:e)},l=e.length===4&&e[3]==="0"||e.length===8&&e.slice(6)==="00";let f="h-5 w-5";switch(o){case"lg":f="w-6 h-6";break}return s.jsx("button",{ref:y,className:we("relative flex shrink-0 cursor-pointer items-center rounded-full border border-grey-300 dark:border-grey-800",f,c&&"outline outline-2 outline-green"),style:{backgroundColor:e},title:a,type:"button",onClick:h,children:l&&s.jsx("div",{className:"absolute left-0 top-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})},u0=({title:e,value:n,swatches:a,swatchSize:o="md",onSwatchChange:c,onTogglePicker:m,isExpanded:y,picker:h=!0,containerClassName:l})=>{const f=a.find(p=>p.value===n||p.hex===n);l=we("flex flex-col gap-3");const u=y||!h;return s.jsxs("div",{className:l,children:[e&&s.jsx(bt,{useLabelTag:!0,children:e}),s.jsxs("div",{className:"flex gap-1",children:[u&&s.jsx("div",{className:"flex items-center gap-1",children:a.map(({customContent:p,...x})=>p?s.jsx(D.Fragment,{children:p},x.title):s.jsx(D2,{isSelected:f?.title===x.title,size:o,onSelect:c,...x},x.title))}),h&&s.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:m,children:[s.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%))]"}),f&&s.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:f.hex},children:f.hex==="transparent"&&s.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})}),!f&&n&&s.jsx("div",{className:"absolute inset-[3px] overflow-hidden rounded-full border border-white dark:border-grey-950",style:{backgroundColor:n},children:n==="transparent"&&s.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})]})]})]})};function Ks(){return(Ks=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e}).apply(this,arguments)}function tl(e,n){if(e==null)return{};var a,o,c={},m=Object.keys(e);for(o=0;o<m.length;o++)n.indexOf(a=m[o])>=0||(c[a]=e[a]);return c}function Qa(e){var n=D.useRef(e),a=D.useRef(function(o){n.current&&n.current(o)});return n.current=e,a.current}var Ja=function(e,n,a){return n===void 0&&(n=0),a===void 0&&(a=1),e>a?a:e<n?n:e},Xa=function(e){return"touches"in e},Df=function(e){return e&&e.ownerDocument.defaultView||self},mh=function(e,n,a){var o=e.getBoundingClientRect(),c=Xa(n)?(function(m,y){for(var h=0;h<m.length;h++)if(m[h].identifier===y)return m[h];return m[0]})(n.touches,a):n;return{left:Ja((c.pageX-(o.left+Df(e).pageXOffset))/o.width),top:Ja((c.pageY-(o.top+Df(e).pageYOffset))/o.height)}},gh=function(e){!Xa(e)&&e.preventDefault()},f0=at.memo(function(e){var n=e.onMove,a=e.onKey,o=tl(e,["onMove","onKey"]),c=D.useRef(null),m=Qa(n),y=Qa(a),h=D.useRef(null),l=D.useRef(!1),f=D.useMemo(function(){var v=function(M){gh(M),(Xa(M)?M.touches.length>0:M.buttons>0)&&c.current?m(mh(c.current,M,h.current)):k(!1)},_=function(){return k(!1)};function k(M){var T=l.current,A=Df(c.current),C=M?A.addEventListener:A.removeEventListener;C(T?"touchmove":"mousemove",v),C(T?"touchend":"mouseup",_)}return[function(M){var T=M.nativeEvent,A=c.current;if(A&&(gh(T),!(function(O,$){return $&&!Xa(O)})(T,l.current)&&A)){if(Xa(T)){l.current=!0;var C=T.changedTouches||[];C.length&&(h.current=C[0].identifier)}A.focus(),m(mh(A,T,h.current)),k(!0)}},function(M){var T=M.which||M.keyCode;T<37||T>40||(M.preventDefault(),y({left:T===39?.05:T===37?-.05:0,top:T===40?.05:T===38?-.05:0}))},k]},[y,m]),u=f[0],p=f[1],x=f[2];return D.useEffect(function(){return x},[x]),at.createElement("div",Ks({},o,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:c,onKeyDown:p,tabIndex:0,role:"slider"}))}),id=function(e){return e.filter(Boolean).join(" ")},d0=function(e){var n=e.color,a=e.left,o=e.top,c=o===void 0?.5:o,m=id(["react-colorful__pointer",e.className]);return at.createElement("div",{className:m,style:{top:100*c+"%",left:100*a+"%"}},at.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:n}}))},Yt=function(e,n,a){return n===void 0&&(n=0),a===void 0&&(a=Math.pow(10,n)),Math.round(a*e)/a},R2=function(e){return F2(Rf(e))},Rf=function(e){return e[0]==="#"&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Yt(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?Yt(parseInt(e.substring(6,8),16)/255,2):1}},O2=function(e){return P2(L2(e))},$2=function(e){var n=e.s,a=e.v,o=e.a,c=(200-n)*a/100;return{h:Yt(e.h),s:Yt(c>0&&c<200?n*a/100/(c<=100?c:200-c)*100:0),l:Yt(c/2),a:Yt(o,2)}},Of=function(e){var n=$2(e);return"hsl("+n.h+", "+n.s+"%, "+n.l+"%)"},L2=function(e){var n=e.h,a=e.s,o=e.v,c=e.a;n=n/360*6,a/=100,o/=100;var m=Math.floor(n),y=o*(1-a),h=o*(1-(n-m)*a),l=o*(1-(1-n+m)*a),f=m%6;return{r:Yt(255*[o,h,y,y,l,o][f]),g:Yt(255*[l,o,o,h,y,y][f]),b:Yt(255*[y,y,l,o,o,h][f]),a:Yt(c,2)}},Di=function(e){var n=e.toString(16);return n.length<2?"0"+n:n},P2=function(e){var n=e.r,a=e.g,o=e.b,c=e.a,m=c<1?Di(Yt(255*c)):"";return"#"+Di(n)+Di(a)+Di(o)+m},F2=function(e){var n=e.r,a=e.g,o=e.b,c=e.a,m=Math.max(n,a,o),y=m-Math.min(n,a,o),h=y?m===n?(a-o)/y:m===a?2+(o-n)/y:4+(n-a)/y:0;return{h:Yt(60*(h<0?h+6:h)),s:Yt(m?y/m*100:0),v:Yt(m/255*100),a:c}},U2=at.memo(function(e){var n=e.hue,a=e.onChange,o=id(["react-colorful__hue",e.className]);return at.createElement("div",{className:o},at.createElement(f0,{onMove:function(c){a({h:360*c.left})},onKey:function(c){a({h:Ja(n+360*c.left,0,360)})},"aria-label":"Hue","aria-valuenow":Yt(n),"aria-valuemax":"360","aria-valuemin":"0"},at.createElement(d0,{className:"react-colorful__hue-pointer",left:n/360,color:Of({h:n,s:100,v:100,a:1})})))}),z2=at.memo(function(e){var n=e.hsva,a=e.onChange,o={backgroundColor:Of({h:n.h,s:100,v:100,a:1})};return at.createElement("div",{className:"react-colorful__saturation",style:o},at.createElement(f0,{onMove:function(c){a({s:100*c.left,v:100-100*c.top})},onKey:function(c){a({s:Ja(n.s+100*c.left,0,100),v:Ja(n.v-100*c.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Yt(n.s)+"%, Brightness "+Yt(n.v)+"%"},at.createElement(d0,{className:"react-colorful__saturation-pointer",top:1-n.v/100,left:n.s/100,color:Of(n)})))}),p0=function(e,n){if(e===n)return!0;for(var a in e)if(e[a]!==n[a])return!1;return!0},H2=function(e,n){return e.toLowerCase()===n.toLowerCase()||p0(Rf(e),Rf(n))};function B2(e,n,a){var o=Qa(a),c=D.useState(function(){return e.toHsva(n)}),m=c[0],y=c[1],h=D.useRef({color:n,hsva:m});D.useEffect(function(){if(!e.equal(n,h.current.color)){var f=e.toHsva(n);h.current={hsva:f,color:n},y(f)}},[n,e]),D.useEffect(function(){var f;p0(m,h.current.hsva)||e.equal(f=e.fromHsva(m),h.current.color)||(h.current={hsva:m,color:f},o(f))},[m,e,o]);var l=D.useCallback(function(f){y(function(u){return Object.assign({},u,f)})},[]);return[m,l]}var W2=typeof window<"u"?D.useLayoutEffect:D.useEffect,q2=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},xh=new Map,Y2=function(e){W2(function(){var n=e.current?e.current.ownerDocument:document;if(n!==void 0&&!xh.has(n)){var a=n.createElement("style");a.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}`,xh.set(n,a);var o=q2();o&&a.setAttribute("nonce",o),n.head.appendChild(a)}},[])},G2=function(e){var n=e.className,a=e.colorModel,o=e.color,c=o===void 0?a.defaultColor:o,m=e.onChange,y=tl(e,["className","colorModel","color","onChange"]),h=D.useRef(null);Y2(h);var l=B2(a,c,m),f=l[0],u=l[1],p=id(["react-colorful",n]);return at.createElement("div",Ks({},y,{ref:h,className:p}),at.createElement(z2,{hsva:f,onChange:u}),at.createElement(U2,{hue:f.h,onChange:u,className:"react-colorful__last-control"}))},X2={defaultColor:"000",toHsva:R2,fromHsva:function(e){return O2({h:e.h,s:e.s,v:e.v,a:1})},equal:H2},K2=function(e){return at.createElement(G2,Ks({},e,{colorModel:X2}))},Z2=/^#?([0-9A-F]{3,8})$/i,V2=function(e){var n=e.color,a=n===void 0?"":n,o=e.onChange,c=e.onBlur,m=e.escape,y=e.validate,h=e.format,l=e.process,f=tl(e,["color","onChange","onBlur","escape","validate","format","process"]),u=D.useState(function(){return m(a)}),p=u[0],x=u[1],v=Qa(o),_=Qa(c),k=D.useCallback(function(T){var A=m(T.target.value);x(A),y(A)&&v(l?l(A):A)},[m,l,y,v]),M=D.useCallback(function(T){y(T.target.value)||x(m(a)),_(T)},[a,m,y,_]);return D.useEffect(function(){x(m(a))},[a,m]),at.createElement("input",Ks({},f,{value:h?h(p):p,spellCheck:"false",onChange:k,onBlur:M}))},bh=function(e){return"#"+e},Q2=function(e){var n=e.prefixed,a=e.alpha,o=tl(e,["prefixed","alpha"]),c=D.useCallback(function(y){return y.replace(/([^0-9A-F]+)/gi,"").substring(0,a?8:6)},[a]),m=D.useCallback(function(y){return(function(h,l){var f=Z2.exec(h),u=f?f[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(y,a)},[a]);return at.createElement(V2,Ks({},o,{escape:c,format:n?bh:void 0,process:bh,validate:m}))};const J2=({hexValue:e,eyedropper:n,clearButtonValue:a,containerClassName:o,onChange:c})=>{const m=D.useRef(null),y=D.useCallback(x=>{var v,_,k;x.stopPropagation();const M=(v=m.current)==null?void 0:v.querySelector("input");x.target!==M&&((k=(_=m.current)==null?void 0:_.querySelector("input"))==null||k.focus(),x.preventDefault())},[]),h=D.useRef(!1),l=D.useCallback(()=>{var x,v;h.current=!1,(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus(),document.removeEventListener("mouseup",l),document.removeEventListener("touchend",l)},[]),f=D.useCallback(()=>{h.current=!0,document.addEventListener("mouseup",l),document.addEventListener("touchend",l)},[l]),u=D.useCallback(x=>{if(x.preventDefault(),!window.EyeDropper)return;h.current=!0,document.body.style.setProperty("pointer-events","none"),new window.EyeDropper().open().then(_=>c?.(_.sRGBHex)).finally(()=>{var _,k;h.current=!1,document.body.style.removeProperty("pointer-events"),(k=(_=m.current)==null?void 0:_.querySelector("input"))==null||k.focus()})},[c]);D.useEffect(()=>{var x,v;(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus()},[]);const p=D.useCallback(()=>{var x,v;(v=(x=m.current)==null?void 0:x.querySelector("input"))==null||v.focus()},[]);return o=we("mt-2",o),s.jsxs("div",{className:o,onMouseDown:y,onTouchStart:y,children:[s.jsx(K2,{className:"w-full",color:e||"#ffffff",onChange:c,onMouseDown:f,onTouchStart:f}),s.jsxs("div",{className:"mt-3 flex gap-2",children:[s.jsxs("div",{ref:m,className:"peer relative order-2 flex h-10 w-full items-center",onClick:p,children:[s.jsx("span",{className:"absolute left-2 top-[9px] z-10 ml-1 mr-2 text-grey-700",children:"#"}),s.jsx(Q2,{"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:e,onChange:c}),n&&!!window.EyeDropper&&s.jsx("button",{className:"absolute inset-y-0 right-3 z-50 my-auto h-4 w-4 p-[1px]",type:"button",onClick:u,children:s.jsx(i_,{className:"h-full w-full"})})]}),a!==void 0&&s.jsx(Ue,{color:"grey",value:"Clear",onClick:()=>c?.(a)})]})]})},e3=D.createContext({colorPickers:[]}),vh=e=>e.length===4?e.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3"):e,Yr=({testId:e,title:n,direction:a,value:o,hint:c,error:m,eyedropper:y,clearButtonValue:h,onChange:l,swatches:f=[],alwaysOpen:u=!1,debounceMs:p})=>{const[x,v]=D.useState(!1),[_,k]=D.useState(o),M=D.useContext(e3),T=D.useId();D.useEffect(()=>{k(W=>vh(W||"")===o?W:o)},[o]),D.useEffect(()=>(M.colorPickers.push({id:T,setExpanded:v}),()=>{M.colorPickers=M.colorPickers.filter(W=>W.id!==T)}),[M,T]),D.useEffect(()=>{if(x){M.colorPickers.filter(R=>R.id!==T).forEach(R=>R.setExpanded(!1));const W=()=>{v(!1)};return document.addEventListener("click",W),()=>{document.removeEventListener("click",W)}}},[M,T,x]);const A=D.useMemo(()=>l&&p?Ji(l,p):l,[p,l]),C=W=>{k(W),A?.(W?vh(W):null)};let O=s.jsx(u0,{isExpanded:x,swatches:f,value:_,onSwatchChange:W=>{C(W),v(!1)},onTogglePicker:()=>!u&&v(!x)});n&&(O=s.jsxs("div",{className:we("flex w-full cursor-pointer items-start first:mt-0 dark:text-white",a==="rtl"&&"flex-row-reverse"),children:[s.jsx("div",{className:"shrink-0",children:O}),s.jsxs("div",{className:we("flex-1",a==="rtl"?"pr-2":"pl-2",c?"mt-[-2px]":"mt-[1px]"),onClick:()=>!u&&v(!x),children:[n,c&&s.jsx("div",{className:`text-xs ${m?"text-red":"text-grey-700"}`,children:c})]})]}));const $=f.find(W=>W.value===_);return s.jsxs("div",{className:"flex-col","data-testid":e,onClick:W=>W.stopPropagation(),children:[O,(u||x)&&s.jsx(J2,{clearButtonValue:h,eyedropper:y,hexValue:$?.hex||_||void 0,onChange:C})]})},t3=({value:e,onChange:n,singleParagraph:a=!0,...o})=>{const c=D.useCallback(m=>{const h=new DOMParser().parseFromString(m,"text/html");h.querySelectorAll("*").forEach(f=>{f.style.removeProperty("white-space"),f.getAttribute("style")||f.removeAttribute("style")}),h.body.innerHTML!==e&&n?.(h.body.innerHTML)},[e,n]);return s.jsx(R_,{...o,singleParagraph:a,children:m=>s.jsx(m.HtmlOutputPlugin,{html:e,setHtml:c})})},ld=({title:e,hideTitle:n,error:a,hint:o,value:c,clearBg:m=!1,className:y="",containerClassName:h="",hintClassName:l="",unstyled:f=!1,...u})=>{const p=f?"":we("flex min-h-[32px] items-center rounded-md border border-transparent py-1.5 md:min-h-[36px]",m?"bg-transparent":"bg-grey-150 px-3 dark:bg-grey-900",a?"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",e&&!n&&!m&&"mt-2",y);return s.jsxs("div",{className:`flex flex-col ${h}`,children:[e&&s.jsx(bt,{className:n?"sr-only":"",grey:!0,useLabelTag:!0,children:e}),s.jsx("div",{className:p,children:s.jsx(t3,{...u,value:c})}),o&&s.jsx(Gr,{className:l,color:a?"red":"",children:o})]})};var cd="Radio",[r3,h0]=Lg(cd),[n3,s3]=r3(cd),m0=D.forwardRef((e,n)=>{const{__scopeRadio:a,name:o,checked:c=!1,required:m,disabled:y,value:h="on",onCheck:l,form:f,...u}=e,[p,x]=D.useState(null),v=Kf(n,M=>x(M)),_=D.useRef(!1),k=p?f||!!p.closest("form"):!0;return s.jsxs(n3,{scope:a,checked:c,disabled:y,children:[s.jsx(Vi.button,{type:"button",role:"radio","aria-checked":c,"data-state":v0(c),"data-disabled":y?"":void 0,disabled:y,value:h,...u,ref:v,onClick:Sf(e.onClick,M=>{c||l?.(),k&&(_.current=M.isPropagationStopped(),_.current||M.stopPropagation())})}),k&&s.jsx(b0,{control:p,bubbles:!_.current,name:o,value:h,checked:c,required:m,disabled:y,form:f,style:{transform:"translateX(-100%)"}})]})});m0.displayName=cd;var g0="RadioIndicator",x0=D.forwardRef((e,n)=>{const{__scopeRadio:a,forceMount:o,...c}=e,m=s3(g0,a);return s.jsx(d_,{present:o||m.checked,children:s.jsx(Vi.span,{"data-state":v0(m.checked),"data-disabled":m.disabled?"":void 0,...c,ref:n})})});x0.displayName=g0;var a3="RadioBubbleInput",b0=D.forwardRef(({__scopeRadio:e,control:n,checked:a,bubbles:o=!0,...c},m)=>{const y=D.useRef(null),h=Kf(y,m),l=p_(a),f=h_(n);return D.useEffect(()=>{const u=y.current;if(!u)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(l!==a&&v){const _=new Event("click",{bubbles:o});v.call(u,a),u.dispatchEvent(_)}},[l,a,o]),s.jsx(Vi.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...c,tabIndex:-1,ref:h,style:{...c.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});b0.displayName=a3;function v0(e){return e?"checked":"unchecked"}var o3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],rl="RadioGroup",[i3]=Lg(rl,[$g,h0]),w0=$g(),y0=h0(),[l3,c3]=i3(rl),_0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,name:o,defaultValue:c,value:m,required:y=!1,disabled:h=!1,orientation:l,dir:f,loop:u=!0,onValueChange:p,...x}=e,v=w0(a),_=l_(f),[k,M]=c_({prop:m,defaultProp:c??null,onChange:p,caller:rl});return s.jsx(l3,{scope:a,name:o,required:y,disabled:h,value:k,onValueChange:M,children:s.jsx(u_,{asChild:!0,...v,orientation:l,dir:_,loop:u,children:s.jsx(Vi.div,{role:"radiogroup","aria-required":y,"aria-orientation":l,"data-disabled":h?"":void 0,dir:_,...x,ref:n})})})});_0.displayName=rl;var k0="RadioGroupItem",M0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,disabled:o,...c}=e,m=c3(k0,a),y=m.disabled||o,h=w0(a),l=y0(a),f=D.useRef(null),u=Kf(n,f),p=m.value===c.value,x=D.useRef(!1);return D.useEffect(()=>{const v=k=>{o3.includes(k.key)&&(x.current=!0)},_=()=>x.current=!1;return document.addEventListener("keydown",v),document.addEventListener("keyup",_),()=>{document.removeEventListener("keydown",v),document.removeEventListener("keyup",_)}},[]),s.jsx(f_,{asChild:!0,...h,focusable:!y,active:p,children:s.jsx(m0,{disabled:y,required:m.required,checked:p,...l,...c,name:m.name,ref:u,onCheck:()=>m.onValueChange(c.value),onKeyDown:Sf(v=>{v.key==="Enter"&&v.preventDefault()}),onFocus:Sf(c.onFocus,()=>{x.current&&f.current?.click()})})})});M0.displayName=k0;var u3="RadioGroupIndicator",j0=D.forwardRef((e,n)=>{const{__scopeRadioGroup:a,...o}=e,c=y0(a);return s.jsx(x0,{...c,...o,ref:n})});j0.displayName=u3;var f3=_0,d3=M0,p3=j0;const h3=({id:e,title:n,options:a,onSelect:o,error:c,hint:m,selectedOption:y,separator:h})=>s.jsxs(f3,{defaultValue:y,name:e,onValueChange:o,children:[s.jsxs("div",{className:`flex flex-col gap-2 ${h&&"pb-2"}`,children:[n&&s.jsx(bt,{level:6,children:n}),a.map(l=>s.jsxs("label",{className:`flex cursor-pointer items-start ${n&&"-mb-1 mt-1"}`,htmlFor:l.value,children:[s.jsx(d3,{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:outline-none focus:ring-0 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:l.value,value:l.value,children:s.jsx(p3,{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"})}),s.jsxs("div",{className:`ml-2 flex flex-col ${l.hint&&"mb-2"}`,children:[s.jsx("span",{className:`inline-block text-md dark:text-white ${l.hint&&"-mb-1"}`,children:l.label}),l.hint&&s.jsx(Gr,{children:l.hint})]})]},l.value)),m&&s.jsx(Gr,{color:c?"red":"",children:m})]}),(h||c)&&s.jsx(Va,{className:c?"border-red":""})]}),Yi=({children:e,gap:n="md",className:a})=>{let o="gap-3";switch(n){case"sm":o="gap-2";break;case"md":o="gap-3";break;case"lg":o="gap-4";break}return a=we("flex flex-col",o,a),s.jsx("div",{className:a,children:e})},ud=({heading:e,children:n,className:a})=>(a=we("w-full p-[8vmin] pt-5",a),s.jsxs("div",{className:a,children:[e&&s.jsx(bt,{className:"mb-8",children:e}),n]})),fd=({items:e,backIcon:n=!1,snapBackIcon:a=!0,onBack:o,containerClassName:c,itemClassName:m,activeItemClassName:y,separatorClassName:h})=>{const l=e.length;let f=0;return c=we("flex items-center gap-2 text-sm",c),y=we("font-bold",y),m=we("text-sm",m),s.jsxs("div",{className:c,children:[n&&s.jsx(Ue,{className:a?"mr-1":"mr-6",icon:"arrow-left",iconColorClass:"dark:text-white",size:"sm",link:!0,onClick:o}),e.map(u=>{const p=f===l-1?s.jsx("span",{className:y,children:u.label}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`${m} ${u.onClick&&"-mx-1 cursor-pointer rounded-sm px-1 py-px hover:bg-grey-100 dark:hover:bg-grey-900"}`,type:"button",onClick:u.onClick,children:u.label},`bc-${f}`),s.jsx("span",{className:h,children:"/"})]});return f=f+1,p})]})},Zs=({testId:e,title:n,titleHeadingLevel:a=4,size:o="full",width:c,height:m,sidebar:y="",preview:h,dirty:l=!1,cancelLabel:f="Cancel",okLabel:u="OK",okColor:p="black",previewToolbar:x=!0,leftToolbar:v=!0,rightToolbar:_=!0,deviceSelector:k=!0,siteLink:M,previewToolbarURLs:T,previewBgColor:A="grey",selectedURL:C,previewToolbarTabs:O,previewToolbarBreadcrumbs:$,buttonsDisabled:W,sidebarButtons:R,sidebarHeader:Z,sidebarPadding:X=!0,sidebarContentClasses:q,enableCMDS:B=!0,backDropClick:Y,onCancel:ae,onOk:ee,afterClose:re,onSelectURL:Q,onSelectDesktopView:ne,onSelectMobileView:be,onBreadcrumbsBack:je})=>{const H=Zt(),{setGlobalDirtyState:he}=O_();D.useEffect(()=>{he(l)},[l,he]),D.useEffect(()=>{if(ee){const J=xe=>{(xe.metaKey||xe.ctrlKey)&&xe.key==="s"&&(xe.preventDefault(),ee())};if(B)return window.addEventListener("keydown",J),()=>{window.removeEventListener("keydown",J)}}});const[ge,F]=D.useState("desktop");if(ge==="mobile"&&k?h=s.jsx(c0,{"data-testid":"preview-mobile",children:h}):ge==="desktop"&&k&&(h=s.jsx(l0,{"data-testid":"preview-desktop",children:h})),x){let J=s.jsx(s.Fragment,{});T?J=s.jsx(Lt,{options:T,selectedOption:T.find(Ie=>Ie.value===C),onSelect:Ie=>Ie&&Q?.(Ie.value)}):O?J=s.jsx(Dn,{border:!1,selectedTab:C,tabs:O,width:"wide",onTabChange:Q}):$&&(J=s.jsx(fd,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:$,separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:je}));const xe="text-black dark:text-green",Te="text-grey-500 dark:text-grey-600",De=[{icon:"laptop",label:"Desktop",hideLabel:!0,link:!0,size:"sm",iconColorClass:ge==="desktop"?xe:Te,onClick:ne||(()=>{F("desktop")})},{icon:"mobile",label:"Mobile",hideLabel:!0,link:!0,size:"sm",iconColorClass:ge==="mobile"?xe:Te,onClick:be||(()=>{F("mobile")})}],Me=k&&s.jsx(an,{buttons:De});let oe="";A==="grey"?oe="bg-grey-50 dark:bg-black":A==="greygradient"&&(oe="bg-gradient-to-tr from-white to-[#f9f9fa] dark:from-grey-950 dark:to-black");const Ee=we("min-w-100 absolute inset-y-0 left-0 right-[400px] flex w-full grow flex-col overflow-y-auto",oe);let Ne;M&&(Ne=s.jsx("div",{className:"ml-3 border-l border-grey-400 dark:border-grey-800",children:s.jsxs("a",{className:"ml-3 flex items-center gap-1 text-sm",href:M,rel:"noopener noreferrer",target:"_blank",children:["View site ",s.jsx(ut,{name:"arrow-top-right",size:"xs"})]})})),h=s.jsxs("div",{className:Ee,children:[x&&s.jsxs("header",{className:"relative flex h-[80px] shrink-0 items-center justify-center px-8 py-5","data-testid":"design-toolbar",children:[v&&s.jsx("div",{className:"absolute left-8 flex h-full items-center",children:J}),_&&s.jsxs("div",{className:"absolute right-8 flex h-full items-center",children:[Me,Ne]})]}),s.jsx("div",{className:"flex grow items-center justify-center text-sm text-grey-400",children:h})]})}const L=[];return R||(L.push({key:"cancel-modal",label:f,onClick:ae||(()=>{$_(l,()=>{H.remove(),re?.()})}),disabled:W}),L.push({key:"ok-modal",label:u,color:p,onClick:ee,disabled:W})),s.jsx(yt,{afterClose:re,animate:!1,backDropClick:Y,dirty:l,footer:!1,height:m,padding:!1,size:o,testId:e,title:"",width:c,hideXOnMobile:!0,children:s.jsxs("div",{className:"flex h-full grow",children:[s.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}),y&&s.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:[Z||s.jsxs("div",{className:"flex max-h-[82px] items-center justify-between gap-3 px-7 py-6",children:[s.jsx(bt,{level:a,children:n}),R||s.jsx(an,{buttons:L})]}),s.jsx("div",{className:`${Z?"":"absolute inset-x-0 bottom-0 top-[80px] grow"} ${X&&"p-7 pt-0"} flex flex-col justify-between overflow-y-auto ${q&&q}`,children:y})]})]})})},m3=({offset:e,onTrigger:n})=>{const a=D.useRef(null);return D.useEffect(()=>{const o=new IntersectionObserver(c=>{c[0].intersectionRatio<=0||n()});return a.current&&o.observe(a.current),()=>o.disconnect()},[n]),s.jsx("div",{ref:a,className:"absolute w-full",style:{bottom:e}})},E0=({trigger:e,triggerButtonProps:n,items:a,position:o="start",open:c,setOpen:m})=>(e||(e=s.jsx(Ue,{icon:"ellipsis",label:"Menu",hideLabel:!0,...n})),s.jsx(zg,{open:c,position:o,setOpen:m,trigger:e,closeOnItemClick:!0,children:s.jsx("div",{className:"flex min-w-[160px] flex-col justify-stretch py-1",role:"none",children:a.map(y=>s.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 ${y.destructive&&" text-red-500"}`,type:"button",onClick:h=>{y.onClick&&y.onClick(h)},children:y.label},y.id))})}));var T0=typeof global=="object"&&global&&global.Object===Object&&global,g3=typeof self=="object"&&self&&self.Object===Object&&self,fn=T0||g3||Function("return this")(),qs=fn.Symbol,S0=Object.prototype,x3=S0.hasOwnProperty,b3=S0.toString,Ba=qs?qs.toStringTag:void 0;function v3(e){var n=x3.call(e,Ba),a=e[Ba];try{e[Ba]=void 0;var o=!0}catch{}var c=b3.call(e);return o&&(n?e[Ba]=a:delete e[Ba]),c}var w3=Object.prototype,y3=w3.toString;function _3(e){return y3.call(e)}var k3="[object Null]",M3="[object Undefined]",wh=qs?qs.toStringTag:void 0;function ao(e){return e==null?e===void 0?M3:k3:wh&&wh in Object(e)?v3(e):_3(e)}function eo(e){return e!=null&&typeof e=="object"}var Gi=Array.isArray;function N0(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var j3="[object AsyncFunction]",E3="[object Function]",T3="[object GeneratorFunction]",S3="[object Proxy]";function A0(e){if(!N0(e))return!1;var n=ao(e);return n==E3||n==T3||n==j3||n==S3}var ru=fn["__core-js_shared__"],yh=(function(){var e=/[^.]+$/.exec(ru&&ru.keys&&ru.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function N3(e){return!!yh&&yh in e}var A3=Function.prototype,I3=A3.toString;function as(e){if(e!=null){try{return I3.call(e)}catch{}try{return e+""}catch{}}return""}var C3=/[\\^$.*+?()[\]{}|]/g,D3=/^\[object .+?Constructor\]$/,R3=Function.prototype,O3=Object.prototype,$3=R3.toString,L3=O3.hasOwnProperty,P3=RegExp("^"+$3.call(L3).replace(C3,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function F3(e){if(!N0(e)||N3(e))return!1;var n=A0(e)?P3:D3;return n.test(as(e))}function U3(e,n){return e?.[n]}function Vs(e,n){var a=U3(e,n);return F3(a)?a:void 0}var $f=Vs(fn,"WeakMap"),z3=9007199254740991,H3=/^(?:0|[1-9]\d*)$/;function B3(e,n){var a=typeof e;return n=n??z3,!!n&&(a=="number"||a!="symbol"&&H3.test(e))&&e>-1&&e%1==0&&e<n}function I0(e,n){return e===n||e!==e&&n!==n}var W3=9007199254740991;function C0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=W3}function q3(e){return e!=null&&C0(e.length)&&!A0(e)}var Y3=Object.prototype;function G3(e){var n=e&&e.constructor,a=typeof n=="function"&&n.prototype||Y3;return e===a}function X3(e,n){for(var a=-1,o=Array(e);++a<e;)o[a]=n(a);return o}var K3="[object Arguments]";function _h(e){return eo(e)&&ao(e)==K3}var D0=Object.prototype,Z3=D0.hasOwnProperty,V3=D0.propertyIsEnumerable,Q3=_h((function(){return arguments})())?_h:function(e){return eo(e)&&Z3.call(e,"callee")&&!V3.call(e,"callee")};function J3(){return!1}var R0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kh=R0&&typeof module=="object"&&module&&!module.nodeType&&module,e8=kh&&kh.exports===R0,Mh=e8?fn.Buffer:void 0,t8=Mh?Mh.isBuffer:void 0,Lf=t8||J3,r8="[object Arguments]",n8="[object Array]",s8="[object Boolean]",a8="[object Date]",o8="[object Error]",i8="[object Function]",l8="[object Map]",c8="[object Number]",u8="[object Object]",f8="[object RegExp]",d8="[object Set]",p8="[object String]",h8="[object WeakMap]",m8="[object ArrayBuffer]",g8="[object DataView]",x8="[object Float32Array]",b8="[object Float64Array]",v8="[object Int8Array]",w8="[object Int16Array]",y8="[object Int32Array]",_8="[object Uint8Array]",k8="[object Uint8ClampedArray]",M8="[object Uint16Array]",j8="[object Uint32Array]",wt={};wt[x8]=wt[b8]=wt[v8]=wt[w8]=wt[y8]=wt[_8]=wt[k8]=wt[M8]=wt[j8]=!0;wt[r8]=wt[n8]=wt[m8]=wt[s8]=wt[g8]=wt[a8]=wt[o8]=wt[i8]=wt[l8]=wt[c8]=wt[u8]=wt[f8]=wt[d8]=wt[p8]=wt[h8]=!1;function E8(e){return eo(e)&&C0(e.length)&&!!wt[ao(e)]}function T8(e){return function(n){return e(n)}}var O0=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ka=O0&&typeof module=="object"&&module&&!module.nodeType&&module,S8=Ka&&Ka.exports===O0,nu=S8&&T0.process,jh=(function(){try{var e=Ka&&Ka.require&&Ka.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}})(),Eh=jh&&jh.isTypedArray,$0=Eh?T8(Eh):E8,N8=Object.prototype,A8=N8.hasOwnProperty;function I8(e,n){var a=Gi(e),o=!a&&Q3(e),c=!a&&!o&&Lf(e),m=!a&&!o&&!c&&$0(e),y=a||o||c||m,h=y?X3(e.length,String):[],l=h.length;for(var f in e)A8.call(e,f)&&!(y&&(f=="length"||c&&(f=="offset"||f=="parent")||m&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||B3(f,l)))&&h.push(f);return h}function C8(e,n){return function(a){return e(n(a))}}var D8=C8(Object.keys,Object),R8=Object.prototype,O8=R8.hasOwnProperty;function $8(e){if(!G3(e))return D8(e);var n=[];for(var a in Object(e))O8.call(e,a)&&a!="constructor"&&n.push(a);return n}function L8(e){return q3(e)?I8(e):$8(e)}var to=Vs(Object,"create");function P8(){this.__data__=to?to(null):{},this.size=0}function F8(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var U8="__lodash_hash_undefined__",z8=Object.prototype,H8=z8.hasOwnProperty;function B8(e){var n=this.__data__;if(to){var a=n[e];return a===U8?void 0:a}return H8.call(n,e)?n[e]:void 0}var W8=Object.prototype,q8=W8.hasOwnProperty;function Y8(e){var n=this.__data__;return to?n[e]!==void 0:q8.call(n,e)}var G8="__lodash_hash_undefined__";function X8(e,n){var a=this.__data__;return this.size+=this.has(e)?0:1,a[e]=to&&n===void 0?G8:n,this}function rs(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}rs.prototype.clear=P8;rs.prototype.delete=F8;rs.prototype.get=B8;rs.prototype.has=Y8;rs.prototype.set=X8;function K8(){this.__data__=[],this.size=0}function nl(e,n){for(var a=e.length;a--;)if(I0(e[a][0],n))return a;return-1}var Z8=Array.prototype,V8=Z8.splice;function Q8(e){var n=this.__data__,a=nl(n,e);if(a<0)return!1;var o=n.length-1;return a==o?n.pop():V8.call(n,a,1),--this.size,!0}function J8(e){var n=this.__data__,a=nl(n,e);return a<0?void 0:n[a][1]}function ek(e){return nl(this.__data__,e)>-1}function tk(e,n){var a=this.__data__,o=nl(a,e);return o<0?(++this.size,a.push([e,n])):a[o][1]=n,this}function dn(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}dn.prototype.clear=K8;dn.prototype.delete=Q8;dn.prototype.get=J8;dn.prototype.has=ek;dn.prototype.set=tk;var ro=Vs(fn,"Map");function rk(){this.size=0,this.__data__={hash:new rs,map:new(ro||dn),string:new rs}}function nk(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function sl(e,n){var a=e.__data__;return nk(n)?a[typeof n=="string"?"string":"hash"]:a.map}function sk(e){var n=sl(this,e).delete(e);return this.size-=n?1:0,n}function ak(e){return sl(this,e).get(e)}function ok(e){return sl(this,e).has(e)}function ik(e,n){var a=sl(this,e),o=a.size;return a.set(e,n),this.size+=a.size==o?0:1,this}function os(e){var n=-1,a=e==null?0:e.length;for(this.clear();++n<a;){var o=e[n];this.set(o[0],o[1])}}os.prototype.clear=rk;os.prototype.delete=sk;os.prototype.get=ak;os.prototype.has=ok;os.prototype.set=ik;function lk(e,n){for(var a=-1,o=n.length,c=e.length;++a<o;)e[c+a]=n[a];return e}function ck(){this.__data__=new dn,this.size=0}function uk(e){var n=this.__data__,a=n.delete(e);return this.size=n.size,a}function fk(e){return this.__data__.get(e)}function dk(e){return this.__data__.has(e)}var pk=200;function hk(e,n){var a=this.__data__;if(a instanceof dn){var o=a.__data__;if(!ro||o.length<pk-1)return o.push([e,n]),this.size=++a.size,this;a=this.__data__=new os(o)}return a.set(e,n),this.size=a.size,this}function Cn(e){var n=this.__data__=new dn(e);this.size=n.size}Cn.prototype.clear=ck;Cn.prototype.delete=uk;Cn.prototype.get=fk;Cn.prototype.has=dk;Cn.prototype.set=hk;function mk(e,n){for(var a=-1,o=e==null?0:e.length,c=0,m=[];++a<o;){var y=e[a];n(y,a,e)&&(m[c++]=y)}return m}function gk(){return[]}var xk=Object.prototype,bk=xk.propertyIsEnumerable,Th=Object.getOwnPropertySymbols,vk=Th?function(e){return e==null?[]:(e=Object(e),mk(Th(e),function(n){return bk.call(e,n)}))}:gk;function wk(e,n,a){var o=n(e);return Gi(e)?o:lk(o,a(e))}function Sh(e){return wk(e,L8,vk)}var Pf=Vs(fn,"DataView"),Ff=Vs(fn,"Promise"),Uf=Vs(fn,"Set"),Nh="[object Map]",yk="[object Object]",Ah="[object Promise]",Ih="[object Set]",Ch="[object WeakMap]",Dh="[object DataView]",_k=as(Pf),kk=as(ro),Mk=as(Ff),jk=as(Uf),Ek=as($f),In=ao;(Pf&&In(new Pf(new ArrayBuffer(1)))!=Dh||ro&&In(new ro)!=Nh||Ff&&In(Ff.resolve())!=Ah||Uf&&In(new Uf)!=Ih||$f&&In(new $f)!=Ch)&&(In=function(e){var n=ao(e),a=n==yk?e.constructor:void 0,o=a?as(a):"";if(o)switch(o){case _k:return Dh;case kk:return Nh;case Mk:return Ah;case jk:return Ih;case Ek:return Ch}return n});var Rh=fn.Uint8Array,Tk="__lodash_hash_undefined__";function Sk(e){return this.__data__.set(e,Tk),this}function Nk(e){return this.__data__.has(e)}function Xi(e){var n=-1,a=e==null?0:e.length;for(this.__data__=new os;++n<a;)this.add(e[n])}Xi.prototype.add=Xi.prototype.push=Sk;Xi.prototype.has=Nk;function Ak(e,n){for(var a=-1,o=e==null?0:e.length;++a<o;)if(n(e[a],a,e))return!0;return!1}function Ik(e,n){return e.has(n)}var Ck=1,Dk=2;function L0(e,n,a,o,c,m){var y=a&Ck,h=e.length,l=n.length;if(h!=l&&!(y&&l>h))return!1;var f=m.get(e),u=m.get(n);if(f&&u)return f==n&&u==e;var p=-1,x=!0,v=a&Dk?new Xi:void 0;for(m.set(e,n),m.set(n,e);++p<h;){var _=e[p],k=n[p];if(o)var M=y?o(k,_,p,n,e,m):o(_,k,p,e,n,m);if(M!==void 0){if(M)continue;x=!1;break}if(v){if(!Ak(n,function(T,A){if(!Ik(v,A)&&(_===T||c(_,T,a,o,m)))return v.push(A)})){x=!1;break}}else if(!(_===k||c(_,k,a,o,m))){x=!1;break}}return m.delete(e),m.delete(n),x}function Rk(e){var n=-1,a=Array(e.size);return e.forEach(function(o,c){a[++n]=[c,o]}),a}function Ok(e){var n=-1,a=Array(e.size);return e.forEach(function(o){a[++n]=o}),a}var $k=1,Lk=2,Pk="[object Boolean]",Fk="[object Date]",Uk="[object Error]",zk="[object Map]",Hk="[object Number]",Bk="[object RegExp]",Wk="[object Set]",qk="[object String]",Yk="[object Symbol]",Gk="[object ArrayBuffer]",Xk="[object DataView]",Oh=qs?qs.prototype:void 0,su=Oh?Oh.valueOf:void 0;function Kk(e,n,a,o,c,m,y){switch(a){case Xk:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case Gk:return!(e.byteLength!=n.byteLength||!m(new Rh(e),new Rh(n)));case Pk:case Fk:case Hk:return I0(+e,+n);case Uk:return e.name==n.name&&e.message==n.message;case Bk:case qk:return e==n+"";case zk:var h=Rk;case Wk:var l=o&$k;if(h||(h=Ok),e.size!=n.size&&!l)return!1;var f=y.get(e);if(f)return f==n;o|=Lk,y.set(e,n);var u=L0(h(e),h(n),o,c,m,y);return y.delete(e),u;case Yk:if(su)return su.call(e)==su.call(n)}return!1}var Zk=1,Vk=Object.prototype,Qk=Vk.hasOwnProperty;function Jk(e,n,a,o,c,m){var y=a&Zk,h=Sh(e),l=h.length,f=Sh(n),u=f.length;if(l!=u&&!y)return!1;for(var p=l;p--;){var x=h[p];if(!(y?x in n:Qk.call(n,x)))return!1}var v=m.get(e),_=m.get(n);if(v&&_)return v==n&&_==e;var k=!0;m.set(e,n),m.set(n,e);for(var M=y;++p<l;){x=h[p];var T=e[x],A=n[x];if(o)var C=y?o(A,T,x,n,e,m):o(T,A,x,e,n,m);if(!(C===void 0?T===A||c(T,A,a,o,m):C)){k=!1;break}M||(M=x=="constructor")}if(k&&!M){var O=e.constructor,$=n.constructor;O!=$&&"constructor"in e&&"constructor"in n&&!(typeof O=="function"&&O instanceof O&&typeof $=="function"&&$ instanceof $)&&(k=!1)}return m.delete(e),m.delete(n),k}var eM=1,$h="[object Arguments]",Lh="[object Array]",Ri="[object Object]",tM=Object.prototype,Ph=tM.hasOwnProperty;function rM(e,n,a,o,c,m){var y=Gi(e),h=Gi(n),l=y?Lh:In(e),f=h?Lh:In(n);l=l==$h?Ri:l,f=f==$h?Ri:f;var u=l==Ri,p=f==Ri,x=l==f;if(x&&Lf(e)){if(!Lf(n))return!1;y=!0,u=!1}if(x&&!u)return m||(m=new Cn),y||$0(e)?L0(e,n,a,o,c,m):Kk(e,n,l,a,o,c,m);if(!(a&eM)){var v=u&&Ph.call(e,"__wrapped__"),_=p&&Ph.call(n,"__wrapped__");if(v||_){var k=v?e.value():e,M=_?n.value():n;return m||(m=new Cn),c(k,M,a,o,m)}}return x?(m||(m=new Cn),Jk(e,n,a,o,c,m)):!1}function P0(e,n,a,o,c){return e===n?!0:e==null||n==null||!eo(e)&&!eo(n)?e!==e&&n!==n:rM(e,n,a,o,P0,c)}function nM(e,n){return P0(e,n)}const Fh=({className:e,children:n,colSpan:a,sticky:o=!1,...c})=>{const m=we("!py-2 !pl-0 !pr-6 text-left align-top",o&&"sticky top-0 bg-white",c.onClick&&"hover:cursor-pointer",e);return s.jsx("th",{className:m,colSpan:a,...c,children:s.jsx(bt,{className:"whitespace-nowrap",level:6,children:n})})},F0=({left:e,center:n,right:a,sticky:o=!0,containerClassName:c,children:m})=>{const y=we("z-50 h-22 min-h-[92px] p-8",!m&&"flex items-center justify-between gap-3",o&&"sticky top-0",c);if(!m){if(e){const h=we("flex flex-auto items-center",a&&n&&"basis-1/3",!a&&n&&"basis-1/2");e=s.jsx("div",{className:h,children:e})}if(n){const h=we("flex flex-auto items-center justify-center",e&&a&&"basis-1/3",(e&&!a||!e&&a)&&"basis-1/2");n=s.jsx("div",{className:h,children:n})}if(a){const h=we("flex flex-auto items-center justify-end",e&&n&&"basis-1/3",!e&&n&&"basis-1/2");a=s.jsx("div",{className:h,children:a})}}return s.jsx("div",{className:y,children:m||s.jsxs(s.Fragment,{children:[e,n,a]})})},U0=({items:e,setItems:n,blank:a,canAddNewItem:o})=>{const[c,m]=D.useState(e.map((x,v)=>({item:x,id:v.toString()}))),[y,h]=D.useState(a);return D.useEffect(()=>{const x=c.map(({item:v})=>v);o(y)&&x.push(y),nM(JSON.parse(JSON.stringify(x)),JSON.parse(JSON.stringify(e)))||n(x)},[c,y,e,n,o]),{items:c,updateItem:(x,v)=>{const _=c.map(k=>k.id===x?{...k,item:v}:k);m(_),n(_.map(k=>k.item))},addItem:()=>{if(o(y)){const x=c.reduce((_,k)=>Math.max(_,parseInt(k.id)),0),v=c.concat({item:y,id:(x+1).toString()});m(v),n(v.map(_=>_.item)),h(a)}},removeItem:x=>{const v=c.filter(_=>_.id!==x);m(v),n(v.map(_=>_.item))},moveItem:(x,v)=>{if(x!==v){const _=c.findIndex(T=>T.id===x),k=v?c.findIndex(T=>T.id===v):0,M=L_(c,_,k);m(M),n(M.map(T=>T.item))}},newItem:y,setNewItem:h}},sM=({label:e,text:n="",hint:a,onRegenerate:o})=>{const[c,m]=D.useState(!1),y=()=>{navigator.clipboard.writeText(n),m(!0),setTimeout(()=>m(!1),2e3)},h=we("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 s.jsxs("div",{className:"mb-3 grid grid-cols-1",children:[e&&s.jsx(bt,{level:6,grey:!0,children:e}),s.jsxs("div",{className:h,children:[s.jsx("span",{children:n}),a,s.jsxs("div",{className:"visible absolute right-0 top-1/2 flex translate-y-[-50%] gap-1 bg-white pl-1 text-sm group-hover/api-keys:visible md:invisible dark:bg-black",children:[o&&s.jsx(Ue,{color:"outline",label:"Regenerate",size:"sm",onClick:o}),s.jsx(Ue,{color:"outline",label:c?"Copied":"Copy",size:"sm",onClick:y})]})]})]})},al=({keys:e})=>s.jsx("div",{"data-testid":"api-keys",children:e.map(n=>s.jsx(sM,{...n},n.label))}),Qs=({icon:e,title:n,detail:a,extra:o})=>s.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:[s.jsx("div",{className:"size-14",children:e}),s.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-1 flex-col",children:[s.jsx("h3",{children:n}),s.jsx("div",{children:a}),o&&s.jsx("div",{className:"mt-4",children:o})]})]}),dd=ns({method:"POST",path:({integrationId:e,apiKeyId:n})=>`/integrations/${e}/api_key/${n}/refresh/`,body:({integrationId:e})=>({integrations:[{id:e}]}),updateQueries:{emberUpdateType:"createOrUpdate",dataType:el,update:(e,n)=>n&&{...n,integrations:n.integrations.map(a=>e.integrations.find(({id:c})=>c===a.id)||a)}}}),aM=ye.create(()=>{const e=ye.useModal(),{updateRoute:n}=Qe(),{zapierTemplates:a}=P_(),{data:{integrations:o}={integrations:[]}}=Qf(),{config:c}=Je(),{mutateAsync:m}=dd(),y=ot(),[h,l]=D.useState(!1),f=c.hostSettings?.limits?.customIntegrations?.disabled,u=o.find(({slug:v})=>v==="zapier"),p=u?.api_keys?.find(v=>v.type==="admin");D.useEffect(()=>{f&&n("integrations")},[f,n]);const x=()=>{!u||!p||(l(!1),ye.show(Et,{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 v=>{try{await m({integrationId:u.id,apiKeyId:p.id}),l(!0),v?.remove()}catch(_){y(_)}}}))};return s.jsxs(yt,{afterClose:()=>{n("integrations")},cancelLabel:"",footer:s.jsxs("div",{className:"mx-8 flex w-full items-center justify-between",children:[s.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 ",s.jsx("span",{children:s.jsx(ut,{className:"relative top-[-2px] inline-block",name:"zapier-logo",size:24})})]}),s.jsx(Ue,{color:"black",label:"Close",onClick:()=>{e.remove()}})]}),okColor:"black",okLabel:"Close",testId:"zapier-modal",title:"",stickyFooter:!0,onOk:()=>{n("integrations"),e.remove()},children:[s.jsx(Qs,{detail:"Automation for your favorite apps",extra:s.jsx("div",{className:"-mb-4 mt-1",children:s.jsx(al,{keys:[{label:"Admin API key",text:p?.secret,hint:h?s.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:x},{label:"API URL",text:window.location.origin+no().subdir}]})}),icon:s.jsx(ut,{name:"zapier",size:56}),title:"Zapier"}),s.jsx(cn,{children:a.map(v=>s.jsx(On,{action:s.jsx(Ue,{className:"whitespace-nowrap text-sm font-semibold text-[#FF4A00]",href:v.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:s.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[s.jsxs("div",{className:"flex shrink-0 flex-nowrap items-center gap-2",children:[s.jsx("img",{className:"size-8 object-contain dark:invert",role:"presentation",src:v.ghostImage}),s.jsx(ut,{name:"arrow-right",size:"xs"}),s.jsx("img",{className:"size-8 object-contain",role:"presentation",src:v.appImage})]}),s.jsx("span",{className:"text-sm",children:v.title})]}),hideActions:!0}))})]})});function z0(e){const n="The URL must be in a format like https://www.threads.net/@yourUsername";if(!e)return"";if(e.startsWith("http")){if(!e.includes("threads.net")&&!e.includes("threads.com"))throw new Error(n);if(e=e.replace("threads.com","threads.net"),e.includes("www.")||(e=e.replace("https://","https://www.")),!Nt.isURL(e))throw new Error(n);if(!e.match(/^https:\/\/www\.threads\.net\/@?[a-zA-Z0-9._]+$/))throw new Error(n);return e}if(!e.includes("/")){if(e.startsWith("@")&&(e=e.slice(1)),!e.match(/^[a-zA-Z0-9._]+$/))throw new Error(n);return`https://www.threads.net/@${e}`}throw new Error(n)}const oM=e=>`https://www.threads.net/${e}`,iM=e=>{const n=e.match(/(?:https:\/\/)(?:www\.)?(?:threads\.(?:com|net))(?:\/)?(?:#!\/)?@?([^/]*)/)?.[1];return n?`@${n}`:null},Bs={INVALID_USERNAME:"Your Username is not a valid Bluesky Username",INVALID_URL:"The URL must be in a format like https://bsky.app/profile/yourUsername"};function H0(e){return[/^did:plc:[a-z2-7]{24}$/,/^[a-zA-Z0-9._]{1,15}$/,/^(?=.{1,191}$)[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$/].some(a=>a.test(e))}function zf(e){let n=e.trim();return n.startsWith("@")&&(n=n.slice(1)),n.startsWith("did:plc:")?n.toLowerCase():n}function B0(e){if(!e)return"";let n;if(e.startsWith("http")||e.startsWith("www.")||e.includes("bsky.app")){if(!e.includes("bsky.app"))throw new Error(Bs.INVALID_URL);const o=e.match(/bsky\.app\/profile\/@?([^/]+)/);if(!o)throw new Error(Bs.INVALID_URL);n=zf(o[1])}else n=zf(e);if(!H0(n))throw new Error(Bs.INVALID_USERNAME);const a=`https://bsky.app/profile/${n}`;if(!Nt.isURL(a))throw new Error(Bs.INVALID_URL);return a}const lM=e=>{if(!e)throw new Error(Bs.INVALID_USERNAME);let n=zf(e);if(!H0(n))throw new Error(Bs.INVALID_USERNAME);return`https://bsky.app/profile/${n}`},cM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?bsky\.app\/profile\/@?([^/]*)/);return n?`${n[1]}`:null},es={INVALID_URL:"The URL must be in a format like https://www.linkedin.com/in/yourUsername",INVALID_USERNAME:"Your Username is not a valid LinkedIn Username"},uM=["in","pub","company","school"],fM=/^[a-zA-Z0-9-]{3,100}$/,dM=/^[a-zA-Z0-9-]{3,100}(?:\/[a-zA-Z0-9-]*)*$/,W0=/^(?:https?:\/\/)?(?:www\.)?(?:([a-z]{2})\.)?linkedin\.com\/(in|pub|company|school)\/([^?#]+)/i,Hf=e=>e.trim().replace(/^@/,""),q0=e=>{if(/^(https?:\/\/|www\.)/.test(e)||e.includes("linkedin.com")){const o=e.match(W0);if(!o)throw new Error(es.INVALID_URL);if(o[0].length!==e.length)throw new Error(es.INVALID_USERNAME);const[,c,m,y]=o,h=Hf(y);if(c&&!/^[A-Z]{2}$/.test(c.toUpperCase()))throw new Error(es.INVALID_URL);return{regional:c,pathType:m,username:h}}const n=Hf(e),a=n.indexOf("/");if(a!==-1){const o=n.substring(0,a);if(uM.includes(o))return{pathType:o,username:n.substring(a+1)}}return{username:n}},Y0=(e,n)=>(e==="pub"?dM:fM).test(n),G0=({regional:e,pathType:n,username:a})=>{const c=`https://${e?`${e.toLowerCase()}.`:"www."}linkedin.com/${n}/${a}`;if(!Nt.isURL(c))throw new Error(es.INVALID_URL);return c};function X0(e){if(!e)return"";const{regional:n,pathType:a="in",username:o}=q0(e);if(!Y0(a,o))throw new Error(es.INVALID_USERNAME);return G0({regional:n,pathType:a,username:o})}const pM=e=>{if(!e)throw new Error(es.INVALID_USERNAME);const{regional:n,pathType:a="in",username:o}=q0(e);if(!Y0(a,o))throw new Error(es.INVALID_USERNAME);return G0({regional:n,pathType:a,username:o})},hM=e=>{const n=e.match(W0);if(!n)return null;const[,,a,o]=n,c=Hf(o);return a==="in"?c:`${a}/${c}`};function K0(e){const n="The URL must be in a format like https://www.instagram.com/yourUsername",a="Your Username is not a valid Instagram Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("instagram.com")){if(!e.includes("instagram.com"))throw new Error(n);const m=e.match(/(?:https?:\/\/)?(?:www\.)?instagram\.com\/@?([^/]+)/);if(!m)throw new Error(n);o=m[1]}else o=e.startsWith("@")?e.slice(1):e;if(!o.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,28}[a-zA-Z0-9_]$/)||o.includes("..")||o.length>30)throw new Error(a);const c=`https://www.instagram.com/${o}`;if(!Nt.isURL(c))throw new Error(n);return c}const mM=e=>{const n="Your Username is not a valid Instagram Username";if(!e)throw new Error(n);let a=e;if(a.startsWith("@")&&(a=a.slice(1)),!a.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,28}[a-zA-Z0-9_]$/)||a.includes("..")||a.length>30)throw new Error(n);return`https://www.instagram.com/${a}`},gM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?instagram\.com\/@?([^/]*)/);return n?`${n[1]}`:null};function Z0(e){const n="The URL must be in a format like https://www.youtube.com/@yourUsername, https://www.youtube.com/user/yourUsername, or https://www.youtube.com/channel/yourChannelId",a="Your Username is not a valid YouTube Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("youtube.com")){if(!e.includes("youtube.com"))throw new Error(n);const m=e.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/((?:@|user\/|channel\/)[^/]+)/);if(!m)throw new Error(n);o=m[1]}else o=e;if(o.startsWith("@")){const m=o.slice(1);if(!m.match(/^[a-zA-Z0-9][a-zA-Z0-9._-]{1,28}[a-zA-Z0-9]$/)||m.includes("..")||m.length>30)throw new Error(a)}else if(o.startsWith("user/")){if(!o.slice(5).match(/^[a-zA-Z0-9._-]{1,50}$/))throw new Error(a)}else if(o.startsWith("channel/")){if(!o.slice(8).match(/^UC[a-zA-Z0-9_-]{22}$/))throw new Error(a)}else throw new Error(n);const c=`https://www.youtube.com/${o}`;if(!Nt.isURL(c))throw new Error(n);return c}const xM=e=>{const n="Your Username is not a valid YouTube Username";if(!e)throw new Error(n);if(e.startsWith("@")){const a=e.slice(1);if(!a.match(/^[a-zA-Z0-9][a-zA-Z0-9._-]{1,28}[a-zA-Z0-9]$/)||a.includes("..")||a.length>30)throw new Error(n)}else if(e.startsWith("user/")){if(!e.slice(5).match(/^[a-zA-Z0-9._-]{1,50}$/))throw new Error(n)}else if(e.startsWith("channel/")){if(!e.slice(8).match(/^UC[a-zA-Z0-9_-]{22}$/))throw new Error(n)}else throw new Error("The handle must be in a format like @yourUsername, user/yourUsername, or channel/yourChannelId");return`https://www.youtube.com/${e}`},bM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/((?:@|user\/|channel\/)[^/]*)/);return n?n[1]:null};function V0(e){const n="The URL must be in a format like https://www.tiktok.com/@yourUsername",a="Your Username is not a valid TikTok Username";if(!e)return"";let o;if(e.startsWith("http")||e.startsWith("www.")||e.includes("tiktok.com")){if(!e.includes("tiktok.com"))throw new Error(n);const y=e.match(/(?:https?:\/\/)?(?:www\.)?tiktok\.com\/(@[^/]+)/);if(!y)throw new Error(n);o=y[1]}else o=e.startsWith("@")?e:`@${e}`;const c=o.slice(1);if(!c.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,22}[a-zA-Z0-9_]$/)||c.includes("..")||c.length<2||c.length>24)throw new Error(a);const m=`https://www.tiktok.com/${o}`;if(!Nt.isURL(m))throw new Error(n);return m}const vM=e=>{const n="Your Username is not a valid TikTok Username";if(!e)throw new Error(n);const a=e.startsWith("@")?e:`@${e}`,o=a.slice(1);if(!o.match(/^[a-zA-Z0-9_][a-zA-Z0-9._]{0,22}[a-zA-Z0-9_]$/)||o.includes("..")||o.length<2||o.length>24)throw new Error(n);return`https://www.tiktok.com/${a}`},wM=e=>{const n=e.match(/(?:https?:\/\/)?(?:www\.)?tiktok\.com\/(@[^/]*)/);return n?n[1]:null};function Q0(e){const n="The URL must be in a format like @username@instance.tld or https://instance.tld/@username or https://website.com/@username@instance.tld";if(!e)return"";let a=e;if(a=a.replace(/^https?:\/\//,""),a.match(/^@[^@]+@[^/]+$/)){const[o,c]=a.split("@").slice(1);if(!Nt.isFQDN(c))throw new Error(n);return`https://${c}/@${o}`}if(a.match(/^[^/]+\.[^/]+\/@[^/]+(@[^/]+)?$/)){const[o,c]=a.split("/@");if(!Nt.isFQDN(o))throw new Error(n);if(c.includes("@")){const[,m]=c.split("@");if(!Nt.isFQDN(m))throw new Error(n)}return`https://${a}`}throw new Error(n)}const yM=e=>{const n="Your Username is not a valid Mastodon Username";if(!e)throw new Error(n);if(e.match(/^@[^@]+@[^/]+$/)){const[a,o]=e.split("@").slice(1);if(!Nt.isFQDN(o))throw new Error(n);return`https://${o}/@${a}`}if(e.match(/^[^/]+\.[^/]+\/@[^/]+(@[^/]+)?$/)){const[a,o]=e.split("/@");if(!Nt.isFQDN(a))throw new Error(n);if(o.includes("@")){const[,c]=o.split("@");if(!Nt.isFQDN(c))throw new Error(n)}return`https://${e}`}throw new Error(n)},_M=e=>e.replace(/^https?:\/\//,""),kM=({tier:e})=>{const n=e?.type==="free",{updateRoute:a}=Qe(),{mutateAsync:o}=ad(),{mutateAsync:c}=A2(),{mutateAsync:m}=Rn(),[y,h]=at.useState(!!e?.trial_days),l=ot(),{localSettings:f,siteData:u}=ss(),[p]=gt(f,["portal_plans"]),x=JSON.parse(p?.toString()||"[]"),v={name:()=>_.name?void 0:"Enter a name for the tier",monthly_price:()=>_.type!=="free"?ch(_.monthly_price||0,_.currency,{allowZero:!1}):void 0,yearly_price:()=>_.type!=="free"?ch(_.yearly_price||0,_.currency,{allowZero:!1}):void 0},{formState:_,saveState:k,updateForm:M,handleSave:T,errors:A,clearError:C,okProps:O}=kr({initialState:{...e||{},trial_days:e?.trial_days?.toString()||"",currency:e?.currency||F_[0].isoCode,visibility:e?.visibility||"none",welcome_page_url:e?.welcome_page_url||null},savingDelay:500,savedDelay:500,onValidate:()=>{const q={};return Object.entries(v).forEach(([B,Y])=>{q[B]=Y?.()}),q},onSave:async()=>{const{trial_days:q,currency:B,...Y}=_,ae=Y;if(ae.benefits=ae.benefits?.filter(ee=>ee),n||(ae.currency=B,ae.trial_days=parseInt(q)),e?.id?await o({...e,...ae}):await c(ae),n){const ee=_.visibility==="public";let re=!1;x.includes("free")&&!ee&&(x.splice(x.indexOf("free"),1),re=!0),!x.includes("free")&&ee&&(x.push("free"),re=!0),re&&await m([{key:"portal_plans",value:JSON.stringify(x)}])}},onSaveError:l}),$=U0({items:_.benefits||[],setItems:q=>M(B=>({...B,benefits:q})),blank:"",canAddNewItem:q=>!!q}),W=q=>{q.target.checked?(h(!0),M(B=>({...B,trial_days:e?.trial_days?e?.trial_days.toString():"7"}))):(h(!1),M(B=>({...B,trial_days:"0"})))},R=D.useRef(!1);D.useEffect(()=>{R.current&&(v.monthly_price?.(),v.yearly_price?.()),R.current=!0},[_.currency]);const Z=()=>{if(e){const q=e.active?"Archive tier":"Reactivate tier",B=e.active?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:["Members will no longer be able to subscribe to ",s.jsx("strong",{children:e.name})," and it will be removed from the list of available tiers in portal."]}),s.jsx("div",{children:"Existing members on this tier will remain unchanged. Offers using this tier will be disabled."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:["Reactivating ",s.jsx("strong",{children:e.name})," will re-enable it as an option in portal and allow new members to subscribe to this tier."]}),s.jsx("div",{children:"Existing members will remain unchanged."})]}),Y=e.active?"Archive":"Reactivate";ye.show(Et,{title:q,prompt:B,okLabel:Y,cancelLabel:"Cancel",okColor:e.active?"red":"black",onOk:ae=>{o({...e,active:!e.active}),ae?.remove(),xt({type:"success",title:`Tier ${e.active?"archived":"reactivated"}`})}})}};let X={};return e&&(e.active&&e.type!=="free"?X={label:"Archive tier",color:"red",link:!0,onClick:Z}:e.active||(X={label:"Reactivate tier",color:"green",link:!0,onClick:Z})),s.jsx(yt,{afterClose:()=>{a("tiers")},buttonsDisabled:O.disabled,cancelLabel:"Close",dirty:k==="unsaved",leftButtonProps:X,okColor:O.color,okLabel:O.label||"Save",size:"lg",testId:"tier-detail-modal",title:e?e.active?"Edit tier":"Edit archived tier":"New tier",stickyFooter:!0,onOk:async()=>{await T({fakeWhenUnchanged:!0})},children:s.jsxs("div",{className:"-mb-8 mt-8 flex items-start gap-8",children:[s.jsxs("div",{className:"flex grow flex-col gap-8",children:[s.jsxs(tt,{marginBottom:!1,title:"Basic",grouped:!0,children:[s.jsx(Ae,{autoComplete:"off",error:!!A.name,hint:A.name,maxLength:191,placeholder:n?"Free":"Bronze",title:"Name",value:_.name||"",autoFocus:!0,onChange:q=>M(B=>({...B,name:q.target.value})),onKeyDown:()=>C("name")}),s.jsx(Ae,{autoComplete:"off",autoFocus:n,maxLength:191,placeholder:n?"Free preview":"Full access to premium content",title:"Description",value:_.description||"",onChange:q=>M(B=>({...B,description:q.target.value}))}),!n&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"flex flex-col gap-10 md:flex-row",children:[s.jsxs("div",{className:"basis-1/2",children:[s.jsxs("div",{className:"mb-1 flex h-6 items-center justify-between",children:[s.jsx(bt,{level:6,children:"Prices"}),s.jsx("div",{className:"-mr-2 w-[50px]",children:s.jsx(Lt,{border:!1,containerClassName:"font-medium",controlClasses:{menu:"w-18"},options:uh(),selectedOption:uh().flatMap(q=>q.options).find(q=>q.value===_.currency),size:"xs",clearBg:!0,isSearchable:!0,onSelect:q=>M(B=>({...B,currency:q?.value}))})})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(fh,{error:!!A.monthly_price,hint:A.monthly_price,placeholder:"5",rightPlaceholder:`${_.currency}/month`,title:"Monthly price",valueInCents:_.monthly_price||"",hideTitle:!0,onBlur:q=>q.target.value===""?M(B=>({...B,monthly_price:0})):null,onChange:q=>M(B=>({...B,monthly_price:q})),onKeyDown:()=>C("monthly_price")}),s.jsx(fh,{error:!!A.yearly_price,hint:A.yearly_price,placeholder:"50",rightPlaceholder:`${_.currency}/year`,title:"Yearly price",valueInCents:_.yearly_price||"",hideTitle:!0,onBlur:q=>q.target.value===""?M(B=>({...B,yearly_price:0})):null,onChange:q=>M(B=>({...B,yearly_price:q})),onKeyDown:()=>C("yearly_price")})]})]}),s.jsxs("div",{className:"basis-1/2",children:[s.jsx("div",{className:"mb-1 flex h-6 flex-col justify-center",children:s.jsx(st,{checked:y,label:"Add a free trial",labelStyle:"heading",onChange:W})}),s.jsx(Ae,{disabled:!y,hint:s.jsxs("div",{className:"mt-1",children:["Members will be subscribed at full price once the trial ends. ",s.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:_.trial_days,hideTitle:!0,onChange:q=>M(B=>({...B,trial_days:q.target.value.replace(/[^\d]/,"")}))})]})]})}),s.jsx(Hg,{baseUrl:u?.url,hint:`Redirect to this URL after signup ${n?"":" for premium membership"}`,maxLength:2e3,placeholder:u?.url,title:"Welcome page",value:_.welcome_page_url||null,nullable:!0,transformPathWithoutSlash:!0,onChange:q=>M(B=>({...B,welcome_page_url:q||null}))})]}),s.jsxs(tt,{gap:"none",title:"Benefits",grouped:!0,children:[s.jsx("div",{className:"-mt-3",children:s.jsx(Bg,{items:$.items,itemSeparator:!1,renderItem:({id:q,item:B})=>s.jsxs("div",{className:"relative flex w-full items-center gap-5",children:[s.jsx("div",{className:"absolute left-[-32px] top-[7px] flex size-6 items-center justify-center bg-white group-hover:hidden dark:bg-black",children:s.jsx(ut,{name:"check",size:"sm"})}),s.jsx(Ae,{maxLength:191,value:B,onChange:Y=>$.updateItem(q,Y.target.value)}),s.jsx(Ue,{className:"absolute right-1 top-1 z-10 opacity-0 group-hover:opacity-100",color:"grey",icon:"trash",size:"sm",onClick:()=>$.removeItem(q)})]}),onMove:$.moveItem})}),s.jsxs("div",{className:"relative mt-1 flex items-center gap-3",children:[s.jsx(ut,{className:"dark:text-white",name:"check",size:"sm"}),s.jsx(Ae,{className:"grow",containerClassName:"w-100",maxLength:191,placeholder:"Expert analysis",title:"New benefit",value:$.newItem,hideTitle:!0,onChange:q=>$.setNewItem(q.target.value),onKeyDown:q=>{q.key==="Enter"&&$.addItem()}}),s.jsx(Ue,{className:"absolute right-[5px] top-[5px] z-10",color:"green",icon:"add",iconColorClass:"text-white",label:"Add",size:"sm",hideLabel:!0,onClick:()=>$.addItem()})]})]})]}),s.jsx("div",{className:"sticky top-[96px] hidden shrink-0 basis-[380px] min-[920px]:!visible min-[920px]:!block",children:s.jsx(U_,{isFreeTier:n,tier:_})})]})})},MM=({params:e})=>{const{data:{tiers:n,isEnd:a}={},fetchNextPage:o}=so();let c;return D.useEffect(()=>{e?.id&&!c&&!a&&o()},[o,a,e?.id,c]),e?.id&&(c=n?.find(({id:m})=>m===e?.id),!c)?null:s.jsx(kM,{tier:c})},jM=ye.create(MM);var au,Uh;function J0(){if(Uh)return au;Uh=1;var e={};return au=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{},au}var ou,zh;function ex(){if(zh)return ou;zh=1;const e="2.0.0",n=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,o=16,c=n-6;return ou={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:o,MAX_SAFE_BUILD_LENGTH:c,MAX_SAFE_INTEGER:a,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},ou}var Oi={exports:{}},Hh;function EM(){return Hh||(Hh=1,(function(e,n){const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:c}=ex(),m=J0();n=e.exports={};const y=n.re=[],h=n.safeRe=[],l=n.src=[],f=n.safeSrc=[],u=n.t={};let p=0;const x="[a-zA-Z0-9-]",v=[["\\s",1],["\\d",c],[x,o]],_=M=>{for(const[T,A]of v)M=M.split(`${T}*`).join(`${T}{0,${A}}`).split(`${T}+`).join(`${T}{1,${A}}`);return M},k=(M,T,A)=>{const C=_(T),O=p++;m(M,O,T),u[M]=O,l[O]=T,f[O]=C,y[O]=new RegExp(T,A?"g":void 0),h[O]=new RegExp(C,A?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*"),k("NUMERICIDENTIFIERLOOSE","\\d+"),k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),k("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),k("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),k("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`),k("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`),k("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),k("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),k("BUILDIDENTIFIER",`${x}+`),k("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),k("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),k("FULL",`^${l[u.FULLPLAIN]}$`),k("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),k("LOOSE",`^${l[u.LOOSEPLAIN]}$`),k("GTLT","((?:<|>)?=?)"),k("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),k("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),k("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),k("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),k("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),k("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),k("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`),k("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`),k("COERCERTL",l[u.COERCE],!0),k("COERCERTLFULL",l[u.COERCEFULL],!0),k("LONETILDE","(?:~>?)"),k("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",k("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),k("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),k("LONECARET","(?:\\^)"),k("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",k("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),k("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),k("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),k("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),k("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",k("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),k("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),k("STAR","(<|>)?=?\\s*\\*"),k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Oi,Oi.exports)),Oi.exports}var iu,Bh;function TM(){if(Bh)return iu;Bh=1;const e=Object.freeze({loose:!0}),n=Object.freeze({});return iu=o=>o?typeof o!="object"?e:o:n,iu}var lu,Wh;function SM(){if(Wh)return lu;Wh=1;const e=/^[0-9]+$/,n=(o,c)=>{if(typeof o=="number"&&typeof c=="number")return o===c?0:o<c?-1:1;const m=e.test(o),y=e.test(c);return m&&y&&(o=+o,c=+c),o===c?0:m&&!y?-1:y&&!m?1:o<c?-1:1};return lu={compareIdentifiers:n,rcompareIdentifiers:(o,c)=>n(c,o)},lu}var cu,qh;function NM(){if(qh)return cu;qh=1;const e=J0(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:a}=ex(),{safeRe:o,t:c}=EM(),m=TM(),{compareIdentifiers:y}=SM();class h{constructor(f,u){if(u=m(u),f instanceof h){if(f.loose===!!u.loose&&f.includePrerelease===!!u.includePrerelease)return f;f=f.version}else if(typeof f!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof f}".`);if(f.length>n)throw new TypeError(`version is longer than ${n} characters`);e("SemVer",f,u),this.options=u,this.loose=!!u.loose,this.includePrerelease=!!u.includePrerelease;const p=f.trim().match(u.loose?o[c.LOOSE]:o[c.FULL]);if(!p)throw new TypeError(`Invalid Version: ${f}`);if(this.raw=f,this.major=+p[1],this.minor=+p[2],this.patch=+p[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");p[4]?this.prerelease=p[4].split(".").map(x=>{if(/^[0-9]+$/.test(x)){const v=+x;if(v>=0&&v<a)return v}return x}):this.prerelease=[],this.build=p[5]?p[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(f){if(e("SemVer.compare",this.version,this.options,f),!(f instanceof h)){if(typeof f=="string"&&f===this.version)return 0;f=new h(f,this.options)}return f.version===this.version?0:this.compareMain(f)||this.comparePre(f)}compareMain(f){return f instanceof h||(f=new h(f,this.options)),this.major<f.major?-1:this.major>f.major?1:this.minor<f.minor?-1:this.minor>f.minor?1:this.patch<f.patch?-1:this.patch>f.patch?1:0}comparePre(f){if(f instanceof h||(f=new h(f,this.options)),this.prerelease.length&&!f.prerelease.length)return-1;if(!this.prerelease.length&&f.prerelease.length)return 1;if(!this.prerelease.length&&!f.prerelease.length)return 0;let u=0;do{const p=this.prerelease[u],x=f.prerelease[u];if(e("prerelease compare",u,p,x),p===void 0&&x===void 0)return 0;if(x===void 0)return 1;if(p===void 0)return-1;if(p===x)continue;return y(p,x)}while(++u)}compareBuild(f){f instanceof h||(f=new h(f,this.options));let u=0;do{const p=this.build[u],x=f.build[u];if(e("build compare",u,p,x),p===void 0&&x===void 0)return 0;if(x===void 0)return 1;if(p===void 0)return-1;if(p===x)continue;return y(p,x)}while(++u)}inc(f,u,p){if(f.startsWith("pre")){if(!u&&p===!1)throw new Error("invalid increment argument: identifier is empty");if(u){const x=`-${u}`.match(this.options.loose?o[c.PRERELEASELOOSE]:o[c.PRERELEASE]);if(!x||x[1]!==u)throw new Error(`invalid identifier: ${u}`)}}switch(f){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",u,p);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",u,p);break;case"prepatch":this.prerelease.length=0,this.inc("patch",u,p),this.inc("pre",u,p);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",u,p),this.inc("pre",u,p);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 x=Number(p)?1:0;if(this.prerelease.length===0)this.prerelease=[x];else{let v=this.prerelease.length;for(;--v>=0;)typeof this.prerelease[v]=="number"&&(this.prerelease[v]++,v=-2);if(v===-1){if(u===this.prerelease.join(".")&&p===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(x)}}if(u){let v=[u,x];p===!1&&(v=[u]),y(this.prerelease[0],u)===0?isNaN(this.prerelease[1])&&(this.prerelease=v):this.prerelease=v}break}default:throw new Error(`invalid increment argument: ${f}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return cu=h,cu}var uu,Yh;function AM(){if(Yh)return uu;Yh=1;const e=NM();return uu=(a,o,c=!1)=>{if(a instanceof e)return a;try{return new e(a,o)}catch(m){if(!c)return null;throw m}},uu}var IM=AM();const CM=Pg(IM);function Gh(e){if(!e)return"";const n=e.replace("+moya","");try{const o=CM(n,{includePrerelease:!0})?.prerelease;if(o&&o?.length>0){const m=String(o[0]).split("-")[1];return!m||!m.startsWith("g")?"":`https://github.com/TryGhost/Ghost/commit/${m.slice(1)}`}return`https://github.com/TryGhost/Ghost/releases/tag/v${n}`}catch{return""}}function DM(e,n){const a=!!e.match?.(/production/i);return!!(a&&n!=="mysql8"||!a&&n==="mysql5")}const RM=ye.create(({})=>{const{updateRoute:e}=Qe();let a=Je().config;const o=z_();function c(){return new Date().getFullYear()}function m(){return!!a.enableDeveloperExperiments}function y(){return!a.hostSettings?.siteId}return s.jsx(yt,{afterClose:()=>{e("")},cancelLabel:"",footer:s.jsx(s.Fragment,{}),topRightContent:"close",width:540,children:s.jsxs("div",{className:"flex flex-col gap-4 pb-7 text-sm",children:[s.jsx(H_,{className:"h-auto w-[120px] dark:invert"}),s.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[o?.message&&s.jsxs("div",{className:"gh-prose-links mb-4 rounded-sm border border-green p-5",children:[s.jsx("strong",{children:"Update available!"}),s.jsx("div",{dangerouslySetInnerHTML:{__html:o.message}})]}),Gh(a.version)&&s.jsxs("div",{children:[s.jsx("strong",{children:"Version:"})," ",s.jsx("a",{className:"text-green",href:Gh(a.version),rel:"noopener noreferrer",target:"_blank",children:a.version})]})||s.jsxs("div",{children:[s.jsx("strong",{children:"Version:"})," ",a.version]}),y()&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Environment:"})," ",a.environment]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Database:"})," ",a.database]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Mail:"})," ",a.mail?a.mail:"Native"]})]}),m()&&s.jsxs("div",{children:[s.jsx("strong",{children:"Developer experiments:"})," Enabled"]}),y()&&DM(a.environment,a.database)&&s.jsxs("div",{className:"text-red-500 dark:text-red-400",children:["You are running an unsupported database in production. Please ",s.jsx("a",{href:"https://ghost.org/docs/faq/supported-databases/",rel:"noopener noreferrer",target:"_blank",children:"upgrade to MySQL 8"}),"."]})]}),s.jsx(Va,{}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.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:[s.jsx(ut,{name:"book-open",size:"sm"})," User documentation"]}),s.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:[s.jsx(ut,{name:"question-circle",size:"sm"})," Get help with Ghost"]}),s.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:[s.jsx(ut,{name:"angle-brackets",size:"sm"})," Get involved"]})]}),s.jsx(Va,{}),s.jsxs("p",{className:"max-w-[460px] text-xs",children:["Copyright © 2013 – ",c()," Ghost Foundation, released under the ",s.jsx("a",{className:"text-green",href:"https://github.com/TryGhost/Ghost/blob/main/LICENSE",rel:"noopener noreferrer",target:"_blank",children:"MIT license"}),". ",s.jsx("a",{className:"text-green",href:"https://ghost.org/",rel:"noopener noreferrer",target:"_blank",children:"Ghost"})," is a registered trademark of ",s.jsx("a",{className:"text-green",href:"https://ghost.org/trademark/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Foundation Ltd"}),"."]})]})})}),OM=()=>{const e=Zt(),{updateRoute:n}=Qe(),[a,o]=D.useState(""),[c,m]=D.useState({name:""}),{mutateAsync:y}=B_(),h=Ys(),l=ot();return D.useEffect(()=>{h?.isLimited("customIntegrations")&&h.errorIfWouldGoOverLimit("customIntegrations").catch(f=>{f instanceof Gs&&(ye.show(Xr,{prompt:f.message||"Your current plan doesn't support more custom integrations.",onOk:()=>n({route:"/pro",isExternal:!0})}),e.remove(),n("integrations"))})},[h,e,n]),s.jsx(yt,{afterClose:()=>{n("integrations")},okColor:"black",okLabel:"Add",size:"sm",testId:"add-integration-modal",title:"Add integration",onOk:async()=>{if(!a){m({name:"Name is required"});return}try{const f=await y({name:a});e.remove(),n({route:`integrations/${f.integrations[0].id}`})}catch(f){l(f)}},children:s.jsx("div",{className:"mt-5",children:s.jsx(tt,{marginBottom:!1,marginTop:!1,children:s.jsx(Ae,{autoFocus:!0,error:!!c.name,hint:c.name,maxLength:191,placeholder:"Custom integration",title:"Name",value:a,onChange:f=>o(f.target.value),onInput:()=>{c.name&&m({name:""})}})})})})},$M=ye.create(OM),LM=()=>{const e=Zt(),{updateRoute:n}=Qe(),a=ot(),[o,c]=D.useState(!0),[m,y]=D.useState(null),{data:h}=Fg({searchParams:{filter:"newsletters.status:active+email_disabled:0",limit:"1",page:"1",include:"newsletters,labels"}}),{mutateAsync:l}=T2(),{formState:f,updateForm:u,saveState:p,handleSave:x,errors:v,clearError:_}=kr({initialState:{name:"",description:"",optInExistingSubscribers:!0},onSave:async()=>{const T=await l({name:f.name,description:f.description,opt_in_existing:f.optInExistingSubscribers,feedback_enabled:!0});n({route:`newsletters/${T.newsletters[0].id}`})},onSaveError:a,onValidate:()=>{const T={};return f.name||(T.name="A name is required for your newsletter"),T}}),k=Ys();D.useEffect(()=>{if(!k){c(!1);return}k.errorIfWouldGoOverLimit("newsletters").catch(T=>{if(T instanceof Gs)y(T);else throw T}).finally(()=>{c(!1)})},[k]);const M=h?.meta?.pagination.total;return D.useEffect(()=>{m&&(ye.show(Xr,{prompt:m.message||"Your current plan doesn't support more newsletters.",onOk:()=>n({route:"/pro",isExternal:!0})}),e.remove(),n("newsletters"))},[m,e,n]),o||m?null:s.jsx(yt,{afterClose:()=>{n("newsletters")},backDropClick:!1,okColor:"black",okDisabled:p==="saving",okLabel:"Create",okLoading:p==="saving",size:"sm",testId:"add-newsletter-modal",title:"Create newsletter",onOk:async()=>{await x()&&e.remove()},children:s.jsxs(tt,{marginBottom:!1,marginTop:!0,children:[s.jsx(Ae,{autoFocus:!0,error:!!v.name,hint:v.name,maxLength:191,placeholder:"Weekly roundup",title:"Name",value:f.name,onChange:T=>u(A=>({...A,name:T.target.value})),onKeyDown:()=>_("name")}),s.jsx($n,{maxLength:2e3,title:"Description",value:f.description,onChange:T=>u(A=>({...A,description:T.target.value}))}),s.jsx(st,{checked:f.optInExistingSubscribers,direction:"rtl",hint:f.optInExistingSubscribers?`This newsletter will be available to all members. Your ${M===void 0?"":Wg(M)} 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=>u(A=>({...A,optInExistingSubscribers:T.target.checked}))})]})})},PM=ye.create(LM),FM=({recommendation:e,animate:n})=>{const a=Zt(),{updateRoute:o,route:c}=Qe(),{mutateAsync:m}=W_(),y=ot(),{formState:h,updateForm:l,handleSave:f,saveState:u,errors:p,clearError:x,setErrors:v}=kr({initialState:{...e},onSave:async T=>{await m(T),a.remove(),xt({title:"Recommendation added",type:"success"}),Y_("Recommendation Added",{oneClickSubscribe:T.one_click_subscribe}),o("recommendations")},onSaveError:y,onValidate:T=>q_(T)});let _="Add",k=!1;u==="saving"?k=!0:u==="saved"&&(_="Added");let M={label:"Back",icon:"arrow-left",iconColorClass:"text-black dark:text-white",link:!0,size:"sm",onClick:()=>{u!=="saving"&&(a.remove(),ye.show(tx,{pathName:c,animate:!1,recommendation:{...h}}))}};return s.jsx(yt,{afterClose:()=>{o("recommendations")},animate:n??!0,backDropClick:!1,cancelLabel:"Cancel",dirty:!0,leftButtonProps:M,okColor:"black",okLabel:_,okLoading:k,size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",stickyFooter:!0,onCancel:()=>{u!=="saving"&&(a.remove(),o("recommendations"))},onOk:async()=>{if(u!=="saving"){Ug();try{await f({force:!0})}catch{xt({type:"error",title:"Something went wrong when adding this recommendation, please try again."})}}},children:s.jsx(G_,{clearError:x,errors:p,formState:h,setErrors:v,showURL:!1,updateForm:l})})},UM=ye.create(FM),Xh=e=>Bi(e).save||"",zM=function(e,n){try{new URL(n).hostname.includes(".")?delete e.url:e.url="Enter a valid URL"}catch{e.url="Enter a valid URL"}return e},HM=({searchParams:e,recommendation:n,animate:a})=>{const[o,c]=D.useState(!1),m=Zt(),{updateRoute:y}=Qe(),{mutateAsync:h}=X_(),l=n?"":e?.get("url")??"",{save:f}=l?Bi(l):{save:""},u=at.useRef(!1),[p,x]=at.useState(!!f),{formState:v,updateForm:_,handleSave:k,errors:M,saveState:T,clearError:A}=kr({initialState:n??{title:"",url:f||"",description:"",excerpt:null,featured_image:null,favicon:null,one_click_subscribe:!1},onSave:async()=>{let O;O=new URL(v.url);const $=O.hostname.replace("www.",""),W={...v,url:O.toString()},{recommendations:R=[]}=await h(O);if(!R||R.length===0)return;const Z=R[0];if(Z.id)throw new ah("A recommendation with this URL already exists.");W.title=Z.title??$,W.excerpt=Z.excerpt??W.excerpt,W.featured_image=Z.featured_image??W.featured_image??null,W.favicon=Z.favicon??W.favicon??null,W.one_click_subscribe=Z.one_click_subscribe??W.one_click_subscribe??!1,W.description=W.excerpt||null,m.remove(),ye.show(UM,{animate:!1,recommendation:W})},onValidate:()=>{const O={};return zM(O,v.url),p&&x(Object.keys(O).length===0),O}}),C=at.useCallback(async()=>{if(T!=="saving"){Ug();try{if(await k({force:!0}))return}catch(O){const $=O instanceof ah?O.message:"Something went wrong while checking this URL, please try again.";xt({type:"error",title:$})}p&&x(!1)}},[k,T,p,x]);return at.useEffect(()=>{p&&!u.current&&(u.current=!0,C())},[p,C]),D.useEffect(()=>{o&&(C(),c(!1))},[v]),p?s.jsx(yt,{afterClose:()=>{y("recommendations")},animate:a??!0,backDropClick:!1,footer:!1,header:!1,size:"sm",children:s.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:s.jsx(Wi,{})})}):s.jsxs(yt,{afterClose:()=>{y("recommendations")},animate:a??!0,backDropClick:!1,okColor:"black",okLabel:"Next",okLoading:T==="saving",size:"sm",testId:"add-recommendation-modal",title:"Add recommendation",onOk:C,children:[s.jsxs("p",{className:"mt-4",children:["You can recommend ",s.jsx("strong",{children:"any site"})," your audience will find valuable, not just those published on Ghost."]}),s.jsx(tt,{marginBottom:!1,marginTop:!0,children:s.jsx(Ae,{autoFocus:!0,error:!!M.url,hint:M.url||s.jsxs(s.Fragment,{children:["Need inspiration? ",s.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:v.url,onBlur:()=>{const O=Xh(v.url);_($=>({...$,url:O}))},onChange:O=>{A?.("url"),_($=>({...$,url:O.target.value}))},onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),_($=>({...$,url:Xh(v.url)})),c(!0))}})})]})},tx=ye.create(HM);function BM(e,n){let a;return function(...c){const m=()=>{clearTimeout(a),e(...c)};clearTimeout(a),a=setTimeout(m,n)}}const pd=({generateContent:e,className:n,height:a,width:o,parentClassName:c,testId:m,addDelay:y=!1})=>{const[h,l]=D.useState(0),f=[D.useRef(null),D.useRef(null)],[u,p]=D.useState(0);return D.useEffect(()=>{const x=h===0?1:0,v=f[x].current;if(v){e(v);const _=()=>{y?setTimeout(()=>{l(x)},500):l(x)};return v.addEventListener("load",_),()=>{v.removeEventListener("load",_)}}},[e]),D.useEffect(()=>{const x=f[h].current,v=BM(()=>{p(x?.contentWindow?.scrollY||0)},250);return x?.contentWindow?.addEventListener("scroll",v),()=>{x?.contentWindow?.removeEventListener("scroll",v)}},[h,f]),D.useEffect(()=>{const x=f[h].current;if(x)try{x.contentWindow?.scrollTo(0,u)}catch(v){m_(v)}},[u,h,f]),s.jsxs("div",{className:c,"data-testid":m,children:[s.jsx("iframe",{ref:f[0],className:`${n} ${h!==0?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===0,frameBorder:"0",height:a,title:"Buffered Preview 1",width:o}),s.jsx("iframe",{ref:f[1],className:`${n} ${h!==1?"z-10 opacity-0":"z-20 opacity-100"}`,"data-visible":h===1,frameBorder:"0",height:a,title:"Buffered Preview 2",width:o})]})},WM=(e,n,a)=>{const o=new URLSearchParams;return o.append("announcement_bg",e||"accent"),o.append("announcement",n||""),a&&a.length>0&&o.append("announcement_vis",a?.join(",")||""),o.toString()},qM=({announcementBackgroundColor:e,announcementContent:n,url:a,visibility:o})=>{const c=D.useMemo(()=>o,[o?.join(",")]),m=D.useCallback(y=>{a&&fetch(a,{method:"POST",headers:{"Content-Type":"text/html;charset=utf-8","x-ghost-preview":WM(e,n,c),Accept:"text/plain"},mode:"cors",credentials:"include"}).then(h=>h.text()).then(h=>{const l="html { pointer-events: none; }",u=new DOMParser().parseFromString(h,"text/html"),p=u.querySelector("style"),x=p.innerHTML;p.innerHTML=`${x}
|
|
2
2
|
|
|
3
3
|
${l}`;let _=(u.doctype?new XMLSerializer().serializeToString(u.doctype):"")+u.documentElement.outerHTML;y.contentDocument?.open(),y.contentDocument?.write(_),y.contentDocument?.close()}).catch(()=>{})},[e,n,a,c]);return s.jsx(pd,{addDelay:!0,className:"absolute size-[110%] origin-top-left scale-[.90909] bg-white max-[1600px]:size-[130%] max-[1600px]:scale-[.76923]",generateContent:m,height:"100%",parentClassName:"relative h-full w-full",testId:"announcement-bar-preview-iframe",width:"100%"})},YM=({announcementContent:e,announcementTextHandler:n,accentColor:a,announcementBackgroundColor:o,toggleColorSwatch:c,toggleVisibility:m,visibility:y=[],paidMembersEnabled:h,onBlur:l})=>{const f=[{label:"Public visitors",onChange:u=>{m("visitors",u)},value:"visitors",checked:y.includes("visitors")},{label:"Free members",onChange:u=>{m("free_members",u)},value:"free_members",checked:y.includes("free_members")},...h?[{label:"Paid members",onChange:u=>{m("paid_members",u)},value:"paid_members",checked:y.includes("paid_members")}]:[]];return s.jsxs(tt,{children:[s.jsx(ld,{nodes:"MINIMAL_NODES",placeholder:"Highlight breaking news, offers or updates",title:"Announcement",value:e,onBlur:l,onChange:n}),s.jsx(u0,{isExpanded:!1,picker:!1,swatches:[{hex:"#08090c",title:"Dark",value:"dark"},{hex:"#ffffff",title:"Light",value:"light"},{hex:a||"#ffdd00",title:"Accent",value:"accent"}],swatchSize:"lg",title:"Background color",value:o,onSwatchChange:u=>{u!==null&&c(u)},onTogglePicker:()=>{}}),s.jsx(Cf,{checkboxes:f,title:"Visibility"})]})},GM=()=>{const{siteData:e}=Je(),{localSettings:n,updateSetting:a,handleSave:o,okProps:c}=ss({savingDelay:500}),[m]=gt(n,["announcement_content"]),[y]=gt(n,["accent_color"]),[h]=gt(n,["announcement_background"]),[l]=gt(n,["announcement_visibility"]),[f]=gt(n,["paid_members_enabled"]),u=JSON.parse(l?.toString()||"[]"),{updateRoute:p}=Qe(),[x,v]=D.useState("homepage"),_=R=>{a("announcement_background",R)},k=(R,Z)=>{const X=u.indexOf(R);X===-1&&Z?u.push(R):u.splice(X,1),a("announcement_visibility",JSON.stringify(u))},M=D.useRef(Ji(R=>{a("announcement_content",R)},500)),T=s.jsx(YM,{accentColor:y,announcementBackgroundColor:h,announcementContent:m,announcementTextHandler:R=>{M.current(R)},paidMembersEnabled:f,toggleColorSwatch:_,toggleVisibility:k,visibility:l,onBlur:()=>{}}),{data:{posts:[A]}={posts:[]}}=i0({searchParams:{filter:"status:published",order:"published_at DESC",limit:"1",fields:"id,url"}});let C=[];A&&(C=[{id:"homepage",title:"Homepage"},{id:"post",title:"Post"}]);const O=R=>{C.length&&v(R)};let $=ln(e);switch(x){case"homepage":$=ln(e);break;case"post":$=A.url;break}const W=s.jsx(qM,{announcementBackgroundColor:h,announcementContent:m,url:$,visibility:u});return s.jsx(Zs,{afterClose:()=>{p("announcement-bar")},buttonsDisabled:c.disabled,cancelLabel:"Close",deviceSelector:!0,dirty:!1,okColor:c.color,okLabel:c.label||"Save",preview:W,previewBgColor:"greygradient",previewToolbarTabs:C,selectedURL:x,sidebar:T,testId:"announcement-bar-modal",title:"Announcement",titleHeadingLevel:5,onOk:async()=>{await o({fakeWhenUnchanged:!0})||xt({type:"error",message:"An error occurred while saving your changes. Please try again."})},onSelectURL:O})},XM=ye.create(GM),Bf=[{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"}]}],KM=e=>Bf.flatMap(({options:a})=>a).find(a=>a.value===e)?.label,ZM=ns({method:"POST",path:()=>"/webhooks/",body:e=>({webhooks:[e]}),updateQueries:{dataType:el,emberUpdateType:"createOrUpdate",update:(e,n)=>n&&{...n,integrations:n.integrations.map(a=>{const o=e.webhooks[0];return o.integration_id===a.id?{...a,webhooks:[...a.webhooks||[],o]}:a})}}}),VM=ns({method:"PUT",path:e=>`/webhooks/${e.id}/`,body:e=>({webhooks:[e]}),updateQueries:{dataType:el,emberUpdateType:"createOrUpdate",update:(e,n)=>n&&{...n,integrations:n.integrations.map(a=>{var o;return{...a,webhooks:(o=a.webhooks)==null?void 0:o.map(c=>c.id===e.webhooks[0].id?e.webhooks[0]:c)}})}}}),QM=ns({method:"DELETE",path:e=>`/webhooks/${e}/`,updateQueries:{dataType:el,emberUpdateType:"createOrUpdate",update:(e,n,a)=>({...n,integrations:n.integrations.map(o=>{var c;return{...o,webhooks:(c=o.webhooks)==null?void 0:c.filter(m=>m.id!==a)}})})}}),JM=({webhook:e,integrationId:n})=>{const a=Zt(),{mutateAsync:o}=ZM(),{mutateAsync:c}=VM(),m=ot(),{formState:y,updateForm:h,handleSave:l,errors:f,clearError:u}=kr({initialState:e||{},onSave:async()=>{y.id?await c(y):await o({...y,integration_id:n})},onSaveError:m,onValidate:()=>{const p={};return y.name||(p.name="Enter a name"),y.event||(p.event="Select an event"),y.target_url||(p.target_url="Enter a target URL"),y.target_url&&!Nt.isURL(y.target_url,{require_tld:!1})&&(p.target_url="Enter a valid URL"),p}});return s.jsx(yt,{okColor:"black",okLabel:e?"Update":"Add",size:"sm",testId:"webhook-modal",title:"Add webhook",formSheet:!0,onOk:async()=>{await l()&&a.remove()},children:s.jsx("div",{className:"mt-5",children:s.jsxs(tt,{marginBottom:!1,marginTop:!1,children:[s.jsx(Ae,{error:!!f.name,hint:f.name,maxLength:191,placeholder:"Custom webhook",title:"Name",value:y.name,onChange:p=>h(x=>({...x,name:p.target.value})),onKeyDown:()=>u("name")}),s.jsx(Lt,{error:!!f.event,hint:f.event,options:Bf,prompt:"Select an event",selectedOption:Bf.flatMap(p=>p.options).find(p=>p.value===y.event),testId:"event-select",title:"Event",hideTitle:!0,onSelect:p=>{h(x=>({...x,event:p?.value})),u("event")}}),s.jsx(Ae,{error:!!f.target_url,hint:f.target_url,maxLength:2e3,placeholder:"https://example.com",title:"Target URL",type:"url",value:y.target_url,onChange:p=>h(x=>({...x,target_url:p.target.value})),onKeyDown:()=>u("target_url")}),s.jsx(Ae,{maxLength:191,placeholder:"https://example.com",title:"Secret",value:y.secret||void 0,onChange:p=>h(x=>({...x,secret:p.target.value}))})]})})})},Kh=ye.create(JM),ej=({integration:e})=>{const{mutateAsync:n}=QM(),a=ot(),o=c=>{ye.show(Et,{title:"Are you sure?",prompt:"Deleting this webhook may prevent the integration from functioning.",okColor:"red",okLabel:"Delete Webhook",onOk:async m=>{try{await n(c),m?.remove(),xt({message:"Webhook deleted",type:"info"})}catch(y){a(y)}}})};return s.jsxs("div",{children:[s.jsxs(K_,{children:[s.jsxs(dh,{bgOnHover:!1,children:[s.jsxs(Fh,{children:[e.webhooks?.length||0," ",e.webhooks?.length===1?"webhook":"webhooks"]}),s.jsx(Fh,{children:"Last triggered"})]}),e.webhooks?.map(c=>s.jsxs(dh,{action:s.jsx(Ue,{color:"red",label:"Delete",link:!0,onClick:m=>{m?.stopPropagation(),o(c.id)}}),bgOnHover:!1,hideActions:!0,onClick:()=>{ye.show(Kh,{webhook:c,integrationId:e.id})},children:[s.jsxs(ph,{className:"w-3/4",children:[s.jsx("div",{className:"text-sm font-semibold",children:c.name}),s.jsxs("div",{className:"grid grid-cols-[max-content_1fr] gap-x-1 text-xs leading-snug",children:[s.jsx("span",{className:"text-grey-600",children:"Event:"}),s.jsx("span",{children:KM(c.event)}),s.jsx("span",{className:"text-grey-600",children:"URL:"}),s.jsx("span",{className:"line-clamp-3 break-all",title:c.target_url,children:c.target_url})]})]}),s.jsx(ph,{className:"w-1/4 text-sm",children:c.last_triggered_at&&new Date(c.last_triggered_at).toLocaleString("default",{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}))]}),s.jsx("div",{className:"mt-5",children:s.jsx(Ue,{color:"green",icon:"add",iconColorClass:"text-green",label:"Add webhook",size:"sm",link:!0,onClick:()=>{ye.show(Kh,{integrationId:e.id})}})})]})},tj=({integration:e})=>{const n=Zt(),{updateRoute:a}=Qe(),{mutateAsync:o}=Z_(),{mutateAsync:c}=dd(),{mutateAsync:m}=Xs(),y=ot(),{formState:h,updateForm:l,handleSave:f,saveState:u,errors:p,clearError:x,okProps:v}=kr({initialState:e,savingDelay:500,savedDelay:500,onSave:async()=>{await o(h)},onSavedStateReset:()=>{a("integrations")},onSaveError:y,onValidate:()=>{const $={};return h.name||($.name="Enter integration title"),$}}),_=e.api_keys?.find($=>$.type==="admin"),k=e.api_keys?.find($=>$.type==="content"),[M,T]=D.useState(!1),[A,C]=D.useState(!1);D.useEffect(()=>{e.type!=="custom"&&(n.remove(),a("integrations"))},[e.type,n,a]);const O=($,W)=>{W(!1);const R=$.type==="content"?"Content":"Admin";ye.show(Et,{title:`Regenerate ${R} API Key`,prompt:`You can regenerate ${R} API Key any time, but any scripts or applications using it will need to be updated.`,okLabel:`Regenerate ${R} API Key`,onOk:async Z=>{try{await c({integrationId:e.id,apiKeyId:$.id}),W(!0),Z?.remove()}catch(X){y(X)}}})};return s.jsxs(yt,{afterClose:()=>{a("integrations")},buttonsDisabled:v.disabled,cancelLabel:"Close",dirty:u==="unsaved",okColor:v.color,okLabel:v.label||"Save",size:"md",testId:"custom-integration-modal",title:h.name||"Custom integration",stickyFooter:!0,onOk:async()=>{await f({fakeWhenUnchanged:!0})},children:[s.jsxs("div",{className:"mt-7 flex w-full flex-col gap-7 md:flex-row",children:[s.jsx("div",{children:s.jsx(un,{height:"100px",id:"custom-integration-icon",imageURL:h.icon_image||void 0,width:"100px",onDelete:()=>l($=>({...$,icon_image:null})),onUpload:async $=>{try{const W=on(await m({file:$}));l(R=>({...R,icon_image:W}))}catch(W){const R=W;R.response.status===415&&(R.message="Unsupported file type"),y(R)}},children:"Upload icon"})}),s.jsx("div",{className:"flex grow flex-col",children:s.jsxs(tt,{children:[s.jsx(Ae,{error:!!p.name,hint:p.name,maxLength:191,title:"Title",value:h.name,onChange:$=>l(W=>({...W,name:$.target.value})),onKeyDown:()=>x("name")}),s.jsx(Ae,{maxLength:2e3,title:"Description",value:h.description||"",onChange:$=>l(W=>({...W,description:$.target.value}))}),s.jsx(al,{keys:[{label:"Content API key",text:k?.secret,hint:A?s.jsx("div",{className:"text-green",children:"Content API Key was successfully regenerated"}):void 0,onRegenerate:()=>k&&O(k,C)},{label:"Admin API key",text:_?.secret,hint:M?s.jsx("div",{className:"text-green",children:"Admin API Key was successfully regenerated"}):void 0,onRegenerate:()=>_&&O(_,T)},{label:"API URL",text:window.location.origin+no().subdir}]})]})})]}),s.jsx("div",{children:s.jsx(ej,{integration:e})})]})},rj=({params:e})=>{const{data:{integrations:n}={}}=Qf(),a=n?.find(({id:o})=>o===e?.id);return a?s.jsx(tj,{integration:a}):null},nj=ye.create(rj),sj=({problem:e})=>{const[n,a]=D.useState(!1),o=()=>{a(!n)};return s.jsx(On,{title:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`${e.level==="error"?"before:bg-red":"before:bg-yellow"} relative px-4 text-sm before:absolute before:left-0 before:top-1.5 before:block before:size-2 before:rounded-full before:content-['']`,children:[e?.fatal?s.jsx("strong",{children:"Fatal: "}):s.jsx("strong",{children:e.level==="error"?"Error: ":"Warning: "}),s.jsx("span",{dangerouslySetInnerHTML:{__html:e.rule}}),s.jsx("div",{className:"absolute -right-4 top-1",children:s.jsx(Ue,{color:"green",icon:n?"chevron-down":"chevron-right",iconColorClass:"text-grey-700",size:"sm",link:!0,onClick:()=>o()})})]}),n?s.jsxs("div",{className:"mt-2 px-4 text-[13px] leading-8",children:[s.jsx("div",{dangerouslySetInnerHTML:{__html:e.details},className:"mb-4"}),s.jsx(bt,{level:6,children:"Affected files:"}),s.jsx("ul",{className:"mt-1",children:e.failures.map(c=>s.jsxs("li",{children:[s.jsx("code",{children:c.ref}),c.message?`: ${c.message}`:""]}))})]}):null]}),hideActions:!0,separator:!0})},aj=({title:e,prompt:n,fatalErrors:a,onRetry:o})=>{let c=null;return a&&(c=s.jsx("div",{className:"mt-10",children:s.jsx(cn,{title:"Errors",children:a.map(m=>typeof m.details=="object"&&m.details.errors&&m.details.errors.length>0?m.details.errors.map(y=>s.jsx(sj,{problem:y})):typeof m.details=="string"?s.jsx(On,{title:m.details}):null)})})),s.jsx(qg,{cancelLabel:"Close",okColor:"black",okLabel:"Retry",prompt:s.jsxs(s.Fragment,{children:[n,c]}),title:e,onOk:o})},rx=ye.create(aj),hd=()=>{const e=V_(),a=!e.data?.themes[0]?.warnings?.some(c=>c.code==="GS051-CUSTOM-FONTS"),o=D.useCallback(()=>{e.refetch()},[e]);return{supportsCustomFonts:a,refreshActiveThemeData:o}};function oj(e){let n=e.package?.name||e.name;return Q_(e)?n+=" (default)":J_(e)?n+=" (legacy)":e.package?.name!==e.name&&(n=s.jsxs("span",{className:"text-sm md:text-base",children:[n," ",s.jsxs("span",{className:"text-grey-600",children:["(",e.name,")"]})]})),Yg(e)&&(n=s.jsxs("span",{className:"text-sm font-bold md:text-base",children:[n," — ",s.jsx("span",{className:"text-green",children:" Active"})]})),n}function ij(e){return e.package?.version||"1.0"}const lj=({theme:e})=>{const{mutateAsync:n}=Jf(),{mutateAsync:a}=e2(),{refreshActiveThemeData:o}=hd(),c=ot(),m=async()=>{try{await n(e.name),o(),xt({title:"Theme activated",type:"success",message:s.jsxs("div",{children:[s.jsx("span",{className:"capitalize",children:e.name})," is now your active theme"]})})}catch(p){let x=null;p instanceof ts&&p.response?.status===422&&p.data?.errors?x=p.data.errors:c(p);let v="Invalid Theme",_=s.jsx(s.Fragment,{children:"This theme is invalid and cannot be activated. Fix the following errors and re-upload the theme"});x&&ye.show(rx,{title:v,prompt:_,fatalErrors:x,onRetry:async k=>{k?.remove(),m()}})}},y=async()=>{const{apiRoot:p}=no();g_(`${p}/themes/${e.name}/download`)},h=async()=>{ye.show(Et,{title:"Are you sure you want to delete this?",prompt:s.jsxs(s.Fragment,{children:["You are about to delete ",s.jsxs("strong",{children:['"',e.name,'".']})," This is permanent! We warned you, k? Maybe download"," ",s.jsx("span",{className:"cursor-pointer text-green-500",onClick:()=>{y()},children:"your theme before continuing"})]}),okLabel:"Delete",okRunningLabel:"Deleting",okColor:"red",onOk:async p=>{try{await a(e.name),p?.remove()}catch(x){c(x)}}})};let l=[];Yg(e)||l.push(s.jsx(Ue,{className:"ml-2",color:"green",label:"Activate",link:!0,onClick:m},"activate"));let f=[{id:"download",label:"Download",onClick:y}];t2(e)&&f.push({id:"delete",label:"Delete",onClick:h});const u={iconColorClass:"text-base",size:"sm"};return s.jsxs("div",{className:"-mr-3 flex items-center gap-4",children:[l,s.jsx(E0,{items:f,position:"end",triggerButtonProps:u})]})},cj=({themes:e})=>(e.sort((n,a)=>n.active&&!a.active?-1:!n.active&&a.active?1:n.package?.name&&a.package?.name?n.package.name.localeCompare(a.package.name):n.name.localeCompare(a.name)),s.jsx(cn,{pageTitle:"Installed themes",children:e.map(n=>{const a=oj(n),o=ij(n);return s.jsx(On,{action:s.jsx(lj,{theme:n}),detail:o,id:`theme-${n.name}`,separator:!1,testId:"theme-list-item",title:a},n.name)})})),uj=({themes:e})=>s.jsx(ud,{children:s.jsx(cj,{themes:e})}),fj=""+new URL("footer-marketplace-bg-BpIYEF6z.png",import.meta.url).href,dj=3e3,Zh=e=>e.variants&&e.variants.length>0,fu=e=>{const n=[{category:e.category,previewUrl:e.previewUrl,image:e.image}];return e.variants&&e.variants.length>0&&n.push(...e.variants),n},pj=({onSelectTheme:e})=>{const n=r2(),[a,o]=D.useState(null),[c,m]=D.useState(0),y=h=>{o(h),m(h!==null&&Zh(h)&&fu(h).length>1?1:0)};return D.useEffect(()=>{if(a===null)return;const h=setInterval(()=>{m((c+1)%(fu(a).length||0))},dj);return()=>clearInterval(h)},[a,c]),s.jsxs(ud,{heading:"Themes",children:[s.jsx("div",{className:"mt-[6vmin] grid grid-cols-1 gap-[6vmin] sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4",children:n.map(h=>{const l=Zh(h),f=fu(h),u=a===h;return s.jsxs("button",{className:"flex cursor-pointer flex-col gap-3 text-left",type:"button",onClick:()=>{e?.(h)},children:[s.jsx("div",{className:"relative w-full bg-grey-100 shadow-md transition-all duration-500 hover:scale-[1.05]",onMouseEnter:()=>y(h),onMouseLeave:()=>y(null),children:l?s.jsx(s.Fragment,{children:f.map((p,x)=>s.jsx("img",{alt:`${h.name} Theme - ${p.category}`,className:we("size-full object-contain opacity-0 transition-opacity duration-500",{"opacity-100":x===c&&u||!u&&x===0,relative:x===c,absolute:x!==c,"left-0":x!==c,"top-0":x!==c}),src:p.image},`theme-variant-${p.category.toLowerCase()}`))}):s.jsx("img",{alt:`${h.name} Theme`,className:"size-full object-contain",src:h.image})}),s.jsxs("div",{className:"relative mt-3",children:[s.jsx(bt,{level:4,children:h.name}),l?f.map((p,x)=>s.jsx("span",{className:we("absolute left-0 translate-y-px text-sm text-grey-700 opacity-0",{"opacity-100":x===c&&u||!u&&x===0}),children:p.category})):s.jsx("span",{className:"text-sm text-grey-700",children:h.category})]})]},h.name)})}),s.jsxs("div",{className:"mx-[-8vmin] mb-[-8vmin] mt-[8vmin] bg-black px-[8vmin] py-16 text-center text-lg text-white",style:{background:`#15171a url(${fj}) 100% 100% / 35vw no-repeat`},children:["Find and buy third-party, premium themes from independent developers in the ",s.jsx("a",{className:"inline-block font-semibold text-lime",href:"https://ghost.org/themes/",rel:"noopener noreferrer",target:"_blank",children:"Ghost Marketplace →"})]})]})},Vh=({problem:e})=>{const[n,a]=D.useState(!1);return s.jsx(On,{title:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`${e.level==="error"?"before:bg-red":"before:bg-yellow"} relative px-4 text-sm before:absolute before:left-0 before:top-1.5 before:block before:size-2 before:rounded-full before:content-['']`,children:[s.jsx("strong",{children:e.level==="error"?"Error: ":"Warning: "}),s.jsx("span",{dangerouslySetInnerHTML:{__html:e.rule}}),s.jsx("div",{className:"absolute -right-4 top-1",children:s.jsx(Ue,{color:"green",icon:n?"chevron-down":"chevron-right",iconColorClass:"text-grey-700",size:"sm",link:!0,onClick:()=>a(!n)})})]}),n?s.jsxs("div",{className:"mt-2 px-4 text-[13px] leading-8",children:[s.jsx("div",{dangerouslySetInnerHTML:{__html:e.details},className:"mb-4"}),s.jsx(bt,{level:6,children:"Affected files:"}),s.jsx("ul",{className:"mt-1",children:e.failures.map(o=>s.jsxs("li",{children:[s.jsx("code",{children:o.ref}),o.message?`: ${o.message}`:""]}))})]}):null]}),hideActions:!0,separator:!0})},hj=({title:e,prompt:n,installedTheme:a,onActivate:o})=>{const{mutateAsync:c}=Jf(),{refreshActiveThemeData:m}=hd(),y=ot();let h=null;a&&a.gscan_errors&&(h=s.jsx("div",{className:"mt-6",children:s.jsx(cn,{hint:s.jsxs(s.Fragment,{children:["Highly recommended to fix, functionality ",s.jsx("strong",{children:"could"})," be restricted"]}),title:"Errors",children:a.gscan_errors?.map(u=>s.jsx(Vh,{problem:u}))})}));let l=null;a&&a.warnings&&(l=s.jsx("div",{className:"mt-10",children:s.jsx(cn,{title:"Warnings",children:a.warnings?.map(u=>s.jsx(Vh,{problem:u}))})}));let f=`Activate${a.gscan_errors?.length?" with errors":""}`;return a.active&&(f="OK"),s.jsx(qg,{cancelLabel:"Close",okColor:"black",okLabel:f,okRunningLabel:"Activating...",prompt:s.jsxs(s.Fragment,{children:[n,h,l]}),title:e,onOk:async u=>{if(!a.active)try{const x=(await c(a.name)).themes[0];m(),xt({title:"Theme activated",type:"success",message:s.jsxs("div",{children:[s.jsx("span",{className:"capitalize",children:x.name})," is now your active theme."]})})}catch(p){y(p)}o?.(),u?.remove()}})},nx=ye.create(hj),Qh=e=>e.variants&&e.variants.length>0,Jh=e=>{const n=[{image:e.image,category:e.category,previewUrl:e.previewUrl}];return e.variants&&e.variants.length>0&&n.push(...e.variants),n},em=e=>e.category.toLowerCase(),mj=({selectedTheme:e,isInstalling:n,installedTheme:a,onBack:o,onInstall:c})=>{const[m,y]=D.useState("desktop"),[h,l]=D.useState(void 0);if(!e)return null;let f=e.previewUrl;const u=Jh(e).map(k=>({label:k.category,value:em(k)}));Qh(e)&&(h===void 0&&l(u[0]),f=Jh(e).find(k=>em(k)===h?.value)?.previewUrl||f);let p=`Install ${e.name}`;n?p="Installing...":qi(e)&&!a?.active?p=`Activate ${e.name}`:a&&(p=`Update ${e.name}`);const x=()=>{c?.()},v=s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(fd,{activeItemClassName:"hidden md:!block md:!visible",containerClassName:"whitespace-nowrap",itemClassName:"hidden md:!block md:!visible",items:[{label:"Change theme",onClick:o},{label:e.name}],separatorClassName:"hidden md:!block md:!visible",backIcon:!0,onBack:o}),Qh(e)?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hidden md:!visible md:!block",children:"–"}),s.jsx(Lt,{border:!1,containerClassName:"text-sm font-bold",controlClasses:{menu:"w-24"},fullWidth:!1,options:u,selectedOption:h,clearBg:!0,onSelect:k=>{l(k||void 0)}})]}):null]}),_=s.jsxs("div",{className:"flex justify-end gap-8",children:[s.jsx(an,{buttons:[{icon:"laptop",iconColorClass:m==="desktop"?"text-black dark:text-green":"text-grey-500 dark:text-grey-600",link:!0,size:"sm",onClick:()=>{y("desktop")}},{icon:"mobile",iconColorClass:m==="mobile"?"text-black dark:text-green":"text-grey-500 dark:text-grey-600",link:!0,size:"sm",onClick:()=>{y("mobile")}}]}),s.jsx(Ue,{color:"green",disabled:n,label:n?"Installing...":p,onClick:x})]});return s.jsxs("div",{className:"absolute inset-0 z-[100]",children:[s.jsx(F0,{containerClassName:"bg-grey-50 dark:bg-black z-[100]",left:v,right:_,sticky:!1}),s.jsx("div",{className:"flex h-[calc(100%-92px)] grow flex-col items-center justify-center bg-grey-50 dark:bg-black",children:m==="desktop"?s.jsx(l0,{children:s.jsx("iframe",{className:"size-full",src:f,title:"Theme preview"})}):s.jsx(c0,{children:s.jsx("iframe",{className:"size-full",src:f,title:"Theme preview"})})})]})},gj=({onUpload:e})=>{const n=Zt();return s.jsx("div",{className:"-mb-6",children:s.jsx(a2,{id:"theme-upload",onUpload:a=>{n.remove(),e(a)},children:s.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"})})})},xj=({currentTab:e,setCurrentTab:n,themes:a})=>{const o=Zt(),{updateRoute:c}=Qe(),{mutateAsync:m}=s2(),{checkThemeLimitError:y,isThemeLimited:h}=td(),l=ot(),[f,u]=D.useState(),[p,x]=D.useState(!1);D.useEffect(()=>{(async()=>{if(h){const O=await y(".");u({enabled:!1,error:O||"Your current plan doesn't support uploading custom themes."})}else u({enabled:!0})})()},[y,h]);const v=()=>{c("/")},_=async C=>{const O=C?.name.replace(/\.zip$/,""),$=a.map(W=>W.name);qi({name:O})?ye.show(Et,{title:"Upload failed",cancelLabel:"Cancel",okLabel:"",prompt:s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["The default ",s.jsx("strong",{children:O})," theme cannot be overwritten."]}),s.jsx("p",{children:"Rename your zip file and try again."})]}),onOk:async W=>{W?.remove()}}):$.includes(O)?ye.show(Et,{title:"Overwrite theme",prompt:s.jsxs(s.Fragment,{children:["The theme ",s.jsx("strong",{children:O})," already exists. Do you want to overwrite it?"]}),okLabel:"Overwrite",cancelLabel:"Cancel",okRunningLabel:"Overwriting...",okColor:"red",onOk:async W=>{x(!0);const R=$.indexOf(O);a.splice(R,1),await k({file:C,onActivate:v}),x(!1),n("installed"),W?.remove()}}):(n("installed"),k({file:C,onActivate:v}))},k=async({file:C,onActivate:O})=>{let $,W=null;try{x(!0),$=await m({file:C}),x(!1)}catch(q){x(!1),q instanceof ts&&q.response?.status===422&&q.data?.errors?W=q.data.errors:l(q)}if(W&&!$){let q="Invalid Theme",B=s.jsx(s.Fragment,{children:"This theme is invalid and cannot be activated. Fix the following errors and re-upload the theme"});ye.show(rx,{title:q,prompt:B,fatalErrors:W,onRetry:async()=>{o?.remove(),T()}})}if(!$)return;const R=$.themes[0];let Z="Upload successful",X=s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:R.name})," uploaded"]});if(R.active||(X=s.jsxs(s.Fragment,{children:[X," ","Do you want to activate it now?"]})),R?.gscan_errors?.length||R.warnings?.length){const q=R?.gscan_errors?.length;Z=`Upload successful with ${q?"errors":"warnings"}`,X=s.jsxs(s.Fragment,{children:["The theme ",s.jsxs("strong",{children:['"',R.name,'"']})," was installed but we detected some ",q?"errors":"warnings","."]}),R.active||(X=s.jsxs(s.Fragment,{children:[X,"You are still able to activate and use the theme but it is recommended to fix these ",q?"errors":"warnings"," before you do so."]}))}ye.show(nx,{title:Z,prompt:X,installedTheme:R,onActivate:O})},M=s.jsx("div",{className:"hidden md:!visible md:!block",children:s.jsx(Dn,{border:!1,selectedTab:e,tabs:[{id:"official",title:"Official themes"},{id:"installed",title:"Installed"}],onTabChange:C=>{n(C)}})}),T=()=>{f&&(f.enabled?ye.show(Et,{title:"Upload theme",prompt:s.jsx(gj,{onUpload:_}),okLabel:"",formSheet:!1}):ye.show(Xr,{title:"Upgrade to enable custom themes",prompt:f.error||s.jsxs(s.Fragment,{children:["Your current plan only supports official themes. You can install them from the ",s.jsx("a",{href:"https://ghost.org/marketplace/",children:"Ghost theme marketplace"}),"."]}),onOk:()=>c({route:"/pro",isExternal:!0})}))},A=s.jsx("div",{className:"flex items-center gap-14",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ue,{label:"Close",onClick:()=>{o.remove(),v()}}),s.jsx(Ue,{color:"black",label:"Upload theme",loading:p,onClick:T})]})});return s.jsxs(s.Fragment,{children:[s.jsx(F0,{containerClassName:"bg-white dark:bg-black",left:M,right:A}),s.jsx("div",{className:"px-[8vmin] md:hidden",children:s.jsx(Dn,{border:!1,selectedTab:e,tabs:[{id:"official",title:"Official themes"},{id:"installed",title:"Installed"}],onTabChange:C=>{n(C)}})})]})},bj=({currentTab:e,onSelectTheme:n,themes:a})=>{switch(e){case"official":return s.jsx(pj,{onSelectTheme:n});case"installed":return s.jsx(uj,{themes:a})}return null},tm=({source:e,themeRef:n})=>{const[a,o]=D.useState("official"),[c,m]=D.useState(null),[y,h]=D.useState("desktop"),[l,f]=D.useState(!1),[u,p]=D.useState(!1),[x,v]=D.useState(!1),{updateRoute:_}=Qe(),k=Zt(),{data:{themes:M}={}}=ed(),{mutateAsync:T}=n2(),{mutateAsync:A}=Jf(),{checkThemeLimitError:C}=td(),O=ot(),$=Z=>{m(Z)};if(D.useEffect(()=>{v(!0)},[]),D.useEffect(()=>{(async()=>{if(e&&n&&!u&&x){const X=n.split("/")[1];if(await C(X)){k.remove();return}let B="Install Theme";const Y=M?.map(ne=>ne.name)||[];let ae=Y.includes(X.toLowerCase());const ee=Y.indexOf(X.toLowerCase()),re=M?.[ee];let Q=s.jsxs(s.Fragment,{children:["By clicking below, ",s.jsx("strong",{children:X})," will automatically be activated as the theme for your site.",ae&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{}),"This will overwrite your existing version of ",s.jsx("strong",{children:X}),re?.active?" which is your active theme":"",". All custom changes will be lost."]})]});ye.show(Et,{title:B,prompt:Q,okLabel:"Install",cancelLabel:"Cancel",okRunningLabel:"Installing...",okColor:"black",onOk:async ne=>{let be;p(!0);try{ae&&M&&M.splice(ee,1),be=await T(n),be?.themes[0]&&(await A(be.themes[0].name),xt({title:"Theme activated",type:"success",message:s.jsxs("div",{children:[s.jsx("span",{className:"capitalize",children:be.themes[0].name})," is now your active theme"]})})),ne?.remove(),_("")}catch(je){O(je)}}})}})()},[n,e,T,O,A,_,M,u,C,k,x]),!M)return;let W,R;if(c){W=M.find(X=>X.name.toLowerCase()===c.name.toLowerCase()),R=async()=>{const X=await C(c.name);if(X){ye.show(Xr,{prompt:X,onOk:()=>_({route:"/pro",isExternal:!0})});return}return W&&!qi(c)?new Promise(q=>{ye.show(Et,{title:"Overwrite theme",prompt:s.jsxs(s.Fragment,{children:["This will overwrite your existing version of ",c.name,W?.active?", which is your active theme":"",". All custom changes will be lost."]}),okLabel:"Overwrite",okRunningLabel:"Installing...",cancelLabel:"Cancel",okColor:"red",onOk:async B=>{B?.remove(),await Z(),q()}})}):Z()};const Z=async()=>{let X="Success",q=s.jsx(s.Fragment,{});if(qi(c))X="Activate theme",q=s.jsxs(s.Fragment,{children:["By clicking below, ",s.jsx("strong",{children:c.name})," will automatically be activated as the theme for your site."]});else{f(!0);let B;try{B=await T(c.ref)}catch(ae){O(ae)}finally{f(!1)}if(!B)return;const Y=B.themes[0];if(X="Success",q=s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:Y.name})," has been successfully installed."]}),Y.active||(q=s.jsxs(s.Fragment,{children:[q," ","Do you want to activate it now?"]})),Y.gscan_errors?.length||Y.warnings?.length){const ae=Y.gscan_errors?.length;X=`Installed with ${ae?"errors":"warnings"}`,q=s.jsxs(s.Fragment,{children:["The theme ",s.jsxs("strong",{children:['"',Y.name,'"']})," was installed successfully but we detected some ",ae?"errors":"warnings","."]}),Y.active||(q=s.jsxs(s.Fragment,{children:[q,"You are still able to activate and use the theme but it is recommended to contact the theme developer fix these ",ae?"errors":"warnings"," before you do so."]}))}W=Y}ye.show(nx,{title:X,prompt:q,installedTheme:W,onActivate:()=>{_("")}})}}return s.jsx(yt,{afterClose:()=>{_("")},animate:!1,cancelLabel:"",footer:!1,padding:!1,size:"full",testId:"theme-modal",title:"",scrolling:!0,onCancel:()=>{k.remove(),_("")},children:s.jsx("div",{className:"flex h-full justify-between",children:s.jsxs("div",{className:"grow",children:[c&&s.jsx(mj,{installedTheme:W,isInstalling:l,selectedTheme:c,onBack:()=>{m(null)},onClose:()=>{_("")},onInstall:R}),s.jsx(xj,{currentTab:a,modal:k,previewMode:y,selectedTheme:c,setCurrentTab:o,setPreviewMode:h,setSelectedTheme:m,themes:M}),!c&&s.jsx(bj,{currentTab:a,themes:M,onSelectTheme:$})]})})})},vj=({children:e,to:n,classNames:a})=>{const o=n||document.body;if(!o)return s.jsx(s.Fragment,{children:e});const c=m=>{m.stopPropagation()};return x_.createPortal(s.jsx("div",{className:a,onMouseDown:c,children:s.jsx("div",{children:e})}),o)};var wj=Object.defineProperty,yj=(e,n,a)=>n in e?wj(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,jt=(e,n,a)=>yj(e,typeof n!="symbol"?n+"":n,a),sx={exports:{}},Wa={};/**
|
|
4
4
|
* @license React
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-
|
|
1
|
+
import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-f5Lv9kLb.js";import{T as O,a as Q,b as w,c as f}from"./tabs-DCHagOip.js";import"./index-DO76vL0R.js";import"./lucide-react-BARFK2PZ.js";import"./a-large-small-CgWPeKpi.js";import"./wallet-cards-CSdWOmJE.js";import"./at-sign-BottTo2X.js";import"./message-square-text-BxquqPhA.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./sprout-BKiwQsGn.js";import"./trash-CpnxYen-.js";const he=()=>{const{data:N,isLoading:l}=T("index"),{data:g,isLoading:n}=F("index"),m=l?Array(5).fill({apId:"",name:"",handle:"",avatarUrl:""}):N?.pages.flatMap(s=>s.accounts)??[],u=n?Array(5).fill({apId:"",name:""}):g?.pages.flatMap(s=>s.domains)??[],U=_("index"),I=E("index"),[M,x]=d.useState(new Set),B=V("index"),D=H("index"),[S,h]=d.useState(new Set),[p,r]=d.useState(null),y=R(),A=s=>{x(t=>{const a=new Set([...t]);return a.add(s.apId),a}),I.mutate(s),c.success("User unblocked")},L=s=>{x(t=>{const a=new Set([...t]);return a.delete(s.apId),a}),U.mutate(s),c.success("User blocked")},C=s=>{h(t=>{const a=new Set([...t]);return a.add(s.url),a}),D.mutate({url:s.url}),c.success("Domain unblocked")},P=s=>{h(t=>{const a=new Set([...t]);return a.delete(s.url),a}),B.mutate({url:s.url}),c.success("Domain blocked")};return e.jsx(W,{children:e.jsxs("div",{className:"mx-auto max-w-[620px] py-[min(4vh,48px)]",children:[e.jsx("div",{className:"flex items-center justify-between gap-8",children:e.jsx($,{children:"Moderation"})}),e.jsx("div",{className:"mt-6",children:e.jsxs(O,{defaultValue:"blocked_users",variant:"underline",children:[e.jsxs(Q,{children:[e.jsx(w,{value:"blocked_users",children:"Blocked users"}),e.jsx(w,{value:"blocked_domains",children:"Blocked domains"})]}),e.jsx(f,{className:"mt-2",value:"blocked_users",children:!l&&m.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block someone, they won't be able to follow you or interact with your content on the social web."})})]}):m.map((s,t)=>e.jsx(G,{actor:s,isCurrentUser:!0,children:e.jsx("div",{children:e.jsxs(v,{onClick:l?void 0:()=>J(s.handle,y),children:[e.jsx(K,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle}}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:l?e.jsx(o,{className:"w-24"}):s.name}),e.jsx("span",{className:"block truncate text-sm text-gray-600",children:l?e.jsx(o,{className:"w-40"}):s.handle})]}),M.has(s.apId)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:a=>{a.stopPropagation(),L(s)},children:"Block"}):l?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:a=>{a.stopPropagation(),A(s)},onMouseEnter:()=>r(s.apId),onMouseLeave:()=>r(null),children:p===s.apId?"Unblock":"Blocked"})]})})},s.apId?s.apId:`loading-${t}`))}),e.jsx(f,{className:"mt-[11px]",value:"blocked_domains",children:!n&&u.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block a domain, all users from that domain won't be able to follow you or interact with your content."})})]}):u.map((s,t)=>e.jsxs(v,{children:[e.jsx("div",{className:"flex min-w-0 flex-col",children:e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:n?e.jsx(o,{className:"w-48"}):new URL(s.url).hostname})}),S.has(s.url)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:()=>P(s),children:"Block"}):n?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:()=>C(s),onMouseEnter:()=>r(s.url),onMouseLeave:()=>r(null),children:p===s.url?"Unblock":"Blocked"})]},s.url?s.url:`loading-${t}`))})]})})]})})};export{he as default};
|