import { proxyCustomElement, HTMLElement as HTMLElement$1, h as h$1, Host } from '@stencil/core/internal/client';

/*!
 * OverlayScrollbars
 * Version: 2.3.2
 *
 * Copyright (c) Rene Haas | KingSora.
 * https://github.com/KingSora
 *
 * Released under the MIT license.
 */

function each(t, n) {
  if (isArrayLike(t)) {
    for (let o = 0; o < t.length; o++) {
      if (n(t[o], o, t) === false) {
        break;
      }
    }
  } else if (t) {
    each(Object.keys(t), (o => n(t[o], o, t)));
  }
  return t;
}

function style(t, n) {
  const o = isString(n);
  const s = isArray(n) || o;
  if (s) {
    let s = o ? "" : {};
    if (t) {
      const e = window.getComputedStyle(t, null);
      s = o ? getCSSVal(t, e, n) : n.reduce(((n, o) => {
        n[o] = getCSSVal(t, e, o);
        return n;
      }), s);
    }
    return s;
  }
  t && each(keys(n), (o => setCSSVal(t, o, n[o])));
}

const createCache = (t, n) => {
  const {o: o, u: s, _: e} = t;
  let c = o;
  let r;
  const cacheUpdateContextual = (t, n) => {
    const o = c;
    const l = t;
    const i = n || (s ? !s(o, l) : o !== l);
    if (i || e) {
      c = l;
      r = o;
    }
    return [ c, i, r ];
  };
  const cacheUpdateIsolated = t => cacheUpdateContextual(n(c, r), t);
  const getCurrentCache = t => [ c, !!t, r ];
  return [ n ? cacheUpdateIsolated : cacheUpdateContextual, getCurrentCache ];
};

const isClient = () => typeof window !== "undefined";

const t = isClient() && Node.ELEMENT_NODE;

const {toString: n, hasOwnProperty: o} = Object.prototype;

const isUndefined = t => t === void 0;

const isNull = t => t === null;

const type = t => isUndefined(t) || isNull(t) ? `${t}` : n.call(t).replace(/^\[object (.+)\]$/, "$1").toLowerCase();

const isNumber = t => typeof t === "number";

const isString = t => typeof t === "string";

const isBoolean = t => typeof t === "boolean";

const isFunction = t => typeof t === "function";

const isArray = t => Array.isArray(t);

const isObject = t => typeof t === "object" && !isArray(t) && !isNull(t);

const isArrayLike = t => {
  const n = !!t && t.length;
  const o = isNumber(n) && n > -1 && n % 1 == 0;
  return isArray(t) || !isFunction(t) && o ? n > 0 && isObject(t) ? n - 1 in t : true : false;
};

const isPlainObject = t => {
  if (!t || !isObject(t) || type(t) !== "object") {
    return false;
  }
  let n;
  const s = "constructor";
  const e = t[s];
  const c = e && e.prototype;
  const r = o.call(t, s);
  const l = c && o.call(c, "isPrototypeOf");
  if (e && !r && !l) {
    return false;
  }
  for (n in t) {}
  return isUndefined(n) || o.call(t, n);
};

const isHTMLElement = n => {
  const o = HTMLElement;
  return n ? o ? n instanceof o : n.nodeType === t : false;
};

const isElement = n => {
  const o = Element;
  return n ? o ? n instanceof o : n.nodeType === t : false;
};

const indexOf = (t, n, o) => t.indexOf(n, o);

const push = (t, n, o) => {
  !o && !isString(n) && isArrayLike(n) ? Array.prototype.push.apply(t, n) : t.push(n);
  return t;
};

const from = t => {
  const n = Array.from;
  const o = [];
  if (n && t) {
    return n(t);
  }
  if (t instanceof Set) {
    t.forEach((t => {
      push(o, t);
    }));
  } else {
    each(t, (t => {
      push(o, t);
    }));
  }
  return o;
};

const isEmptyArray = t => !!t && t.length === 0;

const runEachAndClear = (t, n, o) => {
  const runFn = t => t && t.apply(void 0, n || []);
  each(t, runFn);
  !o && (t.length = 0);
};

const hasOwnProperty = (t, n) => Object.prototype.hasOwnProperty.call(t, n);

const keys = t => t ? Object.keys(t) : [];

const assignDeep = (t, n, o, s, e, c, r) => {
  const l = [ n, o, s, e, c, r ];
  if ((typeof t !== "object" || isNull(t)) && !isFunction(t)) {
    t = {};
  }
  each(l, (n => {
    each(keys(n), (o => {
      const s = n[o];
      if (t === s) {
        return true;
      }
      const e = isArray(s);
      if (s && isPlainObject(s)) {
        const n = t[o];
        let c = n;
        if (e && !isArray(n)) {
          c = [];
        } else if (!e && !isPlainObject(n)) {
          c = {};
        }
        t[o] = assignDeep(c, s);
      } else {
        t[o] = e ? s.slice() : s;
      }
    }));
  }));
  return t;
};

const isEmptyObject = t => {
  for (const n in t) {
    return false;
  }
  return true;
};

const getSetProp = (t, n, o, s) => {
  if (isUndefined(s)) {
    return o ? o[t] : n;
  }
  o && (isString(s) || isNumber(s)) && (o[t] = s);
};

const attr = (t, n, o) => {
  if (isUndefined(o)) {
    return t ? t.getAttribute(n) : null;
  }
  t && t.setAttribute(n, o);
};

const getValueSet = (t, n) => new Set((attr(t, n) || "").split(" "));

const removeAttr = (t, n) => {
  t && t.removeAttribute(n);
};

const attrClass = (t, n, o, s) => {
  if (o) {
    const e = getValueSet(t, n);
    e[s ? "add" : "delete"](o);
    const c = from(e).join(" ").trim();
    attr(t, n, c);
  }
};

const hasAttrClass = (t, n, o) => getValueSet(t, n).has(o);

const scrollLeft = (t, n) => getSetProp("scrollLeft", 0, t, n);

const scrollTop = (t, n) => getSetProp("scrollTop", 0, t, n);

const s = isClient() && Element.prototype;

const find = (t, n) => {
  const o = [];
  const s = n ? isElement(n) && n : document;
  return s ? push(o, s.querySelectorAll(t)) : o;
};

const findFirst = (t, n) => {
  const o = n ? isElement(n) && n : document;
  return o ? o.querySelector(t) : null;
};

const is = (t, n) => {
  if (isElement(t)) {
    const o = s.matches || s.msMatchesSelector;
    return o.call(t, n);
  }
  return false;
};

const contents = t => t ? from(t.childNodes) : [];

const parent = t => t && t.parentElement;

const closest = (t, n) => {
  if (isElement(t)) {
    const o = s.closest;
    if (o) {
      return o.call(t, n);
    }
    do {
      if (is(t, n)) {
        return t;
      }
      t = parent(t);
    } while (t);
  }
};

const liesBetween = (t, n, o) => {
  const s = closest(t, n);
  const e = t && findFirst(o, s);
  const c = closest(e, n) === s;
  return s && e ? s === t || e === t || c && closest(closest(t, o), n) !== s : false;
};

const before = (t, n, o) => {
  if (o && t) {
    let s = n;
    let e;
    if (isArrayLike(o)) {
      e = document.createDocumentFragment();
      each(o, (t => {
        if (t === s) {
          s = t.previousSibling;
        }
        e.appendChild(t);
      }));
    } else {
      e = o;
    }
    if (n) {
      if (!s) {
        s = t.firstChild;
      } else if (s !== n) {
        s = s.nextSibling;
      }
    }
    t.insertBefore(e, s || null);
  }
};

const appendChildren = (t, n) => {
  before(t, null, n);
};

const insertBefore = (t, n) => {
  before(parent(t), t, n);
};

const insertAfter = (t, n) => {
  before(parent(t), t && t.nextSibling, n);
};

const removeElements = t => {
  if (isArrayLike(t)) {
    each(from(t), (t => removeElements(t)));
  } else if (t) {
    const n = parent(t);
    if (n) {
      n.removeChild(t);
    }
  }
};

const createDiv = t => {
  const n = document.createElement("div");
  if (t) {
    attr(n, "class", t);
  }
  return n;
};

const createDOM = t => {
  const n = createDiv();
  n.innerHTML = t.trim();
  return each(contents(n), (t => removeElements(t)));
};

const firstLetterToUpper = t => t.charAt(0).toUpperCase() + t.slice(1);

const getDummyStyle = () => createDiv().style;

const e = [ "-webkit-", "-moz-", "-o-", "-ms-" ];

const c = [ "WebKit", "Moz", "O", "MS", "webkit", "moz", "o", "ms" ];

const r = {};

const l = {};

const cssProperty = t => {
  let n = l[t];
  if (hasOwnProperty(l, t)) {
    return n;
  }
  const o = firstLetterToUpper(t);
  const s = getDummyStyle();
  each(e, (e => {
    const c = e.replace(/-/g, "");
    const r = [ t, e + t, c + o, firstLetterToUpper(c) + o ];
    return !(n = r.find((t => s[t] !== void 0)));
  }));
  return l[t] = n || "";
};

const jsAPI = t => {
  if (isClient()) {
    let n = r[t] || window[t];
    if (hasOwnProperty(r, t)) {
      return n;
    }
    each(c, (o => {
      n = n || window[o + firstLetterToUpper(t)];
      return !n;
    }));
    r[t] = n;
    return n;
  }
};

const i = jsAPI("MutationObserver");

const a = jsAPI("IntersectionObserver");

const u = jsAPI("ResizeObserver");

const f = jsAPI("cancelAnimationFrame");

const d = jsAPI("requestAnimationFrame");

const _ = jsAPI("ScrollTimeline");

const h = isClient() && window.setTimeout;

const g = isClient() && window.clearTimeout;

const v = /[^\x20\t\r\n\f]+/g;

const classListAction = (t, n, o) => {
  const s = t && t.classList;
  let e;
  let c = 0;
  let r = false;
  if (s && n && isString(n)) {
    const t = n.match(v) || [];
    r = t.length > 0;
    while (e = t[c++]) {
      r = !!o(s, e) && r;
    }
  }
  return r;
};

const removeClass = (t, n) => {
  classListAction(t, n, ((t, n) => t.remove(n)));
};

const addClass = (t, n) => {
  classListAction(t, n, ((t, n) => t.add(n)));
  return removeClass.bind(0, t, n);
};

const equal = (t, n, o, s) => {
  if (t && n) {
    let e = true;
    each(o, (o => {
      const c = s ? s(t[o]) : t[o];
      const r = s ? s(n[o]) : n[o];
      if (c !== r) {
        e = false;
      }
    }));
    return e;
  }
  return false;
};

const equalWH = (t, n) => equal(t, n, [ "w", "h" ]);

const equalXY = (t, n) => equal(t, n, [ "x", "y" ]);

const equalTRBL = (t, n) => equal(t, n, [ "t", "r", "b", "l" ]);

const equalBCRWH = (t, n, o) => equal(t, n, [ "width", "height" ], o && (t => Math.round(t)));

const noop = () => {};

const selfClearTimeout = t => {
  let n;
  const o = t ? h : d;
  const s = t ? g : f;
  return [ e => {
    s(n);
    n = o(e, isFunction(t) ? t() : t);
  }, () => s(n) ];
};

const debounce = (t, n) => {
  let o;
  let s;
  let e;
  let c = noop;
  const {g: r, v: l, p: i} = n || {};
  const a = function invokeFunctionToDebounce(n) {
    c();
    g(o);
    o = s = void 0;
    c = noop;
    t.apply(this, n);
  };
  const mergeParms = t => i && s ? i(s, t) : t;
  const flush = () => {
    if (c !== noop) {
      a(mergeParms(e) || e);
    }
  };
  const u = function debouncedFn() {
    const t = from(arguments);
    const n = isFunction(r) ? r() : r;
    const i = isNumber(n) && n >= 0;
    if (i) {
      const r = isFunction(l) ? l() : l;
      const i = isNumber(r) && r >= 0;
      const u = n > 0 ? h : d;
      const _ = n > 0 ? g : f;
      const v = mergeParms(t);
      const p = v || t;
      const w = a.bind(0, p);
      c();
      const b = u(w, n);
      c = () => _(b);
      if (i && !o) {
        o = h(flush, r);
      }
      s = e = p;
    } else {
      a(t);
    }
  };
  u.m = flush;
  return u;
};

const w = {
  opacity: 1,
  zIndex: 1
};

const parseToZeroOrNumber = (t, n) => {
  const o = t || "";
  const s = n ? parseFloat(o) : parseInt(o, 10);
  return s === s ? s : 0;
};

const adaptCSSVal = (t, n) => !w[t] && isNumber(n) ? `${n}px` : n;

const getCSSVal = (t, n, o) => String((n != null ? n[o] || n.getPropertyValue(o) : t.style[o]) || "");

const setCSSVal = (t, n, o) => {
  try {
    const {style: s} = t;
    if (!isUndefined(s[n])) {
      s[n] = adaptCSSVal(n, o);
    } else {
      s.setProperty(n, o);
    }
  } catch (s) {}
};

const directionIsRTL = t => style(t, "direction") === "rtl";

const topRightBottomLeft = (t, n, o) => {
  const s = n ? `${n}-` : "";
  const e = o ? `-${o}` : "";
  const c = `${s}top${e}`;
  const r = `${s}right${e}`;
  const l = `${s}bottom${e}`;
  const i = `${s}left${e}`;
  const a = style(t, [ c, r, l, i ]);
  return {
    t: parseToZeroOrNumber(a[c], true),
    r: parseToZeroOrNumber(a[r], true),
    b: parseToZeroOrNumber(a[l], true),
    l: parseToZeroOrNumber(a[i], true)
  };
};

const getTrasformTranslateValue = (t, n) => `translate${isArray(t) ? `(${t[0]},${t[1]})` : `${n ? "X" : "Y"}(${t})`}`;

const {round: b} = Math;

const m = {
  w: 0,
  h: 0
};

const offsetSize = t => t ? {
  w: t.offsetWidth,
  h: t.offsetHeight
} : m;

const clientSize = t => t ? {
  w: t.clientWidth,
  h: t.clientHeight
} : m;

const scrollSize = t => t ? {
  w: t.scrollWidth,
  h: t.scrollHeight
} : m;

const fractionalSize = t => {
  const n = parseFloat(style(t, "height")) || 0;
  const o = parseFloat(style(t, "width")) || 0;
  return {
    w: o - b(o),
    h: n - b(n)
  };
};

const getBoundingClientRect = t => t.getBoundingClientRect();

const domRectHasDimensions = t => !!(t && (t.height || t.width));

let y;

const supportPassiveEvents = () => {
  if (isUndefined(y)) {
    y = false;
    try {
      window.addEventListener("test", null, Object.defineProperty({}, "passive", {
        get() {
          y = true;
        }
      }));
    } catch (t) {}
  }
  return y;
};

const splitEventNames = t => t.split(" ");

const off = (t, n, o, s) => {
  each(splitEventNames(n), (n => {
    t.removeEventListener(n, o, s);
  }));
};

const on = (t, n, o, s) => {
  var e;
  const c = supportPassiveEvents();
  const r = (e = c && s && s.S) != null ? e : c;
  const l = s && s.$ || false;
  const i = s && s.C || false;
  const a = [];
  const u = c ? {
    passive: r,
    capture: l
  } : l;
  each(splitEventNames(n), (n => {
    const s = i ? e => {
      t.removeEventListener(n, s, l);
      o && o(e);
    } : o;
    push(a, off.bind(null, t, n, s, l));
    t.addEventListener(n, s, u);
  }));
  return runEachAndClear.bind(0, a);
};

const stopPropagation = t => t.stopPropagation();

const preventDefault = t => t.preventDefault();

const S = {
  x: 0,
  y: 0
};

const absoluteCoordinates = t => {
  const n = t ? getBoundingClientRect(t) : 0;
  return n ? {
    x: n.left + window.pageYOffset,
    y: n.top + window.pageXOffset
  } : S;
};

const manageListener = (t, n) => {
  each(isArray(n) ? n : [ n ], t);
};

const createEventListenerHub = t => {
  const n = new Map;
  const removeEvent = (t, o) => {
    if (t) {
      const s = n.get(t);
      manageListener((t => {
        if (s) {
          s[t ? "delete" : "clear"](t);
        }
      }), o);
    } else {
      n.forEach((t => {
        t.clear();
      }));
      n.clear();
    }
  };
  const addEvent = (t, o) => {
    if (isString(t)) {
      const s = n.get(t) || new Set;
      n.set(t, s);
      manageListener((t => {
        isFunction(t) && s.add(t);
      }), o);
      return removeEvent.bind(0, t, o);
    }
    if (isBoolean(o) && o) {
      removeEvent();
    }
    const s = keys(t);
    const e = [];
    each(s, (n => {
      const o = t[n];
      o && push(e, addEvent(n, o));
    }));
    return runEachAndClear.bind(0, e);
  };
  const triggerEvent = (t, o) => {
    const s = n.get(t);
    each(from(s), (t => {
      if (o && !isEmptyArray(o)) {
        t.apply(0, o);
      } else {
        t();
      }
    }));
  };
  addEvent(t || {});
  return [ addEvent, removeEvent, triggerEvent ];
};

const opsStringify = t => JSON.stringify(t, ((t, n) => {
  if (isFunction(n)) {
    throw new Error;
  }
  return n;
}));

const $ = {
  paddingAbsolute: false,
  showNativeOverlaidScrollbars: false,
  update: {
    elementEvents: [ [ "img", "load" ] ],
    debounce: [ 0, 33 ],
    attributes: null,
    ignoreMutation: null
  },
  overflow: {
    x: "scroll",
    y: "scroll"
  },
  scrollbars: {
    theme: "os-theme-dark",
    visibility: "auto",
    autoHide: "never",
    autoHideDelay: 1300,
    autoHideSuspend: false,
    dragScroll: true,
    clickScroll: false,
    pointers: [ "mouse", "touch", "pen" ]
  }
};

const getOptionsDiff = (t, n) => {
  const o = {};
  const s = keys(n).concat(keys(t));
  each(s, (s => {
    const e = t[s];
    const c = n[s];
    if (isObject(e) && isObject(c)) {
      assignDeep(o[s] = {}, getOptionsDiff(e, c));
      if (isEmptyObject(o[s])) {
        delete o[s];
      }
    } else if (hasOwnProperty(n, s) && c !== e) {
      let t = true;
      if (isArray(e) || isArray(c)) {
        try {
          if (opsStringify(e) === opsStringify(c)) {
            t = false;
          }
        } catch (r) {}
      }
      if (t) {
        o[s] = c;
      }
    }
  }));
  return o;
};

const x = `data-overlayscrollbars`;

const C = "os-environment";

const O = `${C}-flexbox-glue`;

const T = `${O}-max`;

const z = `os-scrollbar-hidden`;

const E = `${x}-initialize`;

const A = x;

const I = `${A}-overflow-x`;

const H = `${A}-overflow-y`;

const L = "overflowVisible";

const P = "scrollbarHidden";

const M = "scrollbarPressed";

const D = "updating";

const R = `${x}-viewport`;

const k = "arrange";

const B = "scrollbarHidden";

const V = L;

const Y = `${x}-padding`;

const j = V;

const N = `${x}-content`;

const q = "os-size-observer";

const F = `${q}-appear`;

const G = `${q}-listener`;

const Z = "os-trinsic-observer";

const J = "os-no-css-vars";

const K = "os-theme-none";

const Q = "os-scrollbar";

const tt = `${Q}-rtl`;

const nt = `${Q}-horizontal`;

const ot = `${Q}-vertical`;

const st = `${Q}-track`;

const et = `${Q}-handle`;

const ct = `${Q}-visible`;

const rt = `${Q}-cornerless`;

const lt = `${Q}-transitionless`;

const it = `${Q}-interaction`;

const at = `${Q}-unusable`;

const ut = `${Q}-auto-hide`;

const ft = `${ut}-hidden`;

const dt = `${Q}-wheel`;

const _t = `${st}-interactive`;

const ht = `${et}-interactive`;

const gt = {};

const getPlugins = () => gt;

const addPlugin = t => {
  const n = [];
  each(isArray(t) ? t : [ t ], (t => {
    const o = keys(t);
    each(o, (o => {
      push(n, gt[o] = t[o]);
    }));
  }));
  return n;
};

const $t = "__osOptionsValidationPlugin";

const Ot = "__osSizeObserverPlugin";

const It = "__osScrollbarsHidingPlugin";

const Lt = "__osClickScrollPlugin";

let Mt;

const getNativeScrollbarSize = (t, n, o, s) => {
  appendChildren(t, n);
  const e = clientSize(n);
  const c = offsetSize(n);
  const r = fractionalSize(o);
  s && removeElements(n);
  return {
    x: c.h - e.h + r.h,
    y: c.w - e.w + r.w
  };
};

const getNativeScrollbarsHiding = t => {
  let n = false;
  const o = addClass(t, z);
  try {
    n = style(t, cssProperty("scrollbar-width")) === "none" || window.getComputedStyle(t, "::-webkit-scrollbar").getPropertyValue("display") === "none";
  } catch (s) {}
  o();
  return n;
};

const getRtlScrollBehavior = (t, n) => {
  const o = "hidden";
  style(t, {
    overflowX: o,
    overflowY: o,
    direction: "rtl"
  });
  scrollLeft(t, 0);
  const s = absoluteCoordinates(t);
  const e = absoluteCoordinates(n);
  scrollLeft(t, -999);
  const c = absoluteCoordinates(n);
  return {
    i: s.x === e.x,
    n: e.x !== c.x
  };
};

const getFlexboxGlue = (t, n) => {
  const o = addClass(t, O);
  const s = getBoundingClientRect(t);
  const e = getBoundingClientRect(n);
  const c = equalBCRWH(e, s, true);
  const r = addClass(t, T);
  const l = getBoundingClientRect(t);
  const i = getBoundingClientRect(n);
  const a = equalBCRWH(i, l, true);
  o();
  r();
  return c && a;
};

const createEnvironment = () => {
  const {body: t} = document;
  const n = createDOM(`<div class="${C}"><div></div></div>`);
  const o = n[0];
  const s = o.firstChild;
  const [e, , c] = createEventListenerHub();
  const [r, l] = createCache({
    o: getNativeScrollbarSize(t, o, s),
    u: equalXY
  }, getNativeScrollbarSize.bind(0, t, o, s, true));
  const [i] = l();
  const a = getNativeScrollbarsHiding(o);
  const u = {
    x: i.x === 0,
    y: i.y === 0
  };
  const f = {
    elements: {
      host: null,
      padding: !a,
      viewport: t => a && t === t.ownerDocument.body && t,
      content: false
    },
    scrollbars: {
      slot: true
    },
    cancel: {
      nativeScrollbarsOverlaid: false,
      body: null
    }
  };
  const d = assignDeep({}, $);
  const h = assignDeep.bind(0, {}, d);
  const g = assignDeep.bind(0, {}, f);
  const v = {
    k: i,
    I: u,
    A: a,
    H: style(o, "zIndex") === "-1",
    B: !!_,
    V: getRtlScrollBehavior(o, s),
    Y: getFlexboxGlue(o, s),
    j: e.bind(0, "z"),
    N: e.bind(0, "r"),
    q: g,
    F: t => assignDeep(f, t) && g(),
    G: h,
    X: t => assignDeep(d, t) && h(),
    U: assignDeep({}, f),
    W: assignDeep({}, d)
  };
  const p = window.addEventListener;
  const w = debounce((t => c(t ? "z" : "r")), {
    g: 33,
    v: 99
  });
  removeAttr(o, "style");
  removeElements(o);
  p("resize", w.bind(0, false));
  if (!a && (!u.x || !u.y)) {
    let t;
    p("resize", (() => {
      const n = getPlugins()[It];
      t = t || n && n.R();
      t && t(v, r, w.bind(0, true));
    }));
  }
  return v;
};

const getEnvironment = () => {
  if (!Mt) {
    Mt = createEnvironment();
  }
  return Mt;
};

const resolveInitialization = (t, n) => isFunction(n) ? n.apply(0, t) : n;

const staticInitializationElement = (t, n, o, s) => {
  const e = isUndefined(s) ? o : s;
  const c = resolveInitialization(t, e);
  return c || n.apply(0, t);
};

const dynamicInitializationElement = (t, n, o, s) => {
  const e = isUndefined(s) ? o : s;
  const c = resolveInitialization(t, e);
  return !!c && (isHTMLElement(c) ? c : n.apply(0, t));
};

const cancelInitialization = (t, n, o) => {
  const {nativeScrollbarsOverlaid: s, body: e} = o || {};
  const {I: c, A: r} = getEnvironment();
  const {nativeScrollbarsOverlaid: l, body: i} = n;
  const a = s != null ? s : l;
  const u = isUndefined(e) ? i : e;
  const f = (c.x || c.y) && a;
  const d = t && (isNull(u) ? !r : u);
  return !!f || !!d;
};

const Dt = new WeakMap;

const addInstance = (t, n) => {
  Dt.set(t, n);
};

const removeInstance = t => {
  Dt.delete(t);
};

const getInstance = t => Dt.get(t);

const getPropByPath = (t, n) => t ? n.split(".").reduce(((t, n) => t && hasOwnProperty(t, n) ? t[n] : void 0), t) : void 0;

const createOptionCheck = (t, n, o) => s => [ getPropByPath(t, s), o || getPropByPath(n, s) !== void 0 ];

const createState = t => {
  let n = t;
  return [ () => n, t => {
    n = assignDeep({}, n, t);
  } ];
};

const Rt = "tabindex";

const kt = createDiv.bind(0, "");

const unwrap = t => {
  appendChildren(parent(t), contents(t));
  removeElements(t);
};

const createStructureSetupElements = t => {
  const n = getEnvironment();
  const {q: o, A: s} = n;
  const e = getPlugins()[It];
  const c = e && e.T;
  const {elements: r} = o();
  const {host: l, padding: i, viewport: a, content: u} = r;
  const f = isHTMLElement(t);
  const d = f ? {} : t;
  const {elements: _} = d;
  const {host: h, padding: g, viewport: v, content: p} = _ || {};
  const w = f ? t : d.target;
  const b = is(w, "textarea");
  const m = w.ownerDocument;
  const y = m.documentElement;
  const S = w === m.body;
  const $ = m.defaultView;
  const x = staticInitializationElement.bind(0, [ w ]);
  const C = dynamicInitializationElement.bind(0, [ w ]);
  const O = resolveInitialization.bind(0, [ w ]);
  const T = x.bind(0, kt, a);
  const L = C.bind(0, kt, u);
  const P = T(v);
  const M = P === w;
  const D = M && S;
  const k = !M && L(p);
  const V = !M && isHTMLElement(P) && P === k;
  const j = V && !!O(u);
  const q = j ? T() : P;
  const F = j ? k : L();
  const G = V ? q : P;
  const X = D ? y : G;
  const U = b ? x(kt, l, h) : w;
  const W = D ? X : U;
  const Z = V ? F : k;
  const J = m.activeElement;
  const K = !M && $.top === $ && J === w;
  const Q = {
    Z: w,
    J: W,
    K: X,
    tt: !M && C(kt, i, g),
    nt: Z,
    ot: !M && !s && c && c(n),
    st: D ? y : X,
    et: D ? m : X,
    ct: $,
    rt: m,
    lt: b,
    it: S,
    ut: f,
    ft: M,
    dt: V,
    _t: (t, n) => hasAttrClass(X, M ? A : R, M ? n : t),
    ht: (t, n, o) => attrClass(X, M ? A : R, M ? n : t, o)
  };
  const tt = keys(Q).reduce(((t, n) => {
    const o = Q[n];
    return push(t, o && isHTMLElement(o) && !parent(o) ? o : false);
  }), []);
  const elementIsGenerated = t => t ? indexOf(tt, t) > -1 : null;
  const {Z: nt, J: ot, tt: st, K: et, nt: ct, ot: rt} = Q;
  const lt = [ () => {
    removeAttr(ot, A);
    removeAttr(ot, E);
    removeAttr(nt, E);
    if (S) {
      removeAttr(y, A);
      removeAttr(y, E);
    }
  } ];
  const it = b && elementIsGenerated(ot);
  let at = b ? nt : contents([ ct, et, st, ot, nt ].find((t => elementIsGenerated(t) === false)));
  const ut = D ? nt : ct || et;
  const appendElements = () => {
    attr(ot, A, M ? "viewport" : "host");
    attr(st, Y, "");
    attr(ct, N, "");
    if (!M) {
      attr(et, R, "");
    }
    const t = S && !M ? addClass(parent(w), z) : noop;
    if (it) {
      insertAfter(nt, ot);
      push(lt, (() => {
        insertAfter(ot, nt);
        removeElements(ot);
      }));
    }
    appendChildren(ut, at);
    appendChildren(ot, st);
    appendChildren(st || ot, !M && et);
    appendChildren(et, ct);
    push(lt, (() => {
      t();
      removeAttr(st, Y);
      removeAttr(ct, N);
      removeAttr(et, I);
      removeAttr(et, H);
      removeAttr(et, R);
      if (elementIsGenerated(ct)) {
        unwrap(ct);
      }
      if (elementIsGenerated(et)) {
        unwrap(et);
      }
      if (elementIsGenerated(st)) {
        unwrap(st);
      }
    }));
    if (s && !M) {
      attrClass(et, R, B, true);
      push(lt, removeAttr.bind(0, et, R));
    }
    if (rt) {
      insertBefore(et, rt);
      push(lt, removeElements.bind(0, rt));
    }
    if (K) {
      const t = attr(et, Rt);
      attr(et, Rt, "-1");
      et.focus();
      const revertViewportTabIndex = () => t ? attr(et, Rt, t) : removeAttr(et, Rt);
      const n = on(m, "pointerdown keydown", (() => {
        revertViewportTabIndex();
        n();
      }));
      push(lt, [ revertViewportTabIndex, n ]);
    } else if (J && J.focus) {
      J.focus();
    }
    at = 0;
  };
  return [ Q, appendElements, runEachAndClear.bind(0, lt) ];
};

const createTrinsicUpdateSegment = (t, n) => {
  const {nt: o} = t;
  const [s] = n;
  return t => {
    const {Y: n} = getEnvironment();
    const {gt: e} = s();
    const {vt: c} = t;
    const r = (o || !n) && c;
    if (r) {
      style(o, {
        height: e ? "" : "100%"
      });
    }
    return {
      wt: r,
      bt: r
    };
  };
};

const createPaddingUpdateSegment = (t, n) => {
  const [o, s] = n;
  const {J: e, tt: c, K: r, ft: l} = t;
  const [i, a] = createCache({
    u: equalTRBL,
    o: topRightBottomLeft()
  }, topRightBottomLeft.bind(0, e, "padding", ""));
  return (t, n, e) => {
    let [u, f] = a(e);
    const {A: d, Y: _} = getEnvironment();
    const {yt: h} = o();
    const {wt: g, bt: v, St: p} = t;
    const [w, b] = n("paddingAbsolute");
    const m = !_ && v;
    if (g || f || m) {
      [u, f] = i(e);
    }
    const y = !l && (b || p || f);
    if (y) {
      const t = !w || !c && !d;
      const n = u.r + u.l;
      const o = u.t + u.b;
      const e = {
        marginRight: t && !h ? -n : 0,
        marginBottom: t ? -o : 0,
        marginLeft: t && h ? -n : 0,
        top: t ? -u.t : 0,
        right: t ? h ? -u.r : "auto" : 0,
        left: t ? h ? "auto" : -u.l : 0,
        width: t ? `calc(100% + ${n}px)` : ""
      };
      const l = {
        paddingTop: t ? u.t : 0,
        paddingRight: t ? u.r : 0,
        paddingBottom: t ? u.b : 0,
        paddingLeft: t ? u.l : 0
      };
      style(c || r, e);
      style(r, l);
      s({
        tt: u,
        $t: !t,
        P: c ? l : assignDeep({}, e, l)
      });
    }
    return {
      xt: y
    };
  };
};

const {max: Bt} = Math;

const Vt = Bt.bind(0, 0);

const Yt = "visible";

const jt = "hidden";

const Nt = 42;

const qt = {
  u: equalWH,
  o: {
    w: 0,
    h: 0
  }
};

const Ft = {
  u: equalXY,
  o: {
    x: jt,
    y: jt
  }
};

const getOverflowAmount = (t, n) => {
  const o = window.devicePixelRatio % 1 !== 0 ? 1 : 0;
  const s = {
    w: Vt(t.w - n.w),
    h: Vt(t.h - n.h)
  };
  return {
    w: s.w > o ? s.w : 0,
    h: s.h > o ? s.h : 0
  };
};

const overflowIsVisible = t => t.indexOf(Yt) === 0;

const createOverflowUpdateSegment = (t, n) => {
  const [o, s] = n;
  const {J: e, tt: c, K: r, ot: l, ft: i, ht: a, it: u, ct: f} = t;
  const {k: d, Y: _, A: h, I: g} = getEnvironment();
  const v = getPlugins()[It];
  const p = !i && !h && (g.x || g.y);
  const w = u && i;
  const [b, m] = createCache(qt, fractionalSize.bind(0, r));
  const [y, S] = createCache(qt, scrollSize.bind(0, r));
  const [$, x] = createCache(qt);
  const [C, O] = createCache(qt);
  const [T] = createCache(Ft);
  const fixFlexboxGlue = (t, n) => {
    style(r, {
      height: ""
    });
    if (n) {
      const {$t: n, tt: s} = o();
      const {Ct: c, M: l} = t;
      const i = fractionalSize(e);
      const a = clientSize(e);
      const u = style(r, "boxSizing") === "content-box";
      const f = n || u ? s.b + s.t : 0;
      const d = !(g.x && u);
      style(r, {
        height: a.h + i.h + (c.x && d ? l.x : 0) - f
      });
    }
  };
  const getViewportOverflowState = (t, n) => {
    const o = !h && !t ? Nt : 0;
    const getStatePerAxis = (t, s, e) => {
      const c = style(r, t);
      const l = n ? n[t] : c;
      const i = l === "scroll";
      const a = s ? o : e;
      const u = i && !h ? a : 0;
      const f = s && !!o;
      return [ c, i, u, f ];
    };
    const [s, e, c, l] = getStatePerAxis("overflowX", g.x, d.x);
    const [i, a, u, f] = getStatePerAxis("overflowY", g.y, d.y);
    return {
      Ot: {
        x: s,
        y: i
      },
      Ct: {
        x: e,
        y: a
      },
      M: {
        x: c,
        y: u
      },
      D: {
        x: l,
        y: f
      }
    };
  };
  const setViewportOverflowState = (t, n, o, s) => {
    const setAxisOverflowStyle = (t, n) => {
      const o = overflowIsVisible(t);
      const s = n && o && t.replace(`${Yt}-`, "") || "";
      return [ n && !o ? t : "", overflowIsVisible(s) ? "hidden" : s ];
    };
    const [e, c] = setAxisOverflowStyle(o.x, n.x);
    const [r, l] = setAxisOverflowStyle(o.y, n.y);
    s.overflowX = c && r ? c : e;
    s.overflowY = l && e ? l : r;
    return getViewportOverflowState(t, s);
  };
  const hideNativeScrollbars = (t, n, s, e) => {
    const {M: c, D: r} = t;
    const {x: l, y: i} = r;
    const {x: a, y: u} = c;
    const {P: f} = o();
    const d = n ? "marginLeft" : "marginRight";
    const _ = n ? "paddingLeft" : "paddingRight";
    const h = f[d];
    const g = f.marginBottom;
    const v = f[_];
    const p = f.paddingBottom;
    e.width = `calc(100% + ${u + h * -1}px)`;
    e[d] = -u + h;
    e.marginBottom = -a + g;
    if (s) {
      e[_] = v + (i ? u : 0);
      e.paddingBottom = p + (l ? a : 0);
    }
  };
  const [z, E] = v ? v.L(p, _, r, l, o, getViewportOverflowState, hideNativeScrollbars) : [ () => p, () => [ noop ] ];
  return (t, n, l) => {
    const {wt: u, Tt: d, bt: v, xt: p, vt: M, St: D} = t;
    const {gt: k, yt: N} = o();
    const [q, F] = n("showNativeOverlaidScrollbars");
    const [G, X] = n("overflow");
    const U = q && g.x && g.y;
    const W = !i && !_ && (u || v || d || F || M);
    const Z = overflowIsVisible(G.x);
    const J = overflowIsVisible(G.y);
    const K = Z || J;
    let Q = m(l);
    let tt = S(l);
    let nt = x(l);
    let ot = O(l);
    let st;
    if (F && h) {
      a(B, P, !U);
    }
    if (W) {
      st = getViewportOverflowState(U);
      fixFlexboxGlue(st, k);
    }
    if (u || p || v || D || F) {
      if (K) {
        a(V, L, false);
      }
      const [t, n] = E(U, N, st);
      const [o, s] = Q = b(l);
      const [e, c] = tt = y(l);
      const i = clientSize(r);
      let u = e;
      let d = i;
      t();
      if ((c || s || F) && n && !U && z(n, e, o, N)) {
        d = clientSize(r);
        u = scrollSize(r);
      }
      const _ = {
        w: Vt(Bt(e.w, u.w) + o.w),
        h: Vt(Bt(e.h, u.h) + o.h)
      };
      const h = {
        w: Vt((w ? f.innerWidth : d.w + Vt(i.w - e.w)) + o.w),
        h: Vt((w ? f.innerHeight + o.h : d.h + Vt(i.h - e.h)) + o.h)
      };
      ot = C(h);
      nt = $(getOverflowAmount(_, h), l);
    }
    const [et, ct] = ot;
    const [rt, lt] = nt;
    const [it, at] = tt;
    const [ut, ft] = Q;
    const dt = {
      x: rt.w > 0,
      y: rt.h > 0
    };
    const _t = Z && J && (dt.x || dt.y) || Z && dt.x && !dt.y || J && dt.y && !dt.x;
    if (p || D || ft || at || ct || lt || X || F || W) {
      const t = {
        marginRight: 0,
        marginBottom: 0,
        marginLeft: 0,
        width: "",
        overflowY: "",
        overflowX: ""
      };
      const n = setViewportOverflowState(U, dt, G, t);
      const o = z(n, it, ut, N);
      if (!i) {
        hideNativeScrollbars(n, N, o, t);
      }
      if (W) {
        fixFlexboxGlue(n, k);
      }
      if (i) {
        attr(e, I, t.overflowX);
        attr(e, H, t.overflowY);
      } else {
        style(r, t);
      }
    }
    attrClass(e, A, L, _t);
    attrClass(c, Y, j, _t);
    if (!i) {
      attrClass(r, R, V, K);
    }
    const [ht, gt] = T(getViewportOverflowState(U).Ot);
    s({
      Ot: ht,
      zt: {
        x: et.w,
        y: et.h
      },
      Et: {
        x: rt.w,
        y: rt.h
      },
      At: dt
    });
    return {
      It: gt,
      Ht: ct,
      Lt: lt
    };
  };
};

const prepareUpdateHints = (t, n, o) => {
  const s = {};
  const e = n || {};
  const c = keys(t).concat(keys(e));
  each(c, (n => {
    const c = t[n];
    const r = e[n];
    s[n] = !!(o || c || r);
  }));
  return s;
};

const createStructureSetupUpdate = (t, n) => {
  const {Z: o, K: s, ht: e, ft: c} = t;
  const {A: r, I: l, Y: i} = getEnvironment();
  const a = !r && (l.x || l.y);
  const u = [ createTrinsicUpdateSegment(t, n), createPaddingUpdateSegment(t, n), createOverflowUpdateSegment(t, n) ];
  return (t, n, r) => {
    const l = prepareUpdateHints(assignDeep({
      wt: false,
      xt: false,
      St: false,
      vt: false,
      Ht: false,
      Lt: false,
      It: false,
      Tt: false,
      bt: false,
      Pt: false
    }, n), {}, r);
    const f = a || !i;
    const d = f && scrollLeft(s);
    const _ = f && scrollTop(s);
    e("", D, true);
    let h = l;
    each(u, (n => {
      h = prepareUpdateHints(h, n(h, t, !!r) || {}, r);
    }));
    scrollLeft(s, d);
    scrollTop(s, _);
    e("", D);
    if (!c) {
      scrollLeft(o, 0);
      scrollTop(o, 0);
    }
    return h;
  };
};

const createEventContentChange = (t, n, o) => {
  let s;
  let e = false;
  const destroy = () => {
    e = true;
  };
  const updateElements = c => {
    if (o) {
      const r = o.reduce(((n, o) => {
        if (o) {
          const [s, e] = o;
          const r = e && s && (c ? c(s) : find(s, t));
          if (r && r.length && e && isString(e)) {
            push(n, [ r, e.trim() ], true);
          }
        }
        return n;
      }), []);
      each(r, (o => each(o[0], (c => {
        const r = o[1];
        const l = s.get(c) || [];
        const i = t.contains(c);
        if (i) {
          const t = on(c, r, (o => {
            if (e) {
              t();
              s.delete(c);
            } else {
              n(o);
            }
          }));
          s.set(c, push(l, t));
        } else {
          runEachAndClear(l);
          s.delete(c);
        }
      }))));
    }
  };
  if (o) {
    s = new WeakMap;
    updateElements();
  }
  return [ destroy, updateElements ];
};

const createDOMObserver = (t, n, o, s) => {
  let e = false;
  const {Mt: c, Dt: r, Rt: l, kt: a, Bt: u, Vt: f} = s || {};
  const d = debounce((() => e && o(true)), {
    g: 33,
    v: 99
  });
  const [_, h] = createEventContentChange(t, d, l);
  const g = c || [];
  const v = r || [];
  const p = g.concat(v);
  const observerCallback = (e, c) => {
    const r = u || noop;
    const l = f || noop;
    const i = new Set;
    const d = new Set;
    let _ = false;
    let g = false;
    each(e, (o => {
      const {attributeName: e, target: c, type: u, oldValue: f, addedNodes: h, removedNodes: p} = o;
      const w = u === "attributes";
      const b = u === "childList";
      const m = t === c;
      const y = w && isString(e) ? attr(c, e) : 0;
      const S = y !== 0 && f !== y;
      const $ = indexOf(v, e) > -1 && S;
      if (n && (b || !m)) {
        const n = !w;
        const u = w && S;
        const d = u && a && is(c, a);
        const _ = d ? !r(c, e, f, y) : n || u;
        const v = _ && !l(o, !!d, t, s);
        each(h, (t => i.add(t)));
        each(p, (t => i.add(t)));
        g = g || v;
      }
      if (!n && m && S && !r(c, e, f, y)) {
        d.add(e);
        _ = _ || $;
      }
    }));
    if (i.size > 0) {
      h((t => from(i).reduce(((n, o) => {
        push(n, find(t, o));
        return is(o, t) ? push(n, o) : n;
      }), [])));
    }
    if (n) {
      !c && g && o(false);
      return [ false ];
    }
    if (d.size > 0 || _) {
      const t = [ from(d), _ ];
      !c && o.apply(0, t);
      return t;
    }
  };
  const w = new i((t => observerCallback(t)));
  w.observe(t, {
    attributes: true,
    attributeOldValue: true,
    attributeFilter: p,
    subtree: n,
    childList: n,
    characterData: n
  });
  e = true;
  return [ () => {
    if (e) {
      _();
      w.disconnect();
      e = false;
    }
  }, () => {
    if (e) {
      d.m();
      const t = w.takeRecords();
      return !isEmptyArray(t) && observerCallback(t, true);
    }
  } ];
};

const Gt = 3333333;

const createSizeObserver = (t, n, o) => {
  const {Yt: s, Pt: e} = o || {};
  const c = getPlugins()[Ot];
  const {V: r} = getEnvironment();
  const l = createDOM(`<div class="${q}"><div class="${G}"></div></div>`);
  const i = l[0];
  const a = i.firstChild;
  const f = directionIsRTL.bind(0, t);
  const [d] = createCache({
    o: false,
    _: true,
    u: (t, n) => !(!t || !domRectHasDimensions(t) && domRectHasDimensions(n))
  });
  const onSizeChangedCallbackProxy = t => {
    const o = isArray(t) && t.length > 0 && isObject(t[0]);
    const e = !o && isBoolean(t[0]);
    let c = false;
    let l = false;
    let a = true;
    if (o) {
      const [n, , o] = d(t.pop().contentRect);
      const s = domRectHasDimensions(n);
      const e = domRectHasDimensions(o);
      const r = !o;
      c = r && !!e || !s;
      l = !e && s;
      a = !c;
    } else if (e) {
      [, a] = t;
    } else {
      l = t === true;
    }
    if (s && a) {
      const n = e ? t[0] : directionIsRTL(i);
      scrollLeft(i, n ? r.n ? -Gt : r.i ? 0 : Gt : Gt);
      scrollTop(i, Gt);
    }
    if (!c) {
      n({
        wt: !e,
        jt: e ? t : void 0,
        Pt: !!l
      });
    }
  };
  const _ = [];
  return [ () => {
    runEachAndClear(_);
    removeElements(i);
  }, () => {
    let n = e && onSizeChangedCallbackProxy;
    if (u) {
      const t = new u(onSizeChangedCallbackProxy);
      t.observe(a);
      push(_, (() => {
        t.disconnect();
      }));
    } else if (c) {
      const [t, o] = c.O(a, onSizeChangedCallbackProxy, e);
      n = t;
      push(_, o);
    }
    if (s) {
      const [t] = createCache({
        o: void 0
      }, f);
      push(_, on(i, "scroll", (n => {
        const o = t();
        const [s, e, c] = o;
        if (e) {
          removeClass(a, "ltr rtl");
          addClass(a, s ? "rtl" : "ltr");
          onSizeChangedCallbackProxy([ !!s, e, c ]);
        }
        stopPropagation(n);
      })));
    }
    if (n) {
      addClass(i, F);
      push(_, on(i, "animationstart", n, {
        C: !!u
      }));
    }
    if (u || c) {
      appendChildren(t, i);
    }
  } ];
};

const isHeightIntrinsic = t => t.h === 0 || t.isIntersecting || t.intersectionRatio > 0;

const createTrinsicObserver = (t, n) => {
  let o;
  const s = createDiv(Z);
  const e = [];
  const [c] = createCache({
    o: false
  });
  const triggerOnTrinsicChangedCallback = (t, o) => {
    if (t) {
      const s = c(isHeightIntrinsic(t));
      const [, e] = s;
      return e && !o && n(s) && [ s ];
    }
  };
  const intersectionObserverCallback = (t, n) => t && t.length > 0 && triggerOnTrinsicChangedCallback(t.pop(), n);
  return [ () => {
    runEachAndClear(e);
    removeElements(s);
  }, () => {
    if (a) {
      o = new a((t => intersectionObserverCallback(t)), {
        root: t
      });
      o.observe(s);
      push(e, (() => {
        o.disconnect();
      }));
    } else {
      const onSizeChanged = () => {
        const t = offsetSize(s);
        triggerOnTrinsicChangedCallback(t);
      };
      const [t, n] = createSizeObserver(s, onSizeChanged);
      push(e, t);
      n();
      onSizeChanged();
    }
    appendChildren(t, s);
  }, () => o && intersectionObserverCallback(o.takeRecords(), true) ];
};

const Xt = `[${A}]`;

const Ut = `[${R}]`;

const Wt = [ "tabindex" ];

const Zt = [ "wrap", "cols", "rows" ];

const Jt = [ "id", "class", "style", "open" ];

const createStructureSetupObservers = (t, n, o) => {
  let s;
  let e;
  let c;
  const {J: r, K: l, nt: i, lt: a, ft: f, _t: d, ht: _} = t;
  const {Y: h} = getEnvironment();
  const [g] = createCache({
    u: equalWH,
    o: {
      w: 0,
      h: 0
    }
  }, (() => {
    const t = d(V, L);
    const n = d(k, "");
    const o = n && scrollLeft(l);
    const s = n && scrollTop(l);
    _(V, L);
    _(k, "");
    _("", D, true);
    const e = scrollSize(i);
    const c = scrollSize(l);
    const r = fractionalSize(l);
    _(V, L, t);
    _(k, "", n);
    _("", D);
    scrollLeft(l, o);
    scrollTop(l, s);
    return {
      w: c.w + e.w + r.w,
      h: c.h + e.h + r.h
    };
  }));
  const v = a ? Zt : Jt.concat(Zt);
  const p = debounce(o, {
    g: () => s,
    v: () => e,
    p(t, n) {
      const [o] = t;
      const [s] = n;
      return [ keys(o).concat(keys(s)).reduce(((t, n) => {
        t[n] = o[n] || s[n];
        return t;
      }), {}) ];
    }
  });
  const updateViewportAttrsFromHost = t => {
    each(t || Wt, (t => {
      if (indexOf(Wt, t) > -1) {
        const n = attr(r, t);
        if (isString(n)) {
          attr(l, t, n);
        } else {
          removeAttr(l, t);
        }
      }
    }));
  };
  const onTrinsicChanged = (t, s) => {
    const [e, c] = t;
    const r = {
      vt: c
    };
    n({
      gt: e
    });
    !s && o(r);
    return r;
  };
  const onSizeChanged = ({wt: t, jt: s, Pt: e}) => {
    const c = !t || e ? o : p;
    let r = false;
    if (s) {
      const [t, o] = s;
      r = o;
      n({
        yt: t
      });
    }
    c({
      wt: t,
      Pt: e,
      St: r
    });
  };
  const onContentMutation = (t, n) => {
    const [, s] = g();
    const e = {
      bt: s
    };
    const c = t ? o : p;
    if (s) {
      !n && c(e);
    }
    return e;
  };
  const onHostMutation = (t, n, o) => {
    const s = {
      Tt: n
    };
    if (n) {
      !o && p(s);
    } else if (!f) {
      updateViewportAttrsFromHost(t);
    }
    return s;
  };
  const [w, b, m] = i || !h ? createTrinsicObserver(r, onTrinsicChanged) : [ noop, noop, noop ];
  const [y, S] = !f ? createSizeObserver(r, onSizeChanged, {
    Pt: true,
    Yt: true
  }) : [ noop, noop ];
  const [$, x] = createDOMObserver(r, false, onHostMutation, {
    Dt: Jt,
    Mt: Jt.concat(Wt)
  });
  let C;
  const O = f && u && new u((t => {
    const n = t[t.length - 1].contentRect;
    const o = domRectHasDimensions(n);
    const s = domRectHasDimensions(C);
    const e = !s && o;
    onSizeChanged({
      wt: true,
      Pt: e
    });
    C = n;
  }));
  return [ () => {
    w();
    y();
    c && c[0]();
    O && O.disconnect();
    $();
  }, () => {
    O && O.observe(r);
    updateViewportAttrsFromHost();
    S();
    b();
  }, () => {
    const t = {};
    const n = x();
    const o = m();
    const s = c && c[1]();
    if (n) {
      assignDeep(t, onHostMutation.apply(0, push(n, true)));
    }
    if (o) {
      assignDeep(t, onTrinsicChanged.apply(0, push(o, true)));
    }
    if (s) {
      assignDeep(t, onContentMutation.apply(0, push(s, true)));
    }
    return t;
  }, t => {
    const [n] = t("update.ignoreMutation");
    const [o, r] = t("update.attributes");
    const [a, u] = t("update.elementEvents");
    const [d, _] = t("update.debounce");
    const h = u || r;
    const ignoreMutationFromOptions = t => isFunction(n) && n(t);
    if (h) {
      if (c) {
        c[1]();
        c[0]();
      }
      c = createDOMObserver(i || l, true, onContentMutation, {
        Mt: v.concat(o || []),
        Rt: a,
        kt: Xt,
        Vt: (t, n) => {
          const {target: o, attributeName: s} = t;
          const e = !n && s && !f ? liesBetween(o, Xt, Ut) : false;
          return e || !!closest(o, `.${Q}`) || !!ignoreMutationFromOptions(t);
        }
      });
    }
    if (_) {
      p.m();
      if (isArray(d)) {
        const t = d[0];
        const n = d[1];
        s = isNumber(t) && t;
        e = isNumber(n) && n;
      } else if (isNumber(d)) {
        s = d;
        e = false;
      } else {
        s = false;
        e = false;
      }
    }
  } ];
};

const Kt = {
  x: 0,
  y: 0
};

const createInitialStructureSetupUpdateState = t => ({
  tt: {
    t: 0,
    r: 0,
    b: 0,
    l: 0
  },
  $t: false,
  P: {
    marginRight: 0,
    marginBottom: 0,
    marginLeft: 0,
    paddingTop: 0,
    paddingRight: 0,
    paddingBottom: 0,
    paddingLeft: 0
  },
  zt: Kt,
  Et: Kt,
  Ot: {
    x: "hidden",
    y: "hidden"
  },
  At: {
    x: false,
    y: false
  },
  gt: false,
  yt: directionIsRTL(t.J)
});

const createStructureSetup = (t, n) => {
  const o = createOptionCheck(n, {});
  const [s, e, c] = createEventListenerHub();
  const [r, l, i] = createStructureSetupElements(t);
  const a = createState(createInitialStructureSetupUpdateState(r));
  const [u, f] = a;
  const d = createStructureSetupUpdate(r, a);
  const triggerUpdateEvent = (t, n, o) => {
    const s = keys(t).some((n => !!t[n]));
    const e = s || !isEmptyObject(n) || o;
    if (e) {
      c("u", [ t, n, o ]);
    }
    return e;
  };
  const [_, h, g, v] = createStructureSetupObservers(r, f, (t => triggerUpdateEvent(d(o, t), {}, false)));
  const p = u.bind(0);
  p.Nt = t => s("u", t);
  p.qt = () => {
    const {Z: t, K: n, rt: o, it: s} = r;
    const e = s ? o.documentElement : t;
    const c = scrollLeft(e);
    const i = scrollTop(e);
    h();
    l();
    scrollLeft(n, c);
    scrollTop(n, i);
  };
  p.Ft = r;
  return [ (t, o) => {
    const s = createOptionCheck(n, t, o);
    v(s);
    return triggerUpdateEvent(d(s, g(), o), t, !!o);
  }, p, () => {
    e();
    _();
    i();
  } ];
};

const {round: Qt} = Math;

const getScale = t => {
  const {width: n, height: o} = getBoundingClientRect(t);
  const {w: s, h: e} = offsetSize(t);
  return {
    x: Qt(n) / s || 1,
    y: Qt(o) / e || 1
  };
};

const continuePointerDown = (t, n, o) => {
  const s = n.scrollbars;
  const {button: e, isPrimary: c, pointerType: r} = t;
  const {pointers: l} = s;
  return e === 0 && c && s[o ? "dragScroll" : "clickScroll"] && (l || []).includes(r);
};

const tn = "pointerup pointerleave pointercancel lostpointercapture";

const createRootClickStopPropagationEvents = (t, n) => on(t, "mousedown", on.bind(0, n, "click", stopPropagation, {
  C: true,
  $: true
}), {
  $: true
});

const createInteractiveScrollEvents = (t, n, o, s, e, c, r) => {
  const {V: l} = getEnvironment();
  const {Gt: i, Xt: a, Ut: u} = s;
  const f = `scroll${r ? "Left" : "Top"}`;
  const d = `client${r ? "X" : "Y"}`;
  const _ = r ? "width" : "height";
  const h = r ? "left" : "top";
  const g = r ? "w" : "h";
  const v = r ? "x" : "y";
  const createRelativeHandleMove = (t, n) => o => {
    const {Et: s} = c();
    const d = offsetSize(a)[g] - offsetSize(i)[g];
    const _ = n * o / d;
    const h = _ * s[v];
    const p = directionIsRTL(u);
    const w = p && r ? l.n || l.i ? 1 : -1 : 1;
    e[f] = t + h * w;
  };
  return on(a, "pointerdown", (s => {
    const c = closest(s.target, `.${et}`) === i;
    const r = c ? i : a;
    attrClass(n, A, M, true);
    if (continuePointerDown(s, t, c)) {
      const t = !c && s.shiftKey;
      const getHandleRect = () => getBoundingClientRect(i);
      const getTrackRect = () => getBoundingClientRect(a);
      const getHandleOffset = (t, n) => (t || getHandleRect())[h] - (n || getTrackRect())[h];
      const l = createRelativeHandleMove(e[f] || 0, 1 / getScale(e)[v]);
      const u = s[d];
      const g = getHandleRect();
      const p = getTrackRect();
      const w = g[_];
      const b = getHandleOffset(g, p) + w / 2;
      const m = u - p[h];
      const y = c ? 0 : m - b;
      const releasePointerCapture = t => {
        runEachAndClear(S);
        r.releasePointerCapture(t.pointerId);
      };
      const S = [ attrClass.bind(0, n, A, M), on(o, tn, releasePointerCapture), on(o, "selectstart", (t => preventDefault(t)), {
        S: false
      }), on(a, tn, releasePointerCapture), on(a, "pointermove", (n => {
        const o = n[d] - u;
        if (c || t) {
          l(y + o);
        }
      })) ];
      if (t) {
        l(y);
      } else if (!c) {
        const t = getPlugins()[Lt];
        if (t) {
          push(S, t.O(l, getHandleOffset, y, w, m));
        }
      }
      r.setPointerCapture(s.pointerId);
    }
  }));
};

const createScrollbarsSetupEvents = (t, n) => (o, s, e, c, r, l, i) => {
  const {Ut: a} = o;
  const [u, f] = selfClearTimeout(333);
  const d = !!r.scrollBy;
  let _ = true;
  return runEachAndClear.bind(0, [ on(a, "pointerenter", (() => {
    s(it, true);
  })), on(a, "pointerleave pointercancel", (() => {
    s(it);
  })), on(a, "wheel", (t => {
    const {deltaX: n, deltaY: o, deltaMode: e} = t;
    if (d && _ && e === 0 && parent(a) === c) {
      r.scrollBy({
        left: n,
        top: o,
        behavior: "smooth"
      });
    }
    _ = false;
    s(dt, true);
    u((() => {
      _ = true;
      s(dt);
    }));
    preventDefault(t);
  }), {
    S: false,
    $: true
  }), createRootClickStopPropagationEvents(a, e), createInteractiveScrollEvents(t, c, e, o, r, n, i), f ]);
};

const {min: nn, max: sn, round: en} = Math;

const getScrollbarHandleLengthRatio = (t, n, o, s) => {
  if (s) {
    const t = o ? "x" : "y";
    const {Et: n, zt: e} = s;
    const c = e[t];
    const r = n[t];
    return sn(0, nn(1, c / (c + r)));
  }
  const e = o ? "width" : "height";
  const c = getBoundingClientRect(t)[e];
  const r = getBoundingClientRect(n)[e];
  return sn(0, nn(1, c / r));
};

const getScrollbarHandleOffsetRatio = (t, n, o, s, e, c) => {
  const {V: r} = getEnvironment();
  const l = c ? "x" : "y";
  const i = c ? "Left" : "Top";
  const {Et: a} = s;
  const u = en(a[l]);
  const f = nn(u, sn(0, o[`scroll${i}`]));
  const d = c && e;
  const _ = r.i ? f : u - f;
  const h = d ? _ : f;
  const g = nn(1, h / u);
  const v = getScrollbarHandleLengthRatio(t, n, c);
  return 1 / v * (1 - v) * g;
};

const animateElement = (t, n, o, s) => n && t.animate(o, {
  timeline: n,
  composite: s
});

const getScrollbarHandleAnimationKeyFrames = (t, n) => ({
  transform: [ getTrasformTranslateValue(`0%`, n), getTrasformTranslateValue(n && t ? "100%" : "-100%", n) ],
  [n ? t ? "right" : "left" : "top"]: [ "0%", "100%" ]
});

const maxScrollbarOffsetFrameValue = t => `${Math.max(0, t - .5)}px`;

const animateScrollbarOffset = (t, n, o, s) => animateElement(t, n, {
  transform: [ getTrasformTranslateValue(`0px`, s), getTrasformTranslateValue(maxScrollbarOffsetFrameValue(o), s) ]
}, "add");

const initScrollTimeline = (t, n) => _ ? new _({
  source: t,
  axis: n
}) : null;

const createScrollbarsSetupElements = (t, n, o) => {
  const {q: s, H: e} = getEnvironment();
  const {scrollbars: c} = s();
  const {slot: r} = c;
  const {rt: l, Z: i, J: a, K: u, ut: f, st: d, it: _, ft: g} = n;
  const {scrollbars: v} = f ? {} : t;
  const {slot: p} = v || {};
  const w = new Map;
  const b = initScrollTimeline(d, "x");
  const m = initScrollTimeline(d, "y");
  const y = dynamicInitializationElement([ i, a, u ], (() => g && _ ? i : a), r, p);
  const doRefreshScrollbarOffset = t => g && !_ && parent(t) === u;
  const cancelElementAnimations = t => {
    w.forEach(((n, o) => {
      const s = t ? indexOf(isArray(t) ? t : [ t ], o) > -1 : true;
      if (s) {
        (n || []).forEach((t => {
          t && t.cancel();
        }));
        w.delete(o);
      }
    }));
  };
  const scrollbarStructureAddRemoveClass = (t, n, o) => {
    const s = o ? addClass : removeClass;
    each(t, (t => {
      s(t.Ut, n);
    }));
  };
  const scrollbarStyle = (t, n) => {
    each(t, (t => {
      const [o, s] = n(t);
      style(o, s);
    }));
  };
  const scrollbarStructureRefreshHandleLength = (t, n, o) => {
    scrollbarStyle(t, (t => {
      const {Gt: s, Xt: e} = t;
      return [ s, {
        [o ? "width" : "height"]: `${(getScrollbarHandleLengthRatio(s, e, o, n) * 100).toFixed(3)}%`
      } ];
    }));
  };
  const scrollbarStructureRefreshHandleOffset = (t, n, o) => {
    if (!m && !m) {
      scrollbarStyle(t, (t => {
        const {Gt: s, Xt: e, Ut: c} = t;
        const r = getScrollbarHandleOffsetRatio(s, e, d, n, directionIsRTL(c), o);
        const l = r === r;
        return [ s, {
          transform: l ? getTrasformTranslateValue(`${(r * 100).toFixed(3)}%`, o) : ""
        } ];
      }));
    }
  };
  const styleScrollbarPosition = t => {
    const {Ut: n} = t;
    const o = doRefreshScrollbarOffset(n) && n;
    return [ o, {
      transform: o ? getTrasformTranslateValue([ `${scrollLeft(d)}px`, `${scrollTop(d)}px` ]) : ""
    } ];
  };
  const S = [];
  const $ = [];
  const x = [];
  const scrollbarsAddRemoveClass = (t, n, o) => {
    const s = isBoolean(o);
    const e = s ? o : true;
    const c = s ? !o : true;
    e && scrollbarStructureAddRemoveClass($, t, n);
    c && scrollbarStructureAddRemoveClass(x, t, n);
  };
  const refreshScrollbarsHandleLength = t => {
    scrollbarStructureRefreshHandleLength($, t, true);
    scrollbarStructureRefreshHandleLength(x, t);
  };
  const refreshScrollbarsHandleOffset = t => {
    scrollbarStructureRefreshHandleOffset($, t, true);
    scrollbarStructureRefreshHandleOffset(x, t);
  };
  const refreshScrollbarsHandleOffsetTimeline = () => {
    const forEachFn = (t, {Ut: n, Gt: o}) => {
      cancelElementAnimations(o);
      w.set(o, [ animateElement(o, t ? b : m, getScrollbarHandleAnimationKeyFrames(t && directionIsRTL(n), t)) ]);
    };
    $.forEach(forEachFn.bind(0, true));
    x.forEach(forEachFn.bind(0, false));
  };
  const refreshScrollbarsScrollbarOffset = () => {
    if (!m && !m) {
      g && scrollbarStyle($, styleScrollbarPosition);
      g && scrollbarStyle(x, styleScrollbarPosition);
    }
  };
  const refreshScrollbarsScrollbarOffsetTimeline = ({Et: t}) => {
    x.concat($).forEach((({Ut: n}) => {
      cancelElementAnimations(n);
      if (doRefreshScrollbarOffset(n)) {
        w.set(n, [ animateScrollbarOffset(n, b, t.x, true), animateScrollbarOffset(n, m, t.y) ]);
      }
    }));
  };
  const generateScrollbarDOM = t => {
    const n = t ? nt : ot;
    const s = t ? $ : x;
    const c = isEmptyArray(s) ? lt : "";
    const r = createDiv(`${Q} ${n} ${c}`);
    const i = createDiv(st);
    const u = createDiv(et);
    const f = {
      Ut: r,
      Xt: i,
      Gt: u
    };
    if (!e) {
      addClass(r, J);
    }
    appendChildren(r, i);
    appendChildren(i, u);
    push(s, f);
    push(S, [ removeElements.bind(0, r), cancelElementAnimations, o(f, scrollbarsAddRemoveClass, l, a, d, t ? b : m, t) ]);
    return f;
  };
  const C = generateScrollbarDOM.bind(0, true);
  const O = generateScrollbarDOM.bind(0, false);
  const appendElements = () => {
    appendChildren(y, $[0].Ut);
    appendChildren(y, x[0].Ut);
    h((() => {
      scrollbarsAddRemoveClass(lt);
    }), 300);
  };
  C();
  O();
  return [ {
    Wt: refreshScrollbarsHandleLength,
    Zt: refreshScrollbarsHandleOffset,
    Jt: refreshScrollbarsHandleOffsetTimeline,
    Kt: refreshScrollbarsScrollbarOffsetTimeline,
    Qt: refreshScrollbarsScrollbarOffset,
    tn: scrollbarsAddRemoveClass,
    nn: {
      B: b,
      sn: $,
      en: C,
      cn: scrollbarStyle.bind(0, $)
    },
    rn: {
      B: m,
      sn: x,
      en: O,
      cn: scrollbarStyle.bind(0, x)
    }
  }, appendElements, runEachAndClear.bind(0, S) ];
};

const isHoverablePointerType = t => t.pointerType === "mouse";

const createScrollbarsSetup = (t, n, o, s) => {
  let e;
  let c;
  let r;
  let l;
  let i;
  let a = noop;
  let u = 0;
  const f = createState({});
  const [d] = f;
  const [_, h] = selfClearTimeout();
  const [g, v] = selfClearTimeout();
  const [p, w] = selfClearTimeout(100);
  const [b, m] = selfClearTimeout(100);
  const [y, S] = selfClearTimeout(100);
  const [$, x] = selfClearTimeout((() => u));
  const [C, O, T] = createScrollbarsSetupElements(t, o.Ft, createScrollbarsSetupEvents(n, o));
  const {J: z, et: E, it: A} = o.Ft;
  const {tn: I, Wt: H, Zt: L, Jt: P, Kt: M, Qt: D} = C;
  const manageAutoHideSuspension = t => {
    I(ut, t, true);
    I(ut, t, false);
  };
  const manageScrollbarsAutoHide = (t, n) => {
    x();
    if (t) {
      I(ft);
    } else {
      const hide = () => I(ft, true);
      if (u > 0 && !n) {
        $(hide);
      } else {
        hide();
      }
    }
  };
  const onHostMouseEnter = t => {
    if (isHoverablePointerType(t)) {
      l = c;
      l && manageScrollbarsAutoHide(true);
    }
  };
  const R = [ w, x, m, S, v, h, T, on(z, "pointerover", onHostMouseEnter, {
    C: true
  }), on(z, "pointerenter", onHostMouseEnter), on(z, "pointerleave", (t => {
    if (isHoverablePointerType(t)) {
      l = false;
      c && manageScrollbarsAutoHide(false);
    }
  })), on(z, "pointermove", (t => {
    isHoverablePointerType(t) && e && _((() => {
      w();
      manageScrollbarsAutoHide(true);
      b((() => {
        e && manageScrollbarsAutoHide(false);
      }));
    }));
  })), on(E, "scroll", (t => {
    g((() => {
      L(o());
      r && manageScrollbarsAutoHide(true);
      p((() => {
        r && !l && manageScrollbarsAutoHide(false);
      }));
    }));
    s(t);
    D();
  })) ];
  const k = d.bind(0);
  k.Ft = C;
  k.qt = O;
  return [ (t, s, l) => {
    const {Ht: f, Lt: d, It: _, St: h, Pt: g} = l;
    const {I: v} = getEnvironment();
    const p = createOptionCheck(n, t, s);
    const w = o();
    const {Et: b, Ot: m, yt: S, At: $} = w;
    const [x, C] = p("showNativeOverlaidScrollbars");
    const [O, T] = p("scrollbars.theme");
    const [z, R] = p("scrollbars.visibility");
    const [k, B] = p("scrollbars.autoHide");
    const [V, Y] = p("scrollbars.autoHideSuspend");
    const [j] = p("scrollbars.autoHideDelay");
    const [N, q] = p("scrollbars.dragScroll");
    const [F, G] = p("scrollbars.clickScroll");
    const X = g && !s;
    const U = $.x || $.y;
    const W = f || d || h;
    const Z = _ || R;
    const J = x && v.x && v.y;
    const setScrollbarVisibility = (t, n) => {
      const o = z === "visible" || z === "auto" && t === "scroll";
      I(ct, o, n);
      return o;
    };
    u = j;
    if (X) {
      if (V && U) {
        manageAutoHideSuspension(false);
        a();
        y((() => {
          a = on(E, "scroll", manageAutoHideSuspension.bind(0, true), {
            C: true
          });
        }));
      } else {
        manageAutoHideSuspension(true);
      }
    }
    if (C) {
      I(K, J);
    }
    if (T) {
      I(i);
      I(O, true);
      i = O;
    }
    if (Y && !V) {
      manageAutoHideSuspension(true);
    }
    if (B) {
      e = k === "move";
      c = k === "leave";
      r = k !== "never";
      manageScrollbarsAutoHide(!r, true);
    }
    if (q) {
      I(ht, N);
    }
    if (G) {
      I(_t, F);
    }
    if (Z) {
      const t = setScrollbarVisibility(m.x, true);
      const n = setScrollbarVisibility(m.y, false);
      const o = t && n;
      I(rt, !o);
    }
    if (W) {
      H(w);
      L(w);
      P(w);
      M(w);
      D();
      I(at, !b.x, true);
      I(at, !b.y, false);
      I(tt, S && !A);
    }
  }, k, () => {
    runEachAndClear(R);
    a();
  } ];
};

const invokePluginInstance = (t, n, o) => {
  if (isFunction(t)) {
    t(n || void 0, o || void 0);
  }
};

const OverlayScrollbars = (t, n, o) => {
  const {G: s, q: e, j: c, N: r} = getEnvironment();
  const l = getPlugins();
  const i = isHTMLElement(t);
  const a = i ? t : t.target;
  const u = getInstance(a);
  if (n && !u) {
    let u = false;
    const validateOptions = t => {
      const n = getPlugins()[$t];
      const o = n && n.O;
      return o ? o(t, true) : t;
    };
    const f = assignDeep({}, s(), validateOptions(n));
    const [d, _, h] = createEventListenerHub(o);
    const [g, v, p] = createStructureSetup(t, f);
    const [w, b, m] = createScrollbarsSetup(t, f, v, (t => h("scroll", [ x, t ])));
    const update = (t, n) => g(t, !!n);
    const y = update.bind(0, {}, true);
    const S = c(y);
    const $ = r(y);
    const destroy = t => {
      removeInstance(a);
      S();
      $();
      m();
      p();
      u = true;
      h("destroyed", [ x, !!t ]);
      _();
    };
    const x = {
      options(t, n) {
        if (t) {
          const o = n ? s() : {};
          const e = getOptionsDiff(f, assignDeep(o, validateOptions(t)));
          if (!isEmptyObject(e)) {
            assignDeep(f, e);
            update(e);
          }
        }
        return assignDeep({}, f);
      },
      on: d,
      off: (t, n) => {
        t && n && _(t, n);
      },
      state() {
        const {zt: t, Et: n, Ot: o, At: s, tt: e, $t: c, yt: r} = v();
        return assignDeep({}, {
          overflowEdge: t,
          overflowAmount: n,
          overflowStyle: o,
          hasOverflow: s,
          padding: e,
          paddingAbsolute: c,
          directionRTL: r,
          destroyed: u
        });
      },
      elements() {
        const {Z: t, J: n, tt: o, K: s, nt: e, st: c, et: r} = v.Ft;
        const {nn: l, rn: i} = b.Ft;
        const translateScrollbarStructure = t => {
          const {Gt: n, Xt: o, Ut: s} = t;
          return {
            scrollbar: s,
            track: o,
            handle: n
          };
        };
        const translateScrollbarsSetupElement = t => {
          const {sn: n, en: o} = t;
          const s = translateScrollbarStructure(n[0]);
          return assignDeep({}, s, {
            clone: () => {
              const t = translateScrollbarStructure(o());
              w({}, true, {});
              return t;
            }
          });
        };
        return assignDeep({}, {
          target: t,
          host: n,
          padding: o || s,
          viewport: s,
          content: e || s,
          scrollOffsetElement: c,
          scrollEventElement: r,
          scrollbarHorizontal: translateScrollbarsSetupElement(l),
          scrollbarVertical: translateScrollbarsSetupElement(i)
        });
      },
      update: t => update({}, t),
      destroy: destroy.bind(0)
    };
    v.Nt(((t, n, o) => {
      w(n, o, t);
    }));
    addInstance(a, x);
    each(keys(l), (t => invokePluginInstance(l[t], 0, x)));
    if (cancelInitialization(v.Ft.it, e().cancel, !i && t.cancel)) {
      destroy(true);
      return x;
    }
    v.qt();
    b.qt();
    h("initialized", [ x ]);
    v.Nt(((t, n, o) => {
      const {wt: s, St: e, vt: c, Ht: r, Lt: l, It: i, bt: a, Tt: u} = t;
      h("updated", [ x, {
        updateHints: {
          sizeChanged: s,
          directionChanged: e,
          heightIntrinsicChanged: c,
          overflowEdgeChanged: r,
          overflowAmountChanged: l,
          overflowStyleChanged: i,
          contentMutation: a,
          hostMutation: u
        },
        changedOptions: n,
        force: o
      } ]);
    }));
    x.update(true);
    return x;
  }
  return u;
};

OverlayScrollbars.plugin = t => {
  each(addPlugin(t), (t => invokePluginInstance(t, OverlayScrollbars)));
};

OverlayScrollbars.valid = t => {
  const n = t && t.elements;
  const o = isFunction(n) && n();
  return isPlainObject(o) && !!getInstance(o.target);
};

OverlayScrollbars.env = () => {
  const {k: t, I: n, A: o, V: s, Y: e, H: c, B: r, U: l, W: i, q: a, F: u, G: f, X: d} = getEnvironment();
  return assignDeep({}, {
    scrollbarsSize: t,
    scrollbarsOverlaid: n,
    scrollbarsHiding: o,
    rtlScrollBehavior: s,
    flexboxGlue: e,
    cssCustomProperties: c,
    scrollTimeline: r,
    staticDefaultInitialization: l,
    staticDefaultOptions: i,
    getDefaultInitialization: a,
    setDefaultInitialization: u,
    getDefaultOptions: f,
    setDefaultOptions: d
  });
};

const klevuUtilScrollbarsCss = ":host{--handle-bg:var(--klevu-util-scrollbar-handle-bg, var(--klevu-color-neutral-5, rgba(0, 0, 0, 0.44)));--handle-bg-hover:var(--klevu-util-scrollbar-handle-bg-hover, var(--klevu-color-neutral-6, rgba(0, 0, 0, 0.55)));--handle-bg-active:var(--klevu-util-scrollbar-handle-bg-active, var(--klevu-color-neutral-7, rgba(0, 0, 0, 0.66)));display:block;height:100%}.native{height:100%}/*! \n * OverlayScrollbars\n * Version: 2.2.1\n * \n * Copyright (c) Rene Haas | KingSora.\n * https://github.com/KingSora\n * \n * Released under the MIT license.\n */.os-size-observer,.os-size-observer-listener{direction:inherit;pointer-events:none;overflow:hidden;visibility:hidden;box-sizing:border-box}.os-size-observer,.os-size-observer-listener,.os-size-observer-listener-item,.os-size-observer-listener-item-final{writing-mode:horizontal-tb;position:absolute;left:0;top:0}.os-size-observer{z-index:-1;contain:strict;display:flex;flex-direction:row;flex-wrap:nowrap;padding:inherit;border:inherit;box-sizing:inherit;margin:-133px;top:0;right:0;bottom:0;left:0;transform:scale(0.1)}.os-size-observer::before{content:\"\";flex:none;box-sizing:inherit;padding:10px;width:10px;height:10px}.os-size-observer-appear{animation:os-size-observer-appear-animation 1ms forwards}.os-size-observer-listener{box-sizing:border-box;position:relative;flex:auto;padding:inherit;border:inherit;margin:-133px;transform:scale(10)}.os-size-observer-listener.ltr{margin-right:-266px;margin-left:0}.os-size-observer-listener.rtl{margin-left:-266px;margin-right:0}.os-size-observer-listener:empty::before{content:\"\";width:100%;height:100%}.os-size-observer-listener:empty::before,.os-size-observer-listener>.os-size-observer-listener-item{display:block;position:relative;padding:inherit;border:inherit;box-sizing:content-box;flex:auto}.os-size-observer-listener-scroll{box-sizing:border-box;display:flex}.os-size-observer-listener-item{right:0;bottom:0;overflow:hidden;direction:ltr;flex:none}.os-size-observer-listener-item-final{transition:none}@keyframes os-size-observer-appear-animation{from{cursor:auto}to{cursor:none}}.os-trinsic-observer{flex:none;box-sizing:border-box;position:relative;max-width:0px;max-height:1px;padding:0;margin:0;border:none;overflow:hidden;z-index:-1;height:0;top:calc(100% + 1px);contain:strict}.os-trinsic-observer:not(:empty){height:calc(100% + 1px);top:-1px}.os-trinsic-observer:not(:empty)>.os-size-observer{width:1000%;height:1000%;min-height:1px;min-width:1px}.os-environment{--os-custom-prop:-1;position:fixed;opacity:0;visibility:hidden;overflow:scroll;height:200px;width:200px;z-index:var(--os-custom-prop)}.os-environment div{width:200%;height:200%;margin:10px 0}.os-environment.os-environment-flexbox-glue{display:flex;flex-direction:row;flex-wrap:nowrap;height:auto;width:auto;min-height:200px;min-width:200px}.os-environment.os-environment-flexbox-glue div{flex:auto;width:auto;height:auto;max-height:100%;max-width:100%;margin:0}.os-environment.os-environment-flexbox-glue-max{max-height:200px}.os-environment.os-environment-flexbox-glue-max div{overflow:visible}.os-environment.os-environment-flexbox-glue-max div::before{content:\"\";display:block;height:999px;width:999px}.os-environment,[data-overlayscrollbars-viewport]{-ms-overflow-style:scrollbar !important}[data-overlayscrollbars-initialize],[data-overlayscrollbars~=\"scrollbarHidden\"],[data-overlayscrollbars-viewport~=\"scrollbarHidden\"],.os-scrollbar-hidden.os-environment{scrollbar-width:none !important}[data-overlayscrollbars-initialize]::-webkit-scrollbar,[data-overlayscrollbars-initialize]::-webkit-scrollbar-corner,[data-overlayscrollbars~=\"scrollbarHidden\"]::-webkit-scrollbar,[data-overlayscrollbars~=\"scrollbarHidden\"]::-webkit-scrollbar-corner,[data-overlayscrollbars-viewport~=\"scrollbarHidden\"]::-webkit-scrollbar,[data-overlayscrollbars-viewport~=\"scrollbarHidden\"]::-webkit-scrollbar-corner,.os-scrollbar-hidden.os-environment::-webkit-scrollbar,.os-scrollbar-hidden.os-environment::-webkit-scrollbar-corner{-webkit-appearance:none !important;appearance:none !important;display:none !important;width:0 !important;height:0 !important}[data-overlayscrollbars-initialize]{overflow:auto}html[data-overlayscrollbars],html.os-scrollbar-hidden,html.os-scrollbar-hidden>body{box-sizing:border-box;margin:0;width:100%;height:100%}html[data-overlayscrollbars]>body{overflow:visible}[data-overlayscrollbars~=\"host\"]{position:relative}[data-overlayscrollbars~=\"host\"],[data-overlayscrollbars-padding]{display:flex;flex-direction:row !important;flex-wrap:nowrap !important}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport]{box-sizing:inherit;position:relative;flex:auto !important;height:auto;width:100%;min-width:0;padding:0;margin:0;border:none;z-index:0}[data-overlayscrollbars-viewport]{--os-vaw:0;--os-vah:0}[data-overlayscrollbars-viewport][data-overlayscrollbars-viewport~=\"arrange\"]::before{content:\"\";position:absolute;pointer-events:none;z-index:-1;min-width:1px;min-height:1px;width:var(--os-vaw);height:var(--os-vah)}[data-overlayscrollbars-padding],[data-overlayscrollbars-viewport]{overflow:hidden}[data-overlayscrollbars~=\"host\"],[data-overlayscrollbars~=\"viewport\"]{overflow:hidden}[data-overlayscrollbars~=\"overflowVisible\"],[data-overlayscrollbars-padding~=\"overflowVisible\"],[data-overlayscrollbars-viewport~=\"overflowVisible\"]{overflow:visible}[data-overlayscrollbars-overflow-x=\"hidden\"]{overflow-x:hidden}[data-overlayscrollbars-overflow-x=\"scroll\"]{overflow-x:scroll}[data-overlayscrollbars-overflow-x=\"hidden\"]{overflow-y:hidden}[data-overlayscrollbars-overflow-y=\"scroll\"]{overflow-y:scroll}[data-overlayscrollbars~=\"scrollbarPressed\"],[data-overlayscrollbars~=\"scrollbarPressed\"] [data-overlayscrollbars-viewport]{scroll-behavior:auto !important}[data-overlayscrollbars-content]{box-sizing:inherit}[data-overlayscrollbars-grid],[data-overlayscrollbars-grid] [data-overlayscrollbars-padding]{display:grid;grid-template:1fr/1fr}[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding],[data-overlayscrollbars-grid]>[data-overlayscrollbars-viewport],[data-overlayscrollbars-grid]>[data-overlayscrollbars-padding]>[data-overlayscrollbars-viewport]{height:auto !important;width:auto !important}.os-scrollbar{contain:size layout;contain:size layout style;transition:opacity 0.15s, visibility 0.15s, top 0.15s, right 0.15s, bottom 0.15s, left 0.15s;pointer-events:none;position:absolute;opacity:0;visibility:hidden}body>.os-scrollbar{position:fixed;z-index:99999}.os-scrollbar-transitionless{transition:none}.os-scrollbar-track{position:relative;direction:ltr !important;padding:0 !important;border:none !important}.os-scrollbar-handle{position:absolute}.os-scrollbar-track,.os-scrollbar-handle{pointer-events:none;width:100%;height:100%}.os-scrollbar.os-scrollbar-track-interactive .os-scrollbar-track,.os-scrollbar.os-scrollbar-handle-interactive .os-scrollbar-handle{pointer-events:auto;touch-action:none}.os-scrollbar-horizontal{bottom:0;left:0}.os-scrollbar-vertical{top:0;right:0}.os-scrollbar-rtl.os-scrollbar-horizontal{right:0}.os-scrollbar-rtl.os-scrollbar-vertical{right:auto;left:0}.os-scrollbar-visible,.os-scrollbar-interaction.os-scrollbar-visible{opacity:1;visibility:visible}.os-scrollbar-auto-hidden{opacity:0;visibility:hidden}.os-scrollbar-unusable,.os-scrollbar-unusable *,.os-scrollbar-wheel,.os-scrollbar-wheel *{pointer-events:none !important}.os-scrollbar-unusable .os-scrollbar-handle{opacity:0 !important}.os-scrollbar-horizontal .os-scrollbar-handle{bottom:0}.os-scrollbar-vertical .os-scrollbar-handle{right:0}.os-scrollbar-rtl.os-scrollbar-vertical .os-scrollbar-handle{right:auto;left:0}.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless.os-scrollbar-rtl{left:0;right:0}.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless,.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless.os-scrollbar-rtl{top:0;bottom:0}.os-scrollbar{--os-size:0;--os-padding-perpendicular:0;--os-padding-axis:0;--os-track-border-radius:0;--os-track-bg:none;--os-track-bg-hover:none;--os-track-bg-active:none;--os-track-border:none;--os-track-border-hover:none;--os-track-border-active:none;--os-handle-border-radius:0;--os-handle-bg:none;--os-handle-bg-hover:none;--os-handle-bg-active:none;--os-handle-border:none;--os-handle-border-hover:none;--os-handle-border-active:none;--os-handle-min-size:33px;--os-handle-max-size:none;--os-handle-perpendicular-size:100%;--os-handle-perpendicular-size-hover:100%;--os-handle-perpendicular-size-active:100%;--os-handle-interactive-area-offset:0}.os-scrollbar .os-scrollbar-track{border:var(--os-track-border);border-radius:var(--os-track-border-radius);background:var(--os-track-bg);transition:opacity 0.15s, background-color 0.15s, border-color 0.15s}.os-scrollbar .os-scrollbar-track:hover{border:var(--os-track-border-hover);background:var(--os-track-bg-hover)}.os-scrollbar .os-scrollbar-track:active{border:var(--os-track-border-active);background:var(--os-track-bg-active)}.os-scrollbar .os-scrollbar-handle{border:var(--os-handle-border);border-radius:var(--os-handle-border-radius);background:var(--os-handle-bg)}.os-scrollbar .os-scrollbar-handle:before{content:\"\";position:absolute;left:0;right:0;top:0;bottom:0;display:block}.os-scrollbar .os-scrollbar-handle:hover{border:var(--os-handle-border-hover);background:var(--os-handle-bg-hover)}.os-scrollbar .os-scrollbar-handle:active{border:var(--os-handle-border-active);background:var(--os-handle-bg-active)}.os-scrollbar-horizontal{padding:var(--os-padding-perpendicular) var(--os-padding-axis);right:var(--os-size);height:var(--os-size)}.os-scrollbar-horizontal.os-scrollbar-rtl{left:var(--os-size);right:0}.os-scrollbar-horizontal .os-scrollbar-handle{min-width:var(--os-handle-min-size);max-width:var(--os-handle-max-size);height:var(--os-handle-perpendicular-size);transition:opacity 0.15s, background-color 0.15s, border-color 0.15s, height 0.15s}.os-scrollbar-horizontal .os-scrollbar-handle:before{top:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);bottom:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-horizontal:hover .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-horizontal:active .os-scrollbar-handle{height:var(--os-handle-perpendicular-size-active)}.os-scrollbar-vertical{padding:var(--os-padding-axis) var(--os-padding-perpendicular);bottom:var(--os-size);width:var(--os-size)}.os-scrollbar-vertical .os-scrollbar-handle{min-height:var(--os-handle-min-size);max-height:var(--os-handle-max-size);width:var(--os-handle-perpendicular-size);transition:opacity 0.15s, background-color 0.15s, border-color 0.15s, width 0.15s}.os-scrollbar-vertical .os-scrollbar-handle:before{left:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);right:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:calc((var(--os-padding-perpendicular) + var(--os-handle-interactive-area-offset)) * -1);left:calc(var(--os-padding-perpendicular) * -1)}.os-scrollbar-vertical:hover .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-hover)}.os-scrollbar-vertical:active .os-scrollbar-handle{width:var(--os-handle-perpendicular-size-active)}[data-overlayscrollbars~=\"updating\"]>.os-scrollbar,.os-theme-none.os-scrollbar{display:none !important}.os-theme-dark,.os-theme-light{box-sizing:border-box;--os-size:10px;--os-padding-perpendicular:2px;--os-padding-axis:2px;--os-track-border-radius:10px;--os-handle-interactive-area-offset:4px;--os-handle-border-radius:10px}.os-theme-dark{--os-handle-bg:rgba(0, 0, 0, 0.44);--os-handle-bg-hover:rgba(0, 0, 0, 0.55);--os-handle-bg-active:rgba(0, 0, 0, 0.66)}.os-theme-light{--os-handle-bg:rgba(255, 255, 255, 0.44);--os-handle-bg-hover:rgba(255, 255, 255, 0.55);--os-handle-bg-active:rgba(255, 255, 255, 0.66)}.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-handle{border-radius:10px}.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-track,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-track{border-radius:10px}.os-no-css-vars.os-theme-dark.os-scrollbar .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar .os-scrollbar-handle{border-radius:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal{padding:2px 2px;right:10px;height:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal.os-scrollbar-rtl,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal.os-scrollbar-rtl{left:10px;right:0}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle{min-width:33px;max-width:none}.os-no-css-vars.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle:before{top:calc((2px + 4px) * -1);bottom:calc(2px * -1)}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical,.os-no-css-vars.os-theme-light.os-scrollbar-vertical{padding:2px 2px;bottom:10px;width:10px}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle{min-height:33px;max-height:none}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle:before{left:calc((2px + 4px) * -1);right:calc(2px * -1)}.os-no-css-vars.os-theme-dark.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before,.os-no-css-vars.os-theme-light.os-scrollbar-vertical.os-scrollbar-rtl .os-scrollbar-handle:before{right:calc((2px + 4px) * -1);left:calc(2px * -1)}.os-no-css-vars.os-theme-dark .os-scrollbar-handle{background:rgba(0, 0, 0, 0.44)}.os-no-css-vars.os-theme-dark:hover .os-scrollbar-handle{background:rgba(0, 0, 0, 0.55)}.os-no-css-vars.os-theme-dark:active .os-scrollbar-handle{background:rgba(0, 0, 0, 0.66)}.os-no-css-vars.os-theme-light .os-scrollbar-handle{background:rgba(255, 255, 255, 0.44)}.os-no-css-vars.os-theme-light:hover .os-scrollbar-handle{background:rgba(255, 255, 255, 0.55)}.os-no-css-vars.os-theme-light:active .os-scrollbar-handle{background:rgba(255, 255, 255, 0.66)}.os-theme-klevu{--os-size:4px;--os-padding-perpendicular:2px;--os-padding-axis:2px;--os-track-border-radius:10px;--os-handle-interactive-area-offset:4px;--os-handle-border-radius:10px;--os-handle-bg:var(--handle-bg);--os-handle-bg-hover:var(--handle-bg-hover);--os-handle-bg-active:var(--handle-bg-active)}.os-theme-klevu .os-scrollbar-handle::after{content:\"\";position:absolute;top:-8px;left:-8px;width:calc(100% + 16px);height:calc(100% + 16px)}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _KlevuUtilScrollbars_instances, _KlevuUtilScrollbars_initCustomScrollbars;
const KlevuUtilScrollbars = /*@__PURE__*/ proxyCustomElement(class KlevuUtilScrollbars extends HTMLElement$1 {
  constructor() {
    super();
    this.__registerHost();
    _KlevuUtilScrollbars_instances.add(this);
    this.overflowX = undefined;
    this.overflowY = undefined;
    this.useNative = undefined;
  }
  componentDidLoad() {
    var _a;
    __classPrivateFieldGet(this, _KlevuUtilScrollbars_instances, "m", _KlevuUtilScrollbars_initCustomScrollbars).call(this);
    if (this.useNative === undefined && ((_a = window.klevu_ui_settings) === null || _a === void 0 ? void 0 : _a.useNativeScrollbars) === true) {
      this.useNative = true;
    }
  }
  scrollbarOptionsChanged() {
    var _a;
    (_a = this.instance) === null || _a === void 0 ? void 0 : _a.destroy();
    __classPrivateFieldGet(this, _KlevuUtilScrollbars_instances, "m", _KlevuUtilScrollbars_initCustomScrollbars).call(this);
  }
  async getContainer() {
    return this.container;
  }
  async getInstance() {
    return {
      customInstance: this.instance,
      nativeContainer: this.nativeContainer,
    };
  }
  render() {
    if (this.useNative) {
      return this.renderNative();
    }
    return (h$1(Host, null, h$1("div", { style: {
        height: "100%",
      }, ref: (el) => (this.container = el) }, h$1("slot", null))));
  }
  renderNative() {
    return (h$1(Host, null, h$1("div", { class: {
        native: true,
      }, style: {
        overflowX: this.overflowX,
        overflowY: this.overflowY,
      }, ref: (el) => (this.nativeContainer = el) }, h$1("slot", null))));
  }
  get el() { return this; }
  static get watchers() { return {
    "overflowX": ["scrollbarOptionsChanged"],
    "overflowY": ["scrollbarOptionsChanged"]
  }; }
  static get style() { return klevuUtilScrollbarsCss; }
}, [4, "klevu-util-scrollbars", {
    "overflowX": [1, "overflow-x"],
    "overflowY": [1, "overflow-y"],
    "useNative": [4, "use-native"],
    "getContainer": [64],
    "getInstance": [64]
  }, undefined, {
    "overflowX": ["scrollbarOptionsChanged"],
    "overflowY": ["scrollbarOptionsChanged"]
  }]);
_KlevuUtilScrollbars_instances = new WeakSet(), _KlevuUtilScrollbars_initCustomScrollbars = function _KlevuUtilScrollbars_initCustomScrollbars() {
  if (!this.container || this.useNative) {
    return;
  }
  const options = {
    overflow: {},
    scrollbars: {
      theme: "os-theme-klevu",
    },
  };
  if (this.overflowX) {
    options.overflow.x = this.overflowX;
  }
  if (this.overflowY) {
    options.overflow.y = this.overflowY;
  }
  this.instance = OverlayScrollbars(this.container, options);
};
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-util-scrollbars"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-util-scrollbars":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuUtilScrollbars);
      }
      break;
  } });
}
defineCustomElement();

export { KlevuUtilScrollbars as K, defineCustomElement as d };

//# sourceMappingURL=klevu-util-scrollbars2.js.map