import{r as a,h as t,a as e,g as r}from"./p-d52b3602.js";import{c}from"./p-c608c6dc.js";import{s}from"./p-c5a89792.js";const o=class{constructor(t){a(this,t),this.readData=a=>{try{return Array.isArray(JSON.parse(a))?JSON.parse(a):[]}catch(t){return Array.isArray(a)?a:[]}}}getOpacity(a,t){return JSON.stringify(0===t?1:+a.percentage/100)}getCardStyle(){return"\n      .card:after {\n          content: '';\n          display: block;\n          background: linear-gradient(0deg, white, rgba(255,255,255, 0));\n          height: 2rem;\n          margin-top: -2rem;\n          position: relative;\n        }\n\n      .card__body: {\n        padding-bottom: 0 !important;\n      }\n  "}connectedCallback(){s({source:this.hostElement,type:"warn"})}render(){return t(e,null,t("div",{class:this.getCssClassMap()},t("scale-card",{styles:this.getCardStyle()},t("div",{class:"header"},this.heading),t("div",{class:"bar"},this.readData(this.data).sort(((a,t)=>t.percentage-a.percentage)).map(((a,e)=>{if(+a.percentage>0)return t("div",{class:"bar__item",style:{opacity:this.getOpacity(a,e),flex:JSON.stringify(+a.percentage)}})}))),t("div",{class:"legend"},this.readData(this.data).sort(((a,t)=>t.percentage-a.percentage)).map(((a,e)=>t("div",{class:"legend__row"},t("div",{class:"legend__row__item"},t("div",{class:"legend__item",style:{opacity:this.getOpacity(a,e)}}),t("div",{class:"legend__label spacer"},a.type)),t("div",{class:"legend__row__item"},t("div",{class:"spacer"},a.value),t("div",{class:"spacer"},a.percentage,"%")))))))))}getCssClassMap(){return c("chart-stack-card")}get hostElement(){return r(this)}};o.style=":host{--scl-chart-stack-card-color:var(--telekom-color-additional-blue-600)}.chart-stack-card{color:var(--color-text);--scl-chart-stack-card-color:var(--telekom-color-additional-blue-600)}.chart-stack-card .header{height:var(--telekom-spacing-composition-space-08);font-size:var(--telekom-typography-font-size-headline-3);font-weight:var(--telekom-typography-font-weight-extra-bold);line-height:var(--telekom-typography-line-spacing-tight);margin-bottom:var(--telekom-spacing-composition-space-08)}.chart-stack-card .bar{display:flex;justify-content:space-between;margin-bottom:var(--telekom-spacing-composition-space-06)}.chart-stack-card .bar__item{background-color:var(--scl-chart-stack-card-color);height:var(--telekom-spacing-composition-space-10);flex:1}.chart-stack-card .bar__item:first-of-type{border-top-left-radius:var(--telekom-radius-small);border-bottom-left-radius:var(--telekom-radius-small)}.chart-stack-card .bar__item:last-of-type{border-top-right-radius:var(--telekom-radius-small);border-bottom-right-radius:var(--telekom-radius-small)}.chart-stack-card .legend{display:flex;flex-direction:column;height:calc(var(--telekom-spacing-composition-space-06) * 10)}.chart-stack-card .spacer{padding:0 var(--telekom-spacing-composition-space-04)}.chart-stack-card .legend .legend__row__item{display:flex;line-height:var(--telekom-typography-line-spacing-standard)}.chart-stack-card .legend .legend__row{display:flex;justify-content:space-between}.chart-stack-card .legend .legend__row:last-child{padding-bottom:var(--telekom-spacing-composition-space-10)}.chart-stack-card .legend .legend__item{height:10px;width:10px;background-color:var(--scl-chart-stack-card-color);border-radius:100%;align-self:center;margin-right:var(--telekom-spacing-composition-space-03)}.chart-stack-card .legend .legend__label{font-weight:var(--type-weight-bold);font-size:var(--telekom-spacing-composition-space-06);line-height:200%}";export{o as scale_chart_stack_card}