import{r as t,h as i,g as s}from"./p-890a2f7e.js";import{P as e}from"./p-dc46d6c3.js";import{p as o}from"./p-da3bdb97.js";import{d as r}from"./p-9f421a09.js";const n={"$0 $1 / month in $2 months":"$0 $1 / månad i $2 månader","$0 $1 in initial fee and $2 $3 reccuring. Total cost is $4 $5 and the effective rate is $6%":"$0 $1 i uppläggningsavgift och $2 $3 i månadsavgift. Total kostnad är $4 $5 och den effektiva räntan är $6%"},a=class{constructor(i){t(this,i)}async componentWillLoad(){this.t=r.create({sv:n},this.element)}async getPayment(t,i){let s;return this.option&&this.selected&&(t.items&&t.currency&&t.customer?s={type:this.option.type,plan:this.selected,verify:{mode:"iframe",parent:window.location.origin}}:console.log("Error: must have items, currency, customer")),s}onSelected(t){"object"==typeof t.detail&&"string"==typeof t.detail.value&&this.option&&(this.selected=this.option.plans.find((i=>i.length.toString()==t.detail.value)))}limit(t,i){const s=0==i?1:100;return Math.round((t+Number.EPSILON)*s)/s}render(){const t=this.t;!this.selected&&Array.isArray(this.option)&&this.option.length>0&&(this.selected=this.option.plans[0]);const s=this.selected&&this.selected.effectiveRate?100*this.selected.effectiveRate:"-";return[this.option?this.option.plans.map((s=>i("smoothly-radio",{checked:this.selected==s,name:"invoice-plan",value:s.length.toString()},t("$0 $1 / month in $2 months",this.currency,this.limit(s.amount,0),s.length)))):[],this.selected?i("p",null,t("$0 $1 in initial fee and $2 $3 reccuring. Total cost is $4 $5 and the effective rate is $6%",this.currency,this.selected.fees.initial,this.currency,this.selected.fees.reaccuring,this.currency,this.limit(this.selected.total,0),"number"==typeof s?this.limit(s,2).toString():s)):[]]}get element(){return s(this)}};o("installment",(t=>{const s={type:"installment",name:"Installment Plan",brand:t.service,component:i("ig-installment-details",{ref:t=>s.element=t,option:e(t)?t:void 0,currency:t.currency})};return s})),a.style=".sc-ig-installment-details-h{display:block;margin:1em}[hidden].sc-ig-installment-details-h{display:none}smoothly-radio.sc-ig-installment-details{text-align:center;border-left:solid 1px rgb(var(--smoothly-medium-color));border-right:solid 1px rgb(var(--smoothly-medium-color))}smoothly-radio.sc-ig-installment-details:first-of-type{border-top:solid 1px rgb(var(--smoothly-medium-color));border-top-left-radius:4px;border-top-right-radius:4px}smoothly-radio.sc-ig-installment-details:last-of-type{border-bottom:solid 1px rgb(var(--smoothly-medium-color));border-bottom-left-radius:4px;border-bottom-right-radius:4px}p.sc-ig-installment-details{color:rgb(var(--smoothly-medium-color))}";export{a as I}