@skillbill/vuelace-3
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/@skillbill%2Fvuelace-3)
1,512 lines (1,494 loc) • 1.32 MB
JavaScript
import { defineComponent as Te, openBlock as m, createElementBlock as C, renderSlot as D, mergeModels as ge, useModel as Ue, ref as ae, computed as Be, watch as Fe, createElementVNode as M, normalizeClass as j, toDisplayString as R, createCommentVNode as $, createBlock as P, withCtx as N, createTextVNode as se, withModifiers as Oe, withDirectives as ye, vShow as oi, unref as re, createVNode as ie, readonly as Au, getCurrentInstance as Ru, onMounted as En, nextTick as Us, mergeProps as y, Teleport as zu, resolveComponent as X, Fragment as W, renderList as de, resolveDirective as wt, resolveDynamicComponent as Y, Transition as xr, createSlots as pn, toHandlers as Ji, normalizeProps as Et, guardReactiveProps as Xt, withKeys as ue, pushScopeId as Gs, popScopeId as Ws, normalizeStyle as sa, vModelText as Bu, reactive as qs, toRaw as la } from "vue";
var Ys = Object.defineProperty, Fu = Object.defineProperties, Vu = Object.getOwnPropertyDescriptor, Hu = Object.getOwnPropertyDescriptors, ua = Object.getOwnPropertySymbols, ju = Object.prototype.hasOwnProperty, Nu = Object.prototype.propertyIsEnumerable, Rr = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), da = (t, e, n) => e in t ? Ys(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Nt = (t, e) => {
for (var n in e || (e = {}))
ju.call(e, n) && da(t, n, e[n]);
if (ua)
for (var n of ua(e))
Nu.call(e, n) && da(t, n, e[n]);
return t;
}, Fi = (t, e) => Fu(t, Hu(e)), c = (t, e, n, i) => {
for (var o = i > 1 ? void 0 : i ? Vu(e, n) : e, r = t.length - 1, a; r >= 0; r--)
(a = t[r]) && (o = (i ? a(e, n, o) : a(o)) || o);
return i && o && Ys(e, n, o), o;
}, Ku = function(t, e) {
this[0] = t, this[1] = e;
}, Uu = (t) => {
var e = t[Rr("asyncIterator")], n = !1, i, o = {};
return e == null ? (e = t[Rr("iterator")](), i = (r) => o[r] = (a) => e[r](a)) : (e = e.call(t), i = (r) => o[r] = (a) => {
if (n) {
if (n = !1, r === "throw")
throw a;
return a;
}
return n = !0, {
done: !1,
value: new Ku(new Promise((l) => {
var u = e[r](a);
if (!(u instanceof Object))
throw TypeError("Object expected");
l(u);
}), 1)
};
}), o[Rr("iterator")] = () => o, i("next"), "throw" in e ? i("throw") : o.throw = (r) => {
throw r;
}, "return" in e && i("return"), o;
}, Fn = /* @__PURE__ */ new WeakMap(), Vn = /* @__PURE__ */ new WeakMap(), Hn = /* @__PURE__ */ new WeakMap(), zr = /* @__PURE__ */ new WeakSet(), Qi = /* @__PURE__ */ new WeakMap(), Kt = class {
constructor(t, e) {
this.handleFormData = (n) => {
const i = this.options.disabled(this.host), o = this.options.name(this.host), r = this.options.value(this.host), a = this.host.tagName.toLowerCase() === "sl-button";
this.host.isConnected && !i && !a && typeof o == "string" && o.length > 0 && typeof r < "u" && (Array.isArray(r) ? r.forEach((l) => {
n.formData.append(o, l.toString());
}) : n.formData.append(o, r.toString()));
}, this.handleFormSubmit = (n) => {
var i;
const o = this.options.disabled(this.host), r = this.options.reportValidity;
this.form && !this.form.noValidate && ((i = Fn.get(this.form)) == null || i.forEach((a) => {
this.setUserInteracted(a, !0);
})), this.form && !this.form.noValidate && !o && !r(this.host) && (n.preventDefault(), n.stopImmediatePropagation());
}, this.handleFormReset = () => {
this.options.setValue(this.host, this.options.defaultValue(this.host)), this.setUserInteracted(this.host, !1), Qi.set(this.host, []);
}, this.handleInteraction = (n) => {
const i = Qi.get(this.host);
i.includes(n.type) || i.push(n.type), i.length === this.options.assumeInteractionOn.length && this.setUserInteracted(this.host, !0);
}, this.checkFormValidity = () => {
if (this.form && !this.form.noValidate) {
const n = this.form.querySelectorAll("*");
for (const i of n)
if (typeof i.checkValidity == "function" && !i.checkValidity())
return !1;
}
return !0;
}, this.reportFormValidity = () => {
if (this.form && !this.form.noValidate) {
const n = this.form.querySelectorAll("*");
for (const i of n)
if (typeof i.reportValidity == "function" && !i.reportValidity())
return !1;
}
return !0;
}, (this.host = t).addController(this), this.options = Nt({
form: (n) => {
const i = n.form;
if (i) {
const r = n.getRootNode().querySelector(`#${i}`);
if (r)
return r;
}
return n.closest("form");
},
name: (n) => n.name,
value: (n) => n.value,
defaultValue: (n) => n.defaultValue,
disabled: (n) => {
var i;
return (i = n.disabled) != null ? i : !1;
},
reportValidity: (n) => typeof n.reportValidity == "function" ? n.reportValidity() : !0,
checkValidity: (n) => typeof n.checkValidity == "function" ? n.checkValidity() : !0,
setValue: (n, i) => n.value = i,
assumeInteractionOn: ["sl-input"]
}, e);
}
hostConnected() {
const t = this.options.form(this.host);
t && this.attachForm(t), Qi.set(this.host, []), this.options.assumeInteractionOn.forEach((e) => {
this.host.addEventListener(e, this.handleInteraction);
});
}
hostDisconnected() {
this.detachForm(), Qi.delete(this.host), this.options.assumeInteractionOn.forEach((t) => {
this.host.removeEventListener(t, this.handleInteraction);
});
}
hostUpdated() {
const t = this.options.form(this.host);
t || this.detachForm(), t && this.form !== t && (this.detachForm(), this.attachForm(t)), this.host.hasUpdated && this.setValidity(this.host.validity.valid);
}
attachForm(t) {
t ? (this.form = t, Fn.has(this.form) ? Fn.get(this.form).add(this.host) : Fn.set(this.form, /* @__PURE__ */ new Set([this.host])), this.form.addEventListener("formdata", this.handleFormData), this.form.addEventListener("submit", this.handleFormSubmit), this.form.addEventListener("reset", this.handleFormReset), Vn.has(this.form) || (Vn.set(this.form, this.form.reportValidity), this.form.reportValidity = () => this.reportFormValidity()), Hn.has(this.form) || (Hn.set(this.form, this.form.checkValidity), this.form.checkValidity = () => this.checkFormValidity())) : this.form = void 0;
}
detachForm() {
if (!this.form)
return;
const t = Fn.get(this.form);
t && (t.delete(this.host), t.size <= 0 && (this.form.removeEventListener("formdata", this.handleFormData), this.form.removeEventListener("submit", this.handleFormSubmit), this.form.removeEventListener("reset", this.handleFormReset), Vn.has(this.form) && (this.form.reportValidity = Vn.get(this.form), Vn.delete(this.form)), Hn.has(this.form) && (this.form.checkValidity = Hn.get(this.form), Hn.delete(this.form)), this.form = void 0));
}
setUserInteracted(t, e) {
e ? zr.add(t) : zr.delete(t), t.requestUpdate();
}
doAction(t, e) {
if (this.form) {
const n = document.createElement("button");
n.type = t, n.style.position = "absolute", n.style.width = "0", n.style.height = "0", n.style.clipPath = "inset(50%)", n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", e && (n.name = e.name, n.value = e.value, ["formaction", "formenctype", "formmethod", "formnovalidate", "formtarget"].forEach((i) => {
e.hasAttribute(i) && n.setAttribute(i, e.getAttribute(i));
})), this.form.append(n), n.click(), n.remove();
}
}
/** Returns the associated `<form>` element, if one exists. */
getForm() {
var t;
return (t = this.form) != null ? t : null;
}
/** Resets the form, restoring all the control to their default value */
reset(t) {
this.doAction("reset", t);
}
/** Submits the form, triggering validation and form data injection. */
submit(t) {
this.doAction("submit", t);
}
/**
* Synchronously sets the form control's validity. Call this when you know the future validity but need to update
* the host element immediately, i.e. before Lit updates the component in the next update.
*/
setValidity(t) {
const e = this.host, n = !!zr.has(e), i = !!e.required;
e.toggleAttribute("data-required", i), e.toggleAttribute("data-optional", !i), e.toggleAttribute("data-invalid", !t), e.toggleAttribute("data-valid", t), e.toggleAttribute("data-user-invalid", !t && n), e.toggleAttribute("data-user-valid", t && n);
}
/**
* Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
* that affects constraint validation changes so the component receives the correct validity states.
*/
updateValidity() {
const t = this.host;
this.setValidity(t.validity.valid);
}
/**
* Dispatches a non-bubbling, cancelable custom event of type `sl-invalid`.
* If the `sl-invalid` event will be cancelled then the original `invalid`
* event (which may have been passed as argument) will also be cancelled.
* If no original `invalid` event has been passed then the `sl-invalid`
* event will be cancelled before being dispatched.
*/
emitInvalidEvent(t) {
const e = new CustomEvent("sl-invalid", {
bubbles: !1,
composed: !1,
cancelable: !0,
detail: {}
});
t || e.preventDefault(), this.host.dispatchEvent(e) || t == null || t.preventDefault();
}
}, Or = Object.freeze({
badInput: !1,
customError: !1,
patternMismatch: !1,
rangeOverflow: !1,
rangeUnderflow: !1,
stepMismatch: !1,
tooLong: !1,
tooShort: !1,
typeMismatch: !1,
valid: !0,
valueMissing: !1
}), Gu = Object.freeze(Fi(Nt({}, Or), {
valid: !1,
valueMissing: !0
})), Wu = Object.freeze(Fi(Nt({}, Or), {
valid: !1,
customError: !0
}));
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const dr = globalThis, Bo = dr.ShadowRoot && (dr.ShadyCSS === void 0 || dr.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Fo = Symbol(), ca = /* @__PURE__ */ new WeakMap();
let Zs = class {
constructor(e, n, i) {
if (this._$cssResult$ = !0, i !== Fo)
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = e, this.t = n;
}
get styleSheet() {
let e = this.o;
const n = this.t;
if (Bo && e === void 0) {
const i = n !== void 0 && n.length === 1;
i && (e = ca.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ca.set(n, e));
}
return e;
}
toString() {
return this.cssText;
}
};
const qu = (t) => new Zs(typeof t == "string" ? t : t + "", void 0, Fo), J = (t, ...e) => {
const n = t.length === 1 ? t[0] : e.reduce((i, o, r) => i + ((a) => {
if (a._$cssResult$ === !0)
return a.cssText;
if (typeof a == "number")
return a;
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
})(o) + t[r + 1], t[0]);
return new Zs(n, t, Fo);
}, Yu = (t, e) => {
if (Bo)
t.adoptedStyleSheets = e.map((n) => n instanceof CSSStyleSheet ? n : n.styleSheet);
else
for (const n of e) {
const i = document.createElement("style"), o = dr.litNonce;
o !== void 0 && i.setAttribute("nonce", o), i.textContent = n.cssText, t.appendChild(i);
}
}, pa = Bo ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
let n = "";
for (const i of e.cssRules)
n += i.cssText;
return qu(n);
})(t) : t;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const { is: Zu, defineProperty: Xu, getOwnPropertyDescriptor: Ju, getOwnPropertyNames: Qu, getOwnPropertySymbols: ed, getPrototypeOf: td } = Object, Jt = globalThis, ha = Jt.trustedTypes, nd = ha ? ha.emptyScript : "", Br = Jt.reactiveElementPolyfillSupport, qn = (t, e) => t, In = { toAttribute(t, e) {
switch (e) {
case Boolean:
t = t ? nd : null;
break;
case Object:
case Array:
t = t == null ? t : JSON.stringify(t);
}
return t;
}, fromAttribute(t, e) {
let n = t;
switch (e) {
case Boolean:
n = t !== null;
break;
case Number:
n = t === null ? null : Number(t);
break;
case Object:
case Array:
try {
n = JSON.parse(t);
} catch {
n = null;
}
}
return n;
} }, Vo = (t, e) => !Zu(t, e), fa = { attribute: !0, type: String, converter: In, reflect: !1, hasChanged: Vo };
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Jt.litPropertyMetadata ?? (Jt.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
class kn extends HTMLElement {
static addInitializer(e) {
this._$Ei(), (this.l ?? (this.l = [])).push(e);
}
static get observedAttributes() {
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
}
static createProperty(e, n = fa) {
if (n.state && (n.attribute = !1), this._$Ei(), this.elementProperties.set(e, n), !n.noAccessor) {
const i = Symbol(), o = this.getPropertyDescriptor(e, i, n);
o !== void 0 && Xu(this.prototype, e, o);
}
}
static getPropertyDescriptor(e, n, i) {
const { get: o, set: r } = Ju(this.prototype, e) ?? { get() {
return this[n];
}, set(a) {
this[n] = a;
} };
return { get() {
return o == null ? void 0 : o.call(this);
}, set(a) {
const l = o == null ? void 0 : o.call(this);
r.call(this, a), this.requestUpdate(e, l, i);
}, configurable: !0, enumerable: !0 };
}
static getPropertyOptions(e) {
return this.elementProperties.get(e) ?? fa;
}
static _$Ei() {
if (this.hasOwnProperty(qn("elementProperties")))
return;
const e = td(this);
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(qn("finalized")))
return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(qn("properties"))) {
const n = this.properties, i = [...Qu(n), ...ed(n)];
for (const o of i)
this.createProperty(o, n[o]);
}
const e = this[Symbol.metadata];
if (e !== null) {
const n = litPropertyMetadata.get(e);
if (n !== void 0)
for (const [i, o] of n)
this.elementProperties.set(i, o);
}
this._$Eh = /* @__PURE__ */ new Map();
for (const [n, i] of this.elementProperties) {
const o = this._$Eu(n, i);
o !== void 0 && this._$Eh.set(o, n);
}
this.elementStyles = this.finalizeStyles(this.styles);
}
static finalizeStyles(e) {
const n = [];
if (Array.isArray(e)) {
const i = new Set(e.flat(1 / 0).reverse());
for (const o of i)
n.unshift(pa(o));
} else
e !== void 0 && n.push(pa(e));
return n;
}
static _$Eu(e, n) {
const i = n.attribute;
return i === !1 ? void 0 : typeof i == "string" ? i : 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() {
var e;
this._$ES = new Promise((n) => this.enableUpdating = n), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((n) => n(this));
}
addController(e) {
var n;
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((n = e.hostConnected) == null || n.call(e));
}
removeController(e) {
var n;
(n = this._$EO) == null || n.delete(e);
}
_$E_() {
const e = /* @__PURE__ */ new Map(), n = this.constructor.elementProperties;
for (const i of n.keys())
this.hasOwnProperty(i) && (e.set(i, this[i]), delete this[i]);
e.size > 0 && (this._$Ep = e);
}
createRenderRoot() {
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return Yu(e, this.constructor.elementStyles), e;
}
connectedCallback() {
var e;
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((n) => {
var i;
return (i = n.hostConnected) == null ? void 0 : i.call(n);
});
}
enableUpdating(e) {
}
disconnectedCallback() {
var e;
(e = this._$EO) == null || e.forEach((n) => {
var i;
return (i = n.hostDisconnected) == null ? void 0 : i.call(n);
});
}
attributeChangedCallback(e, n, i) {
this._$AK(e, i);
}
_$EC(e, n) {
var r;
const i = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, i);
if (o !== void 0 && i.reflect === !0) {
const a = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter : In).toAttribute(n, i.type);
this._$Em = e, a == null ? this.removeAttribute(o) : this.setAttribute(o, a), this._$Em = null;
}
}
_$AK(e, n) {
var r;
const i = this.constructor, o = i._$Eh.get(e);
if (o !== void 0 && this._$Em !== o) {
const a = i.getPropertyOptions(o), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((r = a.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? a.converter : In;
this._$Em = o, this[o] = l.fromAttribute(n, a.type), this._$Em = null;
}
}
requestUpdate(e, n, i) {
if (e !== void 0) {
if (i ?? (i = this.constructor.getPropertyOptions(e)), !(i.hasChanged ?? Vo)(this[e], n))
return;
this.P(e, n, i);
}
this.isUpdatePending === !1 && (this._$ES = this._$ET());
}
P(e, n, i) {
this._$AL.has(e) || this._$AL.set(e, n), i.reflect === !0 && this._$Em !== e && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(e);
}
async _$ET() {
this.isUpdatePending = !0;
try {
await this._$ES;
} catch (n) {
Promise.reject(n);
}
const e = this.scheduleUpdate();
return e != null && await e, !this.isUpdatePending;
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var i;
if (!this.isUpdatePending)
return;
if (!this.hasUpdated) {
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
for (const [r, a] of this._$Ep)
this[r] = a;
this._$Ep = void 0;
}
const o = this.constructor.elementProperties;
if (o.size > 0)
for (const [r, a] of o)
a.wrapped !== !0 || this._$AL.has(r) || this[r] === void 0 || this.P(r, this[r], a);
}
let e = !1;
const n = this._$AL;
try {
e = this.shouldUpdate(n), e ? (this.willUpdate(n), (i = this._$EO) == null || i.forEach((o) => {
var r;
return (r = o.hostUpdate) == null ? void 0 : r.call(o);
}), this.update(n)) : this._$EU();
} catch (o) {
throw e = !1, this._$EU(), o;
}
e && this._$AE(n);
}
willUpdate(e) {
}
_$AE(e) {
var n;
(n = this._$EO) == null || n.forEach((i) => {
var o;
return (o = i.hostUpdated) == null ? void 0 : o.call(i);
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
}
_$EU() {
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this._$ES;
}
shouldUpdate(e) {
return !0;
}
update(e) {
this._$Ej && (this._$Ej = this._$Ej.forEach((n) => this._$EC(n, this[n]))), this._$EU();
}
updated(e) {
}
firstUpdated(e) {
}
}
kn.elementStyles = [], kn.shadowRootOptions = { mode: "open" }, kn[qn("elementProperties")] = /* @__PURE__ */ new Map(), kn[qn("finalized")] = /* @__PURE__ */ new Map(), Br == null || Br({ ReactiveElement: kn }), (Jt.reactiveElementVersions ?? (Jt.reactiveElementVersions = [])).push("2.0.4");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Yn = globalThis, fr = Yn.trustedTypes, ma = fr ? fr.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, Xs = "$lit$", Yt = `lit$${Math.random().toFixed(9).slice(2)}$`, Js = "?" + Yt, id = `<${Js}>`, hn = document, ai = () => hn.createComment(""), si = (t) => t === null || typeof t != "object" && typeof t != "function", Qs = Array.isArray, rd = (t) => Qs(t) || typeof (t == null ? void 0 : t[Symbol.iterator]) == "function", Fr = `[
\f\r]`, jn = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ga = /-->/g, ba = />/g, an = RegExp(`>|${Fr}(?:([^\\s"'>=/]+)(${Fr}*=${Fr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), va = /'/g, ya = /"/g, el = /^(?:script|style|textarea|title)$/i, od = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), A = od(1), ut = Symbol.for("lit-noChange"), Ee = Symbol.for("lit-nothing"), wa = /* @__PURE__ */ new WeakMap(), dn = hn.createTreeWalker(hn, 129);
function tl(t, e) {
if (!Array.isArray(t) || !t.hasOwnProperty("raw"))
throw Error("invalid template strings array");
return ma !== void 0 ? ma.createHTML(e) : e;
}
const ad = (t, e) => {
const n = t.length - 1, i = [];
let o, r = e === 2 ? "<svg>" : "", a = jn;
for (let l = 0; l < n; l++) {
const u = t[l];
let s, f, d = -1, h = 0;
for (; h < u.length && (a.lastIndex = h, f = a.exec(u), f !== null); )
h = a.lastIndex, a === jn ? f[1] === "!--" ? a = ga : f[1] !== void 0 ? a = ba : f[2] !== void 0 ? (el.test(f[2]) && (o = RegExp("</" + f[2], "g")), a = an) : f[3] !== void 0 && (a = an) : a === an ? f[0] === ">" ? (a = o ?? jn, d = -1) : f[1] === void 0 ? d = -2 : (d = a.lastIndex - f[2].length, s = f[1], a = f[3] === void 0 ? an : f[3] === '"' ? ya : va) : a === ya || a === va ? a = an : a === ga || a === ba ? a = jn : (a = an, o = void 0);
const p = a === an && t[l + 1].startsWith("/>") ? " " : "";
r += a === jn ? u + id : d >= 0 ? (i.push(s), u.slice(0, d) + Xs + u.slice(d) + Yt + p) : u + Yt + (d === -2 ? l : p);
}
return [tl(t, r + (t[n] || "<?>") + (e === 2 ? "</svg>" : "")), i];
};
class li {
constructor({ strings: e, _$litType$: n }, i) {
let o;
this.parts = [];
let r = 0, a = 0;
const l = e.length - 1, u = this.parts, [s, f] = ad(e, n);
if (this.el = li.createElement(s, i), dn.currentNode = this.el.content, n === 2) {
const d = this.el.content.firstChild;
d.replaceWith(...d.childNodes);
}
for (; (o = dn.nextNode()) !== null && u.length < l; ) {
if (o.nodeType === 1) {
if (o.hasAttributes())
for (const d of o.getAttributeNames())
if (d.endsWith(Xs)) {
const h = f[a++], p = o.getAttribute(d).split(Yt), g = /([.?@])?(.*)/.exec(h);
u.push({ type: 1, index: r, name: g[2], strings: p, ctor: g[1] === "." ? ld : g[1] === "?" ? ud : g[1] === "@" ? dd : Ir }), o.removeAttribute(d);
} else
d.startsWith(Yt) && (u.push({ type: 6, index: r }), o.removeAttribute(d));
if (el.test(o.tagName)) {
const d = o.textContent.split(Yt), h = d.length - 1;
if (h > 0) {
o.textContent = fr ? fr.emptyScript : "";
for (let p = 0; p < h; p++)
o.append(d[p], ai()), dn.nextNode(), u.push({ type: 2, index: ++r });
o.append(d[h], ai());
}
}
} else if (o.nodeType === 8)
if (o.data === Js)
u.push({ type: 2, index: r });
else {
let d = -1;
for (; (d = o.data.indexOf(Yt, d + 1)) !== -1; )
u.push({ type: 7, index: r }), d += Yt.length - 1;
}
r++;
}
}
static createElement(e, n) {
const i = hn.createElement("template");
return i.innerHTML = e, i;
}
}
function Pn(t, e, n = t, i) {
var a, l;
if (e === ut)
return e;
let o = i !== void 0 ? (a = n._$Co) == null ? void 0 : a[i] : n._$Cl;
const r = si(e) ? void 0 : e._$litDirective$;
return (o == null ? void 0 : o.constructor) !== r && ((l = o == null ? void 0 : o._$AO) == null || l.call(o, !1), r === void 0 ? o = void 0 : (o = new r(t), o._$AT(t, n, i)), i !== void 0 ? (n._$Co ?? (n._$Co = []))[i] = o : n._$Cl = o), o !== void 0 && (e = Pn(t, o._$AS(t, e.values), o, i)), e;
}
class sd {
constructor(e, n) {
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = n;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
u(e) {
const { el: { content: n }, parts: i } = this._$AD, o = ((e == null ? void 0 : e.creationScope) ?? hn).importNode(n, !0);
dn.currentNode = o;
let r = dn.nextNode(), a = 0, l = 0, u = i[0];
for (; u !== void 0; ) {
if (a === u.index) {
let s;
u.type === 2 ? s = new Vi(r, r.nextSibling, this, e) : u.type === 1 ? s = new u.ctor(r, u.name, u.strings, this, e) : u.type === 6 && (s = new cd(r, this, e)), this._$AV.push(s), u = i[++l];
}
a !== (u == null ? void 0 : u.index) && (r = dn.nextNode(), a++);
}
return dn.currentNode = hn, o;
}
p(e) {
let n = 0;
for (const i of this._$AV)
i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, n), n += i.strings.length - 2) : i._$AI(e[n])), n++;
}
}
class Vi {
get _$AU() {
var e;
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
}
constructor(e, n, i, o) {
this.type = 2, this._$AH = Ee, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = i, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
}
get parentNode() {
let e = this._$AA.parentNode;
const n = this._$AM;
return n !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = n.parentNode), e;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(e, n = this) {
e = Pn(this, e, n), si(e) ? e === Ee || e == null || e === "" ? (this._$AH !== Ee && this._$AR(), this._$AH = Ee) : e !== this._$AH && e !== ut && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : rd(e) ? this.k(e) : this._(e);
}
S(e) {
return this._$AA.parentNode.insertBefore(e, this._$AB);
}
T(e) {
this._$AH !== e && (this._$AR(), this._$AH = this.S(e));
}
_(e) {
this._$AH !== Ee && si(this._$AH) ? this._$AA.nextSibling.data = e : this.T(hn.createTextNode(e)), this._$AH = e;
}
$(e) {
var r;
const { values: n, _$litType$: i } = e, o = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = li.createElement(tl(i.h, i.h[0]), this.options)), i);
if (((r = this._$AH) == null ? void 0 : r._$AD) === o)
this._$AH.p(n);
else {
const a = new sd(o, this), l = a.u(this.options);
a.p(n), this.T(l), this._$AH = a;
}
}
_$AC(e) {
let n = wa.get(e.strings);
return n === void 0 && wa.set(e.strings, n = new li(e)), n;
}
k(e) {
Qs(this._$AH) || (this._$AH = [], this._$AR());
const n = this._$AH;
let i, o = 0;
for (const r of e)
o === n.length ? n.push(i = new Vi(this.S(ai()), this.S(ai()), this, this.options)) : i = n[o], i._$AI(r), o++;
o < n.length && (this._$AR(i && i._$AB.nextSibling, o), n.length = o);
}
_$AR(e = this._$AA.nextSibling, n) {
var i;
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, n); e && e !== this._$AB; ) {
const o = e.nextSibling;
e.remove(), e = o;
}
}
setConnected(e) {
var n;
this._$AM === void 0 && (this._$Cv = e, (n = this._$AP) == null || n.call(this, e));
}
}
class Ir {
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
constructor(e, n, i, o, r) {
this.type = 1, this._$AH = Ee, this._$AN = void 0, this.element = e, this.name = n, this._$AM = o, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = Ee;
}
_$AI(e, n = this, i, o) {
const r = this.strings;
let a = !1;
if (r === void 0)
e = Pn(this, e, n, 0), a = !si(e) || e !== this._$AH && e !== ut, a && (this._$AH = e);
else {
const l = e;
let u, s;
for (e = r[0], u = 0; u < r.length - 1; u++)
s = Pn(this, l[i + u], n, u), s === ut && (s = this._$AH[u]), a || (a = !si(s) || s !== this._$AH[u]), s === Ee ? e = Ee : e !== Ee && (e += (s ?? "") + r[u + 1]), this._$AH[u] = s;
}
a && !o && this.j(e);
}
j(e) {
e === Ee ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
}
}
class ld extends Ir {
constructor() {
super(...arguments), this.type = 3;
}
j(e) {
this.element[this.name] = e === Ee ? void 0 : e;
}
}
let ud = class extends Ir {
constructor() {
super(...arguments), this.type = 4;
}
j(e) {
this.element.toggleAttribute(this.name, !!e && e !== Ee);
}
};
class dd extends Ir {
constructor(e, n, i, o, r) {
super(e, n, i, o, r), this.type = 5;
}
_$AI(e, n = this) {
if ((e = Pn(this, e, n, 0) ?? Ee) === ut)
return;
const i = this._$AH, o = e === Ee && i !== Ee || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, r = e !== Ee && (i === Ee || o);
o && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
}
handleEvent(e) {
var n;
typeof this._$AH == "function" ? this._$AH.call(((n = this.options) == null ? void 0 : n.host) ?? this.element, e) : this._$AH.handleEvent(e);
}
}
class cd {
constructor(e, n, i) {
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = n, this.options = i;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(e) {
Pn(this, e);
}
}
const Vr = Yn.litHtmlPolyfillSupport;
Vr == null || Vr(li, Vi), (Yn.litHtmlVersions ?? (Yn.litHtmlVersions = [])).push("3.1.3");
const pd = (t, e, n) => {
const i = (n == null ? void 0 : n.renderBefore) ?? e;
let o = i._$litPart$;
if (o === void 0) {
const r = (n == null ? void 0 : n.renderBefore) ?? null;
i._$litPart$ = o = new Vi(e.insertBefore(ai(), r), r, void 0, n ?? {});
}
return o._$AI(t), o;
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
let Zn = class extends kn {
constructor() {
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
}
createRenderRoot() {
var n;
const e = super.createRenderRoot();
return (n = this.renderOptions).renderBefore ?? (n.renderBefore = e.firstChild), e;
}
update(e) {
const n = this.render();
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = pd(n, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var e;
super.connectedCallback(), (e = this._$Do) == null || e.setConnected(!0);
}
disconnectedCallback() {
var e;
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
}
render() {
return ut;
}
};
var Ks;
Zn._$litElement$ = !0, Zn.finalized = !0, (Ks = globalThis.litElementHydrateSupport) == null || Ks.call(globalThis, { LitElement: Zn });
const Hr = globalThis.litElementPolyfillSupport;
Hr == null || Hr({ LitElement: Zn });
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.5");
var hd = J`
:host(:not(:focus-within)) {
position: absolute !important;
width: 1px !important;
height: 1px !important;
clip: rect(0 0 0 0) !important;
clip-path: inset(50%) !important;
border: none !important;
overflow: hidden !important;
white-space: nowrap !important;
padding: 0 !important;
}
`, Q = J`
:host {
box-sizing: border-box;
}
:host *,
:host *::before,
:host *::after {
box-sizing: inherit;
}
[hidden] {
display: none !important;
}
`;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const fd = { attribute: !0, type: String, converter: In, reflect: !1, hasChanged: Vo }, md = (t = fd, e, n) => {
const { kind: i, metadata: o } = n;
let r = globalThis.litPropertyMetadata.get(o);
if (r === void 0 && globalThis.litPropertyMetadata.set(o, r = /* @__PURE__ */ new Map()), r.set(n.name, t), i === "accessor") {
const { name: a } = n;
return { set(l) {
const u = e.get.call(this);
e.set.call(this, l), this.requestUpdate(a, u, t);
}, init(l) {
return l !== void 0 && this.P(a, void 0, t), l;
} };
}
if (i === "setter") {
const { name: a } = n;
return function(l) {
const u = this[a];
e.call(this, l), this.requestUpdate(a, u, t);
};
}
throw Error("Unsupported decorator location: " + i);
};
function b(t) {
return (e, n) => typeof n == "object" ? md(t, e, n) : ((i, o, r) => {
const a = o.hasOwnProperty(r);
return o.constructor.createProperty(r, a ? { ...i, wrapped: !0 } : i), a ? Object.getOwnPropertyDescriptor(o, r) : void 0;
})(t, e, n);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function ne(t) {
return b({ ...t, state: !0, attribute: !1 });
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function Ho(t) {
return (e, n) => {
const i = typeof e == "function" ? e : e[n];
Object.assign(i, t);
};
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const ro = (t, e, n) => (n.configurable = !0, n.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(t, e, n), n);
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function K(t, e) {
return (n, i, o) => {
const r = (a) => {
var l;
return ((l = a.renderRoot) == null ? void 0 : l.querySelector(t)) ?? null;
};
if (e) {
const { get: a, set: l } = typeof i == "object" ? n : o ?? (() => {
const u = Symbol();
return { get() {
return this[u];
}, set(s) {
this[u] = s;
} };
})();
return ro(n, i, { get() {
let u = a.call(this);
return u === void 0 && (u = r(this), (u !== null || this.hasUpdated) && l.call(this, u)), u;
} });
}
return ro(n, i, { get() {
return r(this);
} });
};
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function gd(t) {
return (e, n) => ro(e, n, { async get() {
var i;
return await this.updateComplete, ((i = this.renderRoot) == null ? void 0 : i.querySelector(t)) ?? null;
} });
}
var Z = class extends Zn {
constructor() {
super(), Object.entries(this.constructor.dependencies).forEach(([t, e]) => {
this.constructor.define(t, e);
});
}
emit(t, e) {
const n = new CustomEvent(t, Nt({
bubbles: !0,
cancelable: !1,
composed: !0,
detail: {}
}, e));
return this.dispatchEvent(n), n;
}
/* eslint-enable */
static define(t, e = this, n = {}) {
const i = customElements.get(t);
if (!i) {
customElements.define(t, class extends e {
}, n);
return;
}
let o = " (unknown version)", r = o;
"version" in e && e.version && (o = " v" + e.version), "version" in i && i.version && (r = " v" + i.version), !(o && r && o === r) && console.warn(
`Attempted to register <${t}>${o}, but <${t}>${r} has already been registered.`
);
}
};
Z.version = "2.15.0";
Z.dependencies = {};
c([
b()
], Z.prototype, "dir", 2);
c([
b()
], Z.prototype, "lang", 2);
var jo = class extends Z {
render() {
return A` <slot></slot> `;
}
};
jo.styles = [Q, hd];
jo.define("sl-visually-hidden");
var bd = J`
:host {
--max-width: 20rem;
--hide-delay: 0ms;
--show-delay: 150ms;
display: contents;
}
.tooltip {
--arrow-size: var(--sl-tooltip-arrow-size);
--arrow-color: var(--sl-tooltip-background-color);
}
.tooltip::part(popup) {
z-index: var(--sl-z-index-tooltip);
}
.tooltip[placement^='top']::part(popup) {
transform-origin: bottom;
}
.tooltip[placement^='bottom']::part(popup) {
transform-origin: top;
}
.tooltip[placement^='left']::part(popup) {
transform-origin: right;
}
.tooltip[placement^='right']::part(popup) {
transform-origin: left;
}
.tooltip__body {
display: block;
width: max-content;
max-width: var(--max-width);
border-radius: var(--sl-tooltip-border-radius);
background-color: var(--sl-tooltip-background-color);
font-family: var(--sl-tooltip-font-family);
font-size: var(--sl-tooltip-font-size);
font-weight: var(--sl-tooltip-font-weight);
line-height: var(--sl-tooltip-line-height);
color: var(--sl-tooltip-color);
padding: var(--sl-tooltip-padding);
pointer-events: none;
user-select: none;
-webkit-user-select: none;
}
`, vd = J`
:host {
--arrow-color: var(--sl-color-neutral-1000);
--arrow-size: 6px;
/*
* These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant
* 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.
*/
--arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
--arrow-padding-offset: calc(var(--arrow-size-diagonal) - var(--arrow-size));
display: contents;
}
.popup {
position: absolute;
isolation: isolate;
max-width: var(--auto-size-available-width, none);
max-height: var(--auto-size-available-height, none);
}
.popup--fixed {
position: fixed;
}
.popup:not(.popup--active) {
display: none;
}
.popup__arrow {
position: absolute;
width: calc(var(--arrow-size-diagonal) * 2);
height: calc(var(--arrow-size-diagonal) * 2);
rotate: 45deg;
background: var(--arrow-color);
z-index: -1;
}
/* Hover bridge */
.popup-hover-bridge:not(.popup-hover-bridge--visible) {
display: none;
}
.popup-hover-bridge {
position: fixed;
z-index: calc(var(--sl-z-index-dropdown) - 1);
top: 0;
right: 0;
bottom: 0;
left: 0;
clip-path: polygon(
var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),
var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),
var(--hover-bridge-bottom-right-x, 0) var(--hover-bridge-bottom-right-y, 0),
var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
);
}
`;
const Qt = Math.min, lt = Math.max, mr = Math.round, er = Math.floor, en = (t) => ({
x: t,
y: t
}), yd = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, wd = {
start: "end",
end: "start"
};
function oo(t, e, n) {
return lt(t, Qt(e, n));
}
function Mn(t, e) {
return typeof t == "function" ? t(e) : t;
}
function tn(t) {
return t.split("-")[0];
}
function $n(t) {
return t.split("-")[1];
}
function nl(t) {
return t === "x" ? "y" : "x";
}
function No(t) {
return t === "y" ? "height" : "width";
}
function Hi(t) {
return ["top", "bottom"].includes(tn(t)) ? "y" : "x";
}
function Ko(t) {
return nl(Hi(t));
}
function Cd(t, e, n) {
n === void 0 && (n = !1);
const i = $n(t), o = Ko(t), r = No(o);
let a = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
return e.reference[r] > e.floating[r] && (a = gr(a)), [a, gr(a)];
}
function Sd(t) {
const e = gr(t);
return [ao(t), e, ao(e)];
}
function ao(t) {
return t.replace(/start|end/g, (e) => wd[e]);
}
function kd(t, e, n) {
const i = ["left", "right"], o = ["right", "left"], r = ["top", "bottom"], a = ["bottom", "top"];
switch (t) {
case "top":
case "bottom":
return n ? e ? o : i : e ? i : o;
case "left":
case "right":
return e ? r : a;
default:
return [];
}
}
function xd(t, e, n, i) {
const o = $n(t);
let r = kd(tn(t), n === "start", i);
return o && (r = r.map((a) => a + "-" + o), e && (r = r.concat(r.map(ao)))), r;
}
function gr(t) {
return t.replace(/left|right|bottom|top/g, (e) => yd[e]);
}
function Od(t) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...t
};
}
function il(t) {
return typeof t != "number" ? Od(t) : {
top: t,
right: t,
bottom: t,
left: t
};
}
function br(t) {
return {
...t,
top: t.y,
left: t.x,
right: t.x + t.width,
bottom: t.y + t.height
};
}
function Ca(t, e, n) {
let {
reference: i,
floating: o
} = t;
const r = Hi(e), a = Ko(e), l = No(a), u = tn(e), s = r === "y", f = i.x + i.width / 2 - o.width / 2, d = i.y + i.height / 2 - o.height / 2, h = i[l] / 2 - o[l] / 2;
let p;
switch (u) {
case "top":
p = {
x: f,
y: i.y - o.height
};
break;
case "bottom":
p = {
x: f,
y: i.y + i.height
};
break;
case "right":
p = {
x: i.x + i.width,
y: d
};
break;
case "left":
p = {
x: i.x - o.width,
y: d
};
break;
default:
p = {
x: i.x,
y: i.y
};
}
switch ($n(e)) {
case "start":
p[a] -= h * (n && s ? -1 : 1);
break;
case "end":
p[a] += h * (n && s ? -1 : 1);
break;
}
return p;
}
const Id = async (t, e, n) => {
const {
placement: i = "bottom",
strategy: o = "absolute",
middleware: r = [],
platform: a
} = n, l = r.filter(Boolean), u = await (a.isRTL == null ? void 0 : a.isRTL(e));
let s = await a.getElementRects({
reference: t,
floating: e,
strategy: o
}), {
x: f,
y: d
} = Ca(s, i, u), h = i, p = {}, g = 0;
for (let v = 0; v < l.length; v++) {
const {
name: w,
fn: O
} = l[v], {
x: S,
y: I,
data: k,
reset: _
} = await O({
x: f,
y: d,
initialPlacement: i,
placement: h,
strategy: o,
middlewareData: p,
rects: s,
platform: a,
elements: {
reference: t,
floating: e
}
});
f = S ?? f, d = I ?? d, p = {
...p,
[w]: {
...p[w],
...k
}
}, _ && g <= 50 && (g++, typeof _ == "object" && (_.placement && (h = _.placement), _.rects && (s = _.rects === !0 ? await a.getElementRects({
reference: t,
floating: e,
strategy: o
}) : _.rects), {
x: f,
y: d
} = Ca(s, h, u)), v = -1);
}
return {
x: f,
y: d,
placement: h,
strategy: o,
middlewareData: p
};
};
async function Uo(t, e) {
var n;
e === void 0 && (e = {});
const {
x: i,
y: o,
platform: r,
rects: a,
elements: l,
strategy: u
} = t, {
boundary: s = "clippingAncestors",
rootBoundary: f = "viewport",
elementContext: d = "floating",
altBoundary: h = !1,
padding: p = 0
} = Mn(e, t), g = il(p), w = l[h ? d === "floating" ? "reference" : "floating" : d], O = br(await r.getClippingRect({
element: (n = await (r.isElement == null ? void 0 : r.isElement(w))) == null || n ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(l.floating)),
boundary: s,
rootBoundary: f,
strategy: u
})), S = d === "floating" ? {
...a.floating,
x: i,
y: o
} : a.reference, I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l.floating)), k = await (r.isElement == null ? void 0 : r.isElement(I)) ? await (r.getScale == null ? void 0 : r.getScale(I)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, _ = br(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: l,
rect: S,
offsetParent: I,
strategy: u
}) : S);
return {
top: (O.top - _.top + g.top) / k.y,
bottom: (_.bottom - O.bottom + g.bottom) / k.y,
left: (O.left - _.left + g.left) / k.x,
right: (_.right - O.right + g.right) / k.x
};
}
const Pd = (t) => ({
name: "arrow",
options: t,
async fn(e) {
const {
x: n,
y: i,
placement: o,
rects: r,
platform: a,
elements: l,
middlewareData: u
} = e, {
element: s,
padding: f = 0
} = Mn(t, e) || {};
if (s == null)
return {};
const d = il(f), h = {
x: n,
y: i
}, p = Ko(o), g = No(p), v = await a.getDimensions(s), w = p === "y", O = w ? "top" : "left", S = w ? "bottom" : "right", I = w ? "clientHeight" : "clientWidth", k = r.reference[g] + r.reference[p] - h[p] - r.floating[g], _ = h[p] - r.reference[p], L = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(s));
let z = L ? L[I] : 0;
(!z || !await (a.isElement == null ? void 0 : a.isElement(L))) && (z = l.floating[I] || r.floating[g]);
const B = k / 2 - _ / 2, H = z / 2 - v[g] / 2 - 1, V = Qt(d[O], H), ee = Qt(d[S], H), E = V, U = z - v[g] - ee, G = z / 2 - v[g] / 2 + B, oe = oo(E, G, U), me = !u.arrow && $n(o) != null && G !== oe && r.reference[g] / 2 - (G < E ? V : ee) - v[g] / 2 < 0, Ie = me ? G < E ? G - E : G - U : 0;
return {
[p]: h[p] + Ie,
data: {
[p]: oe,
centerOffset: G - oe - Ie,
...me && {
alignmentOffset: Ie
}
},
reset: me
};
}
}), Td = function(t) {
return t === void 0 && (t = {}), {
name: "flip",
options: t,
async fn(e) {
var n, i;
const {
placement: o,
middlewareData: r,
rects: a,
initialPlacement: l,
platform: u,
elements: s
} = e, {
mainAxis: f = !0,
crossAxis: d = !0,
fallbackPlacements: h,
fallbackStrategy: p = "bestFit",
fallbackAxisSideDirection: g = "none",
flipAlignment: v = !0,
...w
} = Mn(t, e);
if ((n = r.arrow) != null && n.alignmentOffset)
return {};
const O = tn(o), S = tn(l) === l, I = await (u.isRTL == null ? void 0 : u.isRTL(s.floating)), k = h || (S || !v ? [gr(l)] : Sd(l));
!h && g !== "none" && k.push(...xd(l, v, g, I));
const _ = [l, ...k], L = await Uo(e, w), z = [];
let B = ((i = r.flip) == null ? void 0 : i.overflows) || [];
if (f && z.push(L[O]), d) {
const E = Cd(o, a, I);
z.push(L[E[0]], L[E[1]]);
}
if (B = [...B, {
placement: o,
overflows: z
}], !z.every((E) => E <= 0)) {
var H, V;
const E = (((H = r.flip) == null ? void 0 : H.index) || 0) + 1, U = _[E];
if (U)
return {
data: {
index: E,
overflows: B
},
reset: {
placement: U
}
};
let G = (V = B.filter((oe) => oe.overflows[0] <= 0).sort((oe, me) => oe.overflows[1] - me.overflows[1])[0]) == null ? void 0 : V.placement;
if (!G)
switch (p) {
case "bestFit": {
var ee;
const oe = (ee = B.map((me) => [me.placement, me.overflows.filter((Ie) => Ie > 0).reduce((Ie, Ft) => Ie + Ft, 0)]).sort((me, Ie) => me[1] - Ie[1])[0]) == null ? void 0 : ee[0];
oe && (G = oe);
break;
}
case "initialPlacement":
G = l;
break;
}
if (o !== G)
return {
reset: {
placement: G
}
};
}
return {};
}
};
};
async function _d(t, e) {
const {
placement: n,
platform: i,
elements: o
} = t, r = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), a = tn(n), l = $n(n), u = Hi(n) === "y", s = ["left", "top"].includes(a) ? -1 : 1, f = r && u ? -1 : 1, d = Mn(e, t);
let {
mainAxis: h,
crossAxis: p,
alignmentAxis: g
} = typeof d == "number" ? {
mainAxis: d,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: 0,
crossAxis: 0,
alignmentAxis: null,
...d
};
return l && typeof g == "number" && (p = l === "end" ? g * -1 : g), u ? {
x: p * f,
y: h * s
} : {
x: h * s,
y: p * f
};
}
const Ed = function(t) {
return t === void 0 && (t = 0), {
name: "offset",
options: t,
async fn(e) {
var n, i;
const {
x: o,
y: r,
placement: a,
middlewareData: l
} = e, u = await _d(e, t);
return a === ((n = l.offset) == null ? void 0 : n.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
x: o + u.x,
y: r + u.y,
data: {
...u,
placement: a
}
};
}
};
}, Md = function(t) {
return t === void 0 && (t = {}), {
name: "shift",
options: t,
async fn(e) {
const {
x: n,
y: i,
placement: o
} = e, {
mainAxis: r = !0,
crossAxis: a = !1,
limiter: l = {
fn: (w) => {
let {
x: O,
y: S
} = w;
return {
x: O,
y: S
};
}
},
...u
} = Mn(t, e), s = {
x: n,
y: i
}, f = await Uo(e, u), d = Hi(tn(o)), h = nl(d);
let p = s[h], g = s[d];
if (r) {
const w = h === "y" ? "top" : "left", O = h === "y" ? "bottom" : "right", S = p + f[w], I = p - f[O];
p = oo(S, p, I);
}
if (a) {
const w = d === "y" ? "top" : "left", O = d === "y" ? "bottom" : "right", S = g + f[w], I = g - f[O];
g = oo(S, g, I);
}
const v = l.fn({
...e,
[h]: p,
[d]: g
});
return {
...v,
data: {
x: v.x - n,
y: v.y - i
}
};
}
};
}, $d = function(t) {
return t === void 0 &&