'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-58ea899e.js');
const component = require('./component-1e352960.js');
const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
const componentUsageRuntimeMetrics = require('./component-usage-runtime-metrics-4572c5b7.js');
const accessibility = require('./accessibility-bfa227f6.js');
const eventEmitSlimmer = require('./event-emit-slimmer-bcb458b2.js');
const vegaEventId = require('./vega-event-id-c08ce3d3.js');
const changeManager = require('./change-manager-a297e4d2.js');
const staticSubjectTitle = require('./static-subject-title-5829a298.js');
const subStateObserverSlimmer = require('./sub-state-observer-slimmer-b8f6f27b.js');
const vegaInternalEventId = require('./vega-internal-event-id-87014e4f.js');
const ui = require('./ui-ae4ee13d.js');
const observer = require('./observer-f49483e8.js');
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-9110cb94.js');
const childNodesEventPreventSlimmer = require('./child-nodes-event-prevent-slimmer-9b7095a4.js');
const childNodesNotifyObserverSlimmer = require('./child-nodes-notify-observer-slimmer-2631c381.js');
const subStateNotifySlimmer = require('./sub-state-notify-slimmer-b33171b0.js');
const formFieldControllerSlimmer = require('./form-field-controller-slimmer-0f3a028e.js');
const requiredFieldRule = require('./required-field-rule-d73c1d8c.js');
require('./dynamic-slimmer-f31fdfd7.js');
require('./internal-vega-event-manager-fef893bf.js');
require('./try-get-document-c0ebd39a.js');
require('./vega-env-manager-23b8b23c.js');
require('./feature-flag-controller-9129ef52.js');
require('./index-f054eb5d.js');
require('./string-39438062.js');
require('./misc-3d30df91.js');
require('./internal-translation-controller-fb1532f4.js');
require('./index-592b4052.js');
require('./page-resize-observer-slimmer-273d62ef.js');
require('./breakpoints-1cc2c4c6.js');
require('./ui-32120990.js');
require('./breakpoints-ebde4837.js');
require('./internal-form-field-validation-rule.abstract-07cdff46.js');
require('./mutation-observer-slimmer-749d5020.js');
require('./mutation-observer-filters-38cebc6d.js');
require('./array-249289f2.js');
require('./number-4816603d.js');

var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class VegaSelectionTileRenderer extends globalSlimmerRegistry.VegaSlimmer {
  getSelectorContainerRef() {
    return this.selectorContainerRef;
  }
  render() {
    return (index.h("vega-flex", { "align-items": "start", "justify-content": "start", gap: "size-16", class: {
        'selection-tile': true,
        'disabled': this.disabled,
        'checked': this.checked,
        'error': this.showError,
      }, "aria-label": this.titleText || 'No label defined', tabIndex: this.disabled ? -1 : 0, 
      /* eslint-disable-next-line react/jsx-no-bind */
      onClick: () => {
        if (!(this.selectType === 'radio' && this.checked)) {
          this.checkedController.onCheck(!this.checked);
        }
      }, onKeyDown: accessibility.createEnterKeyHandlerToTriggerClick() },
      index.h("div", { class: "vega-flex-grow" }, this.renderContent()),
      this.renderSelect()));
  }
  renderContent() {
    if (this.hasContentSlot()) {
      return index.h("slot", { name: "content" });
    }
    else {
      return (index.h("vega-flex", { gap: "size-12" },
        index.h("vega-flex", { class: "vega-flex-shrink-0" }, this.renderPrefixIcon()),
        index.h("div", { class: "vega-flex-grow" }, this.renderText())));
    }
  }
  renderPrefixIcon() {
    if (this.hasPrefixSlot()) {
      return index.h("slot", { name: "prefix" });
    }
    else if (this.prefixIcon) {
      return (index.h("vega-icon", { icon: this.prefixIcon, size: "size-16", color: this.disabled ? 'text-secondary' : 'text-primary', class: "selection-tile-icon" }));
    }
  }
  renderText() {
    return (index.h("vega-flex", { class: "vega-flex-grow", direction: "col", "align-items": "start", "justify-content": "start" },
      index.h("div", { class: "selection-tile-title" }, this.titleText),
      this.note && index.h("div", { class: "selection-tile-note" }, this.note)));
  }
  renderSelect() {
    return (index.h("vega-flex", { "align-items": "start", class: "vega-flex-shrink-0 selection-tile-select", ref: (ref) => (this.selectorContainerRef = ref) }, this.selectType === 'checkbox' ? this.renderCheckbox() : this.renderRadio()));
  }
  renderCheckbox() {
    return index.h("vega-checkbox", { size: "small", disabled: this.disabled, checked: this.checked });
  }
  renderRadio() {
    return index.h("vega-radio", { size: "small", disabled: this.disabled, checked: this.checked });
  }
  hasPrefixSlot() {
    return this.host.querySelector(`[slot=prefix]`) !== null;
  }
  hasContentSlot() {
    return this.host.querySelector(`[slot=content]`) !== null;
  }
}
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "host", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "prefixIcon", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "titleText", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "note", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "selectType", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "disabled", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "checked", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "showError", void 0);
__decorate$8([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileRenderer.prototype, "checkedController", void 0);

var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The `VegaSelectionTileCheckedController` class in TypeScript manages the checked state of
 * a selection tile component.
 */
class VegaSelectionTileCheckedController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * The function `setChecked` in TypeScript sets the `checked` property to the specified boolean value.
   *
   * @param {boolean} checked - The `checked` parameter is a boolean value that determines whether an
   * item is selected or not. It is used in the `setChecked` method to update the `checked` property of
   * an object to the specified boolean value.
   */
  setChecked(checked) {
    this.checked = checked;
  }
  /**
   * The `onCheck` function in TypeScript updates the value, emits a change event, and notifies the
   * change manager based on the checked status.
   *
   * @param {boolean} checked - The `checked` parameter is a boolean value that indicates whether a
   * checkbox or a similar input element is checked or not.
   */
  onCheck(checked) {
    const value = checked ? this.value : '';
    this.checked = checked;
    this.changeEventEmitter.emit(value);
    changeManager.ChangeManager.notify(staticSubjectTitle.SELECTION_TILE_VALUE_CHANGE, {
      host: this.host,
      detail: {
        checked: checked,
        value: this.value,
      },
    });
  }
}
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "host", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileCheckedController.prototype, "checked", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "changeEventEmitter", void 0);
__decorate$7([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileCheckedController.prototype, "value", void 0);

var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The `VegaSelectionTileStateController` class is a TypeScript class that observes and manages
 * the state of a `HTMLVegaSelectionTileElement` component.
 */
class VegaSelectionTileStateController extends subStateObserverSlimmer.SubStateObserverSlimmer {
  // eslint-disable-next-line jsdoc/require-jsdoc
  constructor() {
    super({
      parent: 'vega-selection-tile-group',
      subStates: [
        {
          subStateName: 'selectType',
          parentStateName: 'selectType',
        },
        {
          subStateName: 'disabled',
          parentStateName: 'disabled',
          /**
           * If group defined disabled property we should synchronize this value,
           * 		otherwise keep the disabled value in selection tile unchanged.
           *
           * @param {Nullable<boolean>} groupDisabled - Disabled value in parent selection tile group.
           */
          callback: (groupDisabled) => {
            if (typeof groupDisabled === 'boolean') {
              this.disabled = groupDisabled;
            }
          },
        },
        {
          subStateName: 'checked',
          parentStateName: 'value',
          /**
           * Synchronize checked status according by the value from parent selection tile group.
           *
           * @param {string | string[]} groupValue - The value from parent selection tile group.
           */
          callback: (groupValue) => {
            this.checkedController.setChecked(Array.isArray(groupValue)
              ? groupValue.includes(this.value)
              : groupValue === this.value);
          },
        },
        {
          subStateName: 'distributeEvenly',
          parentStateName: 'distributeEvenly',
        },
      ],
    });
  }
}
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileStateController.prototype, "host", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileStateController.prototype, "selectType", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileStateController.prototype, "disabled", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileStateController.prototype, "checked", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileStateController.prototype, "value", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileStateController.prototype, "checkedController", void 0);
__decorate$6([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileStateController.prototype, "distributeEvenly", void 0);

var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The `VegaSelectionTileShowErrorController` class is responsible for managing
 * the display of error messages in Vega selection tiles based on field error observations.
 */
class VegaSelectionTileShowErrorController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * Component lifecycle - [connectedCallback]{@link VegaSelectionTile.connectedCallback}
   */
  connectedCallback() {
    this.selectionTileGroup = ui.findParent(this.host, 'vega-selection-tile-group');
    this.fieldErrorObserver = new observer.Observer(this.canAcceptFieldErrorObserver.bind(this), this.fieldErrorObserverListener.bind(this));
    changeManager.ChangeManager.register(domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubject(this.selectionTileGroup || this.host, vegaInternalEventId.VegaInternalFieldErrorStateChange), this.fieldErrorObserver);
  }
  /**
   * Component lifecycle - [disconnectedCallback]{@link VegaSelectionTile.disconnectedCallback}
   */
  disconnectedCallback() {
    changeManager.ChangeManager.unregister(domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubject(this.selectionTileGroup, vegaInternalEventId.VegaInternalFieldErrorStateChange), this.fieldErrorObserver);
  }
  /**
   * The function `canAcceptFieldErrorObserver` always returns `true`.
   *
   * @returns {boolean} a boolean value, which indicates the current host is a checkbox or checkbox group.
   */
  canAcceptFieldErrorObserver() {
    return true;
  }
  /**
   * The function listens to the showError property of the returned object.
   *
   * @param {FieldErrorPayload} payload - The payload parameter is of type FieldErrorPayload, which is an object containing information about field.
   */
  fieldErrorObserverListener(payload) {
    this.showError = payload.showError;
  }
}
__decorate$5([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileShowErrorController.prototype, "showError", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileShowErrorController.prototype, "host", void 0);
__decorate$5([
  globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
], VegaSelectionTileShowErrorController.prototype, "connectedCallback", null);
__decorate$5([
  globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
], VegaSelectionTileShowErrorController.prototype, "disconnectedCallback", null);

const vegaSelectionTileCss = ":host::not(.distribute-evenly){display:block}:host(.distribute-evenly){display:flex;width:100%}:host(.distribute-evenly) .selection-tile{flex:1}:host{display:block}:host .selection-tile{padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;background-color:rgba(var(--v-bg-tile, 252, 252, 252, 1));color:rgba(var(--v-text-primary, 32, 54, 69, 1));cursor:pointer;margin:1px}:host .selection-tile:not(.disabled):hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1));background-color:rgba(var(--v-bg-tile-hover, 245, 247, 247, 1))}:host .selection-tile:not(.disabled):focus-visible{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-tile, 252, 252, 252, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host .selection-tile:not(.disabled).checked{background-color:rgba(var(--v-bg-tile-selected, 242, 247, 255, 1));border:2px solid rgba(var(--v-border-tile-selected, 19, 98, 226, 1));margin:0px}:host .selection-tile:not(.disabled).checked:hover{border:2px solid rgba(var(--v-border-tile-selected-hover, 4, 112, 236, 1));background-color:rgba(var(--v-bg-tile-selected-hover, 229, 239, 255, 1))}:host .selection-tile:not(.disabled).checked:focus-visible{border:2px solid rgba(var(--v-border-tile-selected, 19, 98, 226, 1));background-color:rgba(var(--v-bg-tile-selected, 242, 247, 255, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host .selection-tile:not(.disabled).error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1));background-color:rgba(var(--v-bg-tile, 252, 252, 252, 1))}:host .selection-tile:not(.disabled).error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1));background-color:rgba(var(--v-bg-tile-hover, 245, 247, 247, 1))}:host .selection-tile:not(.disabled).error:focus-visible{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1));background-color:rgba(var(--v-bg-tile, 252, 252, 252, 1));outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}:host .selection-tile.disabled{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));pointer-events:none}:host .selection-tile.disabled .selection-tile-title,:host .selection-tile.disabled .selection-tile-note{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}:host .selection-tile .selection-tile-title{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .selection-tile .selection-tile-title{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .selection-tile .selection-tile-title{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .selection-tile .selection-tile-title{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .selection-tile .selection-tile-note{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .selection-tile .selection-tile-note{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .selection-tile .selection-tile-note{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .selection-tile .selection-tile-note{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .selection-tile .selection-tile-icon{margin-top:4px;margin-bottom:4px}:host .selection-tile .selection-tile-select{height:24px}:host .selection-tile .selection-tile-select vega-checkbox,:host .selection-tile .selection-tile-select vega-radio{margin-top:4px}";

var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const VegaSelectionTile = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.vegaChange = index.createEvent(this, "vegaChange", 7);
    this.change = index.createEvent(this, "change", 7);
    this.globalSlimmers = {};
    this.renderer = new VegaSelectionTileRenderer();
    this.checkedController = new VegaSelectionTileCheckedController();
    this.stateController = new VegaSelectionTileStateController();
    this.showErrorController = new VegaSelectionTileShowErrorController();
    this.changeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaSelectionTile, vegaEventId.VegaChange);
    this.checkboxEventPrevent = new childNodesEventPreventSlimmer.ChildNodesEventPreventSlimmer([vegaEventId.VegaChange], () => this.renderer.getSelectorContainerRef());
    this.checkboxValueChangeObserver = new childNodesNotifyObserverSlimmer.ChildNodesNotifyObserverSlimmer(staticSubjectTitle.CHECKBOX_VALUE_CHANGE, (payload) => this.checkedController.onCheck(payload.detail));
    this.radioValueChangeObserver = new childNodesNotifyObserverSlimmer.ChildNodesNotifyObserverSlimmer(staticSubjectTitle.RADIO_VALUE_CHANGE, (payload) => {
      if (payload.detail) {
        this.checkedController.onCheck(payload.detail);
      }
    });
    this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer();
    /**
     * Indicates whether the parent selection tile group shows error message.
     */
    this.showError = false;
    /**
     * Distribute vega-selection-tile components evenly to always cover the entire available width of the parent
     */
    this.distributeEvenly = false;
    /**
     * Specifies the text content of the title displayed
     *    within the selection tile.
     *
     * @vegaVersion 2.7.0
     */
    this.titleText = '';
    /**
     * Determines if the selection tile is disabled.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.disabled = false;
    /**
     * Determines the selection method for the tile. Options are:
     *
     * - `radio`:
     *      Displays a radio button for selection.
     * - `checkbox`:
     *      Displays a checkbox for selection.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.selectType = 'radio';
  }
  render() {
    return component.sanitizeVegaComponent(index.h(index.Host, { class: { 'distribute-evenly': this.distributeEvenly } }, this.renderer.render()), this.host);
  }
  get host() { return index.getElement(this); }
};
__decorate$4([
  componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
], VegaSelectionTile.prototype, "globalSlimmers", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "renderer", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkedController", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "stateController", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "showErrorController", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "changeEventEmitter", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkboxEventPrevent", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "checkboxValueChangeObserver", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "radioValueChangeObserver", void 0);
__decorate$4([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTile.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
VegaSelectionTile.style = vegaSelectionTileCss;

var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
class VegaSelectionTileGroupRenderer extends globalSlimmerRegistry.VegaSlimmer {
  getGroupContainerRef() {
    return this.groupContainerRef;
  }
  render() {
    return (index.h("div", null,
      this.renderLabel(),
      this.renderContainer(),
      this.renderHint()));
  }
  renderLabel() {
    return (this.label && (index.h("div", { class: "vega-label" },
      index.h("label", { "aria-label": this.label },
        this.label,
        this.renderRequire()))));
  }
  renderRequire() {
    return this.required && index.h("span", { class: "vega-require" }, "*");
  }
  renderContainer() {
    return (index.h("div", { class: "container", ref: (e) => (this.groupContainerRef = e) },
      index.h("vega-flex", { direction: this.layout === 'horizontal' ? 'row' : 'col', gap: "size-12" },
        index.h("slot", { 
          /* eslint-disable-next-line react/jsx-no-bind */
          onSlotchange: 
          /**
           * The below method is e2e-test covered in
           * @see{module:vega-selection-tile-group-slot-change-e2e}
           */
          /* istanbul ignore next */
          () => this.itemsController.syncTileArrayAndValue() }))));
  }
  renderHint() {
    return (this.hint && (index.h("div", { class: "vega-hint" },
      index.h("label", null, this.hint))));
  }
}
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "host", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "label", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "required", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "hint", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "layout", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "selectType", void 0);
__decorate$3([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupRenderer.prototype, "itemsController", void 0);

var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The `VegaSelectionTileGroupValueController` class in TypeScript manages the value selection for
 * a group of checkboxes or radio buttons.
 */
class VegaSelectionTileGroupValueController extends globalSlimmerRegistry.VegaSlimmer {
  /**
   * The `watchValue` function emits a change event with the current value and notifies the
   * `ChangeManager` about a form element value change.
   */
  watchValue() {
    this.changeEventEmitter.emit(this.value);
    changeManager.ChangeManager.notify(staticSubjectTitle.FORM_ELEMENT_VALUE_CHANGE, {
      host: this.host,
      detail: this.value,
    });
  }
  /**
   * The function `onSelectionTilesChanged` determines whether to set the value from checkbox items or
   * radio items based on the selected type.
   */
  onSelectionTilesChanged() {
    this.selectType === 'checkbox' ? this.setValueFromCheckboxItems() : this.setValueFromRadioItems();
  }
  /**
   * The function `onSelectionTileChecked` checks the type of input and calls the appropriate function to set the value
   * based on the type (checkbox or radio).
   *
   * @param {VegaSelectionTileCheckedPayload} payload - The `value` parameter in the `onSelectionTileChecked` function is a string that represents
   * the value of the checkbox or radio button that was checked.
   */
  onSelectionTileChecked(payload) {
    this.selectType === 'checkbox' ? this.setValueFromCheckbox(payload) : this.setValueFromRadio(payload);
  }
  /**
   * The function `setValueFromCheckbox` updates the value array by adding or removing a specified value.
   *
   * @param {VegaSelectionTileCheckedPayload} payload - The `value` parameter in the `setValueFromCheckbox` function is a string
   * representing the value of a checkbox.
   */
  setValueFromCheckbox(payload) {
    if (payload.checked && !this.value.includes(payload.value)) {
      this.value = [...this.value, payload.value];
    }
    else if (!payload.checked && this.value.includes(payload.value)) {
      this.value = [...this.value.filter((value) => value !== payload.value)];
    }
  }
  /**
   * The function `setValueFromRadio` sets the value of a radio button in TypeScript.
   *
   * @param {VegaSelectionTileCheckedPayload} payload - The `value` parameter is a string that represents the value to be set for
   * the radio button.
   */
  setValueFromRadio(payload) {
    if (payload.checked) {
      this.value = payload.value;
    }
  }
  /**
   * The function `setValueFromCheckboxItems` sets the value of an element based on the checked items in
   * a selection tile array.
   */
  setValueFromCheckboxItems() {
    if (this.value.length === 0) {
      this.value = this.itemsController
        .getSelectionTileArray()
        .filter((tile) => tile.checked)
        .map((tile) => tile.value);
    }
  }
  /**
   * The function `setValueFromRadioItems` sets the value of a radio item based on the checked status of
   * the items.
   */
  setValueFromRadioItems() {
    if (!this.value) {
      const checkedItem = this.itemsController
        .getSelectionTileArray()
        .find((tile) => tile.checked);
      if (checkedItem) {
        this.value = checkedItem.value;
      }
    }
  }
}
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupValueController.prototype, "host", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField({ writable: true })
], VegaSelectionTileGroupValueController.prototype, "value", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupValueController.prototype, "selectType", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupValueController.prototype, "changeEventEmitter", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupValueController.prototype, "itemsController", void 0);
__decorate$2([
  globalSlimmerRegistry.MapToComponentMethod('watchValue')
], VegaSelectionTileGroupValueController.prototype, "watchValue", null);

var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The `VegaSelectionTileGroupItemsController` class manages an array of selection tiles within a
 * Vega selection tile group component.
 */
class VegaSelectionTileGroupItemsController extends globalSlimmerRegistry.VegaSlimmer {
  constructor() {
    super(...arguments);
    this.selectionTileArray = [];
  }
  /**
   * The function initializes an array of selection tiles by querying the host element for elements with
   * the tag 'vega-selection-tile'.
   */
  initSelectionTileArray() {
    this.syncTileArrayAndValue();
  }
  /**
   * The function `getSelectionTileArray` returns an array of HTMLVegaSelectionTileElement elements.
   *
   * @returns {HTMLVegaSelectionTileElement[]} An array of HTMLVegaSelectionTileElement elements is being returned.
   */
  getSelectionTileArray() {
    return this.selectionTileArray;
  }
  /**
   * The function syncTileArrayAndValue() populates an array with elements selected by a querySelectorAll
   * method and triggers a callback function on a value controller.
   */
  syncTileArrayAndValue() {
    this.selectionTileArray = Array.from(this.host.querySelectorAll('vega-selection-tile'));
    this.valueController.onSelectionTilesChanged();
  }
  /**
   * This function returns an array of HTML input elements based on the type of selection tile.
   *
   * @returns {HTMLInputElement[]} An array of HTMLInputElement elements is being returned.
   */
  touchableAreaGetter() {
    const selector = this.selectType === 'checkbox' ? 'vega-checkbox' : 'vega-radio';
    return this.selectionTileArray.map((tile) => tile.shadowRoot.querySelector(selector).shadowRoot.querySelector('input'));
  }
}
__decorate$1([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupItemsController.prototype, "host", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupItemsController.prototype, "selectType", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentField()
], VegaSelectionTileGroupItemsController.prototype, "valueController", void 0);
__decorate$1([
  globalSlimmerRegistry.MapToComponentMethod('componentWillLoad')
], VegaSelectionTileGroupItemsController.prototype, "initSelectionTileArray", null);

const vegaSelectionTileGroupCss = ":host{display:block;text-align:left;line-height:normal}:host .vega-error{display:block;margin-top:12px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-hidden{display:none}:host .vega-label{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px;margin-bottom:16px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-label{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-label{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-label{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:500;line-height:22px;letter-spacing:0px}}:host .vega-label label{color:rgba(var(--v-text-primary, 32, 54, 69, 1))}:host .vega-label .vega-require{color:rgba(var(--v-text-error, 189, 41, 71, 1));margin-left:4px}:host .vega-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));padding-top:12px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-hint{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}";

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const VegaSelectionTileGroup = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.vegaChange = index.createEvent(this, "vegaChange", 7);
    this.change = index.createEvent(this, "change", 7);
    this.globalSlimmers = {};
    this.renderer = new VegaSelectionTileGroupRenderer();
    this.itemsController = new VegaSelectionTileGroupItemsController();
    this.valueController = new VegaSelectionTileGroupValueController();
    this.formFieldController = new formFieldControllerSlimmer.FormFieldControllerSlimmer({
      propertyRules: [
        {
          propertyName: 'required',
          ruleFactory: (isRequired) => (isRequired ? new requiredFieldRule.RequiredFieldRule() : null),
        },
      ],
      validationRulesName: 'validationRules',
      inputContainerGetter: () => this.renderer.getGroupContainerRef(),
      touchableAreaGetter: () => this.itemsController.touchableAreaGetter(),
      defaultValue: (target) => (target.selectType === 'checkbox' ? [] : ''),
      attributeGetter: (propertyName) => this[propertyName],
    });
    this.changeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaSelectionTileGroup, vegaEventId.VegaChange);
    this.checkboxEventPrevent = new childNodesEventPreventSlimmer.ChildNodesEventPreventSlimmer([vegaEventId.VegaChange], () => this.renderer.getGroupContainerRef());
    this.selectionTileChangeObserver = new childNodesNotifyObserverSlimmer.ChildNodesNotifyObserverSlimmer(staticSubjectTitle.SELECTION_TILE_VALUE_CHANGE, (payload) => this.valueController.onSelectionTileChecked(payload.detail));
    this.selectTypeNotifySlimmer = subStateNotifySlimmer.createSubStateNotifySlimmer(VegaSelectionTileGroup, 'selectType', 'watchSelectType');
    this.disabledNotifySlimmer = subStateNotifySlimmer.createSubStateNotifySlimmer(VegaSelectionTileGroup, 'disabled', 'watchDisabled');
    this.valueNotifySlimmer = subStateNotifySlimmer.createSubStateNotifySlimmer(VegaSelectionTileGroup, 'value', 'watchValue');
    this.distributeEvenlyNotifySlimmer = subStateNotifySlimmer.createSubStateNotifySlimmer(VegaSelectionTileGroup, 'distributeEvenly', 'watchDistributeEvenly');
    this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer();
    /**
     * Specifies the label or title for the selection tile group.
     *    It provides descriptive text that helps identify
     *    the purpose of the selection tile group.
     *
     * @vegaVersion 2.7.0
     */
    this.label = '';
    /**
     * Distribute vega-selection-tile components evenly to always cover the entire available width of the vega-selection-tile-group
     *
     * @vegaVersion 2.58.0
     */
    this.distributeEvenly = false;
    /**
     * Determines the selection method for the tile group. Options are:
     *
     * - `radio`:
     *      Displays a radio button for selection.
     * - `checkbox`:
     *      Displays a checkbox for selection.
     *
     * @vegaVersion 2.7.0
     */
    this.selectType = 'radio';
    /**
     * Stores the selected values of the nested selection tiles
     *    within the selection tile group.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.value = this.selectType === 'checkbox' ? [] : '';
    /**
     * Controls the layout of the nested selection tiles
     *    within the selection tile group.
     *
     * @vegaVersion 2.7.0
     */
    this.layout = 'vertical';
    /**
     * Defines custom validation rules for the selection tile group field.
     *
     * @vegaVersion 2.7.0
     */
    this.validationRules = [];
    /**
     * Sets the validation status for the selection tile group.
     *
     * @vegaVersion 2.7.0
     */
    /* eslint-disable-next-line @stencil/strict-mutable */
    this.isValid = null;
  }
  watchDistributeEvenly() {
  }
  watchSelectType() {
  }
  watchValue() {
  }
  watchDisabled() {
  }
  watchValidationRules() {
  }
  render() {
    return component.sanitizeVegaComponent(index.h(index.Host, null, this.renderer.render()), this.host);
  }
  get host() { return index.getElement(this); }
  static get watchers() { return {
    "distributeEvenly": ["watchDistributeEvenly"],
    "selectType": ["watchSelectType"],
    "value": ["watchValue"],
    "disabled": ["watchDisabled"],
    "validationRules": ["watchValidationRules"]
  }; }
};
__decorate([
  componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
], VegaSelectionTileGroup.prototype, "globalSlimmers", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "renderer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "itemsController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "valueController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "formFieldController", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "changeEventEmitter", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "checkboxEventPrevent", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "selectionTileChangeObserver", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "selectTypeNotifySlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "disabledNotifySlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "valueNotifySlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "distributeEvenlyNotifySlimmer", void 0);
__decorate([
  globalSlimmerRegistry.InjectVegaSlimmer()
], VegaSelectionTileGroup.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
VegaSelectionTileGroup.style = vegaSelectionTileGroupCss;

exports.vega_selection_tile = VegaSelectionTile;
exports.vega_selection_tile_group = VegaSelectionTileGroup;
