import{a as b}from"./chunk.LHSR56PH.js";import{a as h,c as p}from"./chunk.B2NUKX6G.js";import{a as m}from"./chunk.KLRPP4NQ.js";import{a as y}from"./chunk.VAM5SM3O.js";import{a as o}from"./chunk.UFTAQNZB.js";import{a as f}from"./chunk.NYKJXI3Q.js";import{a as v,b as a,d as s,h as c}from"./chunk.XJAJO727.js";import{b as g,e as u}from"./chunk.OBAEIKIV.js";import{b as r,e as l,f as d}from"./chunk.W4QBFD6E.js";import{e as i}from"./chunk.6EV4YU6C.js";var t=class extends c{constructor(){super(...arguments);this.open=!1;this.inverted=!1;this.localize=new y(this)}updateMaxHeight(){var n;let e=(n=this.contentPreview)==null?void 0:n.scrollHeight.toString();this.style.setProperty("--max-height-pixel",`${e}px`),this.style.setProperty("--max-height",e)}onToggleClick(){this.updateMaxHeight(),this.open=!this.open}async onOpenChange(){if(this.body.classList.add("transitioning"),this.open){this.emit("sd-show"),await l(this.body);let{keyframes:e,options:n}=p(this,"expandable.show",{dir:this.localize.dir()});await r(this.body,d(e,this.body.scrollHeight),n),this.body.style.height="auto",this.updateComplete.then(()=>{this.emit("sd-after-show")})}else{this.emit("sd-hide"),await l(this.body);let{keyframes:e,options:n}=p(this,"expandable.hide",{dir:this.localize.dir()});await r(this.body,d(e,this.body.scrollHeight),n),this.body.style.height="auto",this.updateComplete.then(()=>{this.emit("sd-after-hide")})}this.details.setAttribute("open",this.open.toString()),this.body.classList.remove("transitioning")}async show(){if(!this.open)return this.onToggleClick(),m(this,"sd-after-show")}async hide(){if(this.open)return this.onToggleClick(),m(this,"sd-after-hide")}render(){return u`<div part="base" class="flex flex-col-reverse gap-4"><button part="toggle" class="${o("sd-interactive sd-interactive--reset",this.inverted&&"sd-interactive--inverted",this.inverted?"!focus-visible:focus-outline-inverted":"!focus-visible:focus-outline")}" @click="${this.onToggleClick}" aria-expanded="${this.open}"><div class="${o("h-full justify-center w-full text-base flex items-center toggle")}"><span part="toggle-icon" class="${o("flex items-center mr-2 transition-transform duration-medium ease-in-out",this.open&&"rotate-180")}"><slot name="expand-icon" class="${o(this.open&&"hidden")}"><sd-icon library="_internal" name="chevron-down" class="text-xl"></sd-icon></slot><slot name="collapse-icon" class="${o(!this.open&&"hidden")}"><sd-icon library="_internal" name="chevron-down" class="text-xl"></sd-icon></slot></span><slot name="toggle-closed" class="${o(this.open&&"hidden")}">${this.localize.term("showMore")}</slot><slot name="toggle-open" class="${o(!this.open&&"hidden")}">${this.localize.term("showLess")}</slot></div></button><details part="details" ?inert="${b(!this.open)}"><summary part="summary" aria-hidden="true" class="cursor-pointer overflow-hidden list-none"><slot name="clone"></slot></summary><div part="content" class="content content-preview overflow-hidden relative"><slot></slot></div></details></div>`}firstUpdated(){this.cloneContentToLightDOM(),this.details.setAttribute("open",this.open.toString())}cloneContentToLightDOM(){let e=document.createElement("div");e.setAttribute("slot","clone"),Array.from(this.childNodes).forEach(w=>{let x=w.cloneNode(!0);e.appendChild(x)}),this.appendChild(e)}};t.styles=[...c.styles,g`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties;@layer theme,base,components,utilities;
:host{--component-expandable-max-block-size:90px;--gradient-height:24px;--gradient:var(
              --gradient-color-start,
              transparent,
              var(--gradient-color-end, rgba(var(--sd-color-background-white, rgba(var(--sd-color-white)))))
            ) 80%,var(--gradient-color-end, rgba(var(--sd-color-background-white, rgba(var(--sd-color-white))))) 100%;position:relative;display:inline-block;width:100%}.toggle::-moz-focus-inner{--tw-border-style:none;border-style:none;padding:calc(var(--sd-spacing-1) * 0)}details>summary::-webkit-details-marker,details[open] summary{display:none}summary{max-block-size:var(--component-expandable-max-block-size)}:host([open]) summary{max-block-size:var(--max-height-pixel,1000vh)}.content{max-block-size:var(--component-expandable-max-block-size)}:host([open]) .content,:host:has(.transitioning) .content{max-block-size:var(--max-height-pixel,1000vh)}.content::after{position:absolute;bottom:calc(var(--sd-spacing-1) * 0);left:calc(var(--sd-spacing-1) * 0);display:block;width:100%;opacity:var(--sd-opacity-0);transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4,0,.2,1)));transition-duration:var(--tw-duration,var(--default-transition-duration,150ms));--tw-duration:var(--sd-duration-medium, 300ms);transition-duration:var(--sd-duration-medium,300ms);--tw-ease:var(--ease-in-out, cubic-bezier(0.4, 0, 0.2, 1));transition-timing-function:var(--ease-in-out,cubic-bezier(.4,0,.2,1));content:' ';height:var(--gradient-height);background:linear-gradient(180deg,var(--gradient));pointer-events:none}:host([inverted]){--gradient-color-start:transparent;--gradient-color-end:rgba(var(--sd-color-background-primary) / 1)}:host([inverted]) .content::after{background:var(--gradient-vertical-transparent-primary,linear-gradient(180deg,var(--gradient)))}:host(:not([open])) .content::after{opacity:var(--sd-opacity-100)}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}`],i([s(".content-preview")],t.prototype,"contentPreview",2),i([s("details")],t.prototype,"details",2),i([s('[part="content"]')],t.prototype,"body",2),i([a({type:Boolean,reflect:!0})],t.prototype,"open",2),i([a({type:Boolean,reflect:!0})],t.prototype,"inverted",2),i([f("open",{waitUntilFirstUpdate:!0})],t.prototype,"onOpenChange",1),t=i([v("sd-expandable")],t);h("expandable.show",{keyframes:[{height:"var(--component-expandable-max-block-size, 90px)"},{height:"auto"}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});h("expandable.hide",{keyframes:[{height:"auto"},{height:"var(--component-expandable-max-block-size, 90px)"}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});export{t as a};
