Forked from hermes-frontend, stripped openclaw/bun specifics: - Auth tokens: openclaw_session -> nyx_session - Vite proxy: localhost:3003 -> localhost:8000 (assay) - Prod WS: wss://assay.loop42.de/ws - Workspace paths: removed openclaw-specific paths - Added missing deps: @heroicons/vue, overlayscrollbars-vue - Branding: title -> nyx Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3063 lines
72 KiB
JavaScript
3063 lines
72 KiB
JavaScript
/*!
|
|
* OverlayScrollbars
|
|
* Version: 2.14.0
|
|
*
|
|
* Copyright (c) Rene Haas | KingSora.
|
|
* https://github.com/KingSora
|
|
*
|
|
* Released under the MIT license.
|
|
*/
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
|
|
const createCache = (t, n) => {
|
|
const {o: o, i: s, u: e} = t;
|
|
let c = o;
|
|
let r;
|
|
const cacheUpdateContextual = (t, n) => {
|
|
const o = c;
|
|
const i = t;
|
|
const l = n || (s ? !s(o, i) : o !== i);
|
|
if (l || e) {
|
|
c = i;
|
|
r = o;
|
|
}
|
|
return [ c, l, r ];
|
|
};
|
|
const cacheUpdateIsolated = t => cacheUpdateContextual(n(c, r), t);
|
|
const getCurrentCache = t => [ c, !!t, r ];
|
|
return [ n ? cacheUpdateIsolated : cacheUpdateContextual, getCurrentCache ];
|
|
};
|
|
|
|
const t = typeof window !== "undefined" && typeof HTMLElement !== "undefined" && !!window.document;
|
|
|
|
const n = t ? window : {};
|
|
|
|
const o = Math.max;
|
|
|
|
const s = Math.min;
|
|
|
|
const e = Math.round;
|
|
|
|
const c = Math.abs;
|
|
|
|
const r = Math.sign;
|
|
|
|
const i = n.cancelAnimationFrame;
|
|
|
|
const l = n.requestAnimationFrame;
|
|
|
|
const a = n.setTimeout;
|
|
|
|
const u = n.clearTimeout;
|
|
|
|
const getApi = t => typeof n[t] !== "undefined" ? n[t] : void 0;
|
|
|
|
const f = getApi("MutationObserver");
|
|
|
|
const _ = getApi("IntersectionObserver");
|
|
|
|
const d = getApi("ResizeObserver");
|
|
|
|
const p = getApi("ScrollTimeline");
|
|
|
|
const isUndefined = t => t === void 0;
|
|
|
|
const isNull = t => t === null;
|
|
|
|
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 => !!t && t.constructor === Object;
|
|
|
|
const isHTMLElement = t => t instanceof HTMLElement;
|
|
|
|
const isElement = t => t instanceof Element;
|
|
|
|
const animationCurrentTime = () => performance.now();
|
|
|
|
const animateNumber = (t, n, s, e, c) => {
|
|
let r = 0;
|
|
const a = animationCurrentTime();
|
|
const u = o(0, s);
|
|
const frame = s => {
|
|
const i = animationCurrentTime();
|
|
const f = i - a;
|
|
const _ = f >= u;
|
|
const d = s ? 1 : 1 - (o(0, a + u - i) / u || 0);
|
|
const p = (n - t) * (isFunction(c) ? c(d, d * u, 0, 1, u) : d) + t;
|
|
const v = _ || d === 1;
|
|
if (e) {
|
|
e(p, d, v);
|
|
}
|
|
r = v ? 0 : l((() => frame()));
|
|
};
|
|
frame();
|
|
return t => {
|
|
i(r);
|
|
if (t) {
|
|
frame(t);
|
|
}
|
|
};
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
const inArray = (t, n) => t.indexOf(n) >= 0;
|
|
|
|
const concat = (t, n) => t.concat(n);
|
|
|
|
const push = (t, n, o) => {
|
|
if (!isString(n) && isArrayLike(n)) {
|
|
Array.prototype.push.apply(t, n);
|
|
} else {
|
|
t.push(n);
|
|
}
|
|
return t;
|
|
};
|
|
|
|
const from = t => Array.from(t || []);
|
|
|
|
const createOrKeepArray = t => {
|
|
if (isArray(t)) {
|
|
return t;
|
|
}
|
|
return !isString(t) && isArrayLike(t) ? from(t) : [ t ];
|
|
};
|
|
|
|
const isEmptyArray = t => !!t && !t.length;
|
|
|
|
const deduplicateArray = t => from(new Set(t));
|
|
|
|
const runEachAndClear = (t, n, o) => {
|
|
const runFn = t => t ? t.apply(void 0, n || []) : true;
|
|
each(t, runFn);
|
|
if (!o) {
|
|
t.length = 0;
|
|
}
|
|
};
|
|
|
|
const v = "paddingTop";
|
|
|
|
const g = "paddingRight";
|
|
|
|
const h = "paddingLeft";
|
|
|
|
const b = "paddingBottom";
|
|
|
|
const w = "marginLeft";
|
|
|
|
const y = "marginRight";
|
|
|
|
const S = "marginBottom";
|
|
|
|
const m = "overflowX";
|
|
|
|
const O = "overflowY";
|
|
|
|
const C = "width";
|
|
|
|
const $ = "height";
|
|
|
|
const x = "visible";
|
|
|
|
const H = "hidden";
|
|
|
|
const E = "scroll";
|
|
|
|
const capitalizeFirstLetter = t => {
|
|
const n = String(t || "");
|
|
return n ? n[0].toUpperCase() + n.slice(1) : "";
|
|
};
|
|
|
|
const equal = (t, n, o, s) => {
|
|
if (t && n) {
|
|
let s = true;
|
|
each(o, (o => {
|
|
const e = t[o];
|
|
const c = n[o];
|
|
if (e !== c) {
|
|
s = false;
|
|
}
|
|
}));
|
|
return s;
|
|
}
|
|
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 bind = (t, ...n) => t.bind(0, ...n);
|
|
|
|
const selfClearTimeout = t => {
|
|
let n;
|
|
const o = t ? a : l;
|
|
const s = t ? u : i;
|
|
return [ e => {
|
|
s(n);
|
|
n = o((() => e()), isFunction(t) ? t() : t);
|
|
}, () => s(n) ];
|
|
};
|
|
|
|
const getDebouncer = t => {
|
|
const n = isFunction(t) ? t() : t;
|
|
if (isNumber(n)) {
|
|
const t = n ? a : l;
|
|
const o = n ? u : i;
|
|
return s => {
|
|
const e = t((() => s()), n);
|
|
return () => {
|
|
o(e);
|
|
};
|
|
};
|
|
}
|
|
return n && n._;
|
|
};
|
|
|
|
const debounce = (t, n) => {
|
|
const {p: o, v: s, S: e, m: c} = n || {};
|
|
let r;
|
|
let i;
|
|
let l;
|
|
let a;
|
|
const u = function invokeFunctionToDebounce(n) {
|
|
if (i) {
|
|
i();
|
|
}
|
|
if (r) {
|
|
r();
|
|
}
|
|
a = i = r = l = void 0;
|
|
t.apply(this, n);
|
|
};
|
|
const mergeParms = t => c && l ? c(l, t) : t;
|
|
const flush = () => {
|
|
if (i && l) {
|
|
u(mergeParms(l) || l);
|
|
}
|
|
};
|
|
const f = function debouncedFn() {
|
|
const t = from(arguments);
|
|
const n = getDebouncer(o);
|
|
if (n) {
|
|
const o = typeof e === "function" ? e() : e;
|
|
const c = getDebouncer(s);
|
|
const f = mergeParms(t);
|
|
const _ = f || t;
|
|
const d = u.bind(0, _);
|
|
if (i) {
|
|
i();
|
|
}
|
|
if (o && !a) {
|
|
d();
|
|
a = true;
|
|
i = n((() => a = void 0));
|
|
} else {
|
|
i = n(d);
|
|
if (c && !r) {
|
|
r = c(flush);
|
|
}
|
|
}
|
|
l = _;
|
|
} else {
|
|
u(t);
|
|
}
|
|
};
|
|
f.O = flush;
|
|
return f;
|
|
};
|
|
|
|
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 i = [ n, o, s, e, c, r ];
|
|
if ((typeof t !== "object" || isNull(t)) && !isFunction(t)) {
|
|
t = {};
|
|
}
|
|
each(i, (n => {
|
|
each(n, ((o, s) => {
|
|
const e = n[s];
|
|
if (t === e) {
|
|
return true;
|
|
}
|
|
const c = isArray(e);
|
|
if (e && isPlainObject(e)) {
|
|
const n = t[s];
|
|
let o = n;
|
|
if (c && !isArray(n)) {
|
|
o = [];
|
|
} else if (!c && !isPlainObject(n)) {
|
|
o = {};
|
|
}
|
|
t[s] = assignDeep(o, e);
|
|
} else {
|
|
t[s] = c ? e.slice() : e;
|
|
}
|
|
}));
|
|
}));
|
|
return t;
|
|
};
|
|
|
|
const removeUndefinedProperties = (t, n) => each(assignDeep({}, t), ((t, n, o) => {
|
|
if (t === void 0) {
|
|
delete o[n];
|
|
} else if (t && isPlainObject(t)) {
|
|
o[n] = removeUndefinedProperties(t);
|
|
}
|
|
}));
|
|
|
|
const isEmptyObject = t => !keys(t).length;
|
|
|
|
const noop = () => {};
|
|
|
|
const capNumber = (t, n, e) => o(t, s(n, e));
|
|
|
|
const getDomTokensArray = t => deduplicateArray((isArray(t) ? t : (t || "").split(" ")).filter((t => t)));
|
|
|
|
const getAttr = (t, n) => t && t.getAttribute(n);
|
|
|
|
const hasAttr = (t, n) => t && t.hasAttribute(n);
|
|
|
|
const setAttrs = (t, n, o) => {
|
|
each(getDomTokensArray(n), (n => {
|
|
if (t) {
|
|
t.setAttribute(n, String(o || ""));
|
|
}
|
|
}));
|
|
};
|
|
|
|
const removeAttrs = (t, n) => {
|
|
each(getDomTokensArray(n), (n => t && t.removeAttribute(n)));
|
|
};
|
|
|
|
const domTokenListAttr = (t, n) => {
|
|
const o = getDomTokensArray(getAttr(t, n));
|
|
const s = bind(setAttrs, t, n);
|
|
const domTokenListOperation = (t, n) => {
|
|
const s = new Set(o);
|
|
each(getDomTokensArray(t), (t => {
|
|
s[n](t);
|
|
}));
|
|
return from(s).join(" ");
|
|
};
|
|
return {
|
|
C: t => s(domTokenListOperation(t, "delete")),
|
|
$: t => s(domTokenListOperation(t, "add")),
|
|
H: t => {
|
|
const n = getDomTokensArray(t);
|
|
return n.reduce(((t, n) => t && o.includes(n)), n.length > 0);
|
|
}
|
|
};
|
|
};
|
|
|
|
const removeAttrClass = (t, n, o) => {
|
|
domTokenListAttr(t, n).C(o);
|
|
return bind(addAttrClass, t, n, o);
|
|
};
|
|
|
|
const addAttrClass = (t, n, o) => {
|
|
domTokenListAttr(t, n).$(o);
|
|
return bind(removeAttrClass, t, n, o);
|
|
};
|
|
|
|
const addRemoveAttrClass = (t, n, o, s) => (s ? addAttrClass : removeAttrClass)(t, n, o);
|
|
|
|
const hasAttrClass = (t, n, o) => domTokenListAttr(t, n).H(o);
|
|
|
|
const createDomTokenListClass = t => domTokenListAttr(t, "class");
|
|
|
|
const removeClass = (t, n) => {
|
|
createDomTokenListClass(t).C(n);
|
|
};
|
|
|
|
const addClass = (t, n) => {
|
|
createDomTokenListClass(t).$(n);
|
|
return bind(removeClass, t, n);
|
|
};
|
|
|
|
const find = (t, n) => {
|
|
const o = n ? isElement(n) && n : document;
|
|
return o ? from(o.querySelectorAll(t)) : [];
|
|
};
|
|
|
|
const findFirst = (t, n) => {
|
|
const o = n ? isElement(n) && n : document;
|
|
return o && o.querySelector(t);
|
|
};
|
|
|
|
const is = (t, n) => isElement(t) && t.matches(n);
|
|
|
|
const isBodyElement = t => is(t, "body");
|
|
|
|
const contents = t => t ? from(t.childNodes) : [];
|
|
|
|
const parent = t => t && t.parentElement;
|
|
|
|
const closest = (t, n) => isElement(t) && t.closest(n);
|
|
|
|
const getFocusedElement = t => document.activeElement;
|
|
|
|
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 removeElements = t => {
|
|
each(createOrKeepArray(t), (t => {
|
|
const n = parent(t);
|
|
if (t && n) {
|
|
n.removeChild(t);
|
|
}
|
|
}));
|
|
};
|
|
|
|
const appendChildren = (t, n) => bind(removeElements, t && n && each(createOrKeepArray(n), (n => {
|
|
if (n) {
|
|
t.appendChild(n);
|
|
}
|
|
})));
|
|
|
|
let z;
|
|
|
|
const getTrustedTypePolicy = () => z;
|
|
|
|
const setTrustedTypePolicy = t => {
|
|
z = t;
|
|
};
|
|
|
|
const createDiv = t => {
|
|
const n = document.createElement("div");
|
|
setAttrs(n, "class", t);
|
|
return n;
|
|
};
|
|
|
|
const createDOM = t => {
|
|
const n = createDiv();
|
|
const o = getTrustedTypePolicy();
|
|
const s = t.trim();
|
|
n.innerHTML = o ? o.createHTML(s) : s;
|
|
return each(contents(n), (t => removeElements(t)));
|
|
};
|
|
|
|
const getCSSVal = (t, n) => t.getPropertyValue(n) || t[n] || "";
|
|
|
|
const validFiniteNumber = t => {
|
|
const n = t || 0;
|
|
return isFinite(n) ? n : 0;
|
|
};
|
|
|
|
const parseToZeroOrNumber = t => validFiniteNumber(parseFloat(t || ""));
|
|
|
|
const roundCssNumber = t => Math.round(t * 1e4) / 1e4;
|
|
|
|
const numberToCssPx = t => `${roundCssNumber(validFiniteNumber(t))}px`;
|
|
|
|
function setStyles(t, n) {
|
|
t && n && each(n, ((n, o) => {
|
|
try {
|
|
const s = t.style;
|
|
const e = isNull(n) || isBoolean(n) ? "" : isNumber(n) ? numberToCssPx(n) : n;
|
|
if (o.indexOf("--") === 0) {
|
|
s.setProperty(o, e);
|
|
} else {
|
|
s[o] = e;
|
|
}
|
|
} catch (s) {}
|
|
}));
|
|
}
|
|
|
|
function getStyles(t, o, s) {
|
|
const e = isString(o);
|
|
let c = e ? "" : {};
|
|
if (t) {
|
|
const r = n.getComputedStyle(t, s) || t.style;
|
|
c = e ? getCSSVal(r, o) : from(o).reduce(((t, n) => {
|
|
t[n] = getCSSVal(r, n);
|
|
return t;
|
|
}), c);
|
|
}
|
|
return c;
|
|
}
|
|
|
|
const topRightBottomLeft = (t, n, o) => {
|
|
const s = n ? `${n}-` : "";
|
|
const e = o ? `-${o}` : "";
|
|
const c = `${s}top${e}`;
|
|
const r = `${s}right${e}`;
|
|
const i = `${s}bottom${e}`;
|
|
const l = `${s}left${e}`;
|
|
const a = getStyles(t, [ c, r, i, l ]);
|
|
return {
|
|
t: parseToZeroOrNumber(a[c]),
|
|
r: parseToZeroOrNumber(a[r]),
|
|
b: parseToZeroOrNumber(a[i]),
|
|
l: parseToZeroOrNumber(a[l])
|
|
};
|
|
};
|
|
|
|
const getTrasformTranslateValue = (t, n) => `translate${isObject(t) ? `(${t.x},${t.y})` : `${n ? "X" : "Y"}(${t})`}`;
|
|
|
|
const elementHasDimensions = t => !!(t.offsetWidth || t.offsetHeight || t.getClientRects().length);
|
|
|
|
const I = {
|
|
w: 0,
|
|
h: 0
|
|
};
|
|
|
|
const getElmWidthHeightProperty = (t, n) => n ? {
|
|
w: n[`${t}Width`],
|
|
h: n[`${t}Height`]
|
|
} : I;
|
|
|
|
const getWindowSize = t => getElmWidthHeightProperty("inner", t || n);
|
|
|
|
const A = bind(getElmWidthHeightProperty, "offset");
|
|
|
|
const T = bind(getElmWidthHeightProperty, "client");
|
|
|
|
const D = bind(getElmWidthHeightProperty, "scroll");
|
|
|
|
const getFractionalSize = t => {
|
|
const n = parseFloat(getStyles(t, C)) || 0;
|
|
const o = parseFloat(getStyles(t, $)) || 0;
|
|
return {
|
|
w: n - e(n),
|
|
h: o - e(o)
|
|
};
|
|
};
|
|
|
|
const getBoundingClientRect = t => t.getBoundingClientRect();
|
|
|
|
const hasDimensions = t => !!t && elementHasDimensions(t);
|
|
|
|
const domRectHasDimensions = t => !!(t && (t[$] || t[C]));
|
|
|
|
const domRectAppeared = (t, n) => {
|
|
const o = domRectHasDimensions(t);
|
|
const s = domRectHasDimensions(n);
|
|
return !s && o;
|
|
};
|
|
|
|
const removeEventListener = (t, n, o, s) => {
|
|
each(getDomTokensArray(n), (n => {
|
|
if (t) {
|
|
t.removeEventListener(n, o, s);
|
|
}
|
|
}));
|
|
};
|
|
|
|
const addEventListener = (t, n, o, s) => {
|
|
var e;
|
|
const c = (e = s && s.I) != null ? e : true;
|
|
const r = s && s.A || false;
|
|
const i = s && s.T || false;
|
|
const l = {
|
|
passive: c,
|
|
capture: r
|
|
};
|
|
return bind(runEachAndClear, getDomTokensArray(n).map((n => {
|
|
const s = i ? e => {
|
|
removeEventListener(t, n, s, r);
|
|
if (o) {
|
|
o(e);
|
|
}
|
|
} : o;
|
|
if (t) {
|
|
t.addEventListener(n, s, l);
|
|
}
|
|
return bind(removeEventListener, t, n, s, r);
|
|
})));
|
|
};
|
|
|
|
const stopPropagation = t => t.stopPropagation();
|
|
|
|
const preventDefault = t => t.preventDefault();
|
|
|
|
const stopAndPrevent = t => stopPropagation(t) || preventDefault(t);
|
|
|
|
const scrollElementTo = (t, n) => {
|
|
const {x: o, y: s} = isNumber(n) ? {
|
|
x: n,
|
|
y: n
|
|
} : n || {};
|
|
isNumber(o) && (t.scrollLeft = o);
|
|
isNumber(s) && (t.scrollTop = s);
|
|
};
|
|
|
|
const getElementScroll = t => ({
|
|
x: t.scrollLeft,
|
|
y: t.scrollTop
|
|
});
|
|
|
|
const getZeroScrollCoordinates = () => ({
|
|
D: {
|
|
x: 0,
|
|
y: 0
|
|
},
|
|
M: {
|
|
x: 0,
|
|
y: 0
|
|
}
|
|
});
|
|
|
|
const sanitizeScrollCoordinates = (t, n) => {
|
|
const {D: o, M: s} = t;
|
|
const {w: e, h: i} = n;
|
|
const sanitizeAxis = (t, n, o) => {
|
|
let s = r(t) * o;
|
|
let e = r(n) * o;
|
|
if (s === e) {
|
|
const o = c(t);
|
|
const r = c(n);
|
|
e = o > r ? 0 : e;
|
|
s = o < r ? 0 : s;
|
|
}
|
|
s = s === e ? 0 : s;
|
|
return [ s + 0, e + 0 ];
|
|
};
|
|
const [l, a] = sanitizeAxis(o.x, s.x, e);
|
|
const [u, f] = sanitizeAxis(o.y, s.y, i);
|
|
return {
|
|
D: {
|
|
x: l,
|
|
y: u
|
|
},
|
|
M: {
|
|
x: a,
|
|
y: f
|
|
}
|
|
};
|
|
};
|
|
|
|
const isDefaultDirectionScrollCoordinates = ({D: t, M: n}) => {
|
|
const getAxis = (t, n) => t === 0 && t <= n;
|
|
return {
|
|
x: getAxis(t.x, n.x),
|
|
y: getAxis(t.y, n.y)
|
|
};
|
|
};
|
|
|
|
const getScrollCoordinatesPercent = ({D: t, M: n}, o) => {
|
|
const getAxis = (t, n, o) => capNumber(0, 1, (t - o) / (t - n) || 0);
|
|
return {
|
|
x: getAxis(t.x, n.x, o.x),
|
|
y: getAxis(t.y, n.y, o.y)
|
|
};
|
|
};
|
|
|
|
const focusElement = t => {
|
|
if (t && t.focus) {
|
|
t.focus({
|
|
preventScroll: true,
|
|
focusVisible: false
|
|
});
|
|
}
|
|
};
|
|
|
|
const manageListener = (t, n) => {
|
|
each(createOrKeepArray(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 => {
|
|
if (isFunction(t)) {
|
|
s.add(t);
|
|
}
|
|
}), o);
|
|
return bind(removeEvent, t, o);
|
|
}
|
|
if (isBoolean(o) && o) {
|
|
removeEvent();
|
|
}
|
|
const s = keys(t);
|
|
const e = [];
|
|
each(s, (n => {
|
|
const o = t[n];
|
|
if (o) {
|
|
push(e, addEvent(n, o));
|
|
}
|
|
}));
|
|
return bind(runEachAndClear, e);
|
|
};
|
|
const triggerEvent = (t, o) => {
|
|
each(from(n.get(t)), (t => {
|
|
if (o && !isEmptyArray(o)) {
|
|
t.apply(0, o);
|
|
} else {
|
|
t();
|
|
}
|
|
}));
|
|
};
|
|
addEvent(t || {});
|
|
return [ addEvent, removeEvent, triggerEvent ];
|
|
};
|
|
|
|
const M = {};
|
|
|
|
const k = {};
|
|
|
|
const addPlugins = t => {
|
|
each(t, (t => each(t, ((n, o) => {
|
|
M[o] = t[o];
|
|
}))));
|
|
};
|
|
|
|
const registerPluginModuleInstances = (t, n, o) => keys(t).map((s => {
|
|
const {static: e, instance: c} = t[s];
|
|
const [r, i, l] = o || [];
|
|
const a = o ? c : e;
|
|
if (a) {
|
|
const t = o ? a(r, i, n) : a(n);
|
|
return (l || k)[s] = t;
|
|
}
|
|
}));
|
|
|
|
const getStaticPluginModuleInstance = t => k[t];
|
|
|
|
const R = "__osOptionsValidationPlugin";
|
|
|
|
const V = `data-overlayscrollbars`;
|
|
|
|
const L = "os-environment";
|
|
|
|
const U = `${L}-scrollbar-hidden`;
|
|
|
|
const P = `${V}-initialize`;
|
|
|
|
const N = "noClipping";
|
|
|
|
const q = `${V}-body`;
|
|
|
|
const j = V;
|
|
|
|
const B = "host";
|
|
|
|
const F = `${V}-viewport`;
|
|
|
|
const X = m;
|
|
|
|
const Y = O;
|
|
|
|
const W = "arrange";
|
|
|
|
const J = "measuring";
|
|
|
|
const G = "scrolling";
|
|
|
|
const K = "scrollbarHidden";
|
|
|
|
const Q = "noContent";
|
|
|
|
const Z = `${V}-padding`;
|
|
|
|
const tt = `${V}-content`;
|
|
|
|
const nt = "os-size-observer";
|
|
|
|
const ot = `${nt}-appear`;
|
|
|
|
const st = `${nt}-listener`;
|
|
|
|
const et = `${st}-scroll`;
|
|
|
|
const ct = `${st}-item`;
|
|
|
|
const rt = `${ct}-final`;
|
|
|
|
const it = "os-trinsic-observer";
|
|
|
|
const lt = "os-theme-none";
|
|
|
|
const at = "os-scrollbar";
|
|
|
|
const ut = `${at}-rtl`;
|
|
|
|
const ft = `${at}-horizontal`;
|
|
|
|
const _t = `${at}-vertical`;
|
|
|
|
const dt = `${at}-track`;
|
|
|
|
const pt = `${at}-handle`;
|
|
|
|
const vt = `${at}-visible`;
|
|
|
|
const gt = `${at}-cornerless`;
|
|
|
|
const ht = `${at}-interaction`;
|
|
|
|
const bt = `${at}-unusable`;
|
|
|
|
const wt = `${at}-auto-hide`;
|
|
|
|
const yt = `${wt}-hidden`;
|
|
|
|
const St = `${at}-wheel`;
|
|
|
|
const mt = `${dt}-interactive`;
|
|
|
|
const Ot = `${pt}-interactive`;
|
|
|
|
const Ct = "__osSizeObserverPlugin";
|
|
|
|
const $t = /* @__PURE__ */ (() => ({
|
|
[Ct]: {
|
|
static: () => (t, n, o) => {
|
|
const s = 3333333;
|
|
const e = "scroll";
|
|
const c = createDOM(`<div class="${ct}" dir="ltr"><div class="${ct}"><div class="${rt}"></div></div><div class="${ct}"><div class="${rt}" style="width: 200%; height: 200%"></div></div></div>`);
|
|
const r = c[0];
|
|
const a = r.lastChild;
|
|
const u = r.firstChild;
|
|
const f = u == null ? void 0 : u.firstChild;
|
|
let _ = A(r);
|
|
let d = _;
|
|
let p = false;
|
|
let v;
|
|
const reset = () => {
|
|
scrollElementTo(u, s);
|
|
scrollElementTo(a, s);
|
|
};
|
|
const onResized = t => {
|
|
v = 0;
|
|
if (p) {
|
|
_ = d;
|
|
n(t === true);
|
|
}
|
|
};
|
|
const onScroll = t => {
|
|
d = A(r);
|
|
p = !t || !equalWH(d, _);
|
|
if (t) {
|
|
stopPropagation(t);
|
|
if (p && !v) {
|
|
i(v);
|
|
v = l(onResized);
|
|
}
|
|
} else {
|
|
onResized(t === false);
|
|
}
|
|
reset();
|
|
};
|
|
const g = [ appendChildren(t, c), addEventListener(u, e, onScroll), addEventListener(a, e, onScroll) ];
|
|
addClass(t, et);
|
|
setStyles(f, {
|
|
[C]: s,
|
|
[$]: s
|
|
});
|
|
l(reset);
|
|
return [ o ? bind(onScroll, false) : reset, g ];
|
|
}
|
|
}
|
|
}))();
|
|
|
|
const getShowNativeOverlaidScrollbars = (t, n) => {
|
|
const {k: o} = n;
|
|
const [s, e] = t("showNativeOverlaidScrollbars");
|
|
return [ s && o.x && o.y, e ];
|
|
};
|
|
|
|
const overflowIsVisible = t => t.indexOf(x) === 0;
|
|
|
|
const overflowBehaviorToOverflowStyle = t => t.replace(`${x}-`, "");
|
|
|
|
const overflowCssValueToOverflowStyle = (t, n) => {
|
|
if (t === "auto") {
|
|
return n ? E : H;
|
|
}
|
|
const o = t || H;
|
|
return [ H, E, x ].includes(o) ? o : H;
|
|
};
|
|
|
|
const getElementOverflowStyle = (t, n) => {
|
|
const {overflowX: o, overflowY: s} = getStyles(t, [ m, O ]);
|
|
return {
|
|
x: overflowCssValueToOverflowStyle(o, n.x),
|
|
y: overflowCssValueToOverflowStyle(s, n.y)
|
|
};
|
|
};
|
|
|
|
const xt = "__osScrollbarsHidingPlugin";
|
|
|
|
const Ht = /* @__PURE__ */ (() => ({
|
|
[xt]: {
|
|
static: () => ({
|
|
R: (t, n, o, s, e) => {
|
|
const {V: c, L: r} = t;
|
|
const {U: i, k: l, P: a} = s;
|
|
const u = !c && !i && (l.x || l.y);
|
|
const [f] = getShowNativeOverlaidScrollbars(e, s);
|
|
const _getViewportOverflowHideOffset = t => {
|
|
const n = i || f ? 0 : 42;
|
|
const getHideOffsetPerAxis = (t, o, s) => {
|
|
const e = t ? n : s;
|
|
const c = o && !i ? e : 0;
|
|
const r = t && !!n;
|
|
return [ c, r ];
|
|
};
|
|
const [o, s] = getHideOffsetPerAxis(l.x, t.x === E, a.x);
|
|
const [e, c] = getHideOffsetPerAxis(l.y, t.y === E, a.y);
|
|
return {
|
|
N: {
|
|
x: o,
|
|
y: e
|
|
},
|
|
q: {
|
|
x: s,
|
|
y: c
|
|
}
|
|
};
|
|
};
|
|
const _hideNativeScrollbars = t => {
|
|
if (!c) {
|
|
const {j: s} = o;
|
|
const e = assignDeep({}, {
|
|
[y]: 0,
|
|
[S]: 0,
|
|
[w]: 0
|
|
});
|
|
const {N: c, q: r} = _getViewportOverflowHideOffset(t);
|
|
const {x: i, y: l} = r;
|
|
const {x: a, y: f} = c;
|
|
const {B: _} = n;
|
|
const d = s ? w : y;
|
|
const p = s ? h : g;
|
|
const v = _[d];
|
|
const m = _[S];
|
|
const O = _[p];
|
|
const $ = _[b];
|
|
e[C] = `calc(100% + ${f + v * -1}px)`;
|
|
e[d] = -f + v;
|
|
e[S] = -a + m;
|
|
if (u) {
|
|
e[p] = O + (l ? f : 0);
|
|
e[b] = $ + (i ? a : 0);
|
|
}
|
|
return e;
|
|
}
|
|
};
|
|
const _arrangeViewport = (t, s, e) => {
|
|
if (u) {
|
|
const {B: c} = n;
|
|
const {N: i, q: l} = _getViewportOverflowHideOffset(t);
|
|
const {x: a, y: u} = l;
|
|
const {x: f, y: _} = i;
|
|
const {j: d} = o;
|
|
const p = d ? g : h;
|
|
const v = c[p];
|
|
const b = c.paddingTop;
|
|
const w = s.w + e.w;
|
|
const y = s.h + e.h;
|
|
const S = {
|
|
w: _ && u ? `${_ + w - v}px` : "",
|
|
h: f && a ? `${f + y - b}px` : ""
|
|
};
|
|
setStyles(r, {
|
|
"--os-vaw": S.w,
|
|
"--os-vah": S.h
|
|
});
|
|
}
|
|
return u;
|
|
};
|
|
const _undoViewportArrange = () => {
|
|
if (u) {
|
|
const {F: t, B: o} = n;
|
|
const s = getElementOverflowStyle(r, t);
|
|
const {q: e} = _getViewportOverflowHideOffset(s);
|
|
const {x: c, y: i} = e;
|
|
const l = {};
|
|
const assignProps = t => each(t, (t => {
|
|
l[t] = o[t];
|
|
}));
|
|
if (c) {
|
|
assignProps([ S, v, b ]);
|
|
}
|
|
if (i) {
|
|
assignProps([ w, y, h, g ]);
|
|
}
|
|
const a = getStyles(r, keys(l));
|
|
const u = removeAttrClass(r, F, W);
|
|
setStyles(r, l);
|
|
return () => {
|
|
setStyles(r, assignDeep({}, a, _hideNativeScrollbars(s)));
|
|
u();
|
|
};
|
|
}
|
|
return noop;
|
|
};
|
|
return {
|
|
X: _arrangeViewport,
|
|
Y: _undoViewportArrange,
|
|
W: _hideNativeScrollbars
|
|
};
|
|
}
|
|
})
|
|
}
|
|
}))();
|
|
|
|
const Et = "__osClickScrollPlugin";
|
|
|
|
const zt = /* @__PURE__ */ (() => ({
|
|
[Et]: {
|
|
static: () => (t, n, o, s) => {
|
|
let e = false;
|
|
let c = noop;
|
|
const r = 133;
|
|
const i = 222;
|
|
const [l, a] = selfClearTimeout(r);
|
|
const u = Math.sign(n);
|
|
const f = o * u;
|
|
const _ = f / 2;
|
|
const easing = t => 1 - (1 - t) * (1 - t);
|
|
const easedEndPressAnimation = (n, o) => animateNumber(n, o, i, t, easing);
|
|
const linearPressAnimation = (o, s) => animateNumber(o, n - f, r * s, ((o, s, e) => {
|
|
t(o);
|
|
if (e) {
|
|
c = easedEndPressAnimation(o, n);
|
|
}
|
|
}));
|
|
const d = animateNumber(0, f, i, ((r, i, a) => {
|
|
t(r);
|
|
if (a) {
|
|
s(e);
|
|
if (!e) {
|
|
const t = n - r;
|
|
const s = Math.sign(t - _) === u;
|
|
if (s) {
|
|
l((() => {
|
|
const s = t - f;
|
|
const e = Math.sign(s) === u;
|
|
c = e ? linearPressAnimation(r, Math.abs(s) / o) : easedEndPressAnimation(r, n);
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
}), easing);
|
|
return t => {
|
|
e = true;
|
|
if (t) {
|
|
d();
|
|
}
|
|
a();
|
|
c();
|
|
};
|
|
}
|
|
}
|
|
}))();
|
|
|
|
const opsStringify = t => JSON.stringify(t, ((t, n) => {
|
|
if (isFunction(n)) {
|
|
throw 0;
|
|
}
|
|
return n;
|
|
}));
|
|
|
|
const getPropByPath = (t, n) => t ? `${n}`.split(".").reduce(((t, n) => t && hasOwnProperty(t, n) ? t[n] : void 0), t) : void 0;
|
|
|
|
const It = [ 0, 33 ];
|
|
|
|
const At = [ 33, 99 ];
|
|
|
|
const Tt = [ 222, 666, true ];
|
|
|
|
const Dt = {
|
|
paddingAbsolute: false,
|
|
showNativeOverlaidScrollbars: false,
|
|
update: {
|
|
elementEvents: [ [ "img", "load" ] ],
|
|
debounce: {
|
|
mutation: It,
|
|
resize: null,
|
|
event: At,
|
|
env: Tt
|
|
},
|
|
attributes: null,
|
|
ignoreMutation: null,
|
|
flowDirectionStyles: 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 = concat(keys(n), 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 createOptionCheck = (t, n, o) => s => [ getPropByPath(t, s), o || getPropByPath(n, s) !== void 0 ];
|
|
|
|
let Mt;
|
|
|
|
const getNonce = () => Mt;
|
|
|
|
const setNonce = t => {
|
|
Mt = t;
|
|
};
|
|
|
|
let kt;
|
|
|
|
const createEnvironment = () => {
|
|
const getNativeScrollbarSize = (t, n, o) => {
|
|
appendChildren(document.body, t);
|
|
appendChildren(document.body, t);
|
|
const s = T(t);
|
|
const e = A(t);
|
|
const c = getFractionalSize(n);
|
|
if (o) {
|
|
removeElements(t);
|
|
}
|
|
return {
|
|
x: e.h - s.h + c.h,
|
|
y: e.w - s.w + c.w
|
|
};
|
|
};
|
|
const getNativeScrollbarsHiding = t => {
|
|
let n = false;
|
|
const o = addClass(t, U);
|
|
try {
|
|
n = getStyles(t, "scrollbar-width") === "none" || getStyles(t, "display", "::-webkit-scrollbar") === "none";
|
|
} catch (s) {}
|
|
o();
|
|
return n;
|
|
};
|
|
const t = `.${L}{scroll-behavior:auto!important;position:fixed;opacity:0;visibility:hidden;overflow:scroll;height:200px;width:200px;z-index:-1}.${L} div{width:200%;height:200%;margin:10px 0}.${U}{scrollbar-width:none!important}.${U}::-webkit-scrollbar,.${U}::-webkit-scrollbar-corner{appearance:none!important;display:none!important;width:0!important;height:0!important}`;
|
|
const o = createDOM(`<div class="${L}"><div></div><style>${t}</style></div>`);
|
|
const s = o[0];
|
|
const e = s.firstChild;
|
|
const c = s.lastChild;
|
|
const r = getNonce();
|
|
if (r) {
|
|
c.nonce = r;
|
|
}
|
|
const [i, , l] = createEventListenerHub();
|
|
const [a, u] = createCache({
|
|
o: getNativeScrollbarSize(s, e),
|
|
i: equalXY
|
|
}, bind(getNativeScrollbarSize, s, e, true));
|
|
const [f] = u();
|
|
const _ = getNativeScrollbarsHiding(s);
|
|
const d = {
|
|
x: f.x === 0,
|
|
y: f.y === 0
|
|
};
|
|
const v = {
|
|
elements: {
|
|
host: null,
|
|
padding: !_,
|
|
viewport: t => _ && isBodyElement(t) && t,
|
|
content: false
|
|
},
|
|
scrollbars: {
|
|
slot: true
|
|
},
|
|
cancel: {
|
|
nativeScrollbarsOverlaid: false,
|
|
body: null
|
|
}
|
|
};
|
|
const g = assignDeep({}, Dt);
|
|
const h = bind(assignDeep, {}, g);
|
|
const b = bind(assignDeep, {}, v);
|
|
const w = {
|
|
P: f,
|
|
k: d,
|
|
U: _,
|
|
J: !!p,
|
|
G: bind(i, "r"),
|
|
K: b,
|
|
Z: t => assignDeep(v, t) && b(),
|
|
tt: h,
|
|
nt: t => assignDeep(g, t) && h(),
|
|
ot: assignDeep({}, v),
|
|
st: assignDeep({}, g)
|
|
};
|
|
removeAttrs(s, "style");
|
|
removeElements(s);
|
|
addEventListener(n, "resize", (() => {
|
|
l("r", []);
|
|
}));
|
|
if (isFunction(n.matchMedia) && !_ && (!d.x || !d.y)) {
|
|
const addZoomListener = t => {
|
|
const o = n.matchMedia(`(resolution: ${n.devicePixelRatio}dppx)`);
|
|
addEventListener(o, "change", (() => {
|
|
t();
|
|
addZoomListener(t);
|
|
}), {
|
|
T: true
|
|
});
|
|
};
|
|
addZoomListener((() => {
|
|
const [t, n] = a();
|
|
assignDeep(w.P, t);
|
|
l("r", [ n ]);
|
|
}));
|
|
}
|
|
return w;
|
|
};
|
|
|
|
const getEnvironment = () => {
|
|
if (!kt) {
|
|
kt = createEnvironment();
|
|
}
|
|
return kt;
|
|
};
|
|
|
|
const createEventContentChange = (t, n, o) => {
|
|
let s = false;
|
|
const e = o ? new WeakMap : false;
|
|
const destroy = () => {
|
|
s = true;
|
|
};
|
|
const updateElements = c => {
|
|
if (e && o) {
|
|
const r = o.map((n => {
|
|
const [o, s] = n || [];
|
|
const e = s && o ? (c || find)(o, t) : [];
|
|
return [ e, s ];
|
|
}));
|
|
each(r, (o => each(o[0], (c => {
|
|
const r = o[1];
|
|
const i = e.get(c) || [];
|
|
const l = t.contains(c);
|
|
if (l && r) {
|
|
const t = addEventListener(c, r, (o => {
|
|
if (s) {
|
|
t();
|
|
e.delete(c);
|
|
} else {
|
|
n(o);
|
|
}
|
|
}));
|
|
e.set(c, push(i, t));
|
|
} else {
|
|
runEachAndClear(i);
|
|
e.delete(c);
|
|
}
|
|
}))));
|
|
}
|
|
};
|
|
updateElements();
|
|
return [ destroy, updateElements ];
|
|
};
|
|
|
|
const createDOMObserver = (t, n, o, s) => {
|
|
let e = false;
|
|
const {et: c, ct: r, rt: i, it: l, lt: a, ut: u} = s || {};
|
|
const [_, d] = createEventContentChange(t, (() => e && o(true)), i);
|
|
const p = c || [];
|
|
const v = r || [];
|
|
const g = concat(p, v);
|
|
const observerCallback = (e, c) => {
|
|
if (!isEmptyArray(c)) {
|
|
const r = a || noop;
|
|
const i = u || noop;
|
|
const f = [];
|
|
const _ = [];
|
|
let p = false;
|
|
let g = false;
|
|
each(c, (o => {
|
|
const {attributeName: e, target: c, type: a, oldValue: u, addedNodes: d, removedNodes: h} = o;
|
|
const b = a === "attributes";
|
|
const w = a === "childList";
|
|
const y = t === c;
|
|
const S = b && e;
|
|
const m = S && getAttr(c, e || "");
|
|
const O = isString(m) ? m : null;
|
|
const C = S && u !== O;
|
|
const $ = inArray(v, e) && C;
|
|
if (n && (w || !y)) {
|
|
const n = b && C;
|
|
const a = n && l && is(c, l);
|
|
const _ = a ? !r(c, e, u, O) : !b || n;
|
|
const p = _ && !i(o, !!a, t, s);
|
|
each(d, (t => push(f, t)));
|
|
each(h, (t => push(f, t)));
|
|
g = g || p;
|
|
}
|
|
if (!n && y && C && !r(c, e, u, O)) {
|
|
push(_, e);
|
|
p = p || $;
|
|
}
|
|
}));
|
|
d((t => deduplicateArray(f).reduce(((n, o) => {
|
|
push(n, find(t, o));
|
|
return is(o, t) ? push(n, o) : n;
|
|
}), [])));
|
|
if (n) {
|
|
if (!e && g) {
|
|
o(false);
|
|
}
|
|
return [ false ];
|
|
}
|
|
if (!isEmptyArray(_) || p) {
|
|
const t = [ deduplicateArray(_), p ];
|
|
if (!e) {
|
|
o.apply(0, t);
|
|
}
|
|
return t;
|
|
}
|
|
}
|
|
};
|
|
const h = new f(bind(observerCallback, false));
|
|
return [ () => {
|
|
h.observe(t, {
|
|
attributes: true,
|
|
attributeOldValue: true,
|
|
attributeFilter: g,
|
|
subtree: n,
|
|
childList: n,
|
|
characterData: n
|
|
});
|
|
e = true;
|
|
return () => {
|
|
if (e) {
|
|
_();
|
|
h.disconnect();
|
|
e = false;
|
|
}
|
|
};
|
|
}, () => {
|
|
if (e) {
|
|
return observerCallback(true, h.takeRecords());
|
|
}
|
|
} ];
|
|
};
|
|
|
|
let Rt = null;
|
|
|
|
const createSizeObserver = (t, n, o) => {
|
|
const {ft: s} = o || {};
|
|
const e = getStaticPluginModuleInstance(Ct);
|
|
const [c] = createCache({
|
|
o: false,
|
|
u: true
|
|
});
|
|
return () => {
|
|
const o = [];
|
|
const r = createDOM(`<div class="${nt}"><div class="${st}"></div></div>`);
|
|
const i = r[0];
|
|
const l = i.firstChild;
|
|
const onSizeChangedCallbackProxy = t => {
|
|
const o = isArray(t) && !isEmptyArray(t);
|
|
let s = false;
|
|
let e = false;
|
|
if (o) {
|
|
const n = t[0];
|
|
const [o, , r] = c(n.contentRect);
|
|
const i = domRectHasDimensions(o);
|
|
e = domRectAppeared(o, r);
|
|
s = !e && !i;
|
|
} else {
|
|
e = t === true;
|
|
}
|
|
if (!s) {
|
|
n({
|
|
_t: true,
|
|
ft: e
|
|
});
|
|
}
|
|
};
|
|
if (d) {
|
|
if (!isBoolean(Rt)) {
|
|
const n = new d(noop);
|
|
n.observe(t, {
|
|
get box() {
|
|
Rt = true;
|
|
}
|
|
});
|
|
Rt = Rt || false;
|
|
n.disconnect();
|
|
}
|
|
const n = debounce(onSizeChangedCallbackProxy, {
|
|
p: 0,
|
|
v: 0
|
|
});
|
|
const resizeObserverCallback = t => n(t);
|
|
const s = new d(resizeObserverCallback);
|
|
s.observe(Rt ? t : l);
|
|
push(o, [ () => {
|
|
s.disconnect();
|
|
}, !Rt && appendChildren(t, i) ]);
|
|
if (Rt) {
|
|
const n = new d(resizeObserverCallback);
|
|
n.observe(t, {
|
|
box: "border-box"
|
|
});
|
|
push(o, (() => n.disconnect()));
|
|
}
|
|
} else if (e) {
|
|
const [n, c] = e(l, onSizeChangedCallbackProxy, s);
|
|
push(o, concat([ addClass(i, ot), addEventListener(i, "animationstart", n), appendChildren(t, i) ], c));
|
|
} else {
|
|
return noop;
|
|
}
|
|
return bind(runEachAndClear, o);
|
|
};
|
|
};
|
|
|
|
const createTrinsicObserver = (t, n) => {
|
|
let o;
|
|
const isHeightIntrinsic = t => t.h === 0 || t.isIntersecting || t.intersectionRatio > 0;
|
|
const s = createDiv(it);
|
|
const [e] = createCache({
|
|
o: false
|
|
});
|
|
const triggerOnTrinsicChangedCallback = (t, o) => {
|
|
if (t) {
|
|
const s = e(isHeightIntrinsic(t));
|
|
const [, c] = s;
|
|
return c && !o && n(s) && [ s ];
|
|
}
|
|
};
|
|
const intersectionObserverCallback = (t, n) => triggerOnTrinsicChangedCallback(n.pop(), t);
|
|
return [ () => {
|
|
const n = [];
|
|
if (_) {
|
|
o = new _(bind(intersectionObserverCallback, false), {
|
|
root: t
|
|
});
|
|
o.observe(s);
|
|
push(n, (() => {
|
|
o.disconnect();
|
|
}));
|
|
} else {
|
|
const onSizeChanged = () => {
|
|
const t = A(s);
|
|
triggerOnTrinsicChangedCallback(t);
|
|
};
|
|
push(n, createSizeObserver(s, onSizeChanged)());
|
|
onSizeChanged();
|
|
}
|
|
return bind(runEachAndClear, push(n, appendChildren(t, s)));
|
|
}, () => o && intersectionObserverCallback(true, o.takeRecords()) ];
|
|
};
|
|
|
|
const createObserversSetup = (t, n, o, s) => {
|
|
let e;
|
|
let c;
|
|
let r;
|
|
let i;
|
|
let l;
|
|
let a;
|
|
let u;
|
|
let f;
|
|
const _ = `[${j}]`;
|
|
const p = `[${F}]`;
|
|
const v = [ "id", "class", "style", "open", "wrap", "cols", "rows" ];
|
|
const {dt: g, vt: h, L: b, gt: w, ht: y, V: S, bt: m, wt: O, yt: C, St: $} = t;
|
|
const getDirectionIsRTL = t => getStyles(t, "direction") === "rtl";
|
|
const createDebouncedObservesUpdate = () => {
|
|
let t;
|
|
let n;
|
|
let o;
|
|
const e = debounce(s, {
|
|
p: () => t,
|
|
v: () => n,
|
|
S: () => o,
|
|
m(t, n) {
|
|
const [o] = t;
|
|
const [s] = n;
|
|
return [ concat(keys(o), keys(s)).reduce(((t, n) => {
|
|
t[n] = o[n] || s[n];
|
|
return t;
|
|
}), {}) ];
|
|
}
|
|
});
|
|
const fn = (s, c) => {
|
|
if (isArray(c)) {
|
|
const [s, e, r] = c;
|
|
t = s;
|
|
n = e;
|
|
o = r;
|
|
} else if (isNumber(c)) {
|
|
t = c;
|
|
n = false;
|
|
o = false;
|
|
} else {
|
|
t = false;
|
|
n = false;
|
|
o = false;
|
|
}
|
|
e(s);
|
|
};
|
|
fn.O = e.O;
|
|
return fn;
|
|
};
|
|
const x = {
|
|
Ot: false,
|
|
j: getDirectionIsRTL(g)
|
|
};
|
|
const H = getEnvironment();
|
|
const E = getStaticPluginModuleInstance(xt);
|
|
const [z] = createCache({
|
|
i: equalWH,
|
|
o: {
|
|
w: 0,
|
|
h: 0
|
|
}
|
|
}, (() => {
|
|
const s = E && E.R(t, n, x, H, o).Y;
|
|
const e = m && S;
|
|
const c = !e && hasAttrClass(h, j, N);
|
|
const r = !S && O(W);
|
|
const i = r && getElementScroll(w);
|
|
const l = i && $();
|
|
const a = C(J, c);
|
|
const u = r && s && s();
|
|
const f = D(b);
|
|
const _ = getFractionalSize(b);
|
|
if (u) {
|
|
u();
|
|
}
|
|
scrollElementTo(w, i);
|
|
if (l) {
|
|
l();
|
|
}
|
|
if (c) {
|
|
a();
|
|
}
|
|
return {
|
|
w: f.w + _.w,
|
|
h: f.h + _.h
|
|
};
|
|
}));
|
|
const I = createDebouncedObservesUpdate();
|
|
const setDirection = t => {
|
|
const n = getDirectionIsRTL(g);
|
|
assignDeep(t, {
|
|
Ct: f !== n
|
|
});
|
|
assignDeep(x, {
|
|
j: n
|
|
});
|
|
f = n;
|
|
};
|
|
const onTrinsicChanged = (t, n) => {
|
|
const [o, e] = t;
|
|
const c = {
|
|
$t: e
|
|
};
|
|
assignDeep(x, {
|
|
Ot: o
|
|
});
|
|
if (!n) {
|
|
s(c);
|
|
}
|
|
return c;
|
|
};
|
|
const onSizeChanged = ({_t: t, ft: n}) => {
|
|
const o = n ? s : I;
|
|
const e = {
|
|
_t: t || n,
|
|
ft: n
|
|
};
|
|
setDirection(e);
|
|
o(e, c);
|
|
};
|
|
const onContentMutation = (t, n) => {
|
|
const [, o] = z();
|
|
const s = {
|
|
xt: o
|
|
};
|
|
setDirection(s);
|
|
if (o && !n) {
|
|
I(s, t ? r : e);
|
|
}
|
|
return s;
|
|
};
|
|
const onHostMutation = (t, n, o) => {
|
|
const s = {
|
|
Ht: n
|
|
};
|
|
setDirection(s);
|
|
if (n && !o) {
|
|
I(s, e);
|
|
}
|
|
return s;
|
|
};
|
|
const [A, T] = y ? createTrinsicObserver(h, onTrinsicChanged) : [];
|
|
const M = !S && createSizeObserver(h, onSizeChanged, {
|
|
ft: true
|
|
});
|
|
const [k, R] = createDOMObserver(h, false, onHostMutation, {
|
|
ct: v,
|
|
et: v
|
|
});
|
|
const V = S && d && new d((t => {
|
|
const n = t[t.length - 1].contentRect;
|
|
onSizeChanged({
|
|
_t: true,
|
|
ft: domRectAppeared(n, u)
|
|
});
|
|
u = n;
|
|
}));
|
|
return [ () => {
|
|
if (V) {
|
|
V.observe(h);
|
|
}
|
|
const t = M && M();
|
|
const n = A && A();
|
|
const o = k();
|
|
const s = H.G((t => {
|
|
const [, n] = z();
|
|
I({
|
|
Et: t,
|
|
xt: n,
|
|
_t: m
|
|
}, i);
|
|
}));
|
|
return () => {
|
|
if (V) {
|
|
V.disconnect();
|
|
}
|
|
if (t) {
|
|
t();
|
|
}
|
|
if (n) {
|
|
n();
|
|
}
|
|
if (a) {
|
|
a();
|
|
}
|
|
o();
|
|
s();
|
|
};
|
|
}, ({zt: t, It: n, At: o}) => {
|
|
const s = {};
|
|
const [u] = t("update.ignoreMutation");
|
|
const [f, d] = t("update.attributes");
|
|
const [g, h] = t("update.elementEvents");
|
|
const [w, m] = t("update.debounce");
|
|
const O = h || d;
|
|
const C = n || o;
|
|
const ignoreMutationFromOptions = t => isFunction(u) && u(t);
|
|
if (O) {
|
|
if (l) {
|
|
l();
|
|
}
|
|
if (a) {
|
|
a();
|
|
}
|
|
const [t, n] = createDOMObserver(y || b, true, onContentMutation, {
|
|
et: concat(v, f || []),
|
|
rt: g,
|
|
it: _,
|
|
ut: (t, n) => {
|
|
const {target: o, attributeName: s} = t;
|
|
const e = !n && s && !S ? liesBetween(o, _, p) : false;
|
|
return e || !!closest(o, `.${at}`) || !!ignoreMutationFromOptions(t);
|
|
}
|
|
});
|
|
a = t();
|
|
l = n;
|
|
}
|
|
if (m) {
|
|
I.O();
|
|
if (isArray(w) || isNumber(w)) {
|
|
e = w;
|
|
c = false;
|
|
r = At;
|
|
i = Tt;
|
|
} else if (isPlainObject(w)) {
|
|
e = w.mutation;
|
|
c = w.resize;
|
|
r = w.event;
|
|
i = w.env;
|
|
} else {
|
|
e = false;
|
|
c = false;
|
|
r = false;
|
|
i = false;
|
|
}
|
|
}
|
|
if (C) {
|
|
const t = R();
|
|
const n = T && T();
|
|
const o = l && l();
|
|
if (t) {
|
|
assignDeep(s, onHostMutation(t[0], t[1], C));
|
|
}
|
|
if (n) {
|
|
assignDeep(s, onTrinsicChanged(n[0], C));
|
|
}
|
|
if (o) {
|
|
assignDeep(s, onContentMutation(o[0], C));
|
|
}
|
|
}
|
|
setDirection(s);
|
|
return s;
|
|
}, x ];
|
|
};
|
|
|
|
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) => {
|
|
const {nativeScrollbarsOverlaid: o, body: s} = n || {};
|
|
const {k: e, U: c, K: r} = getEnvironment();
|
|
const {nativeScrollbarsOverlaid: i, body: l} = r().cancel;
|
|
const a = o != null ? o : i;
|
|
const u = isUndefined(s) ? l : s;
|
|
const f = (e.x || e.y) && a;
|
|
const _ = t && (isNull(u) ? !c : u);
|
|
return !!f || !!_;
|
|
};
|
|
|
|
const createScrollbarsSetupElements = (t, n, o, s) => {
|
|
const e = "--os-viewport-percent";
|
|
const c = "--os-scroll-percent";
|
|
const r = "--os-scroll-direction";
|
|
const {K: i} = getEnvironment();
|
|
const {scrollbars: l} = i();
|
|
const {slot: a} = l;
|
|
const {dt: u, vt: f, L: _, Tt: d, gt: v, bt: g, V: h} = n;
|
|
const {scrollbars: b} = d ? {} : t;
|
|
const {slot: w} = b || {};
|
|
const y = [];
|
|
const S = [];
|
|
const m = [];
|
|
const O = dynamicInitializationElement([ u, f, _ ], (() => h && g ? u : f), a, w);
|
|
const initScrollTimeline = t => {
|
|
if (p) {
|
|
let n = null;
|
|
let s = [];
|
|
const e = new p({
|
|
source: v,
|
|
axis: t
|
|
});
|
|
const cancelAnimation = () => {
|
|
if (n) {
|
|
n.cancel();
|
|
}
|
|
n = null;
|
|
};
|
|
const _setScrollPercentAnimation = c => {
|
|
const {Dt: r} = o;
|
|
const i = isDefaultDirectionScrollCoordinates(r)[t];
|
|
const l = t === "x";
|
|
const a = [ getTrasformTranslateValue(0, l), getTrasformTranslateValue(`calc(-100% + 100cq${l ? "w" : "h"})`, l) ];
|
|
const u = i ? a : a.reverse();
|
|
if (s[0] === u[0] && s[1] === u[1]) {
|
|
return cancelAnimation;
|
|
}
|
|
s = u;
|
|
cancelAnimation();
|
|
n = c.Mt.animate({
|
|
clear: [ "left" ],
|
|
transform: u
|
|
}, {
|
|
timeline: e
|
|
});
|
|
return cancelAnimation;
|
|
};
|
|
return {
|
|
kt: _setScrollPercentAnimation
|
|
};
|
|
}
|
|
};
|
|
const C = {
|
|
x: initScrollTimeline("x"),
|
|
y: initScrollTimeline("y")
|
|
};
|
|
const getViewportPercent = () => {
|
|
const {Rt: t, Vt: n} = o;
|
|
const getAxisValue = (t, n) => capNumber(0, 1, t / (t + n) || 0);
|
|
return {
|
|
x: getAxisValue(n.x, t.x),
|
|
y: getAxisValue(n.y, t.y)
|
|
};
|
|
};
|
|
const scrollbarStructureAddRemoveClass = (t, n, o) => {
|
|
const s = o ? addClass : removeClass;
|
|
each(t, (t => {
|
|
s(t.Lt, n);
|
|
}));
|
|
};
|
|
const scrollbarStyle = (t, n) => {
|
|
each(t, (t => {
|
|
const [o, s] = n(t);
|
|
setStyles(o, s);
|
|
}));
|
|
};
|
|
const scrollbarsAddRemoveClass = (t, n, o) => {
|
|
const s = isBoolean(o);
|
|
const e = s ? o : true;
|
|
const c = s ? !o : true;
|
|
if (e) {
|
|
scrollbarStructureAddRemoveClass(S, t, n);
|
|
}
|
|
if (c) {
|
|
scrollbarStructureAddRemoveClass(m, t, n);
|
|
}
|
|
};
|
|
const refreshScrollbarsHandleLength = () => {
|
|
const t = getViewportPercent();
|
|
const createScrollbarStyleFn = t => n => [ n.Lt, {
|
|
[e]: roundCssNumber(t) + ""
|
|
} ];
|
|
scrollbarStyle(S, createScrollbarStyleFn(t.x));
|
|
scrollbarStyle(m, createScrollbarStyleFn(t.y));
|
|
};
|
|
const refreshScrollbarsHandleOffset = () => {
|
|
if (!p) {
|
|
const {Dt: t} = o;
|
|
const n = getScrollCoordinatesPercent(t, getElementScroll(v));
|
|
const createScrollbarStyleFn = t => n => [ n.Lt, {
|
|
[c]: roundCssNumber(t) + ""
|
|
} ];
|
|
scrollbarStyle(S, createScrollbarStyleFn(n.x));
|
|
scrollbarStyle(m, createScrollbarStyleFn(n.y));
|
|
}
|
|
};
|
|
const refreshScrollbarsScrollCoordinates = () => {
|
|
const {Dt: t} = o;
|
|
const n = isDefaultDirectionScrollCoordinates(t);
|
|
const createScrollbarStyleFn = t => n => [ n.Lt, {
|
|
[r]: t ? "0" : "1"
|
|
} ];
|
|
scrollbarStyle(S, createScrollbarStyleFn(n.x));
|
|
scrollbarStyle(m, createScrollbarStyleFn(n.y));
|
|
if (p) {
|
|
S.forEach(C.x.kt);
|
|
m.forEach(C.y.kt);
|
|
}
|
|
};
|
|
const refreshScrollbarsScrollbarOffset = () => {
|
|
if (h && !g) {
|
|
const {Rt: t, Dt: n} = o;
|
|
const s = isDefaultDirectionScrollCoordinates(n);
|
|
const e = getScrollCoordinatesPercent(n, getElementScroll(v));
|
|
const styleScrollbarPosition = n => {
|
|
const {Lt: o} = n;
|
|
const c = parent(o) === _ && o;
|
|
const getTranslateValue = (t, n, o) => {
|
|
const s = n * t;
|
|
return numberToCssPx(o ? s : -s);
|
|
};
|
|
return [ c, c && {
|
|
transform: getTrasformTranslateValue({
|
|
x: getTranslateValue(e.x, t.x, s.x),
|
|
y: getTranslateValue(e.y, t.y, s.y)
|
|
})
|
|
} ];
|
|
};
|
|
scrollbarStyle(S, styleScrollbarPosition);
|
|
scrollbarStyle(m, styleScrollbarPosition);
|
|
}
|
|
};
|
|
const generateScrollbarDOM = t => {
|
|
const n = t ? "x" : "y";
|
|
const o = t ? ft : _t;
|
|
const e = createDiv(`${at} ${o}`);
|
|
const c = createDiv(dt);
|
|
const r = createDiv(pt);
|
|
const i = {
|
|
Lt: e,
|
|
Ut: c,
|
|
Mt: r
|
|
};
|
|
const l = C[n];
|
|
push(t ? S : m, i);
|
|
push(y, [ appendChildren(e, c), appendChildren(c, r), bind(removeElements, e), l && l.kt(i), s(i, scrollbarsAddRemoveClass, t) ]);
|
|
return i;
|
|
};
|
|
const $ = bind(generateScrollbarDOM, true);
|
|
const x = bind(generateScrollbarDOM, false);
|
|
const appendElements = () => {
|
|
appendChildren(O, S[0].Lt);
|
|
appendChildren(O, m[0].Lt);
|
|
return bind(runEachAndClear, y);
|
|
};
|
|
$();
|
|
x();
|
|
return [ {
|
|
Pt: refreshScrollbarsHandleLength,
|
|
Nt: refreshScrollbarsHandleOffset,
|
|
qt: refreshScrollbarsScrollCoordinates,
|
|
jt: refreshScrollbarsScrollbarOffset,
|
|
Bt: scrollbarsAddRemoveClass,
|
|
Ft: {
|
|
Xt: S,
|
|
Yt: $,
|
|
Wt: bind(scrollbarStyle, S)
|
|
},
|
|
Jt: {
|
|
Xt: m,
|
|
Yt: x,
|
|
Wt: bind(scrollbarStyle, m)
|
|
}
|
|
}, appendElements ];
|
|
};
|
|
|
|
const createScrollbarsSetupEvents = (t, n, o, s) => (r, i, l) => {
|
|
const {vt: u, L: f, V: _, gt: d, Gt: p, St: v} = n;
|
|
const {Lt: g, Ut: h, Mt: b} = r;
|
|
const [w, y] = selfClearTimeout(333);
|
|
const [S, m] = selfClearTimeout(444);
|
|
const scrollOffsetElementScrollBy = t => {
|
|
if (isFunction(d.scrollBy)) {
|
|
d.scrollBy({
|
|
behavior: "smooth",
|
|
left: t.x,
|
|
top: t.y
|
|
});
|
|
}
|
|
};
|
|
const createInteractiveScrollEvents = () => {
|
|
const n = "pointerup pointercancel lostpointercapture";
|
|
const s = `client${l ? "X" : "Y"}`;
|
|
const r = l ? C : $;
|
|
const i = l ? "left" : "top";
|
|
const a = l ? "w" : "h";
|
|
const u = l ? "x" : "y";
|
|
const createRelativeHandleMove = (t, n) => s => {
|
|
const {Rt: e} = o;
|
|
const c = A(h)[a] - A(b)[a];
|
|
const r = n * s / c;
|
|
const i = r * e[u];
|
|
scrollElementTo(d, {
|
|
[u]: t + i
|
|
});
|
|
};
|
|
const f = [];
|
|
return addEventListener(h, "pointerdown", (o => {
|
|
const l = closest(o.target, `.${pt}`) === b;
|
|
const _ = l ? b : h;
|
|
const g = t.scrollbars;
|
|
const w = g[l ? "dragScroll" : "clickScroll"];
|
|
const {button: y, isPrimary: O, pointerType: C} = o;
|
|
const {pointers: $} = g;
|
|
const x = y === 0 && O && w && ($ || []).includes(C);
|
|
if (x) {
|
|
runEachAndClear(f);
|
|
m();
|
|
const t = !l && (o.shiftKey || w === "instant");
|
|
const g = bind(getBoundingClientRect, b);
|
|
const y = bind(getBoundingClientRect, h);
|
|
const getHandleOffset = (t, n) => (t || g())[i] - (n || y())[i];
|
|
const O = e(getBoundingClientRect(d)[r]) / A(d)[a] || 1;
|
|
const C = createRelativeHandleMove(getElementScroll(d)[u], 1 / O);
|
|
const $ = o[s];
|
|
const x = g();
|
|
const H = y();
|
|
const E = x[r];
|
|
const z = getHandleOffset(x, H) + E / 2;
|
|
const I = $ - H[i];
|
|
const T = l ? 0 : I - z;
|
|
const releasePointerCapture = t => {
|
|
runEachAndClear(k);
|
|
_.releasePointerCapture(t.pointerId);
|
|
};
|
|
const D = l || t;
|
|
const M = v();
|
|
const k = [ addEventListener(p, n, releasePointerCapture), addEventListener(p, "selectstart", (t => preventDefault(t)), {
|
|
I: false
|
|
}), addEventListener(h, n, releasePointerCapture), D && addEventListener(h, "pointermove", (t => C(T + (t[s] - $)))), D && (() => {
|
|
const t = getElementScroll(d);
|
|
M();
|
|
const n = getElementScroll(d);
|
|
const o = {
|
|
x: n.x - t.x,
|
|
y: n.y - t.y
|
|
};
|
|
if (c(o.x) > 3 || c(o.y) > 3) {
|
|
v();
|
|
scrollElementTo(d, t);
|
|
scrollOffsetElementScrollBy(o);
|
|
S(M);
|
|
}
|
|
}) ];
|
|
_.setPointerCapture(o.pointerId);
|
|
if (t) {
|
|
C(T);
|
|
} else if (!l) {
|
|
const t = getStaticPluginModuleInstance(Et);
|
|
if (t) {
|
|
const n = t(C, T, E, (t => {
|
|
if (t) {
|
|
M();
|
|
} else {
|
|
push(k, M);
|
|
}
|
|
}));
|
|
push(k, n);
|
|
push(f, bind(n, true));
|
|
}
|
|
}
|
|
}
|
|
}));
|
|
};
|
|
let O = true;
|
|
return bind(runEachAndClear, [ addEventListener(b, "pointermove pointerleave", s), addEventListener(g, "pointerenter", (() => {
|
|
i(ht, true);
|
|
})), addEventListener(g, "pointerleave pointercancel", (() => {
|
|
i(ht, false);
|
|
})), !_ && addEventListener(g, "mousedown", (() => {
|
|
const t = getFocusedElement();
|
|
if (hasAttr(t, F) || hasAttr(t, j) || t === document.body) {
|
|
a(bind(focusElement, f), 25);
|
|
}
|
|
})), addEventListener(g, "wheel", (t => {
|
|
const {deltaX: n, deltaY: o, deltaMode: s} = t;
|
|
if (O && s === 0 && parent(g) === u) {
|
|
scrollOffsetElementScrollBy({
|
|
x: n,
|
|
y: o
|
|
});
|
|
}
|
|
O = false;
|
|
i(St, true);
|
|
w((() => {
|
|
O = true;
|
|
i(St);
|
|
}));
|
|
preventDefault(t);
|
|
}), {
|
|
I: false,
|
|
A: true
|
|
}), addEventListener(g, "pointerdown", (() => {
|
|
const t = addEventListener(p, "click", (t => {
|
|
n();
|
|
stopAndPrevent(t);
|
|
}), {
|
|
T: true,
|
|
A: true,
|
|
I: false
|
|
});
|
|
const n = addEventListener(p, "pointerup pointercancel", (() => {
|
|
n();
|
|
setTimeout(t, 150);
|
|
}), {
|
|
A: true,
|
|
I: true
|
|
});
|
|
}), {
|
|
A: true,
|
|
I: true
|
|
}), createInteractiveScrollEvents(), y, m ]);
|
|
};
|
|
|
|
const createScrollbarsSetup = (t, n, o, s, e, c) => {
|
|
let r;
|
|
let i;
|
|
let l;
|
|
let a;
|
|
let u;
|
|
let f = noop;
|
|
let _ = 0;
|
|
const d = [ "mouse", "pen" ];
|
|
const isHoverablePointerType = t => d.includes(t.pointerType);
|
|
const [p, v] = selfClearTimeout();
|
|
const [g, h] = selfClearTimeout(100);
|
|
const [b, w] = selfClearTimeout(100);
|
|
const [y, S] = selfClearTimeout((() => _));
|
|
const [m, O] = createScrollbarsSetupElements(t, e, s, createScrollbarsSetupEvents(n, e, s, (t => isHoverablePointerType(t) && manageScrollbarsAutoHideInstantInteraction())));
|
|
const {vt: C, Kt: $, bt: H} = e;
|
|
const {Bt: z, Pt: I, Nt: A, qt: T, jt: D} = m;
|
|
const manageScrollbarsAutoHide = (t, n) => {
|
|
S();
|
|
if (t) {
|
|
z(yt);
|
|
} else {
|
|
const t = bind(z, yt, true);
|
|
if (_ > 0 && !n) {
|
|
y(t);
|
|
} else {
|
|
t();
|
|
}
|
|
}
|
|
};
|
|
const manageScrollbarsAutoHideInstantInteraction = () => {
|
|
if (l ? !r : !a) {
|
|
manageScrollbarsAutoHide(true);
|
|
g((() => {
|
|
manageScrollbarsAutoHide(false);
|
|
}));
|
|
}
|
|
};
|
|
const manageAutoHideSuspension = t => {
|
|
z(wt, t, true);
|
|
z(wt, t, false);
|
|
};
|
|
const onHostMouseEnter = t => {
|
|
if (isHoverablePointerType(t)) {
|
|
r = l;
|
|
if (l) {
|
|
manageScrollbarsAutoHide(true);
|
|
}
|
|
}
|
|
};
|
|
const M = [ S, h, w, v, () => f(), addEventListener(C, "pointerover", onHostMouseEnter, {
|
|
T: true
|
|
}), addEventListener(C, "pointerenter", onHostMouseEnter), addEventListener(C, "pointerleave", (t => {
|
|
if (isHoverablePointerType(t)) {
|
|
r = false;
|
|
if (l) {
|
|
manageScrollbarsAutoHide(false);
|
|
}
|
|
}
|
|
})), addEventListener(C, "pointermove", (t => {
|
|
if (isHoverablePointerType(t) && i) {
|
|
manageScrollbarsAutoHideInstantInteraction();
|
|
}
|
|
})), addEventListener($, "scroll", (t => {
|
|
p((() => {
|
|
A();
|
|
manageScrollbarsAutoHideInstantInteraction();
|
|
}));
|
|
c(t);
|
|
D();
|
|
})) ];
|
|
const k = getStaticPluginModuleInstance(xt);
|
|
return [ () => bind(runEachAndClear, push(M, O())), ({zt: t, At: n, Qt: e, Zt: c}) => {
|
|
const {tn: r, nn: d, sn: p, en: v} = c || {};
|
|
const {Ct: g, ft: h} = e || {};
|
|
const {j: w} = o;
|
|
const {k: y, U: S} = getEnvironment();
|
|
const {cn: m, F: O} = s;
|
|
const [C, M] = t("showNativeOverlaidScrollbars");
|
|
const [R, V] = t("scrollbars.theme");
|
|
const [L, U] = t("scrollbars.visibility");
|
|
const [P, N] = t("scrollbars.autoHide");
|
|
const [q, j] = t("scrollbars.autoHideSuspend");
|
|
const [B] = t("scrollbars.autoHideDelay");
|
|
const [F, X] = t("scrollbars.dragScroll");
|
|
const [Y, W] = t("scrollbars.clickScroll");
|
|
const [J, G] = t("overflow");
|
|
const K = h && !n;
|
|
const Q = O.x || O.y;
|
|
const Z = r || d || v || g || n;
|
|
const tt = p || U || G;
|
|
const nt = C && y.x && y.y;
|
|
const ot = !S && !k;
|
|
const st = nt || ot;
|
|
const setScrollbarVisibility = (t, n, o) => {
|
|
const s = t.includes(E) && (L === x || L === "auto" && n === E);
|
|
z(vt, s, o);
|
|
return s;
|
|
};
|
|
_ = B;
|
|
if (K) {
|
|
if (q && Q) {
|
|
manageAutoHideSuspension(false);
|
|
f();
|
|
b((() => {
|
|
f = addEventListener($, "scroll", bind(manageAutoHideSuspension, true), {
|
|
T: true
|
|
});
|
|
}));
|
|
} else {
|
|
manageAutoHideSuspension(true);
|
|
}
|
|
}
|
|
if (M || ot) {
|
|
z(lt, st);
|
|
}
|
|
if (V) {
|
|
z(u);
|
|
z(R, true);
|
|
u = R;
|
|
}
|
|
if (j && !q) {
|
|
manageAutoHideSuspension(true);
|
|
}
|
|
if (N) {
|
|
i = P === "move";
|
|
l = P === "leave";
|
|
a = P === "never";
|
|
manageScrollbarsAutoHide(a, true);
|
|
}
|
|
if (X) {
|
|
z(Ot, F);
|
|
}
|
|
if (W) {
|
|
z(mt, !!Y);
|
|
}
|
|
if (tt) {
|
|
const t = setScrollbarVisibility(J.x, m.x, true);
|
|
const n = setScrollbarVisibility(J.y, m.y, false);
|
|
const o = t && n;
|
|
z(gt, !o);
|
|
}
|
|
if (Z) {
|
|
A();
|
|
I();
|
|
D();
|
|
if (v) {
|
|
T();
|
|
}
|
|
z(bt, !O.x, true);
|
|
z(bt, !O.y, false);
|
|
z(ut, w && !H);
|
|
}
|
|
}, {}, m ];
|
|
};
|
|
|
|
const createStructureSetupElements = t => {
|
|
const o = getEnvironment();
|
|
const {K: s, U: e} = o;
|
|
const {elements: c} = s();
|
|
const {padding: r, viewport: i, content: l} = c;
|
|
const a = isHTMLElement(t);
|
|
const u = a ? {} : t;
|
|
const {elements: f} = u;
|
|
const {padding: _, viewport: d, content: p} = f || {};
|
|
const v = a ? t : u.target;
|
|
const g = isBodyElement(v);
|
|
const h = v.ownerDocument;
|
|
const b = h.documentElement;
|
|
const getDocumentWindow = () => h.defaultView || n;
|
|
const w = bind(staticInitializationElement, [ v ]);
|
|
const y = bind(dynamicInitializationElement, [ v ]);
|
|
const S = bind(createDiv, "");
|
|
const C = bind(w, S, i);
|
|
const $ = bind(y, S, l);
|
|
const elementHasOverflow = t => {
|
|
const n = A(t);
|
|
const o = D(t);
|
|
const s = getStyles(t, m);
|
|
const e = getStyles(t, O);
|
|
return o.w - n.w > 0 && !overflowIsVisible(s) || o.h - n.h > 0 && !overflowIsVisible(e);
|
|
};
|
|
const x = C(d);
|
|
const H = x === v;
|
|
const E = H && g;
|
|
const z = !H && $(p);
|
|
const I = !H && x === z;
|
|
const T = E ? b : x;
|
|
const M = E ? T : v;
|
|
const k = !H && y(S, r, _);
|
|
const R = !I && z;
|
|
const V = [ R, T, k, M ].map((t => isHTMLElement(t) && !parent(t) && t));
|
|
const elementIsGenerated = t => t && inArray(V, t);
|
|
const L = !elementIsGenerated(T) && elementHasOverflow(T) ? T : v;
|
|
const U = E ? b : T;
|
|
const N = E ? h : T;
|
|
const X = {
|
|
dt: v,
|
|
vt: M,
|
|
L: T,
|
|
rn: k,
|
|
ht: R,
|
|
gt: U,
|
|
Kt: N,
|
|
ln: g ? b : L,
|
|
Gt: h,
|
|
bt: g,
|
|
Tt: a,
|
|
V: H,
|
|
an: getDocumentWindow,
|
|
wt: t => hasAttrClass(T, F, t),
|
|
yt: (t, n) => addRemoveAttrClass(T, F, t, n),
|
|
St: () => addRemoveAttrClass(U, F, G, true)
|
|
};
|
|
const {dt: Y, vt: W, rn: J, L: Q, ht: nt} = X;
|
|
const ot = [ () => {
|
|
removeAttrs(W, [ j, P ]);
|
|
removeAttrs(Y, P);
|
|
if (g) {
|
|
removeAttrs(b, [ P, j ]);
|
|
}
|
|
} ];
|
|
let st = contents([ nt, Q, J, W, Y ].find((t => t && !elementIsGenerated(t))));
|
|
const et = E ? Y : nt || Q;
|
|
const ct = bind(runEachAndClear, ot);
|
|
const appendElements = () => {
|
|
const t = getDocumentWindow();
|
|
const n = getFocusedElement();
|
|
const unwrap = t => {
|
|
appendChildren(parent(t), contents(t));
|
|
removeElements(t);
|
|
};
|
|
const prepareWrapUnwrapFocus = t => addEventListener(t, "focusin focusout focus blur", stopAndPrevent, {
|
|
A: true,
|
|
I: false
|
|
});
|
|
const o = "tabindex";
|
|
const s = getAttr(Q, o);
|
|
const c = prepareWrapUnwrapFocus(n);
|
|
setAttrs(W, j, H ? "" : B);
|
|
setAttrs(J, Z, "");
|
|
setAttrs(Q, F, "");
|
|
setAttrs(nt, tt, "");
|
|
if (!H) {
|
|
setAttrs(Q, o, s || "-1");
|
|
if (g) {
|
|
setAttrs(b, q, "");
|
|
}
|
|
}
|
|
appendChildren(et, st);
|
|
appendChildren(W, J);
|
|
appendChildren(J || W, !H && Q);
|
|
appendChildren(Q, nt);
|
|
push(ot, [ c, () => {
|
|
const t = getFocusedElement();
|
|
const n = elementIsGenerated(Q);
|
|
const e = n && t === Q ? Y : t;
|
|
const c = prepareWrapUnwrapFocus(e);
|
|
removeAttrs(J, Z);
|
|
removeAttrs(nt, tt);
|
|
removeAttrs(Q, F);
|
|
if (g) {
|
|
removeAttrs(b, q);
|
|
}
|
|
if (s) {
|
|
setAttrs(Q, o, s);
|
|
} else {
|
|
removeAttrs(Q, o);
|
|
}
|
|
if (elementIsGenerated(nt)) {
|
|
unwrap(nt);
|
|
}
|
|
if (n) {
|
|
unwrap(Q);
|
|
}
|
|
if (elementIsGenerated(J)) {
|
|
unwrap(J);
|
|
}
|
|
focusElement(e);
|
|
c();
|
|
} ]);
|
|
if (e && !H) {
|
|
addAttrClass(Q, F, K);
|
|
push(ot, bind(removeAttrs, Q, F));
|
|
}
|
|
focusElement(!H && g && n === Y && t.top === t ? Q : n);
|
|
c();
|
|
st = 0;
|
|
return ct;
|
|
};
|
|
return [ X, appendElements, ct ];
|
|
};
|
|
|
|
const createTrinsicUpdateSegment = ({ht: t}) => ({Qt: n, un: o, At: s}) => {
|
|
const {$t: e} = n || {};
|
|
const {Ot: c} = o;
|
|
const r = t && (e || s);
|
|
if (r) {
|
|
setStyles(t, {
|
|
[$]: c && "100%"
|
|
});
|
|
}
|
|
};
|
|
|
|
const createPaddingUpdateSegment = ({vt: t, rn: n, L: o, V: s}, e) => {
|
|
const [c, r] = createCache({
|
|
i: equalTRBL,
|
|
o: topRightBottomLeft()
|
|
}, bind(topRightBottomLeft, t, "padding", ""));
|
|
return ({zt: t, Qt: i, un: l, At: a}) => {
|
|
let [u, f] = r(a);
|
|
const {U: _} = getEnvironment();
|
|
const {_t: d, xt: p, Ct: m} = i || {};
|
|
const {j: O} = l;
|
|
const [$, x] = t("paddingAbsolute");
|
|
const H = a || p;
|
|
if (d || f || H) {
|
|
[u, f] = c(a);
|
|
}
|
|
const E = !s && (x || m || f);
|
|
if (E) {
|
|
const t = !$ || !n && !_;
|
|
const s = u.r + u.l;
|
|
const c = u.t + u.b;
|
|
const r = {
|
|
[y]: t && !O ? -s : 0,
|
|
[S]: t ? -c : 0,
|
|
[w]: t && O ? -s : 0,
|
|
top: t ? -u.t : 0,
|
|
right: t ? O ? -u.r : "auto" : 0,
|
|
left: t ? O ? "auto" : -u.l : 0,
|
|
[C]: t && `calc(100% + ${s}px)`
|
|
};
|
|
const i = {
|
|
[v]: t ? u.t : 0,
|
|
[g]: t ? u.r : 0,
|
|
[b]: t ? u.b : 0,
|
|
[h]: t ? u.l : 0
|
|
};
|
|
setStyles(n || o, r);
|
|
setStyles(o, i);
|
|
assignDeep(e, {
|
|
rn: u,
|
|
fn: !t,
|
|
B: n ? i : assignDeep({}, r, i)
|
|
});
|
|
}
|
|
return {
|
|
_n: E
|
|
};
|
|
};
|
|
};
|
|
|
|
const createOverflowUpdateSegment = (t, s) => {
|
|
const e = getEnvironment();
|
|
const {vt: r, rn: i, L: a, V: u, Kt: f, gt: _, bt: d, yt: p, an: v} = t;
|
|
const {U: g} = e;
|
|
const h = d && u;
|
|
const b = bind(o, 0);
|
|
const w = {
|
|
display: () => false,
|
|
direction: t => t !== "ltr",
|
|
flexDirection: t => t.endsWith("-reverse"),
|
|
writingMode: t => t !== "horizontal-tb"
|
|
};
|
|
const y = keys(w);
|
|
const S = {
|
|
i: equalWH,
|
|
o: {
|
|
w: 0,
|
|
h: 0
|
|
}
|
|
};
|
|
const m = {
|
|
i: equalXY,
|
|
o: {}
|
|
};
|
|
const setMeasuringMode = t => {
|
|
p(J, !h && t);
|
|
};
|
|
const getFlowDirectionStyles = () => getStyles(a, y);
|
|
const getMeasuredScrollCoordinates = (t, n) => {
|
|
const o = !keys(t).length;
|
|
const s = !n && y.some((n => {
|
|
const o = t[n];
|
|
return isString(o) && w[n](o);
|
|
}));
|
|
const e = o && !s;
|
|
if (e || !hasDimensions(a)) {
|
|
return {
|
|
D: {
|
|
x: 0,
|
|
y: 0
|
|
},
|
|
M: {
|
|
x: 1,
|
|
y: 1
|
|
}
|
|
};
|
|
}
|
|
setMeasuringMode(true);
|
|
const r = getElementScroll(_);
|
|
const i = addEventListener(f, E, (t => {
|
|
const n = getElementScroll(_);
|
|
if (t.isTrusted && n.x === r.x && n.y === r.y) {
|
|
stopPropagation(t);
|
|
}
|
|
}), {
|
|
A: true,
|
|
T: true
|
|
});
|
|
const u = p(Q, true);
|
|
scrollElementTo(_, {
|
|
x: 0,
|
|
y: 0
|
|
});
|
|
u();
|
|
const d = getElementScroll(_);
|
|
const v = D(_);
|
|
scrollElementTo(_, {
|
|
x: v.w,
|
|
y: v.h
|
|
});
|
|
const g = getElementScroll(_);
|
|
const h = {
|
|
x: g.x - d.x,
|
|
y: g.y - d.y
|
|
};
|
|
scrollElementTo(_, {
|
|
x: -v.w,
|
|
y: -v.h
|
|
});
|
|
const b = getElementScroll(_);
|
|
const S = {
|
|
x: b.x - d.x,
|
|
y: b.y - d.y
|
|
};
|
|
const m = {
|
|
x: c(h.x) >= c(S.x) ? g.x : b.x,
|
|
y: c(h.y) >= c(S.y) ? g.y : b.y
|
|
};
|
|
scrollElementTo(_, r);
|
|
l((() => i()));
|
|
return {
|
|
D: d,
|
|
M: m
|
|
};
|
|
};
|
|
const getOverflowAmount = (t, o) => {
|
|
const s = n.devicePixelRatio % 1 !== 0 ? 1 : 0;
|
|
const e = {
|
|
w: b(t.w - o.w),
|
|
h: b(t.h - o.h)
|
|
};
|
|
return {
|
|
w: e.w > s ? e.w : 0,
|
|
h: e.h > s ? e.h : 0
|
|
};
|
|
};
|
|
const getViewportOverflowStyle = (t, n) => {
|
|
const getAxisOverflowStyle = (t, n, o, s) => {
|
|
const e = t === x ? H : overflowBehaviorToOverflowStyle(t);
|
|
const c = overflowIsVisible(t);
|
|
const r = overflowIsVisible(o);
|
|
if (!n && !s) {
|
|
return H;
|
|
}
|
|
if (c && r) {
|
|
return x;
|
|
}
|
|
if (c) {
|
|
const t = n ? x : H;
|
|
return n && s ? e : t;
|
|
}
|
|
const i = r && s ? x : H;
|
|
return n ? e : i;
|
|
};
|
|
return {
|
|
x: getAxisOverflowStyle(n.x, t.x, n.y, t.y),
|
|
y: getAxisOverflowStyle(n.y, t.y, n.x, t.x)
|
|
};
|
|
};
|
|
const setViewportOverflowStyle = t => {
|
|
const createAllOverflowStyleClassNames = t => [ x, H, E ].map((n => createViewportOverflowStyleClassName(overflowCssValueToOverflowStyle(n), t)));
|
|
const n = createAllOverflowStyleClassNames(true).concat(createAllOverflowStyleClassNames()).join(" ");
|
|
p(n);
|
|
p(keys(t).map((n => createViewportOverflowStyleClassName(t[n], n === "x"))).join(" "), true);
|
|
};
|
|
const [O, C] = createCache(S, bind(getFractionalSize, a));
|
|
const [$, z] = createCache(S, bind(D, a));
|
|
const [I, A] = createCache(S);
|
|
const [M] = createCache(m);
|
|
const [k, R] = createCache(S);
|
|
const [V] = createCache(m);
|
|
const [L] = createCache({
|
|
i: (t, n) => equal(t, n, deduplicateArray(concat(keys(t), keys(n)))),
|
|
o: {}
|
|
});
|
|
const [U, P] = createCache({
|
|
i: (t, n) => equalXY(t.D, n.D) && equalXY(t.M, n.M),
|
|
o: getZeroScrollCoordinates()
|
|
});
|
|
const q = getStaticPluginModuleInstance(xt);
|
|
const createViewportOverflowStyleClassName = (t, n) => {
|
|
const o = n ? X : Y;
|
|
return `${o}${capitalizeFirstLetter(t)}`;
|
|
};
|
|
return ({zt: n, Qt: o, un: c, At: l}, {_n: u}) => {
|
|
const {_t: f, Ht: _, xt: d, Ct: w, ft: y, Et: S} = o || {};
|
|
const m = q && q.R(t, s, c, e, n);
|
|
const {X: x, Y: H, W: E} = m || {};
|
|
const [D, B] = getShowNativeOverlaidScrollbars(n, e);
|
|
const [F, X] = n("overflow");
|
|
const Y = overflowIsVisible(F.x);
|
|
const W = overflowIsVisible(F.y);
|
|
const J = f || u || d || w || S || B;
|
|
let G = C(l);
|
|
let Q = z(l);
|
|
let tt = A(l);
|
|
let nt = R(l);
|
|
if (B && g) {
|
|
p(K, !D);
|
|
}
|
|
if (J) {
|
|
if (hasAttrClass(r, j, N)) {
|
|
setMeasuringMode(true);
|
|
}
|
|
const t = H && H();
|
|
const [n] = G = O(l);
|
|
const [o] = Q = $(l);
|
|
const s = T(a);
|
|
const e = h && getWindowSize(v());
|
|
const c = {
|
|
w: b(o.w + n.w),
|
|
h: b(o.h + n.h)
|
|
};
|
|
const i = {
|
|
w: b((e ? e.w : s.w + b(s.w - o.w)) + n.w),
|
|
h: b((e ? e.h : s.h + b(s.h - o.h)) + n.h)
|
|
};
|
|
if (t) {
|
|
t();
|
|
}
|
|
nt = k(i);
|
|
tt = I(getOverflowAmount(c, i), l);
|
|
}
|
|
const [ot, st] = nt;
|
|
const [et, ct] = tt;
|
|
const [rt, it] = Q;
|
|
const [lt, at] = G;
|
|
const [ut, ft] = M({
|
|
x: et.w > 0,
|
|
y: et.h > 0
|
|
});
|
|
const _t = Y && W && (ut.x || ut.y) || Y && ut.x && !ut.y || W && ut.y && !ut.x;
|
|
const dt = u || w || S || at || it || st || ct || X || B || J || _ && h;
|
|
const [pt] = n("update.flowDirectionStyles");
|
|
const [vt, gt] = L(pt ? pt(a) : getFlowDirectionStyles(), l);
|
|
const ht = w || y || gt || ft || l;
|
|
const [bt, wt] = ht ? U(getMeasuredScrollCoordinates(vt, !!pt), l) : P();
|
|
let yt = getViewportOverflowStyle(ut, F);
|
|
setMeasuringMode(false);
|
|
if (dt) {
|
|
setViewportOverflowStyle(yt);
|
|
yt = getElementOverflowStyle(a, ut);
|
|
if (E && x) {
|
|
x(yt, rt, lt);
|
|
setStyles(a, E(yt));
|
|
}
|
|
}
|
|
const [St, mt] = V(yt);
|
|
addRemoveAttrClass(r, j, N, _t);
|
|
addRemoveAttrClass(i, Z, N, _t);
|
|
assignDeep(s, {
|
|
cn: St,
|
|
Vt: {
|
|
x: ot.w,
|
|
y: ot.h
|
|
},
|
|
Rt: {
|
|
x: et.w,
|
|
y: et.h
|
|
},
|
|
F: ut,
|
|
Dt: sanitizeScrollCoordinates(bt, et)
|
|
});
|
|
return {
|
|
sn: mt,
|
|
tn: st,
|
|
nn: ct,
|
|
en: wt || ct
|
|
};
|
|
};
|
|
};
|
|
|
|
const createStructureSetup = t => {
|
|
const [n, o, s] = createStructureSetupElements(t);
|
|
const e = {
|
|
rn: {
|
|
t: 0,
|
|
r: 0,
|
|
b: 0,
|
|
l: 0
|
|
},
|
|
fn: false,
|
|
B: {
|
|
[y]: 0,
|
|
[S]: 0,
|
|
[w]: 0,
|
|
[v]: 0,
|
|
[g]: 0,
|
|
[b]: 0,
|
|
[h]: 0
|
|
},
|
|
Vt: {
|
|
x: 0,
|
|
y: 0
|
|
},
|
|
Rt: {
|
|
x: 0,
|
|
y: 0
|
|
},
|
|
cn: {
|
|
x: H,
|
|
y: H
|
|
},
|
|
F: {
|
|
x: false,
|
|
y: false
|
|
},
|
|
Dt: getZeroScrollCoordinates()
|
|
};
|
|
const {dt: c, gt: r, V: i, St: l} = n;
|
|
const {U: a, k: u} = getEnvironment();
|
|
const f = !a && (u.x || u.y);
|
|
const _ = [ createTrinsicUpdateSegment(n), createPaddingUpdateSegment(n, e), createOverflowUpdateSegment(n, e) ];
|
|
return [ o, t => {
|
|
const n = {};
|
|
const o = f;
|
|
const s = o && getElementScroll(r);
|
|
const e = s && l();
|
|
each(_, (o => {
|
|
assignDeep(n, o(t, n) || {});
|
|
}));
|
|
scrollElementTo(r, s);
|
|
if (e) {
|
|
e();
|
|
}
|
|
if (!i) {
|
|
scrollElementTo(c, 0);
|
|
}
|
|
return n;
|
|
}, e, n, s ];
|
|
};
|
|
|
|
const createSetups = (t, n, o, s, e) => {
|
|
let c = false;
|
|
const r = createOptionCheck(n, {});
|
|
const [i, l, a, u, f] = createStructureSetup(t);
|
|
const [_, d, p] = createObserversSetup(u, a, r, (t => {
|
|
update({}, t);
|
|
}));
|
|
const [v, g, , h] = createScrollbarsSetup(t, n, p, a, u, e);
|
|
const updateHintsAreTruthy = t => keys(t).some((n => !!t[n]));
|
|
const update = (t, e) => {
|
|
if (o()) {
|
|
return false;
|
|
}
|
|
const {dn: r, At: i, It: a, pn: u} = t;
|
|
const f = r || {};
|
|
const _ = !!i || !c;
|
|
const v = {
|
|
zt: createOptionCheck(n, f, _),
|
|
dn: f,
|
|
At: _
|
|
};
|
|
if (u) {
|
|
g(v);
|
|
return false;
|
|
}
|
|
const h = e || d(assignDeep({}, v, {
|
|
It: a
|
|
}));
|
|
const b = l(assignDeep({}, v, {
|
|
un: p,
|
|
Qt: h
|
|
}));
|
|
g(assignDeep({}, v, {
|
|
Qt: h,
|
|
Zt: b
|
|
}));
|
|
const w = updateHintsAreTruthy(h);
|
|
const y = updateHintsAreTruthy(b);
|
|
const S = w || y || !isEmptyObject(f) || _;
|
|
c = true;
|
|
if (S) {
|
|
s(t, {
|
|
Qt: h,
|
|
Zt: b
|
|
});
|
|
}
|
|
return S;
|
|
};
|
|
return [ () => {
|
|
const {ln: t, gt: n, St: o} = u;
|
|
const s = getElementScroll(t);
|
|
const e = [ _(), i(), v() ];
|
|
const c = o();
|
|
scrollElementTo(n, s);
|
|
c();
|
|
return bind(runEachAndClear, e);
|
|
}, update, () => ({
|
|
vn: p,
|
|
gn: a
|
|
}), {
|
|
hn: u,
|
|
bn: h
|
|
}, f ];
|
|
};
|
|
|
|
const Vt = new WeakMap;
|
|
|
|
const addInstance = (t, n) => {
|
|
Vt.set(t, n);
|
|
};
|
|
|
|
const removeInstance = t => {
|
|
Vt.delete(t);
|
|
};
|
|
|
|
const getInstance = t => Vt.get(t);
|
|
|
|
const OverlayScrollbars = (t, n, o) => {
|
|
const {tt: s} = getEnvironment();
|
|
const e = isHTMLElement(t);
|
|
const c = e ? t : t.target;
|
|
const r = getInstance(c);
|
|
if (n && !r) {
|
|
let r = false;
|
|
const i = [];
|
|
const l = {};
|
|
const validateOptions = t => {
|
|
const n = removeUndefinedProperties(t);
|
|
const o = getStaticPluginModuleInstance(R);
|
|
return o ? o(n, true) : n;
|
|
};
|
|
const a = assignDeep({}, s(), validateOptions(n));
|
|
const [u, f, _] = createEventListenerHub();
|
|
const [d, p, v] = createEventListenerHub(o);
|
|
const triggerEvent = (t, n) => {
|
|
v(t, n);
|
|
_(t, n);
|
|
};
|
|
const [g, h, b, w, y] = createSetups(t, a, (() => r), (({dn: t, At: n}, {Qt: o, Zt: s}) => {
|
|
const {_t: e, Ct: c, $t: r, xt: i, Ht: l, ft: a} = o;
|
|
const {tn: u, nn: f, sn: _, en: d} = s;
|
|
triggerEvent("updated", [ S, {
|
|
updateHints: {
|
|
sizeChanged: !!e,
|
|
directionChanged: !!c,
|
|
heightIntrinsicChanged: !!r,
|
|
overflowEdgeChanged: !!u,
|
|
overflowAmountChanged: !!f,
|
|
overflowStyleChanged: !!_,
|
|
scrollCoordinatesChanged: !!d,
|
|
contentMutation: !!i,
|
|
hostMutation: !!l,
|
|
appear: !!a
|
|
},
|
|
changedOptions: t || {},
|
|
force: !!n
|
|
} ]);
|
|
}), (t => triggerEvent("scroll", [ S, t ])));
|
|
const destroy = t => {
|
|
removeInstance(c);
|
|
runEachAndClear(i);
|
|
r = true;
|
|
triggerEvent("destroyed", [ S, t ]);
|
|
f();
|
|
p();
|
|
};
|
|
const S = {
|
|
options(t, n) {
|
|
if (t) {
|
|
const o = n ? s() : {};
|
|
const e = getOptionsDiff(a, assignDeep(o, validateOptions(t)));
|
|
if (!isEmptyObject(e)) {
|
|
assignDeep(a, e);
|
|
h({
|
|
dn: e
|
|
});
|
|
}
|
|
}
|
|
return assignDeep({}, a);
|
|
},
|
|
on: d,
|
|
off: (t, n) => {
|
|
if (t && n) {
|
|
p(t, n);
|
|
}
|
|
},
|
|
state() {
|
|
const {vn: t, gn: n} = b();
|
|
const {j: o} = t;
|
|
const {Vt: s, Rt: e, cn: c, F: i, rn: l, fn: a, Dt: u} = n;
|
|
return assignDeep({}, {
|
|
overflowEdge: s,
|
|
overflowAmount: e,
|
|
overflowStyle: c,
|
|
hasOverflow: i,
|
|
scrollCoordinates: {
|
|
start: u.D,
|
|
end: u.M
|
|
},
|
|
padding: l,
|
|
paddingAbsolute: a,
|
|
directionRTL: o,
|
|
destroyed: r
|
|
});
|
|
},
|
|
elements() {
|
|
const {dt: t, vt: n, rn: o, L: s, ht: e, gt: c, Kt: r} = w.hn;
|
|
const {Ft: i, Jt: l} = w.bn;
|
|
const translateScrollbarStructure = t => {
|
|
const {Mt: n, Ut: o, Lt: s} = t;
|
|
return {
|
|
scrollbar: s,
|
|
track: o,
|
|
handle: n
|
|
};
|
|
};
|
|
const translateScrollbarsSetupElement = t => {
|
|
const {Xt: n, Yt: o} = t;
|
|
const s = translateScrollbarStructure(n[0]);
|
|
return assignDeep({}, s, {
|
|
clone: () => {
|
|
const t = translateScrollbarStructure(o());
|
|
h({
|
|
pn: true
|
|
});
|
|
return t;
|
|
}
|
|
});
|
|
};
|
|
return assignDeep({}, {
|
|
target: t,
|
|
host: n,
|
|
padding: o || s,
|
|
viewport: s,
|
|
content: e || s,
|
|
scrollOffsetElement: c,
|
|
scrollEventElement: r,
|
|
scrollbarHorizontal: translateScrollbarsSetupElement(i),
|
|
scrollbarVertical: translateScrollbarsSetupElement(l)
|
|
});
|
|
},
|
|
update: t => h({
|
|
At: t,
|
|
It: true
|
|
}),
|
|
destroy: bind(destroy, false),
|
|
plugin: t => l[keys(t)[0]]
|
|
};
|
|
push(i, [ y ]);
|
|
addInstance(c, S);
|
|
registerPluginModuleInstances(M, OverlayScrollbars, [ S, u, l ]);
|
|
if (cancelInitialization(w.hn.bt, !e && t.cancel)) {
|
|
destroy(true);
|
|
return S;
|
|
}
|
|
push(i, g());
|
|
triggerEvent("initialized", [ S ]);
|
|
S.update();
|
|
return S;
|
|
}
|
|
return r;
|
|
};
|
|
|
|
OverlayScrollbars.plugin = t => {
|
|
const n = isArray(t);
|
|
const o = n ? t : [ t ];
|
|
const s = o.map((t => registerPluginModuleInstances(t, OverlayScrollbars)[0]));
|
|
addPlugins(o);
|
|
return n ? s : s[0];
|
|
};
|
|
|
|
OverlayScrollbars.valid = t => {
|
|
const n = t && t.elements;
|
|
const o = isFunction(n) && n();
|
|
return isPlainObject(o) && !!getInstance(o.target);
|
|
};
|
|
|
|
OverlayScrollbars.env = () => {
|
|
const {P: t, k: n, U: o, J: s, ot: e, st: c, K: r, Z: i, tt: l, nt: a} = getEnvironment();
|
|
return assignDeep({}, {
|
|
scrollbarsSize: t,
|
|
scrollbarsOverlaid: n,
|
|
scrollbarsHiding: o,
|
|
scrollTimeline: s,
|
|
staticDefaultInitialization: e,
|
|
staticDefaultOptions: c,
|
|
getDefaultInitialization: r,
|
|
setDefaultInitialization: i,
|
|
getDefaultOptions: l,
|
|
setDefaultOptions: a
|
|
});
|
|
};
|
|
|
|
OverlayScrollbars.nonce = setNonce;
|
|
|
|
OverlayScrollbars.trustedTypePolicy = setTrustedTypePolicy;
|
|
|
|
exports.ClickScrollPlugin = zt;
|
|
|
|
exports.OverlayScrollbars = OverlayScrollbars;
|
|
|
|
exports.ScrollbarsHidingPlugin = Ht;
|
|
|
|
exports.SizeObserverPlugin = $t;
|
|
//# sourceMappingURL=overlayscrollbars.cjs.js.map
|