!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6648273b-146f-45a0-934c-89c47bfc07bd",e._sentryDebugIdIdentifier="sentry-dbid-6648273b-146f-45a0-934c-89c47bfc07bd")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[450],{60450:(e,t,n)=>{n.r(t),n.d(t,{GetLayout:()=>A,__N_SSG:()=>Z,default:()=>P});var r=n(52322),i=n(43997),o=n(51451),l=n(2784),u=n(83621),s=n(43782),d=n(30477),c=n(45847),a=n.n(c),f=n(5632),v=n(90077);function g(){return"undefined"!=typeof document&&"visible"===document.visibilityState}var m=n(93160),b=n(76150),h=n(4332),y=n(80591),p=n(28085),w=n(421),E=n(97809),x=n(27823),j=n(48419);function I(e){let{blog:t,currentNote:n}=e,{isLoading:o,hasPostAccess:u,postGatingRuleGroups:c}=function(){var e,t,n,r;let o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],u=(0,i.v9)(s.WX),c=(0,i.v9)(d.N8),a=(0,f.useRouter)(),v=null===(e=a.query)||void 0===e?void 0:e.blogname,g=null===(t=a.query)||void 0===t?void 0:t.noteId,m=(0,x.T)(),h=(null==u?void 0:u.isPostGateTruncated)||(null==u?void 0:u.isAfterGateTruncated),[y,p]=(0,l.useState)(void 0!=h&&h),{track:j}=(0,b.z$)(),I=(0,w.Z)((null==u?void 0:u.id)||"","POST",null,"[noteId]"),_=function(e,t,n){let r=(0,w.Z)(e,t,null,n),[i,o]=(0,l.useState)();return(0,l.useEffect)(()=>{if(void 0==r){o(void 0);return}o(0==r.length||r.some(e=>e.hasAccess&&e.contentType==t))},[e,r,t,n]),i}((null==u?void 0:u.id)||"","POST","[noteId]"),N=(0,w.Z)((null==u?void 0:u.id)||"","AFTER",null,"[noteId]"),T=null==u?void 0:null===(n=u.staticHtml)||void 0===n?void 0:n.match(E.XV),S=!1;if(T){let e=T[1],t=!N||(null===(r=N.find(t=>t.embedId===e))||void 0===r?void 0:r.hasAccess);S=void 0===t||!!t}return(0,l.useEffect)(()=>{(I&&I.length>0||N&&N.length>0)&&j("user viewed gated post",{postGate:I&&I.length>0,gatingEmbed:N&&N.length>0,hasPostAccess:_,hasAfterAccess:S,postGatingRuleGroups:I,afterGatingRuleGroups:N})},[JSON.stringify(I),JSON.stringify(N),_,S]),(0,l.useEffect)(()=>{if(h&&c&&g){if(u&&(!I||0===I.length)&&(!N||0===N.length)||!_&&!S){p(!1);return}p(!0),m((0,s.jx)(v,g,o)).then(()=>{p(!1)})}},[_,S,JSON.stringify(I),JSON.stringify(N),h]),{hasPostAccess:_,postGatingRuleGroups:I,hasAfterAccess:S,isLoading:y}}(),a=(0,y.Z)(o,1e3),v=(0,x.T)();return((0,l.useEffect)(()=>{v((0,j.CV)(n.id))},[]),a||!n)?(0,r.jsx)("div",{className:"mt-24 flex justify-center",children:(0,r.jsx)(p.ZP,{})}):(0,r.jsx)(h.Z,{loading:a,currentNote:n,blog:t,hasAccess:u||!1,gatingRuleGroups:c||[],hideComments:!!t.disable_comments})}function _(e){let{blog:t,currentNote:n}=e;return n?(0,r.jsx)(h.Z,{loading:!1,currentNote:n,blog:t,hasAccess:!0,gatingRuleGroups:[],hideComments:!0===t.disable_comments}):(0,r.jsx)("div",{className:"mt-24 flex justify-center",children:(0,r.jsx)(p.ZP,{})})}var N=n(5986),T=n(38290),S=n(58021),G=n(90878),O=n(58693),Z=!0;function P(e){var t,n,u;let{description:c,previewImage:h,preview:y=!1}=e,p=(0,f.useRouter)(),w=(0,i.v9)(d.N8),[E,x]=(0,l.useState)(""),j=(0,i.v9)(s.WX),{fullNoteUrl:Z}=(0,v.Z)({blog:w,note:j});!function(e){let{currentNote:t,blog:n,preview:r}=e,{track:i}=(0,b.z$)();(0,l.useEffect)(()=>{i("post viewed"),n&&t&&!r&&(0,m.Vx)(n.id,null==t?void 0:t.id,!0)},[]),function(e){let t=function(){let e=(0,l.useRef)(g()),t=()=>{e.current=g()};return(0,l.useEffect)(()=>(document.addEventListener("visibilitychange",t,!1),()=>{document.removeEventListener("visibilitychange",t)}),[]),e}(),n=function(){let e=(0,l.useRef)(!0),t=(0,l.useRef)(Date.now()),n=()=>{t.current=Date.now(),e.current||(e.current=!0)},r=()=>{t.current=Date.now(),e.current||(e.current=!0)};return(0,l.useEffect)(()=>{document.addEventListener("scroll",n,!0),document.addEventListener("mousemove",r,!0);let i=setInterval(()=>{Date.now()-t.current>3e4&&(e.current=!1)},5e3);return()=>{document.removeEventListener("scroll",n),document.removeEventListener("mousemove",r),clearInterval(i)}},[]),e}(),r=(0,l.useRef)(0);(0,l.useEffect)(()=>{window.onbeforeunload=()=>{e(r.current)},window.onpagehide=()=>{e(r.current)}},[]),(0,l.useEffect)(()=>{let i=setInterval(()=>{t.current&&n.current&&(r.current=r.current+2)},2e3);return()=>{e(r.current),clearInterval(i)}},[])}(e=>{t&&(0,m.Vx)(n.id,null==t?void 0:t.id,!1,e)})}({currentNote:j,blog:w,preview:y});let P=(null==j?void 0:j.isPostGateTruncated)||(null==j?void 0:j.isAfterGateTruncated);(0,l.useEffect)(()=>{var e;x("id-".concat(null==j?void 0:j.id,"-truncated-").concat(P,"-").concat(null===(e=p.query)||void 0===e?void 0:e.noteId))},[null==j?void 0:j.id,null===(t=p.query)||void 0===t?void 0:t.noteId,P]);let A=(0,O.w)(w);h=(null==j?void 0:null===(n=j.cover_img)||void 0===n?void 0:n.img.src)||"";let R=(0,T.UB)({text:(null==j?void 0:j.title)||"",post:j,blog:w,blogOwnerUser:w.user,collectibleType:"POST",alwaysGenerate:!0,size:2048});return R="".concat(A).concat(R),(0,r.jsxs)("div",{className:"flex-grow",children:[(0,r.jsx)(a(),{src:"/js/lite-youtube-embed.js",strategy:"lazyOnload"}),(0,r.jsxs)(o.Z,{blog:w,title:"".concat(w.name," | ").concat(null==j?void 0:j.title),share_title:null==j?void 0:j.title,fullUrl:Z,description:c,share_img:h,canonicalUrl:null==j?void 0:j.canonicalUrl,creator:null==w?void 0:null===(u=w.social)||void 0===u?void 0:u.twitter,children:[(0,r.jsx)("link",{title:"".concat(w.name," posts"),type:"application/rss+xml",href:"/api/blogs/rss/".concat(w.url)}),(0,r.jsx)(function(){if(!j)return null;if(void 0===w.user)throw Error("Blog user is undefined. Cannot instantiate frame response generator without the blog user.");let e=new N.n({logger:S.Z,blog:w,blogOwnerUserId:w.user.id,post:j}).generateFrontEndFrameMetaTags({type:G.u.HOMEPAGE_POST,image:R});return(0,r.jsx)(r.Fragment,{children:e.map(e=>(0,r.jsx)("meta",{property:e.property,content:e.content},e.property))})},{})]}),(null==j?void 0:j.isPostGateTruncated)||(null==j?void 0:j.isAfterGateTruncated)?(0,r.jsx)(I,{blog:w,currentNote:j},E):(0,r.jsx)(_,{blog:w,currentNote:j},E)]})}let A=e=>(0,r.jsxs)(u.Z,{showProgressBar:!0,children:[e," "]});P.getLayout=A}}]);
//# sourceMappingURL=450-da5bc6512724002a.js.map