@tryghost/portal 2.72.30 → 2.72.31
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/package.json +1 -1
- package/umd/portal.min.js +34 -34
- package/umd/portal.min.js.map +1 -1
package/umd/portal.min.js
CHANGED
|
@@ -703,7 +703,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
703
703
|
width: 38px !important;
|
|
704
704
|
height: 22px !important;
|
|
705
705
|
}
|
|
706
|
-
`;function gf({id:e,label:t=``,onToggle:n,checked:r=!1,disabled:i=!1,dataTestId:a=`switch-input`,presentational:o=!1}){let[s,c]=(0,_.useState)(r);(0,_.useEffect)(()=>{c(r)},[r]);let l=(0,_.useRef)(null);(0,_.useEffect)(()=>{l.current&&l.current.checked!==s&&(l.current.checked=s)},[s,e]);let u=e=>{i||(o||c(e.target.checked),n(e,e.target.checked))},d=o?{"aria-hidden":!0}:{},f=o?{tabIndex:-1}:{"aria-label":t};return(0,q.jsx)(`div`,{className:`gh-portal-for-switch`,"data-test-switch":a,...d,children:(0,q.jsxs)(`label`,{className:`switch`,htmlFor:e,children:[(0,q.jsx)(`input`,{ref:l,type:`checkbox`,checked:s,disabled:i,id:e,onChange:u,...f}),(0,q.jsx)(`span`,{className:`input-toggle-component`,"data-testid":a})]})})}var _f=`.gh-portal-account-header{flex-direction:column;align-items:center;margin:0 0 32px;display:flex}.gh-portal-account-header .gh-portal-avatar{margin:6px 0 8px!important}.gh-portal-account-data{margin-bottom:40px}footer.gh-portal-account-footer{display:flex}.gh-portal-account-footer.paid{margin-top:12px}.gh-portal-account-footermenu{align-items:center;margin:0;padding:0;list-style:none;display:flex}.gh-portal-account-footerright{flex-grow:1;justify-content:flex-end;align-items:center;display:flex}.gh-portal-account-footermenu li{margin-inline-end:16px}.gh-portal-account-footermenu li:last-of-type{margin-inline-end:0}.gh-portal-freeaccount-newsletter{justify-content:space-between;align-items:center;margin-top:24px;display:flex}.gh-portal-freeaccount-newsletter .label{flex-direction:column;flex-grow:1;display:flex}.gh-portal-free-ctatext{margin-top:-12px}.gh-portal-cancelcontinue-container{margin:24px 0 32px}.gh-portal-cancel-banner{text-align:center;color:var(--grey1);border-radius:8px;margin-bottom:16px;padding:16px;font-size:1.4rem;line-height:1.5;position:relative}.gh-portal-cancel-banner:before{content:"";background:var(--brandcolor);opacity:.05;pointer-events:none;z-index:0;border-radius:8px;display:block;position:absolute;inset:0}.gh-portal-cancel-banner>*{z-index:1;position:relative}.gh-portal-cancel-banner p{max-width:320px;margin:0 auto 16px}.gh-portal-canceled-badge{letter-spacing:.05px;text-transform:uppercase;color:var(--grey6);background:color-mix(in srgb, var(--grey12) 60%, transparent);vertical-align:middle;border-radius:32px;margin-inline-start:6px;padding:6px 8px;font-size:1.1rem;font-weight:600;line-height:1em;display:inline-block;position:relative;top:-1px}.gh-portal-list-detail .gh-portal-email-notice{color:var(--red);letter-spacing:.2px;align-items:center;gap:5px;margin-top:6px;font-size:1.25rem;font-weight:500;display:flex}.gh-portal-email-notice-icon{width:20px;height:20px}.gh-portal-billing-button-loader{opacity:.6;width:32px;height:32px;margin-inline-end:-3px}.gh-portal-product-icon{border-radius:2px;width:52px;margin-inline-end:12px}.gh-portal-account-discountcontainer{flex-wrap:wrap;align-items:center;display:flex;position:relative}.gh-portal-account-expiry{white-space:nowrap}.gh-portal-account-expiry-separator{margin:0 4px}@media (width<=480px){.gh-portal-account-expiry-separator{display:none}.gh-portal-account-expiry{flex-basis:100%}}.gh-portal-account-old-price{text-decoration:line-through;color:var(--grey9)!important}.gh-portal-account-tagicon{width:16px;height:16px;color:var(--brandcolor);z-index:999;margin-inline-end:4px}@media (width<=390px){.gh-portal-account-footer{padding:0!important}}@media (width<=340px){.gh-portal-account-footer{flex-wrap:wrap;gap:12px;padding:0!important}.gh-portal-account-footer .gh-portal-account-footerright{justify-content:flex-start}}.gh-portal-gift-card{margin-top:16px}.gh-portal-gift-card-icon{stroke-width:2px;width:16px;height:16px;margin-inline-end:4px}`,vf=class extends _.Component{static contextType=J;closePopup=()=>{this.context.doAction(`closePopup`)};render(){let{brandColor:e,onClick:t}=this.props,n=e||this.context.brandColor;return(0,q.jsx)(`button`,{type:`button`,className:`gh-portal-closeicon-container`,"aria-label":`Close popup`,"data-testid":`close-popup`,"data-test-button":`close-popup`,onClick:t||this.closePopup,children:(0,q.jsx)(Hd,{className:`gh-portal-closeicon`,style:n?{color:n}:void 0,"aria-hidden":`true`})})}},yf=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[(0,q.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,q.jsx)(`path`,{d:`M12 8v13`}),(0,q.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7`}),(0,q.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0-5C9 3 12 8 12 8`}),(0,q.jsx)(`path`,{d:`M16.5 8a2.5 2.5 0 0 0 0-5C15 3 12 8 12 8`})]}),bf=e=>{if(!e)return[];let t=`${e.replace(/\/$/,``)}/gift/assets`;return[`${t}/gift-card-orb.webp`,`${t}/gift-card-noise.webp`]},xf=e=>{bf(e).forEach(e=>{new Image().src=e})},Sf=({cardRef:e,duration:t,tierName:n,name:r,toName:i,fromName:a,giftValue:o,siteIcon:s,siteTitle:c})=>{let{site:l}=(0,_.useContext)(J),[u,d]=bf(l?.url),f=t&&n,p=r||i||a||o;return(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-frame`,children:(0,q.jsxs)(`div`,{ref:e,className:`gh-portal-gift-checkout-card`,style:u&&{"--gh-gift-orb":`url("${u}")`,"--gh-gift-noise":`url("${d}")`},children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-notch`,"aria-hidden":`true`}),f&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-meta`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-duration`,"data-testid":`gift-card-duration`,children:t}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-tier`,children:K(`{tierName} membership`,{tierName:n})})]}),p&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-details`,children:[r&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`Name`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:r})]}),i&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`To`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:i})]}),a&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`From`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:a})]}),o&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`Gift value`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,"data-testid":`gift-card-value`,children:o})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-site`,children:[s&&(0,q.jsx)(`img`,{className:`gh-portal-gift-checkout-card-site-icon`,src:s,alt:``}),(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-card-site-name`,children:c})]})]})})},Cf=[1,3,6,12];function wf(e,t){return t===12?e.yearlyPrice??null:e.monthlyPrice??null}function Tf(e){return!!e&&typeof e.amount==`number`&&Number.isSafeInteger(e.amount)&&e.amount>0&&typeof e.currency==`string`&&!!e.currency}function Ef({portalPlans:e,duration:t}){return t===12?e.includes(`yearly`):e.includes(`monthly`)}function Df(e,t){let n=wf(e,t);return Tf(n)?{...n,amount:t===12?n.amount:n.amount*t}:null}function Of({site:e,duration:t}){let{paid_members_enabled:n,portal_plans:r=[],portal_products:i,products:a=[]}=e||{};if(!n||!Ef({portalPlans:r,duration:t}))return[];let o=Array.isArray(i)?i:null;return a.filter(e=>e?.type===`paid`&&(!o||o.includes(e.id))&&!!Df(e,t)).map(e=>({product:e,amount:Df(e,t)?.amount??0})).sort((e,t)=>e.amount-t.amount).map(({product:e})=>e)}function kf({site:e}){return Cf.filter(t=>Of({site:e,duration:t}).length>0)}function Af({site:e}){return kf({site:e}).length>0}function jf({site:e}){return e?.portal_signup_gift_promotion===!0&&Af({site:e})}function Mf({site:e}){return e?.portal_account_gift_promotion===!0&&Af({site:e})}function Nf({availableDurations:e,portalDefaultPlan:t,selectedDuration:n}){if(n&&e.includes(n))return n;let r=t===`yearly`?12:1;return e.includes(r)?r:e[0]??null}var Pf=({className:e,lastPage:t})=>{let{brandColor:n,doAction:r,site:i}=(0,_.useContext)(J),a=jf({site:i});if((0,_.useEffect)(()=>{a&&xf(i?.url)},[a,i?.url]),!a)return null;let o=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{children:K(`Buying for someone else?`)}),(0,q.jsxs)(`button`,{className:`gh-portal-btn gh-portal-btn-link gh-portal-signup-message-gift`,"data-test-button":`gift-switch`,"data-testid":`gift-switch`,style:{color:n},type:`button`,onClick:()=>r(`switchPage`,{page:`gift`,lastPage:t}),children:[(0,q.jsx)(yf,{"aria-hidden":`true`,className:`gh-portal-signup-message-icon`}),(0,q.jsx)(`span`,{children:K(`Gift a membership`)})]})]});return e?(0,q.jsx)(`div`,{className:e,children:o}):o},Ff=e=>({leaf:`text`,format:e}),If=(e=>({leaf:`choice`,from:e}))(`countries`),Lf=[`short_text`,`long_text`,`list`,`address`,`phone`],Rf={short_text:{shape:`scalar`,leaf:Ff(`line`)},long_text:{shape:`scalar`,leaf:Ff(`long`)},list:{shape:`set`},address:{shape:`record`,parts:{line1:Ff(`line`),line2:Ff(`line`),city:Ff(`line`),state:Ff(`line`),postal_code:Ff(`code`),country:If}},phone:{shape:`scalar`,leaf:Ff(`phone`)}};function zf(e){let t=[];for(let n in e)t.push(n);return t}function Bf(e,t){return e.options.filter(e=>t.includes(e))}function Vf(e,t){return!e.multiple&&t.length>1?[]:Bf(e,t)}function Hf(e){return Lf.some(t=>t===e)}var Uf=e=>t=>Hf(t)&&Rf[t].shape===e,Wf=Uf(`scalar`),Gf=Uf(`record`),Kf=Uf(`set`);function qf(e,t){return Wf(e)?t.scalar(Rf[e],e):Gf(e)?t.record(Rf[e],e):Kf(e)?t.set(Rf[e],e):$f(e)}var Jf=e=>t=>Uf(e)(t.type),Yf=Jf(`scalar`),Xf=Jf(`record`),Zf=Jf(`set`);function Qf(e,t){if(Yf(e))return t.scalar(e);if(Xf(e))return t.record(e);if(Zf(e))return t.set(e);throw Error(`Unknown field type: ${String(e.type)}`)}function $f(e){throw Error(`Unknown field type: ${String(e)}`)}function ep(e,t){switch(e.leaf){case`text`:return t.text(e);case`choice`:return t.choice(e)}}function tp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var np=e=>typeof e==`string`&&e.trim()===``?void 0:e,rp={kind:`string`,read:e=>typeof e==`string`?np(e.trim()):void 0,fromText:e=>e.trim()},ip={text:rp,choice:rp},ap=(e,t)=>ip[e.leaf].read(t);function op(e){for(let t of zf(ip)){let n=ip[t].read(e);if(n!==void 0)return n}}var sp=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),cp=e=>(t,n)=>n===void 0?t===void 0?void 0:null:t===void 0?n:e(t,n),lp=e=>{let t={};for(let n of zf(e)){let r=np(e[n]??void 0);r!==void 0&&(t[n]=r)}return zf(t).length>0?t:void 0},up=e=>e.length>0?e:void 0,dp={parse:(e,t)=>op(t),same:(e,t)=>e===t,apply:(e,t)=>t,diff:cp((e,t)=>e===t?void 0:t)},fp={parse:(e,t)=>{if(!tp(t))return;let n=Rf[e].parts,r={};for(let e of zf(n)){let i=ap(n[e],t[e]);i!==void 0&&(r[e]=i)}return zf(r).length>0?r:void 0},same:(e,t)=>fp.diff(e,t)===void 0,apply:(e,t)=>{let n={...e};for(let e of zf(t)){let r=t[e];r!==void 0&&(n[e]=r)}return lp(n)},diff:(e,t)=>{if(e===void 0)return t;let n=t??{},r={};for(let t of zf({...e,...n}))e[t]!==n[t]&&(r[t]=n[t]??null);return zf(r).length>0?r:void 0}},pp={parse:(e,t)=>sp(t)?up(t):void 0,same:(e,t)=>{let n=new Set(t);return new Set(e).size===n.size&&e.every(e=>n.has(e))},apply:(e,t)=>t,diff:cp((e,t)=>pp.same(e,t)?void 0:t)},mp={scalar:dp,record:fp,set:pp};function hp(e){return Qf(e,{scalar:e=>({shape:`scalar`,field:e}),record:e=>({shape:`record`,field:e}),set:e=>({shape:`set`,field:e})})}var gp=()=>({editable:(e,t)=>t}),_p={scalar:{held:(e,t)=>t,...gp()},record:{held:(e,t)=>t,...gp()},set:{held:({settings:e},t)=>{let n=t=>{let n=e.options.indexOf(t);return n===-1?e.options.length:n};return[...t].sort((e,t)=>n(e)-n(t)||(e<t?-1:+(e>t)))},editable:({settings:e},t)=>up(Vf(e,t))}};function vp({shape:e,field:t},n){let r=mp[e].parse(t.type,n);return r===void 0?void 0:_p[e].held(t,r)}function yp(e,t){let n=vp(e,t);return n===void 0?void 0:_p[e.shape].editable(e.field,n)}var bp=(e,t)=>np(t)===void 0?void 0:ip[e.leaf].fromText(t),xp=(e,t)=>typeof t==`string`?bp(e,t)??t:t,Sp={scalar:{fromText:(e,t)=>xp(Rf[e].leaf,t)},record:{fromText:(e,t)=>{if(!tp(t))return t;let n=Rf[e].parts;return Object.fromEntries(Object.entries(t).map(([e,t])=>{let r=Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return[e,r?xp(r,t):t]}))}},set:{fromText:(e,t)=>t}};function Cp({shape:e,type:t},n){return mp[e].parse(t,Sp[e].fromText(t,n))}var wp={scalar:e=>String(e),record:e=>Object.fromEntries(zf(e).flatMap(t=>{let n=e[t];return n===void 0?[]:[[t,String(n)]]})),set:e=>e};function Tp(e,t){return wp[e](t)}function Ep(e,t){let n=vp(e,t);return n===void 0?void 0:Tp(e.shape,n)}function Dp(e,t){let n=yp(e,t);return n===void 0?void 0:Tp(e.shape,n)}function Op(e,t){let n=Cp({shape:e.shape,type:e.field.type},t);return n===void 0?void 0:yp(e,n)}function kp(e,t,n){return mp[e.shape].diff(vp(e,n),Op(e,t))}var Ap={AC:`247`,AD:`376`,AE:`971`,AF:`93`,AG:`1`,AI:`1`,AL:`355`,AM:`374`,AO:`244`,AR:`54`,AS:`1`,AT:`43`,AU:`61`,AW:`297`,AX:`358`,AZ:`994`,BA:`387`,BB:`1`,BD:`880`,BE:`32`,BF:`226`,BG:`359`,BH:`973`,BI:`257`,BJ:`229`,BL:`590`,BM:`1`,BN:`673`,BO:`591`,BQ:`599`,BR:`55`,BS:`1`,BT:`975`,BW:`267`,BY:`375`,BZ:`501`,CA:`1`,CC:`61`,CD:`243`,CF:`236`,CG:`242`,CH:`41`,CI:`225`,CK:`682`,CL:`56`,CM:`237`,CN:`86`,CO:`57`,CR:`506`,CU:`53`,CV:`238`,CW:`599`,CX:`61`,CY:`357`,CZ:`420`,DE:`49`,DJ:`253`,DK:`45`,DM:`1`,DO:`1`,DZ:`213`,EC:`593`,EE:`372`,EG:`20`,EH:`212`,ER:`291`,ES:`34`,ET:`251`,FI:`358`,FJ:`679`,FK:`500`,FM:`691`,FO:`298`,FR:`33`,GA:`241`,GB:`44`,GD:`1`,GE:`995`,GF:`594`,GG:`44`,GH:`233`,GI:`350`,GL:`299`,GM:`220`,GN:`224`,GP:`590`,GQ:`240`,GR:`30`,GT:`502`,GU:`1`,GW:`245`,GY:`592`,HK:`852`,HN:`504`,HR:`385`,HT:`509`,HU:`36`,ID:`62`,IE:`353`,IL:`972`,IM:`44`,IN:`91`,IO:`246`,IQ:`964`,IR:`98`,IS:`354`,IT:`39`,JE:`44`,JM:`1`,JO:`962`,JP:`81`,KE:`254`,KG:`996`,KH:`855`,KI:`686`,KM:`269`,KN:`1`,KP:`850`,KR:`82`,KW:`965`,KY:`1`,KZ:`7`,LA:`856`,LB:`961`,LC:`1`,LI:`423`,LK:`94`,LR:`231`,LS:`266`,LT:`370`,LU:`352`,LV:`371`,LY:`218`,MA:`212`,MC:`377`,MD:`373`,ME:`382`,MF:`590`,MG:`261`,MH:`692`,MK:`389`,ML:`223`,MM:`95`,MN:`976`,MO:`853`,MP:`1`,MQ:`596`,MR:`222`,MS:`1`,MT:`356`,MU:`230`,MV:`960`,MW:`265`,MX:`52`,MY:`60`,MZ:`258`,NA:`264`,NC:`687`,NE:`227`,NF:`672`,NG:`234`,NI:`505`,NL:`31`,NO:`47`,NP:`977`,NR:`674`,NU:`683`,NZ:`64`,OM:`968`,PA:`507`,PE:`51`,PF:`689`,PG:`675`,PH:`63`,PK:`92`,PL:`48`,PM:`508`,PR:`1`,PS:`970`,PT:`351`,PW:`680`,PY:`595`,QA:`974`,RE:`262`,RO:`40`,RS:`381`,RU:`7`,RW:`250`,SA:`966`,SB:`677`,SC:`248`,SD:`249`,SE:`46`,SG:`65`,SH:`290`,SI:`386`,SJ:`47`,SK:`421`,SL:`232`,SM:`378`,SN:`221`,SO:`252`,SR:`597`,SS:`211`,ST:`239`,SV:`503`,SX:`1`,SY:`963`,SZ:`268`,TA:`290`,TC:`1`,TD:`235`,TG:`228`,TH:`66`,TJ:`992`,TK:`690`,TL:`670`,TM:`993`,TN:`216`,TO:`676`,TR:`90`,TT:`1`,TV:`688`,TW:`886`,TZ:`255`,UA:`380`,UG:`256`,US:`1`,UY:`598`,UZ:`998`,VA:`39`,VC:`1`,VE:`58`,VG:`1`,VI:`1`,VN:`84`,VU:`678`,WF:`681`,WS:`685`,XK:`383`,YE:`967`,YT:`262`,ZA:`27`,ZM:`260`,ZW:`263`};function jp(e){return Object.prototype.hasOwnProperty.call(Ap,e)}var Mp={AC:`00`,AD:`00`,AE:`00`,AF:`00`,AG:`011`,AI:`011`,AL:`00`,AM:`00`,AO:`00`,AR:`00`,AS:`011`,AT:`00`,AU:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,AW:`00`,AX:`00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))`,AZ:`00`,BA:`00`,BB:`011`,BD:`00`,BE:`00`,BF:`00`,BG:`00`,BH:`00`,BI:`00`,BJ:`00`,BL:`00`,BM:`011`,BN:`00`,BO:`00(?:1\\d)?`,BQ:`00`,BR:`00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)`,BS:`011`,BT:`00`,BW:`00`,BY:`810`,BZ:`00`,CA:`011`,CC:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,CD:`00`,CF:`00`,CG:`00`,CH:`00`,CI:`00`,CK:`00`,CL:`(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0`,CM:`00`,CN:`00|1(?:[12]\\d|79)\\d\\d00`,CO:`00(?:4(?:[14]4|56)|[579])`,CR:`00`,CU:`119`,CV:`0`,CW:`00`,CX:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,CY:`00`,CZ:`00`,DE:`00`,DJ:`00`,DK:`00`,DM:`011`,DO:`011`,DZ:`00`,EC:`00`,EE:`00`,EG:`00`,EH:`00`,ER:`00`,ES:`00`,ET:`00`,FI:`00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))`,FJ:`0(?:0|52)`,FK:`00`,FM:`00`,FO:`00`,FR:`00`,GA:`00`,GB:`00`,GD:`011`,GE:`00`,GF:`00`,GG:`00`,GH:`00`,GI:`00`,GL:`00`,GM:`00`,GN:`00`,GP:`00`,GQ:`00`,GR:`00`,GT:`00`,GU:`011`,GW:`00`,GY:`001`,HK:`00(?:30|5[09]|[126-9]?)`,HN:`00`,HR:`00`,HT:`00`,HU:`00`,ID:`00[89]`,IE:`00`,IL:`0(?:0|1(?:05|[2-9]))`,IM:`00`,IN:`00`,IO:`00`,IQ:`00`,IR:`00`,IS:`00|1(?:0(?:01|[12]0)|100)`,IT:`00`,JE:`00`,JM:`011`,JO:`00`,JP:`010`,KE:`000`,KG:`00`,KH:`00[14-9]`,KI:`00`,KM:`00`,KN:`011`,KP:`00|99`,KR:`00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))`,KW:`00`,KY:`011`,KZ:`810`,LA:`00`,LB:`00`,LC:`011`,LI:`00`,LK:`00`,LR:`00`,LS:`00`,LT:`00`,LU:`00`,LV:`00`,LY:`00`,MA:`00`,MC:`00`,MD:`00`,ME:`00`,MF:`00`,MG:`00`,MH:`011`,MK:`00`,ML:`00`,MM:`00`,MN:`001`,MO:`00`,MP:`011`,MQ:`00`,MR:`00`,MS:`011`,MT:`00`,MU:`0(?:0|[24-7]0|3[03])`,MV:`0(?:0|19)`,MW:`00`,MX:`0[09]`,MY:`00`,MZ:`00`,NA:`00`,NC:`00`,NE:`00`,NF:`00`,NG:`009`,NI:`00`,NL:`00`,NO:`00`,NP:`00`,NR:`00`,NU:`00`,NZ:`0(?:0|161)`,OM:`00`,PA:`00`,PE:`00|19(?:1[124]|77|90)00`,PF:`00`,PG:`00|140[1-3]`,PH:`00`,PK:`00`,PL:`00`,PM:`00`,PR:`011`,PS:`00`,PT:`00`,PW:`01[12]`,PY:`00`,QA:`00`,RE:`00`,RO:`00`,RS:`00`,RU:`810`,RW:`00`,SA:`00`,SB:`0[01]`,SC:`010|0[0-2]`,SD:`00`,SE:`00`,SG:`0[0-3]\\d`,SH:`00`,SI:`00|10(?:22|66|88|99)`,SJ:`00`,SK:`00`,SL:`00`,SM:`00`,SN:`00`,SO:`00`,SR:`00`,SS:`00`,ST:`00`,SV:`00`,SX:`011`,SY:`00`,SZ:`00`,TA:`00`,TC:`011`,TD:`00|16`,TG:`00`,TH:`00[1-9]`,TJ:`810`,TK:`00`,TL:`00`,TM:`810`,TN:`00`,TO:`00`,TR:`00`,TT:`011`,TV:`00`,TW:`0(?:0[25-79]|19)`,TZ:`00[056]`,UA:`00`,UG:`00[057]`,US:`011`,UY:`0(?:0|1[3-9]\\d)`,UZ:`00`,VA:`00`,VC:`011`,VE:`00`,VG:`011`,VI:`011`,VN:`00`,VU:`00`,WF:`00`,WS:`0`,XK:`00`,YE:`00`,YT:`00`,ZA:`00`,ZM:`00`,ZW:`00`},Np={1:[{country:`US`,general:`[2-9]\\d{9}|3\\d{6}`,numbers:[`983[2-57-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[02469]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[02589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}`,``,`8(?:00|33|44|55|66|77|88)[2-9]\\d{6}`,`900[2-9]\\d{6}`,`52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}`]},{country:`AG`,leading:`268`},{country:`AI`,leading:`264`},{country:`AS`,leading:`684`},{country:`BB`,leading:`246`},{country:`BM`,leading:`441`},{country:`BS`,leading:`242`},{country:`CA`,general:`[2-9]\\d{9}|3\\d{6}`,numbers:[`(?:2(?:04|[23]6|[48]9|5[07]|[67]3)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}`,``,`8(?:00|33|44|55|66|77|88)[2-9]\\d{6}`,`900[2-9]\\d{6}`,`52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}`,`310\\d{4}`,`600[2-9]\\d{6}`]},{country:`DM`,leading:`767`},{country:`DO`,leading:`8001|8[024]9`},{country:`GD`,leading:`473`},{country:`GU`,leading:`671`},{country:`JM`,leading:`658|876`},{country:`KN`,leading:`869`},{country:`KY`,leading:`345`},{country:`LC`,leading:`758`},{country:`MP`,leading:`670`},{country:`MS`,leading:`664`},{country:`PR`,leading:`787|939`},{country:`SX`,leading:`721`},{country:`TC`,leading:`649`},{country:`TT`,leading:`868`},{country:`VC`,leading:`784`},{country:`VG`,leading:`284`},{country:`VI`,leading:`340`}],7:[{country:`RU`,leading:`[3489]`},{country:`KZ`,leading:`7`}],39:[{country:`IT`,general:`0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?`,numbers:[`0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}`,`3[2-9]\\d{7,8}|(?:31|43)\\d{8}`,`80(?:0\\d{3}|3)\\d{3}`,`(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}`,`1(?:78\\d|99)\\d{6}`,`3[2-8]\\d{9,10}`,`55\\d{8}`,`84(?:[08]\\d{3}|[17])\\d{3}`]},{country:`VA`,leading:`06698`}],44:[{country:`GB`,general:`[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}`,numbers:[`(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}`,`7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}`,`80[08]\\d{7}|800\\d{6}|8001111`,`(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d`,`70\\d{8}`,`(?:3[0347]|55)\\d{8}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]},{country:`GG`,general:`(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?`,numbers:[`1481[25-9]\\d{5}`,`7(?:(?:781|839)\\d|911[17])\\d{5}`,`80[08]\\d{7}|800\\d{6}|8001111`,`(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d`,`70\\d{8}`,`(?:3[0347]|55)\\d{8}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]},{country:`IM`,leading:`74576|(?:16|7[56])24`},{country:`JE`,general:`1534\\d{6}|(?:[3578]\\d|90)\\d{8}`,numbers:[`1534[0-24-8]\\d{5}`,`7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}`,`80(?:07(?:35|81)|8901)\\d{4}`,`(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}`,`701511\\d{4}`,`(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]}],47:[{country:`NO`,leading:`[02-689]|7[0-8]`},{country:`SJ`,leading:`79`}],61:[{country:`AU`,general:`1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}`,numbers:[`(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`163\\d{2,6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]},{country:`CC`,general:`1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}`,numbers:[`8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]},{country:`CX`,general:`1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}`,numbers:[`8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]}],212:[{country:`MA`,leading:`[5-8]`},{country:`EH`,general:`[5-8]\\d{8}`,numbers:[`528[89]\\d{5}`,`(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|3[01]|5[0-5]))\\d{6}`,`80[0-7]\\d{6}`,`89\\d{7}`,`(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}`]}],262:[{country:`RE`,general:`709\\d{6}|(?:26|[689]\\d)\\d{7}`,numbers:[`2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}`,`(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}`,`80\\d{7}`,`89[1-37-9]\\d{6}`,`9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}`,`8(?:1[019]|2[0156]|84|90)\\d{6}`]},{country:`YT`,general:`(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}`,numbers:[`26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}`,`(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}`,`80\\d{7}`,`9(?:(?:39|47)8[01]|769\\d)\\d{4}`]}],290:[{country:`SH`,leading:`[256]`},{country:`TA`,leading:`8`}],358:[{country:`FI`,leading:`1[03-79]|[2-9]`},{country:`AX`,leading:`18`}],590:[{country:`GP`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]},{country:`BL`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]},{country:`MF`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]}],599:[{country:`CW`,leading:`[69]`},{country:`BQ`,leading:`[347]`}]},Pp=new Map;for(let[e,t]of Object.entries(Ap))jp(e)&&!Pp.has(t)&&Pp.set(t,Np[t]?.[0]?.country??e);var Fp=(e,t)=>RegExp(`^(?:${e})$`).test(t),Ip=(e,t)=>`leading`in e?RegExp(`^(?:${e.leading})`).test(t):Fp(e.general,t)&&e.numbers.some(e=>Fp(e,t));function Lp(e,t){let n=Np[e];if(!n)return Pp.get(e);let r=t.replace(/\D/g,``);for(let e of r.startsWith(`0`)?[r,r.slice(1)]:[r]){let t=n.find(t=>Ip(t,e));if(t)return t.country}}function Rp(e){let t=/^\s*(?:\+|00)[\s().-]*(\d{1,3})/.exec(e),n=t?.[1];if(!t||!n)return;let r=t[0].length-n.length;for(let t=n.length;t>0;t--){let i=n.slice(0,t),a=Pp.get(i);if(a)return{country:a,callingCode:i,rest:e.slice(r+t).trimStart()}}}function zp(e,t){let n=e.trim();if(n.startsWith(`+`))return n;let r=n.replace(/[^\d]/g,``),i=(t?RegExp(`^(?:${Mp[t]})`).exec(r)?.[0]:void 0)?.length??(r.startsWith(`00`)?2:0),a=i?[...n.matchAll(/\d/g)][i-1]?.index:void 0;if(!(a===void 0||!/^[\d\s().-]*$/.test(n.slice(0,a+1))))return`+${n.slice(a+1).replace(/^[\s().-]+/,``)}`}function Bp(e){return e.flatMap(({value:e,label:t})=>jp(e)?[{value:e,label:`${t} (+${Ap[e]})`}]:[])}function Vp(e,t){let n=zp(e,t);if(!n)return t;let r=Rp(n);if(r)return Lp(r.callingCode,r.rest)??(t&&Ap[t]===r.callingCode?t:r.country)}function Hp(e,t){let n=e.trim();return zp(n,t)||(!t||!/\d/.test(n)?n:`+${Ap[t]} ${n}`)}function Up(e,t){let n=Rp(e);return n?Lp(n.callingCode,n.rest)??(t&&Ap[t]===n.callingCode?t:n.country):t}function Wp(e,t){let n=Up(e,t),r=Rp(e);return{typed:r&&n&&Ap[n]===r.callingCode?r.rest:e,picked:n}}function Gp(e,t){return Wp(e,Xp(t))}function Kp(e,t){return Wp(t,e.picked)}function qp(e,t){return{entry:{...e,typed:t},number:Hp(t,e.picked)}}function Jp(e,t){let n=zp(e.typed,e.picked),r=n===void 0?void 0:Rp(n),i=r?`+${Ap[t]} ${r.rest}`:e.typed;return{entry:{typed:i,picked:t},number:Hp(i,t)}}function Yp(e){return String.fromCodePoint(...[...e].map(e=>127397+e.charCodeAt(0)))}function Xp(e){for(let t of e)try{let e=new Intl.Locale(t).maximize().region;if(e&&jp(e))return e}catch{}}var Zp=`
|
|
706
|
+
`;function gf({id:e,label:t=``,onToggle:n,checked:r=!1,disabled:i=!1,dataTestId:a=`switch-input`,presentational:o=!1}){let[s,c]=(0,_.useState)(r);(0,_.useEffect)(()=>{c(r)},[r]);let l=(0,_.useRef)(null);(0,_.useEffect)(()=>{l.current&&l.current.checked!==s&&(l.current.checked=s)},[s,e]);let u=e=>{i||(o||c(e.target.checked),n(e,e.target.checked))},d=o?{"aria-hidden":!0}:{},f=o?{tabIndex:-1}:{"aria-label":t};return(0,q.jsx)(`div`,{className:`gh-portal-for-switch`,"data-test-switch":a,...d,children:(0,q.jsxs)(`label`,{className:`switch`,htmlFor:e,children:[(0,q.jsx)(`input`,{ref:l,type:`checkbox`,checked:s,disabled:i,id:e,onChange:u,...f}),(0,q.jsx)(`span`,{className:`input-toggle-component`,"data-testid":a})]})})}var _f=`.gh-portal-account-header{flex-direction:column;align-items:center;margin:0 0 32px;display:flex}.gh-portal-account-header .gh-portal-avatar{margin:6px 0 8px!important}.gh-portal-account-data{margin-bottom:40px}footer.gh-portal-account-footer{display:flex}.gh-portal-account-footer.paid{margin-top:12px}.gh-portal-account-footermenu{align-items:center;margin:0;padding:0;list-style:none;display:flex}.gh-portal-account-footerright{flex-grow:1;justify-content:flex-end;align-items:center;display:flex}.gh-portal-account-footermenu li{margin-inline-end:16px}.gh-portal-account-footermenu li:last-of-type{margin-inline-end:0}.gh-portal-freeaccount-newsletter{justify-content:space-between;align-items:center;margin-top:24px;display:flex}.gh-portal-freeaccount-newsletter .label{flex-direction:column;flex-grow:1;display:flex}.gh-portal-free-ctatext{margin-top:-12px}.gh-portal-cancelcontinue-container{margin:24px 0 32px}.gh-portal-cancel-banner{text-align:center;color:var(--grey1);border-radius:8px;margin-bottom:16px;padding:16px;font-size:1.4rem;line-height:1.5;position:relative}.gh-portal-cancel-banner:before{content:"";background:var(--brandcolor);opacity:.05;pointer-events:none;z-index:0;border-radius:8px;display:block;position:absolute;inset:0}.gh-portal-cancel-banner>*{z-index:1;position:relative}.gh-portal-cancel-banner p{max-width:320px;margin:0 auto 16px}.gh-portal-canceled-badge{letter-spacing:.05px;text-transform:uppercase;color:var(--grey6);background:color-mix(in srgb, var(--grey12) 60%, transparent);vertical-align:middle;border-radius:32px;margin-inline-start:6px;padding:6px 8px;font-size:1.1rem;font-weight:600;line-height:1em;display:inline-block;position:relative;top:-1px}.gh-portal-list-detail .gh-portal-email-notice{color:var(--red);letter-spacing:.2px;align-items:center;gap:5px;margin-top:6px;font-size:1.25rem;font-weight:500;display:flex}.gh-portal-email-notice-icon{width:20px;height:20px}.gh-portal-billing-button-loader{opacity:.6;width:32px;height:32px;margin-inline-end:-3px}.gh-portal-product-icon{border-radius:2px;width:52px;margin-inline-end:12px}.gh-portal-account-discountcontainer{flex-wrap:wrap;align-items:center;display:flex;position:relative}.gh-portal-account-expiry{white-space:nowrap}.gh-portal-account-expiry-separator{margin:0 4px}@media (width<=480px){.gh-portal-account-expiry-separator{display:none}.gh-portal-account-expiry{flex-basis:100%}}.gh-portal-account-old-price{text-decoration:line-through;color:var(--grey9)!important}.gh-portal-account-tagicon{width:16px;height:16px;color:var(--brandcolor);z-index:999;margin-inline-end:4px}@media (width<=390px){.gh-portal-account-footer{padding:0!important}}@media (width<=340px){.gh-portal-account-footer{flex-wrap:wrap;gap:12px;padding:0!important}.gh-portal-account-footer .gh-portal-account-footerright{justify-content:flex-start}}.gh-portal-gift-card{margin-top:16px}.gh-portal-gift-card-icon{stroke-width:2px;width:16px;height:16px;margin-inline-end:4px}`,vf=class extends _.Component{static contextType=J;closePopup=()=>{this.context.doAction(`closePopup`)};render(){let{brandColor:e,onClick:t}=this.props,n=e||this.context.brandColor;return(0,q.jsx)(`button`,{type:`button`,className:`gh-portal-closeicon-container`,"aria-label":`Close popup`,"data-testid":`close-popup`,"data-test-button":`close-popup`,onClick:t||this.closePopup,children:(0,q.jsx)(Hd,{className:`gh-portal-closeicon`,style:n?{color:n}:void 0,"aria-hidden":`true`})})}},yf=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[(0,q.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,q.jsx)(`path`,{d:`M12 8v13`}),(0,q.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7`}),(0,q.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0-5C9 3 12 8 12 8`}),(0,q.jsx)(`path`,{d:`M16.5 8a2.5 2.5 0 0 0 0-5C15 3 12 8 12 8`})]}),bf=e=>{if(!e)return[];let t=`${e.replace(/\/$/,``)}/gift/assets`;return[`${t}/gift-card-orb.webp`,`${t}/gift-card-noise.webp`]},xf=e=>{bf(e).forEach(e=>{new Image().src=e})},Sf=({cardRef:e,duration:t,tierName:n,name:r,toName:i,fromName:a,giftValue:o,siteIcon:s,siteTitle:c})=>{let{site:l}=(0,_.useContext)(J),[u,d]=bf(l?.url),f=t&&n,p=r||i||a||o;return(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-frame`,children:(0,q.jsxs)(`div`,{ref:e,className:`gh-portal-gift-checkout-card`,style:u&&{"--gh-gift-orb":`url("${u}")`,"--gh-gift-noise":`url("${d}")`},children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-notch`,"aria-hidden":`true`}),f&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-meta`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-duration`,"data-testid":`gift-card-duration`,children:t}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-tier`,children:K(`{tierName} membership`,{tierName:n})})]}),p&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-details`,children:[r&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`Name`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:r})]}),i&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`To`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:i})]}),a&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`From`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,children:a})]}),o&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-detail`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-label`,children:K(`Gift value`)}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-detail-value`,"data-testid":`gift-card-value`,children:o})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-site`,children:[s&&(0,q.jsx)(`img`,{className:`gh-portal-gift-checkout-card-site-icon`,src:s,alt:``}),(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-card-site-name`,children:c})]})]})})},Cf=[1,3,6,12];function wf(e,t){return t===12?e.yearlyPrice??null:e.monthlyPrice??null}function Tf(e){return!!e&&typeof e.amount==`number`&&Number.isSafeInteger(e.amount)&&e.amount>0&&typeof e.currency==`string`&&!!e.currency}function Ef({portalPlans:e,duration:t}){return t===12?e.includes(`yearly`):e.includes(`monthly`)}function Df(e,t){let n=wf(e,t);return Tf(n)?{...n,amount:t===12?n.amount:n.amount*t}:null}function Of({site:e,duration:t}){let{paid_members_enabled:n,portal_plans:r=[],portal_products:i,products:a=[]}=e||{};if(!n||!Ef({portalPlans:r,duration:t}))return[];let o=Array.isArray(i)?i:null;return a.filter(e=>e?.type===`paid`&&(!o||o.includes(e.id))&&!!Df(e,t)).map(e=>({product:e,amount:Df(e,t)?.amount??0})).sort((e,t)=>e.amount-t.amount).map(({product:e})=>e)}function kf({site:e}){return Cf.filter(t=>Of({site:e,duration:t}).length>0)}function Af({site:e}){return kf({site:e}).length>0}function jf({site:e}){return e?.portal_signup_gift_promotion===!0&&Af({site:e})}function Mf({site:e}){return e?.portal_account_gift_promotion===!0&&Af({site:e})}function Nf({availableDurations:e,portalDefaultPlan:t,selectedDuration:n}){if(n&&e.includes(n))return n;let r=t===`yearly`?12:1;return e.includes(r)?r:e[0]??null}var Pf=({className:e,lastPage:t})=>{let{brandColor:n,doAction:r,site:i}=(0,_.useContext)(J),a=jf({site:i});if((0,_.useEffect)(()=>{a&&xf(i?.url)},[a,i?.url]),!a)return null;let o=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{children:K(`Buying for someone else?`)}),(0,q.jsxs)(`button`,{className:`gh-portal-btn gh-portal-btn-link gh-portal-signup-message-gift`,"data-test-button":`gift-switch`,"data-testid":`gift-switch`,style:{color:n},type:`button`,onClick:()=>r(`switchPage`,{page:`gift`,lastPage:t}),children:[(0,q.jsx)(yf,{"aria-hidden":`true`,className:`gh-portal-signup-message-icon`}),(0,q.jsx)(`span`,{children:K(`Gift a membership`)})]})]});return e?(0,q.jsx)(`div`,{className:e,children:o}):o},Ff=e=>({leaf:`text`,format:e}),If=(e=>({leaf:`choice`,from:e}))(`countries`),Lf=[`short_text`,`long_text`,`list`,`address`,`phone`],Rf={short_text:{shape:`scalar`,leaf:Ff(`line`)},long_text:{shape:`scalar`,leaf:Ff(`long`)},list:{shape:`set`},address:{shape:`record`,parts:{line1:Ff(`line`),line2:Ff(`line`),city:Ff(`line`),state:Ff(`line`),postal_code:Ff(`code`),country:If}},phone:{shape:`scalar`,leaf:Ff(`phone`)}};function zf(e){let t=[];for(let n in e)t.push(n);return t}function Bf(e,t){return e.options.filter(e=>t.includes(e))}function Vf(e,t){return!e.multiple&&t.length>1?[]:Bf(e,t)}function Hf(e){return Lf.some(t=>t===e)}var Uf=e=>t=>Hf(t)&&Rf[t].shape===e,Wf=Uf(`scalar`),Gf=Uf(`record`),Kf=Uf(`set`);function qf(e,t){return Wf(e)?t.scalar(Rf[e],e):Gf(e)?t.record(Rf[e],e):Kf(e)?t.set(Rf[e],e):$f(e)}var Jf=e=>t=>Uf(e)(t.type),Yf=Jf(`scalar`),Xf=Jf(`record`),Zf=Jf(`set`);function Qf(e,t){if(Yf(e))return t.scalar(e);if(Xf(e))return t.record(e);if(Zf(e))return t.set(e);throw Error(`Unknown field type: ${String(e.type)}`)}function $f(e){throw Error(`Unknown field type: ${String(e)}`)}function ep(e,t){switch(e.leaf){case`text`:return t.text(e);case`choice`:return t.choice(e)}}function tp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var np=e=>typeof e==`string`&&e.trim()===``?void 0:e,rp={kind:`string`,read:e=>typeof e==`string`?np(e.trim()):void 0,fromText:e=>e.trim()},ip={text:rp,choice:rp},ap=(e,t)=>ip[e.leaf].read(t);function op(e){for(let t of zf(ip)){let n=ip[t].read(e);if(n!==void 0)return n}}var sp=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),cp=e=>(t,n)=>n===void 0?t===void 0?void 0:null:t===void 0?n:e(t,n),lp=e=>{let t={};for(let n of zf(e)){let r=np(e[n]??void 0);r!==void 0&&(t[n]=r)}return zf(t).length>0?t:void 0},up=e=>e.length>0?e:void 0,dp={parse:(e,t)=>op(t),same:(e,t)=>e===t,apply:(e,t)=>t,diff:cp((e,t)=>e===t?void 0:t)},fp={parse:(e,t)=>{if(!tp(t))return;let n=Rf[e].parts,r={};for(let e of zf(n)){let i=ap(n[e],t[e]);i!==void 0&&(r[e]=i)}return zf(r).length>0?r:void 0},same:(e,t)=>fp.diff(e,t)===void 0,apply:(e,t)=>{let n={...e};for(let e of zf(t)){let r=t[e];r!==void 0&&(n[e]=r)}return lp(n)},diff:(e,t)=>{if(e===void 0)return t;let n=t??{},r={};for(let t of zf({...e,...n}))e[t]!==n[t]&&(r[t]=n[t]??null);return zf(r).length>0?r:void 0}},pp={parse:(e,t)=>sp(t)?up(t):void 0,same:(e,t)=>{let n=new Set(t);return new Set(e).size===n.size&&e.every(e=>n.has(e))},apply:(e,t)=>t,diff:cp((e,t)=>pp.same(e,t)?void 0:t)},mp={scalar:dp,record:fp,set:pp};function hp(e){return Qf(e,{scalar:e=>({shape:`scalar`,field:e}),record:e=>({shape:`record`,field:e}),set:e=>({shape:`set`,field:e})})}var gp=()=>({editable:(e,t)=>t}),_p={scalar:{held:(e,t)=>t,...gp()},record:{held:(e,t)=>t,...gp()},set:{held:({settings:e},t)=>{let n=t=>{let n=e.options.indexOf(t);return n===-1?e.options.length:n};return[...t].sort((e,t)=>n(e)-n(t)||(e<t?-1:+(e>t)))},editable:({settings:e},t)=>up(Vf(e,t))}};function vp({shape:e,field:t},n){let r=mp[e].parse(t.type,n);return r===void 0?void 0:_p[e].held(t,r)}function yp(e,t){let n=vp(e,t);return n===void 0?void 0:_p[e.shape].editable(e.field,n)}var bp=(e,t)=>np(t)===void 0?void 0:ip[e.leaf].fromText(t),xp=(e,t)=>typeof t==`string`?bp(e,t)??t:t,Sp={scalar:{fromText:(e,t)=>xp(Rf[e].leaf,t)},record:{fromText:(e,t)=>{if(!tp(t))return t;let n=Rf[e].parts;return Object.fromEntries(Object.entries(t).map(([e,t])=>{let r=Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return[e,r?xp(r,t):t]}))}},set:{fromText:(e,t)=>t}};function Cp({shape:e,type:t},n){return mp[e].parse(t,Sp[e].fromText(t,n))}var wp={scalar:e=>String(e),record:e=>Object.fromEntries(zf(e).flatMap(t=>{let n=e[t];return n===void 0?[]:[[t,String(n)]]})),set:e=>e};function Tp(e,t){return wp[e](t)}function Ep(e,t){let n=vp(e,t);return n===void 0?void 0:Tp(e.shape,n)}function Dp(e,t){let n=yp(e,t);return n===void 0?void 0:Tp(e.shape,n)}function Op(e,t){let n=Cp({shape:e.shape,type:e.field.type},t);return n===void 0?void 0:yp(e,n)}function kp(e,t,n){return mp[e.shape].diff(vp(e,n),Op(e,t))}var Ap={AC:`247`,AD:`376`,AE:`971`,AF:`93`,AG:`1`,AI:`1`,AL:`355`,AM:`374`,AO:`244`,AR:`54`,AS:`1`,AT:`43`,AU:`61`,AW:`297`,AX:`358`,AZ:`994`,BA:`387`,BB:`1`,BD:`880`,BE:`32`,BF:`226`,BG:`359`,BH:`973`,BI:`257`,BJ:`229`,BL:`590`,BM:`1`,BN:`673`,BO:`591`,BQ:`599`,BR:`55`,BS:`1`,BT:`975`,BW:`267`,BY:`375`,BZ:`501`,CA:`1`,CC:`61`,CD:`243`,CF:`236`,CG:`242`,CH:`41`,CI:`225`,CK:`682`,CL:`56`,CM:`237`,CN:`86`,CO:`57`,CR:`506`,CU:`53`,CV:`238`,CW:`599`,CX:`61`,CY:`357`,CZ:`420`,DE:`49`,DJ:`253`,DK:`45`,DM:`1`,DO:`1`,DZ:`213`,EC:`593`,EE:`372`,EG:`20`,EH:`212`,ER:`291`,ES:`34`,ET:`251`,FI:`358`,FJ:`679`,FK:`500`,FM:`691`,FO:`298`,FR:`33`,GA:`241`,GB:`44`,GD:`1`,GE:`995`,GF:`594`,GG:`44`,GH:`233`,GI:`350`,GL:`299`,GM:`220`,GN:`224`,GP:`590`,GQ:`240`,GR:`30`,GT:`502`,GU:`1`,GW:`245`,GY:`592`,HK:`852`,HN:`504`,HR:`385`,HT:`509`,HU:`36`,ID:`62`,IE:`353`,IL:`972`,IM:`44`,IN:`91`,IO:`246`,IQ:`964`,IR:`98`,IS:`354`,IT:`39`,JE:`44`,JM:`1`,JO:`962`,JP:`81`,KE:`254`,KG:`996`,KH:`855`,KI:`686`,KM:`269`,KN:`1`,KP:`850`,KR:`82`,KW:`965`,KY:`1`,KZ:`7`,LA:`856`,LB:`961`,LC:`1`,LI:`423`,LK:`94`,LR:`231`,LS:`266`,LT:`370`,LU:`352`,LV:`371`,LY:`218`,MA:`212`,MC:`377`,MD:`373`,ME:`382`,MF:`590`,MG:`261`,MH:`692`,MK:`389`,ML:`223`,MM:`95`,MN:`976`,MO:`853`,MP:`1`,MQ:`596`,MR:`222`,MS:`1`,MT:`356`,MU:`230`,MV:`960`,MW:`265`,MX:`52`,MY:`60`,MZ:`258`,NA:`264`,NC:`687`,NE:`227`,NF:`672`,NG:`234`,NI:`505`,NL:`31`,NO:`47`,NP:`977`,NR:`674`,NU:`683`,NZ:`64`,OM:`968`,PA:`507`,PE:`51`,PF:`689`,PG:`675`,PH:`63`,PK:`92`,PL:`48`,PM:`508`,PR:`1`,PS:`970`,PT:`351`,PW:`680`,PY:`595`,QA:`974`,RE:`262`,RO:`40`,RS:`381`,RU:`7`,RW:`250`,SA:`966`,SB:`677`,SC:`248`,SD:`249`,SE:`46`,SG:`65`,SH:`290`,SI:`386`,SJ:`47`,SK:`421`,SL:`232`,SM:`378`,SN:`221`,SO:`252`,SR:`597`,SS:`211`,ST:`239`,SV:`503`,SX:`1`,SY:`963`,SZ:`268`,TA:`290`,TC:`1`,TD:`235`,TG:`228`,TH:`66`,TJ:`992`,TK:`690`,TL:`670`,TM:`993`,TN:`216`,TO:`676`,TR:`90`,TT:`1`,TV:`688`,TW:`886`,TZ:`255`,UA:`380`,UG:`256`,US:`1`,UY:`598`,UZ:`998`,VA:`39`,VC:`1`,VE:`58`,VG:`1`,VI:`1`,VN:`84`,VU:`678`,WF:`681`,WS:`685`,XK:`383`,YE:`967`,YT:`262`,ZA:`27`,ZM:`260`,ZW:`263`};function jp(e){return Object.prototype.hasOwnProperty.call(Ap,e)}var Mp={AC:`00`,AD:`00`,AE:`00`,AF:`00`,AG:`011`,AI:`011`,AL:`00`,AM:`00`,AO:`00`,AR:`00`,AS:`011`,AT:`00`,AU:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,AW:`00`,AX:`00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))`,AZ:`00`,BA:`00`,BB:`011`,BD:`00`,BE:`00`,BF:`00`,BG:`00`,BH:`00`,BI:`00`,BJ:`00`,BL:`00`,BM:`011`,BN:`00`,BO:`00(?:1\\d)?`,BQ:`00`,BR:`00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)`,BS:`011`,BT:`00`,BW:`00`,BY:`810`,BZ:`00`,CA:`011`,CC:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,CD:`00`,CF:`00`,CG:`00`,CH:`00`,CI:`00`,CK:`00`,CL:`(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0`,CM:`00`,CN:`00|1(?:[12]\\d|79)\\d\\d00`,CO:`00(?:4(?:[14]4|56)|[579])`,CR:`00`,CU:`119`,CV:`0`,CW:`00`,CX:`001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011`,CY:`00`,CZ:`00`,DE:`00`,DJ:`00`,DK:`00`,DM:`011`,DO:`011`,DZ:`00`,EC:`00`,EE:`00`,EG:`00`,EH:`00`,ER:`00`,ES:`00`,ET:`00`,FI:`00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))`,FJ:`0(?:0|52)`,FK:`00`,FM:`00`,FO:`00`,FR:`00`,GA:`00`,GB:`00`,GD:`011`,GE:`00`,GF:`00`,GG:`00`,GH:`00`,GI:`00`,GL:`00`,GM:`00`,GN:`00`,GP:`00`,GQ:`00`,GR:`00`,GT:`00`,GU:`011`,GW:`00`,GY:`001`,HK:`00(?:30|5[09]|[126-9]?)`,HN:`00`,HR:`00`,HT:`00`,HU:`00`,ID:`00[89]`,IE:`00`,IL:`0(?:0|1(?:05|[2-9]))`,IM:`00`,IN:`00`,IO:`00`,IQ:`00`,IR:`00`,IS:`00|1(?:0(?:01|[12]0)|100)`,IT:`00`,JE:`00`,JM:`011`,JO:`00`,JP:`010`,KE:`000`,KG:`00`,KH:`00[14-9]`,KI:`00`,KM:`00`,KN:`011`,KP:`00|99`,KR:`00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))`,KW:`00`,KY:`011`,KZ:`810`,LA:`00`,LB:`00`,LC:`011`,LI:`00`,LK:`00`,LR:`00`,LS:`00`,LT:`00`,LU:`00`,LV:`00`,LY:`00`,MA:`00`,MC:`00`,MD:`00`,ME:`00`,MF:`00`,MG:`00`,MH:`011`,MK:`00`,ML:`00`,MM:`00`,MN:`001`,MO:`00`,MP:`011`,MQ:`00`,MR:`00`,MS:`011`,MT:`00`,MU:`0(?:0|[24-7]0|3[03])`,MV:`0(?:0|19)`,MW:`00`,MX:`0[09]`,MY:`00`,MZ:`00`,NA:`00`,NC:`00`,NE:`00`,NF:`00`,NG:`009`,NI:`00`,NL:`00`,NO:`00`,NP:`00`,NR:`00`,NU:`00`,NZ:`0(?:0|161)`,OM:`00`,PA:`00`,PE:`00|19(?:1[124]|77|90)00`,PF:`00`,PG:`00|140[1-3]`,PH:`00`,PK:`00`,PL:`00`,PM:`00`,PR:`011`,PS:`00`,PT:`00`,PW:`01[12]`,PY:`00`,QA:`00`,RE:`00`,RO:`00`,RS:`00`,RU:`810`,RW:`00`,SA:`00`,SB:`0[01]`,SC:`010|0[0-2]`,SD:`00`,SE:`00`,SG:`0[0-3]\\d`,SH:`00`,SI:`00|10(?:22|66|88|99)`,SJ:`00`,SK:`00`,SL:`00`,SM:`00`,SN:`00`,SO:`00`,SR:`00`,SS:`00`,ST:`00`,SV:`00`,SX:`011`,SY:`00`,SZ:`00`,TA:`00`,TC:`011`,TD:`00|16`,TG:`00`,TH:`00[1-9]`,TJ:`810`,TK:`00`,TL:`00`,TM:`810`,TN:`00`,TO:`00`,TR:`00`,TT:`011`,TV:`00`,TW:`0(?:0[25-79]|19)`,TZ:`00[056]`,UA:`00`,UG:`00[057]`,US:`011`,UY:`0(?:0|1[3-9]\\d)`,UZ:`00`,VA:`00`,VC:`011`,VE:`00`,VG:`011`,VI:`011`,VN:`00`,VU:`00`,WF:`00`,WS:`0`,XK:`00`,YE:`00`,YT:`00`,ZA:`00`,ZM:`00`,ZW:`00`},Np={1:[{country:`US`,general:`[2-9]\\d{9}|3\\d{6}`,numbers:[`983[2-57-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[02469]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[02589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}`,``,`8(?:00|33|44|55|66|77|88)[2-9]\\d{6}`,`900[2-9]\\d{6}`,`52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}`]},{country:`AG`,leading:`268`},{country:`AI`,leading:`264`},{country:`AS`,leading:`684`},{country:`BB`,leading:`246`},{country:`BM`,leading:`441`},{country:`BS`,leading:`242`},{country:`CA`,general:`[2-9]\\d{9}|3\\d{6}`,numbers:[`(?:2(?:04|[23]6|[48]9|5[07]|[67]3)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}`,``,`8(?:00|33|44|55|66|77|88)[2-9]\\d{6}`,`900[2-9]\\d{6}`,`52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}`,`310\\d{4}`,`600[2-9]\\d{6}`]},{country:`DM`,leading:`767`},{country:`DO`,leading:`8001|8[024]9`},{country:`GD`,leading:`473`},{country:`GU`,leading:`671`},{country:`JM`,leading:`658|876`},{country:`KN`,leading:`869`},{country:`KY`,leading:`345`},{country:`LC`,leading:`758`},{country:`MP`,leading:`670`},{country:`MS`,leading:`664`},{country:`PR`,leading:`787|939`},{country:`SX`,leading:`721`},{country:`TC`,leading:`649`},{country:`TT`,leading:`868`},{country:`VC`,leading:`784`},{country:`VG`,leading:`284`},{country:`VI`,leading:`340`}],7:[{country:`RU`,leading:`[3489]`},{country:`KZ`,leading:`7`}],39:[{country:`IT`,general:`0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?`,numbers:[`0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}`,`3[2-9]\\d{7,8}|(?:31|43)\\d{8}`,`80(?:0\\d{3}|3)\\d{3}`,`(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}`,`1(?:78\\d|99)\\d{6}`,`3[2-8]\\d{9,10}`,`55\\d{8}`,`84(?:[08]\\d{3}|[17])\\d{3}`]},{country:`VA`,leading:`06698`}],44:[{country:`GB`,general:`[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}`,numbers:[`(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}`,`7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}`,`80[08]\\d{7}|800\\d{6}|8001111`,`(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d`,`70\\d{8}`,`(?:3[0347]|55)\\d{8}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]},{country:`GG`,general:`(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?`,numbers:[`1481[25-9]\\d{5}`,`7(?:(?:781|839)\\d|911[17])\\d{5}`,`80[08]\\d{7}|800\\d{6}|8001111`,`(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d`,`70\\d{8}`,`(?:3[0347]|55)\\d{8}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]},{country:`IM`,leading:`74576|(?:16|7[56])24`},{country:`JE`,general:`1534\\d{6}|(?:[3578]\\d|90)\\d{8}`,numbers:[`1534[0-24-8]\\d{5}`,`7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}`,`80(?:07(?:35|81)|8901)\\d{4}`,`(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}`,`701511\\d{4}`,`(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}`,`76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}`,`56\\d{8}`]}],47:[{country:`NO`,leading:`[02-689]|7[0-8]`},{country:`SJ`,leading:`79`}],61:[{country:`AU`,general:`1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}`,numbers:[`(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`163\\d{2,6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]},{country:`CC`,general:`1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}`,numbers:[`8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]},{country:`CX`,general:`1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}`,numbers:[`8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}`,`4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}`,`180(?:0\\d{3}|2)\\d{3}`,`190[0-26]\\d{6}`,`14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}`,`13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}`]}],212:[{country:`MA`,leading:`[5-8]`},{country:`EH`,general:`[5-8]\\d{8}`,numbers:[`528[89]\\d{5}`,`(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|3[01]|5[0-5]))\\d{6}`,`80[0-7]\\d{6}`,`89\\d{7}`,`(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}`]}],262:[{country:`RE`,general:`709\\d{6}|(?:26|[689]\\d)\\d{7}`,numbers:[`2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}`,`(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}`,`80\\d{7}`,`89[1-37-9]\\d{6}`,`9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}`,`8(?:1[019]|2[0156]|84|90)\\d{6}`]},{country:`YT`,general:`(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}`,numbers:[`26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}`,`(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}`,`80\\d{7}`,`9(?:(?:39|47)8[01]|769\\d)\\d{4}`]}],290:[{country:`SH`,leading:`[256]`},{country:`TA`,leading:`8`}],358:[{country:`FI`,leading:`1[03-79]|[2-9]`},{country:`AX`,leading:`18`}],590:[{country:`GP`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]},{country:`BL`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]},{country:`MF`,general:`7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}`,numbers:[`(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}`,`(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}`,`80[0-5]\\d{6}`,`8[129]\\d{7}`,`9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}`]}],599:[{country:`CW`,leading:`[69]`},{country:`BQ`,leading:`[347]`}]},Pp=new Map;for(let[e,t]of Object.entries(Ap))jp(e)&&!Pp.has(t)&&Pp.set(t,Np[t]?.[0]?.country??e);var Fp=(e,t)=>RegExp(`^(?:${e})$`).test(t),Ip=(e,t)=>`leading`in e?RegExp(`^(?:${e.leading})`).test(t):Fp(e.general,t)&&e.numbers.some(e=>Fp(e,t));function Lp(e,t){let n=Np[e];if(!n)return Pp.get(e);let r=t.replace(/\D/g,``);for(let e of r.startsWith(`0`)?[r,r.slice(1)]:[r]){let t=n.find(t=>Ip(t,e));if(t)return t.country}}function Rp(e){let t=/^\s*(?:\+|00)[\s().-]*(\d{1,3})/.exec(e),n=t?.[1];if(!t||!n)return;let r=t[0].length-n.length;for(let t=n.length;t>0;t--){let i=n.slice(0,t),a=Pp.get(i);if(a)return{country:a,callingCode:i,rest:e.slice(r+t).trimStart()}}}function zp(e,t){let n=e.trim();if(n.startsWith(`+`))return n;let r=n.replace(/[^\d]/g,``),i=(t?RegExp(`^(?:${Mp[t]})`).exec(r)?.[0]:void 0)?.length??(r.startsWith(`00`)?2:0),a=i?[...n.matchAll(/\d/g)][i-1]?.index:void 0;if(!(a===void 0||!/^[\d\s().-]*$/.test(n.slice(0,a+1))))return`+${n.slice(a+1).replace(/^[\s().-]+/,``)}`}function Bp(e){return e.flatMap(({value:e,label:t})=>jp(e)?[{value:e,label:`${t} (+${Ap[e]})`}]:[])}function Vp(e,t){let n=zp(e,t);if(!n)return t;let r=Rp(n);if(r)return Lp(r.callingCode,r.rest)??(t&&Ap[t]===r.callingCode?t:r.country)}function Hp(e,t){let n=e.trim();return zp(n,t)||(!t||!/\d/.test(n)?n:`+${Ap[t]} ${n}`)}function Up(e,t){let n=Rp(e);return n?Lp(n.callingCode,n.rest)??(t&&Ap[t]===n.callingCode?t:n.country):t}function Wp(e,t){let n=Up(e,t),r=Rp(e);return{typed:r&&n&&Ap[n]===r.callingCode?r.rest:e,picked:n}}function Gp(e,t,n){let r=Zp(t);return Wp(e,!e&&Xp(n,r)||r)}function Kp(e,t){return Wp(t,e.picked)}function qp(e,t){return{entry:{...e,typed:t},number:Hp(t,e.picked)}}function Jp(e,t){let n=zp(e.typed,e.picked),r=n===void 0?void 0:Rp(n),i=r?`+${Ap[t]} ${r.rest}`:e.typed;return{entry:{typed:i,picked:t},number:Hp(i,t)}}function Yp(e){try{let t=new Intl.Locale(`und-${e}`);return t.getTimeZones?.()??t.timeZones??[]}catch{return[]}}function Xp(e,t){if(!(!e||e===`UTC`||e.startsWith(`Etc/`)))return t&&Yp(t).includes(e)?t:Object.keys(Ap).find(t=>Yp(t).includes(e))}function Zp(e){for(let t of e)try{let e=new Intl.Locale(t).maximize().region;if(e&&jp(e))return e}catch{}}var Qp=`
|
|
707
707
|
.gh-portal-input-section.hidden {
|
|
708
708
|
display: none;
|
|
709
709
|
}
|
|
@@ -859,7 +859,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
859
859
|
.gh-portal-popup-container:not(.preview) .gh-portal-input[readonly]::placeholder {
|
|
860
860
|
color: var(--grey9);
|
|
861
861
|
}
|
|
862
|
-
`;function
|
|
862
|
+
`;function $p({message:e,style:t}){return e?(0,q.jsx)(`p`,{style:{...t||{}},children:e}):null}function em({name:e,id:t,hidden:n,label:r,hideLabel:i,type:a,autoComplete:o,value:s,placeholder:c,disabled:l=!1,readOnly:u=!1,options:d,onChange:f=()=>{},onBlur:p=()=>{},onKeyDown:m=()=>{},tabIndex:h,maxLength:g,autoFocus:v,errorMessage:y,invalid:b=!1,describedBy:x}){let S=(0,_.useRef)(null);t||=`input-${e}`;let C=n?`gh-portal-input-section hidden`:`gh-portal-input-section`,w=i?`gh-portal-input-label hidden`:`gh-portal-input-label`,T=y||b?`gh-portal-input error`:`gh-portal-input`;xl()&&(l=!0),nd([`preview`])&&(l=!0);let E=o??``,D=``,O=``,k,ee;switch(t){case`input-email`:E=`off`,D=`off`,O=`off`;break;case`input-name`:E=`off`,D=`off`;break;case`input-otc`:E=`one-time-code`,D=`off`,O=`off`,k=`numeric`,ee=`[0-9]*`,c??=`• • • • • •`;break;default:break}(0,_.useEffect)(()=>{v&&S.current.focus()},[v]);let A={"data-test-input":t,ref:S,id:t,className:T,name:e,value:s,placeholder:c,onChange:t=>f(t,e),onBlur:t=>p(t,e),disabled:l,readOnly:u,tabIndex:h,maxLength:g,"aria-label":r,"aria-invalid":y||b?!0:void 0,"aria-describedby":x};return(0,q.jsxs)(`section`,{className:C,children:[(0,q.jsxs)(`div`,{className:`gh-portal-input-labelcontainer`,children:[(0,q.jsxs)(`label`,{htmlFor:t,className:w,children:[` `,r,` `]}),(0,q.jsx)($p,{message:y,name:e})]}),a===`textarea`?(0,q.jsx)(`textarea`,{...A,className:`${T} gh-portal-input-textarea`}):a===`select`?(0,q.jsxs)(`select`,{...A,className:s?T:`${T} placeholder`,disabled:l||u,children:[s?(0,q.jsx)(`option`,{value:``,children:K(`(None)`)}):(0,q.jsx)(`option`,{value:``,disabled:!0,hidden:!0,children:c}),(d??[]).map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))]}):(0,q.jsx)(`input`,{...A,type:a,onKeyDown:t=>m(t,e),autoComplete:E,autoCorrect:D,autoCapitalize:O,inputMode:k,pattern:ee})]})}var tm=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:r=()=>{}})=>e?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(em,{label:e.label,hideLabel:e.hideLabel,type:e.type,autoComplete:e.autoComplete,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly,options:e.options,value:e.value,onKeyDown:r,onChange:n=>t(n,e),onBlur:t=>n(t,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,invalid:e.invalid,describedBy:e.describedBy,autoFocus:e.autoFocus},e.name)}):null,nm=class extends _.Component{constructor(e){super(e),this.state={}}render(){let{fields:e,onChange:t,onBlur:n,onKeyDown:r}=this.props;return(0,q.jsx)(q.Fragment,{children:e.map(e=>(0,q.jsx)(tm,{field:e,onChange:t,onBlur:n,onKeyDown:r},e.name))})}},rm=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,...e,children:(0,q.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),im=6,am=12,om=e=>`${e}px`,sm=`
|
|
863
863
|
/* Above the popup's back and close buttons (z-index 10000), which a panel that opens above a
|
|
864
864
|
field near the top of the popup reaches. */
|
|
865
865
|
.gh-portal-popover {
|
|
@@ -872,7 +872,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
872
872
|
display: flex;
|
|
873
873
|
flex-direction: column;
|
|
874
874
|
}
|
|
875
|
-
`;function
|
|
875
|
+
`;function cm(e){return e.closest(`.gh-portal-popup-container`)??e.ownerDocument.body}function lm(e){let t=e.ownerDocument.defaultView;for(let n=e.parentElement;n&&t;n=n.parentElement){let{overflowY:e}=t.getComputedStyle(n);if(e===`auto`||e===`scroll`)return n.getBoundingClientRect()}let n=t?.innerHeight||e.ownerDocument.documentElement.clientHeight;return n?{top:0,bottom:n}:null}function um(e){let t=(0,_.useRef)(e);return(0,_.useLayoutEffect)(()=>{t.current=e}),t}function dm(e,t){let n=um(t);(0,_.useEffect)(()=>{let t=e.current?.ownerDocument;if(!t)return;let r=e=>{e.key!==`Escape`||e.isComposing||(e.preventDefault(),n.current())};return t.addEventListener(`keydown`,r,!0),()=>t.removeEventListener(`keydown`,r,!0)},[e,n])}function fm({anchor:e,alignTo:t,align:n,fit:r=!1,onClose:i,className:a,children:o,...s}){let c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useCallback)(i=>{let a=e.current,o=(t??e).current,s=c.current;if(!a||!o||!s)return;let d=o.getBoundingClientRect(),f=cm(a).getBoundingClientRect(),{style:p}=s;n===`end`?p.right=om(f.right-d.right):(p.left=om(d.left-f.left),p.width=om(d.width)),l.current??=s.offsetHeight;let m=lm(o),h=m?m.bottom-d.bottom-im-am:1/0,g=m?d.top-m.top-im-am:0;(i||u.current===null)&&(u.current=h<l.current&&g>h);let _=u.current;p.top=om(_?d.top-f.top-im:d.bottom-f.top+im),p.transform=_?`translateY(-100%)`:``;let v=_?g:h;r&&Number.isFinite(v)&&(p.maxHeight=om(Math.max(0,v)))},[e,t,n,r]);(0,_.useLayoutEffect)(()=>{d(!1)});let f=um(i);(0,_.useEffect)(()=>{let t=e.current,n=t?.ownerDocument,r=n?.defaultView;if(!t||!n||!r)return;let i=e=>e instanceof r.Node&&!!c.current?.contains(e),a=e=>{e.target instanceof r.Node&&!t.contains(e.target)&&!i(e.target)&&f.current(`outside`)},o=e=>{i(e.target)||d(!0)},s=()=>d(!0);return n.addEventListener(`pointerdown`,a),n.addEventListener(`scroll`,o,!0),r.addEventListener(`resize`,s),()=>{n.removeEventListener(`pointerdown`,a),n.removeEventListener(`scroll`,o,!0),r.removeEventListener(`resize`,s)}},[e,f,d]),dm(e,()=>i(`escape`));let p=e.current;return p?(0,v.createPortal)((0,q.jsx)(`div`,{ref:c,className:[`gh-portal-popover`,r&&`is-fitted`,a].filter(Boolean).join(` `),...s,children:o}),cm(p)):null}var pm=200,mm=.5,hm=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,gm=`
|
|
876
876
|
.gh-portal-sheet-backdrop {
|
|
877
877
|
position: fixed;
|
|
878
878
|
inset: 0;
|
|
@@ -959,7 +959,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
959
959
|
animation: none;
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
|
-
`;function
|
|
962
|
+
`;function _m({opener:e,title:t,onClose:n,children:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(null);dm(i,n),(0,_.useEffect)(()=>{let e=i.current,t=e?.ownerDocument;if(!e||!t)return;let n=n=>{if(n.key!==`Tab`)return;n.preventDefault();let r=Array.from(e.querySelectorAll(hm)),i=r.findIndex(e=>e===t.activeElement),a=n.shiftKey?-1:1;r[((i===-1&&n.shiftKey?r.length-1:i+a)+r.length)%r.length]?.focus()};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[]),(0,_.useEffect)(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);let s={onPointerDown:e=>{a.current={from:e.clientY,at:e.timeStamp,by:0},e.currentTarget.setPointerCapture(e.pointerId);let t=i.current?.style;t?.setProperty(`animation`,`none`),t?.setProperty(`transition`,`none`)},onPointerMove:e=>{!a.current||!i.current||(a.current.by=Math.max(0,e.clientY-a.current.from),i.current.style.transform=`translateY(${a.current.by}px)`)},onPointerUp:e=>{let t=i.current,r=a.current;if(a.current=null,!r||!t)return;t.style.removeProperty(`transition`);let s=r.by/Math.max(1,e.timeStamp-r.at)>mm;r.by>t.offsetHeight/4||s?(t.style.transform=`translateY(100%)`,o.current=window.setTimeout(n,pm)):t.style.transform=``},onPointerCancel:()=>{a.current=null;let e=i.current;e&&(e.style.removeProperty(`transition`),e.style.transform=``)}},c=e.current?.ownerDocument;return c?(0,v.createPortal)((0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-sheet-backdrop`,onClick:n}),(0,q.jsxs)(`div`,{ref:i,"aria-label":t,"aria-modal":`true`,className:`gh-portal-sheet`,role:`dialog`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-sheet-header`,onPointerCancel:s.onPointerCancel,onPointerDown:s.onPointerDown,onPointerMove:s.onPointerMove,onPointerUp:s.onPointerUp,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-sheet-title`,children:t}),(0,q.jsx)(`button`,{"aria-label":K(`Close`),className:`gh-portal-sheet-close`,type:`button`,onClick:n,onPointerDown:e=>e.stopPropagation(),children:(0,q.jsx)(rm,{"aria-hidden":`true`,height:16,width:16})})]}),r]})]}),c.body):null}var vm=480,ym=12,bm=34,xm=416,Sm=500,Cm=`
|
|
963
963
|
/* The field is a .gh-portal-input, so it takes Portal's border and spacing like any other
|
|
964
964
|
input. This only makes room for the chips and the button inside it. */
|
|
965
965
|
.gh-portal-listpicker .gh-portal-listpicker-field {
|
|
@@ -1180,7 +1180,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1180
1180
|
.gh-portal-listpicker-list {
|
|
1181
1181
|
flex: 0 1 auto;
|
|
1182
1182
|
min-height: 0;
|
|
1183
|
-
max-height: ${
|
|
1183
|
+
max-height: ${xm}px;
|
|
1184
1184
|
margin: 0;
|
|
1185
1185
|
padding: 4px;
|
|
1186
1186
|
overflow-y: auto;
|
|
@@ -1188,13 +1188,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1188
1188
|
list-style: none;
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
-
/* Whole pixels: 7px, a 20px line and 7px make a row exactly ${
|
|
1191
|
+
/* Whole pixels: 7px, a 20px line and 7px make a row exactly ${bm}px, so every row
|
|
1192
1192
|
starts on the pixel grid and every tick is drawn the same. */
|
|
1193
1193
|
.gh-portal-listpicker-option {
|
|
1194
1194
|
display: flex;
|
|
1195
1195
|
align-items: center;
|
|
1196
1196
|
gap: 10px;
|
|
1197
|
-
min-height: ${
|
|
1197
|
+
min-height: ${bm}px;
|
|
1198
1198
|
margin: 0;
|
|
1199
1199
|
padding: 7px 10px;
|
|
1200
1200
|
border-radius: 6px;
|
|
@@ -1273,7 +1273,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1273
1273
|
min-height: 44px;
|
|
1274
1274
|
font-size: 1.6rem;
|
|
1275
1275
|
}
|
|
1276
|
-
`,
|
|
1276
|
+
`,wm=(...e)=>e.filter(Boolean).join(` `);function Tm(e,t,n){for(let r=0;r<e.length;r+=1){let i=(n+r)%e.length;if(e[i]?.toLowerCase().startsWith(t))return i}return-1}function Em({id:e,labelId:t,label:n,options:r,value:i,multiple:a,clearable:o=!0,answerText:s,alignTo:c,placeholder:l,invalid:u,disabled:d,readOnly:f,describedBy:p,onChange:m}){let h=t?{"aria-labelledby":t}:{"aria-label":n},[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)({index:0,byKeyboard:!1}),[C,w]=(0,_.useState)(``),T=(0,_.useRef)(null),E=(0,_.useRef)(null),D=(0,_.useRef)(null),O=(0,_.useRef)(null),k=(0,_.useRef)({letters:``,at:0}),ee=`${e}-list`,A=t=>`${e}-option-${t}`,te=r.length>ym,j=C.trim().toLowerCase(),ne=e=>[...!a&&o&&i.length>0&&!e?[{option:null,label:K(`(None)`)}]:[],...r.filter(({label:t})=>!e||t.toLowerCase().includes(e)).map(({value:e,label:t})=>({option:e,label:t}))],re=e=>r.find(t=>t.value===e)?.label??e,M=ne(j),N=()=>T.current?.ownerDocument.defaultView,ie=(e,t)=>S(n=>n.index===e&&n.byKeyboard===t?n:{index:e,byKeyboard:t}),ae=()=>Math.max(0,ne(``).findIndex(({option:e})=>e!==null&&i.includes(e))),oe=e=>{if(d)return;let t=N()?.innerWidth;b(t!==void 0&&t<vm),w(``),k.current={letters:``,at:0},ie(ae(),e),v(!0)},se=()=>{te&&!N()?.matchMedia(`(pointer: coarse)`).matches?O.current?.focus():D.current?.focus()},P=e=>{v(!1),e&&E.current?.focus()},ce=e=>{if(e===null){m([]),P(!0);return}if(a){m(r.map(e=>e.value).filter(t=>t===e?!i.includes(e):i.includes(t)));return}m([e]),P(!0)},le=()=>Date.now()-k.current.at<Sm,ue=e=>{let t=e.toLowerCase(),n=(le()?k.current.letters:``)+t;k.current={letters:n,at:Date.now()};let r=M.map(({label:e})=>e),i=[...n].every(e=>e===t)?Tm(r,t,x.index+1):Tm(r,n,x.index);i!==-1&&ie(i,!0)};(0,_.useLayoutEffect)(()=>{g&&se()},[g,y]);let de=()=>D.current?.querySelector(`[data-active]`)?.scrollIntoView({block:`nearest`});(0,_.useEffect)(()=>{g&&de()},[g]),(0,_.useEffect)(()=>{g&&x.byKeyboard&&de()},[x]);let F=e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let t=e.currentTarget===O.current,n=e=>Math.max(0,Math.min(M.length-1,e)),r={ArrowDown:n(x.index+1),ArrowUp:n(x.index-1),...t?{}:{Home:0,End:n(M.length-1)}}[e.key];if(r!==void 0)e.preventDefault(),ie(r,!0);else if(e.key===`Enter`||e.key===` `&&!t&&!le()){e.preventDefault();let t=M[x.index];t!==void 0&&ce(t.option)}else e.key===`Tab`&&!y?P(!0):e.key===`Backspace`&&t&&!C&&a&&i.length>0?m(i.slice(0,-1)):!t&&e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),ue(e.key))},fe=(0,q.jsx)(`ul`,{ref:D,"aria-activedescendant":M.length>0?A(x.index):void 0,...h,"aria-multiselectable":a||void 0,className:`gh-portal-listpicker-list`,id:ee,role:`listbox`,tabIndex:0,onKeyDown:F,children:M.map(({option:e,label:t},n)=>(0,q.jsxs)(`li`,{"aria-selected":e!==null&&i.includes(e),className:wm(`gh-portal-listpicker-option`,n===x.index&&`is-active`,n===x.index&&x.byKeyboard&&`is-keyboard`),"data-active":n===x.index||void 0,id:A(n),role:`option`,onClick:()=>ce(e),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>ie(n,!1),children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:wm(`gh-portal-listpicker-marker`,!a&&`is-check`)}),(0,q.jsx)(`span`,{children:t})]},e??``))}),pe=te&&(0,q.jsxs)(`div`,{className:`gh-portal-listpicker-search`,children:[(0,q.jsxs)(`svg`,{"aria-hidden":`true`,fill:`none`,height:`16`,viewBox:`0 0 24 24`,width:`16`,children:[(0,q.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`,stroke:`currentColor`,strokeWidth:`2`}),(0,q.jsx)(`path`,{d:`m20 20-3.5-3.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`2`})]}),(0,q.jsx)(`input`,{ref:O,"aria-activedescendant":M.length>0?A(x.index):void 0,"aria-autocomplete":`list`,"aria-controls":ee,"aria-expanded":`true`,...h,autoComplete:`off`,placeholder:n,role:`combobox`,spellCheck:!1,type:`text`,value:C,onChange:e=>{let t=e.target.value;w(t),ie(t.trim()?0:ae(),!0)},onKeyDown:F})]}),me=M.length===0&&(0,q.jsx)(`div`,{className:`gh-portal-listpicker-empty`,children:K(`No options found`)}),he=l;if(a&&i.length>0?he=``:i[0]!==void 0&&(he=(s??re)(i[0])),f){let t=!a&&s?he:void 0;return(0,q.jsx)(`div`,{className:`gh-portal-listpicker`,children:(0,q.jsxs)(`div`,{...h,className:`gh-portal-input gh-portal-listpicker-field is-multiple is-read-only`,"data-test-input":e,id:e,role:`group`,children:[t!==void 0&&(0,q.jsx)(`span`,{className:`gh-portal-listpicker-value`,children:t}),t===void 0&&i.length>0&&(0,q.jsx)(`ul`,{className:`gh-portal-listpicker-chips`,children:i.map(e=>(0,q.jsx)(`li`,{className:`gh-portal-listpicker-chip is-read-only`,children:re(e)},e))})]})})}return(0,q.jsxs)(`div`,{className:wm(`gh-portal-listpicker`,g&&`is-open`),children:[(0,q.jsxs)(`div`,{ref:T,className:wm(`gh-portal-input`,`gh-portal-listpicker-field`,a&&`is-multiple`,a&&i.length>0&&`is-filled`,!!u&&`error`),onClick:e=>{e.target===e.currentTarget&&(g?P(!0):oe(!1))},children:[a&&i.map(e=>(0,q.jsxs)(`span`,{className:`gh-portal-listpicker-chip`,children:[(0,q.jsx)(`span`,{children:re(e)}),(0,q.jsx)(`button`,{"aria-label":K(`Remove {option}`,{option:re(e)}),className:`gh-portal-listpicker-chip-remove`,disabled:d,type:`button`,onClick:()=>{m(i.filter(t=>t!==e)),g?se():E.current?.focus()},children:(0,q.jsx)(rm,{"aria-hidden":`true`,height:12,width:12})})]},e)),(0,q.jsxs)(`button`,{ref:E,"aria-controls":ee,"aria-describedby":p,"aria-expanded":g,"aria-haspopup":`listbox`,"aria-invalid":u||void 0,...h,className:wm(`gh-portal-listpicker-trigger`,!a&&i.length>0&&`has-value`,a&&i.length>0&&`is-filled`),"data-test-input":e,disabled:d,id:e,role:`combobox`,type:`button`,onClick:e=>g?P(!0):oe(e.detail===0),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),oe(!0)):e.key===` `&&(e.preventDefault(),g?P(!0):oe(!0))},onKeyUp:e=>{e.key===` `&&e.preventDefault()},children:[(0,q.jsx)(`span`,{className:`gh-portal-listpicker-value`,children:he}),(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-listpicker-chevron`})]})]}),g&&!y&&(0,q.jsxs)(fm,{align:`stretch`,alignTo:c,anchor:T,className:`gh-portal-listpicker-popover`,fit:!0,onClose:e=>P(e===`escape`),children:[pe,fe,me]}),g&&y&&(0,q.jsxs)(_m,{opener:T,title:n,onClose:()=>P(!0),children:[pe,fe,me]})]})}var Dm=`AC.AD.AE.AF.AG.AI.AL.AM.AO.AQ.AR.AS.AT.AU.AW.AX.AZ.BA.BB.BD.BE.BF.BG.BH.BI.BJ.BL.BM.BN.BO.BQ.BR.BS.BT.BV.BW.BY.BZ.CA.CC.CD.CF.CG.CH.CI.CK.CL.CM.CN.CO.CR.CU.CV.CW.CX.CY.CZ.DE.DJ.DK.DM.DO.DZ.EC.EE.EG.EH.ER.ES.ET.FI.FJ.FK.FM.FO.FR.GA.GB.GD.GE.GF.GG.GH.GI.GL.GM.GN.GP.GQ.GR.GS.GT.GU.GW.GY.HK.HM.HN.HR.HT.HU.ID.IE.IL.IM.IN.IO.IQ.IR.IS.IT.JE.JM.JO.JP.KE.KG.KH.KI.KM.KN.KP.KR.KW.KY.KZ.LA.LB.LC.LI.LK.LR.LS.LT.LU.LV.LY.MA.MC.MD.ME.MF.MG.MH.MK.ML.MM.MN.MO.MP.MQ.MR.MS.MT.MU.MV.MW.MX.MY.MZ.NA.NC.NE.NF.NG.NI.NL.NO.NP.NR.NU.NZ.OM.PA.PE.PF.PG.PH.PK.PL.PM.PN.PR.PS.PT.PW.PY.QA.RE.RO.RS.RU.RW.SA.SB.SC.SD.SE.SG.SH.SI.SJ.SK.SL.SM.SN.SO.SR.SS.ST.SV.SX.SY.SZ.TA.TC.TD.TF.TG.TH.TJ.TK.TL.TM.TN.TO.TR.TT.TV.TW.TZ.UA.UG.UM.US.UY.UZ.VA.VC.VE.VG.VI.VN.VU.WF.WS.XK.YE.YT.ZA.ZM.ZW`.split(`.`),Om=new Map;function km(e){let t=Om.get(e);if(!t){let n=null;try{n=new Intl.DisplayNames([e],{type:`region`})}catch{}let r;try{r=new Intl.Collator(e)}catch{r=new Intl.Collator}let i=e=>{try{return n?.of(e)||e}catch{return e}};t={options:Dm.map(e=>({value:e,label:i(e)})).sort((e,t)=>r.compare(e.label,t.label)),name:i},Om.set(e,t)}return t}function Am(e){let{options:t,name:n}=km(Hc.language||`en`);return!e||t.some(t=>t.value===e)?t:[...t,{value:e,label:n(e)}]}function jm(e){let{options:t,name:n}=km(Hc.language||`en`);return[...t.filter(({value:t})=>e.includes(t)),...e.filter(e=>!t.some(({value:t})=>t===e)).map(e=>({value:e,label:n(e)}))]}function Mm(e){return{...e,readOnly:e.access.member!==`write`}}function Nm(e){return Hf(e.type)}async function Pm({api:e,site:t,member:n}){if(!Zl({site:t})||!n||Qu())return[];try{return(await e.member.customFields()).flatMap(e=>Nm(e)?[e]:(console.warn(`[Portal] Left out a custom field of a type this build does not know:`,{key:e.key,type:e.type}),[]))}catch{return[]}}function Fm(e,t){return Object.fromEntries(e.map(e=>{let n=e.readOnly?Ep:Dp;return[e.key,n(hp(e),t[e.key])]}))}var Im=e=>typeof e==`object`&&!Array.isArray(e)?e:void 0,Lm=e=>typeof e==`string`?e:``,Rm=e=>Array.isArray(e)?e:[];function zm(e,t,n){let r={};for(let i of e.filter(e=>!e.readOnly)){let e=kp(hp(i),t[i.key],n[i.key]);e!==void 0&&(r[i.key]=e)}return Object.keys(r).length>0?{custom:r}:void 0}function Bm(e,t){return qf(e.type,{scalar:()=>t===``?`custom:${e.key}`:null,record:({parts:n})=>t!==``&&Object.keys(n).includes(t)?`custom:${e.key}:${t}`:null,set:()=>t===``?`custom:${e.key}`:null})}var Vm=`
|
|
1277
1277
|
/* A field's reasons sit right under its inputs, which give up their own gap to the next
|
|
1278
1278
|
field so the gap comes after the reasons instead. */
|
|
1279
1279
|
.gh-portal-custom-field {
|
|
@@ -1298,7 +1298,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1298
1298
|
min-width: 0;
|
|
1299
1299
|
}
|
|
1300
1300
|
|
|
1301
|
-
/* The country, shown as its
|
|
1301
|
+
/* The country, shown as its calling code, takes only the room it needs. */
|
|
1302
1302
|
.gh-portal-input-group-row .gh-portal-input-section.gh-portal-phone-country {
|
|
1303
1303
|
flex: 0 0 auto;
|
|
1304
1304
|
}
|
|
@@ -1322,7 +1322,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1322
1322
|
line-height: 1.6em;
|
|
1323
1323
|
margin: 0;
|
|
1324
1324
|
}
|
|
1325
|
-
`,
|
|
1325
|
+
`,Hm={countries:(e,t)=>t?jm(t):Am(e)},Um={line:{type:`text`},code:{type:`text`},long:{type:`textarea`},phone:{type:`phone`}},Wm=(e,t,n)=>ep(e,{text:({format:e})=>Um[e],choice:({from:e})=>({type:`select`,options:Hm[e](t,n)})}),Gm={address:{labels:()=>({line1:K(`Address line 1`),line2:K(`Address line 2`),city:K(`City`),state:K(`State`),postal_code:K(`Postal code`),country:K(`Country`)}),rows:[[`line1`],[`line2`],[`city`,`state`],[`postal_code`,`country`]]}};function Km({id:e,messages:t}){return t.length===0?null:(0,q.jsx)(`ul`,{className:`gh-portal-custom-field-errors`,id:e,children:t.map(e=>(0,q.jsx)(`li`,{children:e},e))})}function qm({value:e,readOnly:t,onChange:n,onKeyDown:r,...i}){let a=nd([`preview`])||xl(),o=(0,_.useMemo)(()=>Bp(Am()),[]),s=(0,_.useRef)(null),[c,l]=(0,_.useState)(()=>Gp(e,navigator.languages??[],Intl.DateTimeFormat().resolvedOptions().timeZone)),u=(0,_.useRef)(e);(0,_.useEffect)(()=>{e!==u.current&&(u.current=e,l(t=>Kp(t,e)))},[e]);let d=Vp(c.typed,c.picked),f=e=>{l(e.entry),u.current=e.number,n(e.number)};return(0,q.jsxs)(`div`,{ref:s,className:`gh-portal-phone-input`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-section gh-portal-phone-country`,children:(0,q.jsx)(Em,{alignTo:s,answerText:e=>`+${Ap[e]}`,clearable:!1,describedBy:i.describedBy,disabled:a,id:`input-${i.name}-country`,invalid:!!i.invalid,label:K(`Country code`),multiple:!1,options:o,placeholder:`+`,readOnly:t??!1,value:d?[d]:[],onChange:([e])=>{e&&e!==d&&f(Jp(c,e))}})}),(0,q.jsx)(nm,{fields:[{...i,type:`tel`,autoComplete:`tel`,value:c.typed,readOnly:t}],onChange:e=>f(qp(c,e.target.value)),onKeyDown:r})]})}function Jm({leaf:e,onChange:t,onKeyDown:n}){return e.type===`phone`?(0,q.jsx)(qm,{...e,onChange:t,onKeyDown:n}):(0,q.jsx)(nm,{fields:[e],onChange:e=>t(e.target.value),onKeyDown:n})}function Ym({field:e,value:t,errors:n,onChange:r,onKeyDown:i}){let a=`custom:${e.key}`,o=Lm(t),s=n[a],c=`custom-${e.key}-errors`,l={...Wm(Rf[e.type].leaf,o||void 0),value:o,label:e.name,name:a,invalid:!!s,describedBy:s?c:void 0,readOnly:e.readOnly};return(0,q.jsxs)(q.Fragment,{children:[l.type===`phone`?(0,q.jsxs)(`section`,{className:`gh-portal-input-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`input-${a}`,children:e.name})}),(0,q.jsx)(`div`,{className:`gh-portal-input-group`,children:(0,q.jsx)(`div`,{className:`gh-portal-input-group-row`,children:(0,q.jsx)(Jm,{leaf:{...l,hideLabel:!0},onChange:r,onKeyDown:i})})})]}):(0,q.jsx)(Jm,{leaf:l,onChange:r,onKeyDown:i}),(0,q.jsx)(Km,{id:c,messages:s?[s]:[]})]})}function Xm({parts:e,input:t,onChange:n,onKeyDown:r}){return(0,q.jsx)(`div`,{className:`gh-portal-input-group-row`,children:e.map(e=>(0,q.jsx)(Jm,{leaf:t(e),onChange:t=>n(e,t),onKeyDown:r},e))})}function Zm({field:e,value:t,errors:n,onChange:r,onKeyDown:i}){let{type:a}=e,o=Im(t)??{},s=Gm[a].labels(),c=Rf[a].parts,l=Gm[a].rows,u=l.flat(),d=[...l,...Object.keys(c).filter(e=>!u.includes(e)).map(e=>[e])],{readOnly:f}=e,p=`custom-${e.key}-label`,m=`custom-${e.key}-errors`,h=t=>`custom:${e.key}:${t}`,g=e=>s[e]??e,_=t=>{let r=c[t],i=g(t);return{...r?Wm(r,o[t],e.countries):{type:`text`},value:o[t]??``,label:i,hideLabel:!0,placeholder:i,name:h(t),invalid:!!n[h(t)],describedBy:n[h(t)]?m:void 0,readOnly:f}},v=d.flat().flatMap(e=>{let t=n[h(e)];return t?[{part:e,message:t}]:[]});return(0,q.jsxs)(`section`,{"aria-labelledby":p,role:`group`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-label`,id:p,children:e.name}),(0,q.jsx)(`div`,{className:`gh-portal-input-group`,children:d.map(e=>(0,q.jsx)(Xm,{input:_,parts:e,onChange:(e,n)=>r({...Im(t),[e]:n}),onKeyDown:i},e.join(`:`)))}),(0,q.jsx)(Km,{id:m,messages:v.map(({part:e,message:t})=>`${g(e)}: ${t}`)})]})}function Qm({field:e,value:t,errors:n,onChange:r}){let{settings:i}=e,a=`custom:${e.key}`,o=Rm(t),{readOnly:s}=e,c=s?Bf(i,o):Vf(i,o),l=n[a],u=`input-${a}`,d=`${u}-label`,f=`custom-${e.key}-errors`;return(0,q.jsxs)(`section`,{className:`gh-portal-input-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:s?(0,q.jsx)(`div`,{className:`gh-portal-input-label`,id:d,children:e.name}):(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:u,id:d,children:e.name})}),(0,q.jsx)(Em,{describedBy:l?f:void 0,disabled:nd([`preview`])||xl(),id:u,invalid:!!l,label:e.name,labelId:d,multiple:i.multiple,options:i.options.map(e=>({value:e,label:e})),placeholder:K(`Choose an option`),readOnly:s,value:c,onChange:r}),(0,q.jsx)(Km,{id:f,messages:l?[l]:[]})]})}function $m({field:e,onChange:t,...n}){return(0,q.jsx)(`div`,{className:`gh-portal-custom-field`,children:Qf(e,{scalar:e=>(0,q.jsx)(Ym,{...n,field:e,onChange:n=>t(e,n)}),record:e=>(0,q.jsx)(Zm,{...n,field:e,onChange:n=>t(e,n)}),set:e=>(0,q.jsx)(Qm,{...n,field:e,onChange:n=>t(e,n)})})})}function eh({fields:e,values:t,errors:n,onChange:r,onKeyDown:i}){return(0,q.jsx)(q.Fragment,{children:e.map(e=>(0,q.jsx)($m,{errors:n,field:e,value:t[e.key],onChange:r,onKeyDown:i},e.key))})}var th={shippingAddress:`checkout.shipping.address`,shippingName:`checkout.shipping.name`,phone:`checkout.phone`},nh={shipping:{recipient:th.shippingName,address:th.shippingAddress},phone:{number:th.phone}};function rh(e){let t=nh[e];return Object.values(t)}function ih(e,t){switch(e.name){case`shipping`:return t.shipping(e);case`phone`:return t.phone(e)}}function ah(e){return Object.hasOwn(nh,e)}Object.keys(nh).filter(ah).flatMap(rh);var oh={shipping:({countries:e})=>({recipient:{label:K(`Recipient name`),type:`short_text`},address:{label:K(`Shipping address`),type:`address`,countries:e}}),phone:()=>({number:{label:K(`Phone number`),type:`phone`}})};function sh(e){if(!ah(e.name))return!1;let t=Object.keys(nh[e.name]),n=Object.keys(e.ports);return n.length===t.length&&t.every(e=>n.includes(e))}function ch(e){let t=e.filter(sh);return Object.keys(oh).flatMap(e=>{let n=t.find(t=>t.name===e);if(!n)return[];let r=ih(n,oh),i=n.ports;return Object.entries(r).flatMap(([e,{label:t,type:n,countries:r}])=>{let a=i[e]?.port;return a?[{key:a,name:t,readOnly:!1,type:n,settings:void 0,countries:r}]:[]})})}function lh(e,t){let n=Fm(e,t);return Object.fromEntries(e.map(e=>{let t=n[e.key],r=Im(t),{country:i}=r??{};return[e.key,r&&i&&e.countries&&!e.countries.includes(i)?{...r,country:``}:t]}))}function uh(e,t){return Object.fromEntries(e.filter(sh).flatMap(({ports:e})=>Object.values(e).flatMap(({port:e,field:n})=>{let[r=``,i=``]=n?.split(`.`)??[],a=t?.[r]?.[i];return a===void 0?[]:[[e,a]]})))}function dh(e,t){let n=[...e].sort((e,t)=>t.key.length-e.key.length);for(let e of n){let n=`answers.${e.key}`;if(t===n)return{field:e,part:``};if(t.startsWith(`${n}.`))return{field:e,part:t.slice(n.length+1)}}return null}function fh(e,t){let n=(0,_.useMemo)(()=>ch(e),[e]),[r,i]=(0,_.useState)(()=>lh(n,uh(e,t)));return{inputs:n,values:r,change:(e,t)=>i(n=>({...n,[e.key]:t}))}}function ph(e,t){if(Op(hp(e),t)===void 0)return!1;let{country:n}=Im(t)??{};return e.type!==`address`||!!n?.trim()}function mh({inputs:e,values:t}){return e.every(e=>ph(e,t[e.key]))}function hh({inputs:e,values:t}){return Object.fromEntries(e.flatMap(e=>{let n=Op(hp(e),t[e.key]);return n===void 0?[]:[[e.key,n]]}))}function gh({asked:e,errors:t}){return(0,q.jsx)(eh,{errors:t,fields:e.inputs,values:e.values,onChange:(t,n)=>e.change(t,n)})}var _h=e=>(0,q.jsx)(`svg`,{width:15,height:14,viewBox:`0 0 15 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,q.jsx)(`path`,{d:`M1 6.89286L6.10714 12L13.9643 1`,stroke:`#222222`,strokeWidth:2})});function vh(e,t){if(isNaN(e)||isNaN(t))return 0;let n=e?100-Math.floor(t/12*100/e):0;return n>=1&&n<100?n:0}var yh=()=>`
|
|
1326
1326
|
.gh-portal-products {
|
|
1327
1327
|
display: flex;
|
|
1328
1328
|
flex-direction: column;
|
|
@@ -1839,7 +1839,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1839
1839
|
min-height: unset;
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
|
-
`,yh=_.createContext({selectedInterval:`month`,selectedProduct:`free`,selectedPlan:null,setSelectedProduct:null});function bh({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((e,t)=>{let n=e?.id||`benefit-${t}`;return(0,q.jsxs)(`div`,{className:`gh-portal-product-benefit`,children:[(0,q.jsx)(gh,{className:`gh-portal-benefit-checkmark`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`gh-portal-benefit-title`,children:e.name})]},n)})}function xh({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:(0,q.jsx)(`div`,{className:`gh-portal-product-benefits`,children:(0,q.jsx)(bh,{product:e})})}function Sh({price:e}){let{site:t}=(0,_.useContext)(J),{portal_plans:n}=t;return!n.includes(`monthly`)||!n.includes(`yearly`)?(0,q.jsx)(`div`,{className:`gh-portal-product-alternative-price`}):(0,q.jsx)(`div`,{className:`gh-portal-product-alternative-price`,children:Nu(e,t.locale)})}function Ch({trialDays:e,discount:t,selectedInterval:n}){let{site:r}=(0,_.useContext)(J);return iu({site:r})?e?(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{trialDays} days free`,{trialDays:e})}):null:n===`year`?(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{discount}% discount`,{discount:t})}):null}function wh({product:e}){let{selectedInterval:t}=(0,_.useContext)(yh),{site:n}=(0,_.useContext)(J),r=e.monthlyPrice,i=e.yearlyPrice,a=e.trial_days,o=t===`month`?r:i,s=t===`month`?i:r,c=o.interval===`year`?K(`year`):K(`month`);if(!r||!i)return null;let l=_h(e.monthlyPrice.amount,e.yearlyPrice.amount),u=ju(o.currency);return iu({site:n})?(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-price-trial`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(u.length>1?` long`:``),children:u}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:Fu(Mu(o.amount),n.locale)}),(0,q.jsxs)(`span`,{className:`billing-period`,children:[`/`,c]})]}),(0,q.jsx)(Ch,{trialDays:a,discount:l,selectedInterval:t})]}),t===`year`?(0,q.jsx)(Ah,{discount:l,trialDays:a}):``,(0,q.jsx)(Sh,{price:s})]})}):(0,q.jsxs)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-price-trial`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(u.length>1?` long`:``),children:u}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:Fu(Mu(o.amount),n.locale)}),(0,q.jsxs)(`span`,{className:`billing-period`,children:[`/`,c]})]}),t===`year`?(0,q.jsx)(Ah,{discount:l}):``]}),(0,q.jsx)(Sh,{price:s})]})}function Th({products:e,handleChooseSignup:t,error:n}){let{site:r,action:i}=(0,_.useContext)(J),{selectedProduct:a,setSelectedProduct:o}=(0,_.useContext)(yh),s=a===`free`?`gh-portal-product-card free checked`:`gh-portal-product-card free`,c=tu({site:r}),l=su({site:r}),u=i===`signup:running`;xl()&&(u=!0);let d=`$`;d=e&&e[1]?ju(e[1].monthlyPrice.currency):`$`;let f=hu({site:r}),p=au({site:r});if(f){if(!l&&!p.length)return null;s+=` only-free`}return!l&&!p.length&&(l=`Free preview`),(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:s,onClick:e=>{e.stopPropagation(),o(`free`)},"data-test-tier":`free`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:ou({site:r})}),f?``:(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer free-trial-disabled`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(d.length>1?` long`:``),children:d}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:`0`})]})})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[l?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:l}):``,(0,q.jsx)(xh,{product:c})]}),f?``:(0,q.jsxs)(`div`,{className:`gh-portal-btn-product`,children:[(0,q.jsx)(`button`,{"data-test-button":`select-tier`,className:`gh-portal-btn`,disabled:u,onClick:e=>{t(e,`free`)},children:a===`free`&&u?(0,q.jsx)(cf,{className:`gh-portal-loadingicon`}):K(`Choose`)}),n&&(0,q.jsx)(`div`,{className:`gh-portal-error-message`,children:n})]})]})]})})}function Eh({selectedProduct:e,product:t,disabled:n,noOfProducts:r,trialDays:i}){return e===t.id&&n?(0,q.jsx)(cf,{className:`gh-portal-loadingicon`}):i>0?(0,q.jsx)(Bd,{string:K(`Start {amount}-day free trial`),mapping:{amount:i}}):K(r>1?`Choose`:`Continue`)}function Dh({product:e,products:t,selectedInterval:n,handleChooseSignup:r,error:i}){let{selectedProduct:a,setSelectedProduct:o}=(0,_.useContext)(yh),{action:s}=(0,_.useContext)(J),c=e.trial_days,l=a===e.id?`gh-portal-product-card checked`:`gh-portal-product-card`,u=t?.filter(e=>e.type===`paid`)?.length,d=!![`signup:running`,`checkoutPlan:running`].includes(s);xl()&&(d=!0);let f=e.description;return(!e.benefits||!e.benefits.length)&&!f&&(f=`Full access`),(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:l,onClick:t=>{t.stopPropagation(),o(e.id)},"data-test-tier":`paid`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:e.name}),(0,q.jsx)(wh,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:f}),(0,q.jsx)(xh,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-product`,children:[(0,q.jsx)(`button`,{"data-test-button":`select-tier`,disabled:d,className:`gh-portal-btn`,onClick:i=>{r(i,Mh({products:t,selectedInterval:n,selectedProduct:e.id}).id)},children:(0,q.jsx)(Eh,{selectedProduct:a,product:e,disabled:d,noOfProducts:u,trialDays:c})}),i&&(0,q.jsx)(`div`,{className:`gh-portal-error-message`,children:i})]})]})]},e.id)})}function Oh({product:e,products:t,selectedInterval:n,errors:r}){let i=Mh({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&r&&r[i.id]?r[i.id]:null}function kh({products:e,selectedInterval:t,handleChooseSignup:n,errors:r}){return e.map(i=>{let a=Oh({product:i,products:e,selectedInterval:t,errors:r});return i.id===`free`?(0,q.jsx)(Th,{products:e,handleChooseSignup:n,error:a},i.id):(0,q.jsx)(Dh,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:a},i.id)})}function Ah({discount:e}){let{site:t}=(0,_.useContext)(J),{portal_plans:n}=t;return e===0||!n.includes(`monthly`)?null:iu({site:t})?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`span`,{className:`gh-portal-discount-label-trial`,children:K(`{discount}% discount`,{discount:e})})}):(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{discount}% discount`,{discount:e})})})}function jh({selectedInterval:e,setSelectedInterval:t,products:n}){let{site:r}=(0,_.useContext)(J),{portal_plans:i}=r,a=n.filter(e=>e.type!==`free`).map(e=>_h(e.monthlyPrice?.amount,e.yearlyPrice?.amount)),o=Math.max(...a);return!i.includes(`monthly`)||!i.includes(`yearly`)?null:(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-products-pricetoggle`+(e===`month`?` left`:``),children:[(0,q.jsx)(`button`,{"data-test-button":`switch-monthly`,"data-testid":`monthly-switch`,className:`gh-portal-btn`+(e===`month`?` active`:``),onClick:()=>{t(`month`)},children:K(`Monthly`)}),(0,q.jsxs)(`button`,{"data-test-button":`switch-yearly`,"data-testid":`yearly-switch`,className:`gh-portal-btn`+(e===`year`?` active`:``),onClick:()=>{t(`year`)},children:[K(`Yearly`),o>0&&(0,q.jsx)(`span`,{className:`gh-portal-maximum-discount`,children:K(`(save {highestYearlyDiscount}%)`,{highestYearlyDiscount:o})})]})]})})}function Mh({products:e,selectedProduct:t,selectedInterval:n}){let r=null;if(t===`free`)r={id:`free`};else{let i=e.find(e=>e.id===t);i||=e.find(e=>e.type===`paid`),r=n===`month`?i?.monthlyPrice:i?.yearlyPrice}return r}function Nh({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:r,errors:i}){let{site:a,member:o}=(0,_.useContext)(J),{portal_plans:s,portal_default_plan:c}=a,l=t.length>0?t[0].id:`free`,[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(l),m=Mh({products:t,selectedInterval:u,selectedProduct:f}),h=Xu({portalPlans:s,portalDefaultPlan:c,selectedInterval:u}),g=wl({member:o}),v=hu({site:a});if((0,_.useEffect)(()=>{p(l)},[l]),(0,_.useEffect)(()=>{e(null,m.id)},[m.id,e]),t.length===0)return g?(0,q.jsx)(`p`,{style:{textAlign:`center`},children:K(`Please contact {supportAddress} to adjust your complimentary subscription.`,{supportAddress:Ou({site:a})})}):null;let y=`gh-portal-products`;n===`upgrade`&&(y+=` gh-portal-upgrade-product`);let b=t.find(e=>e.id===f)?.id||t.find(e=>e.type===`paid`)?.id;return(0,q.jsx)(yh.Provider,{value:{selectedInterval:h,selectedProduct:b,setSelectedProduct:p},children:(0,q.jsxs)(`section`,{className:y,children:[v?``:(0,q.jsx)(jh,{products:t,selectedInterval:h,setSelectedInterval:d}),(0,q.jsx)(`div`,{className:`gh-portal-products-grid`,children:(0,q.jsx)(kh,{products:t,selectedInterval:h,handleChooseSignup:r,errors:i})})]})})}function Ph({onPlanSelect:e,selectedPlan:t,products:n,type:r=null}){let{site:i,member:a}=(0,_.useContext)(J),{portal_plans:o}=i,s=Pl({member:a}),c=yu({site:i,priceId:s.id}),l=Xu({portalPlans:o,selectedInterval:s.interval}),u=c?.id||n?.[0]?.id,[d,f]=(0,_.useState)(l),[p,m]=(0,_.useState)(u),h=Xu({portalPlans:o,selectedInterval:d});if((0,_.useEffect)(()=>{m(u)},[u]),!o.includes(`monthly`)&&!o.includes(`yearly`)||n.length===0)return null;let g=`gh-portal-products`;return r===`upgrade`&&(g+=` gh-portal-upgrade-product`),r===`changePlan`&&(g+=` gh-portal-upgrade-product gh-portal-change-plan`),(0,q.jsx)(yh.Provider,{value:{selectedInterval:h,selectedProduct:p,selectedPlan:t,setSelectedProduct:m},children:(0,q.jsxs)(`section`,{className:g,children:[(0,q.jsx)(jh,{selectedInterval:h,setSelectedInterval:f,products:n}),(0,q.jsx)(`div`,{className:`gh-portal-products-grid`,children:(0,q.jsx)(Lh,{products:n,onPlanSelect:e})})]})})}function Fh({product:e}){return e?.description?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:e.description}):null}function Ih({product:e,onPlanSelect:t}){let{member:n,site:r}=(0,_.useContext)(J),{selectedProduct:i,setSelectedProduct:a,selectedInterval:o}=(0,_.useContext)(yh),s=i===e.id?`gh-portal-product-card checked`:`gh-portal-product-card`,c=e.monthlyPrice,l=e.yearlyPrice,u=Pl({member:n}),d=o===`month`?c:l,f=Il({member:n,site:r,priceId:d.id});return(0,q.jsxs)(`div`,{className:s+(f?` disabled`:``),onClick:t=>{t.stopPropagation(),a(e.id)},"data-test-tier":`paid`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:e.name}),(0,q.jsx)(wh,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[e.description?(0,q.jsx)(Fh,{product:e,selectedPrice:d,activePrice:u}):``,(0,q.jsx)(xh,{product:e})]}),f?(0,q.jsx)(`div`,{className:`gh-portal-btn-product`,children:(0,q.jsx)(`span`,{className:`gh-portal-current-plan`,children:(0,q.jsx)(`span`,{children:K(`Current plan`)})})}):(0,q.jsx)(`div`,{className:`gh-portal-btn-product`,children:(0,q.jsx)(`button`,{"data-test-button":`select-tier`,className:`gh-portal-btn`,onClick:()=>{t(null,d?.id)},children:K(`Choose`)})})]})]},e.id)}function Lh({products:e,onPlanSelect:t}){return e.map(e=>!e||e.id===`free`?null:(0,q.jsx)(Ih,{product:e,onPlanSelect:t},e.id))}function Rh({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r,changePlan:i=!1}){return xl()&&(n=()=>{}),i?(0,q.jsx)(`section`,{className:`gh-portal-plans`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(Ph,{type:`changePlan`,products:e,selectedPlan:t,onPlanSelect:n})})}):(0,q.jsx)(`section`,{className:`gh-portal-plans`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(Nh,{type:`upgrade`,products:e,onPlanSelect:n,handleChooseSignup:(...e)=>{r(...e)}})})})}var zh=`
|
|
1842
|
+
`,bh=_.createContext({selectedInterval:`month`,selectedProduct:`free`,selectedPlan:null,setSelectedProduct:null});function xh({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((e,t)=>{let n=e?.id||`benefit-${t}`;return(0,q.jsxs)(`div`,{className:`gh-portal-product-benefit`,children:[(0,q.jsx)(_h,{className:`gh-portal-benefit-checkmark`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`gh-portal-benefit-title`,children:e.name})]},n)})}function Sh({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:(0,q.jsx)(`div`,{className:`gh-portal-product-benefits`,children:(0,q.jsx)(xh,{product:e})})}function Ch({price:e}){let{site:t}=(0,_.useContext)(J),{portal_plans:n}=t;return!n.includes(`monthly`)||!n.includes(`yearly`)?(0,q.jsx)(`div`,{className:`gh-portal-product-alternative-price`}):(0,q.jsx)(`div`,{className:`gh-portal-product-alternative-price`,children:Nu(e,t.locale)})}function wh({trialDays:e,discount:t,selectedInterval:n}){let{site:r}=(0,_.useContext)(J);return iu({site:r})?e?(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{trialDays} days free`,{trialDays:e})}):null:n===`year`?(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{discount}% discount`,{discount:t})}):null}function Th({product:e}){let{selectedInterval:t}=(0,_.useContext)(bh),{site:n}=(0,_.useContext)(J),r=e.monthlyPrice,i=e.yearlyPrice,a=e.trial_days,o=t===`month`?r:i,s=t===`month`?i:r,c=o.interval===`year`?K(`year`):K(`month`);if(!r||!i)return null;let l=vh(e.monthlyPrice.amount,e.yearlyPrice.amount),u=ju(o.currency);return iu({site:n})?(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-price-trial`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(u.length>1?` long`:``),children:u}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:Fu(Mu(o.amount),n.locale)}),(0,q.jsxs)(`span`,{className:`billing-period`,children:[`/`,c]})]}),(0,q.jsx)(wh,{trialDays:a,discount:l,selectedInterval:t})]}),t===`year`?(0,q.jsx)(jh,{discount:l,trialDays:a}):``,(0,q.jsx)(Ch,{price:s})]})}):(0,q.jsxs)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-price-trial`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(u.length>1?` long`:``),children:u}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:Fu(Mu(o.amount),n.locale)}),(0,q.jsxs)(`span`,{className:`billing-period`,children:[`/`,c]})]}),t===`year`?(0,q.jsx)(jh,{discount:l}):``]}),(0,q.jsx)(Ch,{price:s})]})}function Eh({products:e,handleChooseSignup:t,error:n}){let{site:r,action:i}=(0,_.useContext)(J),{selectedProduct:a,setSelectedProduct:o}=(0,_.useContext)(bh),s=a===`free`?`gh-portal-product-card free checked`:`gh-portal-product-card free`,c=tu({site:r}),l=su({site:r}),u=i===`signup:running`;xl()&&(u=!0);let d=`$`;d=e&&e[1]?ju(e[1].monthlyPrice.currency):`$`;let f=hu({site:r}),p=au({site:r});if(f){if(!l&&!p.length)return null;s+=` only-free`}return!l&&!p.length&&(l=`Free preview`),(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:s,onClick:e=>{e.stopPropagation(),o(`free`)},"data-test-tier":`free`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:ou({site:r})}),f?``:(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer free-trial-disabled`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`+(d.length>1?` long`:``),children:d}),(0,q.jsx)(`span`,{className:`amount`,"data-testid":`product-amount`,children:`0`})]})})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[l?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:l}):``,(0,q.jsx)(Sh,{product:c})]}),f?``:(0,q.jsxs)(`div`,{className:`gh-portal-btn-product`,children:[(0,q.jsx)(`button`,{"data-test-button":`select-tier`,className:`gh-portal-btn`,disabled:u,onClick:e=>{t(e,`free`)},children:a===`free`&&u?(0,q.jsx)(cf,{className:`gh-portal-loadingicon`}):K(`Choose`)}),n&&(0,q.jsx)(`div`,{className:`gh-portal-error-message`,children:n})]})]})]})})}function Dh({selectedProduct:e,product:t,disabled:n,noOfProducts:r,trialDays:i}){return e===t.id&&n?(0,q.jsx)(cf,{className:`gh-portal-loadingicon`}):i>0?(0,q.jsx)(Bd,{string:K(`Start {amount}-day free trial`),mapping:{amount:i}}):K(r>1?`Choose`:`Continue`)}function Oh({product:e,products:t,selectedInterval:n,handleChooseSignup:r,error:i}){let{selectedProduct:a,setSelectedProduct:o}=(0,_.useContext)(bh),{action:s}=(0,_.useContext)(J),c=e.trial_days,l=a===e.id?`gh-portal-product-card checked`:`gh-portal-product-card`,u=t?.filter(e=>e.type===`paid`)?.length,d=!![`signup:running`,`checkoutPlan:running`].includes(s);xl()&&(d=!0);let f=e.description;return(!e.benefits||!e.benefits.length)&&!f&&(f=`Full access`),(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:l,onClick:t=>{t.stopPropagation(),o(e.id)},"data-test-tier":`paid`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:e.name}),(0,q.jsx)(Th,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:f}),(0,q.jsx)(Sh,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-product`,children:[(0,q.jsx)(`button`,{"data-test-button":`select-tier`,disabled:d,className:`gh-portal-btn`,onClick:i=>{r(i,Nh({products:t,selectedInterval:n,selectedProduct:e.id}).id)},children:(0,q.jsx)(Dh,{selectedProduct:a,product:e,disabled:d,noOfProducts:u,trialDays:c})}),i&&(0,q.jsx)(`div`,{className:`gh-portal-error-message`,children:i})]})]})]},e.id)})}function kh({product:e,products:t,selectedInterval:n,errors:r}){let i=Nh({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&r&&r[i.id]?r[i.id]:null}function Ah({products:e,selectedInterval:t,handleChooseSignup:n,errors:r}){return e.map(i=>{let a=kh({product:i,products:e,selectedInterval:t,errors:r});return i.id===`free`?(0,q.jsx)(Eh,{products:e,handleChooseSignup:n,error:a},i.id):(0,q.jsx)(Oh,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:a},i.id)})}function jh({discount:e}){let{site:t}=(0,_.useContext)(J),{portal_plans:n}=t;return e===0||!n.includes(`monthly`)?null:iu({site:t})?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`span`,{className:`gh-portal-discount-label-trial`,children:K(`{discount}% discount`,{discount:e})})}):(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`span`,{className:`gh-portal-discount-label`,children:K(`{discount}% discount`,{discount:e})})})}function Mh({selectedInterval:e,setSelectedInterval:t,products:n}){let{site:r}=(0,_.useContext)(J),{portal_plans:i}=r,a=n.filter(e=>e.type!==`free`).map(e=>vh(e.monthlyPrice?.amount,e.yearlyPrice?.amount)),o=Math.max(...a);return!i.includes(`monthly`)||!i.includes(`yearly`)?null:(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-products-pricetoggle`+(e===`month`?` left`:``),children:[(0,q.jsx)(`button`,{"data-test-button":`switch-monthly`,"data-testid":`monthly-switch`,className:`gh-portal-btn`+(e===`month`?` active`:``),onClick:()=>{t(`month`)},children:K(`Monthly`)}),(0,q.jsxs)(`button`,{"data-test-button":`switch-yearly`,"data-testid":`yearly-switch`,className:`gh-portal-btn`+(e===`year`?` active`:``),onClick:()=>{t(`year`)},children:[K(`Yearly`),o>0&&(0,q.jsx)(`span`,{className:`gh-portal-maximum-discount`,children:K(`(save {highestYearlyDiscount}%)`,{highestYearlyDiscount:o})})]})]})})}function Nh({products:e,selectedProduct:t,selectedInterval:n}){let r=null;if(t===`free`)r={id:`free`};else{let i=e.find(e=>e.id===t);i||=e.find(e=>e.type===`paid`),r=n===`month`?i?.monthlyPrice:i?.yearlyPrice}return r}function Ph({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:r,errors:i}){let{site:a,member:o}=(0,_.useContext)(J),{portal_plans:s,portal_default_plan:c}=a,l=t.length>0?t[0].id:`free`,[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(l),m=Nh({products:t,selectedInterval:u,selectedProduct:f}),h=Xu({portalPlans:s,portalDefaultPlan:c,selectedInterval:u}),g=wl({member:o}),v=hu({site:a});if((0,_.useEffect)(()=>{p(l)},[l]),(0,_.useEffect)(()=>{e(null,m.id)},[m.id,e]),t.length===0)return g?(0,q.jsx)(`p`,{style:{textAlign:`center`},children:K(`Please contact {supportAddress} to adjust your complimentary subscription.`,{supportAddress:Ou({site:a})})}):null;let y=`gh-portal-products`;n===`upgrade`&&(y+=` gh-portal-upgrade-product`);let b=t.find(e=>e.id===f)?.id||t.find(e=>e.type===`paid`)?.id;return(0,q.jsx)(bh.Provider,{value:{selectedInterval:h,selectedProduct:b,setSelectedProduct:p},children:(0,q.jsxs)(`section`,{className:y,children:[v?``:(0,q.jsx)(Mh,{products:t,selectedInterval:h,setSelectedInterval:d}),(0,q.jsx)(`div`,{className:`gh-portal-products-grid`,children:(0,q.jsx)(Ah,{products:t,selectedInterval:h,handleChooseSignup:r,errors:i})})]})})}function Fh({onPlanSelect:e,selectedPlan:t,products:n,type:r=null}){let{site:i,member:a}=(0,_.useContext)(J),{portal_plans:o}=i,s=Pl({member:a}),c=yu({site:i,priceId:s.id}),l=Xu({portalPlans:o,selectedInterval:s.interval}),u=c?.id||n?.[0]?.id,[d,f]=(0,_.useState)(l),[p,m]=(0,_.useState)(u),h=Xu({portalPlans:o,selectedInterval:d});if((0,_.useEffect)(()=>{m(u)},[u]),!o.includes(`monthly`)&&!o.includes(`yearly`)||n.length===0)return null;let g=`gh-portal-products`;return r===`upgrade`&&(g+=` gh-portal-upgrade-product`),r===`changePlan`&&(g+=` gh-portal-upgrade-product gh-portal-change-plan`),(0,q.jsx)(bh.Provider,{value:{selectedInterval:h,selectedProduct:p,selectedPlan:t,setSelectedProduct:m},children:(0,q.jsxs)(`section`,{className:g,children:[(0,q.jsx)(Mh,{selectedInterval:h,setSelectedInterval:f,products:n}),(0,q.jsx)(`div`,{className:`gh-portal-products-grid`,children:(0,q.jsx)(Rh,{products:n,onPlanSelect:e})})]})})}function Ih({product:e}){return e?.description?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,"data-testid":`product-description`,children:e.description}):null}function Lh({product:e,onPlanSelect:t}){let{member:n,site:r}=(0,_.useContext)(J),{selectedProduct:i,setSelectedProduct:a,selectedInterval:o}=(0,_.useContext)(bh),s=i===e.id?`gh-portal-product-card checked`:`gh-portal-product-card`,c=e.monthlyPrice,l=e.yearlyPrice,u=Pl({member:n}),d=o===`month`?c:l,f=Il({member:n,site:r,priceId:d.id});return(0,q.jsxs)(`div`,{className:s+(f?` disabled`:``),onClick:t=>{t.stopPropagation(),a(e.id)},"data-test-tier":`paid`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsx)(`h4`,{className:`gh-portal-product-name`,children:e.name}),(0,q.jsx)(Th,{product:e})]}),(0,q.jsxs)(`div`,{className:`gh-portal-product-card-details`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[e.description?(0,q.jsx)(Ih,{product:e,selectedPrice:d,activePrice:u}):``,(0,q.jsx)(Sh,{product:e})]}),f?(0,q.jsx)(`div`,{className:`gh-portal-btn-product`,children:(0,q.jsx)(`span`,{className:`gh-portal-current-plan`,children:(0,q.jsx)(`span`,{children:K(`Current plan`)})})}):(0,q.jsx)(`div`,{className:`gh-portal-btn-product`,children:(0,q.jsx)(`button`,{"data-test-button":`select-tier`,className:`gh-portal-btn`,onClick:()=>{t(null,d?.id)},children:K(`Choose`)})})]})]},e.id)}function Rh({products:e,onPlanSelect:t}){return e.map(e=>!e||e.id===`free`?null:(0,q.jsx)(Lh,{product:e,onPlanSelect:t},e.id))}function zh({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r,changePlan:i=!1}){return xl()&&(n=()=>{}),i?(0,q.jsx)(`section`,{className:`gh-portal-plans`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(Fh,{type:`changePlan`,products:e,selectedPlan:t,onPlanSelect:n})})}):(0,q.jsx)(`section`,{className:`gh-portal-plans`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(Ph,{type:`upgrade`,products:e,onPlanSelect:n,handleChooseSignup:(...e)=>{r(...e)}})})})}var Bh=`
|
|
1843
1843
|
.account-plan.full-size .gh-portal-main-title {
|
|
1844
1844
|
font-size: 3.2rem;
|
|
1845
1845
|
margin-top: 44px;
|
|
@@ -1892,7 +1892,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1892
1892
|
.gh-portal-retention-offer .gh-portal-offer-details > .footnote:first-child {
|
|
1893
1893
|
margin-top: 12px;
|
|
1894
1894
|
}
|
|
1895
|
-
`;function Bh({confirmationType:e,pendingOffer:t}){if(e===`changePlan`)return K(`Confirm subscription`);if(e===`cancel`)return K(`Cancel subscription`);if(e===`subscribe`)return K(`Subscribe`);if(e===`offerRetention`)return t?.display_title||K(`Before you go`)}var Vh=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{let{member:r}=(0,_.useContext)(J),i=Tl({member:r})?K(`Change plan`):K(`Choose a plan`);return e&&(i=Bh({confirmationType:t,pendingOffer:n})),(0,q.jsx)(`header`,{className:`gh-portal-detail-header`,children:(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:i})})},Hh=({member:e,onCancelSubscription:t,action:n,brandColor:r})=>{if(!e.paid||El({member:e}))return null;let i=Cl({member:e});if(!i||i.cancel_at_period_end)return null;let a=K(`Cancel subscription`),o=[`cancelSubscription:running`].includes(n);return(0,q.jsx)(`div`,{className:`gh-portal-expire-container`,children:(0,q.jsx)(df,{dataTestId:`cancel-subscription`,onClick:()=>{t({subscriptionId:i.id,cancelAtPeriodEnd:!0})},isRunning:o,disabled:!!o,isPrimary:!!i.cancel_at_period_end,isDestructive:!i.cancelAtPeriodEnd,classes:`gh-portal-btn-text mt2 mb4`,brandColor:r,label:a,style:{width:`100%`}})})},Uh=[],Wh=({plan:e,type:t,onConfirm:n})=>{let{site:r,action:i,member:a,brandColor:o,fieldErrors:s}=(0,_.useContext)(J),[c,l]=(0,_.useState)(``),u=Pl({member:a}),d=yu({site:r,priceId:e?.id}),f=dh(d?.id!==yu({site:r,priceId:u?.id})?.id&&d?.requirements||Uh,a?.metafields),p=Cl({member:a}),m=[`updateSubscription:running`,`checkoutPlan:running`,`cancelSubscription:running`].includes(i),h=K(`Confirm`),g=K(`Starting {startDate}`,{startDate:ol(p.current_period_end)});u.id!==e.id&&(g=K(`Starting today`));let v=Pu(e.price),y=`${e.currency_symbol}${v}/${Zu(e.interval)} – ${g}`,b=d?.name;return t===`changePlan`?(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-list mb6`,children:[(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Account`)}),(0,q.jsx)(`p`,{children:a.email})]})}),(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:b}),(0,q.jsx)(`p`,{children:y})]})})]}),f.inputs.length>0&&(0,q.jsx)(`div`,{className:`gh-portal-section mb6`,children:(0,q.jsx)(hh,{asked:f,errors:s||{}})}),(0,q.jsx)(df,{dataTestId:`confirm-action`,onClick:e=>n(e,{answers:mh(f),asked:f.inputs}),disabled:!ph(f),isRunning:m,isPrimary:!0,brandColor:o,label:h,style:{width:`100%`,height:`40px`}})]}):(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container gh-portal-cancellation-form`,children:[(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you cancel your subscription now, you will continue to have access until {periodEnd}.`),mapping:{periodEnd:(0,q.jsx)(`strong`,{children:ol(p.current_period_end)})}})}),(0,q.jsxs)(`section`,{className:`gh-portal-input-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,children:K(`Cancellation reason`)})}),(0,q.jsx)(`textarea`,{"data-test-input":`cancellation-reason`,className:`gh-portal-input`,label:`Cancellation reason`,type:`text`,name:`cancellation_reason`,placeholder:``,value:c,onChange:e=>l(e.target.value),rows:`2`,maxLength:`500`},`cancellation_reason`)]}),(0,q.jsx)(df,{dataTestId:`confirm-cancel-subscription`,onClick:e=>n(e,c),isRunning:m,isPrimary:!0,brandColor:o,label:K(`Confirm cancellation`),style:{width:`100%`,height:`40px`}})]})},Gh=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:r})=>{let{member:i,action:a,brandColor:o}=(0,_.useContext)(J);return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section gh-portal-accountplans-main`,children:(0,q.jsx)(Kh,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),(0,q.jsx)(Hh,{member:i,onCancelSubscription:r,action:a,brandColor:o})]})};function Kh({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:r=!1}){let{site:i,member:a}=(0,_.useContext)(J),o=jl({site:i,member:a}),s=wl({member:a}),c=Fl({member:a,site:i});return(0,q.jsx)(Rh,{products:o.length>0||s||!c?o:[c],selectedPlan:e,changePlan:r,onPlanSelect:t,onPlanCheckout:n})}function qh(e,t){if(_u(e)){let t=e.duration_in_months;return t===1?K(`1 month free`):K(`{months} months free`,{months:t})}return K(`{amount} off`,{amount:t})}function Jh(e,t,n,r,i){if(_u(e)){let t=e.duration_in_months,n=Ju(i.current_period_end,t),r=n?n.toLocaleDateString(`en-GB`,{year:`numeric`,month:`short`,day:`numeric`,timeZone:`UTC`}):null;return r?t===1?K(`Enjoy a free month on us. You won't be charged until {newBillingDate}.`,{newBillingDate:r}):K(`Enjoy {months} free months on us. You won't be charged until {newBillingDate}.`,{months:t,newBillingDate:r}):t===1?K(`Enjoy a free month on us.`):K(`Enjoy {months} free months on us.`,{months:t})}return e.duration===`forever`?K(`Enjoy {amountOff} off forever.`,{amountOff:r}):e.duration===`once`||e.duration===`repeating`&&e.duration_in_months===1?K(`Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.`,{amountOff:r,currency:n,originalPrice:t,cadence:Zu(e.cadence)}):e.duration===`repeating`&&e.duration_in_months>1?K(`Save {amountOff} on your next {durationInMonths} billing cycles. Then {currency}{originalPrice}/{cadence}.`,{amountOff:r,durationInMonths:e.duration_in_months,currency:n,originalPrice:t,cadence:Zu(e.cadence)}):``}var Yh=({subscription:e,offer:t,onAcceptOffer:n,onDeclineOffer:r})=>{let{brandColor:i,action:a}=(0,_.useContext)(J),o=a===`applyOffer:running`,s=Nl({subscription:e}),c=Fu(s.amount/100),l=ju(s.currency),u=Fu(Bu({offer:t,price:s})),d=zu({offer:t}),f=t.cadence===`month`?K(`Monthly`):K(`Yearly`),p=f,m=e.tier;m&&m.name&&(p=`${m.name} - ${f}`);let h=t.display_description||K(`We'd hate to see you leave. How about a special offer to stay?`),g=qh(t,d),v=Jh(t,c,l,d,e);return(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer`,children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:h}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-bar`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-offer-title`,children:[(0,q.jsx)(`h4`,{children:p}),(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,children:g})]}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-details`,children:[!_u(t)&&(0,q.jsxs)(`div`,{className:`gh-portal-retention-offer-price`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`,children:l}),(0,q.jsx)(`span`,{className:`amount`,children:u})]}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-oldprice`,children:[l,c]})]}),(0,q.jsx)(`p`,{className:`footnote`,children:v})]}),(0,q.jsx)(df,{dataTestId:`accept-retention-offer`,onClick:n,isRunning:o,disabled:o,isPrimary:!0,brandColor:i,label:K(`Continue subscription`),style:{width:`100%`,height:`40px`,marginTop:`20px`}})]}),(0,q.jsx)(df,{dataTestId:`decline-retention-offer`,onClick:r,isPrimary:!1,isDestructive:!0,classes:`gh-portal-btn-text`,brandColor:i,label:K(`No thanks, I want to cancel`),style:{width:`100%`,marginTop:`32px`,marginBottom:`24px`}})]})},Xh=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r})=>{let{member:i}=(0,_.useContext)(J),a=``;return e.length===1&&(a=`singleplan`),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section gh-portal-accountplans-main ${a}`,children:(0,q.jsx)(Kh,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r})}),!Tl({member:i})&&(0,q.jsx)(Pf,{className:`gh-portal-signup-message`,lastPage:`accountPlan`})]})},Zh=()=>(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-no-plans-available-notification`,"data-testid":`no-plans-available-notification-text`,children:K(`Sorry, no paid plans are available.`)})})}),Qh=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:r,showConfirmation:i=!1,pendingOffer:a,onPlanSelect:o,onPlanCheckout:s,onConfirm:c,onCancelSubscription:l,onAcceptRetentionOffer:u,onDeclineRetentionOffer:d})=>{let{member:f}=(0,_.useContext)(J);if(!Tl({member:f})||wl({member:f})||El({member:f}))return e.length===0?(0,q.jsx)(Zh,{}):(0,q.jsx)(Xh,{plans:e,selectedPlan:t,onPlanSelect:o,onPlanCheckout:s});if(!i)return(0,q.jsx)(Gh,{plans:e,selectedPlan:t,onCancelSubscription:l,onPlanSelect:o});if(r===`offerRetention`&&a){let e=Cl({member:f});if(e)return(0,q.jsx)(Yh,{subscription:e,offer:a,onAcceptOffer:u,onDeclineOffer:d})}return(0,q.jsx)(Wh,{plan:n,type:r,onConfirm:c},n?.id)},$h=class extends _.Component{static contextType=J;constructor(e,t){super(e,t),this.state=this.getInitialState()}componentDidMount(){let{member:e,site:t}=this.context;if(!e){this.context.doAction(`switchPage`,{page:`signin`});return}if(El({member:e})&&!Al({member:e,site:t})){this.context.doAction(`switchPage`,{page:`accountHome`});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(e){return e?[e.id,e.display_title||``,e.display_description||``,e.type||``,e.cadence||``,e.amount||0,e.duration||``,e.duration_in_months||0,e.currency||``,e.status||``,e.tier?.id||``].join(`|`):``}handleCancelActionFromPageData(){let{member:e,pageData:t,offers:n}=this.context;if(!e||t?.action!==`cancel`||!t?.subscriptionId)return;let r=(n||[]).find(e=>e.redemption_type===`retention`)||null,i=this.getRetentionOfferSignature(r),a=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==t.subscriptionId||this.state.confirmationType!==`offerRetention`||i!==a)&&this.onCancelSubscription({subscriptionId:t.subscriptionId}),t.action=null}getInitialState(){let{member:e,site:t}=this.context;this.prices=xu({site:t});let n=Pl({member:e});n?.id&&(this.prices=Ml({prices:this.prices,currency:n.currency}));let r=n?this.prices.find(e=>e.id===n.id):null;return!Tl({member:e})&&this.prices.length>0&&(r=this.prices[0]),{selectedPlan:r?r.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.lastPage===`accountPlan`?this.context.doAction(`switchPage`,{page:`accountHome`}):this.context.doAction(`back`)}cancelConfirmPage(){this.context.doAction(`clearFieldErrors`),this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(e,t,n){let{doAction:r,member:i}=this.context,{confirmationPlan:a,selectedPlan:o}=this.state;if(t&&(o=t),Tl({member:i})&&!wl({member:i})&&!El({member:i})){let e=Cl({member:i}),t=e?e.id:``;t&&r(`updateSubscription`,{plan:a.name,planId:a.id,subscriptionId:t,cancelAtPeriodEnd:!1,answers:n?.answers,asked:n?.asked})}else r(`checkoutPlan`,{plan:o})}onPlanSelect=(e,t)=>{e?.preventDefault();let{member:n}=this.context;if(!Tl({member:n})||wl({member:n})||El({member:n}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:t}))},5);else{let e=this.prices.find(e=>e.id===t),r=this.getActivePriceId({member:n})?`changePlan`:`subscribe`;t!==this.state.selectedPlan&&this.setState({confirmationPlan:e,confirmationType:r,showConfirmation:!0})}};onCancelSubscription({subscriptionId:e}){let{member:t,offers:n}=this.context,r=Ll({subscriptionId:e,member:t});if(!r)return;let i=Nl({subscription:r}),a=(n||[]).filter(e=>e.redemption_type===`retention`);a.length>0?this.setState({showConfirmation:!0,confirmationPlan:i,confirmationType:`offerRetention`,pendingOffer:a[0],targetSubscriptionId:e}):this.setState({showConfirmation:!0,confirmationPlan:i,confirmationType:`cancel`,pendingOffer:null,targetSubscriptionId:e})}onAcceptRetentionOffer(){let{pendingOffer:e,targetSubscriptionId:t}=this.state;!t||!e||this.context.doAction(`applyOffer`,{subscriptionId:t,offerId:e.id})}onDeclineRetentionOffer(){this.setState({confirmationType:`cancel`,pendingOffer:null})}onCancelSubscriptionConfirmation(e){let{targetSubscriptionId:t}=this.state;if(!t)return null;this.context.doAction(`cancelSubscription`,{subscriptionId:t,cancelAtPeriodEnd:!0,cancellationReason:e})}getActivePriceId({member:e}){let t=Pl({member:e});return t?t.id:null}onConfirm(e,t){let{confirmationType:n}=this.state;if(n===`cancel`)return this.onCancelSubscriptionConfirmation(t);if([`changePlan`,`subscribe`].includes(n))return this.onPlanCheckout(e,null,t)}render(){let e=this.prices,{selectedPlan:t,showConfirmation:n,confirmationPlan:r,confirmationType:i,pendingOffer:a}=this.state,{lastPage:o}=this.context;return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content`,children:[(0,q.jsx)(mf,{onClick:e=>this.onBack(e),hidden:!o&&!n}),(0,q.jsx)(vf,{}),(0,q.jsx)(Vh,{onBack:e=>this.onBack(e),confirmationType:i,pendingOffer:a,showConfirmation:n}),(0,q.jsx)(Qh,{plans:e,selectedPlan:t,showConfirmation:n,confirmationPlan:r,confirmationType:i,pendingOffer:a,onConfirm:(...e)=>this.onConfirm(...e),onCancelSubscription:e=>this.onCancelSubscription(e),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(e,t)=>this.onPlanCheckout(e,t)})]})})}},eg=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[(0,q.jsx)(`path`,{d:`M8 2v4`}),(0,q.jsx)(`path`,{d:`M16 2v4`}),(0,q.jsx)(`rect`,{width:18,height:18,x:3,y:4,rx:2}),(0,q.jsx)(`path`,{d:`M3 10h18`})]});function tg(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var ng={},rg={};function ig(e,t){try{let n=(ng[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in rg?rg[n]:og(n,n.split(`:`))}catch{if(e in rg)return rg[e];let t=e?.match(ag);return t?og(e,t.slice(1)):NaN}}var ag=/([+-]\d\d):?(\d\d)?/;function og(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return rg[e]=n*60+r>0?n*60+r+i:n*60-r-i}var sg=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ig(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),dg(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-ig(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),lg(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},cg=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!cg.test(e))return;let t=e.replace(cg,`$1UTC`);sg.prototype[t]&&(e.startsWith(`get`)?sg.prototype[e]=function(){return this.internal[t]()}:(sg.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),ug(this),+this},sg.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lg(this),+this}))});function lg(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ig(e.timeZone,e)*60))}function ug(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),dg(e)}function dg(e,t){let n=Array.isArray(t)?fg(t):+e.internal,r=ig(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=ig(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(ig(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=ig(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h,_=h!==i,v=g-u,y=h-i,b=n-h*60*1e3,x=y>0&&pg(e)-n===y*60*1e3&&pg(e,b)!==n;if(_&&v&&!x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v);let t=ig(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&v<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}lg(e);let S=(t?n:n+p*1e3)-+e.internal;S&&Math.abs(S)<1800*1e3&&(Date.prototype.setTime.call(e,+e+S),lg(e))}function fg(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function pg(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-ig(e.timeZone,n)*60)),+n}var mg=class e extends sg{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${tg(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},hg=365.2425,gg=6048e5,_g=864e5,vg=3600*24;vg*7,vg*hg/12*3;var yg=Symbol.for(`constructDateFrom`);function bg(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&yg in e?e[yg](t):e instanceof Date?new e.constructor(t):new Date(t)}function X(e,t){return bg(t||e,e)}function xg(e,t,n){let r=X(e,n?.in);return isNaN(t)?bg(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Sg(e,t,n){let r=X(e,n?.in);if(isNaN(t))return bg(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=bg(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var Cg={};function wg(){return Cg}function Tg(e,t){let n=wg(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=X(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Eg(e,t){return Tg(e,{...t,weekStartsOn:1})}function Dg(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=bg(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Eg(i),o=bg(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Eg(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Og(e){let t=X(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function kg(e,...t){let n=bg.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Ag(e,t){let n=X(e,t?.in);return n.setHours(0,0,0,0),n}function jg(e,t,n){let[r,i]=kg(n?.in,e,t),a=Ag(r),o=Ag(i),s=+a-Og(a),c=+o-Og(o);return Math.round((s-c)/_g)}function Mg(e,t){let n=Dg(e,t),r=bg(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Eg(r)}function Ng(e,t,n){return xg(e,t*7,n)}function Pg(e,t,n){return Sg(e,t*12,n)}function Fg(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=bg.bind(null,e));let t=X(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),bg(r,n||NaN)}function Ig(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=bg.bind(null,e));let t=X(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),bg(r,n||NaN)}function Lg(e,t,n){let[r,i]=kg(n?.in,e,t);return+Ag(r)==+Ag(i)}function Rg(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function zg(e){return!(!Rg(e)&&typeof e!=`number`||isNaN(+X(e)))}function Bg(e,t,n){let[r,i]=kg(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Vg(e,t){let n=X(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Hg(e,t){let[n,r]=kg(e,t.start,t.end);return{start:n,end:r}}function Ug(e,t){let{start:n,end:r}=Hg(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(bg(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Wg(e,t){let n=X(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Gg(e,t){let n=X(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Kg(e,t){let n=X(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qg(e,t){let{start:n,end:r}=Hg(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(bg(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Jg(e,t){let n=wg(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=X(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Yg(e,t){return Jg(e,{...t,weekStartsOn:1})}var Xg={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Zg=(e,t,n)=>{let r,i=Xg[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Qg(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var $g={date:Qg({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Qg({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Qg({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},e_={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},t_=(e,t,n,r)=>e_[e];function n_(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var r_={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:n_({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:n_({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:n_({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:n_({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:n_({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function i_(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?o_(s,e=>e.test(o)):a_(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function a_(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function o_(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function s_(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var c_={code:`en-US`,formatDistance:Zg,formatLong:$g,formatRelative:t_,localize:r_,match:{ordinalNumber:s_({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:i_({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:i_({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:i_({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:i_({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:i_({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function l_(e,t){let n=X(e,t?.in);return jg(n,Kg(n))+1}function u_(e,t){let n=X(e,t?.in),r=Eg(n)-+Mg(n);return Math.round(r/gg)+1}function d_(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=wg(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=bg(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Tg(o,t),c=bg(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Tg(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function f_(e,t){let n=wg(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=d_(e,t),a=bg(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Tg(a,t)}function p_(e,t){let n=X(e,t?.in),r=Tg(n,t)-+f_(n,t);return Math.round(r/gg)+1}function Z(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var m_={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Z(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Z(n+1,2)},d(e,t){return Z(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Z(e.getHours()%12||12,t.length)},H(e,t){return Z(e.getHours(),t.length)},m(e,t){return Z(e.getMinutes(),t.length)},s(e,t){return Z(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Z(Math.trunc(r*10**(n-3)),t.length)}},h_={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},g_={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return m_.y(e,t)},Y:function(e,t,n,r){let i=d_(e,r),a=i>0?i:1-i;return t===`YY`?Z(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Z(a,t.length)},R:function(e,t){return Z(Dg(e),t.length)},u:function(e,t){return Z(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Z(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Z(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return m_.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Z(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=p_(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Z(i,t.length)},I:function(e,t,n){let r=u_(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Z(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):m_.d(e,t)},D:function(e,t,n){let r=l_(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Z(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Z(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Z(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Z(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?h_.noon:r===0?h_.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?h_.evening:r>=12?h_.afternoon:r>=4?h_.morning:h_.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return m_.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):m_.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):m_.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):m_.s(e,t)},S:function(e,t){return m_.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return v_(r);case`XXXX`:case`XX`:return y_(r);default:return y_(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return v_(r);case`xxxx`:case`xx`:return y_(r);default:return y_(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+__(r,`:`);default:return`GMT`+y_(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+__(r,`:`);default:return`GMT`+y_(r,`:`)}},t:function(e,t,n){return Z(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Z(+e,t.length)}};function __(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Z(a,2)}function v_(e,t){return e%60==0?(e>0?`-`:`+`)+Z(Math.abs(e)/60,2):y_(e,t)}function y_(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Z(Math.trunc(r/60),2),a=Z(r%60,2);return n+i+t+a}var b_=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},x_=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},S_={p:x_,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return b_(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,b_(r,t)).replace(`{{time}}`,x_(i,t))}},C_=/^D+$/,w_=/^Y+$/,T_=[`D`,`DD`,`YY`,`YYYY`];function E_(e){return C_.test(e)}function D_(e){return w_.test(e)}function O_(e,t,n){let r=k_(e,t,n);if(console.warn(r),T_.includes(e))throw RangeError(r)}function k_(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var A_=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,j_=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,M_=/^'([^]*?)'?$/,N_=/''/g,P_=/[a-zA-Z]/;function F_(e,t,n){let r=wg(),i=n?.locale??r.locale??c_,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=X(e,n?.in);if(!zg(s))throw RangeError(`Invalid time value`);let c=t.match(j_).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=S_[t];return n(e,i.formatLong)}return e}).join(``).match(A_).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:I_(e)};if(g_[t])return{isToken:!0,value:e};if(t.match(P_))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&D_(a)||!n?.useAdditionalDayOfYearTokens&&E_(a))&&O_(a,t,String(e));let o=g_[a[0]];return o(s,a,i.localize,l)}).join(``)}function I_(e){let t=e.match(M_);return t?t[1].replace(N_,`'`):e}function L_(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=bg(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function R_(e,t){return X(e,t?.in).getMonth()}function z_(e,t){return X(e,t?.in).getFullYear()}function B_(e,t){return+X(e)>+X(t)}function V_(e,t){return+X(e)<+X(t)}function H_(e,t,n){let[r,i]=kg(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function U_(e,t,n){let[r,i]=kg(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function W_(e,t,n){let r=X(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=bg(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=L_(o);return r.setMonth(t,Math.min(a,s)),r}function G_(e,t,n){let r=X(e,n?.in);return isNaN(+r)?bg(n?.in||e,NaN):(r.setFullYear(t),r)}var K_=5,q_=4;function J_(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,K_*7-1);return t.getMonth(e)===t.getMonth(a)?K_:q_}function Y_(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function X_(e,t){let n=Y_(e,t),r=J_(e,t);return t.addDays(n,r*7-1)}var Z_={...c_,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>F_(e,t,{locale:c_,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>F_(e,n,{locale:c_,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>F_(e,t,{locale:c_,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>F_(e,n,{locale:c_,...t}),r(e,`cccc`)}}},Q_=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?mg.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new mg(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):xg(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Sg(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Ng(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Pg(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):jg(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Bg(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Ug(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):qg(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):X_(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):Yg(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Vg(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Jg(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Gg(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):F_(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):u_(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):R_(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):z_(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):p_(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):B_(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):V_(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):Rg(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Lg(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):H_(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):U_(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Fg(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Ig(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):W_(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):G_(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Y_(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):Ag(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Eg(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Wg(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Tg(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Kg(e),this.options={locale:Z_,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};Q_.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var $_=new Q_,ev=class{constructor(e,t,n=$_){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},tv=class{constructor(e,t){this.date=e,this.weeks=t}},nv=class{constructor(e,t){this.days=t,this.weekNumber=e}};function rv(e){return _.createElement(`button`,{...e})}function iv(e){return _.createElement(`span`,{...e})}function av(e){let{size:t=24,orientation:n=`left`,className:r}=e;return _.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&_.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&_.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&_.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&_.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function ov(e){let{day:t,modifiers:n,...r}=e;return _.createElement(`td`,{...r})}function sv(e){let{day:t,modifiers:n,...r}=e,i=_.useRef(null);return _.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),_.createElement(`button`,{ref:i,...r})}var Q;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(Q||={});var cv;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(cv||={});var lv;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(lv||={});var uv;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(uv||={});function dv(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[Q.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return _.createElement(`span`,{"data-disabled":a.disabled,className:i[Q.DropdownRoot]},_.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>_.createElement(r.Option,{key:e,value:e,disabled:n},t))),_.createElement(`span`,{className:i[Q.CaptionLabel],"aria-hidden":!0},s?.label,_.createElement(r.Chevron,{orientation:`down`,size:18,className:i[Q.Chevron]})))}function fv(e){return _.createElement(`div`,{...e})}function pv(e){return _.createElement(`div`,{...e})}function mv(e){let{calendarMonth:t,displayIndex:n,...r}=e;return _.createElement(`div`,{...r},e.children)}function hv(e){let{calendarMonth:t,displayIndex:n,...r}=e;return _.createElement(`div`,{...r})}function gv(e){return _.createElement(`table`,{...e})}function _v(e){return _.createElement(`div`,{...e})}var vv=(0,_.createContext)(void 0);function yv(){let e=(0,_.useContext)(vv);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function bv(e){let{components:t}=yv();return _.createElement(t.Dropdown,{...e})}function xv(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=yv(),u=(0,_.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,_.useCallback)(e=>{r&&t?.(e)},[r,t]);return _.createElement(`nav`,{...a},_.createElement(o.PreviousMonthButton,{type:`button`,className:s[Q.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":!r||void 0,"aria-label":c(r),onClick:d},_.createElement(o.Chevron,{disabled:!r||void 0,className:s[Q.Chevron],orientation:`left`})),_.createElement(o.NextMonthButton,{type:`button`,className:s[Q.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":!i||void 0,"aria-label":l(i),onClick:u},_.createElement(o.Chevron,{disabled:!i||void 0,orientation:`right`,className:s[Q.Chevron]})))}function Sv(e){let{components:t}=yv();return _.createElement(t.Button,{...e})}function Cv(e){return _.createElement(`option`,{...e})}function wv(e){let{components:t}=yv();return _.createElement(t.Button,{...e})}function Tv(e){let{rootRef:t,...n}=e;return _.createElement(`div`,{...n,ref:t})}function Ev(e){return _.createElement(`select`,{...e})}function Dv(e){let{week:t,...n}=e;return _.createElement(`tr`,{...n})}function Ov(e){return _.createElement(`th`,{...e})}function kv(e){return _.createElement(`thead`,{"aria-hidden":!0},_.createElement(`tr`,{...e}))}function Av(e){let{week:t,...n}=e;return _.createElement(`th`,{...n})}function jv(e){return _.createElement(`th`,{...e})}function Mv(e){return _.createElement(`tbody`,{...e})}function Nv(e){let{components:t}=yv();return _.createElement(t.Dropdown,{...e})}var Pv=s({Button:()=>rv,CaptionLabel:()=>iv,Chevron:()=>av,Day:()=>ov,DayButton:()=>sv,Dropdown:()=>dv,DropdownNav:()=>fv,Footer:()=>pv,Month:()=>mv,MonthCaption:()=>hv,MonthGrid:()=>gv,Months:()=>_v,MonthsDropdown:()=>bv,Nav:()=>xv,NextMonthButton:()=>Sv,Option:()=>Cv,PreviousMonthButton:()=>wv,Root:()=>Tv,Select:()=>Ev,Week:()=>Dv,WeekNumber:()=>Av,WeekNumberHeader:()=>jv,Weekday:()=>Ov,Weekdays:()=>kv,Weeks:()=>Mv,YearsDropdown:()=>Nv});function Fv(e,t,n=!1,r=$_){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function Iv(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Lv(e){return!!(e&&typeof e==`object`&&`from`in e)}function Rv(e){return!!(e&&typeof e==`object`&&`after`in e)}function zv(e){return!!(e&&typeof e==`object`&&`before`in e)}function Bv(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Vv(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Hv(e,t,n=$_){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(Vv(t,n))return t.some(t=>i(e,t));if(Lv(t))return Fv(t,e,!1,n);if(Bv(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Iv(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return Rv(t)?a(e,t.after)>0:zv(t)?a(t.before,e)>0:typeof t==`function`&&t(e)})}function Uv(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[cv.focused]:[],[cv.outside]:[],[cv.disabled]:[],[cv.hidden]:[],[cv.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Hv(e,a,i)),S=!!(o&&Hv(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Hv(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[cv.focused]:!1,[cv.disabled]:!1,[cv.hidden]:!1,[cv.outside]:!1,[cv.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Wv(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[cv[r]]?e.push(t[cv[r]]):t[lv[r]]&&e.push(t[lv[r]]),e),[t[Q.Day]])}function Gv(e){return{...Pv,...e}}function Kv(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function qv(){let e={};for(let t in Q)e[Q[t]]=`rdp-${Q[t]}`;for(let t in cv)e[cv[t]]=`rdp-${cv[t]}`;for(let t in lv)e[lv[t]]=`rdp-${lv[t]}`;for(let t in uv)e[uv[t]]=`rdp-${uv[t]}`;return e}function Jv(e,t,n){return(n??new Q_(t)).formatMonthYear(e)}var Yv=Jv;function Xv(e,t,n){return(n??new Q_(t)).format(e,`d`)}function Zv(e,t=$_){return t.format(e,`LLLL`)}function Qv(e,t,n){return(n??new Q_(t)).format(e,`cccccc`)}function $v(e,t=$_){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function ey(){return``}function ty(e,t=$_){return t.format(e,`yyyy`)}var ny=ty,ry=s({formatCaption:()=>Jv,formatDay:()=>Xv,formatMonthCaption:()=>Yv,formatMonthDropdown:()=>Zv,formatWeekNumber:()=>$v,formatWeekNumberHeader:()=>ey,formatWeekdayName:()=>Qv,formatYearCaption:()=>ny,formatYearDropdown:()=>ty});function iy(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...ry,...e}}function ay(e,t,n,r){let i=(r??new Q_(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var oy=ay;function sy(e,t,n){return(n??new Q_(t)).formatMonthYear(e)}var cy=sy;function ly(e,t,n,r){let i=(r??new Q_(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function uy(e){return`Choose the Month`}function dy(){return``}var fy=`Go to the Next Month`;function py(e,t){return fy}function my(e){return`Go to the Previous Month`}function hy(e,t,n){return(n??new Q_(t)).format(e,`cccc`)}function gy(e,t){return`Week ${e}`}function _y(e){return`Week Number`}function vy(e){return`Choose the Year`}var yy=s({labelCaption:()=>cy,labelDay:()=>oy,labelDayButton:()=>ay,labelGrid:()=>sy,labelGridcell:()=>ly,labelMonthDropdown:()=>uy,labelNav:()=>dy,labelNext:()=>py,labelPrevious:()=>my,labelWeekNumber:()=>gy,labelWeekNumberHeader:()=>_y,labelWeekday:()=>hy,labelYearDropdown:()=>vy}),by=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function xy(e,t){let n=t.locale?.labels??{};return{...yy,...e??{},labelDayButton:by(ay,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:by(uy,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:by(py,e?.labelNext,n.labelNext),labelPrevious:by(my,e?.labelPrevious,n.labelPrevious),labelWeekNumber:by(gy,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:by(vy,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:by(sy,e?.labelGrid,n.labelGrid),labelGridcell:by(ly,e?.labelGridcell,n.labelGridcell),labelNav:by(dy,e?.labelNav,n.labelNav),labelWeekNumberHeader:by(_y,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:by(hy,e?.labelWeekday,n.labelWeekday)}}function Sy(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function Cy(e,t={},n={}){let r={...t?.[Q.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function wy(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function Ty(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function Ey(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new mg(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(mg.tz(e)),newDate:(t,n,r)=>new mg(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new mg(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new mg(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new mg(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new mg(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>p_(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>u_(o(e)),differenceInCalendarDays:(e,t)=>jg(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Bg(o(e),o(t))}}var Dy=e=>e instanceof HTMLElement?e:null,Oy=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],ky=e=>Dy(e.querySelector(`[data-animated-month]`)),Ay=e=>Dy(e.querySelector(`[data-animated-caption]`)),jy=e=>Dy(e.querySelector(`[data-animated-weeks]`)),My=e=>Dy(e.querySelector(`[data-animated-nav]`)),Ny=e=>Dy(e.querySelector(`[data-animated-weekdays]`));function Py(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(r),c=(0,_.useRef)(!1);(0,_.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[uv.caption_after_enter]:n[uv.caption_before_enter],p=d?n[uv.weeks_after_enter]:n[uv.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(Oy(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=ky(e);t&&e.contains(t)&&e.removeChild(t);let n=Ay(e);n&&n.classList.remove(f);let r=jy(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?Oy(m):[],_=Oy(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=My(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=Ay(i);s&&s.classList.add(f);let l=jy(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=Ny(o);m&&(m.style.opacity=`0`);let h=Ay(o);h&&(h.classList.add(d?n[uv.caption_before_exit]:n[uv.caption_after_exit]),h.addEventListener(`animationend`,u));let _=jy(o);_&&_.classList.add(d?n[uv.weeks_before_exit]:n[uv.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function Fy(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function Iy(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function Ly(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function Ry(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function zy(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new tv(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new ev(t,m,r);return a?a.days.push(o):e.push(new nv(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function By(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function Vy(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function Hy(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function Uy(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function Wy(e,t){let[n,r]=(0,_.useState)(e);return[t===void 0?n:t,r]}function Gy(e,t){let[n,r]=By(e,t),{startOfMonth:i,endOfMonth:a}=t,o=Ry(e,n,r,t),[s,c]=Wy(o,e.month?o:void 0);(0,_.useEffect)(()=>{let i=Ry(e,n,r,t);c(i)},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,_.useMemo)(()=>{let i=Ly(s,r,{numberOfMonths:e.numberOfMonths},t),o=zy(i,Fy(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:Uy(o),days:Iy(o),previousMonth:Hy(s,n,e,t),nextMonth:Vy(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),v=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:v,goToDay:e=>{g(e)||v(e.date)}}}var Ky;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(Ky||={});function qy(e){return!e[cv.disabled]&&!e[cv.hidden]&&!e[cv.outside]}function Jy(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);qy(e)&&(e[cv.focused]&&a<Ky.FocusedModifier?(i=o,a=Ky.FocusedModifier):r?.isEqualTo(o)&&a<Ky.LastFocused?(i=o,a=Ky.LastFocused):n(o.date)&&a<Ky.Selected?(i=o,a=Ky.Selected):e[cv.today]&&a<Ky.Today&&(i=o,a=Ky.Today))}return i||=e.find(e=>qy(t(e))),i}function Yy(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function Xy(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=Yy(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Hv(c,a.disabled,o)),u=!!(a.hidden&&Hv(c,a.hidden,o)),d=new ev(c,c,o);return!l&&!u?d:Xy(e,t,d,r,i,a,o,s+1)}function Zy(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,_.useState)(),c=Jy(t.days,n,r||(()=>!1),o),[l,u]=(0,_.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=Xy(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function Qy(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Wy(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function $y(e,t,n=0,r=0,i=!1,a=$_){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function eb(e,t,n=$_){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function tb(e,t,n=$_){return Fv(e,t.from,!1,n)||Fv(e,t.to,!1,n)||Fv(t,e.from,!1,n)||Fv(t,e.to,!1,n)}function nb(e,t,n=$_){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Fv(e,t,!1,n):Vv(t,n)?t.some(t=>Fv(e,t,!1,n)):Lv(t)?t.from&&t.to?tb(e,{from:t.from,to:t.to},n):!1:Bv(t)?eb(e,t.dayOfWeek,n):Iv(t)?n.isAfter(t.before,t.after)?tb(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Hv(e.from,t,n)||Hv(e.to,t,n):Rv(t)||zv(t)?Hv(e.from,t,n)||Hv(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function rb(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=Wy(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:$y(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&nb({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Fv(u,e,!1,t)}}function ib(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Wy(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function ab(e,t){let n=ib(e,t),r=Qy(e,t),i=rb(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function ob(e,t){return e instanceof mg&&e.timeZone===t?e:new mg(e,t)}function sb(e,t,n){if(!n)return ob(e,t);let r=ob(e,t),i=new mg(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function cb(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?sb(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?sb(e,t,n):e):Lv(e)?{...e,from:e.from?ob(e.from,t):e.from,to:e.to?ob(e.to,t):e.to}:Iv(e)?{before:sb(e.before,t,n),after:sb(e.after,t,n)}:Rv(e)?{after:sb(e.after,t,n)}:zv(e)?{before:sb(e.before,t,n)}:e}function lb(e,t,n){return e&&(Array.isArray(e)?e.map(e=>cb(e,t,n)):cb(e,t,n))}function ub(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=ob(t.today,n),t.month&&=ob(t.month,n),t.defaultMonth&&=ob(t.defaultMonth,n),t.startMonth&&=ob(t.startMonth,n),t.endMonth&&=ob(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=ob(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>ob(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?ob(t.selected.from,n):t.selected.from,to:t.selected.to?ob(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=lb(t.disabled,n)),t.hidden!==void 0&&(t.hidden=lb(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=lb(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,_.useMemo)(()=>{let e={...Z_,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?Ey(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Q_({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Gv(t.components),formatters:iy(t.formatters),labels:xy(t.labels,a.options),locale:e,classNames:{...qv(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:v,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:k,formatYearDropdown:ee}=i,A=Gy(t,o),{days:te,months:j,navStart:ne,navEnd:re,previousMonth:M,nextMonth:N,goToMonth:ie}=A,ae=Uv(te,t,ne,re,o),{isSelected:oe,select:se,selected:P}=ab(t,o)??{},{blur:ce,focused:le,isFocusTarget:ue,moveFocus:de,setFocused:F}=Zy(t,A,ae,oe??(()=>!1),o),{labelDayButton:fe,labelGridcell:pe,labelGrid:me,labelMonthDropdown:he,labelNav:I,labelPrevious:ge,labelNext:L,labelWeekday:_e,labelWeekNumber:ve,labelWeekNumberHeader:ye,labelYearDropdown:be}=a,xe=(0,_.useMemo)(()=>wy(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Se=u!==void 0||m!==void 0,Ce=(0,_.useCallback)(()=>{M&&(ie(M),x?.(M))},[M,ie,x]),R=(0,_.useCallback)(()=>{N&&(ie(N),b?.(N))},[ie,N,b]),we=(0,_.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),F(e),!t.disabled&&(se?.(e.date,t,n),m?.(e.date,t,n))},[se,m,F]),Te=(0,_.useCallback)((e,t)=>n=>{F(e),h?.(e.date,t,n)},[h,F]),Ee=(0,_.useCallback)((e,t)=>n=>{ce(),p?.(e.date,t,n)},[ce,p]),De=(0,_.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];de(e,t)}g?.(e.date,n,r)},[de,g,t.dir]),Oe=(0,_.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),ke=(0,_.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Ae=(0,_.useCallback)(e=>t=>{let n=Number(t.target.value),r=o.setMonth(o.startOfMonth(e),n);ie(r)},[o,ie]),je=(0,_.useCallback)(e=>t=>{let n=Number(t.target.value),r=o.setYear(o.startOfMonth(e),n);ie(r)},[o,ie]),{className:Me,style:Ne}=(0,_.useMemo)(()=>({className:[c[Q.Root],t.className].filter(Boolean).join(` `),style:{...C?.[Q.Root],...t.style}}),[c,t.className,t.style,C]),Pe=Kv(t),Fe=(0,_.useRef)(null);Py(Fe,!!t.animate,{classNames:c,months:j,focused:le,dateLib:o});let Ie={dayPickerProps:t,selected:P,select:se,isSelected:oe,months:j,nextMonth:N,previousMonth:M,goToMonth:ie,getModifiers:ae,components:r,classNames:c,styles:C,labels:a,formatters:i};return _.createElement(vv.Provider,{value:Ie},_.createElement(r.Root,{rootRef:t.animate?Fe:void 0,className:Me,style:Ne,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Pe},_.createElement(r.Months,{className:c[Q.Months],style:C?.[Q.Months]},!t.hideNavigation&&!d&&_.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[Q.Nav],style:C?.[Q.Nav],"aria-label":I(),onPreviousClick:Ce,onNextClick:R,previousMonth:M,nextMonth:N}),j.map((e,n)=>_.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[Q.Month],style:C?.[Q.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&_.createElement(r.PreviousMonthButton,{type:`button`,className:c[Q.PreviousMonthButton],tabIndex:M?void 0:-1,"aria-disabled":!M||void 0,"aria-label":ge(M),onClick:Ce,"data-animated-button":t.animate?`true`:void 0},_.createElement(r.Chevron,{disabled:!M||void 0,className:c[Q.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),_.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[Q.MonthCaption],style:C?.[Q.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?_.createElement(r.DropdownNav,{className:c[Q.Dropdowns],style:C?.[Q.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?_.createElement(r.MonthsDropdown,{key:`month`,className:c[Q.MonthsDropdown],"aria-label":he(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ae(e.date),options:Sy(e.date,ne,re,i,o),style:C?.[Q.Dropdown],value:o.getMonth(e.date)}):_.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?_.createElement(r.YearsDropdown,{key:`year`,className:c[Q.YearsDropdown],"aria-label":be(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:je(e.date),options:Ty(ne,re,i,o,!!t.reverseYears),style:C?.[Q.Dropdown],value:o.getYear(e.date)}):_.createElement(`span`,{key:`year`},ee(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),_.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):_.createElement(r.CaptionLabel,{className:c[Q.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&_.createElement(r.NextMonthButton,{type:`button`,className:c[Q.NextMonthButton],tabIndex:N?void 0:-1,"aria-disabled":!N||void 0,"aria-label":L(N),onClick:R,"data-animated-button":t.animate?`true`:void 0},_.createElement(r.Chevron,{disabled:!N||void 0,className:c[Q.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&_.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[Q.Nav],style:C?.[Q.Nav],"aria-label":I(),onPreviousClick:Ce,onNextClick:R,previousMonth:M,nextMonth:N}),_.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":me(e.date,o.options,o)||void 0,className:c[Q.MonthGrid],style:C?.[Q.MonthGrid]},!t.hideWeekdays&&_.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[Q.Weekdays],style:C?.[Q.Weekdays]},S&&_.createElement(r.WeekNumberHeader,{"aria-label":ye(o.options),className:c[Q.WeekNumberHeader],style:C?.[Q.WeekNumberHeader],scope:`col`},O()),xe.map(e=>_.createElement(r.Weekday,{"aria-label":_e(e,o.options,o),className:c[Q.Weekday],key:String(e),style:C?.[Q.Weekday],scope:`col`},k(e,o.options,o)))),_.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[Q.Weeks],style:C?.[Q.Weeks]},e.weeks.map(e=>_.createElement(r.Week,{className:c[Q.Week],key:e.weekNumber,style:C?.[Q.Week],week:e},S&&_.createElement(r.WeekNumber,{week:e,style:C?.[Q.WeekNumber],"aria-label":ve(e.weekNumber,{locale:s}),className:c[Q.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ae(e);if(i[cv.focused]=!i.hidden&&!!le?.isEqualTo(e),i[lv.selected]=oe?.(n)||i.selected,Lv(P)){let{from:e,to:t}=P;i[lv.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[lv.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[lv.range_middle]=Fv(P,n,!0,o)}let a=Cy(i,C,t.modifiersStyles),s=Wv(i,c,t.modifiersClassNames),l=!Se&&!i.hidden?pe(n,i,o.options,o):void 0;return _.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&Se?_.createElement(r.DayButton,{className:c[Q.DayButton],style:C?.[Q.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:ue(e)?0:-1,"aria-label":fe(n,i,o.options,o),onClick:we(e,i),onBlur:Ee(e,i),onFocus:Te(e,i),onKeyDown:De(e,i),onMouseEnter:Oe(e,i),onMouseLeave:ke(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&_.createElement(r.Footer,{className:c[Q.Footer],style:C?.[Q.Footer],role:`status`,"aria-live":`polite`},t.footer)))}var db=`
|
|
1895
|
+
`;function Vh({confirmationType:e,pendingOffer:t}){if(e===`changePlan`)return K(`Confirm subscription`);if(e===`cancel`)return K(`Cancel subscription`);if(e===`subscribe`)return K(`Subscribe`);if(e===`offerRetention`)return t?.display_title||K(`Before you go`)}var Hh=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{let{member:r}=(0,_.useContext)(J),i=Tl({member:r})?K(`Change plan`):K(`Choose a plan`);return e&&(i=Vh({confirmationType:t,pendingOffer:n})),(0,q.jsx)(`header`,{className:`gh-portal-detail-header`,children:(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:i})})},Uh=({member:e,onCancelSubscription:t,action:n,brandColor:r})=>{if(!e.paid||El({member:e}))return null;let i=Cl({member:e});if(!i||i.cancel_at_period_end)return null;let a=K(`Cancel subscription`),o=[`cancelSubscription:running`].includes(n);return(0,q.jsx)(`div`,{className:`gh-portal-expire-container`,children:(0,q.jsx)(df,{dataTestId:`cancel-subscription`,onClick:()=>{t({subscriptionId:i.id,cancelAtPeriodEnd:!0})},isRunning:o,disabled:!!o,isPrimary:!!i.cancel_at_period_end,isDestructive:!i.cancelAtPeriodEnd,classes:`gh-portal-btn-text mt2 mb4`,brandColor:r,label:a,style:{width:`100%`}})})},Wh=[],Gh=({plan:e,type:t,onConfirm:n})=>{let{site:r,action:i,member:a,brandColor:o,fieldErrors:s}=(0,_.useContext)(J),[c,l]=(0,_.useState)(``),u=Pl({member:a}),d=yu({site:r,priceId:e?.id}),f=fh(d?.id!==yu({site:r,priceId:u?.id})?.id&&d?.requirements||Wh,a?.metafields),p=Cl({member:a}),m=[`updateSubscription:running`,`checkoutPlan:running`,`cancelSubscription:running`].includes(i),h=K(`Confirm`),g=K(`Starting {startDate}`,{startDate:ol(p.current_period_end)});u.id!==e.id&&(g=K(`Starting today`));let v=Pu(e.price),y=`${e.currency_symbol}${v}/${Zu(e.interval)} – ${g}`,b=d?.name;return t===`changePlan`?(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-list mb6`,children:[(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Account`)}),(0,q.jsx)(`p`,{children:a.email})]})}),(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:b}),(0,q.jsx)(`p`,{children:y})]})})]}),f.inputs.length>0&&(0,q.jsx)(`div`,{className:`gh-portal-section mb6`,children:(0,q.jsx)(gh,{asked:f,errors:s||{}})}),(0,q.jsx)(df,{dataTestId:`confirm-action`,onClick:e=>n(e,{answers:hh(f),asked:f.inputs}),disabled:!mh(f),isRunning:m,isPrimary:!0,brandColor:o,label:h,style:{width:`100%`,height:`40px`}})]}):(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container gh-portal-cancellation-form`,children:[(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you cancel your subscription now, you will continue to have access until {periodEnd}.`),mapping:{periodEnd:(0,q.jsx)(`strong`,{children:ol(p.current_period_end)})}})}),(0,q.jsxs)(`section`,{className:`gh-portal-input-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,children:K(`Cancellation reason`)})}),(0,q.jsx)(`textarea`,{"data-test-input":`cancellation-reason`,className:`gh-portal-input`,label:`Cancellation reason`,type:`text`,name:`cancellation_reason`,placeholder:``,value:c,onChange:e=>l(e.target.value),rows:`2`,maxLength:`500`},`cancellation_reason`)]}),(0,q.jsx)(df,{dataTestId:`confirm-cancel-subscription`,onClick:e=>n(e,c),isRunning:m,isPrimary:!0,brandColor:o,label:K(`Confirm cancellation`),style:{width:`100%`,height:`40px`}})]})},Kh=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:r})=>{let{member:i,action:a,brandColor:o}=(0,_.useContext)(J);return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section gh-portal-accountplans-main`,children:(0,q.jsx)(qh,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),(0,q.jsx)(Uh,{member:i,onCancelSubscription:r,action:a,brandColor:o})]})};function qh({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:r=!1}){let{site:i,member:a}=(0,_.useContext)(J),o=jl({site:i,member:a}),s=wl({member:a}),c=Fl({member:a,site:i});return(0,q.jsx)(zh,{products:o.length>0||s||!c?o:[c],selectedPlan:e,changePlan:r,onPlanSelect:t,onPlanCheckout:n})}function Jh(e,t){if(_u(e)){let t=e.duration_in_months;return t===1?K(`1 month free`):K(`{months} months free`,{months:t})}return K(`{amount} off`,{amount:t})}function Yh(e,t,n,r,i){if(_u(e)){let t=e.duration_in_months,n=Ju(i.current_period_end,t),r=n?n.toLocaleDateString(`en-GB`,{year:`numeric`,month:`short`,day:`numeric`,timeZone:`UTC`}):null;return r?t===1?K(`Enjoy a free month on us. You won't be charged until {newBillingDate}.`,{newBillingDate:r}):K(`Enjoy {months} free months on us. You won't be charged until {newBillingDate}.`,{months:t,newBillingDate:r}):t===1?K(`Enjoy a free month on us.`):K(`Enjoy {months} free months on us.`,{months:t})}return e.duration===`forever`?K(`Enjoy {amountOff} off forever.`,{amountOff:r}):e.duration===`once`||e.duration===`repeating`&&e.duration_in_months===1?K(`Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.`,{amountOff:r,currency:n,originalPrice:t,cadence:Zu(e.cadence)}):e.duration===`repeating`&&e.duration_in_months>1?K(`Save {amountOff} on your next {durationInMonths} billing cycles. Then {currency}{originalPrice}/{cadence}.`,{amountOff:r,durationInMonths:e.duration_in_months,currency:n,originalPrice:t,cadence:Zu(e.cadence)}):``}var Xh=({subscription:e,offer:t,onAcceptOffer:n,onDeclineOffer:r})=>{let{brandColor:i,action:a}=(0,_.useContext)(J),o=a===`applyOffer:running`,s=Nl({subscription:e}),c=Fu(s.amount/100),l=ju(s.currency),u=Fu(Bu({offer:t,price:s})),d=zu({offer:t}),f=t.cadence===`month`?K(`Monthly`):K(`Yearly`),p=f,m=e.tier;m&&m.name&&(p=`${m.name} - ${f}`);let h=t.display_description||K(`We'd hate to see you leave. How about a special offer to stay?`),g=Jh(t,d),v=Yh(t,c,l,d,e);return(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer`,children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:h}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-bar`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-offer-title`,children:[(0,q.jsx)(`h4`,{children:p}),(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,children:g})]}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-details`,children:[!_u(t)&&(0,q.jsxs)(`div`,{className:`gh-portal-retention-offer-price`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign`,children:l}),(0,q.jsx)(`span`,{className:`amount`,children:u})]}),(0,q.jsxs)(`div`,{className:`gh-portal-offer-oldprice`,children:[l,c]})]}),(0,q.jsx)(`p`,{className:`footnote`,children:v})]}),(0,q.jsx)(df,{dataTestId:`accept-retention-offer`,onClick:n,isRunning:o,disabled:o,isPrimary:!0,brandColor:i,label:K(`Continue subscription`),style:{width:`100%`,height:`40px`,marginTop:`20px`}})]}),(0,q.jsx)(df,{dataTestId:`decline-retention-offer`,onClick:r,isPrimary:!1,isDestructive:!0,classes:`gh-portal-btn-text`,brandColor:i,label:K(`No thanks, I want to cancel`),style:{width:`100%`,marginTop:`32px`,marginBottom:`24px`}})]})},Zh=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r})=>{let{member:i}=(0,_.useContext)(J),a=``;return e.length===1&&(a=`singleplan`),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section gh-portal-accountplans-main ${a}`,children:(0,q.jsx)(qh,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:r})}),!Tl({member:i})&&(0,q.jsx)(Pf,{className:`gh-portal-signup-message`,lastPage:`accountPlan`})]})},Qh=()=>(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-no-plans-available-notification`,"data-testid":`no-plans-available-notification-text`,children:K(`Sorry, no paid plans are available.`)})})}),$h=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:r,showConfirmation:i=!1,pendingOffer:a,onPlanSelect:o,onPlanCheckout:s,onConfirm:c,onCancelSubscription:l,onAcceptRetentionOffer:u,onDeclineRetentionOffer:d})=>{let{member:f}=(0,_.useContext)(J);if(!Tl({member:f})||wl({member:f})||El({member:f}))return e.length===0?(0,q.jsx)(Qh,{}):(0,q.jsx)(Zh,{plans:e,selectedPlan:t,onPlanSelect:o,onPlanCheckout:s});if(!i)return(0,q.jsx)(Kh,{plans:e,selectedPlan:t,onCancelSubscription:l,onPlanSelect:o});if(r===`offerRetention`&&a){let e=Cl({member:f});if(e)return(0,q.jsx)(Xh,{subscription:e,offer:a,onAcceptOffer:u,onDeclineOffer:d})}return(0,q.jsx)(Gh,{plan:n,type:r,onConfirm:c},n?.id)},eg=class extends _.Component{static contextType=J;constructor(e,t){super(e,t),this.state=this.getInitialState()}componentDidMount(){let{member:e,site:t}=this.context;if(!e){this.context.doAction(`switchPage`,{page:`signin`});return}if(El({member:e})&&!Al({member:e,site:t})){this.context.doAction(`switchPage`,{page:`accountHome`});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(e){return e?[e.id,e.display_title||``,e.display_description||``,e.type||``,e.cadence||``,e.amount||0,e.duration||``,e.duration_in_months||0,e.currency||``,e.status||``,e.tier?.id||``].join(`|`):``}handleCancelActionFromPageData(){let{member:e,pageData:t,offers:n}=this.context;if(!e||t?.action!==`cancel`||!t?.subscriptionId)return;let r=(n||[]).find(e=>e.redemption_type===`retention`)||null,i=this.getRetentionOfferSignature(r),a=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==t.subscriptionId||this.state.confirmationType!==`offerRetention`||i!==a)&&this.onCancelSubscription({subscriptionId:t.subscriptionId}),t.action=null}getInitialState(){let{member:e,site:t}=this.context;this.prices=xu({site:t});let n=Pl({member:e});n?.id&&(this.prices=Ml({prices:this.prices,currency:n.currency}));let r=n?this.prices.find(e=>e.id===n.id):null;return!Tl({member:e})&&this.prices.length>0&&(r=this.prices[0]),{selectedPlan:r?r.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.lastPage===`accountPlan`?this.context.doAction(`switchPage`,{page:`accountHome`}):this.context.doAction(`back`)}cancelConfirmPage(){this.context.doAction(`clearFieldErrors`),this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(e,t,n){let{doAction:r,member:i}=this.context,{confirmationPlan:a,selectedPlan:o}=this.state;if(t&&(o=t),Tl({member:i})&&!wl({member:i})&&!El({member:i})){let e=Cl({member:i}),t=e?e.id:``;t&&r(`updateSubscription`,{plan:a.name,planId:a.id,subscriptionId:t,cancelAtPeriodEnd:!1,answers:n?.answers,asked:n?.asked})}else r(`checkoutPlan`,{plan:o})}onPlanSelect=(e,t)=>{e?.preventDefault();let{member:n}=this.context;if(!Tl({member:n})||wl({member:n})||El({member:n}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:t}))},5);else{let e=this.prices.find(e=>e.id===t),r=this.getActivePriceId({member:n})?`changePlan`:`subscribe`;t!==this.state.selectedPlan&&this.setState({confirmationPlan:e,confirmationType:r,showConfirmation:!0})}};onCancelSubscription({subscriptionId:e}){let{member:t,offers:n}=this.context,r=Ll({subscriptionId:e,member:t});if(!r)return;let i=Nl({subscription:r}),a=(n||[]).filter(e=>e.redemption_type===`retention`);a.length>0?this.setState({showConfirmation:!0,confirmationPlan:i,confirmationType:`offerRetention`,pendingOffer:a[0],targetSubscriptionId:e}):this.setState({showConfirmation:!0,confirmationPlan:i,confirmationType:`cancel`,pendingOffer:null,targetSubscriptionId:e})}onAcceptRetentionOffer(){let{pendingOffer:e,targetSubscriptionId:t}=this.state;!t||!e||this.context.doAction(`applyOffer`,{subscriptionId:t,offerId:e.id})}onDeclineRetentionOffer(){this.setState({confirmationType:`cancel`,pendingOffer:null})}onCancelSubscriptionConfirmation(e){let{targetSubscriptionId:t}=this.state;if(!t)return null;this.context.doAction(`cancelSubscription`,{subscriptionId:t,cancelAtPeriodEnd:!0,cancellationReason:e})}getActivePriceId({member:e}){let t=Pl({member:e});return t?t.id:null}onConfirm(e,t){let{confirmationType:n}=this.state;if(n===`cancel`)return this.onCancelSubscriptionConfirmation(t);if([`changePlan`,`subscribe`].includes(n))return this.onPlanCheckout(e,null,t)}render(){let e=this.prices,{selectedPlan:t,showConfirmation:n,confirmationPlan:r,confirmationType:i,pendingOffer:a}=this.state,{lastPage:o}=this.context;return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content`,children:[(0,q.jsx)(mf,{onClick:e=>this.onBack(e),hidden:!o&&!n}),(0,q.jsx)(vf,{}),(0,q.jsx)(Hh,{onBack:e=>this.onBack(e),confirmationType:i,pendingOffer:a,showConfirmation:n}),(0,q.jsx)($h,{plans:e,selectedPlan:t,showConfirmation:n,confirmationPlan:r,confirmationType:i,pendingOffer:a,onConfirm:(...e)=>this.onConfirm(...e),onCancelSubscription:e=>this.onCancelSubscription(e),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(e,t)=>this.onPlanCheckout(e,t)})]})})}},tg=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[(0,q.jsx)(`path`,{d:`M8 2v4`}),(0,q.jsx)(`path`,{d:`M16 2v4`}),(0,q.jsx)(`rect`,{width:18,height:18,x:3,y:4,rx:2}),(0,q.jsx)(`path`,{d:`M3 10h18`})]});function ng(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var rg={},ig={};function ag(e,t){try{let n=(rg[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in ig?ig[n]:sg(n,n.split(`:`))}catch{if(e in ig)return ig[e];let t=e?.match(og);return t?sg(e,t.slice(1)):NaN}}var og=/([+-]\d\d):?(\d\d)?/;function sg(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return ig[e]=n*60+r>0?n*60+r+i:n*60-r-i}var cg=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ag(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),fg(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-ag(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),ug(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},lg=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!lg.test(e))return;let t=e.replace(lg,`$1UTC`);cg.prototype[t]&&(e.startsWith(`get`)?cg.prototype[e]=function(){return this.internal[t]()}:(cg.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),dg(this),+this},cg.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),ug(this),+this}))});function ug(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ag(e.timeZone,e)*60))}function dg(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),fg(e)}function fg(e,t){let n=Array.isArray(t)?pg(t):+e.internal,r=ag(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=ag(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(ag(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=ag(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h,_=h!==i,v=g-u,y=h-i,b=n-h*60*1e3,x=y>0&&mg(e)-n===y*60*1e3&&mg(e,b)!==n;if(_&&v&&!x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v);let t=ag(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&v<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}ug(e);let S=(t?n:n+p*1e3)-+e.internal;S&&Math.abs(S)<1800*1e3&&(Date.prototype.setTime.call(e,+e+S),ug(e))}function pg(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function mg(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-ag(e.timeZone,n)*60)),+n}var hg=class e extends cg{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${ng(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},gg=365.2425,_g=6048e5,vg=864e5,yg=3600*24;yg*7,yg*gg/12*3;var bg=Symbol.for(`constructDateFrom`);function xg(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&bg in e?e[bg](t):e instanceof Date?new e.constructor(t):new Date(t)}function X(e,t){return xg(t||e,e)}function Sg(e,t,n){let r=X(e,n?.in);return isNaN(t)?xg(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Cg(e,t,n){let r=X(e,n?.in);if(isNaN(t))return xg(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=xg(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var wg={};function Tg(){return wg}function Eg(e,t){let n=Tg(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=X(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Dg(e,t){return Eg(e,{...t,weekStartsOn:1})}function Og(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=xg(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Dg(i),o=xg(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Dg(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function kg(e){let t=X(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Ag(e,...t){let n=xg.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function jg(e,t){let n=X(e,t?.in);return n.setHours(0,0,0,0),n}function Mg(e,t,n){let[r,i]=Ag(n?.in,e,t),a=jg(r),o=jg(i),s=+a-kg(a),c=+o-kg(o);return Math.round((s-c)/vg)}function Ng(e,t){let n=Og(e,t),r=xg(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Dg(r)}function Pg(e,t,n){return Sg(e,t*7,n)}function Fg(e,t,n){return Cg(e,t*12,n)}function Ig(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=xg.bind(null,e));let t=X(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),xg(r,n||NaN)}function Lg(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=xg.bind(null,e));let t=X(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),xg(r,n||NaN)}function Rg(e,t,n){let[r,i]=Ag(n?.in,e,t);return+jg(r)==+jg(i)}function zg(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Bg(e){return!(!zg(e)&&typeof e!=`number`||isNaN(+X(e)))}function Vg(e,t,n){let[r,i]=Ag(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Hg(e,t){let n=X(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Ug(e,t){let[n,r]=Ag(e,t.start,t.end);return{start:n,end:r}}function Wg(e,t){let{start:n,end:r}=Ug(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(xg(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Gg(e,t){let n=X(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kg(e,t){let n=X(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function qg(e,t){let n=X(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Jg(e,t){let{start:n,end:r}=Ug(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(xg(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Yg(e,t){let n=Tg(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=X(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Xg(e,t){return Yg(e,{...t,weekStartsOn:1})}var Zg={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Qg=(e,t,n)=>{let r,i=Zg[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function $g(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var e_={date:$g({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:$g({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:$g({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},t_={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},n_=(e,t,n,r)=>t_[e];function r_(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var i_={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:r_({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:r_({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:r_({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:r_({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:r_({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function a_(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?s_(s,e=>e.test(o)):o_(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function o_(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function s_(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function c_(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var l_={code:`en-US`,formatDistance:Qg,formatLong:e_,formatRelative:n_,localize:i_,match:{ordinalNumber:c_({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:a_({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:a_({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:a_({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:a_({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:a_({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function u_(e,t){let n=X(e,t?.in);return Mg(n,qg(n))+1}function d_(e,t){let n=X(e,t?.in),r=Dg(n)-+Ng(n);return Math.round(r/_g)+1}function f_(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=Tg(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=xg(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Eg(o,t),c=xg(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Eg(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function p_(e,t){let n=Tg(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=f_(e,t),a=xg(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Eg(a,t)}function m_(e,t){let n=X(e,t?.in),r=Eg(n,t)-+p_(n,t);return Math.round(r/_g)+1}function Z(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var h_={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Z(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Z(n+1,2)},d(e,t){return Z(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Z(e.getHours()%12||12,t.length)},H(e,t){return Z(e.getHours(),t.length)},m(e,t){return Z(e.getMinutes(),t.length)},s(e,t){return Z(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Z(Math.trunc(r*10**(n-3)),t.length)}},g_={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},__={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return h_.y(e,t)},Y:function(e,t,n,r){let i=f_(e,r),a=i>0?i:1-i;return t===`YY`?Z(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Z(a,t.length)},R:function(e,t){return Z(Og(e),t.length)},u:function(e,t){return Z(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Z(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Z(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return h_.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Z(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=m_(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Z(i,t.length)},I:function(e,t,n){let r=d_(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Z(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):h_.d(e,t)},D:function(e,t,n){let r=u_(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Z(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Z(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Z(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Z(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?g_.noon:r===0?g_.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?g_.evening:r>=12?g_.afternoon:r>=4?g_.morning:g_.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return h_.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):h_.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Z(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):h_.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):h_.s(e,t)},S:function(e,t){return h_.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return y_(r);case`XXXX`:case`XX`:return b_(r);default:return b_(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return y_(r);case`xxxx`:case`xx`:return b_(r);default:return b_(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+v_(r,`:`);default:return`GMT`+b_(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+v_(r,`:`);default:return`GMT`+b_(r,`:`)}},t:function(e,t,n){return Z(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Z(+e,t.length)}};function v_(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Z(a,2)}function y_(e,t){return e%60==0?(e>0?`-`:`+`)+Z(Math.abs(e)/60,2):b_(e,t)}function b_(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Z(Math.trunc(r/60),2),a=Z(r%60,2);return n+i+t+a}var x_=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},S_=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},C_={p:S_,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return x_(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,x_(r,t)).replace(`{{time}}`,S_(i,t))}},w_=/^D+$/,T_=/^Y+$/,E_=[`D`,`DD`,`YY`,`YYYY`];function D_(e){return w_.test(e)}function O_(e){return T_.test(e)}function k_(e,t,n){let r=A_(e,t,n);if(console.warn(r),E_.includes(e))throw RangeError(r)}function A_(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var j_=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,M_=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,N_=/^'([^]*?)'?$/,P_=/''/g,F_=/[a-zA-Z]/;function I_(e,t,n){let r=Tg(),i=n?.locale??r.locale??l_,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=X(e,n?.in);if(!Bg(s))throw RangeError(`Invalid time value`);let c=t.match(M_).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=C_[t];return n(e,i.formatLong)}return e}).join(``).match(j_).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:L_(e)};if(__[t])return{isToken:!0,value:e};if(t.match(F_))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&O_(a)||!n?.useAdditionalDayOfYearTokens&&D_(a))&&k_(a,t,String(e));let o=__[a[0]];return o(s,a,i.localize,l)}).join(``)}function L_(e){let t=e.match(N_);return t?t[1].replace(P_,`'`):e}function R_(e,t){let n=X(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=xg(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function z_(e,t){return X(e,t?.in).getMonth()}function B_(e,t){return X(e,t?.in).getFullYear()}function V_(e,t){return+X(e)>+X(t)}function H_(e,t){return+X(e)<+X(t)}function U_(e,t,n){let[r,i]=Ag(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function W_(e,t,n){let[r,i]=Ag(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function G_(e,t,n){let r=X(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=xg(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=R_(o);return r.setMonth(t,Math.min(a,s)),r}function K_(e,t,n){let r=X(e,n?.in);return isNaN(+r)?xg(n?.in||e,NaN):(r.setFullYear(t),r)}var q_=5,J_=4;function Y_(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,q_*7-1);return t.getMonth(e)===t.getMonth(a)?q_:J_}function X_(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Z_(e,t){let n=X_(e,t),r=Y_(e,t);return t.addDays(n,r*7-1)}var Q_={...l_,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>I_(e,t,{locale:l_,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>I_(e,n,{locale:l_,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>I_(e,t,{locale:l_,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>I_(e,n,{locale:l_,...t}),r(e,`cccc`)}}},$_=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?hg.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new hg(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):Sg(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Cg(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Pg(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Fg(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):Mg(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Vg(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Wg(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):Jg(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Z_(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):Xg(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Hg(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Yg(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Kg(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):I_(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):d_(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):z_(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):B_(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):m_(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):V_(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):H_(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):zg(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Rg(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):U_(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):W_(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Ig(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Lg(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):G_(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):K_(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):X_(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):jg(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Dg(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Gg(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Eg(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):qg(e),this.options={locale:Q_,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};$_.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var ev=new $_,tv=class{constructor(e,t,n=ev){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},nv=class{constructor(e,t){this.date=e,this.weeks=t}},rv=class{constructor(e,t){this.days=t,this.weekNumber=e}};function iv(e){return _.createElement(`button`,{...e})}function av(e){return _.createElement(`span`,{...e})}function ov(e){let{size:t=24,orientation:n=`left`,className:r}=e;return _.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&_.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&_.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&_.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&_.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function sv(e){let{day:t,modifiers:n,...r}=e;return _.createElement(`td`,{...r})}function cv(e){let{day:t,modifiers:n,...r}=e,i=_.useRef(null);return _.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),_.createElement(`button`,{ref:i,...r})}var Q;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(Q||={});var lv;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(lv||={});var uv;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(uv||={});var dv;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(dv||={});function fv(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[Q.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return _.createElement(`span`,{"data-disabled":a.disabled,className:i[Q.DropdownRoot]},_.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>_.createElement(r.Option,{key:e,value:e,disabled:n},t))),_.createElement(`span`,{className:i[Q.CaptionLabel],"aria-hidden":!0},s?.label,_.createElement(r.Chevron,{orientation:`down`,size:18,className:i[Q.Chevron]})))}function pv(e){return _.createElement(`div`,{...e})}function mv(e){return _.createElement(`div`,{...e})}function hv(e){let{calendarMonth:t,displayIndex:n,...r}=e;return _.createElement(`div`,{...r},e.children)}function gv(e){let{calendarMonth:t,displayIndex:n,...r}=e;return _.createElement(`div`,{...r})}function _v(e){return _.createElement(`table`,{...e})}function vv(e){return _.createElement(`div`,{...e})}var yv=(0,_.createContext)(void 0);function bv(){let e=(0,_.useContext)(yv);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function xv(e){let{components:t}=bv();return _.createElement(t.Dropdown,{...e})}function Sv(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=bv(),u=(0,_.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,_.useCallback)(e=>{r&&t?.(e)},[r,t]);return _.createElement(`nav`,{...a},_.createElement(o.PreviousMonthButton,{type:`button`,className:s[Q.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":!r||void 0,"aria-label":c(r),onClick:d},_.createElement(o.Chevron,{disabled:!r||void 0,className:s[Q.Chevron],orientation:`left`})),_.createElement(o.NextMonthButton,{type:`button`,className:s[Q.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":!i||void 0,"aria-label":l(i),onClick:u},_.createElement(o.Chevron,{disabled:!i||void 0,orientation:`right`,className:s[Q.Chevron]})))}function Cv(e){let{components:t}=bv();return _.createElement(t.Button,{...e})}function wv(e){return _.createElement(`option`,{...e})}function Tv(e){let{components:t}=bv();return _.createElement(t.Button,{...e})}function Ev(e){let{rootRef:t,...n}=e;return _.createElement(`div`,{...n,ref:t})}function Dv(e){return _.createElement(`select`,{...e})}function Ov(e){let{week:t,...n}=e;return _.createElement(`tr`,{...n})}function kv(e){return _.createElement(`th`,{...e})}function Av(e){return _.createElement(`thead`,{"aria-hidden":!0},_.createElement(`tr`,{...e}))}function jv(e){let{week:t,...n}=e;return _.createElement(`th`,{...n})}function Mv(e){return _.createElement(`th`,{...e})}function Nv(e){return _.createElement(`tbody`,{...e})}function Pv(e){let{components:t}=bv();return _.createElement(t.Dropdown,{...e})}var Fv=s({Button:()=>iv,CaptionLabel:()=>av,Chevron:()=>ov,Day:()=>sv,DayButton:()=>cv,Dropdown:()=>fv,DropdownNav:()=>pv,Footer:()=>mv,Month:()=>hv,MonthCaption:()=>gv,MonthGrid:()=>_v,Months:()=>vv,MonthsDropdown:()=>xv,Nav:()=>Sv,NextMonthButton:()=>Cv,Option:()=>wv,PreviousMonthButton:()=>Tv,Root:()=>Ev,Select:()=>Dv,Week:()=>Ov,WeekNumber:()=>jv,WeekNumberHeader:()=>Mv,Weekday:()=>kv,Weekdays:()=>Av,Weeks:()=>Nv,YearsDropdown:()=>Pv});function Iv(e,t,n=!1,r=ev){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function Lv(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Rv(e){return!!(e&&typeof e==`object`&&`from`in e)}function zv(e){return!!(e&&typeof e==`object`&&`after`in e)}function Bv(e){return!!(e&&typeof e==`object`&&`before`in e)}function Vv(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Hv(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Uv(e,t,n=ev){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(Hv(t,n))return t.some(t=>i(e,t));if(Rv(t))return Iv(t,e,!1,n);if(Vv(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Lv(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return zv(t)?a(e,t.after)>0:Bv(t)?a(t.before,e)>0:typeof t==`function`&&t(e)})}function Wv(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[lv.focused]:[],[lv.outside]:[],[lv.disabled]:[],[lv.hidden]:[],[lv.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Uv(e,a,i)),S=!!(o&&Uv(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Uv(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[lv.focused]:!1,[lv.disabled]:!1,[lv.hidden]:!1,[lv.outside]:!1,[lv.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Gv(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[lv[r]]?e.push(t[lv[r]]):t[uv[r]]&&e.push(t[uv[r]]),e),[t[Q.Day]])}function Kv(e){return{...Fv,...e}}function qv(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function Jv(){let e={};for(let t in Q)e[Q[t]]=`rdp-${Q[t]}`;for(let t in lv)e[lv[t]]=`rdp-${lv[t]}`;for(let t in uv)e[uv[t]]=`rdp-${uv[t]}`;for(let t in dv)e[dv[t]]=`rdp-${dv[t]}`;return e}function Yv(e,t,n){return(n??new $_(t)).formatMonthYear(e)}var Xv=Yv;function Zv(e,t,n){return(n??new $_(t)).format(e,`d`)}function Qv(e,t=ev){return t.format(e,`LLLL`)}function $v(e,t,n){return(n??new $_(t)).format(e,`cccccc`)}function ey(e,t=ev){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function ty(){return``}function ny(e,t=ev){return t.format(e,`yyyy`)}var ry=ny,iy=s({formatCaption:()=>Yv,formatDay:()=>Zv,formatMonthCaption:()=>Xv,formatMonthDropdown:()=>Qv,formatWeekNumber:()=>ey,formatWeekNumberHeader:()=>ty,formatWeekdayName:()=>$v,formatYearCaption:()=>ry,formatYearDropdown:()=>ny});function ay(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...iy,...e}}function oy(e,t,n,r){let i=(r??new $_(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var sy=oy;function cy(e,t,n){return(n??new $_(t)).formatMonthYear(e)}var ly=cy;function uy(e,t,n,r){let i=(r??new $_(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function dy(e){return`Choose the Month`}function fy(){return``}var py=`Go to the Next Month`;function my(e,t){return py}function hy(e){return`Go to the Previous Month`}function gy(e,t,n){return(n??new $_(t)).format(e,`cccc`)}function _y(e,t){return`Week ${e}`}function vy(e){return`Week Number`}function yy(e){return`Choose the Year`}var by=s({labelCaption:()=>ly,labelDay:()=>sy,labelDayButton:()=>oy,labelGrid:()=>cy,labelGridcell:()=>uy,labelMonthDropdown:()=>dy,labelNav:()=>fy,labelNext:()=>my,labelPrevious:()=>hy,labelWeekNumber:()=>_y,labelWeekNumberHeader:()=>vy,labelWeekday:()=>gy,labelYearDropdown:()=>yy}),xy=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function Sy(e,t){let n=t.locale?.labels??{};return{...by,...e??{},labelDayButton:xy(oy,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:xy(dy,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:xy(my,e?.labelNext,n.labelNext),labelPrevious:xy(hy,e?.labelPrevious,n.labelPrevious),labelWeekNumber:xy(_y,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:xy(yy,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:xy(cy,e?.labelGrid,n.labelGrid),labelGridcell:xy(uy,e?.labelGridcell,n.labelGridcell),labelNav:xy(fy,e?.labelNav,n.labelNav),labelWeekNumberHeader:xy(vy,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:xy(gy,e?.labelWeekday,n.labelWeekday)}}function Cy(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function wy(e,t={},n={}){let r={...t?.[Q.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function Ty(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function Ey(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function Dy(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new hg(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(hg.tz(e)),newDate:(t,n,r)=>new hg(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new hg(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new hg(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new hg(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new hg(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>m_(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>d_(o(e)),differenceInCalendarDays:(e,t)=>Mg(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Vg(o(e),o(t))}}var Oy=e=>e instanceof HTMLElement?e:null,ky=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],Ay=e=>Oy(e.querySelector(`[data-animated-month]`)),jy=e=>Oy(e.querySelector(`[data-animated-caption]`)),My=e=>Oy(e.querySelector(`[data-animated-weeks]`)),Ny=e=>Oy(e.querySelector(`[data-animated-nav]`)),Py=e=>Oy(e.querySelector(`[data-animated-weekdays]`));function Fy(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(r),c=(0,_.useRef)(!1);(0,_.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[dv.caption_after_enter]:n[dv.caption_before_enter],p=d?n[dv.weeks_after_enter]:n[dv.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(ky(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=Ay(e);t&&e.contains(t)&&e.removeChild(t);let n=jy(e);n&&n.classList.remove(f);let r=My(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?ky(m):[],_=ky(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=Ny(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=jy(i);s&&s.classList.add(f);let l=My(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=Py(o);m&&(m.style.opacity=`0`);let h=jy(o);h&&(h.classList.add(d?n[dv.caption_before_exit]:n[dv.caption_after_exit]),h.addEventListener(`animationend`,u));let _=My(o);_&&_.classList.add(d?n[dv.weeks_before_exit]:n[dv.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function Iy(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function Ly(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function Ry(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function zy(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function By(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new nv(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new tv(t,m,r);return a?a.days.push(o):e.push(new rv(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function Vy(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function Hy(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function Uy(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function Wy(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function Gy(e,t){let[n,r]=(0,_.useState)(e);return[t===void 0?n:t,r]}function Ky(e,t){let[n,r]=Vy(e,t),{startOfMonth:i,endOfMonth:a}=t,o=zy(e,n,r,t),[s,c]=Gy(o,e.month?o:void 0);(0,_.useEffect)(()=>{let i=zy(e,n,r,t);c(i)},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,_.useMemo)(()=>{let i=Ry(s,r,{numberOfMonths:e.numberOfMonths},t),o=By(i,Iy(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:Wy(o),days:Ly(o),previousMonth:Uy(s,n,e,t),nextMonth:Hy(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),v=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:v,goToDay:e=>{g(e)||v(e.date)}}}var qy;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(qy||={});function Jy(e){return!e[lv.disabled]&&!e[lv.hidden]&&!e[lv.outside]}function Yy(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);Jy(e)&&(e[lv.focused]&&a<qy.FocusedModifier?(i=o,a=qy.FocusedModifier):r?.isEqualTo(o)&&a<qy.LastFocused?(i=o,a=qy.LastFocused):n(o.date)&&a<qy.Selected?(i=o,a=qy.Selected):e[lv.today]&&a<qy.Today&&(i=o,a=qy.Today))}return i||=e.find(e=>Jy(t(e))),i}function Xy(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function Zy(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=Xy(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Uv(c,a.disabled,o)),u=!!(a.hidden&&Uv(c,a.hidden,o)),d=new tv(c,c,o);return!l&&!u?d:Zy(e,t,d,r,i,a,o,s+1)}function Qy(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,_.useState)(),c=Yy(t.days,n,r||(()=>!1),o),[l,u]=(0,_.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=Zy(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function $y(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Gy(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function eb(e,t,n=0,r=0,i=!1,a=ev){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function tb(e,t,n=ev){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function nb(e,t,n=ev){return Iv(e,t.from,!1,n)||Iv(e,t.to,!1,n)||Iv(t,e.from,!1,n)||Iv(t,e.to,!1,n)}function rb(e,t,n=ev){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Iv(e,t,!1,n):Hv(t,n)?t.some(t=>Iv(e,t,!1,n)):Rv(t)?t.from&&t.to?nb(e,{from:t.from,to:t.to},n):!1:Vv(t)?tb(e,t.dayOfWeek,n):Lv(t)?n.isAfter(t.before,t.after)?nb(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Uv(e.from,t,n)||Uv(e.to,t,n):zv(t)||Bv(t)?Uv(e.from,t,n)||Uv(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function ib(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=Gy(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:eb(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&rb({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Iv(u,e,!1,t)}}function ab(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Gy(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function ob(e,t){let n=ab(e,t),r=$y(e,t),i=ib(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function sb(e,t){return e instanceof hg&&e.timeZone===t?e:new hg(e,t)}function cb(e,t,n){if(!n)return sb(e,t);let r=sb(e,t),i=new hg(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function lb(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?cb(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?cb(e,t,n):e):Rv(e)?{...e,from:e.from?sb(e.from,t):e.from,to:e.to?sb(e.to,t):e.to}:Lv(e)?{before:cb(e.before,t,n),after:cb(e.after,t,n)}:zv(e)?{after:cb(e.after,t,n)}:Bv(e)?{before:cb(e.before,t,n)}:e}function ub(e,t,n){return e&&(Array.isArray(e)?e.map(e=>lb(e,t,n)):lb(e,t,n))}function db(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=sb(t.today,n),t.month&&=sb(t.month,n),t.defaultMonth&&=sb(t.defaultMonth,n),t.startMonth&&=sb(t.startMonth,n),t.endMonth&&=sb(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=sb(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>sb(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?sb(t.selected.from,n):t.selected.from,to:t.selected.to?sb(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=ub(t.disabled,n)),t.hidden!==void 0&&(t.hidden=ub(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=ub(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,_.useMemo)(()=>{let e={...Q_,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?Dy(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new $_({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Kv(t.components),formatters:ay(t.formatters),labels:Sy(t.labels,a.options),locale:e,classNames:{...Jv(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:v,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:D,formatWeekNumberHeader:O,formatWeekdayName:k,formatYearDropdown:ee}=i,A=Ky(t,o),{days:te,months:j,navStart:ne,navEnd:re,previousMonth:M,nextMonth:N,goToMonth:ie}=A,ae=Wv(te,t,ne,re,o),{isSelected:oe,select:se,selected:P}=ob(t,o)??{},{blur:ce,focused:le,isFocusTarget:ue,moveFocus:de,setFocused:F}=Qy(t,A,ae,oe??(()=>!1),o),{labelDayButton:fe,labelGridcell:pe,labelGrid:me,labelMonthDropdown:he,labelNav:I,labelPrevious:ge,labelNext:L,labelWeekday:_e,labelWeekNumber:ve,labelWeekNumberHeader:ye,labelYearDropdown:be}=a,xe=(0,_.useMemo)(()=>Ty(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Se=u!==void 0||m!==void 0,Ce=(0,_.useCallback)(()=>{M&&(ie(M),x?.(M))},[M,ie,x]),R=(0,_.useCallback)(()=>{N&&(ie(N),b?.(N))},[ie,N,b]),we=(0,_.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),F(e),!t.disabled&&(se?.(e.date,t,n),m?.(e.date,t,n))},[se,m,F]),Te=(0,_.useCallback)((e,t)=>n=>{F(e),h?.(e.date,t,n)},[h,F]),Ee=(0,_.useCallback)((e,t)=>n=>{ce(),p?.(e.date,t,n)},[ce,p]),De=(0,_.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];de(e,t)}g?.(e.date,n,r)},[de,g,t.dir]),Oe=(0,_.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),ke=(0,_.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Ae=(0,_.useCallback)(e=>t=>{let n=Number(t.target.value),r=o.setMonth(o.startOfMonth(e),n);ie(r)},[o,ie]),je=(0,_.useCallback)(e=>t=>{let n=Number(t.target.value),r=o.setYear(o.startOfMonth(e),n);ie(r)},[o,ie]),{className:Me,style:Ne}=(0,_.useMemo)(()=>({className:[c[Q.Root],t.className].filter(Boolean).join(` `),style:{...C?.[Q.Root],...t.style}}),[c,t.className,t.style,C]),Pe=qv(t),Fe=(0,_.useRef)(null);Fy(Fe,!!t.animate,{classNames:c,months:j,focused:le,dateLib:o});let Ie={dayPickerProps:t,selected:P,select:se,isSelected:oe,months:j,nextMonth:N,previousMonth:M,goToMonth:ie,getModifiers:ae,components:r,classNames:c,styles:C,labels:a,formatters:i};return _.createElement(yv.Provider,{value:Ie},_.createElement(r.Root,{rootRef:t.animate?Fe:void 0,className:Me,style:Ne,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Pe},_.createElement(r.Months,{className:c[Q.Months],style:C?.[Q.Months]},!t.hideNavigation&&!d&&_.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[Q.Nav],style:C?.[Q.Nav],"aria-label":I(),onPreviousClick:Ce,onNextClick:R,previousMonth:M,nextMonth:N}),j.map((e,n)=>_.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[Q.Month],style:C?.[Q.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&_.createElement(r.PreviousMonthButton,{type:`button`,className:c[Q.PreviousMonthButton],tabIndex:M?void 0:-1,"aria-disabled":!M||void 0,"aria-label":ge(M),onClick:Ce,"data-animated-button":t.animate?`true`:void 0},_.createElement(r.Chevron,{disabled:!M||void 0,className:c[Q.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),_.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[Q.MonthCaption],style:C?.[Q.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?_.createElement(r.DropdownNav,{className:c[Q.Dropdowns],style:C?.[Q.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?_.createElement(r.MonthsDropdown,{key:`month`,className:c[Q.MonthsDropdown],"aria-label":he(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:Ae(e.date),options:Cy(e.date,ne,re,i,o),style:C?.[Q.Dropdown],value:o.getMonth(e.date)}):_.createElement(`span`,{key:`month`},E(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?_.createElement(r.YearsDropdown,{key:`year`,className:c[Q.YearsDropdown],"aria-label":be(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:je(e.date),options:Ey(ne,re,i,o,!!t.reverseYears),style:C?.[Q.Dropdown],value:o.getYear(e.date)}):_.createElement(`span`,{key:`year`},ee(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),_.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):_.createElement(r.CaptionLabel,{className:c[Q.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&_.createElement(r.NextMonthButton,{type:`button`,className:c[Q.NextMonthButton],tabIndex:N?void 0:-1,"aria-disabled":!N||void 0,"aria-label":L(N),onClick:R,"data-animated-button":t.animate?`true`:void 0},_.createElement(r.Chevron,{disabled:!N||void 0,className:c[Q.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&_.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[Q.Nav],style:C?.[Q.Nav],"aria-label":I(),onPreviousClick:Ce,onNextClick:R,previousMonth:M,nextMonth:N}),_.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":me(e.date,o.options,o)||void 0,className:c[Q.MonthGrid],style:C?.[Q.MonthGrid]},!t.hideWeekdays&&_.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[Q.Weekdays],style:C?.[Q.Weekdays]},S&&_.createElement(r.WeekNumberHeader,{"aria-label":ye(o.options),className:c[Q.WeekNumberHeader],style:C?.[Q.WeekNumberHeader],scope:`col`},O()),xe.map(e=>_.createElement(r.Weekday,{"aria-label":_e(e,o.options,o),className:c[Q.Weekday],key:String(e),style:C?.[Q.Weekday],scope:`col`},k(e,o.options,o)))),_.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[Q.Weeks],style:C?.[Q.Weeks]},e.weeks.map(e=>_.createElement(r.Week,{className:c[Q.Week],key:e.weekNumber,style:C?.[Q.Week],week:e},S&&_.createElement(r.WeekNumber,{week:e,style:C?.[Q.WeekNumber],"aria-label":ve(e.weekNumber,{locale:s}),className:c[Q.WeekNumber],scope:`row`,role:`rowheader`},D(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ae(e);if(i[lv.focused]=!i.hidden&&!!le?.isEqualTo(e),i[uv.selected]=oe?.(n)||i.selected,Rv(P)){let{from:e,to:t}=P;i[uv.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[uv.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[uv.range_middle]=Iv(P,n,!0,o)}let a=wy(i,C,t.modifiersStyles),s=Gv(i,c,t.modifiersClassNames),l=!Se&&!i.hidden?pe(n,i,o.options,o):void 0;return _.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&Se?_.createElement(r.DayButton,{className:c[Q.DayButton],style:C?.[Q.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:ue(e)?0:-1,"aria-label":fe(n,i,o.options,o),onClick:we(e,i),onBlur:Ee(e,i),onFocus:Te(e,i),onKeyDown:De(e,i),onMouseEnter:Oe(e,i),onMouseLeave:ke(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))})))))))),t.footer&&_.createElement(r.Footer,{className:c[Q.Footer],style:C?.[Q.Footer],role:`status`,"aria-live":`polite`},t.footer)))}var fb=`
|
|
1896
1896
|
.gh-portal-datepicker {
|
|
1897
1897
|
position: relative;
|
|
1898
1898
|
}
|
|
@@ -2111,9 +2111,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2111
2111
|
.gh-portal-datepicker-disabled .gh-portal-datepicker-day-button:hover {
|
|
2112
2112
|
background: none;
|
|
2113
2113
|
}
|
|
2114
|
-
`,
|
|
2115
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ab(e,t){return Db(e)||Ob(e,t)||jb(e,t)||kb()}function jb(e,t){if(e){if(typeof e==`string`)return Eb(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eb(e,t):void 0}}function Mb(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Tb;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Mb.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Mb.prototype.next=function(e){return this._invoke(`next`,e)},Mb.prototype.throw=function(e){return this._invoke(`throw`,e)},Mb.prototype.return=function(e){return this._invoke(`return`,e)};var Nb=Object.entries,Pb=Object.setPrototypeOf,Fb=Object.isFrozen,Ib=Object.getPrototypeOf,Lb=Object.getOwnPropertyDescriptor,Rb=Object.freeze,zb=Object.seal,Bb=Object.create,Vb=typeof Reflect<`u`&&Reflect,Hb=Vb.apply,Ub=Vb.construct;Rb||=function(e){return e},zb||=function(e){return e},Hb||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},Ub||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var Wb=mx(Array.prototype.forEach);Array.prototype.indexOf;var Gb=mx(Array.prototype.lastIndexOf),Kb=mx(Array.prototype.pop),qb=mx(Array.prototype.push),Jb=mx(Array.prototype.slice),Yb=mx(Array.prototype.splice),Xb=Array.isArray,Zb=hx(Set),Qb=mx(Set.prototype.add),$b=mx(Set.prototype.has),ex=mx(String.prototype.toLowerCase),tx=mx(String.prototype.toString),nx=mx(String.prototype.match),rx=mx(String.prototype.replace),ix=mx(String.prototype.indexOf),ax=mx(String.prototype.trim),ox=mx(Number.prototype.toString),sx=mx(Boolean.prototype.toString),cx=typeof BigInt>`u`?null:mx(BigInt.prototype.toString),lx=typeof Symbol>`u`?null:mx(Symbol.prototype.toString),ux=mx(Object.prototype.hasOwnProperty),dx=mx(Object.prototype.toString),fx=mx(RegExp.prototype.test),px=hx(TypeError);function mx(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Hb(e,t,r)}}function hx(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ub(e,n)}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ex;if(Pb&&Pb(e,null),!Xb(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Fb(t)||(t[r]=e),i=e)}e[i]=!0}return e}function gx(e){for(let t=0;t<e.length;t++)ux(e,t)||(e[t]=null);return e}function _x(e){let t=Bb(null);for(let r of Nb(e)){var n=Ab(r,2);let i=n[0],a=n[1];ux(e,i)&&(Xb(a)?t[i]=gx(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=_x(a):t[i]=a)}return t}function vx(e){switch(typeof e){case`string`:return e;case`number`:return ox(e);case`boolean`:return sx(e);case`bigint`:return cx?cx(e):`0`;case`symbol`:return lx?lx(e):`Symbol()`;case`undefined`:return dx(e);case`function`:case`object`:{if(e===null)return dx(e);let t=e,n=yx(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:dx(e)}return dx(e)}default:return dx(e)}}function yx(e,t){for(;e!==null;){let n=Lb(e,t);if(n){if(n.get)return mx(n.get);if(typeof n.value==`function`)return mx(n.value)}e=Ib(e)}function n(){return null}return n}function bx(e,t){for(;e!==null;){let n=Lb(e,t);if(n)return n.get?mx(n.get):null;e=Ib(e)}return null}function xx(e){try{return fx(e,``),!0}catch{return!1}}var Sx=Rb(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Cx=Rb(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),wx=Rb([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Tx=Rb([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ex=Rb(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Dx=Rb([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ox=Rb([`#text`]),kx=Rb(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ax=Rb(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),jx=Rb(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Mx=Rb([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Nx=zb(/{{[\w\W]*|^[\w\W]*}}/g),Px=zb(/<%[\w\W]*|^[\w\W]*%>/g),Fx=zb(/\${[\w\W]*/g),Ix=zb(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lx=zb(/^aria-[\-\w]+$/),Rx=zb(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zx=zb(/^(?:\w+script|data):/i),Bx=zb(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vx=zb(/^html$/i),Hx=zb(/^[a-z][.\w]*(-[.\w]+)+$/i),Ux=zb(/<[/\w!]/g),Wx=zb(/<[/\w]/g),Gx=zb(/<\/no(script|embed|frames)/i),Kx=zb(/\/>/i),qx={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Jx=Rb($({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Yx=function(){return typeof window>`u`?null:window},Xx=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Zx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Qx=function(e,t,n,r){return ux(e,t)&&Xb(e[t])?$(r.base?_x(r.base):{},e[t],r.transform):n},$x=function(e,t,n){let r=ux(e,t)?e[t]:void 0;return r&&typeof r==`object`?_x(r):n()};function eS(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yx(),t=e=>eS(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==qx.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=yx(d,`cloneNode`),p=yx(d,`remove`),m=yx(d,`removeAttributeNode`),h=yx(d,`nextSibling`),g=yx(d,`childNodes`),_=yx(d,`parentNode`),v=yx(d,`shadowRoot`),y=yx(d,`attributes`),b=o&&o.prototype?yx(o.prototype,`nodeType`):null,x=o&&o.prototype?yx(o.prototype,`nodeName`):null,S=o&&o.prototype?yx(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=bx(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,ee=!1,A=0,te=function(){if(A>0)throw px(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){te(),A++;try{return D.createHTML(e)}finally{A--}},ne=function(e){te(),A++;try{return D.createScriptURL(e)}finally{A--}},re=function(){return ee||=(k=Xx(u,i),!0),k},M=n,N=M.implementation,ie=M.createNodeIterator,ae=M.createDocumentFragment,oe=M.getElementsByTagName,se=r.importNode,P=Zx();t.isSupported=typeof Nb==`function`&&typeof _==`function`&&N&&N.createHTMLDocument!==void 0;let ce=Nx,le=Px,ue=Fx,de=Ix,F=Lx,fe=zx,pe=Bx,me=Hx,he=Rx,I=null,ge=$({},[...Sx,...Cx,...wx,...Ex,...Ox]),L=null,_e=$({},[...kx,...Ax,...jx,...Mx]),ve=Object.seal(Bb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ye=null,be=null,xe=Object.seal(Bb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Se=!0,Ce=!0,R=!1,we=!0,Te=!1,Ee=!0,De=!1,Oe=!1,ke=null,Ae=null,je=!1,Me=!1,Ne=!1,Pe=!1,Fe=!0,Ie=!1,Le=`user-content-`,Re=!0,ze=!1,Be=null,Ve={},He=null,Ue=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),We=null,Ge=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ke=null,qe=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Je=`http://www.w3.org/1998/Math/MathML`,Ye=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=$({},[Je,Ye,Xe],tx),tt=Rb([`mi`,`mo`,`mn`,`ms`,`mtext`]),nt=$({},tt),rt=Rb([`annotation-xml`]),it=$({},rt),at=$({},[`title`,`style`,`font`,`a`,`script`]),ot=null,st=[`application/xhtml+xml`,`text/html`],z=null,ct=null,lt=n.createElement(`form`),ut=function(e){return e instanceof RegExp||e instanceof Function},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ct&&ct===e)return;(!e||typeof e!=`object`)&&(e={}),e=_x(e),ot=st.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,z=ot===`application/xhtml+xml`?tx:ex,I=Qx(e,`ALLOWED_TAGS`,ge,{transform:z}),L=Qx(e,`ALLOWED_ATTR`,_e,{transform:z}),$e=Qx(e,`ALLOWED_NAMESPACES`,et,{transform:tx}),Ke=Qx(e,`ADD_URI_SAFE_ATTR`,qe,{transform:z,base:qe}),We=Qx(e,`ADD_DATA_URI_TAGS`,Ge,{transform:z,base:Ge}),He=Qx(e,`FORBID_CONTENTS`,Ue,{transform:z}),ye=Qx(e,`FORBID_TAGS`,_x({}),{transform:z}),be=Qx(e,`FORBID_ATTR`,_x({}),{transform:z}),Ve=ux(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?_x(e.USE_PROFILES):e.USE_PROFILES:!1,Se=e.ALLOW_ARIA_ATTR!==!1,Ce=e.ALLOW_DATA_ATTR!==!1,R=e.ALLOW_UNKNOWN_PROTOCOLS||!1,we=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Te=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,De=e.WHOLE_DOCUMENT||!1,Me=e.RETURN_DOM||!1,Ne=e.RETURN_DOM_FRAGMENT||!1,Pe=e.RETURN_TRUSTED_TYPE||!1,je=e.FORCE_BODY||!1,Fe=e.SANITIZE_DOM!==!1,Ie=e.SANITIZE_NAMED_PROPS||!1,Re=e.KEEP_CONTENT!==!1,ze=e.IN_PLACE||!1,he=xx(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Rx,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,nt=$x(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},tt)),it=$x(e,`HTML_INTEGRATION_POINTS`,()=>$({},rt));let t=$x(e,`CUSTOM_ELEMENT_HANDLING`,()=>Bb(null));if(ve=Bb(null),ux(t,`tagNameCheck`)&&ut(t.tagNameCheck)&&(ve.tagNameCheck=t.tagNameCheck),ux(t,`attributeNameCheck`)&&ut(t.attributeNameCheck)&&(ve.attributeNameCheck=t.attributeNameCheck),ux(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ve.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),zb(ve),Te&&(Ce=!1),Ne&&(Me=!0),Ve&&(I=$({},Ox),L=Bb(null),Ve.html===!0&&($(I,Sx),$(L,kx)),Ve.svg===!0&&($(I,Cx),$(L,Ax),$(L,Mx)),Ve.svgFilters===!0&&($(I,wx),$(L,Ax),$(L,Mx)),Ve.mathMl===!0&&($(I,Ex),$(L,jx),$(L,Mx))),xe.tagCheck=null,xe.attributeCheck=null,ux(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?xe.tagCheck=e.ADD_TAGS:Xb(e.ADD_TAGS)&&(I===ge&&(I=_x(I)),$(I,e.ADD_TAGS,z))),ux(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?xe.attributeCheck=e.ADD_ATTR:Xb(e.ADD_ATTR)&&(L===_e&&(L=_x(L)),$(L,e.ADD_ATTR,z))),ux(e,`ADD_FORBID_CONTENTS`)&&Xb(e.ADD_FORBID_CONTENTS)&&(He===Ue&&(He=_x(He)),$(He,e.ADD_FORBID_CONTENTS,z)),Re&&(I[`#text`]=!0),De&&$(I,[`html`,`head`,`body`]),I.table&&($(I,[`tbody`]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw px(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw px(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=j(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=re()),D&&typeof O==`string`&&(O=j(``)));Rb&&Rb(e),ct=e},ft=$({},[...Cx,...wx,...Tx]),pt=$({},[...Ex,...Dx]),mt=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===Je?e===`svg`&&(n===`annotation-xml`||nt[n]):!!ft[e]},ht=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===Ye?e===`math`&&it[n]:!!pt[e]},gt=function(e,t,n){return t.namespaceURI===Ye&&!it[n]||t.namespaceURI===Je&&!nt[n]?!1:!pt[e]&&(at[e]||!ft[e])},_t=function(e){let t=E(e),n=ex(w(e)),r=_(e),i,a;return r&&C(r)===qx.element?(i={namespaceURI:E(r)},a=ex(w(r))):(i={namespaceURI:Ze},a=`template`),$e[t]?t===Ye?mt(n,i,a):t===Je?ht(n,i,a):t===Xe?gt(n,i,a):!!(ot===`application/xhtml+xml`&&$e[t]):!1},vt=function(e){qb(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw px(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},yt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},bt=function(e){wt(e);let t=g(e);t&&Wb(Jb(t),e=>{try{p(e)}catch{}});let n=C(e)===qx.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&yt(e,r,i)}},xt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}qb(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(Me||Ne)try{vt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},St=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||L[z(i)]||yt(e,r,i)}},Ct=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===qx.element){let t=v(e);zt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},wt=function(e){Ct(e,e=>{C(e)===qx.element&&St(e)})},Tt=function(e){let t=[];return Ct(e,e=>{t.push(e)},!0),t},Et=function(e,t){let n=Zb();Wb(Tt(e),e=>{C(e)===qx.element&&Qb(n,e)}),Wb(t,e=>{C(e)===qx.element&&!$b(n,e)&&St(e)})},Dt=function(e,n){let r=!1;return Wb(t.removed,t=>{t.element&&(r||=t.element===e,wt(t.element))}),Et(e,n),r},Ot=function(e,t){let n=Be,r=null,i=()=>(r||(r=Zb(),Wb(t,e=>{Qb(r,e)})),r);for(let t=0;;t++){let r=Tt(e),a=[e],o=!1;if(Wb(r,e=>{C(e)===qx.documentFragment?qb(a,e):!o&&!$b(n,e)&&(o=$b(i(),e))}),!o)return;if(t>=8)throw px(`the tree kept changing during in-place sanitization; refusing to return it`);Wb(a,(t,n)=>{kt(t,n>0,e,i())})}},kt=function(e,t,n,r){let i=Pt(e),a;for(;a=i.nextNode();)!$b(r,a)||$b(Be,a)||(t&&Vt(P.uponSanitizeShadowNode,a,null),qt(a,n),en(a,n),zt(a.content)&&tn(a.content))},At=function(e){Be&&Qb(Be,e)},jt=function(e,t){return Ee?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Mt=function(e){Ee&&Ct(e,e=>{let t=C(e);if(t===qx.processingInstruction||t===qx.comment&&fx(Wx,e.data)){try{p(e)}catch{}return!1}if(t===qx.element){let t=e,n=z(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&jt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Nt=function(e){let t=null,r=null;if(je)e=`<remove></remove>`+e;else{let t=nx(e,/^[\r\n\t ]+/);r=t&&t[0]}ot===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?j(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,ot)}catch{}if(!t||!t.documentElement){t=N.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?oe.call(t,De?`html`:`body`)[0]:De?t.documentElement:a},Pt=function(e){let t=S?S(e):e.ownerDocument;return ie.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ft=function(e){return e=rx(e,ce,` `),e=rx(e,le,` `),e=rx(e,ue,` `),e},It=function(e){Lt(e);let t=e.querySelectorAll?.call(e,`template`);t&&Wb(t,e=>{zt(e.content)&&It(e.content)})},Lt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ie.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Ft(r.data),r=n.nextNode()},Rt=function(e){let t=x?x(e):null;return typeof t!=`string`||z(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},zt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===qx.documentFragment}catch{return!1}},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Vt(e,n,r){e.length!==0&&Wb(e,e=>{e.call(t,n,r,ct)})}let Ht=function(e,t){return!!(Ee&&e.hasChildNodes()&&!Bt(e.firstElementChild)&&fx(Ux,e.textContent)&&fx(Ux,e.innerHTML)||Ee&&Jx[t]&&C(e)===qx.element&&E(e)===Xe&&(Bt(e.firstElementChild)||typeof e.textContent==`string`&&fx(Ux,e.textContent))||e.nodeType===qx.processingInstruction||Ee&&e.nodeType===qx.comment&&fx(Wx,e.data))},Ut=function(e,t){if(e instanceof RegExp)return fx(e,t);if(e instanceof Function){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return!!e(t,...r)}return!1},Wt=function(e,t,n){if(!ye[t]&&Xt(t)&&Ut(ve.tagNameCheck,t))return!1;if(Re&&!He[t]&&!He[ex(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return vt(e),!0},Gt=function(e,t,n,r){return e.length===0?t:t===n||t===r?_x(t):t},Kt=function(e,t){return e===t||_(e)!==null?!1:(ze&&wt(e),!0)},qt=function(e,n){if(At(e),Vt(P.beforeSanitizeElements,e,null),Kt(e,n))return!0;if(Rt(e))return vt(e),!0;let r=z(w(e));if(I=Gt(P.uponSanitizeElement,I,ge,ke),Vt(P.uponSanitizeElement,e,{tagName:r,allowedTags:I}),Kt(e,n))return!0;if(Ht(e,r))return vt(e),!0;if(ye[r]||!(xe.tagCheck instanceof Function&&xe.tagCheck(r))&&!I[r]){let t=Wt(e,r,n);return t===!1&&(Vt(P.afterSanitizeElements,e,null),Kt(e,n))?!0:t}if(C(e)===qx.element&&!_t(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&fx(Gx,e.innerHTML))return vt(e),!0;if(Te&&e.nodeType===qx.text){let n=Ft(e.textContent);e.textContent!==n&&(qb(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Vt(P.afterSanitizeElements,e,null),Kt(e,n)},Jt=function(e,t,r){if(be[t]||jt(t,e)||Fe&&(t===`id`||t===`name`)&&(r in n||r in lt))return!1;let i=L[t]||xe.attributeCheck instanceof Function&&xe.attributeCheck(t,e);return Ce&&fx(de,t)||Se&&fx(F,t)?!0:i?Ke[t]||fx(he,rx(r,pe,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ix(r,`data:`)===0&&We[e]||R&&!fx(fe,rx(r,pe,``))?!0:!r:Xt(e)&&Ut(ve.tagNameCheck,e)&&Ut(ve.attributeNameCheck,t,e)||t===`is`&&ve.allowCustomizedBuiltInElements&&Ut(ve.tagNameCheck,r)},Yt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Xt=function(e){return!Yt[ex(e)]&&fx(me,e)},Zt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return ne(r)}return r},Qt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),Rt(e)?(vt(e),!1):!0}catch{return xt(t,e),!1}},$t=function(e,t){return Ee&&fx(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:ex(e)===`attributename`&&nx(t,`href`)!==null},en=function(e,n){if(Vt(P.beforeSanitizeAttributes,e,null),Kt(e,n))return;let r=e.attributes;if(!r||Rt(e))return;L=Gt(P.uponSanitizeAttribute,L,_e,Ae);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},a=r.length,o=z(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=z(s),d=l,f=s===`value`?d:ax(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Vt(P.uponSanitizeAttribute,e,i),f=i.attrValue,Ie&&(u===`id`||u===`name`)&&ix(f,Le)!==0&&(xt(s,e,n),f=Le+f,p=!0),$t(s,f)){xt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){xt(s,e,n);continue}if(!we&&fx(Kx,f)){xt(s,e,n);continue}if(Te&&(f=Ft(f)),!Jt(o,u,f)){xt(s,e,n);continue}f=Zt(o,u,c,f),f!==d&&Qt(e,s,c,f)&&p&&Kb(t.removed)}}Vt(P.afterSanitizeAttributes,e,null),Kt(e,n)},tn=function(e){let t=null,n=Pt(e);for(Vt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Vt(P.uponSanitizeShadowNode,t,null),qt(t,e),en(t,e),zt(t.content)&&tn(t.content),C(t)===qx.element){let e=v(t);zt(e)&&(nn(e),tn(e))}Te&&Lt(e),Vt(P.afterSanitizeShadowDOM,e,null)},nn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tn(e.shadow);continue}let n=e.node,r=C(n)===qx.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&z(e)===`template`){let e=n.content;zt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);zt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!Bt(e)&&(e=vx(e),typeof e!=`string`))throw px(`dirty is not a string, aborting`);if(!t.isSupported)return e;Oe?(I=ke,L=Ae):dt(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(I=_x(I)),P.uponSanitizeAttribute.length>0&&(L=_x(L)),t.removed=[];let c=ze&&typeof e!=`string`&&Bt(e),l=[],u=Be;if(c){Mt(e);let t=w(e);if(typeof t==`string`){let n=z(t);if(!I[n]||ye[n])throw bt(e),px(`root node is forbidden and cannot be sanitized in-place`)}if(Rt(e))throw bt(e),px(`root node is clobbered and cannot be sanitized in-place`);l=Tt(e),Be=Zb()}else if(Bt(e))i=Nt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===qx.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),nn(i);else{if(!Me&&!Te&&!De&&e.indexOf(`<`)===-1)return D&&Pe?j(e):e;if(i=Nt(e),!i)return Me?null:Pe?O:``}i&&je&&vt(i.firstChild);let d=c?e:i;try{c&&nn(e);let t=Pt(d);for(;o=t.nextNode();)qt(o,d),en(o,d),zt(o.content)&&tn(o.content);c&&Ot(e,l)}catch(t){throw c&&(bt(e),Dt(e,l)),t}finally{Be=u}if(c){if(Dt(e,l))throw px(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Te&&It(e),e}if(Me){if(Te&&It(i),Ne)for(s=ae.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(L.shadowroot||L.shadowrootmode)&&(s=se.call(r,s,!0)),s}let f=De?i.outerHTML:i.innerHTML;return De&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&fx(Vx,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
2116
|
-
`+f),Te&&(f=Ft(f)),D&&Pe?j(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dt(e),Oe=!0,ke=I,Ae=L},t.clearConfig=function(){ct=null,Oe=!1,ke=null,Ae=null,D=k,O=``},t.isValidAttribute=function(e,t,n){ct||dt({});let r=z(e),i=z(t);return typeof n==`string`&&($t(t,n)||!we&&
|
|
2114
|
+
`,pb={months:`gh-portal-datepicker-months`,month_caption:`gh-portal-datepicker-month-caption`,nav:`gh-portal-datepicker-nav`,month_grid:`gh-portal-datepicker-grid`,weekday:`gh-portal-datepicker-weekday`,day:`gh-portal-datepicker-day`,day_button:`gh-portal-datepicker-day-button`,today:`gh-portal-datepicker-today`,selected:`gh-portal-datepicker-selected`,disabled:`gh-portal-datepicker-disabled`,outside:`gh-portal-datepicker-outside`};function mb(e){try{let t=(new Intl.Locale(e).getWeekInfo?.()??new Intl.Locale(e).weekInfo)?.firstDay;return t?t%7:0}catch{return 0}}var hb=({id:e,value:t,onChange:n,min:r,max:i,hasError:a=!1,minLabel:o=null,ariaLabel:s})=>{let{locale:c=`en`,dir:l=`ltr`}=(0,_.useContext)(J),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=dl(t),h=dl(r),g=dl(i),v=(0,_.useMemo)(()=>{try{return new Intl.DateTimeFormat(c),c}catch{return`en`}},[c]),y=(0,_.useMemo)(()=>({monthCaption:new Intl.DateTimeFormat(v,{month:`long`,year:`numeric`}),weekday:new Intl.DateTimeFormat(v,{weekday:`short`}),day:new Intl.DateTimeFormat(v,{day:`numeric`})}),[v]),b=(0,_.useMemo)(()=>mb(v),[v]),x=()=>d(e=>!e),S=e=>{e&&(n(fl(e)),d(!1),p.current?.focus())},C=!!o&&!!t&&t===r;return(0,q.jsxs)(`div`,{className:`gh-portal-datepicker`,children:[(0,q.jsxs)(`div`,{ref:f,className:`gh-portal-datepicker-field`,children:[(0,q.jsx)(`input`,{className:`gh-portal-input`+(a?` error`:``)+(C?` has-min-label`:``),"data-test-input":e,id:e,max:i,min:r,type:`date`,value:t,onBlur:e=>!e.target.value&&n(r),onChange:e=>n(e.target.value)}),C&&(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-datepicker-min-label`,children:o}),(0,q.jsx)(`button`,{ref:p,"aria-expanded":u,"aria-haspopup":`dialog`,"aria-label":s,className:`gh-portal-datepicker-toggle`,"data-testid":`datepicker-toggle`,type:`button`,onClick:x,children:(0,q.jsx)(tg,{"aria-hidden":`true`,focusable:`false`})})]}),u&&(0,q.jsx)(fm,{align:`end`,anchor:f,"aria-label":s,className:`gh-portal-datepicker-popover`,"data-testid":`datepicker-popover`,role:`dialog`,onClose:e=>{d(!1),e===`escape`&&p.current?.focus()},children:(0,q.jsx)(db,{classNames:pb,dir:l,defaultMonth:m||h,disabled:[...h?[{before:h}]:[],...g?[{after:g}]:[]],endMonth:g,fixedWeeks:!0,formatters:{formatCaption:e=>y.monthCaption.format(e),formatWeekdayName:e=>y.weekday.format(e),formatDay:e=>y.day.format(e)},mode:`single`,selected:m,showOutsideDays:!0,startMonth:h,weekStartsOn:b,onSelect:S})})]})},gb=class extends _.Component{static contextType=J;render(){return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`button`,{className:`gh-portal-btn gh-portal-btn-site-title-back`,onClick:()=>{this.props.onBack?this.props.onBack():this.context.doAction(`closePopup`)},children:[(0,q.jsx)(`span`,{children:`← `}),` `,K(`Back`)]})})}},_b=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,...e,children:(0,q.jsx)(`g`,{transform:`matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)`,children:(0,q.jsx)(`path`,{d:`M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-7.5,9a2,2,0,1,1,2-2A2,2,0,0,1,12,18.5ZM16.25,9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5V6.75a4.25,4.25,0,0,1,8.5,0Z`,style:{fill:`#000000`}})})});function vb({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){let r=t.some(t=>t.id===e?.id);if(e.paid)return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper`,"data-testid":`toggle-wrapper`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,q.jsx)(`h3`,{children:e.name}),(0,q.jsx)(`p`,{children:e.description})]}),(0,q.jsx)(`div`,{className:`gh-portal-lock-icon-container`,children:(0,q.jsx)(_b,{className:`gh-portal-lock-icon`,alt:``,title:K(`Unlock access to all newsletters by becoming a paid subscriber.`)})})]});let i=()=>{let i=[];i=r?t.filter(t=>t.id!==e.id):t.filter(t=>t.id!==e.id).concat(e),n(i)};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`toggle-wrapper`,role:`button`,tabIndex:0,"aria-pressed":r,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,q.jsx)(`h3`,{children:e.name}),(0,q.jsx)(`p`,{children:e.description})]}),(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:e.id,label:e.name,onToggle:i,checked:r,presentational:!0})})]})}function yb({subscribedNewsletters:e,setSubscribedNewsletters:t}){let{site:n}=(0,_.useContext)(J);return fu({site:n}).map(n=>(0,q.jsx)(vb,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id))}function bb({pageData:e,onBack:t}){let{brandColor:n,site:r,doAction:i,action:a}=(0,_.useContext)(J),o=fu({site:r}).filter(e=>e.subscribe_on_signup),s=!1;a===`signup:running`&&(s=!0);let c=K(`Continue`),l=!1;a===`signup:failed`&&(c=K(`Retry`),l=!0);let u=a===`signup:running`,[d,f]=(0,_.useState)(o);return(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer gh-portal-newsletter-selection`,children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-text-large`,children:K(`Choose your newsletters`)}),(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`div`,{className:`gh-portal-list`,children:(0,q.jsx)(yb,{subscribedNewsletters:d,setSubscribedNewsletters:f})})}),(0,q.jsx)(`footer`,{className:`gh-portal-action-footer`,children:(0,q.jsxs)(`div`,{style:{width:`100%`},children:[(0,q.jsx)(`div`,{style:{marginBottom:`20px`},children:(0,q.jsx)(df,{isRunning:s,retry:l,disabled:u,onClick:()=>{let t=d.map(e=>({id:e.id,name:e.name})),{name:n,email:r,plan:a,phonenumber:o,offerId:s}=e;i(`signup`,{name:n,email:r,plan:a,phonenumber:o,newsletters:t,offerId:s})},brandColor:n,label:c,style:{width:`100%`}})}),zl({site:r})?null:(0,q.jsx)(`div`,{children:(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan`,onClick:()=>{t()},children:(0,q.jsx)(`span`,{children:K(`Choose a different plan`)})})})]})})]})}var xb=e=>!!e&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(String(e).toLowerCase()),Sb=({field:e})=>{if(e.required&&!e.value)switch(e.name){case`name`:case`buyerName`:return K(`Enter your name`);case`email`:return K(`Enter your email address`);default:return K(`Please enter {fieldName}`,{fieldName:e.name})}return e.type===`email`&&!xb(e.value)?K(`Invalid email address`):null},Cb=({fields:e})=>{let t={};return e.forEach(e=>{let n=e.name,r=Sb({field:e});t[n]=r}),t},wb=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,...e,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`style`,{children:`.inviteicon{fill: currentColor;}`})}),(0,q.jsx)(`path`,{className:`inviteicon`,d:`M23.991 11.464l-.036-.146-.028-.068-.011-.027-.115-.114-.018-.021-.008-.005h-.001l-3.774-2.596v-7.987c0-.276-.224-.5-.5-.5h-15c-.276 0-.5.224-.5.5v7.987l-3.774 2.595-.003.002-.006.004-.015.016-.118.118-.011.027-.028.068-.036.146-.009.037v10.5c0 1.103.897 2 2 2h20c1.103 0 2-.897 2-2v-10.5l-.009-.036zm-1.383.03l-2.608 1.738v-3.531l2.608 1.793zm-18.608 1.738l-2.608-1.739 2.608-1.792v3.531zm18 9.768h-20c-.551 0-1-.449-1-1v-9.566l5.223 3.482c.085.057.181.084.276.084.162 0 .32-.078.417-.223.153-.23.091-.54-.139-.693l-1.777-1.185v-12.899h14v12.899l-1.777 1.185c-.23.153-.292.463-.139.693.096.145.255.223.416.223.095 0 .191-.027.277-.084l5.223-3.482v9.566c0 .551-.449 1-1 1zM15.812 16.109c-.088-.07-.198-.109-.312-.109h-7c-.114 0-.224.039-.312.109l-5 4c-.215.173-.25.487-.078.703.173.215.487.251.703.078l4.862-3.89h6.649l4.863 3.891c.093.073.203.109.313.109.147 0 .292-.065.391-.188.172-.216.137-.53-.078-.703l-5.001-4zM11.706 12.779c.087.064.191.096.294.096s.207-.032.294-.096c.482-.35 4.706-3.497 4.706-6.101 0-1.868-1.387-2.984-2.728-2.984-.772 0-1.674.379-2.272 1.368-.598-.988-1.5-1.368-2.272-1.368-1.341-.001-2.728 1.116-2.728 2.984 0 2.604 4.224 5.751 4.706 6.101zm-1.978-8.086c.844 0 1.511.681 1.786 1.822.108.45.864.45.973 0 .274-1.141.942-1.822 1.786-1.822.85 0 1.728.742 1.728 1.984 0 1.646-2.658 4.037-4 5.072-1.342-1.035-4-3.426-4-5.072-.001-1.241.877-1.984 1.727-1.984z`})]}),Tb=e=>{if(e.currentTarget.contains(e.target)){let t=e.target.closest(`a`);t&&(e.preventDefault(),window.open(t.href,`_blank`))}};function Eb(e,t){this.v=e,this.k=t}function Db(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ob(e){if(Array.isArray(e))return e}function kb(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ab(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2115
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jb(e,t){return Ob(e)||kb(e,t)||Mb(e,t)||Ab()}function Mb(e,t){if(e){if(typeof e==`string`)return Db(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Db(e,t):void 0}}function Nb(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Eb;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Nb.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Nb.prototype.next=function(e){return this._invoke(`next`,e)},Nb.prototype.throw=function(e){return this._invoke(`throw`,e)},Nb.prototype.return=function(e){return this._invoke(`return`,e)};var Pb=Object.entries,Fb=Object.setPrototypeOf,Ib=Object.isFrozen,Lb=Object.getPrototypeOf,Rb=Object.getOwnPropertyDescriptor,zb=Object.freeze,Bb=Object.seal,Vb=Object.create,Hb=typeof Reflect<`u`&&Reflect,Ub=Hb.apply,Wb=Hb.construct;zb||=function(e){return e},Bb||=function(e){return e},Ub||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},Wb||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var Gb=hx(Array.prototype.forEach);Array.prototype.indexOf;var Kb=hx(Array.prototype.lastIndexOf),qb=hx(Array.prototype.pop),Jb=hx(Array.prototype.push),Yb=hx(Array.prototype.slice),Xb=hx(Array.prototype.splice),Zb=Array.isArray,Qb=gx(Set),$b=hx(Set.prototype.add),ex=hx(Set.prototype.has),tx=hx(String.prototype.toLowerCase),nx=hx(String.prototype.toString),rx=hx(String.prototype.match),ix=hx(String.prototype.replace),ax=hx(String.prototype.indexOf),ox=hx(String.prototype.trim),sx=hx(Number.prototype.toString),cx=hx(Boolean.prototype.toString),lx=typeof BigInt>`u`?null:hx(BigInt.prototype.toString),ux=typeof Symbol>`u`?null:hx(Symbol.prototype.toString),dx=hx(Object.prototype.hasOwnProperty),fx=hx(Object.prototype.toString),px=hx(RegExp.prototype.test),mx=gx(TypeError);function hx(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Ub(e,t,r)}}function gx(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return Wb(e,n)}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tx;if(Fb&&Fb(e,null),!Zb(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ib(t)||(t[r]=e),i=e)}e[i]=!0}return e}function _x(e){for(let t=0;t<e.length;t++)dx(e,t)||(e[t]=null);return e}function vx(e){let t=Vb(null);for(let r of Pb(e)){var n=jb(r,2);let i=n[0],a=n[1];dx(e,i)&&(Zb(a)?t[i]=_x(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=vx(a):t[i]=a)}return t}function yx(e){switch(typeof e){case`string`:return e;case`number`:return sx(e);case`boolean`:return cx(e);case`bigint`:return lx?lx(e):`0`;case`symbol`:return ux?ux(e):`Symbol()`;case`undefined`:return fx(e);case`function`:case`object`:{if(e===null)return fx(e);let t=e,n=bx(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:fx(e)}return fx(e)}default:return fx(e)}}function bx(e,t){for(;e!==null;){let n=Rb(e,t);if(n){if(n.get)return hx(n.get);if(typeof n.value==`function`)return hx(n.value)}e=Lb(e)}function n(){return null}return n}function xx(e,t){for(;e!==null;){let n=Rb(e,t);if(n)return n.get?hx(n.get):null;e=Lb(e)}return null}function Sx(e){try{return px(e,``),!0}catch{return!1}}var Cx=zb(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),wx=zb(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Tx=zb([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ex=zb([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Dx=zb(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ox=zb([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),kx=zb([`#text`]),Ax=zb(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),jx=zb(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Mx=zb(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Nx=zb([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Px=Bb(/{{[\w\W]*|^[\w\W]*}}/g),Fx=Bb(/<%[\w\W]*|^[\w\W]*%>/g),Ix=Bb(/\${[\w\W]*/g),Lx=Bb(/^data-[\-\w.\u00B7-\uFFFF]+$/),Rx=Bb(/^aria-[\-\w]+$/),zx=Bb(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bx=Bb(/^(?:\w+script|data):/i),Vx=Bb(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hx=Bb(/^html$/i),Ux=Bb(/^[a-z][.\w]*(-[.\w]+)+$/i),Wx=Bb(/<[/\w!]/g),Gx=Bb(/<[/\w]/g),Kx=Bb(/<\/no(script|embed|frames)/i),qx=Bb(/\/>/i),Jx={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Yx=zb($({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Xx=function(){return typeof window>`u`?null:window},Zx=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Qx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},$x=function(e,t,n,r){return dx(e,t)&&Zb(e[t])?$(r.base?vx(r.base):{},e[t],r.transform):n},eS=function(e,t,n){let r=dx(e,t)?e[t]:void 0;return r&&typeof r==`object`?vx(r):n()};function tS(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xx(),t=e=>tS(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Jx.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=bx(d,`cloneNode`),p=bx(d,`remove`),m=bx(d,`removeAttributeNode`),h=bx(d,`nextSibling`),g=bx(d,`childNodes`),_=bx(d,`parentNode`),v=bx(d,`shadowRoot`),y=bx(d,`attributes`),b=o&&o.prototype?bx(o.prototype,`nodeType`):null,x=o&&o.prototype?bx(o.prototype,`nodeName`):null,S=o&&o.prototype?bx(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=xx(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,ee=!1,A=0,te=function(){if(A>0)throw mx(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){te(),A++;try{return D.createHTML(e)}finally{A--}},ne=function(e){te(),A++;try{return D.createScriptURL(e)}finally{A--}},re=function(){return ee||=(k=Zx(u,i),!0),k},M=n,N=M.implementation,ie=M.createNodeIterator,ae=M.createDocumentFragment,oe=M.getElementsByTagName,se=r.importNode,P=Qx();t.isSupported=typeof Pb==`function`&&typeof _==`function`&&N&&N.createHTMLDocument!==void 0;let ce=Px,le=Fx,ue=Ix,de=Lx,F=Rx,fe=Bx,pe=Vx,me=Ux,he=zx,I=null,ge=$({},[...Cx,...wx,...Tx,...Dx,...kx]),L=null,_e=$({},[...Ax,...jx,...Mx,...Nx]),ve=Object.seal(Vb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ye=null,be=null,xe=Object.seal(Vb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Se=!0,Ce=!0,R=!1,we=!0,Te=!1,Ee=!0,De=!1,Oe=!1,ke=null,Ae=null,je=!1,Me=!1,Ne=!1,Pe=!1,Fe=!0,Ie=!1,Le=`user-content-`,Re=!0,ze=!1,Be=null,Ve={},He=null,Ue=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),We=null,Ge=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ke=null,qe=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Je=`http://www.w3.org/1998/Math/MathML`,Ye=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=$({},[Je,Ye,Xe],nx),tt=zb([`mi`,`mo`,`mn`,`ms`,`mtext`]),nt=$({},tt),rt=zb([`annotation-xml`]),it=$({},rt),at=$({},[`title`,`style`,`font`,`a`,`script`]),ot=null,st=[`application/xhtml+xml`,`text/html`],z=null,ct=null,lt=n.createElement(`form`),ut=function(e){return e instanceof RegExp||e instanceof Function},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ct&&ct===e)return;(!e||typeof e!=`object`)&&(e={}),e=vx(e),ot=st.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,z=ot===`application/xhtml+xml`?nx:tx,I=$x(e,`ALLOWED_TAGS`,ge,{transform:z}),L=$x(e,`ALLOWED_ATTR`,_e,{transform:z}),$e=$x(e,`ALLOWED_NAMESPACES`,et,{transform:nx}),Ke=$x(e,`ADD_URI_SAFE_ATTR`,qe,{transform:z,base:qe}),We=$x(e,`ADD_DATA_URI_TAGS`,Ge,{transform:z,base:Ge}),He=$x(e,`FORBID_CONTENTS`,Ue,{transform:z}),ye=$x(e,`FORBID_TAGS`,vx({}),{transform:z}),be=$x(e,`FORBID_ATTR`,vx({}),{transform:z}),Ve=dx(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?vx(e.USE_PROFILES):e.USE_PROFILES:!1,Se=e.ALLOW_ARIA_ATTR!==!1,Ce=e.ALLOW_DATA_ATTR!==!1,R=e.ALLOW_UNKNOWN_PROTOCOLS||!1,we=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Te=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,De=e.WHOLE_DOCUMENT||!1,Me=e.RETURN_DOM||!1,Ne=e.RETURN_DOM_FRAGMENT||!1,Pe=e.RETURN_TRUSTED_TYPE||!1,je=e.FORCE_BODY||!1,Fe=e.SANITIZE_DOM!==!1,Ie=e.SANITIZE_NAMED_PROPS||!1,Re=e.KEEP_CONTENT!==!1,ze=e.IN_PLACE||!1,he=Sx(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:zx,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,nt=eS(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},tt)),it=eS(e,`HTML_INTEGRATION_POINTS`,()=>$({},rt));let t=eS(e,`CUSTOM_ELEMENT_HANDLING`,()=>Vb(null));if(ve=Vb(null),dx(t,`tagNameCheck`)&&ut(t.tagNameCheck)&&(ve.tagNameCheck=t.tagNameCheck),dx(t,`attributeNameCheck`)&&ut(t.attributeNameCheck)&&(ve.attributeNameCheck=t.attributeNameCheck),dx(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ve.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Bb(ve),Te&&(Ce=!1),Ne&&(Me=!0),Ve&&(I=$({},kx),L=Vb(null),Ve.html===!0&&($(I,Cx),$(L,Ax)),Ve.svg===!0&&($(I,wx),$(L,jx),$(L,Nx)),Ve.svgFilters===!0&&($(I,Tx),$(L,jx),$(L,Nx)),Ve.mathMl===!0&&($(I,Dx),$(L,Mx),$(L,Nx))),xe.tagCheck=null,xe.attributeCheck=null,dx(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?xe.tagCheck=e.ADD_TAGS:Zb(e.ADD_TAGS)&&(I===ge&&(I=vx(I)),$(I,e.ADD_TAGS,z))),dx(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?xe.attributeCheck=e.ADD_ATTR:Zb(e.ADD_ATTR)&&(L===_e&&(L=vx(L)),$(L,e.ADD_ATTR,z))),dx(e,`ADD_FORBID_CONTENTS`)&&Zb(e.ADD_FORBID_CONTENTS)&&(He===Ue&&(He=vx(He)),$(He,e.ADD_FORBID_CONTENTS,z)),Re&&(I[`#text`]=!0),De&&$(I,[`html`,`head`,`body`]),I.table&&($(I,[`tbody`]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw mx(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw mx(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=j(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=re()),D&&typeof O==`string`&&(O=j(``)));zb&&zb(e),ct=e},ft=$({},[...wx,...Tx,...Ex]),pt=$({},[...Dx,...Ox]),mt=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===Je?e===`svg`&&(n===`annotation-xml`||nt[n]):!!ft[e]},ht=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===Ye?e===`math`&&it[n]:!!pt[e]},gt=function(e,t,n){return t.namespaceURI===Ye&&!it[n]||t.namespaceURI===Je&&!nt[n]?!1:!pt[e]&&(at[e]||!ft[e])},_t=function(e){let t=E(e),n=tx(w(e)),r=_(e),i,a;return r&&C(r)===Jx.element?(i={namespaceURI:E(r)},a=tx(w(r))):(i={namespaceURI:Ze},a=`template`),$e[t]?t===Ye?mt(n,i,a):t===Je?ht(n,i,a):t===Xe?gt(n,i,a):!!(ot===`application/xhtml+xml`&&$e[t]):!1},vt=function(e){Jb(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw mx(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},yt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},bt=function(e){wt(e);let t=g(e);t&&Gb(Yb(t),e=>{try{p(e)}catch{}});let n=C(e)===Jx.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&yt(e,r,i)}},xt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Jb(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(Me||Ne)try{vt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},St=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||L[z(i)]||yt(e,r,i)}},Ct=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===Jx.element){let t=v(e);zt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},wt=function(e){Ct(e,e=>{C(e)===Jx.element&&St(e)})},Tt=function(e){let t=[];return Ct(e,e=>{t.push(e)},!0),t},Et=function(e,t){let n=Qb();Gb(Tt(e),e=>{C(e)===Jx.element&&$b(n,e)}),Gb(t,e=>{C(e)===Jx.element&&!ex(n,e)&&St(e)})},Dt=function(e,n){let r=!1;return Gb(t.removed,t=>{t.element&&(r||=t.element===e,wt(t.element))}),Et(e,n),r},Ot=function(e,t){let n=Be,r=null,i=()=>(r||(r=Qb(),Gb(t,e=>{$b(r,e)})),r);for(let t=0;;t++){let r=Tt(e),a=[e],o=!1;if(Gb(r,e=>{C(e)===Jx.documentFragment?Jb(a,e):!o&&!ex(n,e)&&(o=ex(i(),e))}),!o)return;if(t>=8)throw mx(`the tree kept changing during in-place sanitization; refusing to return it`);Gb(a,(t,n)=>{kt(t,n>0,e,i())})}},kt=function(e,t,n,r){let i=Pt(e),a;for(;a=i.nextNode();)!ex(r,a)||ex(Be,a)||(t&&Vt(P.uponSanitizeShadowNode,a,null),qt(a,n),en(a,n),zt(a.content)&&tn(a.content))},At=function(e){Be&&$b(Be,e)},jt=function(e,t){return Ee?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Mt=function(e){Ee&&Ct(e,e=>{let t=C(e);if(t===Jx.processingInstruction||t===Jx.comment&&px(Gx,e.data)){try{p(e)}catch{}return!1}if(t===Jx.element){let t=e,n=z(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&jt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Nt=function(e){let t=null,r=null;if(je)e=`<remove></remove>`+e;else{let t=rx(e,/^[\r\n\t ]+/);r=t&&t[0]}ot===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?j(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,ot)}catch{}if(!t||!t.documentElement){t=N.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?oe.call(t,De?`html`:`body`)[0]:De?t.documentElement:a},Pt=function(e){let t=S?S(e):e.ownerDocument;return ie.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ft=function(e){return e=ix(e,ce,` `),e=ix(e,le,` `),e=ix(e,ue,` `),e},It=function(e){Lt(e);let t=e.querySelectorAll?.call(e,`template`);t&&Gb(t,e=>{zt(e.content)&&It(e.content)})},Lt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ie.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Ft(r.data),r=n.nextNode()},Rt=function(e){let t=x?x(e):null;return typeof t!=`string`||z(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},zt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Jx.documentFragment}catch{return!1}},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Vt(e,n,r){e.length!==0&&Gb(e,e=>{e.call(t,n,r,ct)})}let Ht=function(e,t){return!!(Ee&&e.hasChildNodes()&&!Bt(e.firstElementChild)&&px(Wx,e.textContent)&&px(Wx,e.innerHTML)||Ee&&Yx[t]&&C(e)===Jx.element&&E(e)===Xe&&(Bt(e.firstElementChild)||typeof e.textContent==`string`&&px(Wx,e.textContent))||e.nodeType===Jx.processingInstruction||Ee&&e.nodeType===Jx.comment&&px(Gx,e.data))},Ut=function(e,t){if(e instanceof RegExp)return px(e,t);if(e instanceof Function){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return!!e(t,...r)}return!1},Wt=function(e,t,n){if(!ye[t]&&Xt(t)&&Ut(ve.tagNameCheck,t))return!1;if(Re&&!He[t]&&!He[tx(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return vt(e),!0},Gt=function(e,t,n,r){return e.length===0?t:t===n||t===r?vx(t):t},Kt=function(e,t){return e===t||_(e)!==null?!1:(ze&&wt(e),!0)},qt=function(e,n){if(At(e),Vt(P.beforeSanitizeElements,e,null),Kt(e,n))return!0;if(Rt(e))return vt(e),!0;let r=z(w(e));if(I=Gt(P.uponSanitizeElement,I,ge,ke),Vt(P.uponSanitizeElement,e,{tagName:r,allowedTags:I}),Kt(e,n))return!0;if(Ht(e,r))return vt(e),!0;if(ye[r]||!(xe.tagCheck instanceof Function&&xe.tagCheck(r))&&!I[r]){let t=Wt(e,r,n);return t===!1&&(Vt(P.afterSanitizeElements,e,null),Kt(e,n))?!0:t}if(C(e)===Jx.element&&!_t(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&px(Kx,e.innerHTML))return vt(e),!0;if(Te&&e.nodeType===Jx.text){let n=Ft(e.textContent);e.textContent!==n&&(Jb(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Vt(P.afterSanitizeElements,e,null),Kt(e,n)},Jt=function(e,t,r){if(be[t]||jt(t,e)||Fe&&(t===`id`||t===`name`)&&(r in n||r in lt))return!1;let i=L[t]||xe.attributeCheck instanceof Function&&xe.attributeCheck(t,e);return Ce&&px(de,t)||Se&&px(F,t)?!0:i?Ke[t]||px(he,ix(r,pe,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ax(r,`data:`)===0&&We[e]||R&&!px(fe,ix(r,pe,``))?!0:!r:Xt(e)&&Ut(ve.tagNameCheck,e)&&Ut(ve.attributeNameCheck,t,e)||t===`is`&&ve.allowCustomizedBuiltInElements&&Ut(ve.tagNameCheck,r)},Yt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Xt=function(e){return!Yt[tx(e)]&&px(me,e)},Zt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return ne(r)}return r},Qt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),Rt(e)?(vt(e),!1):!0}catch{return xt(t,e),!1}},$t=function(e,t){return Ee&&px(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:tx(e)===`attributename`&&rx(t,`href`)!==null},en=function(e,n){if(Vt(P.beforeSanitizeAttributes,e,null),Kt(e,n))return;let r=e.attributes;if(!r||Rt(e))return;L=Gt(P.uponSanitizeAttribute,L,_e,Ae);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},a=r.length,o=z(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=z(s),d=l,f=s===`value`?d:ox(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Vt(P.uponSanitizeAttribute,e,i),f=i.attrValue,Ie&&(u===`id`||u===`name`)&&ax(f,Le)!==0&&(xt(s,e,n),f=Le+f,p=!0),$t(s,f)){xt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){xt(s,e,n);continue}if(!we&&px(qx,f)){xt(s,e,n);continue}if(Te&&(f=Ft(f)),!Jt(o,u,f)){xt(s,e,n);continue}f=Zt(o,u,c,f),f!==d&&Qt(e,s,c,f)&&p&&qb(t.removed)}}Vt(P.afterSanitizeAttributes,e,null),Kt(e,n)},tn=function(e){let t=null,n=Pt(e);for(Vt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Vt(P.uponSanitizeShadowNode,t,null),qt(t,e),en(t,e),zt(t.content)&&tn(t.content),C(t)===Jx.element){let e=v(t);zt(e)&&(nn(e),tn(e))}Te&&Lt(e),Vt(P.afterSanitizeShadowDOM,e,null)},nn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tn(e.shadow);continue}let n=e.node,r=C(n)===Jx.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&z(e)===`template`){let e=n.content;zt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);zt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!Bt(e)&&(e=yx(e),typeof e!=`string`))throw mx(`dirty is not a string, aborting`);if(!t.isSupported)return e;Oe?(I=ke,L=Ae):dt(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(I=vx(I)),P.uponSanitizeAttribute.length>0&&(L=vx(L)),t.removed=[];let c=ze&&typeof e!=`string`&&Bt(e),l=[],u=Be;if(c){Mt(e);let t=w(e);if(typeof t==`string`){let n=z(t);if(!I[n]||ye[n])throw bt(e),mx(`root node is forbidden and cannot be sanitized in-place`)}if(Rt(e))throw bt(e),mx(`root node is clobbered and cannot be sanitized in-place`);l=Tt(e),Be=Qb()}else if(Bt(e))i=Nt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Jx.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),nn(i);else{if(!Me&&!Te&&!De&&e.indexOf(`<`)===-1)return D&&Pe?j(e):e;if(i=Nt(e),!i)return Me?null:Pe?O:``}i&&je&&vt(i.firstChild);let d=c?e:i;try{c&&nn(e);let t=Pt(d);for(;o=t.nextNode();)qt(o,d),en(o,d),zt(o.content)&&tn(o.content);c&&Ot(e,l)}catch(t){throw c&&(bt(e),Dt(e,l)),t}finally{Be=u}if(c){if(Dt(e,l))throw mx(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Te&&It(e),e}if(Me){if(Te&&It(i),Ne)for(s=ae.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(L.shadowroot||L.shadowrootmode)&&(s=se.call(r,s,!0)),s}let f=De?i.outerHTML:i.innerHTML;return De&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&px(Hx,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
2116
|
+
`+f),Te&&(f=Ft(f)),D&&Pe?j(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dt(e),Oe=!0,ke=I,Ae=L},t.clearConfig=function(){ct=null,Oe=!1,ke=null,Ae=null,D=k,O=``},t.isValidAttribute=function(e,t,n){ct||dt({});let r=z(e),i=z(t);return typeof n==`string`&&($t(t,n)||!we&&px(qx,n))?!1:Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&dx(P,e)&&Jb(P[e],t)},t.removeHook=function(e,t){if(dx(P,e)){if(t!==void 0){let n=Kb(P[e],t);return n===-1?void 0:Xb(P[e],n,1)[0]}return qb(P[e])}},t.removeHooks=function(e){dx(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=Qx()},t}var nS=tS();function rS(e){return e?nS.sanitize(e,{ALLOWED_TAGS:[`a`,`b`,`i`,`em`,`strong`,`p`,`br`,`ul`,`ol`,`li`,`span`],ALLOWED_ATTR:[`href`,`target`,`rel`,`class`]}):``}function iS(e){return!e||typeof e!=`string`||!/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)?``:e}var aS=`
|
|
2117
2117
|
.gh-portal-back-sitetitle {
|
|
2118
2118
|
position: absolute;
|
|
2119
2119
|
top: 35px;
|
|
@@ -2480,7 +2480,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
|
|
|
2480
2480
|
transform: translateX(-50%);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
`,aS=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={name:``,email:``,plan:`free`,showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=_.createRef()}componentDidMount(){let{member:e}=this.context;e&&this.context.doAction(`switchPage`,{page:`accountHome`}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){let{site:e,pageQuery:t}=this.context,n=Cu({site:e,pageQuery:t}),r=this.getSelectedPriceId(n,this.state.plan);r!==this.state.plan&&this.setState({plan:r})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(e){let t=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!e.termsCheckboxChecked;return{...Sb({fields:this.getInputFields({state:e})}),checkbox:t}}doSignup(){this.setState(e=>({errors:this.getFormErrors(e)}),()=>{let{site:e,doAction:t}=this.context,{name:n,email:r,plan:i,phonenumber:a,token:o,errors:s}=this.state,c=s&&Object.values(s).filter(e=>!!e).length>0,l={...s};delete l.checkbox,s?.checkbox&&Object.values(l).every(e=>!e)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:`smooth`,block:`center`}),c||(pu({site:e})?this.setState({showNewsletterSelection:!0,pageData:{name:n,email:r,plan:i,phonenumber:a,token:o},errors:{}}):(this.setState({errors:{}}),t(`signup`,{name:n,email:r,phonenumber:a,plan:i,token:o})))})}handleSignup(e){e.preventDefault(),this.doSignup()}handleChooseSignup(e,t){e.preventDefault(),this.setState({plan:t},()=>{this.doSignup()})}handleInputChange(e,t){let n=t.name,r=e.target.value;this.setState({[n]:r})}handleSelectPlan=(e,t)=>{e&&e.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:t}))},5)};onKeyDown(e){e.keyCode===13&&this.handleSignup(e)}getSelectedPriceId(e=[],t){return!e||e.length===0||t===`free`?`free`:e.some(e=>e.id===t)?t:e[0].id||`free`}getInputFields({state:e,fieldNames:t}){let{site:{portal_name:n}}=this.context,r=e.errors||{},i=[{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,tabIndex:2,errorMessage:r.email||``},{type:`text`,value:e.phonenumber,placeholder:K(`+1 (123) 456-7890`),label:K(`Phone number`),name:`phonenumber`,required:!1,tabIndex:-1,autoComplete:`off`,hidden:!0}];return n&&i.unshift({type:`text`,value:e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,required:!0,tabIndex:1,errorMessage:r.name||``}),i[0].autoFocus=!0,t&&t.length>0?i.filter(e=>t.includes(e.name)):i}renderSignupTerms(){let{site:e}=this.context;if(e.portal_signup_terms_html===null||e.portal_signup_terms_html===``)return null;let t=e=>{this.setState({termsCheckboxChecked:e.target.checked})},n=(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-content`,dangerouslySetInnerHTML:{__html:nS(e.portal_signup_terms_html)}}),r=e.portal_signup_checkbox_required?(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:!!this.state.termsCheckboxChecked,required:!0,onChange:t}),(0,q.jsx)(`span`,{className:`checkbox`}),n]}):n;return(0,q.jsx)(`div`,{className:`gh-portal-signup-terms ${this.state.errors?.checkbox?`gh-portal-error`:``}`,onClick:wb,ref:this.termsRef,children:r})}renderSubmitButton(){let{action:e,site:t,brandColor:n,pageQuery:r}=this.context;if(Ul({site:t})||!Wl({site:t,pageQuery:r}))return null;let i=K(`Continue`),a=r===`free`&&Yl({site:t});if(zl({site:t})||a)i=K(`Sign up`);else return null;let o=!1;e===`signup:running`&&(i=K(`Sending...`),o=!0);let s=!1;return e===`signup:failed`&&(i=K(`Retry`),s=!0),(0,q.jsx)(df,{style:{width:`100%`},retry:s,onClick:e=>this.handleSignup(e),disabled:e===`signup:running`,brandColor:n,label:i,isRunning:o,tabIndex:3})}renderProducts(){let{site:e,pageQuery:t}=this.context,n=ru({site:e,pageQuery:t}),r=this.state.errors||{},i={};return Object.keys(r).length>0&&this.state.plan&&(i[this.state.plan]=K(`Please fill in required fields`)),(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(Nh,{handleChooseSignup:(...e)=>this.handleChooseSignup(...e),products:n,onPlanSelect:this.handleSelectPlan,errors:i})})}renderFreeTrialMessage(){let{site:e,pageQuery:t}=this.context;return iu({site:e,pageQuery:t})&&!Ul({site:e})&&Wl({site:e,pageQuery:t})?(0,q.jsx)(`p`,{className:`gh-portal-free-trial-notification`,"data-testid":`free-trial-notification-text`,children:K(`After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.`)}):null}renderLoginMessage({showGiftPromotion:e=!0}={}){let{brandColor:t,doAction:n}=this.context;return(0,q.jsxs)(`div`,{children:[this.renderFreeTrialMessage(),(0,q.jsxs)(`div`,{className:`gh-portal-signup-message gh-portal-signup-message-stack`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-signup-message-row`,children:[(0,q.jsx)(`div`,{children:K(`Already a member?`)}),(0,q.jsx)(`button`,{"data-test-button":`signin-switch`,"data-testid":`signin-switch`,className:`gh-portal-btn gh-portal-btn-link`,style:{color:t},onClick:()=>n(`switchPage`,{page:`signin`}),children:(0,q.jsx)(`span`,{children:K(`Sign in`)})})]}),e&&(0,q.jsx)(Pf,{className:`gh-portal-signup-message-row`,lastPage:`signup`})]})]})}renderForm(){let e=this.getInputFields({state:this.state}),{site:t,pageQuery:n}=this.context;if(this.state.showNewsletterSelection)return(0,q.jsx)(yb,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Ul({site:t}))return this.renderInviteOnlyMessage();if(Hl({site:t})&&n===`free`)return this.renderPaidMembersOnlyMessage();if(!Jl({site:t})||!Wl({site:t,pageQuery:n}))return ql({site:t})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();let r=n===`free`&&Yl({site:t}),i=zl({site:t})||r,a=this.renderSignupTerms();return(0,q.jsx)(`section`,{className:`gh-portal-signup`,children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsx)(tm,{fields:e,onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:e=>this.onKeyDown(e)})}),(0,q.jsxs)(`div`,{children:[i?(0,q.jsxs)(q.Fragment,{children:[this.renderProducts(),a&&(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper free-only`,children:a})]}):(0,q.jsxs)(q.Fragment,{children:[a&&(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper`,children:a}),this.renderProducts()]}),i?(0,q.jsx)(`div`,{className:`gh-portal-btn-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container`,children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-paid-members-only-notification`,"data-testid":`paid-members-only-notification-text`,children:K(`This site only accepts paid members.`)}),this.renderLoginMessage({showGiftPromotion:!1})]})})}renderInviteOnlyMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-invite-only-notification`,"data-testid":`invite-only-notification-text`,children:K(`This site is invite-only, contact the owner for access.`)}),this.renderLoginMessage({showGiftPromotion:!1})]})})}renderMembersDisabledMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-members-disabled-notification`,"data-testid":`members-disabled-notification-text`,children:K(`Memberships unavailable, contact the owner for access.`)})})})}renderSiteIcon(){let{site:e,pageQuery:t}=this.context,n=e.icon;return n?(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n,alt:e.title}):!Wl({site:e,pageQuery:t})||Ul({site:e})||!Jl({site:e})?(0,q.jsx)(Cb,{className:`gh-portal-icon gh-portal-icon-invitation`}):null}renderFormHeader(){let{site:e}=this.context,t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-signup-header`,children:[this.renderSiteIcon(),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,"data-testid":`site-title-text`,children:t})]})}getClassNames(){let{site:e,pageQuery:t}=this.context,n=Cu({site:e,pageQuery:t}),r=this.getInputFields({state:this.state}),i=``,a=``;return(n.length<=1||Ul({site:e}))&&(n.length===1&&n[0].type===`free`||Ul({site:e,pageQuery:t})?(i=cu({site:e})?`singleplan`:`noplan`,r.length===1&&(i=`single-field`),Ul({site:e})&&(a=`invite-only`,i=`invite-only`)):i=`singleplan`),{sectionClass:i,footerClass:a}}render(){let{sectionClass:e}=this.getClassNames();return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-back-sitetitle`,children:(0,q.jsx)(hb,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction(`closePopup`)}})}),(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-content signup `+e,children:[this.renderFormHeader(),this.renderForm()]})]})}},oS=()=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,q.jsx)(`polyline`,{points:`6 9 12 15 18 9`})}),sS=({description:e,benefits:t,showDetails:n,onToggle:r})=>{let i=(t||[]).map((e,t)=>{let n=typeof e==`string`?e:e?.name,r=typeof e==`string`?e:e?.id||`gift-benefit-${t}`;return n?(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-benefit`,children:[(0,q.jsx)(gh,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:n})]},r):null}).filter(Boolean);return!e&&i.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-details`,"data-open":n,"aria-hidden":!n,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-details-inner`,children:[e&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-details-description`,children:e}),i.length>0&&(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-benefits`,children:i})]})}),(0,q.jsxs)(`button`,{type:`button`,className:`gh-portal-gift-checkout-details-toggle`+(n?` is-open`:``),onClick:r,"aria-expanded":n,children:[K(n?`Hide details`:`Gift details`),(0,q.jsx)(oS,{})]})]})},cS=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-mail-icon lucide-mail`,...e,children:[(0,q.jsx)(`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`}),(0,q.jsx)(`rect`,{x:2,y:4,width:20,height:16,rx:2})]}),lS=e=>typeof e.userAgentData?.platform==`string`?e.userAgentData.platform===`Android`:/android/i.test(e.userAgent),uS=e=>/chrome/i.test(e.userAgent),dS=e=>lS(e)&&uS(e),fS=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,pS=(0,q.jsx)(`svg`,{height:`24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 49.4 512 399.4200000000001`,children:(0,q.jsxs)(`g`,{fill:`none`,fillRule:`evenodd`,children:[(0,q.jsxs)(`g`,{fillRule:`nonzero`,children:[(0,q.jsx)(`path`,{d:`M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z`,fill:`#4285f4`}),(0,q.jsx)(`path`,{d:`M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z`,fill:`#34a853`}),(0,q.jsx)(`path`,{d:`M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z`,fill:`#fbbc04`})]}),(0,q.jsx)(`path`,{d:`M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z`,fill:`#ea4335`}),(0,q.jsx)(`path`,{d:`M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z`,fill:`#c5221f`,fillRule:`nonzero`})]})}),mS=(0,q.jsx)(`svg`,{clipRule:`evenodd`,fillRule:`evenodd`,height:`2500`,imageRendering:`optimizeQuality`,shapeRendering:`geometricPrecision`,textRendering:`geometricPrecision`,viewBox:`0 0 6876 6994`,width:`2457`,xmlns:`http://www.w3.org/2000/svg`,children:(0,q.jsx)(`path`,{d:`M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z`,fill:`#0072c6`})}),hS=(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 3386.34 3010.5`,shapeRendering:`geometricPrecision`,textRendering:`geometricPrecision`,imageRendering:`optimizeQuality`,fillRule:`evenodd`,clipRule:`evenodd`,children:(0,q.jsx)(`path`,{d:`M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z`,fill:`#5f01d1`,fillRule:`nonzero`})}),gS=(0,q.jsxs)(`svg`,{viewBox:`0 0 512 512`,xmlns:`http://www.w3.org/2000/svg`,fillRule:`evenodd`,clipRule:`evenodd`,strokeLinejoin:`round`,strokeMiterlimit:`2`,children:[(0,q.jsx)(`path`,{d:`M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z`,fill:`url(#prefix___Linear1)`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsx)(`path`,{d:`M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z`,fill:`url(#prefix___Radial2)`,fillRule:`nonzero`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsx)(`path`,{d:`M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z`,fill:`url(#prefix___Linear3)`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsxs)(`defs`,{children:[(0,q.jsxs)(`linearGradient`,{id:`prefix___Linear1`,x1:`0`,y1:`0`,x2:`1`,y2:`0`,gradientUnits:`userSpaceOnUse`,gradientTransform:`scale(-43.6455) rotate(73.941 .222 -.49)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#7341ff`})]}),(0,q.jsxs)(`linearGradient`,{id:`prefix___Linear3`,x1:`0`,y1:`0`,x2:`1`,y2:`0`,gradientUnits:`userSpaceOnUse`,gradientTransform:`scale(-66.0342) rotate(65.129 .243 -.95)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`.27`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#7341ff`})]}),(0,q.jsxs)(`radialGradient`,{id:`prefix___Radial2`,cx:`0`,cy:`0`,r:`1`,gradientUnits:`userSpaceOnUse`,gradientTransform:`matrix(35.9848 0 0 33.9185 30.723 11.814)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#6d4aff`}),(0,q.jsx)(`stop`,{offset:`.56`,stopColor:`#6d4aff`}),(0,q.jsx)(`stop`,{offset:`.99`,stopColor:`#aa8eff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#aa8eff`})]})]})]}),_S=(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`2500`,height:`2432`,viewBox:`85.04 232.402 412.912 401.703`,children:[(0,q.jsx)(`path`,{d:`M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z`,fill:`#333`}),(0,q.jsx)(`path`,{d:`M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z`,fill:`#333`}),(0,q.jsx)(`path`,{d:`M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z`,fill:`#e4e4e4`})]}),vS=(0,q.jsx)(cS,{className:`gh-portal-inbox-link-icon`}),yS={gmail:pS,outlook:mS,yahoo:hS,proton:gS,icloud:_S,hey:vS,aol:vS,mailru:vS,feedbin:(0,q.jsxs)(`svg`,{className:`gh-portal-inbox-link-icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 183.436 170.826`,children:[(0,q.jsx)(`path`,{d:`M183.432,89.959c-0.048-3.063-0.497-6.082-1.334-8.975c-0.901-3.114-2.23-6.177-3.96-9.13 c1.092-6.758,0.659-13.689-1.293-20.634c-1.09-3.878-2.657-7.671-4.658-11.274c-1.858-3.346-4.149-6.63-6.808-9.762 c-2.993-3.525-6.414-6.812-10.168-9.771c-3.486-2.747-7.374-5.301-11.558-7.591c-7.209-3.946-14.975-7.019-23.083-9.133 c-7.625-1.988-15.79-3.189-24.268-3.569C94.507,0.041,92.693,0,90.909,0c-5.665,0-11.351,0.411-16.901,1.223 c-4.65,0.68-9.204,1.621-13.534,2.798c-4.53,1.231-8.963,2.759-13.178,4.543c-4.808,2.035-9.322,4.378-13.417,6.965 c-4.412,2.787-8.502,5.96-12.158,9.43c-2.899,2.752-5.481,5.651-7.674,8.618c-2.396,3.241-4.419,6.682-6.011,10.228 C3.237,54.494,2.171,65.255,4.855,75.84c-1.278,2-2.296,3.965-3.088,5.95c-0.592,1.485-1.401,3.773-1.596,6.482 c-0.317,4.391-0.128,7.032,0.042,8.637c0.333,3.151,1.017,5.92,2.092,8.466c0.876,2.076,2.015,3.983,3.401,5.698 c-0.004,5.271,0.282,9.628,0.896,13.697c1.658,10.979,6.794,20.282,15.266,27.651c4.024,3.5,8.628,6.417,14.075,8.919 c5.796,2.662,12.181,4.704,19.522,6.243c8.669,1.818,17.734,2.833,27.715,3.104c3.439,0.093,6.638,0.139,9.78,0.139 c9.007,0,17.141-0.382,24.867-1.166c6.781-0.689,12.409-1.619,17.71-2.928c6.693-1.652,12.44-3.876,17.568-6.798 c8.917-5.081,15.441-12.349,19.391-21.602c2.111-4.945,3.553-10.188,4.41-16.029c0.666-4.539,0.908-9.172,0.735-14.094 c0.853-0.902,1.612-1.88,2.272-2.926c1.256-1.991,2.15-4.232,2.657-6.659C183.186,95.673,183.476,92.758,183.432,89.959z`,fill:`#fff`}),(0,q.jsx)(`path`,{d:`M173.954,83.388c-0.899-3.108-2.287-5.99-4.047-8.692c-0.474-0.728-0.658-1.389-0.47-2.279 c1.343-6.341,0.995-12.63-0.755-18.853c-1.889-6.72-5.305-12.61-9.8-17.904c-5.448-6.416-12.031-11.427-19.381-15.45 C125.884,12.754,111.195,9.212,95.77,8.519c-6.929-0.311-13.839,0.017-20.718,1.023c-8.509,1.244-16.751,3.418-24.674,6.771 c-8.536,3.613-16.346,8.365-23.092,14.769c-4.932,4.682-9.028,9.992-11.824,16.221c-4.232,9.425-5.189,19.102-2.002,29.042 c0.265,0.827,0.092,1.412-0.395,2.077c-1.489,2.036-2.795,4.184-3.733,6.539c-0.515,1.291-0.927,2.607-1.027,4.003 c-0.172,2.389-0.234,4.781,0.018,7.165c0.455,4.306,1.817,8.219,5.054,11.288c0.181,0.171,0.324,0.381,0.485,0.573 c0,1.019,0.002,2.025,0,3.03c-0.008,4.218,0.171,8.417,0.803,12.603c1.374,9.101,5.583,16.602,12.502,22.62 c3.637,3.163,7.719,5.63,12.088,7.636c5.688,2.612,11.646,4.38,17.759,5.662c8.651,1.814,17.416,2.691,26.234,2.93 c11.207,0.304,22.41,0.147,33.582-0.988c5.579-0.567,11.112-1.384,16.558-2.728c5.396-1.332,10.595-3.186,15.444-5.95 c7.244-4.128,12.584-9.967,15.861-17.644c1.912-4.478,3.125-9.158,3.831-13.971c0.724-4.938,0.85-9.899,0.54-14.875 c-0.035-0.559-0.005-1.122-0.005-1.68c0.277-0.229,0.509-0.441,0.761-0.624c2.407-1.746,3.853-4.108,4.456-6.994 C175.228,92.451,175.26,87.905,173.954,83.388z M25.87,54.851c1.457-4.008,3.659-7.581,6.39-10.84 c3.801-4.534,8.35-8.186,13.371-11.271c6.978-4.287,14.527-7.192,22.458-9.141c9.052-2.223,18.25-3.033,27.545-2.583 c11.875,0.575,23.304,3.097,34.088,8.223c3.31,1.573,6.398,3.515,9.185,5.907c2.226,1.91,4.011,4.165,5.223,6.852 c1.557,3.45,1.801,7.067,1.137,10.724c-1.438,7.927-5.544,14.206-12.025,18.963c-3.062,2.247-6.396,4.006-9.876,5.495 c-1.966,0.841-3.965,1.606-5.939,2.43c-0.695,0.29-1.378,0.621-2.033,0.992c-0.374,0.212-0.722,0.507-1.007,0.831 c-0.41,0.466-0.342,1.172,0.2,1.477c0.59,0.332,1.246,0.592,1.906,0.742c2.236,0.508,4.515,0.413,6.773,0.244 c6.232-0.464,12.355-1.564,18.35-3.342c4.801-1.424,9.319-3.445,13.369-6.433c0.198-0.146,0.428-0.252,0.649-0.365 c0.036-0.018,0.103,0.026,0.284,0.079c-0.133,0.339-0.239,0.679-0.393,0.995c-1.517,3.097-3.65,5.717-6.226,7.99 c-3.044,2.685-6.469,4.784-10.111,6.547c-5.639,2.73-11.577,4.576-17.678,5.911c-6.961,1.522-14.013,2.365-21.128,2.782 c-7.055,0.413-14.101,0.37-21.142-0.129c-9.633-0.683-19.127-2.177-28.327-5.23c-4.191-1.391-8.239-3.11-12.056-5.342 c-2.673-1.563-5.169-3.365-7.393-5.528c-3.469-3.373-5.944-7.326-6.877-12.122C23.6,64.645,24.112,59.687,25.87,54.851z M157.755,121.076c-0.765,3.911-2.589,7.332-5.152,10.365c-2.382,2.819-5.246,5.059-8.41,6.934c-4.693,2.78-9.76,4.638-15.008,6.032 c-5.789,1.537-11.68,2.494-17.637,3.108c-7.902,0.814-15.822,1.131-23.76,1.008c-6.677-0.103-13.335-0.525-19.946-1.496 c-6.928-1.017-13.722-2.574-20.219-5.257c-4.268-1.763-8.291-3.954-11.869-6.9c-4.679-3.852-8.141-8.547-9.866-14.42 c-0.66-2.245-1.048-4.533-1.006-6.881c0.006-0.362,0.071-0.724,0.115-1.144c0.59,0,1.084-0.05,1.565,0.009 c2.26,0.276,4.527,0.297,6.789,0.133c5.883-0.428,11.207,1.103,16.057,4.416c2.92,1.995,5.599,4.282,8.158,6.709 c2.009,1.906,3.968,3.864,5.939,5.81c2.301,2.271,4.848,4.199,7.756,5.633c3.268,1.612,6.71,2.52,10.369,2.454 c3.388-0.061,6.585-0.933,9.625-2.413c2.448-1.192,4.668-2.727,6.753-4.468c0.724-0.604,1.448-1.214,2.21-1.769 c3.767-2.747,7.981-3.55,12.536-2.84c2.558,0.399,5.01,1.201,7.488,1.914c2.355,0.678,4.713,1.375,7.111,1.867 c2.544,0.522,5.123,0.509,7.676-0.147c2.614-0.671,4.531-2.18,5.556-4.674c0.595-1.447,0.998-2.974,1.466-4.472 c0.393-1.26,0.705-2.546,1.139-3.791c1.144-3.281,3.408-5.363,6.808-6.175c2.739-0.654,5.479-1.301,8.331-1.978 c0.091,0.39,0.214,0.678,0.218,0.967C158.601,113.455,158.495,117.295,157.755,121.076z`,fill:`#000`})]}),"dev-mailpit":vS},bS=e=>{switch(e){case`gmail`:return K(`Open Gmail`);case`outlook`:return K(`Open Outlook`);case`yahoo`:return K(`Open Yahoo Mail`);case`proton`:return K(`Open Proton Mail`);case`icloud`:return K(`Open iCloud Mail`);case`hey`:return K(`Open Hey`);case`aol`:return K(`Open AOL Mail`);case`mailru`:return K(`Open Mail.ru`);case`feedbin`:return K(`Open Feedbin`);case`dev-mailpit`:return`Open Mailpit (development only)`;default:return K(`Open email`)}};function xS({inboxLinks:{android:e,desktop:t,provider:n}}){return(0,q.jsxs)(`a`,{href:dS(navigator)?e:t,target:`_blank`,rel:`noreferrer noopener`,className:`gh-portal-btn gh-portal-btn-inbox-link`,children:[fS(yS,n)??vS,(0,q.jsx)(`span`,{children:bS(n)})]})}var SS=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform===`MacIntel`&&e.maxTouchPoints>1,CS=`
|
|
2483
|
+
`,oS=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={name:``,email:``,plan:`free`,showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=_.createRef()}componentDidMount(){let{member:e}=this.context;e&&this.context.doAction(`switchPage`,{page:`accountHome`}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){let{site:e,pageQuery:t}=this.context,n=Cu({site:e,pageQuery:t}),r=this.getSelectedPriceId(n,this.state.plan);r!==this.state.plan&&this.setState({plan:r})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(e){let t=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!e.termsCheckboxChecked;return{...Cb({fields:this.getInputFields({state:e})}),checkbox:t}}doSignup(){this.setState(e=>({errors:this.getFormErrors(e)}),()=>{let{site:e,doAction:t}=this.context,{name:n,email:r,plan:i,phonenumber:a,token:o,errors:s}=this.state,c=s&&Object.values(s).filter(e=>!!e).length>0,l={...s};delete l.checkbox,s?.checkbox&&Object.values(l).every(e=>!e)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:`smooth`,block:`center`}),c||(pu({site:e})?this.setState({showNewsletterSelection:!0,pageData:{name:n,email:r,plan:i,phonenumber:a,token:o},errors:{}}):(this.setState({errors:{}}),t(`signup`,{name:n,email:r,phonenumber:a,plan:i,token:o})))})}handleSignup(e){e.preventDefault(),this.doSignup()}handleChooseSignup(e,t){e.preventDefault(),this.setState({plan:t},()=>{this.doSignup()})}handleInputChange(e,t){let n=t.name,r=e.target.value;this.setState({[n]:r})}handleSelectPlan=(e,t)=>{e&&e.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:t}))},5)};onKeyDown(e){e.keyCode===13&&this.handleSignup(e)}getSelectedPriceId(e=[],t){return!e||e.length===0||t===`free`?`free`:e.some(e=>e.id===t)?t:e[0].id||`free`}getInputFields({state:e,fieldNames:t}){let{site:{portal_name:n}}=this.context,r=e.errors||{},i=[{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,tabIndex:2,errorMessage:r.email||``},{type:`text`,value:e.phonenumber,placeholder:K(`+1 (123) 456-7890`),label:K(`Phone number`),name:`phonenumber`,required:!1,tabIndex:-1,autoComplete:`off`,hidden:!0}];return n&&i.unshift({type:`text`,value:e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,required:!0,tabIndex:1,errorMessage:r.name||``}),i[0].autoFocus=!0,t&&t.length>0?i.filter(e=>t.includes(e.name)):i}renderSignupTerms(){let{site:e}=this.context;if(e.portal_signup_terms_html===null||e.portal_signup_terms_html===``)return null;let t=e=>{this.setState({termsCheckboxChecked:e.target.checked})},n=(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-content`,dangerouslySetInnerHTML:{__html:rS(e.portal_signup_terms_html)}}),r=e.portal_signup_checkbox_required?(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:!!this.state.termsCheckboxChecked,required:!0,onChange:t}),(0,q.jsx)(`span`,{className:`checkbox`}),n]}):n;return(0,q.jsx)(`div`,{className:`gh-portal-signup-terms ${this.state.errors?.checkbox?`gh-portal-error`:``}`,onClick:Tb,ref:this.termsRef,children:r})}renderSubmitButton(){let{action:e,site:t,brandColor:n,pageQuery:r}=this.context;if(Ul({site:t})||!Wl({site:t,pageQuery:r}))return null;let i=K(`Continue`),a=r===`free`&&Yl({site:t});if(zl({site:t})||a)i=K(`Sign up`);else return null;let o=!1;e===`signup:running`&&(i=K(`Sending...`),o=!0);let s=!1;return e===`signup:failed`&&(i=K(`Retry`),s=!0),(0,q.jsx)(df,{style:{width:`100%`},retry:s,onClick:e=>this.handleSignup(e),disabled:e===`signup:running`,brandColor:n,label:i,isRunning:o,tabIndex:3})}renderProducts(){let{site:e,pageQuery:t}=this.context,n=ru({site:e,pageQuery:t}),r=this.state.errors||{},i={};return Object.keys(r).length>0&&this.state.plan&&(i[this.state.plan]=K(`Please fill in required fields`)),(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(Ph,{handleChooseSignup:(...e)=>this.handleChooseSignup(...e),products:n,onPlanSelect:this.handleSelectPlan,errors:i})})}renderFreeTrialMessage(){let{site:e,pageQuery:t}=this.context;return iu({site:e,pageQuery:t})&&!Ul({site:e})&&Wl({site:e,pageQuery:t})?(0,q.jsx)(`p`,{className:`gh-portal-free-trial-notification`,"data-testid":`free-trial-notification-text`,children:K(`After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.`)}):null}renderLoginMessage({showGiftPromotion:e=!0}={}){let{brandColor:t,doAction:n}=this.context;return(0,q.jsxs)(`div`,{children:[this.renderFreeTrialMessage(),(0,q.jsxs)(`div`,{className:`gh-portal-signup-message gh-portal-signup-message-stack`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-signup-message-row`,children:[(0,q.jsx)(`div`,{children:K(`Already a member?`)}),(0,q.jsx)(`button`,{"data-test-button":`signin-switch`,"data-testid":`signin-switch`,className:`gh-portal-btn gh-portal-btn-link`,style:{color:t},onClick:()=>n(`switchPage`,{page:`signin`}),children:(0,q.jsx)(`span`,{children:K(`Sign in`)})})]}),e&&(0,q.jsx)(Pf,{className:`gh-portal-signup-message-row`,lastPage:`signup`})]})]})}renderForm(){let e=this.getInputFields({state:this.state}),{site:t,pageQuery:n}=this.context;if(this.state.showNewsletterSelection)return(0,q.jsx)(bb,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Ul({site:t}))return this.renderInviteOnlyMessage();if(Hl({site:t})&&n===`free`)return this.renderPaidMembersOnlyMessage();if(!Jl({site:t})||!Wl({site:t,pageQuery:n}))return ql({site:t})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();let r=n===`free`&&Yl({site:t}),i=zl({site:t})||r,a=this.renderSignupTerms();return(0,q.jsx)(`section`,{className:`gh-portal-signup`,children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsx)(nm,{fields:e,onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:e=>this.onKeyDown(e)})}),(0,q.jsxs)(`div`,{children:[i?(0,q.jsxs)(q.Fragment,{children:[this.renderProducts(),a&&(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper free-only`,children:a})]}):(0,q.jsxs)(q.Fragment,{children:[a&&(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper`,children:a}),this.renderProducts()]}),i?(0,q.jsx)(`div`,{className:`gh-portal-btn-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-logged-out-form-container`,children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-paid-members-only-notification`,"data-testid":`paid-members-only-notification-text`,children:K(`This site only accepts paid members.`)}),this.renderLoginMessage({showGiftPromotion:!1})]})})}renderInviteOnlyMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-invite-only-notification`,"data-testid":`invite-only-notification-text`,children:K(`This site is invite-only, contact the owner for access.`)}),this.renderLoginMessage({showGiftPromotion:!1})]})})}renderMembersDisabledMessage(){return(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-members-disabled-notification`,"data-testid":`members-disabled-notification-text`,children:K(`Memberships unavailable, contact the owner for access.`)})})})}renderSiteIcon(){let{site:e,pageQuery:t}=this.context,n=e.icon;return n?(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n,alt:e.title}):!Wl({site:e,pageQuery:t})||Ul({site:e})||!Jl({site:e})?(0,q.jsx)(wb,{className:`gh-portal-icon gh-portal-icon-invitation`}):null}renderFormHeader(){let{site:e}=this.context,t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-signup-header`,children:[this.renderSiteIcon(),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,"data-testid":`site-title-text`,children:t})]})}getClassNames(){let{site:e,pageQuery:t}=this.context,n=Cu({site:e,pageQuery:t}),r=this.getInputFields({state:this.state}),i=``,a=``;return(n.length<=1||Ul({site:e}))&&(n.length===1&&n[0].type===`free`||Ul({site:e,pageQuery:t})?(i=cu({site:e})?`singleplan`:`noplan`,r.length===1&&(i=`single-field`),Ul({site:e})&&(a=`invite-only`,i=`invite-only`)):i=`singleplan`),{sectionClass:i,footerClass:a}}render(){let{sectionClass:e}=this.getClassNames();return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-back-sitetitle`,children:(0,q.jsx)(gb,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction(`closePopup`)}})}),(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-content signup `+e,children:[this.renderFormHeader(),this.renderForm()]})]})}},sS=()=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,q.jsx)(`polyline`,{points:`6 9 12 15 18 9`})}),cS=({description:e,benefits:t,showDetails:n,onToggle:r})=>{let i=(t||[]).map((e,t)=>{let n=typeof e==`string`?e:e?.name,r=typeof e==`string`?e:e?.id||`gift-benefit-${t}`;return n?(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-benefit`,children:[(0,q.jsx)(_h,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:n})]},r):null}).filter(Boolean);return!e&&i.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-details`,"data-open":n,"aria-hidden":!n,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-details-inner`,children:[e&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-details-description`,children:e}),i.length>0&&(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-benefits`,children:i})]})}),(0,q.jsxs)(`button`,{type:`button`,className:`gh-portal-gift-checkout-details-toggle`+(n?` is-open`:``),onClick:r,"aria-expanded":n,children:[K(n?`Hide details`:`Gift details`),(0,q.jsx)(sS,{})]})]})},lS=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-mail-icon lucide-mail`,...e,children:[(0,q.jsx)(`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`}),(0,q.jsx)(`rect`,{x:2,y:4,width:20,height:16,rx:2})]}),uS=e=>typeof e.userAgentData?.platform==`string`?e.userAgentData.platform===`Android`:/android/i.test(e.userAgent),dS=e=>/chrome/i.test(e.userAgent),fS=e=>uS(e)&&dS(e),pS=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,mS=(0,q.jsx)(`svg`,{height:`24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 49.4 512 399.4200000000001`,children:(0,q.jsxs)(`g`,{fill:`none`,fillRule:`evenodd`,children:[(0,q.jsxs)(`g`,{fillRule:`nonzero`,children:[(0,q.jsx)(`path`,{d:`M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z`,fill:`#4285f4`}),(0,q.jsx)(`path`,{d:`M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z`,fill:`#34a853`}),(0,q.jsx)(`path`,{d:`M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z`,fill:`#fbbc04`})]}),(0,q.jsx)(`path`,{d:`M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z`,fill:`#ea4335`}),(0,q.jsx)(`path`,{d:`M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z`,fill:`#c5221f`,fillRule:`nonzero`})]})}),hS=(0,q.jsx)(`svg`,{clipRule:`evenodd`,fillRule:`evenodd`,height:`2500`,imageRendering:`optimizeQuality`,shapeRendering:`geometricPrecision`,textRendering:`geometricPrecision`,viewBox:`0 0 6876 6994`,width:`2457`,xmlns:`http://www.w3.org/2000/svg`,children:(0,q.jsx)(`path`,{d:`M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z`,fill:`#0072c6`})}),gS=(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 3386.34 3010.5`,shapeRendering:`geometricPrecision`,textRendering:`geometricPrecision`,imageRendering:`optimizeQuality`,fillRule:`evenodd`,clipRule:`evenodd`,children:(0,q.jsx)(`path`,{d:`M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z`,fill:`#5f01d1`,fillRule:`nonzero`})}),_S=(0,q.jsxs)(`svg`,{viewBox:`0 0 512 512`,xmlns:`http://www.w3.org/2000/svg`,fillRule:`evenodd`,clipRule:`evenodd`,strokeLinejoin:`round`,strokeMiterlimit:`2`,children:[(0,q.jsx)(`path`,{d:`M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z`,fill:`url(#prefix___Linear1)`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsx)(`path`,{d:`M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z`,fill:`url(#prefix___Radial2)`,fillRule:`nonzero`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsx)(`path`,{d:`M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z`,fill:`url(#prefix___Linear3)`,transform:`matrix(13.8889 0 0 13.8889 6 6)`}),(0,q.jsxs)(`defs`,{children:[(0,q.jsxs)(`linearGradient`,{id:`prefix___Linear1`,x1:`0`,y1:`0`,x2:`1`,y2:`0`,gradientUnits:`userSpaceOnUse`,gradientTransform:`scale(-43.6455) rotate(73.941 .222 -.49)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#7341ff`})]}),(0,q.jsxs)(`linearGradient`,{id:`prefix___Linear3`,x1:`0`,y1:`0`,x2:`1`,y2:`0`,gradientUnits:`userSpaceOnUse`,gradientTransform:`scale(-66.0342) rotate(65.129 .243 -.95)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`.27`,stopColor:`#e3d9ff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#7341ff`})]}),(0,q.jsxs)(`radialGradient`,{id:`prefix___Radial2`,cx:`0`,cy:`0`,r:`1`,gradientUnits:`userSpaceOnUse`,gradientTransform:`matrix(35.9848 0 0 33.9185 30.723 11.814)`,children:[(0,q.jsx)(`stop`,{offset:`0`,stopColor:`#6d4aff`}),(0,q.jsx)(`stop`,{offset:`.56`,stopColor:`#6d4aff`}),(0,q.jsx)(`stop`,{offset:`.99`,stopColor:`#aa8eff`}),(0,q.jsx)(`stop`,{offset:`1`,stopColor:`#aa8eff`})]})]})]}),vS=(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`2500`,height:`2432`,viewBox:`85.04 232.402 412.912 401.703`,children:[(0,q.jsx)(`path`,{d:`M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z`,fill:`#333`}),(0,q.jsx)(`path`,{d:`M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z`,fill:`#333`}),(0,q.jsx)(`path`,{d:`M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z`,fill:`#e4e4e4`})]}),yS=(0,q.jsx)(lS,{className:`gh-portal-inbox-link-icon`}),bS={gmail:mS,outlook:hS,yahoo:gS,proton:_S,icloud:vS,hey:yS,aol:yS,mailru:yS,feedbin:(0,q.jsxs)(`svg`,{className:`gh-portal-inbox-link-icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 183.436 170.826`,children:[(0,q.jsx)(`path`,{d:`M183.432,89.959c-0.048-3.063-0.497-6.082-1.334-8.975c-0.901-3.114-2.23-6.177-3.96-9.13 c1.092-6.758,0.659-13.689-1.293-20.634c-1.09-3.878-2.657-7.671-4.658-11.274c-1.858-3.346-4.149-6.63-6.808-9.762 c-2.993-3.525-6.414-6.812-10.168-9.771c-3.486-2.747-7.374-5.301-11.558-7.591c-7.209-3.946-14.975-7.019-23.083-9.133 c-7.625-1.988-15.79-3.189-24.268-3.569C94.507,0.041,92.693,0,90.909,0c-5.665,0-11.351,0.411-16.901,1.223 c-4.65,0.68-9.204,1.621-13.534,2.798c-4.53,1.231-8.963,2.759-13.178,4.543c-4.808,2.035-9.322,4.378-13.417,6.965 c-4.412,2.787-8.502,5.96-12.158,9.43c-2.899,2.752-5.481,5.651-7.674,8.618c-2.396,3.241-4.419,6.682-6.011,10.228 C3.237,54.494,2.171,65.255,4.855,75.84c-1.278,2-2.296,3.965-3.088,5.95c-0.592,1.485-1.401,3.773-1.596,6.482 c-0.317,4.391-0.128,7.032,0.042,8.637c0.333,3.151,1.017,5.92,2.092,8.466c0.876,2.076,2.015,3.983,3.401,5.698 c-0.004,5.271,0.282,9.628,0.896,13.697c1.658,10.979,6.794,20.282,15.266,27.651c4.024,3.5,8.628,6.417,14.075,8.919 c5.796,2.662,12.181,4.704,19.522,6.243c8.669,1.818,17.734,2.833,27.715,3.104c3.439,0.093,6.638,0.139,9.78,0.139 c9.007,0,17.141-0.382,24.867-1.166c6.781-0.689,12.409-1.619,17.71-2.928c6.693-1.652,12.44-3.876,17.568-6.798 c8.917-5.081,15.441-12.349,19.391-21.602c2.111-4.945,3.553-10.188,4.41-16.029c0.666-4.539,0.908-9.172,0.735-14.094 c0.853-0.902,1.612-1.88,2.272-2.926c1.256-1.991,2.15-4.232,2.657-6.659C183.186,95.673,183.476,92.758,183.432,89.959z`,fill:`#fff`}),(0,q.jsx)(`path`,{d:`M173.954,83.388c-0.899-3.108-2.287-5.99-4.047-8.692c-0.474-0.728-0.658-1.389-0.47-2.279 c1.343-6.341,0.995-12.63-0.755-18.853c-1.889-6.72-5.305-12.61-9.8-17.904c-5.448-6.416-12.031-11.427-19.381-15.45 C125.884,12.754,111.195,9.212,95.77,8.519c-6.929-0.311-13.839,0.017-20.718,1.023c-8.509,1.244-16.751,3.418-24.674,6.771 c-8.536,3.613-16.346,8.365-23.092,14.769c-4.932,4.682-9.028,9.992-11.824,16.221c-4.232,9.425-5.189,19.102-2.002,29.042 c0.265,0.827,0.092,1.412-0.395,2.077c-1.489,2.036-2.795,4.184-3.733,6.539c-0.515,1.291-0.927,2.607-1.027,4.003 c-0.172,2.389-0.234,4.781,0.018,7.165c0.455,4.306,1.817,8.219,5.054,11.288c0.181,0.171,0.324,0.381,0.485,0.573 c0,1.019,0.002,2.025,0,3.03c-0.008,4.218,0.171,8.417,0.803,12.603c1.374,9.101,5.583,16.602,12.502,22.62 c3.637,3.163,7.719,5.63,12.088,7.636c5.688,2.612,11.646,4.38,17.759,5.662c8.651,1.814,17.416,2.691,26.234,2.93 c11.207,0.304,22.41,0.147,33.582-0.988c5.579-0.567,11.112-1.384,16.558-2.728c5.396-1.332,10.595-3.186,15.444-5.95 c7.244-4.128,12.584-9.967,15.861-17.644c1.912-4.478,3.125-9.158,3.831-13.971c0.724-4.938,0.85-9.899,0.54-14.875 c-0.035-0.559-0.005-1.122-0.005-1.68c0.277-0.229,0.509-0.441,0.761-0.624c2.407-1.746,3.853-4.108,4.456-6.994 C175.228,92.451,175.26,87.905,173.954,83.388z M25.87,54.851c1.457-4.008,3.659-7.581,6.39-10.84 c3.801-4.534,8.35-8.186,13.371-11.271c6.978-4.287,14.527-7.192,22.458-9.141c9.052-2.223,18.25-3.033,27.545-2.583 c11.875,0.575,23.304,3.097,34.088,8.223c3.31,1.573,6.398,3.515,9.185,5.907c2.226,1.91,4.011,4.165,5.223,6.852 c1.557,3.45,1.801,7.067,1.137,10.724c-1.438,7.927-5.544,14.206-12.025,18.963c-3.062,2.247-6.396,4.006-9.876,5.495 c-1.966,0.841-3.965,1.606-5.939,2.43c-0.695,0.29-1.378,0.621-2.033,0.992c-0.374,0.212-0.722,0.507-1.007,0.831 c-0.41,0.466-0.342,1.172,0.2,1.477c0.59,0.332,1.246,0.592,1.906,0.742c2.236,0.508,4.515,0.413,6.773,0.244 c6.232-0.464,12.355-1.564,18.35-3.342c4.801-1.424,9.319-3.445,13.369-6.433c0.198-0.146,0.428-0.252,0.649-0.365 c0.036-0.018,0.103,0.026,0.284,0.079c-0.133,0.339-0.239,0.679-0.393,0.995c-1.517,3.097-3.65,5.717-6.226,7.99 c-3.044,2.685-6.469,4.784-10.111,6.547c-5.639,2.73-11.577,4.576-17.678,5.911c-6.961,1.522-14.013,2.365-21.128,2.782 c-7.055,0.413-14.101,0.37-21.142-0.129c-9.633-0.683-19.127-2.177-28.327-5.23c-4.191-1.391-8.239-3.11-12.056-5.342 c-2.673-1.563-5.169-3.365-7.393-5.528c-3.469-3.373-5.944-7.326-6.877-12.122C23.6,64.645,24.112,59.687,25.87,54.851z M157.755,121.076c-0.765,3.911-2.589,7.332-5.152,10.365c-2.382,2.819-5.246,5.059-8.41,6.934c-4.693,2.78-9.76,4.638-15.008,6.032 c-5.789,1.537-11.68,2.494-17.637,3.108c-7.902,0.814-15.822,1.131-23.76,1.008c-6.677-0.103-13.335-0.525-19.946-1.496 c-6.928-1.017-13.722-2.574-20.219-5.257c-4.268-1.763-8.291-3.954-11.869-6.9c-4.679-3.852-8.141-8.547-9.866-14.42 c-0.66-2.245-1.048-4.533-1.006-6.881c0.006-0.362,0.071-0.724,0.115-1.144c0.59,0,1.084-0.05,1.565,0.009 c2.26,0.276,4.527,0.297,6.789,0.133c5.883-0.428,11.207,1.103,16.057,4.416c2.92,1.995,5.599,4.282,8.158,6.709 c2.009,1.906,3.968,3.864,5.939,5.81c2.301,2.271,4.848,4.199,7.756,5.633c3.268,1.612,6.71,2.52,10.369,2.454 c3.388-0.061,6.585-0.933,9.625-2.413c2.448-1.192,4.668-2.727,6.753-4.468c0.724-0.604,1.448-1.214,2.21-1.769 c3.767-2.747,7.981-3.55,12.536-2.84c2.558,0.399,5.01,1.201,7.488,1.914c2.355,0.678,4.713,1.375,7.111,1.867 c2.544,0.522,5.123,0.509,7.676-0.147c2.614-0.671,4.531-2.18,5.556-4.674c0.595-1.447,0.998-2.974,1.466-4.472 c0.393-1.26,0.705-2.546,1.139-3.791c1.144-3.281,3.408-5.363,6.808-6.175c2.739-0.654,5.479-1.301,8.331-1.978 c0.091,0.39,0.214,0.678,0.218,0.967C158.601,113.455,158.495,117.295,157.755,121.076z`,fill:`#000`})]}),"dev-mailpit":yS},xS=e=>{switch(e){case`gmail`:return K(`Open Gmail`);case`outlook`:return K(`Open Outlook`);case`yahoo`:return K(`Open Yahoo Mail`);case`proton`:return K(`Open Proton Mail`);case`icloud`:return K(`Open iCloud Mail`);case`hey`:return K(`Open Hey`);case`aol`:return K(`Open AOL Mail`);case`mailru`:return K(`Open Mail.ru`);case`feedbin`:return K(`Open Feedbin`);case`dev-mailpit`:return`Open Mailpit (development only)`;default:return K(`Open email`)}};function SS({inboxLinks:{android:e,desktop:t,provider:n}}){return(0,q.jsxs)(`a`,{href:fS(navigator)?e:t,target:`_blank`,rel:`noreferrer noopener`,className:`gh-portal-btn gh-portal-btn-inbox-link`,children:[pS(bS,n)??yS,(0,q.jsx)(`span`,{children:xS(n)})]})}var CS=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform===`MacIntel`&&e.maxTouchPoints>1,wS=`
|
|
2484
2484
|
.gh-portal-icon-envelope {
|
|
2485
2485
|
width: 44px;
|
|
2486
2486
|
margin: 12px 0 10px;
|
|
@@ -2546,7 +2546,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
|
|
|
2546
2546
|
line-height: 1.6em;
|
|
2547
2547
|
margin-bottom: 0;
|
|
2548
2548
|
}
|
|
2549
|
-
`,
|
|
2549
|
+
`,TS=`otc`,ES=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={[TS]:``,errors:{},isFocused:!1,showDetails:!1}}getDescriptionConfig(e){return{signin:{withOTC:K(`If you have an account, an email has been sent to {submittedEmailOrInbox}. Click the link inside or enter your code below.`,{submittedEmailOrInbox:e}),withoutOTC:K(`If you have an account, a login link has been sent to your inbox. If it doesn't arrive in 3 minutes, be sure to check your spam folder.`)},signup:K(`To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!`),gift:K(`Click the confirmation link in your inbox to finish redeeming your membership. If it doesn't arrive within 3 minutes, check your spam folder.`)}}getTranslatedDescription({lastPage:e,otcRef:t,submittedEmailOrInbox:n}){let r=this.getDescriptionConfig(n),i=[`signup`,`signin`,`gift`].includes(e)?e:`signin`;return i===`signup`?r.signup:i===`gift`?r.gift:t?r.signin.withOTC:r.signin.withoutOTC}renderFormHeader(){let{otcRef:e,pageData:t,lastPage:n}=this.context,r=t?.email?t.email:K(`your inbox`),i=K(`Now check your email!`),a=this.getTranslatedDescription({lastPage:n,otcRef:e,submittedEmailOrInbox:r});return(0,q.jsxs)(`section`,{className:`gh-portal-inbox-notification`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-header`,children:[(0,q.jsx)(lS,{className:`gh-portal-icon gh-portal-icon-envelope`}),(0,q.jsx)(`h2`,{className:`gh-portal-main-title`,children:i})]}),(0,q.jsx)(`p`,{children:a})]})}renderLoginMessage(){return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`div`,{style:{color:`#1d1d1d`,fontWeight:`bold`,cursor:`pointer`},onClick:()=>this.context.doAction(`switchPage`,{page:`signin`}),children:K(`Back to Log in`)})})}handleClose(){this.context.doAction(`closePopup`)}renderCloseButton(){let{inboxLinks:e}=this.context;return e&&!CS(navigator)?(0,q.jsx)(SS,{inboxLinks:e}):(0,q.jsx)(df,{style:{width:`100%`},onClick:e=>this.handleClose(e),brandColor:this.context.brandColor,label:K(`Close`)})}handleSubmit(e){e.preventDefault();let{action:t}=this.context;t!==`verifyOTC:running`&&this.doVerifyOTC()}doVerifyOTC(){let e=K(`Enter code above`);this.setState(t=>{let n=(t.otc||``).trim();return{errors:{[TS]:n?``:e}}},()=>{let{otc:e,errors:t}=this.state,{otcRef:n}=this.context,{redirect:r}=this.context.pageData??{};!(t&&Object.values(t).filter(e=>!!e).length>0)&&n&&this.context.doAction(`verifyOTC`,{otc:e,otcRef:n,redirect:r})})}handleInputChange(e,t){let n=t.name,r=e.target.value;if(n===TS){let e=r.replace(/[^0-9]/g,``);this.setState({[n]:e},()=>{e.length===6&&this.doVerifyOTC()})}else this.setState({[n]:r})}renderOTCForm(){let{action:e,actionErrorMessage:t,otcRef:n,inboxLinks:r}=this.context,i=this.state.errors||{};if(!n)return null;let a=e===`verifyOTC:running`,o=e===`verifyOTC:failed`,s=o&&t?t:i.otc;return(0,q.jsxs)(`form`,{onSubmit:e=>this.handleSubmit(e),children:[(0,q.jsxs)(`section`,{className:`gh-portal-section gh-portal-otp`,children:[(0,q.jsx)(`div`,{className:`gh-portal-otp-container ${this.state.isFocused&&`focused`} ${s&&`error`}`,children:(0,q.jsx)(`input`,{id:`input-${TS}`,className:`gh-portal-input ${this.state.otc&&`entry`} ${s&&`error`}`,placeholder:`––––––`,name:TS,type:`text`,value:this.state.otc,inputMode:`numeric`,maxLength:6,pattern:`[0-9]*`,autoComplete:`one-time-code`,autoCorrect:`off`,autoCapitalize:`off`,autoFocus:!0,"aria-label":K(`Code`),onChange:e=>this.handleInputChange(e,{name:TS}),onFocus:()=>this.setState({isFocused:!0}),onBlur:()=>this.setState({isFocused:!1})})}),s&&(0,q.jsx)(`div`,{className:`gh-portal-otp-error`,children:s})]}),(0,q.jsx)(`footer`,{className:`gh-portal-signin-footer gh-button-row`,children:r&&!CS(navigator)&&!this.state.otc?(0,q.jsx)(SS,{inboxLinks:r}):(0,q.jsx)(df,{style:{width:`100%`},onClick:e=>this.handleSubmit(e),brandColor:this.context.brandColor,label:K(a?`Verifying...`:`Continue`),isRunning:a,retry:o,disabled:a})})]})}renderGiftLayout(e){let{site:t,pageData:n,otcRef:r}=this.context,i=n?.gift,a=t?.icon,o=t?.title||``,s=n?.email?n.email:K(`your inbox`),c=K(`Now check your email!`),l=this.getTranslatedDescription({lastPage:`gift`,otcRef:r,submittedEmailOrInbox:s}),u=i.tier?.benefits||[],d=i.tier?.description||``,f=(n?.name||``).trim();return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-content giftRedemption`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-bg`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:c}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:l})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-redemption-form`,children:e?this.renderOTCForm():this.renderCloseButton()})]})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-stack`,"data-revealing":this.state.showDetails,children:[(0,q.jsx)(Sf,{duration:Gd(i),tierName:i.tier?.name,toName:f||null,fromName:i.buyer_name||null,siteIcon:a,siteTitle:o}),(0,q.jsx)(cS,{description:d,benefits:u,showDetails:this.state.showDetails,onToggle:()=>this.setState(e=>({showDetails:!e.showDetails}))})]})})})]})})]})}render(){let{otcRef:e,lastPage:t,pageData:n}=this.context,r=!!e;return t===`gift`&&n?.gift?this.renderGiftLayout(r):(0,q.jsxs)(`div`,{className:`gh-portal-content`,children:[(0,q.jsx)(vf,{}),this.renderFormHeader(),r?this.renderOTCForm():this.renderCloseButton()]})}},DS=`
|
|
2550
2550
|
.gh-portal-popupnotification {
|
|
2551
2551
|
right: 42px;
|
|
2552
2552
|
}
|
|
@@ -2561,7 +2561,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
|
|
|
2561
2561
|
max-width: calc(100% - 54px);
|
|
2562
2562
|
}
|
|
2563
2563
|
}
|
|
2564
|
-
`,
|
|
2564
|
+
`,OS=({hide:e=!1,onClose:t})=>e?null:(0,q.jsx)(`button`,{type:`button`,className:`gh-portal-notification-closebutton`,"aria-label":`Close notification`,onClick:t,children:(0,q.jsx)(Hd,{className:`gh-portal-notification-closeicon`,"aria-hidden":`true`})}),kS=({message:e,site:t})=>{let n=`mailto:${Ou({site:t})}`;return e?(0,q.jsx)(`p`,{children:e}):(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`An unexpected error occured. Please try again or <a>contact support</a> if the error persists.`),mapping:{a:(0,q.jsx)(`a`,{href:n,onClick:()=>{n&&window.open(n)}})}})})},AS=class extends _.Component{static contextType=J;constructor(){super(),this.state={className:``}}onAnimationEnd(e){let{popupNotification:t}=this.context,{type:n}=t||{};(e.animationName===`notification-slideout`||e.animationName===`notification-slideout-mobile`)&&(n===`stripe:billing-update`&&tf([`stripe`]),this.context.doAction(`clearPopupNotification`))}closeNotification(){this.context.doAction(`clearPopupNotification`)}componentDidUpdate(){let{popupNotification:e}=this.context;e.count!==this.state.notificationCount&&(clearTimeout(this.timeoutId),this.handlePopupNotification({popupNotification:e}))}handlePopupNotification({popupNotification:e}){if(this.setState({notificationCount:e.count}),e.autoHide){let{duration:t=2600}=e;this.timeoutId=setTimeout(()=>{this.setState(t=>t.className===`slideout`?{}:{className:`slideout`,notificationCount:e.count})},t)}}componentDidMount(){let{popupNotification:e}=this.context;this.handlePopupNotification({popupNotification:e})}componentWillUnmount(){clearTimeout(this.timeoutId)}render(){let{popupNotification:e,site:t}=this.context,{className:n}=this.state,{type:r,status:i,closeable:a,message:o}=e;return(0,q.jsxs)(`div`,{className:`gh-portal-notification gh-portal-popupnotification ${i?` ${i}`:``}${n?` ${n}`:``}`,"data-testid":i?`popup-notification-${i}`:`popup-notification`,onAnimationEnd:e=>this.onAnimationEnd(e),children:[i===`error`?(0,q.jsx)(Wd,{className:`gh-portal-notification-icon error`,alt:``}):(0,q.jsx)(Ud,{className:`gh-portal-notification-icon success`,alt:``}),(0,q.jsx)(kS,{type:r,status:i,message:o,site:t}),(0,q.jsx)(OS,{hide:!a,onClose:e=>this.closeNotification(e)})]})}},jS=()=>`
|
|
2565
2565
|
.gh-portal-offer {
|
|
2566
2566
|
padding-bottom: 0;
|
|
2567
2567
|
overflow: unset;
|
|
@@ -2698,7 +2698,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2698
2698
|
.gh-portal-offer .gh-portal-signup-terms.gh-portal-error {
|
|
2699
2699
|
margin: 0;
|
|
2700
2700
|
}
|
|
2701
|
-
`,jS=class extends _.Component{static contextType=J;constructor(e,t){super(e,t),this.state={name:t?.member?.name||``,email:t?.member?.email||``,plan:`free`,showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(e){let t=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!e.termsCheckboxChecked;return{...Sb({fields:this.getInputFields({state:e})}),checkbox:t}}getInputFields({state:e,fieldNames:t}){let{portal_name:n}=this.context.site,{member:r}=this.context,i=e.errors||{},a=[{type:`email`,value:r?.email||e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,disabled:!!r,required:!0,tabIndex:2,errorMessage:i.email||``}],o=!!n;return r&&!r?.name&&(o=!1),o&&a.unshift({type:`text`,value:r?.name||e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,disabled:!!r,required:!0,tabIndex:1,errorMessage:i.name||``}),a[0].autoFocus=!0,t&&t.length>0?a.filter(e=>t.includes(e.name)):a}renderSignupTerms(){let{site:e}=this.context;if(e.portal_signup_terms_html===null||e.portal_signup_terms_html===``)return null;let t=e=>{this.setState({termsCheckboxChecked:e.target.checked})},n=(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-content`,dangerouslySetInnerHTML:{__html:nS(e.portal_signup_terms_html)}}),r=e.portal_signup_checkbox_required?(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:!!this.state.termsCheckboxChecked,required:!0,onChange:t}),(0,q.jsx)(`span`,{className:`checkbox`}),n]}):n;return(0,q.jsx)(`div`,{className:`gh-portal-signup-terms ${this.state.errors?.checkbox?`gh-portal-error`:``}`,onClick:wb,children:r})}onKeyDown(e){e.keyCode===13&&this.handleSignup(e)}handleSignup(e){e.preventDefault();let{pageData:t,site:n,member:r}=this.context;if(!t||!t.tier)return null;let i=lu({site:n,productId:t.tier.id}),a=t.cadence===`month`?i.monthlyPrice:i.yearlyPrice;this.setState(e=>({errors:this.getFormErrors(e)}),()=>{let{doAction:e}=this.context,{name:i,email:o,phonenumber:s,errors:c}=this.state;if(!(c&&Object.values(c).filter(e=>!!e).length>0)){let c={name:i,email:o,plan:a?.id,offerId:t?.id,phonenumber:s};pu({site:n})&&!r?this.setState({showNewsletterSelection:!0,pageData:c,errors:{}}):(e(`signup`,c),this.setState({errors:{}}))}})}handleInputChange(e,t){let n=t.name,r=e.target.value;this.setState({[n]:r})}renderSiteLogo(){let{site:e}=this.context,t=e.icon,n={};return t?(n.backgroundImage=`url(${t})`,(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:t,alt:e.title})):null}renderFormHeader(){let{site:e}=this.context,t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-signup-header`,children:[this.renderSiteLogo(),(0,q.jsx)(`h2`,{className:`gh-portal-main-title`,children:t})]})}renderForm(){let e=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?(0,q.jsx)(yb,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(tm,{fields:e,onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:e=>this.onKeyDown(e)})})})}renderSubmitButton(){let{action:e,brandColor:t}=this.context,{pageData:n}=this.context,r=K(`Continue`);n.type===`trial`&&(r=K(`Start {amount}-day free trial`,{amount:n.amount}));let i=!1;e===`signup:running`&&(r=K(`Sending...`),i=!0);let a=!1;return e===`signup:failed`&&(r=K(`Retry`),a=!0),(0,q.jsx)(df,{style:{width:`100%`},retry:a,onClick:e=>this.handleSignup(e),disabled:e===`signup:running`,brandColor:t,label:r,isRunning:i,tabIndex:3,classes:`sticky bottom`})}renderLoginMessage(){let{member:e}=this.context;if(e)return null;let{brandColor:t,doAction:n,site:r,pageData:i}=this.context,a=new URL(`#/portal/offers/${i.id}`,r.url).href;return(0,q.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,q.jsx)(`div`,{children:K(`Already a member?`)}),(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-link`,style:{color:t},onClick:()=>n(`switchPage`,{page:`signin`,pageData:{redirect:a}}),children:(0,q.jsx)(`span`,{children:K(`Sign in`)})})]})}renderOfferTag(){let{pageData:e}=this.context;return e.amount<=0?(0,q.jsx)(q.Fragment,{}):e.type===`fixed`?(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} off`,{amount:`${ju(e.currency)}${Fu(e.amount/100,this.context.site?.locale)}`})}):e.type===`trial`?(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} days free`,{amount:e.amount})}):(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} off`,{amount:e.amount+`%`})})}renderBenefits({product:e}){let t=e.benefits||[];if(t?.length)return(0,q.jsx)(`div`,{className:`gh-portal-product-benefits`,children:t.map((e,t)=>(0,q.jsxs)(`div`,{className:`gh-portal-product-benefit`,children:[(0,q.jsx)(gh,{className:`gh-portal-benefit-checkmark`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`gh-portal-benefit-title`,children:e.name})]},`${e.name}-${t}`))})}getOriginalPrice({offer:e,product:t}){let n=e.cadence===`month`?t.monthlyPrice:t.yearlyPrice,r=Fu(n.amount/100,this.context.site?.locale);return`${ju(n.currency)}${r}/${Zu(e.cadence)}`}getOffAmount({offer:e}){return e.type===`fixed`?`${ju(e.currency)}${Fu(e.amount/100,this.context.site?.locale)}`:e.type===`percent`?`${e.amount}%`:e.type===`trial`?e.amount:``}renderOfferMessage({offer:e,product:t}){let n={forever:K(`{amount} off forever.`,{amount:this.getOffAmount({offer:e})}),firstPeriod:K(`{amount} off for first {period}.`,{amount:this.getOffAmount({offer:e}),period:Zu(e.cadence)}),firstNMonths:K(`{amount} off for first {number} months.`,{amount:this.getOffAmount({offer:e}),number:e.duration_in_months||``})},r=this.getOriginalPrice({offer:e,product:t}),i=K(`Renews at {price}.`,{price:r}),a=``,o=!1,s=e.duration;return s===`once`?(a=n.firstPeriod,o=!0):s===`forever`?a=n.forever:s===`repeating`&&(a=(e.duration_in_months||``)===1?n.firstPeriod:n.firstNMonths,o=!0),s===`trial`?(0,q.jsxs)(`p`,{className:`footnote`,"data-testid":`offer-message`,children:[K(`Try free for {amount} days, then {originalPrice}.`,{amount:e.amount,originalPrice:r}),` `,(0,q.jsx)(`span`,{className:`gh-portal-cancel`,children:K(`Cancel anytime.`)})]}):(0,q.jsxs)(`p`,{className:`footnote`,"data-testid":`offer-message`,children:[a,` `,o?i:``]})}renderProductLabel({product:e,offer:t}){return(0,q.jsxs)(`h4`,{className:`gh-portal-plan-name`,children:[e.name,` - `,t.cadence===`month`?K(`Monthly`):K(`Yearly`)]})}renderUpdatedTierPrice({offer:e,currencyClass:t,updatedPrice:n,price:r}){return e.type===`trial`?(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer offer-type-trial`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,"data-testid":`offer-updated-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign `+t,children:ju(r.currency)}),(0,q.jsx)(`span`,{className:`amount`,children:Fu(n,this.context.site?.locale)})]})}):(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,"data-testid":`offer-updated-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign `+t,children:ju(r.currency)}),(0,q.jsx)(`span`,{className:`amount`,children:Fu(n,this.context.site?.locale)})]})})}renderOldTierPrice({offer:e,price:t}){return e.type===`trial`?null:(0,q.jsxs)(`div`,{className:`gh-portal-offer-oldprice`,children:[ju(t.currency),` `,Fu(t.amount/100,this.context.site?.locale)]})}renderProductCard({product:e,offer:t,currencyClass:n,updatedPrice:r,price:i,benefits:a}){return this.state.showNewsletterSelection?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-product-card top`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsxs)(`h4`,{className:`gh-portal-product-name`,children:[e.name,` - `,t.cadence===`month`?K(`Monthly`):K(`Yearly`)]}),this.renderOldTierPrice({offer:t,price:i}),this.renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:r,price:i}),this.renderOfferMessage({offer:t,product:e,price:i})]})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-product-card bottom`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[e.description?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,children:e.description}):``,a.length?this.renderBenefits({product:e}):``]})}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-container sticky m32`,children:[(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper`,children:this.renderSignupTerms()}),this.renderSubmitButton()]}),this.renderLoginMessage()]})]})}render(){let{pageData:e,site:t}=this.context;if(!e||!e.tier)return null;let n=lu({site:t,productId:e.tier.id});if(!n)return null;let r=e.cadence===`month`?n.monthlyPrice:n.yearlyPrice,i=Bu({offer:e,price:r}),a=n.benefits||[],o=ju(r.currency).length>1?`long`:``;return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-offer`,children:[(0,q.jsx)(vf,{}),this.renderFormHeader(),(0,q.jsxs)(`div`,{className:`gh-portal-offer-bar`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-offer-title`,children:[e.display_title?(0,q.jsx)(`h4`,{"data-testid":`offer-title`,children:e.display_title}):(0,q.jsx)(`h4`,{className:`placeholder`,"data-testid":`offer-title`,children:K(`Black Friday`)}),this.renderOfferTag()]}),e.display_description?(0,q.jsx)(`p`,{children:e.display_description}):``]}),this.renderForm(),this.renderProductCard({product:n,offer:e,currencyClass:o,updatedPrice:i,price:r,benefits:a})]})})}},MS=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 48 48`,...e,children:(0,q.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:3,d:`M42 26.572h-6.2A3.43 3.43 0 0 0 33.024 28l-8.31 12.771a2.92 2.92 0 0 1-3.587.967 2.875 2.875 0 0 1-1.609-3.366l1.5-5.656a3.36 3.36 0 0 0-1.788-3.895 3.438 3.438 0 0 0-1.5-.348H9.397a3.388 3.388 0 0 1-3.251-4.367v-.02l3.24-10.815v-.029c1.32-4.248 3.585-7.146 8.044-7.146 10.682 0 10.072-1.231 22.544 5.073.679.338 1.354.682 2.027 1.03v18.1`})}),NS=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 48 48`,...e,children:(0,q.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:3,d:`M6.002 21.429H12.2a3.432 3.432 0 0 0 2.777-1.43L23.29 7.23a2.916 2.916 0 0 1 3.586-.967A2.876 2.876 0 0 1 28.48 9.63l-1.497 5.652a3.36 3.36 0 0 0 1.787 3.897c.466.229.98.347 1.498.35h8.334a3.39 3.39 0 0 1 3.253 4.366v.02l-3.24 10.815v.027c-1.32 4.248-3.588 7.146-8.047 7.146-10.68 0-10.067 1.231-22.544-5.073-.675-.338-1.35-.684-2.025-1.026V18.002`})}),PS=e=>(0,q.jsxs)(`svg`,{width:96,height:56,viewBox:`0 0 96 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M9.00004 34.973C9.66499 35.3085 10.3322 35.6418 11.0017 35.9729C23.3405 42.0995 22.7366 40.9062 33.3011 40.9062C37.7115 40.9062 39.954 38.0862 41.2567 33.9563V33.9296L44.4627 23.4164V23.3964C44.6151 22.9038 44.6477 22.3828 44.5578 21.8756C44.4679 21.3683 44.2581 20.8888 43.9453 20.4757C43.6324 20.0626 43.2253 19.7275 42.7565 19.4972C42.2878 19.2669 41.7706 19.1479 41.2466 19.1498H33.0026C32.489 19.1484 31.9825 19.0325 31.5211 18.8108C31.0598 18.5891 30.6558 18.2673 30.3394 17.8698C30.025 17.4718 29.8084 17.0078 29.7066 16.5141C29.6048 16.0203 29.6205 15.51 29.7525 15.0232L31.235 9.5266C31.3503 9.09972 31.3609 8.65208 31.2659 8.2204C31.171 7.78873 30.9732 7.38533 30.6888 7.0433C30.4078 6.70494 30.0511 6.43489 29.6465 6.2542C29.2418 6.07351 28.8002 5.98706 28.3559 6.00157C27.9117 6.01609 27.4769 6.13118 27.0854 6.33789C26.6938 6.5446 26.3562 6.83734 26.0987 7.19329L17.8784 19.6098C17.5652 20.0388 17.1527 20.3885 16.6749 20.6301C16.1971 20.8718 15.6678 20.9985 15.1304 20.9998H9.00004M9 17.6666L9 40.9997`,stroke:`black`,strokeWidth:2.85,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,q.jsx)(`path`,{d:`M86.2148 20.027C85.5499 19.6915 84.8826 19.3582 84.2132 19.0271C71.8743 12.9005 72.4782 14.0938 61.9137 14.0938C57.5034 14.0938 55.2609 16.9138 53.9581 21.0437V21.0704L50.7521 31.5836V31.6036C50.5997 32.0962 50.5672 32.6172 50.657 33.1244C50.7469 33.6317 50.9567 34.1112 51.2695 34.5243C51.5824 34.9374 51.9896 35.2725 52.4583 35.5028C52.927 35.7331 53.4442 35.8521 53.9683 35.8502H62.2123C62.7258 35.8516 63.2324 35.9675 63.6937 36.1892C64.155 36.4109 64.5591 36.7327 64.8754 37.1302C65.1899 37.5282 65.4064 37.9922 65.5082 38.4859C65.61 38.9797 65.5943 39.49 65.4624 39.9768L63.9798 45.4734C63.8646 45.9003 63.854 46.3479 63.9489 46.7796C64.0439 47.2113 64.2416 47.6147 64.526 47.9567C64.807 48.2951 65.1637 48.5651 65.5684 48.7458C65.973 48.9265 66.4147 49.0129 66.8589 48.9984C67.3031 48.9839 67.7379 48.8688 68.1295 48.6621C68.521 48.4554 68.8587 48.1627 69.1162 47.8067L77.3364 35.3902C77.6497 34.9612 78.0622 34.6115 78.5399 34.3699C79.0177 34.1282 79.547 34.0015 80.0844 34.0002H86.2148M86.2148 37.3334V14.0003`,stroke:`black`,strokeWidth:2.85,strokeLinecap:`round`,strokeLinejoin:`round`})]}),FS=`/_fs-ch-`,IS=/\/_fs-ch-[\w-]+\//,LS=`/_fs-ch-1T1wmsGaOgGaSxcX/`,RS=`challenge.js`,zS=`data-challenge-status`,BS=60*1e3,VS=240*1e3,HS=[406,449],US=`Unable to verify your request, please try again`,WS=class extends Uc{constructor(){super(US,{code:`EDGE_CHALLENGE_FAILED`})}};function GS(e){return(e.headers?.get(`content-type`)||``).toLowerCase()}async function KS(e){if(!GS(e).includes(`text/html`))return null;let t;try{t=await e.clone().text()}catch{return null}return t.includes(FS)?`${t.match(IS)?.[0]||LS}${RS}`:null}async function qS(e){return await KS(e)!==null}function JS(e){return HS.includes(e.status)&&!GS(e).includes(`application/json`)}function YS(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!1}}var XS={position:`fixed`,top:`0`,left:`0`,width:`0`,height:`0`,border:`0`,zIndex:`4000000`},ZS={width:`100%`,height:`100%`,background:`rgba(0, 0, 0, 0.4)`},QS=`html,body{margin:0;height:100%;background:transparent}body{display:flex;align-items:center;justify-content:center}.fastly-challenge-close{position:fixed;top:16px;right:16px;width:40px;height:40px;border:0;border-radius:50%;background:#fff;color:#15212a;font:24px/1 sans-serif;cursor:pointer}`,$S=null;function eC(e=`${LS}${RS}`){return $S||($S=new Promise((t,n)=>{let r=new URL(e,window.location.origin).href,i=document.createElement(`iframe`);i.setAttribute(`aria-hidden`,`true`),i.setAttribute(`tabindex`,`-1`),Object.assign(i.style,XS),i.src=r;let a=Date.now(),o=null,s=null,c=!1,l=e=>{e.key===`Escape`&&u(new WS)},u=e=>{o?.disconnect(),clearTimeout(s),document.removeEventListener(`keydown`,l),i.remove(),$S=null,e?n(e):t()},d=e=>{let t=e.createElement(`button`);t.type=`button`,t.className=`fastly-challenge-close`,t.textContent=`×`,t.setAttribute(`aria-label`,K(`Close`)),t.addEventListener(`click`,()=>u(new WS)),e.body.appendChild(t),e.addEventListener(`keydown`,l),document.addEventListener(`keydown`,l),Object.assign(i.style,ZS),i.title=K(`Security verification`),i.removeAttribute(`aria-hidden`),i.removeAttribute(`tabindex`),i.focus()},f=()=>{let e=i.contentDocument;if(!e?.head||!e.body){u(new WS);return}e.head.replaceChildren(),e.body.replaceChildren();let t=e.createElement(`style`);t.textContent=QS,e.head.appendChild(t);let n=e.createElement(`div`);n.className=`fastly-challenge`,e.body.appendChild(n),o=new MutationObserver(()=>{let t=n.getAttribute(zS);t===`complete`?u():t===`error`?u(new WS):t===`captcha_prompted`&&!c&&(c=!0,d(e),clearTimeout(s),s=setTimeout(()=>u(new WS),VS-(Date.now()-a)))}),o.observe(n,{attributes:!0,attributeFilter:[zS]});let l=e.createElement(`script`);l.src=r,l.addEventListener(`error`,()=>u(new WS)),e.head.appendChild(l)},p=()=>{i.contentDocument?.URL!==`about:blank`&&(i.removeEventListener(`load`,p),f())};s=setTimeout(()=>u(new WS),BS),i.addEventListener(`load`,p),document.body.appendChild(i)}),$S)}async function tC(e,t){let n=await fetch(e,t);if(JS(n))throw new WS;let r=await KS(n);if(!r)return n;if(!YS(e))throw new WS;await eC(r);let i=await fetch(e,t);if(JS(i)||await qS(i))throw new WS;return i}function nC({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){function r({type:t,resource:n}){if(t===`members`)return`${e.replace(/\/$/,``)}/members/api/${n}/`}function i({resource:e,params:r={}}){if(t&&n){let i=new URLSearchParams({...r,key:n});return`${t.replace(/\/$/,``)}/${e}/?${i.toString()}`}return``}function a({url:e,method:t=`GET`,headers:n={},credentials:r=void 0,body:i=void 0,edgeChallenge:a=!1}){let o={method:t,headers:n,credentials:r,body:i};return a?tC(e,o):fetch(e,o)}let o={};o.site={read(){return a({url:r({type:`members`,resource:`site`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},newsletters(){return a({url:i({resource:`newsletters`,params:{limit:100}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},tiers(){return a({url:i({resource:`tiers`,params:{limit:100,include:`monthly_price,yearly_price,benefits,requirements`}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},settings(){return a({url:i({resource:`settings`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},offer({offerId:e}){return a({url:i({resource:`offers/${e}`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch offer data`)})},recommendations({limit:e=100}={limit:100}){return a({url:i({resource:`recommendations`,params:{limit:e}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch recommendations`)})}},o.feedback={async add({uuid:e,key:t,postId:n,score:i}){let o=r({type:`members`,resource:`feedback`});e&&t&&(o+=`?uuid=${e}&key=${t}`);let s=await a({url:o,method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify({feedback:[{post_id:n,score:i}]})});if(s.ok)return s.json();throw await Uc.fromApiResponse(s)??Error(`Failed to save feedback`)}};let s=async(e,t)=>{if(e.ok)return e.json();throw await Uc.fromApiResponse(e)||Error(t)};return o.gift={async fetchRedemptionData({token:e}){let t=await a({url:r({type:`members`,resource:`gifts/${encodeURIComponent(e)}/redeem`}),method:`GET`,headers:{"Content-Type":`application/json`},credentials:`same-origin`});return s(t,`Failed to load gift data`)},async redeem({token:e}){let t=await a({url:r({type:`members`,resource:`gifts/${encodeURIComponent(e)}/redeem`}),method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify({})});return s(t,`Failed to redeem gift`)}},o.recommendations={trackClicked({recommendationId:e}){let t=r({type:`members`,resource:`recommendations/`+e+`/clicked`});navigator.sendBeacon(t)},trackSubscribed({recommendationId:e}){let t=r({type:`members`,resource:`recommendations/`+e+`/subscribed`});navigator.sendBeacon(t)}},o.member={identity(){return a({url:r({type:`members`,resource:`session`}),credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.text()})},sessionData(){return a({url:r({type:`members`,resource:`member`}),credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.json()})},customFields(){return a({url:r({type:`members`,resource:`member/metafields/custom`}),credentials:`same-origin`}).then(function(e){return e.ok?e.json().then(e=>e.members_metafields).catch(()=>[]):[]})},update({name:e,subscribed:t,newsletters:n,enableCommentNotifications:i,enableUpdatesAndAnnouncements:o,metafields:s}){let c=r({type:`members`,resource:`member`}),l={name:e,subscribed:t,newsletters:n};return s!==void 0&&(l.metafields=s),i!==void 0&&(l.enable_comment_notifications=i),o!==void 0&&(l.enable_updates_and_announcements=o),a({url:c,method:`PUT`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(l)}).then(async function(e){if(!e.ok)throw await Uc.fromApiResponse(e)??Error(`Failed to update member`);return e.json()})},deleteSuppression(){return a({url:r({type:`members`,resource:`member/suppression`}),method:`DELETE`}).then(function(e){if(!e.ok)throw Error(`Your email has failed to resubscribe, please try again`);return!0})},async getIntegrityToken(){let e=await a({url:r({type:`members`,resource:`integrity-token`}),method:`GET`,edgeChallenge:!0});if(e.ok)return e.text();throw await Uc.fromApiResponse(e)||Error(`Failed to start a members session`)},async sendMagicLink({email:e,emailType:t,labels:n,name:i,oldEmail:o,newsletters:s,redirect:c,integrityToken:l,phonenumber:u,customUrlHistory:d,token:f,giftToken:p,autoRedirect:m=!0,includeOTC:h}){let g=r({type:`members`,resource:`send-magic-link`}),_={name:i,email:e,newsletters:s,oldEmail:o,emailType:t,labels:n,requestSrc:`portal`,redirect:c,integrityToken:l,honeypot:u,token:f,giftToken:p,autoRedirect:m,includeOTC:h},v=d??qu();v&&(_.urlHistory=v);let y=await a({url:g,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(_),edgeChallenge:!0});if(y.ok){if((y.headers.get(`content-type`)||``).toLowerCase().includes(`application/json`))try{return await y.json()}catch{}return{}}else throw await Uc.fromApiResponse(y)||Error(`Failed to send magic link email`)},async verifyOTC({otc:e,otcRef:t,redirect:n,integrityToken:i}){let o=await a({url:r({type:`members`,resource:`verify-otc`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({otc:e,otcRef:t,redirect:n,integrityToken:i})});if(o.ok)return await o.json();throw await Uc.fromApiResponse(o)||Error(`Failed to verify code`)},signout(t=!1){return a({url:r({type:`members`,resource:`session`}),method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({all:t})}).then(function(t){if(t.ok)return window.location.replace(e),`Success`;throw Error(`Failed to signout`)})},async newsletters({uuid:e,key:t}){let n=r({type:`members`,resource:`member/newsletters`});return n+=`?uuid=${e}&key=${t}`,a({url:n,credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.json()})},async updateNewsletters({uuid:e,newsletters:t,key:n,enableCommentNotifications:i,enableUpdatesAndAnnouncements:o}){let s=r({type:`members`,resource:`member/newsletters`});s+=`?uuid=${e}&key=${n}`;let c={newsletters:t};return i!==void 0&&(c.enable_comment_notifications=i),o!==void 0&&(c.enable_updates_and_announcements=o),a({url:s,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to update email preferences`)})},async updateEmailAddress({email:e}){let t=await o.member.identity();return a({url:r({type:`members`,resource:`member/email`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:e,identity:t})}).then(async function(e){if(e.ok)return`Success`;{let t=(await e.json())?.errors?.[0]?.message||`Failed to send email address verification email`;throw Error(t)}})},async checkoutPlan({plan:t,tierId:n,cadence:i,cancelUrl:s,successUrl:c,email:l,name:u,offerId:d,newsletters:f,metadata:p={}}={}){let m=new URL(e),h=await o.member.identity(),g=r({type:`members`,resource:`create-stripe-checkout-session`});if(!c){let t=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`success`),c=t.href}if(!s){let t=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`cancel`),s=t.href}let _={name:u,newsletters:JSON.stringify(f),requestSrc:`portal`,fp_tid:(window.FPROM||window.$FPROM)?.data?.tid,urlHistory:qu(),...p},v={priceId:d?null:t,offerId:d,identity:h,metadata:_,successUrl:c,cancelUrl:s};return l&&(v.customerEmail=l),n&&i&&(delete v.priceId,v.tierId=d?null:n,v.cadence=d?null:i),a({url:g,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(v)}).then(async function(e){if(!e.ok){let t=(await e.json())?.errors?.[0]||{},n=t.message||`Failed to signup, please try again.`,r=Error(n);throw r.code=t.code,r}return e.json()}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})})},async continueGiftCheckout(){let t=new URL(e),n=await o.member.identity(),i=r({type:`members`,resource:`create-stripe-checkout-session`}),s=window.location.href.startsWith(t.href)?new URL(window.location.href):new URL(e);s.searchParams.set(`stripe`,`success`);let c=window.location.href.startsWith(t.href)?new URL(window.location.href):new URL(e);c.searchParams.set(`stripe`,`cancel`);let l={type:`subscription`,continueFromGift:!0,identity:n,successUrl:s.href,cancelUrl:c.href,metadata:{checkoutType:`upgrade`,requestSrc:`portal`,urlHistory:qu()}};return a({url:i,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}).then(async function(e){if(!e.ok){let t=(await e.json())?.errors?.[0]?.message||`Failed to continue gift subscription, please try again.`;throw Error(t)}return e.json()}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})})},async checkoutGift({tierId:t,cadence:n,duration:i,email:s,deliveryMethod:c,recipientEmail:l,recipientName:u,buyerName:d,personalMessage:f,deliveryDate:p}={}){let m=new URL(e),h=r({type:`members`,resource:`create-stripe-checkout-session`}),g=null;try{g=await o.member.identity()}catch{}let _=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);_.hash=i===void 0?`#/portal/gift`:`#/portal/gift/delivery`;let v={identity:g,metadata:{requestSrc:`portal`},type:`gift`,tierId:t,...i===void 0?{cadence:n}:{duration:i},...c===void 0?{}:{deliveryMethod:c},...l?{recipientEmail:l}:{},...u?{recipientName:u}:{},...d?{buyerName:d}:{},...f?{personalMessage:f}:{},...p?{deliveryDate:p}:{},cancelUrl:_.href};s&&(v.customerEmail=s);let y=await a({url:h,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(v)}),b={};try{b=await y.json()}catch{}if(!y.ok)throw b?.errors?.[0]||Error(`Failed to process gift checkout, please try again.`);if(b.url)return window.location.assign(b.url);throw Error(`Failed to process gift checkout, please try again.`)},async checkoutDonation({successUrl:e,cancelUrl:t,metadata:n={},personalNote:i=``}={}){let s=await o.member.identity(),c=r({type:`members`,resource:`create-stripe-checkout-session`}),l={identity:s,metadata:{fp_tid:(window.FPROM||window.$FPROM)?.data?.tid,urlHistory:qu(),...n},successUrl:e,cancelUrl:t,type:`donation`,personalNote:i},u=await a({url:c,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}),d=await u.json();if(!u.ok)throw d?.errors?.[0]||Error(`We're unable to process your payment right now. Please try again later.`);return d},async editBilling({successUrl:t,cancelUrl:n,subscriptionId:i}={}){let s=new URL(e),c=await o.member.identity(),l=r({type:`members`,resource:`create-stripe-update-session`});if(!t){let n=new URL(e);n.searchParams.set(`stripe`,`billing-update-success`),t=n.href}if(!n){let t=window.location.href.startsWith(s.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`billing-update-cancel`),n=t.href}return a({url:l,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:c,subscription_id:i,successUrl:t,cancelUrl:n})}).then(function(e){if(!e.ok)throw Error(`Unable to create stripe checkout session`);return e.json()}).then(function(e){return window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId})}).then(function(e){if(e.error)throw Error(e.error.message)}).catch(function(e){throw e})},async manageBilling({returnUrl:t,subscriptionId:n}={}){let i=await o.member.identity(),s=r({type:`members`,resource:`create-stripe-billing-portal-session`});if(!t){let n=new URL(e);n.searchParams.set(`stripe`,`billing-portal-closed`),t=n.href}return a({url:s,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:i,subscription_id:n,returnUrl:t})}).then(function(e){if(!e.ok)throw Error(`Unable to create Stripe billing portal session`);return e.json()}).then(function(e){return window.location.assign(e.url)}).catch(function(e){throw e})},async updateSubscription({subscriptionId:e,tierId:t,cadence:n,planId:i,smartCancel:s,cancelAtPeriodEnd:c,cancellationReason:l,answers:u}){let d=await o.member.identity(),f=r({type:`members`,resource:`subscriptions`})+e+`/`,p={smart_cancel:s,cancel_at_period_end:c,cancellation_reason:l,identity:d,priceId:i,answers:u&&Object.keys(u).length>0?u:void 0};t&&n&&(delete p.priceId,p.tierId=t,p.cadence=n);let m=await a({url:f,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(p)});if(!m.ok)throw await Uc.fromApiResponse(m)??Error(`Failed to update subscription`);return m},async offers(){let e=await o.member.identity();return a({url:r({type:`members`,resource:`member/offers`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:e})}).then(function(e){return e.ok?e.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:e,subscriptionId:t}){let n=await o.member.identity(),i=await a({url:r({type:`members`,resource:`subscriptions/${t}/apply-offer`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:n,offer_id:e})});if(!i.ok){let e=await i.text();throw Error(e||`Failed to apply offer`)}return!0}},o.init=async()=>{let[e]=await Promise.all([o.member.sessionData()]),t={},n=[],r=[],i={},a=[];try{[{settings:i},{tiers:r},{newsletters:n}]=await Promise.all([o.site.settings(),o.site.tiers(),o.site.newsletters()]),t={...i,newsletters:n,tiers:Ku({tiers:r})}}catch{}if(e&&e.paid)try{a=(await o.member.offers()).offers||[]}catch(e){console.warn(`[Portal] Failed to load member offers:`,e)}return t=$l({site:t}),{site:t,member:e,offers:a}},o}var rC=class extends _.Component{render(){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,color:`#313131`},children:(0,q.jsx)(`div`,{style:{paddingLeft:`16px`,paddingRight:`16px`,paddingTop:`12px`,height:`50px`},children:(0,q.jsx)(cf,{className:`gh-portal-loadingicon dark`,"data-testid":`loaderIcon`})})})}},iC=`
|
|
2701
|
+
`,MS=class extends _.Component{static contextType=J;constructor(e,t){super(e,t),this.state={name:t?.member?.name||``,email:t?.member?.email||``,plan:`free`,showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(e){let t=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!e.termsCheckboxChecked;return{...Cb({fields:this.getInputFields({state:e})}),checkbox:t}}getInputFields({state:e,fieldNames:t}){let{portal_name:n}=this.context.site,{member:r}=this.context,i=e.errors||{},a=[{type:`email`,value:r?.email||e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,disabled:!!r,required:!0,tabIndex:2,errorMessage:i.email||``}],o=!!n;return r&&!r?.name&&(o=!1),o&&a.unshift({type:`text`,value:r?.name||e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,disabled:!!r,required:!0,tabIndex:1,errorMessage:i.name||``}),a[0].autoFocus=!0,t&&t.length>0?a.filter(e=>t.includes(e.name)):a}renderSignupTerms(){let{site:e}=this.context;if(e.portal_signup_terms_html===null||e.portal_signup_terms_html===``)return null;let t=e=>{this.setState({termsCheckboxChecked:e.target.checked})},n=(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-content`,dangerouslySetInnerHTML:{__html:rS(e.portal_signup_terms_html)}}),r=e.portal_signup_checkbox_required?(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:!!this.state.termsCheckboxChecked,required:!0,onChange:t}),(0,q.jsx)(`span`,{className:`checkbox`}),n]}):n;return(0,q.jsx)(`div`,{className:`gh-portal-signup-terms ${this.state.errors?.checkbox?`gh-portal-error`:``}`,onClick:Tb,children:r})}onKeyDown(e){e.keyCode===13&&this.handleSignup(e)}handleSignup(e){e.preventDefault();let{pageData:t,site:n,member:r}=this.context;if(!t||!t.tier)return null;let i=lu({site:n,productId:t.tier.id}),a=t.cadence===`month`?i.monthlyPrice:i.yearlyPrice;this.setState(e=>({errors:this.getFormErrors(e)}),()=>{let{doAction:e}=this.context,{name:i,email:o,phonenumber:s,errors:c}=this.state;if(!(c&&Object.values(c).filter(e=>!!e).length>0)){let c={name:i,email:o,plan:a?.id,offerId:t?.id,phonenumber:s};pu({site:n})&&!r?this.setState({showNewsletterSelection:!0,pageData:c,errors:{}}):(e(`signup`,c),this.setState({errors:{}}))}})}handleInputChange(e,t){let n=t.name,r=e.target.value;this.setState({[n]:r})}renderSiteLogo(){let{site:e}=this.context,t=e.icon,n={};return t?(n.backgroundImage=`url(${t})`,(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:t,alt:e.title})):null}renderFormHeader(){let{site:e}=this.context,t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-signup-header`,children:[this.renderSiteLogo(),(0,q.jsx)(`h2`,{className:`gh-portal-main-title`,children:t})]})}renderForm(){let e=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?(0,q.jsx)(bb,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(nm,{fields:e,onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:e=>this.onKeyDown(e)})})})}renderSubmitButton(){let{action:e,brandColor:t}=this.context,{pageData:n}=this.context,r=K(`Continue`);n.type===`trial`&&(r=K(`Start {amount}-day free trial`,{amount:n.amount}));let i=!1;e===`signup:running`&&(r=K(`Sending...`),i=!0);let a=!1;return e===`signup:failed`&&(r=K(`Retry`),a=!0),(0,q.jsx)(df,{style:{width:`100%`},retry:a,onClick:e=>this.handleSignup(e),disabled:e===`signup:running`,brandColor:t,label:r,isRunning:i,tabIndex:3,classes:`sticky bottom`})}renderLoginMessage(){let{member:e}=this.context;if(e)return null;let{brandColor:t,doAction:n,site:r,pageData:i}=this.context,a=new URL(`#/portal/offers/${i.id}`,r.url).href;return(0,q.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,q.jsx)(`div`,{children:K(`Already a member?`)}),(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-link`,style:{color:t},onClick:()=>n(`switchPage`,{page:`signin`,pageData:{redirect:a}}),children:(0,q.jsx)(`span`,{children:K(`Sign in`)})})]})}renderOfferTag(){let{pageData:e}=this.context;return e.amount<=0?(0,q.jsx)(q.Fragment,{}):e.type===`fixed`?(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} off`,{amount:`${ju(e.currency)}${Fu(e.amount/100,this.context.site?.locale)}`})}):e.type===`trial`?(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} days free`,{amount:e.amount})}):(0,q.jsx)(`h5`,{className:`gh-portal-discount-label`,"data-testid":`offer-discount-label`,children:K(`{amount} off`,{amount:e.amount+`%`})})}renderBenefits({product:e}){let t=e.benefits||[];if(t?.length)return(0,q.jsx)(`div`,{className:`gh-portal-product-benefits`,children:t.map((e,t)=>(0,q.jsxs)(`div`,{className:`gh-portal-product-benefit`,children:[(0,q.jsx)(_h,{className:`gh-portal-benefit-checkmark`,"aria-hidden":`true`}),(0,q.jsx)(`div`,{className:`gh-portal-benefit-title`,children:e.name})]},`${e.name}-${t}`))})}getOriginalPrice({offer:e,product:t}){let n=e.cadence===`month`?t.monthlyPrice:t.yearlyPrice,r=Fu(n.amount/100,this.context.site?.locale);return`${ju(n.currency)}${r}/${Zu(e.cadence)}`}getOffAmount({offer:e}){return e.type===`fixed`?`${ju(e.currency)}${Fu(e.amount/100,this.context.site?.locale)}`:e.type===`percent`?`${e.amount}%`:e.type===`trial`?e.amount:``}renderOfferMessage({offer:e,product:t}){let n={forever:K(`{amount} off forever.`,{amount:this.getOffAmount({offer:e})}),firstPeriod:K(`{amount} off for first {period}.`,{amount:this.getOffAmount({offer:e}),period:Zu(e.cadence)}),firstNMonths:K(`{amount} off for first {number} months.`,{amount:this.getOffAmount({offer:e}),number:e.duration_in_months||``})},r=this.getOriginalPrice({offer:e,product:t}),i=K(`Renews at {price}.`,{price:r}),a=``,o=!1,s=e.duration;return s===`once`?(a=n.firstPeriod,o=!0):s===`forever`?a=n.forever:s===`repeating`&&(a=(e.duration_in_months||``)===1?n.firstPeriod:n.firstNMonths,o=!0),s===`trial`?(0,q.jsxs)(`p`,{className:`footnote`,"data-testid":`offer-message`,children:[K(`Try free for {amount} days, then {originalPrice}.`,{amount:e.amount,originalPrice:r}),` `,(0,q.jsx)(`span`,{className:`gh-portal-cancel`,children:K(`Cancel anytime.`)})]}):(0,q.jsxs)(`p`,{className:`footnote`,"data-testid":`offer-message`,children:[a,` `,o?i:``]})}renderProductLabel({product:e,offer:t}){return(0,q.jsxs)(`h4`,{className:`gh-portal-plan-name`,children:[e.name,` - `,t.cadence===`month`?K(`Monthly`):K(`Yearly`)]})}renderUpdatedTierPrice({offer:e,currencyClass:t,updatedPrice:n,price:r}){return e.type===`trial`?(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer offer-type-trial`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,"data-testid":`offer-updated-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign `+t,children:ju(r.currency)}),(0,q.jsx)(`span`,{className:`amount`,children:Fu(n,this.context.site?.locale)})]})}):(0,q.jsx)(`div`,{className:`gh-portal-product-card-pricecontainer`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-price`,"data-testid":`offer-updated-price`,children:[(0,q.jsx)(`span`,{className:`currency-sign `+t,children:ju(r.currency)}),(0,q.jsx)(`span`,{className:`amount`,children:Fu(n,this.context.site?.locale)})]})})}renderOldTierPrice({offer:e,price:t}){return e.type===`trial`?null:(0,q.jsxs)(`div`,{className:`gh-portal-offer-oldprice`,children:[ju(t.currency),` `,Fu(t.amount/100,this.context.site?.locale)]})}renderProductCard({product:e,offer:t,currencyClass:n,updatedPrice:r,price:i,benefits:a}){return this.state.showNewsletterSelection?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`gh-portal-product-card top`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-header`,children:[(0,q.jsxs)(`h4`,{className:`gh-portal-product-name`,children:[e.name,` - `,t.cadence===`month`?K(`Monthly`):K(`Yearly`)]}),this.renderOldTierPrice({offer:t,price:i}),this.renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:r,price:i}),this.renderOfferMessage({offer:t,product:e,price:i})]})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-product-card bottom`,children:(0,q.jsxs)(`div`,{className:`gh-portal-product-card-detaildata`,children:[e.description?(0,q.jsx)(`div`,{className:`gh-portal-product-description`,children:e.description}):``,a.length?this.renderBenefits({product:e}):``]})}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-container sticky m32`,children:[(0,q.jsx)(`div`,{className:`gh-portal-signup-terms-wrapper`,children:this.renderSignupTerms()}),this.renderSubmitButton()]}),this.renderLoginMessage()]})]})}render(){let{pageData:e,site:t}=this.context;if(!e||!e.tier)return null;let n=lu({site:t,productId:e.tier.id});if(!n)return null;let r=e.cadence===`month`?n.monthlyPrice:n.yearlyPrice,i=Bu({offer:e,price:r}),a=n.benefits||[],o=ju(r.currency).length>1?`long`:``;return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-offer`,children:[(0,q.jsx)(vf,{}),this.renderFormHeader(),(0,q.jsxs)(`div`,{className:`gh-portal-offer-bar`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-offer-title`,children:[e.display_title?(0,q.jsx)(`h4`,{"data-testid":`offer-title`,children:e.display_title}):(0,q.jsx)(`h4`,{className:`placeholder`,"data-testid":`offer-title`,children:K(`Black Friday`)}),this.renderOfferTag()]}),e.display_description?(0,q.jsx)(`p`,{children:e.display_description}):``]}),this.renderForm(),this.renderProductCard({product:n,offer:e,currencyClass:o,updatedPrice:i,price:r,benefits:a})]})})}},NS=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 48 48`,...e,children:(0,q.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:3,d:`M42 26.572h-6.2A3.43 3.43 0 0 0 33.024 28l-8.31 12.771a2.92 2.92 0 0 1-3.587.967 2.875 2.875 0 0 1-1.609-3.366l1.5-5.656a3.36 3.36 0 0 0-1.788-3.895 3.438 3.438 0 0 0-1.5-.348H9.397a3.388 3.388 0 0 1-3.251-4.367v-.02l3.24-10.815v-.029c1.32-4.248 3.585-7.146 8.044-7.146 10.682 0 10.072-1.231 22.544 5.073.679.338 1.354.682 2.027 1.03v18.1`})}),PS=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 48 48`,...e,children:(0,q.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:3,d:`M6.002 21.429H12.2a3.432 3.432 0 0 0 2.777-1.43L23.29 7.23a2.916 2.916 0 0 1 3.586-.967A2.876 2.876 0 0 1 28.48 9.63l-1.497 5.652a3.36 3.36 0 0 0 1.787 3.897c.466.229.98.347 1.498.35h8.334a3.39 3.39 0 0 1 3.253 4.366v.02l-3.24 10.815v.027c-1.32 4.248-3.588 7.146-8.047 7.146-10.68 0-10.067 1.231-22.544-5.073-.675-.338-1.35-.684-2.025-1.026V18.002`})}),FS=e=>(0,q.jsxs)(`svg`,{width:96,height:56,viewBox:`0 0 96 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M9.00004 34.973C9.66499 35.3085 10.3322 35.6418 11.0017 35.9729C23.3405 42.0995 22.7366 40.9062 33.3011 40.9062C37.7115 40.9062 39.954 38.0862 41.2567 33.9563V33.9296L44.4627 23.4164V23.3964C44.6151 22.9038 44.6477 22.3828 44.5578 21.8756C44.4679 21.3683 44.2581 20.8888 43.9453 20.4757C43.6324 20.0626 43.2253 19.7275 42.7565 19.4972C42.2878 19.2669 41.7706 19.1479 41.2466 19.1498H33.0026C32.489 19.1484 31.9825 19.0325 31.5211 18.8108C31.0598 18.5891 30.6558 18.2673 30.3394 17.8698C30.025 17.4718 29.8084 17.0078 29.7066 16.5141C29.6048 16.0203 29.6205 15.51 29.7525 15.0232L31.235 9.5266C31.3503 9.09972 31.3609 8.65208 31.2659 8.2204C31.171 7.78873 30.9732 7.38533 30.6888 7.0433C30.4078 6.70494 30.0511 6.43489 29.6465 6.2542C29.2418 6.07351 28.8002 5.98706 28.3559 6.00157C27.9117 6.01609 27.4769 6.13118 27.0854 6.33789C26.6938 6.5446 26.3562 6.83734 26.0987 7.19329L17.8784 19.6098C17.5652 20.0388 17.1527 20.3885 16.6749 20.6301C16.1971 20.8718 15.6678 20.9985 15.1304 20.9998H9.00004M9 17.6666L9 40.9997`,stroke:`black`,strokeWidth:2.85,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,q.jsx)(`path`,{d:`M86.2148 20.027C85.5499 19.6915 84.8826 19.3582 84.2132 19.0271C71.8743 12.9005 72.4782 14.0938 61.9137 14.0938C57.5034 14.0938 55.2609 16.9138 53.9581 21.0437V21.0704L50.7521 31.5836V31.6036C50.5997 32.0962 50.5672 32.6172 50.657 33.1244C50.7469 33.6317 50.9567 34.1112 51.2695 34.5243C51.5824 34.9374 51.9896 35.2725 52.4583 35.5028C52.927 35.7331 53.4442 35.8521 53.9683 35.8502H62.2123C62.7258 35.8516 63.2324 35.9675 63.6937 36.1892C64.155 36.4109 64.5591 36.7327 64.8754 37.1302C65.1899 37.5282 65.4064 37.9922 65.5082 38.4859C65.61 38.9797 65.5943 39.49 65.4624 39.9768L63.9798 45.4734C63.8646 45.9003 63.854 46.3479 63.9489 46.7796C64.0439 47.2113 64.2416 47.6147 64.526 47.9567C64.807 48.2951 65.1637 48.5651 65.5684 48.7458C65.973 48.9265 66.4147 49.0129 66.8589 48.9984C67.3031 48.9839 67.7379 48.8688 68.1295 48.6621C68.521 48.4554 68.8587 48.1627 69.1162 47.8067L77.3364 35.3902C77.6497 34.9612 78.0622 34.6115 78.5399 34.3699C79.0177 34.1282 79.547 34.0015 80.0844 34.0002H86.2148M86.2148 37.3334V14.0003`,stroke:`black`,strokeWidth:2.85,strokeLinecap:`round`,strokeLinejoin:`round`})]}),IS=`/_fs-ch-`,LS=/\/_fs-ch-[\w-]+\//,RS=`/_fs-ch-1T1wmsGaOgGaSxcX/`,zS=`challenge.js`,BS=`data-challenge-status`,VS=60*1e3,HS=240*1e3,US=[406,449],WS=`Unable to verify your request, please try again`,GS=class extends Uc{constructor(){super(WS,{code:`EDGE_CHALLENGE_FAILED`})}};function KS(e){return(e.headers?.get(`content-type`)||``).toLowerCase()}async function qS(e){if(!KS(e).includes(`text/html`))return null;let t;try{t=await e.clone().text()}catch{return null}return t.includes(IS)?`${t.match(LS)?.[0]||RS}${zS}`:null}async function JS(e){return await qS(e)!==null}function YS(e){return US.includes(e.status)&&!KS(e).includes(`application/json`)}function XS(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!1}}var ZS={position:`fixed`,top:`0`,left:`0`,width:`0`,height:`0`,border:`0`,zIndex:`4000000`},QS={width:`100%`,height:`100%`,background:`rgba(0, 0, 0, 0.4)`},$S=`html,body{margin:0;height:100%;background:transparent}body{display:flex;align-items:center;justify-content:center}.fastly-challenge-close{position:fixed;top:16px;right:16px;width:40px;height:40px;border:0;border-radius:50%;background:#fff;color:#15212a;font:24px/1 sans-serif;cursor:pointer}`,eC=null;function tC(e=`${RS}${zS}`){return eC||(eC=new Promise((t,n)=>{let r=new URL(e,window.location.origin).href,i=document.createElement(`iframe`);i.setAttribute(`aria-hidden`,`true`),i.setAttribute(`tabindex`,`-1`),Object.assign(i.style,ZS),i.src=r;let a=Date.now(),o=null,s=null,c=!1,l=e=>{e.key===`Escape`&&u(new GS)},u=e=>{o?.disconnect(),clearTimeout(s),document.removeEventListener(`keydown`,l),i.remove(),eC=null,e?n(e):t()},d=e=>{let t=e.createElement(`button`);t.type=`button`,t.className=`fastly-challenge-close`,t.textContent=`×`,t.setAttribute(`aria-label`,K(`Close`)),t.addEventListener(`click`,()=>u(new GS)),e.body.appendChild(t),e.addEventListener(`keydown`,l),document.addEventListener(`keydown`,l),Object.assign(i.style,QS),i.title=K(`Security verification`),i.removeAttribute(`aria-hidden`),i.removeAttribute(`tabindex`),i.focus()},f=()=>{let e=i.contentDocument;if(!e?.head||!e.body){u(new GS);return}e.head.replaceChildren(),e.body.replaceChildren();let t=e.createElement(`style`);t.textContent=$S,e.head.appendChild(t);let n=e.createElement(`div`);n.className=`fastly-challenge`,e.body.appendChild(n),o=new MutationObserver(()=>{let t=n.getAttribute(BS);t===`complete`?u():t===`error`?u(new GS):t===`captcha_prompted`&&!c&&(c=!0,d(e),clearTimeout(s),s=setTimeout(()=>u(new GS),HS-(Date.now()-a)))}),o.observe(n,{attributes:!0,attributeFilter:[BS]});let l=e.createElement(`script`);l.src=r,l.addEventListener(`error`,()=>u(new GS)),e.head.appendChild(l)},p=()=>{i.contentDocument?.URL!==`about:blank`&&(i.removeEventListener(`load`,p),f())};s=setTimeout(()=>u(new GS),VS),i.addEventListener(`load`,p),document.body.appendChild(i)}),eC)}async function nC(e,t){let n=await fetch(e,t);if(YS(n))throw new GS;let r=await qS(n);if(!r)return n;if(!XS(e))throw new GS;await tC(r);let i=await fetch(e,t);if(YS(i)||await JS(i))throw new GS;return i}function rC({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){function r({type:t,resource:n}){if(t===`members`)return`${e.replace(/\/$/,``)}/members/api/${n}/`}function i({resource:e,params:r={}}){if(t&&n){let i=new URLSearchParams({...r,key:n});return`${t.replace(/\/$/,``)}/${e}/?${i.toString()}`}return``}function a({url:e,method:t=`GET`,headers:n={},credentials:r=void 0,body:i=void 0,edgeChallenge:a=!1}){let o={method:t,headers:n,credentials:r,body:i};return a?nC(e,o):fetch(e,o)}let o={};o.site={read(){return a({url:r({type:`members`,resource:`site`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},newsletters(){return a({url:i({resource:`newsletters`,params:{limit:100}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},tiers(){return a({url:i({resource:`tiers`,params:{limit:100,include:`monthly_price,yearly_price,benefits,requirements`}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},settings(){return a({url:i({resource:`settings`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch site data`)})},offer({offerId:e}){return a({url:i({resource:`offers/${e}`}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch offer data`)})},recommendations({limit:e=100}={limit:100}){return a({url:i({resource:`recommendations`,params:{limit:e}}),method:`GET`,headers:{"Content-Type":`application/json`}}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to fetch recommendations`)})}},o.feedback={async add({uuid:e,key:t,postId:n,score:i}){let o=r({type:`members`,resource:`feedback`});e&&t&&(o+=`?uuid=${e}&key=${t}`);let s=await a({url:o,method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify({feedback:[{post_id:n,score:i}]})});if(s.ok)return s.json();throw await Uc.fromApiResponse(s)??Error(`Failed to save feedback`)}};let s=async(e,t)=>{if(e.ok)return e.json();throw await Uc.fromApiResponse(e)||Error(t)};return o.gift={async fetchRedemptionData({token:e}){let t=await a({url:r({type:`members`,resource:`gifts/${encodeURIComponent(e)}/redeem`}),method:`GET`,headers:{"Content-Type":`application/json`},credentials:`same-origin`});return s(t,`Failed to load gift data`)},async redeem({token:e}){let t=await a({url:r({type:`members`,resource:`gifts/${encodeURIComponent(e)}/redeem`}),method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify({})});return s(t,`Failed to redeem gift`)}},o.recommendations={trackClicked({recommendationId:e}){let t=r({type:`members`,resource:`recommendations/`+e+`/clicked`});navigator.sendBeacon(t)},trackSubscribed({recommendationId:e}){let t=r({type:`members`,resource:`recommendations/`+e+`/subscribed`});navigator.sendBeacon(t)}},o.member={identity(){return a({url:r({type:`members`,resource:`session`}),credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.text()})},sessionData(){return a({url:r({type:`members`,resource:`member`}),credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.json()})},customFields(){return a({url:r({type:`members`,resource:`member/metafields/custom`}),credentials:`same-origin`}).then(function(e){return e.ok?e.json().then(e=>e.members_metafields).catch(()=>[]):[]})},update({name:e,subscribed:t,newsletters:n,enableCommentNotifications:i,enableUpdatesAndAnnouncements:o,metafields:s}){let c=r({type:`members`,resource:`member`}),l={name:e,subscribed:t,newsletters:n};return s!==void 0&&(l.metafields=s),i!==void 0&&(l.enable_comment_notifications=i),o!==void 0&&(l.enable_updates_and_announcements=o),a({url:c,method:`PUT`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(l)}).then(async function(e){if(!e.ok)throw await Uc.fromApiResponse(e)??Error(`Failed to update member`);return e.json()})},deleteSuppression(){return a({url:r({type:`members`,resource:`member/suppression`}),method:`DELETE`}).then(function(e){if(!e.ok)throw Error(`Your email has failed to resubscribe, please try again`);return!0})},async getIntegrityToken(){let e=await a({url:r({type:`members`,resource:`integrity-token`}),method:`GET`,edgeChallenge:!0});if(e.ok)return e.text();throw await Uc.fromApiResponse(e)||Error(`Failed to start a members session`)},async sendMagicLink({email:e,emailType:t,labels:n,name:i,oldEmail:o,newsletters:s,redirect:c,integrityToken:l,phonenumber:u,customUrlHistory:d,token:f,giftToken:p,autoRedirect:m=!0,includeOTC:h}){let g=r({type:`members`,resource:`send-magic-link`}),_={name:i,email:e,newsletters:s,oldEmail:o,emailType:t,labels:n,requestSrc:`portal`,redirect:c,integrityToken:l,honeypot:u,token:f,giftToken:p,autoRedirect:m,includeOTC:h},v=d??qu();v&&(_.urlHistory=v);let y=await a({url:g,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(_),edgeChallenge:!0});if(y.ok){if((y.headers.get(`content-type`)||``).toLowerCase().includes(`application/json`))try{return await y.json()}catch{}return{}}else throw await Uc.fromApiResponse(y)||Error(`Failed to send magic link email`)},async verifyOTC({otc:e,otcRef:t,redirect:n,integrityToken:i}){let o=await a({url:r({type:`members`,resource:`verify-otc`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({otc:e,otcRef:t,redirect:n,integrityToken:i})});if(o.ok)return await o.json();throw await Uc.fromApiResponse(o)||Error(`Failed to verify code`)},signout(t=!1){return a({url:r({type:`members`,resource:`session`}),method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({all:t})}).then(function(t){if(t.ok)return window.location.replace(e),`Success`;throw Error(`Failed to signout`)})},async newsletters({uuid:e,key:t}){let n=r({type:`members`,resource:`member/newsletters`});return n+=`?uuid=${e}&key=${t}`,a({url:n,credentials:`same-origin`}).then(function(e){return!e.ok||e.status===204?null:e.json()})},async updateNewsletters({uuid:e,newsletters:t,key:n,enableCommentNotifications:i,enableUpdatesAndAnnouncements:o}){let s=r({type:`members`,resource:`member/newsletters`});s+=`?uuid=${e}&key=${n}`;let c={newsletters:t};return i!==void 0&&(c.enable_comment_notifications=i),o!==void 0&&(c.enable_updates_and_announcements=o),a({url:s,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}).then(function(e){if(e.ok)return e.json();throw Error(`Failed to update email preferences`)})},async updateEmailAddress({email:e}){let t=await o.member.identity();return a({url:r({type:`members`,resource:`member/email`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:e,identity:t})}).then(async function(e){if(e.ok)return`Success`;{let t=(await e.json())?.errors?.[0]?.message||`Failed to send email address verification email`;throw Error(t)}})},async checkoutPlan({plan:t,tierId:n,cadence:i,cancelUrl:s,successUrl:c,email:l,name:u,offerId:d,newsletters:f,metadata:p={}}={}){let m=new URL(e),h=await o.member.identity(),g=r({type:`members`,resource:`create-stripe-checkout-session`});if(!c){let t=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`success`),c=t.href}if(!s){let t=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`cancel`),s=t.href}let _={name:u,newsletters:JSON.stringify(f),requestSrc:`portal`,fp_tid:(window.FPROM||window.$FPROM)?.data?.tid,urlHistory:qu(),...p},v={priceId:d?null:t,offerId:d,identity:h,metadata:_,successUrl:c,cancelUrl:s};return l&&(v.customerEmail=l),n&&i&&(delete v.priceId,v.tierId=d?null:n,v.cadence=d?null:i),a({url:g,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(v)}).then(async function(e){if(!e.ok){let t=(await e.json())?.errors?.[0]||{},n=t.message||`Failed to signup, please try again.`,r=Error(n);throw r.code=t.code,r}return e.json()}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})})},async continueGiftCheckout(){let t=new URL(e),n=await o.member.identity(),i=r({type:`members`,resource:`create-stripe-checkout-session`}),s=window.location.href.startsWith(t.href)?new URL(window.location.href):new URL(e);s.searchParams.set(`stripe`,`success`);let c=window.location.href.startsWith(t.href)?new URL(window.location.href):new URL(e);c.searchParams.set(`stripe`,`cancel`);let l={type:`subscription`,continueFromGift:!0,identity:n,successUrl:s.href,cancelUrl:c.href,metadata:{checkoutType:`upgrade`,requestSrc:`portal`,urlHistory:qu()}};return a({url:i,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}).then(async function(e){if(!e.ok){let t=(await e.json())?.errors?.[0]?.message||`Failed to continue gift subscription, please try again.`;throw Error(t)}return e.json()}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})})},async checkoutGift({tierId:t,cadence:n,duration:i,email:s,deliveryMethod:c,recipientEmail:l,recipientName:u,buyerName:d,personalMessage:f,deliveryDate:p}={}){let m=new URL(e),h=r({type:`members`,resource:`create-stripe-checkout-session`}),g=null;try{g=await o.member.identity()}catch{}let _=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);_.hash=i===void 0?`#/portal/gift`:`#/portal/gift/delivery`;let v={identity:g,metadata:{requestSrc:`portal`},type:`gift`,tierId:t,...i===void 0?{cadence:n}:{duration:i},...c===void 0?{}:{deliveryMethod:c},...l?{recipientEmail:l}:{},...u?{recipientName:u}:{},...d?{buyerName:d}:{},...f?{personalMessage:f}:{},...p?{deliveryDate:p}:{},cancelUrl:_.href};s&&(v.customerEmail=s);let y=await a({url:h,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(v)}),b={};try{b=await y.json()}catch{}if(!y.ok)throw b?.errors?.[0]||Error(`Failed to process gift checkout, please try again.`);if(b.url)return window.location.assign(b.url);throw Error(`Failed to process gift checkout, please try again.`)},async checkoutDonation({successUrl:e,cancelUrl:t,metadata:n={},personalNote:i=``}={}){let s=await o.member.identity(),c=r({type:`members`,resource:`create-stripe-checkout-session`}),l={identity:s,metadata:{fp_tid:(window.FPROM||window.$FPROM)?.data?.tid,urlHistory:qu(),...n},successUrl:e,cancelUrl:t,type:`donation`,personalNote:i},u=await a({url:c,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}),d=await u.json();if(!u.ok)throw d?.errors?.[0]||Error(`We're unable to process your payment right now. Please try again later.`);return d},async editBilling({successUrl:t,cancelUrl:n,subscriptionId:i}={}){let s=new URL(e),c=await o.member.identity(),l=r({type:`members`,resource:`create-stripe-update-session`});if(!t){let n=new URL(e);n.searchParams.set(`stripe`,`billing-update-success`),t=n.href}if(!n){let t=window.location.href.startsWith(s.href)?new URL(window.location.href):new URL(e);t.searchParams.set(`stripe`,`billing-update-cancel`),n=t.href}return a({url:l,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:c,subscription_id:i,successUrl:t,cancelUrl:n})}).then(function(e){if(!e.ok)throw Error(`Unable to create stripe checkout session`);return e.json()}).then(function(e){return window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId})}).then(function(e){if(e.error)throw Error(e.error.message)}).catch(function(e){throw e})},async manageBilling({returnUrl:t,subscriptionId:n}={}){let i=await o.member.identity(),s=r({type:`members`,resource:`create-stripe-billing-portal-session`});if(!t){let n=new URL(e);n.searchParams.set(`stripe`,`billing-portal-closed`),t=n.href}return a({url:s,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:i,subscription_id:n,returnUrl:t})}).then(function(e){if(!e.ok)throw Error(`Unable to create Stripe billing portal session`);return e.json()}).then(function(e){return window.location.assign(e.url)}).catch(function(e){throw e})},async updateSubscription({subscriptionId:e,tierId:t,cadence:n,planId:i,smartCancel:s,cancelAtPeriodEnd:c,cancellationReason:l,answers:u}){let d=await o.member.identity(),f=r({type:`members`,resource:`subscriptions`})+e+`/`,p={smart_cancel:s,cancel_at_period_end:c,cancellation_reason:l,identity:d,priceId:i,answers:u&&Object.keys(u).length>0?u:void 0};t&&n&&(delete p.priceId,p.tierId=t,p.cadence=n);let m=await a({url:f,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(p)});if(!m.ok)throw await Uc.fromApiResponse(m)??Error(`Failed to update subscription`);return m},async offers(){let e=await o.member.identity();return a({url:r({type:`members`,resource:`member/offers`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:e})}).then(function(e){return e.ok?e.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:e,subscriptionId:t}){let n=await o.member.identity(),i=await a({url:r({type:`members`,resource:`subscriptions/${t}/apply-offer`}),method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:n,offer_id:e})});if(!i.ok){let e=await i.text();throw Error(e||`Failed to apply offer`)}return!0}},o.init=async()=>{let[e]=await Promise.all([o.member.sessionData()]),t={},n=[],r=[],i={},a=[];try{[{settings:i},{tiers:r},{newsletters:n}]=await Promise.all([o.site.settings(),o.site.tiers(),o.site.newsletters()]),t={...i,newsletters:n,tiers:Ku({tiers:r})}}catch{}if(e&&e.paid)try{a=(await o.member.offers()).offers||[]}catch(e){console.warn(`[Portal] Failed to load member offers:`,e)}return t=$l({site:t}),{site:t,member:e,offers:a}},o}var iC=class extends _.Component{render(){return(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,color:`#313131`},children:(0,q.jsx)(`div`,{style:{paddingLeft:`16px`,paddingRight:`16px`,paddingTop:`12px`,height:`50px`},children:(0,q.jsx)(cf,{className:`gh-portal-loadingicon dark`,"data-testid":`loaderIcon`})})})}},aC=`
|
|
2702
2702
|
.gh-portal-feedback {
|
|
2703
2703
|
|
|
2704
2704
|
}
|
|
@@ -2856,9 +2856,9 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
2858
2858
|
}
|
|
2859
|
-
`;function
|
|
2859
|
+
`;function oC({error:e}){let{doAction:t}=(0,_.useContext)(J);return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-feedback with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-feedback-icon gh-feedback-icon-error`,children:(0,q.jsx)(FS,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Sorry, that didn’t work.`)}),(0,q.jsx)(`div`,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:e})}),(0,q.jsx)(df,{style:{width:`100%`},retry:!1,onClick:()=>t(`closePopup`),disabled:!1,brandColor:`#000000`,label:K(`Close`),isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})}var sC=({onConfirm:e,loading:t,initialScore:n})=>{let{doAction:r,brandColor:i}=(0,_.useContext)(J),[a,o]=(0,_.useState)(n),s=e=>{e.stopPropagation()},c=()=>{r(`closePopup`)},l=async t=>{t.stopPropagation(),await e(a)},u=e=>{let t=`gh-feedback-button`;return e===a?`${t} gh-feedback-button-selected`:t},d=e=>e===a?{color:i}:{};return(0,q.jsxs)(`div`,{className:`gh-portal-confirm-dialog`,onMouseDown:s,children:[(0,q.jsx)(`h1`,{className:`gh-portal-confirm-title`,children:K(`Give feedback on this post`)}),(0,q.jsxs)(`div`,{className:`gh-feedback-buttons-group`,children:[(0,q.jsxs)(`button`,{className:u(1),style:d(1),onClick:()=>o(1),children:[(0,q.jsx)(PS,{}),K(`More like this`)]}),(0,q.jsxs)(`button`,{className:u(0),style:d(0),onClick:()=>o(0),children:[(0,q.jsx)(NS,{}),K(`Less like this`)]})]}),(0,q.jsx)(df,{classes:`gh-portal-confirm-button`,retry:!1,onClick:l,disabled:!1,brandColor:i,label:K(`Submit feedback`),isRunning:t,tabIndex:3}),(0,q.jsx)(vf,{close:()=>c(!1)})]})};async function cC({siteUrl:e,uuid:t,key:n,postId:r,score:i},a){await(a||rC({siteUrl:e})).feedback.add({uuid:t,postId:r,key:n,score:i})}var lC=({action:e,score:t})=>((0,_.useEffect)(()=>{e(t)}),(0,q.jsx)(iC,{})),uC=({positive:e})=>{let{doAction:t,brandColor:n}=(0,_.useContext)(J);return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-feedback`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-feedback-icon`,children:e?(0,q.jsx)(PS,{}):(0,q.jsx)(NS,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Thanks for the feedback!`)}),(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:K(`Your input helps shape what gets published.`)}),(0,q.jsx)(df,{style:{width:`100%`},retry:!1,onClick:()=>t(`closePopup`),disabled:!1,brandColor:n,label:K(`Close`),isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})};function dC(){let{site:e,pageData:t,member:n,api:r}=(0,_.useContext)(J),{uuid:i,key:a,postId:o,score:s}=t,[c,l]=(0,_.useState)(s),u=c===1,d=!!n,f=!!(i&&a),[p,m]=(0,_.useState)(f&&d),[h,g]=(0,_.useState)(f&&d),[v,y]=(0,_.useState)(null),b=async t=>{g(!0);try{await cC({siteUrl:e.url,uuid:i,key:a,postId:o,score:t},r),l(t)}catch(e){let t=Kc(e,K(`There was a problem submitting your feedback. Please try again a little later.`));y(t)}g(!1)};return v?(0,q.jsx)(oC,{error:v}):p?h?(0,q.jsx)(lC,{action:b,score:c}):(0,q.jsx)(uC,{positive:u}):(0,q.jsx)(sC,{onConfirm:async e=>{await b(e),m(!0)},loading:h,initialScore:c})}var fC=`.gh-email-suppressed-page-title{margin-bottom:14px}.gh-email-suppressed-page-icon{width:38px;height:38px;margin:0 auto 18px;display:block}.gh-email-suppressed-page-text{text-align:center;color:var(--grey6);padding:0 14px}.gh-email-faq-footer-text{color:var(--grey8)}.gh-portal-list-detail.email-newsletter .gh-email-faq-page-button{margin-top:3px;display:block}.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:calc(6vmin - 14px)}html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back,html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back:hover{right:calc(6vmin - 14px);left:unset}.emailReceivingFAQ .gh-portal-closeicon-container{right:calc(6vmin - 20px)}@media (width<=480px){.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:16px}.emailReceivingFAQ .gh-portal-closeicon-container{right:24px}}.gh-email-faq-page-button{color:var(--brandcolor);cursor:pointer;background:0 0;font-size:1.45rem;transition:color .1s linear}html[dir=rtl] .gh-email-faq-page-button span{display:inline-flex;transform:scaleX(-1)}`,pC=e=>(0,q.jsxs)(`svg`,{id:`Regular`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:[(0,q.jsx)(`title`,{children:`confetti`}),(0,q.jsx)(`defs`,{children:(0,q.jsx)(`style`,{children:`
|
|
2860
2860
|
.cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px}
|
|
2861
|
-
`})}),(0,q.jsx)(`ellipse`,{className:`cls-1`,cx:11.531,cy:12.469,rx:2.625,ry:5.25,transform:`rotate(-45 11.531 12.47)`}),(0,q.jsx)(`path`,{className:`cls-1`,d:`M7.4 9.7.888 21.121a1.5 1.5 0 0 0 1.991 1.991L14.3 16.605M15.773 7.7a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.527a.377.377 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0m4.773-4.773a.374.374 0 0 1 0 .53m-.53-.53a.374.374 0 0 1 .53 0m-.53.53a.374.374 0 0 1 0-.53m.53.53a.375.375 0 0 1-.53 0m.53 10.076a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M8.349 4.514a.377.377 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M12.857.75a13.836 13.836 0 0 1-.531 5.62m4.243-4.242-.53 2.651m7.211 6.364a13.836 13.836 0 0 0-5.62.531m4.242-4.243-2.651.53`})]}),
|
|
2861
|
+
`})}),(0,q.jsx)(`ellipse`,{className:`cls-1`,cx:11.531,cy:12.469,rx:2.625,ry:5.25,transform:`rotate(-45 11.531 12.47)`}),(0,q.jsx)(`path`,{className:`cls-1`,d:`M7.4 9.7.888 21.121a1.5 1.5 0 0 0 1.991 1.991L14.3 16.605M15.773 7.7a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.527a.377.377 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0m4.773-4.773a.374.374 0 0 1 0 .53m-.53-.53a.374.374 0 0 1 .53 0m-.53.53a.374.374 0 0 1 0-.53m.53.53a.375.375 0 0 1-.53 0m.53 10.076a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M8.349 4.514a.377.377 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M12.857.75a13.836 13.836 0 0 1-.531 5.62m4.243-4.242-.53 2.651m7.211 6.364a13.836 13.836 0 0 0-5.62.531m4.242-4.243-2.651.53`})]}),mC=`
|
|
2862
2862
|
.gh-portal-tips-and-donations .gh-portal-signup-header {
|
|
2863
2863
|
margin-bottom: 12px;
|
|
2864
2864
|
padding: 0;
|
|
@@ -2884,7 +2884,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2884
2884
|
.gh-portal-tips-and-donations .gh-portal-text-center {
|
|
2885
2885
|
padding: 16px 32px 12px;
|
|
2886
2886
|
}
|
|
2887
|
-
`,
|
|
2887
|
+
`,hC=()=>{let{doAction:e,brandColor:t,site:n}=(0,_.useContext)(J),r=K(`Thank you for your support`),i=K(`To continue to stay up to date, subscribe to {publication} below.`,{publication:n?.title}),a=K(`Sign up`);return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-tips-and-donations`,children:[(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-signup-header`,children:[n.icon?(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n.icon,alt:n.title}):(0,q.jsx)(`div`,{className:`gh-tips-and-donations-icon-success`,children:(0,q.jsx)(pC,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:r})]}),(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:i}),(0,q.jsx)(df,{style:{width:`100%`},retry:!1,onClick:()=>e(`switchPage`,{page:`signup`}),disabled:!1,brandColor:t,label:a,isRunning:!1,tabIndex:3,classes:`sticky bottom`}),(0,q.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,q.jsx)(`div`,{children:K(`Already a member?`)}),(0,q.jsx)(`button`,{"data-test-button":`signin-switch`,"data-testid":`signin-switch`,className:`gh-portal-btn gh-portal-btn-link`,style:{color:t},onClick:()=>e(`switchPage`,{page:`signin`}),children:(0,q.jsx)(`span`,{children:K(`Sign in`)})})]})]})};function gC({maxTilt:e=3,shineSwing:t=10,trackTransition:n=`transform 80ms linear, --shine-angle 80ms linear`,restTransition:r=`transform 400ms ease-out, --shine-angle 400ms ease-out`}={}){let i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useRef)(!1),c=(0,_.useCallback)(()=>{a.current=null;let c=i.current;if(c)if(s.current){let{x:r,y:i}=o.current;c.style.transition=n,c.style.transform=`perspective(1200px) rotateX(${-i*e}deg) rotateY(${r*e}deg)`,c.style.setProperty(`--shine-angle`,`${243.43+r*t}deg`)}else c.style.transition=r,c.style.transform=``,c.style.removeProperty(`--shine-angle`)},[e,t,n,r]),l=(0,_.useCallback)(()=>{a.current===null&&(a.current=requestAnimationFrame(c))},[c]);return{cardRef:i,containerProps:{onMouseMove:(0,_.useCallback)(e=>{let t=i.current;if(!t)return;let n=t.getBoundingClientRect(),r=n.width/2,a=n.height/2;if(r===0||a===0)return;let c=e=>Math.max(-1,Math.min(1,e));o.current={x:c((e.clientX-n.left-r)/r),y:c((e.clientY-n.top-a)/a)},s.current=!0,l()},[l]),onMouseLeave:(0,_.useCallback)(()=>{s.current=!1,l()},[l])}}}var _C=`
|
|
2888
2888
|
.gh-portal-gift-redemption-form {
|
|
2889
2889
|
margin-top: 24px;
|
|
2890
2890
|
}
|
|
@@ -2921,7 +2921,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2921
2921
|
font-size: 1.4rem;
|
|
2922
2922
|
color: var(--grey6);
|
|
2923
2923
|
}
|
|
2924
|
-
`,
|
|
2924
|
+
`,vC=()=>{let{action:e,brandColor:t,doAction:n,member:r,pageData:i,site:a}=(0,_.useContext)(J),o=i?.gift,s=!!r,[c,l]=(0,_.useState)(o?.recipient_name||r?.name||``),[u,d]=(0,_.useState)(r?.email||o?.recipient_email||``),[f,p]=(0,_.useState)({}),[m,h]=(0,_.useState)(!1),{cardRef:g,containerProps:v}=gC();if((0,_.useEffect)(()=>{l(o?.recipient_name||r?.name||``),d(r?.email||o?.recipient_email||``),p({})},[r?.email,r?.name,o?.recipient_email,o?.recipient_name]),(0,_.useEffect)(()=>{o||(n(`openNotification`,{action:`giftRedemption:failed`,status:`error`,autoHide:!1,closeable:!0,message:Yd({code:`GIFT_NOT_FOUND`})}),n(`closePopup`))},[n,o]),!o)return null;let y=[{type:`text`,value:c,placeholder:K(`Jamie Larson`),label:K(`Your name`),name:`name`,required:!1,errorMessage:f.name||``,tabIndex:1,autoFocus:!c&&!u},{type:`email`,value:u,placeholder:K(`jamie@example.com`),label:K(`Your email`),name:`email`,required:!0,errorMessage:f.email||``,tabIndex:2,autoFocus:!!u||!!c&&!u}],b=(e,t)=>{p(e=>({...e,[t.name]:``})),t.name===`name`&&l(e.target.value),t.name===`email`&&d(e.target.value)},x=e=>{if(e.keyCode===13){if(C)return;S(e)}},S=e=>{if(e.preventDefault(),C)return;if(s){n(`redeemGift`,{giftToken:i?.token});return}let t=Cb({fields:y}),r=Object.values(t).some(e=>!!e);p(t),!r&&n(`redeemGift`,{email:u,name:c,giftToken:i?.token})},C=e===`redeemGift:running`,w=K(C?`Redeeming...`:`Redeem your gift`),T=a?.icon,E=a?.title||``,D=o.buyer_name||``,O=o.tier.name,k={buyerName:(0,q.jsx)(`strong`,{children:D}),duration:o.duration,strong:(0,q.jsx)(`strong`,{}),tierName:(0,q.jsx)(`strong`,{children:O}),siteTitle:E},ee=qd({buyerName:D,cadence:o.cadence,duration:o.duration,siteTitle:E}),A=o.expires_at?_l(o.expires_at,{locale:a?.locale,timezone:a?.timezone}):``,te=o.tier.benefits||[],j=o.tier.description||``;return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content giftRedemption`,children:[(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-bg`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`A gift, just for you`)}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:(0,q.jsx)(Bd,{mapping:k,string:ee})})]}),o.message&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-redemption-message`,"data-testid":`gift-message`,children:[(0,q.jsxs)(`p`,{className:`gh-portal-gift-redemption-message-text`,children:[`“`,o.message,`”`]}),D&&(0,q.jsxs)(`p`,{className:`gh-portal-gift-redemption-message-from`,children:[`— `,D]})]}),!s&&(0,q.jsx)(`div`,{className:`gh-portal-gift-redemption-form`,children:(0,q.jsx)(nm,{fields:y,onChange:b,onKeyDown:x})}),(0,q.jsx)(df,{brandColor:t,classes:`gh-portal-gift-checkout-cta`,label:w,onClick:S,style:{width:`100%`},disabled:C,isRunning:C}),A&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-cta-note`,children:K(`This gift can only be redeemed once and expires on {expiryDate}.`,{expiryDate:A})})]})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,...v,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-stack`,"data-revealing":m,children:[(0,q.jsx)(Sf,{cardRef:g,duration:Gd(o),tierName:o.tier.name,toName:c.trim()||null,fromName:D||null,siteIcon:T,siteTitle:E}),(0,q.jsx)(cS,{description:j,benefits:te,showDetails:m,onToggle:()=>h(e=>!e)})]})})})]})]})})},yC=`
|
|
2925
2925
|
@property --shine-angle {
|
|
2926
2926
|
syntax: '<angle>';
|
|
2927
2927
|
inherits: false;
|
|
@@ -4223,7 +4223,7 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4223
4223
|
font-size: 2rem;
|
|
4224
4224
|
}
|
|
4225
4225
|
}
|
|
4226
|
-
`;async function
|
|
4226
|
+
`;async function bC(e){try{return await window.navigator.clipboard.writeText(e),!0}catch{return!1}}function xC(e,t){let{amount:n,currency:r}=e??{};return n==null||!r?``:`${ju(r)}${Fu(Mu(n),t)}`}var SC=`
|
|
4227
4227
|
.gh-portal-gift-success-badge {
|
|
4228
4228
|
display: inline-flex;
|
|
4229
4229
|
align-items: center;
|
|
@@ -4316,7 +4316,7 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4316
4316
|
color: var(--grey6);
|
|
4317
4317
|
line-height: 1.5;
|
|
4318
4318
|
}
|
|
4319
|
-
`,
|
|
4319
|
+
`,CC=()=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,q.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),(0,q.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),wC=()=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,q.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),TC=()=>{let{site:e,pageData:t}=(0,_.useContext)(J),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),{cardRef:o,containerProps:s}=gC(),c=t?.token,l=t?.tierId,u=t?.cadence,d=t?.duration||1,f=t?.deliveryMethod,p=t?.deliveryDate,m=t?.scheduledAt,h=e?.url||``,g=e?.icon,v=e?.title||``,y=`${h.replace(/\/$/,``)}/gift/${c}`,b=eu({site:e}).filter(e=>e.type===`paid`),x=l?b.find(e=>e.id===l):null,S=()=>{bC(y),r(!0),setTimeout(()=>r(!1),2e3)},C=f===`email`,w=C&&p&&m&&m>Date.now(),T=K(`Your gift is ready`),E=K(`Send the link below to share it with whoever you'd like.`);if(w){let e=ol(dl(p));T=K(`Your gift is scheduled`),E=K(`We'll email it to the recipient on {deliveryDate}. A copy is in your inbox too.`,{deliveryDate:e})}else C&&(T=K(`Your gift is on its way`),E=K(`We'll email it to the recipient. A copy will be in your inbox too.`));return(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(`div`,{className:`gh-portal-content giftSuccess`,children:[(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-bg`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`span`,{className:`gh-portal-gift-success-badge`,"aria-hidden":`true`,children:(0,q.jsx)(wC,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:T}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:E})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[C&&(0,q.jsx)(`p`,{className:`gh-portal-gift-success-share-label`,children:K(`Share it yourself`)}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-success-link`,children:[(0,q.jsx)(`span`,{className:`gh-portal-gift-success-link-url`,"data-testid":`gift-redeem-link`,children:y}),(0,q.jsxs)(`button`,{className:`gh-portal-gift-success-copy`+(n?` is-copied`:``),onClick:S,type:`button`,children:[n?(0,q.jsx)(wC,{}):(0,q.jsx)(CC,{}),K(n?`Copied`:`Copy`)]})]}),(0,q.jsx)(`span`,{"aria-live":`polite`,style:{position:`absolute`,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:0},children:n?K(`Gift link copied to clipboard`):``})]}),!C&&(0,q.jsx)(`p`,{className:`gh-portal-gift-success-footer`,children:K(`Not ready to share? We've also emailed a copy to your inbox.`)})]})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,...s,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-card-stack`,"data-revealing":i,children:[(0,q.jsx)(Sf,{cardRef:o,duration:x&&u?Gd({cadence:t?.duration?`month`:u,duration:d}):null,tierName:x&&u?x.name:null,giftValue:x&&u?xC(t?.duration?Df(x,d):u===`month`?x.monthlyPrice:x.yearlyPrice,e?.locale):null,siteIcon:g,siteTitle:v}),x&&(0,q.jsx)(cS,{description:x.description,benefits:x.benefits,showDetails:i,onToggle:()=>a(e=>!e)})]})})})]})]})})},EC=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:[(0,q.jsx)(`title`,{children:`warning-stroke`}),(0,q.jsx)(`path`,{d:`M13.313 2.275a1.5 1.5 0 0 0-2.626 0l-9.75 18A1.5 1.5 0 0 0 2.25 22.5h19.5a1.5 1.5 0 0 0 1.313-2.225zM12 18a.375.375 0 0 1 .375.375m-.75 0A.375.375 0 0 1 12 18m0 .75a.375.375 0 0 1-.375-.375m.75 0a.375.375 0 0 1-.375.375M12 15V8.25`,style:{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5px`}})]}),DC=`
|
|
4320
4320
|
.gh-portal-tips-and-donations .gh-tips-and-donations-icon-error {
|
|
4321
4321
|
padding: 10px 0;
|
|
4322
4322
|
text-align: center;
|
|
@@ -4333,8 +4333,8 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4333
4333
|
.gh-portal-tips-and-donations .gh-portal-text-center {
|
|
4334
4334
|
padding: 16px 32px 12px;
|
|
4335
4335
|
}
|
|
4336
|
-
`,
|
|
4337
|
-
`})}),(0,q.jsx)(`title`,{children:`check-circle-1`}),(0,q.jsx)(`path`,{className:`a`,d:`M6,13.223,8.45,16.7a1.049,1.049,0,0,0,1.707.051L18,6.828`}),(0,q.jsx)(`circle`,{className:`a`,cx:12,cy:11.999,r:11.25})]}),
|
|
4336
|
+
`,OC=({error:e})=>{let{doAction:t}=(0,_.useContext)(J),n=K(`Sorry, that didn’t work.`),r=e||K(`There was an error processing your payment. Please try again.`),i=K(`Close`);return e&&nr(e),(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-tips-and-donations`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-tips-and-donations-icon-error`,children:(0,q.jsx)(EC,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:n}),(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:r}),(0,q.jsx)(df,{style:{width:`100%`},retry:!0,onClick:()=>t(`closePopup`),disabled:!1,brandColor:`#000000`,label:i,isDestructive:!0,isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})},kC=e=>(0,q.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M3.84 20.25L19.75 4.34`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,q.jsx)(`path`,{d:`M19.75 19.3398V4.33984H4.75`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`})]}),AC=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,...e,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`style`,{children:`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px!important;}
|
|
4337
|
+
`})}),(0,q.jsx)(`title`,{children:`check-circle-1`}),(0,q.jsx)(`path`,{className:`a`,d:`M6,13.223,8.45,16.7a1.049,1.049,0,0,0,1.707.051L18,6.828`}),(0,q.jsx)(`circle`,{className:`a`,cx:12,cy:11.999,r:11.25})]}),jC=`
|
|
4338
4338
|
.gh-portal-recommendations-header .gh-portal-main-title {
|
|
4339
4339
|
padding: 0 32px;
|
|
4340
4340
|
text-wrap: balance;
|
|
@@ -4467,7 +4467,7 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4467
4467
|
color: var(--grey6);
|
|
4468
4468
|
font-weight: 400;
|
|
4469
4469
|
}
|
|
4470
|
-
`,
|
|
4470
|
+
`,MC=e=>{let t=e.length,n;for(;t>0;)n=Math.floor(Math.random()*t),--t,[e[t],e[n]]=[e[n],e[t]];return e},NC=({title:e,favicon:t,featuredImage:n})=>{let[r,i]=(0,_.useState)(t||n);return r?(0,q.jsx)(`img`,{className:`gh-portal-recommendation-item-favicon`,src:r,alt:e,onError:()=>{i(null)}}):(0,q.jsx)(`div`,{className:`gh-portal-recommendation-item-favicon`})},PC=e=>{let t=window.open(e,`_blank`);t?t.focus():window.location.href=e},FC=e=>{let{doAction:t,member:n,site:r}=(0,_.useContext)(J),{title:i,url:a,description:o,favicon:s,one_click_subscribe:c,featured_image:l}=e,u=n&&c,[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(!1),v=r.outbound_link_tagging??!1,y=(0,_.useMemo)(()=>{if(!v)return a;try{let e=new URL(a);return e.searchParams.has(`ref`)||e.searchParams.has(`utm_source`)||e.searchParams.has(`source`)?a:(e.searchParams.set(`ref`,Xl()),e.toString())}catch{return a}},[a,v]),b=(0,_.useCallback)(()=>{PC(y),p||(t(`trackRecommendationClicked`,{recommendationId:e.id}),m(!0))},[y,e.id,p]),x=(0,_.useCallback)(async()=>{try{g(!0),await t(`oneClickSubscribe`,{siteUrl:a,throwErrors:!0}),t(`trackRecommendationSubscribed`,{recommendationId:e.id}),f(!0)}catch{PC(new URL(`#/portal/signup`,y)),p||(t(`trackRecommendationClicked`,{recommendationId:e.id}),m(!0))}g(!1)},[f,a,y,e.id,p]),S=(0,_.useCallback)(e=>{h||(u?x(e):b(e))},[h,u,x,b]);return(0,q.jsxs)(`section`,{className:`gh-portal-recommendation-item`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,onClick:b,children:[(0,q.jsxs)(`div`,{className:`gh-portal-recommendation-item-header`,children:[(0,q.jsx)(NC,{title:i,favicon:s,featuredImage:l}),(0,q.jsx)(`h3`,{children:i}),(0,q.jsx)(kC,{className:`gh-portal-recommendation-arrow-icon`})]}),(0,q.jsxs)(`div`,{className:`gh-portal-recommendation-description-container`,children:[d&&(0,q.jsxs)(`div`,{className:`gh-portal-recommendation-subscribed `+(o?`with-description`:`without-description`),children:[(0,q.jsx)(`span`,{children:K(`Verification link sent, check your inbox`)}),(0,q.jsx)(AC,{className:`gh-portal-recommendation-checkmark-icon`,alt:``})]}),o&&(0,q.jsx)(`p`,{className:d?`gh-portal-recommendation-description-hidden`:``,children:o})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-recommendation-item-action`,children:[!d&&h&&(0,q.jsx)(`span`,{className:`gh-portal-recommendations-loading-container`,children:(0,q.jsx)(cf,{className:`gh-portal-loadingicon dark`})}),!d&&!h&&u&&(0,q.jsx)(`button`,{type:`button`,className:`gh-portal-btn gh-portal-btn-list`,onClick:S,children:K(`Subscribe`)})]})]})},IC=()=>{let{api:e,site:t,pageData:n,doAction:r}=(0,_.useContext)(J),{title:i,icon:a}=t,{recommendations_enabled:o=!1}=t,[s,c]=(0,_.useState)(null);(0,_.useEffect)(()=>{e.site.recommendations({limit:100}).then(e=>{let t=e.recommendations.filter(e=>e.one_click_subscribe),n=e.recommendations.filter(e=>!e.one_click_subscribe);c([...MC(t),...MC(n)])}).catch(e=>{console.error(e)})},[]);let[l,u]=(0,_.useState)(5),d=()=>{u(s.length)};if((0,_.useEffect)(()=>()=>{if(n.signup){let e=[];e.push(`action`,`success`),tf(e)}},[]),s===null)return(0,q.jsx)(iC,{});let f=n&&n.signup?K(`Welcome to {siteTitle}`,{siteTitle:i}):K(`Recommendations`),p;return p=o&&s&&s.length>0?n&&n.signup?K(`Thank you for subscribing. Before you start reading, below are a few other sites you may enjoy.`):K(`Here are a few other sites you may enjoy.`):K(`Sorry, no recommendations are available right now.`),(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsxs)(`div`,{className:`gh-portal-recommendations-header`,children:[a&&(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,alt:i,src:a}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:f})]}),(0,q.jsx)(`p`,{className:`gh-portal-recommendations-description`,children:p}),o?(0,q.jsx)(`div`,{className:`gh-portal-list`,children:s.slice(0,l).map((e,t)=>(0,q.jsx)(FC,{...e},t))}):null,(l<s.length||n&&n.signup)&&(0,q.jsxs)(`footer`,{className:`gh-portal-action-footer`,children:[l<s.length&&(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-center`,style:{width:`100%`},onClick:d,children:(0,q.jsx)(`span`,{children:K(`Show all`)})}),n&&n.signup&&(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-center gh-portal-btn-link gh-portal-btn-recommendations-later`,style:{width:`100%`},onClick:d,children:(0,q.jsx)(`span`,{onClick:()=>r(`closePopup`),children:K(`Maybe later`)})})]})]})},LC=`
|
|
4471
4471
|
.gh-portal-popup-container.share {
|
|
4472
4472
|
width: 560px;
|
|
4473
4473
|
}
|
|
@@ -4783,7 +4783,7 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4783
4783
|
}
|
|
4784
4784
|
}
|
|
4785
4785
|
|
|
4786
|
-
`,
|
|
4786
|
+
`,RC=`
|
|
4787
4787
|
.gh-portal-action-transistor {
|
|
4788
4788
|
animation: fadeIn 0.3s ease-in-out;
|
|
4789
4789
|
}
|
|
@@ -4800,7 +4800,7 @@ html[dir="rtl"] .gh-portal-content.gift .gh-portal-btn-site-title-back {
|
|
|
4800
4800
|
.gh-portal-action-transistor .gh-portal-list-detail p {
|
|
4801
4801
|
word-break: break-word;
|
|
4802
4802
|
}
|
|
4803
|
-
`,
|
|
4803
|
+
`,zC={heading:`Podcasts`,description:`Access your RSS feeds`,button_text:`Manage`,url_template:`https://partner.transistor.fm/ghost/{memberUuid}`},BC=({hasPodcasts:e,memberUuid:t,settings:n={}})=>{let r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);if(!e||!t||!r)return null;let i=(e,t)=>!e||e===zC[t],a=i(n.heading,`heading`)?K(`Podcasts`):n.heading,o=i(n.description,`description`)?K(`Access your RSS feeds`):n.description,s=i(n.button_text,`button_text`)?K(`Manage`):n.button_text,c=(n.url_template||zC.url_template).replace(`{memberUuid}`,t);return(0,q.jsxs)(`section`,{className:`gh-portal-action-transistor`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:a}),(0,q.jsx)(`p`,{children:o})]}),(0,q.jsx)(`a`,{href:c,rel:`noopener noreferrer`,className:`gh-portal-btn gh-portal-btn-list`,target:`_parent`,children:s})]})},VC=`
|
|
4804
4804
|
.gh-portal-main-title {
|
|
4805
4805
|
text-align: center;
|
|
4806
4806
|
color: var(--grey0);
|
|
@@ -5732,7 +5732,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
5732
5732
|
.pl10 { padding-inline-start: 40px; }
|
|
5733
5733
|
|
|
5734
5734
|
.hidden { display: none !important; }
|
|
5735
|
-
`,
|
|
5735
|
+
`,HC=`
|
|
5736
5736
|
@media (max-width: 1440px) {
|
|
5737
5737
|
.gh-portal-popup-container:not(.full-size):not(.large-size):not(.preview) {
|
|
5738
5738
|
width: 480px;
|
|
@@ -5933,7 +5933,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
5933
5933
|
font-size: 16px !important;
|
|
5934
5934
|
}
|
|
5935
5935
|
}
|
|
5936
|
-
`,
|
|
5936
|
+
`,UC=`
|
|
5937
5937
|
.gh-portal-popup-wrapper.multiple-products .gh-portal-input-section {
|
|
5938
5938
|
max-width: 420px;
|
|
5939
5939
|
margin: 0 auto;
|
|
@@ -6133,7 +6133,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
6133
6133
|
.gh-portal-hide {
|
|
6134
6134
|
display: none;
|
|
6135
6135
|
}
|
|
6136
|
-
`;function UC({site:e}){return il+BC+_f+zh+Zp+Bm+om+hm+Sm+db+vh({site:e})+hf+lf+pf+Xc+CS+iS+AS({site:e})+Vd+ES+VC+HC+iC+dC+``+pC+gC+vC+EC+xC+AC+IC+LC}var WC=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={email:``,token:void 0}}componentDidMount(){let{member:e}=this.context;e&&this.context.doAction(`switchPage`,{page:`accountHome`})}handleSignin(e){e.preventDefault(),this.doSignin()}doSignin(){this.setState(e=>({errors:Sb({fields:this.getInputFields({state:e})})}),async()=>{let{email:e,phonenumber:t,errors:n,token:r}=this.state,{redirect:i}=this.context.pageData??{};n&&Object.values(n).filter(e=>!!e).length>0||this.context.doAction(`signin`,{email:e,phonenumber:t,redirect:i,token:r})})}handleInputChange(e,t){let n=t.name;this.setState({[n]:e.target.value})}onKeyDown(e){e.keyCode===13&&this.handleSignin(e)}getInputFields({state:e}){let t=e.errors||{};return[{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,errorMessage:t.email||``,autoFocus:!0},{type:`text`,value:e.phonenumber,placeholder:`+1 (123) 456-7890`,label:`Phone number`,name:`phonenumber`,required:!1,tabIndex:-1,autoComplete:`off`,hidden:!0}]}renderSubmitButton(){let{action:e}=this.context,t=!1,n=e===`signin:running`,r=K(n?`Sending login link...`:`Continue`),i=!!n;return e===`signin:failed`&&(r=K(`Retry`),t=!0),(0,q.jsx)(df,{dataTestId:`signin`,retry:t,style:{width:`100%`},onClick:e=>this.handleSignin(e),disabled:i,brandColor:this.context.brandColor,label:r,isRunning:n})}renderSignupMessage(){let{brandColor:e}=this.context;return(0,q.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,q.jsx)(`div`,{children:K(`Don't have an account?`)}),(0,q.jsx)(`button`,{"data-test-button":`signup-switch`,className:`gh-portal-btn gh-portal-btn-link`,style:{color:e},onClick:()=>this.context.doAction(`switchPage`,{page:`signup`}),children:(0,q.jsx)(`span`,{children:K(`Sign up`)})})]})}renderForm(){let{site:e}=this.context,t=Jl({site:e})&&Wl({site:e});return ql({site:e})?(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(tm,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)})}),(0,q.jsxs)(`footer`,{className:`gh-portal-signin-footer`,children:[this.renderSubmitButton(),t&&this.renderSignupMessage()]})]}):(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-members-disabled-notification`,"data-testid":`members-disabled-notification-text`,children:K(`Memberships unavailable, contact the owner for access.`)})})})}renderSiteIcon(){let e={},{site:t}=this.context,n=t.icon;return n?(e.backgroundImage=`url(${n})`,(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n,alt:this.context.site.title})):ql({site:t})?null:(0,q.jsx)(Cb,{className:`gh-portal-icon gh-portal-icon-invitation`})}renderSiteTitle(){let{site:e}=this.context,t=e.title;return ql({site:e})?(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Sign in`)}):(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:t})}renderFormHeader(){return(0,q.jsxs)(`header`,{className:`gh-portal-signin-header`,children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-content signin`,children:[this.renderFormHeader(),this.renderForm()]})})]})}},GC=({handleSignout:e,supportAddress:t=``})=>{let n=`mailto:${t}`;return(0,q.jsxs)(`footer`,{className:`gh-portal-account-footer`,children:[(0,q.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,q.jsx)(`li`,{children:(0,q.jsx)(`button`,{"data-test-button":`footer-signout`,className:`gh-portal-btn`,name:`logout`,"aria-label":`logout`,onClick:t=>e(t),children:K(`Sign out`)})})}),(0,q.jsx)(`div`,{className:`gh-portal-account-footerright`,children:(0,q.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,q.jsx)(`li`,{children:(0,q.jsx)(`a`,{"data-test-link":`footer-support`,className:`gh-portal-btn gh-portal-btn-branded`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:K(`Contact support`)})})})})]})},KC=()=>{let{member:e,brandColor:t}=(0,_.useContext)(J),n=e.avatar_image;return(0,q.jsxs)(`header`,{className:`gh-portal-account-header`,children:[(0,q.jsx)(Qc,{gravatar:n,style:{userIcon:{color:t,width:`56px`,height:`56px`,padding:`2px`}}}),(0,q.jsx)(`h2`,{className:`gh-portal-main-title`,children:K(`Your account`)})]})},qC=()=>{let{site:e,action:t,brandColor:n,doAction:r}=(0,_.useContext)(J);if(!Jl({site:e})||!Wl({site:e}))return null;let i=[`checkoutPlan:running`].includes(t),a=()=>{r(`switchPage`,{page:`accountPlan`,lastPage:`accountHome`})};return(0,q.jsx)(df,{dataTestId:`view-plans`,isRunning:i,label:K(`View plans`),onClick:()=>a(),brandColor:n,style:{width:`100%`}})},JC=()=>{let{member:e,site:t}=(0,_.useContext)(J),{paid_members_enabled:n}=t;if(!n||zl({site:t}))return null;let r=Cl({member:e}),i=wl({member:e});if(i&&!r)return null;if(r){let t=r?.current_period_end,n=kl({member:e});return El({member:e})?n?(0,q.jsx)(`div`,{className:`gh-portal-section`,style:{marginBottom:24},children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your gift subscription will expire on {expiryDate}`,{expiryDate:n})})}):null:i&&n?(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will expire on {expiryDate}`,{expiryDate:n})})}):r?.cancel_at_period_end||i?null:gu({sub:r})?(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will start on {subscriptionStart}`,{subscriptionStart:ol(r.trial_end_at)})})}):(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will renew on {renewalDate}`,{renewalDate:ol(t)})})})}return(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`You currently have a free membership, upgrade to a paid subscription for full access.`)}),(0,q.jsx)(qC,{})]})},YC=()=>{let{member:e,doAction:t,action:n,brandColor:r}=(0,_.useContext)(J),i=Cl({member:e});if(!i||!i.cancel_at_period_end)return null;let a=K(`Resume subscription`),o=[`continueSubscription:running`].includes(n),s=!!o,c=ol(i.current_period_end);return(0,q.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`Your subscription has been canceled and will expire on {expiryDate}.`),mapping:{expiryDate:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(df,{onClick:()=>{t(`continueSubscription`,{subscriptionId:i.id})},isRunning:o,disabled:s,isPrimary:!0,brandColor:r,label:a,style:{width:`100%`}})]})})},XC=()=>{let{member:e,site:t,doAction:n,action:r,brandColor:i}=(0,_.useContext)(J);if(!(El({member:e})&&!Al({member:e,site:t})&&Kl({site:t}))||!kl({member:e}))return null;let a=r===`continueGiftSubscription:running`;return(0,q.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,q.jsx)(`p`,{style:{maxWidth:`none`,margin:`0 0 16px`,textAlign:`center`,textWrap:`pretty`},children:K(`Continue with a paid subscription anytime. Your remaining gift period will be added as a free trial.`)}),(0,q.jsx)(df,{onClick:()=>n(`continueGiftSubscription`),isRunning:a,disabled:a,isPrimary:!0,brandColor:i,label:K(`Continue subscription`),style:{width:`100%`}})]})})},ZC=e=>(0,q.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`style`,{children:`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}`})}),(0,q.jsx)(`path`,{d:`M22.939 2.56V8.817C22.9391 9.61244 22.6232 10.3754 22.061 10.938L10.5 22.5C10.2187 22.7812 9.83721 22.9392 9.43946 22.9392C9.04172 22.9392 8.66026 22.7812 8.37896 22.5L1.49997 15.62C1.21876 15.3387 1.06079 14.9572 1.06079 14.5595C1.06079 14.1618 1.21876 13.7803 1.49997 13.499L13.061 1.938C13.6236 1.37572 14.3865 1.0599 15.182 1.06H21.439C21.8368 1.06 22.2183 1.21803 22.4996 1.49934C22.7809 1.78064 22.939 2.16217 22.939 2.56V2.56Z`,className:`a`}),(0,q.jsx)(`path`,{d:`M17.689 7.81C16.8605 7.81 16.189 7.13842 16.189 6.31C16.189 5.48157 16.8605 4.81 17.689 4.81C18.5174 4.81 19.189 5.48157 19.189 6.31C19.189 7.13842 18.5174 7.81 17.689 7.81Z`,className:`a`})]}),QC=()=>{let{member:e,site:t,doAction:n}=(0,_.useContext)(J),r=()=>{let t=Cl({member:e});n(`manageBilling`,{subscriptionId:t.id})},i=()=>{Kl({site:t})&&n(`switchPage`,{page:`accountPlan`,lastPage:`accountHome`})},a=({price:t,isComplimentary:n,subscription:r})=>{let{next_payment:i}=r||{},a=``;if(t){let{amount:e=0,currency:n,interval:r}=t;a=`${Intl.NumberFormat(`en`,{currency:n,style:`currency`}).format(e/100)}/${K(r)}`}let o=kl({member:e});if(El({member:e})&&o)return(0,q.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,children:[(0,q.jsx)(yf,{className:`gh-portal-account-tagicon`}),(0,q.jsx)(`span`,{children:K(`Gift subscription`)}),(0,q.jsx)(`span`,{className:`gh-portal-account-expiry-separator`,children:`-`}),(0,q.jsx)(`span`,{className:`gh-portal-account-expiry`,children:K(`Expires {expiryDate}`,{expiryDate:o})})]});n&&(a=o?`${K(`Complimentary`)} - ${K(`Expires {expiryDate}`,{expiryDate:o})}`:K(`Complimentary`));let s=``;if(gu({sub:r}))return s=`gh-portal-account-old-price`,(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:s,children:a}),(0,q.jsx)($C,{subscription:r})]});let c=ew({nextPayment:i});return c&&(s=`gh-portal-account-old-price`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:s,children:a}),(0,q.jsx)(()=>c?(0,q.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,"data-testid":`offer-label`,children:[(0,q.jsx)(ZC,{className:`gh-portal-account-tagicon`}),(0,q.jsx)(`span`,{children:c})]}):null,{})]})},o=({isPaid:r})=>{let a=El({member:e});if(a&&!Kl({site:t}))return null;let o=a&&!Al({member:e,site:t});return zl({site:t})&&(!r||a&&!o)?null:o?(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),n(`continueGiftSubscription`)},"data-test-button":`continue-gift-subscription`,children:K(`Continue`)}):(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),i(e)},"data-test-button":`change-plan`,children:K(`Change`)})},s=({defaultCardLast4:e})=>e?(0,q.jsx)(`p`,{children:`**** **** **** ${e}`}):null,c=({defaultCardLast4:e})=>{let{action:t}=(0,_.useContext)(J),n=t===`manageBilling:running`?(0,q.jsx)(cf,{className:`gh-portal-billing-button-loader`}):K(`Update`);return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Billing info & receipts`)}),(0,q.jsx)(s,{defaultCardLast4:e})]}),(0,q.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-billing`,"aria-hidden":`true`,children:n})]})},l=Cl({member:e}),u=wl({member:e}),d=El({member:e}),f=Tl({member:e});if(l||u){let{price:t,default_payment_card_last4:n}=l||{},r=K(`Plan`);return Rl({member:e})&&(r=Rl({member:e})),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsxs)(`h3`,{children:[r,l?.cancel_at_period_end&&(0,q.jsx)(`span`,{className:`gh-portal-canceled-badge`,children:K(`Canceled`)})]}),(0,q.jsx)(a,{price:t,isComplimentary:u,subscription:l})]}),(0,q.jsx)(o,{isPaid:f})]}),!u&&!d&&(0,q.jsx)(c,{defaultCardLast4:n})]})}return null};function $C({subscription:e}){return gu({sub:e})?(0,q.jsx)(`p`,{className:`gh-portal-account-discountcontainer`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`span`,{children:K(`Free Trial – Ends {trialEnd}`,{trialEnd:ol(e.trial_end_at)})})})}):null}function ew({nextPayment:e}){if(!e)return``;let t=e.discount;if(!t)return``;let n=t.end?K(`Ends {offerEndDate}`,{offerEndDate:ol(t.end)}):K(`Forever`);return`${`${Intl.NumberFormat(`en`,{currency:e.currency,style:`currency`}).format(e.amount/100)}/${K(e.interval)}`}${n?` — ${n}`:``}`}function tw({site:e,member:t}){return Mf({site:e})&&Tl({member:t??void 0})&&!El({member:t??void 0})}function nw(){let{member:e,site:t,doAction:n}=(0,_.useContext)(J),r=tw({site:t,member:e});if((0,_.useEffect)(()=>{r&&xf(t?.url)},[r,t?.url]),!r)return null;let i=()=>{n(`switchPage`,{page:`gift`,lastPage:`accountHome`})};return(0,q.jsx)(`div`,{className:`gh-portal-list gh-portal-gift-card`,children:(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Gift membership`)}),(0,q.jsx)(`p`,{children:K(`For a friend or colleague`)})]}),(0,q.jsxs)(`span`,{"aria-hidden":`true`,className:`gh-portal-list-action`,"data-test-button":`give-gift-subscription`,children:[(0,q.jsx)(yf,{className:`gh-portal-gift-card-icon`}),K(`Buy`)]})]})})}function rw(){let{member:e,site:t,doAction:n}=(0,_.useContext)(J),{newsletters:r}=e,i=!!r?.length,a=K(i?`Subscribed`:`Unsubscribed`),o=()=>{let r=fu({site:t}),i=e?.newsletters?.length?[]:r;n(`updateNewsletterPreference`,{newsletters:i})};return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,"aria-pressed":i,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail email-newsletter`,children:[(0,q.jsx)(`h3`,{children:K(`Email newsletter`)}),(0,q.jsxs)(`p`,{children:[a,` `,Tu({member:e})&&i&&(0,q.jsx)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:e=>{e.stopPropagation(),n(`switchPage`,{page:`emailReceivingFAQ`,lastPage:`accountHome`})},children:K(`Not receiving emails?`)})]})]}),(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{dataTestId:`default-newsletter-toggle`,id:`default-newsletter-toggle`,label:K(`Email newsletter`),onToggle:e=>{o(e,i)},checked:i,presentational:!0})})]})}var iw=e=>(0,q.jsxs)(`svg`,{fill:`none`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,...e,children:[(0,q.jsx)(`path`,{d:`m12.79 12.376 4.08 4.079m-4.08 0 4.08-4.08`,stroke:`red`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,q.jsx)(`path`,{d:`m10.439 17.994-2.664-2.652-2.86 1.478.111-4.239m0 0L1.677 9.232a1.344 1.344 0 0 1-.366-1.222 1.369 1.369 0 0 1 .904-1.05l13.111-4.374a1.369 1.369 0 0 1 1.76 1.758L15 10m-9.974 2.581 11.67-9.727`,stroke:`#A3A3A3`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`})]});function aw(){return(0,q.jsxs)(`p`,{className:`gh-portal-email-notice`,children:[(0,q.jsx)(iw,{className:`gh-portal-email-notice-icon`}),(0,q.jsx)(`span`,{className:`gh-mobile-only`,children:K(`You're not receiving emails`)}),(0,q.jsx)(`span`,{className:`gh-desktop-only`,children:K(`You're currently not receiving emails`)})]})}function ow(){let{doAction:e,member:t,site:n}=(0,_.useContext)(J),r=mu({member:t}),i=Ol({site:n}),a=Ql({site:n}),o=r?`emailSuppressed`:`accountEmail`,s=!i&&!a,c=()=>r||s?(0,q.jsx)(aw,{}):(0,q.jsx)(`p`,{children:K(`Update your preferences`)}),l=()=>{e(`switchPage`,{page:o,lastPage:`accountHome`})};return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Emails`)}),c()]}),(0,q.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-newsletters`,"aria-hidden":`true`,children:K(`Manage`)})]})}var sw=()=>{let{member:e,site:t}=(0,_.useContext)(J),n=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},r=n?.enabled===!0,i=e?.uuid,a=Qu(),[o,s]=(0,_.useState)(a&&r);return(0,_.useEffect)(()=>{if(a){s(r);return}if(!r||!i){s(!1);return}s(!1);let e=new AbortController;return(async()=>{try{let t=await fetch(`https://partner.transistor.fm/ghost/member/${i}`,{signal:e.signal});if(t.ok){let n=await t.json();e.signal.aborted||s(n?.member===!0)}}catch(t){if(e.signal.aborted)return;console.warn(`Error in Transistor request`,t)}})(),()=>e.abort()},[r,i,a]),{transistor:{enabled:r,hasPodcasts:o,memberUuid:i,settings:n}}},cw=(e,t)=>pu({site:e})&&Ol({site:e})||Ql({site:e})||mu({member:t}),lw=e=>!pu({site:e})&&Ol({site:e})&&!Ql({site:e}),uw=()=>{let{member:e,doAction:t,site:n}=(0,_.useContext)(J),{name:r,email:i}=e,{transistor:a}=sw(),o=()=>{t(`switchPage`,{page:`accountProfile`,lastPage:`accountHome`})},s=cw(n,e),c=lw(n);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:r&&!Zl({site:n})?r:K(`Account`)}),(0,q.jsx)(`p`,{children:i})]}),(0,q.jsx)(`span`,{"data-test-button":`edit-profile`,className:`gh-portal-list-action`,"aria-hidden":`true`,children:K(`Edit`)})]}),(0,q.jsx)(QC,{}),s&&(0,q.jsx)(ow,{}),c&&(0,q.jsx)(rw,{}),a.enabled&&(0,q.jsx)(zC,{hasPodcasts:a.hasPodcasts,memberUuid:a.memberUuid,settings:a.settings})]}),(0,q.jsx)(nw,{})]})},dw=()=>(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-account-main`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(KC,{}),(0,q.jsxs)(`section`,{className:`gh-portal-account-data`,children:[(0,q.jsx)(JC,{}),(0,q.jsx)(XC,{}),(0,q.jsx)(YC,{}),(0,q.jsx)(uw,{})]})]}),fw=class extends _.Component{static contextType=J;componentDidMount(){let{member:e,site:t}=this.context;ql({site:t})||this.context.doAction(`signout`),e||this.context.doAction(`switchPage`,{page:`signin`,pageData:{redirect:window.location.href}})}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}render(){let{member:e,site:t}=this.context,n=Ou({site:t});return!e||!ql({site:t})?null:(0,q.jsxs)(`div`,{className:`gh-portal-account-wrapper`,children:[(0,q.jsx)(dw,{}),(0,q.jsx)(GC,{onClose:()=>this.context.doAction(`closePopup`),handleSignout:e=>this.handleSignout(e),supportAddress:n})]})}},pw=class extends _.Component{static contextType=J;constructor(e,t){super(e,t);let{name:n=``,email:r=``,metafields:i}=t.member||{};this.state={name:n,email:r,metafields:Pm((t.customFields??[]).map(jm),i?.custom||{})}}componentDidMount(){let{member:e}=this.context;e||this.context.doAction(`switchPage`,{page:`signin`})}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}onBack(){this.context.doAction(`back`)}onProfileSave(e){e.preventDefault(),this.setState(e=>({errors:Sb({fields:this.getInputFields({state:e})})}),()=>{let{email:e,name:t,errors:n}=this.state;if(!(n&&Object.values(n).filter(e=>!!e).length>0)){this.context.doAction(`clearPopupNotification`);let n=Rm(this.customFields(),this.state.metafields,this.context.member.metafields?.custom||{});this.context.doAction(`updateProfile`,{email:e,name:t,...n?{metafields:n}:{}})}})}renderSaveButton(){let e=this.context.action===`updateProfile:running`,t=K(`Save`);return this.context.action===`updateProfile:failed`&&(t=K(`Retry`)),(0,q.jsx)(df,{dataTestId:`save-button`,isRunning:e,onClick:e=>this.onProfileSave(e),disabled:!!e,brandColor:this.context.brandColor,label:t,style:{width:`100%`}})}renderDeleteAccountButton(){return(0,q.jsx)(`div`,{style:{cursor:`pointer`,color:`red`},role:`button`,children:K(`Delete account`)})}renderAccountFooter(){return(0,q.jsx)(`footer`,{className:`gh-portal-action-footer`,children:this.renderSaveButton()})}renderHeader(){return(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:e=>this.onBack(e)}),(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:K(`Account settings`)})]})}renderUserAvatar(){return(0,q.jsx)(`div`,{style:{position:`relative`,display:`flex`,width:`64px`,height:`64px`,marginBottom:`6px`,borderRadius:`100%`,boxShadow:`0 0 0 3px #fff`,border:`1px solid gray`,overflow:`hidden`,justifyContent:`center`,alignItems:`center`},children:(0,q.jsx)(Qc,{gravatar:this.context.member&&this.context.member.avatar_image,style:{userIcon:{color:`black`,width:`56px`,height:`56px`}}})})}handleInputChange(e,t){this.setState({[t.name]:e.target.value})}handleCustomFieldChange(e,t){this.setState(({metafields:n})=>({metafields:{...n,[e.key]:t}}))}customFields(){return(this.context.customFields??[]).map(jm)}getInputFields({state:e,fieldNames:t}){let n=e.errors||{},r=[{type:`text`,value:e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,required:!1,errorMessage:n.name||``},{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,errorMessage:n.email||``}];return t&&t.length>0?r.filter(e=>t.includes(e.name)):r}onKeyDown(e){e.keyCode===13&&this.onProfileSave(e)}renderProfileData(){let e=this.customFields();return(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(tm,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)}),e.length>0&&(0,q.jsx)($m,{errors:this.context.fieldErrors||{},fields:e,onChange:(e,t)=>this.handleCustomFieldChange(e,t),onKeyDown:e=>this.onKeyDown(e),values:this.state.metafields})]})}render(){let{member:e}=this.context;return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[this.renderHeader(),(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-section`,children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};function mw(){let{brandColor:e,lastPage:t,doAction:n}=(0,_.useContext)(J);return(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:K(`Email preferences`)})]})}function hw({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){let r=t.some(t=>t.id===e?.id),i=()=>{let i=[];i=r?t.filter(t=>t.id!==e.id):t.filter(t=>t.id!==e.id).concat(e),n(i)};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`newsletter-toggle`,role:`button`,tabIndex:0,"aria-pressed":r,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:e.name}),(0,q.jsx)(`p`,{children:e?.description})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:e.id,label:e.name,onToggle:i,checked:r,dataTestId:`switch-input`,presentational:!0})})]})}function gw({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){let r=!!n,i=(0,_.useRef)(!1);if(!t)return null;let a=async()=>{if(!i.current){i.current=!0;try{await e(!r)}finally{i.current=!1}}};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`comment-toggle`,role:`button`,tabIndex:0,"aria-pressed":r,onClick:a,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Comments`)}),(0,q.jsx)(`p`,{children:K(`Get notified when someone replies to your comment`)})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:`comments`,label:K(`Comments`),onToggle:a,checked:r,dataTestId:`switch-input`,presentational:!0})})]})}function _w({updateUpdatesAndAnnouncements:e,canChangeUpdatesAndAnnouncements:t,enableUpdatesAndAnnouncements:n}){let{site:r}=(0,_.useContext)(J),i=(0,_.useRef)(!1);if(!t)return null;let a=async()=>{if(!i.current){i.current=!0;try{await e(!n)}finally{i.current=!1}}};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`updates-and-announcements-toggle`,role:`button`,tabIndex:0,"aria-pressed":!!n,onClick:a,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Updates & announcements`)}),(0,q.jsx)(`p`,{children:K(`Occasional updates from {siteTitle}`,{siteTitle:r?.title})})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:`updates-and-announcements`,label:K(`Updates & announcements`),onToggle:a,checked:n,dataTestId:`switch-input`,presentational:!0})})]})}function vw({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){let{site:r}=(0,_.useContext)(J),i=fu({site:r});return n?i.map(n=>(0,q.jsx)(hw,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id)):null}function yw(){let{doAction:e}=(0,_.useContext)(J);return(0,q.jsxs)(`section`,{className:`gh-portal-list-help`,children:[(0,q.jsx)(`span`,{className:`gh-portal-list-help-label`,children:K(`Not receiving emails?`)}),(0,q.jsxs)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:()=>e(`switchPage`,{page:`emailReceivingFAQ`,pageData:{direct:!1}}),children:[K(`Get help`),` `,(0,q.jsx)(`span`,{className:`right-arrow`,children:`→`})]})]})}function bw({site:e,isPaid:t}){return t?(0,q.jsx)(`p`,{className:`gh-portal-btn-unsubscribe-note`,children:K(`Unsubscribing from emails will not cancel your paid subscription to {title}`,{title:e?.title})}):null}function xw({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:r,updateCommentNotifications:i,updateUpdatesAndAnnouncements:a,unsubscribeAll:o,isPaidMember:s,isCommentsEnabled:c,enableCommentNotifications:l,canChangeUpdatesAndAnnouncements:u,enableUpdatesAndAnnouncements:d}){let{brandColor:f,member:p,site:m}=(0,_.useContext)(J),h=(0,_.useRef)(!!n?.length).current,g=d!=null,v=g?d:h,y=c&&!l||!c,b=u&&!v||!u,x=!n?.length&&y&&b;return(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-email-preferences-header`,children:[(0,q.jsx)(mw,{}),(0,q.jsx)(t||(()=>null),{})]}),(0,q.jsx)(vf,{brandColor:f}),(0,q.jsx)(`div`,{className:`gh-portal-section flex`,children:(0,q.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,q.jsx)(vw,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:e=>{let t=e.map(e=>({id:e.id}));u&&!g?r(t,v):r(t)}}),(0,q.jsx)(gw,{isCommentsEnabled:c,enableCommentNotifications:l,updateCommentNotifications:i}),(0,q.jsx)(_w,{canChangeUpdatesAndAnnouncements:u,enableUpdatesAndAnnouncements:v,updateUpdatesAndAnnouncements:a}),Tu({member:p})&&!x&&(0,q.jsx)(yw,{})]})}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-unsubscribe`,children:[(0,q.jsx)(df,{isRunning:!1,onClick:()=>{o()},disabled:x,brandColor:f,isPrimary:!1,label:K(`Unsubscribe from all emails`),isDestructive:!0,style:{width:`100%`},dataTestId:`unsubscribe-from-all-emails`}),(0,q.jsx)(bw,{isPaid:s,site:m})]})]})}function Sw(){let{member:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(J),i,a;r&&(i=r.newsletterUuid,a=r.action);let[o,s]=(0,_.useState)(!0),c=fu({site:n}),l=Ol({site:n});(0,_.useEffect)(()=>{e||t(`switchPage`,{page:`signin`})},[e,t]),(0,_.useEffect)(()=>{if(i&&a===`unsubscribe`){let n=e?.newsletters.filter(e=>e.uuid!==i);f(n),s(!1),t(`updateNewsletterPreference`,{newsletters:n})}},[]);let u=()=>{if(r.comments&&p)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:e?.email})}})})});let t=c?.find(e=>e.uuid===r.newsletterUuid);return t?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:e?.email}),newsletterName:(0,q.jsx)(`strong`,{children:t?.name})}})})}):null},[d,f]=(0,_.useState)([...e?.newsletters||[]]),{comments_enabled:p}=n,m=!!n.labs?.automations,{enable_comment_notifications:h,enable_updates_and_announcements:g}=e||{};return(0,_.useEffect)(()=>{f(e?.newsletters||[])},[e?.newsletters]),(0,q.jsx)(xw,{hasNewslettersEnabled:l,notification:i?u:null,subscribedNewsletters:d,updateSubscribedNewsletters:(e,n)=>{f(e),t(`updateNewsletterPreference`,{newsletters:e,enableUpdatesAndAnnouncements:n}),t(`showPopupNotification`,{action:`updated:success`,message:K(`Email preferences updated.`)})},updateCommentNotifications:e=>t(`updateNewsletterPreference`,{enableCommentNotifications:e,successMessage:K(`Comment preferences updated.`)}),updateUpdatesAndAnnouncements:e=>t(`updateNewsletterPreference`,{enableUpdatesAndAnnouncements:e,successMessage:K(`Email preferences updated.`)}),unsubscribeAll:()=>{f([]),t(`showPopupNotification`,{action:`updated:success`,message:K(`Unsubscribed from all emails.`)});let e={newsletters:[]};p&&(e.enableCommentNotifications=!1),m&&(e.enableUpdatesAndAnnouncements=!1),t(`updateNewsletterPreference`,e)},isPaidMember:Tl({member:e}),isCommentsEnabled:p!==`off`,enableCommentNotifications:h,canChangeUpdatesAndAnnouncements:m,enableUpdatesAndAnnouncements:g})}function Cw(){let{site:e}=(0,_.useContext)(J),t=e.icon;return t?(0,q.jsx)(`img`,{className:`gh-portal-unsubscribe-logo`,src:t,alt:e.title}):null}function ww(){let{site:e}=(0,_.useContext)(J),t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-header`,children:[(0,q.jsx)(Cw,{}),(0,q.jsx)(`h2`,{className:`gh-portal-publication-title`,children:t})]})}function Tw({message:e}){let{doAction:t}=(0,_.useContext)(J);return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-feedback with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-feedback-icon gh-feedback-icon-error`,children:(0,q.jsx)(Wd,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`That didn't go to plan`)}),(0,q.jsx)(`div`,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:e})}),(0,q.jsx)(df,{style:{width:`100%`},retry:!1,onClick:()=>t(`closePopup`),disabled:!1,brandColor:`#000000`,label:K(`Close`),isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})}async function Ew({api:e,memberUuid:t,key:n,newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a}){try{return await e.member.updateNewsletters({uuid:t,key:n,newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a})}catch{}}function Dw(){let{site:e,api:t,pageData:n,member:r,doAction:i}=(0,_.useContext)(J),[a,o]=(0,_.useState)(),s=!!r&&r.uuid!==n.uuid,[c,l]=(0,_.useState)(!0),u=fu({site:e}),d=u.filter(e=>e.subscribe_on_signup),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(d),[g,v]=(0,_.useState)(!1),{comments_enabled:y}=e,b=!!e.labs?.automations,{enable_comment_notifications:x=!1,enable_updates_and_announcements:S}=a||{},C=Ol({site:e}),w=async(e,a)=>{let o={newsletters:e};a!==void 0&&(o.enableUpdatesAndAnnouncements=a),r?i(`updateNewsletterPreference`,o):await Ew({api:t,memberUuid:n.uuid,key:n.key,...o}),h(e);let s={action:`updated:success`,message:K(`Email preferences updated.`)};i(`showPopupNotification`,s)},T=async(e,a)=>{let s;r?s=(await i(`updateNewsletterPreference`,{...e,successMessage:a}))?.member:(s=await Ew({api:t,memberUuid:n.uuid,key:n.key,...e}),i(`showPopupNotification`,s?{action:`updated:success`,message:a}:{action:`updateNewsletter:failed`,status:`error`,message:K(`Failed to update newsletter settings`)})),s&&o(s)},E=e=>T({enableCommentNotifications:e},K(`Comment preferences updated.`)),D=e=>T({enableUpdatesAndAnnouncements:e},K(`Email preferences updated.`)),O=async()=>{let e;r?(await i(`updateNewsletterPreference`,{newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),e={...r},e.newsletters=[],e.enable_comment_notifications=!1,e.enable_updates_and_announcements=!1):e=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),h([]),o(e),i(`showPopupNotification`,{action:`updated:success`,message:K(`Unsubscribed from all emails.`)})};return(0,_.useEffect)(()=>{(async()=>{if(s)return;let e;try{e=await t.member.newsletters({uuid:n.uuid,key:n.key}),o(e??null),l(!1)}catch(e){console.error(`[PORTAL] Error fetching member newsletters`,e),o(null),l(!1);return}if(e===null)return;let r=e?.newsletters||[];h(r),u?.length===1&&!y&&!n.newsletterUuid?await w([]):n.newsletterUuid?await w(r?.filter(e=>e.uuid!==n.newsletterUuid)):n.comments&&y?await E(!1):n.updatesAndAnnouncements&&b&&await D(!1)})()},[y,b,s,n.uuid,n.newsletterUuid,n.comments,n.updatesAndAnnouncements,e.url,u?.length]),s?(0,q.jsx)(Tw,{message:K(`This unsubscribe link belongs to a different email address than the one you are signed in with.`)}):c?(0,q.jsx)(rC,{}):a?u?.length===1&&!y&&!g?(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-unsubscribe with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(ww,{}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Successfully unsubscribed`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive this newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})}),(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,q.jsx)(Bd,{string:K(`Didn't mean to do this? Manage your preferences <button>here</button>.`),mapping:{button:(0,q.jsx)(`button`,{className:`gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline`,onClick:()=>{v(!0)}})}})})]})]}):(0,q.jsx)(xw,{hasNewslettersEnabled:C,notification:()=>{if(n.comments&&y)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f||x?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})})});if(n.updatesAndAnnouncements&&b)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f||S!==!1?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive updates & announcements.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})})});let e=u?.find(e=>e.uuid===n.newsletterUuid);return e?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email}),newsletterName:(0,q.jsx)(`strong`,{children:e?.name})}})})}):null},subscribedNewsletters:m,updateSubscribedNewsletters:async(e,t)=>{await w(e,t),p(!0)},updateCommentNotifications:E,updateUpdatesAndAnnouncements:D,unsubscribeAll:async()=>{await O(),p(!0)},isPaidMember:a?.status!==`free`,isCommentsEnabled:y!==`off`,enableCommentNotifications:x,canChangeUpdatesAndAnnouncements:b,enableUpdatesAndAnnouncements:S}):(0,q.jsx)(Tw,{message:K(`We couldn't unsubscribe you as the email address was not found. Please contact the site owner.`)})}function Ow(){let{brandColor:e,lastPage:t,doAction:n,action:r,site:i}=(0,_.useContext)(J);(0,_.useEffect)(()=>{[`removeEmailFromSuppressionList:success`].includes(r)&&n(`refreshMemberData`),[`removeEmailFromSuppressionList:failed`,`refreshMemberData:failed`].includes(r)&&n(`back`),[`refreshMemberData:success`].includes(r)&&(pu({site:i})||Ql({site:i})?(n(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`}),n(`showPopupNotification`,{message:K(`You have been successfully resubscribed`)})):n(`back`))},[r,n,i,K]);let a=[`removeEmailFromSuppressionList:running`,`refreshMemberData:running`].includes(r);return(0,q.jsxs)(`div`,{className:`gh-email-suppressed-page`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,q.jsx)(vf,{})]}),(0,q.jsx)(iw,{className:`gh-email-suppressed-page-icon`}),(0,q.jsxs)(`div`,{className:`gh-email-suppressed-page-text`,children:[(0,q.jsx)(`h3`,{className:`gh-portal-main-title gh-email-suppressed-page-title`,children:K(`Emails disabled`)}),(0,q.jsx)(`p`,{children:K(`You're not receiving emails because you either marked a recent message as spam, or because messages could not be delivered to your provided email address.`)})]}),(0,q.jsx)(df,{dataTestId:`resubscribe-email`,classes:`gh-portal-confirm-button`,onClick:()=>{n(`removeEmailFromSuppressionList`)},disabled:a,brandColor:e,label:K(`Re-enable emails`),isRunning:a})]})}function kw(){let{brandColor:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(J),i=`mailto:${Ou({site:n})}`;return(0,q.jsxs)(`div`,{className:`gh-email-suppression-faq`,children:[!(r&&r.direct)&&(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,onClick:()=>{t(`switchPage`,{page:`emailSuppressed`,lastPage:`accountHome`})}}),(0,q.jsx)(vf,{})]}),(0,q.jsxs)(`div`,{className:`gh-longform`,children:[(0,q.jsx)(`h3`,{children:K(`Why has my email been disabled?`)}),(0,q.jsx)(`p`,{children:K(`Newsletters can be disabled on your account for two reasons: A previous email was marked as spam, or attempting to send an email resulted in a permanent failure (bounce).`)}),(0,q.jsx)(`h4`,{children:K(`Spam complaints`)}),(0,q.jsx)(`p`,{children:K(`If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.`)}),(0,q.jsx)(`p`,{children:K(`If the spam complaint was accidental, or you would like to begin receiving emails again, you can resubscribe to emails by clicking the button on the previous screen.`)}),(0,q.jsx)(`p`,{children:K(`Once resubscribed, if you still don't see emails in your inbox, check your spam folder. Some inbox providers keep a record of previous spam complaints and will continue to flag emails. If this happens, mark the latest newsletter as 'Not spam' to move it back to your primary inbox.`)}),(0,q.jsx)(`h4`,{children:K(`Permanent failure (bounce)`)}),(0,q.jsx)(`p`,{children:K(`When an inbox fails to accept an email it is commonly called a bounce. In many cases, this can be temporary. However, in some cases, a bounced email can be returned as a permanent failure when an email address is invalid or non-existent.`)}),(0,q.jsx)(`p`,{children:K(`In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.`)}),(0,q.jsx)(`p`,{children:K(`If you would like to start receiving emails again, the best next steps are to check your email address on file for any issues and then click resubscribe on the previous screen.`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-btn-branded no-margin-right`,href:i,onClick:()=>{i&&window.open(i)},children:K(`Need more help? Contact support`)})})]})]})}function Aw(){let{brandColor:e,doAction:t,site:n,lastPage:r,member:i,pageData:a}=(0,_.useContext)(J),o=Ou({site:n}),s=`mailto:${o}`,c=ku({site:n});return(0,q.jsxs)(`div`,{className:`gh-email-receiving-faq`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[!(a&&a.direct)&&(0,q.jsx)(mf,{brandColor:e,onClick:()=>{r?t(`switchPage`,{page:`accountHome`}):t(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`})}}),(0,q.jsx)(vf,{})]}),(0,q.jsxs)(`div`,{className:`gh-longform`,children:[(0,q.jsx)(`h3`,{children:K(`Help! I'm not receiving emails`)}),(0,q.jsx)(`p`,{children:K(`If you're not receiving the email newsletter you've subscribed to, here are a few things to check.`)}),(0,q.jsx)(`h4`,{children:K(`Verify your email address is correct`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`The email address we have for you is {memberEmail} — if that's not correct, you can update it in your <button>account settings area</button>.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:i.email}),button:(0,q.jsx)(`button`,{className:`gh-portal-btn-text`,onClick:()=>t(`switchPage`,{lastPage:`emailReceivingFAQ`,page:`accountProfile`})})}})}),(0,q.jsx)(`h4`,{children:K(`Check spam & promotions folders`)}),(0,q.jsx)(`p`,{children:K(`Make sure emails aren't accidentally ending up in the Spam or Promotions folders of your inbox. If they are, click on "Mark as not spam" and/or "Move to inbox".`)}),(0,q.jsx)(`h4`,{children:K(`Create a new contact`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`In your email client add {senderEmail} to your contacts list. This signals to your mail provider that emails sent from this address should be trusted.`),mapping:{senderEmail:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(`h4`,{children:K(`Check with your mail provider`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from {senderEmail}`),mapping:{senderEmail:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(`h4`,{children:K(`Get in touch for help`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you've completed all these checks and you're still not receiving emails, you can reach out to get support by contacting {supportAddress}.`),mapping:{supportAddress:(0,q.jsx)(`a`,{href:s,onClick:()=>{s&&window.open(s)},children:o})}})})]})]})}var jw=()=>{let[e,t]=(0,_.useState)(!0),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),{member:o,site:s}=(0,_.useContext)(J);return(0,_.useEffect)(()=>{async function e(){let e=s.url,n=window.location.origin+window.location.pathname,i=o?`${n}?action=support&success=true`:`${n}#/portal/support/success`,c=n,l=nC({siteUrl:e});try{let e=await l.member.checkoutDonation({successUrl:i,cancelUrl:c,personalNote:K(`Add a personal note`)});e.url&&window.location.replace(e.url)}catch(e){e.type&&e.type===`DisabledFeatureError`?a(K(`This site is not accepting payments at the moment.`)):r(K(`Something went wrong, please try again later.`)),t(!1)}}s&&s.donations_enabled===!1?(a(K(`This site is not accepting donations at the moment.`)),t(!1)):e()},[]),e?(0,q.jsx)(`div`,{children:(0,q.jsx)(rC,{})}):n?(0,q.jsx)(DC,{error:n}):i?(0,q.jsx)(DC,{error:i}):null};function Mw({initialState:e,key:t,parse:n}){let[r,i]=(0,_.useState)(()=>{let r=typeof e==`function`?e():e;try{let e=window.sessionStorage.getItem(t);return e===null?r:n(JSON.parse(e))??r}catch{return r}});return(0,_.useEffect)(()=>{try{window.sessionStorage.setItem(t,JSON.stringify(r))}catch{}},[t,r]),[r,i]}function Nw({key:e}){try{window.sessionStorage.removeItem(e)}catch{}}var Pw=mb,Fw=$p;function Iw({deliveryDateError:e,deliveryMethod:t,effectiveDeliveryDate:n,giftMessage:r,maxDeliveryDate:i,maxMessageLength:a,minDeliveryDate:o,onChangeDeliveryDate:s,onChangeDeliveryMethod:c,onChangeGiftMessage:l,onChangeRecipientEmail:u,onChangeRecipientName:d,recipientEmailField:f,recipientNameField:p}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:K(`How would you like to share this gift?`)}),(0,q.jsxs)(`div`,{"aria-label":K(`Delivery method`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:[(0,q.jsx)(`button`,{"aria-checked":t===`email`,className:`gh-portal-btn`+(t===`email`?` active`:``),"data-test-button":`delivery-method-email`,role:`radio`,type:`button`,onClick:()=>c(`email`),children:K(`Email it to them`)}),(0,q.jsx)(`button`,{"aria-checked":t===`link`,className:`gh-portal-btn`+(t===`link`?` active`:``),"data-test-button":`delivery-method-link`,role:`radio`,type:`button`,onClick:()=>c(`link`),children:K(`I'll share it myself`)})]})]}),(0,q.jsx)(`div`,{"aria-hidden":t!==`email`,className:`gh-portal-gift-checkout-reveal`,"data-open":t===`email`,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(Fw,{...p,onChange:e=>d(e.target.value)}),(0,q.jsx)(Fw,{...f,onChange:e=>u(e.target.value)}),(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-message`,children:K(`Optional message`)})}),(0,q.jsx)(`textarea`,{className:`gh-portal-input gh-portal-gift-checkout-textarea`,"data-test-input":`gift-message`,id:`gift-message`,maxLength:a,placeholder:K(`Add a short note to go with your gift`),value:r,onChange:e=>l(e.target.value)}),(0,q.jsx)(`div`,{"aria-hidden":r.length===0,className:`gh-portal-gift-checkout-reveal`,"data-open":r.length>0,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`p`,{className:`gh-portal-gift-checkout-message-count`,children:[r.length,`/`,a]})})}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-delivery-date`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-delivery-date`,children:K(`Delivery date`)})}),(0,q.jsx)(Pw,{ariaLabel:K(`Delivery date`),hasError:!!e,id:`gift-delivery-date`,max:i,min:o,minLabel:K(`Now`),value:n,onChange:s}),e&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-delivery-error`,children:e})]})]})})})]})}var Lw=`ghost-portal-gift-form-state`;function Rw({buyerName:e=``}={}){return{version:1,plan:{selectedDuration:null,selectedProductId:null,buyerEmail:``,buyerName:e,completed:!1},delivery:{method:`email`,emailDraft:{recipientEmail:``,recipientName:``,message:``,timing:{type:`immediate`}}}}}function zw(e,t){return typeof e==`string`&&e.length<=t}function Bw(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.plan,r=t.delivery,i=r?.emailDraft,a=i?.timing,o=n?.selectedDuration===null||Cf.includes(n?.selectedDuration),s=a?.type===`immediate`||a?.type===`scheduled`&&typeof a.date==`string`;return t.version!==1||!n||!r||!i||!o||!(n.selectedProductId===null||typeof n.selectedProductId==`string`)||!zw(n.buyerEmail,191)||!zw(n.buyerName,191)||typeof n.completed!=`boolean`||![`email`,`link`].includes(r.method)||!zw(i.recipientEmail,191)||!zw(i.recipientName,191)||!zw(i.message,250)||!s?null:t}function Vw(){Nw({key:Lw})}var Hw=$p;function Uw({activeDuration:e,offeredDurations:t,onSelectDuration:n}){return t.length<2?null:(0,q.jsx)(`div`,{"aria-label":K(`Gift duration`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:t.map(t=>{let r=t===e;return(0,q.jsx)(`button`,{"aria-checked":r,className:`gh-portal-btn`+(r?` active`:``),"data-test-button":`switch-duration-${t}`,role:`radio`,type:`button`,onClick:()=>n(t),children:Gd({cadence:`month`,duration:t})},t)})})}function Ww({activeDuration:e,activeDurationLabel:t,activeProduct:n,buyerEmailField:r,buyerNameField:i,isSingleTier:a,offeredDurations:o,onBuyerEmailChange:s,onBuyerNameChange:c,onSelectDuration:l,onSelectProduct:u,products:d,showBuyerEmail:f,showBuyerName:p,siteTitle:m,tierPriceLabel:h}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Gift a membership`)}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:K(`Share a full membership to {siteTitle} with a friend or colleague`,{siteTitle:m})})]}),(p||f)&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[p&&(0,q.jsx)(Hw,{...i,onChange:e=>c(e.target.value)}),f&&(0,q.jsx)(Hw,{...r,onChange:e=>s(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:K(a?`Membership details`:`Tier`)}),o.length>1?(0,q.jsx)(Uw,{activeDuration:e,offeredDurations:o,onSelectDuration:l}):(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-single-duration`,"data-test-single-duration":!0,children:K(`{duration} membership`,{duration:t})})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-section`,children:(0,q.jsx)(`div`,{"aria-label":a?void 0:K(`Choose a tier`),className:`gh-portal-gift-checkout-tiers`+(a?` single`:``),role:a?void 0:`radiogroup`,children:d.map(t=>{let r=t.id===n.id,i=t.benefits||[];return(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-item`+(r&&!a?` selected`:``),children:[(0,q.jsxs)(`button`,{"aria-checked":a?void 0:r,className:`gh-portal-gift-checkout-tier`,"data-test-tier":t.name,role:a?void 0:`radio`,type:`button`,onClick:()=>u(t.id),children:[!a&&(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-tier-radio`}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-content`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-heading`,children:[(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-name`,children:t.name}),(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-price`,children:h(t,e)})]}),t.description&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-tier-description`,children:t.description})]})]}),i.length>0&&(0,q.jsx)(`div`,{"aria-hidden":!r,className:`gh-portal-gift-checkout-tier-benefits`,"data-open":r,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-tier-benefits-inner`,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-benefits`,children:i.map((e,t)=>{let n=e.id||`benefit-${t}`;return(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-benefit`,children:[(0,q.jsx)(gh,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:e.name})]},n)})})})})]},t.id)})})})]})}var Gw=e=>(0,q.jsxs)(`svg`,{width:39,height:27,viewBox:`0 0 39 27`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsxs)(`g`,{fill:`currentColor`,children:[(0,q.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,q.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]}),(0,q.jsxs)(`g`,{fill:`currentColor`,transform:`translate(21 0)`,children:[(0,q.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,q.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]})]}),Kw=({recipientName:e,recipientEmail:t,buyerName:n,giftMessage:r,deliveryDate:i,isScheduled:a=!1,cadence:o,duration:s,tierName:c,benefits:l=[],siteTitle:u,siteIcon:d})=>{let f=e.trim(),p=t.trim(),m=n.trim(),h=r.trim(),g=ol(new Date),v=ol(dl(i))||g,[y,b]=(0,_.useState)(``);(0,_.useEffect)(()=>{a&&b(v)},[a,v]);let x=a?v:y||g,S=``;S=f&&p?`${f} <${p}>`:p||f;let C={buyerName:(0,q.jsx)(`strong`,{children:m}),duration:s,strong:(0,q.jsx)(`strong`,{}),tierName:(0,q.jsx)(`strong`,{children:c}),siteTitle:u},w=qd({buyerName:m,cadence:o,duration:s,siteTitle:u});return(0,q.jsx)(`div`,{className:`gh-portal-gift-email`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-sheet`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-meta`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-meta-text`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-email-from`,children:u}),(0,q.jsx)(`div`,{"aria-hidden":!S,className:`gh-portal-gift-checkout-reveal`,"data-open":!!S,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-to`,children:[(0,q.jsxs)(`span`,{className:`gh-portal-gift-email-meta-label`,children:[K(`To`),`:`]}),(0,q.jsx)(`span`,{className:`gh-portal-gift-email-to-value`,children:S})]})})})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-date-stack`,children:[(0,q.jsx)(`div`,{"aria-hidden":a,className:`gh-portal-gift-email-date`,"data-active":!a,children:g}),(0,q.jsx)(`div`,{"aria-hidden":!a,className:`gh-portal-gift-email-date`,"data-active":a,children:x})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-body`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-email-lockup`,children:d?(0,q.jsx)(`img`,{alt:u,className:`gh-portal-gift-email-lockup-icon`,src:d}):(0,q.jsx)(`span`,{className:`gh-portal-gift-email-lockup-title`,children:u})}),(0,q.jsx)(`h1`,{className:`gh-portal-gift-email-subject`,children:K(`A gift, just for you`)}),(0,q.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-reveal`,"data-open":!!f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsx)(`p`,{className:`gh-portal-gift-email-greeting`,children:K(`Hi {recipientName},`,{recipientName:f})})})}),(0,q.jsx)(`p`,{className:`gh-portal-gift-email-lede`,children:(0,q.jsx)(Bd,{mapping:C,string:w})}),(0,q.jsx)(`div`,{"aria-hidden":!h,className:`gh-portal-gift-checkout-reveal`,"data-open":!!h,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`blockquote`,{className:`gh-portal-gift-email-message`,children:[(0,q.jsx)(Gw,{"aria-hidden":`true`,className:`gh-portal-gift-email-message-mark`,focusable:`false`}),(0,q.jsx)(`p`,{className:`gh-portal-gift-email-message-text`,children:h}),m&&(0,q.jsx)(`p`,{className:`gh-portal-gift-email-message-from`,children:m})]})})}),l.length>0&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-benefits`,children:[(0,q.jsx)(`p`,{className:`gh-portal-gift-email-benefits-label`,children:K(`What's included`)}),(0,q.jsx)(`div`,{children:l.map((e,t)=>(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-benefit`,children:[(0,q.jsx)(gh,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:e.name})]},e?.id||`benefit-${t}`))})]})]})]})})},qw=Sf,Jw=Kw;function Yw({activeDuration:e,activeProduct:t,buyerName:n,cardRef:r,cardTiltProps:i,effectiveDeliveryDate:a,emailDuration:o,giftMessage:s,giftValue:c,minDeliveryDate:l,recipientEmail:u,recipientName:d,showEmailPreview:f,siteIcon:p,siteTitle:m}){return(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,...i,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-stage`,children:[(0,q.jsx)(`div`,{"aria-hidden":f,className:`gh-portal-gift-checkout-stage-item card`,"data-active":!f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-stack`,children:(0,q.jsx)(qw,{cardRef:r,duration:Gd({cadence:`month`,duration:e}),fromName:n.trim(),giftValue:c,siteIcon:p,siteTitle:m,tierName:t.name})})}),(0,q.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-stage-item email`,"data-active":f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-email-stack`,children:(0,q.jsx)(Jw,{...o,benefits:t.benefits||[],buyerName:n,deliveryDate:a,giftMessage:s,isScheduled:a>l,recipientEmail:u,recipientName:d,siteIcon:p,siteTitle:m,tierName:t.name})})})]})})})}var Xw=`ghostPortalGiftHistory`;function Zw(){let e=window.history.state;return e&&typeof e==`object`?e:{}}function Qw(){let e=Zw()[Xw];if(!e||typeof e!=`object`||!(`depth`in e))return null;let{depth:t}=e;return typeof t==`number`&&t>0?{depth:t}:null}function $w(e){return e===`delivery`?`#/portal/gift/delivery`:`#/portal/gift`}function eT(){window.dispatchEvent(new HashChangeEvent(`hashchange`))}function tT({step:e,replace:t=!1}){let n=$w(e);if(t){window.history.replaceState(window.history.state,``,n),eT();return}let r=Qw(),i=r?{...Zw(),[Xw]:{depth:r.depth+1}}:window.history.state;window.history.pushState(i,``,n),eT()}function nT(){window.location.hash!==`#/portal/gift`&&window.history.pushState({...Zw(),[Xw]:{depth:1}},``,`#/portal/gift`)}function rT(){let e=Qw();return e?(window.history.go(-e.depth),!0):!1}var iT=Sb,aT=365;function oT(e){return e===`signup`?`#/portal/signup`:e===`accountHome`?`#/portal/account`:e===`accountPlan`?`#/portal/account/plans`:null}var sT=()=>{let{site:e,member:t,brandColor:n,action:r,doAction:i,lastPage:a,pageData:o}=(0,_.useContext)(J),s=o?.giftStep===`delivery`?`delivery`:`plan`,[c,l]=(0,_.useState)(s),[u,d]=Mw({key:Lw,initialState:()=>Rw({buyerName:t?.name||``}),parse:Bw}),[f,p]=(0,_.useState)({}),{cardRef:m,containerProps:h}=hC(),g=(0,_.useRef)(null),v=(0,_.useRef)(!1),{plan:y,delivery:b}=u,{selectedDuration:x,selectedProductId:S,buyerEmail:C,buyerName:w}=y,{method:T,emailDraft:E}=b,{recipientEmail:D,recipientName:O,message:k,timing:ee}=E;(0,_.useEffect)(()=>{d(e=>e.plan.buyerName||!t?.name?e:{...e,plan:{...e.plan,buyerName:t.name}})},[t?.name]),(0,_.useEffect)(()=>{if(s===`delivery`&&!y.completed){l(`plan`),tT({step:`plan`,replace:!0});return}g.current!==s&&(g.current=s,l(s))},[y.completed,s]);let A=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=requestAnimationFrame(()=>{let e=A.current,t=e?.ownerDocument;if(!t)return;let n=t.defaultView;t.querySelectorAll(`.gh-portal-popup-wrapper, .gh-portal-popup-container`).forEach(e=>{e.scrollTop=0});for(let t=e.parentElement;t;t=t.parentElement){let e=n?.getComputedStyle(t).overflowY;(e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight&&(t.scrollTop=0)}});return()=>cancelAnimationFrame(e)},[c]);let te=()=>{let e=oT(a);!rT()&&e&&window.history.replaceState(window.history.state,``,e),i(`back`)},j=()=>{i(`closePopup`)},ne=e?.portal_default_plan??null,re=kf({site:e}),M=Nf({availableDurations:re,portalDefaultPlan:ne,selectedDuration:x}),N=M?Of({site:e,duration:M}):[],ie=x!==null&&re.includes(x)&&S!==null&&N.some(e=>e.id===S);if((0,_.useEffect)(()=>{!e||!y.completed||ie||(d(e=>({...e,plan:{...e.plan,completed:!1}})),l(`plan`),tT({step:`plan`,replace:!0}))},[y.completed,ie,e]),!e)return(0,q.jsx)(rC,{});function ae(t,n){return bC(Df(t,n),e?.locale)}let oe=e.icon,se=e.title||``;if(!M||N.length===0)return(0,q.jsxs)(`div`,{className:`gh-portal-content gift`,children:[(0,q.jsx)(vf,{onClick:j}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-inner`,children:(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Gift a membership`)}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:K(`Gift subscriptions are not available right now.`)})]})})]}),(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-right`})]})]});let P=N.find(e=>e.id===S)||N[0];if(!P)return null;let ce=N.length===1,le=M===12?{cadence:`year`,duration:1}:{cadence:`month`,duration:M},ue=Kd(le),de=r===`checkoutGift:running`,F=c===`plan`?!!(f.email||f.buyerName):!!(f.recipientEmail||f.deliveryDate),fe=xl()||de||F,pe=!!t,me=!(t?.name||``).trim(),he=!pe,I=c===`delivery`&&T===`email`,ge=gl(new Date,e.timezone),L=pl(ge,aT),_e=ee.type===`scheduled`?ee.date:ge,ve={type:`email`,value:C,placeholder:K(`jamie@example.com`),label:K(`Your email`),name:`email`,required:!0,maxLength:191,errorMessage:f.email||``},ye={type:`email`,value:D,placeholder:K(`taylor@example.com`),label:K(`Recipient's email`),name:`recipientEmail`,required:!1,maxLength:191,errorMessage:f.recipientEmail||``},be={type:`text`,value:w,placeholder:K(`Jamie Larson`),label:K(`Your name`),name:`buyerName`,required:!0,maxLength:191,errorMessage:f.buyerName||``},xe={type:`text`,value:O,placeholder:K(`Taylor Reid`),label:K(`Recipient's name`),name:`recipientName`,required:!1,maxLength:191,errorMessage:``},Se=e=>{p(e=>({...e,email:``})),d(t=>({...t,plan:{...t.plan,buyerEmail:e,completed:!1}}))},Ce=e=>{p(e=>({...e,buyerName:``})),d(t=>({...t,plan:{...t.plan,buyerName:e,completed:!1}}))},R=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientEmail:e}}}))},we=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,method:e}}))},Te=e=>{p(e=>({...e,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,timing:e===ge?{type:`immediate`}:{type:`scheduled`,date:e}}}}))},Ee=e=>{d(t=>({...t,plan:{...t.plan,selectedDuration:e,completed:!1}}))},De=e=>{d(t=>({...t,plan:{...t.plan,selectedProductId:e,completed:!1}}))},Oe=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientName:e}}}))},ke=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,message:e}}}))},Ae=()=>{let e=[];pe||e.push({...ve,value:C.trim()}),e.push({...be,value:w.trim()});let t=iT({fields:e}),n=Object.values(t).some(e=>!!e);p(t),!n&&(d(e=>({...e,plan:{...e.plan,selectedDuration:M,selectedProductId:P.id,completed:!0}})),nT(),v.current=!0,l(`delivery`),tT({step:`delivery`}))},je=()=>{p({}),l(`plan`),v.current?(v.current=!1,window.history.back()):tT({step:`plan`,replace:!0})};return(0,q.jsxs)(`div`,{ref:A,className:`gh-portal-content gift`,children:[(0,q.jsx)(vf,{onClick:j}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,"data-step":c,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(c===`delivery`||a)&&(0,q.jsx)(hb,{onBack:()=>c===`delivery`?je():te()}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[c===`plan`?(0,q.jsx)(Ww,{activeDuration:M,activeDurationLabel:ue,activeProduct:P,buyerEmailField:ve,buyerNameField:be,isSingleTier:ce,offeredDurations:re,products:N,showBuyerEmail:he,showBuyerName:me,siteTitle:se,tierPriceLabel:ae,onBuyerEmailChange:Se,onBuyerNameChange:Ce,onSelectDuration:Ee,onSelectProduct:De}):(0,q.jsx)(Iw,{deliveryDateError:f.deliveryDate||``,deliveryMethod:T,effectiveDeliveryDate:_e,giftMessage:k,maxDeliveryDate:L,maxMessageLength:250,minDeliveryDate:ge,recipientEmailField:ye,recipientNameField:xe,onChangeDeliveryDate:Te,onChangeDeliveryMethod:we,onChangeGiftMessage:ke,onChangeRecipientEmail:R,onChangeRecipientName:Oe}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-cta-wrapper`,children:(0,q.jsx)(df,{brandColor:n,classes:`gh-portal-gift-checkout-cta`,dataTestId:c===`plan`?`gift-continue`:`purchase-gift`,disabled:fe,isRunning:c===`delivery`&&de,label:K(c===`plan`?`Continue to delivery details`:`Continue to payment`),style:{width:`100%`},onClick:c===`plan`?Ae:()=>{if(de)return;let e=C.trim(),t=D.trim(),n=O.trim(),r=w.trim(),a=k.trim(),o=T===`email`,s=o&&_e>ge,c=[];pe||c.push({...ve,value:e}),o&&t&&c.push({...ye,value:t});let u=iT({fields:c});o&&!t&&(u.recipientEmail=K(`Enter the recipient's email address`)),o&&(_e?_e<ge?u.deliveryDate=K(`Choose a date from today onwards`):_e>L&&(u.deliveryDate=K(`Choose a date within the next year`)):u.deliveryDate=K(`Choose a delivery date`));let f=Object.values(u).some(e=>!!e);if(p(u),f){u.email&&(l(`plan`),d(e=>({...e,plan:{...e.plan,completed:!1}})),tT({step:`plan`,replace:!0}));return}i(`checkoutGift`,{tierId:P.id,duration:M,...pe?{}:{email:e},deliveryMethod:T,...o?{recipientEmail:t}:{},...o&&n?{recipientName:n}:{},buyerName:r,...o&&a?{personalMessage:a}:{},...s?{deliveryDate:_e}:{}})}})})]})]}),(0,q.jsx)(Yw,{activeDuration:M,activeProduct:P,buyerName:w,cardRef:m,cardTiltProps:h,effectiveDeliveryDate:_e,emailDuration:le,giftMessage:k,giftValue:ae(P,M),minDeliveryDate:ge,recipientEmail:D,recipientName:O,showEmailPreview:I,siteIcon:oe,siteTitle:se})]})]})},cT=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},lT=(e,t)=>`${e}?${new URLSearchParams(t).toString()}`,uT=({shareTitle:e,shareUrl:t})=>{let n=[e,t].filter(Boolean).join(`
|
|
6136
|
+
`;function WC({site:e}){return il+VC+_f+Bh+Qp+Vm+sm+gm+Cm+fb+yh({site:e})+hf+lf+pf+Xc+wS+aS+jS({site:e})+Vd+DS+HC+UC+aC+fC+``+mC+_C+yC+DC+SC+jC+LC+RC}var GC=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={email:``,token:void 0}}componentDidMount(){let{member:e}=this.context;e&&this.context.doAction(`switchPage`,{page:`accountHome`})}handleSignin(e){e.preventDefault(),this.doSignin()}doSignin(){this.setState(e=>({errors:Cb({fields:this.getInputFields({state:e})})}),async()=>{let{email:e,phonenumber:t,errors:n,token:r}=this.state,{redirect:i}=this.context.pageData??{};n&&Object.values(n).filter(e=>!!e).length>0||this.context.doAction(`signin`,{email:e,phonenumber:t,redirect:i,token:r})})}handleInputChange(e,t){let n=t.name;this.setState({[n]:e.target.value})}onKeyDown(e){e.keyCode===13&&this.handleSignin(e)}getInputFields({state:e}){let t=e.errors||{};return[{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,errorMessage:t.email||``,autoFocus:!0},{type:`text`,value:e.phonenumber,placeholder:`+1 (123) 456-7890`,label:`Phone number`,name:`phonenumber`,required:!1,tabIndex:-1,autoComplete:`off`,hidden:!0}]}renderSubmitButton(){let{action:e}=this.context,t=!1,n=e===`signin:running`,r=K(n?`Sending login link...`:`Continue`),i=!!n;return e===`signin:failed`&&(r=K(`Retry`),t=!0),(0,q.jsx)(df,{dataTestId:`signin`,retry:t,style:{width:`100%`},onClick:e=>this.handleSignin(e),disabled:i,brandColor:this.context.brandColor,label:r,isRunning:n})}renderSignupMessage(){let{brandColor:e}=this.context;return(0,q.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,q.jsx)(`div`,{children:K(`Don't have an account?`)}),(0,q.jsx)(`button`,{"data-test-button":`signup-switch`,className:`gh-portal-btn gh-portal-btn-link`,style:{color:e},onClick:()=>this.context.doAction(`switchPage`,{page:`signup`}),children:(0,q.jsx)(`span`,{children:K(`Sign up`)})})]})}renderForm(){let{site:e}=this.context,t=Jl({site:e})&&Wl({site:e});return ql({site:e})?(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(nm,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)})}),(0,q.jsxs)(`footer`,{className:`gh-portal-signin-footer`,children:[this.renderSubmitButton(),t&&this.renderSignupMessage()]})]}):(0,q.jsx)(`section`,{children:(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-members-disabled-notification`,"data-testid":`members-disabled-notification-text`,children:K(`Memberships unavailable, contact the owner for access.`)})})})}renderSiteIcon(){let e={},{site:t}=this.context,n=t.icon;return n?(e.backgroundImage=`url(${n})`,(0,q.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n,alt:this.context.site.title})):ql({site:t})?null:(0,q.jsx)(wb,{className:`gh-portal-icon gh-portal-icon-invitation`})}renderSiteTitle(){let{site:e}=this.context,t=e.title;return ql({site:e})?(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Sign in`)}):(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:t})}renderFormHeader(){return(0,q.jsxs)(`header`,{className:`gh-portal-signin-header`,children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-content signin`,children:[this.renderFormHeader(),this.renderForm()]})})]})}},KC=({handleSignout:e,supportAddress:t=``})=>{let n=`mailto:${t}`;return(0,q.jsxs)(`footer`,{className:`gh-portal-account-footer`,children:[(0,q.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,q.jsx)(`li`,{children:(0,q.jsx)(`button`,{"data-test-button":`footer-signout`,className:`gh-portal-btn`,name:`logout`,"aria-label":`logout`,onClick:t=>e(t),children:K(`Sign out`)})})}),(0,q.jsx)(`div`,{className:`gh-portal-account-footerright`,children:(0,q.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,q.jsx)(`li`,{children:(0,q.jsx)(`a`,{"data-test-link":`footer-support`,className:`gh-portal-btn gh-portal-btn-branded`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:K(`Contact support`)})})})})]})},qC=()=>{let{member:e,brandColor:t}=(0,_.useContext)(J),n=e.avatar_image;return(0,q.jsxs)(`header`,{className:`gh-portal-account-header`,children:[(0,q.jsx)(Qc,{gravatar:n,style:{userIcon:{color:t,width:`56px`,height:`56px`,padding:`2px`}}}),(0,q.jsx)(`h2`,{className:`gh-portal-main-title`,children:K(`Your account`)})]})},JC=()=>{let{site:e,action:t,brandColor:n,doAction:r}=(0,_.useContext)(J);if(!Jl({site:e})||!Wl({site:e}))return null;let i=[`checkoutPlan:running`].includes(t),a=()=>{r(`switchPage`,{page:`accountPlan`,lastPage:`accountHome`})};return(0,q.jsx)(df,{dataTestId:`view-plans`,isRunning:i,label:K(`View plans`),onClick:()=>a(),brandColor:n,style:{width:`100%`}})},YC=()=>{let{member:e,site:t}=(0,_.useContext)(J),{paid_members_enabled:n}=t;if(!n||zl({site:t}))return null;let r=Cl({member:e}),i=wl({member:e});if(i&&!r)return null;if(r){let t=r?.current_period_end,n=kl({member:e});return El({member:e})?n?(0,q.jsx)(`div`,{className:`gh-portal-section`,style:{marginBottom:24},children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your gift subscription will expire on {expiryDate}`,{expiryDate:n})})}):null:i&&n?(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will expire on {expiryDate}`,{expiryDate:n})})}):r?.cancel_at_period_end||i?null:gu({sub:r})?(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will start on {subscriptionStart}`,{subscriptionStart:ol(r.trial_end_at)})})}):(0,q.jsx)(`div`,{className:`gh-portal-section`,children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`Your subscription will renew on {renewalDate}`,{renewalDate:ol(t)})})})}return(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:K(`You currently have a free membership, upgrade to a paid subscription for full access.`)}),(0,q.jsx)(JC,{})]})},XC=()=>{let{member:e,doAction:t,action:n,brandColor:r}=(0,_.useContext)(J),i=Cl({member:e});if(!i||!i.cancel_at_period_end)return null;let a=K(`Resume subscription`),o=[`continueSubscription:running`].includes(n),s=!!o,c=ol(i.current_period_end);return(0,q.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`Your subscription has been canceled and will expire on {expiryDate}.`),mapping:{expiryDate:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(df,{onClick:()=>{t(`continueSubscription`,{subscriptionId:i.id})},isRunning:o,disabled:s,isPrimary:!0,brandColor:r,label:a,style:{width:`100%`}})]})})},ZC=()=>{let{member:e,site:t,doAction:n,action:r,brandColor:i}=(0,_.useContext)(J);if(!(El({member:e})&&!Al({member:e,site:t})&&Kl({site:t}))||!kl({member:e}))return null;let a=r===`continueGiftSubscription:running`;return(0,q.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,q.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,q.jsx)(`p`,{style:{maxWidth:`none`,margin:`0 0 16px`,textAlign:`center`,textWrap:`pretty`},children:K(`Continue with a paid subscription anytime. Your remaining gift period will be added as a free trial.`)}),(0,q.jsx)(df,{onClick:()=>n(`continueGiftSubscription`),isRunning:a,disabled:a,isPrimary:!0,brandColor:i,label:K(`Continue subscription`),style:{width:`100%`}})]})})},QC=e=>(0,q.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`defs`,{children:(0,q.jsx)(`style`,{children:`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}`})}),(0,q.jsx)(`path`,{d:`M22.939 2.56V8.817C22.9391 9.61244 22.6232 10.3754 22.061 10.938L10.5 22.5C10.2187 22.7812 9.83721 22.9392 9.43946 22.9392C9.04172 22.9392 8.66026 22.7812 8.37896 22.5L1.49997 15.62C1.21876 15.3387 1.06079 14.9572 1.06079 14.5595C1.06079 14.1618 1.21876 13.7803 1.49997 13.499L13.061 1.938C13.6236 1.37572 14.3865 1.0599 15.182 1.06H21.439C21.8368 1.06 22.2183 1.21803 22.4996 1.49934C22.7809 1.78064 22.939 2.16217 22.939 2.56V2.56Z`,className:`a`}),(0,q.jsx)(`path`,{d:`M17.689 7.81C16.8605 7.81 16.189 7.13842 16.189 6.31C16.189 5.48157 16.8605 4.81 17.689 4.81C18.5174 4.81 19.189 5.48157 19.189 6.31C19.189 7.13842 18.5174 7.81 17.689 7.81Z`,className:`a`})]}),$C=()=>{let{member:e,site:t,doAction:n}=(0,_.useContext)(J),r=()=>{let t=Cl({member:e});n(`manageBilling`,{subscriptionId:t.id})},i=()=>{Kl({site:t})&&n(`switchPage`,{page:`accountPlan`,lastPage:`accountHome`})},a=({price:t,isComplimentary:n,subscription:r})=>{let{next_payment:i}=r||{},a=``;if(t){let{amount:e=0,currency:n,interval:r}=t;a=`${Intl.NumberFormat(`en`,{currency:n,style:`currency`}).format(e/100)}/${K(r)}`}let o=kl({member:e});if(El({member:e})&&o)return(0,q.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,children:[(0,q.jsx)(yf,{className:`gh-portal-account-tagicon`}),(0,q.jsx)(`span`,{children:K(`Gift subscription`)}),(0,q.jsx)(`span`,{className:`gh-portal-account-expiry-separator`,children:`-`}),(0,q.jsx)(`span`,{className:`gh-portal-account-expiry`,children:K(`Expires {expiryDate}`,{expiryDate:o})})]});n&&(a=o?`${K(`Complimentary`)} - ${K(`Expires {expiryDate}`,{expiryDate:o})}`:K(`Complimentary`));let s=``;if(gu({sub:r}))return s=`gh-portal-account-old-price`,(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:s,children:a}),(0,q.jsx)(ew,{subscription:r})]});let c=tw({nextPayment:i});return c&&(s=`gh-portal-account-old-price`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:s,children:a}),(0,q.jsx)(()=>c?(0,q.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,"data-testid":`offer-label`,children:[(0,q.jsx)(QC,{className:`gh-portal-account-tagicon`}),(0,q.jsx)(`span`,{children:c})]}):null,{})]})},o=({isPaid:r})=>{let a=El({member:e});if(a&&!Kl({site:t}))return null;let o=a&&!Al({member:e,site:t});return zl({site:t})&&(!r||a&&!o)?null:o?(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),n(`continueGiftSubscription`)},"data-test-button":`continue-gift-subscription`,children:K(`Continue`)}):(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),i(e)},"data-test-button":`change-plan`,children:K(`Change`)})},s=({defaultCardLast4:e})=>e?(0,q.jsx)(`p`,{children:`**** **** **** ${e}`}):null,c=({defaultCardLast4:e})=>{let{action:t}=(0,_.useContext)(J),n=t===`manageBilling:running`?(0,q.jsx)(cf,{className:`gh-portal-billing-button-loader`}):K(`Update`);return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Billing info & receipts`)}),(0,q.jsx)(s,{defaultCardLast4:e})]}),(0,q.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-billing`,"aria-hidden":`true`,children:n})]})},l=Cl({member:e}),u=wl({member:e}),d=El({member:e}),f=Tl({member:e});if(l||u){let{price:t,default_payment_card_last4:n}=l||{},r=K(`Plan`);return Rl({member:e})&&(r=Rl({member:e})),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsxs)(`h3`,{children:[r,l?.cancel_at_period_end&&(0,q.jsx)(`span`,{className:`gh-portal-canceled-badge`,children:K(`Canceled`)})]}),(0,q.jsx)(a,{price:t,isComplimentary:u,subscription:l})]}),(0,q.jsx)(o,{isPaid:f})]}),!u&&!d&&(0,q.jsx)(c,{defaultCardLast4:n})]})}return null};function ew({subscription:e}){return gu({sub:e})?(0,q.jsx)(`p`,{className:`gh-portal-account-discountcontainer`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`span`,{children:K(`Free Trial – Ends {trialEnd}`,{trialEnd:ol(e.trial_end_at)})})})}):null}function tw({nextPayment:e}){if(!e)return``;let t=e.discount;if(!t)return``;let n=t.end?K(`Ends {offerEndDate}`,{offerEndDate:ol(t.end)}):K(`Forever`);return`${`${Intl.NumberFormat(`en`,{currency:e.currency,style:`currency`}).format(e.amount/100)}/${K(e.interval)}`}${n?` — ${n}`:``}`}function nw({site:e,member:t}){return Mf({site:e})&&Tl({member:t??void 0})&&!El({member:t??void 0})}function rw(){let{member:e,site:t,doAction:n}=(0,_.useContext)(J),r=nw({site:t,member:e});if((0,_.useEffect)(()=>{r&&xf(t?.url)},[r,t?.url]),!r)return null;let i=()=>{n(`switchPage`,{page:`gift`,lastPage:`accountHome`})};return(0,q.jsx)(`div`,{className:`gh-portal-list gh-portal-gift-card`,children:(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Gift membership`)}),(0,q.jsx)(`p`,{children:K(`For a friend or colleague`)})]}),(0,q.jsxs)(`span`,{"aria-hidden":`true`,className:`gh-portal-list-action`,"data-test-button":`give-gift-subscription`,children:[(0,q.jsx)(yf,{className:`gh-portal-gift-card-icon`}),K(`Buy`)]})]})})}function iw(){let{member:e,site:t,doAction:n}=(0,_.useContext)(J),{newsletters:r}=e,i=!!r?.length,a=K(i?`Subscribed`:`Unsubscribed`),o=()=>{let r=fu({site:t}),i=e?.newsletters?.length?[]:r;n(`updateNewsletterPreference`,{newsletters:i})};return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,"aria-pressed":i,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail email-newsletter`,children:[(0,q.jsx)(`h3`,{children:K(`Email newsletter`)}),(0,q.jsxs)(`p`,{children:[a,` `,Tu({member:e})&&i&&(0,q.jsx)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:e=>{e.stopPropagation(),n(`switchPage`,{page:`emailReceivingFAQ`,lastPage:`accountHome`})},children:K(`Not receiving emails?`)})]})]}),(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{dataTestId:`default-newsletter-toggle`,id:`default-newsletter-toggle`,label:K(`Email newsletter`),onToggle:e=>{o(e,i)},checked:i,presentational:!0})})]})}var aw=e=>(0,q.jsxs)(`svg`,{fill:`none`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,...e,children:[(0,q.jsx)(`path`,{d:`m12.79 12.376 4.08 4.079m-4.08 0 4.08-4.08`,stroke:`red`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,q.jsx)(`path`,{d:`m10.439 17.994-2.664-2.652-2.86 1.478.111-4.239m0 0L1.677 9.232a1.344 1.344 0 0 1-.366-1.222 1.369 1.369 0 0 1 .904-1.05l13.111-4.374a1.369 1.369 0 0 1 1.76 1.758L15 10m-9.974 2.581 11.67-9.727`,stroke:`#A3A3A3`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`})]});function ow(){return(0,q.jsxs)(`p`,{className:`gh-portal-email-notice`,children:[(0,q.jsx)(aw,{className:`gh-portal-email-notice-icon`}),(0,q.jsx)(`span`,{className:`gh-mobile-only`,children:K(`You're not receiving emails`)}),(0,q.jsx)(`span`,{className:`gh-desktop-only`,children:K(`You're currently not receiving emails`)})]})}function sw(){let{doAction:e,member:t,site:n}=(0,_.useContext)(J),r=mu({member:t}),i=Ol({site:n}),a=Ql({site:n}),o=r?`emailSuppressed`:`accountEmail`,s=!i&&!a,c=()=>r||s?(0,q.jsx)(ow,{}):(0,q.jsx)(`p`,{children:K(`Update your preferences`)}),l=()=>{e(`switchPage`,{page:o,lastPage:`accountHome`})};return(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Emails`)}),c()]}),(0,q.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-newsletters`,"aria-hidden":`true`,children:K(`Manage`)})]})}var cw=()=>{let{member:e,site:t}=(0,_.useContext)(J),n=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},r=n?.enabled===!0,i=e?.uuid,a=Qu(),[o,s]=(0,_.useState)(a&&r);return(0,_.useEffect)(()=>{if(a){s(r);return}if(!r||!i){s(!1);return}s(!1);let e=new AbortController;return(async()=>{try{let t=await fetch(`https://partner.transistor.fm/ghost/member/${i}`,{signal:e.signal});if(t.ok){let n=await t.json();e.signal.aborted||s(n?.member===!0)}}catch(t){if(e.signal.aborted)return;console.warn(`Error in Transistor request`,t)}})(),()=>e.abort()},[r,i,a]),{transistor:{enabled:r,hasPodcasts:o,memberUuid:i,settings:n}}},lw=(e,t)=>pu({site:e})&&Ol({site:e})||Ql({site:e})||mu({member:t}),uw=e=>!pu({site:e})&&Ol({site:e})&&!Ql({site:e}),dw=()=>{let{member:e,doAction:t,site:n}=(0,_.useContext)(J),{name:r,email:i}=e,{transistor:a}=cw(),o=()=>{t(`switchPage`,{page:`accountProfile`,lastPage:`accountHome`})},s=lw(n,e),c=uw(n);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,q.jsxs)(`section`,{className:`gh-portal-list-clickable`,role:`button`,tabIndex:0,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:r&&!Zl({site:n})?r:K(`Account`)}),(0,q.jsx)(`p`,{children:i})]}),(0,q.jsx)(`span`,{"data-test-button":`edit-profile`,className:`gh-portal-list-action`,"aria-hidden":`true`,children:K(`Edit`)})]}),(0,q.jsx)($C,{}),s&&(0,q.jsx)(sw,{}),c&&(0,q.jsx)(iw,{}),a.enabled&&(0,q.jsx)(BC,{hasPodcasts:a.hasPodcasts,memberUuid:a.memberUuid,settings:a.settings})]}),(0,q.jsx)(rw,{})]})},fw=()=>(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-account-main`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(qC,{}),(0,q.jsxs)(`section`,{className:`gh-portal-account-data`,children:[(0,q.jsx)(YC,{}),(0,q.jsx)(ZC,{}),(0,q.jsx)(XC,{}),(0,q.jsx)(dw,{})]})]}),pw=class extends _.Component{static contextType=J;componentDidMount(){let{member:e,site:t}=this.context;ql({site:t})||this.context.doAction(`signout`),e||this.context.doAction(`switchPage`,{page:`signin`,pageData:{redirect:window.location.href}})}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}render(){let{member:e,site:t}=this.context,n=Ou({site:t});return!e||!ql({site:t})?null:(0,q.jsxs)(`div`,{className:`gh-portal-account-wrapper`,children:[(0,q.jsx)(fw,{}),(0,q.jsx)(KC,{onClose:()=>this.context.doAction(`closePopup`),handleSignout:e=>this.handleSignout(e),supportAddress:n})]})}},mw=class extends _.Component{static contextType=J;constructor(e,t){super(e,t);let{name:n=``,email:r=``,metafields:i}=t.member||{};this.state={name:n,email:r,metafields:Fm((t.customFields??[]).map(Mm),i?.custom||{})}}componentDidMount(){let{member:e}=this.context;e||this.context.doAction(`switchPage`,{page:`signin`})}handleSignout(e){e.preventDefault(),this.context.doAction(`signout`)}onBack(){this.context.doAction(`back`)}onProfileSave(e){e.preventDefault(),this.setState(e=>({errors:Cb({fields:this.getInputFields({state:e})})}),()=>{let{email:e,name:t,errors:n}=this.state;if(!(n&&Object.values(n).filter(e=>!!e).length>0)){this.context.doAction(`clearPopupNotification`);let n=zm(this.customFields(),this.state.metafields,this.context.member.metafields?.custom||{});this.context.doAction(`updateProfile`,{email:e,name:t,...n?{metafields:n}:{}})}})}renderSaveButton(){let e=this.context.action===`updateProfile:running`,t=K(`Save`);return this.context.action===`updateProfile:failed`&&(t=K(`Retry`)),(0,q.jsx)(df,{dataTestId:`save-button`,isRunning:e,onClick:e=>this.onProfileSave(e),disabled:!!e,brandColor:this.context.brandColor,label:t,style:{width:`100%`}})}renderDeleteAccountButton(){return(0,q.jsx)(`div`,{style:{cursor:`pointer`,color:`red`},role:`button`,children:K(`Delete account`)})}renderAccountFooter(){return(0,q.jsx)(`footer`,{className:`gh-portal-action-footer`,children:this.renderSaveButton()})}renderHeader(){return(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:e=>this.onBack(e)}),(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:K(`Account settings`)})]})}renderUserAvatar(){return(0,q.jsx)(`div`,{style:{position:`relative`,display:`flex`,width:`64px`,height:`64px`,marginBottom:`6px`,borderRadius:`100%`,boxShadow:`0 0 0 3px #fff`,border:`1px solid gray`,overflow:`hidden`,justifyContent:`center`,alignItems:`center`},children:(0,q.jsx)(Qc,{gravatar:this.context.member&&this.context.member.avatar_image,style:{userIcon:{color:`black`,width:`56px`,height:`56px`}}})})}handleInputChange(e,t){this.setState({[t.name]:e.target.value})}handleCustomFieldChange(e,t){this.setState(({metafields:n})=>({metafields:{...n,[e.key]:t}}))}customFields(){return(this.context.customFields??[]).map(Mm)}getInputFields({state:e,fieldNames:t}){let n=e.errors||{},r=[{type:`text`,value:e.name,placeholder:K(`Jamie Larson`),label:K(`Name`),name:`name`,required:!1,errorMessage:n.name||``},{type:`email`,value:e.email,placeholder:K(`jamie@example.com`),label:K(`Email`),name:`email`,required:!0,errorMessage:n.email||``}];return t&&t.length>0?r.filter(e=>t.includes(e.name)):r}onKeyDown(e){e.keyCode===13&&this.onProfileSave(e)}renderProfileData(){let e=this.customFields();return(0,q.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,q.jsx)(nm,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)}),e.length>0&&(0,q.jsx)(eh,{errors:this.context.fieldErrors||{},fields:e,onChange:(e,t)=>this.handleCustomFieldChange(e,t),onKeyDown:e=>this.onKeyDown(e),values:this.state.metafields})]})}render(){let{member:e}=this.context;return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[this.renderHeader(),(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-section`,children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};function hw(){let{brandColor:e,lastPage:t,doAction:n}=(0,_.useContext)(J);return(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,q.jsx)(`h3`,{className:`gh-portal-main-title`,children:K(`Email preferences`)})]})}function gw({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){let r=t.some(t=>t.id===e?.id),i=()=>{let i=[];i=r?t.filter(t=>t.id!==e.id):t.filter(t=>t.id!==e.id).concat(e),n(i)};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`newsletter-toggle`,role:`button`,tabIndex:0,"aria-pressed":r,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:e.name}),(0,q.jsx)(`p`,{children:e?.description})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:e.id,label:e.name,onToggle:i,checked:r,dataTestId:`switch-input`,presentational:!0})})]})}function _w({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){let r=!!n,i=(0,_.useRef)(!1);if(!t)return null;let a=async()=>{if(!i.current){i.current=!0;try{await e(!r)}finally{i.current=!1}}};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`comment-toggle`,role:`button`,tabIndex:0,"aria-pressed":r,onClick:a,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Comments`)}),(0,q.jsx)(`p`,{children:K(`Get notified when someone replies to your comment`)})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:`comments`,label:K(`Comments`),onToggle:a,checked:r,dataTestId:`switch-input`,presentational:!0})})]})}function vw({updateUpdatesAndAnnouncements:e,canChangeUpdatesAndAnnouncements:t,enableUpdatesAndAnnouncements:n}){let{site:r}=(0,_.useContext)(J),i=(0,_.useRef)(!1);if(!t)return null;let a=async()=>{if(!i.current){i.current=!0;try{await e(!n)}finally{i.current=!1}}};return(0,q.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`updates-and-announcements-toggle`,role:`button`,tabIndex:0,"aria-pressed":!!n,onClick:a,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},children:[(0,q.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,q.jsx)(`h3`,{children:K(`Updates & announcements`)}),(0,q.jsx)(`p`,{children:K(`Occasional updates from {siteTitle}`,{siteTitle:r?.title})})]}),(0,q.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,q.jsx)(gf,{id:`updates-and-announcements`,label:K(`Updates & announcements`),onToggle:a,checked:n,dataTestId:`switch-input`,presentational:!0})})]})}function yw({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){let{site:r}=(0,_.useContext)(J),i=fu({site:r});return n?i.map(n=>(0,q.jsx)(gw,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id)):null}function bw(){let{doAction:e}=(0,_.useContext)(J);return(0,q.jsxs)(`section`,{className:`gh-portal-list-help`,children:[(0,q.jsx)(`span`,{className:`gh-portal-list-help-label`,children:K(`Not receiving emails?`)}),(0,q.jsxs)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:()=>e(`switchPage`,{page:`emailReceivingFAQ`,pageData:{direct:!1}}),children:[K(`Get help`),` `,(0,q.jsx)(`span`,{className:`right-arrow`,children:`→`})]})]})}function xw({site:e,isPaid:t}){return t?(0,q.jsx)(`p`,{className:`gh-portal-btn-unsubscribe-note`,children:K(`Unsubscribing from emails will not cancel your paid subscription to {title}`,{title:e?.title})}):null}function Sw({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:r,updateCommentNotifications:i,updateUpdatesAndAnnouncements:a,unsubscribeAll:o,isPaidMember:s,isCommentsEnabled:c,enableCommentNotifications:l,canChangeUpdatesAndAnnouncements:u,enableUpdatesAndAnnouncements:d}){let{brandColor:f,member:p,site:m}=(0,_.useContext)(J),h=(0,_.useRef)(!!n?.length).current,g=d!=null,v=g?d:h,y=c&&!l||!c,b=u&&!v||!u,x=!n?.length&&y&&b;return(0,q.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-email-preferences-header`,children:[(0,q.jsx)(hw,{}),(0,q.jsx)(t||(()=>null),{})]}),(0,q.jsx)(vf,{brandColor:f}),(0,q.jsx)(`div`,{className:`gh-portal-section flex`,children:(0,q.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,q.jsx)(yw,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:e=>{let t=e.map(e=>({id:e.id}));u&&!g?r(t,v):r(t)}}),(0,q.jsx)(_w,{isCommentsEnabled:c,enableCommentNotifications:l,updateCommentNotifications:i}),(0,q.jsx)(vw,{canChangeUpdatesAndAnnouncements:u,enableUpdatesAndAnnouncements:v,updateUpdatesAndAnnouncements:a}),Tu({member:p})&&!x&&(0,q.jsx)(bw,{})]})}),(0,q.jsxs)(`div`,{className:`gh-portal-btn-unsubscribe`,children:[(0,q.jsx)(df,{isRunning:!1,onClick:()=>{o()},disabled:x,brandColor:f,isPrimary:!1,label:K(`Unsubscribe from all emails`),isDestructive:!0,style:{width:`100%`},dataTestId:`unsubscribe-from-all-emails`}),(0,q.jsx)(xw,{isPaid:s,site:m})]})]})}function Cw(){let{member:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(J),i,a;r&&(i=r.newsletterUuid,a=r.action);let[o,s]=(0,_.useState)(!0),c=fu({site:n}),l=Ol({site:n});(0,_.useEffect)(()=>{e||t(`switchPage`,{page:`signin`})},[e,t]),(0,_.useEffect)(()=>{if(i&&a===`unsubscribe`){let n=e?.newsletters.filter(e=>e.uuid!==i);f(n),s(!1),t(`updateNewsletterPreference`,{newsletters:n})}},[]);let u=()=>{if(r.comments&&p)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:e?.email})}})})});let t=c?.find(e=>e.uuid===r.newsletterUuid);return t?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:e?.email}),newsletterName:(0,q.jsx)(`strong`,{children:t?.name})}})})}):null},[d,f]=(0,_.useState)([...e?.newsletters||[]]),{comments_enabled:p}=n,m=!!n.labs?.automations,{enable_comment_notifications:h,enable_updates_and_announcements:g}=e||{};return(0,_.useEffect)(()=>{f(e?.newsletters||[])},[e?.newsletters]),(0,q.jsx)(Sw,{hasNewslettersEnabled:l,notification:i?u:null,subscribedNewsletters:d,updateSubscribedNewsletters:(e,n)=>{f(e),t(`updateNewsletterPreference`,{newsletters:e,enableUpdatesAndAnnouncements:n}),t(`showPopupNotification`,{action:`updated:success`,message:K(`Email preferences updated.`)})},updateCommentNotifications:e=>t(`updateNewsletterPreference`,{enableCommentNotifications:e,successMessage:K(`Comment preferences updated.`)}),updateUpdatesAndAnnouncements:e=>t(`updateNewsletterPreference`,{enableUpdatesAndAnnouncements:e,successMessage:K(`Email preferences updated.`)}),unsubscribeAll:()=>{f([]),t(`showPopupNotification`,{action:`updated:success`,message:K(`Unsubscribed from all emails.`)});let e={newsletters:[]};p&&(e.enableCommentNotifications=!1),m&&(e.enableUpdatesAndAnnouncements=!1),t(`updateNewsletterPreference`,e)},isPaidMember:Tl({member:e}),isCommentsEnabled:p!==`off`,enableCommentNotifications:h,canChangeUpdatesAndAnnouncements:m,enableUpdatesAndAnnouncements:g})}function ww(){let{site:e}=(0,_.useContext)(J),t=e.icon;return t?(0,q.jsx)(`img`,{className:`gh-portal-unsubscribe-logo`,src:t,alt:e.title}):null}function Tw(){let{site:e}=(0,_.useContext)(J),t=e.title||``;return(0,q.jsxs)(`header`,{className:`gh-portal-header`,children:[(0,q.jsx)(ww,{}),(0,q.jsx)(`h2`,{className:`gh-portal-publication-title`,children:t})]})}function Ew({message:e}){let{doAction:t}=(0,_.useContext)(J);return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-feedback with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-feedback-icon gh-feedback-icon-error`,children:(0,q.jsx)(Wd,{})}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`That didn't go to plan`)}),(0,q.jsx)(`div`,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:e})}),(0,q.jsx)(df,{style:{width:`100%`},retry:!1,onClick:()=>t(`closePopup`),disabled:!1,brandColor:`#000000`,label:K(`Close`),isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})}async function Dw({api:e,memberUuid:t,key:n,newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a}){try{return await e.member.updateNewsletters({uuid:t,key:n,newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a})}catch{}}function Ow(){let{site:e,api:t,pageData:n,member:r,doAction:i}=(0,_.useContext)(J),[a,o]=(0,_.useState)(),s=!!r&&r.uuid!==n.uuid,[c,l]=(0,_.useState)(!0),u=fu({site:e}),d=u.filter(e=>e.subscribe_on_signup),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(d),[g,v]=(0,_.useState)(!1),{comments_enabled:y}=e,b=!!e.labs?.automations,{enable_comment_notifications:x=!1,enable_updates_and_announcements:S}=a||{},C=Ol({site:e}),w=async(e,a)=>{let o={newsletters:e};a!==void 0&&(o.enableUpdatesAndAnnouncements=a),r?i(`updateNewsletterPreference`,o):await Dw({api:t,memberUuid:n.uuid,key:n.key,...o}),h(e);let s={action:`updated:success`,message:K(`Email preferences updated.`)};i(`showPopupNotification`,s)},T=async(e,a)=>{let s;r?s=(await i(`updateNewsletterPreference`,{...e,successMessage:a}))?.member:(s=await Dw({api:t,memberUuid:n.uuid,key:n.key,...e}),i(`showPopupNotification`,s?{action:`updated:success`,message:a}:{action:`updateNewsletter:failed`,status:`error`,message:K(`Failed to update newsletter settings`)})),s&&o(s)},E=e=>T({enableCommentNotifications:e},K(`Comment preferences updated.`)),D=e=>T({enableUpdatesAndAnnouncements:e},K(`Email preferences updated.`)),O=async()=>{let e;r?(await i(`updateNewsletterPreference`,{newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),e={...r},e.newsletters=[],e.enable_comment_notifications=!1,e.enable_updates_and_announcements=!1):e=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),h([]),o(e),i(`showPopupNotification`,{action:`updated:success`,message:K(`Unsubscribed from all emails.`)})};return(0,_.useEffect)(()=>{(async()=>{if(s)return;let e;try{e=await t.member.newsletters({uuid:n.uuid,key:n.key}),o(e??null),l(!1)}catch(e){console.error(`[PORTAL] Error fetching member newsletters`,e),o(null),l(!1);return}if(e===null)return;let r=e?.newsletters||[];h(r),u?.length===1&&!y&&!n.newsletterUuid?await w([]):n.newsletterUuid?await w(r?.filter(e=>e.uuid!==n.newsletterUuid)):n.comments&&y?await E(!1):n.updatesAndAnnouncements&&b&&await D(!1)})()},[y,b,s,n.uuid,n.newsletterUuid,n.comments,n.updatesAndAnnouncements,e.url,u?.length]),s?(0,q.jsx)(Ew,{message:K(`This unsubscribe link belongs to a different email address than the one you are signed in with.`)}):c?(0,q.jsx)(iC,{}):a?u?.length===1&&!y&&!g?(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-unsubscribe with-footer`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(Tw,{}),(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Successfully unsubscribed`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive this newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})}),(0,q.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,q.jsx)(Bd,{string:K(`Didn't mean to do this? Manage your preferences <button>here</button>.`),mapping:{button:(0,q.jsx)(`button`,{className:`gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline`,onClick:()=>{v(!0)}})}})})]})]}):(0,q.jsx)(Sw,{hasNewslettersEnabled:C,notification:()=>{if(n.comments&&y)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f||x?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})})});if(n.updatesAndAnnouncements&&b)return(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f||S!==!1?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive updates & announcements.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email})}})})});let e=u?.find(e=>e.uuid===n.newsletterUuid);return e?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${f?`gh-portal-hide`:``}`,children:(0,q.jsx)(Bd,{string:K(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:a?.email}),newsletterName:(0,q.jsx)(`strong`,{children:e?.name})}})})}):null},subscribedNewsletters:m,updateSubscribedNewsletters:async(e,t)=>{await w(e,t),p(!0)},updateCommentNotifications:E,updateUpdatesAndAnnouncements:D,unsubscribeAll:async()=>{await O(),p(!0)},isPaidMember:a?.status!==`free`,isCommentsEnabled:y!==`off`,enableCommentNotifications:x,canChangeUpdatesAndAnnouncements:b,enableUpdatesAndAnnouncements:S}):(0,q.jsx)(Ew,{message:K(`We couldn't unsubscribe you as the email address was not found. Please contact the site owner.`)})}function kw(){let{brandColor:e,lastPage:t,doAction:n,action:r,site:i}=(0,_.useContext)(J);(0,_.useEffect)(()=>{[`removeEmailFromSuppressionList:success`].includes(r)&&n(`refreshMemberData`),[`removeEmailFromSuppressionList:failed`,`refreshMemberData:failed`].includes(r)&&n(`back`),[`refreshMemberData:success`].includes(r)&&(pu({site:i})||Ql({site:i})?(n(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`}),n(`showPopupNotification`,{message:K(`You have been successfully resubscribed`)})):n(`back`))},[r,n,i,K]);let a=[`removeEmailFromSuppressionList:running`,`refreshMemberData:running`].includes(r);return(0,q.jsxs)(`div`,{className:`gh-email-suppressed-page`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,q.jsx)(vf,{})]}),(0,q.jsx)(aw,{className:`gh-email-suppressed-page-icon`}),(0,q.jsxs)(`div`,{className:`gh-email-suppressed-page-text`,children:[(0,q.jsx)(`h3`,{className:`gh-portal-main-title gh-email-suppressed-page-title`,children:K(`Emails disabled`)}),(0,q.jsx)(`p`,{children:K(`You're not receiving emails because you either marked a recent message as spam, or because messages could not be delivered to your provided email address.`)})]}),(0,q.jsx)(df,{dataTestId:`resubscribe-email`,classes:`gh-portal-confirm-button`,onClick:()=>{n(`removeEmailFromSuppressionList`)},disabled:a,brandColor:e,label:K(`Re-enable emails`),isRunning:a})]})}function Aw(){let{brandColor:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(J),i=`mailto:${Ou({site:n})}`;return(0,q.jsxs)(`div`,{className:`gh-email-suppression-faq`,children:[!(r&&r.direct)&&(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,q.jsx)(mf,{brandColor:e,onClick:()=>{t(`switchPage`,{page:`emailSuppressed`,lastPage:`accountHome`})}}),(0,q.jsx)(vf,{})]}),(0,q.jsxs)(`div`,{className:`gh-longform`,children:[(0,q.jsx)(`h3`,{children:K(`Why has my email been disabled?`)}),(0,q.jsx)(`p`,{children:K(`Newsletters can be disabled on your account for two reasons: A previous email was marked as spam, or attempting to send an email resulted in a permanent failure (bounce).`)}),(0,q.jsx)(`h4`,{children:K(`Spam complaints`)}),(0,q.jsx)(`p`,{children:K(`If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.`)}),(0,q.jsx)(`p`,{children:K(`If the spam complaint was accidental, or you would like to begin receiving emails again, you can resubscribe to emails by clicking the button on the previous screen.`)}),(0,q.jsx)(`p`,{children:K(`Once resubscribed, if you still don't see emails in your inbox, check your spam folder. Some inbox providers keep a record of previous spam complaints and will continue to flag emails. If this happens, mark the latest newsletter as 'Not spam' to move it back to your primary inbox.`)}),(0,q.jsx)(`h4`,{children:K(`Permanent failure (bounce)`)}),(0,q.jsx)(`p`,{children:K(`When an inbox fails to accept an email it is commonly called a bounce. In many cases, this can be temporary. However, in some cases, a bounced email can be returned as a permanent failure when an email address is invalid or non-existent.`)}),(0,q.jsx)(`p`,{children:K(`In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.`)}),(0,q.jsx)(`p`,{children:K(`If you would like to start receiving emails again, the best next steps are to check your email address on file for any issues and then click resubscribe on the previous screen.`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-btn-branded no-margin-right`,href:i,onClick:()=>{i&&window.open(i)},children:K(`Need more help? Contact support`)})})]})]})}function jw(){let{brandColor:e,doAction:t,site:n,lastPage:r,member:i,pageData:a}=(0,_.useContext)(J),o=Ou({site:n}),s=`mailto:${o}`,c=ku({site:n});return(0,q.jsxs)(`div`,{className:`gh-email-receiving-faq`,children:[(0,q.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[!(a&&a.direct)&&(0,q.jsx)(mf,{brandColor:e,onClick:()=>{r?t(`switchPage`,{page:`accountHome`}):t(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`})}}),(0,q.jsx)(vf,{})]}),(0,q.jsxs)(`div`,{className:`gh-longform`,children:[(0,q.jsx)(`h3`,{children:K(`Help! I'm not receiving emails`)}),(0,q.jsx)(`p`,{children:K(`If you're not receiving the email newsletter you've subscribed to, here are a few things to check.`)}),(0,q.jsx)(`h4`,{children:K(`Verify your email address is correct`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`The email address we have for you is {memberEmail} — if that's not correct, you can update it in your <button>account settings area</button>.`),mapping:{memberEmail:(0,q.jsx)(`strong`,{children:i.email}),button:(0,q.jsx)(`button`,{className:`gh-portal-btn-text`,onClick:()=>t(`switchPage`,{lastPage:`emailReceivingFAQ`,page:`accountProfile`})})}})}),(0,q.jsx)(`h4`,{children:K(`Check spam & promotions folders`)}),(0,q.jsx)(`p`,{children:K(`Make sure emails aren't accidentally ending up in the Spam or Promotions folders of your inbox. If they are, click on "Mark as not spam" and/or "Move to inbox".`)}),(0,q.jsx)(`h4`,{children:K(`Create a new contact`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`In your email client add {senderEmail} to your contacts list. This signals to your mail provider that emails sent from this address should be trusted.`),mapping:{senderEmail:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(`h4`,{children:K(`Check with your mail provider`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from {senderEmail}`),mapping:{senderEmail:(0,q.jsx)(`strong`,{children:c})}})}),(0,q.jsx)(`h4`,{children:K(`Get in touch for help`)}),(0,q.jsx)(`p`,{children:(0,q.jsx)(Bd,{string:K(`If you've completed all these checks and you're still not receiving emails, you can reach out to get support by contacting {supportAddress}.`),mapping:{supportAddress:(0,q.jsx)(`a`,{href:s,onClick:()=>{s&&window.open(s)},children:o})}})})]})]})}var Mw=()=>{let[e,t]=(0,_.useState)(!0),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),{member:o,site:s}=(0,_.useContext)(J);return(0,_.useEffect)(()=>{async function e(){let e=s.url,n=window.location.origin+window.location.pathname,i=o?`${n}?action=support&success=true`:`${n}#/portal/support/success`,c=n,l=rC({siteUrl:e});try{let e=await l.member.checkoutDonation({successUrl:i,cancelUrl:c,personalNote:K(`Add a personal note`)});e.url&&window.location.replace(e.url)}catch(e){e.type&&e.type===`DisabledFeatureError`?a(K(`This site is not accepting payments at the moment.`)):r(K(`Something went wrong, please try again later.`)),t(!1)}}s&&s.donations_enabled===!1?(a(K(`This site is not accepting donations at the moment.`)),t(!1)):e()},[]),e?(0,q.jsx)(`div`,{children:(0,q.jsx)(iC,{})}):n?(0,q.jsx)(OC,{error:n}):i?(0,q.jsx)(OC,{error:i}):null};function Nw({initialState:e,key:t,parse:n}){let[r,i]=(0,_.useState)(()=>{let r=typeof e==`function`?e():e;try{let e=window.sessionStorage.getItem(t);return e===null?r:n(JSON.parse(e))??r}catch{return r}});return(0,_.useEffect)(()=>{try{window.sessionStorage.setItem(t,JSON.stringify(r))}catch{}},[t,r]),[r,i]}function Pw({key:e}){try{window.sessionStorage.removeItem(e)}catch{}}var Fw=hb,Iw=em;function Lw({deliveryDateError:e,deliveryMethod:t,effectiveDeliveryDate:n,giftMessage:r,maxDeliveryDate:i,maxMessageLength:a,minDeliveryDate:o,onChangeDeliveryDate:s,onChangeDeliveryMethod:c,onChangeGiftMessage:l,onChangeRecipientEmail:u,onChangeRecipientName:d,recipientEmailField:f,recipientNameField:p}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:K(`How would you like to share this gift?`)}),(0,q.jsxs)(`div`,{"aria-label":K(`Delivery method`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:[(0,q.jsx)(`button`,{"aria-checked":t===`email`,className:`gh-portal-btn`+(t===`email`?` active`:``),"data-test-button":`delivery-method-email`,role:`radio`,type:`button`,onClick:()=>c(`email`),children:K(`Email it to them`)}),(0,q.jsx)(`button`,{"aria-checked":t===`link`,className:`gh-portal-btn`+(t===`link`?` active`:``),"data-test-button":`delivery-method-link`,role:`radio`,type:`button`,onClick:()=>c(`link`),children:K(`I'll share it myself`)})]})]}),(0,q.jsx)(`div`,{"aria-hidden":t!==`email`,className:`gh-portal-gift-checkout-reveal`,"data-open":t===`email`,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(Iw,{...p,onChange:e=>d(e.target.value)}),(0,q.jsx)(Iw,{...f,onChange:e=>u(e.target.value)}),(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-message`,children:K(`Optional message`)})}),(0,q.jsx)(`textarea`,{className:`gh-portal-input gh-portal-gift-checkout-textarea`,"data-test-input":`gift-message`,id:`gift-message`,maxLength:a,placeholder:K(`Add a short note to go with your gift`),value:r,onChange:e=>l(e.target.value)}),(0,q.jsx)(`div`,{"aria-hidden":r.length===0,className:`gh-portal-gift-checkout-reveal`,"data-open":r.length>0,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`p`,{className:`gh-portal-gift-checkout-message-count`,children:[r.length,`/`,a]})})}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-delivery-date`,children:[(0,q.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,q.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-delivery-date`,children:K(`Delivery date`)})}),(0,q.jsx)(Fw,{ariaLabel:K(`Delivery date`),hasError:!!e,id:`gift-delivery-date`,max:i,min:o,minLabel:K(`Now`),value:n,onChange:s}),e&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-delivery-error`,children:e})]})]})})})]})}var Rw=`ghost-portal-gift-form-state`;function zw({buyerName:e=``}={}){return{version:1,plan:{selectedDuration:null,selectedProductId:null,buyerEmail:``,buyerName:e,completed:!1},delivery:{method:`email`,emailDraft:{recipientEmail:``,recipientName:``,message:``,timing:{type:`immediate`}}}}}function Bw(e,t){return typeof e==`string`&&e.length<=t}function Vw(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.plan,r=t.delivery,i=r?.emailDraft,a=i?.timing,o=n?.selectedDuration===null||Cf.includes(n?.selectedDuration),s=a?.type===`immediate`||a?.type===`scheduled`&&typeof a.date==`string`;return t.version!==1||!n||!r||!i||!o||!(n.selectedProductId===null||typeof n.selectedProductId==`string`)||!Bw(n.buyerEmail,191)||!Bw(n.buyerName,191)||typeof n.completed!=`boolean`||![`email`,`link`].includes(r.method)||!Bw(i.recipientEmail,191)||!Bw(i.recipientName,191)||!Bw(i.message,250)||!s?null:t}function Hw(){Pw({key:Rw})}var Uw=em;function Ww({activeDuration:e,offeredDurations:t,onSelectDuration:n}){return t.length<2?null:(0,q.jsx)(`div`,{"aria-label":K(`Gift duration`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:t.map(t=>{let r=t===e;return(0,q.jsx)(`button`,{"aria-checked":r,className:`gh-portal-btn`+(r?` active`:``),"data-test-button":`switch-duration-${t}`,role:`radio`,type:`button`,onClick:()=>n(t),children:Gd({cadence:`month`,duration:t})},t)})})}function Gw({activeDuration:e,activeDurationLabel:t,activeProduct:n,buyerEmailField:r,buyerNameField:i,isSingleTier:a,offeredDurations:o,onBuyerEmailChange:s,onBuyerNameChange:c,onSelectDuration:l,onSelectProduct:u,products:d,showBuyerEmail:f,showBuyerName:p,siteTitle:m,tierPriceLabel:h}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Gift a membership`)}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:K(`Share a full membership to {siteTitle} with a friend or colleague`,{siteTitle:m})})]}),(p||f)&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[p&&(0,q.jsx)(Uw,{...i,onChange:e=>c(e.target.value)}),f&&(0,q.jsx)(Uw,{...r,onChange:e=>s(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:K(a?`Membership details`:`Tier`)}),o.length>1?(0,q.jsx)(Ww,{activeDuration:e,offeredDurations:o,onSelectDuration:l}):(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-single-duration`,"data-test-single-duration":!0,children:K(`{duration} membership`,{duration:t})})]}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-section`,children:(0,q.jsx)(`div`,{"aria-label":a?void 0:K(`Choose a tier`),className:`gh-portal-gift-checkout-tiers`+(a?` single`:``),role:a?void 0:`radiogroup`,children:d.map(t=>{let r=t.id===n.id,i=t.benefits||[];return(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-item`+(r&&!a?` selected`:``),children:[(0,q.jsxs)(`button`,{"aria-checked":a?void 0:r,className:`gh-portal-gift-checkout-tier`,"data-test-tier":t.name,role:a?void 0:`radio`,type:`button`,onClick:()=>u(t.id),children:[!a&&(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-tier-radio`}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-content`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-heading`,children:[(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-name`,children:t.name}),(0,q.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-price`,children:h(t,e)})]}),t.description&&(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-tier-description`,children:t.description})]})]}),i.length>0&&(0,q.jsx)(`div`,{"aria-hidden":!r,className:`gh-portal-gift-checkout-tier-benefits`,"data-open":r,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-tier-benefits-inner`,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-benefits`,children:i.map((e,t)=>{let n=e.id||`benefit-${t}`;return(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-benefit`,children:[(0,q.jsx)(_h,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:e.name})]},n)})})})})]},t.id)})})})]})}var Kw=e=>(0,q.jsxs)(`svg`,{width:39,height:27,viewBox:`0 0 39 27`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsxs)(`g`,{fill:`currentColor`,children:[(0,q.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,q.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]}),(0,q.jsxs)(`g`,{fill:`currentColor`,transform:`translate(21 0)`,children:[(0,q.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,q.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]})]}),qw=({recipientName:e,recipientEmail:t,buyerName:n,giftMessage:r,deliveryDate:i,isScheduled:a=!1,cadence:o,duration:s,tierName:c,benefits:l=[],siteTitle:u,siteIcon:d})=>{let f=e.trim(),p=t.trim(),m=n.trim(),h=r.trim(),g=ol(new Date),v=ol(dl(i))||g,[y,b]=(0,_.useState)(``);(0,_.useEffect)(()=>{a&&b(v)},[a,v]);let x=a?v:y||g,S=``;S=f&&p?`${f} <${p}>`:p||f;let C={buyerName:(0,q.jsx)(`strong`,{children:m}),duration:s,strong:(0,q.jsx)(`strong`,{}),tierName:(0,q.jsx)(`strong`,{children:c}),siteTitle:u},w=qd({buyerName:m,cadence:o,duration:s,siteTitle:u});return(0,q.jsx)(`div`,{className:`gh-portal-gift-email`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-sheet`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-meta`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-meta-text`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-email-from`,children:u}),(0,q.jsx)(`div`,{"aria-hidden":!S,className:`gh-portal-gift-checkout-reveal`,"data-open":!!S,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-to`,children:[(0,q.jsxs)(`span`,{className:`gh-portal-gift-email-meta-label`,children:[K(`To`),`:`]}),(0,q.jsx)(`span`,{className:`gh-portal-gift-email-to-value`,children:S})]})})})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-date-stack`,children:[(0,q.jsx)(`div`,{"aria-hidden":a,className:`gh-portal-gift-email-date`,"data-active":!a,children:g}),(0,q.jsx)(`div`,{"aria-hidden":!a,className:`gh-portal-gift-email-date`,"data-active":a,children:x})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-body`,children:[(0,q.jsx)(`div`,{className:`gh-portal-gift-email-lockup`,children:d?(0,q.jsx)(`img`,{alt:u,className:`gh-portal-gift-email-lockup-icon`,src:d}):(0,q.jsx)(`span`,{className:`gh-portal-gift-email-lockup-title`,children:u})}),(0,q.jsx)(`h1`,{className:`gh-portal-gift-email-subject`,children:K(`A gift, just for you`)}),(0,q.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-reveal`,"data-open":!!f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsx)(`p`,{className:`gh-portal-gift-email-greeting`,children:K(`Hi {recipientName},`,{recipientName:f})})})}),(0,q.jsx)(`p`,{className:`gh-portal-gift-email-lede`,children:(0,q.jsx)(Bd,{mapping:C,string:w})}),(0,q.jsx)(`div`,{"aria-hidden":!h,className:`gh-portal-gift-checkout-reveal`,"data-open":!!h,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,q.jsxs)(`blockquote`,{className:`gh-portal-gift-email-message`,children:[(0,q.jsx)(Kw,{"aria-hidden":`true`,className:`gh-portal-gift-email-message-mark`,focusable:`false`}),(0,q.jsx)(`p`,{className:`gh-portal-gift-email-message-text`,children:h}),m&&(0,q.jsx)(`p`,{className:`gh-portal-gift-email-message-from`,children:m})]})})}),l.length>0&&(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-benefits`,children:[(0,q.jsx)(`p`,{className:`gh-portal-gift-email-benefits-label`,children:K(`What's included`)}),(0,q.jsx)(`div`,{children:l.map((e,t)=>(0,q.jsxs)(`div`,{className:`gh-portal-gift-email-benefit`,children:[(0,q.jsx)(_h,{"aria-hidden":`true`,focusable:`false`}),(0,q.jsx)(`span`,{children:e.name})]},e?.id||`benefit-${t}`))})]})]})]})})},Jw=Sf,Yw=qw;function Xw({activeDuration:e,activeProduct:t,buyerName:n,cardRef:r,cardTiltProps:i,effectiveDeliveryDate:a,emailDuration:o,giftMessage:s,giftValue:c,minDeliveryDate:l,recipientEmail:u,recipientName:d,showEmailPreview:f,siteIcon:p,siteTitle:m}){return(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,...i,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-stage`,children:[(0,q.jsx)(`div`,{"aria-hidden":f,className:`gh-portal-gift-checkout-stage-item card`,"data-active":!f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-card-stack`,children:(0,q.jsx)(Jw,{cardRef:r,duration:Gd({cadence:`month`,duration:e}),fromName:n.trim(),giftValue:c,siteIcon:p,siteTitle:m,tierName:t.name})})}),(0,q.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-stage-item email`,"data-active":f,children:(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-email-stack`,children:(0,q.jsx)(Yw,{...o,benefits:t.benefits||[],buyerName:n,deliveryDate:a,giftMessage:s,isScheduled:a>l,recipientEmail:u,recipientName:d,siteIcon:p,siteTitle:m,tierName:t.name})})})]})})})}var Zw=`ghostPortalGiftHistory`;function Qw(){let e=window.history.state;return e&&typeof e==`object`?e:{}}function $w(){let e=Qw()[Zw];if(!e||typeof e!=`object`||!(`depth`in e))return null;let{depth:t}=e;return typeof t==`number`&&t>0?{depth:t}:null}function eT(e){return e===`delivery`?`#/portal/gift/delivery`:`#/portal/gift`}function tT(){window.dispatchEvent(new HashChangeEvent(`hashchange`))}function nT({step:e,replace:t=!1}){let n=eT(e);if(t){window.history.replaceState(window.history.state,``,n),tT();return}let r=$w(),i=r?{...Qw(),[Zw]:{depth:r.depth+1}}:window.history.state;window.history.pushState(i,``,n),tT()}function rT(){window.location.hash!==`#/portal/gift`&&window.history.pushState({...Qw(),[Zw]:{depth:1}},``,`#/portal/gift`)}function iT(){let e=$w();return e?(window.history.go(-e.depth),!0):!1}var aT=Cb,oT=365;function sT(e){return e===`signup`?`#/portal/signup`:e===`accountHome`?`#/portal/account`:e===`accountPlan`?`#/portal/account/plans`:null}var cT=()=>{let{site:e,member:t,brandColor:n,action:r,doAction:i,lastPage:a,pageData:o}=(0,_.useContext)(J),s=o?.giftStep===`delivery`?`delivery`:`plan`,[c,l]=(0,_.useState)(s),[u,d]=Nw({key:Rw,initialState:()=>zw({buyerName:t?.name||``}),parse:Vw}),[f,p]=(0,_.useState)({}),{cardRef:m,containerProps:h}=gC(),g=(0,_.useRef)(null),v=(0,_.useRef)(!1),{plan:y,delivery:b}=u,{selectedDuration:x,selectedProductId:S,buyerEmail:C,buyerName:w}=y,{method:T,emailDraft:E}=b,{recipientEmail:D,recipientName:O,message:k,timing:ee}=E;(0,_.useEffect)(()=>{d(e=>e.plan.buyerName||!t?.name?e:{...e,plan:{...e.plan,buyerName:t.name}})},[t?.name]),(0,_.useEffect)(()=>{if(s===`delivery`&&!y.completed){l(`plan`),nT({step:`plan`,replace:!0});return}g.current!==s&&(g.current=s,l(s))},[y.completed,s]);let A=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=requestAnimationFrame(()=>{let e=A.current,t=e?.ownerDocument;if(!t)return;let n=t.defaultView;t.querySelectorAll(`.gh-portal-popup-wrapper, .gh-portal-popup-container`).forEach(e=>{e.scrollTop=0});for(let t=e.parentElement;t;t=t.parentElement){let e=n?.getComputedStyle(t).overflowY;(e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight&&(t.scrollTop=0)}});return()=>cancelAnimationFrame(e)},[c]);let te=()=>{let e=sT(a);!iT()&&e&&window.history.replaceState(window.history.state,``,e),i(`back`)},j=()=>{i(`closePopup`)},ne=e?.portal_default_plan??null,re=kf({site:e}),M=Nf({availableDurations:re,portalDefaultPlan:ne,selectedDuration:x}),N=M?Of({site:e,duration:M}):[],ie=x!==null&&re.includes(x)&&S!==null&&N.some(e=>e.id===S);if((0,_.useEffect)(()=>{!e||!y.completed||ie||(d(e=>({...e,plan:{...e.plan,completed:!1}})),l(`plan`),nT({step:`plan`,replace:!0}))},[y.completed,ie,e]),!e)return(0,q.jsx)(iC,{});function ae(t,n){return xC(Df(t,n),e?.locale)}let oe=e.icon,se=e.title||``;if(!M||N.length===0)return(0,q.jsxs)(`div`,{className:`gh-portal-content gift`,children:[(0,q.jsx)(vf,{onClick:j}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-inner`,children:(0,q.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Gift a membership`)}),(0,q.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:K(`Gift subscriptions are not available right now.`)})]})})]}),(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-right`})]})]});let P=N.find(e=>e.id===S)||N[0];if(!P)return null;let ce=N.length===1,le=M===12?{cadence:`year`,duration:1}:{cadence:`month`,duration:M},ue=Kd(le),de=r===`checkoutGift:running`,F=c===`plan`?!!(f.email||f.buyerName):!!(f.recipientEmail||f.deliveryDate),fe=xl()||de||F,pe=!!t,me=!(t?.name||``).trim(),he=!pe,I=c===`delivery`&&T===`email`,ge=gl(new Date,e.timezone),L=pl(ge,oT),_e=ee.type===`scheduled`?ee.date:ge,ve={type:`email`,value:C,placeholder:K(`jamie@example.com`),label:K(`Your email`),name:`email`,required:!0,maxLength:191,errorMessage:f.email||``},ye={type:`email`,value:D,placeholder:K(`taylor@example.com`),label:K(`Recipient's email`),name:`recipientEmail`,required:!1,maxLength:191,errorMessage:f.recipientEmail||``},be={type:`text`,value:w,placeholder:K(`Jamie Larson`),label:K(`Your name`),name:`buyerName`,required:!0,maxLength:191,errorMessage:f.buyerName||``},xe={type:`text`,value:O,placeholder:K(`Taylor Reid`),label:K(`Recipient's name`),name:`recipientName`,required:!1,maxLength:191,errorMessage:``},Se=e=>{p(e=>({...e,email:``})),d(t=>({...t,plan:{...t.plan,buyerEmail:e,completed:!1}}))},Ce=e=>{p(e=>({...e,buyerName:``})),d(t=>({...t,plan:{...t.plan,buyerName:e,completed:!1}}))},R=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientEmail:e}}}))},we=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,method:e}}))},Te=e=>{p(e=>({...e,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,timing:e===ge?{type:`immediate`}:{type:`scheduled`,date:e}}}}))},Ee=e=>{d(t=>({...t,plan:{...t.plan,selectedDuration:e,completed:!1}}))},De=e=>{d(t=>({...t,plan:{...t.plan,selectedProductId:e,completed:!1}}))},Oe=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientName:e}}}))},ke=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,message:e}}}))},Ae=()=>{let e=[];pe||e.push({...ve,value:C.trim()}),e.push({...be,value:w.trim()});let t=aT({fields:e}),n=Object.values(t).some(e=>!!e);p(t),!n&&(d(e=>({...e,plan:{...e.plan,selectedDuration:M,selectedProductId:P.id,completed:!0}})),rT(),v.current=!0,l(`delivery`),nT({step:`delivery`}))},je=()=>{p({}),l(`plan`),v.current?(v.current=!1,window.history.back()):nT({step:`plan`,replace:!0})};return(0,q.jsxs)(`div`,{ref:A,className:`gh-portal-content gift`,children:[(0,q.jsx)(vf,{onClick:j}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,"data-step":c,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(c===`delivery`||a)&&(0,q.jsx)(gb,{onBack:()=>c===`delivery`?je():te()}),(0,q.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[c===`plan`?(0,q.jsx)(Gw,{activeDuration:M,activeDurationLabel:ue,activeProduct:P,buyerEmailField:ve,buyerNameField:be,isSingleTier:ce,offeredDurations:re,products:N,showBuyerEmail:he,showBuyerName:me,siteTitle:se,tierPriceLabel:ae,onBuyerEmailChange:Se,onBuyerNameChange:Ce,onSelectDuration:Ee,onSelectProduct:De}):(0,q.jsx)(Lw,{deliveryDateError:f.deliveryDate||``,deliveryMethod:T,effectiveDeliveryDate:_e,giftMessage:k,maxDeliveryDate:L,maxMessageLength:250,minDeliveryDate:ge,recipientEmailField:ye,recipientNameField:xe,onChangeDeliveryDate:Te,onChangeDeliveryMethod:we,onChangeGiftMessage:ke,onChangeRecipientEmail:R,onChangeRecipientName:Oe}),(0,q.jsx)(`div`,{className:`gh-portal-gift-checkout-cta-wrapper`,children:(0,q.jsx)(df,{brandColor:n,classes:`gh-portal-gift-checkout-cta`,dataTestId:c===`plan`?`gift-continue`:`purchase-gift`,disabled:fe,isRunning:c===`delivery`&&de,label:K(c===`plan`?`Continue to delivery details`:`Continue to payment`),style:{width:`100%`},onClick:c===`plan`?Ae:()=>{if(de)return;let e=C.trim(),t=D.trim(),n=O.trim(),r=w.trim(),a=k.trim(),o=T===`email`,s=o&&_e>ge,c=[];pe||c.push({...ve,value:e}),o&&t&&c.push({...ye,value:t});let u=aT({fields:c});o&&!t&&(u.recipientEmail=K(`Enter the recipient's email address`)),o&&(_e?_e<ge?u.deliveryDate=K(`Choose a date from today onwards`):_e>L&&(u.deliveryDate=K(`Choose a date within the next year`)):u.deliveryDate=K(`Choose a delivery date`));let f=Object.values(u).some(e=>!!e);if(p(u),f){u.email&&(l(`plan`),d(e=>({...e,plan:{...e.plan,completed:!1}})),nT({step:`plan`,replace:!0}));return}i(`checkoutGift`,{tierId:P.id,duration:M,...pe?{}:{email:e},deliveryMethod:T,...o?{recipientEmail:t}:{},...o&&n?{recipientName:n}:{},buyerName:r,...o&&a?{personalMessage:a}:{},...s?{deliveryDate:_e}:{}})}})})]})]}),(0,q.jsx)(Xw,{activeDuration:M,activeProduct:P,buyerName:w,cardRef:m,cardTiltProps:h,effectiveDeliveryDate:_e,emailDuration:le,giftMessage:k,giftValue:ae(P,M),minDeliveryDate:ge,recipientEmail:D,recipientName:O,showEmailPreview:I,siteIcon:oe,siteTitle:se})]})]})},lT=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},uT=(e,t)=>`${e}?${new URLSearchParams(t).toString()}`,dT=({shareTitle:e,shareUrl:t})=>{let n=[e,t].filter(Boolean).join(`
|
|
6137
6137
|
|
|
6138
|
-
`),r=[];return e&&r.push(`subject=${encodeURIComponent(e)}`),n&&r.push(`body=${encodeURIComponent(n)}`),`mailto:${r.length?`?${r.join(`&`)}`:``}`},dT=({shareTitle:e,shareUrl:t})=>lT(`https://www.linkedin.com/shareArticle`,{mini:`true`,url:t,title:e}),fT=()=>{let e=cT(),t=e.document,n=e.location,r=(e,n=`content`)=>t.querySelector(e)?.[n]||``,i=r(`link[rel="canonical"]`,`href`)||n.origin+n.pathname+n.search,a=r(`meta[property="og:title"]`)||t.title||``,o=r(`meta[property="og:description"]`)||r(`meta[name="description"]`)||``,s=r(`meta[property="og:image"]`)||r(`meta[name="twitter:image"]`)||``,c=r(`link[rel="icon"]`,`href`)||r(`link[rel="shortcut icon"]`,`href`)||r(`link[rel="apple-touch-icon"]`,`href`),l=r(`meta[name="author"]`),u=(l&&!/^https?:\/\//i.test(l)?l:``)||r(`meta[name="twitter:creator"]`)||``,d=r(`meta[property="og:site_name"]`)||r(`meta[name="application-name"]`)||``;if(!d)try{d=new URL(i).hostname.replace(/^www\./,``)}catch{d=``}let f=[a,i].filter(Boolean).join(` `).trim(),p={twitter:lT(`https://twitter.com/intent/tweet`,{url:i,text:a}),facebook:lT(`https://www.facebook.com/sharer/sharer.php`,{u:i}),email:uT({shareTitle:a,shareUrl:i}),threads:lT(`https://www.threads.net/intent/post`,{text:f}),linkedin:dT({shareTitle:a,shareUrl:i}),bluesky:lT(`https://bsky.app/intent/compose`,{text:f})};return{shareUrl:i,shareTitle:a,shareExcerpt:o,shareImage:s,shareFavicon:c,shareSiteName:d,shareAuthor:u,socialLinks:p}},pT=()=>{let[e]=(0,_.useState)(fT);return e},mT=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -3.268 64 68.414`,width:2232,height:2500,...e,children:(0,q.jsx)(`path`,{fill:`#0085ff`,d:`M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z`})}),hT=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-ellipsis-icon lucide-ellipsis`,...e,children:[(0,q.jsx)(`circle`,{cx:12,cy:12,r:1}),(0,q.jsx)(`circle`,{cx:19,cy:12,r:1}),(0,q.jsx)(`circle`,{cx:5,cy:12,r:1})]}),gT=e=>(0,q.jsxs)(`svg`,{id:`svg9`,width:666.66669,height:666.66718,viewBox:`0 0 666.66668 666.66717`,xmlns:`http://www.w3.org/2000/svg`,"xmlns:svg":`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`defs`,{id:`defs13`,children:(0,q.jsx)(`clipPath`,{clipPathUnits:`userSpaceOnUse`,id:`clipPath25`,children:(0,q.jsx)(`path`,{d:`M 0,700 H 700 V 0 H 0 Z`,id:`path23`})})}),(0,q.jsx)(`g`,{id:`g17`,transform:`matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)`,children:(0,q.jsx)(`g`,{id:`g19`,children:(0,q.jsxs)(`g`,{id:`g21`,clipPath:`url(#clipPath25)`,children:[(0,q.jsx)(`g`,{id:`g27`,transform:`translate(600,350)`,children:(0,q.jsx)(`path`,{d:`m 0,0 c 0,138.071 -111.929,250 -250,250 -138.071,0 -250,-111.929 -250,-250 0,-117.245 80.715,-215.622 189.606,-242.638 v 166.242 h -51.552 V 0 h 51.552 v 32.919 c 0,85.092 38.508,124.532 122.048,124.532 15.838,0 43.167,-3.105 54.347,-6.211 V 81.986 c -5.901,0.621 -16.149,0.932 -28.882,0.932 -40.993,0 -56.832,-15.528 -56.832,-55.9 V 0 h 81.659 l -14.028,-76.396 h -67.631 V -248.169 C -95.927,-233.218 0,-127.818 0,0`,style:{fill:`#0866ff`,fillOpacity:1,fillRule:`nonzero`,stroke:`none`},id:`path29`})}),(0,q.jsx)(`g`,{id:`g31`,transform:`translate(447.9175,273.6036)`,children:(0,q.jsx)(`path`,{d:`M 0,0 14.029,76.396 H -67.63 v 27.019 c 0,40.372 15.838,55.899 56.831,55.899 12.733,0 22.981,-0.31 28.882,-0.931 v 69.253 c -11.18,3.106 -38.509,6.212 -54.347,6.212 -83.539,0 -122.048,-39.441 -122.048,-124.533 V 76.396 h -51.552 V 0 h 51.552 v -166.242 c 19.343,-4.798 39.568,-7.362 60.394,-7.362 10.254,0 20.358,0.632 30.288,1.831 L -67.63,0 Z`,style:{fill:`#ffffff`,fillOpacity:1,fillRule:`nonzero`,stroke:`none`},id:`path33`})})]})})})]}),_T=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-link-icon lucide-link`,...e,children:[(0,q.jsx)(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),(0,q.jsx)(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})]}),vT=e=>(0,q.jsxs)(`svg`,{viewBox:`0 5 2490 2490.0000000000005`,xmlns:`http://www.w3.org/2000/svg`,width:2500,height:2495,...e,children:[(0,q.jsx)(`path`,{d:`M185.2 313.1H2252V2291H185.2z`,fill:`#fff`}),(0,q.jsx)(`path`,{d:`M0 183.4C0 84.9 82.4 5 184 5h2122c101.6 0 184 79.9 184 178.4v2133.3c0 98.5-82.4 178.3-184 178.3H184c-101.6 0-184-79.8-184-178.3z`,fill:`#0a66c2`}),(0,q.jsx)(`path`,{d:`M756.7 2088.8v-1121H384.1v1121zm-186.2-1274c129.9 0 210.8-86.1 210.8-193.7-2.4-110-80.9-193.7-208.3-193.7-127.5 0-210.8 83.7-210.8 193.7 0 107.6 80.8 193.7 205.9 193.7zm392.4 1274h372.6v-626c0-33.5 2.4-67 12.3-90.9 26.9-67 88.2-136.3 191.2-136.3 134.8 0 188.7 102.8 188.7 253.5v599.6h372.6V1446c0-344.3-183.8-504.5-428.9-504.5-201 0-289.2 112.3-338.3 188.8h2.5V967.8H962.9c4.9 105.2 0 1121 0 1121z`,fill:`#fff`})]}),yT=e=>(0,q.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`g`,{clipPath:`url(#clip0_351_18008)`,children:(0,q.jsx)(`path`,{d:`M13.0332 8.37917C12.96 8.34407 12.8856 8.3103 12.8103 8.27795C12.6791 5.86015 11.3579 4.47596 9.1396 4.4618C9.12955 4.46173 9.11955 4.46173 9.1095 4.46173C7.78265 4.46173 6.67913 5.0281 5.99992 6.05871L7.21993 6.89561C7.72733 6.12579 8.52364 5.96167 9.11008 5.96167C9.11686 5.96167 9.12366 5.96168 9.13036 5.96174C9.86078 5.96639 10.4119 6.17876 10.7687 6.59291C11.0283 6.89442 11.2019 7.31107 11.2879 7.8369C10.6403 7.72683 9.93993 7.69299 9.19122 7.73592C7.08214 7.8574 5.72624 9.08747 5.81731 10.7967C5.86352 11.6637 6.29544 12.4096 7.03346 12.8968C7.65745 13.3087 8.46111 13.5101 9.29635 13.4645C10.3994 13.4041 11.2647 12.9832 11.8684 12.2137C12.3268 11.6293 12.6168 10.872 12.7448 9.91782C13.2705 10.2351 13.6601 10.6525 13.8753 11.1544C14.2411 12.0075 14.2624 13.4094 13.1186 14.5523C12.1164 15.5535 10.9117 15.9866 9.09104 16C7.07147 15.9851 5.54409 15.3374 4.55103 14.0749C3.62111 12.8928 3.14053 11.1854 3.1226 9C3.14053 6.8146 3.62111 5.10714 4.55103 3.92503C5.54409 2.66262 7.07144 2.01495 9.09101 1.99994C11.1252 2.01506 12.6792 2.66585 13.7103 3.93435C14.2159 4.55641 14.597 5.3387 14.8483 6.25081L16.278 5.86936C15.9734 4.74665 15.4942 3.7792 14.842 2.97686C13.5201 1.35059 11.5869 0.517279 9.096 0.5H9.08603C6.60019 0.517219 4.68862 1.3537 3.40443 2.98619C2.26168 4.4389 1.67221 6.46024 1.65241 8.99402L1.65234 9L1.65241 9.00598C1.67221 11.5397 2.26168 13.5611 3.40443 15.0138C4.68862 16.6463 6.60019 17.4828 9.08603 17.5H9.096C11.306 17.4847 12.8638 16.9061 14.1472 15.6239C15.8262 13.9465 15.7756 11.8439 15.2222 10.5531C14.8252 9.62749 14.0683 8.8757 13.0332 8.37917ZM9.21739 11.9668C8.29301 12.0188 7.33268 11.6039 7.28533 10.7152C7.25023 10.0563 7.75426 9.32105 9.27412 9.23347C9.44817 9.22343 9.61897 9.21852 9.78676 9.21852C10.3388 9.21852 10.8553 9.27215 11.3248 9.3748C11.1497 11.562 10.1224 11.9171 9.21739 11.9668Z`,fill:`black`})}),(0,q.jsx)(`defs`,{children:(0,q.jsx)(`clipPath`,{id:`clip0_351_18008`,children:(0,q.jsx)(`rect`,{width:17,height:17,fill:`white`,transform:`translate(0.5 0.5)`})})})]}),bT=e=>(0,q.jsx)(`svg`,{viewBox:`0 0 1200 1226.37`,xmlns:`http://www.w3.org/2000/svg`,width:2446,height:2500,...e,children:(0,q.jsx)(`path`,{d:`M714.163 519.284L1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284zM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854z`})}),xT={signin:WC,signup:aS,accountHome:fw,accountPlan:$h,accountProfile:pw,accountEmail:Sw,signupNewsletter:yb,unsubscribe:Dw,magiclink:TS,loading:rC,offer:jS,feedback:uC,emailSuppressed:Ow,emailSuppressionFAQ:kw,emailReceivingFAQ:Aw,support:jw,supportSuccess:mC,supportError:DC,recommendations:FC,gift:sT,giftRedemption:_C,giftSuccess:wC,share:()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(),a=(0,_.useRef)(null),{shareUrl:o,shareTitle:s,shareExcerpt:c,shareImage:l,shareFavicon:u,shareSiteName:d,shareAuthor:f,socialLinks:p}=pT();(0,_.useEffect)(()=>()=>{clearTimeout(i.current)},[]),(0,_.useEffect)(()=>{if(!n)return;let e=a.current?.ownerDocument||document,t=e=>{a.current&&!a.current.contains(e.target)&&(e.stopPropagation(),e.preventDefault(),r(!1))},i=e=>{e.key===`Escape`&&!e.isComposing&&(e.preventDefault(),r(!1))};return e.addEventListener(`click`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`click`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[n]);let m=async()=>{await yC(o)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},h=()=>{r(e=>!e)},g=()=>{r(!1)};return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-share`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-share-header`,children:(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Share`)})}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview`,children:[l&&(0,q.jsx)(`img`,{className:`gh-portal-share-preview-image`,src:l,alt:``,"data-testid":`share-preview-image`}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-content`,children:[s&&(0,q.jsx)(`h2`,{className:`gh-portal-share-preview-title`,children:s}),c&&(0,q.jsx)(`p`,{className:`gh-portal-share-preview-excerpt`,children:c}),(u||d||f)&&(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-footer`,children:[u&&(0,q.jsx)(`img`,{className:`gh-portal-share-preview-favicon`,src:u,alt:``,"data-testid":`share-preview-favicon`}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-meta`,children:[d&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-site`,children:d}),d&&f&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-separator`,"aria-hidden":`true`,children:`|`}),f&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-author`,children:f})]})]})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-share-actions`,children:[(0,q.jsxs)(`button`,{className:`gh-portal-btn gh-portal-share-action copy`,type:`button`,onClick:m,"aria-label":K(e?`Copied`:`Copy link`),title:K(e?`Copied`:`Copy link`),children:[e?(0,q.jsx)(`span`,{className:`gh-portal-share-icon copied`,"aria-hidden":`true`,children:(0,q.jsx)(gh,{})}):(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(_T,{})}),(0,q.jsx)(`span`,{className:`gh-portal-share-label`,children:K(e?`Copied`:`Copy link`)})]}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action twitter`,href:p.twitter,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`X (Twitter)`),title:K(`X (Twitter)`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon x`,"aria-hidden":`true`,children:(0,q.jsx)(bT,{})})}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action linkedin`,href:p.linkedin,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`LinkedIn`),title:K(`LinkedIn`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(vT,{})})}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action email`,href:p.email,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`Email`),title:K(`Email`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(cS,{})})}),(0,q.jsxs)(`div`,{className:`gh-portal-share-more`,ref:a,children:[(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-share-action more`,type:`button`,onClick:h,"aria-label":K(`More options`),title:K(`More options`),"aria-haspopup":`menu`,"aria-expanded":n,children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(hT,{})})}),n&&(0,q.jsxs)(`div`,{className:`gh-portal-share-more-menu`,role:`menu`,"aria-label":K(`More options`),children:[(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.facebook,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(gT,{})}),(0,q.jsx)(`span`,{children:K(`Facebook`)})]}),(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.threads,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(yT,{})}),(0,q.jsx)(`span`,{children:K(`Threads`)})]}),(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.bluesky,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(mT,{})}),(0,q.jsx)(`span`,{children:K(`Bluesky`)})]})]})]})]})]})}},ST=function(){return xT},CT=function({page:e}){return Object.keys(xT).includes(e)?e:`signup`},wT=function({page:e}){return e.includes(`account`)},TT=function({page:e}){return e.includes(`offer`)},ET=e=>(0,q.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z`,fill:`#15171A`})}),DT=class extends _.Component{static contextType=J;render(){return(0,q.jsxs)(`a`,{href:`https://ghost.org`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,q.jsx)(ET,{}),`Powered by Ghost`]})}},OT=()=>({modalContainer:{zIndex:`3999999`,position:`fixed`,left:`0`,top:`0`,width:`100%`,height:`100%`,overflow:`hidden`},frame:{common:{margin:`auto`,position:`relative`,padding:`0`,outline:`0`,width:`100%`,opacity:`1`,overflow:`hidden`,height:`100%`}},page:{links:{width:`600px`}}});function kT({message:e}){return xl()?(0,q.jsx)(`div`,{className:`gh-portal-cookiebanner`,children:e}):null}var AT=class extends _.Component{static contextType=J;componentDidMount(){this.node&&!nd([`preview`])&&!this.props.isMobile&&(this.node.focus(),this.keyDownHandler=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.isComposing&&this.dismissPopup(e)},this.node.ownerDocument.removeEventListener(`keydown`,this.keyDownHandler),this.node.ownerDocument.addEventListener(`keydown`,this.keyDownHandler)),this.sendContainerHeightChangeEvent()}dismissPopup(e){let t=e.target&&e.target.tagName;(!(t===`INPUT`||t===`TEXTAREA`)||!e?.target?.value)&&this.context.doAction(`closePopup`)}sendContainerHeightChangeEvent(){this.node&&nd([`preview`])&&this.node?.clientHeight!==this.lastContainerHeight&&(this.lastContainerHeight=this.node?.clientHeight,window.document.body.style.overflow=`hidden`,window.document.body.style[`scrollbar-width`]=`none`,window.parent.postMessage({type:`portal-preview-updated`,payload:{height:this.lastContainerHeight}},`*`))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener(`keydown`,this.keyDownHandler)}handlePopupClose(e){let{page:t,otcRef:n}=this.context;nd([`preview`])||n&&t===`magiclink`||t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderActivePage(){let{page:e,site:t}=this.context;CT({page:e});let n=ST({site:t})[e];return(0,q.jsx)(n,{})}renderPopupNotification(){let{popupNotification:e}=this.context;return!e||!e.type?null:(0,q.jsx)(kS,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:`portal-preview-ready`,payload:{}},`*`)}render(){let{page:e,pageQuery:t,site:n,customSiteUrl:r,lastPage:i}=this.context,a=ru({site:n,pageQuery:t}).length;CT({page:e});let o={...OT({page:e}).page[e]},s=`regular`,c=``,l=e;switch(e){case`signup`:c=`Cookies must be enabled in your browser to sign up.`;break;case`signin`:c=`Cookies must be enabled in your browser to sign in.`;break;case`accountHome`:l=`account-home`;break;case`accountProfile`:l=`account-profile`;break;case`accountPlan`:l=`account-plan`;break;default:c=`Cookies must be enabled in your browser.`,l=e;break}a>1&&!Ul({site:n})&&Wl({site:n,pageQuery:t})&&e===`signup`&&(l+=` full-size`,s=`full`),(e===`gift`||e===`giftSuccess`||e===`giftRedemption`)&&(l+=` full-size`,s=`full`),e===`magiclink`&&i===`gift`&&(l+=` full-size giftRedemption`,s=`full`);let u=du({site:n});(u&&a>2||!u&&a>1)&&e===`accountPlan`&&(l+=` full-size`,s=`full`),(e===`emailSuppressionFAQ`||e===`emailReceivingFAQ`)&&(l+=` large-size`);let d=`gh-portal-popup-container`;nd([`preview`])&&(l+=` preview`),nd([`preview`],{customSiteUrl:r})&&!n.disableBackground&&(d+=` preview`),nd([`dev`])&&(d+=` dev`);let f=`${d} ${l}`,p=e===`gift`||e===`giftSuccess`||e===`giftRedemption`||e===`magiclink`&&i===`gift`;return this.sendPortalPreviewReadyEvent(),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-popup-wrapper `+l,onClick:e=>this.handlePopupClose(e),children:[this.renderPopupNotification(),(0,q.jsxs)(`div`,{className:f,style:o,ref:e=>this.node=e,tabIndex:-1,children:[(0,q.jsx)(kT,{message:c}),this.renderActivePage(),s===`full`&&!p?(0,q.jsx)(`div`,{className:`gh-portal-powered inside `+(nd([`preview`])?`hidden `:``)+l,children:(0,q.jsx)(DT,{})}):``]})]}),e!==`share`&&!p&&(0,q.jsx)(`div`,{className:`gh-portal-powered outside `+(nd([`preview`])?`hidden `:``)+l,children:(0,q.jsx)(DT,{})})]})}},jT=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){let t=ST({site:this.context.site})[e];return(0,q.jsx)(t,{})}onHeightChange(e){this.setState({height:e})}handlePopupClose(e){e.preventDefault();let{page:t}=this.context;t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderFrameStyles(){let{site:e,brandColor:t}=this.context,n=UC({site:e});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{dangerouslySetInnerHTML:{__html:t?`:root { --brandcolor: ${t} }`+n:n}}),(0,q.jsx)(`meta`,{name:`viewport`,content:`width=device-width, initial-scale=1, maximum-scale=1`})]})}renderFrameContainer(){let{member:e,site:t,customSiteUrl:n}=this.context,r=OT({member:e}),i=window.innerWidth<480,a={...r.frame.common},o=`gh-portal-popup-background`;return nd([`preview`])&&(r.modalContainer.zIndex=`3999997`),nd([`preview`],{customSiteUrl:n})&&!t.disableBackground&&(o+=` preview`,t.preview_theme===`dark`&&(o+=` preview-dark`)),nd([`dev`])&&(o+=` dev`),(0,q.jsx)(`div`,{style:r.modalContainer,children:(0,q.jsxs)(Jc,{style:a,title:`portal-popup`,head:this.renderFrameStyles(),dataTestId:`portal-popup-frame`,dataDir:this.context.dir,children:[(0,q.jsx)(`div`,{className:o,onClick:e=>this.handlePopupClose(e)}),(0,q.jsx)(AT,{isMobile:i})]})})}render(){let{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};PT({products:zT({numOfProducts:1})});function MT(){return(new Date().getTime()/1e3|0).toString(16)+`xxxxxxxxxxxxxxxx`.replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function NT(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function PT({title:e=`The Blueprint`,description:t=`Thoughts, stories and ideas.`,logo:n=`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,icon:r=`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,url:i=`https://portal.localhost`,plans:a={monthly:5e3,yearly:15e4,currency:`USD`},products:o=zT({numOfProducts:1}),portalProducts:s=o.map(e=>e.id),accentColor:c=`#45C32E`,portalPlans:l=[`free`,`monthly`,`yearly`],portalDefaultPlan:u=``,membersSignupAccess:d=`all`,freePriceName:f=`Free`,freePriceDescription:p=`Free preview`,paidMembersEnabled:m=!0,portalButton:h=!0,portalName:g=!0,portalButtonIcon:_=`icon-1`,portalButtonSignupText:v=`Subscribe now`,portalButtonStyle:y=`icon-and-text`,membersSupportAddress:b=`support@example.com`,editorDefaultEmailRecipients:x=`visibility`,newsletters:S=[],posts:C=LT(),commentsEnabled:w,recommendations:T=[],recommendationsEnabled:E,labs:D={}}={}){return{title:e,description:t,logo:n,icon:r,accent_color:c,url:i,plans:a,products:o,portal_products:s,members_signup_access:d,free_price_name:f,free_price_description:p,paid_members_enabled:m,portal_button:h,portal_name:g,portal_plans:l,...u?{portal_default_plan:u}:{},portal_button_icon:_,portal_button_signup_text:v,portal_button_style:y,members_support_address:b,comments_enabled:w!==`off`,newsletters:S,recommendations:T,recommendations_enabled:!!E,labs:D,editor_default_email_recipients:x,posts:C}}function FT({name:e=`Black Friday`,code:t=`black-friday`,displayTitle:n=`Black Friday Sale!`,displayDescription:r=`Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.`,type:i=`percent`,cadence:a=`month`,amount:o=50,duration:s=`repeating`,durationInMonths:c=null,currencyRestriction:l=!1,currency:u=null,status:d=`active`,tierId:f=``,tierName:p=`Basic`,redemptionType:m=`signup`}={}){return{id:`offer_${MT()}`,name:e,code:t,display_title:n,display_description:r,type:i,cadence:a,amount:o,duration:s,duration_in_months:c,currency_restriction:l,currency:u,status:d,tier:{id:`${f}`,name:p},redemption_type:m}}function IT({name:e=`Jamie Larson`,email:t=`jamie@example.com`,firstname:n=`Jamie`,subscriptions:r=[],paid:i=!1,status:a,avatarImage:o=``,subscribed:s=!0,email_suppression:c={suppressed:!1,info:null},newsletters:l=[]}={}){let u={uuid:NT(),email:t,name:e,firstname:n,paid:i,subscribed:s,avatar_image:o,subscriptions:r,email_suppression:c,newsletters:l};return a===void 0?i?u.status=`paid`:u.status=`free`:u.status=a,u}function LT({numOfPosts:e=3}={}){let t=[];for(let n=0;n<e;n++)t.push(RT({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function RT({id:e=`post_${MT()}`,title:t=`Post`,excerpt:n=`Post excerpt`,slug:r=`post`,featured:i=!1}={}){return{id:e,title:t,excerpt:n,slug:r,featured:i}}function zT({numOfProducts:e=3}={}){let t=[BT({name:`Bronze`,description:`Access to all members articles`,monthlyPrice:WT({interval:`month`,amount:700}),yearlyPrice:WT({interval:`year`,amount:7e3}),numOfBenefits:2}),BT({name:`Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:WT({interval:`month`,amount:1200}),yearlyPrice:WT({interval:`year`,amount:12e3}),numOfBenefits:3}),BT({name:`Friends of the Blueprint`,description:`Get access to everything and lock in early adopter pricing for life + listen to my podcast`,monthlyPrice:WT({interval:`month`,amount:18e3}),yearlyPrice:WT({interval:`year`,amount:17e3}),numOfBenefits:4})].slice(0,e),n=VT({});return[...t,n]}function BT({type:e=`paid`,name:t=`Basic`,description:n=``,id:r=`product_${MT()}`,monthlyPrice:i=WT(),yearlyPrice:a=WT({interval:`year`}),numOfBenefits:o=2,trialDays:s=null}){return{id:r,name:t,description:n,monthlyPrice:e===`free`?null:i,yearlyPrice:e===`free`?null:a,type:e,benefits:HT({numOfBenefits:o}),trial_days:s}}function VT({name:e=`Free tier`,description:t=`Free tier description`,id:n=`product_${MT()}`,numOfBenefits:r=2}){return{id:n,name:e,type:`free`,description:t,benefits:HT({numOfBenefits:r})}}function HT({numOfBenefits:e}){let t=MT();return[UT({name:`Limited early adopter pricing #${t.substring(0,6)}`}),UT({name:`Latest gear reviews #${t.substring(6,12)}`}),UT({name:`Weekly email newsletter #${t.substring(12,18)}`}),UT({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function UT({id:e=`benefit_${MT()}`,name:t=`Benefit`}){return{id:e,name:t}}function WT({interval:e=`month`,amount:t=e===`month`?500:5e3,nickname:n=e===`month`?`Monthly`:`Yearly`,description:r=null,currency:i=`usd`,active:a=!0,id:o=`price_${MT()}`}={}){return{id:o,active:a,nickname:n,currency:i,amount:t,interval:e,description:r,stripe_price_id:`price_${MT()}`,stripe_product_id:`prod_${MT()}`,type:`recurring`}}function GT({id:e=`sub_${MT()}`,status:t=`active`,currency:n=`USD`,interval:r=`year`,amount:i=r===`month`?500:5e3,nickname:a=r===`month`?`Monthly`:`Yearly`,cardLast4:o=`4242`,offer:s=qT,priceId:c=`price_${MT()}`,startDate:l=`2021-10-05T03:18:30.000Z`,currentPeriodEnd:u=`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:d=!1,trialEndAt:f=null,nextPayment:p=null,tier:m=null}={}){return{id:e,customer:{id:`cus_${MT()}`,name:`Jamie`,email:`jamie@example.com`},plan:{id:`price_${MT()}`,nickname:a,amount:i,interval:r,currency:n},offer:s,status:t,start_date:l,default_payment_card_last4:o,cancel_at_period_end:d,cancellation_reason:null,current_period_end:u,trial_end_at:f,next_payment:p,tier:m,price:{id:`stripe_price_${MT()}`,price_id:c,nickname:a,amount:i,interval:r,type:`recurring`,currency:n,product:{id:`stripe_prod_${MT()}`,product_id:`prod_${MT()}`}}}}function KT(){let e=zT({numOfProducts:1});return PT({products:e,portalPlans:[`free`,`monthly`,`yearly`],portalProducts:e.map(e=>e.id)})}KT();var qT=FT({tierId:PT({products:[BT({numOfBenefits:2,type:`free`})]}).products[0]?.id});IT({status:`free`}),IT({status:`paid`,paid:!0,subscriptions:[GT()]}),IT({status:`comped`,paid:!0,subscriptions:[]}),IT({status:`comped`,paid:!0,subscriptions:[GT({amount:0})]}),IT({status:`paid`,paid:!0,subscriptions:[GT({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:`2021-06-05T11:42:40.000Z`})]}),KT();var JT=[VT({name:`Free`,description:`Free tier description which is actually a pretty long description`,numOfBenefits:2}),BT({name:`The Blueprint`,description:``,monthlyPrice:WT({interval:`month`,amount:500}),yearlyPrice:WT({interval:`year`,amount:5e3}),numOfBenefits:3}),BT({name:`Friends of the Blueprint Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:WT({interval:`month`,amount:1200}),yearlyPrice:WT({interval:`year`,amount:11e3}),numOfBenefits:4})],YT=PT({title:`The Blueprint`,description:`Thoughts, stories and ideas.`,logo:`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,icon:`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,accentColor:`#45C32E`,url:`https://portal.localhost`,plans:{monthly:5e3,yearly:15e4,currency:`USD`},products:JT,portalProducts:JT.map(e=>e.id),allowSelfSignup:!0,membersSignupAccess:`all`,freePriceName:`Free`,freePriceDescription:`Free preview`,paidMembersEnabled:!0,portalButton:!0,portalName:!0,portalPlans:[`free`,`monthly`,`yearly`],portalButtonIcon:`icon-1`,portalButtonSignupText:`Subscribe now`,portalButtonStyle:`icon-and-text`,membersSupportAddress:`support@example.com`,commentsEnabled:!0,newsletters:[{id:`weekly`,name:`Weekly Rundown`,description:`Best of last week`,subscribe_on_signup:!0,paid:!0},{id:`daily`,name:`Daily Brief`,description:`One email every day`,subscribe_on_signup:!1,paid:!1}],posts:[{id:`post_66aacfe061c94e10eb6e4fc1`,title:`Post 1`,excerpt:`Post excerpt`,slug:`post-1`,featured:!1},{id:`post_66aacfe04f14b8dbb56c5721`,title:`Post 2`,excerpt:`Post excerpt`,slug:`post-2`,featured:!1},{id:`post_66aacfe03d609460819af18c`,title:`Post 3`,excerpt:`Post excerpt`,slug:`post-3`,featured:!1}]}),XT=FT({tierId:YT.products[1]?.id}),ZT={free:IT({name:`Jamie Larson`,email:`jamie@example.com`,firstname:`Jamie`,subscriptions:[],paid:!1,status:`free`,avatarImage:``,subscribed:!0}),paid:IT({paid:!0,status:`paid`,subscriptions:[GT({status:`active`,currency:`USD`,interval:`year`,amount:5e3,cardLast4:`4242`,startDate:`2021-10-05T03:18:30.000Z`,currentPeriodEnd:`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:!1})]}),complimentary:IT({paid:!0,status:`comped`,subscriptions:[]}),complimentaryWithSubscription:IT({paid:!0,status:`comped`,subscriptions:[GT({amount:0})]}),preview:IT({paid:!0,status:`paid`,subscriptions:[GT({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:new Date().toISOString()})]})};function QT(){if(!JT||!JT[1])return null;let e=YT?.products?.[1].monthlyPrice;return{site:YT,member:IT({paid:!0,status:`paid`,subscriptions:[GT({offer:null,priceId:e?.id,status:`active`,currency:e?.currency,interval:e?.interval,amount:e?.amount,cardLast4:`4242`,startDate:`2021-10-05T03:18:30.000Z`,currentPeriodEnd:`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:!1})]})}}function $T(e){let t=e.getAttribute(`href`),n;try{n=new URL(t,window.location.origin)}catch{return}let r=[`#/portal`,`#/share`],i=r.some(e=>n.hash.startsWith(e)),a=r.some(e=>t.startsWith(e));!n.hash||!i||a||n.origin===window.location.origin&&e.setAttribute(`href`,n.hash)}var eE=`CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION`;function tE({data:e,state:t}){return{page:e.page,popupNotification:null,fieldErrors:{},lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function nE({state:e}){return{showPopup:!e.showPopup}}function rE({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function iE({state:e}){return e.page===`gift`&&Vw(),e.lastPage?{page:e.lastPage,fieldErrors:{}}:aE({state:e})}function aE({state:e}){let t=!1;e.page===`gift`&&(Vw(),t=rT()),t||vl();let n={...e.pageData||{}};return delete n.redirect,{showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,fieldErrors:{},page:e.page===`magiclink`?``:e.page,pageData:n}}function oE({data:e,state:t}){let{action:n=`openNotification`,status:r=`success`,autoHide:i=!0,closeable:a=!0,duration:o=2600,message:s=``}=e||{},c=Iu({type:n,status:r,autoHide:i,closeable:a,duration:o,state:t,message:s});return{notification:c,notificationSequence:c.count}}function sE(){return{notification:null}}async function cE({api:e,state:t}){try{return await e.member.signout(),{action:`signout:success`}}catch{return{action:`signout:failed`,popupNotification:Y({type:`signout:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to log out, please try again`)})}}}async function lE({data:e,api:t,state:n}){try{let r=await t.member.getIntegrityToken(),i={...e,emailType:`signin`,integrityToken:r,includeOTC:!0},{otc_ref:a,inboxLinks:o}=await t.member.sendMagicLink(i);return{page:`magiclink`,lastPage:`signin`,...a?{otcRef:a}:{},inboxLinks:o,pageData:{...n.pageData||{},email:(e?.email||``).trim()}}}catch(e){return{action:`signin:failed`,popupNotification:Y({type:`signin:failed`,autoHide:!1,closeable:!0,state:n,status:`error`,message:Kc(e,K(`Failed to log in, please try again`))})}}}function uE({data:e,state:t}){let n=(e?.email||``).trim(),r=e?.otcRef,i=e?.inboxLinks;return r?{showPopup:!0,page:`magiclink`,lastPage:`signin`,otcRef:r,inboxLinks:i,pageData:{...t.pageData||{},email:n},popupNotification:null}:{}}async function dE({data:e,api:t}){let n=K(`Failed to verify code, please try again`);try{let r=await t.member.getIntegrityToken(),i=await t.member.verifyOTC({...e,integrityToken:r});return i.redirectUrl?window.location.assign(i.redirectUrl):{action:`verifyOTC:failed`,actionErrorMessage:Kc(i.errors?.[0],n)}}catch(e){return{action:`verifyOTC:failed`,actionErrorMessage:Kc(e,n)}}}async function fE({data:e,state:t,api:n}){try{let{plan:r,tierId:i,cadence:a,email:o,name:s,newsletters:c,offerId:l}=e;s=s?.trim();let u;if(r.toLowerCase()===`free`){let t=await n.member.getIntegrityToken();({inboxLinks:u}=await n.member.sendMagicLink({emailType:`signup`,integrityToken:t,...e,name:s}))}else{let e=t.member?{checkoutType:`upgrade`}:void 0;return(!i||!a)&&({tierId:i,cadence:a}=bu({site:t?.site,priceId:r})),await n.member.checkoutPlan({plan:r,tierId:i,cadence:a,email:o,name:s,newsletters:c,offerId:l,metadata:e}),{page:`loading`}}return{page:`magiclink`,lastPage:`signup`,inboxLinks:u,pageData:{...t.pageData||{},email:(o||``).trim()}}}catch(n){return n.code===eE?t.member?{action:`signup:failed`,popupNotification:Y({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`You already have an active subscription.`)})}:{page:`magiclink`,lastPage:`signin`,pageData:{...t.pageData||{},email:(e?.email||``).trim()},popupNotification:null}:{action:`signup:failed`,popupNotification:Y({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:Kc(n,K(`Failed to sign up, please try again`))})}}}async function pE({data:e,state:t,api:n}){try{let{email:r,name:i,giftToken:a}=e;if(i=i?.trim(),t.member){await n.gift.redeem({token:a});let e=await n.member.sessionData(),r=Iu({type:`giftRedeem`,status:`success`,autoHide:!0,closeable:!0,state:t,message:Jd({member:e})});return vl(),{action:`redeemGift:success`,member:e,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:r,notificationSequence:r.count}}let o=await n.member.getIntegrityToken(),s=new URL(t?.site?.url||window.location.href);s.search=new URLSearchParams({giftRedemption:`true`}).toString(),s.hash=``;let{otc_ref:c,inboxLinks:l}=await n.member.sendMagicLink({email:(r||``).trim(),emailType:`subscribe`,integrityToken:o,includeOTC:!0,redirect:s.href,giftToken:a,...i?{name:i}:{}});return{page:`magiclink`,lastPage:`gift`,...c?{otcRef:c}:{},inboxLinks:l,pageData:{...t.pageData||{},email:(r||``).trim(),...i?{name:i}:{},redirect:s.href}}}catch(e){let n=Iu({type:`giftRedeem`,status:`error`,autoHide:!1,closeable:!0,state:t,message:Yd(e)});return vl(),{action:`redeemGift:failed`,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:n,notificationSequence:n.count}}}async function mE({data:e,state:t,api:n}){try{let{plan:r,offerId:i,tierId:a,cadence:o}=e;(!a||!o)&&({tierId:a,cadence:o}=bu({site:t?.site,priceId:r})),await n.member.checkoutPlan({plan:r,tierId:a,cadence:o,offerId:i,metadata:{checkoutType:`upgrade`}})}catch{return{action:`checkoutPlan:failed`,popupNotification:Y({type:`checkoutPlan:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}async function hE({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:`continueGiftSubscription:failed`,popupNotification:Y({type:`continueGiftSubscription:failed`,autoHide:!1,closeable:!0,state:e,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}async function gE({data:e,state:t,api:n}){try{let{tierId:t,cadence:r,duration:i,email:a,deliveryMethod:o,recipientEmail:s,recipientName:c,buyerName:l,personalMessage:u,deliveryDate:d}=e;return await n.member.checkoutGift({tierId:t,...i===void 0?{cadence:r}:{duration:i},...a?{email:a}:{},...o===void 0?{}:{deliveryMethod:o},...s?{recipientEmail:s}:{},...c?{recipientName:c}:{},...l?{buyerName:l}:{},...u?{personalMessage:u}:{},...d?{deliveryDate:d}:{}}),{action:`checkoutGift:success`}}catch{return{action:`checkoutGift:failed`,popupNotification:Y({type:`checkoutGift:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}function _E({property:e,message:t},n){if(typeof e!=`string`||!/^answers(\.|$)/.test(e))return{};let r=Kc({message:t}),i=uh(n,e);return i?FE(i.field,i.part,r):{sentence:r}}async function vE({data:e,state:t,api:n}){let{plan:r,planId:i,subscriptionId:a,cancelAtPeriodEnd:o,answers:s,asked:c=[]}=e;try{let{tierId:e,cadence:c}=bu({site:t?.site,priceId:i});await n.member.updateSubscription({planName:r,tierId:e,cadence:c,subscriptionId:a,cancelAtPeriodEnd:o,planId:i,answers:s});let l=await n.member.sessionData(),u=`updateSubscription:success`;return{action:u,fieldErrors:{},popupNotification:Y({type:u,autoHide:!0,closeable:!0,state:t,status:`success`,message:K(`Subscription plan updated successfully`)}),page:`accountHome`,member:l}}catch(e){let n=NE(e,e=>_E(e,c),K(`Failed to update subscription, please try again`));return{action:`updateSubscription:failed`,fieldErrors:n.fieldErrors,popupNotification:IE({...n,state:t,type:`updateSubscription:failed`,autoHide:!1})}}}function yE(){return{fieldErrors:{}}}async function bE({data:e,state:t,api:n}){try{let{subscriptionId:t,cancellationReason:r}=e;return await n.member.updateSubscription({subscriptionId:t,smartCancel:!0,cancellationReason:r}),{action:`cancelSubscription:success`,page:`accountHome`,member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:`cancelSubscription:failed`,popupNotification:Y({type:`cancelSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to cancel subscription, please try again`)})}}}async function xE({data:e,state:t,api:n}){try{let{subscriptionId:t}=e;return await n.member.updateSubscription({subscriptionId:t,cancelAtPeriodEnd:!1}),{action:`continueSubscription:success`,page:`accountHome`,member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:`continueSubscription:failed`,popupNotification:Y({type:`continueSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to cancel subscription, please try again`)})}}}async function SE({data:e,state:t,api:n}){try{let{offerId:r,subscriptionId:i}=e;return await n.member.applyOffer({offerId:r,subscriptionId:i}),{action:`applyOffer:success`,page:`accountHome`,member:await n.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:Y({type:`applyOffer:success`,autoHide:!0,closeable:!0,state:t,status:`success`,message:`Offer applied successfully!`})}}catch{return{action:`applyOffer:failed`,popupNotification:Y({type:`applyOffer:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:`Failed to apply offer, please try again`})}}}async function CE({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:`editBilling:failed`,popupNotification:Y({type:`editBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to update billing information, please try again`)})}}}async function wE({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:`manageBilling:failed`,popupNotification:Y({type:`manageBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to open billing portal, please try again`)})}}}async function TE(){return{popupNotification:null}}async function EE({data:e,state:t}){let{action:n,message:r=``,status:i=`success`}=e;return n||=`showPopupNotification:success`,{popupNotification:Y({type:n,autoHide:!0,closeable:!0,state:t,status:i,message:r})}}async function DE({data:e,state:t,api:n}){try{let{newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a,successMessage:o}=e;if(!r&&i===void 0&&a===void 0)return{};let s={};r&&(s.newsletters=r),i!==void 0&&(s.enableCommentNotifications=i),a!==void 0&&(s.enableUpdatesAndAnnouncements=a);let c=await n.member.update(s),l=`updateNewsletterPref:success`;return{action:l,member:c,...o&&{popupNotification:Y({type:l,autoHide:!0,closeable:!0,state:t,status:`success`,message:o})}}}catch{return{action:`updateNewsletterPref:failed`,popupNotification:Y({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:K(`Failed to update newsletter settings`)})}}}async function OE({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:`removeEmailFromSuppressionList:success`,popupNotification:Y({type:`removeEmailFromSuppressionList:success`,autoHide:!0,closeable:!0,state:e,status:`success`,message:K(`You have been successfully resubscribed`)})}}catch{return{action:`removeEmailFromSuppressionList:failed`,popupNotification:Y({type:`removeEmailFromSuppressionList:failed`,autoHide:!0,closeable:!0,state:e,status:`error`,message:K(`Your email has failed to resubscribe, please try again`)})}}}async function kE({data:e,state:t,api:n}){try{let{subscribed:r}=e,i=await n.member.update({subscribed:r});if(!i)throw Error(`Failed to update newsletter`);let a=`updateNewsletter:success`;return{action:a,member:i,popupNotification:Y({type:a,autoHide:!0,closeable:!0,state:t,status:`success`,message:K(`Email newsletter settings updated`)})}}catch{return{action:`updateNewsletter:failed`,popupNotification:Y({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:K(`Failed to update newsletter settings`)})}}}async function AE({data:e,state:t,api:n}){let{email:r}=e;if(r!==wu({member:t.member}))try{return await n.member.updateEmailAddress({email:r}),{success:!0}}catch(e){return{success:!1,error:e}}return null}async function jE({data:e,state:t,api:n}){let r=e?.name?.trim(),i=e?.metafields;if(Du({member:t.member})!==r||i)try{let e=await n.member.update({name:r,metafields:i});if(!e)throw Error(`Failed to update member`);return{member:e,success:!0}}catch(e){return{success:!1,error:e}}return null}async function ME({state:e,api:t}){if(e.member)try{let e=await t.member.sessionData();return e?{member:e,success:!0,action:`refreshMemberData:success`}:null}catch(e){return{success:!1,error:e,action:`refreshMemberData:failed`}}return null}function NE(e,t,n){let r=e?.details?.length?e.details:[{property:e?.property,message:e?.message}],i={},a=null;for(let e of r){let n=t(e);n.input?i[n.input]=n.message:n.sentence&&!a&&(a=n.sentence)}return{fieldErrors:i,sentence:a,message:a??n}}function PE({property:e,message:t},n){let[r,,i,...a]=(typeof e==`string`?e:``).split(`.`);if(r!==`metafields`)return{};let o=Kc({message:t}),s=n.customFields?.find(e=>e.key===i);return s?FE(s,a.join(`.`),o):{sentence:o}}function FE(e,t,n){let r=zm(e,t);return r?{input:r,message:n}:{sentence:K(`{field}: {message}`,{field:e.name,message:n})}}function IE({fieldErrors:e,sentence:t,message:n,state:r,type:i=`updateProfile:failed`,autoHide:a=!0}){return Object.keys(e).length>0&&!t?null:Y({type:i,autoHide:a,closeable:!0,status:`error`,message:n,state:r})}async function LE({data:e,state:t,api:n}){let[r,i]=await Promise.all([jE({data:e,state:t,api:n}),AE({data:e,state:t,api:n})]);if(r&&i){if(i.success&&r.success)return{action:`updateProfile:success`,...r.success?{member:r.member}:{},page:`accountHome`,popupNotification:Y({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:K(`Check your inbox to verify email update`)})};let e=r.success?{fieldErrors:{},message:K(`Failed to send verification email`)}:NE(r.error,e=>PE(e,t),K(`Failed to update account data`));return{action:`updateProfile:failed`,fieldErrors:e.fieldErrors,...r.success?{member:r.member}:{},popupNotification:IE({...e,state:t})}}else if(r){let e=r.success?`updateProfile:success`:`updateProfile:failed`,n=r.success?`success`:`error`,i=r.success?{fieldErrors:{},message:K(`Account details updated successfully`)}:NE(r.error,e=>PE(e,t),K(`Failed to update account details`));return{action:e,fieldErrors:i.fieldErrors,...r.success?{member:r.member}:{},...r.success?{page:`accountHome`}:{},popupNotification:r.success?Y({type:e,autoHide:!0,closeable:!0,status:n,state:t,message:i.message}):IE({...i,state:t})}}else if(i){let e=i.success?`updateProfile:success`:`updateProfile:failed`,n=i.success?`success`:`error`,r=``;return r=i.error?Kc(i.error,K(`Failed to send verification email`)):K(`Check your inbox to verify email update`),{action:e,fieldErrors:{},...i.success?{page:`accountHome`}:{},popupNotification:Y({type:e,autoHide:i.success,closeable:!0,status:n,state:t,message:r})}}return{action:`updateProfile:success`,page:`accountHome`,popupNotification:Y({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:K(`Account details updated successfully`)})}}async function RE({data:{siteUrl:e},state:t}){let n=nC({siteUrl:e,apiUrl:`not-defined`,contentApiKey:`not-defined`}),{member:r}=t,i=window.location.href,a=Xl(),o=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:`signup`,name:r.name,email:r.email,autoRedirect:!1,integrityToken:o,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:a,referrerMedium:`Ghost Recommendations`,referrerUrl:i}]:[]}),{}}function zE({data:{recommendationId:e},api:t}){try{let t=localStorage.getItem(`ghost-recommendations-clicked`),n=t?JSON.parse(t):[];if(n.includes(e))return;n.push(e),localStorage.setItem(`ghost-recommendations-clicked`,JSON.stringify(n))}catch{}return t.recommendations.trackClicked({recommendationId:e}),{}}async function BE({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}var VE={togglePopup:nE,openPopup:rE,closePopup:aE,switchPage:tE,openNotification:oE,closeNotification:sE,back:iE,signout:cE,signin:lE,startSigninOTCFromCustomForm:uE,verifyOTC:dE,signup:fE,redeemGift:pE,updateSubscription:vE,cancelSubscription:bE,continueSubscription:xE,applyOffer:SE,updateNewsletter:kE,updateProfile:LE,refreshMemberData:ME,clearPopupNotification:TE,clearFieldErrors:yE,editBilling:CE,manageBilling:wE,checkoutPlan:mE,continueGiftSubscription:hE,checkoutGift:gE,updateNewsletterPreference:DE,showPopupNotification:EE,removeEmailFromSuppressionList:OE,oneClickSubscribe:RE,trackRecommendationClicked:zE,trackRecommendationSubscribed:BE};async function HE({action:e,data:t,state:n,api:r}){let i=VE[e];return i&&await i({data:t,state:n,api:r})||{}}function UE(e,t){e&&(e.innerText=t)}function WE(e,t,n){t.classList.add(`error`),UE(n,Kc(e,K(`There was an error sending the email, please try again`)))}async function GE({event:e,form:t,errorEl:n,siteUrl:r,submitHandler:i,doAction:a,captureException:o}){t.removeEventListener(`submit`,i),e.preventDefault(),n&&(n.innerText=``),t.classList.remove(`success`,`invalid`,`error`);let s=e.target.querySelector(`input[data-members-email]`),c=e.target.querySelector(`input[data-members-name]`),l=t?.dataset?.membersAutoredirect||`true`,u=s?.value,d=(c?.value||``).trim()||void 0,f,p=[],m=[],h=e.target.querySelectorAll(`input[data-members-label]`)||[];for(let e=0;e<h.length;++e)p.push(h[e].value);let g=e.target.querySelectorAll(`input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked`)||[];for(let e=0;e<g.length;++e)m.push({name:g[e].value});t.dataset.membersForm&&(f=t.dataset.membersForm);let _=f===`signin`&&t?.dataset?.membersOtc===`true`;t.classList.add(`loading`);let v=qu(),y={email:u,emailType:f,labels:p,name:d,autoRedirect:l===`true`};_&&(y.includeOTC=!0),v&&(y.urlHistory=v),g.length>0?y.newsletters=m:(e.target.querySelectorAll(`input[type=checkbox][data-members-newsletter]`)||[]).length>0&&(y.newsletters=[]);try{let e=await(await tC(`${r}/members/api/integrity-token/`,{method:`GET`})).text(),i=await tC(`${r}/members/api/send-magic-link/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...y,integrityToken:e})});if(i.ok){t.classList.add(`success`);let e;if(_)try{e=await i.clone().json()}catch{e=void 0}let n=e?.otc_ref;if(n&&typeof a==`function`)try{a(`startSigninOTCFromCustomForm`,{email:(u||``).trim(),otcRef:n,inboxLinks:e?.inboxLinks})}catch(e){console.error(e),o?.(e)}}else UE(n,Kc(await Uc.fromApiResponse(i),K(`Failed to send magic link email`))),t.classList.add(`error`)}catch(e){WE(e,t,n)}finally{t.addEventListener(`submit`,i),t.classList.remove(`loading`)}}function KE({event:e,el:t,errorEl:n,siteUrl:r,site:i,member:a,clickHandler:o}){t.removeEventListener(`click`,o),e.preventDefault();let s=t.dataset.membersPlan,c=Bl(i,s.toLowerCase()),l=t.dataset.membersSuccess,u=t.dataset.membersCancel,d,f;l&&(d=new URL(l,window.location.href).href),u&&(f=new URL(u,window.location.href).href),n&&(n.innerText=``),t.classList.add(`loading`);let p=a?{checkoutType:`upgrade`}:{},m=qu();return m&&(p.urlHistory=m),fetch(`${r}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(e){return fetch(`${r}/members/api/create-stripe-checkout-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...c,identity:e,successUrl:d,cancelUrl:f,metadata:p})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe checkout session`));return e.json()})}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})}).catch(function(e){console.error(e),t.addEventListener(`click`,o),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}function qE({siteUrl:e,site:t={},member:n,offers:r=[],doAction:i,captureException:a}={}){if(!e)return;e=e.replace(/\/$/,``),Array.prototype.forEach.call(document.querySelectorAll(`form[data-members-form]`),function(t){let n=t.querySelector(`[data-members-error]`);function r(o){GE({event:o,errorEl:n,form:t,siteUrl:e,submitHandler:r,doAction:i,captureException:a})}t.addEventListener(`submit`,r)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-plan]`),function(r){let i=r.querySelector(`[data-members-error]`);function a(o){KE({el:r,event:o,errorEl:i,member:n,site:t,siteUrl:e,clickHandler:a})}r.addEventListener(`click`,a)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-edit-billing]`),function(t){let n=t.querySelector(`[data-members-error]`),r=t.dataset.membersSuccess,i=t.dataset.membersCancel,a,o;r&&(a=new URL(r,window.location.href).href),i&&(o=new URL(i,window.location.href).href);function s(r){t.removeEventListener(`click`,s),r.preventDefault(),n&&(n.innerText=``),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,successUrl:a,cancelUrl:o})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe checkout session`));return e.json()})}).then(function(e){return window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId})}).then(function(e){if(e.error)throw Error(K(e.error.message))}).catch(function(e){console.error(e),t.addEventListener(`click`,s),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}t.addEventListener(`click`,s)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-manage-billing]`),function(t){let n=t.querySelector(`[data-members-error]`),r=t.dataset.membersReturn,i;r&&(i=new URL(r,window.location.href).href);function a(r){t.removeEventListener(`click`,a),r.preventDefault(),n&&(n.innerText=``),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,returnUrl:i})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe billing portal session`));return e.json()})}).then(function(e){return window.location.assign(e.url)}).catch(function(e){console.error(e),t.addEventListener(`click`,a),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}t.addEventListener(`click`,a)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-signout]`),function(t){function n(r){t.removeEventListener(`click`,n),r.preventDefault(),t.classList.remove(`error`),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{method:`DELETE`}).then(function(r){r.ok?window.location.replace(e):(t.addEventListener(`click`,n),t.classList.remove(`loading`),t.classList.add(`error`))})}t.addEventListener(`click`,n)});let o=(r||[]).some(e=>e.redemption_type===`retention`);Array.prototype.forEach.call(document.querySelectorAll(`[data-members-cancel-subscription]`),function(t){let n=t.parentElement.querySelector(`[data-members-error]`);function r(a){a.preventDefault();let s=t.dataset.membersCancelSubscription;if(o){i(`openPopup`,{page:`accountPlan`,pageData:{subscriptionId:s,action:`cancel`}});return}return t.removeEventListener(`click`,r),t.classList.remove(`error`),t.classList.add(`loading`),n&&(n.innerText=``),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/subscriptions/${s}/`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,smart_cancel:!0})})}).then(function(e){e.ok?window.location.reload():(t.addEventListener(`click`,r),t.classList.remove(`loading`),t.classList.add(`error`),n&&(n.innerText=K(`There was an error cancelling your subscription, please try again.`)))})}t.addEventListener(`click`,r)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-continue-subscription]`),function(t){let n=t.parentElement.querySelector(`[data-members-error]`);function r(i){t.removeEventListener(`click`,r),i.preventDefault(),t.classList.remove(`error`),t.classList.add(`loading`);let a=t.dataset.membersContinueSubscription;return n&&(n.innerText=``),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/subscriptions/${a}/`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,cancel_at_period_end:!1})})}).then(function(e){e.ok?window.location.reload():(t.addEventListener(`click`,r),t.classList.remove(`loading`),t.classList.add(`error`),n&&(n.innerText=K(`There was an error continuing your subscription, please try again.`)))})}t.addEventListener(`click`,r)})}var JE=e=>{try{return decodeURIComponent(e)}catch{return null}},YE=e=>{if(e===`true`)return!0;if(e===`false`)return!1},XE={staleGiftRedemptionRequest:!0},ZE={showPopup:!0,site:YT,member:ZT.free,page:`accountEmail`,...QT(),pageData:XT};function QE({site:e,children:t}){let{portal_sentry:n}=e||{};return n&&n.dsn?(0,q.jsx)(Eo,{children:t}):(0,q.jsx)(q.Fragment,{children:t})}var $E=class extends _.Component{constructor(e){super(e),this.setupCustomTriggerButton(),this.state={site:null,member:null,customFields:[],offers:[],page:`loading`,showPopup:!1,action:`init:running`,actionErrorMessage:null,fieldErrors:{},initStatus:`running`,lastPage:null,notification:null,notificationSequence:-1,customSiteUrl:e.customSiteUrl,locale:e.locale,scrollbarWidth:0},this._redemptionRequestId=0,this.currentRedemptionToken=null}componentDidMount(){let e=this.getScrollbarWidth();this.setState({scrollbarWidth:e}),this.initSetup()}componentDidUpdate(e,t){if(t.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=window.document?.body?.style?.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue(`margin-right`),window.document.body.style.overflow=`hidden`,this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||``,!this.bodyMargin||this.bodyMargin===`0px`?window.document.body.style.marginRight=``:window.document.body.style.marginRight=this.bodyMargin,this.state.reloadOnPopupClose&&window.location.reload())}catch{}}if(this.state.initStatus===`success`&&t.initStatus!==this.state.initStatus){let{siteUrl:e}=this.props,t=this.getContextFromState();this.sendPortalReadyEvent(),qE({siteUrl:e,site:t.site,member:t.member,offers:t.offers,doAction:t.doAction,captureException:nr})}}componentWillUnmount(){clearTimeout(this.timeoutId),this.customTriggerButtons&&this.customTriggerButtons.forEach(e=>{e.removeEventListener(`click`,this.clickHandler)}),window.removeEventListener(`hashchange`,this.hashHandler,!1)}sendPortalReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:`portal-ready`,payload:{}},`*`)}getScrollbarWidth(){let e=document.createElement(`div`);e.style.visibility=`hidden`,e.style.overflow=`scroll`,document.body.appendChild(e),document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}setupCustomTriggerButton(){this.clickHandler=async e=>{e.preventDefault();let t=e.currentTarget,n=t&&t.dataset.portal,r=this.getPageFromLinkPath(n,this.state.site);if(!r)return;let{page:i,pageQuery:a,pageData:o}=r;if(this.state.initStatus===`success`){if(i===`gift`&&!Kl({site:this.state.site})){this.invalidateGiftRedemptionRequest(),vl();return}if(i===`giftRedemption`&&o?.token){let e=this.startGiftRedemptionRequest(o.token),t=await this.fetchGiftRedemptionData({token:o.token});if(!this.isCurrentGiftRedemptionRequest(e))return;this.setState(t);return}this.invalidateGiftRedemptionRequest(),a&&a!==`free`?this.handleSignupQuery({site:this.state.site,pageQuery:a}):this.dispatchAction(`openPopup`,{page:i,pageQuery:a,pageData:o})}},this.customTriggerButtons=document.querySelectorAll(`[data-portal]`)||[],this.customTriggerButtons.forEach(e=>{e.classList.add(`gh-portal-close`),e.removeEventListener(`click`,this.clickHandler),e.addEventListener(`click`,this.clickHandler)})}handleCustomTriggerClassUpdate(){let e=`gh-portal-open`,t=`gh-portal-close`;this.customTriggerButtons?.forEach(n=>{let r=this.state.showPopup?e:t,i=this.state.showPopup?t:e;n.classList.add(r),n.classList.remove(i)})}startGiftRedemptionRequest(e){return this._redemptionRequestId+=1,this.currentRedemptionToken=e,{requestId:this._redemptionRequestId,token:e}}invalidateGiftRedemptionRequest(){this._redemptionRequestId+=1,this.currentRedemptionToken=null}isCurrentGiftRedemptionRequest({requestId:e,token:t}){return this._redemptionRequestId===e&&this.currentRedemptionToken===t}async initSetup(){try{let{site:e,member:t,offers:n,customFields:r,page:i,showPopup:a,popupNotification:o,notification:s,notificationSequence:c,lastPage:l,pageQuery:u,pageData:d}=await this.fetchData(),f=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||`en`;Hc.changeLanguage(f);let p={site:e,member:t,offers:n,customFields:r,page:i,lastPage:l,pageQuery:u,showPopup:a,pageData:d,popupNotification:o,notification:s,notificationSequence:c,dir:Hc.dir()||`ltr`,action:`init:success`,initStatus:`success`,locale:f};if(this.setState(p,()=>{this.handleSignupQuery({site:e,pageQuery:u,member:t})}),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener(`hashchange`,this.hashHandler,!1),!t){let e=document.querySelectorAll(`[data-lexical-signup-form]`);e.length>0&&e.forEach(e=>{e.style.display=``})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(e){console.error(`[Portal] Failed to initialize:`,e),this.setState({action:`init:failed`,initStatus:`failed`})}}async fetchData(){let{site:e,member:t,offers:n}=await this.fetchApiData(),{site:r,...i}=this.fetchDevData(),[a,o]=await Promise.all([this.fetchLinkData(e,t),Nm({api:this.GhostApi,site:e,member:t})]),{site:s,...c}=a?.staleGiftRedemptionRequest?{}:a,{site:l,...u}=this.fetchPreviewData(),{site:d,...f}=this.fetchNotificationData();return{member:t,offers:n,customFields:o,page:``,site:{...e,...s,...l,...d,...r,plans:{...(r||{}).plans,...(e||{}).plans,...(l||{}).plans}},...i,...c,...f,...u}}fetchDevData(){return nd([`dev`])&&!this.state.customSiteUrl?ZE:nd([`test`])?{showPopup:this.props.showPopup===void 0||this.props.showPopup}:{}}fetchOfferQueryStrData(e=``){let t=new URLSearchParams(e),n={};for(let e of t.entries()){let t=e[0],r=decodeURIComponent(e[1]);t===`name`?n.name=r||``:t===`code`?n.code=r||``:t===`display_title`?n.display_title=r||``:t===`display_description`?n.display_description=r||``:t===`type`?n.type=r||``:t===`cadence`?n.cadence=r||``:t===`duration`?n.duration=r||``:t===`duration_in_months`&&!isNaN(Number(r))?n.duration_in_months=Number(r):t===`amount`&&!isNaN(Number(r))?n.amount=Number(r):t===`currency`?n.currency=r||``:t===`status`?n.status=r||``:t===`tier_id`?n.tier={id:r||XT.tier.id}:t===`redemption_type`&&(n.redemption_type=r||`signup`)}if(n.redemption_type===`retention`){let e=ZT.preview?.subscriptions?.[0]?.id;return{page:`accountPlan`,offers:[n],pageData:{action:`cancel`,subscriptionId:e}}}return{page:`offer`,pageData:n}}fetchQueryStrData(e=``){let t=new URLSearchParams(e),n={site:{plans:{}}},r=[],i,a=null,o,s,c;for(let e of t.entries()){let t=e[0],l=decodeURIComponent(e[1]);if(t===`button`)n.site.portal_button=JSON.parse(l);else if(t===`name`)n.site.portal_name=JSON.parse(l);else if(t===`signupGiftPromotion`){let e=YE(l);e!==void 0&&(n.site.portal_signup_gift_promotion=e)}else if(t===`accountGiftPromotion`){let e=YE(l);e!==void 0&&(n.site.portal_account_gift_promotion=e)}else if(t===`isFree`&&JSON.parse(l))r.push(`free`);else if(t===`isMonthly`&&JSON.parse(l))r.push(`monthly`);else if(t===`isYearly`&&JSON.parse(l))r.push(`yearly`);else if(t===`portalPrices`)i=l?l.split(`,`):[];else if(t===`portalProducts`)a=l?l.split(`,`):[];else if(t===`page`&&l)n.page=l;else if(t===`accentColor`&&(l===``||l))n.site.accent_color=l;else if(t===`buttonIcon`&&l)n.site.portal_button_icon=l;else if(t===`signupButtonText`)n.site.portal_button_signup_text=l||``;else if(t===`signupTermsHtml`)n.site.portal_signup_terms_html=l||``;else if(t===`signupCheckboxRequired`)n.site.portal_signup_checkbox_required=JSON.parse(l);else if(t===`buttonStyle`&&l)n.site.portal_button_style=l;else if(t===`monthlyPrice`&&!isNaN(Number(l)))n.site.plans.monthly=Number(l),o=Number(l);else if(t===`yearlyPrice`&&!isNaN(Number(l)))n.site.plans.yearly=Number(l),s=Number(l);else if(t===`currency`&&l){let e=l.toUpperCase();n.site.plans.currency=e,n.site.plans.currency_symbol=ju(e),c=e}else t===`disableBackground`?n.site.disableBackground=JSON.parse(l):t===`previewTheme`?n.site.preview_theme=l:t===`membersSignupAccess`&&l?n.site.members_signup_access=l:t===`portalDefaultPlan`&&l?n.site.portal_default_plan=l:t===`transistorPortalSettings`&&l&&(n.site.transistor_portal_settings=JSON.parse(l))}return n.site.portal_plans=r,n.site.portal_products=a,i?n.site.portal_plans=i:o&&s&&c&&(n.site.prices=[{id:`monthly`,stripe_price_id:`dummy_stripe_monthly`,stripe_product_id:`dummy_stripe_product`,active:1,nickname:`Monthly`,currency:c,amount:o,type:`recurring`,interval:`month`},{id:`yearly`,stripe_price_id:`dummy_stripe_yearly`,stripe_product_id:`dummy_stripe_product`,active:1,nickname:`Yearly`,currency:c,amount:s,type:`recurring`,interval:`year`}]),n}fetchNotificationData(){let{type:e,status:t,duration:n,autoHide:r,closeable:i}=nf({billingOnly:!0})||{};return[`stripe:billing-update`].includes(e)?t===`success`?{showPopup:!0,popupNotification:Y({type:e,status:t,duration:n,closeable:i,autoHide:r,state:this.state,message:t===`success`?`Billing info updated successfully`:``})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({token:e}){try{return{showPopup:!0,notification:null,page:`giftRedemption`,pageData:{token:e,gift:(await this.GhostApi.gift.fetchRedemptionData({token:e}))?.gifts?.[0]||null}}}catch(e){vl();let t=Iu({type:`giftRedemption:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:Yd(e)});return{showPopup:!1,pageData:null,notification:t,notificationSequence:t.count}}}async fetchLinkData(e,t){this.invalidateGiftRedemptionRequest();let n=new URLSearchParams(window.location.search);if(n.get(`stripe`)===`gift-purchase-success`){let e=n.get(`gift_token`),t=n.get(`gift_tier`),r=n.get(`gift_cadence`),i=Number(n.get(`gift_duration`)),a=n.get(`gift_delivery`),o=n.get(`gift_delivery_date`),s=/^\d{4}-\d{2}-\d{2}$/.test(o||``)?o:null,c=Number(n.get(`gift_scheduled_at`)),l=Number.isFinite(c)&&c>0?c:null;if(tf([`stripe`,`gift_token`,`gift_tier`,`gift_cadence`,`gift_duration`,`gift_delivery`,`gift_delivery_date`,`gift_scheduled_at`]),e)return Vw(),{showPopup:!0,page:`giftSuccess`,pageData:{token:e,tierId:t,cadence:r,duration:Cf.includes(i)?i:null,deliveryMethod:a===`email`?`email`:`link`,deliveryDate:s,scheduledAt:l}}}if(n.get(`action`)===`unsubscribe`)return n.get(`key`)&&n.get(`uuid`)?{showPopup:!0,page:`unsubscribe`,pageData:{uuid:n.get(`uuid`),key:n.get(`key`),newsletterUuid:n.get(`newsletter`),comments:n.get(`comments`),updatesAndAnnouncements:n.get(`updatesandannouncements`)}}:{showPopup:!0,page:`accountEmail`,pageData:{newsletterUuid:n.get(`newsletter`),action:`unsubscribe`,redirect:e.url+`#/portal/account/newsletters`}};if(Gl({site:e})&&n.get(`action`)===`signup`&&n.get(`success`)===`true`)return{showPopup:!0,page:`recommendations`,pageData:{signup:!0}};let[r,i]=window.location.hash.substr(1).split(`?`),a=new URLSearchParams(i??``),o=/^(?:(\w+?))?\/monthly$/,s=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,l=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,u=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,d=/^\/share\/?$/,f=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(r&&f.test(r)){let[,n,i]=r.match(f),o=parseInt(i);if(o===1||o===0)return t||a.get(`uuid`)&&a.get(`key`)?{showPopup:!0,page:`feedback`,pageData:{uuid:a.get(`uuid`),key:a.get(`key`),postId:n,score:o}}:{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/feedback/${n}/${o}/`}}}if(r&&l.test(r)){let[,t]=r.match(l),n=JE(t);if(!n)return{};xf(e.url);let i=this.startGiftRedemptionRequest(n),a=await this.fetchGiftRedemptionData({token:n});return this.isCurrentGiftRedemptionRequest(i)?a:XE}if(r&&d.test(r))return{showPopup:!0,page:`share`};if(r&&u.test(r)){let[,n]=r.match(u),{page:i,pageQuery:l,pageData:d}=this.getPageFromLinkPath(n,e)||{};if(!t&&i&&wT({page:i}))return{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/portal/${n}/`}};if(i===`gift`&&!Kl({site:e}))return vl(),{};i===`gift`&&xf(e.url);let f=[`accountPlan`,`accountProfile`].includes(i)?`accountHome`:null,p=!([`monthly`,`yearly`].includes(l)||o.test(l)||s.test(l)||c.test(l)),m=a.get(`redirect`),h=i===`signin`&&m?{...d||{},redirect:m}:d;return{showPopup:p,...i?{page:i}:{},...l?{pageQuery:l}:{},...h?{pageData:h}:{},...f?{lastPage:f}:{}}}return{}}fetchPreviewData(){let[,e]=window.location.hash.substr(1).split(`?`);if(nd([`preview`])){let t={};try{t=nd([`offerPreview`])?this.fetchOfferQueryStrData(e):this.fetchQueryStrData(e)}catch(e){return nr(e),{}}return{...t,showPopup:!0}}return{}}getColorOverride(){let e=document.querySelector(`script[data-ghost]`);return e&&e.dataset.accentColor?e.dataset.accentColor:!1}async fetchApiData(){let{siteUrl:e,customSiteUrl:t,apiUrl:n,apiKey:r}=this.props;try{this.GhostApi=this.props.api||nC({siteUrl:e,apiUrl:n,apiKey:r});let{site:t,member:i,offers:a}=await this.GhostApi.init(),o=this.getColorOverride();return o&&(t.accent_color=o),this.setupFirstPromoter({site:t,member:i}),this.setupSentry({site:t}),{site:t,member:i,offers:a}}catch(e){if(nd([`dev`,`test`],{customSiteUrl:t}))return{};throw e}}setupSentry({site:e}){if(nd([`test`]))return null;let{portal_sentry:t,portal_version:n,version:r}=e,i=`portal@2.72.30|ghost@${r}`;t&&t.dsn&&vo({dsn:t.dsn,environment:t.env||`development`,release:i,beforeSend:e=>Sl({event:e})?e:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:t}){if(nd([`test`]))return null;let n=Eu({site:e}),r=Au({site:e});if(r=r?.replace(/^(\S*\.)?(\S*\.\S*)$/i,`.$2`),n&&r){let e=document.createElement(`script`);e.type=`text/javascript`,e.async=!0,e.src=`https://cdn.firstpromoter.com/fprom.js`,e.onload=e.onreadystatechange=function(){let e=this.readyState;if(!e||e===`complete`||e===`loaded`)try{if(window.$FPROM.init(n,r),Yu({member:t})){let e=t.email,n=t.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:e,uid:n});else{let t=window._fprom||[];window._fprom=t,t.push([`event`,`signup`]),t.push([`email`,e]),t.push([`uid`,n])}}}catch{}};let i=document.getElementsByTagName(`script`)[0];i.parentNode.insertBefore(e,i)}}async dispatchAction(e,t){clearTimeout(this.timeoutId),this.setState({action:`${e}:running`,actionErrorMessage:null});try{let n=await HE({action:e,data:t,state:this.state,api:this.GhostApi});return this.setState(n),n&&n.action&&!n.action.includes(`:failed`)&&(this.timeoutId=setTimeout(()=>{this.setState({action:``})},2e3)),n}catch(n){if(console.error(`[Portal] Failed to dispatch action: ${e}`,n),t&&t.throwErrors)throw n;let r=Y({type:`${e}:failed`,autoHide:!0,closeable:!0,status:`error`,state:this.state,meta:{error:n}});this.setState({action:`${e}:failed`,actionErrorMessage:Kc(n,K(`An unexpected error occured. Please try again or <a>contact support</a> if the error persists.`)),popupNotification:r})}}async updateStateForPreviewLinks(){let{site:e,...t}=this.fetchPreviewData(),n=await this.fetchLinkData(this.state.site,this.state.member);if(n?.staleGiftRedemptionRequest)return;let{site:r,...i}=n,a=this.state.page===`gift`&&i.page!==`gift`;a&&Vw();let o=a&&!i.page,s={site:{...this.state.site,...r||{},...e||{},plans:{...this.state.site&&this.state.site.plans,...(r||{}).plans,...(e||{}).plans}},...i,...t,...o?{showPopup:!1,lastPage:null}:{}};this.handleSignupQuery({site:s.site,pageQuery:s.pageQuery}),this.setState(s)}async handleOfferQuery({site:e,offerId:t,member:n=this.state.member}){if(vl(),!(!Tl({member:n})||wl({member:n}))){let e=Iu({type:`offer:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:K(`You already have an active subscription.`)});await this.dispatchAction(`closePopup`),this.setState({notification:e,notificationSequence:e.count});return}try{let n=(await this.GhostApi.site.offer({offerId:t}))?.offers[0];if(!n||!n.tier||Vu({offer:n})||!Hu({site:e,offer:n}))return;this.dispatchAction(`openPopup`,{page:`offer`,pageData:n})}catch{}}handleSignupQuery({site:e,pageQuery:t,member:n}){let r=/^offers\/(\w+?)\/?$/,i=t;if(r.test(t||``)){let[,i]=t.match(r);this.handleOfferQuery({site:e,offerId:i,member:n});return}Ru({site:e,pageQuery:t})&&(i=Ru({site:e,pageQuery:t}));let a=Vl({site:e,priceId:i});if(t&&t!==`free`){vl();let t=a?.id||i;t!==`free`&&this.dispatchAction(`openPopup`,{page:`loading`});let{tierId:n,cadence:r}=bu({site:e,priceId:t});this.dispatchAction(`signup`,{plan:t,tierId:n,cadence:r})}}getPageFromLinkPath(e){let t=/^signup\/?(?:\/(\w+?))?\/?$/,n=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,r=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,i=/^offers\/(\w+?)\/?$/,a=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e===``)return{page:`default`};if(a.test(e)){let[,t]=e.match(a),n=JE(t);return n?{page:`giftRedemption`,pageData:{token:n}}:null}else if(i.test(e))return{pageQuery:e};else if(e===`signup`)return{page:`signup`};else if(n.test(e)){let[,t]=e.match(n);return{page:`signup`,pageQuery:`${t}/monthly`}}else if(r.test(e)){let[,t]=e.match(r);return{page:`signup`,pageQuery:`${t}/yearly`}}else if(t.test(e)){let[,n]=e.match(t);return{page:`signup`,pageQuery:n}}else if(e===`signup/free`)return{page:`signup`,pageQuery:`free`};else if(e===`signup/monthly`)return{page:`signup`,pageQuery:`monthly`};else if(e===`signup/yearly`)return{page:`signup`,pageQuery:`yearly`};else if(e===`signin`)return{page:`signin`};else if(e===`account`)return{page:`accountHome`};else if(e===`account/plans`)return{page:`accountPlan`};else if(e===`account/profile`)return{page:`accountProfile`};else if(e===`account/newsletters`)return{page:`accountEmail`};else if(e===`support`)return{page:`support`};else if(e===`support/success`)return{page:`supportSuccess`};else if(e===`support/error`)return{page:`supportError`};else if(e===`recommendations`)return{page:`recommendations`,pageData:{signup:!1}};else if(e===`gift`)return{page:`gift`,pageData:{giftStep:`plan`}};else if(e===`gift/delivery`)return{page:`gift`,pageData:{giftStep:`delivery`}};else if(e===`share`)return{page:`share`};else if(e===`account/newsletters/help`)return{page:`emailReceivingFAQ`,pageData:{direct:!0}};else if(e===`account/newsletters/disabled`)return{page:`emailSuppressionFAQ`,pageData:{direct:!0}};return{page:`default`}}getAccentColor(){let{accent_color:e}=this.state.site||{};return rS(e)}getRetentionPreviewMember({site:e,offers:t}){let n=(t||[]).find(e=>Vu({offer:e})),r=n?.tier?.id,i=r?lu({site:e,productId:r}):null,a=i?n.cadence===`year`?i.yearlyPrice:i.monthlyPrice:null,o=ZT.preview,s=o?.subscriptions?.[0];return!s||!i||!a?o:{...o,subscriptions:[{...s,plan:{...s.plan,amount:a.amount,interval:a.interval,currency:a.currency.toUpperCase()},price:{...s.price,price_id:a.id,amount:a.amount,interval:a.interval,currency:a.currency,product:{...s.price?.product,product_id:i.id}},tier:{id:i.id,name:i.name}}]}}getContextPage({site:e,page:t,member:n}){if(!t||t==="default"){let r=Ul({site:e})||!Wl({site:e})?`signin`:`signup`;t=n?`accountHome`:r}return CT({page:t})}getContextMember({site:e,page:t,member:n,offers:r,pageData:i,customSiteUrl:a}){return nd([`dev`,`preview`],{customSiteUrl:a})?wT({page:t})||TT({page:t})?nd([`dev`],{customSiteUrl:a})?n||ZT.free:nd([`preview`])?t===`accountPlan`&&i?.action===`cancel`?this.getRetentionPreviewMember({site:e,offers:r}):ZT.preview:ZT.paid:null:n}getContextFromState(){let{site:e,member:t,offers:n,action:r,actionErrorMessage:i,page:a,lastPage:o,showPopup:s,pageQuery:c,pageData:l,popupNotification:u,notification:d,customSiteUrl:f,dir:p,scrollbarWidth:m,otcRef:h,inboxLinks:g,customFields:_,fieldErrors:v}=this.state,y=this.getContextPage({site:e,page:a,member:t}),b=this.getContextMember({site:e,page:y,member:t,offers:n,pageData:l,customSiteUrl:f});return{api:this.GhostApi,site:e,offers:n,action:r,actionErrorMessage:i,brandColor:this.getAccentColor(),page:y,pageQuery:c,pageData:l,member:b,customFields:_,fieldErrors:v,lastPage:o,showPopup:s,popupNotification:u,notification:d,customSiteUrl:f,dir:p,scrollbarWidth:m,otcRef:h,inboxLinks:g,doAction:(e,t)=>this.dispatchAction(e,t)}}getRecommendationButtons(){return document.querySelectorAll(`[data-recommendation]`)||[]}setupRecommendationButtons(){let e=e=>{let t=e.currentTarget.dataset.recommendation;t?this.dispatchAction(`trackRecommendationClicked`,{recommendationId:t}).catch(console.error):console.warn(`[Portal] Invalid usage of data-recommendation attribute`)},t=this.getRecommendationButtons();for(let n of t)n.addEventListener(`click`,e,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll(`a[href*="#/portal"], a[href*="#/share"]`).forEach($T)}render(){return this.state.initStatus===`success`?(0,q.jsx)(QE,{site:this.state.site,children:(0,q.jsxs)(J.Provider,{value:this.getContextFromState(),children:[(0,q.jsx)(jT,{}),(0,q.jsx)(od,{}),(0,q.jsx)(sf,{})]})}):null}},eD=`ghost-portal-root`;function tD(){let e=document.createElement(`div`);e.id=eD,e.setAttribute(`data-testid`,`portal-root`),document.body.appendChild(e)}function nD(){let e=document.querySelector(`script[data-ghost]`);if(e){let t=e.dataset.i18n===`true`;return{siteUrl:e.dataset.ghost,apiKey:e.dataset.key,apiUrl:e.dataset.api,siteI18nEnabled:t,locale:e.dataset.locale}}return{}}function rD(){let e=new URL(window.location.href);e.searchParams.get(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState({},document.title,e.href))}function iD(){let[,e]=window.location.hash.substring(1).split(`?`);new URLSearchParams(e).get(`previewTheme`)===`dark`&&(document.documentElement.dataset.portalPreviewTheme=`dark`)}function aD(){let{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i}=nD(),a=e||window.location.origin;iD(),tD(),rD(),v.render((0,q.jsx)(_.default.StrictMode,{children:(0,q.jsx)($E,{siteUrl:a,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i})}),document.getElementById(eD))}aD()});
|
|
6138
|
+
`),r=[];return e&&r.push(`subject=${encodeURIComponent(e)}`),n&&r.push(`body=${encodeURIComponent(n)}`),`mailto:${r.length?`?${r.join(`&`)}`:``}`},fT=({shareTitle:e,shareUrl:t})=>uT(`https://www.linkedin.com/shareArticle`,{mini:`true`,url:t,title:e}),pT=()=>{let e=lT(),t=e.document,n=e.location,r=(e,n=`content`)=>t.querySelector(e)?.[n]||``,i=r(`link[rel="canonical"]`,`href`)||n.origin+n.pathname+n.search,a=r(`meta[property="og:title"]`)||t.title||``,o=r(`meta[property="og:description"]`)||r(`meta[name="description"]`)||``,s=r(`meta[property="og:image"]`)||r(`meta[name="twitter:image"]`)||``,c=r(`link[rel="icon"]`,`href`)||r(`link[rel="shortcut icon"]`,`href`)||r(`link[rel="apple-touch-icon"]`,`href`),l=r(`meta[name="author"]`),u=(l&&!/^https?:\/\//i.test(l)?l:``)||r(`meta[name="twitter:creator"]`)||``,d=r(`meta[property="og:site_name"]`)||r(`meta[name="application-name"]`)||``;if(!d)try{d=new URL(i).hostname.replace(/^www\./,``)}catch{d=``}let f=[a,i].filter(Boolean).join(` `).trim(),p={twitter:uT(`https://twitter.com/intent/tweet`,{url:i,text:a}),facebook:uT(`https://www.facebook.com/sharer/sharer.php`,{u:i}),email:dT({shareTitle:a,shareUrl:i}),threads:uT(`https://www.threads.net/intent/post`,{text:f}),linkedin:fT({shareTitle:a,shareUrl:i}),bluesky:uT(`https://bsky.app/intent/compose`,{text:f})};return{shareUrl:i,shareTitle:a,shareExcerpt:o,shareImage:s,shareFavicon:c,shareSiteName:d,shareAuthor:u,socialLinks:p}},mT=()=>{let[e]=(0,_.useState)(pT);return e},hT=e=>(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -3.268 64 68.414`,width:2232,height:2500,...e,children:(0,q.jsx)(`path`,{fill:`#0085ff`,d:`M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z`})}),gT=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-ellipsis-icon lucide-ellipsis`,...e,children:[(0,q.jsx)(`circle`,{cx:12,cy:12,r:1}),(0,q.jsx)(`circle`,{cx:19,cy:12,r:1}),(0,q.jsx)(`circle`,{cx:5,cy:12,r:1})]}),_T=e=>(0,q.jsxs)(`svg`,{id:`svg9`,width:666.66669,height:666.66718,viewBox:`0 0 666.66668 666.66717`,xmlns:`http://www.w3.org/2000/svg`,"xmlns:svg":`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`defs`,{id:`defs13`,children:(0,q.jsx)(`clipPath`,{clipPathUnits:`userSpaceOnUse`,id:`clipPath25`,children:(0,q.jsx)(`path`,{d:`M 0,700 H 700 V 0 H 0 Z`,id:`path23`})})}),(0,q.jsx)(`g`,{id:`g17`,transform:`matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)`,children:(0,q.jsx)(`g`,{id:`g19`,children:(0,q.jsxs)(`g`,{id:`g21`,clipPath:`url(#clipPath25)`,children:[(0,q.jsx)(`g`,{id:`g27`,transform:`translate(600,350)`,children:(0,q.jsx)(`path`,{d:`m 0,0 c 0,138.071 -111.929,250 -250,250 -138.071,0 -250,-111.929 -250,-250 0,-117.245 80.715,-215.622 189.606,-242.638 v 166.242 h -51.552 V 0 h 51.552 v 32.919 c 0,85.092 38.508,124.532 122.048,124.532 15.838,0 43.167,-3.105 54.347,-6.211 V 81.986 c -5.901,0.621 -16.149,0.932 -28.882,0.932 -40.993,0 -56.832,-15.528 -56.832,-55.9 V 0 h 81.659 l -14.028,-76.396 h -67.631 V -248.169 C -95.927,-233.218 0,-127.818 0,0`,style:{fill:`#0866ff`,fillOpacity:1,fillRule:`nonzero`,stroke:`none`},id:`path29`})}),(0,q.jsx)(`g`,{id:`g31`,transform:`translate(447.9175,273.6036)`,children:(0,q.jsx)(`path`,{d:`M 0,0 14.029,76.396 H -67.63 v 27.019 c 0,40.372 15.838,55.899 56.831,55.899 12.733,0 22.981,-0.31 28.882,-0.931 v 69.253 c -11.18,3.106 -38.509,6.212 -54.347,6.212 -83.539,0 -122.048,-39.441 -122.048,-124.533 V 76.396 h -51.552 V 0 h 51.552 v -166.242 c 19.343,-4.798 39.568,-7.362 60.394,-7.362 10.254,0 20.358,0.632 30.288,1.831 L -67.63,0 Z`,style:{fill:`#ffffff`,fillOpacity:1,fillRule:`nonzero`,stroke:`none`},id:`path33`})})]})})})]}),vT=e=>(0,q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`lucide lucide-link-icon lucide-link`,...e,children:[(0,q.jsx)(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),(0,q.jsx)(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})]}),yT=e=>(0,q.jsxs)(`svg`,{viewBox:`0 5 2490 2490.0000000000005`,xmlns:`http://www.w3.org/2000/svg`,width:2500,height:2495,...e,children:[(0,q.jsx)(`path`,{d:`M185.2 313.1H2252V2291H185.2z`,fill:`#fff`}),(0,q.jsx)(`path`,{d:`M0 183.4C0 84.9 82.4 5 184 5h2122c101.6 0 184 79.9 184 178.4v2133.3c0 98.5-82.4 178.3-184 178.3H184c-101.6 0-184-79.8-184-178.3z`,fill:`#0a66c2`}),(0,q.jsx)(`path`,{d:`M756.7 2088.8v-1121H384.1v1121zm-186.2-1274c129.9 0 210.8-86.1 210.8-193.7-2.4-110-80.9-193.7-208.3-193.7-127.5 0-210.8 83.7-210.8 193.7 0 107.6 80.8 193.7 205.9 193.7zm392.4 1274h372.6v-626c0-33.5 2.4-67 12.3-90.9 26.9-67 88.2-136.3 191.2-136.3 134.8 0 188.7 102.8 188.7 253.5v599.6h372.6V1446c0-344.3-183.8-504.5-428.9-504.5-201 0-289.2 112.3-338.3 188.8h2.5V967.8H962.9c4.9 105.2 0 1121 0 1121z`,fill:`#fff`})]}),bT=e=>(0,q.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`g`,{clipPath:`url(#clip0_351_18008)`,children:(0,q.jsx)(`path`,{d:`M13.0332 8.37917C12.96 8.34407 12.8856 8.3103 12.8103 8.27795C12.6791 5.86015 11.3579 4.47596 9.1396 4.4618C9.12955 4.46173 9.11955 4.46173 9.1095 4.46173C7.78265 4.46173 6.67913 5.0281 5.99992 6.05871L7.21993 6.89561C7.72733 6.12579 8.52364 5.96167 9.11008 5.96167C9.11686 5.96167 9.12366 5.96168 9.13036 5.96174C9.86078 5.96639 10.4119 6.17876 10.7687 6.59291C11.0283 6.89442 11.2019 7.31107 11.2879 7.8369C10.6403 7.72683 9.93993 7.69299 9.19122 7.73592C7.08214 7.8574 5.72624 9.08747 5.81731 10.7967C5.86352 11.6637 6.29544 12.4096 7.03346 12.8968C7.65745 13.3087 8.46111 13.5101 9.29635 13.4645C10.3994 13.4041 11.2647 12.9832 11.8684 12.2137C12.3268 11.6293 12.6168 10.872 12.7448 9.91782C13.2705 10.2351 13.6601 10.6525 13.8753 11.1544C14.2411 12.0075 14.2624 13.4094 13.1186 14.5523C12.1164 15.5535 10.9117 15.9866 9.09104 16C7.07147 15.9851 5.54409 15.3374 4.55103 14.0749C3.62111 12.8928 3.14053 11.1854 3.1226 9C3.14053 6.8146 3.62111 5.10714 4.55103 3.92503C5.54409 2.66262 7.07144 2.01495 9.09101 1.99994C11.1252 2.01506 12.6792 2.66585 13.7103 3.93435C14.2159 4.55641 14.597 5.3387 14.8483 6.25081L16.278 5.86936C15.9734 4.74665 15.4942 3.7792 14.842 2.97686C13.5201 1.35059 11.5869 0.517279 9.096 0.5H9.08603C6.60019 0.517219 4.68862 1.3537 3.40443 2.98619C2.26168 4.4389 1.67221 6.46024 1.65241 8.99402L1.65234 9L1.65241 9.00598C1.67221 11.5397 2.26168 13.5611 3.40443 15.0138C4.68862 16.6463 6.60019 17.4828 9.08603 17.5H9.096C11.306 17.4847 12.8638 16.9061 14.1472 15.6239C15.8262 13.9465 15.7756 11.8439 15.2222 10.5531C14.8252 9.62749 14.0683 8.8757 13.0332 8.37917ZM9.21739 11.9668C8.29301 12.0188 7.33268 11.6039 7.28533 10.7152C7.25023 10.0563 7.75426 9.32105 9.27412 9.23347C9.44817 9.22343 9.61897 9.21852 9.78676 9.21852C10.3388 9.21852 10.8553 9.27215 11.3248 9.3748C11.1497 11.562 10.1224 11.9171 9.21739 11.9668Z`,fill:`black`})}),(0,q.jsx)(`defs`,{children:(0,q.jsx)(`clipPath`,{id:`clip0_351_18008`,children:(0,q.jsx)(`rect`,{width:17,height:17,fill:`white`,transform:`translate(0.5 0.5)`})})})]}),xT=e=>(0,q.jsx)(`svg`,{viewBox:`0 0 1200 1226.37`,xmlns:`http://www.w3.org/2000/svg`,width:2446,height:2500,...e,children:(0,q.jsx)(`path`,{d:`M714.163 519.284L1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284zM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854z`})}),ST={signin:GC,signup:oS,accountHome:pw,accountPlan:eg,accountProfile:mw,accountEmail:Cw,signupNewsletter:bb,unsubscribe:Ow,magiclink:ES,loading:iC,offer:MS,feedback:dC,emailSuppressed:kw,emailSuppressionFAQ:Aw,emailReceivingFAQ:jw,support:Mw,supportSuccess:hC,supportError:OC,recommendations:IC,gift:cT,giftRedemption:vC,giftSuccess:TC,share:()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(),a=(0,_.useRef)(null),{shareUrl:o,shareTitle:s,shareExcerpt:c,shareImage:l,shareFavicon:u,shareSiteName:d,shareAuthor:f,socialLinks:p}=mT();(0,_.useEffect)(()=>()=>{clearTimeout(i.current)},[]),(0,_.useEffect)(()=>{if(!n)return;let e=a.current?.ownerDocument||document,t=e=>{a.current&&!a.current.contains(e.target)&&(e.stopPropagation(),e.preventDefault(),r(!1))},i=e=>{e.key===`Escape`&&!e.isComposing&&(e.preventDefault(),r(!1))};return e.addEventListener(`click`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`click`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[n]);let m=async()=>{await bC(o)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},h=()=>{r(e=>!e)},g=()=>{r(!1)};return(0,q.jsxs)(`div`,{className:`gh-portal-content gh-portal-share`,children:[(0,q.jsx)(vf,{}),(0,q.jsx)(`div`,{className:`gh-portal-share-header`,children:(0,q.jsx)(`h1`,{className:`gh-portal-main-title`,children:K(`Share`)})}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview`,children:[l&&(0,q.jsx)(`img`,{className:`gh-portal-share-preview-image`,src:l,alt:``,"data-testid":`share-preview-image`}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-content`,children:[s&&(0,q.jsx)(`h2`,{className:`gh-portal-share-preview-title`,children:s}),c&&(0,q.jsx)(`p`,{className:`gh-portal-share-preview-excerpt`,children:c}),(u||d||f)&&(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-footer`,children:[u&&(0,q.jsx)(`img`,{className:`gh-portal-share-preview-favicon`,src:u,alt:``,"data-testid":`share-preview-favicon`}),(0,q.jsxs)(`div`,{className:`gh-portal-share-preview-meta`,children:[d&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-site`,children:d}),d&&f&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-separator`,"aria-hidden":`true`,children:`|`}),f&&(0,q.jsx)(`span`,{className:`gh-portal-share-preview-author`,children:f})]})]})]})]}),(0,q.jsxs)(`div`,{className:`gh-portal-share-actions`,children:[(0,q.jsxs)(`button`,{className:`gh-portal-btn gh-portal-share-action copy`,type:`button`,onClick:m,"aria-label":K(e?`Copied`:`Copy link`),title:K(e?`Copied`:`Copy link`),children:[e?(0,q.jsx)(`span`,{className:`gh-portal-share-icon copied`,"aria-hidden":`true`,children:(0,q.jsx)(_h,{})}):(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(vT,{})}),(0,q.jsx)(`span`,{className:`gh-portal-share-label`,children:K(e?`Copied`:`Copy link`)})]}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action twitter`,href:p.twitter,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`X (Twitter)`),title:K(`X (Twitter)`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon x`,"aria-hidden":`true`,children:(0,q.jsx)(xT,{})})}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action linkedin`,href:p.linkedin,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`LinkedIn`),title:K(`LinkedIn`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(yT,{})})}),(0,q.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action email`,href:p.email,target:`_blank`,rel:`noopener noreferrer`,"aria-label":K(`Email`),title:K(`Email`),children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(lS,{})})}),(0,q.jsxs)(`div`,{className:`gh-portal-share-more`,ref:a,children:[(0,q.jsx)(`button`,{className:`gh-portal-btn gh-portal-share-action more`,type:`button`,onClick:h,"aria-label":K(`More options`),title:K(`More options`),"aria-haspopup":`menu`,"aria-expanded":n,children:(0,q.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,q.jsx)(gT,{})})}),n&&(0,q.jsxs)(`div`,{className:`gh-portal-share-more-menu`,role:`menu`,"aria-label":K(`More options`),children:[(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.facebook,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(_T,{})}),(0,q.jsx)(`span`,{children:K(`Facebook`)})]}),(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.threads,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(bT,{})}),(0,q.jsx)(`span`,{children:K(`Threads`)})]}),(0,q.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.bluesky,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,q.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,q.jsx)(hT,{})}),(0,q.jsx)(`span`,{children:K(`Bluesky`)})]})]})]})]})]})}},CT=function(){return ST},wT=function({page:e}){return Object.keys(ST).includes(e)?e:`signup`},TT=function({page:e}){return e.includes(`account`)},ET=function({page:e}){return e.includes(`offer`)},DT=e=>(0,q.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z`,fill:`#15171A`})}),OT=class extends _.Component{static contextType=J;render(){return(0,q.jsxs)(`a`,{href:`https://ghost.org`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,q.jsx)(DT,{}),`Powered by Ghost`]})}},kT=()=>({modalContainer:{zIndex:`3999999`,position:`fixed`,left:`0`,top:`0`,width:`100%`,height:`100%`,overflow:`hidden`},frame:{common:{margin:`auto`,position:`relative`,padding:`0`,outline:`0`,width:`100%`,opacity:`1`,overflow:`hidden`,height:`100%`}},page:{links:{width:`600px`}}});function AT({message:e}){return xl()?(0,q.jsx)(`div`,{className:`gh-portal-cookiebanner`,children:e}):null}var jT=class extends _.Component{static contextType=J;componentDidMount(){this.node&&!nd([`preview`])&&!this.props.isMobile&&(this.node.focus(),this.keyDownHandler=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.isComposing&&this.dismissPopup(e)},this.node.ownerDocument.removeEventListener(`keydown`,this.keyDownHandler),this.node.ownerDocument.addEventListener(`keydown`,this.keyDownHandler)),this.sendContainerHeightChangeEvent()}dismissPopup(e){let t=e.target&&e.target.tagName;(!(t===`INPUT`||t===`TEXTAREA`)||!e?.target?.value)&&this.context.doAction(`closePopup`)}sendContainerHeightChangeEvent(){this.node&&nd([`preview`])&&this.node?.clientHeight!==this.lastContainerHeight&&(this.lastContainerHeight=this.node?.clientHeight,window.document.body.style.overflow=`hidden`,window.document.body.style[`scrollbar-width`]=`none`,window.parent.postMessage({type:`portal-preview-updated`,payload:{height:this.lastContainerHeight}},`*`))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener(`keydown`,this.keyDownHandler)}handlePopupClose(e){let{page:t,otcRef:n}=this.context;nd([`preview`])||n&&t===`magiclink`||t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderActivePage(){let{page:e,site:t}=this.context;wT({page:e});let n=CT({site:t})[e];return(0,q.jsx)(n,{})}renderPopupNotification(){let{popupNotification:e}=this.context;return!e||!e.type?null:(0,q.jsx)(AS,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:`portal-preview-ready`,payload:{}},`*`)}render(){let{page:e,pageQuery:t,site:n,customSiteUrl:r,lastPage:i}=this.context,a=ru({site:n,pageQuery:t}).length;wT({page:e});let o={...kT({page:e}).page[e]},s=`regular`,c=``,l=e;switch(e){case`signup`:c=`Cookies must be enabled in your browser to sign up.`;break;case`signin`:c=`Cookies must be enabled in your browser to sign in.`;break;case`accountHome`:l=`account-home`;break;case`accountProfile`:l=`account-profile`;break;case`accountPlan`:l=`account-plan`;break;default:c=`Cookies must be enabled in your browser.`,l=e;break}a>1&&!Ul({site:n})&&Wl({site:n,pageQuery:t})&&e===`signup`&&(l+=` full-size`,s=`full`),(e===`gift`||e===`giftSuccess`||e===`giftRedemption`)&&(l+=` full-size`,s=`full`),e===`magiclink`&&i===`gift`&&(l+=` full-size giftRedemption`,s=`full`);let u=du({site:n});(u&&a>2||!u&&a>1)&&e===`accountPlan`&&(l+=` full-size`,s=`full`),(e===`emailSuppressionFAQ`||e===`emailReceivingFAQ`)&&(l+=` large-size`);let d=`gh-portal-popup-container`;nd([`preview`])&&(l+=` preview`),nd([`preview`],{customSiteUrl:r})&&!n.disableBackground&&(d+=` preview`),nd([`dev`])&&(d+=` dev`);let f=`${d} ${l}`,p=e===`gift`||e===`giftSuccess`||e===`giftRedemption`||e===`magiclink`&&i===`gift`;return this.sendPortalPreviewReadyEvent(),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`gh-portal-popup-wrapper `+l,onClick:e=>this.handlePopupClose(e),children:[this.renderPopupNotification(),(0,q.jsxs)(`div`,{className:f,style:o,ref:e=>this.node=e,tabIndex:-1,children:[(0,q.jsx)(AT,{message:c}),this.renderActivePage(),s===`full`&&!p?(0,q.jsx)(`div`,{className:`gh-portal-powered inside `+(nd([`preview`])?`hidden `:``)+l,children:(0,q.jsx)(OT,{})}):``]})]}),e!==`share`&&!p&&(0,q.jsx)(`div`,{className:`gh-portal-powered outside `+(nd([`preview`])?`hidden `:``)+l,children:(0,q.jsx)(OT,{})})]})}},MT=class extends _.Component{static contextType=J;constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){let t=CT({site:this.context.site})[e];return(0,q.jsx)(t,{})}onHeightChange(e){this.setState({height:e})}handlePopupClose(e){e.preventDefault();let{page:t}=this.context;t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderFrameStyles(){let{site:e,brandColor:t}=this.context,n=WC({site:e});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`style`,{dangerouslySetInnerHTML:{__html:t?`:root { --brandcolor: ${t} }`+n:n}}),(0,q.jsx)(`meta`,{name:`viewport`,content:`width=device-width, initial-scale=1, maximum-scale=1`})]})}renderFrameContainer(){let{member:e,site:t,customSiteUrl:n}=this.context,r=kT({member:e}),i=window.innerWidth<480,a={...r.frame.common},o=`gh-portal-popup-background`;return nd([`preview`])&&(r.modalContainer.zIndex=`3999997`),nd([`preview`],{customSiteUrl:n})&&!t.disableBackground&&(o+=` preview`,t.preview_theme===`dark`&&(o+=` preview-dark`)),nd([`dev`])&&(o+=` dev`),(0,q.jsx)(`div`,{style:r.modalContainer,children:(0,q.jsxs)(Jc,{style:a,title:`portal-popup`,head:this.renderFrameStyles(),dataTestId:`portal-popup-frame`,dataDir:this.context.dir,children:[(0,q.jsx)(`div`,{className:o,onClick:e=>this.handlePopupClose(e)}),(0,q.jsx)(jT,{isMobile:i})]})})}render(){let{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};FT({products:BT({numOfProducts:1})});function NT(){return(new Date().getTime()/1e3|0).toString(16)+`xxxxxxxxxxxxxxxx`.replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function PT(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function FT({title:e=`The Blueprint`,description:t=`Thoughts, stories and ideas.`,logo:n=`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,icon:r=`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,url:i=`https://portal.localhost`,plans:a={monthly:5e3,yearly:15e4,currency:`USD`},products:o=BT({numOfProducts:1}),portalProducts:s=o.map(e=>e.id),accentColor:c=`#45C32E`,portalPlans:l=[`free`,`monthly`,`yearly`],portalDefaultPlan:u=``,membersSignupAccess:d=`all`,freePriceName:f=`Free`,freePriceDescription:p=`Free preview`,paidMembersEnabled:m=!0,portalButton:h=!0,portalName:g=!0,portalButtonIcon:_=`icon-1`,portalButtonSignupText:v=`Subscribe now`,portalButtonStyle:y=`icon-and-text`,membersSupportAddress:b=`support@example.com`,editorDefaultEmailRecipients:x=`visibility`,newsletters:S=[],posts:C=RT(),commentsEnabled:w,recommendations:T=[],recommendationsEnabled:E,labs:D={}}={}){return{title:e,description:t,logo:n,icon:r,accent_color:c,url:i,plans:a,products:o,portal_products:s,members_signup_access:d,free_price_name:f,free_price_description:p,paid_members_enabled:m,portal_button:h,portal_name:g,portal_plans:l,...u?{portal_default_plan:u}:{},portal_button_icon:_,portal_button_signup_text:v,portal_button_style:y,members_support_address:b,comments_enabled:w!==`off`,newsletters:S,recommendations:T,recommendations_enabled:!!E,labs:D,editor_default_email_recipients:x,posts:C}}function IT({name:e=`Black Friday`,code:t=`black-friday`,displayTitle:n=`Black Friday Sale!`,displayDescription:r=`Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.`,type:i=`percent`,cadence:a=`month`,amount:o=50,duration:s=`repeating`,durationInMonths:c=null,currencyRestriction:l=!1,currency:u=null,status:d=`active`,tierId:f=``,tierName:p=`Basic`,redemptionType:m=`signup`}={}){return{id:`offer_${NT()}`,name:e,code:t,display_title:n,display_description:r,type:i,cadence:a,amount:o,duration:s,duration_in_months:c,currency_restriction:l,currency:u,status:d,tier:{id:`${f}`,name:p},redemption_type:m}}function LT({name:e=`Jamie Larson`,email:t=`jamie@example.com`,firstname:n=`Jamie`,subscriptions:r=[],paid:i=!1,status:a,avatarImage:o=``,subscribed:s=!0,email_suppression:c={suppressed:!1,info:null},newsletters:l=[]}={}){let u={uuid:PT(),email:t,name:e,firstname:n,paid:i,subscribed:s,avatar_image:o,subscriptions:r,email_suppression:c,newsletters:l};return a===void 0?i?u.status=`paid`:u.status=`free`:u.status=a,u}function RT({numOfPosts:e=3}={}){let t=[];for(let n=0;n<e;n++)t.push(zT({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function zT({id:e=`post_${NT()}`,title:t=`Post`,excerpt:n=`Post excerpt`,slug:r=`post`,featured:i=!1}={}){return{id:e,title:t,excerpt:n,slug:r,featured:i}}function BT({numOfProducts:e=3}={}){let t=[VT({name:`Bronze`,description:`Access to all members articles`,monthlyPrice:GT({interval:`month`,amount:700}),yearlyPrice:GT({interval:`year`,amount:7e3}),numOfBenefits:2}),VT({name:`Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:GT({interval:`month`,amount:1200}),yearlyPrice:GT({interval:`year`,amount:12e3}),numOfBenefits:3}),VT({name:`Friends of the Blueprint`,description:`Get access to everything and lock in early adopter pricing for life + listen to my podcast`,monthlyPrice:GT({interval:`month`,amount:18e3}),yearlyPrice:GT({interval:`year`,amount:17e3}),numOfBenefits:4})].slice(0,e),n=HT({});return[...t,n]}function VT({type:e=`paid`,name:t=`Basic`,description:n=``,id:r=`product_${NT()}`,monthlyPrice:i=GT(),yearlyPrice:a=GT({interval:`year`}),numOfBenefits:o=2,trialDays:s=null}){return{id:r,name:t,description:n,monthlyPrice:e===`free`?null:i,yearlyPrice:e===`free`?null:a,type:e,benefits:UT({numOfBenefits:o}),trial_days:s}}function HT({name:e=`Free tier`,description:t=`Free tier description`,id:n=`product_${NT()}`,numOfBenefits:r=2}){return{id:n,name:e,type:`free`,description:t,benefits:UT({numOfBenefits:r})}}function UT({numOfBenefits:e}){let t=NT();return[WT({name:`Limited early adopter pricing #${t.substring(0,6)}`}),WT({name:`Latest gear reviews #${t.substring(6,12)}`}),WT({name:`Weekly email newsletter #${t.substring(12,18)}`}),WT({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function WT({id:e=`benefit_${NT()}`,name:t=`Benefit`}){return{id:e,name:t}}function GT({interval:e=`month`,amount:t=e===`month`?500:5e3,nickname:n=e===`month`?`Monthly`:`Yearly`,description:r=null,currency:i=`usd`,active:a=!0,id:o=`price_${NT()}`}={}){return{id:o,active:a,nickname:n,currency:i,amount:t,interval:e,description:r,stripe_price_id:`price_${NT()}`,stripe_product_id:`prod_${NT()}`,type:`recurring`}}function KT({id:e=`sub_${NT()}`,status:t=`active`,currency:n=`USD`,interval:r=`year`,amount:i=r===`month`?500:5e3,nickname:a=r===`month`?`Monthly`:`Yearly`,cardLast4:o=`4242`,offer:s=JT,priceId:c=`price_${NT()}`,startDate:l=`2021-10-05T03:18:30.000Z`,currentPeriodEnd:u=`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:d=!1,trialEndAt:f=null,nextPayment:p=null,tier:m=null}={}){return{id:e,customer:{id:`cus_${NT()}`,name:`Jamie`,email:`jamie@example.com`},plan:{id:`price_${NT()}`,nickname:a,amount:i,interval:r,currency:n},offer:s,status:t,start_date:l,default_payment_card_last4:o,cancel_at_period_end:d,cancellation_reason:null,current_period_end:u,trial_end_at:f,next_payment:p,tier:m,price:{id:`stripe_price_${NT()}`,price_id:c,nickname:a,amount:i,interval:r,type:`recurring`,currency:n,product:{id:`stripe_prod_${NT()}`,product_id:`prod_${NT()}`}}}}function qT(){let e=BT({numOfProducts:1});return FT({products:e,portalPlans:[`free`,`monthly`,`yearly`],portalProducts:e.map(e=>e.id)})}qT();var JT=IT({tierId:FT({products:[VT({numOfBenefits:2,type:`free`})]}).products[0]?.id});LT({status:`free`}),LT({status:`paid`,paid:!0,subscriptions:[KT()]}),LT({status:`comped`,paid:!0,subscriptions:[]}),LT({status:`comped`,paid:!0,subscriptions:[KT({amount:0})]}),LT({status:`paid`,paid:!0,subscriptions:[KT({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:`2021-06-05T11:42:40.000Z`})]}),qT();var YT=[HT({name:`Free`,description:`Free tier description which is actually a pretty long description`,numOfBenefits:2}),VT({name:`The Blueprint`,description:``,monthlyPrice:GT({interval:`month`,amount:500}),yearlyPrice:GT({interval:`year`,amount:5e3}),numOfBenefits:3}),VT({name:`Friends of the Blueprint Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:GT({interval:`month`,amount:1200}),yearlyPrice:GT({interval:`year`,amount:11e3}),numOfBenefits:4})],XT=FT({title:`The Blueprint`,description:`Thoughts, stories and ideas.`,logo:`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,icon:`https://static.ghost.org/v4.0.0/images/ghost-orb-1.png`,accentColor:`#45C32E`,url:`https://portal.localhost`,plans:{monthly:5e3,yearly:15e4,currency:`USD`},products:YT,portalProducts:YT.map(e=>e.id),allowSelfSignup:!0,membersSignupAccess:`all`,freePriceName:`Free`,freePriceDescription:`Free preview`,paidMembersEnabled:!0,portalButton:!0,portalName:!0,portalPlans:[`free`,`monthly`,`yearly`],portalButtonIcon:`icon-1`,portalButtonSignupText:`Subscribe now`,portalButtonStyle:`icon-and-text`,membersSupportAddress:`support@example.com`,commentsEnabled:!0,newsletters:[{id:`weekly`,name:`Weekly Rundown`,description:`Best of last week`,subscribe_on_signup:!0,paid:!0},{id:`daily`,name:`Daily Brief`,description:`One email every day`,subscribe_on_signup:!1,paid:!1}],posts:[{id:`post_66aacfe061c94e10eb6e4fc1`,title:`Post 1`,excerpt:`Post excerpt`,slug:`post-1`,featured:!1},{id:`post_66aacfe04f14b8dbb56c5721`,title:`Post 2`,excerpt:`Post excerpt`,slug:`post-2`,featured:!1},{id:`post_66aacfe03d609460819af18c`,title:`Post 3`,excerpt:`Post excerpt`,slug:`post-3`,featured:!1}]}),ZT=IT({tierId:XT.products[1]?.id}),QT={free:LT({name:`Jamie Larson`,email:`jamie@example.com`,firstname:`Jamie`,subscriptions:[],paid:!1,status:`free`,avatarImage:``,subscribed:!0}),paid:LT({paid:!0,status:`paid`,subscriptions:[KT({status:`active`,currency:`USD`,interval:`year`,amount:5e3,cardLast4:`4242`,startDate:`2021-10-05T03:18:30.000Z`,currentPeriodEnd:`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:!1})]}),complimentary:LT({paid:!0,status:`comped`,subscriptions:[]}),complimentaryWithSubscription:LT({paid:!0,status:`comped`,subscriptions:[KT({amount:0})]}),preview:LT({paid:!0,status:`paid`,subscriptions:[KT({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:new Date().toISOString()})]})};function $T(){if(!YT||!YT[1])return null;let e=XT?.products?.[1].monthlyPrice;return{site:XT,member:LT({paid:!0,status:`paid`,subscriptions:[KT({offer:null,priceId:e?.id,status:`active`,currency:e?.currency,interval:e?.interval,amount:e?.amount,cardLast4:`4242`,startDate:`2021-10-05T03:18:30.000Z`,currentPeriodEnd:`2022-10-05T03:18:30.000Z`,cancelAtPeriodEnd:!1})]})}}function eE(e){let t=e.getAttribute(`href`),n;try{n=new URL(t,window.location.origin)}catch{return}let r=[`#/portal`,`#/share`],i=r.some(e=>n.hash.startsWith(e)),a=r.some(e=>t.startsWith(e));!n.hash||!i||a||n.origin===window.location.origin&&e.setAttribute(`href`,n.hash)}var tE=`CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION`;function nE({data:e,state:t}){return{page:e.page,popupNotification:null,fieldErrors:{},lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function rE({state:e}){return{showPopup:!e.showPopup}}function iE({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function aE({state:e}){return e.page===`gift`&&Hw(),e.lastPage?{page:e.lastPage,fieldErrors:{}}:oE({state:e})}function oE({state:e}){let t=!1;e.page===`gift`&&(Hw(),t=iT()),t||vl();let n={...e.pageData||{}};return delete n.redirect,{showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,fieldErrors:{},page:e.page===`magiclink`?``:e.page,pageData:n}}function sE({data:e,state:t}){let{action:n=`openNotification`,status:r=`success`,autoHide:i=!0,closeable:a=!0,duration:o=2600,message:s=``}=e||{},c=Iu({type:n,status:r,autoHide:i,closeable:a,duration:o,state:t,message:s});return{notification:c,notificationSequence:c.count}}function cE(){return{notification:null}}async function lE({api:e,state:t}){try{return await e.member.signout(),{action:`signout:success`}}catch{return{action:`signout:failed`,popupNotification:Y({type:`signout:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to log out, please try again`)})}}}async function uE({data:e,api:t,state:n}){try{let r=await t.member.getIntegrityToken(),i={...e,emailType:`signin`,integrityToken:r,includeOTC:!0},{otc_ref:a,inboxLinks:o}=await t.member.sendMagicLink(i);return{page:`magiclink`,lastPage:`signin`,...a?{otcRef:a}:{},inboxLinks:o,pageData:{...n.pageData||{},email:(e?.email||``).trim()}}}catch(e){return{action:`signin:failed`,popupNotification:Y({type:`signin:failed`,autoHide:!1,closeable:!0,state:n,status:`error`,message:Kc(e,K(`Failed to log in, please try again`))})}}}function dE({data:e,state:t}){let n=(e?.email||``).trim(),r=e?.otcRef,i=e?.inboxLinks;return r?{showPopup:!0,page:`magiclink`,lastPage:`signin`,otcRef:r,inboxLinks:i,pageData:{...t.pageData||{},email:n},popupNotification:null}:{}}async function fE({data:e,api:t}){let n=K(`Failed to verify code, please try again`);try{let r=await t.member.getIntegrityToken(),i=await t.member.verifyOTC({...e,integrityToken:r});return i.redirectUrl?window.location.assign(i.redirectUrl):{action:`verifyOTC:failed`,actionErrorMessage:Kc(i.errors?.[0],n)}}catch(e){return{action:`verifyOTC:failed`,actionErrorMessage:Kc(e,n)}}}async function pE({data:e,state:t,api:n}){try{let{plan:r,tierId:i,cadence:a,email:o,name:s,newsletters:c,offerId:l}=e;s=s?.trim();let u;if(r.toLowerCase()===`free`){let t=await n.member.getIntegrityToken();({inboxLinks:u}=await n.member.sendMagicLink({emailType:`signup`,integrityToken:t,...e,name:s}))}else{let e=t.member?{checkoutType:`upgrade`}:void 0;return(!i||!a)&&({tierId:i,cadence:a}=bu({site:t?.site,priceId:r})),await n.member.checkoutPlan({plan:r,tierId:i,cadence:a,email:o,name:s,newsletters:c,offerId:l,metadata:e}),{page:`loading`}}return{page:`magiclink`,lastPage:`signup`,inboxLinks:u,pageData:{...t.pageData||{},email:(o||``).trim()}}}catch(n){return n.code===tE?t.member?{action:`signup:failed`,popupNotification:Y({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`You already have an active subscription.`)})}:{page:`magiclink`,lastPage:`signin`,pageData:{...t.pageData||{},email:(e?.email||``).trim()},popupNotification:null}:{action:`signup:failed`,popupNotification:Y({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:Kc(n,K(`Failed to sign up, please try again`))})}}}async function mE({data:e,state:t,api:n}){try{let{email:r,name:i,giftToken:a}=e;if(i=i?.trim(),t.member){await n.gift.redeem({token:a});let e=await n.member.sessionData(),r=Iu({type:`giftRedeem`,status:`success`,autoHide:!0,closeable:!0,state:t,message:Jd({member:e})});return vl(),{action:`redeemGift:success`,member:e,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:r,notificationSequence:r.count}}let o=await n.member.getIntegrityToken(),s=new URL(t?.site?.url||window.location.href);s.search=new URLSearchParams({giftRedemption:`true`}).toString(),s.hash=``;let{otc_ref:c,inboxLinks:l}=await n.member.sendMagicLink({email:(r||``).trim(),emailType:`subscribe`,integrityToken:o,includeOTC:!0,redirect:s.href,giftToken:a,...i?{name:i}:{}});return{page:`magiclink`,lastPage:`gift`,...c?{otcRef:c}:{},inboxLinks:l,pageData:{...t.pageData||{},email:(r||``).trim(),...i?{name:i}:{},redirect:s.href}}}catch(e){let n=Iu({type:`giftRedeem`,status:`error`,autoHide:!1,closeable:!0,state:t,message:Yd(e)});return vl(),{action:`redeemGift:failed`,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:n,notificationSequence:n.count}}}async function hE({data:e,state:t,api:n}){try{let{plan:r,offerId:i,tierId:a,cadence:o}=e;(!a||!o)&&({tierId:a,cadence:o}=bu({site:t?.site,priceId:r})),await n.member.checkoutPlan({plan:r,tierId:a,cadence:o,offerId:i,metadata:{checkoutType:`upgrade`}})}catch{return{action:`checkoutPlan:failed`,popupNotification:Y({type:`checkoutPlan:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}async function gE({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:`continueGiftSubscription:failed`,popupNotification:Y({type:`continueGiftSubscription:failed`,autoHide:!1,closeable:!0,state:e,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}async function _E({data:e,state:t,api:n}){try{let{tierId:t,cadence:r,duration:i,email:a,deliveryMethod:o,recipientEmail:s,recipientName:c,buyerName:l,personalMessage:u,deliveryDate:d}=e;return await n.member.checkoutGift({tierId:t,...i===void 0?{cadence:r}:{duration:i},...a?{email:a}:{},...o===void 0?{}:{deliveryMethod:o},...s?{recipientEmail:s}:{},...c?{recipientName:c}:{},...l?{buyerName:l}:{},...u?{personalMessage:u}:{},...d?{deliveryDate:d}:{}}),{action:`checkoutGift:success`}}catch{return{action:`checkoutGift:failed`,popupNotification:Y({type:`checkoutGift:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to process checkout, please try again`)})}}}function vE({property:e,message:t},n){if(typeof e!=`string`||!/^answers(\.|$)/.test(e))return{};let r=Kc({message:t}),i=dh(n,e);return i?IE(i.field,i.part,r):{sentence:r}}async function yE({data:e,state:t,api:n}){let{plan:r,planId:i,subscriptionId:a,cancelAtPeriodEnd:o,answers:s,asked:c=[]}=e;try{let{tierId:e,cadence:c}=bu({site:t?.site,priceId:i});await n.member.updateSubscription({planName:r,tierId:e,cadence:c,subscriptionId:a,cancelAtPeriodEnd:o,planId:i,answers:s});let l=await n.member.sessionData(),u=`updateSubscription:success`;return{action:u,fieldErrors:{},popupNotification:Y({type:u,autoHide:!0,closeable:!0,state:t,status:`success`,message:K(`Subscription plan updated successfully`)}),page:`accountHome`,member:l}}catch(e){let n=PE(e,e=>vE(e,c),K(`Failed to update subscription, please try again`));return{action:`updateSubscription:failed`,fieldErrors:n.fieldErrors,popupNotification:LE({...n,state:t,type:`updateSubscription:failed`,autoHide:!1})}}}function bE(){return{fieldErrors:{}}}async function xE({data:e,state:t,api:n}){try{let{subscriptionId:t,cancellationReason:r}=e;return await n.member.updateSubscription({subscriptionId:t,smartCancel:!0,cancellationReason:r}),{action:`cancelSubscription:success`,page:`accountHome`,member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:`cancelSubscription:failed`,popupNotification:Y({type:`cancelSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to cancel subscription, please try again`)})}}}async function SE({data:e,state:t,api:n}){try{let{subscriptionId:t}=e;return await n.member.updateSubscription({subscriptionId:t,cancelAtPeriodEnd:!1}),{action:`continueSubscription:success`,page:`accountHome`,member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:`continueSubscription:failed`,popupNotification:Y({type:`continueSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to cancel subscription, please try again`)})}}}async function CE({data:e,state:t,api:n}){try{let{offerId:r,subscriptionId:i}=e;return await n.member.applyOffer({offerId:r,subscriptionId:i}),{action:`applyOffer:success`,page:`accountHome`,member:await n.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:Y({type:`applyOffer:success`,autoHide:!0,closeable:!0,state:t,status:`success`,message:`Offer applied successfully!`})}}catch{return{action:`applyOffer:failed`,popupNotification:Y({type:`applyOffer:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:`Failed to apply offer, please try again`})}}}async function wE({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:`editBilling:failed`,popupNotification:Y({type:`editBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to update billing information, please try again`)})}}}async function TE({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:`manageBilling:failed`,popupNotification:Y({type:`manageBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:K(`Failed to open billing portal, please try again`)})}}}async function EE(){return{popupNotification:null}}async function DE({data:e,state:t}){let{action:n,message:r=``,status:i=`success`}=e;return n||=`showPopupNotification:success`,{popupNotification:Y({type:n,autoHide:!0,closeable:!0,state:t,status:i,message:r})}}async function OE({data:e,state:t,api:n}){try{let{newsletters:r,enableCommentNotifications:i,enableUpdatesAndAnnouncements:a,successMessage:o}=e;if(!r&&i===void 0&&a===void 0)return{};let s={};r&&(s.newsletters=r),i!==void 0&&(s.enableCommentNotifications=i),a!==void 0&&(s.enableUpdatesAndAnnouncements=a);let c=await n.member.update(s),l=`updateNewsletterPref:success`;return{action:l,member:c,...o&&{popupNotification:Y({type:l,autoHide:!0,closeable:!0,state:t,status:`success`,message:o})}}}catch{return{action:`updateNewsletterPref:failed`,popupNotification:Y({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:K(`Failed to update newsletter settings`)})}}}async function kE({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:`removeEmailFromSuppressionList:success`,popupNotification:Y({type:`removeEmailFromSuppressionList:success`,autoHide:!0,closeable:!0,state:e,status:`success`,message:K(`You have been successfully resubscribed`)})}}catch{return{action:`removeEmailFromSuppressionList:failed`,popupNotification:Y({type:`removeEmailFromSuppressionList:failed`,autoHide:!0,closeable:!0,state:e,status:`error`,message:K(`Your email has failed to resubscribe, please try again`)})}}}async function AE({data:e,state:t,api:n}){try{let{subscribed:r}=e,i=await n.member.update({subscribed:r});if(!i)throw Error(`Failed to update newsletter`);let a=`updateNewsletter:success`;return{action:a,member:i,popupNotification:Y({type:a,autoHide:!0,closeable:!0,state:t,status:`success`,message:K(`Email newsletter settings updated`)})}}catch{return{action:`updateNewsletter:failed`,popupNotification:Y({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:K(`Failed to update newsletter settings`)})}}}async function jE({data:e,state:t,api:n}){let{email:r}=e;if(r!==wu({member:t.member}))try{return await n.member.updateEmailAddress({email:r}),{success:!0}}catch(e){return{success:!1,error:e}}return null}async function ME({data:e,state:t,api:n}){let r=e?.name?.trim(),i=e?.metafields;if(Du({member:t.member})!==r||i)try{let e=await n.member.update({name:r,metafields:i});if(!e)throw Error(`Failed to update member`);return{member:e,success:!0}}catch(e){return{success:!1,error:e}}return null}async function NE({state:e,api:t}){if(e.member)try{let e=await t.member.sessionData();return e?{member:e,success:!0,action:`refreshMemberData:success`}:null}catch(e){return{success:!1,error:e,action:`refreshMemberData:failed`}}return null}function PE(e,t,n){let r=e?.details?.length?e.details:[{property:e?.property,message:e?.message}],i={},a=null;for(let e of r){let n=t(e);n.input?i[n.input]=n.message:n.sentence&&!a&&(a=n.sentence)}return{fieldErrors:i,sentence:a,message:a??n}}function FE({property:e,message:t},n){let[r,,i,...a]=(typeof e==`string`?e:``).split(`.`);if(r!==`metafields`)return{};let o=Kc({message:t}),s=n.customFields?.find(e=>e.key===i);return s?IE(s,a.join(`.`),o):{sentence:o}}function IE(e,t,n){let r=Bm(e,t);return r?{input:r,message:n}:{sentence:K(`{field}: {message}`,{field:e.name,message:n})}}function LE({fieldErrors:e,sentence:t,message:n,state:r,type:i=`updateProfile:failed`,autoHide:a=!0}){return Object.keys(e).length>0&&!t?null:Y({type:i,autoHide:a,closeable:!0,status:`error`,message:n,state:r})}async function RE({data:e,state:t,api:n}){let[r,i]=await Promise.all([ME({data:e,state:t,api:n}),jE({data:e,state:t,api:n})]);if(r&&i){if(i.success&&r.success)return{action:`updateProfile:success`,...r.success?{member:r.member}:{},page:`accountHome`,popupNotification:Y({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:K(`Check your inbox to verify email update`)})};let e=r.success?{fieldErrors:{},message:K(`Failed to send verification email`)}:PE(r.error,e=>FE(e,t),K(`Failed to update account data`));return{action:`updateProfile:failed`,fieldErrors:e.fieldErrors,...r.success?{member:r.member}:{},popupNotification:LE({...e,state:t})}}else if(r){let e=r.success?`updateProfile:success`:`updateProfile:failed`,n=r.success?`success`:`error`,i=r.success?{fieldErrors:{},message:K(`Account details updated successfully`)}:PE(r.error,e=>FE(e,t),K(`Failed to update account details`));return{action:e,fieldErrors:i.fieldErrors,...r.success?{member:r.member}:{},...r.success?{page:`accountHome`}:{},popupNotification:r.success?Y({type:e,autoHide:!0,closeable:!0,status:n,state:t,message:i.message}):LE({...i,state:t})}}else if(i){let e=i.success?`updateProfile:success`:`updateProfile:failed`,n=i.success?`success`:`error`,r=``;return r=i.error?Kc(i.error,K(`Failed to send verification email`)):K(`Check your inbox to verify email update`),{action:e,fieldErrors:{},...i.success?{page:`accountHome`}:{},popupNotification:Y({type:e,autoHide:i.success,closeable:!0,status:n,state:t,message:r})}}return{action:`updateProfile:success`,page:`accountHome`,popupNotification:Y({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:K(`Account details updated successfully`)})}}async function zE({data:{siteUrl:e},state:t}){let n=rC({siteUrl:e,apiUrl:`not-defined`,contentApiKey:`not-defined`}),{member:r}=t,i=window.location.href,a=Xl(),o=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:`signup`,name:r.name,email:r.email,autoRedirect:!1,integrityToken:o,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:a,referrerMedium:`Ghost Recommendations`,referrerUrl:i}]:[]}),{}}function BE({data:{recommendationId:e},api:t}){try{let t=localStorage.getItem(`ghost-recommendations-clicked`),n=t?JSON.parse(t):[];if(n.includes(e))return;n.push(e),localStorage.setItem(`ghost-recommendations-clicked`,JSON.stringify(n))}catch{}return t.recommendations.trackClicked({recommendationId:e}),{}}async function VE({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}var HE={togglePopup:rE,openPopup:iE,closePopup:oE,switchPage:nE,openNotification:sE,closeNotification:cE,back:aE,signout:lE,signin:uE,startSigninOTCFromCustomForm:dE,verifyOTC:fE,signup:pE,redeemGift:mE,updateSubscription:yE,cancelSubscription:xE,continueSubscription:SE,applyOffer:CE,updateNewsletter:AE,updateProfile:RE,refreshMemberData:NE,clearPopupNotification:EE,clearFieldErrors:bE,editBilling:wE,manageBilling:TE,checkoutPlan:hE,continueGiftSubscription:gE,checkoutGift:_E,updateNewsletterPreference:OE,showPopupNotification:DE,removeEmailFromSuppressionList:kE,oneClickSubscribe:zE,trackRecommendationClicked:BE,trackRecommendationSubscribed:VE};async function UE({action:e,data:t,state:n,api:r}){let i=HE[e];return i&&await i({data:t,state:n,api:r})||{}}function WE(e,t){e&&(e.innerText=t)}function GE(e,t,n){t.classList.add(`error`),WE(n,Kc(e,K(`There was an error sending the email, please try again`)))}async function KE({event:e,form:t,errorEl:n,siteUrl:r,submitHandler:i,doAction:a,captureException:o}){t.removeEventListener(`submit`,i),e.preventDefault(),n&&(n.innerText=``),t.classList.remove(`success`,`invalid`,`error`);let s=e.target.querySelector(`input[data-members-email]`),c=e.target.querySelector(`input[data-members-name]`),l=t?.dataset?.membersAutoredirect||`true`,u=s?.value,d=(c?.value||``).trim()||void 0,f,p=[],m=[],h=e.target.querySelectorAll(`input[data-members-label]`)||[];for(let e=0;e<h.length;++e)p.push(h[e].value);let g=e.target.querySelectorAll(`input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked`)||[];for(let e=0;e<g.length;++e)m.push({name:g[e].value});t.dataset.membersForm&&(f=t.dataset.membersForm);let _=f===`signin`&&t?.dataset?.membersOtc===`true`;t.classList.add(`loading`);let v=qu(),y={email:u,emailType:f,labels:p,name:d,autoRedirect:l===`true`};_&&(y.includeOTC=!0),v&&(y.urlHistory=v),g.length>0?y.newsletters=m:(e.target.querySelectorAll(`input[type=checkbox][data-members-newsletter]`)||[]).length>0&&(y.newsletters=[]);try{let e=await(await nC(`${r}/members/api/integrity-token/`,{method:`GET`})).text(),i=await nC(`${r}/members/api/send-magic-link/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...y,integrityToken:e})});if(i.ok){t.classList.add(`success`);let e;if(_)try{e=await i.clone().json()}catch{e=void 0}let n=e?.otc_ref;if(n&&typeof a==`function`)try{a(`startSigninOTCFromCustomForm`,{email:(u||``).trim(),otcRef:n,inboxLinks:e?.inboxLinks})}catch(e){console.error(e),o?.(e)}}else WE(n,Kc(await Uc.fromApiResponse(i),K(`Failed to send magic link email`))),t.classList.add(`error`)}catch(e){GE(e,t,n)}finally{t.addEventListener(`submit`,i),t.classList.remove(`loading`)}}function qE({event:e,el:t,errorEl:n,siteUrl:r,site:i,member:a,clickHandler:o}){t.removeEventListener(`click`,o),e.preventDefault();let s=t.dataset.membersPlan,c=Bl(i,s.toLowerCase()),l=t.dataset.membersSuccess,u=t.dataset.membersCancel,d,f;l&&(d=new URL(l,window.location.href).href),u&&(f=new URL(u,window.location.href).href),n&&(n.innerText=``),t.classList.add(`loading`);let p=a?{checkoutType:`upgrade`}:{},m=qu();return m&&(p.urlHistory=m),fetch(`${r}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(e){return fetch(`${r}/members/api/create-stripe-checkout-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...c,identity:e,successUrl:d,cancelUrl:f,metadata:p})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe checkout session`));return e.json()})}).then(function(e){return e.url?window.location.assign(e.url):window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId}).then(function(e){if(e.error)throw Error(e.error.message)})}).catch(function(e){console.error(e),t.addEventListener(`click`,o),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}function JE({siteUrl:e,site:t={},member:n,offers:r=[],doAction:i,captureException:a}={}){if(!e)return;e=e.replace(/\/$/,``),Array.prototype.forEach.call(document.querySelectorAll(`form[data-members-form]`),function(t){let n=t.querySelector(`[data-members-error]`);function r(o){KE({event:o,errorEl:n,form:t,siteUrl:e,submitHandler:r,doAction:i,captureException:a})}t.addEventListener(`submit`,r)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-plan]`),function(r){let i=r.querySelector(`[data-members-error]`);function a(o){qE({el:r,event:o,errorEl:i,member:n,site:t,siteUrl:e,clickHandler:a})}r.addEventListener(`click`,a)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-edit-billing]`),function(t){let n=t.querySelector(`[data-members-error]`),r=t.dataset.membersSuccess,i=t.dataset.membersCancel,a,o;r&&(a=new URL(r,window.location.href).href),i&&(o=new URL(i,window.location.href).href);function s(r){t.removeEventListener(`click`,s),r.preventDefault(),n&&(n.innerText=``),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,successUrl:a,cancelUrl:o})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe checkout session`));return e.json()})}).then(function(e){return window.Stripe(e.publicKey).redirectToCheckout({sessionId:e.sessionId})}).then(function(e){if(e.error)throw Error(K(e.error.message))}).catch(function(e){console.error(e),t.addEventListener(`click`,s),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}t.addEventListener(`click`,s)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-manage-billing]`),function(t){let n=t.querySelector(`[data-members-error]`),r=t.dataset.membersReturn,i;r&&(i=new URL(r,window.location.href).href);function a(r){t.removeEventListener(`click`,a),r.preventDefault(),n&&(n.innerText=``),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,returnUrl:i})}).then(function(e){if(!e.ok)throw Error(K(`Could not create Stripe billing portal session`));return e.json()})}).then(function(e){return window.location.assign(e.url)}).catch(function(e){console.error(e),t.addEventListener(`click`,a),t.classList.remove(`loading`),n&&(n.innerText=e.message),t.classList.add(`error`)})}t.addEventListener(`click`,a)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-signout]`),function(t){function n(r){t.removeEventListener(`click`,n),r.preventDefault(),t.classList.remove(`error`),t.classList.add(`loading`),fetch(`${e}/members/api/session`,{method:`DELETE`}).then(function(r){r.ok?window.location.replace(e):(t.addEventListener(`click`,n),t.classList.remove(`loading`),t.classList.add(`error`))})}t.addEventListener(`click`,n)});let o=(r||[]).some(e=>e.redemption_type===`retention`);Array.prototype.forEach.call(document.querySelectorAll(`[data-members-cancel-subscription]`),function(t){let n=t.parentElement.querySelector(`[data-members-error]`);function r(a){a.preventDefault();let s=t.dataset.membersCancelSubscription;if(o){i(`openPopup`,{page:`accountPlan`,pageData:{subscriptionId:s,action:`cancel`}});return}return t.removeEventListener(`click`,r),t.classList.remove(`error`),t.classList.add(`loading`),n&&(n.innerText=``),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/subscriptions/${s}/`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,smart_cancel:!0})})}).then(function(e){e.ok?window.location.reload():(t.addEventListener(`click`,r),t.classList.remove(`loading`),t.classList.add(`error`),n&&(n.innerText=K(`There was an error cancelling your subscription, please try again.`)))})}t.addEventListener(`click`,r)}),Array.prototype.forEach.call(document.querySelectorAll(`[data-members-continue-subscription]`),function(t){let n=t.parentElement.querySelector(`[data-members-error]`);function r(i){t.removeEventListener(`click`,r),i.preventDefault(),t.classList.remove(`error`),t.classList.add(`loading`);let a=t.dataset.membersContinueSubscription;return n&&(n.innerText=``),fetch(`${e}/members/api/session`,{credentials:`same-origin`}).then(function(e){return e.ok?e.text():null}).then(function(t){return fetch(`${e}/members/api/subscriptions/${a}/`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({identity:t,cancel_at_period_end:!1})})}).then(function(e){e.ok?window.location.reload():(t.addEventListener(`click`,r),t.classList.remove(`loading`),t.classList.add(`error`),n&&(n.innerText=K(`There was an error continuing your subscription, please try again.`)))})}t.addEventListener(`click`,r)})}var YE=e=>{try{return decodeURIComponent(e)}catch{return null}},XE=e=>{if(e===`true`)return!0;if(e===`false`)return!1},ZE={staleGiftRedemptionRequest:!0},QE={showPopup:!0,site:XT,member:QT.free,page:`accountEmail`,...$T(),pageData:ZT};function $E({site:e,children:t}){let{portal_sentry:n}=e||{};return n&&n.dsn?(0,q.jsx)(Eo,{children:t}):(0,q.jsx)(q.Fragment,{children:t})}var eD=class extends _.Component{constructor(e){super(e),this.setupCustomTriggerButton(),this.state={site:null,member:null,customFields:[],offers:[],page:`loading`,showPopup:!1,action:`init:running`,actionErrorMessage:null,fieldErrors:{},initStatus:`running`,lastPage:null,notification:null,notificationSequence:-1,customSiteUrl:e.customSiteUrl,locale:e.locale,scrollbarWidth:0},this._redemptionRequestId=0,this.currentRedemptionToken=null}componentDidMount(){let e=this.getScrollbarWidth();this.setState({scrollbarWidth:e}),this.initSetup()}componentDidUpdate(e,t){if(t.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=window.document?.body?.style?.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue(`margin-right`),window.document.body.style.overflow=`hidden`,this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||``,!this.bodyMargin||this.bodyMargin===`0px`?window.document.body.style.marginRight=``:window.document.body.style.marginRight=this.bodyMargin,this.state.reloadOnPopupClose&&window.location.reload())}catch{}}if(this.state.initStatus===`success`&&t.initStatus!==this.state.initStatus){let{siteUrl:e}=this.props,t=this.getContextFromState();this.sendPortalReadyEvent(),JE({siteUrl:e,site:t.site,member:t.member,offers:t.offers,doAction:t.doAction,captureException:nr})}}componentWillUnmount(){clearTimeout(this.timeoutId),this.customTriggerButtons&&this.customTriggerButtons.forEach(e=>{e.removeEventListener(`click`,this.clickHandler)}),window.removeEventListener(`hashchange`,this.hashHandler,!1)}sendPortalReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:`portal-ready`,payload:{}},`*`)}getScrollbarWidth(){let e=document.createElement(`div`);e.style.visibility=`hidden`,e.style.overflow=`scroll`,document.body.appendChild(e),document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}setupCustomTriggerButton(){this.clickHandler=async e=>{e.preventDefault();let t=e.currentTarget,n=t&&t.dataset.portal,r=this.getPageFromLinkPath(n,this.state.site);if(!r)return;let{page:i,pageQuery:a,pageData:o}=r;if(this.state.initStatus===`success`){if(i===`gift`&&!Kl({site:this.state.site})){this.invalidateGiftRedemptionRequest(),vl();return}if(i===`giftRedemption`&&o?.token){let e=this.startGiftRedemptionRequest(o.token),t=await this.fetchGiftRedemptionData({token:o.token});if(!this.isCurrentGiftRedemptionRequest(e))return;this.setState(t);return}this.invalidateGiftRedemptionRequest(),a&&a!==`free`?this.handleSignupQuery({site:this.state.site,pageQuery:a}):this.dispatchAction(`openPopup`,{page:i,pageQuery:a,pageData:o})}},this.customTriggerButtons=document.querySelectorAll(`[data-portal]`)||[],this.customTriggerButtons.forEach(e=>{e.classList.add(`gh-portal-close`),e.removeEventListener(`click`,this.clickHandler),e.addEventListener(`click`,this.clickHandler)})}handleCustomTriggerClassUpdate(){let e=`gh-portal-open`,t=`gh-portal-close`;this.customTriggerButtons?.forEach(n=>{let r=this.state.showPopup?e:t,i=this.state.showPopup?t:e;n.classList.add(r),n.classList.remove(i)})}startGiftRedemptionRequest(e){return this._redemptionRequestId+=1,this.currentRedemptionToken=e,{requestId:this._redemptionRequestId,token:e}}invalidateGiftRedemptionRequest(){this._redemptionRequestId+=1,this.currentRedemptionToken=null}isCurrentGiftRedemptionRequest({requestId:e,token:t}){return this._redemptionRequestId===e&&this.currentRedemptionToken===t}async initSetup(){try{let{site:e,member:t,offers:n,customFields:r,page:i,showPopup:a,popupNotification:o,notification:s,notificationSequence:c,lastPage:l,pageQuery:u,pageData:d}=await this.fetchData(),f=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||`en`;Hc.changeLanguage(f);let p={site:e,member:t,offers:n,customFields:r,page:i,lastPage:l,pageQuery:u,showPopup:a,pageData:d,popupNotification:o,notification:s,notificationSequence:c,dir:Hc.dir()||`ltr`,action:`init:success`,initStatus:`success`,locale:f};if(this.setState(p,()=>{this.handleSignupQuery({site:e,pageQuery:u,member:t})}),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener(`hashchange`,this.hashHandler,!1),!t){let e=document.querySelectorAll(`[data-lexical-signup-form]`);e.length>0&&e.forEach(e=>{e.style.display=``})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(e){console.error(`[Portal] Failed to initialize:`,e),this.setState({action:`init:failed`,initStatus:`failed`})}}async fetchData(){let{site:e,member:t,offers:n}=await this.fetchApiData(),{site:r,...i}=this.fetchDevData(),[a,o]=await Promise.all([this.fetchLinkData(e,t),Pm({api:this.GhostApi,site:e,member:t})]),{site:s,...c}=a?.staleGiftRedemptionRequest?{}:a,{site:l,...u}=this.fetchPreviewData(),{site:d,...f}=this.fetchNotificationData();return{member:t,offers:n,customFields:o,page:``,site:{...e,...s,...l,...d,...r,plans:{...(r||{}).plans,...(e||{}).plans,...(l||{}).plans}},...i,...c,...f,...u}}fetchDevData(){return nd([`dev`])&&!this.state.customSiteUrl?QE:nd([`test`])?{showPopup:this.props.showPopup===void 0||this.props.showPopup}:{}}fetchOfferQueryStrData(e=``){let t=new URLSearchParams(e),n={};for(let e of t.entries()){let t=e[0],r=decodeURIComponent(e[1]);t===`name`?n.name=r||``:t===`code`?n.code=r||``:t===`display_title`?n.display_title=r||``:t===`display_description`?n.display_description=r||``:t===`type`?n.type=r||``:t===`cadence`?n.cadence=r||``:t===`duration`?n.duration=r||``:t===`duration_in_months`&&!isNaN(Number(r))?n.duration_in_months=Number(r):t===`amount`&&!isNaN(Number(r))?n.amount=Number(r):t===`currency`?n.currency=r||``:t===`status`?n.status=r||``:t===`tier_id`?n.tier={id:r||ZT.tier.id}:t===`redemption_type`&&(n.redemption_type=r||`signup`)}if(n.redemption_type===`retention`){let e=QT.preview?.subscriptions?.[0]?.id;return{page:`accountPlan`,offers:[n],pageData:{action:`cancel`,subscriptionId:e}}}return{page:`offer`,pageData:n}}fetchQueryStrData(e=``){let t=new URLSearchParams(e),n={site:{plans:{}}},r=[],i,a=null,o,s,c;for(let e of t.entries()){let t=e[0],l=decodeURIComponent(e[1]);if(t===`button`)n.site.portal_button=JSON.parse(l);else if(t===`name`)n.site.portal_name=JSON.parse(l);else if(t===`signupGiftPromotion`){let e=XE(l);e!==void 0&&(n.site.portal_signup_gift_promotion=e)}else if(t===`accountGiftPromotion`){let e=XE(l);e!==void 0&&(n.site.portal_account_gift_promotion=e)}else if(t===`isFree`&&JSON.parse(l))r.push(`free`);else if(t===`isMonthly`&&JSON.parse(l))r.push(`monthly`);else if(t===`isYearly`&&JSON.parse(l))r.push(`yearly`);else if(t===`portalPrices`)i=l?l.split(`,`):[];else if(t===`portalProducts`)a=l?l.split(`,`):[];else if(t===`page`&&l)n.page=l;else if(t===`accentColor`&&(l===``||l))n.site.accent_color=l;else if(t===`buttonIcon`&&l)n.site.portal_button_icon=l;else if(t===`signupButtonText`)n.site.portal_button_signup_text=l||``;else if(t===`signupTermsHtml`)n.site.portal_signup_terms_html=l||``;else if(t===`signupCheckboxRequired`)n.site.portal_signup_checkbox_required=JSON.parse(l);else if(t===`buttonStyle`&&l)n.site.portal_button_style=l;else if(t===`monthlyPrice`&&!isNaN(Number(l)))n.site.plans.monthly=Number(l),o=Number(l);else if(t===`yearlyPrice`&&!isNaN(Number(l)))n.site.plans.yearly=Number(l),s=Number(l);else if(t===`currency`&&l){let e=l.toUpperCase();n.site.plans.currency=e,n.site.plans.currency_symbol=ju(e),c=e}else t===`disableBackground`?n.site.disableBackground=JSON.parse(l):t===`previewTheme`?n.site.preview_theme=l:t===`membersSignupAccess`&&l?n.site.members_signup_access=l:t===`portalDefaultPlan`&&l?n.site.portal_default_plan=l:t===`transistorPortalSettings`&&l&&(n.site.transistor_portal_settings=JSON.parse(l))}return n.site.portal_plans=r,n.site.portal_products=a,i?n.site.portal_plans=i:o&&s&&c&&(n.site.prices=[{id:`monthly`,stripe_price_id:`dummy_stripe_monthly`,stripe_product_id:`dummy_stripe_product`,active:1,nickname:`Monthly`,currency:c,amount:o,type:`recurring`,interval:`month`},{id:`yearly`,stripe_price_id:`dummy_stripe_yearly`,stripe_product_id:`dummy_stripe_product`,active:1,nickname:`Yearly`,currency:c,amount:s,type:`recurring`,interval:`year`}]),n}fetchNotificationData(){let{type:e,status:t,duration:n,autoHide:r,closeable:i}=nf({billingOnly:!0})||{};return[`stripe:billing-update`].includes(e)?t===`success`?{showPopup:!0,popupNotification:Y({type:e,status:t,duration:n,closeable:i,autoHide:r,state:this.state,message:t===`success`?`Billing info updated successfully`:``})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({token:e}){try{return{showPopup:!0,notification:null,page:`giftRedemption`,pageData:{token:e,gift:(await this.GhostApi.gift.fetchRedemptionData({token:e}))?.gifts?.[0]||null}}}catch(e){vl();let t=Iu({type:`giftRedemption:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:Yd(e)});return{showPopup:!1,pageData:null,notification:t,notificationSequence:t.count}}}async fetchLinkData(e,t){this.invalidateGiftRedemptionRequest();let n=new URLSearchParams(window.location.search);if(n.get(`stripe`)===`gift-purchase-success`){let e=n.get(`gift_token`),t=n.get(`gift_tier`),r=n.get(`gift_cadence`),i=Number(n.get(`gift_duration`)),a=n.get(`gift_delivery`),o=n.get(`gift_delivery_date`),s=/^\d{4}-\d{2}-\d{2}$/.test(o||``)?o:null,c=Number(n.get(`gift_scheduled_at`)),l=Number.isFinite(c)&&c>0?c:null;if(tf([`stripe`,`gift_token`,`gift_tier`,`gift_cadence`,`gift_duration`,`gift_delivery`,`gift_delivery_date`,`gift_scheduled_at`]),e)return Hw(),{showPopup:!0,page:`giftSuccess`,pageData:{token:e,tierId:t,cadence:r,duration:Cf.includes(i)?i:null,deliveryMethod:a===`email`?`email`:`link`,deliveryDate:s,scheduledAt:l}}}if(n.get(`action`)===`unsubscribe`)return n.get(`key`)&&n.get(`uuid`)?{showPopup:!0,page:`unsubscribe`,pageData:{uuid:n.get(`uuid`),key:n.get(`key`),newsletterUuid:n.get(`newsletter`),comments:n.get(`comments`),updatesAndAnnouncements:n.get(`updatesandannouncements`)}}:{showPopup:!0,page:`accountEmail`,pageData:{newsletterUuid:n.get(`newsletter`),action:`unsubscribe`,redirect:e.url+`#/portal/account/newsletters`}};if(Gl({site:e})&&n.get(`action`)===`signup`&&n.get(`success`)===`true`)return{showPopup:!0,page:`recommendations`,pageData:{signup:!0}};let[r,i]=window.location.hash.substr(1).split(`?`),a=new URLSearchParams(i??``),o=/^(?:(\w+?))?\/monthly$/,s=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,l=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,u=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,d=/^\/share\/?$/,f=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(r&&f.test(r)){let[,n,i]=r.match(f),o=parseInt(i);if(o===1||o===0)return t||a.get(`uuid`)&&a.get(`key`)?{showPopup:!0,page:`feedback`,pageData:{uuid:a.get(`uuid`),key:a.get(`key`),postId:n,score:o}}:{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/feedback/${n}/${o}/`}}}if(r&&l.test(r)){let[,t]=r.match(l),n=YE(t);if(!n)return{};xf(e.url);let i=this.startGiftRedemptionRequest(n),a=await this.fetchGiftRedemptionData({token:n});return this.isCurrentGiftRedemptionRequest(i)?a:ZE}if(r&&d.test(r))return{showPopup:!0,page:`share`};if(r&&u.test(r)){let[,n]=r.match(u),{page:i,pageQuery:l,pageData:d}=this.getPageFromLinkPath(n,e)||{};if(!t&&i&&TT({page:i}))return{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/portal/${n}/`}};if(i===`gift`&&!Kl({site:e}))return vl(),{};i===`gift`&&xf(e.url);let f=[`accountPlan`,`accountProfile`].includes(i)?`accountHome`:null,p=!([`monthly`,`yearly`].includes(l)||o.test(l)||s.test(l)||c.test(l)),m=a.get(`redirect`),h=i===`signin`&&m?{...d||{},redirect:m}:d;return{showPopup:p,...i?{page:i}:{},...l?{pageQuery:l}:{},...h?{pageData:h}:{},...f?{lastPage:f}:{}}}return{}}fetchPreviewData(){let[,e]=window.location.hash.substr(1).split(`?`);if(nd([`preview`])){let t={};try{t=nd([`offerPreview`])?this.fetchOfferQueryStrData(e):this.fetchQueryStrData(e)}catch(e){return nr(e),{}}return{...t,showPopup:!0}}return{}}getColorOverride(){let e=document.querySelector(`script[data-ghost]`);return e&&e.dataset.accentColor?e.dataset.accentColor:!1}async fetchApiData(){let{siteUrl:e,customSiteUrl:t,apiUrl:n,apiKey:r}=this.props;try{this.GhostApi=this.props.api||rC({siteUrl:e,apiUrl:n,apiKey:r});let{site:t,member:i,offers:a}=await this.GhostApi.init(),o=this.getColorOverride();return o&&(t.accent_color=o),this.setupFirstPromoter({site:t,member:i}),this.setupSentry({site:t}),{site:t,member:i,offers:a}}catch(e){if(nd([`dev`,`test`],{customSiteUrl:t}))return{};throw e}}setupSentry({site:e}){if(nd([`test`]))return null;let{portal_sentry:t,portal_version:n,version:r}=e,i=`portal@2.72.31|ghost@${r}`;t&&t.dsn&&vo({dsn:t.dsn,environment:t.env||`development`,release:i,beforeSend:e=>Sl({event:e})?e:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:t}){if(nd([`test`]))return null;let n=Eu({site:e}),r=Au({site:e});if(r=r?.replace(/^(\S*\.)?(\S*\.\S*)$/i,`.$2`),n&&r){let e=document.createElement(`script`);e.type=`text/javascript`,e.async=!0,e.src=`https://cdn.firstpromoter.com/fprom.js`,e.onload=e.onreadystatechange=function(){let e=this.readyState;if(!e||e===`complete`||e===`loaded`)try{if(window.$FPROM.init(n,r),Yu({member:t})){let e=t.email,n=t.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:e,uid:n});else{let t=window._fprom||[];window._fprom=t,t.push([`event`,`signup`]),t.push([`email`,e]),t.push([`uid`,n])}}}catch{}};let i=document.getElementsByTagName(`script`)[0];i.parentNode.insertBefore(e,i)}}async dispatchAction(e,t){clearTimeout(this.timeoutId),this.setState({action:`${e}:running`,actionErrorMessage:null});try{let n=await UE({action:e,data:t,state:this.state,api:this.GhostApi});return this.setState(n),n&&n.action&&!n.action.includes(`:failed`)&&(this.timeoutId=setTimeout(()=>{this.setState({action:``})},2e3)),n}catch(n){if(console.error(`[Portal] Failed to dispatch action: ${e}`,n),t&&t.throwErrors)throw n;let r=Y({type:`${e}:failed`,autoHide:!0,closeable:!0,status:`error`,state:this.state,meta:{error:n}});this.setState({action:`${e}:failed`,actionErrorMessage:Kc(n,K(`An unexpected error occured. Please try again or <a>contact support</a> if the error persists.`)),popupNotification:r})}}async updateStateForPreviewLinks(){let{site:e,...t}=this.fetchPreviewData(),n=await this.fetchLinkData(this.state.site,this.state.member);if(n?.staleGiftRedemptionRequest)return;let{site:r,...i}=n,a=this.state.page===`gift`&&i.page!==`gift`;a&&Hw();let o=a&&!i.page,s={site:{...this.state.site,...r||{},...e||{},plans:{...this.state.site&&this.state.site.plans,...(r||{}).plans,...(e||{}).plans}},...i,...t,...o?{showPopup:!1,lastPage:null}:{}};this.handleSignupQuery({site:s.site,pageQuery:s.pageQuery}),this.setState(s)}async handleOfferQuery({site:e,offerId:t,member:n=this.state.member}){if(vl(),!(!Tl({member:n})||wl({member:n}))){let e=Iu({type:`offer:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:K(`You already have an active subscription.`)});await this.dispatchAction(`closePopup`),this.setState({notification:e,notificationSequence:e.count});return}try{let n=(await this.GhostApi.site.offer({offerId:t}))?.offers[0];if(!n||!n.tier||Vu({offer:n})||!Hu({site:e,offer:n}))return;this.dispatchAction(`openPopup`,{page:`offer`,pageData:n})}catch{}}handleSignupQuery({site:e,pageQuery:t,member:n}){let r=/^offers\/(\w+?)\/?$/,i=t;if(r.test(t||``)){let[,i]=t.match(r);this.handleOfferQuery({site:e,offerId:i,member:n});return}Ru({site:e,pageQuery:t})&&(i=Ru({site:e,pageQuery:t}));let a=Vl({site:e,priceId:i});if(t&&t!==`free`){vl();let t=a?.id||i;t!==`free`&&this.dispatchAction(`openPopup`,{page:`loading`});let{tierId:n,cadence:r}=bu({site:e,priceId:t});this.dispatchAction(`signup`,{plan:t,tierId:n,cadence:r})}}getPageFromLinkPath(e){let t=/^signup\/?(?:\/(\w+?))?\/?$/,n=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,r=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,i=/^offers\/(\w+?)\/?$/,a=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e===``)return{page:`default`};if(a.test(e)){let[,t]=e.match(a),n=YE(t);return n?{page:`giftRedemption`,pageData:{token:n}}:null}else if(i.test(e))return{pageQuery:e};else if(e===`signup`)return{page:`signup`};else if(n.test(e)){let[,t]=e.match(n);return{page:`signup`,pageQuery:`${t}/monthly`}}else if(r.test(e)){let[,t]=e.match(r);return{page:`signup`,pageQuery:`${t}/yearly`}}else if(t.test(e)){let[,n]=e.match(t);return{page:`signup`,pageQuery:n}}else if(e===`signup/free`)return{page:`signup`,pageQuery:`free`};else if(e===`signup/monthly`)return{page:`signup`,pageQuery:`monthly`};else if(e===`signup/yearly`)return{page:`signup`,pageQuery:`yearly`};else if(e===`signin`)return{page:`signin`};else if(e===`account`)return{page:`accountHome`};else if(e===`account/plans`)return{page:`accountPlan`};else if(e===`account/profile`)return{page:`accountProfile`};else if(e===`account/newsletters`)return{page:`accountEmail`};else if(e===`support`)return{page:`support`};else if(e===`support/success`)return{page:`supportSuccess`};else if(e===`support/error`)return{page:`supportError`};else if(e===`recommendations`)return{page:`recommendations`,pageData:{signup:!1}};else if(e===`gift`)return{page:`gift`,pageData:{giftStep:`plan`}};else if(e===`gift/delivery`)return{page:`gift`,pageData:{giftStep:`delivery`}};else if(e===`share`)return{page:`share`};else if(e===`account/newsletters/help`)return{page:`emailReceivingFAQ`,pageData:{direct:!0}};else if(e===`account/newsletters/disabled`)return{page:`emailSuppressionFAQ`,pageData:{direct:!0}};return{page:`default`}}getAccentColor(){let{accent_color:e}=this.state.site||{};return iS(e)}getRetentionPreviewMember({site:e,offers:t}){let n=(t||[]).find(e=>Vu({offer:e})),r=n?.tier?.id,i=r?lu({site:e,productId:r}):null,a=i?n.cadence===`year`?i.yearlyPrice:i.monthlyPrice:null,o=QT.preview,s=o?.subscriptions?.[0];return!s||!i||!a?o:{...o,subscriptions:[{...s,plan:{...s.plan,amount:a.amount,interval:a.interval,currency:a.currency.toUpperCase()},price:{...s.price,price_id:a.id,amount:a.amount,interval:a.interval,currency:a.currency,product:{...s.price?.product,product_id:i.id}},tier:{id:i.id,name:i.name}}]}}getContextPage({site:e,page:t,member:n}){if(!t||t==="default"){let r=Ul({site:e})||!Wl({site:e})?`signin`:`signup`;t=n?`accountHome`:r}return wT({page:t})}getContextMember({site:e,page:t,member:n,offers:r,pageData:i,customSiteUrl:a}){return nd([`dev`,`preview`],{customSiteUrl:a})?TT({page:t})||ET({page:t})?nd([`dev`],{customSiteUrl:a})?n||QT.free:nd([`preview`])?t===`accountPlan`&&i?.action===`cancel`?this.getRetentionPreviewMember({site:e,offers:r}):QT.preview:QT.paid:null:n}getContextFromState(){let{site:e,member:t,offers:n,action:r,actionErrorMessage:i,page:a,lastPage:o,showPopup:s,pageQuery:c,pageData:l,popupNotification:u,notification:d,customSiteUrl:f,dir:p,scrollbarWidth:m,otcRef:h,inboxLinks:g,customFields:_,fieldErrors:v}=this.state,y=this.getContextPage({site:e,page:a,member:t}),b=this.getContextMember({site:e,page:y,member:t,offers:n,pageData:l,customSiteUrl:f});return{api:this.GhostApi,site:e,offers:n,action:r,actionErrorMessage:i,brandColor:this.getAccentColor(),page:y,pageQuery:c,pageData:l,member:b,customFields:_,fieldErrors:v,lastPage:o,showPopup:s,popupNotification:u,notification:d,customSiteUrl:f,dir:p,scrollbarWidth:m,otcRef:h,inboxLinks:g,doAction:(e,t)=>this.dispatchAction(e,t)}}getRecommendationButtons(){return document.querySelectorAll(`[data-recommendation]`)||[]}setupRecommendationButtons(){let e=e=>{let t=e.currentTarget.dataset.recommendation;t?this.dispatchAction(`trackRecommendationClicked`,{recommendationId:t}).catch(console.error):console.warn(`[Portal] Invalid usage of data-recommendation attribute`)},t=this.getRecommendationButtons();for(let n of t)n.addEventListener(`click`,e,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll(`a[href*="#/portal"], a[href*="#/share"]`).forEach(eE)}render(){return this.state.initStatus===`success`?(0,q.jsx)($E,{site:this.state.site,children:(0,q.jsxs)(J.Provider,{value:this.getContextFromState(),children:[(0,q.jsx)(MT,{}),(0,q.jsx)(od,{}),(0,q.jsx)(sf,{})]})}):null}},tD=`ghost-portal-root`;function nD(){let e=document.createElement(`div`);e.id=tD,e.setAttribute(`data-testid`,`portal-root`),document.body.appendChild(e)}function rD(){let e=document.querySelector(`script[data-ghost]`);if(e){let t=e.dataset.i18n===`true`;return{siteUrl:e.dataset.ghost,apiKey:e.dataset.key,apiUrl:e.dataset.api,siteI18nEnabled:t,locale:e.dataset.locale}}return{}}function iD(){let e=new URL(window.location.href);e.searchParams.get(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState({},document.title,e.href))}function aD(){let[,e]=window.location.hash.substring(1).split(`?`);new URLSearchParams(e).get(`previewTheme`)===`dark`&&(document.documentElement.dataset.portalPreviewTheme=`dark`)}function oD(){let{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i}=rD(),a=e||window.location.origin;aD(),nD(),iD(),v.render((0,q.jsx)(_.default.StrictMode,{children:(0,q.jsx)(eD,{siteUrl:a,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i})}),document.getElementById(tD))}oD()});
|
|
6139
6139
|
//# sourceMappingURL=portal.min.js.map
|