/**
 * Copyright Aquera Inc 2026
 *
 * This source code is licensed under the BSD-3-Clause license found in the
 * LICENSE file in the root directory of this source tree.
 */
import { __decorate } from "tslib";
import { html } from 'lit';
import { customElement, property, query, queryAll, state, } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { live } from 'lit/directives/live.js';
import { defaultValue } from '../internal/default-value';
import { FormControlController, validValidityState } from '../internal/form';
import { HasSlotController } from '../internal/slot';
import { watch } from '../internal/watch';
import NileElement from '../internal/nile-element';
import { KeyCode, Nile_Events } from '../internal/enum';
import { styles } from './nile-otp-input.css';
import { OtpInputMode, OtpInputType, OtpEnterKeyHint, OtpAutoComplete, OtpCellPattern, } from './nile-otp-input.enum';
import '../nile-form-help-text';
import '../nile-form-error-message';
/**
 * @summary OTP input renders a segmented set of cells but behaves like a single logical form control.
 * @tag nile-otp-input
 *
 * @slot label - The input label. Alternatively, use the `label` attribute.
 * @slot help-text - Helpful guidance text. Alternatively, use the `help-text` attribute.
 *
 * @event nile-input - Emitted whenever the OTP value changes from user input.
 * @event nile-change - Emitted whenever the OTP value changes from user input.
 * @event nile-complete - Emitted when all OTP cells are filled.
 * @event nile-focus - Emitted when focus enters the component.
 * @event nile-blur - Emitted when focus leaves the component.
 * @event nile-paste - Emitted when OTP text is pasted.
 * @event nile-invalid - Emitted when the control is invalid.
 *
 * @csspart form-control - Wrapper for label, input, and help/error content.
 * @csspart form-control-label - Label wrapper.
 * @csspart form-control-input - Input wrapper.
 * @csspart form-control-help-text - Help text wrapper.
 * @csspart form-control-error-message - Error message wrapper.
 * @csspart base - OTP cell container.
 * @csspart cell - Individual OTP cell.
 * @csspart separator - Separator element between cell groups.
 */
let NileOtpInput = class NileOtpInput extends NileElement {
    constructor() {
        super(...arguments);
        this.formControlController = new FormControlController(this, {
            assumeInteractionOn: [Nile_Events.NILE_BLUR, Nile_Events.NILE_INPUT],
        });
        this.hasSlotController = new HasSlotController(this, 'help-text', 'label');
        this.customValidationMessage = '';
        this.wasComplete = false;
        this.hasFocus = false;
        this.activeIndex = -1;
        this.cells = this.createCells('');
        /** The name of the input, submitted as a name/value pair with form data. */
        this.name = '';
        /** The current value of the OTP control. */
        this.value = '';
        /** The default value of the form control. Primarily used for resetting the form control. */
        this.defaultValue = '';
        /** Number of OTP cells. Values below 4 are clamped to 4. */
        this.length = 6;
        /** Restricts input to numeric digits when true. Overridden by `alphanumeric`. */
        this.numericOnly = true;
        /** Allows both letters and digits. When present, overrides `numeric-only`. */
        this.alphanumeric = false;
        /** The input's label. */
        this.label = '';
        this.helpText = '';
        this.errorMessage = '';
        /** Placeholder shown inside each OTP cell. */
        this.placeholder = '';
        /** Optional separator text rendered between configured OTP groups (for example "-"). */
        this.separator = '';
        /** Renders a separator after each N cells when `separator` is set. */
        this.separatorEvery = 0;
        /** Comma-separated zero-based cell indexes after which separators are rendered. */
        this.separatorPositions = '';
        /** Masks filled cells with dots, showing each character briefly while typing. */
        this.masked = false;
        /** Sets the input to a warning state, changing its visual appearance. */
        this.warning = false;
        /** Sets the input to an error state, changing its visual appearance. */
        this.error = false;
        /** Sets the input to a success state, changing its visual appearance. */
        this.success = false;
        /** Disables the control. */
        this.disabled = false;
        /** Makes the control readonly. */
        this.readonly = false;
        /**
         * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
         * to place the form control outside of a form and associate it with the form that has this `id`.
         */
        this.form = '';
        /** Makes this field required. */
        this.required = false;
        /** Indicates that the input should receive focus on page load. */
        this.autofocus = false;
        /** The autocomplete mode used on the first OTP cell. */
        this.autocomplete = OtpAutoComplete.ONE_TIME_CODE;
    }
    connectedCallback() {
        super.connectedCallback();
        this.emit(Nile_Events.NILE_INIT);
    }
    disconnectedCallback() {
        super.disconnectedCallback();
        this.emit(Nile_Events.NILE_DESTROY);
    }
    firstUpdated() {
        const normalized = this.normalizeValue(this.value);
        if (normalized !== this.value) {
            this.value = normalized;
            return;
        }
        this.syncCellsFromValue(normalized);
        this.wasComplete = this.isComplete(normalized);
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
        if (this.autofocus) {
            this.focus();
        }
    }
    /** Gets the validity state object. */
    get validity() {
        return this.valueInput?.validity ?? validValidityState;
    }
    /** Gets the validation message. */
    get validationMessage() {
        return this.valueInput?.validationMessage ?? '';
    }
    /** Returns true when all OTP cells have values. */
    get complete() {
        return this.isComplete(this.value);
    }
    getNormalizedLength() {
        const parsed = Number.isFinite(this.length) ? Math.trunc(this.length) : 6;
        return Math.max(4, parsed);
    }
    isNumericMode() {
        return this.numericOnly && !this.alphanumeric;
    }
    getResolvedInputMode() {
        return this.inputmode ?? (this.isNumericMode() ? OtpInputMode.NUMERIC : OtpInputMode.TEXT);
    }
    getValidationPattern() {
        if (this.pattern) {
            return this.pattern;
        }
        const normalizedLength = this.getNormalizedLength();
        return this.isNumericMode()
            ? `[0-9]{${normalizedLength}}`
            : `[A-Za-z0-9]{${normalizedLength}}`;
    }
    isAllowedCharacter(char) {
        return this.isNumericMode() ? /^[0-9]$/.test(char) : /^[A-Za-z0-9]$/.test(char);
    }
    toOtpCharacters(value) {
        return Array.from(value ?? '').filter(char => this.isAllowedCharacter(char));
    }
    normalizeValue(value) {
        return this.toOtpCharacters(value ?? '')
            .slice(0, this.getNormalizedLength())
            .join('');
    }
    createCells(value) {
        const normalizedLength = this.getNormalizedLength();
        const normalizedChars = this.toOtpCharacters(value).slice(0, normalizedLength);
        return Array.from({ length: normalizedLength }, (_, index) => normalizedChars[index] ?? '');
    }
    syncCellsFromValue(value) {
        this.cells = this.createCells(value);
    }
    isComplete(value) {
        return value.length === this.getNormalizedLength();
    }
    getFirstEmptyIndex() {
        const index = this.cells.findIndex(char => char === '');
        return index === -1 ? this.getNormalizedLength() - 1 : index;
    }
    getSeparatorIndices() {
        const maxIndex = this.getNormalizedLength() - 2;
        const indices = new Set();
        if (Number.isInteger(this.separatorEvery) && this.separatorEvery > 0) {
            for (let index = this.separatorEvery - 1; index <= maxIndex; index += this.separatorEvery) {
                indices.add(index);
            }
        }
        if (this.separatorPositions.trim().length > 0) {
            this.separatorPositions
                .split(',')
                .map(value => Number.parseInt(value.trim(), 10))
                .filter(index => Number.isInteger(index) && index >= 0 && index <= maxIndex)
                .forEach(index => indices.add(index));
        }
        return indices;
    }
    getCellPlaceholder(index) {
        if (!this.placeholder || this.cells[index]) {
            return undefined;
        }
        if (this.activeIndex === -1) {
            return index === this.getFirstEmptyIndex() ? this.placeholder : undefined;
        }
        return index === this.activeIndex ? this.placeholder : undefined;
    }
    focusCell(index, options) {
        const input = this.cellInputs?.[index];
        if (input) {
            input.focus(options);
            input.select();
        }
    }
    updateCell(index, value) {
        const nextCells = [...this.cells];
        nextCells[index] = value;
        this.cells = nextCells;
    }
    fillFromIndex(startIndex, chars) {
        const nextCells = [...this.cells];
        let cursor = startIndex;
        for (const char of chars) {
            if (cursor >= nextCells.length) {
                break;
            }
            nextCells[cursor] = char;
            cursor += 1;
        }
        this.cells = nextCells;
        return cursor;
    }
    commitUserValueUpdate() {
        const previousValue = this.value;
        const nextValue = this.cells.join('');
        const isNowComplete = this.isComplete(nextValue);
        this.value = nextValue;
        this.valueInput.value = nextValue;
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
        this.emit(Nile_Events.NILE_INPUT, { value: nextValue, complete: isNowComplete });
        if (previousValue !== nextValue) {
            this.emit(Nile_Events.NILE_CHANGE, { value: nextValue, complete: isNowComplete });
        }
        if (isNowComplete && !this.wasComplete) {
            this.emit(Nile_Events.NILE_COMPLETE, { value: nextValue });
        }
        this.wasComplete = isNowComplete;
    }
    handleInvalid(event) {
        this.formControlController.setValidity(false);
        this.formControlController.emitInvalidEvent(event);
    }
    handleCellFocus(event) {
        const target = event.target;
        const index = Number(target.dataset.index ?? -1);
        const firstEmpty = this.getFirstEmptyIndex();
        if (index > firstEmpty) {
            this.focusCell(firstEmpty);
            return;
        }
        if (index < firstEmpty && !this.cells[index]) {
            this.focusCell(firstEmpty);
            return;
        }
        this.activeIndex = index;
        target.select();
        if (!this.hasFocus) {
            this.hasFocus = true;
            this.emit(Nile_Events.NILE_FOCUS, { value: this.value });
        }
    }
    handleCellBlur() {
        queueMicrotask(() => {
            const active = this.shadowRoot?.activeElement;
            const isInsideOtp = active instanceof HTMLInputElement &&
                active.classList.contains('otp__cell');
            if (!isInsideOtp && this.hasFocus) {
                this.hasFocus = false;
                this.activeIndex = -1;
                this.emit(Nile_Events.NILE_BLUR, { value: this.value });
            }
        });
    }
    handleCellInput(event) {
        const target = event.target;
        const index = Number(target.dataset.index ?? 0);
        if (this.disabled || this.readonly) {
            target.value = this.cells[index] ?? '';
            return;
        }
        const chars = this.toOtpCharacters(target.value);
        if (chars.length === 0) {
            this.updateCell(index, '');
            this.commitUserValueUpdate();
            return;
        }
        if (chars.length === 1) {
            this.updateCell(index, chars[0]);
            this.commitUserValueUpdate();
            const nextEmpty = this.getFirstEmptyIndex();
            this.focusCell(nextEmpty);
            return;
        }
        const nextCursor = this.fillFromIndex(index, chars);
        this.commitUserValueUpdate();
        const nextEmpty = this.getFirstEmptyIndex();
        this.focusCell(nextEmpty);
    }
    handleCellPaste(event) {
        if (this.disabled || this.readonly) {
            return;
        }
        const pasted = event.clipboardData?.getData('text') ?? '';
        const chars = this.toOtpCharacters(pasted);
        if (!chars.length) {
            return;
        }
        event.preventDefault();
        this.fillFromIndex(0, chars);
        this.commitUserValueUpdate();
        const nextEmpty = this.getFirstEmptyIndex();
        this.focusCell(nextEmpty);
        this.emit(Nile_Events.NILE_PASTE, { value: this.value });
    }
    handleCellKeyDown(event) {
        const hasModifier = event.metaKey || event.ctrlKey || event.altKey;
        const target = event.target;
        const index = Number(target.dataset.index ?? 0);
        if (event.key === KeyCode.ENTER && !hasModifier && !event.shiftKey) {
            setTimeout(() => {
                if (!event.defaultPrevented && !event.isComposing) {
                    this.formControlController.submit();
                }
            });
            return;
        }
        if (this.disabled || this.readonly) {
            return;
        }
        const isHandledKey = event.key === KeyCode.BACKSPACE ||
            event.key === KeyCode.DELETE ||
            event.key === KeyCode.ARROW_LEFT ||
            event.key === KeyCode.ARROW_RIGHT ||
            event.key === KeyCode.HOME ||
            event.key === KeyCode.END ||
            event.key === KeyCode.SPACE ||
            (event.key.length === 1 && !hasModifier);
        if (!isHandledKey) {
            return;
        }
        event.preventDefault();
        if (event.key === KeyCode.BACKSPACE) {
            if (this.cells[index]) {
                this.updateCell(index, '');
                this.commitUserValueUpdate();
                if (index > 0) {
                    this.focusCell(index - 1);
                }
                return;
            }
            if (index > 0) {
                this.updateCell(index - 1, '');
                this.commitUserValueUpdate();
                this.focusCell(index - 1);
            }
            return;
        }
        if (event.key === KeyCode.DELETE) {
            if (this.cells[index]) {
                this.updateCell(index, '');
                this.commitUserValueUpdate();
            }
            return;
        }
        if (event.key === KeyCode.ARROW_LEFT) {
            if (index > 0) {
                this.focusCell(index - 1);
            }
            return;
        }
        if (event.key === KeyCode.ARROW_RIGHT) {
            const firstEmpty = this.getFirstEmptyIndex();
            if (index < firstEmpty) {
                this.focusCell(index + 1);
            }
            return;
        }
        if (event.key === KeyCode.HOME) {
            this.focusCell(0);
            return;
        }
        if (event.key === KeyCode.END) {
            this.focusCell(this.getFirstEmptyIndex());
            return;
        }
        if (event.key === KeyCode.SPACE) {
            return;
        }
        if (event.key.length === 1 && !hasModifier && this.isAllowedCharacter(event.key)) {
            this.updateCell(index, event.key);
            this.commitUserValueUpdate();
            const nextEmpty = this.getFirstEmptyIndex();
            this.focusCell(nextEmpty);
        }
    }
    handleLengthChange() {
        const normalizedLength = this.getNormalizedLength();
        if (this.length !== normalizedLength) {
            this.length = normalizedLength;
            return;
        }
        const normalizedValue = this.normalizeValue(this.value);
        this.syncCellsFromValue(normalizedValue);
        if (normalizedValue !== this.value) {
            this.value = normalizedValue;
            return;
        }
        this.wasComplete = this.isComplete(normalizedValue);
        this.valueInput.value = normalizedValue;
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
    }
    handleValueChange() {
        const normalizedValue = this.normalizeValue(this.value);
        if (normalizedValue !== this.value) {
            this.value = normalizedValue;
            return;
        }
        this.syncCellsFromValue(normalizedValue);
        this.wasComplete = this.isComplete(normalizedValue);
        this.valueInput.value = normalizedValue;
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
    }
    handleDisabledChange() {
        if (this.disabled) {
            this.hasFocus = false;
            this.activeIndex = -1;
            this.formControlController.setValidity(true);
        }
        else {
            this.formControlController.updateValidity();
        }
    }
    handleNumericOnlyChange() {
        const normalizedValue = this.normalizeValue(this.value);
        if (normalizedValue !== this.value) {
            this.value = normalizedValue;
            return;
        }
        this.syncCellsFromValue(normalizedValue);
        this.wasComplete = this.isComplete(normalizedValue);
        this.valueInput.value = normalizedValue;
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
    }
    handlePatternChange() {
        this.valueInput.setCustomValidity(this.customValidationMessage);
        this.formControlController.updateValidity();
    }
    /** Checks validity without showing browser UI. */
    checkValidity() {
        return this.valueInput.checkValidity();
    }
    /** Returns associated form if one exists. */
    getForm() {
        return this.formControlController.getForm();
    }
    /** Checks validity and shows browser UI when invalid. */
    reportValidity() {
        return this.valueInput.reportValidity();
    }
    /** Sets a custom validation message. Pass empty string to restore validity. */
    setCustomValidity(message) {
        this.customValidationMessage = message;
        if (this.valueInput) {
            this.valueInput.setCustomValidity(message);
        }
        this.formControlController.updateValidity();
    }
    /** Focuses the first empty cell, or the last one when complete. */
    focus(options) {
        this.focusCell(this.getFirstEmptyIndex(), options);
    }
    /** Removes focus from whichever OTP cell is currently focused. */
    blur() {
        const active = this.shadowRoot?.activeElement;
        if (active instanceof HTMLElement) {
            active.blur();
        }
    }
    /** Clears all OTP cells. */
    clear() {
        if (this.disabled || this.readonly) {
            return;
        }
        this.cells = Array.from({ length: this.getNormalizedLength() }, () => '');
        this.commitUserValueUpdate();
        this.focusCell(0);
    }
    render() {
        const normalizedLength = this.getNormalizedLength();
        const separatorIndices = this.getSeparatorIndices();
        const hasLabelSlot = this.hasSlotController.test('label');
        const hasHelpTextSlot = this.hasSlotController.test('help-text');
        const hasLabel = Boolean(this.label || hasLabelSlot);
        const hasHelpText = Boolean(this.helpText || hasHelpTextSlot);
        const hasErrorMessage = Boolean(this.errorMessage);
        const describedBy = [
            hasHelpText ? 'help-text' : '',
            hasErrorMessage ? 'error-message' : '',
        ]
            .filter(Boolean)
            .join(' ');
        return html `
      <div
        part="form-control"
        class=${classMap({
            'form-control': true,
            'form-control--has-label': hasLabel,
        })}
      >
        <label
          id="label"
          part="form-control-label"
          class="form-control__label"
          aria-hidden=${hasLabel ? 'false' : 'true'}
        >
          <slot name="label">${this.label}</slot>
        </label>

        <div part="form-control-input" class="form-control-input">
          <div
            part="base"
            class=${classMap({
            otp: true,
            'otp--warning': this.warning,
            'otp--error': this.error,
            'otp--success': this.success,
            'otp--disabled': this.disabled,
            'otp--readonly': this.readonly,
        })}
            role="group"
            aria-labelledby=${ifDefined(hasLabel ? 'label' : undefined)}
            aria-label=${ifDefined(hasLabel ? undefined : 'One-time password')}
            aria-describedby=${ifDefined(describedBy || undefined)}
            aria-disabled=${this.disabled ? 'true' : 'false'}
          >
            ${Array.from({ length: normalizedLength }, (_, index) => {
            const value = this.cells[index] ?? '';
            return html `
                <input
                  part="cell"
                  class=${classMap({
                otp__cell: true,
                'otp__cell--active': this.activeIndex === index,
            })}
                  data-index=${index}
                  type=${this.masked && value && this.activeIndex !== index ? OtpInputType.PASSWORD : OtpInputType.TEXT}
                  maxlength="1"
                  .value=${live(value)}
                  ?disabled=${this.disabled}
                  ?readonly=${this.readonly}
                  placeholder=${ifDefined(this.getCellPlaceholder(index))}
                  inputmode=${ifDefined(this.getResolvedInputMode())}
                  pattern=${this.isNumericMode() ? OtpCellPattern.NUMERIC : OtpCellPattern.ALPHANUMERIC}
                  autocapitalize="none"
                  autocorrect="off"
                  spellcheck="false"
                  autocomplete=${index === 0 ? this.autocomplete : OtpAutoComplete.OFF}
                  enterkeyhint=${index === normalizedLength - 1
                ? OtpEnterKeyHint.DONE
                : OtpEnterKeyHint.NEXT}
                  aria-label=${`Digit ${index + 1} of ${normalizedLength}`}
                  aria-describedby=${ifDefined(describedBy || undefined)}
                  aria-invalid=${this.hasAttribute('data-user-invalid')
                ? 'true'
                : 'false'}
                  @focus=${this.handleCellFocus}
                  @blur=${this.handleCellBlur}
                  @keydown=${this.handleCellKeyDown}
                  @input=${this.handleCellInput}
                  @paste=${this.handleCellPaste}
                />
                ${this.separator && separatorIndices.has(index)
                ? html `
                      <span
                        class="otp__separator"
                        part="separator"
                        aria-hidden="true"
                      >
                        ${this.separator}
                      </span>
                    `
                : ''}
              `;
        })}

            <input
              class="otp__value-input"
              type="text"
              .value=${live(this.value)}
              ?required=${this.required}
              ?disabled=${this.disabled}
              minlength=${normalizedLength}
              maxlength=${normalizedLength}
              pattern=${this.getValidationPattern()}
              tabindex="-1"
              aria-hidden="true"
              @focus=${() => this.focus()}
              @invalid=${this.handleInvalid}
            />
          </div>
        </div>

        ${hasHelpText
            ? html `
              <div
                id="help-text"
                part="form-control-help-text"
                class="form-control__help-text"
              >
                <nile-form-help-text>
                  <slot name="help-text">${this.helpText}</slot>
                </nile-form-help-text>
              </div>
            `
            : ``}
        ${hasErrorMessage
            ? html `
              <div
                id="error-message"
                part="form-control-error-message"
                class="form-control__error-message"
              >
                <nile-form-error-message
                  >${this.errorMessage}</nile-form-error-message
                >
              </div>
            `
            : ``}
      </div>
    `;
    }
};
NileOtpInput.styles = styles;
__decorate([
    query('.otp__value-input')
], NileOtpInput.prototype, "valueInput", void 0);
__decorate([
    queryAll('.otp__cell')
], NileOtpInput.prototype, "cellInputs", void 0);
__decorate([
    state()
], NileOtpInput.prototype, "hasFocus", void 0);
__decorate([
    state()
], NileOtpInput.prototype, "activeIndex", void 0);
__decorate([
    state()
], NileOtpInput.prototype, "cells", void 0);
__decorate([
    property({ reflect: true, type: String, attribute: true })
], NileOtpInput.prototype, "name", void 0);
__decorate([
    property({ reflect: true, type: String, attribute: true })
], NileOtpInput.prototype, "value", void 0);
__decorate([
    defaultValue()
], NileOtpInput.prototype, "defaultValue", void 0);
__decorate([
    property({ type: Number, reflect: true, attribute: true })
], NileOtpInput.prototype, "length", void 0);
__decorate([
    property({ type: Boolean, reflect: true, attribute: true })
], NileOtpInput.prototype, "numericOnly", void 0);
__decorate([
    property({ type: Boolean, reflect: true, attribute: true })
], NileOtpInput.prototype, "alphanumeric", void 0);
__decorate([
    property({ reflect: true, attribute: true, type: String })
], NileOtpInput.prototype, "label", void 0);
__decorate([
    property({ attribute: true, reflect: true, type: String })
], NileOtpInput.prototype, "helpText", void 0);
__decorate([
    property({ attribute: true, reflect: true, type: String })
], NileOtpInput.prototype, "errorMessage", void 0);
__decorate([
    property({ reflect: true, attribute: true, type: String })
], NileOtpInput.prototype, "placeholder", void 0);
__decorate([
    property({ reflect: true, type: String })
], NileOtpInput.prototype, "separator", void 0);
__decorate([
    property({ type: Number, attribute: true, reflect: true })
], NileOtpInput.prototype, "separatorEvery", void 0);
__decorate([
    property({ attribute: 'separator-positions', type: String, reflect: true })
], NileOtpInput.prototype, "separatorPositions", void 0);
__decorate([
    property({ type: Boolean, reflect: true })
], NileOtpInput.prototype, "masked", void 0);
__decorate([
    property({ type: Boolean, attribute: true, reflect: true })
], NileOtpInput.prototype, "warning", void 0);
__decorate([
    property({ type: Boolean, attribute: true, reflect: true })
], NileOtpInput.prototype, "error", void 0);
__decorate([
    property({ type: Boolean, attribute: true, reflect: true })
], NileOtpInput.prototype, "success", void 0);
__decorate([
    property({ type: Boolean, reflect: true, attribute: true })
], NileOtpInput.prototype, "disabled", void 0);
__decorate([
    property({ type: Boolean, attribute: true, reflect: true })
], NileOtpInput.prototype, "readonly", void 0);
__decorate([
    property({ reflect: true, attribute: true, type: String })
], NileOtpInput.prototype, "form", void 0);
__decorate([
    property({ type: Boolean, reflect: true, attribute: true })
], NileOtpInput.prototype, "required", void 0);
__decorate([
    property({ reflect: true, attribute: true, type: String })
], NileOtpInput.prototype, "pattern", void 0);
__decorate([
    property({ type: Boolean, reflect: true, attribute: true })
], NileOtpInput.prototype, "autofocus", void 0);
__decorate([
    property({ reflect: true, attribute: true, type: String })
], NileOtpInput.prototype, "inputmode", void 0);
__decorate([
    property({ reflect: true, type: String })
], NileOtpInput.prototype, "autocomplete", void 0);
__decorate([
    watch('length', { waitUntilFirstUpdate: true })
], NileOtpInput.prototype, "handleLengthChange", null);
__decorate([
    watch('value', { waitUntilFirstUpdate: true })
], NileOtpInput.prototype, "handleValueChange", null);
__decorate([
    watch('disabled', { waitUntilFirstUpdate: true })
], NileOtpInput.prototype, "handleDisabledChange", null);
__decorate([
    watch('numericOnly', { waitUntilFirstUpdate: true })
], NileOtpInput.prototype, "handleNumericOnlyChange", null);
__decorate([
    watch('pattern', { waitUntilFirstUpdate: true })
], NileOtpInput.prototype, "handlePatternChange", null);
NileOtpInput = __decorate([
    customElement('nile-otp-input')
], NileOtpInput);
export { NileOtpInput };
export default NileOtpInput;
//# sourceMappingURL=nile-otp-input.js.map