import{r as i,c as s,h as t,g as e}from"./p-52e3bb32.js";import{P as r,c as o,b as h,a as d}from"./p-06f939ab.js";import{l as g}from"./p-e3d2e899.js";const a=class{constructor(t){i(this,t),this.afOnReady=s(this,"afOnReady",3),this.afHeading=void 0,this.afAriaLabel=void 0,this.afHeadingLevel=r.H2,this.afVariation=o.PRIMARY,this.afType=h.CIRCLE,this.afExpandable=!1,this.afExpandText="",this.afCollapseText="",this.afCurrentStep=1,this.steps=[]}async afMNext(){this.afCurrentStep+=1}async afMPrevious(){this.afCurrentStep-=1}componentWillLoad(){this.getSteps(),this.setStepAndTypeProps()}componentWillUpdate(){this.getSteps(),this.setStepAndTypeProps()}componentDidLoad(){this.afOnReady.emit()}getSteps(){const i=this.hostElement.querySelectorAll("digi-progress-list-item");!i||i.length<=0?g.warn("The slot contains no children elements.",this.hostElement):this.steps=[...Array.from(i)].map((i=>({outerHTML:i.outerHTML,ref:i})))}setStepAndTypeProps(){return this.steps&&this.afCurrentStep<1?(g.warn(`Current step is set to ${this.afCurrentStep} which is not allowed.`,this.hostElement),void(this.afCurrentStep=1)):this.steps&&this.afCurrentStep>this.steps.length+1?(g.warn(`Current step is set to ${this.afCurrentStep} which is more than the amount of available steps (${this.steps.length}).`,this.hostElement),void(this.afCurrentStep=this.steps.length+1)):void(this.steps&&this.steps.forEach(((i,s)=>{i.ref.afVariation=this.afVariation;try{const t=Number.parseInt(this.afHeadingLevel.split("h")[1])+1,e="h"+Math.max(Math.min(t,6),1);let r;i.ref.afIsLast=s==this.steps.length-1,r=s<this.afCurrentStep-1?d.DONE:s==this.afCurrentStep-1?d.CURRENT:d.UPCOMING,i.ref.afStepStatus=r,i.ref.afType=this.afType,i.ref.afHeadingLevel=e,i.ref.afExpandable=this.afExpandable,i.ref.afExpanded=r===d.CURRENT,i.ref.afExpandText=this.afExpandText,i.ref.afCollapseText=this.afCollapseText}catch(i){g.warn("Error in setStepAndTypeProps, ",i)}})))}renderHeading(){var i;return(null===(i=this.afHeading)||void 0===i?void 0:i.trim().length)>1?t("div",null,t(this.afHeadingLevel,{class:"digi-progress-list__header","aria-label":this.afAriaLabel},this.afHeading)):null}render(){return t("div",{key:"64bf972e1029f4e802207f6b263d73c5912a8852",class:"digi-progress-list"},t("digi-typography",{key:"68eae21de61ec1758cdf803f9df543f713036a73"},this.renderHeading(),t("ol",{key:"3900f3181170af233600a57b8e94dd8c08727556",class:"digi-progress-list__content"},t("slot",{key:"d34a28c365b74000cbfc8d0a152b7eb13c7a7e6a"}))))}get hostElement(){return e(this)}};a.style=".sc-digi-progress-list-h{--digi--progress-list--content--padding-top:var(--digi--padding--medium);--digi--progress-list--heading--font-size:var(--digi--typography--heading-1--font-size--desktop);--digi--progress-list--heading--font-weight:var(--digi--typography--heading-1--font-weight--desktop);--digi--progress-list--heading--margin-bottom:var(--digi--margin--largest)}.sc-digi-progress-list-h .digi-progress-list__header.sc-digi-progress-list{font-size:var(--digi--progress-list--heading--font-size);font-weight:var(--digi--progress-list--heading--font-weight);margin-bottom:var(--digi--progress-list--heading--margin-bottom)}.sc-digi-progress-list-h .digi-progress-list__content.sc-digi-progress-list{margin-top:0;padding-left:0;padding-bottom:0;padding-top:var(--digi--progress-list--content--padding-top)}.sc-digi-progress-list-h .digi-progress-list.sc-digi-progress-list ol.sc-digi-progress-list{max-width:100%}";export{a as digi_progress_list}