@tryghost/portal 2.69.12 → 2.69.13
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/README.md +1 -4
- package/package.json +2 -4
- package/umd/portal.min.js +2 -2
- package/umd/portal.min.js.map +1 -1
package/umd/portal.min.js
CHANGED
|
@@ -35,7 +35,7 @@ Url: ${Jr(t)}`),!0)}function Xw(t,e){return t.type||!e||!e.length?!1:tx(t).some(
|
|
|
35
35
|
`)+" "+j.join(`,
|
|
36
36
|
`)+" "+_[1]:_[0]+Y+" "+j.join(", ")+" "+_[1]}function I(j){return Array.isArray(j)}t.isArray=I;function O(j){return typeof j=="boolean"}t.isBoolean=O;function D(j){return j===null}t.isNull=D;function U(j){return j==null}t.isNullOrUndefined=U;function q(j){return typeof j=="number"}t.isNumber=q;function ee(j){return typeof j=="string"}t.isString=ee;function te(j){return typeof j=="symbol"}t.isSymbol=te;function H(j){return j===void 0}t.isUndefined=H;function re(j){return ce(j)&&X(j)==="[object RegExp]"}t.isRegExp=re;function ce(j){return typeof j=="object"&&j!==null}t.isObject=ce;function pe(j){return ce(j)&&X(j)==="[object Date]"}t.isDate=pe;function we(j){return ce(j)&&(X(j)==="[object Error]"||j instanceof Error)}t.isError=we;function L(j){return typeof j=="function"}t.isFunction=L;function G(j){return j===null||typeof j=="boolean"||typeof j=="number"||typeof j=="string"||typeof j=="symbol"||typeof j>"u"}t.isPrimitive=G,t.isBuffer=dE();function X(j){return Object.prototype.toString.call(j)}function ue(j){return j<10?"0"+j.toString(10):j.toString(10)}var ye=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(){var j=new Date,Y=[ue(j.getHours()),ue(j.getMinutes()),ue(j.getSeconds())].join(":");return[j.getDate(),ye[j.getMonth()],Y].join(" ")}t.log=function(){console.log("%s - %s",Ne(),t.format.apply(t,arguments))},t.inherits=mE(),t._extend=function(j,Y){if(!Y||!ce(Y))return j;for(var _=Object.keys(Y),be=_.length;be--;)j[_[be]]=Y[_[be]];return j};function Ue(j,Y){return Object.prototype.hasOwnProperty.call(j,Y)}})(lc)),lc}var Gf;function hE(){if(Gf)return ku.exports;Gf=1;var t=cE()();function e(L,G){if(L===G)return 0;for(var X=L.length,ue=G.length,ye=0,Ne=Math.min(X,ue);ye<Ne;++ye)if(L[ye]!==G[ye]){X=L[ye],ue=G[ye];break}return X<ue?-1:ue<X?1:0}function a(L){return ma.Buffer&&typeof ma.Buffer.isBuffer=="function"?ma.Buffer.isBuffer(L):!!(L!=null&&L._isBuffer)}var o=pE(),s=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c=(function(){return(function(){}).name==="foo"})();function m(L){return Object.prototype.toString.call(L)}function h(L){return a(L)||typeof ma.ArrayBuffer!="function"?!1:typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(L):L?!!(L instanceof DataView||L.buffer&&L.buffer instanceof ArrayBuffer):!1}var f=ku.exports=D,y=/\s*function\s+([^\(\s]*)\s*/;function k(L){if(o.isFunction(L)){if(c)return L.name;var G=L.toString(),X=G.match(y);return X&&X[1]}}f.AssertionError=function(G){this.name="AssertionError",this.actual=G.actual,this.expected=G.expected,this.operator=G.operator,G.message?(this.message=G.message,this.generatedMessage=!1):(this.message=I(this),this.generatedMessage=!0);var X=G.stackStartFunction||O;if(Error.captureStackTrace)Error.captureStackTrace(this,X);else{var ue=new Error;if(ue.stack){var ye=ue.stack,Ne=k(X),Ue=ye.indexOf(`
|
|
37
37
|
`+Ne);if(Ue>=0){var j=ye.indexOf(`
|
|
38
|
-
`,Ue+1);ye=ye.substring(j+1)}this.stack=ye}}},o.inherits(f.AssertionError,Error);function x(L,G){return typeof L=="string"?L.length<G?L:L.slice(0,G):L}function S(L){if(c||!o.isFunction(L))return o.inspect(L);var G=k(L),X=G?": "+G:"";return"[Function"+X+"]"}function I(L){return x(S(L.actual),128)+" "+L.operator+" "+x(S(L.expected),128)}function O(L,G,X,ue,ye){throw new f.AssertionError({message:X,actual:L,expected:G,operator:ue,stackStartFunction:ye})}f.fail=O;function D(L,G){L||O(L,!0,G,"==",f.ok)}f.ok=D,f.equal=function(G,X,ue){G!=X&&O(G,X,ue,"==",f.equal)},f.notEqual=function(G,X,ue){G==X&&O(G,X,ue,"!=",f.notEqual)},f.deepEqual=function(G,X,ue){U(G,X,!1)||O(G,X,ue,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(G,X,ue){U(G,X,!0)||O(G,X,ue,"deepStrictEqual",f.deepStrictEqual)};function U(L,G,X,ue){if(L===G)return!0;if(a(L)&&a(G))return e(L,G)===0;if(o.isDate(L)&&o.isDate(G))return L.getTime()===G.getTime();if(o.isRegExp(L)&&o.isRegExp(G))return L.source===G.source&&L.global===G.global&&L.multiline===G.multiline&&L.lastIndex===G.lastIndex&&L.ignoreCase===G.ignoreCase;if((L===null||typeof L!="object")&&(G===null||typeof G!="object"))return X?L===G:L==G;if(h(L)&&h(G)&&m(L)===m(G)&&!(L instanceof Float32Array||L instanceof Float64Array))return e(new Uint8Array(L.buffer),new Uint8Array(G.buffer))===0;if(a(L)!==a(G))return!1;ue=ue||{actual:[],expected:[]};var ye=ue.actual.indexOf(L);return ye!==-1&&ye===ue.expected.indexOf(G)?!0:(ue.actual.push(L),ue.expected.push(G),ee(L,G,X,ue))}function q(L){return Object.prototype.toString.call(L)=="[object Arguments]"}function ee(L,G,X,ue){if(L==null||G===null||G===void 0)return!1;if(o.isPrimitive(L)||o.isPrimitive(G))return L===G;if(X&&Object.getPrototypeOf(L)!==Object.getPrototypeOf(G))return!1;var ye=q(L),Ne=q(G);if(ye&&!Ne||!ye&&Ne)return!1;if(ye)return L=u.call(L),G=u.call(G),U(L,G,X);var Ue=we(L),j=we(G),Y,_;if(Ue.length!==j.length)return!1;for(Ue.sort(),j.sort(),_=Ue.length-1;_>=0;_--)if(Ue[_]!==j[_])return!1;for(_=Ue.length-1;_>=0;_--)if(Y=Ue[_],!U(L[Y],G[Y],X,ue))return!1;return!0}f.notDeepEqual=function(G,X,ue){U(G,X,!1)&&O(G,X,ue,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=te;function te(L,G,X){U(L,G,!0)&&O(L,G,X,"notDeepStrictEqual",te)}f.strictEqual=function(G,X,ue){G!==X&&O(G,X,ue,"===",f.strictEqual)},f.notStrictEqual=function(G,X,ue){G===X&&O(G,X,ue,"!==",f.notStrictEqual)};function H(L,G){if(!L||!G)return!1;if(Object.prototype.toString.call(G)=="[object RegExp]")return G.test(L);try{if(L instanceof G)return!0}catch{}return Error.isPrototypeOf(G)?!1:G.call({},L)===!0}function re(L){var G;try{L()}catch(X){G=X}return G}function ce(L,G,X,ue){var ye;if(typeof G!="function")throw new TypeError('"block" argument must be a function');typeof X=="string"&&(ue=X,X=null),ye=re(G),ue=(X&&X.name?" ("+X.name+").":".")+(ue?" "+ue:"."),L&&!ye&&O(ye,X,"Missing expected exception"+ue);var Ne=typeof ue=="string",Ue=!L&&o.isError(ye),j=!L&&ye&&!X;if((Ue&&Ne&&H(ye,X)||j)&&O(ye,X,"Got unwanted exception"+ue),L&&ye&&X&&!H(ye,X)||!L&&ye)throw ye}f.throws=function(L,G,X){ce(!0,L,G,X)},f.doesNotThrow=function(L,G,X){ce(!1,L,G,X)},f.ifError=function(L){if(L)throw L};function pe(L,G){L||O(L,!0,G,"==",pe)}f.strict=t(pe,f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var we=Object.keys||function(L){var G=[];for(var X in L)s.call(L,X)&&G.push(X);return G};return ku.exports}var cc,Wf;function fE(){if(Wf)return cc;Wf=1;var t=hE();return cc=function(e){var a,o,s,u,c;for(a=Error.prepareStackTrace,Error.prepareStackTrace=function(m,h){return Error.prepareStackTrace=a,h},o=new Error().stack,c=0;c<o.length&&o[c].getFileName()!==__filename;)c++;t(c<o.length,"Unexpected: unable to find caller/index.js in the stack"),e=!e||isNaN(e)?1:e>o.length-2?o.length-2:e,o=o.slice(c+e+1);do u=o.shift(),s=u&&u.getFileName();while(o.length&&s==="module.js");return s},cc}var Vf;function gE(){if(Vf)return es;Vf=1;const t=Ii,e=Ii,a=MC(),o=fE();return es.getCallerRoot=function(){try{return a(o(2))}catch{return}},es.getProcessRoot=function(){let u=process.cwd();const c=e.join(u,"current");try{t.statSync(c).isDirectory()&&(u=c)}catch{}try{return a(u)}catch{return}},es}var dc,Hf;function yE(){return Hf||(Hf=1,dc=gE()),dc}var as={exports:{}},mc,qf;function bE(){if(qf)return mc;qf=1;var t=1e3,e=t*60,a=e*60,o=a*24,s=o*7,u=o*365.25;mc=function(y,k){k=k||{};var x=typeof y;if(x==="string"&&y.length>0)return c(y);if(x==="number"&&isFinite(y))return k.long?h(y):m(y);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(y))};function c(y){if(y=String(y),!(y.length>100)){var k=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(k){var x=parseFloat(k[1]),S=(k[2]||"ms").toLowerCase();switch(S){case"years":case"year":case"yrs":case"yr":case"y":return x*u;case"weeks":case"week":case"w":return x*s;case"days":case"day":case"d":return x*o;case"hours":case"hour":case"hrs":case"hr":case"h":return x*a;case"minutes":case"minute":case"mins":case"min":case"m":return x*e;case"seconds":case"second":case"secs":case"sec":case"s":return x*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}}}function m(y){var k=Math.abs(y);return k>=o?Math.round(y/o)+"d":k>=a?Math.round(y/a)+"h":k>=e?Math.round(y/e)+"m":k>=t?Math.round(y/t)+"s":y+"ms"}function h(y){var k=Math.abs(y);return k>=o?f(y,k,o,"day"):k>=a?f(y,k,a,"hour"):k>=e?f(y,k,e,"minute"):k>=t?f(y,k,t,"second"):y+" ms"}function f(y,k,x,S){var I=k>=x*1.5;return Math.round(y/x)+" "+S+(I?"s":"")}return mc}var pc,Zf;function kE(){if(Zf)return pc;Zf=1;function t(e){o.debug=o,o.default=o,o.coerce=f,o.disable=m,o.enable=u,o.enabled=h,o.humanize=bE(),o.destroy=y,Object.keys(e).forEach(k=>{o[k]=e[k]}),o.names=[],o.skips=[],o.formatters={};function a(k){let x=0;for(let S=0;S<k.length;S++)x=(x<<5)-x+k.charCodeAt(S),x|=0;return o.colors[Math.abs(x)%o.colors.length]}o.selectColor=a;function o(k){let x,S=null,I,O;function D(...U){if(!D.enabled)return;const q=D,ee=Number(new Date),te=ee-(x||ee);q.diff=te,q.prev=x,q.curr=ee,x=ee,U[0]=o.coerce(U[0]),typeof U[0]!="string"&&U.unshift("%O");let H=0;U[0]=U[0].replace(/%([a-zA-Z%])/g,(ce,pe)=>{if(ce==="%%")return"%";H++;const we=o.formatters[pe];if(typeof we=="function"){const L=U[H];ce=we.call(q,L),U.splice(H,1),H--}return ce}),o.formatArgs.call(q,U),(q.log||o.log).apply(q,U)}return D.namespace=k,D.useColors=o.useColors(),D.color=o.selectColor(k),D.extend=s,D.destroy=o.destroy,Object.defineProperty(D,"enabled",{enumerable:!0,configurable:!1,get:()=>S!==null?S:(I!==o.namespaces&&(I=o.namespaces,O=o.enabled(k)),O),set:U=>{S=U}}),typeof o.init=="function"&&o.init(D),D}function s(k,x){const S=o(this.namespace+(typeof x>"u"?":":x)+k);return S.log=this.log,S}function u(k){o.save(k),o.namespaces=k,o.names=[],o.skips=[];const x=(typeof k=="string"?k:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const S of x)S[0]==="-"?o.skips.push(S.slice(1)):o.names.push(S)}function c(k,x){let S=0,I=0,O=-1,D=0;for(;S<k.length;)if(I<x.length&&(x[I]===k[S]||x[I]==="*"))x[I]==="*"?(O=I,D=S,I++):(S++,I++);else if(O!==-1)I=O+1,D++,S=D;else return!1;for(;I<x.length&&x[I]==="*";)I++;return I===x.length}function m(){const k=[...o.names,...o.skips.map(x=>"-"+x)].join(",");return o.enable(""),k}function h(k){for(const x of o.skips)if(c(k,x))return!1;for(const x of o.names)if(c(k,x))return!0;return!1}function f(k){return k instanceof Error?k.stack||k.message:k}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o.enable(o.load()),o}return pc=t,pc}var Jf;function vE(){return Jf||(Jf=1,(function(t,e){e.formatArgs=o,e.save=s,e.load=u,e.useColors=a,e.storage=c(),e.destroy=(()=>{let h=!1;return()=>{h||(h=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function a(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let h;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(h=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(h[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(h){if(h[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+h[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;h.splice(1,0,f,"color: inherit");let y=0,k=0;h[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(k=y))}),h.splice(k,0,f)}e.log=console.debug||console.log||(()=>{});function s(h){try{h?e.storage.setItem("debug",h):e.storage.removeItem("debug")}catch{}}function u(){let h;try{h=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!h&&typeof process<"u"&&"env"in process&&(h=process.env.DEBUG),h}function c(){try{return localStorage}catch{}}t.exports=kE()(e);const{formatters:m}=t.exports;m.j=function(h){try{return JSON.stringify(h)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(as,as.exports)),as.exports}var Kf;function wE(){if(Kf)return _r.exports;Kf=1;const t=yE(),e=vE();return _r.exports=function(o){const s=t.getCallerRoot();let u;try{const c=Xa("/node_modules/.pnpm/@tryghost+debug@2.2.3_supports-color@5.5.0/node_modules/@tryghost/debug/lib")(s+"/package.json");c.alias?u=c.alias:u=c.name}catch{u="undefined"}return e(u+":"+o)},_r.exports._base=e,_r.exports}var hc,Xf;function xE(){return Xf||(Xf=1,hc=wE()),hc}const SE=[{code:"af",label:"Afrikaans"},{code:"ar",label:"Arabic"},{code:"bg",label:"Bulgarian"},{code:"bn",label:"Bengali"},{code:"bs",label:"Bosnian"},{code:"ca",label:"Catalan"},{code:"cs",label:"Czech"},{code:"da",label:"Danish"},{code:"de",label:"German"},{code:"de-CH",label:"Swiss German"},{code:"el",label:"Greek"},{code:"en",label:"English"},{code:"eo",label:"Esperanto"},{code:"es",label:"Spanish"},{code:"et",label:"Estonian"},{code:"eu",label:"Basque"},{code:"fa",label:"Persian/Farsi"},{code:"fi",label:"Finnish"},{code:"fr",label:"French"},{code:"gd",label:"Gaelic (Scottish)"},{code:"he",label:"Hebrew"},{code:"hi",label:"Hindi"},{code:"hr",label:"Croatian"},{code:"hu",label:"Hungarian"},{code:"id",label:"Indonesian"},{code:"is",label:"Icelandic"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"kz",label:"Kazakh"},{code:"lt",label:"Lithuanian"},{code:"lv",label:"Latvian"},{code:"mk",label:"Macedonian"},{code:"mn",label:"Mongolian"},{code:"ms",label:"Malay"},{code:"nb",label:"Norwegian Bokmål"},{code:"ne",label:"Nepali"},{code:"nl",label:"Dutch"},{code:"nn",label:"Norwegian Nynorsk"},{code:"pa",label:"Punjabi"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"pt-BR",label:"Portuguese (Brazil)"},{code:"ro",label:"Romanian"},{code:"ru",label:"Russian"},{code:"si",label:"Sinhala"},{code:"sk",label:"Slovak"},{code:"sl",label:"Slovenian"},{code:"sq",label:"Albanian"},{code:"sr",label:"Serbian"},{code:"sr-Cyrl",label:"Serbian (Cyrillic)"},{code:"sv",label:"Swedish"},{code:"sw",label:"Swahili"},{code:"ta",label:"Tamil"},{code:"th",label:"Thai"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu"},{code:"uz",label:"Uzbek"},{code:"vi",label:"Vietnamese"},{code:"zh",label:"Chinese"},{code:"zh-Hant",label:"Traditional Chinese"}];var Qf;function CE(){if(Qf)return Ni.exports;Qf=1;const t=AC(),e=Ii,a=Ii,o=xE()("i18n"),s=SE,u=s.map(h=>h.code);function c(h,f){return h.reduce((y,k)=>{let x;try{x=Xa("/ghost/i18n/lib")(`../locales/${k}/${f}.json`)}catch{x=Xa("/ghost/i18n/lib")(`../locales/en/${f}.json`)}return y[k]={[f]:{...x,...x.default&&typeof x.default=="object"?x.default:{}}},y},{})}function m(h,f){if(!f)return{[h]:{theme:{}}};let y=[];try{y=a.readdirSync(f).filter(S=>S.endsWith(".json")).map(S=>S.replace(".json",""))}catch{y=[h,"en"]}return[...new Set([h,...y,"en"])].reduce((x,S)=>{let I,O=!1;const D=e.join(f,`${S}.json`);if(a.existsSync(D))try{delete require.cache[Xa("/ghost/i18n/lib").resolve(D)],I=Xa("/ghost/i18n/lib")(D)}catch{o(`Error loading theme locale file: ${S}`),O=!0}else O=!0;if(O)if(S!=="en")try{const U=e.join(f,"en.json");a.existsSync(U)?(delete require.cache[Xa("/ghost/i18n/lib").resolve(U)],I=Xa("/ghost/i18n/lib")(U)):I={}}catch{I={}}else o("Theme en.json file not found"),I={};return x[S]={theme:{...I,...I.default&&typeof I.default=="object"?I.default:{}}},x},{})}return Ni.exports=(h="en",f="portal",y={})=>{const k=t.createInstance(),x={prefix:"{",suffix:"}"};(f==="theme"||f==="portal")&&(x.escapeValue=!1);let S;return f!=="theme"?S=c(u,f):(o(`generateThemeResources: ${h}, ${y.themePath}`),S=m(h,y.themePath)),k.init({lng:h,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:f,defaultNS:f,interpolation:x,resources:S}),k},Ni.exports.SUPPORTED_LOCALES=u,Ni.exports.LOCALE_DATA=s,Ni.exports.generateResources=c,Ni.exports}var _f;function EE(){if(_f)return Qa.exports;_f=1;const t=CE();return Qa.exports=t,Qa.exports.default=t,Qa.exports.LOCALE_DATA=t.LOCALE_DATA,Qa.exports.SUPPORTED_LOCALES=t.SUPPORTED_LOCALES,Qa.exports.generateResources=t.generateResources,Qa.exports}var jE=EE();const is=Ar(jE)("en","portal"),w=is.t.bind(is);class Pn extends Error{constructor(e,{code:a}={}){super(e),this.code=a??null}static async fromApiResponse(e){if(e.status===400||e.status===429)try{const a=await e.json();if(a.errors&&Array.isArray(a.errors)&&a.errors.length>0&&a.errors[0].message)return new Pn(a.errors[0].message,{code:a.errors[0].code})}catch{return}if(e.status===404){if(!(e.headers.get("content-type")||"").toLowerCase().includes("application/json"))return;try{const o=await e.json();if(o.errors&&Array.isArray(o.errors)&&o.errors.length>0&&o.errors[0].message)return new Pn(o.errors[0].message,{code:o.errors[0].code})}catch{return}}if(e.status===500)return new Pn("A server error occurred")}}const os=[];function _n(t,e){const a=(c,m=null)=>m?w(c,{number:m}):w(c),o=()=>{const c=m=>os.push(m);os.length===0&&(c("No member exists with this e-mail address."),c("This site is invite-only, contact the owner for access."),c("Unable to initiate checkout session"),c("This site is not accepting payments at the moment."),c("Too many attempts try again in {number} minutes."),c("Too many attempts try again in {number} hours."),c("Too many attempts try again in {number} days."),c("Too many different sign-in attempts, try again in {number} minutes"),c("Too many different sign-in attempts, try again in {number} hours"),c("Too many different sign-in attempts, try again in {number} days"),c("Failed to send magic link email"),c("This site only accepts paid members."),c("Signups from this email domain are currently restricted."),c("Too many sign-up attempts, try again later"),c("Memberships from this email domain are currently restricted."),c("Invalid verification code"))},s=c=>(os.length===0&&o(),!!os.includes(c)),u=(c=null)=>{if(!c)return{preparedMessage:"An error occurred",number:null};const m=c.match(/\d+/);return m&&(c=c.replace(m[0],"{number}")),{preparedMessage:c,number:m?m[0]:null}};if(!t&&!e)return w("An error occurred");if(t instanceof Pn||t.message){const{preparedMessage:c,number:m}=u(t.message);return s(c)?a(c,m):e||a(t?.message)}else return e||w("An error occurred")+": "+t.toString()}class fc extends z.Component{constructor(){super(...arguments),this.handleLoad=()=>{this.setupFrameBaseStyle()}}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.iframeHtml.setAttribute("dir",this.props.dataDir),this.forceUpdate())}render(){const{children:e,head:a,title:o="",style:s={},dataTestId:u="",dataDir:c="ltr",...m}=this.props;return l.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":u,ref:h=>this.node=h,title:o,style:s,frameBorder:"0",dir:c,...m,children:[this.iframeHead&&Fl.createPortal(a,this.iframeHead),this.iframeRoot&&Fl.createPortal(e,this.iframeRoot)]})}}const gc=t=>z.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},z.createElement("defs",null,z.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),z.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),z.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),z.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),eg=`
|
|
38
|
+
`,Ue+1);ye=ye.substring(j+1)}this.stack=ye}}},o.inherits(f.AssertionError,Error);function x(L,G){return typeof L=="string"?L.length<G?L:L.slice(0,G):L}function S(L){if(c||!o.isFunction(L))return o.inspect(L);var G=k(L),X=G?": "+G:"";return"[Function"+X+"]"}function I(L){return x(S(L.actual),128)+" "+L.operator+" "+x(S(L.expected),128)}function O(L,G,X,ue,ye){throw new f.AssertionError({message:X,actual:L,expected:G,operator:ue,stackStartFunction:ye})}f.fail=O;function D(L,G){L||O(L,!0,G,"==",f.ok)}f.ok=D,f.equal=function(G,X,ue){G!=X&&O(G,X,ue,"==",f.equal)},f.notEqual=function(G,X,ue){G==X&&O(G,X,ue,"!=",f.notEqual)},f.deepEqual=function(G,X,ue){U(G,X,!1)||O(G,X,ue,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(G,X,ue){U(G,X,!0)||O(G,X,ue,"deepStrictEqual",f.deepStrictEqual)};function U(L,G,X,ue){if(L===G)return!0;if(a(L)&&a(G))return e(L,G)===0;if(o.isDate(L)&&o.isDate(G))return L.getTime()===G.getTime();if(o.isRegExp(L)&&o.isRegExp(G))return L.source===G.source&&L.global===G.global&&L.multiline===G.multiline&&L.lastIndex===G.lastIndex&&L.ignoreCase===G.ignoreCase;if((L===null||typeof L!="object")&&(G===null||typeof G!="object"))return X?L===G:L==G;if(h(L)&&h(G)&&m(L)===m(G)&&!(L instanceof Float32Array||L instanceof Float64Array))return e(new Uint8Array(L.buffer),new Uint8Array(G.buffer))===0;if(a(L)!==a(G))return!1;ue=ue||{actual:[],expected:[]};var ye=ue.actual.indexOf(L);return ye!==-1&&ye===ue.expected.indexOf(G)?!0:(ue.actual.push(L),ue.expected.push(G),ee(L,G,X,ue))}function q(L){return Object.prototype.toString.call(L)=="[object Arguments]"}function ee(L,G,X,ue){if(L==null||G===null||G===void 0)return!1;if(o.isPrimitive(L)||o.isPrimitive(G))return L===G;if(X&&Object.getPrototypeOf(L)!==Object.getPrototypeOf(G))return!1;var ye=q(L),Ne=q(G);if(ye&&!Ne||!ye&&Ne)return!1;if(ye)return L=u.call(L),G=u.call(G),U(L,G,X);var Ue=we(L),j=we(G),Y,_;if(Ue.length!==j.length)return!1;for(Ue.sort(),j.sort(),_=Ue.length-1;_>=0;_--)if(Ue[_]!==j[_])return!1;for(_=Ue.length-1;_>=0;_--)if(Y=Ue[_],!U(L[Y],G[Y],X,ue))return!1;return!0}f.notDeepEqual=function(G,X,ue){U(G,X,!1)&&O(G,X,ue,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=te;function te(L,G,X){U(L,G,!0)&&O(L,G,X,"notDeepStrictEqual",te)}f.strictEqual=function(G,X,ue){G!==X&&O(G,X,ue,"===",f.strictEqual)},f.notStrictEqual=function(G,X,ue){G===X&&O(G,X,ue,"!==",f.notStrictEqual)};function H(L,G){if(!L||!G)return!1;if(Object.prototype.toString.call(G)=="[object RegExp]")return G.test(L);try{if(L instanceof G)return!0}catch{}return Error.isPrototypeOf(G)?!1:G.call({},L)===!0}function re(L){var G;try{L()}catch(X){G=X}return G}function ce(L,G,X,ue){var ye;if(typeof G!="function")throw new TypeError('"block" argument must be a function');typeof X=="string"&&(ue=X,X=null),ye=re(G),ue=(X&&X.name?" ("+X.name+").":".")+(ue?" "+ue:"."),L&&!ye&&O(ye,X,"Missing expected exception"+ue);var Ne=typeof ue=="string",Ue=!L&&o.isError(ye),j=!L&&ye&&!X;if((Ue&&Ne&&H(ye,X)||j)&&O(ye,X,"Got unwanted exception"+ue),L&&ye&&X&&!H(ye,X)||!L&&ye)throw ye}f.throws=function(L,G,X){ce(!0,L,G,X)},f.doesNotThrow=function(L,G,X){ce(!1,L,G,X)},f.ifError=function(L){if(L)throw L};function pe(L,G){L||O(L,!0,G,"==",pe)}f.strict=t(pe,f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var we=Object.keys||function(L){var G=[];for(var X in L)s.call(L,X)&&G.push(X);return G};return ku.exports}var cc,Wf;function fE(){if(Wf)return cc;Wf=1;var t=hE();return cc=function(e){var a,o,s,u,c;for(a=Error.prepareStackTrace,Error.prepareStackTrace=function(m,h){return Error.prepareStackTrace=a,h},o=new Error().stack,c=0;c<o.length&&o[c].getFileName()!==__filename;)c++;t(c<o.length,"Unexpected: unable to find caller/index.js in the stack"),e=!e||isNaN(e)?1:e>o.length-2?o.length-2:e,o=o.slice(c+e+1);do u=o.shift(),s=u&&u.getFileName();while(o.length&&s==="module.js");return s},cc}var Vf;function gE(){if(Vf)return es;Vf=1;const t=Ii,e=Ii,a=MC(),o=fE();return es.getCallerRoot=function(){try{return a(o(2))}catch{return}},es.getProcessRoot=function(){let u=process.cwd();const c=e.join(u,"current");try{t.statSync(c).isDirectory()&&(u=c)}catch{}try{return a(u)}catch{return}},es}var dc,Hf;function yE(){return Hf||(Hf=1,dc=gE()),dc}var as={exports:{}},mc,qf;function bE(){if(qf)return mc;qf=1;var t=1e3,e=t*60,a=e*60,o=a*24,s=o*7,u=o*365.25;mc=function(y,k){k=k||{};var x=typeof y;if(x==="string"&&y.length>0)return c(y);if(x==="number"&&isFinite(y))return k.long?h(y):m(y);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(y))};function c(y){if(y=String(y),!(y.length>100)){var k=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(k){var x=parseFloat(k[1]),S=(k[2]||"ms").toLowerCase();switch(S){case"years":case"year":case"yrs":case"yr":case"y":return x*u;case"weeks":case"week":case"w":return x*s;case"days":case"day":case"d":return x*o;case"hours":case"hour":case"hrs":case"hr":case"h":return x*a;case"minutes":case"minute":case"mins":case"min":case"m":return x*e;case"seconds":case"second":case"secs":case"sec":case"s":return x*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}}}function m(y){var k=Math.abs(y);return k>=o?Math.round(y/o)+"d":k>=a?Math.round(y/a)+"h":k>=e?Math.round(y/e)+"m":k>=t?Math.round(y/t)+"s":y+"ms"}function h(y){var k=Math.abs(y);return k>=o?f(y,k,o,"day"):k>=a?f(y,k,a,"hour"):k>=e?f(y,k,e,"minute"):k>=t?f(y,k,t,"second"):y+" ms"}function f(y,k,x,S){var I=k>=x*1.5;return Math.round(y/x)+" "+S+(I?"s":"")}return mc}var pc,Zf;function kE(){if(Zf)return pc;Zf=1;function t(e){o.debug=o,o.default=o,o.coerce=f,o.disable=m,o.enable=u,o.enabled=h,o.humanize=bE(),o.destroy=y,Object.keys(e).forEach(k=>{o[k]=e[k]}),o.names=[],o.skips=[],o.formatters={};function a(k){let x=0;for(let S=0;S<k.length;S++)x=(x<<5)-x+k.charCodeAt(S),x|=0;return o.colors[Math.abs(x)%o.colors.length]}o.selectColor=a;function o(k){let x,S=null,I,O;function D(...U){if(!D.enabled)return;const q=D,ee=Number(new Date),te=ee-(x||ee);q.diff=te,q.prev=x,q.curr=ee,x=ee,U[0]=o.coerce(U[0]),typeof U[0]!="string"&&U.unshift("%O");let H=0;U[0]=U[0].replace(/%([a-zA-Z%])/g,(ce,pe)=>{if(ce==="%%")return"%";H++;const we=o.formatters[pe];if(typeof we=="function"){const L=U[H];ce=we.call(q,L),U.splice(H,1),H--}return ce}),o.formatArgs.call(q,U),(q.log||o.log).apply(q,U)}return D.namespace=k,D.useColors=o.useColors(),D.color=o.selectColor(k),D.extend=s,D.destroy=o.destroy,Object.defineProperty(D,"enabled",{enumerable:!0,configurable:!1,get:()=>S!==null?S:(I!==o.namespaces&&(I=o.namespaces,O=o.enabled(k)),O),set:U=>{S=U}}),typeof o.init=="function"&&o.init(D),D}function s(k,x){const S=o(this.namespace+(typeof x>"u"?":":x)+k);return S.log=this.log,S}function u(k){o.save(k),o.namespaces=k,o.names=[],o.skips=[];const x=(typeof k=="string"?k:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const S of x)S[0]==="-"?o.skips.push(S.slice(1)):o.names.push(S)}function c(k,x){let S=0,I=0,O=-1,D=0;for(;S<k.length;)if(I<x.length&&(x[I]===k[S]||x[I]==="*"))x[I]==="*"?(O=I,D=S,I++):(S++,I++);else if(O!==-1)I=O+1,D++,S=D;else return!1;for(;I<x.length&&x[I]==="*";)I++;return I===x.length}function m(){const k=[...o.names,...o.skips.map(x=>"-"+x)].join(",");return o.enable(""),k}function h(k){for(const x of o.skips)if(c(k,x))return!1;for(const x of o.names)if(c(k,x))return!0;return!1}function f(k){return k instanceof Error?k.stack||k.message:k}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o.enable(o.load()),o}return pc=t,pc}var Jf;function vE(){return Jf||(Jf=1,(function(t,e){e.formatArgs=o,e.save=s,e.load=u,e.useColors=a,e.storage=c(),e.destroy=(()=>{let h=!1;return()=>{h||(h=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function a(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let h;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(h=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(h[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(h){if(h[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+h[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;h.splice(1,0,f,"color: inherit");let y=0,k=0;h[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(k=y))}),h.splice(k,0,f)}e.log=console.debug||console.log||(()=>{});function s(h){try{h?e.storage.setItem("debug",h):e.storage.removeItem("debug")}catch{}}function u(){let h;try{h=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!h&&typeof process<"u"&&"env"in process&&(h=process.env.DEBUG),h}function c(){try{return localStorage}catch{}}t.exports=kE()(e);const{formatters:m}=t.exports;m.j=function(h){try{return JSON.stringify(h)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(as,as.exports)),as.exports}var Kf;function wE(){if(Kf)return _r.exports;Kf=1;const t=yE(),e=vE();return _r.exports=function(o){const s=t.getCallerRoot();let u;try{const c=Xa("/node_modules/.pnpm/@tryghost+debug@2.2.3/node_modules/@tryghost/debug/lib")(s+"/package.json");c.alias?u=c.alias:u=c.name}catch{u="undefined"}return e(u+":"+o)},_r.exports._base=e,_r.exports}var hc,Xf;function xE(){return Xf||(Xf=1,hc=wE()),hc}const SE=[{code:"af",label:"Afrikaans"},{code:"ar",label:"Arabic"},{code:"bg",label:"Bulgarian"},{code:"bn",label:"Bengali"},{code:"bs",label:"Bosnian"},{code:"ca",label:"Catalan"},{code:"cs",label:"Czech"},{code:"da",label:"Danish"},{code:"de",label:"German"},{code:"de-CH",label:"Swiss German"},{code:"el",label:"Greek"},{code:"en",label:"English"},{code:"eo",label:"Esperanto"},{code:"es",label:"Spanish"},{code:"et",label:"Estonian"},{code:"eu",label:"Basque"},{code:"fa",label:"Persian/Farsi"},{code:"fi",label:"Finnish"},{code:"fr",label:"French"},{code:"gd",label:"Gaelic (Scottish)"},{code:"he",label:"Hebrew"},{code:"hi",label:"Hindi"},{code:"hr",label:"Croatian"},{code:"hu",label:"Hungarian"},{code:"id",label:"Indonesian"},{code:"is",label:"Icelandic"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"kz",label:"Kazakh"},{code:"lt",label:"Lithuanian"},{code:"lv",label:"Latvian"},{code:"mk",label:"Macedonian"},{code:"mn",label:"Mongolian"},{code:"ms",label:"Malay"},{code:"nb",label:"Norwegian Bokmål"},{code:"ne",label:"Nepali"},{code:"nl",label:"Dutch"},{code:"nn",label:"Norwegian Nynorsk"},{code:"pa",label:"Punjabi"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"pt-BR",label:"Portuguese (Brazil)"},{code:"ro",label:"Romanian"},{code:"ru",label:"Russian"},{code:"si",label:"Sinhala"},{code:"sk",label:"Slovak"},{code:"sl",label:"Slovenian"},{code:"sq",label:"Albanian"},{code:"sr",label:"Serbian"},{code:"sr-Cyrl",label:"Serbian (Cyrillic)"},{code:"sv",label:"Swedish"},{code:"sw",label:"Swahili"},{code:"ta",label:"Tamil"},{code:"th",label:"Thai"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu"},{code:"uz",label:"Uzbek"},{code:"vi",label:"Vietnamese"},{code:"zh",label:"Chinese"},{code:"zh-Hant",label:"Traditional Chinese"}];var Qf;function CE(){if(Qf)return Ni.exports;Qf=1;const t=AC(),e=Ii,a=Ii,o=xE()("i18n"),s=SE,u=s.map(h=>h.code);function c(h,f){return h.reduce((y,k)=>{let x;try{x=Xa("/ghost/i18n/lib")(`../locales/${k}/${f}.json`)}catch{x=Xa("/ghost/i18n/lib")(`../locales/en/${f}.json`)}return y[k]={[f]:{...x,...x.default&&typeof x.default=="object"?x.default:{}}},y},{})}function m(h,f){if(!f)return{[h]:{theme:{}}};let y=[];try{y=a.readdirSync(f).filter(S=>S.endsWith(".json")).map(S=>S.replace(".json",""))}catch{y=[h,"en"]}return[...new Set([h,...y,"en"])].reduce((x,S)=>{let I,O=!1;const D=e.join(f,`${S}.json`);if(a.existsSync(D))try{delete require.cache[Xa("/ghost/i18n/lib").resolve(D)],I=Xa("/ghost/i18n/lib")(D)}catch{o(`Error loading theme locale file: ${S}`),O=!0}else O=!0;if(O)if(S!=="en")try{const U=e.join(f,"en.json");a.existsSync(U)?(delete require.cache[Xa("/ghost/i18n/lib").resolve(U)],I=Xa("/ghost/i18n/lib")(U)):I={}}catch{I={}}else o("Theme en.json file not found"),I={};return x[S]={theme:{...I,...I.default&&typeof I.default=="object"?I.default:{}}},x},{})}return Ni.exports=(h="en",f="portal",y={})=>{const k=t.createInstance(),x={prefix:"{",suffix:"}"};(f==="theme"||f==="portal")&&(x.escapeValue=!1);let S;return f!=="theme"?S=c(u,f):(o(`generateThemeResources: ${h}, ${y.themePath}`),S=m(h,y.themePath)),k.init({lng:h,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:f,defaultNS:f,interpolation:x,resources:S}),k},Ni.exports.SUPPORTED_LOCALES=u,Ni.exports.LOCALE_DATA=s,Ni.exports.generateResources=c,Ni.exports}var _f;function EE(){if(_f)return Qa.exports;_f=1;const t=CE();return Qa.exports=t,Qa.exports.default=t,Qa.exports.LOCALE_DATA=t.LOCALE_DATA,Qa.exports.SUPPORTED_LOCALES=t.SUPPORTED_LOCALES,Qa.exports.generateResources=t.generateResources,Qa.exports}var jE=EE();const is=Ar(jE)("en","portal"),w=is.t.bind(is);class Pn extends Error{constructor(e,{code:a}={}){super(e),this.code=a??null}static async fromApiResponse(e){if(e.status===400||e.status===429)try{const a=await e.json();if(a.errors&&Array.isArray(a.errors)&&a.errors.length>0&&a.errors[0].message)return new Pn(a.errors[0].message,{code:a.errors[0].code})}catch{return}if(e.status===404){if(!(e.headers.get("content-type")||"").toLowerCase().includes("application/json"))return;try{const o=await e.json();if(o.errors&&Array.isArray(o.errors)&&o.errors.length>0&&o.errors[0].message)return new Pn(o.errors[0].message,{code:o.errors[0].code})}catch{return}}if(e.status===500)return new Pn("A server error occurred")}}const os=[];function _n(t,e){const a=(c,m=null)=>m?w(c,{number:m}):w(c),o=()=>{const c=m=>os.push(m);os.length===0&&(c("No member exists with this e-mail address."),c("This site is invite-only, contact the owner for access."),c("Unable to initiate checkout session"),c("This site is not accepting payments at the moment."),c("Too many attempts try again in {number} minutes."),c("Too many attempts try again in {number} hours."),c("Too many attempts try again in {number} days."),c("Too many different sign-in attempts, try again in {number} minutes"),c("Too many different sign-in attempts, try again in {number} hours"),c("Too many different sign-in attempts, try again in {number} days"),c("Failed to send magic link email"),c("This site only accepts paid members."),c("Signups from this email domain are currently restricted."),c("Too many sign-up attempts, try again later"),c("Memberships from this email domain are currently restricted."),c("Invalid verification code"))},s=c=>(os.length===0&&o(),!!os.includes(c)),u=(c=null)=>{if(!c)return{preparedMessage:"An error occurred",number:null};const m=c.match(/\d+/);return m&&(c=c.replace(m[0],"{number}")),{preparedMessage:c,number:m?m[0]:null}};if(!t&&!e)return w("An error occurred");if(t instanceof Pn||t.message){const{preparedMessage:c,number:m}=u(t.message);return s(c)?a(c,m):e||a(t?.message)}else return e||w("An error occurred")+": "+t.toString()}class fc extends z.Component{constructor(){super(...arguments),this.handleLoad=()=>{this.setupFrameBaseStyle()}}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.iframeHtml.setAttribute("dir",this.props.dataDir),this.forceUpdate())}render(){const{children:e,head:a,title:o="",style:s={},dataTestId:u="",dataDir:c="ltr",...m}=this.props;return l.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":u,ref:h=>this.node=h,title:o,style:s,frameBorder:"0",dir:c,...m,children:[this.iframeHead&&Fl.createPortal(a,this.iframeHead),this.iframeRoot&&Fl.createPortal(e,this.iframeRoot)]})}}const gc=t=>z.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},z.createElement("defs",null,z.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),z.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),z.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),z.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),eg=`
|
|
39
39
|
.gh-portal-avatar {
|
|
40
40
|
position: relative;
|
|
41
41
|
display: flex;
|
|
@@ -4578,5 +4578,5 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
4578
4578
|
}
|
|
4579
4579
|
`;function iT({site:t}){return bc+tT+L1+ej+mj+U1()+$1+D1+R1+eg+k0+t0+S0()+Yc+v0+nT+aT+E0+O0+A0+M0+F0+R0+g0+V0+L0+Z0+Q0+_0}const Td=class Td extends Je.Component{constructor(e){super(e),this.state={email:"",token:void 0}}componentDidMount(){const{member:e}=this.context;e&&this.context.doAction("switchPage",{page:"accountHome"})}handleSignin(e){e.preventDefault(),this.doSignin()}doSignin(){this.setState(e=>({errors:Li({fields:this.getInputFields({state:e})})}),async()=>{const{email:e,phonenumber:a,errors:o,token:s}=this.state,{redirect:u}=this.context.pageData??{};o&&Object.values(o).filter(m=>!!m).length>0||this.context.doAction("signin",{email:e,phonenumber:a,redirect:u,token:s})})}handleInputChange(e,a){const o=a.name;this.setState({[o]:e.target.value})}onKeyDown(e){e.keyCode===13&&this.handleSignin(e)}getInputFields({state:e}){const a=e.errors||{};return[{type:"email",value:e.email,placeholder:w("jamie@example.com"),label:w("Email"),name:"email",required:!0,errorMessage:a.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(){const{action:e}=this.context;let a=!1;const o=e==="signin:running";let s=w(o?"Sending login link...":"Continue");const u=!!o;return e==="signin:failed"&&(s=w("Retry"),a=!0),l.jsx(dt,{dataTestId:"signin",retry:a,style:{width:"100%"},onClick:c=>this.handleSignin(c),disabled:u,brandColor:this.context.brandColor,label:s,isRunning:o})}renderSignupMessage(){const{brandColor:e}=this.context;return l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:w("Don't have an account?")}),l.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:l.jsx("span",{children:w("Sign up")})})]})}renderForm(){const{site:e}=this.context,a=ls({site:e})&&ea({site:e});return ka({site:e})?l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section",children:l.jsx(Vo,{fields:this.getInputFields({state:this.state}),onChange:(o,s)=>this.handleInputChange(o,s),onKeyDown:(o,s)=>this.onKeyDown(o,s)})}),l.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),a&&this.renderSignupMessage()]})]}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:w("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:e}=this.context,a=e.icon;return a?l.jsx("img",{className:"gh-portal-signup-logo",src:a,alt:this.context.site.title}):ka({site:e})?null:l.jsx(Rg,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:e}=this.context,a=e.title;return ka({site:e})?l.jsx("h1",{className:"gh-portal-main-title",children:w("Sign in")}):l.jsx("h1",{className:"gh-portal-main-title",children:a})}renderFormHeader(){return l.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return l.jsxs(l.Fragment,{children:[l.jsx(mt,{}),l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};Td.contextType=ke;let ld=Td;const oT=({handleSignout:t,supportAddress:e=""})=>{const a=`mailto:${e}`;return l.jsxs("footer",{className:"gh-portal-account-footer",children:[l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:o=>t(o),children:w("Sign out")})})}),l.jsx("div",{className:"gh-portal-account-footerright",children:l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:a,target:"_blank",rel:"noopener noreferrer",children:w("Contact support")})})})})]})},rT=()=>{const{member:t,brandColor:e}=z.useContext(ke),a=t.avatar_image;return l.jsxs("header",{className:"gh-portal-account-header",children:[l.jsx(yc,{gravatar:a,style:{userIcon:{color:e,width:"56px",height:"56px",padding:"2px"}}}),l.jsx("h2",{className:"gh-portal-main-title",children:w("Your account")})]})},sT=()=>{const{site:t,action:e,brandColor:a,doAction:o}=z.useContext(ke);if(!ls({site:t})||!ea({site:t}))return null;const s=["checkoutPlan:running"].includes(e),u=()=>{o("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return l.jsx(dt,{dataTestId:"view-plans",isRunning:s,label:w("View plans"),onClick:()=>u(),brandColor:a,style:{width:"100%"}})},lT=()=>{const{member:t,site:e}=z.useContext(ke),{paid_members_enabled:a}=e;if(!a||Oi({site:e}))return null;const o=nn({member:t}),s=ba({member:t});if(s&&!o)return null;if(o){const u=o?.current_period_end,c=rs({member:t});if(Rn({member:t}))return c?l.jsx("div",{className:"gh-portal-section",style:{marginBottom:24},children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:w("Your gift subscription will expire on {expiryDate}",{expiryDate:c})})}):null;if(s&&c)return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:w("Your subscription will expire on {expiryDate}",{expiryDate:c})})});if(o?.cancel_at_period_end||s)return null;if(xc({sub:o})){const m=ga(o.trial_end_at);return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:w("Your subscription will start on {subscriptionStart}",{subscriptionStart:m})})})}return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:w("Your subscription will renew on {renewalDate}",{renewalDate:ga(u)})})})}return l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:w("You currently have a free membership, upgrade to a paid subscription for full access.")}),l.jsx(sT,{})]})},uT=()=>{const{member:t,doAction:e,action:a,brandColor:o}=z.useContext(ke),s=nn({member:t});if(!s||!s.cancel_at_period_end)return null;const u=w("Resume subscription"),c=["continueSubscription:running"].includes(a),m=!!c,h=ga(s.current_period_end);return l.jsx("div",{className:"gh-portal-cancelcontinue-container",children:l.jsxs("div",{className:"gh-portal-cancel-banner",children:[l.jsx("p",{children:l.jsx(zt,{string:w("Your subscription has been canceled and will expire on {expiryDate}."),mapping:{expiryDate:l.jsx("strong",{children:h})}})}),l.jsx(dt,{onClick:()=>{e("continueSubscription",{subscriptionId:s.id})},isRunning:c,disabled:m,isPrimary:!0,brandColor:o,label:u,style:{width:"100%"}})]})})},cT=()=>{const{member:t,site:e,doAction:a,action:o,brandColor:s}=z.useContext(ke);if(!(Rn({member:t})&&!kc({member:t,site:e})&&Ai({site:e}))||!rs({member:t}))return null;const m=o==="continueGiftSubscription:running";return l.jsx("div",{className:"gh-portal-cancelcontinue-container",children:l.jsxs("div",{className:"gh-portal-cancel-banner",children:[l.jsx("p",{style:{maxWidth:"none",margin:"0 0 16px",textAlign:"center",textWrap:"pretty"},children:w("Continue with a paid subscription anytime. Your remaining gift period will be added as a free trial.")}),l.jsx(dt,{onClick:()=>a("continueGiftSubscription"),isRunning:m,disabled:m,isPrimary:!0,brandColor:s,label:w("Continue subscription"),style:{width:"100%"}})]})})},dT=t=>z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...t},z.createElement("rect",{x:3,y:8,width:18,height:4,rx:1}),z.createElement("path",{d:"M12 8v13"}),z.createElement("path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"}),z.createElement("path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5C9 3 12 8 12 8"}),z.createElement("path",{d:"M16.5 8a2.5 2.5 0 0 0 0-5C15 3 12 8 12 8"})),mT=t=>z.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},z.createElement("defs",null,z.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),z.createElement("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"}),z.createElement("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"})),pT=()=>{const{member:t,site:e,doAction:a}=z.useContext(ke),o=()=>{const S=nn({member:t});a("manageBilling",{subscriptionId:S.id})},s=()=>{Ai({site:e})&&a("switchPage",{page:"accountPlan",lastPage:"accountHome"})},u=({price:S,isComplimentary:I,subscription:O})=>{const{next_payment:D}=O||{};let U="";if(S){const{amount:ce=0,currency:pe,interval:we}=S;U=`${Intl.NumberFormat("en",{currency:pe,style:"currency"}).format(ce/100)}/${w(we)}`}const q=rs({member:t});if(Rn({member:t})&&q)return l.jsxs("p",{className:"gh-portal-account-discountcontainer",children:[l.jsx(dT,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:w("Gift subscription")}),l.jsx("span",{className:"gh-portal-account-expiry-separator",children:"-"}),l.jsx("span",{className:"gh-portal-account-expiry",children:w("Expires {expiryDate}",{expiryDate:q})})]});I&&(q?U=`${w("Complimentary")} - ${w("Expires {expiryDate}",{expiryDate:q})}`:U=w("Complimentary"));let ee="";if(xc({sub:O}))return ee="gh-portal-account-old-price",l.jsxs(l.Fragment,{children:[l.jsx("p",{className:ee,children:U}),l.jsx(hT,{subscription:O})]});let H=fT({nextPayment:D});H&&(ee="gh-portal-account-old-price");const re=()=>H?l.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[l.jsx(mT,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:H})]}):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:ee,children:U}),l.jsx(re,{})]})},c=({isPaid:S})=>{const I=Rn({member:t});if(I&&!Ai({site:e}))return null;const O=I&&!kc({member:t,site:e});return Oi({site:e})&&(!S||I&&!O)?null:O?l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:D=>{D.stopPropagation(),a("continueGiftSubscription")},"data-test-button":"continue-gift-subscription",children:w("Continue")}):l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:D=>{D.stopPropagation(),s()},"data-test-button":"change-plan",children:w("Change")})},m=({defaultCardLast4:S})=>{if(S){const I=`**** **** **** ${S}`;return l.jsx("p",{children:I})}return null},h=({defaultCardLast4:S})=>{const{action:I}=z.useContext(ke),O=I==="manageBilling:running"?l.jsx(Yi,{className:"gh-portal-billing-button-loader"}):w("Update");return l.jsxs("section",{className:"gh-portal-list-clickable",role:"button",tabIndex:0,onClick:o,onKeyDown:D=>{D.target===D.currentTarget&&(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),o())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:w("Billing info & receipts")}),l.jsx(m,{defaultCardLast4:S})]}),l.jsx("span",{className:"gh-portal-list-action","data-test-button":"manage-billing","aria-hidden":"true",children:O})]})},f=nn({member:t}),y=ba({member:t}),k=Rn({member:t}),x=Yn({member:t});if(f||y){const{price:S,default_payment_card_last4:I}=f||{};let O=w("Plan");return vc({member:t})&&(O=vc({member:t})),l.jsxs(l.Fragment,{children:[l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsxs("h3",{children:[O,f?.cancel_at_period_end&&l.jsx("span",{className:"gh-portal-canceled-badge",children:w("Canceled")})]}),l.jsx(u,{price:S,isComplimentary:y,subscription:f})]}),l.jsx(c,{isPaid:x})]}),!y&&!k&&l.jsx(h,{defaultCardLast4:I})]})}return null};function hT({subscription:t}){if(xc({sub:t})){const e=ga(t.trial_end_at);return l.jsx("p",{className:"gh-portal-account-discountcontainer",children:l.jsx("div",{children:l.jsx("span",{children:w("Free Trial – Ends {trialEnd}",{trialEnd:e})})})})}return null}function fT({nextPayment:t}){if(!t)return"";const e=t.discount;if(!e)return"";const a=e.end?w("Ends {offerEndDate}",{offerEndDate:ga(e.end)}):w("Forever");return`${`${Intl.NumberFormat("en",{currency:t.currency,style:"currency"}).format(t.amount/100)}/${w(t.interval)}`}${a?` — ${a}`:""}`}function gT(){const{member:t,site:e,doAction:a}=z.useContext(ke);let{newsletters:o}=t;const s=!!o?.length;let u=w(s?"Subscribed":"Unsubscribed");const c=()=>{const m=ai({site:e}),h=t?.newsletters?.length?[]:m;a("updateNewsletterPreference",{newsletters:h})};return l.jsxs("section",{className:"gh-portal-list-clickable",role:"button",tabIndex:0,"aria-pressed":s,onClick:c,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())},children:[l.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[l.jsx("h3",{children:w("Email newsletter")}),l.jsxs("p",{children:[u," ",Sc({member:t})&&s&&l.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:m=>{m.stopPropagation(),a("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"})},children:w("Not receiving emails?")})]})]}),l.jsx("div",{onClick:m=>m.stopPropagation(),children:l.jsx(Go,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",label:w("Email newsletter"),onToggle:m=>{c()},checked:s,presentational:!0})})]})}const py=t=>z.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...t},z.createElement("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"}),z.createElement("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 yT(){return l.jsxs("p",{className:"gh-portal-email-notice",children:[l.jsx(py,{className:"gh-portal-email-notice-icon"}),l.jsx("span",{className:"gh-mobile-only",children:w("You're not receiving emails")}),l.jsx("span",{className:"gh-desktop-only",children:w("You're currently not receiving emails")})]})}function bT(){const{doAction:t,member:e,site:a}=z.useContext(ke),o=og({member:e}),s=Mo({site:a}),u=us({site:a}),c=o?"emailSuppressed":"accountEmail",m=!s&&!u,h=()=>o||m?l.jsx(yT,{}):l.jsx("p",{children:w("Update your preferences")}),f=()=>{t("switchPage",{page:c,lastPage:"accountHome"})};return l.jsxs("section",{className:"gh-portal-list-clickable",role:"button",tabIndex:0,onClick:f,onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),f())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:w("Emails")}),h()]}),l.jsx("span",{className:"gh-portal-list-action","data-test-button":"manage-newsletters","aria-hidden":"true",children:w("Manage")})]})}const kT=()=>{const{member:t,site:e}=z.useContext(ke),o=e.transistor_portal_settings||{enabled:e.transistor_portal_enabled===!0,heading:e.transistor_portal_heading,description:e.transistor_portal_description,button_text:e.transistor_portal_button_text,url_template:e.transistor_portal_url_template},s=o?.enabled===!0,u=t?.uuid,c=cg(),[m,h]=z.useState(c&&s);return z.useEffect(()=>{if(c){h(s);return}if(!s||!u){h(!1);return}h(!1);const f=new AbortController;return(async()=>{try{const k=await fetch(`https://partner.transistor.fm/ghost/member/${u}`,{signal:f.signal});if(k.ok){const x=await k.json();f.signal.aborted||h(x?.member===!0)}}catch(k){if(f.signal.aborted)return;console.warn("Error in Transistor request",k)}})(),()=>f.abort()},[s,u,c]),{transistor:{enabled:s,hasPodcasts:m,memberUuid:u,settings:o}}},vT=(t,e)=>Fo({site:t})&&Mo({site:t})||us({site:t})||og({member:e}),wT=t=>!Fo({site:t})&&Mo({site:t})&&!us({site:t}),xT=()=>{const{member:t,doAction:e,site:a}=z.useContext(ke),{name:o,email:s}=t,{transistor:u}=kT(),c=()=>{e("switchPage",{page:"accountProfile",lastPage:"accountHome"})},m=vT(a,t),h=wT(a);return l.jsx("div",{children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsxs("section",{className:"gh-portal-list-clickable",role:"button",tabIndex:0,onClick:c,onKeyDown:f=>{f.target===f.currentTarget&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:o||w("Account")}),l.jsx("p",{children:s})]}),l.jsx("span",{"data-test-button":"edit-profile",className:"gh-portal-list-action","aria-hidden":"true",children:w("Edit")})]}),l.jsx(pT,{}),m&&l.jsx(bT,{}),h&&l.jsx(gT,{}),u.enabled&&l.jsx(eT,{hasPodcasts:u.hasPodcasts,memberUuid:u.memberUuid,settings:u.settings})]})})},ST=()=>l.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[l.jsx(mt,{}),l.jsx(rT,{}),l.jsxs("section",{className:"gh-portal-account-data",children:[l.jsx(lT,{}),l.jsx(cT,{}),l.jsx(uT,{}),l.jsx(xT,{})]})]}),Pd=class Pd extends Je.Component{componentDidMount(){const{member:e,site:a}=this.context;ka({site:a})||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(){const{member:e,site:a}=this.context,o=Ro({site:a});return!e||!ka({site:a})?null:l.jsxs("div",{className:"gh-portal-account-wrapper",children:[l.jsx(ST,{}),l.jsx(oT,{onClose:()=>this.context.doAction("closePopup"),handleSignout:s=>this.handleSignout(s),supportAddress:o})]})}};Pd.contextType=ke;let ud=Pd;const zd=class zd extends Je.Component{constructor(e,a){super(e,a);const{name:o="",email:s=""}=a.member||{};this.state={name:o,email:s}}componentDidMount(){const{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(a=>({errors:Li({fields:this.getInputFields({state:a})})}),()=>{const{email:a,name:o,errors:s}=this.state;s&&Object.values(s).filter(c=>!!c).length>0||(this.context.doAction("clearPopupNotification"),this.context.doAction("updateProfile",{email:a,name:o}))})}renderSaveButton(){const e=this.context.action==="updateProfile:running";let a=w("Save");this.context.action==="updateProfile:failed"&&(a=w("Retry"));const o=!!e;return l.jsx(dt,{dataTestId:"save-button",isRunning:e,onClick:s=>this.onProfileSave(s),disabled:o,brandColor:this.context.brandColor,label:a,style:{width:"100%"}})}renderDeleteAccountButton(){return l.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:w("Delete account")})}renderAccountFooter(){return l.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Ri,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:e=>this.onBack(e)}),l.jsx("h3",{className:"gh-portal-main-title",children:w("Account settings")})]})}renderUserAvatar(){const e=this.context.member&&this.context.member.avatar_image,a={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"};return l.jsx("div",{style:a,children:l.jsx(yc,{gravatar:e,style:{userIcon:{color:"black",width:"56px",height:"56px"}}})})}handleInputChange(e,a){const o=a.name;this.setState({[o]:e.target.value})}getInputFields({state:e,fieldNames:a}){const o=e.errors||{},s=[{type:"text",value:e.name,placeholder:w("Jamie Larson"),label:w("Name"),name:"name",required:!1,errorMessage:o.name||""},{type:"email",value:e.email,placeholder:w("jamie@example.com"),label:w("Email"),name:"email",required:!0,errorMessage:o.email||""}];return a&&a.length>0?s.filter(u=>a.includes(u.name)):s}onKeyDown(e){e.keyCode===13&&this.onProfileSave(e)}renderProfileData(){return l.jsx("div",{className:"gh-portal-section",children:l.jsx(Vo,{fields:this.getInputFields({state:this.state}),onChange:(e,a)=>this.handleInputChange(e,a),onKeyDown:(e,a)=>this.onKeyDown(e,a)})})}render(){const{member:e}=this.context;return e?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-content with-footer",children:[this.renderHeader(),l.jsx(mt,{}),l.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};zd.contextType=ke;let cd=zd;function CT(){const{brandColor:t,lastPage:e,doAction:a}=z.useContext(ke);return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Ri,{brandColor:t,hidden:!e,onClick:()=>{a("back")}}),l.jsx("h3",{className:"gh-portal-main-title",children:w("Email preferences")})]})}function ET({newsletter:t,subscribedNewsletters:e,setSubscribedNewsletters:a}){const o=e.some(u=>u.id===t?.id),s=()=>{let u=[];o?u=e.filter(c=>c.id!==t.id):u=e.filter(c=>c.id!==t.id).concat(t),a(u)};return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper gh-portal-list-clickable","data-testid":"newsletter-toggle",role:"button",tabIndex:0,"aria-pressed":o,onClick:s,onKeyDown:u=>{u.target===u.currentTarget&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:t.name}),l.jsx("p",{children:t?.description})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},onClick:u=>u.stopPropagation(),children:l.jsx(Go,{id:t.id,label:t.name,onToggle:s,checked:o,dataTestId:"switch-input",presentational:!0})})]})}function jT({updateCommentNotifications:t,isCommentsEnabled:e,enableCommentNotifications:a}){const{doAction:o}=z.useContext(ke),s=!!a,u=z.useRef(!1);if(!e)return null;const c=async()=>{if(!u.current){u.current=!0;try{await t(!s),o("showPopupNotification",{action:"updated:success",message:w("Comment preferences updated.")})}finally{u.current=!1}}};return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper gh-portal-list-clickable","data-testid":"comment-toggle",role:"button",tabIndex:0,"aria-pressed":s,onClick:c,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:w("Comments")}),l.jsx("p",{children:w("Get notified when someone replies to your comment")})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},onClick:m=>m.stopPropagation(),children:l.jsx(Go,{id:"comments",label:w("Comments"),onToggle:c,checked:s,dataTestId:"switch-input",presentational:!0})})]})}function TT({updateUpdatesAndAnnouncements:t,canChangeUpdatesAndAnnouncements:e,enableUpdatesAndAnnouncements:a}){const{doAction:o,site:s}=z.useContext(ke),u=z.useRef(!1);if(!e)return null;const c=async()=>{if(!u.current){u.current=!0;try{await t(!a),o("showPopupNotification",{action:"updated:success",message:w("Email preferences updated.")})}finally{u.current=!1}}};return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper gh-portal-list-clickable","data-testid":"updates-and-announcements-toggle",role:"button",tabIndex:0,"aria-pressed":!!a,onClick:c,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())},children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:w("Updates & announcements")}),l.jsx("p",{children:w("Occasional updates from {siteTitle}",{siteTitle:s?.title})})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},onClick:m=>m.stopPropagation(),children:l.jsx(Go,{id:"updates-and-announcements",label:w("Updates & announcements"),onToggle:c,checked:a,dataTestId:"switch-input",presentational:!0})})]})}function PT({subscribedNewsletters:t,setSubscribedNewsletters:e,hasNewslettersEnabled:a}){const{site:o}=z.useContext(ke),s=ai({site:o});return a?s.map(u=>l.jsx(ET,{newsletter:u,subscribedNewsletters:t,setSubscribedNewsletters:e},u?.id)):null}function zT({site:t,isPaid:e}){return e?l.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:w("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:t?.title})}):null}function hy({hasNewslettersEnabled:t,notification:e,subscribedNewsletters:a,updateSubscribedNewsletters:o,updateCommentNotifications:s,updateUpdatesAndAnnouncements:u,unsubscribeAll:c,isPaidMember:m,isCommentsEnabled:h,enableCommentNotifications:f,canChangeUpdatesAndAnnouncements:y,enableUpdatesAndAnnouncements:k}){const{brandColor:x,doAction:S,member:I,site:O}=z.useContext(ke),D=z.useRef(!!a?.length).current,U=k!=null,q=U?k:D,ee=h&&!f||!h,te=y&&!q||!y,H=!a?.length&&ee&&te,ce=e||(()=>null);return l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(CT,{}),l.jsx(mt,{brandColor:x}),l.jsx(ce,{}),l.jsx("div",{className:"gh-portal-section flex",children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsx(PT,{hasNewslettersEnabled:t,subscribedNewsletters:a,setSubscribedNewsletters:pe=>{let we=pe.map(L=>({id:L.id}));y&&!U?o(we,q):o(we)}}),l.jsx(jT,{isCommentsEnabled:h,enableCommentNotifications:f,updateCommentNotifications:s}),l.jsx(TT,{canChangeUpdatesAndAnnouncements:y,enableUpdatesAndAnnouncements:q,updateUpdatesAndAnnouncements:u})]})}),l.jsx("div",{className:"gh-portal-btn-unsubscribe",children:l.jsx(dt,{isRunning:!1,onClick:()=>{c()},disabled:H,brandColor:x,isPrimary:!1,label:w("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%"},dataTestId:"unsubscribe-from-all-emails"})}),l.jsxs("footer",{className:"gh-portal-action-footer"+(Sc({member:I})?" gh-feature-suppressions":""),children:[l.jsx("div",{style:{width:"100%"},children:l.jsx(zT,{isPaid:m,site:O,subscribedNewsletters:a})}),Sc({member:I})&&!H&&l.jsxs("div",{className:"gh-portal-footer-secondary",children:[l.jsx("span",{className:"gh-portal-footer-secondary-light",children:w("Not receiving emails?")}),l.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>S("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[w("Get help")," ",l.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function NT(){const{member:t,doAction:e,site:a,pageData:o}=z.useContext(ke);let s,u;o&&(s=o.newsletterUuid,u=o.action);const[c,m]=z.useState(!0),h=ai({site:a}),f=Mo({site:a});z.useEffect(()=>{t||e("switchPage",{page:"signin"})},[t,e]),z.useEffect(()=>{if(s&&u==="unsubscribe"){const q=t?.newsletters.filter(ee=>ee.uuid!==s);S(q),m(!1),e("updateNewsletterPreference",{newsletters:q})}},[]);const y=()=>{if(o.comments&&I){const te=c?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${te}`,children:l.jsx(zt,{string:w("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:t?.email})}})})})}const q=h?.find(te=>te.uuid===o.newsletterUuid);if(!q)return null;const ee=c?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${ee}`,children:l.jsx(zt,{string:w("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:t?.email}),newsletterName:l.jsx("strong",{children:q?.name})}})})})},k=[...t?.newsletters||[]],[x,S]=z.useState(k),{comments_enabled:I}=a,O=!!a.labs?.automations,{enable_comment_notifications:D,enable_updates_and_announcements:U}=t||{};return z.useEffect(()=>{S(t?.newsletters||[])},[t?.newsletters]),l.jsx(hy,{hasNewslettersEnabled:f,notification:s?y:null,subscribedNewsletters:x,updateSubscribedNewsletters:(q,ee)=>{S(q),e("updateNewsletterPreference",{newsletters:q,enableUpdatesAndAnnouncements:ee}),e("showPopupNotification",{action:"updated:success",message:w("Email preferences updated.")})},updateCommentNotifications:async q=>{e("updateNewsletterPreference",{enableCommentNotifications:q})},updateUpdatesAndAnnouncements:async q=>{e("updateNewsletterPreference",{enableUpdatesAndAnnouncements:q})},unsubscribeAll:()=>{S([]),e("showPopupNotification",{action:"updated:success",message:w("Unsubscribed from all emails.")});const q={newsletters:[]};I&&(q.enableCommentNotifications=!1),O&&(q.enableUpdatesAndAnnouncements=!1),e("updateNewsletterPreference",q)},isPaidMember:Yn({member:t}),isCommentsEnabled:I!=="off",enableCommentNotifications:D,canChangeUpdatesAndAnnouncements:O,enableUpdatesAndAnnouncements:U})}function IT(){const{site:t}=z.useContext(ke),e=t.icon;return e?l.jsx("img",{className:"gh-portal-unsubscribe-logo",src:e,alt:t.title}):null}function OT(){const{site:t}=z.useContext(ke),e=t.title||"";return l.jsxs("header",{className:"gh-portal-header",children:[l.jsx(IT,{}),l.jsx("h2",{className:"gh-portal-publication-title",children:e})]})}async function dd({api:t,memberUuid:e,key:a,newsletters:o,enableCommentNotifications:s,enableUpdatesAndAnnouncements:u}){try{return await t.member.updateNewsletters({uuid:e,key:a,newsletters:o,enableCommentNotifications:s,enableUpdatesAndAnnouncements:u})}catch{}}function AT(){const{site:t,api:e,pageData:a,member:o,doAction:s}=z.useContext(ke),[u,c]=z.useState(),[m,h]=z.useState(!0),f=ai({site:t}),y=f.filter(G=>G.subscribe_on_signup),[k,x]=z.useState(!1),[S,I]=z.useState(y),[O,D]=z.useState(!1),{comments_enabled:U}=t,q=!!t.labs?.automations,{enable_comment_notifications:ee=!1,enable_updates_and_announcements:te}=u||{},H=Mo({site:t}),re=async(G,X)=>{const ue={newsletters:G};X!==void 0&&(ue.enableUpdatesAndAnnouncements=X),o?s("updateNewsletterPreference",ue):await dd({api:e,memberUuid:a.uuid,key:a.key,...ue}),I(G);const ye={action:"updated:success",message:w("Email preferences updated.")};s("showPopupNotification",ye)},ce=async G=>{let X;o?(await s("updateNewsletterPreference",{enableCommentNotifications:G}),X={...o,enable_comment_notifications:G}):X=await dd({api:e,memberUuid:a.uuid,key:a.key,enableCommentNotifications:G}),c(X),s("showPopupNotification",{action:"updated:success",message:w("Comment preferences updated.")})},pe=async G=>{let X;o?(await s("updateNewsletterPreference",{enableUpdatesAndAnnouncements:G}),X={...o,enable_updates_and_announcements:G}):X=await dd({api:e,memberUuid:a.uuid,key:a.key,enableUpdatesAndAnnouncements:G}),c(X),s("showPopupNotification",{action:"updated:success",message:w("Email preferences updated.")})},we=async()=>{let G;o?(await s("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),G={...o},G.newsletters=[],G.enable_comment_notifications=!1,G.enable_updates_and_announcements=!1):G=await e.member.updateNewsletters({uuid:a.uuid,key:a.key,newsletters:[],enableCommentNotifications:!1,enableUpdatesAndAnnouncements:!1}),I([]),c(G),s("showPopupNotification",{action:"updated:success",message:w("Unsubscribed from all emails.")})};if(z.useEffect(()=>{(async()=>{let G;try{G=await e.member.newsletters({uuid:a.uuid,key:a.key}),c(G??null),h(!1)}catch(ue){console.error("[PORTAL] Error fetching member newsletters",ue),c(null),h(!1);return}if(G===null)return;const X=G?.newsletters||[];I(X),f?.length===1&&!U&&!a.newsletterUuid?await re([]):a.newsletterUuid?await re(X?.filter(ue=>ue.uuid!==a.newsletterUuid)):a.comments&&U?await ce(!1):a.updatesAndAnnouncements&&q&&await pe(!1)})()},[U,q,a.uuid,a.newsletterUuid,a.comments,a.updatesAndAnnouncements,t.url,f?.length]),m)return l.jsx(Gi,{});if(!u)return l.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[l.jsx(mt,{}),l.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:l.jsx($c,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:w("That didn't go to plan")}),l.jsx("div",{children:l.jsx("p",{className:"gh-portal-text-center",children:w("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),l.jsx(dt,{style:{width:"100%"},retry:!1,onClick:()=>s("closePopup"),disabled:!1,brandColor:"#000000",label:w("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if(f?.length===1&&!U&&!O)return l.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[l.jsx(mt,{}),l.jsx(OT,{}),l.jsx("h1",{className:"gh-portal-main-title",children:w("Successfully unsubscribed")}),l.jsxs("div",{children:[l.jsx("p",{className:"gh-portal-text-center",children:l.jsx(zt,{string:w("{memberEmail} will no longer receive this newsletter."),mapping:{memberEmail:l.jsx("strong",{children:u?.email})}})}),l.jsx("p",{className:"gh-portal-text-center",children:l.jsx(zt,{string:w("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:l.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{D(!0)}})}})})]})]});const L=()=>{if(a.comments&&U){const ue=k?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${ue}`,children:l.jsx(zt,{string:w("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:u?.email})}})})})}if(a.updatesAndAnnouncements&&q){const ue=k?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${ue}`,children:l.jsx(zt,{string:w("{memberEmail} will no longer receive updates & announcements."),mapping:{memberEmail:l.jsx("strong",{children:u?.email})}})})})}const G=f?.find(ue=>ue.uuid===a.newsletterUuid);if(!G)return null;const X=k?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${X}`,children:l.jsx(zt,{string:w("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:u?.email}),newsletterName:l.jsx("strong",{children:G?.name})}})})})};return l.jsx(hy,{hasNewslettersEnabled:H,notification:L,subscribedNewsletters:S,updateSubscribedNewsletters:async(G,X)=>{await re(G,X),x(!0)},updateCommentNotifications:ce,updateUpdatesAndAnnouncements:pe,unsubscribeAll:async()=>{await we(),x(!0)},isPaidMember:u?.status!=="free",isCommentsEnabled:U!=="off",enableCommentNotifications:ee,canChangeUpdatesAndAnnouncements:q,enableUpdatesAndAnnouncements:te})}function MT(){const{brandColor:t,lastPage:e,doAction:a,action:o,site:s}=z.useContext(ke);z.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(o)&&a("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(o)&&a("back"),["refreshMemberData:success"].includes(o)&&(Fo({site:s})||us({site:s})?(a("switchPage",{page:"accountEmail",lastPage:"accountHome"}),a("showPopupNotification",{message:w("You have been successfully resubscribed")})):a("back"))},[o,a,s,w]);const u=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(o),c=()=>{a("removeEmailFromSuppressionList")};return l.jsxs("div",{className:"gh-email-suppressed-page",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Ri,{brandColor:t,hidden:!e,onClick:()=>{a("back")}}),l.jsx(mt,{})]}),l.jsx(py,{className:"gh-email-suppressed-page-icon"}),l.jsxs("div",{className:"gh-email-suppressed-page-text",children:[l.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:w("Emails disabled")}),l.jsx("p",{children:w("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.")})]}),l.jsx(dt,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:c,disabled:u,brandColor:t,label:w("Re-enable emails"),isRunning:u})]})}function DT(){const{brandColor:t,doAction:e,site:a,pageData:o}=z.useContext(ke),s=`mailto:${Ro({site:a})}`,u=o&&o.direct||!1;return l.jsxs("div",{className:"gh-email-suppression-faq",children:[!u&&l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Ri,{brandColor:t,onClick:()=>{e("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),l.jsx(mt,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:w("Why has my email been disabled?")}),l.jsx("p",{children:w("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).")}),l.jsx("h4",{children:w("Spam complaints")}),l.jsx("p",{children:w("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),l.jsx("p",{children:w("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.")}),l.jsx("p",{children:w("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.")}),l.jsx("h4",{children:w("Permanent failure (bounce)")}),l.jsx("p",{children:w("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.")}),l.jsx("p",{children:w("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),l.jsx("p",{children:w("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.")}),l.jsx("p",{children:l.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:s,onClick:()=>{s&&window.open(s)},children:w("Need more help? Contact support")})})]})]})}function FT(){const{brandColor:t,doAction:e,site:a,lastPage:o,member:s,pageData:u}=z.useContext(ke),c=Ro({site:a}),m=`mailto:${c}`,h=t1({site:a}),f=u&&u.direct||!1;return l.jsxs("div",{className:"gh-email-receiving-faq",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[!f&&l.jsx(Ri,{brandColor:t,onClick:()=>{o?e("switchPage",{page:"accountHome"}):e("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),l.jsx(mt,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:w("Help! I'm not receiving emails")}),l.jsx("p",{children:w("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),l.jsx("h4",{children:w("Verify your email address is correct")}),l.jsx("p",{children:l.jsx(zt,{string:w("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:l.jsx("strong",{children:s.email}),button:l.jsx("button",{className:"gh-portal-btn-text",onClick:()=>e("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),l.jsx("h4",{children:w("Check spam & promotions folders")}),l.jsx("p",{children:w(`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".`)}),l.jsx("h4",{children:w("Create a new contact")}),l.jsx("p",{children:l.jsx(zt,{string:w("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:l.jsx("strong",{children:h})}})}),l.jsx("h4",{children:w("Send an email and say hi!")}),l.jsx("p",{children:l.jsx(zt,{string:w("Send an email to {senderEmail} and say hello. This can also help signal to your mail provider that emails to and from this address should be trusted."),mapping:{senderEmail:l.jsx("strong",{children:h})}})}),l.jsx("h4",{children:w("Check with your mail provider")}),l.jsx("p",{children:l.jsx(zt,{string:w("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:l.jsx("strong",{children:h})}})}),l.jsx("h4",{children:w("Get in touch for help")}),l.jsx("p",{children:l.jsx(zt,{string:w("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:l.jsx("a",{href:m,onClick:()=>{m&&window.open(m)},children:c})}})})]})]})}const YT=()=>{const[t,e]=z.useState(!0),[a,o]=z.useState(null),[s,u]=z.useState(null),{member:c,site:m}=z.useContext(ke);return z.useEffect(()=>{async function h(){const f=m.url,y=window.location.origin+window.location.pathname,k=c?`${y}?action=support&success=true`:`${y}#/portal/support/success`,x=y,S=js({siteUrl:f});try{const I=await S.member.checkoutDonation({successUrl:k,cancelUrl:x,personalNote:w("Add a personal note")});I.url&&window.location.replace(I.url)}catch(I){I.type&&I.type==="DisabledFeatureError"?u(w("This site is not accepting payments at the moment.")):o(w("Something went wrong, please try again later.")),e(!1)}}m&&m.donations_enabled===!1?(u(w("This site is not accepting donations at the moment.")),e(!1)):h()},[]),t?l.jsx("div",{children:l.jsx(Gi,{})}):a?l.jsx(sd,{error:a}):s?l.jsx(sd,{error:s}):null},RT=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},Xo=(t,e)=>{const a=new URLSearchParams(e);return`${t}?${a.toString()}`},$T=({shareTitle:t,shareUrl:e})=>{const a=[t,e].filter(Boolean).join(`
|
|
4580
4580
|
|
|
4581
|
-
`),o=[];return t&&o.push(`subject=${encodeURIComponent(t)}`),a&&o.push(`body=${encodeURIComponent(a)}`),`mailto:${o.length?`?${o.join("&")}`:""}`},LT=({shareTitle:t,shareUrl:e})=>Xo("https://www.linkedin.com/shareArticle",{mini:"true",url:e,title:t}),UT=()=>{const t=RT(),e=t.document,a=t.location,o=(I,O="content")=>e.querySelector(I)?.[O]||"",s=o('link[rel="canonical"]',"href")||a.origin+a.pathname+a.search,u=o('meta[property="og:title"]')||e.title||"",c=o('meta[property="og:description"]')||o('meta[name="description"]')||"",m=o('meta[property="og:image"]')||o('meta[name="twitter:image"]')||"",h=o('link[rel="icon"]',"href")||o('link[rel="shortcut icon"]',"href")||o('link[rel="apple-touch-icon"]',"href"),f=o('meta[name="author"]'),y=(f&&!/^https?:\/\//i.test(f)?f:"")||o('meta[name="twitter:creator"]')||"";let k=o('meta[property="og:site_name"]')||o('meta[name="application-name"]')||"";if(!k)try{k=new URL(s).hostname.replace(/^www\./,"")}catch{k=""}const x=[u,s].filter(Boolean).join(" ").trim(),S={twitter:Xo("https://twitter.com/intent/tweet",{url:s,text:u}),facebook:Xo("https://www.facebook.com/sharer/sharer.php",{u:s}),email:$T({shareTitle:u,shareUrl:s}),threads:Xo("https://www.threads.net/intent/post",{text:x}),linkedin:LT({shareTitle:u,shareUrl:s}),bluesky:Xo("https://bsky.app/intent/compose",{text:x})};return{shareUrl:s,shareTitle:u,shareExcerpt:c,shareImage:m,shareFavicon:h,shareSiteName:k,shareAuthor:y,socialLinks:S}},BT=()=>{const[t]=z.useState(UT);return t},GT=t=>z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...t},z.createElement("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"})),WT=t=>z.createElement("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",...t},z.createElement("circle",{cx:12,cy:12,r:1}),z.createElement("circle",{cx:19,cy:12,r:1}),z.createElement("circle",{cx:5,cy:12,r:1})),VT=t=>z.createElement("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",...t},z.createElement("defs",{id:"defs13"},z.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},z.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),z.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},z.createElement("g",{id:"g19"},z.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},z.createElement("g",{id:"g27",transform:"translate(600,350)"},z.createElement("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"})),z.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},z.createElement("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"})))))),HT=t=>z.createElement("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",...t},z.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),z.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),qT=t=>z.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...t},z.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),z.createElement("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"}),z.createElement("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"})),ZT=t=>z.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},z.createElement("g",{clipPath:"url(#clip0_351_18008)"},z.createElement("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"})),z.createElement("defs",null,z.createElement("clipPath",{id:"clip0_351_18008"},z.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),JT=t=>z.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...t},z.createElement("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"})),md={signin:ld,signup:ed,accountHome:ud,accountPlan:Wc,accountProfile:cd,accountEmail:NT,signupNewsletter:Hc,unsubscribe:AT,magiclink:id,loading:Gi,offer:rd,feedback:I0,emailSuppressed:MT,emailSuppressionFAQ:DT,emailReceivingFAQ:FT,support:YT,supportSuccess:Y0,supportError:sd,recommendations:X0,gift:b0,giftRedemption:$0,giftSuccess:G0,share:()=>{const[t,e]=z.useState(!1),[a,o]=z.useState(!1),s=z.useRef(),u=z.useRef(null),{shareUrl:c,shareTitle:m,shareExcerpt:h,shareImage:f,shareFavicon:y,shareSiteName:k,shareAuthor:x,socialLinks:S}=BT();z.useEffect(()=>()=>{clearTimeout(s.current)},[]),z.useEffect(()=>{if(!a)return;const U=u.current?.ownerDocument||document,q=te=>{u.current&&!u.current.contains(te.target)&&(te.stopPropagation(),te.preventDefault(),o(!1))},ee=te=>{te.key==="Escape"&&o(!1)};return U.addEventListener("click",q,!0),U.addEventListener("keydown",ee),()=>{U.removeEventListener("click",q,!0),U.removeEventListener("keydown",ee)}},[a]);const I=async()=>{await uy(c)&&(e(!0),clearTimeout(s.current),s.current=setTimeout(()=>{e(!1)},2e3))},O=()=>{o(U=>!U)},D=()=>{o(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(mt,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:w("Share")})}),l.jsxs("div",{className:"gh-portal-share-preview",children:[f&&l.jsx("img",{className:"gh-portal-share-preview-image",src:f,alt:"","data-testid":"share-preview-image"}),l.jsxs("div",{className:"gh-portal-share-preview-content",children:[m&&l.jsx("h2",{className:"gh-portal-share-preview-title",children:m}),h&&l.jsx("p",{className:"gh-portal-share-preview-excerpt",children:h}),(y||k||x)&&l.jsxs("div",{className:"gh-portal-share-preview-footer",children:[y&&l.jsx("img",{className:"gh-portal-share-preview-favicon",src:y,alt:"","data-testid":"share-preview-favicon"}),l.jsxs("div",{className:"gh-portal-share-preview-meta",children:[k&&l.jsx("span",{className:"gh-portal-share-preview-site",children:k}),k&&x&&l.jsx("span",{className:"gh-portal-share-preview-separator","aria-hidden":"true",children:"|"}),x&&l.jsx("span",{className:"gh-portal-share-preview-author",children:x})]})]})]})]}),l.jsxs("div",{className:"gh-portal-share-actions",children:[l.jsxs("button",{className:"gh-portal-btn gh-portal-share-action copy",type:"button",onClick:I,"aria-label":w(t?"Copied":"Copy link"),title:w(t?"Copied":"Copy link"),children:[t?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(Wo,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(HT,{})}),l.jsx("span",{className:"gh-portal-share-label",children:w(t?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:S.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":w("X (Twitter)"),title:w("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(JT,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:S.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":w("LinkedIn"),title:w("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(qT,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:S.email,target:"_blank",rel:"noopener noreferrer","aria-label":w("Email"),title:w("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(nd,{})})}),l.jsxs("div",{className:"gh-portal-share-more",ref:u,children:[l.jsx("button",{className:"gh-portal-btn gh-portal-share-action more",type:"button",onClick:O,"aria-label":w("More options"),title:w("More options"),"aria-haspopup":"menu","aria-expanded":a,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(WT,{})})}),a&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":w("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:S.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(VT,{})}),l.jsx("span",{children:w("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:S.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(ZT,{})}),l.jsx("span",{children:w("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:S.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(GT,{})}),l.jsx("span",{children:w("Bluesky")})]})]})]})]})]})}},pd=function({page:t}){return Object.keys(md).includes(t)?t:"signup"},fy=function({page:t}){return t.includes("account")},KT=function({page:t}){return t.includes("offer")},XT=t=>z.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},z.createElement("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"})),Nd=class Nd extends Je.Component{render(){return l.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",children:[l.jsx(XT,{}),"Powered by Ghost"]})}};Nd.contextType=ke;let Ts=Nd;const gy=()=>({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 QT({message:t}){return _a()?l.jsx("div",{className:"gh-portal-cookiebanner",children:t}):null}const Id=class Id extends Je.Component{componentDidMount(){this.node&&!yt(["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){const a=e.target&&e.target.tagName;(a!=="INPUT"||a==="INPUT"&&!e?.target?.value)&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){this.node&&yt(["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){const{page:a,otcRef:o}=this.context;yt(["preview"])||o&&a==="magiclink"||a==="giftRedemption"||a==="giftSuccess"||e.target===e.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:e}=this.context;pd({page:e});const a=md[e];return l.jsx(a,{})}renderPopupNotification(){const{popupNotification:e}=this.context;return!e||!e.type?null:l.jsx(od,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:e,pageQuery:a,site:o,customSiteUrl:s,lastPage:u}=this.context,m=ds({site:o,pageQuery:a}).length;pd({page:e});const f={...gy().page[e]};let y="",k="regular",x="",S=e;switch(e){case"signup":x="Cookies must be enabled in your browser to sign up.";break;case"signin":x="Cookies must be enabled in your browser to sign in.";break;case"accountHome":S="account-home";break;case"accountProfile":S="account-profile";break;case"accountPlan":S="account-plan";break;default:x="Cookies must be enabled in your browser.",S=e;break}m>1&&!$n({site:o})&&ea({site:o,pageQuery:a})&&e==="signup"&&(S+=" full-size",k="full"),(e==="gift"||e==="giftSuccess"||e==="giftRedemption")&&(S+=" full-size",k="full"),e==="magiclink"&&u==="gift"&&(S+=" full-size giftRedemption",k="full");const I=Do({site:o});(I&&m>2||!I&&m>1)&&e==="accountPlan"&&(S+=" full-size",k="full"),(e==="emailSuppressionFAQ"||e==="emailReceivingFAQ")&&(S+=" large-size");let O="gh-portal-popup-container";yt(["preview"])&&(S+=" preview"),yt(["preview"],{customSiteUrl:s})&&!o.disableBackground&&(O+=" preview"),yt(["dev"])&&(O+=" dev");const D=`${O} ${y} ${S}`,U=e==="gift"||e==="giftSuccess"||e==="giftRedemption"||e==="magiclink"&&u==="gift";return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+S,onClick:q=>this.handlePopupClose(q),children:[this.renderPopupNotification(),l.jsxs("div",{className:D,style:f,ref:q=>this.node=q,tabIndex:-1,children:[l.jsx(QT,{message:x}),this.renderActivePage(),k==="full"&&!U?l.jsx("div",{className:"gh-portal-powered inside "+(yt(["preview"])?"hidden ":"")+S,children:l.jsx(Ts,{})}):""]})]}),e!=="share"&&!U&&l.jsx("div",{className:"gh-portal-powered outside "+(yt(["preview"])?"hidden ":"")+S,children:l.jsx(Ts,{})})]})}};Id.contextType=ke;let hd=Id;const Od=class Od extends Je.Component{constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){const a=md[e];return l.jsx(a,{})}onHeightChange(e){this.setState({height:e})}handlePopupClose(e){e.preventDefault();const{page:a}=this.context;a==="giftRedemption"||a==="giftSuccess"||e.target===e.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:e,brandColor:a}=this.context,o=iT({site:e}),s=a?`:root { --brandcolor: ${a} }`+o:o;return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:s}}),l.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:e,site:a,customSiteUrl:o}=this.context,s=gy(),u=window.innerWidth<480,c={...s.frame.common};let m="gh-portal-popup-background";return yt(["preview"])&&(s.modalContainer.zIndex="3999997"),yt(["preview"],{customSiteUrl:o})&&!a.disableBackground&&(m+=" preview"),yt(["dev"])&&(m+=" dev"),l.jsx("div",{style:s.modalContainer,children:l.jsxs(fc,{style:c,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[l.jsx("div",{className:m,onClick:h=>this.handlePopupClose(h)}),l.jsx(hd,{isMobile:u})]})})}render(){const{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};Od.contextType=ke;let fd=Od;Ps({products:gd({numOfProducts:1})});function Wt(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function _T(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Ps({title:t="The Blueprint",description:e="Thoughts, stories and ideas.",logo:a="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:o="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",url:s="https://portal.localhost",plans:u={monthly:5e3,yearly:15e4,currency:"USD"},products:c=gd({numOfProducts:1}),portalProducts:m=c.map(L=>L.id),accentColor:h="#45C32E",portalPlans:f=["free","monthly","yearly"],membersSignupAccess:y="all",freePriceName:k="Free",freePriceDescription:x="Free preview",paidMembersEnabled:S=!0,portalButton:I=!0,portalName:O=!0,portalButtonIcon:D="icon-1",portalButtonSignupText:U="Subscribe now",portalButtonStyle:q="icon-and-text",membersSupportAddress:ee="support@example.com",editorDefaultEmailRecipients:te="visibility",newsletters:H=[],posts:re=eP(),commentsEnabled:ce,recommendations:pe=[],recommendationsEnabled:we}={}){return{title:t,description:e,logo:a,icon:o,accent_color:h,url:s,plans:u,products:c,portal_products:m,members_signup_access:y,free_price_name:k,free_price_description:x,paid_members_enabled:S,portal_button:I,portal_name:O,portal_plans:f,portal_button_icon:D,portal_button_signup_text:U,portal_button_style:q,members_support_address:ee,comments_enabled:ce!=="off",newsletters:H,recommendations:pe,recommendations_enabled:!!we,editor_default_email_recipients:te,posts:re}}function yy({name:t="Black Friday",code:e="black-friday",displayTitle:a="Black Friday Sale!",displayDescription:o="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:s="percent",cadence:u="month",amount:c=50,duration:m="repeating",durationInMonths:h=null,currencyRestriction:f=!1,currency:y=null,status:k="active",tierId:x="",tierName:S="Basic",redemptionType:I="signup"}={}){return{id:`offer_${Wt()}`,name:t,code:e,display_title:a,display_description:o,type:s,cadence:u,amount:c,duration:m,duration_in_months:h,currency_restriction:f,currency:y,status:k,tier:{id:`${x}`,name:S},redemption_type:I}}function zn({name:t="Jamie Larson",email:e="jamie@example.com",firstname:a="Jamie",subscriptions:o=[],paid:s=!1,status:u,avatarImage:c="",subscribed:m=!0,email_suppression:h={suppressed:!1,info:null},newsletters:f=[]}={}){const y={uuid:_T(),email:e,name:t,firstname:a,paid:s,subscribed:m,avatar_image:c,subscriptions:o,email_suppression:h,newsletters:f};return u!==void 0?y.status=u:s?y.status="paid":y.status="free",y}function eP({numOfPosts:t=3}={}){const e=[];for(let a=0;a<t;a++)e.push(tP({title:`Post ${a+1}`,slug:`post-${a+1}`}));return e.slice(0,t)}function tP({id:t=`post_${Wt()}`,title:e="Post",excerpt:a="Post excerpt",slug:o="post",featured:s=!1}={}){return{id:t,title:e,excerpt:a,slug:o,featured:s}}function gd({numOfProducts:t=3}={}){const a=[Vi({name:"Bronze",description:"Access to all members articles",monthlyPrice:kn({interval:"month",amount:700}),yearlyPrice:kn({interval:"year",amount:7e3}),numOfBenefits:2}),Vi({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:kn({interval:"month",amount:1200}),yearlyPrice:kn({interval:"year",amount:12e3}),numOfBenefits:3}),Vi({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:kn({interval:"month",amount:18e3}),yearlyPrice:kn({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,t),o=by({});return[...a,o]}function Vi({type:t="paid",name:e="Basic",description:a="",id:o=`product_${Wt()}`,monthlyPrice:s=kn(),yearlyPrice:u=kn({interval:"year"}),numOfBenefits:c=2,trialDays:m=null}){return{id:o,name:e,description:a,monthlyPrice:t==="free"?null:s,yearlyPrice:t==="free"?null:u,type:t,benefits:ky({numOfBenefits:c}),trial_days:m}}function by({name:t="Free tier",description:e="Free tier description",id:a=`product_${Wt()}`,numOfBenefits:o=2}){return{id:a,name:t,type:"free",description:e,benefits:ky({numOfBenefits:o})}}function ky({numOfBenefits:t}){const e=Wt();return[zs({name:`Limited early adopter pricing #${e.substring(0,6)}`}),zs({name:`Latest gear reviews #${e.substring(6,12)}`}),zs({name:`Weekly email newsletter #${e.substring(12,18)}`}),zs({name:`Listen to my podcast #${e.substring(18)}`})].slice(0,t)}function zs({id:t=`benefit_${Wt()}`,name:e="Benefit"}){return{id:t,name:e}}function kn({interval:t="month",amount:e=t==="month"?500:5e3,nickname:a=t==="month"?"Monthly":"Yearly",description:o=null,currency:s="usd",active:u=!0,id:c=`price_${Wt()}`}={}){return{id:c,active:u,nickname:a,currency:s,amount:e,interval:t,description:o,stripe_price_id:`price_${Wt()}`,stripe_product_id:`prod_${Wt()}`,type:"recurring"}}function ri({id:t=`sub_${Wt()}`,status:e="active",currency:a="USD",interval:o="year",amount:s=o==="month"?500:5e3,nickname:u=o==="month"?"Monthly":"Yearly",cardLast4:c="4242",offer:m=aP,priceId:h=`price_${Wt()}`,startDate:f="2021-10-05T03:18:30.000Z",currentPeriodEnd:y="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:k=!1,trialEndAt:x=null,nextPayment:S=null,tier:I=null}={}){return{id:t,customer:{id:`cus_${Wt()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Wt()}`,nickname:u,amount:s,interval:o,currency:a},offer:m,status:e,start_date:f,default_payment_card_last4:c,cancel_at_period_end:k,cancellation_reason:null,current_period_end:y,trial_end_at:x,next_payment:S,tier:I,price:{id:`stripe_price_${Wt()}`,price_id:h,nickname:u,amount:s,interval:o,type:"recurring",currency:a,product:{id:`stripe_prod_${Wt()}`,product_id:`prod_${Wt()}`}}}}function vy(){const t=gd({numOfProducts:1}),e=t.map(o=>o.id);return Ps({products:t,portalPlans:["free","monthly","yearly"],portalProducts:e})}vy();const nP=Ps({products:[Vi({numOfBenefits:2,type:"free"})]}),aP=yy({tierId:nP.products[0]?.id});zn({status:"free"}),zn({status:"paid",paid:!0,subscriptions:[ri()]}),zn({status:"comped",paid:!0,subscriptions:[]}),zn({status:"comped",paid:!0,subscriptions:[ri({amount:0})]}),zn({status:"paid",paid:!0,subscriptions:[ri({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),vy();const Ns=[by({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),Vi({name:"The Blueprint",description:"",monthlyPrice:kn({interval:"month",amount:500}),yearlyPrice:kn({interval:"year",amount:5e3}),numOfBenefits:3}),Vi({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:kn({interval:"month",amount:1200}),yearlyPrice:kn({interval:"year",amount:11e3}),numOfBenefits:4})],Is=Ps({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:Ns,portalProducts:Ns.map(t=>t.id),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}]}),wy=yy({tierId:Is.products[1]?.id}),Hi={free:zn({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,status:"free",avatarImage:"",subscribed:!0}),paid:zn({paid:!0,status:"paid",subscriptions:[ri({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:zn({paid:!0,status:"comped",subscriptions:[]}),complimentaryWithSubscription:zn({paid:!0,status:"comped",subscriptions:[ri({amount:0})]}),preview:zn({paid:!0,status:"paid",subscriptions:[ri({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function iP(){if(!Ns||!Ns[1])return null;let t=Is?.products?.[1].monthlyPrice,e=zn({paid:!0,status:"paid",subscriptions:[ri({offer:null,priceId:t?.id,status:"active",currency:t?.currency,interval:t?.interval,amount:t?.amount,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]});return{site:Is,member:e}}function oP(t){const e=t.getAttribute("href"),a=new URL(e,window.location.origin),o=["#/portal","#/share"],s=o.some(c=>a.hash.startsWith(c)),u=o.some(c=>e.startsWith(c));!a.hash||!s||u||a.origin===window.location.origin&&t.setAttribute("href",a.hash)}const rP="CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION";function sP({data:t,state:e}){return{page:t.page,popupNotification:null,lastPage:t.lastPage||null,pageData:t.pageData||e.pageData}}function lP({state:t}){return{showPopup:!t.showPopup}}function uP({data:t}){return{showPopup:!0,reloadOnPopupClose:!1,page:t.page,...t.pageQuery?{pageQuery:t.pageQuery}:{},...t.pageData?{pageData:t.pageData}:{}}}function cP({state:t}){return t.lastPage?{page:t.lastPage}:xy({state:t})}function xy({state:t}){ya();const e={...t.pageData||{}};return delete e.redirect,{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:t.page==="magiclink"?"":t.page,pageData:e}}function dP({data:t,state:e}){const{action:a="openNotification",status:o="success",autoHide:s=!0,closeable:u=!0,duration:c=2600,message:m=""}=t||{},h=$o({type:a,status:o,autoHide:s,closeable:u,duration:c,state:e,message:m});return{notification:h,notificationSequence:h.count}}function mP(){return{notification:null}}async function pP({api:t,state:e}){try{return await t.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:rt({type:"signout:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to log out, please try again")})}}}async function hP({data:t,api:e,state:a}){try{const o=await e.member.getIntegrityToken(),s={...t,emailType:"signin",integrityToken:o,includeOTC:!0},{otc_ref:u,inboxLinks:c}=await e.member.sendMagicLink(s);return{page:"magiclink",lastPage:"signin",...u?{otcRef:u}:{},inboxLinks:c,pageData:{...a.pageData||{},email:(t?.email||"").trim()}}}catch(o){return{action:"signin:failed",popupNotification:rt({type:"signin:failed",autoHide:!1,closeable:!0,state:a,status:"error",message:_n(o,w("Failed to log in, please try again"))})}}}function fP({data:t,state:e}){const a=(t?.email||"").trim(),o=t?.otcRef,s=t?.inboxLinks;return o?{showPopup:!0,page:"magiclink",lastPage:"signin",otcRef:o,inboxLinks:s,pageData:{...e.pageData||{},email:a},popupNotification:null}:{}}async function gP({data:t,api:e}){const a=w("Failed to verify code, please try again");try{const o=await e.member.getIntegrityToken(),s=await e.member.verifyOTC({...t,integrityToken:o});return s.redirectUrl?window.location.assign(s.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:_n(s.errors?.[0],a)}}catch(o){return{action:"verifyOTC:failed",actionErrorMessage:_n(o,a)}}}async function yP({data:t,state:e,api:a}){try{let{plan:o,tierId:s,cadence:u,email:c,name:m,newsletters:h,offerId:f}=t;m=m?.trim();let y;if(o.toLowerCase()==="free"){const k=await a.member.getIntegrityToken();({inboxLinks:y}=await a.member.sendMagicLink({emailType:"signup",integrityToken:k,...t,name:m}))}else{const k=e.member?{checkoutType:"upgrade"}:void 0;return(!s||!u)&&({tierId:s,cadence:u}=Yo({site:e?.site,priceId:o})),await a.member.checkoutPlan({plan:o,tierId:s,cadence:u,email:c,name:m,newsletters:h,offerId:f,metadata:k}),{page:"loading"}}return{page:"magiclink",lastPage:"signup",inboxLinks:y,pageData:{...e.pageData||{},email:(c||"").trim()}}}catch(o){if(o.code===rP)return e.member?{action:"signup:failed",popupNotification:rt({type:"signup:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("You already have an active subscription.")})}:{page:"magiclink",lastPage:"signin",pageData:{...e.pageData||{},email:(t?.email||"").trim()},popupNotification:null};const s=_n(o,w("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:rt({type:"signup:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:s})}}}async function bP({data:t,state:e,api:a}){try{let{email:o,name:s,giftToken:u}=t;if(s=s?.trim(),e.member){await a.gift.redeem({token:u});const y=await a.member.sessionData(),k=$o({type:"giftRedeem",status:"success",autoHide:!0,closeable:!0,state:e,message:Tg({member:y})});return ya(),{action:"redeemGift:success",member:y,showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:k,notificationSequence:k.count}}const c=await a.member.getIntegrityToken(),m=new URL(e?.site?.url||window.location.href);m.search=new URLSearchParams({giftRedemption:"true"}).toString(),m.hash="";const{otc_ref:h,inboxLinks:f}=await a.member.sendMagicLink({email:(o||"").trim(),emailType:"subscribe",integrityToken:c,includeOTC:!0,redirect:m.href,giftToken:u,...s?{name:s}:{}});return{page:"magiclink",lastPage:"gift",...h?{otcRef:h}:{},inboxLinks:f,pageData:{...e.pageData||{},email:(o||"").trim(),redirect:m.href}}}catch(o){const s=$o({type:"giftRedeem",status:"error",autoHide:!1,closeable:!0,state:e,message:ws(o)});return ya(),{action:"redeemGift:failed",showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:s,notificationSequence:s.count}}}async function kP({data:t,state:e,api:a}){try{let{plan:o,offerId:s,tierId:u,cadence:c}=t;(!u||!c)&&({tierId:u,cadence:c}=Yo({site:e?.site,priceId:o})),await a.member.checkoutPlan({plan:o,tierId:u,cadence:c,offerId:s,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:rt({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to process checkout, please try again")})}}}async function vP({state:t,api:e}){try{await e.member.continueGiftCheckout()}catch{return{action:"continueGiftSubscription:failed",popupNotification:rt({type:"continueGiftSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:w("Failed to process checkout, please try again")})}}}async function wP({data:t,state:e,api:a}){try{const{tierId:o,cadence:s,email:u}=t;return await a.member.checkoutGift({tierId:o,cadence:s,...u?{email:u}:{}}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:rt({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to process checkout, please try again")})}}}async function xP({data:t,state:e,api:a}){try{const{plan:o,planId:s,subscriptionId:u,cancelAtPeriodEnd:c}=t,{tierId:m,cadence:h}=Yo({site:e?.site,priceId:s});await a.member.updateSubscription({planName:o,tierId:m,cadence:h,subscriptionId:u,cancelAtPeriodEnd:c,planId:s});const f=await a.member.sessionData(),y="updateSubscription:success";return{action:y,popupNotification:rt({type:y,autoHide:!0,closeable:!0,state:e,status:"success",message:w("Subscription plan updated successfully")}),page:"accountHome",member:f}}catch{return{action:"updateSubscription:failed",popupNotification:rt({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to update subscription, please try again")})}}}async function SP({data:t,state:e,api:a}){try{const{subscriptionId:o,cancellationReason:s}=t;return await a.member.updateSubscription({subscriptionId:o,smartCancel:!0,cancellationReason:s}),{action:"cancelSubscription:success",page:"accountHome",member:await a.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"cancelSubscription:failed",popupNotification:rt({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to cancel subscription, please try again")})}}}async function CP({data:t,state:e,api:a}){try{const{subscriptionId:o}=t;return await a.member.updateSubscription({subscriptionId:o,cancelAtPeriodEnd:!1}),{action:"continueSubscription:success",page:"accountHome",member:await a.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"continueSubscription:failed",popupNotification:rt({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to cancel subscription, please try again")})}}}async function EP({data:t,state:e,api:a}){try{const{offerId:o,subscriptionId:s}=t;return await a.member.applyOffer({offerId:o,subscriptionId:s}),{action:"applyOffer:success",page:"accountHome",member:await a.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:rt({type:"applyOffer:success",autoHide:!0,closeable:!0,state:e,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:rt({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:"Failed to apply offer, please try again"})}}}async function jP({data:t,state:e,api:a}){try{await a.member.editBilling(t)}catch{return{action:"editBilling:failed",popupNotification:rt({type:"editBilling:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to update billing information, please try again")})}}}async function TP({data:t,state:e,api:a}){try{await a.member.manageBilling(t)}catch{return{action:"manageBilling:failed",popupNotification:rt({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to open billing portal, please try again")})}}}async function PP(){return{popupNotification:null}}async function zP({data:t,state:e}){let{action:a,message:o=""}=t;return a=a||"showPopupNotification:success",{popupNotification:rt({type:a,autoHide:!0,closeable:!0,state:e,status:"success",message:o})}}async function NP({data:t,state:e,api:a}){try{const{newsletters:o,enableCommentNotifications:s,enableUpdatesAndAnnouncements:u}=t;if(!o&&s===void 0&&u===void 0)return{};const c={};return o&&(c.newsletters=o),s!==void 0&&(c.enableCommentNotifications=s),u!==void 0&&(c.enableUpdatesAndAnnouncements=u),{action:"updateNewsletterPref:success",member:await a.member.update(c)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:rt({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:w("Failed to update newsletter settings")})}}}async function IP({state:t,api:e}){try{return await e.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:rt({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:t,status:"success",message:w("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:rt({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:w("Your email has failed to resubscribe, please try again")})}}}async function OP({data:t,state:e,api:a}){try{const{subscribed:o}=t,s=await a.member.update({subscribed:o});if(!s)throw new Error("Failed to update newsletter");const u="updateNewsletter:success";return{action:u,member:s,popupNotification:rt({type:u,autoHide:!0,closeable:!0,state:e,status:"success",message:w("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:rt({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:w("Failed to update newsletter settings")})}}}async function AP({data:t,state:e,api:a}){const{email:o}=t,s=QE({member:e.member});if(o!==s)try{return await a.member.updateEmailAddress({email:o}),{success:!0}}catch(u){return{success:!1,error:u}}return null}async function MP({data:t,state:e,api:a}){const o=t?.name?.trim();if(e1({member:e.member})!==o)try{const u=await a.member.update({name:o});if(!u)throw new Error("Failed to update member");return{member:u,success:!0}}catch(u){return{success:!1,error:u}}return null}async function DP({state:t,api:e}){if(t.member)try{const a=await e.member.sessionData();return a?{member:a,success:!0,action:"refreshMemberData:success"}:null}catch(a){return{success:!1,error:a,action:"refreshMemberData:failed"}}return null}async function FP({data:t,state:e,api:a}){const[o,s]=await Promise.all([MP({data:t,state:e,api:a}),AP({data:t,state:e,api:a})]);if(o&&s){if(s.success)return{action:"updateProfile:success",...o.success?{member:o.member}:{},page:"accountHome",popupNotification:rt({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:e,message:w("Check your inbox to verify email update")})};const u=o.success?w("Failed to send verification email"):w("Failed to update account data");return{action:"updateProfile:failed",...o.success?{member:o.member}:{},popupNotification:rt({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:u,state:e})}}else if(o){const u=o.success?"updateProfile:success":"updateProfile:failed",c=o.success?"success":"error",m=o.success?w("Account details updated successfully"):w("Failed to update account details");return{action:u,...o.success?{member:o.member}:{},...o.success?{page:"accountHome"}:{},popupNotification:rt({type:u,autoHide:o.success,closeable:!0,status:c,state:e,message:m})}}else if(s){const u=s.success?"updateProfile:success":"updateProfile:failed",c=s.success?"success":"error";let m="";return s.error?m=_n(s.error,w("Failed to send verification email")):m=w("Check your inbox to verify email update"),{action:u,...s.success?{page:"accountHome"}:{},popupNotification:rt({type:u,autoHide:s.success,closeable:!0,status:c,state:e,message:m})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:rt({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:e,message:w("Account details updated successfully")})}}async function YP({data:{siteUrl:t},state:e}){const a=js({siteUrl:t,apiUrl:"not-defined"}),{member:o}=e,s=window.location.href,u=ag(),c=await a.member.getIntegrityToken();return await a.member.sendMagicLink({emailType:"signup",name:o.name,email:o.email,autoRedirect:!1,integrityToken:c,customUrlHistory:e.site.outbound_link_tagging?[{time:Date.now(),referrerSource:u,referrerMedium:"Ghost Recommendations",referrerUrl:s}]:[]}),{}}function RP({data:{recommendationId:t},api:e}){try{const a=localStorage.getItem("ghost-recommendations-clicked"),o=a?JSON.parse(a):[];if(o.includes(t))return;o.push(t),localStorage.setItem("ghost-recommendations-clicked",JSON.stringify(o))}catch{}return e.recommendations.trackClicked({recommendationId:t}),{}}async function $P({data:{recommendationId:t},api:e}){return e.recommendations.trackSubscribed({recommendationId:t}),{}}const LP={togglePopup:lP,openPopup:uP,closePopup:xy,switchPage:sP,openNotification:dP,closeNotification:mP,back:cP,signout:pP,signin:hP,startSigninOTCFromCustomForm:fP,verifyOTC:gP,signup:yP,redeemGift:bP,updateSubscription:xP,cancelSubscription:SP,continueSubscription:CP,applyOffer:EP,updateNewsletter:OP,updateProfile:FP,refreshMemberData:DP,clearPopupNotification:PP,editBilling:jP,manageBilling:TP,checkoutPlan:kP,continueGiftSubscription:vP,checkoutGift:wP,updateNewsletterPreference:NP,showPopupNotification:zP,removeEmailFromSuppressionList:IP,oneClickSubscribe:YP,trackRecommendationClicked:RP,trackRecommendationSubscribed:$P};async function UP({action:t,data:e,state:a,api:o}){const s=LP[t];return s?await s({data:e,state:a,api:o})||{}:{}}function Sy(t,e){t&&(t.innerText=e)}function BP(t,e,a){e.classList.add("error");const o=w("There was an error sending the email, please try again");Sy(a,_n(t,o))}async function GP({event:t,form:e,errorEl:a,siteUrl:o,submitHandler:s,doAction:u,captureException:c}){e.removeEventListener("submit",s),t.preventDefault(),a&&(a.innerText=""),e.classList.remove("success","invalid","error");let m=t.target.querySelector("input[data-members-email]"),h=t.target.querySelector("input[data-members-name]"),f=e?.dataset?.membersAutoredirect||"true",y=m?.value,k=(h?.value||"").trim()||void 0,x,S=[],I=[],O=t.target.querySelectorAll("input[data-members-label]")||[];for(let te=0;te<O.length;++te)S.push(O[te].value);let D=t.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let te=0;te<D.length;++te)I.push({name:D[te].value});e.dataset.membersForm&&(x=e.dataset.membersForm);const U=x==="signin"&&e?.dataset?.membersOtc==="true";e.classList.add("loading");const q=Di(),ee={email:y,emailType:x,labels:S,name:k,autoRedirect:f==="true"};U&&(ee.includeOTC=!0),q&&(ee.urlHistory=q),D.length>0?ee.newsletters=I:(t.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(ee.newsletters=[]);try{const H=await(await fetch(`${o}/members/api/integrity-token/`,{method:"GET"})).text(),re=await fetch(`${o}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ee,integrityToken:H})});if(e.addEventListener("submit",s),e.classList.remove("loading"),re.ok){e.classList.add("success");let ce;if(U)try{ce=await re.clone().json()}catch{ce=void 0}const pe=ce?.otc_ref;if(pe&&typeof u=="function")try{u("startSigninOTCFromCustomForm",{email:(y||"").trim(),otcRef:pe,inboxLinks:ce?.inboxLinks})}catch(we){console.error(we),c?.(we)}}else{const ce=await Pn.fromApiResponse(re),pe=_n(ce,w("Failed to send magic link email"));Sy(a,pe),e.classList.add("error")}}catch(te){BP(te,e,a)}}function WP({event:t,el:e,errorEl:a,siteUrl:o,site:s,member:u,clickHandler:c}){e.removeEventListener("click",c),t.preventDefault();let m=e.dataset.membersPlan,h=UE(s,m.toLowerCase()),f=e.dataset.membersSuccess,y=e.dataset.membersCancel,k,x;f&&(k=new URL(f,window.location.href).href),y&&(x=new URL(y,window.location.href).href),a&&(a.innerText=""),e.classList.add("loading");const S=u?{checkoutType:"upgrade"}:{},I=Di();return I&&(S.urlHistory=I),fetch(`${o}/members/api/session`,{credentials:"same-origin"}).then(function(O){return O.ok?O.text():null}).then(function(O){return fetch(`${o}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...h,identity:O,successUrl:k,cancelUrl:x,metadata:S})}).then(function(D){if(!D.ok)throw new Error(w("Could not create Stripe checkout session"));return D.json()})}).then(function(O){return O.url?window.location.assign(O.url):window.Stripe(O.publicKey).redirectToCheckout({sessionId:O.sessionId}).then(function(U){if(U.error)throw new Error(U.error.message)})}).catch(function(O){console.error(O),e.addEventListener("click",c),e.classList.remove("loading"),a&&(a.innerText=O.message),e.classList.add("error")})}function VP({siteUrl:t,site:e={},member:a,offers:o=[],doAction:s,captureException:u}={}){if(!t)return;t=t.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(m){let h=m.querySelector("[data-members-error]");function f(y){GP({event:y,errorEl:h,form:m,siteUrl:t,submitHandler:f,doAction:s,captureException:u})}m.addEventListener("submit",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(m){let h=m.querySelector("[data-members-error]");function f(y){WP({el:m,event:y,errorEl:h,member:a,site:e,siteUrl:t,clickHandler:f})}m.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(m){let h=m.querySelector("[data-members-error]"),f=m.dataset.membersSuccess,y=m.dataset.membersCancel,k,x;f&&(k=new URL(f,window.location.href).href),y&&(x=new URL(y,window.location.href).href);function S(I){m.removeEventListener("click",S),I.preventDefault(),h&&(h.innerText=""),m.classList.add("loading"),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(O){return O.ok?O.text():null}).then(function(O){return fetch(`${t}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:O,successUrl:k,cancelUrl:x})}).then(function(D){if(!D.ok)throw new Error(w("Could not create Stripe checkout session"));return D.json()})}).then(function(O){return window.Stripe(O.publicKey).redirectToCheckout({sessionId:O.sessionId})}).then(function(O){if(O.error)throw new Error(w(O.error.message))}).catch(function(O){console.error(O),m.addEventListener("click",S),m.classList.remove("loading"),h&&(h.innerText=O.message),m.classList.add("error")})}m.addEventListener("click",S)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(m){let h=m.querySelector("[data-members-error]"),f=m.dataset.membersReturn,y;f&&(y=new URL(f,window.location.href).href);function k(x){m.removeEventListener("click",k),x.preventDefault(),h&&(h.innerText=""),m.classList.add("loading"),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(S){return S.ok?S.text():null}).then(function(S){return fetch(`${t}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:S,returnUrl:y})}).then(function(I){if(!I.ok)throw new Error(w("Could not create Stripe billing portal session"));return I.json()})}).then(function(S){return window.location.assign(S.url)}).catch(function(S){console.error(S),m.addEventListener("click",k),m.classList.remove("loading"),h&&(h.innerText=S.message),m.classList.add("error")})}m.addEventListener("click",k)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(m){function h(f){m.removeEventListener("click",h),f.preventDefault(),m.classList.remove("error"),m.classList.add("loading"),fetch(`${t}/members/api/session`,{method:"DELETE"}).then(function(y){y.ok?window.location.replace(t):(m.addEventListener("click",h),m.classList.remove("loading"),m.classList.add("error"))})}m.addEventListener("click",h)});const c=(o||[]).some(m=>m.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(m){let h=m.parentElement.querySelector("[data-members-error]");function f(y){y.preventDefault();let k=m.dataset.membersCancelSubscription;if(c){s("openPopup",{page:"accountPlan",pageData:{subscriptionId:k,action:"cancel"}});return}return m.removeEventListener("click",f),m.classList.remove("error"),m.classList.add("loading"),h&&(h.innerText=""),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(x){return x.ok?x.text():null}).then(function(x){return fetch(`${t}/members/api/subscriptions/${k}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:x,smart_cancel:!0})})}).then(function(x){x.ok?window.location.reload():(m.addEventListener("click",f),m.classList.remove("loading"),m.classList.add("error"),h&&(h.innerText=w("There was an error cancelling your subscription, please try again.")))})}m.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(m){let h=m.parentElement.querySelector("[data-members-error]");function f(y){m.removeEventListener("click",f),y.preventDefault(),m.classList.remove("error"),m.classList.add("loading");let k=m.dataset.membersContinueSubscription;return h&&(h.innerText=""),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(x){return x.ok?x.text():null}).then(function(x){return fetch(`${t}/members/api/subscriptions/${k}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:x,cancel_at_period_end:!1})})}).then(function(x){x.ok?window.location.reload():(m.addEventListener("click",f),m.classList.remove("loading"),m.classList.add("error"),h&&(h.innerText=w("There was an error continuing your subscription, please try again.")))})}m.addEventListener("click",f)})}const Cy=t=>{try{return decodeURIComponent(t)}catch{return null}},HP={staleGiftRedemptionRequest:!0},qP={showPopup:!0,site:Is,member:Hi.free,page:"accountEmail",...iP(),pageData:wy};function ZP({site:t,children:e}){const{portal_sentry:a}=t||{};return a&&a.dsn?l.jsx(gu,{children:e}):l.jsx(l.Fragment,{children:e})}class JP extends Je.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(){const e=this.getScrollbarWidth();this.setState({scrollbarWidth:e}),this.initSetup()}componentDidUpdate(e,a){if(a.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"&&a.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),VP({siteUrl:o,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:No})}}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(){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",document.body.appendChild(e),document.body.appendChild(e);const a=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),a}setupCustomTriggerButton(){this.clickHandler=async o=>{o.preventDefault();const s=o.currentTarget,u=s&&s.dataset.portal,c=this.getPageFromLinkPath(u);if(!c)return;const{page:m,pageQuery:h,pageData:f}=c;if(this.state.initStatus==="success"){if(m==="gift"&&!Ai({site:this.state.site})){this.invalidateGiftRedemptionRequest(),ya();return}if(m==="giftRedemption"&&f?.token){const y=this.startGiftRedemptionRequest(f.token),k=await this.fetchGiftRedemptionData({token:f.token});if(!this.isCurrentGiftRedemptionRequest(y))return;this.setState(k);return}this.invalidateGiftRedemptionRequest(),h&&h!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:h}):this.dispatchAction("openPopup",{page:m,pageQuery:h,pageData:f})}};const e="[data-portal]",a="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(e)||[],this.customTriggerButtons.forEach(o=>{o.classList.add(a),o.removeEventListener("click",this.clickHandler),o.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){const e="gh-portal-open",a="gh-portal-close";this.customTriggerButtons?.forEach(o=>{const s=this.state.showPopup?e:a,u=this.state.showPopup?a:e;o.classList.add(s),o.classList.remove(u)})}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:a}){return this._redemptionRequestId===e&&this.currentRedemptionToken===a}async initSetup(){try{const{site:e,member:a,offers:o,page:s,showPopup:u,popupNotification:c,notification:m,notificationSequence:h,lastPage:f,pageQuery:y,pageData:k}=await this.fetchData(),x=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||"en";is.changeLanguage(x);const S={site:e,member:a,offers:o,page:s,lastPage:f,pageQuery:y,showPopup:u,pageData:k,popupNotification:c,notification:m,notificationSequence:h,dir:is.dir()||"ltr",action:"init:success",initStatus:"success",locale:x};if(this.setState(S,()=>{this.handleSignupQuery({site:e,pageQuery:y,member:a})}),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!a){const I=document.querySelectorAll("[data-lexical-signup-form]");I.length>0&&I.forEach(O=>{O.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(e){console.error("[Portal] Failed to initialize:",e),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:e,member:a,offers:o}=await this.fetchApiData(),{site:s,...u}=this.fetchDevData(),c=await this.fetchLinkData(e,a),{site:m,...h}=c?.staleGiftRedemptionRequest?{}:c,{site:f,...y}=this.fetchPreviewData(),{site:k,...x}=this.fetchNotificationData();return{member:a,offers:o,page:"",site:{...e,...m,...f,...k,...s,plans:{...(s||{}).plans,...(e||{}).plans,...(f||{}).plans}},...u,...h,...x,...y}}fetchDevData(){return yt(["dev"])&&!this.state.customSiteUrl?qP:yt(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(e=""){const a=new URLSearchParams(e),o={};for(let s of a.entries()){const u=s[0],c=decodeURIComponent(s[1]);u==="name"?o.name=c||"":u==="code"?o.code=c||"":u==="display_title"?o.display_title=c||"":u==="display_description"?o.display_description=c||"":u==="type"?o.type=c||"":u==="cadence"?o.cadence=c||"":u==="duration"?o.duration=c||"":u==="duration_in_months"&&!isNaN(Number(c))?o.duration_in_months=Number(c):u==="amount"&&!isNaN(Number(c))?o.amount=Number(c):u==="currency"?o.currency=c||"":u==="status"?o.status=c||"":u==="tier_id"?o.tier={id:c||wy.tier.id}:u==="redemption_type"&&(o.redemption_type=c||"signup")}if(o.redemption_type==="retention"){const s=Hi.preview?.subscriptions?.[0]?.id;return{page:"accountPlan",offers:[o],pageData:{action:"cancel",subscriptionId:s}}}return{page:"offer",pageData:o}}fetchQueryStrData(e=""){const a=new URLSearchParams(e),o={site:{plans:{}}},s=[];let u,c=null,m,h,f;for(let y of a.entries()){const k=y[0],x=decodeURIComponent(y[1]);if(k==="button")o.site.portal_button=JSON.parse(x);else if(k==="name")o.site.portal_name=JSON.parse(x);else if(k==="isFree"&&JSON.parse(x))s.push("free");else if(k==="isMonthly"&&JSON.parse(x))s.push("monthly");else if(k==="isYearly"&&JSON.parse(x))s.push("yearly");else if(k==="portalPrices")u=x?x.split(","):[];else if(k==="portalProducts")c=x?x.split(","):[];else if(k==="page"&&x)o.page=x;else if(k==="accentColor"&&(x===""||x))o.site.accent_color=x;else if(k==="buttonIcon"&&x)o.site.portal_button_icon=x;else if(k==="signupButtonText")o.site.portal_button_signup_text=x||"";else if(k==="signupTermsHtml")o.site.portal_signup_terms_html=x||"";else if(k==="signupCheckboxRequired")o.site.portal_signup_checkbox_required=JSON.parse(x);else if(k==="buttonStyle"&&x)o.site.portal_button_style=x;else if(k==="monthlyPrice"&&!isNaN(Number(x)))o.site.plans.monthly=Number(x),m=Number(x);else if(k==="yearlyPrice"&&!isNaN(Number(x)))o.site.plans.yearly=Number(x),h=Number(x);else if(k==="currency"&&x){const S=x.toUpperCase();o.site.plans.currency=S,o.site.plans.currency_symbol=Tt(S),f=S}else k==="disableBackground"?o.site.disableBackground=JSON.parse(x):k==="membersSignupAccess"&&x?o.site.members_signup_access=x:k==="portalDefaultPlan"&&x?o.site.portal_default_plan=x:k==="transistorPortalSettings"&&x&&(o.site.transistor_portal_settings=JSON.parse(x))}return o.site.portal_plans=s,o.site.portal_products=c,u?o.site.portal_plans=u:m&&h&&f&&(o.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:f,amount:m,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:f,amount:h,type:"recurring",interval:"year"}]),o}fetchNotificationData(){const{type:e,status:a,duration:o,autoHide:s,closeable:u}=zg({billingOnly:!0})||{};return["stripe:billing-update"].includes(e)?a==="success"?{showPopup:!0,popupNotification:rt({type:e,status:a,duration:o,closeable:u,autoHide:s,state:this.state,message:a==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({token:e}){try{const a=await this.GhostApi.gift.fetchRedemptionData({token:e});return{showPopup:!0,notification:null,page:"giftRedemption",pageData:{token:e,gift:a?.gifts?.[0]||null}}}catch(a){ya();const o=$o({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:ws(a)});return{showPopup:!1,pageData:null,notification:o,notificationSequence:o.count}}}async fetchLinkData(e,a){this.invalidateGiftRedemptionRequest();const o=new URLSearchParams(window.location.search);if(o.get("stripe")==="gift-purchase-success"){const I=o.get("gift_token"),O=o.get("gift_tier"),D=o.get("gift_cadence");if(xs(["stripe","gift_token","gift_tier","gift_cadence"]),I)return{showPopup:!0,page:"giftSuccess",pageData:{token:I,tierId:O,cadence:D}}}if(o.get("action")==="unsubscribe")return o.get("key")&&o.get("uuid")?{showPopup:!0,page:"unsubscribe",pageData:{uuid:o.get("uuid"),key:o.get("key"),newsletterUuid:o.get("newsletter"),comments:o.get("comments"),updatesAndAnnouncements:o.get("updatesandannouncements")}}:{showPopup:!0,page:"accountEmail",pageData:{newsletterUuid:o.get("newsletter"),action:"unsubscribe",redirect:e.url+"#/portal/account/newsletters"}};if(WE({site:e})&&o.get("action")==="signup"&&o.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[s,u]=window.location.hash.substr(1).split("?"),c=new URLSearchParams(u??""),m=/^(?:(\w+?))?\/monthly$/,h=/^(?:(\w+?))?\/yearly$/,f=/^offers\/(\w+?)\/?$/,y=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,k=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,x=/^\/share\/?$/,S=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(s&&S.test(s)){const[,I,O]=s.match(S),D=parseInt(O);if(D===1||D===0)return a||c.get("uuid")&&c.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:a?null:c.get("uuid"),key:a?null:c.get("key"),postId:I,score:D}}:{showPopup:!0,page:"signin",pageData:{redirect:e.url+`#/feedback/${I}/${D}/`}}}if(s&&y.test(s)){const[,I]=s.match(y),O=Cy(I);if(!O)return{};const D=this.startGiftRedemptionRequest(O),U=await this.fetchGiftRedemptionData({token:O});return this.isCurrentGiftRedemptionRequest(D)?U:HP}if(s&&x.test(s))return{showPopup:!0,page:"share"};if(s&&k.test(s)){const[,I]=s.match(k),{page:O,pageQuery:D,pageData:U}=this.getPageFromLinkPath(I,e)||{};if(!a&&O&&fy({page:O}))return{showPopup:!0,page:"signin",pageData:{redirect:e.url+`#/portal/${I}/`}};if(O==="gift"&&!Ai({site:e}))return ya(),{};const q=["accountPlan","accountProfile"].includes(O)?"accountHome":null,ee=!(["monthly","yearly"].includes(D)||m.test(D)||h.test(D)||f.test(D)),te=c.get("redirect"),H=O==="signin"&&te?{...U||{},redirect:te}:U;return{showPopup:ee,...O?{page:O}:{},...D?{pageQuery:D}:{},...H?{pageData:H}:{},...q?{lastPage:q}:{}}}return{}}fetchPreviewData(){const[,e]=window.location.hash.substr(1).split("?");if(yt(["preview"])){let a={};try{yt(["offerPreview"])?a=this.fetchOfferQueryStrData(e):a=this.fetchQueryStrData(e)}catch(o){return No(o),{}}return{...a,showPopup:!0}}return{}}getColorOverride(){const e=document.querySelector("script[data-ghost]");return e&&e.dataset.accentColor?e.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:e,customSiteUrl:a,apiUrl:o,apiKey:s}=this.props;try{this.GhostApi=this.props.api||js({siteUrl:e,apiUrl:o,apiKey:s});const{site:u,member:c,offers:m}=await this.GhostApi.init(),h=this.getColorOverride();return h&&(u.accent_color=h),this.setupFirstPromoter({site:u,member:c}),this.setupSentry({site:u}),{site:u,member:c,offers:m}}catch(u){if(yt(["dev","test"],{customSiteUrl:a}))return{};throw u}}setupSentry({site:e}){if(yt(["test"]))return null;const{portal_sentry:a,portal_version:o,version:s}=e,c=`portal@2.69.12|ghost@${s}`;a&&a.dsn&&jC({dsn:a.dsn,environment:a.env||"development",release:c,beforeSend:m=>ME({event:m})?m:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:a}){if(yt(["test"]))return null;const o=_E({site:e});let s=Cc({site:e});if(s=s?.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),o&&s){const u=document.createElement("script");u.type="text/javascript",u.async=!0,u.src="https://cdn.firstpromoter.com/fprom.js",u.onload=u.onreadystatechange=function(){let m=this.readyState;if(!m||m==="complete"||m==="loaded")try{if(window.$FPROM.init(o,s),c1({member:a})){const h=a.email,f=a.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:h,uid:f});else{const y=window._fprom||[];window._fprom=y,y.push(["event","signup"]),y.push(["email",h]),y.push(["uid",f])}}}catch{}};const c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(u,c)}}async dispatchAction(e,a){clearTimeout(this.timeoutId),this.setState({action:`${e}:running`,actionErrorMessage:null});try{const o=await UP({action:e,data:a,state:this.state,api:this.GhostApi});this.setState(o),o&&o.action&&!o.action.includes(":failed")&&(this.timeoutId=setTimeout(()=>{this.setState({action:""})},2e3))}catch(o){if(console.error(`[Portal] Failed to dispatch action: ${e}`,o),a&&a.throwErrors)throw o;const s=rt({type:`${e}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:o}});this.setState({action:`${e}:failed`,actionErrorMessage:_n(o,w("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:s})}}async updateStateForPreviewLinks(){const{site:e,...a}=this.fetchPreviewData(),o=await this.fetchLinkData(this.state.site,this.state.member);if(o?.staleGiftRedemptionRequest)return;const{site:s,...u}=o,c={site:{...this.state.site,...s||{},...e||{},plans:{...this.state.site&&this.state.site.plans,...(s||{}).plans,...(e||{}).plans}},...u,...a};this.handleSignupQuery({site:c.site,pageQuery:c.pageQuery}),this.setState(c)}async handleOfferQuery({site:e,offerId:a,member:o=this.state.member}){if(ya(),!(!Yn({member:o})||ba({member:o}))){const u=$o({type:"offer:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:w("You already have an active subscription.")});await this.dispatchAction("closePopup"),this.setState({notification:u,notificationSequence:u.count});return}try{const c=(await this.GhostApi.site.offer({offerId:a}))?.offers[0];if(!c||!c.tier||Tc({offer:c})||!i1({site:e,offer:c}))return;this.dispatchAction("openPopup",{page:"offer",pageData:c})}catch{}}handleSignupQuery({site:e,pageQuery:a,member:o}){const s=/^offers\/(\w+?)\/?$/;let u=a;if(s.test(a||"")){const[,m]=a.match(s);this.handleOfferQuery({site:e,offerId:m,member:o});return}lg({site:e,pageQuery:a})&&(u=lg({site:e,pageQuery:a}));const c=BE({site:e,priceId:u});if(a&&a!=="free"){ya();const m=c?.id||u;m!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:h,cadence:f}=Yo({site:e,priceId:m});this.dispatchAction("signup",{plan:m,tierId:h,cadence:f})}}getPageFromLinkPath(e){const a=/^signup\/?(?:\/(\w+?))?\/?$/,o=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,s=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,u=/^offers\/(\w+?)\/?$/,c=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e==="")return{page:"default"};if(c.test(e)){const[,m]=e.match(c),h=Cy(m);return h?{page:"giftRedemption",pageData:{token:h}}:null}else{if(u.test(e))return{pageQuery:e};if(e==="signup")return{page:"signup"};if(o.test(e)){const[,m]=e.match(o);return{page:"signup",pageQuery:`${m}/monthly`}}else if(s.test(e)){const[,m]=e.match(s);return{page:"signup",pageQuery:`${m}/yearly`}}else if(a.test(e)){const[,m]=e.match(a);return{page:"signup",pageQuery:m}}else{if(e==="signup/free")return{page:"signup",pageQuery:"free"};if(e==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(e==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(e==="signin")return{page:"signin"};if(e==="account")return{page:"accountHome"};if(e==="account/plans")return{page:"accountPlan"};if(e==="account/profile")return{page:"accountProfile"};if(e==="account/newsletters")return{page:"accountEmail"};if(e==="support")return{page:"support"};if(e==="support/success")return{page:"supportSuccess"};if(e==="support/error")return{page:"supportError"};if(e==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(e==="gift")return{page:"gift"};if(e==="share")return{page:"share"};if(e==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(e==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}}return{page:"default"}}getAccentColor(){const{accent_color:e}=this.state.site||{};return e0(e)}getRetentionPreviewMember({site:e,offers:a}){const o=(a||[]).find(f=>Tc({offer:f})),s=o?.tier?.id,u=s?ni({site:e,productId:s}):null,c=u?o.cadence==="year"?u.yearlyPrice:u.monthlyPrice:null,m=Hi.preview,h=m?.subscriptions?.[0];return!h||!u||!c?m:{...m,subscriptions:[{...h,plan:{...h.plan,amount:c.amount,interval:c.interval,currency:c.currency.toUpperCase()},price:{...h.price,price_id:c.id,amount:c.amount,interval:c.interval,currency:c.currency,product:{...h.price?.product,product_id:u.id}},tier:{id:u.id,name:u.name}}]}}getContextPage({site:e,page:a,member:o}){if(!a||a==="default"){const s=$n({site:e})||!ea({site:e})?"signin":"signup";a=o?"accountHome":s}return pd({page:a})}getContextMember({site:e,page:a,member:o,offers:s,pageData:u,customSiteUrl:c}){return yt(["dev","preview"],{customSiteUrl:c})?fy({page:a})||KT({page:a})?yt(["dev"],{customSiteUrl:c})?o||Hi.free:yt(["preview"])?a==="accountPlan"&&u?.action==="cancel"?this.getRetentionPreviewMember({site:e,offers:s}):Hi.preview:Hi.paid:null:o}getContextFromState(){const{site:e,member:a,offers:o,action:s,actionErrorMessage:u,page:c,lastPage:m,showPopup:h,pageQuery:f,pageData:y,popupNotification:k,notification:x,customSiteUrl:S,dir:I,scrollbarWidth:O,otcRef:D,inboxLinks:U}=this.state,q=this.getContextPage({site:e,page:c,member:a}),ee=this.getContextMember({site:e,page:q,member:a,offers:o,pageData:y,customSiteUrl:S});return{api:this.GhostApi,site:e,offers:o,action:s,actionErrorMessage:u,brandColor:this.getAccentColor(),page:q,pageQuery:f,pageData:y,member:ee,lastPage:m,showPopup:h,popupNotification:k,notification:x,customSiteUrl:S,dir:I,scrollbarWidth:O,otcRef:D,inboxLinks:U,doAction:(te,H)=>this.dispatchAction(te,H)}}getRecommendationButtons(){return document.querySelectorAll("[data-recommendation]")||[]}setupRecommendationButtons(){const e=o=>{const s=o.currentTarget.dataset.recommendation;s?this.dispatchAction("trackRecommendationClicked",{recommendationId:s}).catch(console.error):console.warn("[Portal] Invalid usage of data-recommendation attribute")},a=this.getRecommendationButtons();for(const o of a)o.addEventListener("click",e,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll('a[href*="#/portal"], a[href*="#/share"]').forEach(oP)}render(){return this.state.initStatus==="success"?l.jsx(ZP,{site:this.state.site,children:l.jsxs(ke.Provider,{value:this.getContextFromState(),children:[l.jsx(fd,{}),l.jsx(zc,{}),l.jsx(Uc,{})]})}):null}}const Ey="ghost-portal-root";function KP(){const t=document.createElement("div");t.id=Ey,t.setAttribute("data-testid","portal-root"),document.body.appendChild(t)}function XP(){const t=document.querySelector("script[data-ghost]");if(t){const e=t.dataset.i18n==="true",a=t.dataset.ghost,o=t.dataset.key,s=t.dataset.api,u=t.dataset.locale;return{siteUrl:a,apiKey:o,apiUrl:s,siteI18nEnabled:e,locale:u}}return{}}function QP(){const t=new URL(window.location.href);t.searchParams.get("token")&&(t.searchParams.delete("token"),window.history.replaceState({},document.title,t.href))}function _P(){const{siteUrl:t,apiKey:e,apiUrl:a,siteI18nEnabled:o,locale:s}=XP(),u=t||window.location.origin;KP(),QP(),Dk.render(l.jsx(Je.StrictMode,{children:l.jsx(JP,{siteUrl:u,customSiteUrl:t,apiKey:e,apiUrl:a,siteI18nEnabled:o,locale:s})}),document.getElementById(Ey))}_P()}));
|
|
4581
|
+
`),o=[];return t&&o.push(`subject=${encodeURIComponent(t)}`),a&&o.push(`body=${encodeURIComponent(a)}`),`mailto:${o.length?`?${o.join("&")}`:""}`},LT=({shareTitle:t,shareUrl:e})=>Xo("https://www.linkedin.com/shareArticle",{mini:"true",url:e,title:t}),UT=()=>{const t=RT(),e=t.document,a=t.location,o=(I,O="content")=>e.querySelector(I)?.[O]||"",s=o('link[rel="canonical"]',"href")||a.origin+a.pathname+a.search,u=o('meta[property="og:title"]')||e.title||"",c=o('meta[property="og:description"]')||o('meta[name="description"]')||"",m=o('meta[property="og:image"]')||o('meta[name="twitter:image"]')||"",h=o('link[rel="icon"]',"href")||o('link[rel="shortcut icon"]',"href")||o('link[rel="apple-touch-icon"]',"href"),f=o('meta[name="author"]'),y=(f&&!/^https?:\/\//i.test(f)?f:"")||o('meta[name="twitter:creator"]')||"";let k=o('meta[property="og:site_name"]')||o('meta[name="application-name"]')||"";if(!k)try{k=new URL(s).hostname.replace(/^www\./,"")}catch{k=""}const x=[u,s].filter(Boolean).join(" ").trim(),S={twitter:Xo("https://twitter.com/intent/tweet",{url:s,text:u}),facebook:Xo("https://www.facebook.com/sharer/sharer.php",{u:s}),email:$T({shareTitle:u,shareUrl:s}),threads:Xo("https://www.threads.net/intent/post",{text:x}),linkedin:LT({shareTitle:u,shareUrl:s}),bluesky:Xo("https://bsky.app/intent/compose",{text:x})};return{shareUrl:s,shareTitle:u,shareExcerpt:c,shareImage:m,shareFavicon:h,shareSiteName:k,shareAuthor:y,socialLinks:S}},BT=()=>{const[t]=z.useState(UT);return t},GT=t=>z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...t},z.createElement("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"})),WT=t=>z.createElement("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",...t},z.createElement("circle",{cx:12,cy:12,r:1}),z.createElement("circle",{cx:19,cy:12,r:1}),z.createElement("circle",{cx:5,cy:12,r:1})),VT=t=>z.createElement("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",...t},z.createElement("defs",{id:"defs13"},z.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},z.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),z.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},z.createElement("g",{id:"g19"},z.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},z.createElement("g",{id:"g27",transform:"translate(600,350)"},z.createElement("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"})),z.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},z.createElement("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"})))))),HT=t=>z.createElement("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",...t},z.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),z.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),qT=t=>z.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...t},z.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),z.createElement("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"}),z.createElement("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"})),ZT=t=>z.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},z.createElement("g",{clipPath:"url(#clip0_351_18008)"},z.createElement("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"})),z.createElement("defs",null,z.createElement("clipPath",{id:"clip0_351_18008"},z.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),JT=t=>z.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...t},z.createElement("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"})),md={signin:ld,signup:ed,accountHome:ud,accountPlan:Wc,accountProfile:cd,accountEmail:NT,signupNewsletter:Hc,unsubscribe:AT,magiclink:id,loading:Gi,offer:rd,feedback:I0,emailSuppressed:MT,emailSuppressionFAQ:DT,emailReceivingFAQ:FT,support:YT,supportSuccess:Y0,supportError:sd,recommendations:X0,gift:b0,giftRedemption:$0,giftSuccess:G0,share:()=>{const[t,e]=z.useState(!1),[a,o]=z.useState(!1),s=z.useRef(),u=z.useRef(null),{shareUrl:c,shareTitle:m,shareExcerpt:h,shareImage:f,shareFavicon:y,shareSiteName:k,shareAuthor:x,socialLinks:S}=BT();z.useEffect(()=>()=>{clearTimeout(s.current)},[]),z.useEffect(()=>{if(!a)return;const U=u.current?.ownerDocument||document,q=te=>{u.current&&!u.current.contains(te.target)&&(te.stopPropagation(),te.preventDefault(),o(!1))},ee=te=>{te.key==="Escape"&&o(!1)};return U.addEventListener("click",q,!0),U.addEventListener("keydown",ee),()=>{U.removeEventListener("click",q,!0),U.removeEventListener("keydown",ee)}},[a]);const I=async()=>{await uy(c)&&(e(!0),clearTimeout(s.current),s.current=setTimeout(()=>{e(!1)},2e3))},O=()=>{o(U=>!U)},D=()=>{o(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(mt,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:w("Share")})}),l.jsxs("div",{className:"gh-portal-share-preview",children:[f&&l.jsx("img",{className:"gh-portal-share-preview-image",src:f,alt:"","data-testid":"share-preview-image"}),l.jsxs("div",{className:"gh-portal-share-preview-content",children:[m&&l.jsx("h2",{className:"gh-portal-share-preview-title",children:m}),h&&l.jsx("p",{className:"gh-portal-share-preview-excerpt",children:h}),(y||k||x)&&l.jsxs("div",{className:"gh-portal-share-preview-footer",children:[y&&l.jsx("img",{className:"gh-portal-share-preview-favicon",src:y,alt:"","data-testid":"share-preview-favicon"}),l.jsxs("div",{className:"gh-portal-share-preview-meta",children:[k&&l.jsx("span",{className:"gh-portal-share-preview-site",children:k}),k&&x&&l.jsx("span",{className:"gh-portal-share-preview-separator","aria-hidden":"true",children:"|"}),x&&l.jsx("span",{className:"gh-portal-share-preview-author",children:x})]})]})]})]}),l.jsxs("div",{className:"gh-portal-share-actions",children:[l.jsxs("button",{className:"gh-portal-btn gh-portal-share-action copy",type:"button",onClick:I,"aria-label":w(t?"Copied":"Copy link"),title:w(t?"Copied":"Copy link"),children:[t?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(Wo,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(HT,{})}),l.jsx("span",{className:"gh-portal-share-label",children:w(t?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:S.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":w("X (Twitter)"),title:w("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(JT,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:S.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":w("LinkedIn"),title:w("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(qT,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:S.email,target:"_blank",rel:"noopener noreferrer","aria-label":w("Email"),title:w("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(nd,{})})}),l.jsxs("div",{className:"gh-portal-share-more",ref:u,children:[l.jsx("button",{className:"gh-portal-btn gh-portal-share-action more",type:"button",onClick:O,"aria-label":w("More options"),title:w("More options"),"aria-haspopup":"menu","aria-expanded":a,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(WT,{})})}),a&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":w("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:S.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(VT,{})}),l.jsx("span",{children:w("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:S.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(ZT,{})}),l.jsx("span",{children:w("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:S.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:D,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(GT,{})}),l.jsx("span",{children:w("Bluesky")})]})]})]})]})]})}},pd=function({page:t}){return Object.keys(md).includes(t)?t:"signup"},fy=function({page:t}){return t.includes("account")},KT=function({page:t}){return t.includes("offer")},XT=t=>z.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},z.createElement("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"})),Nd=class Nd extends Je.Component{render(){return l.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",children:[l.jsx(XT,{}),"Powered by Ghost"]})}};Nd.contextType=ke;let Ts=Nd;const gy=()=>({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 QT({message:t}){return _a()?l.jsx("div",{className:"gh-portal-cookiebanner",children:t}):null}const Id=class Id extends Je.Component{componentDidMount(){this.node&&!yt(["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){const a=e.target&&e.target.tagName;(a!=="INPUT"||a==="INPUT"&&!e?.target?.value)&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){this.node&&yt(["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){const{page:a,otcRef:o}=this.context;yt(["preview"])||o&&a==="magiclink"||a==="giftRedemption"||a==="giftSuccess"||e.target===e.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:e}=this.context;pd({page:e});const a=md[e];return l.jsx(a,{})}renderPopupNotification(){const{popupNotification:e}=this.context;return!e||!e.type?null:l.jsx(od,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:e,pageQuery:a,site:o,customSiteUrl:s,lastPage:u}=this.context,m=ds({site:o,pageQuery:a}).length;pd({page:e});const f={...gy().page[e]};let y="",k="regular",x="",S=e;switch(e){case"signup":x="Cookies must be enabled in your browser to sign up.";break;case"signin":x="Cookies must be enabled in your browser to sign in.";break;case"accountHome":S="account-home";break;case"accountProfile":S="account-profile";break;case"accountPlan":S="account-plan";break;default:x="Cookies must be enabled in your browser.",S=e;break}m>1&&!$n({site:o})&&ea({site:o,pageQuery:a})&&e==="signup"&&(S+=" full-size",k="full"),(e==="gift"||e==="giftSuccess"||e==="giftRedemption")&&(S+=" full-size",k="full"),e==="magiclink"&&u==="gift"&&(S+=" full-size giftRedemption",k="full");const I=Do({site:o});(I&&m>2||!I&&m>1)&&e==="accountPlan"&&(S+=" full-size",k="full"),(e==="emailSuppressionFAQ"||e==="emailReceivingFAQ")&&(S+=" large-size");let O="gh-portal-popup-container";yt(["preview"])&&(S+=" preview"),yt(["preview"],{customSiteUrl:s})&&!o.disableBackground&&(O+=" preview"),yt(["dev"])&&(O+=" dev");const D=`${O} ${y} ${S}`,U=e==="gift"||e==="giftSuccess"||e==="giftRedemption"||e==="magiclink"&&u==="gift";return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+S,onClick:q=>this.handlePopupClose(q),children:[this.renderPopupNotification(),l.jsxs("div",{className:D,style:f,ref:q=>this.node=q,tabIndex:-1,children:[l.jsx(QT,{message:x}),this.renderActivePage(),k==="full"&&!U?l.jsx("div",{className:"gh-portal-powered inside "+(yt(["preview"])?"hidden ":"")+S,children:l.jsx(Ts,{})}):""]})]}),e!=="share"&&!U&&l.jsx("div",{className:"gh-portal-powered outside "+(yt(["preview"])?"hidden ":"")+S,children:l.jsx(Ts,{})})]})}};Id.contextType=ke;let hd=Id;const Od=class Od extends Je.Component{constructor(e){super(e),this.state={height:null}}renderCurrentPage(e){const a=md[e];return l.jsx(a,{})}onHeightChange(e){this.setState({height:e})}handlePopupClose(e){e.preventDefault();const{page:a}=this.context;a==="giftRedemption"||a==="giftSuccess"||e.target===e.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:e,brandColor:a}=this.context,o=iT({site:e}),s=a?`:root { --brandcolor: ${a} }`+o:o;return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:s}}),l.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:e,site:a,customSiteUrl:o}=this.context,s=gy(),u=window.innerWidth<480,c={...s.frame.common};let m="gh-portal-popup-background";return yt(["preview"])&&(s.modalContainer.zIndex="3999997"),yt(["preview"],{customSiteUrl:o})&&!a.disableBackground&&(m+=" preview"),yt(["dev"])&&(m+=" dev"),l.jsx("div",{style:s.modalContainer,children:l.jsxs(fc,{style:c,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[l.jsx("div",{className:m,onClick:h=>this.handlePopupClose(h)}),l.jsx(hd,{isMobile:u})]})})}render(){const{showPopup:e}=this.context;return e?this.renderFrameContainer():null}};Od.contextType=ke;let fd=Od;Ps({products:gd({numOfProducts:1})});function Wt(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function _T(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Ps({title:t="The Blueprint",description:e="Thoughts, stories and ideas.",logo:a="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:o="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",url:s="https://portal.localhost",plans:u={monthly:5e3,yearly:15e4,currency:"USD"},products:c=gd({numOfProducts:1}),portalProducts:m=c.map(L=>L.id),accentColor:h="#45C32E",portalPlans:f=["free","monthly","yearly"],membersSignupAccess:y="all",freePriceName:k="Free",freePriceDescription:x="Free preview",paidMembersEnabled:S=!0,portalButton:I=!0,portalName:O=!0,portalButtonIcon:D="icon-1",portalButtonSignupText:U="Subscribe now",portalButtonStyle:q="icon-and-text",membersSupportAddress:ee="support@example.com",editorDefaultEmailRecipients:te="visibility",newsletters:H=[],posts:re=eP(),commentsEnabled:ce,recommendations:pe=[],recommendationsEnabled:we}={}){return{title:t,description:e,logo:a,icon:o,accent_color:h,url:s,plans:u,products:c,portal_products:m,members_signup_access:y,free_price_name:k,free_price_description:x,paid_members_enabled:S,portal_button:I,portal_name:O,portal_plans:f,portal_button_icon:D,portal_button_signup_text:U,portal_button_style:q,members_support_address:ee,comments_enabled:ce!=="off",newsletters:H,recommendations:pe,recommendations_enabled:!!we,editor_default_email_recipients:te,posts:re}}function yy({name:t="Black Friday",code:e="black-friday",displayTitle:a="Black Friday Sale!",displayDescription:o="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:s="percent",cadence:u="month",amount:c=50,duration:m="repeating",durationInMonths:h=null,currencyRestriction:f=!1,currency:y=null,status:k="active",tierId:x="",tierName:S="Basic",redemptionType:I="signup"}={}){return{id:`offer_${Wt()}`,name:t,code:e,display_title:a,display_description:o,type:s,cadence:u,amount:c,duration:m,duration_in_months:h,currency_restriction:f,currency:y,status:k,tier:{id:`${x}`,name:S},redemption_type:I}}function zn({name:t="Jamie Larson",email:e="jamie@example.com",firstname:a="Jamie",subscriptions:o=[],paid:s=!1,status:u,avatarImage:c="",subscribed:m=!0,email_suppression:h={suppressed:!1,info:null},newsletters:f=[]}={}){const y={uuid:_T(),email:e,name:t,firstname:a,paid:s,subscribed:m,avatar_image:c,subscriptions:o,email_suppression:h,newsletters:f};return u!==void 0?y.status=u:s?y.status="paid":y.status="free",y}function eP({numOfPosts:t=3}={}){const e=[];for(let a=0;a<t;a++)e.push(tP({title:`Post ${a+1}`,slug:`post-${a+1}`}));return e.slice(0,t)}function tP({id:t=`post_${Wt()}`,title:e="Post",excerpt:a="Post excerpt",slug:o="post",featured:s=!1}={}){return{id:t,title:e,excerpt:a,slug:o,featured:s}}function gd({numOfProducts:t=3}={}){const a=[Vi({name:"Bronze",description:"Access to all members articles",monthlyPrice:kn({interval:"month",amount:700}),yearlyPrice:kn({interval:"year",amount:7e3}),numOfBenefits:2}),Vi({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:kn({interval:"month",amount:1200}),yearlyPrice:kn({interval:"year",amount:12e3}),numOfBenefits:3}),Vi({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:kn({interval:"month",amount:18e3}),yearlyPrice:kn({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,t),o=by({});return[...a,o]}function Vi({type:t="paid",name:e="Basic",description:a="",id:o=`product_${Wt()}`,monthlyPrice:s=kn(),yearlyPrice:u=kn({interval:"year"}),numOfBenefits:c=2,trialDays:m=null}){return{id:o,name:e,description:a,monthlyPrice:t==="free"?null:s,yearlyPrice:t==="free"?null:u,type:t,benefits:ky({numOfBenefits:c}),trial_days:m}}function by({name:t="Free tier",description:e="Free tier description",id:a=`product_${Wt()}`,numOfBenefits:o=2}){return{id:a,name:t,type:"free",description:e,benefits:ky({numOfBenefits:o})}}function ky({numOfBenefits:t}){const e=Wt();return[zs({name:`Limited early adopter pricing #${e.substring(0,6)}`}),zs({name:`Latest gear reviews #${e.substring(6,12)}`}),zs({name:`Weekly email newsletter #${e.substring(12,18)}`}),zs({name:`Listen to my podcast #${e.substring(18)}`})].slice(0,t)}function zs({id:t=`benefit_${Wt()}`,name:e="Benefit"}){return{id:t,name:e}}function kn({interval:t="month",amount:e=t==="month"?500:5e3,nickname:a=t==="month"?"Monthly":"Yearly",description:o=null,currency:s="usd",active:u=!0,id:c=`price_${Wt()}`}={}){return{id:c,active:u,nickname:a,currency:s,amount:e,interval:t,description:o,stripe_price_id:`price_${Wt()}`,stripe_product_id:`prod_${Wt()}`,type:"recurring"}}function ri({id:t=`sub_${Wt()}`,status:e="active",currency:a="USD",interval:o="year",amount:s=o==="month"?500:5e3,nickname:u=o==="month"?"Monthly":"Yearly",cardLast4:c="4242",offer:m=aP,priceId:h=`price_${Wt()}`,startDate:f="2021-10-05T03:18:30.000Z",currentPeriodEnd:y="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:k=!1,trialEndAt:x=null,nextPayment:S=null,tier:I=null}={}){return{id:t,customer:{id:`cus_${Wt()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Wt()}`,nickname:u,amount:s,interval:o,currency:a},offer:m,status:e,start_date:f,default_payment_card_last4:c,cancel_at_period_end:k,cancellation_reason:null,current_period_end:y,trial_end_at:x,next_payment:S,tier:I,price:{id:`stripe_price_${Wt()}`,price_id:h,nickname:u,amount:s,interval:o,type:"recurring",currency:a,product:{id:`stripe_prod_${Wt()}`,product_id:`prod_${Wt()}`}}}}function vy(){const t=gd({numOfProducts:1}),e=t.map(o=>o.id);return Ps({products:t,portalPlans:["free","monthly","yearly"],portalProducts:e})}vy();const nP=Ps({products:[Vi({numOfBenefits:2,type:"free"})]}),aP=yy({tierId:nP.products[0]?.id});zn({status:"free"}),zn({status:"paid",paid:!0,subscriptions:[ri()]}),zn({status:"comped",paid:!0,subscriptions:[]}),zn({status:"comped",paid:!0,subscriptions:[ri({amount:0})]}),zn({status:"paid",paid:!0,subscriptions:[ri({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),vy();const Ns=[by({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),Vi({name:"The Blueprint",description:"",monthlyPrice:kn({interval:"month",amount:500}),yearlyPrice:kn({interval:"year",amount:5e3}),numOfBenefits:3}),Vi({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:kn({interval:"month",amount:1200}),yearlyPrice:kn({interval:"year",amount:11e3}),numOfBenefits:4})],Is=Ps({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:Ns,portalProducts:Ns.map(t=>t.id),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}]}),wy=yy({tierId:Is.products[1]?.id}),Hi={free:zn({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,status:"free",avatarImage:"",subscribed:!0}),paid:zn({paid:!0,status:"paid",subscriptions:[ri({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:zn({paid:!0,status:"comped",subscriptions:[]}),complimentaryWithSubscription:zn({paid:!0,status:"comped",subscriptions:[ri({amount:0})]}),preview:zn({paid:!0,status:"paid",subscriptions:[ri({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function iP(){if(!Ns||!Ns[1])return null;let t=Is?.products?.[1].monthlyPrice,e=zn({paid:!0,status:"paid",subscriptions:[ri({offer:null,priceId:t?.id,status:"active",currency:t?.currency,interval:t?.interval,amount:t?.amount,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]});return{site:Is,member:e}}function oP(t){const e=t.getAttribute("href"),a=new URL(e,window.location.origin),o=["#/portal","#/share"],s=o.some(c=>a.hash.startsWith(c)),u=o.some(c=>e.startsWith(c));!a.hash||!s||u||a.origin===window.location.origin&&t.setAttribute("href",a.hash)}const rP="CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION";function sP({data:t,state:e}){return{page:t.page,popupNotification:null,lastPage:t.lastPage||null,pageData:t.pageData||e.pageData}}function lP({state:t}){return{showPopup:!t.showPopup}}function uP({data:t}){return{showPopup:!0,reloadOnPopupClose:!1,page:t.page,...t.pageQuery?{pageQuery:t.pageQuery}:{},...t.pageData?{pageData:t.pageData}:{}}}function cP({state:t}){return t.lastPage?{page:t.lastPage}:xy({state:t})}function xy({state:t}){ya();const e={...t.pageData||{}};return delete e.redirect,{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:t.page==="magiclink"?"":t.page,pageData:e}}function dP({data:t,state:e}){const{action:a="openNotification",status:o="success",autoHide:s=!0,closeable:u=!0,duration:c=2600,message:m=""}=t||{},h=$o({type:a,status:o,autoHide:s,closeable:u,duration:c,state:e,message:m});return{notification:h,notificationSequence:h.count}}function mP(){return{notification:null}}async function pP({api:t,state:e}){try{return await t.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:rt({type:"signout:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to log out, please try again")})}}}async function hP({data:t,api:e,state:a}){try{const o=await e.member.getIntegrityToken(),s={...t,emailType:"signin",integrityToken:o,includeOTC:!0},{otc_ref:u,inboxLinks:c}=await e.member.sendMagicLink(s);return{page:"magiclink",lastPage:"signin",...u?{otcRef:u}:{},inboxLinks:c,pageData:{...a.pageData||{},email:(t?.email||"").trim()}}}catch(o){return{action:"signin:failed",popupNotification:rt({type:"signin:failed",autoHide:!1,closeable:!0,state:a,status:"error",message:_n(o,w("Failed to log in, please try again"))})}}}function fP({data:t,state:e}){const a=(t?.email||"").trim(),o=t?.otcRef,s=t?.inboxLinks;return o?{showPopup:!0,page:"magiclink",lastPage:"signin",otcRef:o,inboxLinks:s,pageData:{...e.pageData||{},email:a},popupNotification:null}:{}}async function gP({data:t,api:e}){const a=w("Failed to verify code, please try again");try{const o=await e.member.getIntegrityToken(),s=await e.member.verifyOTC({...t,integrityToken:o});return s.redirectUrl?window.location.assign(s.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:_n(s.errors?.[0],a)}}catch(o){return{action:"verifyOTC:failed",actionErrorMessage:_n(o,a)}}}async function yP({data:t,state:e,api:a}){try{let{plan:o,tierId:s,cadence:u,email:c,name:m,newsletters:h,offerId:f}=t;m=m?.trim();let y;if(o.toLowerCase()==="free"){const k=await a.member.getIntegrityToken();({inboxLinks:y}=await a.member.sendMagicLink({emailType:"signup",integrityToken:k,...t,name:m}))}else{const k=e.member?{checkoutType:"upgrade"}:void 0;return(!s||!u)&&({tierId:s,cadence:u}=Yo({site:e?.site,priceId:o})),await a.member.checkoutPlan({plan:o,tierId:s,cadence:u,email:c,name:m,newsletters:h,offerId:f,metadata:k}),{page:"loading"}}return{page:"magiclink",lastPage:"signup",inboxLinks:y,pageData:{...e.pageData||{},email:(c||"").trim()}}}catch(o){if(o.code===rP)return e.member?{action:"signup:failed",popupNotification:rt({type:"signup:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("You already have an active subscription.")})}:{page:"magiclink",lastPage:"signin",pageData:{...e.pageData||{},email:(t?.email||"").trim()},popupNotification:null};const s=_n(o,w("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:rt({type:"signup:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:s})}}}async function bP({data:t,state:e,api:a}){try{let{email:o,name:s,giftToken:u}=t;if(s=s?.trim(),e.member){await a.gift.redeem({token:u});const y=await a.member.sessionData(),k=$o({type:"giftRedeem",status:"success",autoHide:!0,closeable:!0,state:e,message:Tg({member:y})});return ya(),{action:"redeemGift:success",member:y,showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:k,notificationSequence:k.count}}const c=await a.member.getIntegrityToken(),m=new URL(e?.site?.url||window.location.href);m.search=new URLSearchParams({giftRedemption:"true"}).toString(),m.hash="";const{otc_ref:h,inboxLinks:f}=await a.member.sendMagicLink({email:(o||"").trim(),emailType:"subscribe",integrityToken:c,includeOTC:!0,redirect:m.href,giftToken:u,...s?{name:s}:{}});return{page:"magiclink",lastPage:"gift",...h?{otcRef:h}:{},inboxLinks:f,pageData:{...e.pageData||{},email:(o||"").trim(),redirect:m.href}}}catch(o){const s=$o({type:"giftRedeem",status:"error",autoHide:!1,closeable:!0,state:e,message:ws(o)});return ya(),{action:"redeemGift:failed",showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:s,notificationSequence:s.count}}}async function kP({data:t,state:e,api:a}){try{let{plan:o,offerId:s,tierId:u,cadence:c}=t;(!u||!c)&&({tierId:u,cadence:c}=Yo({site:e?.site,priceId:o})),await a.member.checkoutPlan({plan:o,tierId:u,cadence:c,offerId:s,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:rt({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to process checkout, please try again")})}}}async function vP({state:t,api:e}){try{await e.member.continueGiftCheckout()}catch{return{action:"continueGiftSubscription:failed",popupNotification:rt({type:"continueGiftSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:w("Failed to process checkout, please try again")})}}}async function wP({data:t,state:e,api:a}){try{const{tierId:o,cadence:s,email:u}=t;return await a.member.checkoutGift({tierId:o,cadence:s,...u?{email:u}:{}}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:rt({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to process checkout, please try again")})}}}async function xP({data:t,state:e,api:a}){try{const{plan:o,planId:s,subscriptionId:u,cancelAtPeriodEnd:c}=t,{tierId:m,cadence:h}=Yo({site:e?.site,priceId:s});await a.member.updateSubscription({planName:o,tierId:m,cadence:h,subscriptionId:u,cancelAtPeriodEnd:c,planId:s});const f=await a.member.sessionData(),y="updateSubscription:success";return{action:y,popupNotification:rt({type:y,autoHide:!0,closeable:!0,state:e,status:"success",message:w("Subscription plan updated successfully")}),page:"accountHome",member:f}}catch{return{action:"updateSubscription:failed",popupNotification:rt({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to update subscription, please try again")})}}}async function SP({data:t,state:e,api:a}){try{const{subscriptionId:o,cancellationReason:s}=t;return await a.member.updateSubscription({subscriptionId:o,smartCancel:!0,cancellationReason:s}),{action:"cancelSubscription:success",page:"accountHome",member:await a.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"cancelSubscription:failed",popupNotification:rt({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to cancel subscription, please try again")})}}}async function CP({data:t,state:e,api:a}){try{const{subscriptionId:o}=t;return await a.member.updateSubscription({subscriptionId:o,cancelAtPeriodEnd:!1}),{action:"continueSubscription:success",page:"accountHome",member:await a.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"continueSubscription:failed",popupNotification:rt({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to cancel subscription, please try again")})}}}async function EP({data:t,state:e,api:a}){try{const{offerId:o,subscriptionId:s}=t;return await a.member.applyOffer({offerId:o,subscriptionId:s}),{action:"applyOffer:success",page:"accountHome",member:await a.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:rt({type:"applyOffer:success",autoHide:!0,closeable:!0,state:e,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:rt({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:"Failed to apply offer, please try again"})}}}async function jP({data:t,state:e,api:a}){try{await a.member.editBilling(t)}catch{return{action:"editBilling:failed",popupNotification:rt({type:"editBilling:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to update billing information, please try again")})}}}async function TP({data:t,state:e,api:a}){try{await a.member.manageBilling(t)}catch{return{action:"manageBilling:failed",popupNotification:rt({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:w("Failed to open billing portal, please try again")})}}}async function PP(){return{popupNotification:null}}async function zP({data:t,state:e}){let{action:a,message:o=""}=t;return a=a||"showPopupNotification:success",{popupNotification:rt({type:a,autoHide:!0,closeable:!0,state:e,status:"success",message:o})}}async function NP({data:t,state:e,api:a}){try{const{newsletters:o,enableCommentNotifications:s,enableUpdatesAndAnnouncements:u}=t;if(!o&&s===void 0&&u===void 0)return{};const c={};return o&&(c.newsletters=o),s!==void 0&&(c.enableCommentNotifications=s),u!==void 0&&(c.enableUpdatesAndAnnouncements=u),{action:"updateNewsletterPref:success",member:await a.member.update(c)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:rt({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:w("Failed to update newsletter settings")})}}}async function IP({state:t,api:e}){try{return await e.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:rt({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:t,status:"success",message:w("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:rt({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:w("Your email has failed to resubscribe, please try again")})}}}async function OP({data:t,state:e,api:a}){try{const{subscribed:o}=t,s=await a.member.update({subscribed:o});if(!s)throw new Error("Failed to update newsletter");const u="updateNewsletter:success";return{action:u,member:s,popupNotification:rt({type:u,autoHide:!0,closeable:!0,state:e,status:"success",message:w("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:rt({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:w("Failed to update newsletter settings")})}}}async function AP({data:t,state:e,api:a}){const{email:o}=t,s=QE({member:e.member});if(o!==s)try{return await a.member.updateEmailAddress({email:o}),{success:!0}}catch(u){return{success:!1,error:u}}return null}async function MP({data:t,state:e,api:a}){const o=t?.name?.trim();if(e1({member:e.member})!==o)try{const u=await a.member.update({name:o});if(!u)throw new Error("Failed to update member");return{member:u,success:!0}}catch(u){return{success:!1,error:u}}return null}async function DP({state:t,api:e}){if(t.member)try{const a=await e.member.sessionData();return a?{member:a,success:!0,action:"refreshMemberData:success"}:null}catch(a){return{success:!1,error:a,action:"refreshMemberData:failed"}}return null}async function FP({data:t,state:e,api:a}){const[o,s]=await Promise.all([MP({data:t,state:e,api:a}),AP({data:t,state:e,api:a})]);if(o&&s){if(s.success)return{action:"updateProfile:success",...o.success?{member:o.member}:{},page:"accountHome",popupNotification:rt({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:e,message:w("Check your inbox to verify email update")})};const u=o.success?w("Failed to send verification email"):w("Failed to update account data");return{action:"updateProfile:failed",...o.success?{member:o.member}:{},popupNotification:rt({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:u,state:e})}}else if(o){const u=o.success?"updateProfile:success":"updateProfile:failed",c=o.success?"success":"error",m=o.success?w("Account details updated successfully"):w("Failed to update account details");return{action:u,...o.success?{member:o.member}:{},...o.success?{page:"accountHome"}:{},popupNotification:rt({type:u,autoHide:o.success,closeable:!0,status:c,state:e,message:m})}}else if(s){const u=s.success?"updateProfile:success":"updateProfile:failed",c=s.success?"success":"error";let m="";return s.error?m=_n(s.error,w("Failed to send verification email")):m=w("Check your inbox to verify email update"),{action:u,...s.success?{page:"accountHome"}:{},popupNotification:rt({type:u,autoHide:s.success,closeable:!0,status:c,state:e,message:m})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:rt({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:e,message:w("Account details updated successfully")})}}async function YP({data:{siteUrl:t},state:e}){const a=js({siteUrl:t,apiUrl:"not-defined"}),{member:o}=e,s=window.location.href,u=ag(),c=await a.member.getIntegrityToken();return await a.member.sendMagicLink({emailType:"signup",name:o.name,email:o.email,autoRedirect:!1,integrityToken:c,customUrlHistory:e.site.outbound_link_tagging?[{time:Date.now(),referrerSource:u,referrerMedium:"Ghost Recommendations",referrerUrl:s}]:[]}),{}}function RP({data:{recommendationId:t},api:e}){try{const a=localStorage.getItem("ghost-recommendations-clicked"),o=a?JSON.parse(a):[];if(o.includes(t))return;o.push(t),localStorage.setItem("ghost-recommendations-clicked",JSON.stringify(o))}catch{}return e.recommendations.trackClicked({recommendationId:t}),{}}async function $P({data:{recommendationId:t},api:e}){return e.recommendations.trackSubscribed({recommendationId:t}),{}}const LP={togglePopup:lP,openPopup:uP,closePopup:xy,switchPage:sP,openNotification:dP,closeNotification:mP,back:cP,signout:pP,signin:hP,startSigninOTCFromCustomForm:fP,verifyOTC:gP,signup:yP,redeemGift:bP,updateSubscription:xP,cancelSubscription:SP,continueSubscription:CP,applyOffer:EP,updateNewsletter:OP,updateProfile:FP,refreshMemberData:DP,clearPopupNotification:PP,editBilling:jP,manageBilling:TP,checkoutPlan:kP,continueGiftSubscription:vP,checkoutGift:wP,updateNewsletterPreference:NP,showPopupNotification:zP,removeEmailFromSuppressionList:IP,oneClickSubscribe:YP,trackRecommendationClicked:RP,trackRecommendationSubscribed:$P};async function UP({action:t,data:e,state:a,api:o}){const s=LP[t];return s?await s({data:e,state:a,api:o})||{}:{}}function Sy(t,e){t&&(t.innerText=e)}function BP(t,e,a){e.classList.add("error");const o=w("There was an error sending the email, please try again");Sy(a,_n(t,o))}async function GP({event:t,form:e,errorEl:a,siteUrl:o,submitHandler:s,doAction:u,captureException:c}){e.removeEventListener("submit",s),t.preventDefault(),a&&(a.innerText=""),e.classList.remove("success","invalid","error");let m=t.target.querySelector("input[data-members-email]"),h=t.target.querySelector("input[data-members-name]"),f=e?.dataset?.membersAutoredirect||"true",y=m?.value,k=(h?.value||"").trim()||void 0,x,S=[],I=[],O=t.target.querySelectorAll("input[data-members-label]")||[];for(let te=0;te<O.length;++te)S.push(O[te].value);let D=t.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let te=0;te<D.length;++te)I.push({name:D[te].value});e.dataset.membersForm&&(x=e.dataset.membersForm);const U=x==="signin"&&e?.dataset?.membersOtc==="true";e.classList.add("loading");const q=Di(),ee={email:y,emailType:x,labels:S,name:k,autoRedirect:f==="true"};U&&(ee.includeOTC=!0),q&&(ee.urlHistory=q),D.length>0?ee.newsletters=I:(t.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(ee.newsletters=[]);try{const H=await(await fetch(`${o}/members/api/integrity-token/`,{method:"GET"})).text(),re=await fetch(`${o}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ee,integrityToken:H})});if(e.addEventListener("submit",s),e.classList.remove("loading"),re.ok){e.classList.add("success");let ce;if(U)try{ce=await re.clone().json()}catch{ce=void 0}const pe=ce?.otc_ref;if(pe&&typeof u=="function")try{u("startSigninOTCFromCustomForm",{email:(y||"").trim(),otcRef:pe,inboxLinks:ce?.inboxLinks})}catch(we){console.error(we),c?.(we)}}else{const ce=await Pn.fromApiResponse(re),pe=_n(ce,w("Failed to send magic link email"));Sy(a,pe),e.classList.add("error")}}catch(te){BP(te,e,a)}}function WP({event:t,el:e,errorEl:a,siteUrl:o,site:s,member:u,clickHandler:c}){e.removeEventListener("click",c),t.preventDefault();let m=e.dataset.membersPlan,h=UE(s,m.toLowerCase()),f=e.dataset.membersSuccess,y=e.dataset.membersCancel,k,x;f&&(k=new URL(f,window.location.href).href),y&&(x=new URL(y,window.location.href).href),a&&(a.innerText=""),e.classList.add("loading");const S=u?{checkoutType:"upgrade"}:{},I=Di();return I&&(S.urlHistory=I),fetch(`${o}/members/api/session`,{credentials:"same-origin"}).then(function(O){return O.ok?O.text():null}).then(function(O){return fetch(`${o}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...h,identity:O,successUrl:k,cancelUrl:x,metadata:S})}).then(function(D){if(!D.ok)throw new Error(w("Could not create Stripe checkout session"));return D.json()})}).then(function(O){return O.url?window.location.assign(O.url):window.Stripe(O.publicKey).redirectToCheckout({sessionId:O.sessionId}).then(function(U){if(U.error)throw new Error(U.error.message)})}).catch(function(O){console.error(O),e.addEventListener("click",c),e.classList.remove("loading"),a&&(a.innerText=O.message),e.classList.add("error")})}function VP({siteUrl:t,site:e={},member:a,offers:o=[],doAction:s,captureException:u}={}){if(!t)return;t=t.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(m){let h=m.querySelector("[data-members-error]");function f(y){GP({event:y,errorEl:h,form:m,siteUrl:t,submitHandler:f,doAction:s,captureException:u})}m.addEventListener("submit",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(m){let h=m.querySelector("[data-members-error]");function f(y){WP({el:m,event:y,errorEl:h,member:a,site:e,siteUrl:t,clickHandler:f})}m.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(m){let h=m.querySelector("[data-members-error]"),f=m.dataset.membersSuccess,y=m.dataset.membersCancel,k,x;f&&(k=new URL(f,window.location.href).href),y&&(x=new URL(y,window.location.href).href);function S(I){m.removeEventListener("click",S),I.preventDefault(),h&&(h.innerText=""),m.classList.add("loading"),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(O){return O.ok?O.text():null}).then(function(O){return fetch(`${t}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:O,successUrl:k,cancelUrl:x})}).then(function(D){if(!D.ok)throw new Error(w("Could not create Stripe checkout session"));return D.json()})}).then(function(O){return window.Stripe(O.publicKey).redirectToCheckout({sessionId:O.sessionId})}).then(function(O){if(O.error)throw new Error(w(O.error.message))}).catch(function(O){console.error(O),m.addEventListener("click",S),m.classList.remove("loading"),h&&(h.innerText=O.message),m.classList.add("error")})}m.addEventListener("click",S)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(m){let h=m.querySelector("[data-members-error]"),f=m.dataset.membersReturn,y;f&&(y=new URL(f,window.location.href).href);function k(x){m.removeEventListener("click",k),x.preventDefault(),h&&(h.innerText=""),m.classList.add("loading"),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(S){return S.ok?S.text():null}).then(function(S){return fetch(`${t}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:S,returnUrl:y})}).then(function(I){if(!I.ok)throw new Error(w("Could not create Stripe billing portal session"));return I.json()})}).then(function(S){return window.location.assign(S.url)}).catch(function(S){console.error(S),m.addEventListener("click",k),m.classList.remove("loading"),h&&(h.innerText=S.message),m.classList.add("error")})}m.addEventListener("click",k)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(m){function h(f){m.removeEventListener("click",h),f.preventDefault(),m.classList.remove("error"),m.classList.add("loading"),fetch(`${t}/members/api/session`,{method:"DELETE"}).then(function(y){y.ok?window.location.replace(t):(m.addEventListener("click",h),m.classList.remove("loading"),m.classList.add("error"))})}m.addEventListener("click",h)});const c=(o||[]).some(m=>m.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(m){let h=m.parentElement.querySelector("[data-members-error]");function f(y){y.preventDefault();let k=m.dataset.membersCancelSubscription;if(c){s("openPopup",{page:"accountPlan",pageData:{subscriptionId:k,action:"cancel"}});return}return m.removeEventListener("click",f),m.classList.remove("error"),m.classList.add("loading"),h&&(h.innerText=""),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(x){return x.ok?x.text():null}).then(function(x){return fetch(`${t}/members/api/subscriptions/${k}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:x,smart_cancel:!0})})}).then(function(x){x.ok?window.location.reload():(m.addEventListener("click",f),m.classList.remove("loading"),m.classList.add("error"),h&&(h.innerText=w("There was an error cancelling your subscription, please try again.")))})}m.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(m){let h=m.parentElement.querySelector("[data-members-error]");function f(y){m.removeEventListener("click",f),y.preventDefault(),m.classList.remove("error"),m.classList.add("loading");let k=m.dataset.membersContinueSubscription;return h&&(h.innerText=""),fetch(`${t}/members/api/session`,{credentials:"same-origin"}).then(function(x){return x.ok?x.text():null}).then(function(x){return fetch(`${t}/members/api/subscriptions/${k}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:x,cancel_at_period_end:!1})})}).then(function(x){x.ok?window.location.reload():(m.addEventListener("click",f),m.classList.remove("loading"),m.classList.add("error"),h&&(h.innerText=w("There was an error continuing your subscription, please try again.")))})}m.addEventListener("click",f)})}const Cy=t=>{try{return decodeURIComponent(t)}catch{return null}},HP={staleGiftRedemptionRequest:!0},qP={showPopup:!0,site:Is,member:Hi.free,page:"accountEmail",...iP(),pageData:wy};function ZP({site:t,children:e}){const{portal_sentry:a}=t||{};return a&&a.dsn?l.jsx(gu,{children:e}):l.jsx(l.Fragment,{children:e})}class JP extends Je.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(){const e=this.getScrollbarWidth();this.setState({scrollbarWidth:e}),this.initSetup()}componentDidUpdate(e,a){if(a.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"&&a.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),VP({siteUrl:o,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:No})}}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(){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",document.body.appendChild(e),document.body.appendChild(e);const a=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),a}setupCustomTriggerButton(){this.clickHandler=async o=>{o.preventDefault();const s=o.currentTarget,u=s&&s.dataset.portal,c=this.getPageFromLinkPath(u);if(!c)return;const{page:m,pageQuery:h,pageData:f}=c;if(this.state.initStatus==="success"){if(m==="gift"&&!Ai({site:this.state.site})){this.invalidateGiftRedemptionRequest(),ya();return}if(m==="giftRedemption"&&f?.token){const y=this.startGiftRedemptionRequest(f.token),k=await this.fetchGiftRedemptionData({token:f.token});if(!this.isCurrentGiftRedemptionRequest(y))return;this.setState(k);return}this.invalidateGiftRedemptionRequest(),h&&h!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:h}):this.dispatchAction("openPopup",{page:m,pageQuery:h,pageData:f})}};const e="[data-portal]",a="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(e)||[],this.customTriggerButtons.forEach(o=>{o.classList.add(a),o.removeEventListener("click",this.clickHandler),o.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){const e="gh-portal-open",a="gh-portal-close";this.customTriggerButtons?.forEach(o=>{const s=this.state.showPopup?e:a,u=this.state.showPopup?a:e;o.classList.add(s),o.classList.remove(u)})}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:a}){return this._redemptionRequestId===e&&this.currentRedemptionToken===a}async initSetup(){try{const{site:e,member:a,offers:o,page:s,showPopup:u,popupNotification:c,notification:m,notificationSequence:h,lastPage:f,pageQuery:y,pageData:k}=await this.fetchData(),x=this.props.siteI18nEnabled&&(this.props.locale||e.locale)||"en";is.changeLanguage(x);const S={site:e,member:a,offers:o,page:s,lastPage:f,pageQuery:y,showPopup:u,pageData:k,popupNotification:c,notification:m,notificationSequence:h,dir:is.dir()||"ltr",action:"init:success",initStatus:"success",locale:x};if(this.setState(S,()=>{this.handleSignupQuery({site:e,pageQuery:y,member:a})}),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!a){const I=document.querySelectorAll("[data-lexical-signup-form]");I.length>0&&I.forEach(O=>{O.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(e){console.error("[Portal] Failed to initialize:",e),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:e,member:a,offers:o}=await this.fetchApiData(),{site:s,...u}=this.fetchDevData(),c=await this.fetchLinkData(e,a),{site:m,...h}=c?.staleGiftRedemptionRequest?{}:c,{site:f,...y}=this.fetchPreviewData(),{site:k,...x}=this.fetchNotificationData();return{member:a,offers:o,page:"",site:{...e,...m,...f,...k,...s,plans:{...(s||{}).plans,...(e||{}).plans,...(f||{}).plans}},...u,...h,...x,...y}}fetchDevData(){return yt(["dev"])&&!this.state.customSiteUrl?qP:yt(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(e=""){const a=new URLSearchParams(e),o={};for(let s of a.entries()){const u=s[0],c=decodeURIComponent(s[1]);u==="name"?o.name=c||"":u==="code"?o.code=c||"":u==="display_title"?o.display_title=c||"":u==="display_description"?o.display_description=c||"":u==="type"?o.type=c||"":u==="cadence"?o.cadence=c||"":u==="duration"?o.duration=c||"":u==="duration_in_months"&&!isNaN(Number(c))?o.duration_in_months=Number(c):u==="amount"&&!isNaN(Number(c))?o.amount=Number(c):u==="currency"?o.currency=c||"":u==="status"?o.status=c||"":u==="tier_id"?o.tier={id:c||wy.tier.id}:u==="redemption_type"&&(o.redemption_type=c||"signup")}if(o.redemption_type==="retention"){const s=Hi.preview?.subscriptions?.[0]?.id;return{page:"accountPlan",offers:[o],pageData:{action:"cancel",subscriptionId:s}}}return{page:"offer",pageData:o}}fetchQueryStrData(e=""){const a=new URLSearchParams(e),o={site:{plans:{}}},s=[];let u,c=null,m,h,f;for(let y of a.entries()){const k=y[0],x=decodeURIComponent(y[1]);if(k==="button")o.site.portal_button=JSON.parse(x);else if(k==="name")o.site.portal_name=JSON.parse(x);else if(k==="isFree"&&JSON.parse(x))s.push("free");else if(k==="isMonthly"&&JSON.parse(x))s.push("monthly");else if(k==="isYearly"&&JSON.parse(x))s.push("yearly");else if(k==="portalPrices")u=x?x.split(","):[];else if(k==="portalProducts")c=x?x.split(","):[];else if(k==="page"&&x)o.page=x;else if(k==="accentColor"&&(x===""||x))o.site.accent_color=x;else if(k==="buttonIcon"&&x)o.site.portal_button_icon=x;else if(k==="signupButtonText")o.site.portal_button_signup_text=x||"";else if(k==="signupTermsHtml")o.site.portal_signup_terms_html=x||"";else if(k==="signupCheckboxRequired")o.site.portal_signup_checkbox_required=JSON.parse(x);else if(k==="buttonStyle"&&x)o.site.portal_button_style=x;else if(k==="monthlyPrice"&&!isNaN(Number(x)))o.site.plans.monthly=Number(x),m=Number(x);else if(k==="yearlyPrice"&&!isNaN(Number(x)))o.site.plans.yearly=Number(x),h=Number(x);else if(k==="currency"&&x){const S=x.toUpperCase();o.site.plans.currency=S,o.site.plans.currency_symbol=Tt(S),f=S}else k==="disableBackground"?o.site.disableBackground=JSON.parse(x):k==="membersSignupAccess"&&x?o.site.members_signup_access=x:k==="portalDefaultPlan"&&x?o.site.portal_default_plan=x:k==="transistorPortalSettings"&&x&&(o.site.transistor_portal_settings=JSON.parse(x))}return o.site.portal_plans=s,o.site.portal_products=c,u?o.site.portal_plans=u:m&&h&&f&&(o.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:f,amount:m,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:f,amount:h,type:"recurring",interval:"year"}]),o}fetchNotificationData(){const{type:e,status:a,duration:o,autoHide:s,closeable:u}=zg({billingOnly:!0})||{};return["stripe:billing-update"].includes(e)?a==="success"?{showPopup:!0,popupNotification:rt({type:e,status:a,duration:o,closeable:u,autoHide:s,state:this.state,message:a==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({token:e}){try{const a=await this.GhostApi.gift.fetchRedemptionData({token:e});return{showPopup:!0,notification:null,page:"giftRedemption",pageData:{token:e,gift:a?.gifts?.[0]||null}}}catch(a){ya();const o=$o({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:ws(a)});return{showPopup:!1,pageData:null,notification:o,notificationSequence:o.count}}}async fetchLinkData(e,a){this.invalidateGiftRedemptionRequest();const o=new URLSearchParams(window.location.search);if(o.get("stripe")==="gift-purchase-success"){const I=o.get("gift_token"),O=o.get("gift_tier"),D=o.get("gift_cadence");if(xs(["stripe","gift_token","gift_tier","gift_cadence"]),I)return{showPopup:!0,page:"giftSuccess",pageData:{token:I,tierId:O,cadence:D}}}if(o.get("action")==="unsubscribe")return o.get("key")&&o.get("uuid")?{showPopup:!0,page:"unsubscribe",pageData:{uuid:o.get("uuid"),key:o.get("key"),newsletterUuid:o.get("newsletter"),comments:o.get("comments"),updatesAndAnnouncements:o.get("updatesandannouncements")}}:{showPopup:!0,page:"accountEmail",pageData:{newsletterUuid:o.get("newsletter"),action:"unsubscribe",redirect:e.url+"#/portal/account/newsletters"}};if(WE({site:e})&&o.get("action")==="signup"&&o.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[s,u]=window.location.hash.substr(1).split("?"),c=new URLSearchParams(u??""),m=/^(?:(\w+?))?\/monthly$/,h=/^(?:(\w+?))?\/yearly$/,f=/^offers\/(\w+?)\/?$/,y=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,k=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,x=/^\/share\/?$/,S=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(s&&S.test(s)){const[,I,O]=s.match(S),D=parseInt(O);if(D===1||D===0)return a||c.get("uuid")&&c.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:a?null:c.get("uuid"),key:a?null:c.get("key"),postId:I,score:D}}:{showPopup:!0,page:"signin",pageData:{redirect:e.url+`#/feedback/${I}/${D}/`}}}if(s&&y.test(s)){const[,I]=s.match(y),O=Cy(I);if(!O)return{};const D=this.startGiftRedemptionRequest(O),U=await this.fetchGiftRedemptionData({token:O});return this.isCurrentGiftRedemptionRequest(D)?U:HP}if(s&&x.test(s))return{showPopup:!0,page:"share"};if(s&&k.test(s)){const[,I]=s.match(k),{page:O,pageQuery:D,pageData:U}=this.getPageFromLinkPath(I,e)||{};if(!a&&O&&fy({page:O}))return{showPopup:!0,page:"signin",pageData:{redirect:e.url+`#/portal/${I}/`}};if(O==="gift"&&!Ai({site:e}))return ya(),{};const q=["accountPlan","accountProfile"].includes(O)?"accountHome":null,ee=!(["monthly","yearly"].includes(D)||m.test(D)||h.test(D)||f.test(D)),te=c.get("redirect"),H=O==="signin"&&te?{...U||{},redirect:te}:U;return{showPopup:ee,...O?{page:O}:{},...D?{pageQuery:D}:{},...H?{pageData:H}:{},...q?{lastPage:q}:{}}}return{}}fetchPreviewData(){const[,e]=window.location.hash.substr(1).split("?");if(yt(["preview"])){let a={};try{yt(["offerPreview"])?a=this.fetchOfferQueryStrData(e):a=this.fetchQueryStrData(e)}catch(o){return No(o),{}}return{...a,showPopup:!0}}return{}}getColorOverride(){const e=document.querySelector("script[data-ghost]");return e&&e.dataset.accentColor?e.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:e,customSiteUrl:a,apiUrl:o,apiKey:s}=this.props;try{this.GhostApi=this.props.api||js({siteUrl:e,apiUrl:o,apiKey:s});const{site:u,member:c,offers:m}=await this.GhostApi.init(),h=this.getColorOverride();return h&&(u.accent_color=h),this.setupFirstPromoter({site:u,member:c}),this.setupSentry({site:u}),{site:u,member:c,offers:m}}catch(u){if(yt(["dev","test"],{customSiteUrl:a}))return{};throw u}}setupSentry({site:e}){if(yt(["test"]))return null;const{portal_sentry:a,portal_version:o,version:s}=e,c=`portal@2.69.13|ghost@${s}`;a&&a.dsn&&jC({dsn:a.dsn,environment:a.env||"development",release:c,beforeSend:m=>ME({event:m})?m:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:e,member:a}){if(yt(["test"]))return null;const o=_E({site:e});let s=Cc({site:e});if(s=s?.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),o&&s){const u=document.createElement("script");u.type="text/javascript",u.async=!0,u.src="https://cdn.firstpromoter.com/fprom.js",u.onload=u.onreadystatechange=function(){let m=this.readyState;if(!m||m==="complete"||m==="loaded")try{if(window.$FPROM.init(o,s),c1({member:a})){const h=a.email,f=a.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:h,uid:f});else{const y=window._fprom||[];window._fprom=y,y.push(["event","signup"]),y.push(["email",h]),y.push(["uid",f])}}}catch{}};const c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(u,c)}}async dispatchAction(e,a){clearTimeout(this.timeoutId),this.setState({action:`${e}:running`,actionErrorMessage:null});try{const o=await UP({action:e,data:a,state:this.state,api:this.GhostApi});this.setState(o),o&&o.action&&!o.action.includes(":failed")&&(this.timeoutId=setTimeout(()=>{this.setState({action:""})},2e3))}catch(o){if(console.error(`[Portal] Failed to dispatch action: ${e}`,o),a&&a.throwErrors)throw o;const s=rt({type:`${e}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:o}});this.setState({action:`${e}:failed`,actionErrorMessage:_n(o,w("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:s})}}async updateStateForPreviewLinks(){const{site:e,...a}=this.fetchPreviewData(),o=await this.fetchLinkData(this.state.site,this.state.member);if(o?.staleGiftRedemptionRequest)return;const{site:s,...u}=o,c={site:{...this.state.site,...s||{},...e||{},plans:{...this.state.site&&this.state.site.plans,...(s||{}).plans,...(e||{}).plans}},...u,...a};this.handleSignupQuery({site:c.site,pageQuery:c.pageQuery}),this.setState(c)}async handleOfferQuery({site:e,offerId:a,member:o=this.state.member}){if(ya(),!(!Yn({member:o})||ba({member:o}))){const u=$o({type:"offer:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:w("You already have an active subscription.")});await this.dispatchAction("closePopup"),this.setState({notification:u,notificationSequence:u.count});return}try{const c=(await this.GhostApi.site.offer({offerId:a}))?.offers[0];if(!c||!c.tier||Tc({offer:c})||!i1({site:e,offer:c}))return;this.dispatchAction("openPopup",{page:"offer",pageData:c})}catch{}}handleSignupQuery({site:e,pageQuery:a,member:o}){const s=/^offers\/(\w+?)\/?$/;let u=a;if(s.test(a||"")){const[,m]=a.match(s);this.handleOfferQuery({site:e,offerId:m,member:o});return}lg({site:e,pageQuery:a})&&(u=lg({site:e,pageQuery:a}));const c=BE({site:e,priceId:u});if(a&&a!=="free"){ya();const m=c?.id||u;m!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:h,cadence:f}=Yo({site:e,priceId:m});this.dispatchAction("signup",{plan:m,tierId:h,cadence:f})}}getPageFromLinkPath(e){const a=/^signup\/?(?:\/(\w+?))?\/?$/,o=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,s=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,u=/^offers\/(\w+?)\/?$/,c=/^gift\/redeem\/([^/?#]+)\/?$/;if(e===void 0||e==="")return{page:"default"};if(c.test(e)){const[,m]=e.match(c),h=Cy(m);return h?{page:"giftRedemption",pageData:{token:h}}:null}else{if(u.test(e))return{pageQuery:e};if(e==="signup")return{page:"signup"};if(o.test(e)){const[,m]=e.match(o);return{page:"signup",pageQuery:`${m}/monthly`}}else if(s.test(e)){const[,m]=e.match(s);return{page:"signup",pageQuery:`${m}/yearly`}}else if(a.test(e)){const[,m]=e.match(a);return{page:"signup",pageQuery:m}}else{if(e==="signup/free")return{page:"signup",pageQuery:"free"};if(e==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(e==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(e==="signin")return{page:"signin"};if(e==="account")return{page:"accountHome"};if(e==="account/plans")return{page:"accountPlan"};if(e==="account/profile")return{page:"accountProfile"};if(e==="account/newsletters")return{page:"accountEmail"};if(e==="support")return{page:"support"};if(e==="support/success")return{page:"supportSuccess"};if(e==="support/error")return{page:"supportError"};if(e==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(e==="gift")return{page:"gift"};if(e==="share")return{page:"share"};if(e==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(e==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}}return{page:"default"}}getAccentColor(){const{accent_color:e}=this.state.site||{};return e0(e)}getRetentionPreviewMember({site:e,offers:a}){const o=(a||[]).find(f=>Tc({offer:f})),s=o?.tier?.id,u=s?ni({site:e,productId:s}):null,c=u?o.cadence==="year"?u.yearlyPrice:u.monthlyPrice:null,m=Hi.preview,h=m?.subscriptions?.[0];return!h||!u||!c?m:{...m,subscriptions:[{...h,plan:{...h.plan,amount:c.amount,interval:c.interval,currency:c.currency.toUpperCase()},price:{...h.price,price_id:c.id,amount:c.amount,interval:c.interval,currency:c.currency,product:{...h.price?.product,product_id:u.id}},tier:{id:u.id,name:u.name}}]}}getContextPage({site:e,page:a,member:o}){if(!a||a==="default"){const s=$n({site:e})||!ea({site:e})?"signin":"signup";a=o?"accountHome":s}return pd({page:a})}getContextMember({site:e,page:a,member:o,offers:s,pageData:u,customSiteUrl:c}){return yt(["dev","preview"],{customSiteUrl:c})?fy({page:a})||KT({page:a})?yt(["dev"],{customSiteUrl:c})?o||Hi.free:yt(["preview"])?a==="accountPlan"&&u?.action==="cancel"?this.getRetentionPreviewMember({site:e,offers:s}):Hi.preview:Hi.paid:null:o}getContextFromState(){const{site:e,member:a,offers:o,action:s,actionErrorMessage:u,page:c,lastPage:m,showPopup:h,pageQuery:f,pageData:y,popupNotification:k,notification:x,customSiteUrl:S,dir:I,scrollbarWidth:O,otcRef:D,inboxLinks:U}=this.state,q=this.getContextPage({site:e,page:c,member:a}),ee=this.getContextMember({site:e,page:q,member:a,offers:o,pageData:y,customSiteUrl:S});return{api:this.GhostApi,site:e,offers:o,action:s,actionErrorMessage:u,brandColor:this.getAccentColor(),page:q,pageQuery:f,pageData:y,member:ee,lastPage:m,showPopup:h,popupNotification:k,notification:x,customSiteUrl:S,dir:I,scrollbarWidth:O,otcRef:D,inboxLinks:U,doAction:(te,H)=>this.dispatchAction(te,H)}}getRecommendationButtons(){return document.querySelectorAll("[data-recommendation]")||[]}setupRecommendationButtons(){const e=o=>{const s=o.currentTarget.dataset.recommendation;s?this.dispatchAction("trackRecommendationClicked",{recommendationId:s}).catch(console.error):console.warn("[Portal] Invalid usage of data-recommendation attribute")},a=this.getRecommendationButtons();for(const o of a)o.addEventListener("click",e,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll('a[href*="#/portal"], a[href*="#/share"]').forEach(oP)}render(){return this.state.initStatus==="success"?l.jsx(ZP,{site:this.state.site,children:l.jsxs(ke.Provider,{value:this.getContextFromState(),children:[l.jsx(fd,{}),l.jsx(zc,{}),l.jsx(Uc,{})]})}):null}}const Ey="ghost-portal-root";function KP(){const t=document.createElement("div");t.id=Ey,t.setAttribute("data-testid","portal-root"),document.body.appendChild(t)}function XP(){const t=document.querySelector("script[data-ghost]");if(t){const e=t.dataset.i18n==="true",a=t.dataset.ghost,o=t.dataset.key,s=t.dataset.api,u=t.dataset.locale;return{siteUrl:a,apiKey:o,apiUrl:s,siteI18nEnabled:e,locale:u}}return{}}function QP(){const t=new URL(window.location.href);t.searchParams.get("token")&&(t.searchParams.delete("token"),window.history.replaceState({},document.title,t.href))}function _P(){const{siteUrl:t,apiKey:e,apiUrl:a,siteI18nEnabled:o,locale:s}=XP(),u=t||window.location.origin;KP(),QP(),Dk.render(l.jsx(Je.StrictMode,{children:l.jsx(JP,{siteUrl:u,customSiteUrl:t,apiKey:e,apiUrl:a,siteI18nEnabled:o,locale:s})}),document.getElementById(Ey))}_P()}));
|
|
4582
4582
|
//# sourceMappingURL=portal.min.js.map
|