@headless-primitives/scroll-area
Advanced tools
+1062
| //#region ../utils/dist/index.js | ||
| var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, n = Symbol(), r = /* @__PURE__ */ new WeakMap(), i = class { | ||
| constructor(e, t, r) { | ||
| if (this._$cssResult$ = !0, r !== n) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = e, this.t = t; | ||
| } | ||
| get styleSheet() { | ||
| let e = this.o, n = this.t; | ||
| if (t && e === void 0) { | ||
| let t = n !== void 0 && n.length === 1; | ||
| t && (e = r.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), t && r.set(n, e)); | ||
| } | ||
| return e; | ||
| } | ||
| toString() { | ||
| return this.cssText; | ||
| } | ||
| }, a = (e) => new i(typeof e == "string" ? e : e + "", void 0, n), o = (n, r) => { | ||
| if (t) n.adoptedStyleSheets = r.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet); | ||
| else for (let t of r) { | ||
| let r = document.createElement("style"), i = e.litNonce; | ||
| i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, n.appendChild(r); | ||
| } | ||
| }, s = t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => { | ||
| let t = ""; | ||
| for (let n of e.cssRules) t += n.cssText; | ||
| return a(t); | ||
| })(e) : e, { is: c, defineProperty: l, getOwnPropertyDescriptor: u, getOwnPropertyNames: d, getOwnPropertySymbols: ee, getPrototypeOf: te } = Object, f = globalThis, ne = f.trustedTypes, re = ne ? ne.emptyScript : "", ie = f.reactiveElementPolyfillSupport, p = (e, t) => e, m = { | ||
| toAttribute(e, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| e = e ? re : null; | ||
| break; | ||
| case Object: | ||
| case Array: e = e == null ? e : JSON.stringify(e); | ||
| } | ||
| return e; | ||
| }, | ||
| fromAttribute(e, t) { | ||
| let n = e; | ||
| switch (t) { | ||
| case Boolean: | ||
| n = e !== null; | ||
| break; | ||
| case Number: | ||
| n = e === null ? null : Number(e); | ||
| break; | ||
| case Object: | ||
| case Array: try { | ||
| n = JSON.parse(e); | ||
| } catch { | ||
| n = null; | ||
| } | ||
| } | ||
| return n; | ||
| } | ||
| }, ae = (e, t) => !c(e, t), oe = { | ||
| attribute: !0, | ||
| type: String, | ||
| converter: m, | ||
| reflect: !1, | ||
| useDefault: !1, | ||
| hasChanged: ae | ||
| }; | ||
| Symbol.metadata ??= Symbol("metadata"), f.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| var h = class extends HTMLElement { | ||
| static addInitializer(e) { | ||
| this._$Ei(), (this.l ??= []).push(e); | ||
| } | ||
| static get observedAttributes() { | ||
| return this.finalize(), this._$Eh && [...this._$Eh.keys()]; | ||
| } | ||
| static createProperty(e, t = oe) { | ||
| if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) { | ||
| let n = Symbol(), r = this.getPropertyDescriptor(e, n, t); | ||
| r !== void 0 && l(this.prototype, e, r); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(e, t, n) { | ||
| let { get: r, set: i } = u(this.prototype, e) ?? { | ||
| get() { | ||
| return this[t]; | ||
| }, | ||
| set(e) { | ||
| this[t] = e; | ||
| } | ||
| }; | ||
| return { | ||
| get: r, | ||
| set(t) { | ||
| let a = r?.call(this); | ||
| i?.call(this, t), this.requestUpdate(e, a, n); | ||
| }, | ||
| configurable: !0, | ||
| enumerable: !0 | ||
| }; | ||
| } | ||
| static getPropertyOptions(e) { | ||
| return this.elementProperties.get(e) ?? oe; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(p("elementProperties"))) return; | ||
| let e = te(this); | ||
| e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); | ||
| } | ||
| static finalize() { | ||
| if (this.hasOwnProperty(p("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(p("properties"))) { | ||
| let e = this.properties, t = [...d(e), ...ee(e)]; | ||
| for (let n of t) this.createProperty(n, e[n]); | ||
| } | ||
| let e = this[Symbol.metadata]; | ||
| if (e !== null) { | ||
| let t = litPropertyMetadata.get(e); | ||
| if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (let [e, t] of this.elementProperties) { | ||
| let n = this._$Eu(e, t); | ||
| n !== void 0 && this._$Eh.set(n, e); | ||
| } | ||
| this.elementStyles = this.finalizeStyles(this.styles); | ||
| } | ||
| static finalizeStyles(e) { | ||
| let t = []; | ||
| if (Array.isArray(e)) { | ||
| let n = new Set(e.flat(Infinity).reverse()); | ||
| for (let e of n) t.unshift(s(e)); | ||
| } else e !== void 0 && t.push(s(e)); | ||
| return t; | ||
| } | ||
| static _$Eu(e, t) { | ||
| let n = t.attribute; | ||
| return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0; | ||
| } | ||
| constructor() { | ||
| super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); | ||
| } | ||
| _$Ev() { | ||
| this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this)); | ||
| } | ||
| addController(e) { | ||
| (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.(); | ||
| } | ||
| removeController(e) { | ||
| this._$EO?.delete(e); | ||
| } | ||
| _$E_() { | ||
| let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties; | ||
| for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]); | ||
| e.size > 0 && (this._$Ep = e); | ||
| } | ||
| createRenderRoot() { | ||
| let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return o(e, this.constructor.elementStyles), e; | ||
| } | ||
| connectedCallback() { | ||
| this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.()); | ||
| } | ||
| enableUpdating(e) {} | ||
| disconnectedCallback() { | ||
| this._$EO?.forEach((e) => e.hostDisconnected?.()); | ||
| } | ||
| attributeChangedCallback(e, t, n) { | ||
| this._$AK(e, n); | ||
| } | ||
| _$ET(e, t) { | ||
| let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n); | ||
| if (r !== void 0 && !0 === n.reflect) { | ||
| let i = (n.converter?.toAttribute === void 0 ? m : n.converter).toAttribute(t, n.type); | ||
| this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(e, t) { | ||
| let n = this.constructor, r = n._$Eh.get(e); | ||
| if (r !== void 0 && this._$Em !== r) { | ||
| let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? m : e.converter; | ||
| this._$Em = r; | ||
| let a = i.fromAttribute(t, e.type); | ||
| this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null; | ||
| } | ||
| } | ||
| requestUpdate(e, t, n, r = !1, i) { | ||
| if (e !== void 0) { | ||
| let a = this.constructor; | ||
| if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? ae)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return; | ||
| this.C(e, t, n); | ||
| } | ||
| !1 === this.isUpdatePending && (this._$ES = this._$EP()); | ||
| } | ||
| C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) { | ||
| n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e)); | ||
| } | ||
| async _$EP() { | ||
| this.isUpdatePending = !0; | ||
| try { | ||
| await this._$ES; | ||
| } catch (e) { | ||
| Promise.reject(e); | ||
| } | ||
| let e = this.scheduleUpdate(); | ||
| return e != null && await e, !this.isUpdatePending; | ||
| } | ||
| scheduleUpdate() { | ||
| return this.performUpdate(); | ||
| } | ||
| performUpdate() { | ||
| if (!this.isUpdatePending) return; | ||
| if (!this.hasUpdated) { | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (let [e, t] of this._$Ep) this[e] = t; | ||
| this._$Ep = void 0; | ||
| } | ||
| let e = this.constructor.elementProperties; | ||
| if (e.size > 0) for (let [t, n] of e) { | ||
| let { wrapped: e } = n, r = this[t]; | ||
| !0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r); | ||
| } | ||
| } | ||
| let e = !1, t = this._$AL; | ||
| try { | ||
| e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM(); | ||
| } catch (t) { | ||
| throw e = !1, this._$EM(), t; | ||
| } | ||
| e && this._$AE(t); | ||
| } | ||
| willUpdate(e) {} | ||
| _$AE(e) { | ||
| this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e); | ||
| } | ||
| _$EM() { | ||
| this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; | ||
| } | ||
| get updateComplete() { | ||
| return this.getUpdateComplete(); | ||
| } | ||
| getUpdateComplete() { | ||
| return this._$ES; | ||
| } | ||
| shouldUpdate(e) { | ||
| return !0; | ||
| } | ||
| update(e) { | ||
| this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM(); | ||
| } | ||
| updated(e) {} | ||
| firstUpdated(e) {} | ||
| }; | ||
| h.elementStyles = [], h.shadowRootOptions = { mode: "open" }, h[p("elementProperties")] = /* @__PURE__ */ new Map(), h[p("finalized")] = /* @__PURE__ */ new Map(), ie?.({ ReactiveElement: h }), (f.reactiveElementVersions ??= []).push("2.1.2"); | ||
| var g = globalThis, se = (e) => e, _ = g.trustedTypes, ce = _ ? _.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, le = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, ue = "?" + v, de = `<${ue}>`, y = document, b = () => y.createComment(""), x = (e) => e === null || typeof e != "object" && typeof e != "function", S = Array.isArray, fe = (e) => S(e) || typeof e?.[Symbol.iterator] == "function", C = "[ \n\f\r]", w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, pe = /-->/g, me = />/g, T = RegExp(`>|${C}(?:([^\\s"'>=/]+)(${C}*=${C}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), he = /'/g, ge = /"/g, _e = /^(?:script|style|textarea|title)$/i, E = Symbol.for("lit-noChange"), D = Symbol.for("lit-nothing"), ve = /* @__PURE__ */ new WeakMap(), O = y.createTreeWalker(y, 129); | ||
| function ye(e, t) { | ||
| if (!S(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array"); | ||
| return ce === void 0 ? t : ce.createHTML(t); | ||
| } | ||
| var be = (e, t) => { | ||
| let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = w; | ||
| for (let t = 0; t < n; t++) { | ||
| let n = e[t], s, c, l = -1, u = 0; | ||
| for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === w ? c[1] === "!--" ? o = pe : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = T) : (_e.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = T) : o = me : o === T ? c[0] === ">" ? (o = i ?? w, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? T : c[3] === "\"" ? ge : he) : o === ge || o === he ? o = T : o === pe || o === me ? o = w : (o = T, i = void 0); | ||
| let d = o === T && e[t + 1].startsWith("/>") ? " " : ""; | ||
| a += o === w ? n + de : l >= 0 ? (r.push(s), n.slice(0, l) + le + n.slice(l) + v + d) : n + v + (l === -2 ? t : d); | ||
| } | ||
| return [ye(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r]; | ||
| }, k = class e { | ||
| constructor({ strings: t, _$litType$: n }, r) { | ||
| let i; | ||
| this.parts = []; | ||
| let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = be(t, n); | ||
| if (this.el = e.createElement(l, r), O.currentNode = this.el.content, n === 2 || n === 3) { | ||
| let e = this.el.content.firstChild; | ||
| e.replaceWith(...e.childNodes); | ||
| } | ||
| for (; (i = O.nextNode()) !== null && c.length < s;) { | ||
| if (i.nodeType === 1) { | ||
| if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(le)) { | ||
| let t = u[o++], n = i.getAttribute(e).split(v), r = /([.?@])?(.*)/.exec(t); | ||
| c.push({ | ||
| type: 1, | ||
| index: a, | ||
| name: r[2], | ||
| strings: n, | ||
| ctor: r[1] === "." ? Se : r[1] === "?" ? Ce : r[1] === "@" ? we : M | ||
| }), i.removeAttribute(e); | ||
| } else e.startsWith(v) && (c.push({ | ||
| type: 6, | ||
| index: a | ||
| }), i.removeAttribute(e)); | ||
| if (_e.test(i.tagName)) { | ||
| let e = i.textContent.split(v), t = e.length - 1; | ||
| if (t > 0) { | ||
| i.textContent = _ ? _.emptyScript : ""; | ||
| for (let n = 0; n < t; n++) i.append(e[n], b()), O.nextNode(), c.push({ | ||
| type: 2, | ||
| index: ++a | ||
| }); | ||
| i.append(e[t], b()); | ||
| } | ||
| } | ||
| } else if (i.nodeType === 8) if (i.data === ue) c.push({ | ||
| type: 2, | ||
| index: a | ||
| }); | ||
| else { | ||
| let e = -1; | ||
| for (; (e = i.data.indexOf(v, e + 1)) !== -1;) c.push({ | ||
| type: 7, | ||
| index: a | ||
| }), e += v.length - 1; | ||
| } | ||
| a++; | ||
| } | ||
| } | ||
| static createElement(e, t) { | ||
| let n = y.createElement("template"); | ||
| return n.innerHTML = e, n; | ||
| } | ||
| }; | ||
| function A(e, t, n = e, r) { | ||
| if (t === E) return t; | ||
| let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = x(t) ? void 0 : t._$litDirective$; | ||
| return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = A(e, i._$AS(e, t.values), i, r)), t; | ||
| } | ||
| var xe = class { | ||
| constructor(e, t) { | ||
| this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t; | ||
| } | ||
| get parentNode() { | ||
| return this._$AM.parentNode; | ||
| } | ||
| get _$AU() { | ||
| return this._$AM._$AU; | ||
| } | ||
| u(e) { | ||
| let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? y).importNode(t, !0); | ||
| O.currentNode = r; | ||
| let i = O.nextNode(), a = 0, o = 0, s = n[0]; | ||
| for (; s !== void 0;) { | ||
| if (a === s.index) { | ||
| let t; | ||
| s.type === 2 ? t = new j(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new Te(i, this, e)), this._$AV.push(t), s = n[++o]; | ||
| } | ||
| a !== s?.index && (i = O.nextNode(), a++); | ||
| } | ||
| return O.currentNode = y, r; | ||
| } | ||
| p(e) { | ||
| let t = 0; | ||
| for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++; | ||
| } | ||
| }, j = class e { | ||
| get _$AU() { | ||
| return this._$AM?._$AU ?? this._$Cv; | ||
| } | ||
| constructor(e, t, n, r) { | ||
| this.type = 2, this._$AH = D, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0; | ||
| } | ||
| get parentNode() { | ||
| let e = this._$AA.parentNode, t = this._$AM; | ||
| return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e; | ||
| } | ||
| get startNode() { | ||
| return this._$AA; | ||
| } | ||
| get endNode() { | ||
| return this._$AB; | ||
| } | ||
| _$AI(e, t = this) { | ||
| e = A(this, e, t), x(e) ? e === D || e == null || e === "" ? (this._$AH !== D && this._$AR(), this._$AH = D) : e !== this._$AH && e !== E && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? fe(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e); | ||
| } | ||
| O(e) { | ||
| return this._$AA.parentNode.insertBefore(e, this._$AB); | ||
| } | ||
| T(e) { | ||
| this._$AH !== e && (this._$AR(), this._$AH = this.O(e)); | ||
| } | ||
| _(e) { | ||
| this._$AH !== D && x(this._$AH) ? this._$AA.nextSibling.data = e : this.T(y.createTextNode(e)), this._$AH = e; | ||
| } | ||
| $(e) { | ||
| let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = k.createElement(ye(n.h, n.h[0]), this.options)), n); | ||
| if (this._$AH?._$AD === r) this._$AH.p(t); | ||
| else { | ||
| let e = new xe(r, this), n = e.u(this.options); | ||
| e.p(t), this.T(n), this._$AH = e; | ||
| } | ||
| } | ||
| _$AC(e) { | ||
| let t = ve.get(e.strings); | ||
| return t === void 0 && ve.set(e.strings, t = new k(e)), t; | ||
| } | ||
| k(t) { | ||
| S(this._$AH) || (this._$AH = [], this._$AR()); | ||
| let n = this._$AH, r, i = 0; | ||
| for (let a of t) i === n.length ? n.push(r = new e(this.O(b()), this.O(b()), this, this.options)) : r = n[i], r._$AI(a), i++; | ||
| i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i); | ||
| } | ||
| _$AR(e = this._$AA.nextSibling, t) { | ||
| for (this._$AP?.(!1, !0, t); e !== this._$AB;) { | ||
| let t = se(e).nextSibling; | ||
| se(e).remove(), e = t; | ||
| } | ||
| } | ||
| setConnected(e) { | ||
| this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e)); | ||
| } | ||
| }, M = class { | ||
| get tagName() { | ||
| return this.element.tagName; | ||
| } | ||
| get _$AU() { | ||
| return this._$AM._$AU; | ||
| } | ||
| constructor(e, t, n, r, i) { | ||
| this.type = 1, this._$AH = D, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = D; | ||
| } | ||
| _$AI(e, t = this, n, r) { | ||
| let i = this.strings, a = !1; | ||
| if (i === void 0) e = A(this, e, t, 0), a = !x(e) || e !== this._$AH && e !== E, a && (this._$AH = e); | ||
| else { | ||
| let r = e, o, s; | ||
| for (e = i[0], o = 0; o < i.length - 1; o++) s = A(this, r[n + o], t, o), s === E && (s = this._$AH[o]), a ||= !x(s) || s !== this._$AH[o], s === D ? e = D : e !== D && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s; | ||
| } | ||
| a && !r && this.j(e); | ||
| } | ||
| j(e) { | ||
| e === D ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? ""); | ||
| } | ||
| }, Se = class extends M { | ||
| constructor() { | ||
| super(...arguments), this.type = 3; | ||
| } | ||
| j(e) { | ||
| this.element[this.name] = e === D ? void 0 : e; | ||
| } | ||
| }, Ce = class extends M { | ||
| constructor() { | ||
| super(...arguments), this.type = 4; | ||
| } | ||
| j(e) { | ||
| this.element.toggleAttribute(this.name, !!e && e !== D); | ||
| } | ||
| }, we = class extends M { | ||
| constructor(e, t, n, r, i) { | ||
| super(e, t, n, r, i), this.type = 5; | ||
| } | ||
| _$AI(e, t = this) { | ||
| if ((e = A(this, e, t, 0) ?? D) === E) return; | ||
| let n = this._$AH, r = e === D && n !== D || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== D && (n === D || r); | ||
| r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e; | ||
| } | ||
| handleEvent(e) { | ||
| typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e); | ||
| } | ||
| }, Te = class { | ||
| constructor(e, t, n) { | ||
| this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n; | ||
| } | ||
| get _$AU() { | ||
| return this._$AM._$AU; | ||
| } | ||
| _$AI(e) { | ||
| A(this, e); | ||
| } | ||
| }, Ee = g.litHtmlPolyfillSupport; | ||
| Ee?.(k, j), (g.litHtmlVersions ??= []).push("3.3.2"); | ||
| var De = (e, t, n) => { | ||
| let r = n?.renderBefore ?? t, i = r._$litPart$; | ||
| if (i === void 0) { | ||
| let e = n?.renderBefore ?? null; | ||
| r._$litPart$ = i = new j(t.insertBefore(b(), e), e, void 0, n ?? {}); | ||
| } | ||
| return i._$AI(e), i; | ||
| }, N = globalThis, P = class extends h { | ||
| constructor() { | ||
| super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; | ||
| } | ||
| createRenderRoot() { | ||
| let e = super.createRenderRoot(); | ||
| return this.renderOptions.renderBefore ??= e.firstChild, e; | ||
| } | ||
| update(e) { | ||
| let t = this.render(); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = De(t, this.renderRoot, this.renderOptions); | ||
| } | ||
| connectedCallback() { | ||
| super.connectedCallback(), this._$Do?.setConnected(!0); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(), this._$Do?.setConnected(!1); | ||
| } | ||
| render() { | ||
| return E; | ||
| } | ||
| }; | ||
| P._$litElement$ = !0, P.finalized = !0, N.litElementHydrateSupport?.({ LitElement: P }); | ||
| var Oe = N.litElementPolyfillSupport; | ||
| Oe?.({ LitElement: P }), (N.litElementVersions ??= []).push("4.2.2"); | ||
| var F = []; | ||
| for (let e = 0; e < 256; ++e) F.push((e + 256).toString(16).slice(1)); | ||
| function ke(e, t = 0) { | ||
| return (F[e[t + 0]] + F[e[t + 1]] + F[e[t + 2]] + F[e[t + 3]] + "-" + F[e[t + 4]] + F[e[t + 5]] + "-" + F[e[t + 6]] + F[e[t + 7]] + "-" + F[e[t + 8]] + F[e[t + 9]] + "-" + F[e[t + 10]] + F[e[t + 11]] + F[e[t + 12]] + F[e[t + 13]] + F[e[t + 14]] + F[e[t + 15]]).toLowerCase(); | ||
| } | ||
| var I, Ae = new Uint8Array(16); | ||
| function je() { | ||
| if (!I) { | ||
| if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); | ||
| I = crypto.getRandomValues.bind(crypto); | ||
| } | ||
| return I(Ae); | ||
| } | ||
| var Me = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) }; | ||
| function Ne(e, t, n) { | ||
| e ||= {}; | ||
| let r = e.random ?? e.rng?.() ?? je(); | ||
| if (r.length < 16) throw Error("Random bytes length must be >= 16"); | ||
| if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) { | ||
| if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`); | ||
| for (let e = 0; e < 16; ++e) t[n + e] = r[e]; | ||
| return t; | ||
| } | ||
| return ke(r); | ||
| } | ||
| function Pe(e, t, n) { | ||
| return Me.randomUUID && !t && !e ? Me.randomUUID() : Ne(e, t, n); | ||
| } | ||
| function Fe(e = "hp") { | ||
| return `${e}-${Pe()}`; | ||
| } | ||
| var L = class extends P { | ||
| createRenderRoot() { | ||
| return this; | ||
| } | ||
| emit(e, t) { | ||
| let n = new CustomEvent(`hp-${e}`, { | ||
| detail: t, | ||
| bubbles: !0, | ||
| composed: !0, | ||
| cancelable: !0 | ||
| }); | ||
| return this.dispatchEvent(n), n; | ||
| } | ||
| _hpId = Fe(); | ||
| get hpId() { | ||
| return this._hpId; | ||
| } | ||
| _abortController = null; | ||
| get signal() { | ||
| return (!this._abortController || this._abortController.signal.aborted) && (this._abortController = new AbortController()), this._abortController.signal; | ||
| } | ||
| connectedCallback() { | ||
| super.connectedCallback(), (!this._abortController || this._abortController.signal.aborted) && (this._abortController = new AbortController()); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(), this._abortController?.abort(), this._abortController = null; | ||
| } | ||
| }; | ||
| function R(e) { | ||
| return function(t) { | ||
| typeof window < "u" && (customElements.get(e) || customElements.define(e, t)); | ||
| }; | ||
| } | ||
| //#endregion | ||
| //#region ../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.js | ||
| var z = globalThis, B = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, V = Symbol(), Ie = /* @__PURE__ */ new WeakMap(), Le = class { | ||
| constructor(e, t, n) { | ||
| if (this._$cssResult$ = !0, n !== V) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = e, this.t = t; | ||
| } | ||
| get styleSheet() { | ||
| let e = this.o, t = this.t; | ||
| if (B && e === void 0) { | ||
| let n = t !== void 0 && t.length === 1; | ||
| n && (e = Ie.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && Ie.set(t, e)); | ||
| } | ||
| return e; | ||
| } | ||
| toString() { | ||
| return this.cssText; | ||
| } | ||
| }, Re = (e) => new Le(typeof e == "string" ? e : e + "", void 0, V), ze = (e, t) => { | ||
| if (B) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet); | ||
| else for (let n of t) { | ||
| let t = document.createElement("style"), r = z.litNonce; | ||
| r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t); | ||
| } | ||
| }, Be = B ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => { | ||
| let t = ""; | ||
| for (let n of e.cssRules) t += n.cssText; | ||
| return Re(t); | ||
| })(e) : e, { is: Ve, defineProperty: He, getOwnPropertyDescriptor: Ue, getOwnPropertyNames: We, getOwnPropertySymbols: Ge, getPrototypeOf: Ke } = Object, H = globalThis, qe = H.trustedTypes, Je = qe ? qe.emptyScript : "", Ye = H.reactiveElementPolyfillSupport, U = (e, t) => e, W = { | ||
| toAttribute(e, t) { | ||
| switch (t) { | ||
| case Boolean: | ||
| e = e ? Je : null; | ||
| break; | ||
| case Object: | ||
| case Array: e = e == null ? e : JSON.stringify(e); | ||
| } | ||
| return e; | ||
| }, | ||
| fromAttribute(e, t) { | ||
| let n = e; | ||
| switch (t) { | ||
| case Boolean: | ||
| n = e !== null; | ||
| break; | ||
| case Number: | ||
| n = e === null ? null : Number(e); | ||
| break; | ||
| case Object: | ||
| case Array: try { | ||
| n = JSON.parse(e); | ||
| } catch { | ||
| n = null; | ||
| } | ||
| } | ||
| return n; | ||
| } | ||
| }, G = (e, t) => !Ve(e, t), Xe = { | ||
| attribute: !0, | ||
| type: String, | ||
| converter: W, | ||
| reflect: !1, | ||
| useDefault: !1, | ||
| hasChanged: G | ||
| }; | ||
| Symbol.metadata ??= Symbol("metadata"), H.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| var K = class extends HTMLElement { | ||
| static addInitializer(e) { | ||
| this._$Ei(), (this.l ??= []).push(e); | ||
| } | ||
| static get observedAttributes() { | ||
| return this.finalize(), this._$Eh && [...this._$Eh.keys()]; | ||
| } | ||
| static createProperty(e, t = Xe) { | ||
| if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) { | ||
| let n = Symbol(), r = this.getPropertyDescriptor(e, n, t); | ||
| r !== void 0 && He(this.prototype, e, r); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(e, t, n) { | ||
| let { get: r, set: i } = Ue(this.prototype, e) ?? { | ||
| get() { | ||
| return this[t]; | ||
| }, | ||
| set(e) { | ||
| this[t] = e; | ||
| } | ||
| }; | ||
| return { | ||
| get: r, | ||
| set(t) { | ||
| let a = r?.call(this); | ||
| i?.call(this, t), this.requestUpdate(e, a, n); | ||
| }, | ||
| configurable: !0, | ||
| enumerable: !0 | ||
| }; | ||
| } | ||
| static getPropertyOptions(e) { | ||
| return this.elementProperties.get(e) ?? Xe; | ||
| } | ||
| static _$Ei() { | ||
| if (this.hasOwnProperty(U("elementProperties"))) return; | ||
| let e = Ke(this); | ||
| e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); | ||
| } | ||
| static finalize() { | ||
| if (this.hasOwnProperty(U("finalized"))) return; | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) { | ||
| let e = this.properties, t = [...We(e), ...Ge(e)]; | ||
| for (let n of t) this.createProperty(n, e[n]); | ||
| } | ||
| let e = this[Symbol.metadata]; | ||
| if (e !== null) { | ||
| let t = litPropertyMetadata.get(e); | ||
| if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (let [e, t] of this.elementProperties) { | ||
| let n = this._$Eu(e, t); | ||
| n !== void 0 && this._$Eh.set(n, e); | ||
| } | ||
| this.elementStyles = this.finalizeStyles(this.styles); | ||
| } | ||
| static finalizeStyles(e) { | ||
| let t = []; | ||
| if (Array.isArray(e)) { | ||
| let n = new Set(e.flat(Infinity).reverse()); | ||
| for (let e of n) t.unshift(Be(e)); | ||
| } else e !== void 0 && t.push(Be(e)); | ||
| return t; | ||
| } | ||
| static _$Eu(e, t) { | ||
| let n = t.attribute; | ||
| return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0; | ||
| } | ||
| constructor() { | ||
| super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); | ||
| } | ||
| _$Ev() { | ||
| this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this)); | ||
| } | ||
| addController(e) { | ||
| (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.(); | ||
| } | ||
| removeController(e) { | ||
| this._$EO?.delete(e); | ||
| } | ||
| _$E_() { | ||
| let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties; | ||
| for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]); | ||
| e.size > 0 && (this._$Ep = e); | ||
| } | ||
| createRenderRoot() { | ||
| let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); | ||
| return ze(e, this.constructor.elementStyles), e; | ||
| } | ||
| connectedCallback() { | ||
| this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.()); | ||
| } | ||
| enableUpdating(e) {} | ||
| disconnectedCallback() { | ||
| this._$EO?.forEach((e) => e.hostDisconnected?.()); | ||
| } | ||
| attributeChangedCallback(e, t, n) { | ||
| this._$AK(e, n); | ||
| } | ||
| _$ET(e, t) { | ||
| let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n); | ||
| if (r !== void 0 && !0 === n.reflect) { | ||
| let i = (n.converter?.toAttribute === void 0 ? W : n.converter).toAttribute(t, n.type); | ||
| this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(e, t) { | ||
| let n = this.constructor, r = n._$Eh.get(e); | ||
| if (r !== void 0 && this._$Em !== r) { | ||
| let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? W : e.converter; | ||
| this._$Em = r; | ||
| let a = i.fromAttribute(t, e.type); | ||
| this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null; | ||
| } | ||
| } | ||
| requestUpdate(e, t, n, r = !1, i) { | ||
| if (e !== void 0) { | ||
| let a = this.constructor; | ||
| if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? G)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return; | ||
| this.C(e, t, n); | ||
| } | ||
| !1 === this.isUpdatePending && (this._$ES = this._$EP()); | ||
| } | ||
| C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) { | ||
| n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e)); | ||
| } | ||
| async _$EP() { | ||
| this.isUpdatePending = !0; | ||
| try { | ||
| await this._$ES; | ||
| } catch (e) { | ||
| Promise.reject(e); | ||
| } | ||
| let e = this.scheduleUpdate(); | ||
| return e != null && await e, !this.isUpdatePending; | ||
| } | ||
| scheduleUpdate() { | ||
| return this.performUpdate(); | ||
| } | ||
| performUpdate() { | ||
| if (!this.isUpdatePending) return; | ||
| if (!this.hasUpdated) { | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (let [e, t] of this._$Ep) this[e] = t; | ||
| this._$Ep = void 0; | ||
| } | ||
| let e = this.constructor.elementProperties; | ||
| if (e.size > 0) for (let [t, n] of e) { | ||
| let { wrapped: e } = n, r = this[t]; | ||
| !0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r); | ||
| } | ||
| } | ||
| let e = !1, t = this._$AL; | ||
| try { | ||
| e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM(); | ||
| } catch (t) { | ||
| throw e = !1, this._$EM(), t; | ||
| } | ||
| e && this._$AE(t); | ||
| } | ||
| willUpdate(e) {} | ||
| _$AE(e) { | ||
| this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e); | ||
| } | ||
| _$EM() { | ||
| this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; | ||
| } | ||
| get updateComplete() { | ||
| return this.getUpdateComplete(); | ||
| } | ||
| getUpdateComplete() { | ||
| return this._$ES; | ||
| } | ||
| shouldUpdate(e) { | ||
| return !0; | ||
| } | ||
| update(e) { | ||
| this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM(); | ||
| } | ||
| updated(e) {} | ||
| firstUpdated(e) {} | ||
| }; | ||
| K.elementStyles = [], K.shadowRootOptions = { mode: "open" }, K[U("elementProperties")] = /* @__PURE__ */ new Map(), K[U("finalized")] = /* @__PURE__ */ new Map(), Ye?.({ ReactiveElement: K }), (H.reactiveElementVersions ??= []).push("2.1.2"); | ||
| //#endregion | ||
| //#region ../../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.js | ||
| var Ze = { | ||
| attribute: !0, | ||
| type: String, | ||
| converter: W, | ||
| reflect: !1, | ||
| hasChanged: G | ||
| }, Qe = (e = Ze, t, n) => { | ||
| let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i); | ||
| if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") { | ||
| let { name: r } = n; | ||
| return { | ||
| set(n) { | ||
| let i = t.get.call(this); | ||
| t.set.call(this, n), this.requestUpdate(r, i, e, !0, n); | ||
| }, | ||
| init(t) { | ||
| return t !== void 0 && this.C(r, void 0, e, t), t; | ||
| } | ||
| }; | ||
| } | ||
| if (r === "setter") { | ||
| let { name: r } = n; | ||
| return function(n) { | ||
| let i = this[r]; | ||
| t.call(this, n), this.requestUpdate(r, i, e, !0, n); | ||
| }; | ||
| } | ||
| throw Error("Unsupported decorator location: " + r); | ||
| }; | ||
| function $e(e) { | ||
| return (t, n) => typeof n == "object" ? Qe(e, t, n) : ((e, t, n) => { | ||
| let r = t.hasOwnProperty(n); | ||
| return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0; | ||
| })(e, t, n); | ||
| } | ||
| //#endregion | ||
| //#region \0@oxc-project+runtime@0.122.0/helpers/decorate.js | ||
| function q(e, t, n, r) { | ||
| var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o; | ||
| if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r); | ||
| else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a); | ||
| return i > 3 && a && Object.defineProperty(t, n, a), a; | ||
| } | ||
| //#endregion | ||
| //#region src/scroll-area.ts | ||
| var J = class extends L { | ||
| get orientation() { | ||
| return this._orientation; | ||
| } | ||
| set orientation(e) { | ||
| this._orientation = e, this._sync(); | ||
| } | ||
| _orientation = "vertical"; | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area"), this._sync(), requestAnimationFrame(() => this._sync()); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(); | ||
| } | ||
| _sync() { | ||
| this.setAttribute("data-orientation", this._orientation); | ||
| } | ||
| }; | ||
| q([$e({ | ||
| type: String, | ||
| reflect: !0 | ||
| })], J.prototype, "orientation", null), J = q([R("hp-scroll-area")], J); | ||
| var Y = class extends L { | ||
| _viewportId = ""; | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area-viewport"), this._viewportId = `hp-scroll-area-viewport-${this.hpId}`, this.id ||= this._viewportId, this.addEventListener("scroll", this._handleScroll, { passive: !0 }), requestAnimationFrame(() => this._updateScrollbars()); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(), this.removeEventListener("scroll", this._handleScroll); | ||
| } | ||
| _handleScroll = () => { | ||
| this._updateScrollbars(), this._updateOverflowAttributes(), this.emit("scroll", { | ||
| scrollTop: this.scrollTop, | ||
| scrollLeft: this.scrollLeft, | ||
| scrollHeight: this.scrollHeight, | ||
| scrollWidth: this.scrollWidth, | ||
| clientHeight: this.clientHeight, | ||
| clientWidth: this.clientWidth | ||
| }); | ||
| }; | ||
| _updateScrollbars() { | ||
| let e = this.closest("hp-scroll-area"); | ||
| if (!e) return; | ||
| let t = e.querySelector("hp-scroll-area-scrollbar[orientation=\"vertical\"]"); | ||
| if (t) { | ||
| let e = t.querySelector("hp-scroll-area-thumb"); | ||
| if (e) { | ||
| let n = t.clientHeight, r = Math.max(20, this.clientHeight / this.scrollHeight * n), i = this.scrollTop / (this.scrollHeight - this.clientHeight) * (n - r); | ||
| e.style.height = `${r}px`, e.style.transform = `translateY(${i}px)`; | ||
| } | ||
| let n = this.scrollHeight > this.clientHeight; | ||
| t.setAttribute("data-state", n ? "visible" : "hidden"), t.setAttribute("aria-valuenow", String(Math.round(this.scrollTop))), t.setAttribute("aria-valuemax", String(Math.round(this.scrollHeight - this.clientHeight))); | ||
| } | ||
| let n = e.querySelector("hp-scroll-area-scrollbar[orientation=\"horizontal\"]"); | ||
| if (n) { | ||
| let e = n.querySelector("hp-scroll-area-thumb"); | ||
| if (e) { | ||
| let t = n.clientWidth, r = Math.max(20, this.clientWidth / this.scrollWidth * t), i = this.scrollLeft / (this.scrollWidth - this.clientWidth) * (t - r); | ||
| e.style.width = `${r}px`, e.style.transform = `translateX(${i}px)`; | ||
| } | ||
| let t = this.scrollWidth > this.clientWidth; | ||
| n.setAttribute("data-state", t ? "visible" : "hidden"), n.setAttribute("aria-valuenow", String(Math.round(this.scrollLeft))), n.setAttribute("aria-valuemax", String(Math.round(this.scrollWidth - this.clientWidth))); | ||
| } | ||
| let r = e.querySelector("hp-scroll-area-corner"); | ||
| if (r) { | ||
| let e = this.scrollHeight > this.clientHeight, t = this.scrollWidth > this.clientWidth; | ||
| r.setAttribute("data-state", e && t ? "visible" : "hidden"); | ||
| } | ||
| } | ||
| _updateOverflowAttributes() { | ||
| let e = this.closest("hp-scroll-area"); | ||
| if (!e) return; | ||
| let t = this.scrollHeight > this.clientHeight, n = this.scrollWidth > this.clientWidth, r = this.scrollTop <= 0, i = this.scrollTop + this.clientHeight >= this.scrollHeight - 1, a = this.scrollLeft <= 0, o = this.scrollLeft + this.clientWidth >= this.scrollWidth - 1; | ||
| e.toggleAttribute("data-has-overflow-y", t), e.toggleAttribute("data-has-overflow-x", n), e.toggleAttribute("data-overflow-y-start", t && !r), e.toggleAttribute("data-overflow-y-end", t && !i), e.toggleAttribute("data-overflow-x-start", n && !a), e.toggleAttribute("data-overflow-x-end", n && !o); | ||
| let s = this.scrollTop, c = this.scrollHeight - this.clientHeight - this.scrollTop, l = this.scrollLeft, u = this.scrollWidth - this.clientWidth - this.scrollLeft; | ||
| this.style.setProperty("--scroll-area-overflow-y-start", `${s}px`), this.style.setProperty("--scroll-area-overflow-y-end", `${c}px`), this.style.setProperty("--scroll-area-overflow-x-start", `${l}px`), this.style.setProperty("--scroll-area-overflow-x-end", `${u}px`); | ||
| } | ||
| syncScrollbars() { | ||
| this._updateScrollbars(), this._updateOverflowAttributes(); | ||
| } | ||
| }; | ||
| Y = q([R("hp-scroll-area-viewport")], Y); | ||
| var X = class extends L { | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area-content"); | ||
| } | ||
| }; | ||
| X = q([R("hp-scroll-area-content")], X); | ||
| var Z = class extends L { | ||
| get orientation() { | ||
| return this._orientation; | ||
| } | ||
| set orientation(e) { | ||
| this._orientation = e, this._sync(); | ||
| } | ||
| _orientation = "vertical"; | ||
| _isDragging = !1; | ||
| _dragStartPos = 0; | ||
| _dragStartScroll = 0; | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area-scrollbar"), this.setAttribute("role", "scrollbar"), this.setAttribute("tabindex", "0"), this._sync(), this.addEventListener("mousedown", this._handleTrackClick), this.addEventListener("keydown", this._handleKeyDown), requestAnimationFrame(() => this._initAria()); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(), this.removeEventListener("mousedown", this._handleTrackClick), this.removeEventListener("keydown", this._handleKeyDown); | ||
| } | ||
| _sync() { | ||
| this.setAttribute("data-orientation", this._orientation), this.setAttribute("aria-orientation", this._orientation); | ||
| } | ||
| _initAria() { | ||
| let e = this._getViewport(); | ||
| if (!e) return; | ||
| e.id && this.setAttribute("aria-controls", e.id), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuenow", "0"); | ||
| let t = this._orientation === "vertical" ? Math.max(0, e.scrollHeight - e.clientHeight) : Math.max(0, e.scrollWidth - e.clientWidth); | ||
| this.setAttribute("aria-valuemax", String(Math.round(t))); | ||
| } | ||
| _getViewport() { | ||
| return this.closest("hp-scroll-area")?.querySelector("hp-scroll-area-viewport") ?? null; | ||
| } | ||
| _handleTrackClick = (e) => { | ||
| let t = this.querySelector("hp-scroll-area-thumb"); | ||
| if (!t || e.target === t || t.contains(e.target)) return; | ||
| let n = this._getViewport(); | ||
| if (!n) return; | ||
| let r = this.getBoundingClientRect(); | ||
| this._orientation === "vertical" ? n.scrollTop = (e.clientY - r.top) / r.height * (n.scrollHeight - n.clientHeight) : n.scrollLeft = (e.clientX - r.left) / r.width * (n.scrollWidth - n.clientWidth); | ||
| }; | ||
| _handleKeyDown = (e) => { | ||
| let t = this._getViewport(); | ||
| if (!t) return; | ||
| let n = this._orientation === "vertical" ? t.clientHeight : t.clientWidth; | ||
| switch (e.key) { | ||
| case "ArrowDown": | ||
| this._orientation === "vertical" && (e.preventDefault(), t.scrollTop += 40); | ||
| break; | ||
| case "ArrowUp": | ||
| this._orientation === "vertical" && (e.preventDefault(), t.scrollTop -= 40); | ||
| break; | ||
| case "ArrowRight": | ||
| this._orientation === "horizontal" && (e.preventDefault(), t.scrollLeft += 40); | ||
| break; | ||
| case "ArrowLeft": | ||
| this._orientation === "horizontal" && (e.preventDefault(), t.scrollLeft -= 40); | ||
| break; | ||
| case "PageDown": | ||
| e.preventDefault(), this._orientation === "vertical" ? t.scrollTop += n : t.scrollLeft += n; | ||
| break; | ||
| case "PageUp": | ||
| e.preventDefault(), this._orientation === "vertical" ? t.scrollTop -= n : t.scrollLeft -= n; | ||
| break; | ||
| case "Home": | ||
| e.preventDefault(), this._orientation === "vertical" ? t.scrollTop = 0 : t.scrollLeft = 0; | ||
| break; | ||
| case "End": | ||
| e.preventDefault(), this._orientation === "vertical" ? t.scrollTop = t.scrollHeight : t.scrollLeft = t.scrollWidth; | ||
| break; | ||
| } | ||
| }; | ||
| startThumbDrag(e, t) { | ||
| this._isDragging = !0, this._dragStartPos = e, this._dragStartScroll = t, this.setAttribute("data-dragging", ""), document.addEventListener("mousemove", (e) => { | ||
| if (!this._isDragging) return; | ||
| let t = this._getViewport(); | ||
| if (!t) return; | ||
| let n = this._orientation === "vertical" ? e.clientY - this._dragStartPos : e.clientX - this._dragStartPos, r = this._orientation === "vertical" ? this.clientHeight : this.clientWidth, i = this._orientation === "vertical" ? t.scrollHeight : t.scrollWidth, a = this._orientation === "vertical" ? t.clientHeight : t.clientWidth, o = n * ((i - a) / (r - a / i * r)); | ||
| this._orientation === "vertical" ? t.scrollTop = this._dragStartScroll + o : t.scrollLeft = this._dragStartScroll + o; | ||
| }, { signal: this.signal }), document.addEventListener("mouseup", () => { | ||
| this._isDragging = !1, this.removeAttribute("data-dragging"); | ||
| }, { | ||
| signal: this.signal, | ||
| once: !0 | ||
| }); | ||
| } | ||
| }; | ||
| q([$e({ | ||
| type: String, | ||
| reflect: !0 | ||
| })], Z.prototype, "orientation", null), Z = q([R("hp-scroll-area-scrollbar")], Z); | ||
| var Q = class extends L { | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area-thumb"), this.addEventListener("mousedown", this._handleMouseDown); | ||
| } | ||
| disconnectedCallback() { | ||
| super.disconnectedCallback(), this.removeEventListener("mousedown", this._handleMouseDown); | ||
| } | ||
| _handleMouseDown = (e) => { | ||
| e.preventDefault(), e.stopPropagation(); | ||
| let t = this.closest("hp-scroll-area-scrollbar"); | ||
| if (!t) return; | ||
| let n = t.closest("hp-scroll-area")?.querySelector("hp-scroll-area-viewport"); | ||
| if (!n) return; | ||
| let r = t.orientation === "vertical" ? e.clientY : e.clientX, i = t.orientation === "vertical" ? n.scrollTop : n.scrollLeft; | ||
| t.startThumbDrag(r, i); | ||
| }; | ||
| }; | ||
| Q = q([R("hp-scroll-area-thumb")], Q); | ||
| var $ = class extends L { | ||
| connectedCallback() { | ||
| super.connectedCallback(), this.setAttribute("data-hp-component", "scroll-area-corner"), this.setAttribute("aria-hidden", "true"); | ||
| } | ||
| }; | ||
| $ = q([R("hp-scroll-area-corner")], $); | ||
| //#endregion | ||
| export { J as HeadlessScrollArea, X as HeadlessScrollAreaContent, $ as HeadlessScrollAreaCorner, Z as HeadlessScrollAreaScrollbar, Q as HeadlessScrollAreaThumb, Y as HeadlessScrollAreaViewport }; |
| (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.HeadlessPrimitivesScrollArea={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=globalThis,n=t.ShadowRoot&&(t.ShadyCSS===void 0||t.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap,a=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=i.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}},o=e=>new a(typeof e==`string`?e:e+``,void 0,r),s=(e,r)=>{if(n)e.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of r){let r=document.createElement(`style`),i=t.litNonce;i!==void 0&&r.setAttribute(`nonce`,i),r.textContent=n.cssText,e.appendChild(r)}},c=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return o(t)})(e):e,{is:l,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:ee,getOwnPropertySymbols:te,getPrototypeOf:ne}=Object,f=globalThis,re=f.trustedTypes,ie=re?re.emptyScript:``,ae=f.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?ie:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},oe=(e,t)=>!l(e,t),se={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:oe};Symbol.metadata??=Symbol(`metadata`),f.litPropertyMetadata??=new WeakMap;var h=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&u(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(p(`elementProperties`)))return;let e=ne(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(p(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p(`properties`))){let e=this.properties,t=[...ee(e),...te(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(c(e))}else e!==void 0&&t.push(c(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?m:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?m:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??oe)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};h.elementStyles=[],h.shadowRootOptions={mode:`open`},h[p(`elementProperties`)]=new Map,h[p(`finalized`)]=new Map,ae?.({ReactiveElement:h}),(f.reactiveElementVersions??=[]).push(`2.1.2`);var g=globalThis,_=e=>e,v=g.trustedTypes,ce=v?v.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,le=`$lit$`,y=`lit$${Math.random().toFixed(9).slice(2)}$`,ue=`?`+y,de=`<${ue}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,C=Array.isArray,fe=e=>C(e)||typeof e?.[Symbol.iterator]==`function`,w=`[ | ||
| \f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pe=/-->/g,me=/>/g,E=RegExp(`>|${w}(?:([^\\s"'>=/]+)(${w}*=${w}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),he=/'/g,ge=/"/g,_e=/^(?:script|style|textarea|title)$/i,D=Symbol.for(`lit-noChange`),O=Symbol.for(`lit-nothing`),ve=new WeakMap,k=b.createTreeWalker(b,129);function ye(e,t){if(!C(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return ce===void 0?t:ce.createHTML(t)}var be=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=T;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===T?c[1]===`!--`?o=pe:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=E):(_e.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=E):o=me:o===E?c[0]===`>`?(o=i??T,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?E:c[3]===`"`?ge:he):o===ge||o===he?o=E:o===pe||o===me?o=T:(o=E,i=void 0);let d=o===E&&e[t+1].startsWith(`/>`)?` `:``;a+=o===T?n+de:l>=0?(r.push(s),n.slice(0,l)+le+n.slice(l)+y+d):n+y+(l===-2?t:d)}return[ye(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},A=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=be(t,n);if(this.el=e.createElement(l,r),k.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=k.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(le)){let t=u[o++],n=i.getAttribute(e).split(y),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Se:r[1]===`?`?Ce:r[1]===`@`?we:N}),i.removeAttribute(e)}else e.startsWith(y)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(_e.test(i.tagName)){let e=i.textContent.split(y),t=e.length-1;if(t>0){i.textContent=v?v.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],x()),k.nextNode(),c.push({type:2,index:++a});i.append(e[t],x())}}}else if(i.nodeType===8)if(i.data===ue)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(y,e+1))!==-1;)c.push({type:7,index:a}),e+=y.length-1}a++}}static createElement(e,t){let n=b.createElement(`template`);return n.innerHTML=e,n}};function j(e,t,n=e,r){if(t===D)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=S(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=j(e,i._$AS(e,t.values),i,r)),t}var xe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??b).importNode(t,!0);k.currentNode=r;let i=k.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new M(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Te(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=k.nextNode(),a++)}return k.currentNode=b,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},M=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=j(this,e,t),S(e)?e===O||e==null||e===``?(this._$AH!==O&&this._$AR(),this._$AH=O):e!==this._$AH&&e!==D&&this._(e):e._$litType$===void 0?e.nodeType===void 0?fe(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==O&&S(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=A.createElement(ye(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new xe(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=ve.get(e.strings);return t===void 0&&ve.set(e.strings,t=new A(e)),t}k(t){C(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(x()),this.O(x()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=_(e).nextSibling;_(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},N=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=O,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=O}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=j(this,e,t,0),a=!S(e)||e!==this._$AH&&e!==D,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=j(this,r[n+o],t,o),s===D&&(s=this._$AH[o]),a||=!S(s)||s!==this._$AH[o],s===O?e=O:e!==O&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Se=class extends N{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===O?void 0:e}},Ce=class extends N{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==O)}},we=class extends N{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=j(this,e,t,0)??O)===D)return;let n=this._$AH,r=e===O&&n!==O||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==O&&(n===O||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Te=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){j(this,e)}},Ee=g.litHtmlPolyfillSupport;Ee?.(A,M),(g.litHtmlVersions??=[]).push(`3.3.2`);var De=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new M(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},P=globalThis,F=class extends h{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=De(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};F._$litElement$=!0,F.finalized=!0,P.litElementHydrateSupport?.({LitElement:F});var Oe=P.litElementPolyfillSupport;Oe?.({LitElement:F}),(P.litElementVersions??=[]).push(`4.2.2`);var I=[];for(let e=0;e<256;++e)I.push((e+256).toString(16).slice(1));function ke(e,t=0){return(I[e[t+0]]+I[e[t+1]]+I[e[t+2]]+I[e[t+3]]+`-`+I[e[t+4]]+I[e[t+5]]+`-`+I[e[t+6]]+I[e[t+7]]+`-`+I[e[t+8]]+I[e[t+9]]+`-`+I[e[t+10]]+I[e[t+11]]+I[e[t+12]]+I[e[t+13]]+I[e[t+14]]+I[e[t+15]]).toLowerCase()}var L,Ae=new Uint8Array(16);function je(){if(!L){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);L=crypto.getRandomValues.bind(crypto)}return L(Ae)}var Me={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ne(e,t,n){e||={};let r=e.random??e.rng?.()??je();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ke(r)}function Pe(e,t,n){return Me.randomUUID&&!t&&!e?Me.randomUUID():Ne(e,t,n)}function Fe(e=`hp`){return`${e}-${Pe()}`}var R=class extends F{createRenderRoot(){return this}emit(e,t){let n=new CustomEvent(`hp-${e}`,{detail:t,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n),n}_hpId=Fe();get hpId(){return this._hpId}_abortController=null;get signal(){return(!this._abortController||this._abortController.signal.aborted)&&(this._abortController=new AbortController),this._abortController.signal}connectedCallback(){super.connectedCallback(),(!this._abortController||this._abortController.signal.aborted)&&(this._abortController=new AbortController)}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}};function z(e){return function(t){typeof window<`u`&&(customElements.get(e)||customElements.define(e,t))}}var B=globalThis,V=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,Ie=Symbol(),Le=new WeakMap,Re=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ie)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(V&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Le.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Le.set(t,e))}return e}toString(){return this.cssText}},ze=e=>new Re(typeof e==`string`?e:e+``,void 0,Ie),Be=(e,t)=>{if(V)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=B.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},Ve=V?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ze(t)})(e):e,{is:He,defineProperty:Ue,getOwnPropertyDescriptor:We,getOwnPropertyNames:Ge,getOwnPropertySymbols:Ke,getPrototypeOf:qe}=Object,H=globalThis,Je=H.trustedTypes,Ye=Je?Je.emptyScript:``,Xe=H.reactiveElementPolyfillSupport,U=(e,t)=>e,W={toAttribute(e,t){switch(t){case Boolean:e=e?Ye:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},G=(e,t)=>!He(e,t),Ze={attribute:!0,type:String,converter:W,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol(`metadata`),H.litPropertyMetadata??=new WeakMap;var K=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ze){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ue(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=We(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ze}static _$Ei(){if(this.hasOwnProperty(U(`elementProperties`)))return;let e=qe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(U(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U(`properties`))){let e=this.properties,t=[...Ge(e),...Ke(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(Ve(e))}else e!==void 0&&t.push(Ve(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Be(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?W:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?W:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??G)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};K.elementStyles=[],K.shadowRootOptions={mode:`open`},K[U(`elementProperties`)]=new Map,K[U(`finalized`)]=new Map,Xe?.({ReactiveElement:K}),(H.reactiveElementVersions??=[]).push(`2.1.2`);var Qe={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:G},$e=(e=Qe,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function et(e){return(t,n)=>typeof n==`object`?$e(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var J=class extends R{get orientation(){return this._orientation}set orientation(e){this._orientation=e,this._sync()}_orientation=`vertical`;connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area`),this._sync(),requestAnimationFrame(()=>this._sync())}disconnectedCallback(){super.disconnectedCallback()}_sync(){this.setAttribute(`data-orientation`,this._orientation)}};q([et({type:String,reflect:!0})],J.prototype,`orientation`,null),J=q([z(`hp-scroll-area`)],J);var Y=class extends R{_viewportId=``;connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area-viewport`),this._viewportId=`hp-scroll-area-viewport-${this.hpId}`,this.id||=this._viewportId,this.addEventListener(`scroll`,this._handleScroll,{passive:!0}),requestAnimationFrame(()=>this._updateScrollbars())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`scroll`,this._handleScroll)}_handleScroll=()=>{this._updateScrollbars(),this._updateOverflowAttributes(),this.emit(`scroll`,{scrollTop:this.scrollTop,scrollLeft:this.scrollLeft,scrollHeight:this.scrollHeight,scrollWidth:this.scrollWidth,clientHeight:this.clientHeight,clientWidth:this.clientWidth})};_updateScrollbars(){let e=this.closest(`hp-scroll-area`);if(!e)return;let t=e.querySelector(`hp-scroll-area-scrollbar[orientation="vertical"]`);if(t){let e=t.querySelector(`hp-scroll-area-thumb`);if(e){let n=t.clientHeight,r=Math.max(20,this.clientHeight/this.scrollHeight*n),i=this.scrollTop/(this.scrollHeight-this.clientHeight)*(n-r);e.style.height=`${r}px`,e.style.transform=`translateY(${i}px)`}let n=this.scrollHeight>this.clientHeight;t.setAttribute(`data-state`,n?`visible`:`hidden`),t.setAttribute(`aria-valuenow`,String(Math.round(this.scrollTop))),t.setAttribute(`aria-valuemax`,String(Math.round(this.scrollHeight-this.clientHeight)))}let n=e.querySelector(`hp-scroll-area-scrollbar[orientation="horizontal"]`);if(n){let e=n.querySelector(`hp-scroll-area-thumb`);if(e){let t=n.clientWidth,r=Math.max(20,this.clientWidth/this.scrollWidth*t),i=this.scrollLeft/(this.scrollWidth-this.clientWidth)*(t-r);e.style.width=`${r}px`,e.style.transform=`translateX(${i}px)`}let t=this.scrollWidth>this.clientWidth;n.setAttribute(`data-state`,t?`visible`:`hidden`),n.setAttribute(`aria-valuenow`,String(Math.round(this.scrollLeft))),n.setAttribute(`aria-valuemax`,String(Math.round(this.scrollWidth-this.clientWidth)))}let r=e.querySelector(`hp-scroll-area-corner`);if(r){let e=this.scrollHeight>this.clientHeight,t=this.scrollWidth>this.clientWidth;r.setAttribute(`data-state`,e&&t?`visible`:`hidden`)}}_updateOverflowAttributes(){let e=this.closest(`hp-scroll-area`);if(!e)return;let t=this.scrollHeight>this.clientHeight,n=this.scrollWidth>this.clientWidth,r=this.scrollTop<=0,i=this.scrollTop+this.clientHeight>=this.scrollHeight-1,a=this.scrollLeft<=0,o=this.scrollLeft+this.clientWidth>=this.scrollWidth-1;e.toggleAttribute(`data-has-overflow-y`,t),e.toggleAttribute(`data-has-overflow-x`,n),e.toggleAttribute(`data-overflow-y-start`,t&&!r),e.toggleAttribute(`data-overflow-y-end`,t&&!i),e.toggleAttribute(`data-overflow-x-start`,n&&!a),e.toggleAttribute(`data-overflow-x-end`,n&&!o);let s=this.scrollTop,c=this.scrollHeight-this.clientHeight-this.scrollTop,l=this.scrollLeft,u=this.scrollWidth-this.clientWidth-this.scrollLeft;this.style.setProperty(`--scroll-area-overflow-y-start`,`${s}px`),this.style.setProperty(`--scroll-area-overflow-y-end`,`${c}px`),this.style.setProperty(`--scroll-area-overflow-x-start`,`${l}px`),this.style.setProperty(`--scroll-area-overflow-x-end`,`${u}px`)}syncScrollbars(){this._updateScrollbars(),this._updateOverflowAttributes()}};Y=q([z(`hp-scroll-area-viewport`)],Y);var X=class extends R{connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area-content`)}};X=q([z(`hp-scroll-area-content`)],X);var Z=class extends R{get orientation(){return this._orientation}set orientation(e){this._orientation=e,this._sync()}_orientation=`vertical`;_isDragging=!1;_dragStartPos=0;_dragStartScroll=0;connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area-scrollbar`),this.setAttribute(`role`,`scrollbar`),this.setAttribute(`tabindex`,`0`),this._sync(),this.addEventListener(`mousedown`,this._handleTrackClick),this.addEventListener(`keydown`,this._handleKeyDown),requestAnimationFrame(()=>this._initAria())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`mousedown`,this._handleTrackClick),this.removeEventListener(`keydown`,this._handleKeyDown)}_sync(){this.setAttribute(`data-orientation`,this._orientation),this.setAttribute(`aria-orientation`,this._orientation)}_initAria(){let e=this._getViewport();if(!e)return;e.id&&this.setAttribute(`aria-controls`,e.id),this.setAttribute(`aria-valuemin`,`0`),this.setAttribute(`aria-valuenow`,`0`);let t=this._orientation===`vertical`?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,e.scrollWidth-e.clientWidth);this.setAttribute(`aria-valuemax`,String(Math.round(t)))}_getViewport(){return this.closest(`hp-scroll-area`)?.querySelector(`hp-scroll-area-viewport`)??null}_handleTrackClick=e=>{let t=this.querySelector(`hp-scroll-area-thumb`);if(!t||e.target===t||t.contains(e.target))return;let n=this._getViewport();if(!n)return;let r=this.getBoundingClientRect();this._orientation===`vertical`?n.scrollTop=(e.clientY-r.top)/r.height*(n.scrollHeight-n.clientHeight):n.scrollLeft=(e.clientX-r.left)/r.width*(n.scrollWidth-n.clientWidth)};_handleKeyDown=e=>{let t=this._getViewport();if(!t)return;let n=this._orientation===`vertical`?t.clientHeight:t.clientWidth;switch(e.key){case`ArrowDown`:this._orientation===`vertical`&&(e.preventDefault(),t.scrollTop+=40);break;case`ArrowUp`:this._orientation===`vertical`&&(e.preventDefault(),t.scrollTop-=40);break;case`ArrowRight`:this._orientation===`horizontal`&&(e.preventDefault(),t.scrollLeft+=40);break;case`ArrowLeft`:this._orientation===`horizontal`&&(e.preventDefault(),t.scrollLeft-=40);break;case`PageDown`:e.preventDefault(),this._orientation===`vertical`?t.scrollTop+=n:t.scrollLeft+=n;break;case`PageUp`:e.preventDefault(),this._orientation===`vertical`?t.scrollTop-=n:t.scrollLeft-=n;break;case`Home`:e.preventDefault(),this._orientation===`vertical`?t.scrollTop=0:t.scrollLeft=0;break;case`End`:e.preventDefault(),this._orientation===`vertical`?t.scrollTop=t.scrollHeight:t.scrollLeft=t.scrollWidth;break}};startThumbDrag(e,t){this._isDragging=!0,this._dragStartPos=e,this._dragStartScroll=t,this.setAttribute(`data-dragging`,``),document.addEventListener(`mousemove`,e=>{if(!this._isDragging)return;let t=this._getViewport();if(!t)return;let n=this._orientation===`vertical`?e.clientY-this._dragStartPos:e.clientX-this._dragStartPos,r=this._orientation===`vertical`?this.clientHeight:this.clientWidth,i=this._orientation===`vertical`?t.scrollHeight:t.scrollWidth,a=this._orientation===`vertical`?t.clientHeight:t.clientWidth,o=n*((i-a)/(r-a/i*r));this._orientation===`vertical`?t.scrollTop=this._dragStartScroll+o:t.scrollLeft=this._dragStartScroll+o},{signal:this.signal}),document.addEventListener(`mouseup`,()=>{this._isDragging=!1,this.removeAttribute(`data-dragging`)},{signal:this.signal,once:!0})}};q([et({type:String,reflect:!0})],Z.prototype,`orientation`,null),Z=q([z(`hp-scroll-area-scrollbar`)],Z);var Q=class extends R{connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area-thumb`),this.addEventListener(`mousedown`,this._handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`mousedown`,this._handleMouseDown)}_handleMouseDown=e=>{e.preventDefault(),e.stopPropagation();let t=this.closest(`hp-scroll-area-scrollbar`);if(!t)return;let n=t.closest(`hp-scroll-area`)?.querySelector(`hp-scroll-area-viewport`);if(!n)return;let r=t.orientation===`vertical`?e.clientY:e.clientX,i=t.orientation===`vertical`?n.scrollTop:n.scrollLeft;t.startThumbDrag(r,i)}};Q=q([z(`hp-scroll-area-thumb`)],Q);var $=class extends R{connectedCallback(){super.connectedCallback(),this.setAttribute(`data-hp-component`,`scroll-area-corner`),this.setAttribute(`aria-hidden`,`true`)}};$=q([z(`hp-scroll-area-corner`)],$),Object.defineProperty(e,`HeadlessScrollArea`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,`HeadlessScrollAreaContent`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,`HeadlessScrollAreaCorner`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,`HeadlessScrollAreaScrollbar`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,`HeadlessScrollAreaThumb`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,`HeadlessScrollAreaViewport`,{enumerable:!0,get:function(){return Y}})}); |
+2
-2
| { | ||
| "name": "@headless-primitives/scroll-area", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "description": "Headless scroll area primitive", | ||
@@ -24,3 +24,3 @@ "files": [ | ||
| "lit": "^3.3.2", | ||
| "@headless-primitives/utils": "1.0.0" | ||
| "@headless-primitives/utils": "1.1.0" | ||
| }, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
76428
4134.24%4
100%1099
Infinity%4
100%2
100%+ Added
- Removed