@gguf/claw
Version:
WhatsApp gateway CLI (Baileys web) with Pi RPC agent
1,758 lines (1,646 loc) • 537 kB
JavaScript
var __defProp$1 = Object.defineProperty;
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) {
__defProp$1(target, name, {
get: all[name],
enumerable: true
});
}
if (!no_symbols) {
__defProp$1(target, Symbol.toStringTag, { value: "Module" });
}
return target;
};
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$6 = globalThis, e$13 = t$6.ShadowRoot && (void 0 === t$6.ShadyCSS || t$6.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$8 = Symbol(), o$14 = new WeakMap();
var n$12 = class {
constructor(t, e, o) {
if (this._$cssResult$ = !0, o !== s$8) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = t, this.t = e;
}
get styleSheet() {
let t = this.o;
const s = this.t;
if (e$13 && void 0 === t) {
const e = void 0 !== s && 1 === s.length;
e && (t = o$14.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$14.set(s, t));
}
return t;
}
toString() {
return this.cssText;
}
};
const r$11 = (t) => new n$12("string" == typeof t ? t : t + "", void 0, s$8), i$9 = (t, ...e) => {
const o = 1 === t.length ? t[0] : e.reduce((e, s, o) => e + ((t) => {
if (!0 === t._$cssResult$) return t.cssText;
if ("number" == typeof t) return t;
throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
})(s) + t[o + 1], t[0]);
return new n$12(o, t, s$8);
}, S$1 = (s, o) => {
if (e$13) s.adoptedStyleSheets = o.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
else for (const e of o) {
const o = document.createElement("style"), n = t$6.litNonce;
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
}
}, c$6 = e$13 ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((t) => {
let e = "";
for (const s of t.cssRules) e += s.cssText;
return r$11(e);
})(t) : t;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ const { is: i$8, defineProperty: e$12, getOwnPropertyDescriptor: h$6, getOwnPropertyNames: r$10, getOwnPropertySymbols: o$13, getPrototypeOf: n$11 } = Object, a$1 = globalThis, c$5 = a$1.trustedTypes, l$4 = c$5 ? c$5.emptyScript : "", p$2 = a$1.reactiveElementPolyfillSupport, d$2 = (t, s) => t, u$3 = {
toAttribute(t, s) {
switch (s) {
case Boolean:
t = t ? l$4 : null;
break;
case Object:
case Array: t = null == t ? t : JSON.stringify(t);
}
return t;
},
fromAttribute(t, s) {
let i = t;
switch (s) {
case Boolean:
i = null !== t;
break;
case Number:
i = null === t ? null : Number(t);
break;
case Object:
case Array: try {
i = JSON.parse(t);
} catch (t) {
i = null;
}
}
return i;
}
}, f$3 = (t, s) => !i$8(t, s), b$1 = {
attribute: !0,
type: String,
converter: u$3,
reflect: !1,
useDefault: !1,
hasChanged: f$3
};
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap();
var y$1 = 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, s = b$1) {
if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(t, s), !s.noAccessor) {
const i = Symbol(), h = this.getPropertyDescriptor(t, i, s);
void 0 !== h && e$12(this.prototype, t, h);
}
}
static getPropertyDescriptor(t, s, i) {
const { get: e, set: r } = h$6(this.prototype, t) ?? {
get() {
return this[s];
},
set(t) {
this[s] = t;
}
};
return {
get: e,
set(s) {
const h = e?.call(this);
r?.call(this, s), this.requestUpdate(t, h, i);
},
configurable: !0,
enumerable: !0
};
}
static getPropertyOptions(t) {
return this.elementProperties.get(t) ?? b$1;
}
static _$Ei() {
if (this.hasOwnProperty(d$2("elementProperties"))) return;
const t = n$11(this);
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(d$2("finalized"))) return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$2("properties"))) {
const t = this.properties, s = [...r$10(t), ...o$13(t)];
for (const i of s) this.createProperty(i, t[i]);
}
const t = this[Symbol.metadata];
if (null !== t) {
const s = litPropertyMetadata.get(t);
if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
}
this._$Eh = new Map();
for (const [t, s] of this.elementProperties) {
const i = this._$Eu(t, s);
void 0 !== i && this._$Eh.set(i, t);
}
this.elementStyles = this.finalizeStyles(this.styles);
}
static finalizeStyles(s) {
const i = [];
if (Array.isArray(s)) {
const e = new Set(s.flat(1 / 0).reverse());
for (const s of e) i.unshift(c$6(s));
} else void 0 !== s && i.push(c$6(s));
return i;
}
static _$Eu(t, s) {
const i = s.attribute;
return !1 === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? 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), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
}
removeController(t) {
this._$EO?.delete(t);
}
_$E_() {
const t = new Map(), s = this.constructor.elementProperties;
for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
t.size > 0 && (this._$Ep = t);
}
createRenderRoot() {
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return S$1(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, s, i) {
this._$AK(t, i);
}
_$ET(t, s) {
const i = this.constructor.elementProperties.get(t), e = this.constructor._$Eu(t, i);
if (void 0 !== e && !0 === i.reflect) {
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u$3).toAttribute(s, i.type);
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
}
}
_$AK(t, s) {
const i = this.constructor, e = i._$Eh.get(t);
if (void 0 !== e && this._$Em !== e) {
const t = i.getPropertyOptions(e), h = "function" == typeof t.converter ? { fromAttribute: t.converter } : void 0 !== t.converter?.fromAttribute ? t.converter : u$3;
this._$Em = e;
const r = h.fromAttribute(s, t.type);
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
}
}
requestUpdate(t, s, i, e = !1, h) {
if (void 0 !== t) {
const r = this.constructor;
if (!1 === e && (h = this[t]), i ??= r.getPropertyOptions(t), !((i.hasChanged ?? f$3)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, i)))) return;
this.C(t, s, i);
}
!1 === this.isUpdatePending && (this._$ES = this._$EP());
}
C(t, s, { useDefault: i, reflect: e, wrapped: h }, r) {
i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), !0 !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), !0 === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
}
async _$EP() {
this.isUpdatePending = !0;
try {
await this._$ES;
} catch (t) {
Promise.reject(t);
}
const t = this.scheduleUpdate();
return null != t && await t, !this.isUpdatePending;
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
if (!this.isUpdatePending) return;
if (!this.hasUpdated) {
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
for (const [t, s] of this._$Ep) this[t] = s;
this._$Ep = void 0;
}
const t = this.constructor.elementProperties;
if (t.size > 0) for (const [s, i] of t) {
const { wrapped: t } = i, e = this[s];
!0 !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
}
}
let t = !1;
const s = this._$AL;
try {
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach((t) => t.hostUpdate?.()), this.update(s)) : this._$EM();
} catch (s) {
throw t = !1, this._$EM(), s;
}
t && this._$AE(s);
}
willUpdate(t) {}
_$AE(t) {
this._$EO?.forEach((t) => t.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((t) => this._$ET(t, this[t])), this._$EM();
}
updated(t) {}
firstUpdated(t) {}
};
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$2("elementProperties")] = new Map(), y$1[d$2("finalized")] = new Map(), p$2?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$5 = globalThis, i$7 = (t) => t, s$7 = t$5.trustedTypes, e$11 = s$7 ? s$7.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, h$5 = "$lit$", o$12 = `lit$${Math.random().toFixed(9).slice(2)}$`, n$10 = "?" + o$12, r$9 = `<${n$10}>`, l$3 = document, c$4 = () => l$3.createComment(""), a = (t) => null === t || "object" != typeof t && "function" != typeof t, u$2 = Array.isArray, d$1 = (t) => u$2(t) || "function" == typeof t?.[Symbol.iterator], f$2 = "[ \n\f\r]", v$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m$2 = />/g, p$1 = RegExp(`>|${f$2}(?:([^\\s"'>=/]+)(${f$2}*=${f$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y = /^(?:script|style|textarea|title)$/i, x = (t) => (i, ...s) => ({
_$litType$: t,
strings: i,
values: s
}), b = x(1), w = x(2), T = x(3), E = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), C = new WeakMap(), P = l$3.createTreeWalker(l$3, 129);
function V(t, i) {
if (!u$2(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
return void 0 !== e$11 ? e$11.createHTML(i) : i;
}
const N = (t, i) => {
const s = t.length - 1, e = [];
let n, l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "", c = v$1;
for (let i = 0; i < s; i++) {
const s = t[i];
let a, u, d = -1, f = 0;
for (; f < s.length && (c.lastIndex = f, u = c.exec(s), null !== u);) f = c.lastIndex, c === v$1 ? "!--" === u[1] ? c = _ : void 0 !== u[1] ? c = m$2 : void 0 !== u[2] ? (y.test(u[2]) && (n = RegExp("</" + u[2], "g")), c = p$1) : void 0 !== u[3] && (c = p$1) : c === p$1 ? ">" === u[0] ? (c = n ?? v$1, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? p$1 : "\"" === u[3] ? $ : g) : c === $ || c === g ? c = p$1 : c === _ || c === m$2 ? c = v$1 : (c = p$1, n = void 0);
const x = c === p$1 && t[i + 1].startsWith("/>") ? " " : "";
l += c === v$1 ? s + r$9 : d >= 0 ? (e.push(a), s.slice(0, d) + h$5 + s.slice(d) + o$12 + x) : s + o$12 + (-2 === d ? i : x);
}
return [V(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), e];
};
var S = class S {
constructor({ strings: t, _$litType$: i }, e) {
let r;
this.parts = [];
let l = 0, a = 0;
const u = t.length - 1, d = this.parts, [f, v] = N(t, i);
if (this.el = S.createElement(f, e), P.currentNode = this.el.content, 2 === i || 3 === i) {
const t = this.el.content.firstChild;
t.replaceWith(...t.childNodes);
}
for (; null !== (r = P.nextNode()) && d.length < u;) {
if (1 === r.nodeType) {
if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(h$5)) {
const i = v[a++], s = r.getAttribute(t).split(o$12), e = /([.?@])?(.*)/.exec(i);
d.push({
type: 1,
index: l,
name: e[2],
strings: s,
ctor: "." === e[1] ? I : "?" === e[1] ? L : "@" === e[1] ? z : H
}), r.removeAttribute(t);
} else t.startsWith(o$12) && (d.push({
type: 6,
index: l
}), r.removeAttribute(t));
if (y.test(r.tagName)) {
const t = r.textContent.split(o$12), i = t.length - 1;
if (i > 0) {
r.textContent = s$7 ? s$7.emptyScript : "";
for (let s = 0; s < i; s++) r.append(t[s], c$4()), P.nextNode(), d.push({
type: 2,
index: ++l
});
r.append(t[i], c$4());
}
}
} else if (8 === r.nodeType) if (r.data === n$10) d.push({
type: 2,
index: l
});
else {
let t = -1;
for (; -1 !== (t = r.data.indexOf(o$12, t + 1));) d.push({
type: 7,
index: l
}), t += o$12.length - 1;
}
l++;
}
}
static createElement(t, i) {
const s = l$3.createElement("template");
return s.innerHTML = t, s;
}
};
function M$1(t, i, s = t, e) {
if (i === E) return i;
let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
const o = a(i) ? void 0 : i._$litDirective$;
return h?.constructor !== o && (h?._$AO?.(!1), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? (s._$Co ??= [])[e] = h : s._$Cl = h), void 0 !== h && (i = M$1(t, h._$AS(t, i.values), h, e)), i;
}
var R = class {
constructor(t, i) {
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
u(t) {
const { el: { content: i }, parts: s } = this._$AD, e = (t?.creationScope ?? l$3).importNode(i, !0);
P.currentNode = e;
let h = P.nextNode(), o = 0, n = 0, r = s[0];
for (; void 0 !== r;) {
if (o === r.index) {
let i;
2 === r.type ? i = new k(h, h.nextSibling, this, t) : 1 === r.type ? i = new r.ctor(h, r.name, r.strings, this, t) : 6 === r.type && (i = new Z(h, this, t)), this._$AV.push(i), r = s[++n];
}
o !== r?.index && (h = P.nextNode(), o++);
}
return P.currentNode = l$3, e;
}
p(t) {
let i = 0;
for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
}
};
var k = class k {
get _$AU() {
return this._$AM?._$AU ?? this._$Cv;
}
constructor(t, i, s, e) {
this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = e?.isConnected ?? !0;
}
get parentNode() {
let t = this._$AA.parentNode;
const i = this._$AM;
return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(t, i = this) {
t = M$1(this, t, i), a(t) ? t === A || null == t || "" === t ? (this._$AH !== A && this._$AR(), this._$AH = A) : t !== this._$AH && t !== E && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : d$1(t) ? this.k(t) : this._(t);
}
O(t) {
return this._$AA.parentNode.insertBefore(t, this._$AB);
}
T(t) {
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
}
_(t) {
this._$AH !== A && a(this._$AH) ? this._$AA.nextSibling.data = t : this.T(l$3.createTextNode(t)), this._$AH = t;
}
$(t) {
const { values: i, _$litType$: s } = t, e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = S.createElement(V(s.h, s.h[0]), this.options)), s);
if (this._$AH?._$AD === e) this._$AH.p(i);
else {
const t = new R(e, this), s = t.u(this.options);
t.p(i), this.T(s), this._$AH = t;
}
}
_$AC(t) {
let i = C.get(t.strings);
return void 0 === i && C.set(t.strings, i = new S(t)), i;
}
k(t) {
u$2(this._$AH) || (this._$AH = [], this._$AR());
const i = this._$AH;
let s, e = 0;
for (const h of t) e === i.length ? i.push(s = new k(this.O(c$4()), this.O(c$4()), this, this.options)) : s = i[e], s._$AI(h), e++;
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
}
_$AR(t = this._$AA.nextSibling, s) {
for (this._$AP?.(!1, !0, s); t !== this._$AB;) {
const s = i$7(t).nextSibling;
i$7(t).remove(), t = s;
}
}
setConnected(t) {
void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
}
};
var H = class {
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
constructor(t, i, s, e, h) {
this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = A;
}
_$AI(t, i = this, s, e) {
const h = this.strings;
let o = !1;
if (void 0 === h) t = M$1(this, t, i, 0), o = !a(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
else {
const e = t;
let n, r;
for (t = h[0], n = 0; n < h.length - 1; n++) r = M$1(this, e[s + n], i, n), r === E && (r = this._$AH[n]), o ||= !a(r) || r !== this._$AH[n], r === A ? t = A : t !== A && (t += (r ?? "") + h[n + 1]), this._$AH[n] = r;
}
o && !e && this.j(t);
}
j(t) {
t === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
}
};
var I = class extends H {
constructor() {
super(...arguments), this.type = 3;
}
j(t) {
this.element[this.name] = t === A ? void 0 : t;
}
};
var L = class extends H {
constructor() {
super(...arguments), this.type = 4;
}
j(t) {
this.element.toggleAttribute(this.name, !!t && t !== A);
}
};
var z = class extends H {
constructor(t, i, s, e, h) {
super(t, i, s, e, h), this.type = 5;
}
_$AI(t, i = this) {
if ((t = M$1(this, t, i, 0) ?? A) === E) return;
const s = this._$AH, e = t === A && s !== A || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, h = t !== A && (s === A || e);
e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
}
handleEvent(t) {
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
}
};
var Z = class {
constructor(t, i, s) {
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t) {
M$1(this, t);
}
};
const j$1 = {
M: h$5,
P: o$12,
A: n$10,
C: 1,
L: N,
R,
D: d$1,
V: M$1,
I: k,
H,
N: L,
U: z,
B: I,
F: Z
}, B = t$5.litHtmlPolyfillSupport;
B?.(S, k), (t$5.litHtmlVersions ??= []).push("3.3.2");
const D = (t, i, s) => {
const e = s?.renderBefore ?? i;
let h = e._$litPart$;
if (void 0 === h) {
const t = s?.renderBefore ?? null;
e._$litPart$ = h = new k(i.insertBefore(c$4(), t), t, void 0, s ?? {});
}
return h._$AI(t), h;
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ const s$6 = globalThis;
var i$6 = class extends y$1 {
constructor() {
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
}
createRenderRoot() {
const t = super.createRenderRoot();
return this.renderOptions.renderBefore ??= t.firstChild, t;
}
update(t) {
const r = this.render();
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = D(r, this.renderRoot, this.renderOptions);
}
connectedCallback() {
super.connectedCallback(), this._$Do?.setConnected(!0);
}
disconnectedCallback() {
super.disconnectedCallback(), this._$Do?.setConnected(!1);
}
render() {
return E;
}
};
i$6._$litElement$ = !0, i$6["finalized"] = !0, s$6.litElementHydrateSupport?.({ LitElement: i$6 });
const o$11 = s$6.litElementPolyfillSupport;
o$11?.({ LitElement: i$6 });
const n$9 = {
_$AK: (t, e, r) => {
t._$AK(e, r);
},
_$AL: (t) => t._$AL
};
(s$6.litElementVersions ??= []).push("4.2.2");
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const o$10 = !1;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$4 = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
}, e$10 = (t) => (...e) => ({
_$litDirective$: t,
values: e
});
var i$5 = class {
constructor(t) {}
get _$AU() {
return this._$AM._$AU;
}
_$AT(t, e, i) {
this._$Ct = t, this._$AM = e, this._$Ci = i;
}
_$AS(t, e) {
return this.update(t, e);
}
update(t, e) {
return this.render(...e);
}
};
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ const { I: t$3 } = j$1, i$4 = (o) => o, n$8 = (o) => null === o || "object" != typeof o && "function" != typeof o, e$9 = {
HTML: 1,
SVG: 2,
MATHML: 3
}, l$2 = (o, t) => void 0 === t ? void 0 !== o?._$litType$ : o?._$litType$ === t, d = (o) => null != o?._$litType$?.h, c$3 = (o) => void 0 !== o?._$litDirective$, f$1 = (o) => o?._$litDirective$, r$8 = (o) => void 0 === o.strings, s$5 = () => document.createComment(""), v = (o, n, e) => {
const l = o._$AA.parentNode, d = void 0 === n ? o._$AB : n._$AA;
if (void 0 === e) {
const i = l.insertBefore(s$5(), d), n = l.insertBefore(s$5(), d);
e = new t$3(i, n, o, o.options);
} else {
const t = e._$AB.nextSibling, n = e._$AM, c = n !== o;
if (c) {
let t;
e._$AQ?.(o), e._$AM = o, void 0 !== e._$AP && (t = o._$AU) !== n._$AU && e._$AP(t);
}
if (t !== d || c) {
let o = e._$AA;
for (; o !== t;) {
const t = i$4(o).nextSibling;
i$4(l).insertBefore(o, d), o = t;
}
}
}
return e;
}, u$1 = (o, t, i = o) => (o._$AI(t, i), o), m$1 = {}, p = (o, t = m$1) => o._$AH = t, M = (o) => o._$AH, h$4 = (o) => {
o._$AR(), o._$AA.remove();
}, j = (o) => {
o._$AR();
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const u = (e, s, t) => {
const r = new Map();
for (let l = s; l <= t; l++) r.set(e[l], l);
return r;
}, c$2 = e$10(class extends i$5 {
constructor(e) {
if (super(e), e.type !== t$4.CHILD) throw Error("repeat() can only be used in text expressions");
}
dt(e, s, t) {
let r;
void 0 === t ? t = s : void 0 !== s && (r = s);
const l = [], o = [];
let i = 0;
for (const s of e) l[i] = r ? r(s, i) : i, o[i] = t(s, i), i++;
return {
values: o,
keys: l
};
}
render(e, s, t) {
return this.dt(e, s, t).values;
}
update(s, [t, r, c]) {
const d = M(s), { values: p$3, keys: a } = this.dt(t, r, c);
if (!Array.isArray(d)) return this.ut = a, p$3;
const h = this.ut ??= [], v$2 = [];
let m, y, x = 0, j = d.length - 1, k = 0, w = p$3.length - 1;
for (; x <= j && k <= w;) if (null === d[x]) x++;
else if (null === d[j]) j--;
else if (h[x] === a[k]) v$2[k] = u$1(d[x], p$3[k]), x++, k++;
else if (h[j] === a[w]) v$2[w] = u$1(d[j], p$3[w]), j--, w--;
else if (h[x] === a[w]) v$2[w] = u$1(d[x], p$3[w]), v(s, v$2[w + 1], d[x]), x++, w--;
else if (h[j] === a[k]) v$2[k] = u$1(d[j], p$3[k]), v(s, d[x], d[j]), j--, k++;
else if (void 0 === m && (m = u(a, k, w), y = u(h, x, j)), m.has(h[x])) if (m.has(h[j])) {
const e = y.get(a[k]), t = void 0 !== e ? d[e] : null;
if (null === t) {
const e = v(s, d[x]);
u$1(e, p$3[k]), v$2[k] = e;
} else v$2[k] = u$1(t, p$3[k]), v(s, d[x], t), d[e] = null;
k++;
} else h$4(d[j]), j--;
else h$4(d[x]), x++;
for (; k <= w;) {
const e = v(s, v$2[w + 1]);
u$1(e, p$3[k]), v$2[k++] = e;
}
for (; x <= j;) {
const e = d[x++];
null !== e && h$4(e);
}
return this.ut = a, p(s, v$2), E;
}
});
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var s$4 = class extends Event {
constructor(s, t, e, o) {
super("context-request", {
bubbles: !0,
composed: !0
}), this.context = s, this.contextTarget = t, this.callback = e, this.subscribe = o ?? !1;
}
};
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function n$7(n) {
return n;
}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ var s$3 = class {
constructor(t, s, i, h) {
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (t, s) => {
this.unsubscribe && (this.unsubscribe !== s && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = t, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(t, s)), this.unsubscribe = s;
}, this.host = t, void 0 !== s.context) {
const t = s;
this.context = t.context, this.callback = t.callback, this.subscribe = t.subscribe ?? !1;
} else this.context = s, this.callback = i, this.subscribe = h ?? !1;
this.host.addController(this);
}
hostConnected() {
this.dispatchRequest();
}
hostDisconnected() {
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
}
dispatchRequest() {
this.host.dispatchEvent(new s$4(this.context, this.host, this.t, this.subscribe));
}
};
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var s$2 = class {
get value() {
return this.o;
}
set value(s) {
this.setValue(s);
}
setValue(s, t = !1) {
const i = t || !Object.is(s, this.o);
this.o = s, i && this.updateObservers();
}
constructor(s) {
this.subscriptions = new Map(), this.updateObservers = () => {
for (const [s, { disposer: t }] of this.subscriptions) s(this.o, t);
}, void 0 !== s && (this.value = s);
}
addCallback(s, t, i) {
if (!i) return void s(this.value);
this.subscriptions.has(s) || this.subscriptions.set(s, {
disposer: () => {
this.subscriptions.delete(s);
},
consumerHost: t
});
const { disposer: h } = this.subscriptions.get(s);
s(this.value, h);
}
clearCallbacks() {
this.subscriptions.clear();
}
};
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ var e$8 = class extends Event {
constructor(t, s) {
super("context-provider", {
bubbles: !0,
composed: !0
}), this.context = t, this.contextTarget = s;
}
};
var i$3 = class extends s$2 {
constructor(s, e, i) {
super(void 0 !== e.context ? e.initialValue : i), this.onContextRequest = (t) => {
if (t.context !== this.context) return;
const s = t.contextTarget ?? t.composedPath()[0];
s !== this.host && (t.stopPropagation(), this.addCallback(t.callback, s, t.subscribe));
}, this.onProviderRequest = (s) => {
if (s.context !== this.context) return;
if ((s.contextTarget ?? s.composedPath()[0]) === this.host) return;
const e = new Set();
for (const [s, { consumerHost: i }] of this.subscriptions) e.has(s) || (e.add(s), i.dispatchEvent(new s$4(this.context, i, s, !0)));
s.stopPropagation();
}, this.host = s, void 0 !== e.context ? this.context = e.context : this.context = e, this.attachListeners(), this.host.addController?.(this);
}
attachListeners() {
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
}
hostConnected() {
this.host.dispatchEvent(new e$8(this.context, this.host));
}
};
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ var t$2 = class {
constructor() {
this.pendingContextRequests = new Map(), this.onContextProvider = (t) => {
const s = this.pendingContextRequests.get(t.context);
if (void 0 === s) return;
this.pendingContextRequests.delete(t.context);
const { requests: o } = s;
for (const { elementRef: s, callbackRef: n } of o) {
const o = s.deref(), c = n.deref();
void 0 === o || void 0 === c || o.dispatchEvent(new s$4(t.context, o, c, !0));
}
}, this.onContextRequest = (e) => {
if (!0 !== e.subscribe) return;
const t = e.contextTarget ?? e.composedPath()[0], s = e.callback;
let o = this.pendingContextRequests.get(e.context);
void 0 === o && this.pendingContextRequests.set(e.context, o = {
callbacks: new WeakMap(),
requests: []
});
let n = o.callbacks.get(t);
void 0 === n && o.callbacks.set(t, n = new WeakSet()), n.has(s) || (n.add(s), o.requests.push({
elementRef: new WeakRef(t),
callbackRef: new WeakRef(s)
}));
};
}
attach(e) {
e.addEventListener("context-request", this.onContextRequest), e.addEventListener("context-provider", this.onContextProvider);
}
detach(e) {
e.removeEventListener("context-request", this.onContextRequest), e.removeEventListener("context-provider", this.onContextProvider);
}
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ function e$7({ context: e }) {
return (n, i) => {
const r = new WeakMap();
if ("object" == typeof i) return {
get() {
return n.get.call(this);
},
set(t) {
return r.get(this).setValue(t), n.set.call(this, t);
},
init(n) {
return r.set(this, new i$3(this, {
context: e,
initialValue: n
})), n;
}
};
{
n.constructor.addInitializer(((n) => {
r.set(n, new i$3(n, { context: e }));
}));
const o = Object.getOwnPropertyDescriptor(n, i);
let s;
if (void 0 === o) {
const t = new WeakMap();
s = {
get() {
return t.get(this);
},
set(e) {
r.get(this).setValue(e), t.set(this, e);
},
configurable: !0,
enumerable: !0
};
} else {
const t = o.set;
s = {
...o,
set(e) {
r.get(this).setValue(e), t?.call(this, e);
}
};
}
return void Object.defineProperty(n, i, s);
}
};
}
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/ function c$1({ context: c, subscribe: e }) {
return (o, n) => {
"object" == typeof n ? n.addInitializer((function() {
new s$3(this, {
context: c,
callback: (t) => {
o.set.call(this, t);
},
subscribe: e
});
})) : o.constructor.addInitializer(((o) => {
new s$3(o, {
context: c,
callback: (t) => {
o[n] = t;
},
subscribe: e
});
}));
};
}
const eventInit = {
bubbles: true,
cancelable: true,
composed: true
};
var StateEvent = class StateEvent extends CustomEvent {
static {
this.eventName = "a2uiaction";
}
constructor(payload) {
super(StateEvent.eventName, {
detail: payload,
...eventInit
});
this.payload = payload;
}
};
const opacityBehavior = `
&:not([disabled]) {
cursor: pointer;
opacity: var(--opacity, 0);
transition: opacity var(--speed, 0.2s) cubic-bezier(0, 0, 0.3, 1);
&:hover,
&:focus {
opacity: 1;
}
}`;
const behavior = `
${new Array(21).fill(0).map((_, idx) => {
return `.behavior-ho-${idx * 5} {
--opacity: ${idx / 20};
${opacityBehavior}
}`;
}).join("\n")}
.behavior-o-s {
overflow: scroll;
}
.behavior-o-a {
overflow: auto;
}
.behavior-o-h {
overflow: hidden;
}
.behavior-sw-n {
scrollbar-width: none;
}
`;
const grid = 4;
const border = `
${new Array(25).fill(0).map((_, idx) => {
return `
.border-bw-${idx} { border-width: ${idx}px; }
.border-btw-${idx} { border-top-width: ${idx}px; }
.border-bbw-${idx} { border-bottom-width: ${idx}px; }
.border-blw-${idx} { border-left-width: ${idx}px; }
.border-brw-${idx} { border-right-width: ${idx}px; }
.border-ow-${idx} { outline-width: ${idx}px; }
.border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`;
}).join("\n")}
.border-br-50pc {
border-radius: 50%;
}
.border-bs-s {
border-style: solid;
}
`;
const shades = [
0,
5,
10,
15,
20,
25,
30,
35,
40,
50,
60,
70,
80,
90,
95,
98,
99,
100
];
function merge(...classes) {
const styles = {};
for (const clazz of classes) {
for (const [key, val] of Object.entries(clazz)) {
const prefix = key.split("-").with(-1, "").join("-");
const existingKeys = Object.keys(styles).filter((key) => key.startsWith(prefix));
for (const existingKey of existingKeys) {
delete styles[existingKey];
}
styles[key] = val;
}
}
return styles;
}
function appendToAll(target, exclusions, ...classes) {
const updatedTarget = structuredClone(target);
for (const clazz of classes) {
for (const key of Object.keys(clazz)) {
const prefix = key.split("-").with(-1, "").join("-");
for (const [tagName, classesToAdd] of Object.entries(updatedTarget)) {
if (exclusions.includes(tagName)) {
continue;
}
let found = false;
for (let t = 0; t < classesToAdd.length; t++) {
if (classesToAdd[t].startsWith(prefix)) {
found = true;
classesToAdd[t] = key;
}
}
if (!found) {
classesToAdd.push(key);
}
}
}
}
return updatedTarget;
}
function createThemeStyles(palettes) {
const styles = {};
for (const palette of Object.values(palettes)) {
for (const [key, val] of Object.entries(palette)) {
const prop = toProp(key);
styles[prop] = val;
}
}
return styles;
}
function toProp(key) {
if (key.startsWith("nv")) {
return `--nv-${key.slice(2)}`;
}
return `--${key[0]}-${key.slice(1)}`;
}
const color = (src) => `
${src.map((key) => {
const inverseKey = getInverseKey(key);
return `.color-bc-${key} { border-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`;
}).join("\n")}
${src.map((key) => {
const inverseKey = getInverseKey(key);
const vals = [`.color-bgc-${key} { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`, `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`];
for (let o = .1; o < 1; o += .1) {
vals.push(`.color-bbgc-${key}_${(o * 100).toFixed(0)}::backdrop {
background-color: light-dark(oklch(from var(${toProp(key)}) l c h / calc(alpha * ${o.toFixed(1)})), oklch(from var(${toProp(inverseKey)}) l c h / calc(alpha * ${o.toFixed(1)})) );
}
`);
}
return vals.join("\n");
}).join("\n")}
${src.map((key) => {
const inverseKey = getInverseKey(key);
return `.color-c-${key} { color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`;
}).join("\n")}
`;
const getInverseKey = (key) => {
const match = key.match(/^([a-z]+)(\d+)$/);
if (!match) return key;
const [, prefix, shadeStr] = match;
const shade = parseInt(shadeStr, 10);
const target = 100 - shade;
const inverseShade = shades.reduce((prev, curr) => Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev);
return `${prefix}${inverseShade}`;
};
const keyFactory = (prefix) => {
return shades.map((v) => `${prefix}${v}`);
};
const colors = [
color(keyFactory("p")),
color(keyFactory("s")),
color(keyFactory("t")),
color(keyFactory("n")),
color(keyFactory("nv")),
color(keyFactory("e")),
`
.color-bgc-transparent {
background-color: transparent;
}
:host {
color-scheme: var(--color-scheme);
}
`
];
/**
* CSS classes for Google Symbols.
*
* Usage:
*
* ```html
* <span class="g-icon">pen_spark</span>
* ```
*/
const icons = `
.g-icon {
font-family: "Material Symbols Outlined", "Google Symbols";
font-weight: normal;
font-style: normal;
font-display: optional;
font-size: 20px;
width: 1em;
height: 1em;
user-select: none;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: "liga";
-webkit-font-smoothing: antialiased;
overflow: hidden;
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 48,
"ROND" 100;
&.filled {
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 0, "opsz" 48,
"ROND" 100;
}
&.filled-heavy {
font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 48,
"ROND" 100;
}
}
`;
const layout = `
:host {
${new Array(16).fill(0).map((_, idx) => {
return `--g-${idx + 1}: ${(idx + 1) * grid}px;`;
}).join("\n")}
}
${new Array(49).fill(0).map((_, index) => {
const idx = index - 24;
const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString();
return `
.layout-p-${lbl} { --padding: ${idx * grid}px; padding: var(--padding); }
.layout-pt-${lbl} { padding-top: ${idx * grid}px; }
.layout-pr-${lbl} { padding-right: ${idx * grid}px; }
.layout-pb-${lbl} { padding-bottom: ${idx * grid}px; }
.layout-pl-${lbl} { padding-left: ${idx * grid}px; }
.layout-m-${lbl} { --margin: ${idx * grid}px; margin: var(--margin); }
.layout-mt-${lbl} { margin-top: ${idx * grid}px; }
.layout-mr-${lbl} { margin-right: ${idx * grid}px; }
.layout-mb-${lbl} { margin-bottom: ${idx * grid}px; }
.layout-ml-${lbl} { margin-left: ${idx * grid}px; }
.layout-t-${lbl} { top: ${idx * grid}px; }
.layout-r-${lbl} { right: ${idx * grid}px; }
.layout-b-${lbl} { bottom: ${idx * grid}px; }
.layout-l-${lbl} { left: ${idx * grid}px; }`;
}).join("\n")}
${new Array(25).fill(0).map((_, idx) => {
return `
.layout-g-${idx} { gap: ${idx * grid}px; }`;
}).join("\n")}
${new Array(8).fill(0).map((_, idx) => {
return `
.layout-grd-col${idx + 1} { grid-template-columns: ${"1fr ".repeat(idx + 1).trim()}; }`;
}).join("\n")}
.layout-pos-a {
position: absolute;
}
.layout-pos-rel {
position: relative;
}
.layout-dsp-none {
display: none;
}
.layout-dsp-block {
display: block;
}
.layout-dsp-grid {
display: grid;
}
.layout-dsp-iflex {
display: inline-flex;
}
.layout-dsp-flexvert {
display: flex;
flex-direction: column;
}
.layout-dsp-flexhor {
display: flex;
flex-direction: row;
}
.layout-fw-w {
flex-wrap: wrap;
}
.layout-al-fs {
align-items: start;
}
.layout-al-fe {
align-items: end;
}
.layout-al-c {
align-items: center;
}
.layout-as-n {
align-self: normal;
}
.layout-js-c {
justify-self: center;
}
.layout-sp-c {
justify-content: center;
}
.layout-sp-ev {
justify-content: space-evenly;
}
.layout-sp-bt {
justify-content: space-between;
}
.layout-sp-s {
justify-content: start;
}
.layout-sp-e {
justify-content: end;
}
.layout-ji-e {
justify-items: end;
}
.layout-r-none {
resize: none;
}
.layout-fs-c {
field-sizing: content;
}
.layout-fs-n {
field-sizing: none;
}
.layout-flx-0 {
flex: 0 0 auto;
}
.layout-flx-1 {
flex: 1 0 auto;
}
.layout-c-s {
contain: strict;
}
/** Widths **/
${new Array(10).fill(0).map((_, idx) => {
const weight = (idx + 1) * 10;
return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`;
}).join("\n")}
${new Array(16).fill(0).map((_, idx) => {
const weight = idx * grid;
return `.layout-wp-${idx} { width: ${weight}px; }`;
}).join("\n")}
/** Heights **/
${new Array(10).fill(0).map((_, idx) => {
const height = (idx + 1) * 10;
return `.layout-h-${height} { height: ${height}%; }`;
}).join("\n")}
${new Array(16).fill(0).map((_, idx) => {
const height = idx * grid;
return `.layout-hp-${idx} { height: ${height}px; }`;
}).join("\n")}
.layout-el-cv {
& img,
& video {
width: 100%;
height: 100%;
object-fit: cover;
margin: 0;
}
}
.layout-ar-sq {
aspect-ratio: 1 / 1;
}
.layout-ex-fb {
margin: calc(var(--padding) * -1) 0 0 calc(var(--padding) * -1);
width: calc(100% + var(--padding) * 2);
height: calc(100% + var(--padding) * 2);
}
`;
const opacity = `
${new Array(21).fill(0).map((_, idx) => {
return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`;
}).join("\n")}
`;
const type$1 = `
:host {
--default-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
--default-font-family-mono: "Courier New", Courier, monospace;
}
.typography-f-s {
font-family: var(--font-family, var(--default-font-family));
font-optical-sizing: auto;
font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0;
}
.typography-f-sf {
font-family: var(--font-family-flex, var(--default-font-family));
font-optical-sizing: auto;
}
.typography-f-c {
font-family: var(--font-family-mono, var(--default-font-family));
font-optical-sizing: auto;
font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0;
}
.typography-v-r {
font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 100;
}
.typography-ta-s {
text-align: start;
}
.typography-ta-c {
text-align: center;
}
.typography-fs-n {
font-style: normal;
}
.typography-fs-i {
font-style: italic;
}
.typography-sz-ls {
font-size: 11px;
line-height: 16px;
}
.typography-sz-lm {
font-size: 12px;
line-height: 16px;
}
.typography-sz-ll {
font-size: 14px;
line-height: 20px;
}
.typography-sz-bs {
font-size: 12px;
line-height: 16px;
}
.typography-sz-bm {
font-size: 14px;
line-height: 20px;
}
.typography-sz-bl {
font-size: 16px;
line-height: 24px;
}
.typography-sz-ts {
font-size: 14px;
line-height: 20px;
}
.typography-sz-tm {
font-size: 16px;
line-height: 24px;
}
.typography-sz-tl {
font-size: 22px;
line-height: 28px;
}
.typography-sz-hs {
font-size: 24px;
line-height: 32px;
}
.typography-sz-hm {
font-size: 28px;
line-height: 36px;
}
.typography-sz-hl {
font-size: 32px;
line-height: 40px;
}
.typography-sz-ds {
font-size: 36px;
line-height: 44px;
}
.typography-sz-dm {
font-size: 45px;
line-height: 52px;
}
.typography-sz-dl {
font-size: 57px;
line-height: 64px;
}
.typography-ws-p {
white-space: pre-line;
}
.typography-ws-nw {
white-space: nowrap;
}
.typography-td-none {
text-decoration: none;
}
/** Weights **/
${new Array(9).fill(0).map((_, idx) => {
const weight = (idx + 1) * 100;
return `.typography-w-${weight} { font-weight: ${weight}; }`;
}).join("\n")}
`;
const structuralStyles$1 = [
behavior,
border,
colors,
icons,
layout,
opacity,
type$1
].flat(Infinity).join("\n");
var guards_exports = /* @__PURE__ */ __exportAll({
isComponentArrayReference: () => isComponentArrayReference,
isObject: () => isObject$1,
isPath: () => isPath,
isResolvedAudioPlayer: () => isResolvedAudioPlayer,
isResolvedButton: () => isResolvedButton,
isResolvedCard: () => isResolvedCard,
isResolvedCheckbox: () => isResolvedCheckbox,
isResolvedColumn: () => isResolvedColumn,
isResolvedDateTimeInput: () => isResolvedDateTimeInput,
isResolvedDivider: () => isResolvedDivider,
isResolvedIcon: () => isResolvedIcon,
isResolvedImage: () => isResolvedImage,
isResolvedList: () => isResolvedList,
isResolvedModal: () => isResolvedModal,
isResolvedMultipleChoice: () => isResolvedMultipleChoice,
isResolvedRow: () => isResolvedRow,
isResolvedSlider: () => isResolvedSlider,
isResolvedTabs: () => isResolvedTabs,
isResolvedText: () => isResolvedText,
isResolvedTextField: () => isResolvedTextField,
isResolvedVideo: () => isResolvedVideo,
isValueMap: () => isValueMap
});
function isValueMap(value) {
return isObject$1(value) && "key" in value;
}
function isPath(key, value) {
return key === "path" && typeof value === "string";
}
function isObject$1(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function isComponentArrayReference(value) {
if (!isObject$1(value)) return false;
return "explicitList" in value || "template" in value;
}
function isStringValue(value) {
return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "string" || "literalString" in value);
}
function isNumberValue(value) {
return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "number" || "literalNumber" in value);
}
function isBooleanValue(value) {
return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "boolean" || "literalBoolean" in value);
}
function isAnyComponentNode(value) {
if (!isObject$1(value)) return false;
const hasBaseKeys = "id" in value && "type" in value && "properties" in value;
if (!hasBaseKeys) return false;
return true;
}
function isResolvedAudioPlayer(props) {
return isObject$1(props) && "url" in props && isStringValue(props.url);
}
function isResolvedButton(props) {
return isObject$1(props) && "child" in props && isAnyComponentNode(props.child) && "action" in props;
}
function isResolvedCard(props) {
if (!isObject$1(props)) return false;
if (!("child" in props)) {
if (!("children" in props)) {
return false;
} else {
return Array.isArray(props.children) && props.children.every(isAnyComponentNode);
}
}
return isAnyComponentNode(props.child);
}
function isResolvedCheckbox(props) {
return isObject$1(props) && "label" in props && isStringValue(props.label) && "value" in props && isBooleanValue(props.value);
}
function isResolvedColumn(props) {
return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode);
}
function isResolvedDateTimeInput(props) {
return isObject$1(props) && "value" in props && isStringValue(props.value);
}
function isResolvedDivider(props) {
return isObject$1(props);
}
function isResolvedImage(props) {
return isObject$1(props) && "url" in props && isStringValue(props.url);
}
function isResolvedIcon(props) {
return isObject$1(props) && "name" in props && isStringValue(props.name);
}
function isResolvedList(props) {
return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode);
}
function isResolvedModal(props) {
return isObject$1(props) && "entryPointChild" in props && isAnyComponentNode(props.entryPointChild) && "contentChild" in props && isAnyComponentNode(props.contentChild);
}
function isResolvedMultipleChoice(props) {
return isObject$1(props) && "selections" in props;
}
function isResolvedRow(props) {
return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode);
}
function isResolvedSlider(props) {
return isObject$1(props) && "value" in props && isNumberValue(props.value);
}
function isResolvedTabItem(item) {
return isObject$1(item) && "title" in item && isStringValue(item.title) && "child" in item && isAnyComponentNode(item.child);
}
function isResolvedTabs(props) {
return isObject$1(props) && "tabItems" in props && Array.isArray(props.tabItems) && props.tabItems.every(isResolvedTabItem);
}
function isResolvedText(props) {
return isObject$1(props) && "text" in props && isStringValue(props.text);
}
function isResolvedTextField(props) {
return isObject$1(props) && "label" in props && isStringValue(props.label);
}
function isResolvedVideo(props) {
return isObject$1(props) && "url" in props && isStringValue(props.url);
}
/**
* Processes and consolidates A2UIProtocolMessage objects into a structured,
* hierarchical model of UI surfaces.
*/
var A2uiMessageProcessor = class A2uiMessageProcessor {
static {
this.DEFAULT_SURFACE_ID = "@default";
}
#mapCtor = Map;
#arrayCtor = Array;
#setCtor = Set;
#objCtor = Object;
#surfaces;
constructor(opts = {
mapCtor: Map,
arrayCtor: Array,
setCtor: Set,
objCtor: Object
}) {
this.opts = opts;
this.#arrayCtor = opts.arrayCtor;
this.#mapCtor = opts.mapCtor;
this.#setCtor = opts.setCtor;
this.#objCtor = opts.objCtor;
this.#surfaces = new opts.mapCtor();
}
getSurfaces() {
return this.#surfaces;
}
clearSurfaces() {
this.#surfaces.clear();
}
processMessages(messages) {
for (const message of messages) {
if (message.beginRendering) {
this.#handleBeginRendering(message.beginRendering, message.beginRendering.surfaceId);
}
if (message.surfaceUpdate) {
this.#handleSurfaceUpdate(message.surfaceUpdate, message.surfaceUpdate.surfaceId);
}
if (message.dataModelUpdate) {
this.#handleDataModelUpdate(message.dataModelUpdate, message.dataModelUpdate.surfaceId);
}
if (message.deleteSurface) {
this.#handleDeleteSurface(message.deleteSurface);
}
}
}
/**
* Retrieves the data for a given component node and a relative path string.
* This correctly handles the special `.` path, which refers to the node's
* own data context.
*/
getData(node, relativePath, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) {
const surface = this.#getOrCreateSurface(surfaceId);
if (!surface) return null;
let finalPath;
if (relativePath === "." || relativePath === "") {
finalPath = node.dataContextPath ?? "/";
} else {
finalPath = this.resolvePath(relativePath, node.dataContextPath);
}
return this.#getDataByPath(surface.dataModel, finalPath);
}
setData(node, relativePath, value, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) {
if (!node) {
console.warn("No component node set");
return;
}
const surface = this.#getOrCreateSurface(surfaceId);
if (!surface) return;
let finalPath;
if (relativePath === "." || relativePath === "") {
finalPath = node.dataContextPath ?? "/";
} else {
finalPath = this.resolvePath(relativePath, node.dataContextPath);
}
this.#setDataByPath(surface.dataModel, finalPath, value);
}
resolvePath(path, dataContextPath) {
if (path.startsWith("/")) {
return path;
}
if (dataContextPath && dataContextPath !== "/") {
return dataContextPath.endsWith("/") ? `${dataContextP