Module 428262

42,882 characters · in no known chunk
Dependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{ki:()=>to,Ke:()=>ej,FY:()=>tf,ff:()=>tc,aZ:()=>tR,Nc:()=>tt,Rr:()=>t_,YE:()=>S.YE,OU:()=>eQ,qn:()=>tC,CC:()=>S.CC,iv:()=>tU,RH:()=>ez,z_:()=>tj,FJ:()=>eY,ee:()=>tI,$k:()=>tr,VA:()=>tV,Dd:()=>eq,kX:()=>te,To:()=>tW,_e:()=>e9,l6:()=>ex,nB:()=>eX,y8:()=>eU,re:()=>tE,pb:()=>eG,Zb:()=>e5,Pr:()=>ek,nK:()=>tP,Tm:()=>eJ,mv:()=>tO,J$:()=>ti,Pg:()=>tT,D8:()=>eH,TW:()=>S.ki,$Q:()=>eF,aE:()=>tA,L_:()=>tF,Uf:()=>ts,sS:()=>ta,ji:()=>e7,Q8:()=>tn,Mn:()=>eK,m6:()=>eW,Em:()=>tM,xq:()=>e3,Ge:()=>td,Of:()=>tg,tW:()=>tm,mH:()=>tw,XN:()=>tY,Ay:()=>tK,EL:()=>eM,bx:()=>e1,Zw:()=>e$,Om:()=>ty,GX:()=>tS,qi:()=>tH,JM:()=>eP,UC:()=>eV,e1:()=>tx,PK:()=>tl,z4:()=>e6,LE:()=>tp,ys:()=>e4,U8:()=>eB,k8:()=>tB,tS:()=>th,EJ:()=>tN}),n(667532),n(321073);var i,r,s,a=n(64700),o=n(284009),l=n.n(o),u=n(989349),c=n.n(u),d=n(17928),_=n(441574),h=n(975807),f=n(366999),p=n(930767),E=n(968671),m=n(626584),g=n(981088),A=n(367888),I=((i={}).ANIMATED_EMOJIS="animatedEmojis",i.EMOJIS_EVERYWHERE="emojisEverywhere",i.STICKERS_EVERYWHERE="stickersEverywhere",i.SOUNDBOARD_EVERYWHERE="soundboardEverywhere",i.ANIMATED_AVATAR="animatedAvatar",i.CUSTOM_DISCRIMINATOR="customDiscriminator",i.PREMIUM_GUILD_MEMBER_PROFILE="premiumGuildMemberProfile",i.PROFILE_PREMIUM_FEATURES="profilePremiumFeatures",i.STREAM_MID_QUALITY="streamMidQuality",i.STREAM_HIGH_QUALITY="streamHighQuality",i.VIDEO_FILTER_ASSETS="videoFilterAssets",i.INCREASED_FILE_UPLOAD_SIZE="increasedFileUploadSize",i.INCREASED_GUILD_LIMIT="increasedGuildLimit",i.INCREASED_MESSAGE_LENGTH="increasedMessageLength",i.NITRO_REACTION_TOGGLE="nitroReactionToggle",i.CLIENT_THEMES="clientThemes",i.PREMIUM_COLLECTIBLES="premiumCollectibles",i.CUSTOM_CALL_SOUNDS="customCallSounds",i.CUSTOM_NOTIFICATION_SOUNDS="customNotificationSounds",i.SAVED_MESSAGES="savedMessages",i.PREMIUM_VOICE_FILTERS="premiumVoiceFilters",i.APP_ICONS="appIcons",i.CHAT_WALLPAPERS="chatWallpapers",i.QUEST_ORB_MULTIPLIER="questOrbMultiplier",i),T=n(683760),S=n(474090),y=n(652215),C=n(788868);function N(e){if(null==e)return y.TbF;let t=T.A.getPremiumTypeOverride();return e.isStaff()&&t===C.$I?y.mu:null!=e.premiumType&&(0,S.ki)(e)?C.f5[e.premiumType].fileSize:y.TbF}class v{name;description;getFeatureValue;constructor(e,t,n){this.name=e,this.description=n,this.getFeatureValue=t,Object.defineProperty(this,"getFeatureValue",{value:t,configurable:!1,writable:!1})}}class R{skuId;skuFeatures;constructor(e,t){this.skuId=e,this.skuFeatures=t}}var O=n(945810),b=((r={})[r.CONTROL=0]="CONTROL",r[r.DUAL_READ_RETURN_OLD=1]="DUAL_READ_RETURN_OLD",r[r.DUAL_READ_RETURN_NEW=2]="DUAL_READ_RETURN_NEW",r);let D=(0,O.mj)({name:"2026-03-denormalized-perks-access-read",kind:"user",defaultConfig:0,variations:{0:0,1:1,2:2}});var L=n(349871);let w=new m.A("ProductCatalog.tsx");class M extends v{constructor(e,t){super(e,e=>(function(e,t){if(null==t||null==t.premiumType)return!1;try{let n=C.u0[t.premiumType];if(null==n)return w.warn(`Cannot find the corresponding SKU to the user's premium type ${t.premiumType}`),!1;let i=el[n];if(null==i)return w.warn(`Cannot find the corresponding product catalog entry to the user's SKU ${n} and premium type ${t.premiumType}`),!1;return i.skuFeatures.includes(e)}catch(e){w.error(`Error while retrieving user's feature access: ${e.message??JSON.stringify(e)}`)}return!1})(this,e),t)}}let P=new M(I.ANIMATED_EMOJIS),x=new M(I.EMOJIS_EVERYWHERE),k=new M(I.STICKERS_EVERYWHERE),U=new M(I.SOUNDBOARD_EVERYWHERE),G=new M(I.CUSTOM_CALL_SOUNDS),F=new M(I.PREMIUM_VOICE_FILTERS),V=new M(I.ANIMATED_AVATAR),B=new M(I.CUSTOM_DISCRIMINATOR),j=new M(I.PREMIUM_GUILD_MEMBER_PROFILE),H=new M("profileBadges"),Y=new M(I.PROFILE_PREMIUM_FEATURES,"custom banner and avatar decoration"),W=new M("collectibles"),K=new M("appIcons"),$=new M(I.CLIENT_THEMES),z=new M("boostDiscount"),q=new M("freeBoosts"),Z=new M(I.STREAM_MID_QUALITY),X=new M(I.STREAM_HIGH_QUALITY),Q=new M(I.CUSTOM_NOTIFICATION_SOUNDS),J=new M("fancyVoiceChannelReactions"),ee=new M("installPremiumApplications"),et=new M("redeemPremiumPerks"),en=new M(I.VIDEO_FILTER_ASSETS);new v(I.INCREASED_FILE_UPLOAD_SIZE,N);let ei=new M(I.INCREASED_GUILD_LIMIT),er=new M(I.INCREASED_MESSAGE_LENGTH),es=new M("increasedVideoUploadQuality"),ea=new M("uploadLargeFiles"),eo=new M(I.QUEST_ORB_MULTIPLIER),el=Object.freeze({[C.pe.TIER_0]:new R(C.pe.TIER_0,[P,x,k,H,en,es,ea,K]),[C.pe.TIER_1]:new R(C.pe.TIER_1,[P,x,V,B,H,z,Z,J,es,ea,K]),[C.pe.TIER_2]:new R(C.pe.TIER_2,[P,x,k,U,G,V,B,j,H,Y,$,z,q,Z,X,J,ee,et,en,ei,er,es,ea,K,W,Q,F,eo])}),eu=[z,q],ec=[eo],ed=[],e_=new Map([[P,_.bb.ANIMATED_EMOJIS],[x,_.bb.EMOJIS_EVERYWHERE],[k,_.bb.STICKERS_EVERYWHERE],[U,_.bb.SOUNDBOARD_EVERYWHERE],[G,_.bb.CUSTOM_CALL_SOUNDS],[F,_.bb.PREMIUM_VOICE_FILTERS],[V,_.bb.ANIMATED_AVATAR],[B,_.bb.CUSTOM_DISCRIMINATOR],[j,_.bb.PREMIUM_GUILD_MEMBER_PROFILE],[Y,_.bb.PROFILE_PREMIUM_FEATURES],[W,_.bb.PREMIUM_COLLECTIBLES],[$,_.bb.CLIENT_THEMES],[Z,_.bb.STREAM_MID_QUALITY],[X,_.bb.STREAM_HIGH_QUALITY],[en,_.bb.VIDEO_FILTER_ASSETS],[ei,_.bb.INCREASED_GUILD_LIMIT],[er,_.bb.INCREASED_MESSAGE_LENGTH],[ea,_.bb.INCREASED_FILE_UPLOAD_SIZE],[H,_.bb.PROFILE_BADGES],[K,_.bb.APP_ICONS],[z,_.bb.BOOST_DISCOUNT],[q,_.bb.FREE_BOOSTS],[ee,_.bb.INSTALL_PREMIUM_APPLICATIONS],[es,_.bb.INCREASED_VIDEO_UPLOAD_QUALITY]]);function eh(e,t,n){if(null!=t&&t.isPremiumWithFractionalPremiumOnly()&&eu.includes(e)||null!=t&&t.isFractionalPremiumWithNoStandardSub()&&ec.includes(e)||n&&ed.includes(e))return!1;let i=e_.get(e);if(null!=i&&t?.perks!=null){let n=D.getConfig({location:"product_catalog_can_user_use"});if(n!==b.CONTROL){let r=e.getFeatureValue(t),s=(0,L.Nh)(t?.perks,i);return n===b.DUAL_READ_RETURN_NEW?s:r}}return e.getFeatureValue(t)}var ef=n(832946),ep=n(287809),eE=n(615405),em=n(295405),eg=n(97352),eA=n(166403),eI=n(739508),eT=n(58703),eS=n(927813),ey=n(255438),eC=n(580630),eN=n(88001),ev=n(818348),eR=n(375708),eO=n(466919);let eb={PAYMENT_SOURCE_MANAGEMENT:"https://support.apple.com/HT201266",BILLING_HISTORY:"https://support.apple.com/HT201266",SUBSCRIPTION_MANAGEMENT:"https://support.apple.com/HT202039"},eD={SUBSCRIPTION_MANAGEMENT:"https://play.google.com/store/account/subscriptions",PAYMENT_SOURCE_MANAGEMENT:"https://play.google.com/store/paymentmethods",BILLING_HISTORY:"https://play.google.com/store/account/orderhistory"},eL=new m.A("PremiumUtils.tsx");var ew=((s={}).MID="mid",s.HIGH="high",s);function eM(e){return e.items.find(e=>C.JM.has(e.planId))}function eP(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,r=!(arguments.length>4)||void 0===arguments[4]||arguments[4],s=em.A.defaultPaymentSourceId??void 0,a=eA.A.getPremiumTypeSubscription();return null!=a&&null!=a.paymentSourceId&&(s=a.paymentSourceId),eU(e,t,n,{paymentSourceId:s,currency:i},r)}function ex(e,t){return null==t?e:{...e,contextPlanPrices:Object.fromEntries(t.map(e=>[e.id,e.price]))}}function ek(e,t,n){let i=a.useMemo(()=>null==t||null==t.checkoutContext||null==t.checkoutContext.available_plans?null:t.checkoutContext.available_plans,[t]);return a.useMemo(()=>({priceOptions:ex(e,i),planPricesLoading:null!=e.currency&&null!=t&&t.currency!==e.currency&&null==n}),[e,t,i,n])}function eU(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=!(arguments.length>4)||void 0===arguments[4]||arguments[4],{paymentSourceId:s,currency:a,contextPlanPrices:o}=i;if(null!=o){let t=o[e],n=null!=a&&null!=t&&t.currency!==a;if(null!=t&&!n)return{amount:t.amount,currency:t.currency,exponent:t.exponent,tax:0,taxInclusive:!1}}if(null!=eg.A.get(e)){let i=y.lid.DEFAULT;n?i=y.lid.GIFT:t&&(i=y.lid.PREMIUM_TIER_1);let o=function(e){let{paymentSourceId:t,purchaseType:n,currency:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{purchaseType:y.lid.DEFAULT},r=eG(e,{paymentSourceId:t,purchaseType:n});if(0===r.length&&eL.warn(`No prices found for planId: ${e}, paymentSourceId: ${t}, purchaseType: ${n}`),null!=i){let s=r.find(e=>e.currency===i.toLowerCase());return null!=s?s:null!=t?eG(e,{purchaseType:n}).find(e=>e.currency===i.toLowerCase()):void 0}return r[0]}(e,{paymentSourceId:s,purchaseType:i,currency:a});if(null==o){let t=Error("Couldn't find price");throw r&&(0,eI.pM)(t,{extra:{paymentSourceId:s},tags:{purchaseType:i.toString(),planId:e,currency:a??"unknown"}}),t}return o}let l=Error("Plan not found");throw r&&(0,eI.pM)(l,{tags:{planId:e,currency:a??"unknown"},extra:{...i,isGift:n}}),l}function eG(e){let{paymentSourceId:t,purchaseType:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{purchaseType:y.lid.DEFAULT},i=function(e,t){let n=eg.A.get(e);if(null==n){let n=Error("Plan not found");throw(0,eI.pM)(n,{tags:{planId:e,purchaseType:t.toString()}}),n}if(null==n.prices)throw Error(`No prices returned for ${e}, is your user in the experiment?`);let i=n.prices[t];if(null==i)throw eL.info(`Purchase types: ${JSON.stringify(Object.keys(n.prices))}`),Error(`No prices returned for purchase type ${t} for plan ${e}`);return i}(e,n);if(null!=t){let r=i.paymentSourcePrices[t];if(null==r){eL.info(`Payment sources IDs: ${JSON.stringify(Object.keys(i.paymentSourcePrices))}`),eL.info(`prices: ${r}`);let s=Error("Missing prices for payment source on subscription plan");(0,eI.pM)(s,{extra:{paymentSourceId:t},tags:{purchaseType:n.toString(),planId:e}})}else if(0!==r.length)return r}if(null==i.countryPrices.prices){eL.info(`countryPrices: ${JSON.stringify(i.countryPrices)}`);let t=Error("Missing prices for country");throw(0,eI.pM)(t,{tags:{countryCode:i.countryPrices.countryCode,planId:e}}),t}return i.countryPrices.prices}function eF(e){return{amount:e.amount,currency:e.currency,exponent:e.exponent}}function eV(e,t,n){let i,r,s={currency:t,amount:0,tax:0,taxInclusive:!1},a=(0,A._1)(e);null!=a&&(i=C.hd[a.planId].premiumType);let o=(0,S.CC)(i,C.PremiumTypes.TIER_0),l=(0,S.CC)(i,C.PremiumTypes.TIER_2);for(let i of e){let e;r=C.pW.has(i.planId)?l:!C.JM.has(i.planId)&&o,e=void 0===n?eP(i.planId,r,!1,t):eU(i.planId,r,!1,{paymentSourceId:n,currency:t}),s.amount+=e.amount*i.quantity}return eF(s)}function eB(e,t,n,i){return null===t&&(l()(null!==e,"Subscription can't be null"),t=[]),eV(null!==e?tA(e,t):tI(t),n,i)}function ej(e){switch(e){case C.Ff.MONTH:return eR.intl.string(eR.t.FPybU7);case C.Ff.YEAR:return eR.intl.string(eR.t.tfqrhj);case C.Ff.DAY:case C.Ff.WEEK:default:throw Error("Unexpected interval")}}function eH(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:C.PremiumTypes.TIER_2;if(t||n)switch(e){case C.WT.MONTH:let a=eR.intl.formatToPlainString(s===C.PremiumTypes.TIER_0?eR.t.NPKsLz:eR.t.poEovT,{timeInterval:eR.intl.string(eR.t.FPybU7)});return r?a:eR.intl.string(eR.t.Mh9bTt);case C.WT.YEAR:let o=eR.intl.formatToPlainString(s===C.PremiumTypes.TIER_0?eR.t.NPKsLz:eR.t.poEovT,{timeInterval:eR.intl.string(eR.t.tfqrhj)});return r?o:eR.intl.string(eR.t.DRgqMo);default:throw Error("Unexpected interval")}switch(e){case C.WT.MONTH:if(1!==i)return eR.intl.formatToPlainString(eR.t["0UlZnH"],{intervalCount:i});return eR.intl.string(eR.t.DKzs96);case C.WT.YEAR:return eR.intl.string(eR.t["/Q4HRN"]);default:throw Error("Unexpected interval")}}function eY(e){switch(e){case C.WT.MONTH:return eR.intl.string(eR.t.FPybU7);case C.WT.YEAR:return eR.intl.string(eR.t.tfqrhj);default:throw Error("Unexpected interval")}}function eW(e){let t=C.hd[e];if(null!=t)return t.premiumType;let n=Error("Unsupported plan");throw(0,eI.pM)(n,{tags:{planId:e}}),n}function eK(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;switch(e){case C.gD.PREMIUM_MONTH_TIER_0:return t?eR.intl.format(eR.t.TZXHNj,{duration:i}):n?eR.intl.string(eR.t["81iAgs"]):eR.intl.string(eR.t["0efVPy"]);case C.gD.PREMIUM_YEAR_TIER_0:return t?eR.intl.format(eR.t.eqRhC7,{duration:i}):n?eR.intl.string(eR.t.UvzqY1):eR.intl.string(eR.t.eoVuBn);case C.gD.PREMIUM_MONTH_TIER_1:return n?eR.intl.string(eR.t["g/dH5g"]):eR.intl.string(eR.t["7O6qSq"]);case C.gD.PREMIUM_YEAR_TIER_1:return n?eR.intl.string(eR.t.pdZJaq):eR.intl.string(eR.t.Md5xbi);case C.gD.PREMIUM_MONTH_TIER_2:return t?eR.intl.format(eR.t.aI6QXz,{duration:i}):n?eR.intl.string(eR.t.SmVbHc):eR.intl.string(eR.t.FKYNC6);case C.gD.PREMIUM_GROUP_MONTH:return n?eR.intl.string(eR.t.SmVbHc):eR.intl.formatToPlainString(eO.default["8bPDtb"],{premiumGroupProductName:(0,eN.DP)()});case C.gD.PREMIUM_YEAR_TIER_2:return t?eR.intl.format(eR.t["1wBcPi"],{duration:i}):n?eR.intl.string(eR.t.JIq4O1):eR.intl.string(eR.t["cfu/5d"]);case C.gD.PREMIUM_3_MONTH_TIER_2:return eR.intl.string(eR.t.wCbINr);case C.gD.PREMIUM_6_MONTH_TIER_2:return eR.intl.string(eR.t["e3/ArU"]);case C.gD.PREMIUM_MONTH_GUILD:return n?eR.intl.string(eR.t["6ZR3By"]):eR.intl.string(eR.t["h80cx/"]);case C.gD.PREMIUM_YEAR_GUILD:return n?eR.intl.string(eR.t.YDpAzZ):eR.intl.string(eR.t.ZHkls0);case C.gD.PREMIUM_3_MONTH_GUILD:return eR.intl.string(eR.t.EZHHB6);case C.gD.PREMIUM_6_MONTH_GUILD:return eR.intl.string(eR.t.X2KDO2);case C.gD.PREMIUM_MONTH_LEGACY:return eR.intl.string(eR.t.PD6k79);case C.gD.PREMIUM_YEAR_LEGACY:return eR.intl.string(eR.t.LtJgTC)}let r=Error("Unsupported plan");throw(0,eI.pM)(r,{tags:{planId:e}}),r}function e$(e){switch(e){case C.pe.TIER_0:return eR.intl.string(eR.t["t9uG/o"]);case C.pe.TIER_1:return eR.intl.string(eR.t.FSOz78);case C.pe.TIER_2:return eR.intl.string(eR.t.lG6a5x)}let t=Error("Unsupported sku");throw(0,eI.pM)(t,{tags:{skuId:e}}),t}function ez(e){let t=C.hd[e]?.premiumType,n=null!=t?C.Mr[t]:null;if(null!=n)return eR.intl.string(n);let i=Error("Unsupported plan");throw(0,eI.pM)(i,{tags:{planId:e}}),i}function eq(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(e){case C.PremiumTypes.TIER_0:return t?"Basic":eR.intl.string(eR.t["t9uG/o"]);case C.PremiumTypes.TIER_1:return t?"Classic":eR.intl.string(eR.t.FSOz78);case C.PremiumTypes.TIER_2:return eR.intl.string(eR.t.lG6a5x)}}function eZ(e){let{subscription:t,planId:n,price:i,includePremiumGuilds:r,hasDiscountApplied:s,activeDiscountInfo:a,renewalInvoiceWithoutEntitlementsPreview:o,renewalInvoiceWithEntitlementsPreview:l,hasFractionalPremiumWithSub:u,fractionalPremiumInfo:d}=e,_=C.hd[n],f=tL(eP(_.id),_.interval),p=null!=l&&0===l.subtotal,E=to(t)||null==t.paymentSourceId&&!t.isPurchasedExternally&&!ep.default.getCurrentUser()?.hasFreePremium()&&!p,m=null!=i&&null==t.paymentGateway,g=t.status===y.Dmq.UNPAID&&null!==t.latestInvoice&&t.latestInvoice?.status===y.lT7.OPEN,A=E?y.Dmq.CANCELED:g?y.Dmq.UNPAID:t.status,I=o?.taxInclusive??t.latestInvoice?.taxInclusive??!0,T=C.M4+(r?e1(t.additionalPlans):0),S=m?I?eR.intl.format(eR.t["cd+hqB"],{price:i}):eR.intl.format(eR.t.NUkcpF,{price:i}):eR.intl.string(eR.t.zYx3Y6),N=m?I?eR.intl.format(eR.t.VsKcFB,{price:i}):eR.intl.format(eR.t.hJ5xEX,{price:i}):eR.intl.string(eR.t["8rSipI"]),v=m?I?eR.intl.format(eR.t["jRy6/J"],{price:i,num:T}):eR.intl.format(eR.t.tTNE8M,{price:i,num:T}):eR.intl.format(eR.t["U+z/HJ"],{num:T});switch(n){case C.gD.PREMIUM_MONTH_TIER_0:case C.gD.PREMIUM_YEAR_TIER_0:switch(A){case y.Dmq.CANCELED:return m?I?eR.intl.format(eR.t["USi/nc"],{price:i}):eR.intl.format(eR.t["FS//l2"],{price:i}):eR.intl.string(eR.t.JshLzq);case y.Dmq.ACCOUNT_HOLD:return m?I?eR.intl.format(eR.t["5mv+2i"],{price:i}):eR.intl.format(eR.t.nkAEfZ,{price:i}):eR.intl.format(eR.t.SsLIXS,{});case y.Dmq.UNPAID:return eR.intl.format(eR.t.cmkbFB,{});case y.Dmq.PAUSE_PENDING:let R=null!=t.pauseEndsAt?c()(t.pauseEndsAt).diff(t.currentPeriodEnd,"days"):null;return null!=R?eR.intl.format(eR.t.WUfOD5,{pauseDate:t.currentPeriodEnd,pauseDuration:R}):eR.intl.format(eR.t.VlWufv,{pauseDate:t.currentPeriodEnd});case y.Dmq.PAUSED:if(u)return S;return eR.intl.format(eR.t["6RTdZA"],{resumeDate:t.pauseEndsAt});case y.Dmq.PAST_DUE:return eR.intl.format(eR.t["d+0vwo"],{endDate:(0,eT.i$)(e7(t).expiresDate,"LL"),onClick:()=>{(0,h.A)("https://support.discord.com/hc/articles/23082866222871")}});default:return S}case C.gD.PREMIUM_MONTH_TIER_1:case C.gD.PREMIUM_YEAR_TIER_1:switch(A){case y.Dmq.CANCELED:return m?I?eR.intl.format(eR.t.cXy8Bp,{price:i}):eR.intl.format(eR.t["C/XsHt"],{price:i}):eR.intl.string(eR.t.K6tYFa);case y.Dmq.ACCOUNT_HOLD:return m?I?eR.intl.format(eR.t.HBkIBi,{price:i}):eR.intl.format(eR.t.ZsO1Sx,{price:i}):eR.intl.format(eR.t["0+/WH7"],{});case y.Dmq.UNPAID:return eR.intl.format(eR.t.McIzwj,{});case y.Dmq.PAUSE_PENDING:let O=null!=t.pauseEndsAt?c()(t.pauseEndsAt).diff(t.currentPeriodEnd,"days"):null;return null!=O?eR.intl.format(eR.t.WUfOD5,{pauseDate:t.currentPeriodEnd,pauseDuration:O}):eR.intl.format(eR.t.VlWufv,{pauseDate:t.currentPeriodEnd});case y.Dmq.PAUSED:if(u)return N;return eR.intl.format(eR.t["6RTdZA"],{resumeDate:t.pauseEndsAt});case y.Dmq.PAST_DUE:return eR.intl.format(eR.t["d+0vwo"],{endDate:(0,eT.i$)(e7(t).expiresDate,"LL"),onClick:()=>{(0,h.A)("https://support.discord.com/hc/articles/23082866222871")}});default:return N}case C.gD.PREMIUM_MONTH_TIER_2:case C.gD.PREMIUM_YEAR_TIER_2:case C.gD.PREMIUM_3_MONTH_TIER_2:case C.gD.PREMIUM_6_MONTH_TIER_2:case C.gD.PREMIUM_GROUP_MONTH:switch(A){case y.Dmq.CANCELED:return m?I?eR.intl.format(eR.t.xoFgRh,{price:i,num:T}):eR.intl.format(eR.t.nXdbKo,{price:i,num:T}):eR.intl.format(eR.t.EcSdRH,{num:T});case y.Dmq.ACCOUNT_HOLD:return m?I?eR.intl.format(eR.t["5C/0QG"],{price:i,num:T}):eR.intl.format(eR.t.xfYkhu,{price:i,num:T}):eR.intl.format(eR.t.ivjxcn,{num:T});case y.Dmq.UNPAID:return eR.intl.format(eR.t["0HopYf"],{num:T});case y.Dmq.PAUSE_PENDING:let b=null!=t.pauseEndsAt?c()(t.pauseEndsAt).diff(t.currentPeriodEnd,"days"):null;return null!=b?eR.intl.format(eR.t.WUfOD5,{pauseDate:t.currentPeriodEnd,pauseDuration:b}):eR.intl.format(eR.t.VlWufv,{pauseDate:t.currentPeriodEnd});case y.Dmq.PAUSED:if(u)return v;return eR.intl.format(eR.t["6RTdZA"],{resumeDate:t.pauseEndsAt});case y.Dmq.BILLING_RETRY:return eR.intl.format(eR.t["IlJ/HV"],{endDate:c()(t.currentPeriodStart).add(C.bx,"days").toDate()});case y.Dmq.PAST_DUE:return eR.intl.format(eR.t["d+0vwo"],{endDate:(0,eT.i$)(e7(t).expiresDate,"LL"),onClick:()=>{(0,h.A)("https://support.discord.com/hc/articles/23082866222871")}});default:return s?n===C.gD.PREMIUM_YEAR_TIER_2?eR.intl.format(eR.t.z2oQtA,{percent:a?.percentage??C.Cq,regularPrice:f,renewalDate:e8(t,d)}):I?eR.intl.formatToPlainString(eR.t["3ZiutU"],{percent:a?.percentage??C._$,regularPrice:f,numMonths:a?.duration??C.OJ}):eR.intl.formatToPlainString(eR.t["G6+XOT"],{percent:a?.percentage??C._$,regularPrice:f,numMonths:a?.duration??C.OJ}):v}default:throw Error(`Invalid planId ${n}`)}}function eX(e){var t,n,i;let r,s,{renewalInvoicePreview:a,renewalInvoiceWithEntitlementsPreview:o,subscription:u,planId:c,includePremiumGuilds:d=!1,hasDiscountApplied:_=!1,activeDiscountInfo:h,hasFractionalPremiumWithSub:f=!1,fractionalPremiumInfo:p}=e,E=eg.A.get(c);return l()(null!=E,"Missing plan"),eZ({subscription:u,planId:E.id,price:(t=a,n=u,i=E,s=null==(r=t.findInvoiceItemByPlanId(i.id))?eU(i.id,!1,!1,{paymentSourceId:n.paymentSourceId,currency:n.currency}).amount:r.amount,(0,eC.CE)((0,eC.$g)(s,t.currency),i.interval,i.intervalCount)),includePremiumGuilds:d,hasDiscountApplied:_,activeDiscountInfo:h,renewalInvoiceWithoutEntitlementsPreview:a,renewalInvoiceWithEntitlementsPreview:o,hasFractionalPremiumWithSub:f,fractionalPremiumInfo:p})}function eQ(e){let{planId:t,additionalPlans:n}=e,i=(0,ef.m1)(t)?null:eK(t),r=n?.find(e=>{let{planId:t}=e;return C.pW.has(t)}),s=r?.planId===C.gD.PREMIUM_MONTH_GUILD||r?.planId===C.gD.PREMIUM_YEAR_GUILD?eR.t.Pi5yMJ:null,a=null!=s?eR.intl.formatToPlainString(s,{num:r?.quantity}):void 0;if(null!=i&&null!=a)return eR.intl.formatToPlainString(eR.t.FN5T9r,{premiumDescription:i,premiumGuildDescription:a});if(null!=i)return i;if(null!=a)return a;throw Error("Subscription without premium or premium guild subscription")}function eJ(e){let{skuId:t,isPremium:n,defaultPlanId:i}=e;if(null==t||!n)return[];let r=void 0!==i&&t===C.hd[i].skuId?i:void 0,s=[];switch(t){case C.pe.TIER_0:s=[C.gD.PREMIUM_YEAR_TIER_0,C.gD.PREMIUM_MONTH_TIER_0];break;case C.pe.TIER_1:s=[C.gD.PREMIUM_MONTH_TIER_1];break;case C.pe.TIER_2:s=[C.gD.PREMIUM_YEAR_TIER_2,C.gD.PREMIUM_MONTH_TIER_2];break;default:throw Error(`Unexpected SKU: ${t}`)}if(void 0!==r){let e=s.indexOf(r);s.splice(e,1),s.unshift(r)}return s}function e0(e){let t=C.hd[e];if(null==t){let t=Error("Unsupported plan");throw(0,eI.pM)(t,{tags:{planId:e}}),t}return t.skuId}function e1(e){let t=eg.A.getPlanIdsForSkus([tw(C.pe.GUILD)]);l()(null!=t,"Missing guildSubscriptionPlanIds");let n=e.find(e=>{let{planId:n}=e;return t.includes(n)});return null!=n?n.quantity:0}let e2=new Set([C.gD.NONE_MONTH,C.gD.NONE_3_MONTH,C.gD.NONE_6_MONTH,C.gD.NONE_YEAR,C.gD.PREMIUM_MONTH_TIER_0,C.gD.PREMIUM_MONTH_TIER_1,C.gD.PREMIUM_MONTH_TIER_2,C.gD.PREMIUM_YEAR_TIER_0,C.gD.PREMIUM_YEAR_TIER_1,C.gD.PREMIUM_YEAR_TIER_2,C.gD.PREMIUM_3_MONTH_TIER_2,C.gD.PREMIUM_6_MONTH_TIER_2,C.gD.PREMIUM_GROUP_MONTH]);function e3(e){return e2.has(e)}function e6(e){return C.pW.has(e)}function e4(e){return e3(e)||e6(e)}function e5(e){return null!=e&&e===C.gD.PREMIUM_GROUP_MONTH}function e7(e){if(e.isPurchasedViaApple&&e.metadata?.apple_grace_period_expires_date!=null){let t=c()(e.metadata.apple_grace_period_expires_date);return{days:c().duration(t.diff(e.currentPeriodStart)).days(),expiresDate:t}}if(e.isPurchasedViaGoogle&&e.metadata?.google_grace_period_expires_date!=null&&e.metadata?.google_original_expires_date!=null){let t=c()(e.metadata.google_grace_period_expires_date),n=c()(e.metadata.google_original_expires_date);return{days:c().duration(t.diff(n)).days(),expiresDate:t}}if(e.isPurchasedExternally){let t=e.isPurchasedViaApple?C.U1:C.L9;return{days:t,expiresDate:c()(e.currentPeriodStart).add(t,"days")}}if(e.metadata?.grace_period_expires_date!=null)return{days:c()(e.metadata?.grace_period_expires_date).diff(e.currentPeriodStart,"days"),expiresDate:c()(e.metadata.grace_period_expires_date)};{let t=null==e.paymentSourceId?C.a5:C.EV;return{days:t,expiresDate:c()(e.currentPeriodStart).add(t,"days")}}}function e8(e,t){let n=new Date(e.currentPeriodEnd);return null==t||e.isBoostOnly||e.hasAnyPremiumGroup||(n=e9(n,t.unactivatedUnits)),n}function e9(e,t,n,i){let r=c()(i?void 0:e);if(t.length>0){let e=tk(t);r=r.add(e,"hours")}if(!i&&void 0!==n){let e=c()(),t=n.diff(e,"hours",!0);t>0&&(r=r.add(t,"hours"))}return r.toDate()}function te(e){let t=tk(e.unactivatedUnits);if(!(t>0&&e.fractionalState===C.xc.NONE))return"";let n={days:eR.t.fYmirx,hours:eR.t["C3RO+g"],minutes:eR.t.r77oHc},i=(0,f.Vb)((0,eT.Tf)(0,t*eS.A.Millis.HOUR));return(0,eT.uN)(i,n)}function tt(e){return null!=e.renewalMutations||null!=e.trialEndsAt||e.status===y.Dmq.PAST_DUE}function tn(e){let t=null;return null!=e.renewalMutations&&(t=e.renewalMutations.planId!==e.planId?eR.intl.string(eR.t["0rzJ4J"]):eR.intl.string(eR.t["9dLQ0/"])),null!=e.trialEndsAt&&(t=eR.intl.string(eR.t.a9Mdb3)),t}function ti(e){if(null==e)return!1;let t=em.A.getPaymentSource(e);return null!=t&&ev.AD.has(t.type)}function tr(e){return e.isPurchasedExternally?e.status===y.Dmq.CANCELED:function(e){let{renewalMutations:t,additionalPlans:n,status:i}=e,r=e1(n);return 0===(null!=t?e1(t.additionalPlans):null)&&0!==r?y.Dmq.CANCELED:i}(e)===y.Dmq.CANCELED}function ts(e){let{subscription:t,user:n,price:i,renewalInvoicePreview:r,fractionalPremiumInfo:s}=e,{planId:a,additionalPlans:o,renewalMutations:u}=t,c=eg.A.get(a);l()(null!=c,"Missing plan");let d=e1(o),_=u?.additionalPlans!=null?e1(u.additionalPlans):d,f=Math.max(0,d-_),p=_>0&&f>0,E=tu(t.planId,t.paymentSourceId,t.currency,n),m=p?_:d,g=E.amount*m;if(null!=r){let e=r.invoiceItems.find(e=>C.pW.has(e.subscriptionPlanId));null!=e&&(g=e.amount)}i=i??(0,eC.$g)(g,t.currency);let A=r?.taxInclusive??t.latestInvoice?.taxInclusive??!0;if(tr(t))return t.isPurchasedViaGoogle?eR.intl.format(eR.t["3/WTrI"],{quantity:d}):A?eR.intl.format(eR.t["0ozBSB"],{quantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)}):eR.intl.format(eR.t["yjsv/s"],{quantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)});switch(t.status){case y.Dmq.ACCOUNT_HOLD:return t.isPurchasedViaGoogle?eR.intl.format(eR.t.Nlf3nc,{quantity:d,boostQuantity:d}):A?eR.intl.format(eR.t.oiRy7v,{quantity:d,boostQuantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)}):eR.intl.format(eR.t["0QxOAi"],{quantity:d,boostQuantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)});case y.Dmq.PAUSE_PENDING:case y.Dmq.PAUSED:if(null!=s&&!s.isFractionalPremiumActive)return eR.intl.string(eR.t.CduWAm);return eR.intl.format(eR.t["5iud9s"],{quantity:d});case y.Dmq.PAST_DUE:if(t.isBoostOnly)return eR.intl.format(eR.t["d+0vwo"],{endDate:(0,eT.i$)(e7(t).expiresDate,"LL"),onClick:()=>{(0,h.A)("https://support.discord.com/hc/articles/23082866222871")}});default:if(p){if(t.isPurchasedViaGoogle)return eR.intl.format(eR.t["krRy+d"],{activeQuantity:_,pendingQuantity:f});let e=A?eR.t["4nc7+E"]:eR.t.BmaudS;return eR.intl.format(e,{activeQuantity:_,pendingQuantity:f,rate:(0,eC.CE)(i,c.interval,c.intervalCount)})}return t.isPurchasedViaGoogle?eR.intl.format(eR.t["5iud9s"],{quantity:d}):A?eR.intl.format(eR.t.eDwrLA,{quantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)}):eR.intl.format(eR.t.ijSDcI,{quantity:d,rate:(0,eC.CE)(i,c.interval,c.intervalCount)})}}function ta(e,t,n){let i,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(null!=t)try{i=eU(e.id,!1,r,t)}catch{i=eP(e.id,!1,r)}else i=eP(e.id,!1,r);let s=(0,eC.$g)(i.amount,i.currency);return e.currency!==ev.Yr.USD&&!0===n&&(s=s.concat("*")),s}function to(e){let{status:t,renewalMutations:n}=e;return t===y.Dmq.CANCELED||null!=n&&(0,ef.m1)(n.planId)&&!e.isPurchasedExternally}function tl(e){return e===y.Dmq.PAST_DUE||e===y.Dmq.ACCOUNT_HOLD||e===y.Dmq.BILLING_RETRY}function tu(e,t,n,i){let r=null!=t?{paymentSourceId:t,currency:n}:{country:eE.A.ipCountryCodeWithFallback,currency:n},s=eg.A.get(e);if(null==s){let t=Error("Unsupported plan");throw(0,eI.pM)(t,{tags:{planId:e}}),t}let a=eg.A.getForSkuAndInterval(tw(C.pe.GUILD),s.interval,s.intervalCount);if(null==a){let t=Error("Unsupported plan");throw(0,eI.pM)(t,{tags:{planId:e}}),t}return eU(a.id,(0,S.ki)(i),!1,r)}function tc(e,t,n){let i=t.id;if(null!=e)switch(i){case C.gD.PREMIUM_MONTH_TIER_0:return eR.intl.string(eR.t["0ggVqN"]);case C.gD.PREMIUM_YEAR_TIER_0:return eR.intl.string(eR.t["jm+ZQw"]);case C.gD.PREMIUM_MONTH_TIER_1:return eR.intl.string(eR.t.uph4Jx);case C.gD.PREMIUM_YEAR_TIER_1:return eR.intl.string(eR.t["D/l7Yt"]);case C.gD.PREMIUM_MONTH_TIER_2:case C.gD.PREMIUM_GROUP_MONTH:return eR.intl.string(eR.t["5l1MuV"]);case C.gD.PREMIUM_YEAR_TIER_2:return eR.intl.string(eR.t.G0mISV)}switch(i){case C.gD.PREMIUM_MONTH_TIER_0:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t["/G3aKw"]);case C.gD.PREMIUM_YEAR_TIER_0:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t["2eQpsL"]);case C.gD.PREMIUM_MONTH_TIER_1:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t.gueLg5);case C.gD.PREMIUM_YEAR_TIER_1:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t["MhH/vW"]);case C.gD.PREMIUM_MONTH_TIER_2:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t.LQVQIq);case C.gD.PREMIUM_GROUP_MONTH:return eR.intl.formatToPlainString(eO.default.LwdrNi,{premiumGroupProductName:(0,eN.DP)()});case C.gD.PREMIUM_YEAR_TIER_2:return n?eR.intl.string(eR.t.cRCCJ3):eR.intl.string(eR.t["0nfg1x"]);case C.gD.PREMIUM_3_MONTH_TIER_2:case C.gD.PREMIUM_6_MONTH_TIER_2:return eR.intl.formatToPlainString(eR.t.BCD4fT,{intervalCount:t.intervalCount});case C.gD.NONE_MONTH:case C.gD.NONE_YEAR:case C.gD.NONE_3_MONTH:case C.gD.NONE_6_MONTH:case C.gD.PREMIUM_MONTH_GUILD:case C.gD.PREMIUM_YEAR_GUILD:case C.gD.PREMIUM_3_MONTH_GUILD:case C.gD.PREMIUM_6_MONTH_GUILD:return eR.intl.string(eR.t.eUEeCt)}let r=Error("User is purchasing an unsupported plan");throw(0,eI.pM)(r,{tags:{planId:i}}),r}function td(e){let t=e.invoiceItems[0].subscriptionPlanId,n=eg.A.get(t);return l()(null!=n,"Missing subscriptionPlan"),{intervalType:n.interval,intervalCount:n.intervalCount}}function t_(){let e=ev.Yr.USD;try{e=eP(C.gD.PREMIUM_MONTH_TIER_2,!1,!1,void 0,!1).currency}catch{}return e}function th(e){let{intervalType:t=C.WT.MONTH,intervalCount:n=1,capitalize:i=!1}=e;switch(t){case C.WT.DAY:if(n>=7&&n%7==0)return i?eR.intl.formatToPlainString(eR.t.fRNBRX,{weeks:n/7}):eR.intl.formatToPlainString(eR.t.EIpHEj,{weeks:n/7});return i?eR.intl.formatToPlainString(eR.t["6Cdzoy"],{days:n}):eR.intl.formatToPlainString(eR.t["kbBj/h"],{days:n});case C.WT.MONTH:return i?eR.intl.formatToPlainString(eR.t.x5MgxS,{months:n}):eR.intl.formatToPlainString(eR.t["4SEnCZ"],{months:n});case C.WT.YEAR:return i?eR.intl.formatToPlainString(eR.t["h+63yl"],{years:n}):eR.intl.formatToPlainString(eR.t["9DFiHk"],{years:n});default:throw Error("Unsupported interval duration.")}}function tf(e){let{intervalType:t=C.WT.MONTH,intervalCount:n=1}=e,i=t_(),r=(0,eC.$g)(0,i,{maximumFractionDigits:0,minimumFractionDigits:0});switch(t){case C.WT.DAY:if(n>=7&&n%7==0)return eR.intl.formatToPlainString(eR.t.C6i5Jt,{weeks:n/7,price:r});return eR.intl.formatToPlainString(eR.t.cR9ifw,{days:n,price:r});case C.WT.MONTH:return eR.intl.formatToPlainString(eR.t["8FZfNo"],{months:n,price:r});case C.WT.YEAR:return eR.intl.formatToPlainString(eR.t.xzAcST,{years:n,price:r});default:throw Error("Unsupported interval duration.")}}function tp(e,t){if(null!=e&&null!=e.subscription_trial&&e.subscription_trial.sku_id===t){let t=e.subscription_trial;return tf({intervalType:t.interval,intervalCount:t.interval_count})}return null}function tE(e){let{intervalType:t=C.WT.MONTH,intervalCount:n=1,capitalize:i=!1}=e;switch(t){case C.WT.DAY:if(n>=7&&n%7==0)return i?eR.intl.formatToPlainString(eR.t.iVZYyl,{weeks:n/7}):eR.intl.formatToPlainString(eR.t.EmoBD2,{weeks:n/7});return i?eR.intl.formatToPlainString(eR.t.jzH70Z,{days:n}):eR.intl.formatToPlainString(eR.t["k2UNz+"],{days:n});case C.WT.MONTH:return i?eR.intl.formatToPlainString(eR.t.erUSmA,{months:n}):eR.intl.formatToPlainString(eR.t.kridzK,{months:n});case C.WT.YEAR:return i?eR.intl.formatToPlainString(eR.t.IfYQVC,{years:n}):eR.intl.formatToPlainString(eR.t.PClsrw,{years:n});default:throw Error("Unsupported interval duration.")}}function tm(e,t){switch(e){case y.kM_.APPLE_PARTNER:case y.kM_.APPLE_ADVANCED_COMMERCE:case y.kM_.APPLE:return eb[t];case y.kM_.GOOGLE:return eD[t]}throw Error(`Invalid external payment gateway ${e}`)}function tg(e,t){return(0,S.ki)(e)||tl(t?.status)}function tA(e,t){let n=[],i=(e.renewalMutations?.items??e.items).find(e=>C.JM.has(e.planId));return null!=i&&n.push(i),n.push(...t),n.map(t=>{for(let n of e.items)if(t.planId===n.planId)return{...n,...t};return t})}function tI(e){return e.filter(e=>!C.JM.has(e.planId))}function tT(e,t,n,i){if(!i.has(t))throw new p.v({message:"Expected planId in group",extraSentryInformation:{newPlanId:t,planGroup:i}});let r=!1,s=(e.renewalMutations?.items??e.items).map(e=>i.has(e.planId)?(r=!0,{...e,quantity:n,planId:t}):e);if(!r){let i={planId:t,quantity:n},r=e.items.find(e=>e.planId===t);null!=r&&(i.id=r.id),s.push(i)}return s.filter(e=>0!==e.quantity)}function tS(e,t){return tT(e,t,1,C.JM)}function ty(e,t,n){return tT(e,n,t,C.pW)}function tC(e){let t=e.find(e=>!("id"in e))??e.find(e=>C.JM.has(e.planId));if(null!=t){let n=eg.A.get(t.planId);l()(null!=n,"Missing plan"),e=e.map(e=>{if(e===t)return e;let i=eg.A.get(e.planId);if(l()(null!=i,"Missing plan"),n.interval===i.interval&&n.intervalCount===i.intervalCount)return e;let r=eg.A.getForSkuAndInterval(i.skuId,n.interval,n.intervalCount);return l()(null!=r,"Missing planForInterval"),{...e,planId:r.id}})}return e}function tN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{useSpace:!0},n=C.f5[e].fileSize;return(0,ey.Xq)(n/1024,{useKibibytes:!0,useSpace:t.useSpace})}function tv(e){return null==e?null:e.items.find(e=>C.pW.has(e.planId))}function tR(e){let t=null!=e?eM(e):null;return null!=t?e0(t.planId):null}function tO(e){return null!=e&&Date.now()-e.createdAt.getTime()<2592e6}function tb(e){return eh(eo,e)}function tD(e){return eh(W,e)}function tL(e,t){let n=(0,eC.$g)(e.amount,e.currency),i=eY(t);return`${n}/${i}`}function tw(e){return e}function tM(e){return"isNitroLocked"in e}function tP(){let e=(0,d.bG)([ep.default],()=>ep.default.getCurrentUser());return(0,S.YE)(e,C.PremiumTypes.TIER_2)}function tx(e){var t;let n=C.Eg;if(null!=(t=e)&&"trial_id"in t)switch(e.trial_id){case C.Tt:return C.h7;case C.yo:return C.CA}else;return n}function tk(e){return tU(e.map(e=>e.skuId))}function tU(e){return e.reduce((e,t)=>{let[n,i]=C.NL[t],r=1;switch(n){case C.T.HOUR:r=1;break;case C.T.DAY:r=24}return e+r*i},0)}function tG(e){let{subscriptionPlan:t,isGift:n=!1,priceOptions:i={}}=e,r=C.En[t.skuId];return null==r?null:eU(r,!1,n,i)}function tF(e){let{planId:t,isGift:n,priceOptions:i,subscriptionPlan:r}=e,s=C.XE[t];return null!=r&&(s=tB(r,n,i)),s}function tV(e){let{subscriptionPlan:t,isGift:n=!1,priceOptions:i={}}=e;if(t.interval===C.WT.DAY||t.interval===C.WT.MONTH&&1===t.intervalCount)return null;let r=tG({subscriptionPlan:t,isGift:n,priceOptions:i});if(null==r)return null;let s=t.interval===C.WT.MONTH?t.intervalCount:12*t.intervalCount;return r.amount*s}function tB(e){let t,n,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.interval===C.WT.YEAR){try{if(t=tG({subscriptionPlan:e,isGift:i,priceOptions:r}),null==t)return;n=eU(e.id,!1,i,r)}catch{return}if(0!==t.amount)return Math.floor(100*(1-n.amount/(12*t.amount)))}}function tj(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=tV({subscriptionPlan:e,isGift:t,priceOptions:n});if(null==i||i<=0)return null;let r=eU(e.id,!1,t,n),s=i-r.amount;return s<=0?null:{amount:s,currency:r.currency}}function tH(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.interval!==C.WT.YEAR)return null;let i=tG({subscriptionPlan:e,isGift:t,priceOptions:n});if(null==i||0===i.amount)return null;let r=tj(e,t,n);if(null==r)return null;let s=Math.floor(r.amount/i.amount*2)/2;return s<=0?null:s}function tY(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.interval!==C.WT.YEAR)return null;let i=eU(e.id,!1,t,n);return 0===i.amount?null:{amount:Math.round(i.amount/12),currency:i.currency}}function tW(e){return null==e?0:Math.max((0,eT.m_)(new Date,new Date(e)),0)}let tK=Object.freeze({isNewUser:tO,isPremiumAtLeast:S.CC,isPremium:S.ki,isPremiumExactly:S.YE,isPremiumEligible:function(e){return null!=e&&!e.isProvisional&&!e.bot},getPrice:eU,getDefaultPrice:eP,getInterval:function(e){let t=C.hd[e];if(null!=t)return{intervalType:t.interval,intervalCount:t.intervalCount};let n=Error("Unsupported plan");throw(0,eI.pM)(n,{tags:{planId:e}}),n},getIntervalString:eH,getIntervalStringAsNoun:eY,getPremiumType:eW,getTierDisplayNameByPlanId:ez,getDisplayName:eK,getPremiumPlanOptions:eJ,formatInterval:function(e){if(e===C.WT.YEAR)return eR.intl.string(eR.t.tfqrhj);if(e===C.WT.MONTH)return eR.intl.string(eR.t.FPybU7);throw Error(`Invalid interval type: ${e}`)},getPlanDescription:eZ,isPremiumSku:function(e){return e===C.pe.TIER_0||e===C.pe.TIER_1||e===C.pe.TIER_2},getIntervalMonths:function(e,t){if(e===C.WT.MONTH)return t;if(e===C.WT.YEAR)return 12*t;throw Error(`${e} interval subscription period not implemented`)},getUserMaxFileSize:N,getSkuIdForPlan:e0,getSkuIdForPremiumType:function(e){switch(e){case C.PremiumTypes.TIER_0:return C.pe.TIER_0;case C.PremiumTypes.TIER_1:return C.pe.TIER_1;case C.PremiumTypes.TIER_2:return C.pe.TIER_2}},getNumIncludedPremiumGuildSubscriptionSlots:function(e){return eW(e)===C.PremiumTypes.TIER_2?C.M4:0},getBillingInformationString:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{isFractionalPremiumActive:!1,fetched:!0,fractionalState:C.xc.NONE,startsAt:c()(0),endsAt:c()(0),currentEntitlementId:"",currentEntitlementEndsAt:c()(0),unactivatedUnits:[]},s=null!==n&&e.status===y.Dmq.PAST_DUE?n:t,a=i?(0,eC.$g)(s.invoiceItems.filter(e=>C.VY.has(e.subscriptionPlanId)).map(e=>e.amount).reduce((e,t)=>t+e,0),s.currency):(0,eC.$g)(s.total,s.currency);if(ep.default.getCurrentUser()?.isOnReverseTrial()){let t=null!=r.currentEntitlementEndsAt?r.currentEntitlementEndsAt.toDate():e.currentPeriodEnd;return eR.intl.format(eR.t["7ZS2m1"],{trialEnd:t})}if(e.status===y.Dmq.CANCELED)return eR.intl.format(eR.t["Whp/qk"],{endDate:t.subscriptionPeriodStart});if(e.status===y.Dmq.PAUSE_PENDING)return eR.intl.format(eR.t.uBLUGU,{pauseDate:e.currentPeriodEnd,resumeDate:e.pauseEndsAt});if(e.status===y.Dmq.PAUSED)return r.fractionalState!==C.xc.NONE?eR.intl.format(eR.t.Q18lRK,{renewalDate:r.endsAt.toDate(),price:a}):null==e.pauseEndsAt?i?eR.intl.format(eR.t.KTYQCg,{planName:eR.intl.string(eR.t.Ipxkog),price:a}):eR.intl.string(eR.t.fMz6Lg):i?eR.intl.format(eR.t.zcgtzf,{planName:eR.intl.string(eR.t.Ipxkog),resumeDate:e.pauseEndsAt,price:a}):eR.intl.format(eR.t["V8+l6k"],{resumeDate:e.pauseEndsAt});if(e.status===y.Dmq.PAST_DUE){let t=e7(e).expiresDate;return(e.isPurchasedViaGoogle&&e.metadata?.google_grace_period_expires_date!=null&&(t=c()(e.metadata.google_grace_period_expires_date)),e.isPurchasedViaApple&&e.metadata?.apple_grace_period_expires_date!=null&&(t=c()(e.metadata.apple_grace_period_expires_date)),e.isPurchasedExternally)?eR.intl.format(eR.t.U2hb3W,{endDate:t.toDate(),paymentGatewayName:ev.qm[e.paymentGateway],paymentSourceLink:tm(e.paymentGateway,"PAYMENT_SOURCE_MANAGEMENT")}):eR.intl.format(eR.t.qEIzyi,{endDate:t.toDate(),price:a})}{var o;if(e.status===y.Dmq.BILLING_RETRY)return eR.intl.format(eR.t.EMTLOT,{endDate:c()(e.currentPeriodStart).add(C.bx,"days").toDate(),price:a});if(e.status===y.Dmq.ACCOUNT_HOLD)return e.isPurchasedViaGoogle&&!(0,g.xv)()?eR.intl.format(eR.t["dtcxw+"],{endDate:c()(e.currentPeriodStart).add(C.ph,"days").toDate(),paymentGatewayName:ev.qm[e.paymentGateway],paymentSourceLink:tm(e.paymentGateway,"PAYMENT_SOURCE_MANAGEMENT")}):eR.intl.format(eR.t.EMTLOT,{endDate:c()(e.currentPeriodStart).add(C.ph,"days").toDate(),price:a});if(null!=(o=e).paymentSourceId&&ti(o.paymentSourceId))return eR.intl.format(eR.t.awpB0C,{prepaidEndDate:e.currentPeriodEnd});if(e.status===y.Dmq.UNPAID)return eR.intl.format(eR.t.CzTKom,{maxProcessingTimeInDays:C.G4});if(e.isPurchasedExternally)return eR.intl.format(eR.t.ZlWXgR,{renewalDate:t.subscriptionPeriodStart,paymentGatewayName:ev.qm[e.paymentGateway],subscriptionManagementLink:tm(e.paymentGateway,"SUBSCRIPTION_MANAGEMENT")});let n=new Date(t.subscriptionPeriodStart);return e.isBoostOnly||e.hasAnyPremiumGroup||(n=e9(n,r.unactivatedUnits)),i?eR.intl.format(eR.t.Vl3cED,{planName:eR.intl.string(eR.t.Ipxkog),renewalDate:n,price:a}):eR.intl.format(eR.t.Q18lRK,{renewalDate:n,price:a})}},getExpectedRenewalDate:e8,extendDateWithUnconsumedFractionalPremium:e9,getUnactivatedFractionalPremiumDurationString:te,isSwitchingPlansDisabled:tt,getSwitchingPlansDisabledMessage:tn,isNoneSubscription:ef.m1,getPlanIdFromInvoice:function(e,t){let{planId:n}=e;if(e.status===y.Dmq.CANCELED||e.status===y.Dmq.PAUSE_PENDING)return n;l()(null!=t,"Expected invoicePreview");let i=t.invoiceItems.find(e=>{let{subscriptionPlanId:t}=e;return e3(t)});return null==i||(0,ef.m1)(i.subscriptionPlanId)||null!=e.renewalMutations&&e.renewalMutations.planId!==e.planId?e.planId:i.subscriptionPlanId},getStatusFromInvoice:function(e,t){let{status:n}=e;if(e.status===y.Dmq.CANCELED||e.status===y.Dmq.PAUSE_PENDING)return n;l()(null!=t,"Expected invoicePreview");let i=t.invoiceItems.find(e=>{let{subscriptionPlanId:t}=e;return e3(t)});return(null==i||(0,ef.m1)(i.subscriptionPlanId))&&(n=y.Dmq.CANCELED),n},isBaseSubscriptionCanceled:to,getPremiumGuildIntervalPrice:tu,hasAccountCredit:function(e){return null!=e&&0!==e.size&&Array.from(e).some(e=>{let{subscriptionPlanId:t,parentId:n,consumed:i}=e;return null!=t&&null!=n&&!i})},hasUnconsumedGiftForSubscriptionPlan:function(e,t){return null!=e&&0!==e.size&&null!=t&&Array.from(e).some(e=>{let{subscriptionPlanId:n,parentId:i,consumed:r}=e;return null!=n&&null!=i&&!r&&n===t})},getBillingReviewSubheader:tc,getIntervalForInvoice:td,getPremiumPlanItem:eM,getGuildBoostPlanItem:tv,isBoostOnlySubscription:function(e){return null!=e&&null==eM(e)&&null!=tv(e)},getPremiumSkuIdForSubscription:tR,getPremiumTypeFromSubscription:function(e){if(null!=e){let t=eM(e);if(null!=t)return eW(t.planId)}},getUnactivatedFractionalPremiumHours:tk,castPremiumSubscriptionAsSkuId:tw,calculateDiscountPercentageForYearlyPlan:tB,calculateYearlyPlanDollarSavingsAmount:tj,calculateYearlyPlanMonthsSaved:tH,calculateYearlyPlanMonthlyRateAmount:tY,getDaysSincePremium:tW,getDaysRemainingUntilSubscriptionCurrentPeriodEnds:function(e){return Math.max(1,Math.ceil((0,eT.c_)(new Date(e.currentPeriodEnd),new Date)))},canUseAnimatedEmojis:function(e){return eh(P,e)},canUseEmojisEverywhere:function(e){return eh(x,e)},canUseSoundboardEverywhere:function(e){return eh(U,e)},canUseCustomCallSounds:function(e){return eh(G,e)},canUploadLargeFiles:function(e){return eh(ea,e)},canUseBadges:function(e){return eh(H,e)},canUseHighVideoUploadQuality:function(e){return eh(es,e)},canEditDiscriminator:function(e){return eh(B,e)},hasBoostDiscount:function(e){return eh(z,e)},canUseAnimatedAvatar:function(e){return eh(V,e)},canInstallPremiumApplications:function(e){return eh(ee,e)},canUseIncreasedMessageLength:function(e){return eh(er,e)},canUseIncreasedGuildCap:function(e){return eh(ei,e)},canRedeemPremiumPerks:function(e){return eh(et,e)},canUsePremiumProfileCustomization:function(e){return eh(Y,e)},canUsePremiumAppIcons:function(e){return eh(K,e)},canUsePremiumGuildMemberProfile:function(e){return eh(j,e)},canUseClientThemes:function(e){return eh($,e)},canStreamQuality:function(e,t){return"high"===e?eh(X,t):eh(Z,t)},canUseQuestOrbMultiplier:tb,hasFreeBoosts:function(e){return eh(q,e)},canUseCustomStickersEverywhere:function(e){return eh(k,e)},canUseCustomBackgrounds:function(e){return eh(en,e)},canUseCollectibles:tD,canUseMonthlyOrbs:function(e){return!!(0,E.f0)("canUseMonthlyOrbs")&&(0,L.Nh)(e?.perks,_.bb.MONTHLY_ORBS)},canUseShopDiscounts:function(e){return(0,E.f0)("canUseShopDiscounts")&&(0,L.Nh)(e?.perks,_.bb.SHOP_DISCOUNTS)||tD(e)},canUseMoreQuestOrbs:function(e){return(0,E.f0)("canUseMoreQuestOrbs")&&(0,L.Nh)(e?.perks,_.bb.MORE_QUEST_ORBS)||tb(e)},formatPriceString:tL,StreamQuality:ew})}