import{h as a,r as f,g as v,w as d,t as c,s as g,m as p}from"./index-yJ8X--q8.js";import{c as r}from"./clsx-eK3rPvPS-BT_IL7Fz.js";import{n as _}from"./dev.utils-tIfWUJtH-D6CaU-xq.js";import{I as y}from"./controller-BUK8x0Dz-BOTwYD01.js";import{F as x,g as w,c as I,a as z}from"./getRenderStates-B4Xg8PG8-CdOczHfm.js";import{F as A}from"./FieldControlStateWrapper-DC7YlV6o-foHzOYZl.js";import{_ as s}from"./Heading-D_vnx163-UWSZHCcZ.js";import{K as F}from"./Icon-XldYcxyr-CesIFDsR.js";import{I as V}from"./Input-D27-m66t-DoBDfVtU.js";import"./isObject-DvSELytj-B0RigBxT.js";import"./Alert-DnD_hO6X-DpaZH47L.js";import"./i18n-H9CUbi---DysS2qV6.js";import"./label-D3d1qqIG-BD7RiEyC.js";import"./orientation-D3xx-ujZ-DK4pLh55.js";import"./access-and-short-key-CykHF9HL-6HKaguqV.js";import"./hide-label-DYRsvAHX-PflOO5bC.js";import"./tooltip-align-5cqqmpu7-BPcIsh4c.js";import"./align-tkanisJ7-pF0lTZGz.js";import"./associated.controller-ClhjBSrR-DMmQMFt9.js";import"./InternalUnderlinedBadgeText-Cy3ElU32-BKlO6_-s.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const h=["button","default","switch"],C=(e,n)=>{p(e,"_checked",n)},S=(e,n)=>{p(e,"_indeterminate",n)},u=["left","right"],j=(e,n)=>{d(e,"_labelAlign",t=>typeof t=="string"&&u.includes(t),new Set([`KoliBriLabelAlign {${u.join(", ")}`]),n)};class L extends y{constructor(n,t,o){super(n,t,o),this.setFormAssociatedCheckboxValue=l=>{this.component._checked?this.setFormAssociatedValue(l):this.setFormAssociatedValue(null)},this.component=n}validateChecked(n){C(this.component,n),this.setFormAssociatedCheckboxValue(this.component.state._value)}validateIcons(n){d(this.component,"_icons",t=>typeof t=="object"&&t!==null&&(c(t.checked,1)||c(t.indeterminate,1)||c(t.unchecked,1)),new Set(["InputCheckboxIcons"]),n,{hooks:{beforePatch:(t,o,l)=>{o.set("_icons",Object.assign(Object.assign({},l.state._icons),t))}}})}validateIndeterminate(n){S(this.component,n)}validateLabelAlign(n){j(this.component,n)}validateValue(n){g(this.component,"_value",n),this.setFormAssociatedCheckboxValue(this.component.state._value)}validateVariant(n){d(this.component,"_variant",t=>typeof t=="string"&&h.includes(t),new Set([`String {${h.join(", ")}`]),n)}componentWillLoad(){super.componentWillLoad(),this.validateChecked(this.component._checked),this.validateIcons(this.component._icons),this.validateIndeterminate(this.component._indeterminate),this.validateValue(this.component._value),this.validateVariant(this.component._variant),this.validateLabelAlign(this.component._labelAlign)}}const O=e=>{var{class:n}=e,t=s(e,["class"]);return a(F,Object.assign({class:r("kol-checkbox__icon",n)},t))},B=e=>{var{class:n}=e,t=s(e,["class"]);return a(V,Object.assign({class:r("kol-checkbox__input",n)},t,{type:"checkbox"}))},M=e=>{var n,{class:t,variant:o="default",icon:l,inputProps:i}=e,m=s(e,["class","variant","icon","inputProps"]);const k=z(i==null?void 0:i.msg,i==null?void 0:i.touched),b={[`kol-checkbox--variant-${o}`]:!0,"kol-checkbox--checked":i==null?void 0:i.checked,"kol-checkbox--indeterminate":i==null?void 0:i.indeterminate,"kol-checkbox--disabled":!!(i!=null&&i.disabled),"kol-checkbox--required":!!(i!=null&&i.required),"kol-checkbox--touched":!!(i!=null&&i.touched),[`kol-checkbox--${((n=i==null?void 0:i.msg)===null||n===void 0?void 0:n.type)||"error"}`]:!!k};return a("label",Object.assign({class:r("kol-checkbox",b,t)},m),a(O,{label:"",icons:l}),a(B,Object.assign({},i)))};function q(e,n={}){const{ariaDescribedBy:t}=w(e),o={id:e._id,hideLabel:e._hideLabel,label:e._label,value:e._value,accessKey:e._accessKey,disabled:e._disabled,name:e._name,ariaDescribedBy:t};return"_required"in e&&(o.required=e._required),"_checked"in e&&(o.checked=e._checked),"_indeterminate"in e&&(o.indeterminate=e._indeterminate),"_touched"in e&&(o.touched=e._touched),"_msg"in e&&(o.msg=I(e._msg)),Object.assign(Object.assign({},o),n)}const K=e=>{var{state:n,inputProps:t}=e,o=s(e,["state","inputProps"]);const l=(n==null?void 0:n._variant)||"default";return a(M,Object.assign({variant:l,inputProps:q(n,t)},o))},P=`/* 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 {
  :host {
    display: block;
  }
}
@layer kol-component {
  .kol-tooltip {
    contain: layout;
    display: contents;
  }
  .kol-tooltip__floating {
    animation-duration: 0.25s;
    animation-iteration-count: 1;
    animation-name: fadeInOpacity;
    animation-timing-function: ease-in;
    display: none;
    position: fixed;
    visibility: hidden;
    /* Avoid layout interference - see https://floating-ui.com/docs/computePosition */
    top: 0;
    left: 0;
    max-width: 90vw;
    max-height: 90vh;
    /* Can be used to specify the tooltip-width from the outside. Unset by default.  */
    width: var(--kol-tooltip-width);
  }
  .kol-tooltip__arrow {
    background-color: #fff;
    color: #000;
    height: calc(10rem / var(--kolibri-root-font-size, 16));
    position: absolute;
    transform: rotate(45deg);
    width: calc(10rem / var(--kolibri-root-font-size, 16));
    z-index: 999;
  }
  .kol-tooltip__content {
    background-color: #fff;
    color: #000;
    position: relative;
    z-index: 1000;
  }
  @keyframes fadeInOpacity {
    0% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }
}
@layer kol-component {
  .kol-form-field {
    display: grid;
  }
  .kol-form-field:not(.kol-form-field--disabled) .kol-form-field__label {
    cursor: pointer;
  }
  .kol-form-field--disabled .kol-form-field__label {
    opacity: 0.5;
  }
  .kol-form-field--required .kol-form-field__label-text::after {
    content: "*";
  }
  .kol-form-field--disabled .kol-form-field__hint {
    opacity: 0.5;
  }
  .kol-form-field--required .kol-form-field__tooltip .span-label::after {
    content: "*";
  }
}
@layer kol-component {
  .kol-field-control {
    min-height: var(--a11y-min-size);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "input label";
    grid-template-rows: auto;
    align-items: center;
    justify-content: left;
  }
  .kol-field-control:has(.kol-field-control__hint) {
    grid-template-columns: auto 1fr;
    grid-template-areas: "input label" "hint hint";
    grid-template-rows: auto auto;
  }
  .kol-field-control--label-align-left:not(.kol-field-control--hide-label) {
    grid-template-columns: 1fr auto;
    grid-template-areas: "label input";
    grid-template-rows: auto;
  }
  .kol-field-control--label-align-left:not(.kol-field-control--hide-label):has(.kol-field-control__hint) {
    grid-template-columns: 1fr auto;
    grid-template-areas: "label input" "hint hint";
    grid-template-rows: auto auto;
  }
  .kol-field-control__input {
    grid-area: input;
    display: flex;
    min-height: var(--a11y-min-size);
    align-items: center;
  }
  .kol-field-control__label {
    align-items: center;
    cursor: pointer;
    display: flex;
    flex-grow: 1;
    grid-area: label;
    min-height: var(--a11y-min-size);
  }
  .kol-field-control__label--visually-hidden {
    height: 0;
    margin: 0;
    padding: 0;
    visibility: hidden;
  }
  .kol-field-control__label-text::after {
    content: "";
  }
  .kol-field-control__tooltip .span-label::after {
    content: "";
  }
  .kol-field-control__hint {
    grid-area: hint;
  }
  .kol-field-control--disabled .kol-field-control__label {
    cursor: not-allowed;
    opacity: 0.5;
  }
  .kol-field-control--required .kol-field-control__label-text::after {
    content: "*";
  }
  .kol-field-control--required .kol-field-control__tooltip .span-label::after {
    content: "*";
  }
}
@layer kol-component {
  .kol-form-field {
    display: grid;
  }
  .kol-checkbox {
    align-items: center;
    cursor: pointer;
    display: flex;
    position: relative;
  }
  .kol-checkbox--disabled {
    cursor: not-allowed;
  }
  .kol-checkbox .kol-input {
    appearance: none;
    background-color: #fff;
    border-style: solid;
    border-width: 2px;
    cursor: inherit;
    margin: 0;
    transition: 0.5s;
  }
  .kol-checkbox .kol-input:before {
    content: "";
  }
  /**
   * Variant: Checkbox
   */
  .kol-checkbox--variant-default {
    height: var(--a11y-min-size);
    justify-content: center;
    position: relative;
    width: var(--a11y-min-size);
  }
  .kol-checkbox--variant-default .kol-icon {
    display: flex;
    inset: auto;
    position: absolute;
    z-index: 1;
    pointer-events: none;
  }
  .kol-checkbox--variant-default .kol-icon::part(icon) {
    display: none;
  }
  .kol-checkbox--variant-default .kol-input {
    width: calc(22rem / var(--kolibri-root-font-size, 16));
    height: calc(22rem / var(--kolibri-root-font-size, 16));
  }
  .kol-checkbox--variant-default.kol-checkbox--checked .kol-icon::part(icon), .kol-checkbox--variant-default.kol-checkbox--indeterminate .kol-icon::part(icon) {
    display: block;
  }
  /**
   * Variant: Switch
   */
  .kol-checkbox--variant-switch {
    position: relative;
  }
  .kol-checkbox--variant-switch .kol-input {
    display: inline-block;
    height: 1.7em;
    min-width: 3.2em;
    position: relative;
    width: 3.2em;
  }
  .kol-checkbox--variant-switch .kol-input::before {
    background-color: #000;
    height: 1.2em;
    left: calc(0.25em - (2rem / var(--kolibri-root-font-size, 16)));
    top: calc(0.25em - (2rem / var(--kolibri-root-font-size, 16)));
    position: absolute;
    transition: 0.5s;
    width: 1.2em;
  }
  .kol-checkbox--variant-switch .kol-input:checked::before {
    transform: translateX(1.5em);
  }
  .kol-checkbox--variant-switch .kol-input:indeterminate::before {
    transform: translateX(0.75em);
  }
  .kol-checkbox--variant-switch .kol-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    position: absolute;
    z-index: 1;
    top: 50%;
    left: calc(4rem / var(--kolibri-root-font-size, 16));
    transform: translate(0, -50%);
    transition: 0.5s;
    color: #000;
  }
  .kol-checkbox--variant-switch.kol-checkbox--checked .kol-icon {
    transform: translate(1.5em, -50%);
  }
  .kol-checkbox--variant-switch.kol-checkbox--indeterminate .kol-icon {
    transform: translate(0.75em, -50%);
  }
  /**
   * Variant: Button
   */
  .kol-checkbox--variant-button {
    width: var(--a11y-min-size);
  }
  .kol-checkbox--variant-button .kol-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--a11y-min-size);
    height: var(--a11y-min-size);
  }
}`,H=class{getModelValue(){return this._checked?this.state._value:null}async getValue(){return this.getModelValue()}async kolFocus(){var e;(e=this.inputRef)===null||e===void 0||e.focus()}getFormFieldProps(){return{state:this.state,class:r("kol-input-checkbox",{"kol-input-checkbox--checked":this.state._checked,"kol-input-checkbox--indeterminate":this.state._indeterminate,[`kol-input-checkbox--variant-${this.state._variant||"default"}`]:!0,[`kol-input-checkbox--label-align-${this.state._labelAlign||"right"}`]:!0}),tooltipAlign:this._tooltipAlign,"data-role":this.state._variant==="button"?"button":void 0,alert:this.showAsAlert(),renderNoTooltip:!0}}getFieldControlProps(){return{class:r("kol-input-checkbox__field-control",{"kol-input-checkbox__field-control--checked":this.state._checked,"kol-input-checkbox__field-control--indeterminate":this.state._indeterminate,[`kol-input-checkbox__field-control--variant-${this.state._variant||"default"}`]:!0}),state:this.state}}getInputProps(){return{state:this.state,icon:this.getIcon(),inputProps:Object.assign(Object.assign({class:r({"visually-hidden":this.state._variant==="button"}),ref:this.catchRef},this.controller.onFacade),{onInput:this.onInput,onChange:this.onChange,onFocus:e=>{this.controller.onFacade.onFocus(e),this.inputHasFocus=!0},onBlur:e=>{this.controller.onFacade.onBlur(e),this.inputHasFocus=!1},onClick:void 0})}}getIcon(){return this.state._indeterminate?this.state._icons.indeterminate:this.state._checked?this.state._icons.checked:this.state._icons.unchecked}render(){return a(x,Object.assign({key:"7c330c625df423783c9f9dd29f2c032408f8d50f"},this.getFormFieldProps(),{renderNoLabel:!0}),a(A,Object.assign({key:"52245f0424402b5c030c358ec1a0e1c177c23f1f"},this.getFieldControlProps(),{renderNoHint:!0}),a(K,Object.assign({key:"f0e91630ed979e2ec59bede5151c9640f31d5d84"},this.getInputProps()))))}constructor(e){f(this,e),this.catchRef=n=>{this.inputRef=n},this._checked=!1,this._hideMsg=!1,this._disabled=!1,this._hideLabel=!1,this._hint="",this._labelAlign="right",this._required=!1,this._tooltipAlign="top",this._touched=!1,this._value=!0,this._variant="default",this.state={_checked:!1,_hideMsg:!1,_icons:{checked:"codicon codicon-check",indeterminate:"codicon codicon-remove",unchecked:"codicon codicon-close"},_id:`id-${_()}`,_indeterminate:!1,_label:"",_value:!0,_variant:"default",_labelAlign:"right"},this.inputHasFocus=!1,this.onInput=n=>{this._checked=!this._checked,this._indeterminate=!1;const t=this.getModelValue();this.controller.onFacade.onInput(n,!1,t),this.controller.setFormAssociatedCheckboxValue(t)},this.onChange=n=>{this.controller.onFacade.onChange(n,this.getModelValue())},this.controller=new L(this,"checkbox",this.host)}showAsAlert(){return!!this.state._touched&&!this.inputHasFocus}validateAccessKey(e){this.controller.validateAccessKey(e)}validateChecked(e){this.controller.validateChecked(e)}validateDisabled(e){this.controller.validateDisabled(e)}validateHideMsg(e){this.controller.validateHideMsg(e)}validateHideLabel(e){this.controller.validateHideLabel(e)}validateHint(e){this.controller.validateHint(e)}validateIcons(e){this.controller.validateIcons(e)}validateId(e){this.controller.validateId(e)}validateIndeterminate(e){this.controller.validateIndeterminate(e)}validateLabel(e){this.controller.validateLabel(e)}validateLabelAlign(e){this.controller.validateLabelAlign(e)}validateMsg(e){this.controller.validateMsg(e)}validateName(e){this.controller.validateName(e)}validateOn(e){this.controller.validateOn(e)}validateRequired(e){this.controller.validateRequired(e)}validateShortKey(e){this.controller.validateShortKey(e)}validateSyncValueBySelector(e){this.controller.validateSyncValueBySelector(e)}validateTouched(e){this.controller.validateTouched(e)}validateValue(e){this.controller.validateValue(e)}validateVariant(e){this.controller.validateVariant(e)}componentWillLoad(){this._touched=this._touched===!0,this.controller.componentWillLoad()}static get delegatesFocus(){return!0}get host(){return v(this)}static get watchers(){return{_accessKey:["validateAccessKey"],_checked:["validateChecked"],_disabled:["validateDisabled"],_hideMsg:["validateHideMsg"],_hideLabel:["validateHideLabel"],_hint:["validateHint"],_icons:["validateIcons"],_id:["validateId"],_indeterminate:["validateIndeterminate"],_label:["validateLabel"],_labelAlign:["validateLabelAlign"],_msg:["validateMsg"],_name:["validateName"],_on:["validateOn"],_required:["validateRequired"],_shortKey:["validateShortKey"],_syncValueBySelector:["validateSyncValueBySelector"],_touched:["validateTouched"],_value:["validateValue"],_variant:["validateVariant"]}}};H.style={default:P};export{H as kol_input_checkbox};
//# sourceMappingURL=kol-input-checkbox.entry-H7y6taDX.js.map
