import{r as s,h as t,H as l,B as i,t as o,w as c,a7 as d}from"./index-BeCeuELg.js";import{v as h}from"./label-3757689e-D7ErDa5R.js";const u=`/*
 * This file contains all rules for accessibility.
 */
@layer kol-a11y {
  :host {
    /*
     * Minimum size of interactive elements.
     */
    --a11y-min-size: calc(44rem / var(--kolibri-root-font-size, 16));
    color: black;
    /*
     * 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;
    /*
     * 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;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  * {
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    hyphens: auto;
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    word-break: break-word;
  }
  /*
   * All interactive elements should have a minimum size of rem(44).
   */
  /* input:not([type='checkbox'], [type='radio'], [type='range']), */
  /* option, */
  /* select, */
  /* textarea, */
  button,
  .kol-input .input {
    min-width: var(--a11y-min-size);
    min-height: 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;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: 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 {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }
}
@layer kol-global {
  /*
   * Dieses CSS stellt sicher, dass der Standard-Style
   * von A und Button resettet werden.
   */
  :is(a, button) {
    background-color: transparent;
    width: 100%; /* 100% needed for custom width from outside */
    margin: 0;
    padding: 0;
    border: none;
  }
  /*
   * Ensure elements with hidden attribute to be actually not visible
   * @see https://meowni.ca/hidden.is.a.lie.html
   */
  [hidden] {
    display: none !important;
  }
}
@layer kol-global {
  :host {
    /*
     * 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%;
    font-size: calc(16rem / var(--kolibri-root-font-size, 16));
  }
  * {
    /*
     * We prefer to box-sizing: border-box for all elements.
     */
    box-sizing: border-box;
  }
  /* KolSpan is a layout component with icons in all directions and a label text in the middle. */
  .kol-span-wc {
    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-wc > span {
    display: flex;
    place-items: center;
  }
  a,
  button {
    cursor: pointer;
  }
  /* This is the text label. */
  .hide-label > .kol-span-wc > span > span {
    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 {
    opacity: 0.5;
    outline: none;
    cursor: not-allowed;
  }
  [aria-disabled=true]:focus .kol-span-wc,
  [disabled]:focus .kol-span-wc {
    outline: none !important;
  }
  .badge-text-hint {
    color: black;
    background-color: lightgray;
  }
}
@layer kol-component {
  .bar {
    display: grid;
    column-gap: 0.05rem;
    align-items: center;
    grid-template-areas: "LABEL LABEL LABEL" "BAR VALUE UNIT";
    grid-template-columns: 1fr auto;
  }
  .bar .label {
    grid-column-end: 2;
    grid-area: LABEL;
  }
  .bar svg {
    grid-area: BAR;
  }
  .bar .value {
    grid-area: VALUE;
    text-align: right;
  }
  .bar .unit {
    grid-area: UNIT;
  }
  .bar .border {
    fill: transparent;
    stroke: black;
  }
  .bar .background {
    fill: lightgray;
    stroke: white;
  }
  .bar .progress {
    fill: #0075ff;
    stroke: transparent;
    transition: 250ms ease-in-out 50ms;
  }
  .cycle {
    display: grid;
    align-content: center;
    justify-items: center;
    grid-template-areas: "ALL";
    grid-template-columns: auto;
  }
  .cycle > * {
    grid-area: ALL;
  }
  .cycle .text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: x-small;
    text-align: center;
  }
  .cycle .text * {
    background-color: white;
  }
  .cycle .background {
    fill: transparent;
    stroke: lightgray;
  }
  .cycle .border {
    fill: transparent;
    stroke: black;
  }
  .cycle .whitespace {
    fill: transparent;
    stroke: white;
  }
  .cycle .progress {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    fill: transparent;
    stroke: #0075ff;
    transition: 250ms ease-in-out 50ms;
  }
  /* https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion */
  @media (prefers-reduced-motion) {
    .progress {
      transition-delay: 0s;
      transition-duration: 0s;
    }
  }
}`,b=u,r=Object.keys(d),f=({state:e})=>t("svg",{width:"100",viewBox:"0 0 120 120",xmlns:"http://www.w3.org/2000/svg"},t("circle",{class:"background",cx:"60",cy:"60",r:"54.5",fill:"currentColor",stroke:"currentColor","stroke-width":"8"}),t("circle",{class:"whitespace",cx:"60",cy:"60",r:"59",fill:"currentColor",stroke:"currentColor","stroke-width":"3"}),t("circle",{class:"border",cx:"60",cy:"60",r:"59",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"whitespace",cx:"60",cy:"60",r:"51",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"border",cx:"60",cy:"60",r:"50",fill:"currentColor",stroke:"currentColor","stroke-width":"1"}),t("circle",{class:"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"})),p=({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:"background",x:"1",y:"1",height:"11",rx:"5",fill:"currentColor",stroke:"currentColor","stroke-width":"3",style:{width:"100%"}}),t("rect",{class:"border",x:"1",y:"1",height:"11",rx:"5",fill:"currentColor",stroke:"currentColor","stroke-width":"1",style:{width:"100%"}}),t("rect",{class:"progress",x:"3",y:"3",height:"7",rx:"3.5",fill:"currentColor",stroke:"currentColor","stroke-width":"3",style:{width:`calc(${n}% - 4px)`}}))},m=e=>{switch(e._variant){case"cycle":return t(f,{state:e});case"bar":return t(p,{state:e});default:throw new Error(`Progress variant ${e._variant} not implemented.`)}},g=class{constructor(e){s(this,e),this._label=void 0,this._max=void 0,this._unit="%",this._value=void 0,this._variant=void 0,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,a=e?Math.round(this.state._value/this.state._max*100):this.state._value;return t(l,{key:"f60db7145824605284463ebed50375fe16437977",class:"kol-progress"},t("div",{key:"4e4621d716484942ce91307f95ebe267ffcfc5a8","aria-hidden":"true",class:{cycle:this.state._variant==="cycle",bar:this.state._variant==="bar"}},this.state._variant==="bar"&&this.state._label&&t("div",{key:"63494a0fe3de04a7a10b12423a5387833c298419",class:"label"},this.state._label),m(this.state),this.state._variant==="cycle"&&t("div",{key:"061731318ad475b919b208b61ef04b5ce9eb669f",class:"text"},this.state._label&&t("div",{key:"4db3c052decc2e86431acb8a662a39573aed5936",class:"label"},this.state._label),t("div",{key:"69f726ab53b2c93bccd4dd9590e7339570acc75b",class:"value"},`${a} ${this.state._unit}`)),this.state._variant==="bar"&&t("div",{key:"ba795fbad1a28ec944230c8c1cc9cc53e83b93c8",class:"value",style:{width:`${`${(e?100:this.state._max)+1}`.length}ch`}},a),this.state._variant==="bar"&&t("div",{key:"90f055da87f99b3d5fc4dc0d9e5219286c31472b",class:"unit"},this.state._unit)),t("progress",{key:"4d1ac0743b3a6a6f6c443db0197805528d213843","aria-busy":this.state._value<this.state._max?"true":"false",class:"visually-hidden",max:this.state._max,value:this.state._value}),t("span",{key:"dc796c59ba6a4a2508b55a69a6fee846a0ea8882","aria-live":"polite","aria-relevant":"removals text",class:"visually-hidden"},e?`${n} %`:`${n} von ${this.state._max} ${this.state._unit}`))}validateLabel(e){h(this,e)}validateMax(e){typeof e!="number"&&(e=100),i(this,"_max",e,{required:!0})}validateUnit(e){o(this,"_unit",e)}validateValue(e){typeof e!="number"&&(e=0),i(this,"_value",e,{required:!0})}validateVariant(e){c(this,"_variant",n=>typeof n=="string"&&r.includes(n),new Set(r),e)}componentWillLoad(){this.validateLabel(this._label),this.validateMax(this._max),this.validateUnit(this._unit),this.validateValue(this._value),this.validateVariant(this._variant),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"]}}};g.style={default:b};export{g as kol_progress};
//# sourceMappingURL=kol-progress.entry-BNF7Lsfm.js.map
