import{r as i,c as e,h as n,F as s}from"./p-e97fde0a.js";import{i as t}from"./p-610295e2.js";import"./p-3f6362a4.js";const c=":host {\n  display: block;\n  min-width: 0;\n  width: 100%;\n}\n\nsc-choice-container {\n  container-type: inline-size;\n}\n\n.price-choice {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  line-height: var(--sc-line-height-dense);\n  gap: var(--sc-spacing-small);\n}\n.price-choice__name {\n  display: inline-block;\n  font-size: var(--sc-price-choice-name-size, var(--sc-input-label-font-size-medium));\n  font-weight: var(--sc-price-choice-name-font-weight, var(--sc-font-weight-bold));\n  text-transform: var(--sc-price-choice-text-transform, var(--sc-input-label-text-transform, none));\n}\n.price-choice > *:not(:first-child):last-child {\n  text-align: right;\n}\n.price-choice__details {\n  flex: 1 0 50%;\n  display: grid;\n  gap: var(--sc-spacing-xxx-small);\n}\n.price-choice__trial, .price-choice__setup-fee, .price-choice__price {\n  font-size: var(--sc-font-size-small);\n  opacity: 0.8;\n}\n.price-choice__price {\n  font-weight: var(--sc-price-choice-price-font-weight, var(--sc-font-weight-normal));\n}\n\n@container (max-width: 325px) {\n  .price-choice {\n    flex-direction: column;\n    align-items: flex-start;\n    gap: var(--sc-spacing-xx-small);\n  }\n  .price-choice > *:not(:first-child):last-child {\n    text-align: initial;\n  }\n}";const r=c;const a=class{constructor(n){i(this,n);this.scChange=e(this,"scChange",7);this.price=undefined;this.loading=false;this.label=undefined;this.showLabel=true;this.showPrice=true;this.showControl=false;this.description=undefined;this.type=undefined;this.required=false;this.checked=false;this.priceData=undefined}handlePriceChange(){this.priceData=typeof this.price==="string"?JSON.parse(this.price):this.price}componentWillLoad(){this.handlePriceChange()}renderPrice(){var i;return n(s,null,(i=this.priceData)===null||i===void 0?void 0:i.display_amount,t(this.priceData,{showOnce:true,abbreviate:true,labels:{interval:"/",period:wp.i18n.__("for","surecart")}}))}render(){var i,e,c,r,a,l,o,h,d,p,u,v;if(this.loading){return n("sc-choice-container",{showControl:this.showControl,name:"loading",disabled:true},n("div",{class:"price-choice"},n("sc-skeleton",{style:{width:"60px",display:"inline-block"}}),n("sc-skeleton",{style:{width:"80px",display:"inline-block"}})))}return n("sc-choice-container",{value:(i=this.priceData)===null||i===void 0?void 0:i.id,type:this.type,showControl:this.showControl,checked:this.checked,onScChange:()=>this.scChange.emit(),required:this.required},n("div",{class:"price-choice"},this.showLabel&&n("div",{class:"price-choice__title"},n("div",{class:"price-choice__name"},this.label||this.priceData.name),!!this.description&&n("div",{class:"price-choice__description"},this.description)),this.showPrice&&n("div",{class:"price-choice__details"},n("div",{class:"price-choice__price"},((e=this.priceData)===null||e===void 0?void 0:e.ad_hoc)?wp.i18n.__("Custom Amount","surecart"):n(s,null,(c=this.priceData)===null||c===void 0?void 0:c.display_amount,((r=this.priceData)===null||r===void 0?void 0:r.recurring_period_count)&&1<=((a=this.priceData)===null||a===void 0?void 0:a.recurring_period_count)&&n("sc-visually-hidden",null," ",wp.i18n.__("This is a repeating price. Payment will happen","surecart")," ",t(this.priceData,{showOnce:true,abbreviate:false,labels:{interval:wp.i18n.__("every","surecart"),period:wp.i18n.__("for","surecart")}})),n("span",{"aria-hidden":"true"},t(this.priceData,{showOnce:true,abbreviate:true,labels:{interval:"/",period:wp.i18n.__("for","surecart")}})))),!!((l=this.priceData)===null||l===void 0?void 0:l.trial_duration_days)&&n(s,null,n("sc-visually-hidden",null,wp.i18n.sprintf(wp.i18n.__("You have a %d-day trial before payment becomes necessary.","surecart"),(o=this.priceData)===null||o===void 0?void 0:o.trial_duration_days)),n("div",{class:"price-choice__trial","aria-hidden":"true"},wp.i18n.sprintf(wp.i18n._n("Starting in %s day","Starting in %s days",this.priceData.trial_duration_days,"surecart"),this.priceData.trial_duration_days))),!!((h=this.priceData)===null||h===void 0?void 0:h.setup_fee_enabled)&&((d=this.priceData)===null||d===void 0?void 0:d.setup_fee_amount)&&n("div",{class:"price-choice__setup-fee"},n("sc-visually-hidden",null,wp.i18n.__("This payment plan has","surecart")," "),(p=this.priceData)===null||p===void 0?void 0:p.setup_fee_display_amount," ",((u=this.priceData)===null||u===void 0?void 0:u.setup_fee_name)||(((v=this.priceData)===null||v===void 0?void 0:v.setup_fee_amount)<0?wp.i18n.__("Discount","surecart"):wp.i18n.__("Setup Fee","surecart"))))))}static get watchers(){return{price:["handlePriceChange"]}}};a.style=r;export{a as sc_price_choice_container};
//# sourceMappingURL=p-5f62221f.entry.js.map