import{r as s,c as t,h as i,g as e}from"./p-b891c2f1.js";import{_ as o}from"./p-684c85b4.js";import"./p-aafd8ea4.js";import{o as a}from"./p-494248b1.js";import{s as r,g as n,a as l,c,b as h}from"./p-f9d64176.js";import"./p-112455b1.js";const p=class{constructor(i){s(this,i),this.scShow=t(this,"scShow",7),this.scHide=t(this,"scHide",7),this.closedText=o("Show Summary","surecart"),this.openText=o("Summary","surecart"),this.collapsible=!1}componentDidLoad(){this.body.hidden=this.collapsed,this.body.style.height=this.collapsed?"0":"auto"}handleClick(s){s.preventDefault(),this.empty&&!this.loading||(this.collapsed=!this.collapsed)}renderHeader(){var s;return this.loading&&!(null===(s=this.order)||void 0===s?void 0:s.id)?i("sc-line-item",null,i("sc-skeleton",{slot:"title",style:{width:"120px",display:"inline-block"}}),i("sc-skeleton",{slot:"price",style:{width:"70px",display:"inline-block","--border-radius":"6px"}}),i("sc-skeleton",{slot:"currency",style:{width:"30px",display:"inline-block"}})):i("sc-line-item",{style:{"--price-size":"var(--sc-font-size-x-large)"}},i("span",{class:"collapse-link",slot:"title",onClick:s=>this.handleClick(s)},this.collapsed?this.closedText:this.openText,i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"collapse-link__icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"}))),i("span",{slot:"description"},i("slot",{name:"description"})),i("span",{slot:"price"},i("sc-total",{total:"total",order:this.order})))}async handleOpenChange(){if(this.collapsed){this.scHide.emit(),await r(this.body);const{keyframes:s,options:t}=n(this.el,"summary.hide");await l(this.body,c(s,this.body.scrollHeight),t),this.body.hidden=!0,this.body.style.height="auto"}else{this.scShow.emit(),await r(this.body),this.body.hidden=!1;const{keyframes:s,options:t}=n(this.el,"summary.show");await l(this.body,c(s,this.body.scrollHeight),t),this.body.style.height="auto"}}render(){return i("div",{class:{summary:!0,"summary--open":!this.collapsed}},this.collapsible&&this.renderHeader(),i("div",{ref:s=>this.body=s,class:{summary__content:!0,"summary__content--empty":this.empty&&!this.loading}},i("slot",null)),this.empty&&!this.loading&&i("p",{class:"empty"},o("Your cart is empty.","surecart")))}get el(){return e(this)}static get watchers(){return{collapsed:["handleOpenChange"]}}};h("summary.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:250,easing:"ease"}}),h("summary.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:250,easing:"ease"}}),a(p,["order","loading","empty"],!1),p.style=":host{display:block;font-family:var(--sc-font-sans);font-size:var(--sc-checkout-font-size, 16px)}.collapse-link{display:flex;align-items:center;gap:0.35em}.summary__content--empty{display:none}.collapse-link__icon{width:18px;height:18px;color:var(--sc-color-gray-500)}.item__product+.item__product{margin-top:20px}.empty{color:var(--sc-color-gray-500)}.summary{position:relative;user-select:none;cursor:pointer}.summary .collapse-link__icon{transition:transform 0.25s ease-in-out}.summary--open .collapse-link__icon{transform:rotate(180deg)}::slotted(*){margin:4px 0 !important}::slotted(sc-divider){margin:16px 0 !important}sc-line-item~sc-line-item{margin-top:14px}";export{p as sc_order_summary}