Loading
function(e,t,n){n.d(t,{Bv:()=>_,ar:()=>h,f9:()=>b,g5:()=>I,k0:()=>x,k5:()=>T,nf:()=>A});var i=n(64700),r=n(989349),l=n.n(r),a=n(17928),s=n(155718),o=n(166403),c=n(89366),u=n(881489),d=n(945960),m=n(432779),f=n(422936),g=n(234419),p=n(788868);function h(){let e=(0,g.V)(),t=(0,c.QQ)(),n=(0,f.O)(),i=(0,f.p)(),r=T();return null!=e||t||null!=n||null!=i||r}let T=()=>{let e=(0,a.bG)([o.A],()=>o.A.getPremiumTypeSubscription()),t=e?.metadata?.active_discount_expires_at;return null!=t&&l()(Date.now())<=l()(t)};function A(){let e=(0,a.bG)([o.A],()=>o.A.getPremiumTypeSubscription()),t=e?.metadata?.active_discount_id;switch(t){case p.q:case p.lj:return{duration:1,percentage:30,discountId:t};case p.EG:case p.TU:case p.KG:return{duration:3,percentage:30,discountId:t};case p.HF:return{duration:1,percentage:40,discountId:t};case p.BR:return{duration:1,percentage:20,discountId:t};case p.CW:return{duration:1,percentage:25,discountId:t};case p.UX:return{duration:12,percentage:20,discountId:t};case p.RG:return{duration:12,percentage:30,discountId:t};case p.V2:return{duration:1,percentage:40,discountId:t};case p.xH:return{duration:3,percentage:30,discountId:t};default:return}}function I(e){let t=(0,m.A)(p.q),n=(0,m.A)(p.EG),[r,l]=i.useState(!1),[a,s]=i.useState(!1),[o,c]=i.useState(null),u=t??n??null;if(null!=u)return{churnUserDiscountOffer:u,isFetchingChurnDiscountOffer:!1};if(e)return{churnUserDiscountOffer:o,isFetchingChurnDiscountOffer:a};function f(){l(!0),s(!1)}return a||r||(s(!0),(0,d.qz)().then(e=>{c(e),f()}).catch(e=>{f()})),{churnUserDiscountOffer:o,isFetchingChurnDiscountOffer:a}}function b(){let e=(0,a.bG)([o.A],()=>o.A.getPremiumTypeSubscription()),t=T(),n=null!==e&&e.hasPremiumNitroMonthly,i=!!e?.hasActiveTrial;return n&&!t&&!i}function _(e){for(let t of e.invoiceItems){let e=t.discounts.find(e=>e.type===s.iS.SUBSCRIPTION_PLAN);if(null!=e)switch(e.discount_id){case p.q:return{duration:1,percentage:e.percentage_amount,discountId:e.discount_id};case p.EG:return{duration:3,percentage:e.percentage_amount,discountId:e.discount_id}}}return null}function x(){return(0,u.ds)()}}