import{r as e,h as s,H as a,g as t}from"./p-40eb06b7.js";import{c as o}from"./p-5b78f53d.js";const i=class{constructor(s){e(this,s),this.header=void 0,this.show=!1,this.expanded=!1}async toggle(){this.toggleCollapse()}onExpandedChange(){this.updateCollapse()}componentDidLoad(){this.container=this.el.querySelector(".collapse-container"),this.show&&(this.expanded=!0)}toggleCollapse(){this.expanded=!this.expanded}updateCollapse(){this.el.querySelector(".collapse-container").style.maxHeight?this.hideCollapseContainer():this.showCollapseContainer()}hideCollapseContainer(){this.container.style.maxHeight=null,this.container.style.overflow="hidden"}showCollapseContainer(){this.container.style.maxHeight=`${this.container.scrollHeight}px`,setTimeout((()=>{this.container.style.overflow="auto"}),200)}render(){var e;return s(a,{key:"340d35f5f3036fd79926291fc34a7e473c4c2fa2",class:o({"collapse-expanded":this.expanded})},s("div",{key:"d8036f0e3b289115db446624feb8cf389565ba38",class:"collapse-header",onClick:()=>this.toggleCollapse()},(null===(e=this.header)||void 0===e?void 0:e.length)?s("h4",null,this.header):s("slot",{name:"header"}),s("span",{key:"3ffd78f1814f1bd65e95382b8e8c710d64c326ae",class:"collapse-action"},s("x-icon",{key:"ec8e4026ca69d5d6fd22711afb6bc60516b78f09",name:this.expanded?"minus":"dropdown"}))),s("div",{key:"6458af67fa01ec420154ce098942a16ff8516450",class:"collapse-container"},s("slot",{key:"550b37e509bba6612760a766a8d7113cd745d5e0"})))}get el(){return t(this)}static get watchers(){return{expanded:["onExpandedChange"]}}};i.style="x-collapse{display:block;position:relative;-webkit-transition:0.3s;transition:0.3s}.is-dark-mode x-collapse{color:var(--color-text-light, #FEFEFE)}x-collapse .collapse-header{position:relative;padding:0.5rem 0;line-height:1em;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}x-collapse .collapse-header:hover:after{-webkit-animation:0.75s fadeBreathe infinite;animation:0.75s fadeBreathe infinite}x-collapse .collapse-header h4{margin:0}x-collapse .collapse-header .collapse-action{position:absolute;top:calc(50% - 0.5rem);right:0.75rem}x-collapse .collapse-container{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:0.3s;transition:0.3s;max-height:0;opacity:0;-webkit-transition:max-height 0.2s ease-out, opacity 0.2s;transition:max-height 0.2s ease-out, opacity 0.2s}x-collapse.collapse-expanded .collapse-container{opacity:1}";export{i as x_collapse}