     if (!(e || o || t))
        return "";
      const L = [];
      if (e && L.push({
        key: "clear",
        content: u`<button
            class="clear"
            type="button"
            tabindex=${this.disabled ? -1 : ""}
            aria-label=${this.assistiveClear}
            @click=${this.handleClearClick}
          >
            <maui-icon use="icon-clear" .theme=${this.theme}></maui-icon>
          </button>`
      }), o || t) {
        const N = t ? "slotted-icon" : "icon";
        L.push({
          key: N,
          content: u`<button
            class="icon"
            tabindex=${this.disabled ? -1 : ""}
            aria-label=${t ? this.assistiveSlottedIcon : this.assistiveIcon}
            @click=${this.handleIconClick}
            @keydown=${this.handleIconKeyDown}
          >
            ${t ? u`<slot name="icon"></slot>` : u`<maui-icon
                  .theme=${this.theme}
                  use=${U(this.icon)}
                ></maui-icon>`}
          </button>`
        });
      }
      return u`${Tv(
        L,
        (N) => N.key,
        (N) => N.content
      )}`;
    };
    let $;
    return m ? $ = this.inputSlot : $ = this.shadowControl || this.initInput(), $ && ($.setAttribute("class", "control validation-input"), $.setAttribute("id", `${this.id}-input`), $.type = this.getType(), this.name !== void 0 && ($.name = this.name), $.disabled = this.disabled, $.readOnly = this.readonly, $.required = this.required, $.placeholder = this.hasFocus ? "" : x, this.minlength !== void 0 && ($.minLength = this.minlength), $.title = this.title, this.maxlength !== void 0 && ($.maxLength = this.maxlength), this.min !== void 0 && ($.min = this.min), this.max !== void 0 && ($.max = this.max), this.step !== void 0 && ($.step = this.step), this.controlled || ($.value = this.value || ""), $.autocapitalize = this.type === "password" ? "off" : this.autocapitalize || $.autocapitalize, $.autocomplete = this.type === "password" ? "off" : this.autocomplete || $.autocomplete, this.type === "password" ? $.setAttribute("autocorrect", "off") : this.autocorrect && $.setAttribute("autocorrect", this.autocorrect), this.autofocus !== void 0 && ($.autofocus = this.autofocus), $.spellcheck = this.spellcheck, this.pattern !== void 0 && ($.pattern = this.pattern), this.enterkeyhint !== void 0 && ($.enterKeyHint = this.enterkeyhint), this.inputmode !== void 0 && ($.inputMode = this.inputmode), $.setAttribute("aria-labelledby", `${this.id}-label`), this.ariaLabel !== null && $.setAttribute("aria-label", this.ariaLabel), $.getAttribute("aria-describedby") || $.setAttribute(
      "aria-describedby",
      `${this.id}-hint ${this.id}-error`
    ), $.setAttribute(
      "aria-invalid",
      this.invalid ? "true" : "false"
    )), u` <div
      class="${y({
      [this.componentName]: !0,
      [this.theme]: !0,
      ..._s({
        baseClass: this.componentName,
        slots: Za.slots,
        hasSlotController: this.hasSlotController
      }),
      "has-focus": this.hasFocus,
      "has-value": !!this.value,
      "has-error": c,
      clearable: this.clearable,
      "has-icon": t || o,
      "has-hint": i || r,
      disabled: !!this.disabled
    })}"
    >
      <maui-label
        .theme=${this.theme}
        class="label"
        for="${this.id}-input"
        id="${this.id}-label"
        .ariaHidden=${this.hasFocus || this.value ? "false" : "true"}
        >${v}</maui-label
      >
      <div class="border-wrapper">
        ${m ? u`<slot
              name="input"
              @slotchange=${this.handleInputSlotChange}
              @change=${this.handleChange}
              @input=${this.handleInput}
              @invalid=${this.handleInvalid}
              @keydown=${this.handleKeyDown}
              @focusin=${this.handleFocus}
              @focusout=${this.handleBlur}
              @click=${this.handleClick}
            ></slot>` : $}
        <div
          class="icon-wrapper ${y({
      "has-icon": t || o,
      "has-optional": !this.required && !this.value && this.optional
    })}"
          ?hidden=${!o && !t && !this.optional && !this.clearable}
        >
          ${!this.required && !this.value ? u`<div class="optional-label">${this.optional}</div>` : ""}${_()}
        </div>

        ${["lh", "b2b"].includes(this.theme) && !this.value && !this.hasFocus ? u`<div class="border-right"></div>` : ""}
      </div>
      ${g ? u`<div class="info-wrapper">
            ${(r || i) && !c && !n ? u`<div id="${this.id}-hint" class="hint">
                  ${i ? u`<slot name="hint"></slot>` : u`<maui-hint .theme=${this.theme} class="hint"
                        >${this.hint}</maui-hint
                      >`}
                </div>` : ""}
            <div
              aria-live="polite"
              aria-relevant="additions"
              aria-atomic="true"
            >
              ${f}
            </div>
          </div>` : ""}
    </div>`;
  }
};
D.styles = Jv;
D.slots = ["icon", "hint", "error", "input"];
P([
  O()
], D.prototype, "inputSlot", 2);
P([
  O()
], D.prototype, "hasFocus", 2);
P([
  M(".control")
], D.prototype, "shadowControl", 2);
P([
  l({ reflect: !0 })
], D.prototype, "type", 2);
P([
  l({ type: Boolean, reflect: !0 })
], D.prototype, "disabled", 2);
P([
  l({ type: Boolean })
], D.prototype, "controlled", 2);
P([
  l({ reflect: !0 })
], D.prototype, "id", 2);
P([
  l({ reflect: !0 })
], D.prototype, "label", 2);
P([
  l({ reflect: !0 })
], D.prototype, "hint", 2);
P([
  l({ reflect: !0 })
], D.prototype, "title", 2);
P([
  l({ attribute: "password-visible", type: Boolean })
], D.prototype, "passwordVisible", 2);
P([
  l({ type: Boolean })
], D.prototype, "clearable", 2);
P([
  l({ type: Boolean, reflect: !0 })
], D.prototype, "readonly", 2);
P([
  l({ type: Number })
], D.prototype, "minlength", 2);
P([
  l({ type: Number })
], D.prototype, "maxlength", 2);
P([
  l({ reflect: !0 })
], D.prototype, "min", 2);
P([
  l({ reflect: !0 })
], D.prototype, "max", 2);
P([
  l({ type: String, reflect: !0 })
], D.prototype, "optional", 2);
P([
  l({ reflect: !0 })
], D.prototype, "placeholder", 2);
P([
  l({ reflect: !0 })
], D.prototype, "icon", 2);
P([
  l({ reflect: !0 })
], D.prototype, "step", 2);
P([
  l({ reflect: !0 })
], D.prototype, "pattern", 2);
P([
  l({ type: Boolean, reflect: !0 })
], D.prototype, "invalid", 2);
P([
  l({ reflect: !0 })
], D.prototype, "autocapitalize", 2);
P([
  l({ reflect: !0 })
], D.prototype, "autocorrect", 2);
P([
  l({ type: String })
], D.prototype, "autocomplete", 2);
P([
  l({ type: Boolean })
], D.prototype, "autofocus", 2);
P([
  l({ reflect: !0 })
], D.prototype, "enterkeyhint", 2);
P([
  l({ type: Boolean })
], D.prototype, "spellcheck", 2);
P([
  l({ reflect: !0 })
], D.prototype, "inputmode", 2);
P([
  l({ type: Array })
], D.prototype, "preventDefaultKeys", 2);
P([
  l({ type: String, attribute: "assistive-clear", reflect: !0 })
], D.prototype, "assistiveClear", 2);
P([
  l({ type: String, attribute: "assistive-icon" })
], D.prototype, "assistiveIcon", 2);
P([
  l({ type: String, attribute: "assistive-slotted-icon" })
], D.prototype, "assistiveSlottedIcon", 2);
let af = D;
w("maui-input", af);
const rf = s`
  .link-list {
    column-gap: calc(var(--maui-spacing-4) + var(--maui-spacing-2));
    row-gap: calc(var(--maui-spacing-4) + var(--maui-spacing-2));
  }

  .vertical {
    display: grid;
  }

  .horizontal {
    display: flex;
    flex-wrap: wrap;
  }
`, nf = s`
  .os.link-list {
    column-gap: var(--maui-spacing-4);
    row-gap: var(--maui-spacing-4);
  }
`, sf = s`
  .sn.link-list {
    column-gap: var(--maui-spacing-5);
    row-gap: var(--maui-spacing-5);
  }
`, lf = s`
  .four_y.link-list {
    column-gap: var(--maui-spacing-4);
    row-gap: var(--maui-spacing-4);
  }
`, cf = s`
  .mmg.link-list {
    gap: var(--maui-spacing-6);
  }
`, df = [rf, nf, sf, lf, cf];
var uf = Object.defineProperty, mf = Object.getOwnPropertyDescriptor, hf = (a, e, t, o) => {
  for (var i = o > 1 ? void 0 : o ? mf(e, t) : e, r = a.length - 1, n; r >= 0; r--)
    (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i);
  return o && i && uf(e, t, i), i;
};
class Mr extends k {
  constructor() {
    super(), this.orientation = "vertical", this.componentName = "link-list";
  }
  connectedCallback() {
    super.connectedCallback(), this.setAttribute("role", "list");
  }
  handleSlotChange(e) {
    const t = e.target;
    X(
      t,
      [
        "MAUI-FUNCTIONAL-LINK",
        "MAUI-NAVIGATION-LINK",
        "MAUI-SERVICE-LINK",
        "MAUI-LINK-BUTTON",
        "MAUI-LINK-MIMIC",
        "MAUI-ICON-LINK"
      ],
      void 0,
      !0
    ), t.assignedNodes().forEach((i) => {
      i instanceof HTMLElement && (i.setAttribute("role", "listitem"), i.theme = this.theme);
    });
  }
  render() {
    return u`<div
      class=${y({
      [this.componentName]: !0,
      [this.orientation]: !0,
      [this.theme]: !0
    })}
    >
      <slot @slotchange=${this.handleSlotChange}></slot>
    </div>`;
  }
}
Mr.styles = df;
hf([
  l({ reflect: !0, type: String })
], Mr.prototype, "orientation", 2);
w("maui-link-list", Mr);
const pf = s`
  ${C}

  .list {
    color: var(--maui-color-text-copy);
  }

  .icon-list li {
    list-style-type: none;
  }

  .list ul,
  .list ol {
    padding-left: var(--maui-spacing-4);
  }

  .list.icon-list ul {
    padding-left: 0;
  }

  .item {
    margin-bottom: var(--maui-spacing-base);
  }

  slot {
    display: grid;
    row-gap: var(--maui-spacing-3);
  }
`, gf = s`
  .os .item {
    margin-bottom: var(--maui-spacing-3);
  }
`, bf = s`
  .four_y .item {
    margin-bottom: var(--maui-spacing-3);
  }
`, vf = [pf, gf, bf];
var ff = Object.defineProperty, yf = Object.getOwnPropertyDescriptor, Lr = (a, e, t, o) => {
  for (var i = o > 1 ? void 0 : o ? yf(e, t) : e, r = a.length - 1, n; r >= 0; r--)
    (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i);
  return o && i && ff(e, t, i), i;
};
class zi extends k {
  constructor() {
    super(), this.size = "medium", this.type = "unordered", this.componentName = "list";
  }
  connectedCallback() {
    super.connectedCallback(), this.setAttribute("role", "list");
  }
  firstUpdated() {
    super.firstUpdated();
  }
  handleSlotChange() {
    const t = this.shadowRoot.querySelector("slot")?.assignedElements();
    t && t.forEach((o) => {
      o.setAttribute("size", this.size), o.setAttribute("type", this.type), o.setAttribute("theme", this.theme);
    });
  }
  handleChange() {
    this.handleSlotChange();
  }
  render() {
    const e = this.size ? this.size : "medium", t = this.type ? this.type : "unordered";
    return u`<div
      class="${y({
      [this.componentName]: !0,
      [this.theme]: !0,
      [e]: !0,
      [t]: !0
    })}"
    >
      <slot @slotchange=${this.handleSlotChange}></slot>
    </div>`;
  }
}
zi.styles = vf;
Lr([
  l({ reflect: !0 })
], zi.prototype, "size", 2);
Lr([
  l({ reflect: !0 })
], zi.prototype, "type", 2);
Lr([
  F(["size", "type"])
], zi.prototype, "handleChange", 1);
w("maui-list", zi);
const ks = (a) => {
  const e = h(a);
  return s`
    .${e}.list-item.small {
      ${d({ size: "copy-medium", tenant: a })};
    }

    .${e}.list-item.medium {
      ${d({ size: "copy-large", tenant: a })};
    }

    .${e}.list-item.large {
      ${d({ size: "copy-large", tenant: a })};
    }
  `;
}, xf = s`
  ${C}

  ${A}

  :host {
    display: inline;
  }

  .list-item {
    display: flex;

    font-family: var(--maui-font-family-copy);
    ${d({ size: "copy-medium", tenant: "wl" })};

    color: var(--maui-color-text-copy);
  }

  .list-item {
    display: grid;
    grid-template-areas: 'decorator content';
    grid-template-columns: max-content auto;
    grid-template-columns: minmax(24px, max-content) auto;
  }

  .list-item.ordered {
    column-gap: var(--maui-spacing-1);
  }

  .decorator {
    grid-area: decorator;
  }

  .indentation {
    display: block;
    pointer-events: none;
    user-select: none;
  }

  .unordered .indentation {
    unicode-bidi: isolate;
    font-size: 1.3em;
  }

  .content {
    grid-area: content;
  }

  .children.has-children {
    display: grid;
    row-gap: var(--maui-spacing-3);
    margin-top: var(--maui-spacing-3);
  }
`, $f = s`
  ${ks("lh")}
`, wf = s`
  .os.list-item.small {
    ${d({ size: "copy-small", tenant: "os" })};
  }
  .os.list-item.medium {
    ${d({ size: "copy-medium", tenant: "os" })};
  }
  .os.list-item.large {
    ${d({ size: "copy-large", tenant: "os" })};
  }
`, _f = s`
  .lx.list-item.small {
    ${d({ size: "copy-small", tenant: "lx" })};
  }
  .lx.list-item.medium {
    ${d({ size: "copy-medium", tenant: "lx" })};
  }
  .lx.list-item.large {
    ${d({ size: "copy-large", tenant: "lx" })};
  }
`, kf = s`
  .sn.list-item.small {
    ${d({ size: "copy-small", tenant: "sn" })};
  }
  .sn.list-item.medium {
    ${d({ size: "copy-medium", tenant: "sn" })};
  }
  .sn.list-item.large {
    ${d({ size: "copy-large", tenant: "sn" })};
  }
`, Sf = s`
  ${ks("b2b")}
`, Of = s`
  .four_y.list-item.small {
    ${d({ size: "copy-small", tenant: "four_y" })};
  }
  .four_y.list-item.medium {
    ${d({ size: "copy-medium", tenant: "four_y" })};
  }
  .four_y.list-item.large {
    ${d({ size: "copy-large", tenant: "four_y" })};
  }
`, Mf = s`
  .mmg.list-item.small {
    ${d({ size: "copy-small", tenant: "mmg" })};
  }
  .mmg.list-item.medium {
    ${d({ size: "copy-medium", tenant: "mmg" })};
  }
  .mmg.list-item.large {
    ${d({ size: "copy-large", tenant: "mmg" })};
  }

  .mmg.list-item.custom {
    align-items: center;
    column-gap: var(--maui-spacing-2);
  }
`, Lf = [
  xf,
  $f,
  wf,
  _f,
  kf,
  Sf,
  Of,
  Mf
];
var Bf = Object.defineProperty, Cf = Object.getOwnPropertyDescriptor, Ai = (a, e, t, o) => {
  for (var i = o > 1 ? void 0 : o ? Cf(e, t) : e, r = a.length - 1, n; r >= 0; r--)
    (n = a[r]) && (i = (o ? n(e, t, i) : n(i)) || i);
  return o && i && Bf(e, t, i), i;
};
function nn(a) {
  return a && ["listitem", "listitem list"].includes(
    a.getAttribute("role")?.toLowerCase() || ""
  );
}
const yo = class Ss extends k {
  constructor() {
    super(), this.hasChildren = !1, this.listType = "unordered", this.listSize = "medium", this.componentName = "list-item";
  }
  connectedCallback() {
    super.connectedCallback(), this.setAttribute("role", "listitem"), this.isNestedItem() && (this.slot = "children"), this.setListIndex();
  }
  // Checks whether the item is nested into an item/list
  isNestedItem() {
    const e = this.parentElement;
    return !!e && nn(e);
  }
  // Sets the items list index. Used for indentation and bullet selection
  setListIndex() {
    const e = this.previousElementSibling?.getAttribute("list-index"), t = () => {
      if (e) {
        if (this.isNestedItem()) {
          const i = e.split(".").filter((r) => r);
          return parseInt(i[i.length - 1], 10) + (this.hasChildren ? 0 : 1);
        }
        return parseInt(e, 10) + (this.hasChildren ? 0 : 1);
      }
    }, o = () => `${t() ? `${t()}` : "1"}.`;
    if (!this.isNestedItem()) {
      this.setAttribute("list-index", o());
      return;
    }
    this.parentElement && this.parentElement.getAttribute("list-index") && this.setAttribute(
      "list-index",
      `${[
        ...this.parentElement.getAttribute("list-index").split("."),
        ...o().split(".")
      ].filter((i) => i).join(".")}.`
    );
  }
  // Gets all the nested list items
  getChildrenItems() {
    return this.childrenSlot ? [...this.childrenSlot.assignedElements({ flatten: !0 })].filter(
      (e) => nn(e)
    ) : [];
  }
  // Returns the intended bullet character based on the current list index
  static getBullet(e) {
    const t = e.split(".").filter((o) => o).length;
    return t === 1 ? "•" : t >= 1 ? "◦" : "•";
  }
  // decides if counter or bullet should be used
  getDecorator(e) {
    switch (this.listType) {
      case "ordered":
        return u`<div class="indentation">${e}</div>`;
      case "unordered":
        return u`<div class="indentation">
          ${Ss.getBullet(e)}
        </div>`;
      default:
        return "";
    }
  }
  firstUpdated() {
    super.firstUpdated(), this.updateItem();
  }
  updateItem() {
    this.hasChildren = this.getChildrenItems().length > 0, this.setAttribute("role", `listitem${this.hasChildren ? " list" : ""}`);
    const e = this.getChildrenItems();
    e.length !== 0 && e.forEach((t) => {
      t.setAttribute("size", this.listSize), t.setAttribute("type", this.listType);
    });
  }
  updateIcon() {
    const e = this.shadowRoot.querySelector(
      'slot[name="icon"]'
    );
    if (!e)
      return;
    e.assignedElements({ flatten: !0 }).forEach((o) => {
      o.setAttribute(
        "size",
        this.listSize === "large" ? "medium" : this.listSize
      );
    });
  }
  handleChange() {
    this.updateItem(), this.updateIcon();
  }
  render() {
    const e = this.getAttribute("list-index");
    return u`<div
      class="${y({
      [this.componentName]: !0,
      [this.theme]: !0,
      [this.listType]: !0,
      [this.listSize]: !0
    })}"
    >
      <div class="decorator">
        ${this.listType === "custom" ? u`<slot name="icon" @slotchange=${this.updateIcon}></slot>` : ""}
        ${this.getDecorator(e || "")}
      </div>

      <div class="content">
        <slot @slotchange=${this.updateItem}></slot>
        <div
          class=${y({
      children: !0,
      "has-children": this.hasChildren
    })}
        >
          <slot name="children" @slotchange=${this.updateItem}></slot>
        </div>
      </div>
    </div>`;
  }
};
yo.styles = Lf;
Ai([
  M("slot[name=children]")
], yo.prototype, "childrenSlot", 2);
Ai([
  O()
], yo.prototype, "hasChildren", 2);
Ai([
  l({ type: String, attribute: "type" })
], yo.prototype, "listType", 2);
Ai([
  l({ type: String, attribute: "size" })
], yo.prototype, "listSize", 2);
Ai([
  F(["listSize", "listType"])
], yo.prototype, "handleChange", 1);
let zf = yo;
w("maui-list-item", zf);
function Ft(a) {
  return typeof a == "string" || a instanceof String;
}
function sn(a) {
  var e;
  return typeof a == "object" && a != null && (a == null || (e = a.constructor) == null ? void 0 : e.name) === "Object";
}
function Os(a, e) {
  return Array.isArray(e) ? Os(a, (t, o) => e.includes(o)) : Object.entries(a).reduce((t, o) => {
    let [i, r] = o;
    return e(r, i) && (t[i] = r), t;
  }, {});
}
const B = {
  NONE: "NONE",
  LEFT: "LEFT",
  FORCE_LEFT: "FORCE_LEFT",
  RIGHT: "RIGHT",
  FORCE_RIGHT: "FORCE_RIGHT"
};
function Af(a) {
  switch (a) {
    case B.LEFT:
      return B.FORCE_LEFT;
    case B.RIGHT:
      return B.FORCE_RIGHT;
    default:
      return a;
  }
}
function Pa(a) {
  return a.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
}
function na(a, e) {
  if (e === a)
    return !0;
  const t = Array.isArray(e), o = Array.isArray(a);
  let i;
  if (t && o) {
    if (e.length != a.length)
      return !1;
    for (i = 0; i < e.length; i++)
      if (!na(e[i], a[i]))
        return !1;
    return !0;
  }
  if (t != o)
    return !1;
  if (e && a && typeof e == "object" && typeof a == "object") {
    const r = e instanceof Date, n = a instanceof Date;
    if (r && n)
      return e.getTime() == a.getTime();
    if (r != n)
      return !1;
    const c = e instanceof RegExp, m = a instanceof RegExp;
    if (c && m)
      return e.toString() == a.toString();
    if (c != m)
      return !1;
    const g = Object.keys(e);
    for (i = 0; i < g.length; i++)
      if (!Object.prototype.hasOwnProperty.call(a, g[i]))
        return !1;
    for (i = 0; i < g.length; i++)
      if (!na(a[g[i]], e[g[i]]))
        return !1;
    return !0;
  } else if (e && a && typeof e == "function" && typeof a == "function")
    return e.toString() === a.toString();
  return !1;
}
class Ff {
  /** Current input value */
  /** Current cursor position */
  /** Old input value */
  /** Old selection */
  constructor(e) {
    for (Object.assign(this, e); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
      --this.oldSelection.start;
    if (this.insertedCount)
      for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
        this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
  }
  /** Start changing position */
  get startChangePos() {
    return Math.min(this.cursorPos, this.oldSelection.start);
  }
  /** Inserted symbols count */
  get insertedCount() {
    return this.cursorPos - this.startChangePos;
  }
  /** Inserted symbols */
  get inserted() {
    return this.value.substr(this.startChangePos, this.insertedCount);
  }
  /** Removed symbols count */
  get removedCount() {
    return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
    this.oldValue.length - this.value.length, 0);
  }
  /** Removed symbols */
  get removed() {
    return this.oldValue.substr(this.startChangePos, this.removedCount);
  }
  /** Unchanged head symbols */
  get head() {
    return this.value.substring(0, this.startChangePos);
  }
  /** Unchanged tail symbols */
  get tail() {
    return this.value.substring(this.startChangePos + this.insertedCount);
  }
  /** Remove direction */
  get removeDirection() {
    return !this.removedCount || this.insertedCount ? B.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
    this.oldSelection.end === this.oldSelection.start ? B.RIGHT : B.LEFT;
  }
}
function z(a, e) {
  return new z.InputMask(a, e);
}
function Ms(a) {
  if (a == null)
    throw new Error("mask property should be defined");
  return a instanceof RegExp ? z.MaskedRegExp : Ft(a) ? z.MaskedPattern : a === Date ? z.MaskedDate : a === Number ? z.MaskedNumber : Array.isArray(a) || a === Array ? z.MaskedDynamic : z.Masked && a.prototype instanceof z.Masked ? a : z.Masked && a instanceof z.Masked ? a.constructor : a instanceof Function ? z.MaskedFunction : (console.warn("Mask not found for mask", a), z.Masked);
}
function pi(a) {
  if (!a)
    throw new Error("Options in not defined");
  if (z.Masked) {
    if (a.prototype instanceof z.Masked)
      return {
        mask: a
      };
    const {
      mask: e = void 0,
      ...t
    } = a instanceof z.Masked ? {
      mask: a
    } : sn(a) && a.mask instanceof z.Masked ? a : {};
    if (e) {
      const o = e.mask;
      return {
        ...Os(e, (i, r) => !r.startsWith("_")),
        mask: e.constructor,
        _mask: o,
        ...t
      };
    }
  }
  return sn(a) ? {
    ...a
  } : {
    mask: a
  };
}
function $t(a) {
  if (z.Masked && a instanceof z.Masked)
    return a;
  const e = pi(a), t = Ms(e.mask);
  if (!t)
    throw new Error("Masked class is not found for provided mask " + e.mask + ", appropriate module needs to be imported manually before creating mask.");
  return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
}
z.createMask = $t;
class Br {
  /** */
  /** */
  /** */
  /** Safely returns selection start */
  get selectionStart() {
    let e;
    try {
      e = this._unsafeSelectionStart;
    } catch {
    }
    return e ?? this.value.length;
  }
  /** Safely returns selection end */
  get selectionEnd() {
    let e;
    try {
      e = this._unsafeSelectionEnd;
    } catch {
    }
    return e ?? this.value.length;
  }
  /** Safely sets element selection */
  select(e, t) {
    if (!(e == null || t == null || e === this.selectionStart && t === this.selectionEnd))
      try {
        this._unsafeSelect(e, t);
      } catch {
      }
  }
  /** */
  get isActive() {
    return !1;
  }
  /** */
  /** */
  /** */
}
z.MaskElement = Br;
const ln = 90, Nf = 89;
class _a extends Br {
  /** HTMLElement to use mask on */
  constructor(e) {
    super(), this.input = e, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
  }
  get rootElement() {
    var e, t, o;
    return (e = (t = (o = this.input).getRootNode) == null ? void 0 : t.call(o)) != null ? e : document;
  }
  /** Is element in focus */
  get isActive() {
    return this.input === this.rootElement.activeElement;
  }
  /** Binds HTMLElement events to mask internal events */
  bindEvents(e) {
    this.input.addEventListener("keydown", this._onKeydown), this.input.addEventListener("input", this._onInput), this.input.addEventListener("beforeinput", this._onBeforeinput), this.input.addEventListener("compositionend", this._onCompositionEnd), this.input.addEventListener("drop", e.drop), this.input.addEventListener("click", e.click), this.input.addEventListener("focus", e.focus), this.input.addEventListener("blur", e.commit), this._handlers = e;
  }
  _onKeydown(e) {
    if (this._handlers.redo && (e.keyCode === ln && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === Nf && e.ctrlKey))
      return e.preventDefault(), this._handlers.redo(e);
    if (this._handlers.undo && e.keyCode === ln && (e.metaKey || e.ctrlKey))
      return e.preventDefault(), this._handlers.undo(e);
    e.isComposing || this._handlers.selectionChange(e);
  }
  _onBeforeinput(e) {
    if (e.inputType === "historyUndo" && this._handlers.undo)
      return e.preventDefault(), this._handlers.undo(e);
    if (e.inputType === "historyRedo" && this._handlers.redo)
      return e.preventDefault(), this._handlers.redo(e);
  }
  _onCompositionEnd(e) {
    this._handlers.input(e);
  }
  _onInput(e) {
    e.isComposing || this._handlers.input(e);
  }
  /** Unbinds HTMLElement events to mask internal events */
  unbindEvents() {
    this.input.removeEventListener("keydown", this._onKeydown), this.input.removeEventListener("input", this._onInput), this.input.removeEventListener("beforeinput", this._onBeforeinput), this.input.removeEventListener("compositionend", this._onCompositionEnd), this.input.removeEventListener("drop", this._handlers.drop), this.input.removeEventListener("click", this._handlers.click), this.input.removeEventListener("focus", this._handlers.focus), this.input.removeEventListener("blur", this._handlers.commit), this._handlers = {};
  }
}
z.HTMLMaskElement = _a;
class If extends _a {
  /** InputElement to use mask on */
  constructor(e) {
    super(e), this.input = e;
  }
  /** Returns InputElement selection start */
  get _unsafeSelectionStart() {
    return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
  }
  /** Returns InputElement selection end */
  get _unsafeSelectionEnd() {
    return this.input.selectionEnd;
  }
  /** Sets InputElement selection */
  _unsafeSelect(e, t) {
    this.input.setSelectionRange(e, t);
  }
  get value() {
    return this.input.value;
  }
  set value(e) {
    this.input.value = e;
  }
}
z.HTMLMaskElement = _a;
class Ls extends _a {
  /** Returns HTMLElement selection start */
  get _unsafeSelectionStart() {
    const e = this.rootElement, t = e.getSelection && e.getSelection(), o = t && t.anchorOffset, i = t && t.focusOffset;
    return i == null || o == null || o < i ? o : i;
  }
  /** Returns HTMLElement selection end */
  get _unsafeSelectionEnd() {
    const e = this.rootElement, t = e.getSelection && e.getSelection(), o = t && t.anchorOffset, i = t && t.focusOffset;
    return i == null || o == null || o > i ? o : i;
  }
  /** Sets HTMLElement selection */
  _unsafeSelect(e, t) {
    if (!this.rootElement.createRange)
      return;
    const o = this.rootElement.createRange();
    o.setStart(this.input.firstChild || this.input, e), o.setEnd(this.input.lastChild || this.input, t);
    const i = this.rootElement, r = i.getSelection && i.getSelection();
    r && (r.removeAllRanges(), r.addRange(o));
  }
  /** HTMLElement value */
  get value() {
    return this.input.textContent || "";
  }
  set value(e) {
    this.input.textContent = e;
  }
}
z.HTMLContenteditableMaskElement = Ls;
class ka {
  constructor() {
    this.states = [], this.currentIndex = 0;
  }
  get currentState() {
    return this.states[this.currentIndex];
  }
  get isEmpty() {
    return this.states.length === 0;
  }
  push(e) {
    this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > ka.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
  }
  go(e) {
    return this.currentIndex = Math.min(Math.max(this.currentIndex + e, 0), this.states.length - 1), this.currentState;
  }
  undo() {
    return this.go(-1);
  }
  redo() {
    return this.go(1);
  }
  clear() {
    this.states.length = 0, this.currentIndex = 0;
  }
}
ka.MAX_LENGTH = 100;
class Uf {
  /**
    View element
  */
  /** Internal {@link Masked} model */
  constructor(e, t) {
    this.el = e instanceof Br ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new Ls(e) : new If(e), this.masked = $t(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new ka(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
  }
  maskEquals(e) {
    var t;
    return e == null || ((t = this.masked) == null ? void 0 : t.maskEquals(e));
  }
  /** Masked */
  get mask() {
    return this.masked.mask;
  }
  set mask(e) {
    if (this.maskEquals(e))
      return;
    if (!(e instanceof z.Masked) && this.masked.constructor === Ms(e)) {
      this.masked.updateOptions({
        mask: e
      });
      return;
    }
    const t = e instanceof z.Masked ? e : $t({
      mask: e
    });
    t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
  }
  /** Raw value */
  get value() {
    return this._value;
  }
  set value(e) {
    this.value !== e && (this.masked.value = e, this.updateControl("auto"));
  }
  /** Unmasked value */
  get unmaskedValue() {
    return this._unmaskedValue;
  }
  set unmaskedValue(e) {
    this.unmaskedValue !== e && (this.masked.unmaskedValue = e, this.updateControl("auto"));
  }
  /** Raw input value */
  get rawInputValue() {
    return this._rawInputValue;
  }
  set rawInputValue(e) {
    this.rawInputValue !== e && (this.masked.rawInputValue = e, this.updateControl(), this.alignCursor());
  }
  /** Typed unmasked value */
  get typedValue() {
    return this.masked.typedValue;
  }
  set typedValue(e) {
    this.masked.typedValueEquals(e) || (this.masked.typedValue = e, this.updateControl("auto"));
  }
  /** Display value */
  get displayValue() {
    return this.masked.displayValue;
  }
  /** Starts listening to element events */
  _bindEvents() {
    this.el.bindEvents({
      selectionChange: this._saveSelection,
      input: this._onInput,
      drop: this._onDrop,
      click: this._onClick,
      focus: this._onFocus,
      commit: this._onChange,
      undo: this._onUndo,
      redo: this._onRedo
    });
  }
  /** Stops listening to element events */
  _unbindEvents() {
    this.el && this.el.unbindEvents();
  }
  /** Fires custom event */
  _fireEvent(e, t) {
    const o = this._listeners[e];
    o && o.forEach((i) => i(t));
  }
  /** Current selection start */
  get selectionStart() {
    return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
  }
  /** Current cursor position */
  get cursorPos() {
    return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
  }
  set cursorPos(e) {
    !this.el || !this.el.isActive || (this.el.select(e, e), this._saveSelection());
  }
  /** Stores current selection */
  _saveSelection() {
    this.displayValue !== this.el.value && console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."), this._selection = {
      start: this.selectionStart,
      end: this.cursorPos
    };
  }
  /** Syncronizes model value from view */
  updateValue() {
    this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
  }
  /** Syncronizes view from model value, fires change events */
  updateControl(e) {
    const t = this.masked.unmaskedValue, o = this.masked.value, i = this.masked.rawInputValue, r = this.displayValue, n = this.unmaskedValue !== t || this.value !== o || this._rawInputValue !== i;
    this._unmaskedValue = t, this._value = o, this._rawInputValue = i, this.el.value !== r && (this.el.value = r), e === "auto" ? this.alignCursor() : e != null && (this.cursorPos = e), n && this._fireChangeEvents(), !this._historyChanging && (n || this.history.isEmpty) && this.history.push({
      unmaskedValue: t,
      selection: {
        start: this.selectionStart,
        end: this.cursorPos
      }
    });
  }
  /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
  updateOptions(e) {
    const {
      mask: t,
      ...o
    } = e, i = !this.maskEquals(t), r = this.masked.optionsIsChanged(o);
    i && (this.mask = t), r && this.masked.updateOptions(o), (i || r) && this.updateControl();
  }
  /** Updates cursor */
  updateCursor(e) {
    e != null && (this.cursorPos = e, this._delayUpdateCursor(e));
  }
  /** Delays cursor update to support mobile browsers */
  _delayUpdateCursor(e) {
    this._abortUpdateCursor(), this._changingCursorPos = e, this._cursorChanging = setTimeout(() => {
      this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
    }, 10);
  }
  /** Fires custom events */
  _fireChangeEvents() {
    this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
  }
  /** Aborts delayed cursor update */
  _abortUpdateCursor() {
    this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
  }
  /** Aligns cursor to nearest available position */
  alignCursor() {
    this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, B.LEFT));
  }
  /** Aligns cursor only if selection is empty */
  alignCursorFriendly() {
    this.selectionStart === this.cursorPos && this.alignCursor();
  }
  /** Adds listener on custom event */
  on(e, t) {
    return this._listeners[e] || (this._listeners[e] = []), this._listeners[e].push(t), this;
  }
  /** Removes custom event listener */
  off(e, t) {
    if (!this._listeners[e])
      return this;
    if (!t)
      return delete this._listeners[e], this;
    const o = this._listeners[e].indexOf(t);
    return o >= 0 && this._listeners[e].splice(o, 1), this;
  }
  /** Handles view input event */
  _onInput(e) {
    this._inputEvent = e, this._abortUpdateCursor();
    const t = new Ff({
      // new state
      value: this.el.value,
      cursorPos: this.cursorPos,
      // old state
      oldValue: this.displayValue,
      oldSelection: this._selection
    }), o = this.masked.rawInputValue, i = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
      input: !0,
      raw: !0
    }).offset, r = o === this.masked.rawInputValue ? t.removeDirection : B.NONE;
    let n = this.masked.nearestInputPos(t.startChangePos + i, r);
    r !== B.NONE && (n = this.masked.nearestInputPos(n, B.NONE)), this.updateControl(n), delete this._inputEvent;
  }
  /** Handles view change event and commits model value */
  _onChange() {
    this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
  }
  /** Handles view drop event, prevents by default */
  _onDrop(e) {
    e.preventDefault(), e.stopPropagation();
  }
  /** Restore last selection on focus */
  _onFocus(e) {
    this.alignCursorFriendly();
  }
  /** Restore last selection on focus */
  _onClick(e) {
    this.alignCursorFriendly();
  }
  _onUndo() {
    this._applyHistoryState(this.history.undo());
  }
  _onRedo() {
    this._applyHistoryState(this.history.redo());
  }
  _applyHistoryState(e) {
    e && (this._historyChanging = !0, this.unmaskedValue = e.unmaskedValue, this.el.select(e.selection.start, e.selection.end), this._saveSelection(), this._historyChanging = !1);
  }
  /** Unbind view events and removes element reference */
  destroy() {
    this._unbindEvents(), this._listeners.length = 0, delete this.el;
  }
}
z.InputMask = Uf;
class I {
  /** Inserted symbols */
  /** Additional offset if any changes occurred before tail */
  /** Raw inserted is used by dynamic mask */
  /** Can skip chars */
  static normalize(e) {
    return Array.isArray(e) ? e : [e, new I()];
  }
  constructor(e) {
    Object.assign(this, {
      inserted: "",
      rawInserted: "",
      tailShift: 0,
      skip: !1
    }, e);
  }
  /** Aggregate changes */
  aggregate(e) {
    return this.inserted += e.inserted, this.rawInserted += e.rawInserted, this.tailShift += e.tailShift, this.skip = this.skip || e.skip, this;
  }
  /** Total offset considering all changes */
  get offset() {
    return this.tailShift + this.inserted.length;
  }
  get consumed() {
    return !!this.rawInserted || this.skip;
  }
  equals(e) {
    return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
  }
}
z.ChangeDetails = I;
class Qe {
  /** Tail value as string */
  /** Tail start position */
  /** Start position */
  constructor(e, t, o) {
    e === void 0 && (e = ""), t === void 0 && (t = 0), this.value = e, this.from = t, this.stop = o;
  }
  toString() {
    return this.value;
  }
  extend(e) {
    this.value += String(e);
  }
  appendTo(e) {
    return e.append(this.toString(), {
      tail: !0
    }).aggregate(e._appendPlaceholder());
  }
  get state() {
    return {
      value: this.value,
      from: this.from,
      stop: this.stop
    };
  }
  set state(e) {
    Object.assign(this, e);
  }
  unshift(e) {
    if (!this.value.length || e != null && this.from >= e)
      return "";
    const t = this.value[0];
    return this.value = this.value.slice(1), t;
  }
  shift() {
    if (!this.value.length)
      return "";
    const e = this.value[this.value.length - 1];
    return this.value = this.value.slice(0, -1), e;
  }
}
class ce {
  /** */
  /** */
  /** Transforms value before mask processing */
  /** Transforms each char before mask processing */
  /** Validates if value is acceptable */
  /** Does additional processing at the end of editing */
  /** Format typed value to string */
  /** Parse string to get typed value */
  /** Enable characters overwriting */
  /** */
  /** */
  /** */
  /** */
  constructor(e) {
    this._value = "", this._update({
      ...ce.DEFAULTS,
      ...e
    }), this._initialized = !0;
  }
  /** Sets and applies new options */
  updateOptions(e) {
    this.optionsIsChanged(e) && this.withValueRefresh(this._update.bind(this, e));
  }
  /** Sets new options */
  _update(e) {
    Object.assign(this, e);
  }
  /** Mask state */
  get state() {
    return {
      _value: this.value,
      _rawInputValue: this.rawInputValue
    };
  }
  set state(e) {
    this._value = e._value;
  }
  /** Resets value */
  reset() {
    this._value = "";
  }
  get value() {
    return this._value;
  }
  set value(e) {
    this.resolve(e, {
      input: !0
    });
  }
  /** Resolve new value */
  resolve(e, t) {
    t === void 0 && (t = {
      input: !0
    }), this.reset(), this.append(e, t, ""), this.doCommit();
  }
  get unmaskedValue() {
    return this.value;
  }
  set unmaskedValue(e) {
    this.resolve(e, {});
  }
  get typedValue() {
    return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
  }
  set typedValue(e) {
    this.format ? this.value = this.format(e, this) : this.unmaskedValue = String(e);
  }
  /** Value that includes raw user input */
  get rawInputValue() {
    return this.extractInput(0, this.displayValue.length, {
      raw: !0
    });
  }
  set rawInputValue(e) {
    this.resolve(e, {
      raw: !0
    });
  }
  get displayValue() {
    return this.value;
  }
  get isComplete() {
    return !0;
  }
  get isFilled() {
    return this.isComplete;
  }
  /** Finds nearest input position in direction */
  nearestInputPos(e, t) {
    return e;
  }
  totalInputPositions(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), Math.min(this.displayValue.length, t - e);
  }
  /** Extracts value in range considering flags */
  extractInput(e, t, o) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this.displayValue.slice(e, t);
  }
  /** Extracts tail in range */
  extractTail(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new Qe(this.extractInput(e, t), e);
  }
  /** Appends tail */
  appendTail(e) {
    return Ft(e) && (e = new Qe(String(e))), e.appendTo(this);
  }
  /** Appends char */
  _appendCharRaw(e, t) {
    return e ? (this._value += e, new I({
      inserted: e,
      rawInserted: e
    })) : new I();
  }
  /** Appends char */
  _appendChar(e, t, o) {
    t === void 0 && (t = {});
    const i = this.state;
    let r;
    if ([e, r] = this.doPrepareChar(e, t), e && (r = r.aggregate(this._appendCharRaw(e, t)), !r.rawInserted && this.autofix === "pad")) {
      const n = this.state;
      this.state = i;
      let c = this.pad(t);
      const m = this._appendCharRaw(e, t);
      c = c.aggregate(m), m.rawInserted || c.equals(r) ? r = c : this.state = n;
    }
    if (r.inserted) {
      let n, c = this.doValidate(t) !== !1;
      if (c && o != null) {
        const m = this.state;
        if (this.overwrite === !0) {
          n = o.state;
          for (let f = 0; f < r.rawInserted.length; ++f)
            o.unshift(this.displayValue.length - r.tailShift);
        }
        let g = this.appendTail(o);
        if (c = g.rawInserted.length === o.toString().length, !(c && g.inserted) && this.overwrite === "shift") {
          this.state = m, n = o.state;
          for (let f = 0; f < r.rawInserted.length; ++f)
            o.shift();
          g = this.appendTail(o), c = g.rawInserted.length === o.toString().length;
        }
        c && g.inserted && (this.state = m);
      }
      c || (r = new I(), this.state = i, o && n && (o.state = n));
    }
    return r;
  }
  /** Appends optional placeholder at the end */
  _appendPlaceholder() {
    return new I();
  }
  /** Appends optional eager placeholder at the end */
  _appendEager() {
    return new I();
  }
  /** Appends symbols considering flags */
  append(e, t, o) {
    if (!Ft(e))
      throw new Error("value should be string");
    const i = Ft(o) ? new Qe(String(o)) : o;
    t != null && t.tail && (t._beforeTailState = this.state);
    let r;
    [e, r] = this.doPrepare(e, t);
    for (let n = 0; n < e.length; ++n) {
      const c = this._appendChar(e[n], t, i);
      if (!c.rawInserted && !this.doSkipInvalid(e[n], t, i))
        break;
      r.aggregate(c);
    }
    return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && r.aggregate(this._appendEager()), i != null && (r.tailShift += this.appendTail(i).tailShift), r;
  }
  remove(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this._value = this.displayValue.slice(0, e) + this.displayValue.slice(t), new I();
  }
  /** Calls function and reapplies current value */
  withValueRefresh(e) {
    if (this._refreshing || !this._initialized)
      return e();
    this._refreshing = !0;
    const t = this.rawInputValue, o = this.value, i = e();
    return this.rawInputValue = t, this.value && this.value !== o && o.indexOf(this.value) === 0 && (this.append(o.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
  }
  runIsolated(e) {
    if (this._isolated || !this._initialized)
      return e(this);
    this._isolated = !0;
    const t = this.state, o = e(this);
    return this.state = t, delete this._isolated, o;
  }
  doSkipInvalid(e, t, o) {
    return !!this.skipInvalid;
  }
  /** Prepares string before mask processing */
  doPrepare(e, t) {
    return t === void 0 && (t = {}), I.normalize(this.prepare ? this.prepare(e, this, t) : e);
  }
  /** Prepares each char before mask processing */
  doPrepareChar(e, t) {
    return t === void 0 && (t = {}), I.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
  }
  /** Validates if value is acceptable */
  doValidate(e) {
    return (!this.validate || this.validate(this.value, this, e)) && (!this.parent || this.parent.doValidate(e));
  }
  /** Does additional processing at the end of editing */
  doCommit() {
    this.commit && this.commit(this.value, this);
  }
  splice(e, t, o, i, r) {
    o === void 0 && (o = ""), i === void 0 && (i = B.NONE), r === void 0 && (r = {
      input: !0
    });
    const n = e + t, c = this.extractTail(n), m = this.eager === !0 || this.eager === "remove";
    let g;
    m && (i = Af(i), g = this.extractInput(0, n, {
      raw: !0
    }));
    let f = e;
    const v = new I();
    if (i !== B.NONE && (f = this.nearestInputPos(e, t > 1 && e !== 0 && !m ? B.NONE : i), v.tailShift = f - e), v.aggregate(this.remove(f)), m && i !== B.NONE && g === this.rawInputValue)
      if (i === B.FORCE_LEFT) {
        let x;
        for (; g === this.rawInputValue && (x = this.displayValue.length); )
          v.aggregate(new I({
            tailShift: -1
          })).aggregate(this.remove(x - 1));
      } else
        i === B.FORCE_RIGHT && c.unshift();
    return v.aggregate(this.append(o, r, c));
  }
  maskEquals(e) {
    return this.mask === e;
  }
  optionsIsChanged(e) {
    return !na(this, e);
  }
  typedValueEquals(e) {
    const t = this.typedValue;
    return e === t || ce.EMPTY_VALUES.includes(e) && ce.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
  }
  pad(e) {
    return new I();
  }
}
ce.DEFAULTS = {
  skipInvalid: !0
};
ce.EMPTY_VALUES = [void 0, null, ""];
z.Masked = ce;
class ro {
  /** */
  constructor(e, t) {
    e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
  }
  toString() {
    return this.chunks.map(String).join("");
  }
  extend(e) {
    if (!String(e))
      return;
    e = Ft(e) ? new Qe(String(e)) : e;
    const t = this.chunks[this.chunks.length - 1], o = t && // if stops are same or tail has no stop
    (t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
    e.from === t.from + t.toString().length;
    if (e instanceof Qe)
      o ? t.extend(e.toString()) : this.chunks.push(e);
    else if (e instanceof ro) {
      if (e.stop == null) {
        let i;
        for (; e.chunks.length && e.chunks[0].stop == null; )
          i = e.chunks.shift(), i.from += e.from, this.extend(i);
      }
      e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
    }
  }
  appendTo(e) {
    if (!(e instanceof z.MaskedPattern))
      return new Qe(this.toString()).appendTo(e);
    const t = new I();
    for (let o = 0; o < this.chunks.length; ++o) {
      const i = this.chunks[o], r = e._mapPosToBlock(e.displayValue.length), n = i.stop;
      let c;
      if (n != null && // if block not found or stop is behind lastBlock
      (!r || r.index <= n) && ((i instanceof ro || // for continuous block also check if stop is exist
      e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), c = i instanceof ro && e._blocks[n]), c) {
        const m = c.appendTail(i);
        t.aggregate(m);
        const g = i.toString().slice(m.rawInserted.length);
        g && t.aggregate(e.append(g, {
          tail: !0
        }));
      } else
        t.aggregate(e.append(i.toString(), {
          tail: !0
        }));
    }
    return t;
  }
  get state() {
    return {
      chunks: this.chunks.map((e) => e.state),
      from: this.from,
      stop: this.stop,
      blockIndex: this.blockIndex
    };
  }
  set state(e) {
    const {
      chunks: t,
      ...o
    } = e;
    Object.assign(this, o), this.chunks = t.map((i) => {
      const r = "chunks" in i ? new ro() : new Qe();
      return r.state = i, r;
    });
  }
  unshift(e) {
    if (!this.chunks.length || e != null && this.from >= e)
      return "";
    const t = e != null ? e - this.from : e;
    let o = 0;
    for (; o < this.chunks.length; ) {
      const i = this.chunks[o], r = i.unshift(t);
      if (i.toString()) {
        if (!r)
          break;
        ++o;
      } else
        this.chunks.splice(o, 1);
      if (r)
        return r;
    }
    return "";
  }
  shift() {
    if (!this.chunks.length)
      return "";
    let e = this.chunks.length - 1;
    for (; 0 <= e; ) {
      const t = this.chunks[e], o = t.shift();
      if (t.toString()) {
        if (!o)
          break;
        --e;
      } else
        this.chunks.splice(e, 1);
      if (o)
        return o;
    }
    return "";
  }
}
class Rf {
  constructor(e, t) {
    this.masked = e, this._log = [];
    const {
      offset: o,
      index: i
    } = e._mapPosToBlock(t) || (t < 0 ? (
      // first
      {
        index: 0,
        offset: 0
      }
    ) : (
      // last
      {
        index: this.masked._blocks.length,
        offset: 0
      }
    ));
    this.offset = o, this.index = i, this.ok = !1;
  }
  get block() {
    return this.masked._blocks[this.index];
  }
  get pos() {
    return this.masked._blockStartPos(this.index) + this.offset;
  }
  get state() {
    return {
      index: this.index,
      offset: this.offset,
      ok: this.ok
    };
  }
  set state(e) {
    Object.assign(this, e);
  }
  pushState() {
    this._log.push(this.state);
  }
  popState() {
    const e = this._log.pop();
    return e && (this.state = e), e;
  }
  bindBlock() {
    this.block || (this.index < 0 && (this.index = 0, this.offset = 0), this.index >= this.masked._blocks.length && (this.index = this.masked._blocks.length - 1, this.offset = this.block.displayValue.length));
  }
  _pushLeft(e) {
    for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((t = this.block) == null ? void 0 : t.displayValue.length) || 0) {
      var t;
      if (e())
        return this.ok = !0;
    }
    return this.ok = !1;
  }
  _pushRight(e) {
    for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
      if (e())
        return this.ok = !0;
    return this.ok = !1;
  }
  pushLeftBeforeFilled() {
    return this._pushLeft(() => {
      if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, B.FORCE_LEFT), this.offset !== 0))
        return !0;
    });
  }
  pushLeftBeforeInput() {
    return this._pushLeft(() => {
      if (!this.block.isFixed)
        return this.offset = this.block.nearestInputPos(this.offset, B.LEFT), !0;
    });
  }
  pushLeftBeforeRequired() {
    return this._pushLeft(() => {
      if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
        return this.offset = this.block.nearestInputPos(this.offset, B.LEFT), !0;
    });
  }
  pushRightBeforeFilled() {
    return this._pushRight(() => {
      if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, B.FORCE_RIGHT), this.offset !== this.block.value.length))
        return !0;
    });
  }
  pushRightBeforeInput() {
    return this._pushRight(() => {
      if (!this.block.isFixed)
        return this.offset = this.block.nearestInputPos(this.offset, B.NONE), !0;
    });
  }
  pushRightBeforeRequired() {
    return this._pushRight(() => {
      if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
        return this.offset = this.block.nearestInputPos(this.offset, B.NONE), !0;
    });
  }
}
class Bs {
  /** */
  /** */
  /** */
  /** */
  /** */
  /** */
  constructor(e) {
    Object.assign(this, e), this._value = "", this.isFixed = !0;
  }
  get value() {
    return this._value;
  }
  get unmaskedValue() {
    return this.isUnmasking ? this.value : "";
  }
  get rawInputValue() {
    return this._isRawInput ? this.value : "";
  }
  get displayValue() {
    return this.value;
  }
  reset() {
    this._isRawInput = !1, this._value = "";
  }
  remove(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._value = this._value.slice(0, e) + this._value.slice(t), this._value || (this._isRawInput = !1), new I();
  }
  nearestInputPos(e, t) {
    t === void 0 && (t = B.NONE);
    const o = 0, i = this._value.length;
    switch (t) {
      case B.LEFT:
      case B.FORCE_LEFT:
        return o;
      case B.NONE:
      case B.RIGHT:
      case B.FORCE_RIGHT:
      default:
        return i;
    }
  }
  totalInputPositions(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._isRawInput ? t - e : 0;
  }
  extractInput(e, t, o) {
    return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), o === void 0 && (o = {}), o.raw && this._isRawInput && this._value.slice(e, t) || "";
  }
  get isComplete() {
    return !0;
  }
  get isFilled() {
    return !!this._value;
  }
  _appendChar(e, t) {
    if (t === void 0 && (t = {}), this.isFilled)
      return new I();
    const o = this.eager === !0 || this.eager === "append", r = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !o) && !t.tail, n = new I({
      inserted: this.char,
      rawInserted: r ? this.char : ""
    });
    return this._value = this.char, this._isRawInput = r && (t.raw || t.input), n;
  }
  _appendEager() {
    return this._appendChar(this.char, {
      tail: !0
    });
  }
  _appendPlaceholder() {
    const e = new I();
    return this.isFilled || (this._value = e.inserted = this.char), e;
  }
  extractTail() {
    return new Qe("");
  }
  appendTail(e) {
    return Ft(e) && (e = new Qe(String(e))), e.appendTo(this);
  }
  append(e, t, o) {
    const i = this._appendChar(e[0], t);
    return o != null && (i.tailShift += this.appendTail(o).tailShift), i;
  }
  doCommit() {
  }
  get state() {
    return {
      _value: this._value,
      _rawInputValue: this.rawInputValue
    };
  }
  set state(e) {
    this._value = e._value, this._isRawInput = !!e._rawInputValue;
  }
  pad(e) {
    return this._appendPlaceholder();
  }
}
class sa {
  /** */
  /** */
  /** */
  /** */
  /** */
  /** */
  /** */
  /** */
  constructor(e) {
    const {
      parent: t,
      isOptional: o,
      placeholderChar: i,
      displayChar: r,
      lazy: n,
      eager: c,
      ...m
    } = e;
    this.masked = $t(m), Object.assign(this, {
      parent: t,
      isOptional: o,
      placeholderChar: i,
      displayChar: r,
      lazy: n,
      eager: c
    });
  }
  reset() {
    this.isFilled = !1, this.masked.reset();
  }
  remove(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), e === 0 && t >= 1 ? (this.isFilled = !1, this.masked.remove(e, t)) : new I();
  }
  get value() {
    return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
  }
  get unmaskedValue() {
    return this.masked.unmaskedValue;
  }
  get rawInputValue() {
    return this.masked.rawInputValue;
  }
  get displayValue() {
    return this.masked.value && this.displayChar || this.value;
  }
  get isComplete() {
    return !!this.masked.value || this.isOptional;
  }
  _appendChar(e, t) {
    if (t === void 0 && (t = {}), this.isFilled)
      return new I();
    const o = this.masked.state;
    let i = this.masked._appendChar(e, this.currentMaskFlags(t));
    return i.inserted && this.doValidate(t) === !1 && (i = new I(), this.masked.state = o), !i.inserted && !this.isOptional && !this.lazy && !t.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
  }
  append(e, t, o) {
    return this.masked.append(e, this.currentMaskFlags(t), o);
  }
  _appendPlaceholder() {
    return this.isFilled || this.isOptional ? new I() : (this.isFilled = !0, new I({
      inserted: this.placeholderChar
    }));
  }
  _appendEager() {
    return new I();
  }
  extractTail(e, t) {
    return this.masked.extractTail(e, t);
  }
  appendTail(e) {
    return this.masked.appendTail(e);
  }
  extractInput(e, t, o) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, o);
  }
  nearestInputPos(e, t) {
    t === void 0 && (t = B.NONE);
    const o = 0, i = this.value.length, r = Math.min(Math.max(e, o), i);
    switch (t) {
      case B.LEFT:
      case B.FORCE_LEFT:
        return this.isComplete ? r : o;
      case B.RIGHT:
      case B.FORCE_RIGHT:
        return this.isComplete ? r : i;
      case B.NONE:
      default:
        return r;
    }
  }
  totalInputPositions(e, t) {
    return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.value.slice(e, t).length;
  }
  doValidate(e) {
    return this.masked.doValidate(this.currentMaskFlags(e)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(e)));
  }
  doCommit() {
    this.masked.doCommit();
  }
  get state() {
    return {
      _value: this.value,
      _rawInputValue: this.rawInputValue,
      masked: this.masked.state,
      isFilled: this.isFilled
    };
  }
  set state(e) {
    this.masked.state = e.masked, this.isFilled = e.isFilled;
  }
  currentMaskFlags(e) {
    var t;
    return {
      ...e,
      _beforeTailState: (e == null || (t = e._beforeTailState) == null ? void 0 : t.masked) || e?._beforeTailState
    };
  }
  pad(e) {
    return new I();
  }
}
sa.DEFAULT_DEFINITIONS = {
  0: /\d/,
  a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
  // http://stackoverflow.com/a/22075070
  "*": /./
};
class Df extends ce {
  /** */
  /** Enable characters overwriting */
  /** */
  /** */
  /** */
  updateOptions(e) {
    super.updateOptions(e);
  }
  _update(e) {
    const t = e.mask;
    t && (e.validate = (o) => o.search(t) >= 0), super._update(e);
  }
}
z.MaskedRegExp = Df;
class de extends ce {
  /** */
  /** */
  /** Single char for empty input */
  /** Single char for filled input */
  /** Show placeholder only when needed */
  /** Enable characters overwriting */
  /** */
  /** */
  /** */
  constructor(e) {
    super({
      ...de.DEFAULTS,
      ...e,
      definitions: Object.assign({}, sa.DEFAULT_DEFINITIONS, e?.definitions)
    });
  }
  updateOptions(e) {
    super.updateOptions(e);
  }
  _update(e) {
    e.definitions = Object.assign({}, this.definitions, e.definitions), super._update(e), this._rebuildMask();
  }
  _rebuildMask() {
    const e = this.definitions;
    this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
    const t = this.mask;
    if (!t || !e)
      return;
    let o = !1, i = !1;
    for (let r = 0; r < t.length; ++r) {
      if (this.blocks) {
        const g = t.slice(r), f = Object.keys(this.blocks).filter((x) => g.indexOf(x) === 0);
        f.sort((x, _) => _.length - x.length);
        const v = f[0];
        if (v) {
          const {
            expose: x,
            repeat: _,
            ...$
          } = pi(this.blocks[v]), L = {
            lazy: this.lazy,
            eager: this.eager,
            placeholderChar: this.placeholderChar,
            displayChar: this.displayChar,
            overwrite: this.overwrite,
            autofix: this.autofix,
            ...$,
            repeat: _,
            parent: this
          }, N = _ != null ? new z.RepeatBlock(
            L
            /* TODO */
          ) : $t(L);
          N && (this._blocks.push(N), x && (this.exposeBlock = N), this._maskedBlocks[v] || (this._maskedBlocks[v] = []), this._maskedBlocks[v].push(this._blocks.length - 