@headless-primitives/field
Advanced tools
+198
-188
| var R = globalThis, j = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), F = /* @__PURE__ */ new WeakMap(), _t = class { | ||
| constructor(t, e, i) { | ||
| if (this._$cssResult$ = !0, i !== ht) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| constructor(t, e, s) { | ||
| if (this._$cssResult$ = !0, s !== ht) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); | ||
| this.cssText = t, this.t = e; | ||
@@ -9,4 +9,4 @@ } | ||
| if (j && t === void 0) { | ||
| let i = e !== void 0 && e.length === 1; | ||
| i && (t = F.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && F.set(e, t)); | ||
| let s = e !== void 0 && e.length === 1; | ||
| s && (t = F.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && F.set(e, t)); | ||
| } | ||
@@ -19,16 +19,16 @@ return t; | ||
| }, At = (t) => new _t(typeof t == "string" ? t : t + "", void 0, ht), mt = (t, e) => { | ||
| if (j) t.adoptedStyleSheets = e.map((i) => i instanceof CSSStyleSheet ? i : i.styleSheet); | ||
| else for (let i of e) { | ||
| let s = document.createElement("style"), r = R.litNonce; | ||
| r !== void 0 && s.setAttribute("nonce", r), s.textContent = i.cssText, t.appendChild(s); | ||
| if (j) t.adoptedStyleSheets = e.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet); | ||
| else for (let s of e) { | ||
| let i = document.createElement("style"), r = R.litNonce; | ||
| r !== void 0 && i.setAttribute("nonce", r), i.textContent = s.cssText, t.appendChild(i); | ||
| } | ||
| }, W = j ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => { | ||
| let i = ""; | ||
| for (let s of e.cssRules) i += s.cssText; | ||
| return At(i); | ||
| })(t) : t, { is: yt, defineProperty: gt, getOwnPropertyDescriptor: bt, getOwnPropertyNames: vt, getOwnPropertySymbols: Et, getPrototypeOf: St } = Object, N = globalThis, J = N.trustedTypes, Ct = J ? J.emptyScript : "", wt = N.reactiveElementPolyfillSupport, E = (t, e) => t, D = { | ||
| let s = ""; | ||
| for (let i of e.cssRules) s += i.cssText; | ||
| return At(s); | ||
| })(t) : t, { is: bt, defineProperty: yt, getOwnPropertyDescriptor: gt, getOwnPropertyNames: vt, getOwnPropertySymbols: Et, getPrototypeOf: Ct } = Object, k = globalThis, J = k.trustedTypes, St = J ? J.emptyScript : "", wt = k.reactiveElementPolyfillSupport, E = (t, e) => t, D = { | ||
| toAttribute(t, e) { | ||
| switch (e) { | ||
| case Boolean: | ||
| t = t ? Ct : null; | ||
| t = t ? St : null; | ||
| break; | ||
@@ -42,9 +42,9 @@ case Object: | ||
| fromAttribute(t, e) { | ||
| let i = t; | ||
| let s = t; | ||
| switch (e) { | ||
| case Boolean: | ||
| i = t !== null; | ||
| s = t !== null; | ||
| break; | ||
| case Number: | ||
| i = t === null ? null : Number(t); | ||
| s = t === null ? null : Number(t); | ||
| break; | ||
@@ -54,10 +54,10 @@ case Object: | ||
| try { | ||
| i = JSON.parse(t); | ||
| s = JSON.parse(t); | ||
| } catch { | ||
| i = null; | ||
| s = null; | ||
| } | ||
| } | ||
| return i; | ||
| return s; | ||
| } | ||
| }, at = (t, e) => !yt(t, e), K = { | ||
| }, at = (t, e) => !bt(t, e), K = { | ||
| attribute: !0, | ||
@@ -70,4 +70,4 @@ type: String, | ||
| }; | ||
| Symbol.metadata ??= Symbol("metadata"), N.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| var y = class extends HTMLElement { | ||
| Symbol.metadata ??= Symbol("metadata"), k.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); | ||
| var b = class extends HTMLElement { | ||
| static addInitializer(t) { | ||
@@ -81,20 +81,20 @@ this._$Ei(), (this.l ??= []).push(t); | ||
| if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) { | ||
| let i = Symbol(), s = this.getPropertyDescriptor(t, i, e); | ||
| s !== void 0 && gt(this.prototype, t, s); | ||
| let s = Symbol(), i = this.getPropertyDescriptor(t, s, e); | ||
| i !== void 0 && yt(this.prototype, t, i); | ||
| } | ||
| } | ||
| static getPropertyDescriptor(t, e, i) { | ||
| let { get: s, set: r } = bt(this.prototype, t) ?? { | ||
| static getPropertyDescriptor(t, e, s) { | ||
| let { get: i, set: r } = gt(this.prototype, t) ?? { | ||
| get() { | ||
| return this[e]; | ||
| }, | ||
| set(n) { | ||
| this[e] = n; | ||
| set(o) { | ||
| this[e] = o; | ||
| } | ||
| }; | ||
| return { | ||
| get: s, | ||
| set(n) { | ||
| let o = s?.call(this); | ||
| r?.call(this, n), this.requestUpdate(t, o, i); | ||
| get: i, | ||
| set(o) { | ||
| let n = i?.call(this); | ||
| r?.call(this, o), this.requestUpdate(t, n, s); | ||
| }, | ||
@@ -110,3 +110,3 @@ configurable: !0, | ||
| if (this.hasOwnProperty(E("elementProperties"))) return; | ||
| let t = St(this); | ||
| let t = Ct(this); | ||
| t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); | ||
@@ -117,4 +117,4 @@ } | ||
| if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(E("properties"))) { | ||
| let e = this.properties, i = [...vt(e), ...Et(e)]; | ||
| for (let s of i) this.createProperty(s, e[s]); | ||
| let e = this.properties, s = [...vt(e), ...Et(e)]; | ||
| for (let i of s) this.createProperty(i, e[i]); | ||
| } | ||
@@ -124,8 +124,8 @@ let t = this[Symbol.metadata]; | ||
| let e = litPropertyMetadata.get(t); | ||
| if (e !== void 0) for (let [i, s] of e) this.elementProperties.set(i, s); | ||
| if (e !== void 0) for (let [s, i] of e) this.elementProperties.set(s, i); | ||
| } | ||
| this._$Eh = /* @__PURE__ */ new Map(); | ||
| for (let [e, i] of this.elementProperties) { | ||
| let s = this._$Eu(e, i); | ||
| s !== void 0 && this._$Eh.set(s, e); | ||
| for (let [e, s] of this.elementProperties) { | ||
| let i = this._$Eu(e, s); | ||
| i !== void 0 && this._$Eh.set(i, e); | ||
| } | ||
@@ -137,4 +137,4 @@ this.elementStyles = this.finalizeStyles(this.styles); | ||
| if (Array.isArray(t)) { | ||
| let i = new Set(t.flat(1 / 0).reverse()); | ||
| for (let s of i) e.unshift(W(s)); | ||
| let s = new Set(t.flat(1 / 0).reverse()); | ||
| for (let i of s) e.unshift(W(i)); | ||
| } else t !== void 0 && e.push(W(t)); | ||
@@ -144,4 +144,4 @@ return e; | ||
| static _$Eu(t, e) { | ||
| let i = e.attribute; | ||
| return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0; | ||
| let s = e.attribute; | ||
| return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0; | ||
| } | ||
@@ -162,3 +162,3 @@ constructor() { | ||
| let t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties; | ||
| for (let i of e.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]); | ||
| for (let s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]); | ||
| t.size > 0 && (this._$Ep = t); | ||
@@ -178,31 +178,31 @@ } | ||
| } | ||
| attributeChangedCallback(t, e, i) { | ||
| this._$AK(t, i); | ||
| attributeChangedCallback(t, e, s) { | ||
| this._$AK(t, s); | ||
| } | ||
| _$ET(t, e) { | ||
| let i = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, i); | ||
| if (s !== void 0 && i.reflect === !0) { | ||
| let r = (i.converter?.toAttribute === void 0 ? D : i.converter).toAttribute(e, i.type); | ||
| this._$Em = t, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null; | ||
| let s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s); | ||
| if (i !== void 0 && s.reflect === !0) { | ||
| let r = (s.converter?.toAttribute === void 0 ? D : s.converter).toAttribute(e, s.type); | ||
| this._$Em = t, r == null ? this.removeAttribute(i) : this.setAttribute(i, r), this._$Em = null; | ||
| } | ||
| } | ||
| _$AK(t, e) { | ||
| let i = this.constructor, s = i._$Eh.get(t); | ||
| if (s !== void 0 && this._$Em !== s) { | ||
| let r = i.getPropertyOptions(s), n = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute === void 0 ? D : r.converter; | ||
| this._$Em = s; | ||
| let o = n.fromAttribute(e, r.type); | ||
| this[s] = o ?? this._$Ej?.get(s) ?? o, this._$Em = null; | ||
| let s = this.constructor, i = s._$Eh.get(t); | ||
| if (i !== void 0 && this._$Em !== i) { | ||
| let r = s.getPropertyOptions(i), o = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute === void 0 ? D : r.converter; | ||
| this._$Em = i; | ||
| let n = o.fromAttribute(e, r.type); | ||
| this[i] = n ?? this._$Ej?.get(i) ?? n, this._$Em = null; | ||
| } | ||
| } | ||
| requestUpdate(t, e, i, s = !1, r) { | ||
| requestUpdate(t, e, s, i = !1, r) { | ||
| if (t !== void 0) { | ||
| let n = this.constructor; | ||
| if (s === !1 && (r = this[t]), i ??= n.getPropertyOptions(t), !((i.hasChanged ?? at)(r, e) || i.useDefault && i.reflect && r === this._$Ej?.get(t) && !this.hasAttribute(n._$Eu(t, i)))) return; | ||
| this.C(t, e, i); | ||
| let o = this.constructor; | ||
| if (i === !1 && (r = this[t]), s ??= o.getPropertyOptions(t), !((s.hasChanged ?? at)(r, e) || s.useDefault && s.reflect && r === this._$Ej?.get(t) && !this.hasAttribute(o._$Eu(t, s)))) return; | ||
| this.C(t, e, s); | ||
| } | ||
| this.isUpdatePending === !1 && (this._$ES = this._$EP()); | ||
| } | ||
| C(t, e, { useDefault: i, reflect: s, wrapped: r }, n) { | ||
| i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), r !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), s === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); | ||
| C(t, e, { useDefault: s, reflect: i, wrapped: r }, o) { | ||
| s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); | ||
| } | ||
@@ -226,9 +226,9 @@ async _$EP() { | ||
| if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { | ||
| for (let [s, r] of this._$Ep) this[s] = r; | ||
| for (let [i, r] of this._$Ep) this[i] = r; | ||
| this._$Ep = void 0; | ||
| } | ||
| let i = this.constructor.elementProperties; | ||
| if (i.size > 0) for (let [s, r] of i) { | ||
| let { wrapped: n } = r, o = this[s]; | ||
| n !== !0 || this._$AL.has(s) || o === void 0 || this.C(s, void 0, r, o); | ||
| let s = this.constructor.elementProperties; | ||
| if (s.size > 0) for (let [i, r] of s) { | ||
| let { wrapped: o } = r, n = this[i]; | ||
| o !== !0 || this._$AL.has(i) || n === void 0 || this.C(i, void 0, r, n); | ||
| } | ||
@@ -238,5 +238,5 @@ } | ||
| try { | ||
| t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach((i) => i.hostUpdate?.()), this.update(e)) : this._$EM(); | ||
| } catch (i) { | ||
| throw t = !1, this._$EM(), i; | ||
| t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach((s) => s.hostUpdate?.()), this.update(e)) : this._$EM(); | ||
| } catch (s) { | ||
| throw t = !1, this._$EM(), s; | ||
| } | ||
@@ -270,6 +270,6 @@ t && this._$AE(e); | ||
| }; | ||
| y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[E("elementProperties")] = /* @__PURE__ */ new Map(), y[E("finalized")] = /* @__PURE__ */ new Map(), wt?.({ ReactiveElement: y }), (N.reactiveElementVersions ??= []).push("2.1.2"); | ||
| var z = globalThis, Z = (t) => t, M = z.trustedTypes, G = M ? M.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, dt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, ct = "?" + $, Ut = `<${ct}>`, m = document, C = () => m.createComment(""), w = (t) => t === null || typeof t != "object" && typeof t != "function", q = Array.isArray, Pt = (t) => q(t) || typeof t?.[Symbol.iterator] == "function", k = `[ | ||
| \f\r]`, v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, _ = RegExp(`>|${k}(?:([^\\s"'>=/]+)(${k}*=${k}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`, "g"), Y = /'/g, tt = /"/g, pt = /^(?:script|style|textarea|title)$/i, g = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), et = /* @__PURE__ */ new WeakMap(), A = m.createTreeWalker(m, 129); | ||
| b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[E("elementProperties")] = /* @__PURE__ */ new Map(), b[E("finalized")] = /* @__PURE__ */ new Map(), wt?.({ ReactiveElement: b }), (k.reactiveElementVersions ??= []).push("2.1.2"); | ||
| var z = globalThis, Z = (t) => t, M = z.trustedTypes, G = M ? M.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, dt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, ct = "?" + $, Ut = `<${ct}>`, m = document, S = () => m.createComment(""), w = (t) => t === null || typeof t != "object" && typeof t != "function", q = Array.isArray, Pt = (t) => q(t) || typeof t?.[Symbol.iterator] == "function", T = `[ | ||
| \f\r]`, v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, _ = RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`, "g"), Y = /'/g, tt = /"/g, pt = /^(?:script|style|textarea|title)$/i, y = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), et = /* @__PURE__ */ new WeakMap(), A = m.createTreeWalker(m, 129); | ||
| function ut(t, e) { | ||
@@ -280,16 +280,16 @@ if (!q(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array"); | ||
| var xt = (t, e) => { | ||
| let i = t.length - 1, s = [], r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = v; | ||
| for (let l = 0; l < i; l++) { | ||
| let s = t.length - 1, i = [], r, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = v; | ||
| for (let l = 0; l < s; l++) { | ||
| let h = t[l], H, p, a = -1, u = 0; | ||
| for (; u < h.length && (o.lastIndex = u, p = o.exec(h), p !== null); ) u = o.lastIndex, o === v ? p[1] === "!--" ? o = Q : p[1] === void 0 ? p[2] === void 0 ? p[3] !== void 0 && (o = _) : (pt.test(p[2]) && (r = RegExp("</" + p[2], "g")), o = _) : o = X : o === _ ? p[0] === ">" ? (o = r ?? v, a = -1) : p[1] === void 0 ? a = -2 : (a = o.lastIndex - p[2].length, H = p[1], o = p[3] === void 0 ? _ : p[3] === '"' ? tt : Y) : o === tt || o === Y ? o = _ : o === Q || o === X ? o = v : (o = _, r = void 0); | ||
| let f = o === _ && t[l + 1].startsWith("/>") ? " " : ""; | ||
| n += o === v ? h + Ut : a >= 0 ? (s.push(H), h.slice(0, a) + dt + h.slice(a) + $ + f) : h + $ + (a === -2 ? l : f); | ||
| for (; u < h.length && (n.lastIndex = u, p = n.exec(h), p !== null); ) u = n.lastIndex, n === v ? p[1] === "!--" ? n = Q : p[1] === void 0 ? p[2] === void 0 ? p[3] !== void 0 && (n = _) : (pt.test(p[2]) && (r = RegExp("</" + p[2], "g")), n = _) : n = X : n === _ ? p[0] === ">" ? (n = r ?? v, a = -1) : p[1] === void 0 ? a = -2 : (a = n.lastIndex - p[2].length, H = p[1], n = p[3] === void 0 ? _ : p[3] === '"' ? tt : Y) : n === tt || n === Y ? n = _ : n === Q || n === X ? n = v : (n = _, r = void 0); | ||
| let f = n === _ && t[l + 1].startsWith("/>") ? " " : ""; | ||
| o += n === v ? h + Ut : a >= 0 ? (i.push(H), h.slice(0, a) + dt + h.slice(a) + $ + f) : h + $ + (a === -2 ? l : f); | ||
| } | ||
| return [ut(t, n + (t[i] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s]; | ||
| return [ut(t, o + (t[s] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i]; | ||
| }, L = class ft { | ||
| constructor({ strings: e, _$litType$: i }, s) { | ||
| constructor({ strings: e, _$litType$: s }, i) { | ||
| let r; | ||
| this.parts = []; | ||
| let n = 0, o = 0, l = e.length - 1, h = this.parts, [H, p] = xt(e, i); | ||
| if (this.el = ft.createElement(H, s), A.currentNode = this.el.content, i === 2 || i === 3) { | ||
| let o = 0, n = 0, l = e.length - 1, h = this.parts, [H, p] = xt(e, s); | ||
| if (this.el = ft.createElement(H, i), A.currentNode = this.el.content, s === 2 || s === 3) { | ||
| let a = this.el.content.firstChild; | ||
@@ -301,13 +301,13 @@ a.replaceWith(...a.childNodes); | ||
| if (r.hasAttributes()) for (let a of r.getAttributeNames()) if (a.endsWith(dt)) { | ||
| let u = p[o++], f = r.getAttribute(a).split($), O = /([.?@])?(.*)/.exec(u); | ||
| let u = p[n++], f = r.getAttribute(a).split($), O = /([.?@])?(.*)/.exec(u); | ||
| h.push({ | ||
| type: 1, | ||
| index: n, | ||
| index: o, | ||
| name: O[2], | ||
| strings: f, | ||
| ctor: O[1] === "." ? Ot : O[1] === "?" ? Rt : O[1] === "@" ? Mt : T | ||
| ctor: O[1] === "." ? Ot : O[1] === "?" ? Rt : O[1] === "@" ? Mt : N | ||
| }), r.removeAttribute(a); | ||
| } else a.startsWith($) && (h.push({ | ||
| type: 6, | ||
| index: n | ||
| index: o | ||
| }), r.removeAttribute(a)); | ||
@@ -318,7 +318,7 @@ if (pt.test(r.tagName)) { | ||
| r.textContent = M ? M.emptyScript : ""; | ||
| for (let f = 0; f < u; f++) r.append(a[f], C()), A.nextNode(), h.push({ | ||
| for (let f = 0; f < u; f++) r.append(a[f], S()), A.nextNode(), h.push({ | ||
| type: 2, | ||
| index: ++n | ||
| index: ++o | ||
| }); | ||
| r.append(a[u], C()); | ||
| r.append(a[u], S()); | ||
| } | ||
@@ -328,3 +328,3 @@ } | ||
| type: 2, | ||
| index: n | ||
| index: o | ||
| }); | ||
@@ -335,17 +335,17 @@ else { | ||
| type: 7, | ||
| index: n | ||
| index: o | ||
| }), a += $.length - 1; | ||
| } | ||
| n++; | ||
| o++; | ||
| } | ||
| } | ||
| static createElement(e, i) { | ||
| let s = m.createElement("template"); | ||
| return s.innerHTML = e, s; | ||
| static createElement(e, s) { | ||
| let i = m.createElement("template"); | ||
| return i.innerHTML = e, i; | ||
| } | ||
| }; | ||
| function b(t, e, i = t, s) { | ||
| if (e === g) return e; | ||
| let r = s === void 0 ? i._$Cl : i._$Co?.[s], n = w(e) ? void 0 : e._$litDirective$; | ||
| return r?.constructor !== n && (r?._$AO?.(!1), n === void 0 ? r = void 0 : (r = new n(t), r._$AT(t, i, s)), s === void 0 ? i._$Cl = r : (i._$Co ??= [])[s] = r), r !== void 0 && (e = b(t, r._$AS(t, e.values), r, s)), e; | ||
| function g(t, e, s = t, i) { | ||
| if (e === y) return e; | ||
| let r = i === void 0 ? s._$Cl : s._$Co?.[i], o = w(e) ? void 0 : e._$litDirective$; | ||
| return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(t), r._$AT(t, s, i)), i === void 0 ? s._$Cl = r : (s._$Co ??= [])[i] = r), r !== void 0 && (e = g(t, r._$AS(t, e.values), r, i)), e; | ||
| } | ||
@@ -363,17 +363,17 @@ var Ht = class { | ||
| u(t) { | ||
| let { el: { content: e }, parts: i } = this._$AD, s = (t?.creationScope ?? m).importNode(e, !0); | ||
| A.currentNode = s; | ||
| let r = A.nextNode(), n = 0, o = 0, l = i[0]; | ||
| let { el: { content: e }, parts: s } = this._$AD, i = (t?.creationScope ?? m).importNode(e, !0); | ||
| A.currentNode = i; | ||
| let r = A.nextNode(), o = 0, n = 0, l = s[0]; | ||
| for (; l !== void 0; ) { | ||
| if (n === l.index) { | ||
| if (o === l.index) { | ||
| let h; | ||
| l.type === 2 ? h = new B(r, r.nextSibling, this, t) : l.type === 1 ? h = new l.ctor(r, l.name, l.strings, this, t) : l.type === 6 && (h = new Nt(r, this, t)), this._$AV.push(h), l = i[++o]; | ||
| l.type === 2 ? h = new B(r, r.nextSibling, this, t) : l.type === 1 ? h = new l.ctor(r, l.name, l.strings, this, t) : l.type === 6 && (h = new kt(r, this, t)), this._$AV.push(h), l = s[++n]; | ||
| } | ||
| n !== l?.index && (r = A.nextNode(), n++); | ||
| o !== l?.index && (r = A.nextNode(), o++); | ||
| } | ||
| return A.currentNode = m, s; | ||
| return A.currentNode = m, i; | ||
| } | ||
| p(t) { | ||
| let e = 0; | ||
| for (let i of this._$AV) i !== void 0 && (i.strings === void 0 ? i._$AI(t[e]) : (i._$AI(t, i, e), e += i.strings.length - 2)), e++; | ||
| for (let s of this._$AV) s !== void 0 && (s.strings === void 0 ? s._$AI(t[e]) : (s._$AI(t, s, e), e += s.strings.length - 2)), e++; | ||
| } | ||
@@ -384,8 +384,8 @@ }, B = class $t { | ||
| } | ||
| constructor(e, i, s, r) { | ||
| this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = e, this._$AB = i, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0; | ||
| constructor(e, s, i, r) { | ||
| this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = e, this._$AB = s, this._$AM = i, this.options = r, this._$Cv = r?.isConnected ?? !0; | ||
| } | ||
| get parentNode() { | ||
| let e = this._$AA.parentNode, i = this._$AM; | ||
| return i !== void 0 && e?.nodeType === 11 && (e = i.parentNode), e; | ||
| let e = this._$AA.parentNode, s = this._$AM; | ||
| return s !== void 0 && e?.nodeType === 11 && (e = s.parentNode), e; | ||
| } | ||
@@ -398,4 +398,4 @@ get startNode() { | ||
| } | ||
| _$AI(e, i = this) { | ||
| e = b(this, e, i), w(e) ? e === d || e == null || e === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : e !== this._$AH && e !== g && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? Pt(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e); | ||
| _$AI(e, s = this) { | ||
| e = g(this, e, s), w(e) ? e === d || e == null || e === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : e !== this._$AH && e !== y && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? Pt(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e); | ||
| } | ||
@@ -412,23 +412,23 @@ O(e) { | ||
| $(e) { | ||
| let { values: i, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = L.createElement(ut(s.h, s.h[0]), this.options)), s); | ||
| if (this._$AH?._$AD === r) this._$AH.p(i); | ||
| let { values: s, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = L.createElement(ut(i.h, i.h[0]), this.options)), i); | ||
| if (this._$AH?._$AD === r) this._$AH.p(s); | ||
| else { | ||
| let n = new Ht(r, this), o = n.u(this.options); | ||
| n.p(i), this.T(o), this._$AH = n; | ||
| let o = new Ht(r, this), n = o.u(this.options); | ||
| o.p(s), this.T(n), this._$AH = o; | ||
| } | ||
| } | ||
| _$AC(e) { | ||
| let i = et.get(e.strings); | ||
| return i === void 0 && et.set(e.strings, i = new L(e)), i; | ||
| let s = et.get(e.strings); | ||
| return s === void 0 && et.set(e.strings, s = new L(e)), s; | ||
| } | ||
| k(e) { | ||
| q(this._$AH) || (this._$AH = [], this._$AR()); | ||
| let i = this._$AH, s, r = 0; | ||
| for (let n of e) r === i.length ? i.push(s = new $t(this.O(C()), this.O(C()), this, this.options)) : s = i[r], s._$AI(n), r++; | ||
| r < i.length && (this._$AR(s && s._$AB.nextSibling, r), i.length = r); | ||
| let s = this._$AH, i, r = 0; | ||
| for (let o of e) r === s.length ? s.push(i = new $t(this.O(S()), this.O(S()), this, this.options)) : i = s[r], i._$AI(o), r++; | ||
| r < s.length && (this._$AR(i && i._$AB.nextSibling, r), s.length = r); | ||
| } | ||
| _$AR(e = this._$AA.nextSibling, i) { | ||
| for (this._$AP?.(!1, !0, i); e !== this._$AB; ) { | ||
| let s = Z(e).nextSibling; | ||
| Z(e).remove(), e = s; | ||
| _$AR(e = this._$AA.nextSibling, s) { | ||
| for (this._$AP?.(!1, !0, s); e !== this._$AB; ) { | ||
| let i = Z(e).nextSibling; | ||
| Z(e).remove(), e = i; | ||
| } | ||
@@ -439,3 +439,3 @@ } | ||
| } | ||
| }, T = class { | ||
| }, N = class { | ||
| get tagName() { | ||
@@ -447,13 +447,13 @@ return this.element.tagName; | ||
| } | ||
| constructor(t, e, i, s, r) { | ||
| this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(/* @__PURE__ */ new String()), this.strings = i) : this._$AH = d; | ||
| constructor(t, e, s, i, r) { | ||
| this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(/* @__PURE__ */ new String()), this.strings = s) : this._$AH = d; | ||
| } | ||
| _$AI(t, e = this, i, s) { | ||
| let r = this.strings, n = !1; | ||
| if (r === void 0) t = b(this, t, e, 0), n = !w(t) || t !== this._$AH && t !== g, n && (this._$AH = t); | ||
| _$AI(t, e = this, s, i) { | ||
| let r = this.strings, o = !1; | ||
| if (r === void 0) t = g(this, t, e, 0), o = !w(t) || t !== this._$AH && t !== y, o && (this._$AH = t); | ||
| else { | ||
| let o = t, l, h; | ||
| for (t = r[0], l = 0; l < r.length - 1; l++) h = b(this, o[i + l], e, l), h === g && (h = this._$AH[l]), n ||= !w(h) || h !== this._$AH[l], h === d ? t = d : t !== d && (t += (h ?? "") + r[l + 1]), this._$AH[l] = h; | ||
| let n = t, l, h; | ||
| for (t = r[0], l = 0; l < r.length - 1; l++) h = g(this, n[s + l], e, l), h === y && (h = this._$AH[l]), o ||= !w(h) || h !== this._$AH[l], h === d ? t = d : t !== d && (t += (h ?? "") + r[l + 1]), this._$AH[l] = h; | ||
| } | ||
| n && !s && this.j(t); | ||
| o && !i && this.j(t); | ||
| } | ||
@@ -463,3 +463,3 @@ j(t) { | ||
| } | ||
| }, Ot = class extends T { | ||
| }, Ot = class extends N { | ||
| constructor() { | ||
@@ -471,3 +471,3 @@ super(...arguments), this.type = 3; | ||
| } | ||
| }, Rt = class extends T { | ||
| }, Rt = class extends N { | ||
| constructor() { | ||
@@ -479,10 +479,10 @@ super(...arguments), this.type = 4; | ||
| } | ||
| }, Mt = class extends T { | ||
| constructor(t, e, i, s, r) { | ||
| super(t, e, i, s, r), this.type = 5; | ||
| }, Mt = class extends N { | ||
| constructor(t, e, s, i, r) { | ||
| super(t, e, s, i, r), this.type = 5; | ||
| } | ||
| _$AI(t, e = this) { | ||
| if ((t = b(this, t, e, 0) ?? d) === g) return; | ||
| let i = this._$AH, s = t === d && i !== d || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== d && (i === d || s); | ||
| s && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
| if ((t = g(this, t, e, 0) ?? d) === y) return; | ||
| let s = this._$AH, i = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== d && (s === d || i); | ||
| i && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t; | ||
| } | ||
@@ -492,5 +492,5 @@ handleEvent(t) { | ||
| } | ||
| }, Nt = class { | ||
| constructor(t, e, i) { | ||
| this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i; | ||
| }, kt = class { | ||
| constructor(t, e, s) { | ||
| this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s; | ||
| } | ||
@@ -501,14 +501,14 @@ get _$AU() { | ||
| _$AI(t) { | ||
| b(this, t); | ||
| g(this, t); | ||
| } | ||
| }, Tt = z.litHtmlPolyfillSupport; | ||
| Tt?.(L, B), (z.litHtmlVersions ??= []).push("3.3.2"); | ||
| var kt = (t, e, i) => { | ||
| let s = i?.renderBefore ?? e, r = s._$litPart$; | ||
| }, Nt = z.litHtmlPolyfillSupport; | ||
| Nt?.(L, B), (z.litHtmlVersions ??= []).push("3.3.2"); | ||
| var Tt = (t, e, s) => { | ||
| let i = s?.renderBefore ?? e, r = i._$litPart$; | ||
| if (r === void 0) { | ||
| let n = i?.renderBefore ?? null; | ||
| s._$litPart$ = r = new B(e.insertBefore(C(), n), n, void 0, i ?? {}); | ||
| let o = s?.renderBefore ?? null; | ||
| i._$litPart$ = r = new B(e.insertBefore(S(), o), o, void 0, s ?? {}); | ||
| } | ||
| return r._$AI(t), r; | ||
| }, V = globalThis, S = class extends y { | ||
| }, V = globalThis, C = class extends b { | ||
| constructor() { | ||
@@ -523,3 +523,3 @@ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; | ||
| let e = this.render(); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions); | ||
| this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Tt(e, this.renderRoot, this.renderOptions); | ||
| } | ||
@@ -533,8 +533,8 @@ connectedCallback() { | ||
| render() { | ||
| return g; | ||
| return y; | ||
| } | ||
| }; | ||
| S._$litElement$ = !0, S.finalized = !0, V.litElementHydrateSupport?.({ LitElement: S }); | ||
| C._$litElement$ = !0, C.finalized = !0, V.litElementHydrateSupport?.({ LitElement: C }); | ||
| var It = V.litElementPolyfillSupport; | ||
| It?.({ LitElement: S }), (V.litElementVersions ??= []).push("4.2.2"); | ||
| It?.({ LitElement: C }), (V.litElementVersions ??= []).push("4.2.2"); | ||
| var c = []; | ||
@@ -553,11 +553,11 @@ for (let t = 0; t < 256; ++t) c.push((t + 256).toString(16).slice(1)); | ||
| } | ||
| var it = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) }; | ||
| function zt(t, e, i) { | ||
| var st = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) }; | ||
| function zt(t, e, s) { | ||
| t ||= {}; | ||
| let s = t.random ?? t.rng?.() ?? jt(); | ||
| if (s.length < 16) throw Error("Random bytes length must be >= 16"); | ||
| return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, Dt(s); | ||
| let i = t.random ?? t.rng?.() ?? jt(); | ||
| if (i.length < 16) throw Error("Random bytes length must be >= 16"); | ||
| return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Dt(i); | ||
| } | ||
| function qt(t, e, i) { | ||
| return it.randomUUID && !e && !t ? it.randomUUID() : zt(t, e); | ||
| function qt(t, e, s) { | ||
| return st.randomUUID && !e && !t ? st.randomUUID() : zt(t, e); | ||
| } | ||
@@ -567,3 +567,3 @@ function Bt(t = "hp") { | ||
| } | ||
| var U = class extends S { | ||
| var U = class extends C { | ||
| createRenderRoot() { | ||
@@ -573,3 +573,3 @@ return this; | ||
| emit(t, e) { | ||
| let i = new CustomEvent(`hp-${t}`, { | ||
| let s = new CustomEvent(`hp-${t}`, { | ||
| detail: e, | ||
@@ -580,3 +580,3 @@ bubbles: !0, | ||
| }); | ||
| return this.dispatchEvent(i), i; | ||
| return this.dispatchEvent(s), s; | ||
| } | ||
@@ -587,2 +587,12 @@ _hpId = Bt(); | ||
| } | ||
| _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; | ||
| } | ||
| }; | ||
@@ -594,8 +604,8 @@ function P(t) { | ||
| } | ||
| var Vt = Object.getOwnPropertyDescriptor, x = (t, e, i, s) => { | ||
| for (var r = s > 1 ? void 0 : s ? Vt(e, i) : e, n = t.length - 1, o; n >= 0; n--) | ||
| (o = t[n]) && (r = o(r) || r); | ||
| var Vt = Object.getOwnPropertyDescriptor, x = (t, e, s, i) => { | ||
| for (var r = i > 1 ? void 0 : i ? Vt(e, s) : e, o = t.length - 1, n; o >= 0; o--) | ||
| (n = t[o]) && (r = n(r) || r); | ||
| return r; | ||
| }; | ||
| let st = class extends U { | ||
| let it = class extends U { | ||
| get baseId() { | ||
@@ -611,5 +621,5 @@ return `hp-field-${this.hpId}`; | ||
| }; | ||
| st = x([ | ||
| it = x([ | ||
| P("hp-field") | ||
| ], st); | ||
| ], it); | ||
| let rt = class extends U { | ||
@@ -625,3 +635,3 @@ connectedCallback() { | ||
| ], rt); | ||
| let nt = class extends U { | ||
| let ot = class extends U { | ||
| connectedCallback() { | ||
@@ -633,6 +643,6 @@ super.connectedCallback(), this.setAttribute("data-hp-component", "field-description"); | ||
| }; | ||
| nt = x([ | ||
| ot = x([ | ||
| P("hp-field-description") | ||
| ], nt); | ||
| let ot = class extends U { | ||
| ], ot); | ||
| let nt = class extends U { | ||
| connectedCallback() { | ||
@@ -644,5 +654,5 @@ super.connectedCallback(), this.setAttribute("data-hp-component", "field-error"); | ||
| }; | ||
| ot = x([ | ||
| nt = x([ | ||
| P("hp-field-error") | ||
| ], ot); | ||
| ], nt); | ||
| let lt = class extends U { | ||
@@ -658,6 +668,6 @@ connectedCallback() { | ||
| e.id || (e.id = `${t.baseId}-control`); | ||
| const i = [], s = t.querySelector("hp-field-description"), r = t.querySelector("hp-field-error"); | ||
| s?.id && i.push(s.id), r?.id && i.push(r.id), i.length > 0 ? e.setAttribute("aria-describedby", i.join(" ")) : e.removeAttribute("aria-describedby"); | ||
| const n = t.querySelector("hp-field-label"); | ||
| n?.id && e.setAttribute("aria-labelledby", n.id); | ||
| const s = [], i = t.querySelector("hp-field-description"), r = t.querySelector("hp-field-error"); | ||
| i?.id && s.push(i.id), r?.id && s.push(r.id), s.length > 0 ? e.setAttribute("aria-describedby", s.join(" ")) : e.removeAttribute("aria-describedby"); | ||
| const o = t.querySelector("hp-field-label"); | ||
| o?.id && e.setAttribute("aria-labelledby", o.id); | ||
| } | ||
@@ -674,7 +684,7 @@ _findControl() { | ||
| export { | ||
| st as HeadlessField, | ||
| it as HeadlessField, | ||
| lt as HeadlessFieldControl, | ||
| nt as HeadlessFieldDescription, | ||
| ot as HeadlessFieldError, | ||
| ot as HeadlessFieldDescription, | ||
| nt as HeadlessFieldError, | ||
| rt as HeadlessFieldLabel | ||
| }; |
@@ -1,3 +0,3 @@ | ||
| (function(d,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(d=typeof globalThis<"u"?globalThis:d||self,$(d.HeadlessPrimitivesField={}))})(this,function(d){"use strict";var $=globalThis,I=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),J=new WeakMap,pt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(I&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=J.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&J.set(e,t))}return t}toString(){return this.cssText}},ut=t=>new pt(typeof t=="string"?t:t+"",void 0,W),ft=(t,e)=>{if(I)t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of e){let s=document.createElement("style"),r=$.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=i.cssText,t.appendChild(s)}},K=I?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let s of e.cssRules)i+=s.cssText;return ut(i)})(t):t,{is:$t,defineProperty:_t,getOwnPropertyDescriptor:mt,getOwnPropertyNames:At,getOwnPropertySymbols:yt,getPrototypeOf:gt}=Object,R=globalThis,Z=R.trustedTypes,bt=Z?Z.emptyScript:"",vt=R.reactiveElementPolyfillSupport,S=(t,e)=>t,D={toAttribute(t,e){switch(e){case Boolean:t=t?bt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},G=(t,e)=>!$t(t,e),Q={attribute:!0,type:String,converter:D,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol("metadata"),R.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Q){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&_t(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){let{get:s,set:r}=mt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:s,set(n){let o=s?.call(this);r?.call(this,n),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Q}static _$Ei(){if(this.hasOwnProperty(S("elementProperties")))return;let t=gt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(S("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(S("properties"))){let e=this.properties,i=[...At(e),...yt(e)];for(let s of i)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let s of i)e.unshift(K(s))}else t!==void 0&&e.push(K(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){let r=(i.converter?.toAttribute===void 0?D:i.converter).toAttribute(e,i.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){let i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let r=i.getPropertyOptions(s),n=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute===void 0?D:r.converter;this._$Em=s;let o=n.fromAttribute(e,r.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(t,e,i,s=!1,r){if(t!==void 0){let n=this.constructor;if(s===!1&&(r=this[t]),i??=n.getPropertyOptions(t),!((i.hasChanged??G)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),r!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,r]of i){let{wrapped:n}=r,o=this[s];n!==!0||this._$AL.has(s)||o===void 0||this.C(s,void 0,r,o)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[S("elementProperties")]=new Map,b[S("finalized")]=new Map,vt?.({ReactiveElement:b}),(R.reactiveElementVersions??=[]).push("2.1.2");var F=globalThis,X=t=>t,M=F.trustedTypes,Y=M?M.createPolicy("lit-html",{createHTML:t=>t}):void 0,tt="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,et="?"+_,Et=`<${et}>`,A=document,C=()=>A.createComment(""),w=t=>t===null||typeof t!="object"&&typeof t!="function",L=Array.isArray,St=t=>L(t)||typeof t?.[Symbol.iterator]=="function",j=`[ | ||
| \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,it=/-->/g,st=/>/g,y=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,nt=/"/g,ot=/^(?:script|style|textarea|title)$/i,v=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),lt=new WeakMap,g=A.createTreeWalker(A,129);function ht(t,e){if(!L(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Y===void 0?e:Y.createHTML(e)}var Ct=(t,e)=>{let i=t.length-1,s=[],r,n=e===2?"<svg>":e===3?"<math>":"",o=H;for(let l=0;l<i;l++){let h=t[l],N,u,a=-1,f=0;for(;f<h.length&&(o.lastIndex=f,u=o.exec(h),u!==null);)f=o.lastIndex,o===H?u[1]==="!--"?o=it:u[1]===void 0?u[2]===void 0?u[3]!==void 0&&(o=y):(ot.test(u[2])&&(r=RegExp("</"+u[2],"g")),o=y):o=st:o===y?u[0]===">"?(o=r??H,a=-1):u[1]===void 0?a=-2:(a=o.lastIndex-u[2].length,N=u[1],o=u[3]===void 0?y:u[3]==='"'?nt:rt):o===nt||o===rt?o=y:o===it||o===st?o=H:(o=y,r=void 0);let m=o===y&&t[l+1].startsWith("/>")?" ":"";n+=o===H?h+Et:a>=0?(s.push(N),h.slice(0,a)+tt+h.slice(a)+_+m):h+_+(a===-2?l:m)}return[ht(t,n+(t[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]},z=class dt{constructor({strings:e,_$litType$:i},s){let r;this.parts=[];let n=0,o=0,l=e.length-1,h=this.parts,[N,u]=Ct(e,i);if(this.el=dt.createElement(N,s),g.currentNode=this.el.content,i===2||i===3){let a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(r=g.nextNode())!==null&&h.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let a of r.getAttributeNames())if(a.endsWith(tt)){let f=u[o++],m=r.getAttribute(a).split(_),k=/([.?@])?(.*)/.exec(f);h.push({type:1,index:n,name:k[2],strings:m,ctor:k[1]==="."?Ht:k[1]==="?"?Pt:k[1]==="@"?Ut:T}),r.removeAttribute(a)}else a.startsWith(_)&&(h.push({type:6,index:n}),r.removeAttribute(a));if(ot.test(r.tagName)){let a=r.textContent.split(_),f=a.length-1;if(f>0){r.textContent=M?M.emptyScript:"";for(let m=0;m<f;m++)r.append(a[m],C()),g.nextNode(),h.push({type:2,index:++n});r.append(a[f],C())}}}else if(r.nodeType===8)if(r.data===et)h.push({type:2,index:n});else{let a=-1;for(;(a=r.data.indexOf(_,a+1))!==-1;)h.push({type:7,index:n}),a+=_.length-1}n++}}static createElement(e,i){let s=A.createElement("template");return s.innerHTML=e,s}};function E(t,e,i=t,s){if(e===v)return e;let r=s===void 0?i._$Cl:i._$Co?.[s],n=w(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(t),r._$AT(t,i,s)),s===void 0?i._$Cl=r:(i._$Co??=[])[s]=r),r!==void 0&&(e=E(t,r._$AS(t,e.values),r,s)),e}var wt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??A).importNode(e,!0);g.currentNode=s;let r=g.nextNode(),n=0,o=0,l=i[0];for(;l!==void 0;){if(n===l.index){let h;l.type===2?h=new q(r,r.nextSibling,this,t):l.type===1?h=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(h=new Ot(r,this,t)),this._$AV.push(h),l=i[++o]}n!==l?.index&&(r=g.nextNode(),n++)}return g.currentNode=A,s}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings===void 0?i._$AI(t[e]):(i._$AI(t,i,e),e+=i.strings.length-2)),e++}},q=class ct{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,s,r){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=E(this,e,i),w(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==v&&this._(e):e._$litType$===void 0?e.nodeType===void 0?St(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!==c&&w(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){let{values:i,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=z.createElement(ht(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(i);else{let n=new wt(r,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(e){let i=lt.get(e.strings);return i===void 0&<.set(e.strings,i=new z(e)),i}k(e){L(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,s,r=0;for(let n of e)r===i.length?i.push(s=new ct(this.O(C()),this.O(C()),this,this.options)):s=i[r],s._$AI(n),r++;r<i.length&&(this._$AR(s&&s._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){let s=X(e).nextSibling;X(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}_$AI(t,e=this,i,s){let r=this.strings,n=!1;if(r===void 0)t=E(this,t,e,0),n=!w(t)||t!==this._$AH&&t!==v,n&&(this._$AH=t);else{let o=t,l,h;for(t=r[0],l=0;l<r.length-1;l++)h=E(this,o[i+l],e,l),h===v&&(h=this._$AH[l]),n||=!w(h)||h!==this._$AH[l],h===c?t=c:t!==c&&(t+=(h??"")+r[l+1]),this._$AH[l]=h}n&&!s&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ht=class extends T{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}},Pt=class extends T{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}},Ut=class extends T{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??c)===v)return;let i=this._$AH,s=t===c&&i!==c||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==c&&(i===c||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ot=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}},xt=F.litHtmlPolyfillSupport;xt?.(z,q),(F.litHtmlVersions??=[]).push("3.3.2");var Rt=(t,e,i)=>{let s=i?.renderBefore??e,r=s._$litPart$;if(r===void 0){let n=i?.renderBefore??null;s._$litPart$=r=new q(e.insertBefore(C(),n),n,void 0,i??{})}return r._$AI(t),r},B=globalThis,P=class extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return v}};P._$litElement$=!0,P.finalized=!0,B.litElementHydrateSupport?.({LitElement:P});var Mt=B.litElementPolyfillSupport;Mt?.({LitElement:P}),(B.litElementVersions??=[]).push("4.2.2");var p=[];for(let t=0;t<256;++t)p.push((t+256).toString(16).slice(1));function Tt(t,e=0){return(p[t[e+0]]+p[t[e+1]]+p[t[e+2]]+p[t[e+3]]+"-"+p[t[e+4]]+p[t[e+5]]+"-"+p[t[e+6]]+p[t[e+7]]+"-"+p[t[e+8]]+p[t[e+9]]+"-"+p[t[e+10]]+p[t[e+11]]+p[t[e+12]]+p[t[e+13]]+p[t[e+14]]+p[t[e+15]]).toLowerCase()}var V,Nt=new Uint8Array(16);function kt(){if(!V){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");V=crypto.getRandomValues.bind(crypto)}return V(Nt)}var at={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function It(t,e,i){t||={};let s=t.random??t.rng?.()??kt();if(s.length<16)throw Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Tt(s)}function Dt(t,e,i){return at.randomUUID&&!e&&!t?at.randomUUID():It(t,e)}function Ft(t="hp"){return`${t}-${Dt()}`}var U=class extends P{createRenderRoot(){return this}emit(t,e){let i=new CustomEvent(`hp-${t}`,{detail:e,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(i),i}_hpId=Ft();get hpId(){return this._hpId}};function O(t){return function(e){typeof window<"u"&&(customElements.get(t)||customElements.define(t,e))}}var Lt=Object.getOwnPropertyDescriptor,x=(t,e,i,s)=>{for(var r=s>1?void 0:s?Lt(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=o(r)||r);return r};d.HeadlessField=class extends U{get baseId(){return`hp-field-${this.hpId}`}connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field"),this.hasAttribute("role")||this.setAttribute("role","group"),this.addEventListener("slotchange",()=>this.notifyControl()),requestAnimationFrame(()=>requestAnimationFrame(()=>this.notifyControl()))}notifyControl(){this.querySelector("hp-field-control")?.updateControl()}},d.HeadlessField=x([O("hp-field")],d.HeadlessField),d.HeadlessFieldLabel=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-label");const e=this.closest("hp-field");e&&(this.hasAttribute("for")||this.setAttribute("for",`${e.baseId}-control`),this.id||(this.id=`${e.baseId}-label`))}},d.HeadlessFieldLabel=x([O("hp-field-label")],d.HeadlessFieldLabel),d.HeadlessFieldDescription=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-description");const e=this.closest("hp-field");e&&!this.id&&(this.id=`${e.baseId}-description`)}},d.HeadlessFieldDescription=x([O("hp-field-description")],d.HeadlessFieldDescription),d.HeadlessFieldError=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-error");const e=this.closest("hp-field");e&&!this.id&&(this.id=`${e.baseId}-error`),this.hasAttribute("role")||this.setAttribute("role","alert")}},d.HeadlessFieldError=x([O("hp-field-error")],d.HeadlessFieldError),d.HeadlessFieldControl=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-control"),this.addEventListener("slotchange",()=>this.updateControl()),this.updateControl()}updateControl(){const e=this.closest("hp-field");if(!e)return;const i=this._findControl();if(!i)return;i.id||(i.id=`${e.baseId}-control`);const s=[],r=e.querySelector("hp-field-description"),n=e.querySelector("hp-field-error");r?.id&&s.push(r.id),n?.id&&s.push(n.id),s.length>0?i.setAttribute("aria-describedby",s.join(" ")):i.removeAttribute("aria-describedby");const o=e.querySelector("hp-field-label");o?.id&&i.setAttribute("aria-labelledby",o.id)}_findControl(){return this.querySelector("input, select, textarea, [role='checkbox'], [role='switch'], [role='combobox'], [role='progressbar']")}},d.HeadlessFieldControl=x([O("hp-field-control")],d.HeadlessFieldControl),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}); | ||
| (function(d,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(d=typeof globalThis<"u"?globalThis:d||self,$(d.HeadlessPrimitivesField={}))})(this,function(d){"use strict";var $=globalThis,I=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),J=new WeakMap,pt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(I&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=J.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&J.set(e,t))}return t}toString(){return this.cssText}},ut=t=>new pt(typeof t=="string"?t:t+"",void 0,W),ft=(t,e)=>{if(I)t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of e){let s=document.createElement("style"),r=$.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=i.cssText,t.appendChild(s)}},K=I?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let s of e.cssRules)i+=s.cssText;return ut(i)})(t):t,{is:$t,defineProperty:_t,getOwnPropertyDescriptor:At,getOwnPropertyNames:mt,getOwnPropertySymbols:bt,getPrototypeOf:yt}=Object,R=globalThis,Z=R.trustedTypes,gt=Z?Z.emptyScript:"",vt=R.reactiveElementPolyfillSupport,C=(t,e)=>t,D={toAttribute(t,e){switch(e){case Boolean:t=t?gt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},G=(t,e)=>!$t(t,e),Q={attribute:!0,type:String,converter:D,reflect:!1,useDefault:!1,hasChanged:G};Symbol.metadata??=Symbol("metadata"),R.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Q){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&_t(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){let{get:s,set:r}=At(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:s,set(o){let n=s?.call(this);r?.call(this,o),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Q}static _$Ei(){if(this.hasOwnProperty(C("elementProperties")))return;let t=yt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){let e=this.properties,i=[...mt(e),...bt(e)];for(let s of i)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let s of i)e.unshift(K(s))}else t!==void 0&&e.push(K(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ft(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){let r=(i.converter?.toAttribute===void 0?D:i.converter).toAttribute(e,i.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){let i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let r=i.getPropertyOptions(s),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute===void 0?D:r.converter;this._$Em=s;let n=o.fromAttribute(e,r.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(t,e,i,s=!1,r){if(t!==void 0){let o=this.constructor;if(s===!1&&(r=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??G)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,r]of i){let{wrapped:o}=r,n=this[s];o!==!0||this._$AL.has(s)||n===void 0||this.C(s,void 0,r,n)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[C("elementProperties")]=new Map,g[C("finalized")]=new Map,vt?.({ReactiveElement:g}),(R.reactiveElementVersions??=[]).push("2.1.2");var F=globalThis,X=t=>t,M=F.trustedTypes,Y=M?M.createPolicy("lit-html",{createHTML:t=>t}):void 0,tt="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,et="?"+_,Et=`<${et}>`,m=document,S=()=>m.createComment(""),w=t=>t===null||typeof t!="object"&&typeof t!="function",L=Array.isArray,Ct=t=>L(t)||typeof t?.[Symbol.iterator]=="function",j=`[ | ||
| \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,it=/-->/g,st=/>/g,b=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ | ||
| \f\r"'\`<>=]|("|')|))|$)`,"g"),rt=/'/g,ot=/"/g,nt=/^(?:script|style|textarea|title)$/i,v=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),lt=new WeakMap,y=m.createTreeWalker(m,129);function at(t,e){if(!L(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Y===void 0?e:Y.createHTML(e)}var St=(t,e)=>{let i=t.length-1,s=[],r,o=e===2?"<svg>":e===3?"<math>":"",n=H;for(let l=0;l<i;l++){let a=t[l],k,u,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,u=n.exec(a),u!==null);)f=n.lastIndex,n===H?u[1]==="!--"?n=it:u[1]===void 0?u[2]===void 0?u[3]!==void 0&&(n=b):(nt.test(u[2])&&(r=RegExp("</"+u[2],"g")),n=b):n=st:n===b?u[0]===">"?(n=r??H,h=-1):u[1]===void 0?h=-2:(h=n.lastIndex-u[2].length,k=u[1],n=u[3]===void 0?b:u[3]==='"'?ot:rt):n===ot||n===rt?n=b:n===it||n===st?n=H:(n=b,r=void 0);let A=n===b&&t[l+1].startsWith("/>")?" ":"";o+=n===H?a+Et:h>=0?(s.push(k),a.slice(0,h)+tt+a.slice(h)+_+A):a+_+(h===-2?l:A)}return[at(t,o+(t[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]},z=class dt{constructor({strings:e,_$litType$:i},s){let r;this.parts=[];let o=0,n=0,l=e.length-1,a=this.parts,[k,u]=St(e,i);if(this.el=dt.createElement(k,s),y.currentNode=this.el.content,i===2||i===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=y.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(tt)){let f=u[n++],A=r.getAttribute(h).split(_),N=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:N[2],strings:A,ctor:N[1]==="."?Ht:N[1]==="?"?Pt:N[1]==="@"?Ut:T}),r.removeAttribute(h)}else h.startsWith(_)&&(a.push({type:6,index:o}),r.removeAttribute(h));if(nt.test(r.tagName)){let h=r.textContent.split(_),f=h.length-1;if(f>0){r.textContent=M?M.emptyScript:"";for(let A=0;A<f;A++)r.append(h[A],S()),y.nextNode(),a.push({type:2,index:++o});r.append(h[f],S())}}}else if(r.nodeType===8)if(r.data===et)a.push({type:2,index:o});else{let h=-1;for(;(h=r.data.indexOf(_,h+1))!==-1;)a.push({type:7,index:o}),h+=_.length-1}o++}}static createElement(e,i){let s=m.createElement("template");return s.innerHTML=e,s}};function E(t,e,i=t,s){if(e===v)return e;let r=s===void 0?i._$Cl:i._$Co?.[s],o=w(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,i,s)),s===void 0?i._$Cl=r:(i._$Co??=[])[s]=r),r!==void 0&&(e=E(t,r._$AS(t,e.values),r,s)),e}var wt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??m).importNode(e,!0);y.currentNode=s;let r=y.nextNode(),o=0,n=0,l=i[0];for(;l!==void 0;){if(o===l.index){let a;l.type===2?a=new q(r,r.nextSibling,this,t):l.type===1?a=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(a=new Ot(r,this,t)),this._$AV.push(a),l=i[++n]}o!==l?.index&&(r=y.nextNode(),o++)}return y.currentNode=m,s}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings===void 0?i._$AI(t[e]):(i._$AI(t,i,e),e+=i.strings.length-2)),e++}},q=class ct{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,s,r){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=E(this,e,i),w(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==v&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Ct(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!==c&&w(this._$AH)?this._$AA.nextSibling.data=e:this.T(m.createTextNode(e)),this._$AH=e}$(e){let{values:i,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=z.createElement(at(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(i);else{let o=new wt(r,this),n=o.u(this.options);o.p(i),this.T(n),this._$AH=o}}_$AC(e){let i=lt.get(e.strings);return i===void 0&<.set(e.strings,i=new z(e)),i}k(e){L(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,s,r=0;for(let o of e)r===i.length?i.push(s=new ct(this.O(S()),this.O(S()),this,this.options)):s=i[r],s._$AI(o),r++;r<i.length&&(this._$AR(s&&s._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){let s=X(e).nextSibling;X(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,r){this.type=1,this._$AH=c,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}_$AI(t,e=this,i,s){let r=this.strings,o=!1;if(r===void 0)t=E(this,t,e,0),o=!w(t)||t!==this._$AH&&t!==v,o&&(this._$AH=t);else{let n=t,l,a;for(t=r[0],l=0;l<r.length-1;l++)a=E(this,n[i+l],e,l),a===v&&(a=this._$AH[l]),o||=!w(a)||a!==this._$AH[l],a===c?t=c:t!==c&&(t+=(a??"")+r[l+1]),this._$AH[l]=a}o&&!s&&this.j(t)}j(t){t===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ht=class extends T{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===c?void 0:t}},Pt=class extends T{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==c)}},Ut=class extends T{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??c)===v)return;let i=this._$AH,s=t===c&&i!==c||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==c&&(i===c||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ot=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}},xt=F.litHtmlPolyfillSupport;xt?.(z,q),(F.litHtmlVersions??=[]).push("3.3.2");var Rt=(t,e,i)=>{let s=i?.renderBefore??e,r=s._$litPart$;if(r===void 0){let o=i?.renderBefore??null;s._$litPart$=r=new q(e.insertBefore(S(),o),o,void 0,i??{})}return r._$AI(t),r},B=globalThis,P=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return v}};P._$litElement$=!0,P.finalized=!0,B.litElementHydrateSupport?.({LitElement:P});var Mt=B.litElementPolyfillSupport;Mt?.({LitElement:P}),(B.litElementVersions??=[]).push("4.2.2");var p=[];for(let t=0;t<256;++t)p.push((t+256).toString(16).slice(1));function Tt(t,e=0){return(p[t[e+0]]+p[t[e+1]]+p[t[e+2]]+p[t[e+3]]+"-"+p[t[e+4]]+p[t[e+5]]+"-"+p[t[e+6]]+p[t[e+7]]+"-"+p[t[e+8]]+p[t[e+9]]+"-"+p[t[e+10]]+p[t[e+11]]+p[t[e+12]]+p[t[e+13]]+p[t[e+14]]+p[t[e+15]]).toLowerCase()}var V,kt=new Uint8Array(16);function Nt(){if(!V){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");V=crypto.getRandomValues.bind(crypto)}return V(kt)}var ht={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function It(t,e,i){t||={};let s=t.random??t.rng?.()??Nt();if(s.length<16)throw Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Tt(s)}function Dt(t,e,i){return ht.randomUUID&&!e&&!t?ht.randomUUID():It(t,e)}function Ft(t="hp"){return`${t}-${Dt()}`}var U=class extends P{createRenderRoot(){return this}emit(t,e){let i=new CustomEvent(`hp-${t}`,{detail:e,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(i),i}_hpId=Ft();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 O(t){return function(e){typeof window<"u"&&(customElements.get(t)||customElements.define(t,e))}}var Lt=Object.getOwnPropertyDescriptor,x=(t,e,i,s)=>{for(var r=s>1?void 0:s?Lt(e,i):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(r=n(r)||r);return r};d.HeadlessField=class extends U{get baseId(){return`hp-field-${this.hpId}`}connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field"),this.hasAttribute("role")||this.setAttribute("role","group"),this.addEventListener("slotchange",()=>this.notifyControl()),requestAnimationFrame(()=>requestAnimationFrame(()=>this.notifyControl()))}notifyControl(){this.querySelector("hp-field-control")?.updateControl()}},d.HeadlessField=x([O("hp-field")],d.HeadlessField),d.HeadlessFieldLabel=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-label");const e=this.closest("hp-field");e&&(this.hasAttribute("for")||this.setAttribute("for",`${e.baseId}-control`),this.id||(this.id=`${e.baseId}-label`))}},d.HeadlessFieldLabel=x([O("hp-field-label")],d.HeadlessFieldLabel),d.HeadlessFieldDescription=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-description");const e=this.closest("hp-field");e&&!this.id&&(this.id=`${e.baseId}-description`)}},d.HeadlessFieldDescription=x([O("hp-field-description")],d.HeadlessFieldDescription),d.HeadlessFieldError=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-error");const e=this.closest("hp-field");e&&!this.id&&(this.id=`${e.baseId}-error`),this.hasAttribute("role")||this.setAttribute("role","alert")}},d.HeadlessFieldError=x([O("hp-field-error")],d.HeadlessFieldError),d.HeadlessFieldControl=class extends U{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","field-control"),this.addEventListener("slotchange",()=>this.updateControl()),this.updateControl()}updateControl(){const e=this.closest("hp-field");if(!e)return;const i=this._findControl();if(!i)return;i.id||(i.id=`${e.baseId}-control`);const s=[],r=e.querySelector("hp-field-description"),o=e.querySelector("hp-field-error");r?.id&&s.push(r.id),o?.id&&s.push(o.id),s.length>0?i.setAttribute("aria-describedby",s.join(" ")):i.removeAttribute("aria-describedby");const n=e.querySelector("hp-field-label");n?.id&&i.setAttribute("aria-labelledby",n.id)}_findControl(){return this.querySelector("input, select, textarea, [role='checkbox'], [role='switch'], [role='combobox'], [role='progressbar']")}},d.HeadlessFieldControl=x([O("hp-field-control")],d.HeadlessFieldControl),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}); |
+2
-2
| { | ||
| "name": "@headless-primitives/field", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "Headless field primitive for form coordination", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
| "lit": "^3.3.2", | ||
| "@headless-primitives/utils": "1.0.0" | ||
| "@headless-primitives/utils": "1.1.0" | ||
| }, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
45650
2.13%722
1.69%+ Added
- Removed