import{r as i,h as t,z as a,n as l,w as o,a9 as c}from"./index-yJ8X--q8.js";import{v as d}from"./label-D3d1qqIG-BD7RiEyC.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const h=`/* forward the rem function */
/*
 * This file contains all rules for accessibility.
 */
@layer kol-global {
  :host {
    /*
     * Minimum size of interactive elements.
     */
    --a11y-min-size: calc(44rem / var(--kolibri-root-font-size, 16));
    /*
     * No element should be used without a background and font color whose contrast ratio has
     * not been checked. By initially setting the background color to white and the font color
     * to black, the contrast ratio is ensured and explicit adjustment is forced.
     */
    background-color: white;
    color: black;
  }
  * {
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    hyphens: auto;
    /*
     * Verdana is an accessible font that can be used without requiring additional loading time.
     */
    font-family: Verdana;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    word-break: break-word;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  /*
   * All interactive elements should have a minimum size of to-rem(44).
   */
  /* input:not([type='checkbox'], [type='radio'], [type='range']), */
  /* option, */
  /* select, */
  /* textarea, */
  [role=button],
  button:not([role=link]),
  .kol-input .input {
    min-height: var(--a11y-min-size);
    min-width: var(--a11y-min-size);
  }
  /*
   * Some interactive elements should not inherit the font-family and font-size.
   */
  a,
  button,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  input,
  option,
  select,
  textarea {
    /*
     * All elements should inherit the font family from his parent element.
     */
    font-family: inherit;
    /*
     * All elements should inherit the font size from his parent element.
     */
    font-size: inherit;
  }
}
/**
 * Sometimes we need the semantic element for accessibility reasons,
 * but we don't want to show it.
 *
 * - https://www.a11yproject.com/posts/how-to-hide-content/
 */
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@layer kol-global {
  /*
   * Dieses CSS stellt sicher, dass der Standard-Style
   * von A und Button resettet werden.
   */
  :is(a, button) {
    background-color: transparent;
    border: none;
    margin: 0;
    padding: 0;
    width: 100%;
    /* 100% needed for custom width from outside */
  }
  /*
   * Ensure elements with hidden attribute to be actually not visible
   * @see https://meowni.ca/hidden.is.a.lie.html
   */
  [hidden] {
    display: none !important;
  }
  .badge-text-hint {
    background-color: lightgray;
    color: black;
  }
}
@layer kol-global {
  :host {
    font-size: calc(16rem / var(--kolibri-root-font-size, 16));
    /*
     * The max-width is needed to prevent the table from overflowing the
     * parent node, if the table is wider than the parent node.
     */
    max-width: 100%;
  }
  * {
    /*
     * We prefer to box-sizing: border-box for all elements.
     */
    box-sizing: border-box;
  }
  .kol-span {
    /* KolSpan is a layout component with icons in all directions and a label text in the middle. */
    display: grid;
    place-items: center;
    /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */
  }
  .kol-span__container {
    display: flex;
    place-items: center;
  }
  a,
  button {
    cursor: pointer;
  }
  .kol-span .kol-span__label--hide-label .kol-span__label {
    display: none;
  }
  /* Reset browser agent style. */
  button:disabled {
    color: unset;
  }
  .disabled label,
  .disabled:focus-within label,
  [aria-disabled=true],
  [aria-disabled=true]:focus,
  [disabled],
  [disabled]:focus {
    cursor: not-allowed;
    opacity: 0.5;
    outline: none;
  }
  [aria-disabled=true]:focus .kol-span,
  [disabled]:focus .kol-span {
    outline: none !important;
  }
}
@layer kol-component {
  .kol-progress__bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "LABEL LABEL LABEL" "BAR VALUE UNIT";
    align-items: center;
    column-gap: 0.05rem;
  }
  .kol-progress__bar-label {
    grid-column-end: 2;
    grid-area: LABEL;
  }
  .kol-progress__bar svg {
    grid-area: BAR;
  }
  .kol-progress__bar-value {
    grid-area: VALUE;
    text-align: right;
  }
  .kol-progress__bar-unit {
    grid-area: UNIT;
  }
  .kol-progress__bar-border {
    fill: transparent;
    stroke: black;
  }
  .kol-progress__bar-background {
    fill: lightgray;
    stroke: white;
  }
  .kol-progress__bar-progress {
    fill: #0075ff;
    stroke: transparent;
  }
  @media (prefers-reduced-motion: no-preference) {
    .kol-progress__bar-progress {
      transition: 250ms ease-in-out 50ms;
    }
  }
  .kol-progress__cycle {
    display: grid;
    grid-template-columns: auto;
    grid-template-areas: "ALL";
    justify-items: center;
    align-content: center;
  }
  .kol-progress__cycle > * {
    grid-area: ALL;
  }
  .kol-progress__cycle-text {
    text-align: center;
    display: flex;
    justify-content: center;
    flex-direction: column;
    font-size: x-small;
  }
  .kol-progress__cycle-text * {
    background-color: white;
  }
  .kol-progress__cycle-background {
    fill: transparent;
    stroke: lightgray;
  }
  .kol-progress__cycle-border {
    fill: transparent;
    stroke: black;
  }
  .kol-progress__cycle-whitespace {
    fill: transparent;
    stroke: white;
  }
  .kol-progress__cycle-progress {
    fill: transparent;
    stroke: #0075ff;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
  }
  @media (prefers-reduced-motion: no-preference) {
    .kol-progress__cycle-progress {
      transition: 250ms ease-in-out 50ms;
    }
  }
}`,s=Object.keys(c),u=({state:e})=>t("svg",{width:"100",viewBox:"0 0 120 120",xmlns:"http://www.w3.org/2000/svg"},t("circle",{class:"kol-progress__cycle-background",cx:"60",cy:"60",r:"54.5",fill:"currentColor",stroke:"currentColor","stroke-width":"8"}),t("circle",{class:"kol-progress__cycle-whitespace",cx:"60",cy:"60",r:"59",fill:"currentColor",stroke:"currentColor","stroke-width":"3"}),t("circle",{class:"kol-progress__cycle-border",cx:"60",cy:"60",r:"59",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"kol-progress__cycle-whitespace",cx:"60",cy:"60",r:"51",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"kol-progress__cycle-border",cx:"60",cy:"60",r:"50",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"kol-progress__cycle-progress",fill:"currentColor",stroke:"currentColor","stroke-linecap":"round","stroke-dasharray":`${Math.round(e._value/e._max*342)}px 342px`,"stroke-width":"6",cx:"60",cy:"60",r:"54.5"})),b=({state:e})=>{const n=100*(e._value/e._max);return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"12",overflow:"visible"},t("rect",{class:"kol-progress__bar-background",x:"1",y:"1",height:"11",rx:"5",fill:"currentColor",stroke:"currentColor","stroke-width":"3",width:"100%"}),t("rect",{class:"kol-progress__bar-border",x:"1",y:"1",height:"11",rx:"5",fill:"currentColor",stroke:"currentColor","stroke-width":"1",width:"100%"}),t("rect",{class:"kol-progress__bar-progress",x:"3",y:"3",height:"7",rx:"3.5",fill:"currentColor",stroke:"currentColor","stroke-width":"3",style:{width:`calc(${n}% - 4px)`}}))},p=e=>{switch(e._variant){case"cycle":return t(u,{state:e});case"bar":return t(b,{state:e});default:throw new Error(`Progress variant ${e._variant} not implemented.`)}},_=class{constructor(e){i(this,e),this._unit="%",this.state={_max:100,_unit:"%",_value:0,_variant:"bar",_liveValue:0}}render(){const e=this.state._unit==="%",n=e?`${Math.round(this.state._liveValue/this.state._max*100)}`:this.state._liveValue,r=e?Math.round(this.state._value/this.state._max*100):this.state._value;return t("div",{key:"821bf1d4fece816591e8b567cf2026b44eb4b278",class:"kol-progress"},t("div",{key:"59bcae97c107e7b369ceb28a96b70215cfff498b","aria-hidden":"true",class:{"kol-progress__cycle":this.state._variant==="cycle","kol-progress__bar":this.state._variant==="bar"}},this.state._variant==="bar"&&this.state._label&&t("div",{key:"72598c6fb849503f400b75fdb3789673c580886e",class:"kol-progress__bar-label"},this.state._label),p(this.state),this.state._variant==="cycle"&&t("div",{key:"18c2541fe253d1c823734d845122827e2953a04e",class:"kol-progress__cycle-text"},this.state._label&&t("div",{key:"74c81b2090e32b4d9eaa16636cb9c5c5114c46ad",class:"kol-progress__cycle-label"},this.state._label),t("div",{key:"3a32c98fca4adc2658c36ec72249f297dc1175c3",class:"kol-progress__cycle-value"},`${r} ${this.state._unit}`)),this.state._variant==="bar"&&t("div",{key:"4fc52d6d486fc97becfb8d1a45a1ba98975abafd",class:"kol-progress__bar-value",style:{width:`${`${(e?100:this.state._max)+1}`.length}ch`}},r),this.state._variant==="bar"&&t("div",{key:"a21584bb20a71bc0931a08e7d98ed358748c4685",class:"kol-progress__bar-unit"},this.state._unit)),t("progress",{key:"de96c7da155a8b40d393601abfd8854c4b195a68",class:"visually-hidden","aria-busy":this.state._value<this.state._max?"true":"false",max:this.state._max,value:this.state._value}),t("span",{key:"85870eee4599c14b3124f211539fecbdfa605dab","aria-live":"polite","aria-relevant":"removals text",class:"visually-hidden"},e?`${n} %`:`${n} von ${this.state._max} ${this.state._unit}`))}validateLabel(e){d(this,e)}validateMax(e){typeof e!="number"&&(e=100),a(this,"_max",e,{required:!0})}validateUnit(e){l(this,"_unit",e)}validateValue(e){typeof e!="number"&&(e=0),a(this,"_value",e,{required:!0})}validateVariant(e){o(this,"_variant",n=>typeof n=="string"&&s.includes(n),new Set(s),e)}componentWillLoad(){this.validateLabel(this._label),this.validateMax(this._max),this.validateUnit(this._unit),this.validateValue(this._value),this.validateVariant(this._variant),this.state=Object.assign(Object.assign({},this.state),{_liveValue:this.state._value}),this.interval=setInterval(()=>{this.state._liveValue!==this.state._value&&(this.state=Object.assign(Object.assign({},this.state),{_liveValue:this.state._value}))},5e3)}disconnectedCallback(){clearInterval(this.interval)}static get watchers(){return{_label:["validateLabel"],_max:["validateMax"],_unit:["validateUnit"],_value:["validateValue"],_variant:["validateVariant"]}}};_.style={default:h};export{_ as kol_progress};
//# sourceMappingURL=kol-progress.entry-BPAxSPqW.js.map
