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}from"./p-06f939ab.js";import{l as d}from"./p-e3d2e899.js";const g=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?d.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?(d.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?(d.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?a.DONE:s==this.afCurrentStep-1?a.CURRENT:a.UPCOMING,i.ref.afStepStatus=r,i.ref.afType=this.afType,i.ref.afHeadingLevel=e,i.ref.afExpandable=this.afExpandable,i.ref.afExpanded=r===a.CURRENT,i.ref.afExpandText=this.afExpandText,i.ref.afCollapseText=this.afCollapseText}catch(i){d.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:"49e79226a302b6f1600eb8a8071fc52ed9d1af17",class:"digi-progress-list"},t("digi-typography",{key:"5393e83a0748300d42a1e4044af64c592805cc6b"},this.renderHeading(),t("ol",{key:"80d221f36d6e8539c81a8a55ef31457d88a55f09",class:"digi-progress-list__content"},t("slot",{key:"a67b614383b6fbc3e1dace65a8641860d163e51a"}))))}get hostElement(){return e(this)}};g.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{g as digi_progress_list}