@tryghost/portal 2.71.61 → 2.71.62
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 +2 -2
- package/umd/portal.min.js.map +1 -1
package/umd/portal.min.js
CHANGED
|
@@ -1560,7 +1560,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1560
1560
|
.gh-portal-datepicker-disabled .gh-portal-datepicker-day-button:hover {
|
|
1561
1561
|
background: none;
|
|
1562
1562
|
}
|
|
1563
|
-
`,P_={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`},F_=6;function I_(e){return e?.closest(`.gh-portal-popup-container`)||e?.ownerDocument?.body||null}function L_(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||0;return n?{top:0,bottom:n}:null}function R_(e){try{let t=(new Intl.Locale(e).getWeekInfo?.()??new Intl.Locale(e).weekInfo)?.firstDay;return t?t%7:0}catch{return 0}}var z_=({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)(q),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(null),y=(0,_.useRef)(null),b=gl(t),x=gl(r),S=gl(i),C=(0,_.useMemo)(()=>{try{return new Intl.DateTimeFormat(c),c}catch{return`en`}},[c]),w=(0,_.useMemo)(()=>({monthCaption:new Intl.DateTimeFormat(C,{month:`long`,year:`numeric`}),weekday:new Intl.DateTimeFormat(C,{weekday:`short`}),day:new Intl.DateTimeFormat(C,{day:`numeric`})}),[C]),T=(0,_.useMemo)(()=>R_(C),[C]),E=(0,_.useCallback)(()=>{let e=h.current,t=I_(e),n=y.current;if(!e||!t||!n)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=L_(e),o=n.offsetHeight,s=a?a.bottom-r.bottom:1/0,c=a?r.top-a.top:0,l=s<o+F_&&c>s;p({top:l?r.top-i.top-F_:r.bottom-i.top+F_,right:i.right-r.right,transform:l?`translateY(-100%)`:void 0})},[]);(0,_.useLayoutEffect)(()=>{u&&E()},[u,E]),(0,_.useEffect)(()=>{if(!u)return;let e=m.current,t=e?.ownerDocument;if(!t)return;let n=t=>{!e.contains(t.target)&&!t.target.closest?.(`.gh-portal-datepicker-popover`)&&d(!1)},r=e=>{e.key===`Escape`&&(d(!1),g.current?.focus())};return t.addEventListener(`pointerdown`,n),t.addEventListener(`keydown`,r),t.addEventListener(`scroll`,E,!0),t.defaultView?.addEventListener(`resize`,E),()=>{t.removeEventListener(`pointerdown`,n),t.removeEventListener(`keydown`,r),t.removeEventListener(`scroll`,E,!0),t.defaultView?.removeEventListener(`resize`,E)}},[u,E]);let D=()=>d(e=>!e),O=e=>{e&&(n(_l(e)),d(!1),g.current?.focus())},k=!!o&&!!t&&t===r;return(0,K.jsxs)(`div`,{ref:m,className:`gh-portal-datepicker`,children:[(0,K.jsxs)(`div`,{ref:h,className:`gh-portal-datepicker-field`,children:[(0,K.jsx)(`input`,{className:`gh-portal-input`+(a?` error`:``)+(k?` 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)}),k&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-datepicker-min-label`,children:o}),(0,K.jsx)(`button`,{ref:g,"aria-expanded":u,"aria-haspopup":`dialog`,"aria-label":s,className:`gh-portal-datepicker-toggle`,"data-testid":`datepicker-toggle`,type:`button`,onClick:D,children:(0,K.jsx)(Sp,{"aria-hidden":`true`,focusable:`false`})})]}),u&&(0,v.createPortal)((0,K.jsx)(`div`,{"aria-label":s,className:`gh-portal-datepicker-popover`,"data-testid":`datepicker-popover`,role:`dialog`,ref:y,style:f||{visibility:`hidden`},children:(0,K.jsx)(M_,{classNames:P_,dir:l,disabled:[...x?[{before:x}]:[],...S?[{after:S}]:[]],endMonth:S,fixedWeeks:!0,formatters:{formatCaption:e=>w.monthCaption.format(e),formatWeekdayName:e=>w.weekday.format(e),formatDay:e=>w.day.format(e)},mode:`single`,selected:b,showOutsideDays:!0,startMonth:x,weekStartsOn:T,onSelect:O})}),I_(h.current))]})},B_=class extends _.Component{static contextType=q;render(){return(0,K.jsx)(K.Fragment,{children:(0,K.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,K.jsx)(`span`,{children:`← `}),` `,G(`Back`)]})})}},V_=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,...e,children:(0,K.jsx)(`g`,{transform:`matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)`,children:(0,K.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 H_({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){let r=t.some(t=>t.id===e?.id);if(e.paid)return(0,K.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper`,"data-testid":`toggle-wrapper`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,K.jsx)(`h3`,{children:e.name}),(0,K.jsx)(`p`,{children:e.description})]}),(0,K.jsx)(`div`,{className:`gh-portal-lock-icon-container`,children:(0,K.jsx)(V_,{className:`gh-portal-lock-icon`,alt:``,title:G(`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,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,K.jsx)(`h3`,{children:e.name}),(0,K.jsx)(`p`,{children:e.description})]}),(0,K.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{id:e.id,label:e.name,onToggle:i,checked:r,presentational:!0})})]})}function U_({subscribedNewsletters:e,setSubscribedNewsletters:t}){let{site:n}=(0,_.useContext)(q);return gu({site:n}).map(n=>(0,K.jsx)(H_,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id))}function W_({pageData:e,onBack:t}){let{brandColor:n,site:r,doAction:i,action:a}=(0,_.useContext)(q),o=gu({site:r}).filter(e=>e.subscribe_on_signup),s=!1;a===`signup:running`&&(s=!0);let c=G(`Continue`),l=!1;a===`signup:failed`&&(c=G(`Retry`),l=!0);let u=a===`signup:running`,[d,f]=(0,_.useState)(o);return(0,K.jsxs)(`div`,{className:`gh-portal-content with-footer gh-portal-newsletter-selection`,children:[(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-text-large`,children:G(`Choose your newsletters`)}),(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`div`,{className:`gh-portal-list`,children:(0,K.jsx)(U_,{subscribedNewsletters:d,setSubscribedNewsletters:f})})}),(0,K.jsx)(`footer`,{className:`gh-portal-action-footer`,children:(0,K.jsxs)(`div`,{style:{width:`100%`},children:[(0,K.jsx)(`div`,{style:{marginBottom:`20px`},children:(0,K.jsx)(hf,{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%`}})}),Wl({site:r})?null:(0,K.jsx)(`div`,{children:(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan`,onClick:()=>{t()},children:(0,K.jsx)(`span`,{children:G(`Choose a different plan`)})})})]})})]})}var G_=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:r=()=>{}})=>e?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(xp,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:r,onChange:n=>t(n,e),onBlur:t=>n(t,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null,K_=class extends _.Component{constructor(e){super(e),this.state={}}render(){let{fields:e,onChange:t,onBlur:n,onKeyDown:r}=this.props;return(0,K.jsx)(K.Fragment,{children:e.map(e=>(0,K.jsx)(G_,{field:e,onChange:t,onBlur:n,onKeyDown:r},e.name))})}},q_=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()),J_=({field:e})=>{if(e.required&&!e.value)switch(e.name){case`name`:case`buyerName`:return G(`Enter your name`);case`email`:return G(`Enter your email address`);default:return G(`Please enter {fieldName}`,{fieldName:e.name})}return e.type===`email`&&!q_(e.value)?G(`Invalid email address`):null},Y_=({fields:e})=>{let t={};return e.forEach(e=>{let n=e.name,r=J_({field:e});t[n]=r}),t},X_=e=>(0,K.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,...e,children:[(0,K.jsx)(`defs`,{children:(0,K.jsx)(`style`,{children:`.inviteicon{fill: currentColor;}`})}),(0,K.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`})]}),Z_=e=>{if(e.currentTarget.contains(e.target)){let t=e.target.closest(`a`);t&&(e.preventDefault(),window.open(t.href,`_blank`))}};function Q_(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 $_(e){if(Array.isArray(e))return e}function ev(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)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 tv(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1563
|
+
`,P_={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`},F_=6;function I_(e){return e?.closest(`.gh-portal-popup-container`)||e?.ownerDocument?.body||null}function L_(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||0;return n?{top:0,bottom:n}:null}function R_(e){try{let t=(new Intl.Locale(e).getWeekInfo?.()??new Intl.Locale(e).weekInfo)?.firstDay;return t?t%7:0}catch{return 0}}var z_=({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)(q),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(null),y=(0,_.useRef)(null),b=gl(t),x=gl(r),S=gl(i),C=(0,_.useMemo)(()=>{try{return new Intl.DateTimeFormat(c),c}catch{return`en`}},[c]),w=(0,_.useMemo)(()=>({monthCaption:new Intl.DateTimeFormat(C,{month:`long`,year:`numeric`}),weekday:new Intl.DateTimeFormat(C,{weekday:`short`}),day:new Intl.DateTimeFormat(C,{day:`numeric`})}),[C]),T=(0,_.useMemo)(()=>R_(C),[C]),E=(0,_.useCallback)(()=>{let e=h.current,t=I_(e),n=y.current;if(!e||!t||!n)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=L_(e),o=n.offsetHeight,s=a?a.bottom-r.bottom:1/0,c=a?r.top-a.top:0,l=s<o+F_&&c>s;p({top:l?r.top-i.top-F_:r.bottom-i.top+F_,right:i.right-r.right,transform:l?`translateY(-100%)`:void 0})},[]);(0,_.useLayoutEffect)(()=>{u&&E()},[u,E]),(0,_.useEffect)(()=>{if(!u)return;let e=m.current,t=e?.ownerDocument;if(!t)return;let n=t=>{!e.contains(t.target)&&!t.target.closest?.(`.gh-portal-datepicker-popover`)&&d(!1)},r=e=>{e.key===`Escape`&&(d(!1),g.current?.focus())};return t.addEventListener(`pointerdown`,n),t.addEventListener(`keydown`,r),t.addEventListener(`scroll`,E,!0),t.defaultView?.addEventListener(`resize`,E),()=>{t.removeEventListener(`pointerdown`,n),t.removeEventListener(`keydown`,r),t.removeEventListener(`scroll`,E,!0),t.defaultView?.removeEventListener(`resize`,E)}},[u,E]);let D=()=>d(e=>!e),O=e=>{e&&(n(_l(e)),d(!1),g.current?.focus())},k=!!o&&!!t&&t===r;return(0,K.jsxs)(`div`,{ref:m,className:`gh-portal-datepicker`,children:[(0,K.jsxs)(`div`,{ref:h,className:`gh-portal-datepicker-field`,children:[(0,K.jsx)(`input`,{className:`gh-portal-input`+(a?` error`:``)+(k?` 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)}),k&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-datepicker-min-label`,children:o}),(0,K.jsx)(`button`,{ref:g,"aria-expanded":u,"aria-haspopup":`dialog`,"aria-label":s,className:`gh-portal-datepicker-toggle`,"data-testid":`datepicker-toggle`,type:`button`,onClick:D,children:(0,K.jsx)(Sp,{"aria-hidden":`true`,focusable:`false`})})]}),u&&(0,v.createPortal)((0,K.jsx)(`div`,{"aria-label":s,className:`gh-portal-datepicker-popover`,"data-testid":`datepicker-popover`,role:`dialog`,ref:y,style:f||{visibility:`hidden`},children:(0,K.jsx)(M_,{classNames:P_,dir:l,defaultMonth:b||x,disabled:[...x?[{before:x}]:[],...S?[{after:S}]:[]],endMonth:S,fixedWeeks:!0,formatters:{formatCaption:e=>w.monthCaption.format(e),formatWeekdayName:e=>w.weekday.format(e),formatDay:e=>w.day.format(e)},mode:`single`,selected:b,showOutsideDays:!0,startMonth:x,weekStartsOn:T,onSelect:O})}),I_(h.current))]})},B_=class extends _.Component{static contextType=q;render(){return(0,K.jsx)(K.Fragment,{children:(0,K.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,K.jsx)(`span`,{children:`← `}),` `,G(`Back`)]})})}},V_=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,...e,children:(0,K.jsx)(`g`,{transform:`matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)`,children:(0,K.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 H_({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){let r=t.some(t=>t.id===e?.id);if(e.paid)return(0,K.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper`,"data-testid":`toggle-wrapper`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,K.jsx)(`h3`,{children:e.name}),(0,K.jsx)(`p`,{children:e.description})]}),(0,K.jsx)(`div`,{className:`gh-portal-lock-icon-container`,children:(0,K.jsx)(V_,{className:`gh-portal-lock-icon`,alt:``,title:G(`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,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail gh-portal-list-big`,children:[(0,K.jsx)(`h3`,{children:e.name}),(0,K.jsx)(`p`,{children:e.description})]}),(0,K.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{id:e.id,label:e.name,onToggle:i,checked:r,presentational:!0})})]})}function U_({subscribedNewsletters:e,setSubscribedNewsletters:t}){let{site:n}=(0,_.useContext)(q);return gu({site:n}).map(n=>(0,K.jsx)(H_,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id))}function W_({pageData:e,onBack:t}){let{brandColor:n,site:r,doAction:i,action:a}=(0,_.useContext)(q),o=gu({site:r}).filter(e=>e.subscribe_on_signup),s=!1;a===`signup:running`&&(s=!0);let c=G(`Continue`),l=!1;a===`signup:failed`&&(c=G(`Retry`),l=!0);let u=a===`signup:running`,[d,f]=(0,_.useState)(o);return(0,K.jsxs)(`div`,{className:`gh-portal-content with-footer gh-portal-newsletter-selection`,children:[(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-text-large`,children:G(`Choose your newsletters`)}),(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`div`,{className:`gh-portal-list`,children:(0,K.jsx)(U_,{subscribedNewsletters:d,setSubscribedNewsletters:f})})}),(0,K.jsx)(`footer`,{className:`gh-portal-action-footer`,children:(0,K.jsxs)(`div`,{style:{width:`100%`},children:[(0,K.jsx)(`div`,{style:{marginBottom:`20px`},children:(0,K.jsx)(hf,{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%`}})}),Wl({site:r})?null:(0,K.jsx)(`div`,{children:(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan`,onClick:()=>{t()},children:(0,K.jsx)(`span`,{children:G(`Choose a different plan`)})})})]})})]})}var G_=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:r=()=>{}})=>e?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(xp,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:r,onChange:n=>t(n,e),onBlur:t=>n(t,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null,K_=class extends _.Component{constructor(e){super(e),this.state={}}render(){let{fields:e,onChange:t,onBlur:n,onKeyDown:r}=this.props;return(0,K.jsx)(K.Fragment,{children:e.map(e=>(0,K.jsx)(G_,{field:e,onChange:t,onBlur:n,onKeyDown:r},e.name))})}},q_=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()),J_=({field:e})=>{if(e.required&&!e.value)switch(e.name){case`name`:case`buyerName`:return G(`Enter your name`);case`email`:return G(`Enter your email address`);default:return G(`Please enter {fieldName}`,{fieldName:e.name})}return e.type===`email`&&!q_(e.value)?G(`Invalid email address`):null},Y_=({fields:e})=>{let t={};return e.forEach(e=>{let n=e.name,r=J_({field:e});t[n]=r}),t},X_=e=>(0,K.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,...e,children:[(0,K.jsx)(`defs`,{children:(0,K.jsx)(`style`,{children:`.inviteicon{fill: currentColor;}`})}),(0,K.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`})]}),Z_=e=>{if(e.currentTarget.contains(e.target)){let t=e.target.closest(`a`);t&&(e.preventDefault(),window.open(t.href,`_blank`))}};function Q_(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 $_(e){if(Array.isArray(e))return e}function ev(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)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 tv(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1564
1564
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nv(e,t){return $_(e)||ev(e,t)||rv(e,t)||tv()}function rv(e,t){if(e){if(typeof e==`string`)return Q_(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)?Q_(e,t):void 0}}var iv=Object.entries,av=Object.setPrototypeOf,ov=Object.isFrozen,sv=Object.getPrototypeOf,cv=Object.getOwnPropertyDescriptor,lv=Object.freeze,uv=Object.seal,dv=Object.create,fv=typeof Reflect<`u`&&Reflect,pv=fv.apply,mv=fv.construct;lv||=function(e){return e},uv||=function(e){return e},pv||=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)},mv||=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 hv=Fv(Array.prototype.forEach),gv=Fv(Array.prototype.lastIndexOf),_v=Fv(Array.prototype.pop),vv=Fv(Array.prototype.push),yv=Fv(Array.prototype.splice),bv=Array.isArray,xv=Fv(String.prototype.toLowerCase),Sv=Fv(String.prototype.toString),Cv=Fv(String.prototype.match),wv=Fv(String.prototype.replace),Tv=Fv(String.prototype.indexOf),Ev=Fv(String.prototype.trim),Dv=Fv(Number.prototype.toString),Ov=Fv(Boolean.prototype.toString),kv=typeof BigInt>`u`?null:Fv(BigInt.prototype.toString),Av=typeof Symbol>`u`?null:Fv(Symbol.prototype.toString),jv=Fv(Object.prototype.hasOwnProperty),Mv=Fv(Object.prototype.toString),Nv=Fv(RegExp.prototype.test),Pv=Iv(TypeError);function Fv(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 pv(e,t,r)}}function Iv(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return mv(e,n)}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xv;if(av&&av(e,null),!bv(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ov(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Lv(e){for(let t=0;t<e.length;t++)jv(e,t)||(e[t]=null);return e}function Rv(e){let t=dv(null);for(let r of iv(e)){var n=nv(r,2);let i=n[0],a=n[1];jv(e,i)&&(bv(a)?t[i]=Lv(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Rv(a):t[i]=a)}return t}function zv(e){switch(typeof e){case`string`:return e;case`number`:return Dv(e);case`boolean`:return Ov(e);case`bigint`:return kv?kv(e):`0`;case`symbol`:return Av?Av(e):`Symbol()`;case`undefined`:return Mv(e);case`function`:case`object`:{if(e===null)return Mv(e);let t=e,n=Bv(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Mv(e)}return Mv(e)}default:return Mv(e)}}function Bv(e,t){for(;e!==null;){let n=cv(e,t);if(n){if(n.get)return Fv(n.get);if(typeof n.value==`function`)return Fv(n.value)}e=sv(e)}function n(){return null}return n}function Vv(e){try{return Nv(e,``),!0}catch{return!1}}var Hv=lv(`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(`.`)),Uv=lv(`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(`.`)),Wv=lv([`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`]),Gv=lv([`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`]),Kv=lv(`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(`.`)),qv=lv([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Jv=lv([`#text`]),Yv=lv(`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(`.`)),Xv=lv(`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.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.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(`.`)),Zv=lv(`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(`.`)),Qv=lv([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),$v=uv(/{{[\w\W]*|^[\w\W]*}}/g),ey=uv(/<%[\w\W]*|^[\w\W]*%>/g),ty=uv(/\${[\w\W]*/g),ny=uv(/^data-[\-\w.\u00B7-\uFFFF]+$/),ry=uv(/^aria-[\-\w]+$/),iy=uv(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ay=uv(/^(?:\w+script|data):/i),oy=uv(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sy=uv(/^html$/i),cy=uv(/^[a-z][.\w]*(-[.\w]+)+$/i),ly=uv(/<[/\w!]/g),uy=uv(/<[/\w]/g),dy=uv(/<\/no(script|embed|frames)/i),fy=uv(/\/>/i),py={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},my=function(){return typeof window>`u`?null:window},hy=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}},gy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_y=function(e,t,n,r){return jv(e,t)&&bv(e[t])?$(r.base?Rv(r.base):{},e[t],r.transform):n};function vy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:my(),t=e=>vy(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==py.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=Bv(d,`cloneNode`),p=Bv(d,`remove`),m=Bv(d,`nextSibling`),h=Bv(d,`childNodes`),g=Bv(d,`parentNode`),_=Bv(d,`shadowRoot`),v=Bv(d,`attributes`),y=o&&o.prototype?Bv(o.prototype,`nodeType`):null,b=o&&o.prototype?Bv(o.prototype,`nodeName`):null,x=o&&o.prototype?Bv(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,w,T=!1,E=0,D=function(){if(E>0)throw Pv(`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.`)},O=function(e){D(),E++;try{return S.createHTML(e)}finally{E--}},k=function(e){D(),E++;try{return S.createScriptURL(e)}finally{E--}},ee=function(){return T||=(w=hy(u,i),!0),w},te=n,ne=te.implementation,re=te.createNodeIterator,ie=te.createDocumentFragment,ae=te.getElementsByTagName,A=r.importNode,j=gy();t.isSupported=typeof iv==`function`&&typeof g==`function`&&ne&&ne.createHTMLDocument!==void 0;let oe=$v,se=ey,ce=ty,le=ny,ue=ry,de=ay,fe=oy,pe=cy,me=iy,M=null,he=$({},[...Hv,...Uv,...Wv,...Kv,...Jv]),N=null,ge=$({},[...Yv,...Xv,...Zv,...Qv]),P=Object.seal(dv(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}})),_e=null,ve=null,ye=Object.seal(dv(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,xe=!0,Se=!1,Ce=!0,we=!1,Te=!0,Ee=!1,F=!1,De=null,Oe=null,ke=!1,Ae=!1,je=!1,Me=!1,Ne=!0,Pe=!1,Fe=`user-content-`,Ie=!0,Le=!1,Re={},ze=null,Be=$({},`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(`.`)),Ve=null,He=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ue=null,We=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ge=`http://www.w3.org/1998/Math/MathML`,Ke=`http://www.w3.org/2000/svg`,qe=`http://www.w3.org/1999/xhtml`,Je=qe,Ye=!1,Xe=null,Ze=$({},[Ge,Ke,qe],Sv),Qe=lv([`mi`,`mo`,`mn`,`ms`,`mtext`]),$e=$({},Qe),et=lv([`annotation-xml`]),tt=$({},et),nt=$({},[`title`,`style`,`font`,`a`,`script`]),rt=null,it=[`application/xhtml+xml`,`text/html`],I=null,at=null,ot=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(at&&at===e)return;(!e||typeof e!=`object`)&&(e={}),e=Rv(e),rt=it.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,I=rt===`application/xhtml+xml`?Sv:xv,M=_y(e,`ALLOWED_TAGS`,he,{transform:I}),N=_y(e,`ALLOWED_ATTR`,ge,{transform:I}),Xe=_y(e,`ALLOWED_NAMESPACES`,Ze,{transform:Sv}),Ue=_y(e,`ADD_URI_SAFE_ATTR`,We,{transform:I,base:We}),Ve=_y(e,`ADD_DATA_URI_TAGS`,He,{transform:I,base:He}),ze=_y(e,`FORBID_CONTENTS`,Be,{transform:I}),_e=_y(e,`FORBID_TAGS`,Rv({}),{transform:I}),ve=_y(e,`FORBID_ATTR`,Rv({}),{transform:I}),Re=jv(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Rv(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,xe=e.ALLOW_DATA_ATTR!==!1,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=e.SAFE_FOR_TEMPLATES||!1,Te=e.SAFE_FOR_XML!==!1,Ee=e.WHOLE_DOCUMENT||!1,Ae=e.RETURN_DOM||!1,je=e.RETURN_DOM_FRAGMENT||!1,Me=e.RETURN_TRUSTED_TYPE||!1,ke=e.FORCE_BODY||!1,Ne=e.SANITIZE_DOM!==!1,Pe=e.SANITIZE_NAMED_PROPS||!1,Ie=e.KEEP_CONTENT!==!1,Le=e.IN_PLACE||!1,me=Vv(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:iy,Je=typeof e.NAMESPACE==`string`?e.NAMESPACE:qe,$e=jv(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Rv(e.MATHML_TEXT_INTEGRATION_POINTS):$({},Qe),tt=jv(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Rv(e.HTML_INTEGRATION_POINTS):$({},et);let t=jv(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Rv(e.CUSTOM_ELEMENT_HANDLING):dv(null);if(P=dv(null),jv(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(P.tagNameCheck=t.tagNameCheck),jv(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(P.attributeNameCheck=t.attributeNameCheck),jv(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),uv(P),we&&(xe=!1),je&&(Ae=!0),Re&&(M=$({},Jv),N=dv(null),Re.html===!0&&($(M,Hv),$(N,Yv)),Re.svg===!0&&($(M,Uv),$(N,Xv),$(N,Qv)),Re.svgFilters===!0&&($(M,Wv),$(N,Xv),$(N,Qv)),Re.mathMl===!0&&($(M,Kv),$(N,Zv),$(N,Qv))),ye.tagCheck=null,ye.attributeCheck=null,jv(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?ye.tagCheck=e.ADD_TAGS:bv(e.ADD_TAGS)&&(M===he&&(M=Rv(M)),$(M,e.ADD_TAGS,I))),jv(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?ye.attributeCheck=e.ADD_ATTR:bv(e.ADD_ATTR)&&(N===ge&&(N=Rv(N)),$(N,e.ADD_ATTR,I))),jv(e,`ADD_URI_SAFE_ATTR`)&&bv(e.ADD_URI_SAFE_ATTR)&&$(Ue,e.ADD_URI_SAFE_ATTR,I),jv(e,`FORBID_CONTENTS`)&&bv(e.FORBID_CONTENTS)&&(ze===Be&&(ze=Rv(ze)),$(ze,e.FORBID_CONTENTS,I)),jv(e,`ADD_FORBID_CONTENTS`)&&bv(e.ADD_FORBID_CONTENTS)&&(ze===Be&&(ze=Rv(ze)),$(ze,e.ADD_FORBID_CONTENTS,I)),Ie&&(M[`#text`]=!0),Ee&&$(M,[`html`,`head`,`body`]),M.table&&($(M,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Pv(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Pv(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=O(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=ee()),S&&typeof C==`string`&&(C=O(``)));lv&&lv(e),at=e},lt=$({},[...Uv,...Wv,...Gv]),ut=$({},[...Kv,...qv]),dt=function(e,t,n){return t.namespaceURI===qe?e===`svg`:t.namespaceURI===Ge?e===`svg`&&(n===`annotation-xml`||$e[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===qe?e===`math`:t.namespaceURI===Ke?e===`math`&&tt[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===Ke&&!tt[n]||t.namespaceURI===Ge&&!$e[n]?!1:!ut[e]&&(nt[e]||!lt[e])},mt=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Je,tagName:`template`});let n=xv(e.tagName),r=xv(t.tagName);return Xe[e.namespaceURI]?e.namespaceURI===Ke?dt(n,t,r):e.namespaceURI===Ge?ft(n,t,r):e.namespaceURI===qe?pt(n,t,r):!!(rt===`application/xhtml+xml`&&Xe[e.namespaceURI]):!1},ht=function(e){vv(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Pv(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e){yt(e);let t=h(e);if(t){let e=[];hv(t,t=>{vv(e,t)}),hv(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},_t=function(e,n){try{vv(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{vv(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ae||je)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}},vt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||N[I(i)]))try{e.removeAttribute(i)}catch{}}},yt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===py.element&&vt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},bt=function(e){if(!Te)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===py.processingInstruction||n===py.comment&&Nv(uy,e.data)){try{p(e)}catch{}continue}if(n===py.element){let t=e,n=I(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},xt=function(e){let t=null,r=null;if(ke)e=`<remove></remove>`+e;else{let t=Cv(e,/^[\r\n\t ]+/);r=t&&t[0]}rt===`application/xhtml+xml`&&Je===qe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?O(e):e;if(Je===qe)try{t=new l().parseFromString(i,rt)}catch{}if(!t||!t.documentElement){t=ne.createDocument(Je,`template`,null);try{t.documentElement.innerHTML=Ye?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Je===qe?ae.call(t,Ee?`html`:`body`)[0]:Ee?t.documentElement:a},St=function(e){let t=x?x(e):e.ownerDocument;return re.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ct=function(e){return e=wv(e,oe,` `),e=wv(e,se,` `),e=wv(e,ce,` `),e},wt=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=re.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=Ct(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&hv(i,e=>{Et(e.content)&&wt(e.content)})},Tt=function(e){let t=b?b(e):null;return typeof t!=`string`||I(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Et=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===py.documentFragment}catch{return!1}},Dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function Ot(e,n,r){e.length!==0&&hv(e,e=>{e.call(t,n,r,at)})}let kt=function(e,t){return!!(Te&&e.hasChildNodes()&&!Dt(e.firstElementChild)&&Nv(ly,e.textContent)&&Nv(ly,e.innerHTML)||Te&&e.namespaceURI===qe&&t===`style`&&Dt(e.firstElementChild)||e.nodeType===py.processingInstruction||Te&&e.nodeType===py.comment&&Nv(uy,e.data))},At=function(e,t,n){if(!_e[t]&&Ft(t)&&(P.tagNameCheck instanceof RegExp&&Nv(P.tagNameCheck,t)||P.tagNameCheck instanceof Function&&P.tagNameCheck(t)))return!1;if(Ie&&!ze[t]){let t=g(e),r=h(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,m(e))}}}return ht(e),!0},jt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Rv(t):t},Mt=function(e,n){if(Ot(j.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return Le&&yt(e),!0;if(Tt(e))return ht(e),!0;let r=I(b?b(e):e.nodeName);if(M=jt(j.uponSanitizeElement,M,he,De),Ot(j.uponSanitizeElement,e,{tagName:r,allowedTags:M}),e!==n&&g(e)===null)return Le&&yt(e),!0;if(kt(e,r))return ht(e),!0;if(_e[r]||!(ye.tagCheck instanceof Function&&ye.tagCheck(r))&&!M[r]){let t=At(e,r,n);return t===!1&&Ot(j.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===py.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Nv(dy,e.innerHTML))return ht(e),!0;if(we&&e.nodeType===py.text){let n=Ct(e.textContent);e.textContent!==n&&(vv(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ot(j.afterSanitizeElements,e,null),!1},Nt=function(e,t,r){if(ve[t]||Te&&t===`patchsrc`||Te&&t===`for`&&e!==`label`&&e!==`output`||Ne&&(t===`id`||t===`name`)&&(r in n||r in ot))return!1;let i=N[t]||ye.attributeCheck instanceof Function&&ye.attributeCheck(t,e);if(!(xe&&Nv(le,t))&&!(be&&Nv(ue,t))){if(!i){if(!(Ft(e)&&(P.tagNameCheck instanceof RegExp&&Nv(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&Nv(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&Nv(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r))))return!1}else if(!Ue[t]&&!Nv(me,wv(r,fe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Tv(r,`data:`)===0&&Ve[e])&&!(Se&&!Nv(de,wv(r,fe,``)))&&r)return!1}return!0},Pt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ft=function(e){return!Pt[xv(e)]&&Nv(pe,e)},It=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},Lt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Tt(e)?ht(e):_v(t.removed)}catch{_t(n,e)}},Rt=function(e){Ot(j.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Tt(e))return;N=jt(j.uponSanitizeAttribute,N,ge,Oe);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},r=t.length,i=I(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=I(o),u=c,d=o===`value`?u:Ev(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Ot(j.uponSanitizeAttribute,e,n),d=n.attrValue,Pe&&(l===`id`||l===`name`)&&Tv(d,Fe)!==0&&(_t(o,e),d=Fe+d),Te&&Nv(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){_t(o,e);continue}if(l===`attributename`&&Cv(d,`href`)){_t(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){_t(o,e);continue}if(!Ce&&Nv(fy,d)){_t(o,e);continue}if(we&&(d=Ct(d)),!Nt(i,l,d)){_t(o,e);continue}d=It(i,l,s,d),d!==u&&Lt(e,o,s,d)}}Ot(j.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=St(e);for(Ot(j.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ot(j.uponSanitizeShadowNode,t,null),Mt(t,e),Rt(t),Et(t.content)&&zt(t.content),(y?y(t):t.nodeType)===py.element){let e=_(t);Et(e)&&(Bt(e),zt(e))}Ot(j.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===py.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&I(e)===`template`){let e=n.content;Et(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Et(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(Ye=!e,Ye&&(e=`<!-->`),typeof e!=`string`&&!Dt(e)&&(e=zv(e),typeof e!=`string`))throw Pv(`dirty is not a string, aborting`);if(!t.isSupported)return e;F?(M=De,N=Oe):ct(n),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(M=Rv(M)),j.uponSanitizeAttribute.length>0&&(N=Rv(N)),t.removed=[];let c=Le&&typeof e!=`string`&&Dt(e);if(c){bt(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=I(t);if(!M[n]||_e[n])throw gt(e),Pv(`root node is forbidden and cannot be sanitized in-place`)}if(Tt(e))throw gt(e),Pv(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw gt(e),t}}else if(Dt(e))i=xt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===py.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(a);else{if(!Ae&&!we&&!Ee&&e.indexOf(`<`)===-1)return S&&Me?O(e):e;if(i=xt(e),!i)return Ae?null:Me?C:``}i&&ke&&ht(i.firstChild);let l=c?e:i;try{let e=St(l);for(;o=e.nextNode();)Mt(o,l),Rt(o),Et(o.content)&&zt(o.content)}catch(n){throw c&&(gt(e),hv(t.removed,e=>{e.element&&yt(e.element)})),n}if(c)return hv(t.removed,e=>{e.element&&yt(e.element)}),we&&wt(e),e;if(Ae){if(we&&wt(i),je)for(s=ie.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(N.shadowroot||N.shadowrootmode)&&(s=A.call(r,s,!0)),s}let u=Ee?i.outerHTML:i.innerHTML;return Ee&&M[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Nv(sy,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
1565
1565
|
`+u),we&&(u=Ct(u)),S&&Me?O(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(e),F=!0,De=M,Oe=N},t.clearConfig=function(){at=null,F=!1,De=null,Oe=null,S=w,C=``},t.isValidAttribute=function(e,t,n){at||ct({});let r=I(e),i=I(t);return Nt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&jv(j,e)&&vv(j[e],t)},t.removeHook=function(e,t){if(jv(j,e)){if(t!==void 0){let n=gv(j[e],t);return n===-1?void 0:yv(j[e],n,1)[0]}return _v(j[e])}},t.removeHooks=function(e){jv(j,e)&&(j[e]=[])},t.removeAllHooks=function(){j=gy()},t}var yy=vy();function by(e){return e?yy.sanitize(e,{ALLOWED_TAGS:[`a`,`b`,`i`,`em`,`strong`,`p`,`br`,`ul`,`ol`,`li`,`span`],ALLOWED_ATTR:[`href`,`target`,`rel`,`class`]}):``}function xy(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 Sy=`
|
|
1566
1566
|
.gh-portal-back-sitetitle {
|
|
@@ -6239,5 +6239,5 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
6239
6239
|
}
|
|
6240
6240
|
`;function $b({site:e}){return ll+Xb+xf+ap+yp+N_+Rf({site:e})+yf+pf+_f+tl+Zy+Sy+ib({site:e})+Gd+eb+Zb+Qb+ub+_b+``+yb+(e?.labs?.giftSubCustomization?Cb:xb)+(e?.labs?.giftSubCustomization?Tb:Ky)+Ib+(e?.labs?.giftSubCustomization?jb:Db)+Bb+Kb+qb}var ex=class extends _.Component{static contextType=q;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:Y_({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:G(`jamie@example.com`),label:G(`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=G(n?`Sending login link...`:`Continue`),i=!!n;return e===`signin:failed`&&(r=G(`Retry`),t=!0),(0,K.jsx)(hf,{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,K.jsxs)(`div`,{className:`gh-portal-signup-message`,children:[(0,K.jsx)(`div`,{children:G(`Don't have an account?`)}),(0,K.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,K.jsx)(`span`,{children:G(`Sign up`)})})]})}renderForm(){let{site:e}=this.context,t=$l({site:e})&&Yl({site:e});return Ql({site:e})?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(K_,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)})}),(0,K.jsxs)(`footer`,{className:`gh-portal-signin-footer`,children:[this.renderSubmitButton(),t&&this.renderSignupMessage()]})]}):(0,K.jsx)(`section`,{children:(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`p`,{className:`gh-portal-members-disabled-notification`,"data-testid":`members-disabled-notification-text`,children:G(`Memberships unavailable, contact the owner for access.`)})})})}renderSiteIcon(){let e={},{site:t}=this.context,n=t.icon;return n?(e.backgroundImage=`url(${n})`,(0,K.jsx)(`img`,{className:`gh-portal-signup-logo`,src:n,alt:this.context.site.title})):Ql({site:t})?null:(0,K.jsx)(X_,{className:`gh-portal-icon gh-portal-icon-invitation`})}renderSiteTitle(){let{site:e}=this.context,t=e.title;return Ql({site:e})?(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Sign in`)}):(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:t})}renderFormHeader(){return(0,K.jsxs)(`header`,{className:`gh-portal-signin-header`,children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Y,{}),(0,K.jsx)(`div`,{className:`gh-portal-logged-out-form-container`,children:(0,K.jsxs)(`div`,{className:`gh-portal-content signin`,children:[this.renderFormHeader(),this.renderForm()]})})]})}},tx=({handleSignout:e,supportAddress:t=``})=>{let n=`mailto:${t}`;return(0,K.jsxs)(`footer`,{className:`gh-portal-account-footer`,children:[(0,K.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,K.jsx)(`li`,{children:(0,K.jsx)(`button`,{"data-test-button":`footer-signout`,className:`gh-portal-btn`,name:`logout`,"aria-label":`logout`,onClick:t=>e(t),children:G(`Sign out`)})})}),(0,K.jsx)(`div`,{className:`gh-portal-account-footerright`,children:(0,K.jsx)(`ul`,{className:`gh-portal-account-footermenu`,children:(0,K.jsx)(`li`,{children:(0,K.jsx)(`a`,{"data-test-link":`footer-support`,className:`gh-portal-btn gh-portal-btn-branded`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:G(`Contact support`)})})})})]})},nx=()=>{let{member:e,brandColor:t}=(0,_.useContext)(q),n=e.avatar_image;return(0,K.jsxs)(`header`,{className:`gh-portal-account-header`,children:[(0,K.jsx)(rl,{gravatar:n,style:{userIcon:{color:t,width:`56px`,height:`56px`,padding:`2px`}}}),(0,K.jsx)(`h2`,{className:`gh-portal-main-title`,children:G(`Your account`)})]})},rx=()=>{let{site:e,action:t,brandColor:n,doAction:r}=(0,_.useContext)(q);if(!$l({site:e})||!Yl({site:e}))return null;let i=[`checkoutPlan:running`].includes(t),a=()=>{r(`switchPage`,{page:`accountPlan`,lastPage:`accountHome`})};return(0,K.jsx)(hf,{dataTestId:`view-plans`,isRunning:i,label:G(`View plans`),onClick:()=>a(),brandColor:n,style:{width:`100%`}})},ix=()=>{let{member:e,site:t}=(0,_.useContext)(q),{paid_members_enabled:n}=t;if(!n||Wl({site:t}))return null;let r=Ol({member:e}),i=kl({member:e});if(i&&!r)return null;if(r){let t=r?.current_period_end,n=Pl({member:e});return jl({member:e})?n?(0,K.jsx)(`div`,{className:`gh-portal-section`,style:{marginBottom:24},children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:G(`Your gift subscription will expire on {expiryDate}`,{expiryDate:n})})}):null:i&&n?(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:G(`Your subscription will expire on {expiryDate}`,{expiryDate:n})})}):r?.cancel_at_period_end||i?null:bu({sub:r})?(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:G(`Your subscription will start on {subscriptionStart}`,{subscriptionStart:dl(r.trial_end_at)})})}):(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:G(`Your subscription will renew on {renewalDate}`,{renewalDate:dl(t)})})})}return(0,K.jsxs)(`div`,{className:`gh-portal-section`,children:[(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-free-ctatext`,children:G(`You currently have a free membership, upgrade to a paid subscription for full access.`)}),(0,K.jsx)(rx,{})]})},ax=()=>{let{member:e,doAction:t,action:n,brandColor:r}=(0,_.useContext)(q),i=Ol({member:e});if(!i||!i.cancel_at_period_end)return null;let a=G(`Resume subscription`),o=[`continueSubscription:running`].includes(n),s=!!o,c=dl(i.current_period_end);return(0,K.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,K.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,K.jsx)(`p`,{children:(0,K.jsx)(Wd,{string:G(`Your subscription has been canceled and will expire on {expiryDate}.`),mapping:{expiryDate:(0,K.jsx)(`strong`,{children:c})}})}),(0,K.jsx)(hf,{onClick:()=>{t(`continueSubscription`,{subscriptionId:i.id})},isRunning:o,disabled:s,isPrimary:!0,brandColor:r,label:a,style:{width:`100%`}})]})})},ox=()=>{let{member:e,site:t,doAction:n,action:r,brandColor:i}=(0,_.useContext)(q);if(!(jl({member:e})&&!Fl({member:e,site:t})&&Zl({site:t}))||!Pl({member:e}))return null;let a=r===`continueGiftSubscription:running`;return(0,K.jsx)(`div`,{className:`gh-portal-cancelcontinue-container`,children:(0,K.jsxs)(`div`,{className:`gh-portal-cancel-banner`,children:[(0,K.jsx)(`p`,{style:{maxWidth:`none`,margin:`0 0 16px`,textAlign:`center`,textWrap:`pretty`},children:G(`Continue with a paid subscription anytime. Your remaining gift period will be added as a free trial.`)}),(0,K.jsx)(hf,{onClick:()=>n(`continueGiftSubscription`),isRunning:a,disabled:a,isPrimary:!0,brandColor:i,label:G(`Continue subscription`),style:{width:`100%`}})]})})},sx=e=>(0,K.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,K.jsx)(`defs`,{children:(0,K.jsx)(`style`,{children:`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}`})}),(0,K.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,K.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`})]}),cx=()=>{let{member:e,site:t,doAction:n}=(0,_.useContext)(q),r=()=>{let t=Ol({member:e});n(`manageBilling`,{subscriptionId:t.id})},i=()=>{Zl({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)}/${G(r)}`}let o=Pl({member:e});if(jl({member:e})&&o)return(0,K.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,children:[(0,K.jsx)(Sf,{className:`gh-portal-account-tagicon`}),(0,K.jsx)(`span`,{children:G(`Gift subscription`)}),(0,K.jsx)(`span`,{className:`gh-portal-account-expiry-separator`,children:`-`}),(0,K.jsx)(`span`,{className:`gh-portal-account-expiry`,children:G(`Expires {expiryDate}`,{expiryDate:o})})]});n&&(a=o?`${G(`Complimentary`)} - ${G(`Expires {expiryDate}`,{expiryDate:o})}`:G(`Complimentary`));let s=``;if(bu({sub:r}))return s=`gh-portal-account-old-price`,(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:s,children:a}),(0,K.jsx)(lx,{subscription:r})]});let c=ux({nextPayment:i});return c&&(s=`gh-portal-account-old-price`),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:s,children:a}),(0,K.jsx)(()=>c?(0,K.jsxs)(`p`,{className:`gh-portal-account-discountcontainer`,"data-testid":`offer-label`,children:[(0,K.jsx)(sx,{className:`gh-portal-account-tagicon`}),(0,K.jsx)(`span`,{children:c})]}):null,{})]})},o=({isPaid:r})=>{let a=jl({member:e});if(a&&!Zl({site:t}))return null;let o=a&&!Fl({member:e,site:t});return Wl({site:t})&&(!r||a&&!o)?null:o?(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),n(`continueGiftSubscription`)},"data-test-button":`continue-gift-subscription`,children:G(`Continue`)}):(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-btn-list`,onClick:e=>{e.stopPropagation(),i(e)},"data-test-button":`change-plan`,children:G(`Change`)})},s=({defaultCardLast4:e})=>e?(0,K.jsx)(`p`,{children:`**** **** **** ${e}`}):null,c=({defaultCardLast4:e})=>{let{action:t}=(0,_.useContext)(q),n=t===`manageBilling:running`?(0,K.jsx)(ff,{className:`gh-portal-billing-button-loader`}):G(`Update`);return(0,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:G(`Billing info & receipts`)}),(0,K.jsx)(s,{defaultCardLast4:e})]}),(0,K.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-billing`,"aria-hidden":`true`,children:n})]})},l=Ol({member:e}),u=kl({member:e}),d=jl({member:e}),f=Al({member:e});if(l||u){let{price:t,default_payment_card_last4:n}=l||{},r=G(`Plan`);return Ul({member:e})&&(r=Ul({member:e})),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsxs)(`h3`,{children:[r,l?.cancel_at_period_end&&(0,K.jsx)(`span`,{className:`gh-portal-canceled-badge`,children:G(`Canceled`)})]}),(0,K.jsx)(a,{price:t,isComplimentary:u,subscription:l})]}),(0,K.jsx)(o,{isPaid:f})]}),!u&&!d&&(0,K.jsx)(c,{defaultCardLast4:n})]})}return null};function lx({subscription:e}){return bu({sub:e})?(0,K.jsx)(`p`,{className:`gh-portal-account-discountcontainer`,children:(0,K.jsx)(`div`,{children:(0,K.jsx)(`span`,{children:G(`Free Trial – Ends {trialEnd}`,{trialEnd:dl(e.trial_end_at)})})})}):null}function ux({nextPayment:e}){if(!e)return``;let t=e.discount;if(!t)return``;let n=t.end?G(`Ends {offerEndDate}`,{offerEndDate:dl(t.end)}):G(`Forever`);return`${`${Intl.NumberFormat(`en`,{currency:e.currency,style:`currency`}).format(e.amount/100)}/${G(e.interval)}`}${n?` — ${n}`:``}`}function dx({site:e,member:t}){return Nf({site:e})&&Al({member:t??void 0})&&!jl({member:t??void 0})}function fx(){let{member:e,site:t,doAction:n}=(0,_.useContext)(q);if(!dx({site:t,member:e}))return null;let r=()=>{n(`switchPage`,{page:`gift`,lastPage:`accountHome`})};return(0,K.jsx)(`div`,{className:`gh-portal-list gh-portal-gift-card`,children:(0,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:G(`Gift membership`)}),(0,K.jsx)(`p`,{children:G(`For a friend or colleague`)})]}),(0,K.jsxs)(`span`,{"aria-hidden":`true`,className:`gh-portal-list-action`,"data-test-button":`give-gift-subscription`,children:[(0,K.jsx)(Sf,{className:`gh-portal-gift-card-icon`}),G(`Buy`)]})]})})}function px(){let{member:e,site:t,doAction:n}=(0,_.useContext)(q),{newsletters:r}=e,i=!!r?.length,a=G(i?`Subscribed`:`Unsubscribed`),o=()=>{let r=gu({site:t}),i=e?.newsletters?.length?[]:r;n(`updateNewsletterPreference`,{newsletters:i})};return(0,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail email-newsletter`,children:[(0,K.jsx)(`h3`,{children:G(`Email newsletter`)}),(0,K.jsxs)(`p`,{children:[a,` `,ku({member:e})&&i&&(0,K.jsx)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:e=>{e.stopPropagation(),n(`switchPage`,{page:`emailReceivingFAQ`,lastPage:`accountHome`})},children:G(`Not receiving emails?`)})]})]}),(0,K.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{dataTestId:`default-newsletter-toggle`,id:`default-newsletter-toggle`,label:G(`Email newsletter`),onToggle:e=>{o(e,i)},checked:i,presentational:!0})})]})}var mx=e=>(0,K.jsxs)(`svg`,{fill:`none`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,...e,children:[(0,K.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,K.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 hx(){return(0,K.jsxs)(`p`,{className:`gh-portal-email-notice`,children:[(0,K.jsx)(mx,{className:`gh-portal-email-notice-icon`}),(0,K.jsx)(`span`,{className:`gh-mobile-only`,children:G(`You're not receiving emails`)}),(0,K.jsx)(`span`,{className:`gh-desktop-only`,children:G(`You're currently not receiving emails`)})]})}function gx(){let{doAction:e,member:t,site:n}=(0,_.useContext)(q),r=vu({member:t}),i=Nl({site:n}),a=nu({site:n}),o=r?`emailSuppressed`:`accountEmail`,s=!i&&!a,c=()=>r||s?(0,K.jsx)(hx,{}):(0,K.jsx)(`p`,{children:G(`Update your preferences`)}),l=()=>{e(`switchPage`,{page:o,lastPage:`accountHome`})};return(0,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:G(`Emails`)}),c()]}),(0,K.jsx)(`span`,{className:`gh-portal-list-action`,"data-test-button":`manage-newsletters`,"aria-hidden":`true`,children:G(`Manage`)})]})}var _x=()=>{let{member:e,site:t}=(0,_.useContext)(q),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=nd(),[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}}},vx=(e,t)=>_u({site:e})&&Nl({site:e})||nu({site:e})||vu({member:t}),yx=e=>!_u({site:e})&&Nl({site:e})&&!nu({site:e}),bx=()=>{let{member:e,doAction:t,site:n}=(0,_.useContext)(q),{name:r,email:i}=e,{transistor:a}=_x(),o=()=>{t(`switchPage`,{page:`accountProfile`,lastPage:`accountHome`})},s=vx(n,e),c=yx(n);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:r||G(`Account`)}),(0,K.jsx)(`p`,{children:i})]}),(0,K.jsx)(`span`,{"data-test-button":`edit-profile`,className:`gh-portal-list-action`,"aria-hidden":`true`,children:G(`Edit`)})]}),(0,K.jsx)(cx,{}),s&&(0,K.jsx)(gx,{}),c&&(0,K.jsx)(px,{}),a.enabled&&(0,K.jsx)(Yb,{hasPodcasts:a.hasPodcasts,memberUuid:a.memberUuid,settings:a.settings})]}),(0,K.jsx)(fx,{})]})},xx=()=>(0,K.jsxs)(`div`,{className:`gh-portal-content gh-portal-account-main`,children:[(0,K.jsx)(Y,{}),(0,K.jsx)(nx,{}),(0,K.jsxs)(`section`,{className:`gh-portal-account-data`,children:[(0,K.jsx)(ix,{}),(0,K.jsx)(ox,{}),(0,K.jsx)(ax,{}),(0,K.jsx)(bx,{})]})]}),Sx=class extends _.Component{static contextType=q;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=Mu({site:t});return!e||!Ql({site:t})?null:(0,K.jsxs)(`div`,{className:`gh-portal-account-wrapper`,children:[(0,K.jsx)(xx,{}),(0,K.jsx)(tx,{onClose:()=>this.context.doAction(`closePopup`),handleSignout:e=>this.handleSignout(e),supportAddress:n})]})}},Cx=class extends _.Component{static contextType=q;constructor(e,t){super(e,t);let{name:n=``,email:r=``}=t.member||{};this.state={name:n,email:r}}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:Y_({fields:this.getInputFields({state:e})})}),()=>{let{email:e,name:t,errors:n}=this.state;n&&Object.values(n).filter(e=>!!e).length>0||(this.context.doAction(`clearPopupNotification`),this.context.doAction(`updateProfile`,{email:e,name:t}))})}renderSaveButton(){let e=this.context.action===`updateProfile:running`,t=G(`Save`);return this.context.action===`updateProfile:failed`&&(t=G(`Retry`)),(0,K.jsx)(hf,{dataTestId:`save-button`,isRunning:e,onClick:e=>this.onProfileSave(e),disabled:!!e,brandColor:this.context.brandColor,label:t,style:{width:`100%`}})}renderDeleteAccountButton(){return(0,K.jsx)(`div`,{style:{cursor:`pointer`,color:`red`},role:`button`,children:G(`Delete account`)})}renderAccountFooter(){return(0,K.jsx)(`footer`,{className:`gh-portal-action-footer`,children:this.renderSaveButton()})}renderHeader(){return(0,K.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,K.jsx)(vf,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:e=>this.onBack(e)}),(0,K.jsx)(`h3`,{className:`gh-portal-main-title`,children:G(`Account settings`)})]})}renderUserAvatar(){return(0,K.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,K.jsx)(rl,{gravatar:this.context.member&&this.context.member.avatar_image,style:{userIcon:{color:`black`,width:`56px`,height:`56px`}}})})}handleInputChange(e,t){let n=t.name;this.setState({[n]:e.target.value})}getInputFields({state:e,fieldNames:t}){let n=e.errors||{},r=[{type:`text`,value:e.name,placeholder:G(`Jamie Larson`),label:G(`Name`),name:`name`,required:!1,errorMessage:n.name||``},{type:`email`,value:e.email,placeholder:G(`jamie@example.com`),label:G(`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(){return(0,K.jsx)(`div`,{className:`gh-portal-section`,children:(0,K.jsx)(K_,{fields:this.getInputFields({state:this.state}),onChange:(e,t)=>this.handleInputChange(e,t),onKeyDown:(e,t)=>this.onKeyDown(e,t)})})}render(){let{member:e}=this.context;return e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[this.renderHeader(),(0,K.jsx)(Y,{}),(0,K.jsx)(`div`,{className:`gh-portal-section`,children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};function wx(){let{brandColor:e,lastPage:t,doAction:n}=(0,_.useContext)(q);return(0,K.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,K.jsx)(vf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,K.jsx)(`h3`,{className:`gh-portal-main-title`,children:G(`Email preferences`)})]})}function Tx({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,K.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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:e.name}),(0,K.jsx)(`p`,{children:e?.description})]}),(0,K.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{id:e.id,label:e.name,onToggle:i,checked:r,dataTestId:`switch-input`,presentational:!0})})]})}function Ex({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){let{doAction:r}=(0,_.useContext)(q),i=!!n,a=(0,_.useRef)(!1);if(!t)return null;let o=async()=>{if(!a.current){a.current=!0;try{await e(!i),r(`showPopupNotification`,{action:`updated:success`,message:G(`Comment preferences updated.`)})}finally{a.current=!1}}};return(0,K.jsxs)(`section`,{className:`gh-portal-list-toggle-wrapper gh-portal-list-clickable`,"data-testid":`comment-toggle`,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,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:G(`Comments`)}),(0,K.jsx)(`p`,{children:G(`Get notified when someone replies to your comment`)})]}),(0,K.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{id:`comments`,label:G(`Comments`),onToggle:o,checked:i,dataTestId:`switch-input`,presentational:!0})})]})}function Dx({updateUpdatesAndAnnouncements:e,canChangeUpdatesAndAnnouncements:t,enableUpdatesAndAnnouncements:n}){let{doAction:r,site:i}=(0,_.useContext)(q),a=(0,_.useRef)(!1);if(!t)return null;let o=async()=>{if(!a.current){a.current=!0;try{await e(!n),r(`showPopupNotification`,{action:`updated:success`,message:G(`Email preferences updated.`)})}finally{a.current=!1}}};return(0,K.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:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,K.jsxs)(`div`,{className:`gh-portal-list-detail`,children:[(0,K.jsx)(`h3`,{children:G(`Updates & announcements`)}),(0,K.jsx)(`p`,{children:G(`Occasional updates from {siteTitle}`,{siteTitle:i?.title})})]}),(0,K.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>e.stopPropagation(),children:(0,K.jsx)(bf,{id:`updates-and-announcements`,label:G(`Updates & announcements`),onToggle:o,checked:n,dataTestId:`switch-input`,presentational:!0})})]})}function Ox({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){let{site:r}=(0,_.useContext)(q),i=gu({site:r});return n?i.map(n=>(0,K.jsx)(Tx,{newsletter:n,subscribedNewsletters:e,setSubscribedNewsletters:t},n?.id)):null}function kx({site:e,isPaid:t}){return t?(0,K.jsx)(`p`,{style:{textAlign:`center`,marginTop:`12px`,marginBottom:`0`,color:`var(--grey6)`},children:G(`Unsubscribing from emails will not cancel your paid subscription to {title}`,{title:e?.title})}):null}function Ax({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,doAction:p,member:m,site:h}=(0,_.useContext)(q),g=(0,_.useRef)(!!n?.length).current,v=d!=null,y=v?d:g,b=c&&!l||!c,x=u&&!y||!u,S=!n?.length&&b&&x;return(0,K.jsxs)(`div`,{className:`gh-portal-content with-footer`,children:[(0,K.jsx)(wx,{}),(0,K.jsx)(Y,{brandColor:f}),(0,K.jsx)(t||(()=>null),{}),(0,K.jsx)(`div`,{className:`gh-portal-section flex`,children:(0,K.jsxs)(`div`,{className:`gh-portal-list`,children:[(0,K.jsx)(Ox,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:e=>{let t=e.map(e=>({id:e.id}));u&&!v?r(t,y):r(t)}}),(0,K.jsx)(Ex,{isCommentsEnabled:c,enableCommentNotifications:l,updateCommentNotifications:i}),(0,K.jsx)(Dx,{canChangeUpdatesAndAnnouncements:u,enableUpdatesAndAnnouncements:y,updateUpdatesAndAnnouncements:a})]})}),(0,K.jsx)(`div`,{className:`gh-portal-btn-unsubscribe`,children:(0,K.jsx)(hf,{isRunning:!1,onClick:()=>{o()},disabled:S,brandColor:f,isPrimary:!1,label:G(`Unsubscribe from all emails`),isDestructive:!0,style:{width:`100%`},dataTestId:`unsubscribe-from-all-emails`})}),(0,K.jsxs)(`footer`,{className:`gh-portal-action-footer`+(ku({member:m})?` gh-feature-suppressions`:``),children:[(0,K.jsx)(`div`,{style:{width:`100%`},children:(0,K.jsx)(kx,{isPaid:s,site:h,subscribedNewsletters:n})}),ku({member:m})&&!S&&(0,K.jsxs)(`div`,{className:`gh-portal-footer-secondary`,children:[(0,K.jsx)(`span`,{className:`gh-portal-footer-secondary-light`,children:G(`Not receiving emails?`)}),(0,K.jsxs)(`button`,{className:`gh-portal-btn-text gh-email-faq-page-button`,onClick:()=>p(`switchPage`,{page:`emailReceivingFAQ`,pageData:{direct:!1}}),children:[G(`Get help`),` `,(0,K.jsx)(`span`,{className:`right-arrow`,children:`→`})]})]})]})]})}function jx(){let{member:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(q),i,a;r&&(i=r.newsletterUuid,a=r.action);let[o,s]=(0,_.useState)(!0),c=gu({site:n}),l=Nl({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,K.jsx)(K.Fragment,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:e?.email})}})})});let t=c?.find(e=>e.uuid===r.newsletterUuid);return t?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${o?`gh-portal-hide`:``}`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:e?.email}),newsletterName:(0,K.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,K.jsx)(Ax,{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:G(`Email preferences updated.`)})},updateCommentNotifications:async e=>{t(`updateNewsletterPreference`,{enableCommentNotifications:e})},updateUpdatesAndAnnouncements:async e=>{t(`updateNewsletterPreference`,{enableUpdatesAndAnnouncements:e})},unsubscribeAll:()=>{f([]),t(`showPopupNotification`,{action:`updated:success`,message:G(`Unsubscribed from all emails.`)});let e={newsletters:[]};p&&(e.enableCommentNotifications=!1),m&&(e.enableUpdatesAndAnnouncements=!1),t(`updateNewsletterPreference`,e)},isPaidMember:Al({member:e}),isCommentsEnabled:p!==`off`,enableCommentNotifications:h,canChangeUpdatesAndAnnouncements:m,enableUpdatesAndAnnouncements:g})}function Mx(){let{site:e}=(0,_.useContext)(q),t=e.icon;return t?(0,K.jsx)(`img`,{className:`gh-portal-unsubscribe-logo`,src:t,alt:e.title}):null}function Nx(){let{site:e}=(0,_.useContext)(q),t=e.title||``;return(0,K.jsxs)(`header`,{className:`gh-portal-header`,children:[(0,K.jsx)(Mx,{}),(0,K.jsx)(`h2`,{className:`gh-portal-publication-title`,children:t})]})}async function Px({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 Fx(){let{site:e,api:t,pageData:n,member:r,doAction:i}=(0,_.useContext)(q),[a,o]=(0,_.useState)(),[s,c]=(0,_.useState)(!0),l=gu({site:e}),u=l.filter(e=>e.subscribe_on_signup),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(u),[h,g]=(0,_.useState)(!1),{comments_enabled:v}=e,y=!!e.labs?.automations,{enable_comment_notifications:b=!1,enable_updates_and_announcements:x}=a||{},S=Nl({site:e}),C=async(e,a)=>{let o={newsletters:e};a!==void 0&&(o.enableUpdatesAndAnnouncements=a),r?i(`updateNewsletterPreference`,o):await Px({api:t,memberUuid:n.uuid,key:n.key,...o}),m(e);let s={action:`updated:success`,message:G(`Email preferences updated.`)};i(`showPopupNotification`,s)},w=async e=>{let a;r?(await i(`updateNewsletterPreference`,{enableCommentNotifications:e}),a={...r,enable_comment_notifications:e}):a=await Px({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:e}),o(a),i(`showPopupNotification`,{action:`updated:success`,message:G(`Comment preferences updated.`)})},T=async e=>{let a;r?(await i(`updateNewsletterPreference`,{enableUpdatesAndAnnouncements:e}),a={...r,enable_updates_and_announcements:e}):a=await Px({api:t,memberUuid:n.uuid,key:n.key,enableUpdatesAndAnnouncements:e}),o(a),i(`showPopupNotification`,{action:`updated:success`,message:G(`Email preferences updated.`)})},E=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}),m([]),o(e),i(`showPopupNotification`,{action:`updated:success`,message:G(`Unsubscribed from all emails.`)})};return(0,_.useEffect)(()=>{(async()=>{let e;try{e=await t.member.newsletters({uuid:n.uuid,key:n.key}),o(e??null),c(!1)}catch(e){console.error(`[PORTAL] Error fetching member newsletters`,e),o(null),c(!1);return}if(e===null)return;let r=e?.newsletters||[];m(r),l?.length===1&&!v&&!n.newsletterUuid?await C([]):n.newsletterUuid?await C(r?.filter(e=>e.uuid!==n.newsletterUuid)):n.comments&&v?await w(!1):n.updatesAndAnnouncements&&y&&await T(!1)})()},[v,y,n.uuid,n.newsletterUuid,n.comments,n.updatesAndAnnouncements,e.url,l?.length]),s?(0,K.jsx)(Hy,{}):a?l?.length===1&&!v&&!h?(0,K.jsxs)(`div`,{className:`gh-portal-content gh-portal-unsubscribe with-footer`,children:[(0,K.jsx)(Y,{}),(0,K.jsx)(Nx,{}),(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Successfully unsubscribed`)}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive this newsletter.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:a?.email})}})}),(0,K.jsx)(`p`,{className:`gh-portal-text-center`,children:(0,K.jsx)(Wd,{string:G(`Didn't mean to do this? Manage your preferences <button>here</button>.`),mapping:{button:(0,K.jsx)(`button`,{className:`gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline`,onClick:()=>{g(!0)}})}})})]})]}):(0,K.jsx)(Ax,{hasNewslettersEnabled:S,notification:()=>{if(n.comments&&v)return(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${d?`gh-portal-hide`:``}`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive emails when someone replies to your comments.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:a?.email})}})})});if(n.updatesAndAnnouncements&&y)return(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${d?`gh-portal-hide`:``}`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive updates & announcements.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:a?.email})}})})});let e=l?.find(e=>e.uuid===n.newsletterUuid);return e?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center gh-portal-header-message ${d?`gh-portal-hide`:``}`,children:(0,K.jsx)(Wd,{string:G(`{memberEmail} will no longer receive {newsletterName} newsletter.`),mapping:{memberEmail:(0,K.jsx)(`strong`,{children:a?.email}),newsletterName:(0,K.jsx)(`strong`,{children:e?.name})}})})}):null},subscribedNewsletters:p,updateSubscribedNewsletters:async(e,t)=>{await C(e,t),f(!0)},updateCommentNotifications:w,updateUpdatesAndAnnouncements:T,unsubscribeAll:async()=>{await E(),f(!0)},isPaidMember:a?.status!==`free`,isCommentsEnabled:v!==`off`,enableCommentNotifications:b,canChangeUpdatesAndAnnouncements:y,enableUpdatesAndAnnouncements:x}):(0,K.jsxs)(`div`,{className:`gh-portal-content gh-portal-feedback with-footer`,children:[(0,K.jsx)(Y,{}),(0,K.jsx)(`div`,{className:`gh-feedback-icon gh-feedback-icon-error`,children:(0,K.jsx)(Jd,{})}),(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`That didn't go to plan`)}),(0,K.jsx)(`div`,{children:(0,K.jsx)(`p`,{className:`gh-portal-text-center`,children:G(`We couldn't unsubscribe you as the email address was not found. Please contact the site owner.`)})}),(0,K.jsx)(hf,{style:{width:`100%`},retry:!1,onClick:()=>i(`closePopup`),disabled:!1,brandColor:`#000000`,label:G(`Close`),isRunning:!1,tabIndex:3,classes:`sticky bottom`})]})}function Ix(){let{brandColor:e,lastPage:t,doAction:n,action:r,site:i}=(0,_.useContext)(q);(0,_.useEffect)(()=>{[`removeEmailFromSuppressionList:success`].includes(r)&&n(`refreshMemberData`),[`removeEmailFromSuppressionList:failed`,`refreshMemberData:failed`].includes(r)&&n(`back`),[`refreshMemberData:success`].includes(r)&&(_u({site:i})||nu({site:i})?(n(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`}),n(`showPopupNotification`,{message:G(`You have been successfully resubscribed`)})):n(`back`))},[r,n,i,G]);let a=[`removeEmailFromSuppressionList:running`,`refreshMemberData:running`].includes(r);return(0,K.jsxs)(`div`,{className:`gh-email-suppressed-page`,children:[(0,K.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,K.jsx)(vf,{brandColor:e,hidden:!t,onClick:()=>{n(`back`)}}),(0,K.jsx)(Y,{})]}),(0,K.jsx)(mx,{className:`gh-email-suppressed-page-icon`}),(0,K.jsxs)(`div`,{className:`gh-email-suppressed-page-text`,children:[(0,K.jsx)(`h3`,{className:`gh-portal-main-title gh-email-suppressed-page-title`,children:G(`Emails disabled`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(hf,{dataTestId:`resubscribe-email`,classes:`gh-portal-confirm-button`,onClick:()=>{n(`removeEmailFromSuppressionList`)},disabled:a,brandColor:e,label:G(`Re-enable emails`),isRunning:a})]})}function Lx(){let{brandColor:e,doAction:t,site:n,pageData:r}=(0,_.useContext)(q),i=`mailto:${Mu({site:n})}`;return(0,K.jsxs)(`div`,{className:`gh-email-suppression-faq`,children:[!(r&&r.direct)&&(0,K.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[(0,K.jsx)(vf,{brandColor:e,onClick:()=>{t(`switchPage`,{page:`emailSuppressed`,lastPage:`accountHome`})}}),(0,K.jsx)(Y,{})]}),(0,K.jsxs)(`div`,{className:`gh-longform`,children:[(0,K.jsx)(`h3`,{children:G(`Why has my email been disabled?`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(`h4`,{children:G(`Spam complaints`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(`p`,{children:G(`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,K.jsx)(`p`,{children:G(`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,K.jsx)(`h4`,{children:G(`Permanent failure (bounce)`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(`p`,{children:G(`In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(`p`,{children:(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-btn-branded no-margin-right`,href:i,onClick:()=>{i&&window.open(i)},children:G(`Need more help? Contact support`)})})]})]})}function Rx(){let{brandColor:e,doAction:t,site:n,lastPage:r,member:i,pageData:a}=(0,_.useContext)(q),o=Mu({site:n}),s=`mailto:${o}`,c=Nu({site:n});return(0,K.jsxs)(`div`,{className:`gh-email-receiving-faq`,children:[(0,K.jsxs)(`header`,{className:`gh-portal-detail-header`,children:[!(a&&a.direct)&&(0,K.jsx)(vf,{brandColor:e,onClick:()=>{r?t(`switchPage`,{page:`accountHome`}):t(`switchPage`,{page:`accountEmail`,lastPage:`accountHome`})}}),(0,K.jsx)(Y,{})]}),(0,K.jsxs)(`div`,{className:`gh-longform`,children:[(0,K.jsx)(`h3`,{children:G(`Help! I'm not receiving emails`)}),(0,K.jsx)(`p`,{children:G(`If you're not receiving the email newsletter you've subscribed to, here are a few things to check.`)}),(0,K.jsx)(`h4`,{children:G(`Verify your email address is correct`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(Wd,{string:G(`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,K.jsx)(`strong`,{children:i.email}),button:(0,K.jsx)(`button`,{className:`gh-portal-btn-text`,onClick:()=>t(`switchPage`,{lastPage:`emailReceivingFAQ`,page:`accountProfile`})})}})}),(0,K.jsx)(`h4`,{children:G(`Check spam & promotions folders`)}),(0,K.jsx)(`p`,{children:G(`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,K.jsx)(`h4`,{children:G(`Create a new contact`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(Wd,{string:G(`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,K.jsx)(`strong`,{children:c})}})}),(0,K.jsx)(`h4`,{children:G(`Check with your mail provider`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(Wd,{string:G(`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,K.jsx)(`strong`,{children:c})}})}),(0,K.jsx)(`h4`,{children:G(`Get in touch for help`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(Wd,{string:G(`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,K.jsx)(`a`,{href:s,onClick:()=>{s&&window.open(s)},children:o})}})})]})]})}var zx=()=>{let[e,t]=(0,_.useState)(!0),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),{member:o,site:s}=(0,_.useContext)(q);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=lb({siteUrl:e});try{let e=await l.member.checkoutDonation({successUrl:i,cancelUrl:c,personalNote:G(`Add a personal note`)});e.url&&window.location.replace(e.url)}catch(e){e.type&&e.type===`DisabledFeatureError`?a(G(`This site is not accepting payments at the moment.`)):r(G(`Something went wrong, please try again later.`)),t(!1)}}s&&s.donations_enabled===!1?(a(G(`This site is not accepting donations at the moment.`)),t(!1)):e()},[]),e?(0,K.jsx)(`div`,{children:(0,K.jsx)(Hy,{})}):n?(0,K.jsx)(Lb,{error:n}):i?(0,K.jsx)(Lb,{error:i}):null};function Bx({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 Vx({key:e}){try{window.sessionStorage.removeItem(e)}catch{}}var Hx=z_,Ux=xp;function Wx({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,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:G(`How would you like to share this gift?`)}),(0,K.jsxs)(`div`,{"aria-label":G(`Delivery method`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:[(0,K.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:G(`Email it to them`)}),(0,K.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:G(`I'll share it myself`)})]})]}),(0,K.jsx)(`div`,{"aria-hidden":t!==`email`,className:`gh-portal-gift-checkout-reveal`,"data-open":t===`email`,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,K.jsx)(Ux,{...p,onChange:e=>d(e.target.value)}),(0,K.jsx)(Ux,{...f,onChange:e=>u(e.target.value)}),(0,K.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,K.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-message`,children:G(`Optional message`)})}),(0,K.jsx)(`textarea`,{className:`gh-portal-input gh-portal-gift-checkout-textarea`,"data-test-input":`gift-message`,id:`gift-message`,maxLength:a,placeholder:G(`Add a short note to go with your gift`),value:r,onChange:e=>l(e.target.value)}),(0,K.jsx)(`div`,{"aria-hidden":r.length===0,className:`gh-portal-gift-checkout-reveal`,"data-open":r.length>0,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,K.jsxs)(`p`,{className:`gh-portal-gift-checkout-message-count`,children:[r.length,`/`,a]})})}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-delivery-date`,children:[(0,K.jsx)(`div`,{className:`gh-portal-input-labelcontainer`,children:(0,K.jsx)(`label`,{className:`gh-portal-input-label`,htmlFor:`gift-delivery-date`,children:G(`Delivery date`)})}),(0,K.jsx)(Hx,{ariaLabel:G(`Delivery date`),hasError:!!e,id:`gift-delivery-date`,max:i,min:o,minLabel:G(`Now`),value:n,onChange:s}),e&&(0,K.jsx)(`p`,{className:`gh-portal-gift-checkout-delivery-error`,children:e})]})]})})})]})}var Gx=`ghost-portal-gift-form-state`;function Kx({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 qx(e,t){return typeof e==`string`&&e.length<=t}function Jx(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`)||!qx(n.buyerEmail,191)||!qx(n.buyerName,191)||typeof n.completed!=`boolean`||![`email`,`link`].includes(r.method)||!qx(i.recipientEmail,191)||!qx(i.recipientName,191)||!qx(i.message,250)||!s?null:t}function Yx(){Vx({key:Gx})}var Xx=xp;function Zx({activeDuration:e,offeredDurations:t,onSelectDuration:n}){return t.length<2?null:(0,K.jsx)(`div`,{"aria-label":G(`Gift duration`),className:`gh-portal-gift-duration-switch`,role:`radiogroup`,children:t.map(t=>{let r=t===e;return(0,K.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:Yd({cadence:`month`,duration:t})},t)})})}function Qx({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,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Gift a membership`)}),(0,K.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:G(`Share a full membership to {siteTitle} with a friend or colleague`,{siteTitle:m})})]}),(p||f)&&(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[p&&(0,K.jsx)(Xx,{...i,onChange:e=>c(e.target.value)}),f&&(0,K.jsx)(Xx,{...r,onChange:e=>s(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-section`,children:[(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-label`,children:G(a?`Membership details`:`Tier`)}),o.length>1?(0,K.jsx)(Zx,{activeDuration:e,offeredDurations:o,onSelectDuration:l}):(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-single-duration`,"data-test-single-duration":!0,children:G(`{duration} membership`,{duration:t})})]}),(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-section`,children:(0,K.jsx)(`div`,{"aria-label":a?void 0:G(`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,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-item`+(r&&!a?` selected`:``),children:[(0,K.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,K.jsx)(`span`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-tier-radio`}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-content`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-tier-heading`,children:[(0,K.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-name`,children:t.name}),(0,K.jsx)(`span`,{className:`gh-portal-gift-checkout-tier-price`,children:h(t,e)})]}),t.description&&(0,K.jsx)(`p`,{className:`gh-portal-gift-checkout-tier-description`,children:t.description})]})]}),i.length>0&&(0,K.jsx)(`div`,{"aria-hidden":!r,className:`gh-portal-gift-checkout-tier-benefits`,"data-open":r,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-tier-benefits-inner`,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-benefits`,children:i.map((e,t)=>{let n=e.id||`benefit-${t}`;return(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-benefit`,children:[(0,K.jsx)(If,{"aria-hidden":`true`,focusable:`false`}),(0,K.jsx)(`span`,{children:e.name})]},n)})})})})]},t.id)})})})]})}var $x=e=>(0,K.jsxs)(`svg`,{width:39,height:27,viewBox:`0 0 39 27`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,K.jsxs)(`g`,{fill:`currentColor`,children:[(0,K.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,K.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]}),(0,K.jsxs)(`g`,{fill:`currentColor`,transform:`translate(21 0)`,children:[(0,K.jsx)(`path`,{d:`M9 0a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z`}),(0,K.jsx)(`path`,{d:`M18 7c0 10-4.8 17.2-13.4 20L3 22.4C9.4 20.2 13 15.6 13 8Z`})]})]}),eS=({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=dl(new Date),v=dl(gl(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,K.jsx)(`strong`,{children:m}),duration:s,strong:(0,K.jsx)(`strong`,{}),tierName:(0,K.jsx)(`strong`,{children:c}),siteTitle:u},w=Zd({buyerName:m,cadence:o,duration:s,siteTitle:u});return(0,K.jsx)(`div`,{className:`gh-portal-gift-email`,children:(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-sheet`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-meta`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-meta-text`,children:[(0,K.jsx)(`div`,{className:`gh-portal-gift-email-from`,children:u}),(0,K.jsx)(`div`,{"aria-hidden":!S,className:`gh-portal-gift-checkout-reveal`,"data-open":!!S,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-to`,children:[(0,K.jsxs)(`span`,{className:`gh-portal-gift-email-meta-label`,children:[G(`To`),`:`]}),(0,K.jsx)(`span`,{className:`gh-portal-gift-email-to-value`,children:S})]})})})]}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-date-stack`,children:[(0,K.jsx)(`div`,{"aria-hidden":a,className:`gh-portal-gift-email-date`,"data-active":!a,children:g}),(0,K.jsx)(`div`,{"aria-hidden":!a,className:`gh-portal-gift-email-date`,"data-active":a,children:x})]})]}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-body`,children:[(0,K.jsx)(`div`,{className:`gh-portal-gift-email-lockup`,children:d?(0,K.jsx)(`img`,{alt:u,className:`gh-portal-gift-email-lockup-icon`,src:d}):(0,K.jsx)(`span`,{className:`gh-portal-gift-email-lockup-title`,children:u})}),(0,K.jsx)(`h1`,{className:`gh-portal-gift-email-subject`,children:G(`A gift, just for you`)}),(0,K.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-reveal`,"data-open":!!f,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,K.jsx)(`p`,{className:`gh-portal-gift-email-greeting`,children:G(`Hi {recipientName},`,{recipientName:f})})})}),(0,K.jsx)(`p`,{className:`gh-portal-gift-email-lede`,children:(0,K.jsx)(Wd,{mapping:C,string:w})}),(0,K.jsx)(`div`,{"aria-hidden":!h,className:`gh-portal-gift-checkout-reveal`,"data-open":!!h,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-reveal-inner`,children:(0,K.jsxs)(`blockquote`,{className:`gh-portal-gift-email-message`,children:[(0,K.jsx)($x,{"aria-hidden":`true`,className:`gh-portal-gift-email-message-mark`,focusable:`false`}),(0,K.jsx)(`p`,{className:`gh-portal-gift-email-message-text`,children:h}),m&&(0,K.jsx)(`p`,{className:`gh-portal-gift-email-message-from`,children:m})]})})}),l.length>0&&(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-benefits`,children:[(0,K.jsx)(`p`,{className:`gh-portal-gift-email-benefits-label`,children:G(`What's included`)}),(0,K.jsx)(`div`,{children:l.map((e,t)=>(0,K.jsxs)(`div`,{className:`gh-portal-gift-email-benefit`,children:[(0,K.jsx)(If,{"aria-hidden":`true`,focusable:`false`}),(0,K.jsx)(`span`,{children:e.name})]},e?.id||`benefit-${t}`))})]})]})]})})},tS=wy,nS=eS;function rS({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,K.jsx)(`div`,{className:`gh-portal-gift-checkout-right`,...i,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-right-panel`,children:(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-stage`,children:[(0,K.jsx)(`div`,{"aria-hidden":f,className:`gh-portal-gift-checkout-stage-item card`,"data-active":!f,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-card-stack`,children:(0,K.jsx)(tS,{cardRef:r,duration:Yd({cadence:`month`,duration:e}),fromName:n.trim(),giftValue:c,siteIcon:p,siteTitle:m,tierName:t.name})})}),(0,K.jsx)(`div`,{"aria-hidden":!f,className:`gh-portal-gift-checkout-stage-item email`,"data-active":f,children:(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-email-stack`,children:(0,K.jsx)(nS,{...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 iS=`ghostPortalGiftHistory`;function aS(){let e=window.history.state;return e&&typeof e==`object`?e:{}}function oS(){let e=aS()[iS];if(!e||typeof e!=`object`||!(`depth`in e))return null;let{depth:t}=e;return typeof t==`number`&&t>0?{depth:t}:null}function sS(e){return e===`delivery`?`#/portal/gift/delivery`:`#/portal/gift`}function cS(){window.dispatchEvent(new HashChangeEvent(`hashchange`))}function lS({step:e,replace:t=!1}){let n=sS(e);if(t){window.history.replaceState(window.history.state,``,n),cS();return}let r=oS(),i=r?{...aS(),[iS]:{depth:r.depth+1}}:window.history.state;window.history.pushState(i,``,n),cS()}function uS(){window.location.hash!==`#/portal/gift`&&window.history.pushState({...aS(),[iS]:{depth:1}},``,`#/portal/gift`)}function dS(){let e=oS();return e?(window.history.go(-e.depth),!0):!1}var fS=Y_,pS=365;function mS(e,t){return Jy(Df(e,t))}function hS(e){return e===`signup`?`#/portal/signup`:e===`accountHome`?`#/portal/account`:e===`accountPlan`?`#/portal/account/plans`:null}var gS=()=>{let{site:e,member:t,brandColor:n,action:r,doAction:i,lastPage:a,pageData:o}=(0,_.useContext)(q),s=o?.giftStep===`delivery`?`delivery`:`plan`,[c,l]=(0,_.useState)(s),[u,d]=Bx({key:Gx,initialState:()=>Kx({buyerName:t?.name||``}),parse:Jx}),[f,p]=(0,_.useState)({}),{cardRef:m,containerProps:h}=Gy(),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`),lS({step:`plan`,replace:!0});return}g.current!==s&&(g.current=s,l(s))},[y.completed,s]);let te=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=requestAnimationFrame(()=>{let e=te.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 ne=()=>{let e=hS(a);!dS()&&e&&window.history.replaceState(window.history.state,``,e),i(`back`)},re=()=>{i(`closePopup`)},ie=e?.portal_default_plan??null,ae=kf({site:e}),A=Pf({availableDurations:ae,portalDefaultPlan:ie,selectedDuration:x}),j=A?Of({site:e,duration:A}):[],oe=x!==null&&ae.includes(x)&&S!==null&&j.some(e=>e.id===S);if((0,_.useEffect)(()=>{!e||!y.completed||oe||(d(e=>({...e,plan:{...e.plan,completed:!1}})),l(`plan`),lS({step:`plan`,replace:!0}))},[y.completed,oe,e]),!e)return(0,K.jsx)(Hy,{});let se=e.icon,ce=e.title||``;if(!A||j.length===0)return(0,K.jsxs)(`div`,{className:`gh-portal-content gift`,children:[(0,K.jsx)(Y,{onClick:re}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-inner`,children:(0,K.jsxs)(`header`,{className:`gh-portal-gift-checkout-header`,children:[(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Gift a membership`)}),(0,K.jsx)(`p`,{className:`gh-portal-gift-checkout-subtitle`,children:G(`Gift subscriptions are not available right now.`)})]})})]}),(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-right`})]})]});let le=j.find(e=>e.id===S)||j[0];if(!le)return null;let ue=j.length===1,de=A===12?{cadence:`year`,duration:1}:{cadence:`month`,duration:A},fe=Xd(de),pe=r===`checkoutGift:running`,me=c===`plan`?!!(f.email||f.buyerName):!!(f.recipientEmail||f.deliveryDate),M=El()||pe||me,he=!!t,N=!(t?.name||``).trim(),ge=!he,P=c===`delivery`&&T===`email`,_e=xl(new Date,e.timezone),ve=vl(_e,pS),ye=ee.type===`scheduled`?ee.date:_e,be={type:`email`,value:C,placeholder:G(`jamie@example.com`),label:G(`Your email`),name:`email`,required:!0,maxLength:191,errorMessage:f.email||``},xe={type:`email`,value:D,placeholder:G(`taylor@example.com`),label:G(`Recipient's email`),name:`recipientEmail`,required:!1,maxLength:191,errorMessage:f.recipientEmail||``},Se={type:`text`,value:w,placeholder:G(`Jamie Larson`),label:G(`Your name`),name:`buyerName`,required:!0,maxLength:191,errorMessage:f.buyerName||``},Ce={type:`text`,value:O,placeholder:G(`Taylor Reid`),label:G(`Recipient's name`),name:`recipientName`,required:!1,maxLength:191,errorMessage:``},we=e=>{p(e=>({...e,email:``})),d(t=>({...t,plan:{...t.plan,buyerEmail:e,completed:!1}}))},Te=e=>{p(e=>({...e,buyerName:``})),d(t=>({...t,plan:{...t.plan,buyerName:e,completed:!1}}))},Ee=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientEmail:e}}}))},F=e=>{p(e=>({...e,recipientEmail:``,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,method:e}}))},De=e=>{p(e=>({...e,deliveryDate:``})),d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,timing:e===_e?{type:`immediate`}:{type:`scheduled`,date:e}}}}))},Oe=e=>{d(t=>({...t,plan:{...t.plan,selectedDuration:e,completed:!1}}))},ke=e=>{d(t=>({...t,plan:{...t.plan,selectedProductId:e,completed:!1}}))},Ae=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,recipientName:e}}}))},je=e=>{d(t=>({...t,delivery:{...t.delivery,emailDraft:{...t.delivery.emailDraft,message:e}}}))},Me=()=>{let e=[];he||e.push({...be,value:C.trim()}),e.push({...Se,value:w.trim()});let t=fS({fields:e}),n=Object.values(t).some(e=>!!e);p(t),!n&&(d(e=>({...e,plan:{...e.plan,selectedDuration:A,selectedProductId:le.id,completed:!0}})),uS(),v.current=!0,l(`delivery`),lS({step:`delivery`}))},Ne=()=>{p({}),l(`plan`),v.current?(v.current=!1,window.history.back()):lS({step:`plan`,replace:!0})};return(0,K.jsxs)(`div`,{ref:te,className:`gh-portal-content gift`,children:[(0,K.jsx)(Y,{onClick:re}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout`,children:[(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-left`,"data-step":c,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`gh-portal-gift-checkout-bg`}),(c===`delivery`||a)&&(0,K.jsx)(B_,{onBack:()=>c===`delivery`?Ne():ne()}),(0,K.jsxs)(`div`,{className:`gh-portal-gift-checkout-inner`,children:[c===`plan`?(0,K.jsx)(Qx,{activeDuration:A,activeDurationLabel:fe,activeProduct:le,buyerEmailField:be,buyerNameField:Se,isSingleTier:ue,offeredDurations:ae,products:j,showBuyerEmail:ge,showBuyerName:N,siteTitle:ce,tierPriceLabel:mS,onBuyerEmailChange:we,onBuyerNameChange:Te,onSelectDuration:Oe,onSelectProduct:ke}):(0,K.jsx)(Wx,{deliveryDateError:f.deliveryDate||``,deliveryMethod:T,effectiveDeliveryDate:ye,giftMessage:k,maxDeliveryDate:ve,maxMessageLength:250,minDeliveryDate:_e,recipientEmailField:xe,recipientNameField:Ce,onChangeDeliveryDate:De,onChangeDeliveryMethod:F,onChangeGiftMessage:je,onChangeRecipientEmail:Ee,onChangeRecipientName:Ae}),(0,K.jsx)(`div`,{className:`gh-portal-gift-checkout-cta-wrapper`,children:(0,K.jsx)(hf,{brandColor:n,classes:`gh-portal-gift-checkout-cta`,dataTestId:c===`plan`?`gift-continue`:`purchase-gift`,disabled:M,isRunning:c===`delivery`&&pe,label:G(c===`plan`?`Continue to delivery details`:`Continue to payment`),style:{width:`100%`},onClick:c===`plan`?Me:()=>{if(pe)return;let e=C.trim(),t=D.trim(),n=O.trim(),r=w.trim(),a=k.trim(),o=T===`email`,s=o&&ye>_e,c=[];he||c.push({...be,value:e}),o&&t&&c.push({...xe,value:t});let u=fS({fields:c});o&&!t&&(u.recipientEmail=G(`Enter the recipient's email address`)),o&&(ye?ye<_e?u.deliveryDate=G(`Choose a date from today onwards`):ye>ve&&(u.deliveryDate=G(`Choose a date within the next year`)):u.deliveryDate=G(`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}})),lS({step:`plan`,replace:!0}));return}i(`checkoutGift`,{tierId:le.id,duration:A,...he?{}:{email:e},deliveryMethod:T,...o?{recipientEmail:t}:{},...o&&n?{recipientName:n}:{},buyerName:r,...o&&a?{personalMessage:a}:{},...s?{deliveryDate:ye}:{}})}})})]})]}),(0,K.jsx)(rS,{activeDuration:A,activeProduct:le,buyerName:w,cardRef:m,cardTiltProps:h,effectiveDeliveryDate:ye,emailDuration:de,giftMessage:k,giftValue:mS(le,A),minDeliveryDate:_e,recipientEmail:D,recipientName:O,showEmailPreview:P,siteIcon:se,siteTitle:ce})]})]})},_S=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},vS=(e,t)=>`${e}?${new URLSearchParams(t).toString()}`,yS=({shareTitle:e,shareUrl:t})=>{let n=[e,t].filter(Boolean).join(`
|
|
6241
6241
|
|
|
6242
|
-
`),r=[];return e&&r.push(`subject=${encodeURIComponent(e)}`),n&&r.push(`body=${encodeURIComponent(n)}`),`mailto:${r.length?`?${r.join(`&`)}`:``}`},bS=({shareTitle:e,shareUrl:t})=>vS(`https://www.linkedin.com/shareArticle`,{mini:`true`,url:t,title:e}),xS=()=>{let e=_S(),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:vS(`https://twitter.com/intent/tweet`,{url:i,text:a}),facebook:vS(`https://www.facebook.com/sharer/sharer.php`,{u:i}),email:yS({shareTitle:a,shareUrl:i}),threads:vS(`https://www.threads.net/intent/post`,{text:f}),linkedin:bS({shareTitle:a,shareUrl:i}),bluesky:vS(`https://bsky.app/intent/compose`,{text:f})};return{shareUrl:i,shareTitle:a,shareExcerpt:o,shareImage:s,shareFavicon:c,shareSiteName:d,shareAuthor:u,socialLinks:p}},SS=()=>{let[e]=(0,_.useState)(xS);return e},CS=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -3.268 64 68.414`,width:2232,height:2500,...e,children:(0,K.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`})}),wS=e=>(0,K.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,K.jsx)(`circle`,{cx:12,cy:12,r:1}),(0,K.jsx)(`circle`,{cx:19,cy:12,r:1}),(0,K.jsx)(`circle`,{cx:5,cy:12,r:1})]}),TS=e=>(0,K.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,K.jsx)(`defs`,{id:`defs13`,children:(0,K.jsx)(`clipPath`,{clipPathUnits:`userSpaceOnUse`,id:`clipPath25`,children:(0,K.jsx)(`path`,{d:`M 0,700 H 700 V 0 H 0 Z`,id:`path23`})})}),(0,K.jsx)(`g`,{id:`g17`,transform:`matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)`,children:(0,K.jsx)(`g`,{id:`g19`,children:(0,K.jsxs)(`g`,{id:`g21`,clipPath:`url(#clipPath25)`,children:[(0,K.jsx)(`g`,{id:`g27`,transform:`translate(600,350)`,children:(0,K.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,K.jsx)(`g`,{id:`g31`,transform:`translate(447.9175,273.6036)`,children:(0,K.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`})})]})})})]}),ES=e=>(0,K.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,K.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,K.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`})]}),DS=e=>(0,K.jsxs)(`svg`,{viewBox:`0 5 2490 2490.0000000000005`,xmlns:`http://www.w3.org/2000/svg`,width:2500,height:2495,...e,children:[(0,K.jsx)(`path`,{d:`M185.2 313.1H2252V2291H185.2z`,fill:`#fff`}),(0,K.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,K.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`})]}),OS=e=>(0,K.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,K.jsx)(`g`,{clipPath:`url(#clip0_351_18008)`,children:(0,K.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,K.jsx)(`defs`,{children:(0,K.jsx)(`clipPath`,{id:`clip0_351_18008`,children:(0,K.jsx)(`rect`,{width:17,height:17,fill:`white`,transform:`translate(0.5 0.5)`})})})]}),kS=e=>(0,K.jsx)(`svg`,{viewBox:`0 0 1200 1226.37`,xmlns:`http://www.w3.org/2000/svg`,width:2446,height:2500,...e,children:(0,K.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`})}),AS={signin:ex,signup:Cy,accountHome:Sx,accountPlan:vp,accountProfile:Cx,accountEmail:jx,signupNewsletter:W_,unsubscribe:Fx,magiclink:$y,loading:Hy,offer:ab,feedback:gb,emailSuppressed:Ix,emailSuppressionFAQ:Lx,emailReceivingFAQ:Rx,support:zx,supportSuccess:bb,supportError:Lb,recommendations:Gb,gift:Xy,giftRedemption:Sb,giftSuccess:Ab,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}=SS();(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`&&r(!1)};return e.addEventListener(`click`,t,!0),e.addEventListener(`keydown`,i),()=>{e.removeEventListener(`click`,t,!0),e.removeEventListener(`keydown`,i)}},[n]);let m=async()=>{await Eb(o)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},h=()=>{r(e=>!e)},g=()=>{r(!1)};return(0,K.jsxs)(`div`,{className:`gh-portal-content gh-portal-share`,children:[(0,K.jsx)(Y,{}),(0,K.jsx)(`div`,{className:`gh-portal-share-header`,children:(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Share`)})}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview`,children:[l&&(0,K.jsx)(`img`,{className:`gh-portal-share-preview-image`,src:l,alt:``,"data-testid":`share-preview-image`}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-content`,children:[s&&(0,K.jsx)(`h2`,{className:`gh-portal-share-preview-title`,children:s}),c&&(0,K.jsx)(`p`,{className:`gh-portal-share-preview-excerpt`,children:c}),(u||d||f)&&(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-footer`,children:[u&&(0,K.jsx)(`img`,{className:`gh-portal-share-preview-favicon`,src:u,alt:``,"data-testid":`share-preview-favicon`}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-meta`,children:[d&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-site`,children:d}),d&&f&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-separator`,"aria-hidden":`true`,children:`|`}),f&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-author`,children:f})]})]})]})]}),(0,K.jsxs)(`div`,{className:`gh-portal-share-actions`,children:[(0,K.jsxs)(`button`,{className:`gh-portal-btn gh-portal-share-action copy`,type:`button`,onClick:m,"aria-label":G(e?`Copied`:`Copy link`),title:G(e?`Copied`:`Copy link`),children:[e?(0,K.jsx)(`span`,{className:`gh-portal-share-icon copied`,"aria-hidden":`true`,children:(0,K.jsx)(If,{})}):(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(ES,{})}),(0,K.jsx)(`span`,{className:`gh-portal-share-label`,children:G(e?`Copied`:`Copy link`)})]}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action twitter`,href:p.twitter,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`X (Twitter)`),title:G(`X (Twitter)`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon x`,"aria-hidden":`true`,children:(0,K.jsx)(kS,{})})}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action linkedin`,href:p.linkedin,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`LinkedIn`),title:G(`LinkedIn`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(DS,{})})}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action email`,href:p.email,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`Email`),title:G(`Email`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(Dy,{})})}),(0,K.jsxs)(`div`,{className:`gh-portal-share-more`,ref:a,children:[(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-share-action more`,type:`button`,onClick:h,"aria-label":G(`More options`),title:G(`More options`),"aria-haspopup":`menu`,"aria-expanded":n,children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(wS,{})})}),n&&(0,K.jsxs)(`div`,{className:`gh-portal-share-more-menu`,role:`menu`,"aria-label":G(`More options`),children:[(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.facebook,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(TS,{})}),(0,K.jsx)(`span`,{children:G(`Facebook`)})]}),(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.threads,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(OS,{})}),(0,K.jsx)(`span`,{children:G(`Threads`)})]}),(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.bluesky,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(CS,{})}),(0,K.jsx)(`span`,{children:G(`Bluesky`)})]})]})]})]})]})}},jS={...AS,gift:gS,giftRedemption:wb,giftSuccess:Pb},MS=function({site:e}={}){return Af({site:e})?jS:AS},NS=function({page:e}){return Object.keys(AS).includes(e)?e:`signup`},PS=function({page:e}){return e.includes(`account`)},FS=function({page:e}){return e.includes(`offer`)},IS=e=>(0,K.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,K.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`})}),LS=class extends _.Component{static contextType=q;render(){return(0,K.jsxs)(`a`,{href:`https://ghost.org`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,K.jsx)(IS,{}),`Powered by Ghost`]})}},RS=()=>({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 zS({message:e}){return El()?(0,K.jsx)(`div`,{className:`gh-portal-cookiebanner`,children:e}):null}var BS=class extends _.Component{static contextType=q;componentDidMount(){this.node&&!od([`preview`])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=e=>{e.key===`Escape`&&this.dismissPopup(e)},this.node.ownerDocument.removeEventListener(`keyup`,this.keyUphandler),this.node.ownerDocument.addEventListener(`keyup`,this.keyUphandler)),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&&od([`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(`keyup`,this.keyUphandler)}handlePopupClose(e){let{page:t,otcRef:n}=this.context;od([`preview`])||n&&t===`magiclink`||t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderActivePage(){let{page:e,site:t}=this.context;NS({page:e});let n=MS({site:t})[e];return(0,K.jsx)(n,{})}renderPopupNotification(){let{popupNotification:e}=this.context;return!e||!e.type?null:(0,K.jsx)(rb,{})}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=su({site:n,pageQuery:t}).length;NS({page:e});let o={...RS({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&&!Jl({site:n})&&Yl({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=hu({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`;od([`preview`])&&(l+=` preview`),od([`preview`],{customSiteUrl:r})&&!n.disableBackground&&(d+=` preview`),od([`dev`])&&(d+=` dev`);let f=`${d} ${l}`,p=e===`gift`||e===`giftSuccess`||e===`giftRedemption`||e===`magiclink`&&i===`gift`;return this.sendPortalPreviewReadyEvent(),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-popup-wrapper `+l,onClick:e=>this.handlePopupClose(e),children:[this.renderPopupNotification(),(0,K.jsxs)(`div`,{className:f,style:o,ref:e=>this.node=e,tabIndex:-1,children:[(0,K.jsx)(zS,{message:c}),this.renderActivePage(),s===`full`&&!p?(0,K.jsx)(`div`,{className:`gh-portal-powered inside `+(od([`preview`])?`hidden `:``)+l,children:(0,K.jsx)(LS,{})}):``]})]}),e!==`share`&&!p&&(0,K.jsx)(`div`,{className:`gh-portal-powered outside `+(od([`preview`])?`hidden `:``)+l,children:(0,K.jsx)(LS,{})})]})}},VS=class extends _.Component{static contextType=q;constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){let t=MS({site:this.context.site})[e];return(0,K.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=$b({site:e});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`style`,{dangerouslySetInnerHTML:{__html:t?`:root { --brandcolor: ${t} }`+n:n}}),(0,K.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=RS({member:e}),i=window.innerWidth<480,a={...r.frame.common},o=`gh-portal-popup-background`;return od([`preview`])&&(r.modalContainer.zIndex=`3999997`),od([`preview`],{customSiteUrl:n})&&!t.disableBackground&&(o+=` preview`,t.preview_theme===`dark`&&(o+=` preview-dark`)),od([`dev`])&&(o+=` dev`),(0,K.jsx)(`div`,{style:r.modalContainer,children:(0,K.jsxs)($c,{style:a,title:`portal-popup`,head:this.renderFrameStyles(),dataTestId:`portal-popup-frame`,dataDir:this.context.dir,children:[(0,K.jsx)(`div`,{className:o,onClick:e=>this.handlePopupClose(e)}),(0,K.jsx)(BS,{isMobile:i})]})})}render(){let{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};WS({products:YS({numOfProducts:1})});function HS(){return(new Date().getTime()/1e3|0).toString(16)+`xxxxxxxxxxxxxxxx`.replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function US(){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 WS({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=YS({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=qS(),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 GS({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_${HS()}`,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 KS({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:US(),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 qS({numOfPosts:e=3}={}){let t=[];for(let n=0;n<e;n++)t.push(JS({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function JS({id:e=`post_${HS()}`,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 YS({numOfProducts:e=3}={}){let t=[XS({name:`Bronze`,description:`Access to all members articles`,monthlyPrice:eC({interval:`month`,amount:700}),yearlyPrice:eC({interval:`year`,amount:7e3}),numOfBenefits:2}),XS({name:`Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:eC({interval:`month`,amount:1200}),yearlyPrice:eC({interval:`year`,amount:12e3}),numOfBenefits:3}),XS({name:`Friends of the Blueprint`,description:`Get access to everything and lock in early adopter pricing for life + listen to my podcast`,monthlyPrice:eC({interval:`month`,amount:18e3}),yearlyPrice:eC({interval:`year`,amount:17e3}),numOfBenefits:4})].slice(0,e),n=ZS({});return[...t,n]}function XS({type:e=`paid`,name:t=`Basic`,description:n=``,id:r=`product_${HS()}`,monthlyPrice:i=eC(),yearlyPrice:a=eC({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:QS({numOfBenefits:o}),trial_days:s}}function ZS({name:e=`Free tier`,description:t=`Free tier description`,id:n=`product_${HS()}`,numOfBenefits:r=2}){return{id:n,name:e,type:`free`,description:t,benefits:QS({numOfBenefits:r})}}function QS({numOfBenefits:e}){let t=HS();return[$S({name:`Limited early adopter pricing #${t.substring(0,6)}`}),$S({name:`Latest gear reviews #${t.substring(6,12)}`}),$S({name:`Weekly email newsletter #${t.substring(12,18)}`}),$S({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function $S({id:e=`benefit_${HS()}`,name:t=`Benefit`}){return{id:e,name:t}}function eC({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_${HS()}`}={}){return{id:o,active:a,nickname:n,currency:i,amount:t,interval:e,description:r,stripe_price_id:`price_${HS()}`,stripe_product_id:`prod_${HS()}`,type:`recurring`}}function tC({id:e=`sub_${HS()}`,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=rC,priceId:c=`price_${HS()}`,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_${HS()}`,name:`Jamie`,email:`jamie@example.com`},plan:{id:`price_${HS()}`,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_${HS()}`,price_id:c,nickname:a,amount:i,interval:r,type:`recurring`,currency:n,product:{id:`stripe_prod_${HS()}`,product_id:`prod_${HS()}`}}}}function nC(){let e=YS({numOfProducts:1});return WS({products:e,portalPlans:[`free`,`monthly`,`yearly`],portalProducts:e.map(e=>e.id)})}nC();var rC=GS({tierId:WS({products:[XS({numOfBenefits:2,type:`free`})]}).products[0]?.id});KS({status:`free`}),KS({status:`paid`,paid:!0,subscriptions:[tC()]}),KS({status:`comped`,paid:!0,subscriptions:[]}),KS({status:`comped`,paid:!0,subscriptions:[tC({amount:0})]}),KS({status:`paid`,paid:!0,subscriptions:[tC({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:`2021-06-05T11:42:40.000Z`})]}),nC();var iC=[ZS({name:`Free`,description:`Free tier description which is actually a pretty long description`,numOfBenefits:2}),XS({name:`The Blueprint`,description:``,monthlyPrice:eC({interval:`month`,amount:500}),yearlyPrice:eC({interval:`year`,amount:5e3}),numOfBenefits:3}),XS({name:`Friends of the Blueprint Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:eC({interval:`month`,amount:1200}),yearlyPrice:eC({interval:`year`,amount:11e3}),numOfBenefits:4})],aC=WS({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:iC,portalProducts:iC.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}]}),oC=GS({tierId:aC.products[1]?.id}),sC={free:KS({name:`Jamie Larson`,email:`jamie@example.com`,firstname:`Jamie`,subscriptions:[],paid:!1,status:`free`,avatarImage:``,subscribed:!0}),paid:KS({paid:!0,status:`paid`,subscriptions:[tC({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:KS({paid:!0,status:`comped`,subscriptions:[]}),complimentaryWithSubscription:KS({paid:!0,status:`comped`,subscriptions:[tC({amount:0})]}),preview:KS({paid:!0,status:`paid`,subscriptions:[tC({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:new Date().toISOString()})]})};function cC(){if(!iC||!iC[1])return null;let e=aC?.products?.[1].monthlyPrice;return{site:aC,member:KS({paid:!0,status:`paid`,subscriptions:[tC({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 lC(e){let t=e.getAttribute(`href`),n=new URL(t,window.location.origin),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 uC=`CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION`;function dC({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function fC({state:e}){return{showPopup:!e.showPopup}}function pC({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function mC({state:e}){return e.page===`gift`&&Yx(),e.lastPage?{page:e.lastPage}:hC({state:e})}function hC({state:e}){let t=!1;e.page===`gift`&&(Yx(),t=dS()),t||Cl();let n={...e.pageData||{}};return delete n.redirect,{showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,page:e.page===`magiclink`?``:e.page,pageData:n}}function gC({data:e,state:t}){let{action:n=`openNotification`,status:r=`success`,autoHide:i=!0,closeable:a=!0,duration:o=2600,message:s=``}=e||{},c=Bu({type:n,status:r,autoHide:i,closeable:a,duration:o,state:t,message:s});return{notification:c,notificationSequence:c.count}}function _C(){return{notification:null}}async function vC({api:e,state:t}){try{return await e.member.signout(),{action:`signout:success`}}catch{return{action:`signout:failed`,popupNotification:J({type:`signout:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to log out, please try again`)})}}}async function yC({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:J({type:`signin:failed`,autoHide:!1,closeable:!0,state:n,status:`error`,message:Zc(e,G(`Failed to log in, please try again`))})}}}function bC({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 xC({data:e,api:t}){let n=G(`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:Zc(i.errors?.[0],n)}}catch(e){return{action:`verifyOTC:failed`,actionErrorMessage:Zc(e,n)}}}async function SC({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}=wu({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===uC?t.member?{action:`signup:failed`,popupNotification:J({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`You already have an active subscription.`)})}:{page:`magiclink`,lastPage:`signin`,pageData:{...t.pageData||{},email:(e?.email||``).trim()},popupNotification:null}:{action:`signup:failed`,popupNotification:J({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:Zc(n,G(`Failed to sign up, please try again`))})}}}async function CC({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=Bu({type:`giftRedeem`,status:`success`,autoHide:!0,closeable:!0,state:t,message:Qd({member:e})});return Cl(),{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=Bu({type:`giftRedeem`,status:`error`,autoHide:!1,closeable:!0,state:t,message:$d(e)});return Cl(),{action:`redeemGift:failed`,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:n,notificationSequence:n.count}}}async function wC({data:e,state:t,api:n}){try{let{plan:r,offerId:i,tierId:a,cadence:o}=e;(!a||!o)&&({tierId:a,cadence:o}=wu({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:J({type:`checkoutPlan:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function TC({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:`continueGiftSubscription:failed`,popupNotification:J({type:`continueGiftSubscription:failed`,autoHide:!1,closeable:!0,state:e,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function EC({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:J({type:`checkoutGift:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function DC({data:e,state:t,api:n}){try{let{plan:r,planId:i,subscriptionId:a,cancelAtPeriodEnd:o}=e,{tierId:s,cadence:c}=wu({site:t?.site,priceId:i});await n.member.updateSubscription({planName:r,tierId:s,cadence:c,subscriptionId:a,cancelAtPeriodEnd:o,planId:i});let l=await n.member.sessionData(),u=`updateSubscription:success`;return{action:u,popupNotification:J({type:u,autoHide:!0,closeable:!0,state:t,status:`success`,message:G(`Subscription plan updated successfully`)}),page:`accountHome`,member:l}}catch{return{action:`updateSubscription:failed`,popupNotification:J({type:`updateSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to update subscription, please try again`)})}}}async function OC({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:J({type:`cancelSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to cancel subscription, please try again`)})}}}async function kC({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:J({type:`continueSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to cancel subscription, please try again`)})}}}async function AC({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:J({type:`applyOffer:success`,autoHide:!0,closeable:!0,state:t,status:`success`,message:`Offer applied successfully!`})}}catch{return{action:`applyOffer:failed`,popupNotification:J({type:`applyOffer:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:`Failed to apply offer, please try again`})}}}async function jC({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:`editBilling:failed`,popupNotification:J({type:`editBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to update billing information, please try again`)})}}}async function MC({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:`manageBilling:failed`,popupNotification:J({type:`manageBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to open billing portal, please try again`)})}}}async function NC(){return{popupNotification:null}}async function PC({data:e,state:t}){let{action:n,message:r=``}=e;return n||=`showPopupNotification:success`,{popupNotification:J({type:n,autoHide:!0,closeable:!0,state:t,status:`success`,message:r})}}async function FC({data:e,state:t,api:n}){try{let{newsletters:t,enableCommentNotifications:r,enableUpdatesAndAnnouncements:i}=e;if(!t&&r===void 0&&i===void 0)return{};let a={};return t&&(a.newsletters=t),r!==void 0&&(a.enableCommentNotifications=r),i!==void 0&&(a.enableUpdatesAndAnnouncements=i),{action:`updateNewsletterPref:success`,member:await n.member.update(a)}}catch{return{action:`updateNewsletterPref:failed`,popupNotification:J({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:G(`Failed to update newsletter settings`)})}}}async function IC({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:`removeEmailFromSuppressionList:success`,popupNotification:J({type:`removeEmailFromSuppressionList:success`,autoHide:!0,closeable:!0,state:e,status:`success`,message:G(`You have been successfully resubscribed`)})}}catch{return{action:`removeEmailFromSuppressionList:failed`,popupNotification:J({type:`removeEmailFromSuppressionList:failed`,autoHide:!0,closeable:!0,state:e,status:`error`,message:G(`Your email has failed to resubscribe, please try again`)})}}}async function LC({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:J({type:a,autoHide:!0,closeable:!0,state:t,status:`success`,message:G(`Email newsletter settings updated`)})}}catch{return{action:`updateNewsletter:failed`,popupNotification:J({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:G(`Failed to update newsletter settings`)})}}}async function RC({data:e,state:t,api:n}){let{email:r}=e;if(r!==Ou({member:t.member}))try{return await n.member.updateEmailAddress({email:r}),{success:!0}}catch(e){return{success:!1,error:e}}return null}async function zC({data:e,state:t,api:n}){let r=e?.name?.trim();if(ju({member:t.member})!==r)try{let e=await n.member.update({name:r});if(!e)throw Error(`Failed to update member`);return{member:e,success:!0}}catch(e){return{success:!1,error:e}}return null}async function BC({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}async function VC({data:e,state:t,api:n}){let[r,i]=await Promise.all([zC({data:e,state:t,api:n}),RC({data:e,state:t,api:n})]);if(r&&i){if(i.success)return{action:`updateProfile:success`,...r.success?{member:r.member}:{},page:`accountHome`,popupNotification:J({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:G(`Check your inbox to verify email update`)})};let e=r.success?G(`Failed to send verification email`):G(`Failed to update account data`);return{action:`updateProfile:failed`,...r.success?{member:r.member}:{},popupNotification:J({type:`updateProfile:failed`,autoHide:!0,closeable:!0,status:`error`,message:e,state:t})}}else if(r){let e=r.success?`updateProfile:success`:`updateProfile:failed`,n=r.success?`success`:`error`,i=r.success?G(`Account details updated successfully`):G(`Failed to update account details`);return{action:e,...r.success?{member:r.member}:{},...r.success?{page:`accountHome`}:{},popupNotification:J({type:e,autoHide:r.success,closeable:!0,status:n,state:t,message:i})}}else if(i){let e=i.success?`updateProfile:success`:`updateProfile:failed`,n=i.success?`success`:`error`,r=``;return r=i.error?Zc(i.error,G(`Failed to send verification email`)):G(`Check your inbox to verify email update`),{action:e,...i.success?{page:`accountHome`}:{},popupNotification:J({type:e,autoHide:i.success,closeable:!0,status:n,state:t,message:r})}}return{action:`updateProfile:success`,page:`accountHome`,popupNotification:J({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:G(`Account details updated successfully`)})}}async function HC({data:{siteUrl:e},state:t}){let n=lb({siteUrl:e,apiUrl:`not-defined`,contentApiKey:`not-defined`}),{member:r}=t,i=window.location.href,a=tu(),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 UC({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 WC({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}var GC={togglePopup:fC,openPopup:pC,closePopup:hC,switchPage:dC,openNotification:gC,closeNotification:_C,back:mC,signout:vC,signin:yC,startSigninOTCFromCustomForm:bC,verifyOTC:xC,signup:SC,redeemGift:CC,updateSubscription:DC,cancelSubscription:OC,continueSubscription:kC,applyOffer:AC,updateNewsletter:LC,updateProfile:VC,refreshMemberData:BC,clearPopupNotification:NC,editBilling:jC,manageBilling:MC,checkoutPlan:wC,continueGiftSubscription:TC,checkoutGift:EC,updateNewsletterPreference:FC,showPopupNotification:PC,removeEmailFromSuppressionList:IC,oneClickSubscribe:HC,trackRecommendationClicked:UC,trackRecommendationSubscribed:WC};async function KC({action:e,data:t,state:n,api:r}){let i=GC[e];return i&&await i({data:t,state:n,api:r})||{}}function qC(e,t){e&&(e.innerText=t)}function JC(e,t,n){t.classList.add(`error`),qC(n,Zc(e,G(`There was an error sending the email, please try again`)))}async function YC({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=Zu(),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 fetch(`${r}/members/api/integrity-token/`,{method:`GET`})).text(),s=await fetch(`${r}/members/api/send-magic-link/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...y,integrityToken:e})});if(t.addEventListener(`submit`,i),t.classList.remove(`loading`),s.ok){t.classList.add(`success`);let e;if(_)try{e=await s.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 qC(n,Zc(await Jc.fromApiResponse(s),G(`Failed to send magic link email`))),t.classList.add(`error`)}catch(e){JC(e,t,n)}}function XC({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=Gl(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=Zu();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(G(`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 ZC({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){YC({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){XC({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(G(`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(G(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(G(`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=G(`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=G(`There was an error continuing your subscription, please try again.`)))})}t.addEventListener(`click`,r)})}var QC=e=>{try{return decodeURIComponent(e)}catch{return null}},$C=e=>{if(e===`true`)return!0;if(e===`false`)return!1},ew={staleGiftRedemptionRequest:!0},tw={showPopup:!0,site:aC,member:sC.free,page:`accountEmail`,...cC(),pageData:oC};function nw({site:e,children:t}){let{portal_sentry:n}=e||{};return n&&n.dsn?(0,K.jsx)(Oo,{children:t}):(0,K.jsx)(K.Fragment,{children:t})}var rw=class extends _.Component{constructor(e){super(e),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:`loading`,showPopup:!1,action:`init:running`,actionErrorMessage:null,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(),ZC({siteUrl:e,site:t.site,member:t.member,offers:t.offers,doAction:t.doAction,captureException:ar})}}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`&&!Zl({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Cl();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,page:r,showPopup:i,popupNotification:a,notification:o,notificationSequence:s,lastPage:c,pageQuery:l,pageData:u}=await this.fetchData(),d=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||`en`;qc.changeLanguage(d);let f={site:e,member:t,offers:n,page:r,lastPage:c,pageQuery:l,showPopup:i,pageData:u,popupNotification:a,notification:o,notificationSequence:s,dir:qc.dir()||`ltr`,action:`init:success`,initStatus:`success`,locale:d};if(this.setState(f,()=>{this.handleSignupQuery({site:e,pageQuery:l,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=await this.fetchLinkData(e,t),{site:o,...s}=a?.staleGiftRedemptionRequest?{}:a,{site:c,...l}=this.fetchPreviewData(),{site:u,...d}=this.fetchNotificationData();return{member:t,offers:n,page:``,site:{...e,...o,...c,...u,...r,plans:{...(r||{}).plans,...(e||{}).plans,...(c||{}).plans}},...i,...s,...d,...l}}fetchDevData(){return od([`dev`])&&!this.state.customSiteUrl?tw:od([`test`])?{showPopup:this.props.showPopup===void 0?!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||oC.tier.id}:t===`redemption_type`&&(n.redemption_type=r||`signup`)}if(n.redemption_type===`retention`){let e=sC.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=$C(l);e!==void 0&&(n.site.portal_signup_gift_promotion=e)}else if(t===`accountGiftPromotion`){let e=$C(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=Fu(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}=sf({billingOnly:!0})||{};return[`stripe:billing-update`].includes(e)?t===`success`?{showPopup:!0,popupNotification:J({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){Cl();let t=Bu({type:`giftRedemption:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:$d(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(of([`stripe`,`gift_token`,`gift_tier`,`gift_cadence`,`gift_duration`,`gift_delivery`,`gift_delivery_date`,`gift_scheduled_at`]),e)return Yx(),{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(Xl({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[,e]=r.match(l),t=QC(e);if(!t)return{};let n=this.startGiftRedemptionRequest(t),i=await this.fetchGiftRedemptionData({token:t});return this.isCurrentGiftRedemptionRequest(n)?i:ew}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&&PS({page:i}))return{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/portal/${n}/`}};if(i===`gift`&&!Zl({site:e}))return Cl(),{};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(od([`preview`])){let t={};try{t=od([`offerPreview`])?this.fetchOfferQueryStrData(e):this.fetchQueryStrData(e)}catch(e){return ar(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||lb({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(od([`dev`,`test`],{customSiteUrl:t}))return{};throw e}}setupSentry({site:e}){if(od([`test`]))return null;let{portal_sentry:t,portal_version:n,version:r}=e,i=`portal@2.71.61|ghost@${r}`;t&&t.dsn&&bo({dsn:t.dsn,environment:t.env||`development`,release:i,beforeSend:e=>Dl({event:e})?e:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:t}){if(od([`test`]))return null;let n=Au({site:e}),r=Pu({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),$u({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 KC({action:e,data:t,state:this.state,api:this.GhostApi});this.setState(n),n&&n.action&&!n.action.includes(`:failed`)&&(this.timeoutId=setTimeout(()=>{this.setState({action:``})},2e3))}catch(n){if(console.error(`[Portal] Failed to dispatch action: ${e}`,n),t&&t.throwErrors)throw n;let r=J({type:`${e}:failed`,autoHide:!0,closeable:!0,status:`error`,state:this.state,meta:{error:n}});this.setState({action:`${e}:failed`,actionErrorMessage:Zc(n,G(`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&&Yx();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(Cl(),!(!Al({member:n})||kl({member:n}))){let e=Bu({type:`offer:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:G(`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||Gu({offer:n})||!Ku({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}Hu({site:e,pageQuery:t})&&(i=Hu({site:e,pageQuery:t}));let a=Kl({site:e,priceId:i});if(t&&t!==`free`){Cl();let t=a?.id||i;t!==`free`&&this.dispatchAction(`openPopup`,{page:`loading`});let{tierId:n,cadence:r}=wu({site:e,priceId:t});this.dispatchAction(`signup`,{plan:t,tierId:n,cadence:r})}}getPageFromLinkPath(e,t){let n=/^signup\/?(?:\/(\w+?))?\/?$/,r=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,a=/^offers\/(\w+?)\/?$/,o=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e===``)return{page:`default`};if(o.test(e)){let[,t]=e.match(o),n=QC(t);return n?{page:`giftRedemption`,pageData:{token:n}}:null}else if(a.test(e))return{pageQuery:e};else if(e===`signup`)return{page:`signup`};else if(r.test(e)){let[,t]=e.match(r);return{page:`signup`,pageQuery:`${t}/monthly`}}else if(i.test(e)){let[,t]=e.match(i);return{page:`signup`,pageQuery:`${t}/yearly`}}else if(n.test(e)){let[,t]=e.match(n);return{page:`signup`,pageQuery:t}}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`&&Af({site:t}))return{page:`gift`,pageData:{giftStep:`plan`}};else if(e===`gift/delivery`&&Af({site:t}))return{page:`gift`,pageData:{giftStep:`delivery`}};else if(e===`gift`||e===`gift/delivery`)return{page:`gift`};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 xy(e)}getRetentionPreviewMember({site:e,offers:t}){let n=(t||[]).find(e=>Gu({offer:e})),r=n?.tier?.id,i=r?pu({site:e,productId:r}):null,a=i?n.cadence===`year`?i.yearlyPrice:i.monthlyPrice:null,o=sC.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=Jl({site:e})||!Yl({site:e})?`signin`:`signup`;t=n?`accountHome`:r}return NS({page:t})}getContextMember({site:e,page:t,member:n,offers:r,pageData:i,customSiteUrl:a}){return od([`dev`,`preview`],{customSiteUrl:a})?PS({page:t})||FS({page:t})?od([`dev`],{customSiteUrl:a})?n||sC.free:od([`preview`])?t===`accountPlan`&&i?.action===`cancel`?this.getRetentionPreviewMember({site:e,offers:r}):sC.preview:sC.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}=this.state,_=this.getContextPage({site:e,page:a,member:t}),v=this.getContextMember({site:e,page:_,member:t,offers:n,pageData:l,customSiteUrl:f});return{api:this.GhostApi,site:e,offers:n,action:r,actionErrorMessage:i,brandColor:this.getAccentColor(),page:_,pageQuery:c,pageData:l,member: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(lC)}render(){return this.state.initStatus===`success`?(0,K.jsx)(nw,{site:this.state.site,children:(0,K.jsxs)(q.Provider,{value:this.getContextFromState(),children:[(0,K.jsx)(VS,{}),(0,K.jsx)(ud,{}),(0,K.jsx)(df,{})]})}):null}},iw=`ghost-portal-root`;function aw(){let e=document.createElement(`div`);e.id=iw,e.setAttribute(`data-testid`,`portal-root`),document.body.appendChild(e)}function ow(){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 sw(){let e=new URL(window.location.href);e.searchParams.get(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState({},document.title,e.href))}function cw(){let[,e]=window.location.hash.substring(1).split(`?`);new URLSearchParams(e).get(`previewTheme`)===`dark`&&(document.documentElement.dataset.portalPreviewTheme=`dark`)}function lw(){let{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i}=ow(),a=e||window.location.origin;cw(),aw(),sw(),v.render((0,K.jsx)(_.default.StrictMode,{children:(0,K.jsx)(rw,{siteUrl:a,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i})}),document.getElementById(iw))}lw()});
|
|
6242
|
+
`),r=[];return e&&r.push(`subject=${encodeURIComponent(e)}`),n&&r.push(`body=${encodeURIComponent(n)}`),`mailto:${r.length?`?${r.join(`&`)}`:``}`},bS=({shareTitle:e,shareUrl:t})=>vS(`https://www.linkedin.com/shareArticle`,{mini:`true`,url:t,title:e}),xS=()=>{let e=_S(),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:vS(`https://twitter.com/intent/tweet`,{url:i,text:a}),facebook:vS(`https://www.facebook.com/sharer/sharer.php`,{u:i}),email:yS({shareTitle:a,shareUrl:i}),threads:vS(`https://www.threads.net/intent/post`,{text:f}),linkedin:bS({shareTitle:a,shareUrl:i}),bluesky:vS(`https://bsky.app/intent/compose`,{text:f})};return{shareUrl:i,shareTitle:a,shareExcerpt:o,shareImage:s,shareFavicon:c,shareSiteName:d,shareAuthor:u,socialLinks:p}},SS=()=>{let[e]=(0,_.useState)(xS);return e},CS=e=>(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -3.268 64 68.414`,width:2232,height:2500,...e,children:(0,K.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`})}),wS=e=>(0,K.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,K.jsx)(`circle`,{cx:12,cy:12,r:1}),(0,K.jsx)(`circle`,{cx:19,cy:12,r:1}),(0,K.jsx)(`circle`,{cx:5,cy:12,r:1})]}),TS=e=>(0,K.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,K.jsx)(`defs`,{id:`defs13`,children:(0,K.jsx)(`clipPath`,{clipPathUnits:`userSpaceOnUse`,id:`clipPath25`,children:(0,K.jsx)(`path`,{d:`M 0,700 H 700 V 0 H 0 Z`,id:`path23`})})}),(0,K.jsx)(`g`,{id:`g17`,transform:`matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)`,children:(0,K.jsx)(`g`,{id:`g19`,children:(0,K.jsxs)(`g`,{id:`g21`,clipPath:`url(#clipPath25)`,children:[(0,K.jsx)(`g`,{id:`g27`,transform:`translate(600,350)`,children:(0,K.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,K.jsx)(`g`,{id:`g31`,transform:`translate(447.9175,273.6036)`,children:(0,K.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`})})]})})})]}),ES=e=>(0,K.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,K.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,K.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`})]}),DS=e=>(0,K.jsxs)(`svg`,{viewBox:`0 5 2490 2490.0000000000005`,xmlns:`http://www.w3.org/2000/svg`,width:2500,height:2495,...e,children:[(0,K.jsx)(`path`,{d:`M185.2 313.1H2252V2291H185.2z`,fill:`#fff`}),(0,K.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,K.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`})]}),OS=e=>(0,K.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,K.jsx)(`g`,{clipPath:`url(#clip0_351_18008)`,children:(0,K.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,K.jsx)(`defs`,{children:(0,K.jsx)(`clipPath`,{id:`clip0_351_18008`,children:(0,K.jsx)(`rect`,{width:17,height:17,fill:`white`,transform:`translate(0.5 0.5)`})})})]}),kS=e=>(0,K.jsx)(`svg`,{viewBox:`0 0 1200 1226.37`,xmlns:`http://www.w3.org/2000/svg`,width:2446,height:2500,...e,children:(0,K.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`})}),AS={signin:ex,signup:Cy,accountHome:Sx,accountPlan:vp,accountProfile:Cx,accountEmail:jx,signupNewsletter:W_,unsubscribe:Fx,magiclink:$y,loading:Hy,offer:ab,feedback:gb,emailSuppressed:Ix,emailSuppressionFAQ:Lx,emailReceivingFAQ:Rx,support:zx,supportSuccess:bb,supportError:Lb,recommendations:Gb,gift:Xy,giftRedemption:Sb,giftSuccess:Ab,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}=SS();(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`&&r(!1)};return e.addEventListener(`click`,t,!0),e.addEventListener(`keydown`,i),()=>{e.removeEventListener(`click`,t,!0),e.removeEventListener(`keydown`,i)}},[n]);let m=async()=>{await Eb(o)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},h=()=>{r(e=>!e)},g=()=>{r(!1)};return(0,K.jsxs)(`div`,{className:`gh-portal-content gh-portal-share`,children:[(0,K.jsx)(Y,{}),(0,K.jsx)(`div`,{className:`gh-portal-share-header`,children:(0,K.jsx)(`h1`,{className:`gh-portal-main-title`,children:G(`Share`)})}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview`,children:[l&&(0,K.jsx)(`img`,{className:`gh-portal-share-preview-image`,src:l,alt:``,"data-testid":`share-preview-image`}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-content`,children:[s&&(0,K.jsx)(`h2`,{className:`gh-portal-share-preview-title`,children:s}),c&&(0,K.jsx)(`p`,{className:`gh-portal-share-preview-excerpt`,children:c}),(u||d||f)&&(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-footer`,children:[u&&(0,K.jsx)(`img`,{className:`gh-portal-share-preview-favicon`,src:u,alt:``,"data-testid":`share-preview-favicon`}),(0,K.jsxs)(`div`,{className:`gh-portal-share-preview-meta`,children:[d&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-site`,children:d}),d&&f&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-separator`,"aria-hidden":`true`,children:`|`}),f&&(0,K.jsx)(`span`,{className:`gh-portal-share-preview-author`,children:f})]})]})]})]}),(0,K.jsxs)(`div`,{className:`gh-portal-share-actions`,children:[(0,K.jsxs)(`button`,{className:`gh-portal-btn gh-portal-share-action copy`,type:`button`,onClick:m,"aria-label":G(e?`Copied`:`Copy link`),title:G(e?`Copied`:`Copy link`),children:[e?(0,K.jsx)(`span`,{className:`gh-portal-share-icon copied`,"aria-hidden":`true`,children:(0,K.jsx)(If,{})}):(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(ES,{})}),(0,K.jsx)(`span`,{className:`gh-portal-share-label`,children:G(e?`Copied`:`Copy link`)})]}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action twitter`,href:p.twitter,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`X (Twitter)`),title:G(`X (Twitter)`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon x`,"aria-hidden":`true`,children:(0,K.jsx)(kS,{})})}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action linkedin`,href:p.linkedin,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`LinkedIn`),title:G(`LinkedIn`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(DS,{})})}),(0,K.jsx)(`a`,{className:`gh-portal-btn gh-portal-share-action email`,href:p.email,target:`_blank`,rel:`noopener noreferrer`,"aria-label":G(`Email`),title:G(`Email`),children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(Dy,{})})}),(0,K.jsxs)(`div`,{className:`gh-portal-share-more`,ref:a,children:[(0,K.jsx)(`button`,{className:`gh-portal-btn gh-portal-share-action more`,type:`button`,onClick:h,"aria-label":G(`More options`),title:G(`More options`),"aria-haspopup":`menu`,"aria-expanded":n,children:(0,K.jsx)(`span`,{className:`gh-portal-share-icon`,"aria-hidden":`true`,children:(0,K.jsx)(wS,{})})}),n&&(0,K.jsxs)(`div`,{className:`gh-portal-share-more-menu`,role:`menu`,"aria-label":G(`More options`),children:[(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.facebook,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(TS,{})}),(0,K.jsx)(`span`,{children:G(`Facebook`)})]}),(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.threads,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(OS,{})}),(0,K.jsx)(`span`,{children:G(`Threads`)})]}),(0,K.jsxs)(`a`,{className:`gh-portal-share-more-item`,href:p.bluesky,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,onClick:g,children:[(0,K.jsx)(`span`,{className:`gh-portal-share-more-item-icon`,"aria-hidden":`true`,children:(0,K.jsx)(CS,{})}),(0,K.jsx)(`span`,{children:G(`Bluesky`)})]})]})]})]})]})}},jS={...AS,gift:gS,giftRedemption:wb,giftSuccess:Pb},MS=function({site:e}={}){return Af({site:e})?jS:AS},NS=function({page:e}){return Object.keys(AS).includes(e)?e:`signup`},PS=function({page:e}){return e.includes(`account`)},FS=function({page:e}){return e.includes(`offer`)},IS=e=>(0,K.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,K.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`})}),LS=class extends _.Component{static contextType=q;render(){return(0,K.jsxs)(`a`,{href:`https://ghost.org`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,K.jsx)(IS,{}),`Powered by Ghost`]})}},RS=()=>({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 zS({message:e}){return El()?(0,K.jsx)(`div`,{className:`gh-portal-cookiebanner`,children:e}):null}var BS=class extends _.Component{static contextType=q;componentDidMount(){this.node&&!od([`preview`])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=e=>{e.key===`Escape`&&this.dismissPopup(e)},this.node.ownerDocument.removeEventListener(`keyup`,this.keyUphandler),this.node.ownerDocument.addEventListener(`keyup`,this.keyUphandler)),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&&od([`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(`keyup`,this.keyUphandler)}handlePopupClose(e){let{page:t,otcRef:n}=this.context;od([`preview`])||n&&t===`magiclink`||t===`giftRedemption`||t===`giftSuccess`||e.target===e.currentTarget&&this.context.doAction(`closePopup`)}renderActivePage(){let{page:e,site:t}=this.context;NS({page:e});let n=MS({site:t})[e];return(0,K.jsx)(n,{})}renderPopupNotification(){let{popupNotification:e}=this.context;return!e||!e.type?null:(0,K.jsx)(rb,{})}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=su({site:n,pageQuery:t}).length;NS({page:e});let o={...RS({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&&!Jl({site:n})&&Yl({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=hu({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`;od([`preview`])&&(l+=` preview`),od([`preview`],{customSiteUrl:r})&&!n.disableBackground&&(d+=` preview`),od([`dev`])&&(d+=` dev`);let f=`${d} ${l}`,p=e===`gift`||e===`giftSuccess`||e===`giftRedemption`||e===`magiclink`&&i===`gift`;return this.sendPortalPreviewReadyEvent(),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`gh-portal-popup-wrapper `+l,onClick:e=>this.handlePopupClose(e),children:[this.renderPopupNotification(),(0,K.jsxs)(`div`,{className:f,style:o,ref:e=>this.node=e,tabIndex:-1,children:[(0,K.jsx)(zS,{message:c}),this.renderActivePage(),s===`full`&&!p?(0,K.jsx)(`div`,{className:`gh-portal-powered inside `+(od([`preview`])?`hidden `:``)+l,children:(0,K.jsx)(LS,{})}):``]})]}),e!==`share`&&!p&&(0,K.jsx)(`div`,{className:`gh-portal-powered outside `+(od([`preview`])?`hidden `:``)+l,children:(0,K.jsx)(LS,{})})]})}},VS=class extends _.Component{static contextType=q;constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){let t=MS({site:this.context.site})[e];return(0,K.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=$b({site:e});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`style`,{dangerouslySetInnerHTML:{__html:t?`:root { --brandcolor: ${t} }`+n:n}}),(0,K.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=RS({member:e}),i=window.innerWidth<480,a={...r.frame.common},o=`gh-portal-popup-background`;return od([`preview`])&&(r.modalContainer.zIndex=`3999997`),od([`preview`],{customSiteUrl:n})&&!t.disableBackground&&(o+=` preview`,t.preview_theme===`dark`&&(o+=` preview-dark`)),od([`dev`])&&(o+=` dev`),(0,K.jsx)(`div`,{style:r.modalContainer,children:(0,K.jsxs)($c,{style:a,title:`portal-popup`,head:this.renderFrameStyles(),dataTestId:`portal-popup-frame`,dataDir:this.context.dir,children:[(0,K.jsx)(`div`,{className:o,onClick:e=>this.handlePopupClose(e)}),(0,K.jsx)(BS,{isMobile:i})]})})}render(){let{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};WS({products:YS({numOfProducts:1})});function HS(){return(new Date().getTime()/1e3|0).toString(16)+`xxxxxxxxxxxxxxxx`.replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function US(){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 WS({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=YS({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=qS(),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 GS({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_${HS()}`,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 KS({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:US(),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 qS({numOfPosts:e=3}={}){let t=[];for(let n=0;n<e;n++)t.push(JS({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function JS({id:e=`post_${HS()}`,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 YS({numOfProducts:e=3}={}){let t=[XS({name:`Bronze`,description:`Access to all members articles`,monthlyPrice:eC({interval:`month`,amount:700}),yearlyPrice:eC({interval:`year`,amount:7e3}),numOfBenefits:2}),XS({name:`Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:eC({interval:`month`,amount:1200}),yearlyPrice:eC({interval:`year`,amount:12e3}),numOfBenefits:3}),XS({name:`Friends of the Blueprint`,description:`Get access to everything and lock in early adopter pricing for life + listen to my podcast`,monthlyPrice:eC({interval:`month`,amount:18e3}),yearlyPrice:eC({interval:`year`,amount:17e3}),numOfBenefits:4})].slice(0,e),n=ZS({});return[...t,n]}function XS({type:e=`paid`,name:t=`Basic`,description:n=``,id:r=`product_${HS()}`,monthlyPrice:i=eC(),yearlyPrice:a=eC({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:QS({numOfBenefits:o}),trial_days:s}}function ZS({name:e=`Free tier`,description:t=`Free tier description`,id:n=`product_${HS()}`,numOfBenefits:r=2}){return{id:n,name:e,type:`free`,description:t,benefits:QS({numOfBenefits:r})}}function QS({numOfBenefits:e}){let t=HS();return[$S({name:`Limited early adopter pricing #${t.substring(0,6)}`}),$S({name:`Latest gear reviews #${t.substring(6,12)}`}),$S({name:`Weekly email newsletter #${t.substring(12,18)}`}),$S({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function $S({id:e=`benefit_${HS()}`,name:t=`Benefit`}){return{id:e,name:t}}function eC({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_${HS()}`}={}){return{id:o,active:a,nickname:n,currency:i,amount:t,interval:e,description:r,stripe_price_id:`price_${HS()}`,stripe_product_id:`prod_${HS()}`,type:`recurring`}}function tC({id:e=`sub_${HS()}`,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=rC,priceId:c=`price_${HS()}`,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_${HS()}`,name:`Jamie`,email:`jamie@example.com`},plan:{id:`price_${HS()}`,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_${HS()}`,price_id:c,nickname:a,amount:i,interval:r,type:`recurring`,currency:n,product:{id:`stripe_prod_${HS()}`,product_id:`prod_${HS()}`}}}}function nC(){let e=YS({numOfProducts:1});return WS({products:e,portalPlans:[`free`,`monthly`,`yearly`],portalProducts:e.map(e=>e.id)})}nC();var rC=GS({tierId:WS({products:[XS({numOfBenefits:2,type:`free`})]}).products[0]?.id});KS({status:`free`}),KS({status:`paid`,paid:!0,subscriptions:[tC()]}),KS({status:`comped`,paid:!0,subscriptions:[]}),KS({status:`comped`,paid:!0,subscriptions:[tC({amount:0})]}),KS({status:`paid`,paid:!0,subscriptions:[tC({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:`2021-06-05T11:42:40.000Z`})]}),nC();var iC=[ZS({name:`Free`,description:`Free tier description which is actually a pretty long description`,numOfBenefits:2}),XS({name:`The Blueprint`,description:``,monthlyPrice:eC({interval:`month`,amount:500}),yearlyPrice:eC({interval:`year`,amount:5e3}),numOfBenefits:3}),XS({name:`Friends of the Blueprint Silver`,description:`Access to all members articles and weekly podcast`,monthlyPrice:eC({interval:`month`,amount:1200}),yearlyPrice:eC({interval:`year`,amount:11e3}),numOfBenefits:4})],aC=WS({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:iC,portalProducts:iC.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}]}),oC=GS({tierId:aC.products[1]?.id}),sC={free:KS({name:`Jamie Larson`,email:`jamie@example.com`,firstname:`Jamie`,subscriptions:[],paid:!1,status:`free`,avatarImage:``,subscribed:!0}),paid:KS({paid:!0,status:`paid`,subscriptions:[tC({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:KS({paid:!0,status:`comped`,subscriptions:[]}),complimentaryWithSubscription:KS({paid:!0,status:`comped`,subscriptions:[tC({amount:0})]}),preview:KS({paid:!0,status:`paid`,subscriptions:[tC({amount:1500,startDate:`2019-05-01T11:42:40.000Z`,currentPeriodEnd:new Date().toISOString()})]})};function cC(){if(!iC||!iC[1])return null;let e=aC?.products?.[1].monthlyPrice;return{site:aC,member:KS({paid:!0,status:`paid`,subscriptions:[tC({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 lC(e){let t=e.getAttribute(`href`),n=new URL(t,window.location.origin),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 uC=`CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION`;function dC({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function fC({state:e}){return{showPopup:!e.showPopup}}function pC({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function mC({state:e}){return e.page===`gift`&&Yx(),e.lastPage?{page:e.lastPage}:hC({state:e})}function hC({state:e}){let t=!1;e.page===`gift`&&(Yx(),t=dS()),t||Cl();let n={...e.pageData||{}};return delete n.redirect,{showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,page:e.page===`magiclink`?``:e.page,pageData:n}}function gC({data:e,state:t}){let{action:n=`openNotification`,status:r=`success`,autoHide:i=!0,closeable:a=!0,duration:o=2600,message:s=``}=e||{},c=Bu({type:n,status:r,autoHide:i,closeable:a,duration:o,state:t,message:s});return{notification:c,notificationSequence:c.count}}function _C(){return{notification:null}}async function vC({api:e,state:t}){try{return await e.member.signout(),{action:`signout:success`}}catch{return{action:`signout:failed`,popupNotification:J({type:`signout:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to log out, please try again`)})}}}async function yC({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:J({type:`signin:failed`,autoHide:!1,closeable:!0,state:n,status:`error`,message:Zc(e,G(`Failed to log in, please try again`))})}}}function bC({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 xC({data:e,api:t}){let n=G(`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:Zc(i.errors?.[0],n)}}catch(e){return{action:`verifyOTC:failed`,actionErrorMessage:Zc(e,n)}}}async function SC({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}=wu({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===uC?t.member?{action:`signup:failed`,popupNotification:J({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`You already have an active subscription.`)})}:{page:`magiclink`,lastPage:`signin`,pageData:{...t.pageData||{},email:(e?.email||``).trim()},popupNotification:null}:{action:`signup:failed`,popupNotification:J({type:`signup:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:Zc(n,G(`Failed to sign up, please try again`))})}}}async function CC({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=Bu({type:`giftRedeem`,status:`success`,autoHide:!0,closeable:!0,state:t,message:Qd({member:e})});return Cl(),{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=Bu({type:`giftRedeem`,status:`error`,autoHide:!1,closeable:!0,state:t,message:$d(e)});return Cl(),{action:`redeemGift:failed`,showPopup:!1,lastPage:null,pageQuery:``,popupNotification:null,notification:n,notificationSequence:n.count}}}async function wC({data:e,state:t,api:n}){try{let{plan:r,offerId:i,tierId:a,cadence:o}=e;(!a||!o)&&({tierId:a,cadence:o}=wu({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:J({type:`checkoutPlan:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function TC({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:`continueGiftSubscription:failed`,popupNotification:J({type:`continueGiftSubscription:failed`,autoHide:!1,closeable:!0,state:e,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function EC({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:J({type:`checkoutGift:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to process checkout, please try again`)})}}}async function DC({data:e,state:t,api:n}){try{let{plan:r,planId:i,subscriptionId:a,cancelAtPeriodEnd:o}=e,{tierId:s,cadence:c}=wu({site:t?.site,priceId:i});await n.member.updateSubscription({planName:r,tierId:s,cadence:c,subscriptionId:a,cancelAtPeriodEnd:o,planId:i});let l=await n.member.sessionData(),u=`updateSubscription:success`;return{action:u,popupNotification:J({type:u,autoHide:!0,closeable:!0,state:t,status:`success`,message:G(`Subscription plan updated successfully`)}),page:`accountHome`,member:l}}catch{return{action:`updateSubscription:failed`,popupNotification:J({type:`updateSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to update subscription, please try again`)})}}}async function OC({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:J({type:`cancelSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to cancel subscription, please try again`)})}}}async function kC({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:J({type:`continueSubscription:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to cancel subscription, please try again`)})}}}async function AC({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:J({type:`applyOffer:success`,autoHide:!0,closeable:!0,state:t,status:`success`,message:`Offer applied successfully!`})}}catch{return{action:`applyOffer:failed`,popupNotification:J({type:`applyOffer:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:`Failed to apply offer, please try again`})}}}async function jC({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:`editBilling:failed`,popupNotification:J({type:`editBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to update billing information, please try again`)})}}}async function MC({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:`manageBilling:failed`,popupNotification:J({type:`manageBilling:failed`,autoHide:!1,closeable:!0,state:t,status:`error`,message:G(`Failed to open billing portal, please try again`)})}}}async function NC(){return{popupNotification:null}}async function PC({data:e,state:t}){let{action:n,message:r=``}=e;return n||=`showPopupNotification:success`,{popupNotification:J({type:n,autoHide:!0,closeable:!0,state:t,status:`success`,message:r})}}async function FC({data:e,state:t,api:n}){try{let{newsletters:t,enableCommentNotifications:r,enableUpdatesAndAnnouncements:i}=e;if(!t&&r===void 0&&i===void 0)return{};let a={};return t&&(a.newsletters=t),r!==void 0&&(a.enableCommentNotifications=r),i!==void 0&&(a.enableUpdatesAndAnnouncements=i),{action:`updateNewsletterPref:success`,member:await n.member.update(a)}}catch{return{action:`updateNewsletterPref:failed`,popupNotification:J({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:G(`Failed to update newsletter settings`)})}}}async function IC({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:`removeEmailFromSuppressionList:success`,popupNotification:J({type:`removeEmailFromSuppressionList:success`,autoHide:!0,closeable:!0,state:e,status:`success`,message:G(`You have been successfully resubscribed`)})}}catch{return{action:`removeEmailFromSuppressionList:failed`,popupNotification:J({type:`removeEmailFromSuppressionList:failed`,autoHide:!0,closeable:!0,state:e,status:`error`,message:G(`Your email has failed to resubscribe, please try again`)})}}}async function LC({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:J({type:a,autoHide:!0,closeable:!0,state:t,status:`success`,message:G(`Email newsletter settings updated`)})}}catch{return{action:`updateNewsletter:failed`,popupNotification:J({type:`updateNewsletter:failed`,autoHide:!0,closeable:!0,state:t,status:`error`,message:G(`Failed to update newsletter settings`)})}}}async function RC({data:e,state:t,api:n}){let{email:r}=e;if(r!==Ou({member:t.member}))try{return await n.member.updateEmailAddress({email:r}),{success:!0}}catch(e){return{success:!1,error:e}}return null}async function zC({data:e,state:t,api:n}){let r=e?.name?.trim();if(ju({member:t.member})!==r)try{let e=await n.member.update({name:r});if(!e)throw Error(`Failed to update member`);return{member:e,success:!0}}catch(e){return{success:!1,error:e}}return null}async function BC({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}async function VC({data:e,state:t,api:n}){let[r,i]=await Promise.all([zC({data:e,state:t,api:n}),RC({data:e,state:t,api:n})]);if(r&&i){if(i.success)return{action:`updateProfile:success`,...r.success?{member:r.member}:{},page:`accountHome`,popupNotification:J({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:G(`Check your inbox to verify email update`)})};let e=r.success?G(`Failed to send verification email`):G(`Failed to update account data`);return{action:`updateProfile:failed`,...r.success?{member:r.member}:{},popupNotification:J({type:`updateProfile:failed`,autoHide:!0,closeable:!0,status:`error`,message:e,state:t})}}else if(r){let e=r.success?`updateProfile:success`:`updateProfile:failed`,n=r.success?`success`:`error`,i=r.success?G(`Account details updated successfully`):G(`Failed to update account details`);return{action:e,...r.success?{member:r.member}:{},...r.success?{page:`accountHome`}:{},popupNotification:J({type:e,autoHide:r.success,closeable:!0,status:n,state:t,message:i})}}else if(i){let e=i.success?`updateProfile:success`:`updateProfile:failed`,n=i.success?`success`:`error`,r=``;return r=i.error?Zc(i.error,G(`Failed to send verification email`)):G(`Check your inbox to verify email update`),{action:e,...i.success?{page:`accountHome`}:{},popupNotification:J({type:e,autoHide:i.success,closeable:!0,status:n,state:t,message:r})}}return{action:`updateProfile:success`,page:`accountHome`,popupNotification:J({type:`updateProfile:success`,autoHide:!0,closeable:!0,status:`success`,state:t,message:G(`Account details updated successfully`)})}}async function HC({data:{siteUrl:e},state:t}){let n=lb({siteUrl:e,apiUrl:`not-defined`,contentApiKey:`not-defined`}),{member:r}=t,i=window.location.href,a=tu(),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 UC({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 WC({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}var GC={togglePopup:fC,openPopup:pC,closePopup:hC,switchPage:dC,openNotification:gC,closeNotification:_C,back:mC,signout:vC,signin:yC,startSigninOTCFromCustomForm:bC,verifyOTC:xC,signup:SC,redeemGift:CC,updateSubscription:DC,cancelSubscription:OC,continueSubscription:kC,applyOffer:AC,updateNewsletter:LC,updateProfile:VC,refreshMemberData:BC,clearPopupNotification:NC,editBilling:jC,manageBilling:MC,checkoutPlan:wC,continueGiftSubscription:TC,checkoutGift:EC,updateNewsletterPreference:FC,showPopupNotification:PC,removeEmailFromSuppressionList:IC,oneClickSubscribe:HC,trackRecommendationClicked:UC,trackRecommendationSubscribed:WC};async function KC({action:e,data:t,state:n,api:r}){let i=GC[e];return i&&await i({data:t,state:n,api:r})||{}}function qC(e,t){e&&(e.innerText=t)}function JC(e,t,n){t.classList.add(`error`),qC(n,Zc(e,G(`There was an error sending the email, please try again`)))}async function YC({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=Zu(),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 fetch(`${r}/members/api/integrity-token/`,{method:`GET`})).text(),s=await fetch(`${r}/members/api/send-magic-link/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...y,integrityToken:e})});if(t.addEventListener(`submit`,i),t.classList.remove(`loading`),s.ok){t.classList.add(`success`);let e;if(_)try{e=await s.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 qC(n,Zc(await Jc.fromApiResponse(s),G(`Failed to send magic link email`))),t.classList.add(`error`)}catch(e){JC(e,t,n)}}function XC({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=Gl(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=Zu();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(G(`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 ZC({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){YC({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){XC({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(G(`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(G(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(G(`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=G(`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=G(`There was an error continuing your subscription, please try again.`)))})}t.addEventListener(`click`,r)})}var QC=e=>{try{return decodeURIComponent(e)}catch{return null}},$C=e=>{if(e===`true`)return!0;if(e===`false`)return!1},ew={staleGiftRedemptionRequest:!0},tw={showPopup:!0,site:aC,member:sC.free,page:`accountEmail`,...cC(),pageData:oC};function nw({site:e,children:t}){let{portal_sentry:n}=e||{};return n&&n.dsn?(0,K.jsx)(Oo,{children:t}):(0,K.jsx)(K.Fragment,{children:t})}var rw=class extends _.Component{constructor(e){super(e),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:`loading`,showPopup:!1,action:`init:running`,actionErrorMessage:null,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(),ZC({siteUrl:e,site:t.site,member:t.member,offers:t.offers,doAction:t.doAction,captureException:ar})}}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`&&!Zl({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Cl();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,page:r,showPopup:i,popupNotification:a,notification:o,notificationSequence:s,lastPage:c,pageQuery:l,pageData:u}=await this.fetchData(),d=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||`en`;qc.changeLanguage(d);let f={site:e,member:t,offers:n,page:r,lastPage:c,pageQuery:l,showPopup:i,pageData:u,popupNotification:a,notification:o,notificationSequence:s,dir:qc.dir()||`ltr`,action:`init:success`,initStatus:`success`,locale:d};if(this.setState(f,()=>{this.handleSignupQuery({site:e,pageQuery:l,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=await this.fetchLinkData(e,t),{site:o,...s}=a?.staleGiftRedemptionRequest?{}:a,{site:c,...l}=this.fetchPreviewData(),{site:u,...d}=this.fetchNotificationData();return{member:t,offers:n,page:``,site:{...e,...o,...c,...u,...r,plans:{...(r||{}).plans,...(e||{}).plans,...(c||{}).plans}},...i,...s,...d,...l}}fetchDevData(){return od([`dev`])&&!this.state.customSiteUrl?tw:od([`test`])?{showPopup:this.props.showPopup===void 0?!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||oC.tier.id}:t===`redemption_type`&&(n.redemption_type=r||`signup`)}if(n.redemption_type===`retention`){let e=sC.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=$C(l);e!==void 0&&(n.site.portal_signup_gift_promotion=e)}else if(t===`accountGiftPromotion`){let e=$C(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=Fu(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}=sf({billingOnly:!0})||{};return[`stripe:billing-update`].includes(e)?t===`success`?{showPopup:!0,popupNotification:J({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){Cl();let t=Bu({type:`giftRedemption:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:$d(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(of([`stripe`,`gift_token`,`gift_tier`,`gift_cadence`,`gift_duration`,`gift_delivery`,`gift_delivery_date`,`gift_scheduled_at`]),e)return Yx(),{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(Xl({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[,e]=r.match(l),t=QC(e);if(!t)return{};let n=this.startGiftRedemptionRequest(t),i=await this.fetchGiftRedemptionData({token:t});return this.isCurrentGiftRedemptionRequest(n)?i:ew}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&&PS({page:i}))return{showPopup:!0,page:`signin`,pageData:{redirect:e.url+`#/portal/${n}/`}};if(i===`gift`&&!Zl({site:e}))return Cl(),{};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(od([`preview`])){let t={};try{t=od([`offerPreview`])?this.fetchOfferQueryStrData(e):this.fetchQueryStrData(e)}catch(e){return ar(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||lb({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(od([`dev`,`test`],{customSiteUrl:t}))return{};throw e}}setupSentry({site:e}){if(od([`test`]))return null;let{portal_sentry:t,portal_version:n,version:r}=e,i=`portal@2.71.62|ghost@${r}`;t&&t.dsn&&bo({dsn:t.dsn,environment:t.env||`development`,release:i,beforeSend:e=>Dl({event:e})?e:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:t}){if(od([`test`]))return null;let n=Au({site:e}),r=Pu({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),$u({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 KC({action:e,data:t,state:this.state,api:this.GhostApi});this.setState(n),n&&n.action&&!n.action.includes(`:failed`)&&(this.timeoutId=setTimeout(()=>{this.setState({action:``})},2e3))}catch(n){if(console.error(`[Portal] Failed to dispatch action: ${e}`,n),t&&t.throwErrors)throw n;let r=J({type:`${e}:failed`,autoHide:!0,closeable:!0,status:`error`,state:this.state,meta:{error:n}});this.setState({action:`${e}:failed`,actionErrorMessage:Zc(n,G(`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&&Yx();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(Cl(),!(!Al({member:n})||kl({member:n}))){let e=Bu({type:`offer:failed`,status:`error`,autoHide:!1,closeable:!0,state:this.state,message:G(`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||Gu({offer:n})||!Ku({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}Hu({site:e,pageQuery:t})&&(i=Hu({site:e,pageQuery:t}));let a=Kl({site:e,priceId:i});if(t&&t!==`free`){Cl();let t=a?.id||i;t!==`free`&&this.dispatchAction(`openPopup`,{page:`loading`});let{tierId:n,cadence:r}=wu({site:e,priceId:t});this.dispatchAction(`signup`,{plan:t,tierId:n,cadence:r})}}getPageFromLinkPath(e,t){let n=/^signup\/?(?:\/(\w+?))?\/?$/,r=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,a=/^offers\/(\w+?)\/?$/,o=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e===``)return{page:`default`};if(o.test(e)){let[,t]=e.match(o),n=QC(t);return n?{page:`giftRedemption`,pageData:{token:n}}:null}else if(a.test(e))return{pageQuery:e};else if(e===`signup`)return{page:`signup`};else if(r.test(e)){let[,t]=e.match(r);return{page:`signup`,pageQuery:`${t}/monthly`}}else if(i.test(e)){let[,t]=e.match(i);return{page:`signup`,pageQuery:`${t}/yearly`}}else if(n.test(e)){let[,t]=e.match(n);return{page:`signup`,pageQuery:t}}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`&&Af({site:t}))return{page:`gift`,pageData:{giftStep:`plan`}};else if(e===`gift/delivery`&&Af({site:t}))return{page:`gift`,pageData:{giftStep:`delivery`}};else if(e===`gift`||e===`gift/delivery`)return{page:`gift`};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 xy(e)}getRetentionPreviewMember({site:e,offers:t}){let n=(t||[]).find(e=>Gu({offer:e})),r=n?.tier?.id,i=r?pu({site:e,productId:r}):null,a=i?n.cadence===`year`?i.yearlyPrice:i.monthlyPrice:null,o=sC.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=Jl({site:e})||!Yl({site:e})?`signin`:`signup`;t=n?`accountHome`:r}return NS({page:t})}getContextMember({site:e,page:t,member:n,offers:r,pageData:i,customSiteUrl:a}){return od([`dev`,`preview`],{customSiteUrl:a})?PS({page:t})||FS({page:t})?od([`dev`],{customSiteUrl:a})?n||sC.free:od([`preview`])?t===`accountPlan`&&i?.action===`cancel`?this.getRetentionPreviewMember({site:e,offers:r}):sC.preview:sC.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}=this.state,_=this.getContextPage({site:e,page:a,member:t}),v=this.getContextMember({site:e,page:_,member:t,offers:n,pageData:l,customSiteUrl:f});return{api:this.GhostApi,site:e,offers:n,action:r,actionErrorMessage:i,brandColor:this.getAccentColor(),page:_,pageQuery:c,pageData:l,member: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(lC)}render(){return this.state.initStatus===`success`?(0,K.jsx)(nw,{site:this.state.site,children:(0,K.jsxs)(q.Provider,{value:this.getContextFromState(),children:[(0,K.jsx)(VS,{}),(0,K.jsx)(ud,{}),(0,K.jsx)(df,{})]})}):null}},iw=`ghost-portal-root`;function aw(){let e=document.createElement(`div`);e.id=iw,e.setAttribute(`data-testid`,`portal-root`),document.body.appendChild(e)}function ow(){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 sw(){let e=new URL(window.location.href);e.searchParams.get(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState({},document.title,e.href))}function cw(){let[,e]=window.location.hash.substring(1).split(`?`);new URLSearchParams(e).get(`previewTheme`)===`dark`&&(document.documentElement.dataset.portalPreviewTheme=`dark`)}function lw(){let{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i}=ow(),a=e||window.location.origin;cw(),aw(),sw(),v.render((0,K.jsx)(_.default.StrictMode,{children:(0,K.jsx)(rw,{siteUrl:a,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:r,locale:i})}),document.getElementById(iw))}lw()});
|
|
6243
6243
|
//# sourceMappingURL=portal.min.js.map
|