import{r as i,c as r,h as t,g as s}from"./p-52e3bb32.js";import{r as o}from"./p-ffe5c0e8.js";import{e,u as a,y as p}from"./p-86eddf30.js";import{l as d}from"./p-e3d2e899.js";import"./p-717306ef.js";import"./p-a4a001e1.js";import"./p-53d9556b.js";import"./p-4841b4e1.js";import"./p-cf3ce3c5.js";import"./p-7e32c40b.js";import"./p-5d21a361.js";import"./p-ad16c7a1.js";import"./p-f40f4b2a.js";import"./p-1f68d501.js";import"./p-ee88e3f1.js";import"./p-8142cc73.js";import"./p-905ccb30.js";import"./p-88b4d03a.js";import"./p-1f956af8.js";import"./p-f447b984.js";import"./p-9c5a93d8.js";import"./p-7933b555.js";import"./p-0f6c0360.js";import"./p-814ca2ad.js";import"./p-a39f86c9.js";import"./p-07303cb5.js";import"./p-2a023831.js";import"./p-5ba6737a.js";import"./p-e4a9f8f0.js";import"./p-f2a6768b.js";import"./p-290d1746.js";import"./p-40657c82.js";import"./p-f600576a.js";import"./p-9dd5d6c8.js";import"./p-77a93845.js";import"./p-06f939ab.js";import"./p-8cd2d6dd.js";import"./p-484a1d6d.js";import"./p-0f3fbb1e.js";import"./p-820e795b.js";import"./p-46cbbcb5.js";import"./p-d74742b8.js";import"./p-6e383896.js";import"./p-4bad4fb0.js";import"./p-d1886fff.js";import"./p-a6ca40fc.js";import"./p-b0e88537.js";import"./p-cdcaf0eb.js";const m=class{constructor(t){i(this,t),this.afOnClickLink=r(this,"afOnClickLink",7),this.afOnReady=r(this,"afOnReady",3),this.linkItems=[],this.afHeading=void 0,this.afHeadingLevel=e.H2,this.afDescription=void 0,this.afId=o("digi-form-error-list"),this.afOverrideLink=!1,this.afEnableHeadingFocus=!0}async afMSetHeadingFocus(){this.setHeadingFocus()}componentWillLoad(){this.getLinks()}componentWillUpdate(){this.getLinks(!0)}componentDidLoad(){this.setHeadingFocus(),this.afOnReady.emit()}getLinks(i){const r=this.hostElement.children;if(!r||r.length<=0)return void d.warn("The slot contains no link elements",this.hostElement);let t;t=i?this._observer.children:r,this.linkItems=[...t].filter((i=>"a"===i.tagName.toLowerCase())).map((i=>({text:i.textContent,href:i.getAttribute("href")||""})))}setHeadingFocus(){this.afEnableHeadingFocus&&setTimeout((async()=>{const i=await this._notificationAlert.afMGetHeadingElement();i&&i.focus()}),0)}clickResponse(i){this.afOverrideLink&&i.detail.preventDefault(),this.afOnClickLink.emit(i)}render(){return t("div",{key:"b1538bef3aa4d16c21c04cc6ec3a16e1da48cf9c",class:"digi-form-error-list",id:this.afId},t("digi-notification-alert",{key:"2b6989a273a1182560cf313e22c5c6d2fd01fd33",ref:i=>this._notificationAlert=i,"af-heading":this.afHeading,"af-heading-level":this.afHeadingLevel,"af-variation":a.DANGER},this.afDescription&&t("digi-typography",{key:"9142a6f39761391edd40aa8102cff60547be34b2","af-variation":p.SMALL},t("p",{key:"0244fd85c399f6823dca2437e5b25e329fcfa9b2",class:"digi-form-error-list__description"},this.afDescription)),t("ul",{key:"47caec67e8e33bdaa13abb8b04f5ce9756a93e8b",class:"digi-form-error-list__list"},this.linkItems.map((i=>t("li",{class:"digi-form-error-list__item"},t("digi-link-internal",{class:"digi-form-error-list__link",afHref:i.href},i.text)))))),t("div",{key:"9e48117d3a59c50c10684f05a40f350c5b936867",hidden:!0,class:"digi-form-error-list__slot"},t("digi-util-mutation-observer",{key:"02d6c18bd0c16be3fb3266abebd4bd8156e4a432",afOptions:{attributes:!1,childList:!0,subtree:!0,characterData:!0},ref:i=>this._observer=i,onAfOnChange:()=>this.getLinks()},t("slot",{key:"d1d766b6f1f094c135a0ae8c9624a0e871ccdfad"}))))}get hostElement(){return s(this)}};m.style=".sc-digi-form-error-list-h{--digi--form-error-list--list--padding:var(--digi--gutter--smaller) 0 0 0;--digi--form-error-list--list--margin:0;--digi--form-error-list--item--padding:var(--digi--padding--smaller) 0 0 0;--digi--form-error-list--item--margin:0}.sc-digi-form-error-list-h .digi-form-error-list__list.sc-digi-form-error-list{list-style:none;padding:var(--digi--form-error-list--list--padding);margin:var(--digi--form-error-list--list--margin)}.sc-digi-form-error-list-h .digi-form-error-list__item.sc-digi-form-error-list{list-style:none;padding:var(--digi--form-error-list--item--padding);margin:var(--digi--form-error-list--item--margin)}";export{m as digi_form_error_list}