import{r as i,h as s}from"./p-9add63ef.js";import{u as o,s as t}from"./p-1282ed4a.js";import{t as l}from"./p-c1ecac8a.js";import{c as a}from"./p-78468e45.js";import"./p-2b28ea49.js";import"./p-dd24e53c.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-31faf2b8.js";import"./p-610295e2.js";import"./p-445fd8b4.js";import"./p-259c3935.js";const d=".swap{display:flex;align-items:baseline;justify-content:space-between}.swap__price{color:var(--sc-swap-price-color, var(--sc-input-label-color));line-height:var(--sc-line-height-dense);font-size:var(--sc-font-size-small);white-space:nowrap}";const n=d;const p=class{constructor(s){i(this,s);this.lineItem=undefined}async onSwapToggleChange(i){var s;try{o("FETCH");t.checkout=await l({id:(s=this.lineItem)===null||s===void 0?void 0:s.id,action:i.target.checked?"swap":"unswap"});o("RESOLVE")}catch(i){o("REJECT");a(i.message);console.error(i)}}render(){var i,o,t,l,a;if(!((i=this===null||this===void 0?void 0:this.lineItem)===null||i===void 0?void 0:i.is_swappable)){return null}const d=((o=this===null||this===void 0?void 0:this.lineItem)===null||o===void 0?void 0:o.swap)||((l=(t=this===null||this===void 0?void 0:this.lineItem)===null||t===void 0?void 0:t.price)===null||l===void 0?void 0:l.current_swap);const n=(d===null||d===void 0?void 0:d.swap_price)||this.lineItem.price;return s("div",{class:"swap"},s("sc-switch",{checked:!!((a=this===null||this===void 0?void 0:this.lineItem)===null||a===void 0?void 0:a.swap),onScChange:i=>this.onSwapToggleChange(i)},d===null||d===void 0?void 0:d.description),!!(n===null||n===void 0?void 0:n.display_amount)&&s("div",{class:"swap__price"},n===null||n===void 0?void 0:n.display_amount," ",n===null||n===void 0?void 0:n.short_interval_text," ",n===null||n===void 0?void 0:n.short_interval_count_text))}};p.style=n;export{p as sc_swap};
//# sourceMappingURL=p-7006b2db.entry.js.map