import{r as i,h as s}from"./p-e97fde0a.js";import{u as o,s as t}from"./p-53e7f7d7.js";import{t as l}from"./p-be3a018c.js";import{c as d}from"./p-1f60f497.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-4df6e0c5.js";import"./p-dd3464cd.js";const n=".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 p=n;const a=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");d(i.message);console.error(i)}}render(){var i,o,t,l,d;if(!((i=this===null||this===void 0?void 0:this.lineItem)===null||i===void 0?void 0:i.is_swappable)){return null}const n=((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 p=(n===null||n===void 0?void 0:n.swap_price)||this.lineItem.price;return s("div",{class:"swap"},s("sc-switch",{checked:!!((d=this===null||this===void 0?void 0:this.lineItem)===null||d===void 0?void 0:d.swap),onScChange:i=>this.onSwapToggleChange(i)},n===null||n===void 0?void 0:n.description),!!(p===null||p===void 0?void 0:p.display_amount)&&s("div",{class:"swap__price"},p===null||p===void 0?void 0:p.display_amount," ",p===null||p===void 0?void 0:p.short_interval_text," ",p===null||p===void 0?void 0:p.short_interval_count_text))}};a.style=p;export{a as sc_swap};
//# sourceMappingURL=p-e814ca2e.entry.js.map