import{l as u,k as _,aj as g,ak as l,V as a}from"./index-BwK72RNz.js";import{D as c}from"./DonationVoice-B-yV52Ms.js";import{g as h}from"./getVotesFormat-CTrf3mHq.js";class p{constructor(i){this._login="",this._username="",this._avatar="",this._title="",this._branding="",this._successDescription="",this._rules="",this._isWallEnabled=!1,this._minAmountWall="0",this._isTTSEnable=!1,this._voiceLimit=0,this._activities=new Map,this._actions=new Map,this._quizCategories=[],this._buttonText="",this._telegram="",this._youtube="",this._twitch="",this._vk="",this._vkLive="",this._kick="",this._firstVariant="",this._secondVariant="",this._firstVariantDescription="",this._secondVariantDescription="",this._votePrice="",this._firstVariantCountRub=0,this._secondVariantCountRub=0,this._voices=[],this._donationOnAir=null,this._ai=null,this._safe=null,this._wonder=null,this._isTgButton=!1,this._isAddedCreditCard=!1,this._isEmailConfirmation=!1,this._isPhoneConfirmation=!1,this._isAddedPhone=!1,this._isPro=!1,this._isVip=!1,this._isLoading=!0,u(this),this.setFromApi(i)}get isLoading(){return this._isLoading}get avatar(){return this._avatar?_(this._avatar):""}get login(){return this._login}get username(){return this._username}get title(){return this._title}get branding(){return this._branding?g(this._branding,1024):""}get successDescription(){return this._successDescription}get buttonText(){return this._buttonText}get rules(){return this._rules}get isWallEnabled(){return this._isWallEnabled}get minAmountWall(){return this._minAmountWall}get telegram(){return this._telegram}get youtube(){return this._youtube}get twitch(){return this._twitch}get vk(){return this._vk}get vkLive(){return this._vkLive}get kick(){return this._kick}get isSuperDonate(){return!1}get votePrice(){return this._votePrice}get firstVariant(){return this._firstVariant}get secondVariant(){return this._secondVariant}get firstVariantDescription(){return this._firstVariantDescription}get secondVariantDescription(){return this._secondVariantDescription}get firstVariantCollectedVotes(){return this.calcVotes(this._firstVariantCountRub)}get secondVariantCollectedVotes(){return this.calcVotes(this._secondVariantCountRub)}get firstVariantCollectedVotesFormatted(){return h(this.firstVariantCollectedVotes)}get secondVariantCollectedVotesFormatted(){return h(this.secondVariantCollectedVotes)}get donationOnAir(){return this._donationOnAir}get voices(){return this._voices}get isTTSEnable(){return this._isTTSEnable}get isAIEnable(){var i;return((i=this._ai)==null?void 0:i.isEnabled)??!1}get isSafeEnable(){var i;return((i=this._safe)==null?void 0:i.isEnable)??!1}get isWonderEnable(){var i;return((i=this._wonder)==null?void 0:i.isEnable)??!1}get ttsMinAmount(){return this._voiceLimit}get aiMinAmount(){return this._ai?Number(this._ai.minAmount):0}get safeMinAmount(){return this._safe?Number(this._safe.minAmount):0}get wonderMinAmount(){return this._wonder?Number(this._wonder.minAmount):0}get actions(){const i=[];return this._actions.forEach(t=>i.push(t)),i}get activities(){const i=[];return this._activities.forEach(t=>i.push(t)),i}get quizCategories(){return this._quizCategories}get isTgButton(){return this._isTgButton}get ai(){return this._ai}get safe(){return this._safe}get wonder(){return this._wonder}get isAddedCreditCard(){return this._isAddedCreditCard}get isEmailConfirmation(){return this._isEmailConfirmation}get isPhoneConfirmation(){return this._isPhoneConfirmation}get isAddedPhone(){return this._isAddedPhone}get isAvailable(){return this.isAddedCreditCard&&this.isPhoneConfirmation}get isPro(){return this._isPro}get isVip(){return this._isVip}setLoading(i){this._isLoading=i}getActivityNameById(i){const t=this._activities.get(i);return t&&t.name?t.name:l[i]}setFromApi(i){var t,e,s,n,r,o;i&&(this._login=i.pageSettings.login,this._username=i.username,this._avatar=i.pageSettings.avatar,this._title=i.pageSettings.title,this._branding=i.pageSettings.branding,this._successDescription=i.pageSettings.successDescription,this._buttonText=i.pageSettings.buttonText,this._rules=i.pageSettings.rules,this._isWallEnabled=((t=i.wall)==null?void 0:t.isEnabled)??i.pageSettings.isWallEnabled??!1,this._minAmountWall=((e=i.wall)==null?void 0:e.minAmount)??((s=i.wall)==null?void 0:s.minDonationAmount)??i.pageSettings.minAmountWall??"0",this._telegram=i.pageSettings.socials.telegram||"",this._youtube=i.pageSettings.socials.youtube||"",this._twitch=i.pageSettings.socials.twitch||"",this._vk=i.pageSettings.socials.vk||"",this._vkLive=i.pageSettings.socials.vkLive||"",this._kick=i.pageSettings.socials.kick||"",this.setActivities(i),this.setActions(i),this.setSounds(i),this._firstVariant=i.iHaveTo.firstVariant||"",this._secondVariant=i.iHaveTo.secondVariant||"",this._firstVariantDescription=i.iHaveTo.firstVariantDescription||"",this._secondVariantDescription=i.iHaveTo.secondVariantDescription||"",this._votePrice=i.iHaveTo.votePrice||"",this._firstVariantCountRub=((n=i.iHaveTo.votingResult)==null?void 0:n.firstVariantCount)??0,this._secondVariantCountRub=((r=i.iHaveTo.votingResult)==null?void 0:r.secondVariantCount)??0,this._isAddedCreditCard=i.isAddedCreditCard||!1,this._isEmailConfirmation=i.isEmailConfirmation||!1,this._isPhoneConfirmation=i.isPhoneConfirmation||!1,this._isAddedPhone=i.isPhone||!1,this._isPro=i.isPro||!1,this._isVip=i.isVip||!1,Array.isArray(i.quizCategories)&&(this._quizCategories=i.quizCategories),i.onAir&&(this._donationOnAir=i.onAir),(o=i.pageSettings.partnerFunctions)!=null&&o.isTgButton&&(this._isTgButton=!0),i.donationSettings.voiceLimit&&(this._voiceLimit=i.donationSettings.voiceLimit),i.AI&&(this._ai=i.AI),i.safe&&(this._safe=i.safe),i.wonder&&(this._wonder=i.wonder))}setActivities(i){this._activities.clear(),i.activitiesList.forEach(t=>{t.typeId===a.QuestionAnswer||t.isActive&&t.typeId>=a.Quiz&&this._activities.set(t.typeId,t)})}setActions(i){this._actions.clear(),i.actionsList.forEach(t=>this._actions.set(t.id,t))}setSounds(i){this._isTTSEnable=i.sounds.isTTSEnable,this._voices=[],i.sounds.voices.forEach(t=>{this._voices.push(new c(t))})}calcVotes(i){const t=Number(this._votePrice);return!Number.isFinite(t)||t<=0||!Number.isFinite(i)||i<=0?0:Math.floor(i/t)}}export{p as D};