@cal.macconnachie/web-components 0.0.20 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,894 @@
1
+ const M = globalThis, B = M.ShadowRoot && (M.ShadyCSS === void 0 || M.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, D = Symbol(), K = /* @__PURE__ */ new WeakMap();
2
+ let ot = class {
3
+ constructor(t, e, s) {
4
+ if (this._$cssResult$ = !0, s !== D) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
+ this.cssText = t, this.t = e;
6
+ }
7
+ get styleSheet() {
8
+ let t = this.o;
9
+ const e = this.t;
10
+ if (B && t === void 0) {
11
+ const s = e !== void 0 && e.length === 1;
12
+ s && (t = K.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && K.set(e, t));
13
+ }
14
+ return t;
15
+ }
16
+ toString() {
17
+ return this.cssText;
18
+ }
19
+ };
20
+ const ct = (o) => new ot(typeof o == "string" ? o : o + "", void 0, D), dt = (o, ...t) => {
21
+ const e = o.length === 1 ? o[0] : t.reduce(((s, r, i) => s + ((n) => {
22
+ if (n._$cssResult$ === !0) return n.cssText;
23
+ if (typeof n == "number") return n;
24
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
+ })(r) + o[i + 1]), o[0]);
26
+ return new ot(e, o, D);
27
+ }, ut = (o, t) => {
28
+ if (B) o.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
+ else for (const e of t) {
30
+ const s = document.createElement("style"), r = M.litNonce;
31
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, o.appendChild(s);
32
+ }
33
+ }, G = B ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((t) => {
34
+ let e = "";
35
+ for (const s of t.cssRules) e += s.cssText;
36
+ return ct(e);
37
+ })(o) : o;
38
+ const { is: pt, defineProperty: ft, getOwnPropertyDescriptor: bt, getOwnPropertyNames: $t, getOwnPropertySymbols: gt, getPrototypeOf: mt } = Object, R = globalThis, J = R.trustedTypes, vt = J ? J.emptyScript : "", yt = R.reactiveElementPolyfillSupport, x = (o, t) => o, H = { toAttribute(o, t) {
39
+ switch (t) {
40
+ case Boolean:
41
+ o = o ? vt : null;
42
+ break;
43
+ case Object:
44
+ case Array:
45
+ o = o == null ? o : JSON.stringify(o);
46
+ }
47
+ return o;
48
+ }, fromAttribute(o, t) {
49
+ let e = o;
50
+ switch (t) {
51
+ case Boolean:
52
+ e = o !== null;
53
+ break;
54
+ case Number:
55
+ e = o === null ? null : Number(o);
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ try {
60
+ e = JSON.parse(o);
61
+ } catch {
62
+ e = null;
63
+ }
64
+ }
65
+ return e;
66
+ } }, L = (o, t) => !pt(o, t), Z = { attribute: !0, type: String, converter: H, reflect: !1, useDefault: !1, hasChanged: L };
67
+ Symbol.metadata ??= Symbol("metadata"), R.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
+ let w = class extends HTMLElement {
69
+ static addInitializer(t) {
70
+ this._$Ei(), (this.l ??= []).push(t);
71
+ }
72
+ static get observedAttributes() {
73
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
74
+ }
75
+ static createProperty(t, e = Z) {
76
+ 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) {
77
+ const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
78
+ r !== void 0 && ft(this.prototype, t, r);
79
+ }
80
+ }
81
+ static getPropertyDescriptor(t, e, s) {
82
+ const { get: r, set: i } = bt(this.prototype, t) ?? { get() {
83
+ return this[e];
84
+ }, set(n) {
85
+ this[e] = n;
86
+ } };
87
+ return { get: r, set(n) {
88
+ const l = r?.call(this);
89
+ i?.call(this, n), this.requestUpdate(t, l, s);
90
+ }, configurable: !0, enumerable: !0 };
91
+ }
92
+ static getPropertyOptions(t) {
93
+ return this.elementProperties.get(t) ?? Z;
94
+ }
95
+ static _$Ei() {
96
+ if (this.hasOwnProperty(x("elementProperties"))) return;
97
+ const t = mt(this);
98
+ t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
99
+ }
100
+ static finalize() {
101
+ if (this.hasOwnProperty(x("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(x("properties"))) {
103
+ const e = this.properties, s = [...$t(e), ...gt(e)];
104
+ for (const r of s) this.createProperty(r, e[r]);
105
+ }
106
+ const t = this[Symbol.metadata];
107
+ if (t !== null) {
108
+ const e = litPropertyMetadata.get(t);
109
+ if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r);
110
+ }
111
+ this._$Eh = /* @__PURE__ */ new Map();
112
+ for (const [e, s] of this.elementProperties) {
113
+ const r = this._$Eu(e, s);
114
+ r !== void 0 && this._$Eh.set(r, e);
115
+ }
116
+ this.elementStyles = this.finalizeStyles(this.styles);
117
+ }
118
+ static finalizeStyles(t) {
119
+ const e = [];
120
+ if (Array.isArray(t)) {
121
+ const s = new Set(t.flat(1 / 0).reverse());
122
+ for (const r of s) e.unshift(G(r));
123
+ } else t !== void 0 && e.push(G(t));
124
+ return e;
125
+ }
126
+ static _$Eu(t, e) {
127
+ const s = e.attribute;
128
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
129
+ }
130
+ constructor() {
131
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
132
+ }
133
+ _$Ev() {
134
+ this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
135
+ }
136
+ addController(t) {
137
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
138
+ }
139
+ removeController(t) {
140
+ this._$EO?.delete(t);
141
+ }
142
+ _$E_() {
143
+ const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
144
+ for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
145
+ t.size > 0 && (this._$Ep = t);
146
+ }
147
+ createRenderRoot() {
148
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
+ return ut(t, this.constructor.elementStyles), t;
150
+ }
151
+ connectedCallback() {
152
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
153
+ }
154
+ enableUpdating(t) {
155
+ }
156
+ disconnectedCallback() {
157
+ this._$EO?.forEach(((t) => t.hostDisconnected?.()));
158
+ }
159
+ attributeChangedCallback(t, e, s) {
160
+ this._$AK(t, s);
161
+ }
162
+ _$ET(t, e) {
163
+ const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
164
+ if (r !== void 0 && s.reflect === !0) {
165
+ const i = (s.converter?.toAttribute !== void 0 ? s.converter : H).toAttribute(e, s.type);
166
+ this._$Em = t, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
167
+ }
168
+ }
169
+ _$AK(t, e) {
170
+ const s = this.constructor, r = s._$Eh.get(t);
171
+ if (r !== void 0 && this._$Em !== r) {
172
+ const i = s.getPropertyOptions(r), n = typeof i.converter == "function" ? { fromAttribute: i.converter } : i.converter?.fromAttribute !== void 0 ? i.converter : H;
173
+ this._$Em = r;
174
+ const l = n.fromAttribute(e, i.type);
175
+ this[r] = l ?? this._$Ej?.get(r) ?? l, this._$Em = null;
176
+ }
177
+ }
178
+ requestUpdate(t, e, s) {
179
+ if (t !== void 0) {
180
+ const r = this.constructor, i = this[t];
181
+ if (s ??= r.getPropertyOptions(t), !((s.hasChanged ?? L)(i, e) || s.useDefault && s.reflect && i === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, s)))) return;
182
+ this.C(t, e, s);
183
+ }
184
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
185
+ }
186
+ C(t, e, { useDefault: s, reflect: r, wrapped: i }, n) {
187
+ s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), i !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
188
+ }
189
+ async _$EP() {
190
+ this.isUpdatePending = !0;
191
+ try {
192
+ await this._$ES;
193
+ } catch (e) {
194
+ Promise.reject(e);
195
+ }
196
+ const t = this.scheduleUpdate();
197
+ return t != null && await t, !this.isUpdatePending;
198
+ }
199
+ scheduleUpdate() {
200
+ return this.performUpdate();
201
+ }
202
+ performUpdate() {
203
+ if (!this.isUpdatePending) return;
204
+ if (!this.hasUpdated) {
205
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
206
+ for (const [r, i] of this._$Ep) this[r] = i;
207
+ this._$Ep = void 0;
208
+ }
209
+ const s = this.constructor.elementProperties;
210
+ if (s.size > 0) for (const [r, i] of s) {
211
+ const { wrapped: n } = i, l = this[r];
212
+ n !== !0 || this._$AL.has(r) || l === void 0 || this.C(r, void 0, i, l);
213
+ }
214
+ }
215
+ let t = !1;
216
+ const e = this._$AL;
217
+ try {
218
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(e)) : this._$EM();
219
+ } catch (s) {
220
+ throw t = !1, this._$EM(), s;
221
+ }
222
+ t && this._$AE(e);
223
+ }
224
+ willUpdate(t) {
225
+ }
226
+ _$AE(t) {
227
+ this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
228
+ }
229
+ _$EM() {
230
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
231
+ }
232
+ get updateComplete() {
233
+ return this.getUpdateComplete();
234
+ }
235
+ getUpdateComplete() {
236
+ return this._$ES;
237
+ }
238
+ shouldUpdate(t) {
239
+ return !0;
240
+ }
241
+ update(t) {
242
+ this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
243
+ }
244
+ updated(t) {
245
+ }
246
+ firstUpdated(t) {
247
+ }
248
+ };
249
+ w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[x("elementProperties")] = /* @__PURE__ */ new Map(), w[x("finalized")] = /* @__PURE__ */ new Map(), yt?.({ ReactiveElement: w }), (R.reactiveElementVersions ??= []).push("2.1.1");
250
+ const I = globalThis, N = I.trustedTypes, F = N ? N.createPolicy("lit-html", { createHTML: (o) => o }) : void 0, it = "$lit$", g = `lit$${Math.random().toFixed(9).slice(2)}$`, nt = "?" + g, _t = `<${nt}>`, _ = document, P = () => _.createComment(""), k = (o) => o === null || typeof o != "object" && typeof o != "function", W = Array.isArray, At = (o) => W(o) || typeof o?.[Symbol.iterator] == "function", j = `[
251
+ \f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, v = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), Y = /'/g, tt = /"/g, at = /^(?:script|style|textarea|title)$/i, wt = (o) => (t, ...e) => ({ _$litType$: o, strings: t, values: e }), et = wt(1), A = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), y = _.createTreeWalker(_, 129);
253
+ function lt(o, t) {
254
+ if (!W(o) || !o.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
+ return F !== void 0 ? F.createHTML(t) : t;
256
+ }
257
+ const Et = (o, t) => {
258
+ const e = o.length - 1, s = [];
259
+ let r, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = S;
260
+ for (let l = 0; l < e; l++) {
261
+ const a = o[l];
262
+ let c, u, h = -1, f = 0;
263
+ for (; f < a.length && (n.lastIndex = f, u = n.exec(a), u !== null); ) f = n.lastIndex, n === S ? u[1] === "!--" ? n = Q : u[1] !== void 0 ? n = X : u[2] !== void 0 ? (at.test(u[2]) && (r = RegExp("</" + u[2], "g")), n = v) : u[3] !== void 0 && (n = v) : n === v ? u[0] === ">" ? (n = r ?? S, h = -1) : u[1] === void 0 ? h = -2 : (h = n.lastIndex - u[2].length, c = u[1], n = u[3] === void 0 ? v : u[3] === '"' ? tt : Y) : n === tt || n === Y ? n = v : n === Q || n === X ? n = S : (n = v, r = void 0);
264
+ const $ = n === v && o[l + 1].startsWith("/>") ? " " : "";
265
+ i += n === S ? a + _t : h >= 0 ? (s.push(c), a.slice(0, h) + it + a.slice(h) + g + $) : a + g + (h === -2 ? l : $);
266
+ }
267
+ return [lt(o, i + (o[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
268
+ };
269
+ class T {
270
+ constructor({ strings: t, _$litType$: e }, s) {
271
+ let r;
272
+ this.parts = [];
273
+ let i = 0, n = 0;
274
+ const l = t.length - 1, a = this.parts, [c, u] = Et(t, e);
275
+ if (this.el = T.createElement(c, s), y.currentNode = this.el.content, e === 2 || e === 3) {
276
+ const h = this.el.content.firstChild;
277
+ h.replaceWith(...h.childNodes);
278
+ }
279
+ for (; (r = y.nextNode()) !== null && a.length < l; ) {
280
+ if (r.nodeType === 1) {
281
+ if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(it)) {
282
+ const f = u[n++], $ = r.getAttribute(h).split(g), O = /([.?@])?(.*)/.exec(f);
283
+ a.push({ type: 1, index: i, name: O[2], strings: $, ctor: O[1] === "." ? xt : O[1] === "?" ? Ct : O[1] === "@" ? Pt : z }), r.removeAttribute(h);
284
+ } else h.startsWith(g) && (a.push({ type: 6, index: i }), r.removeAttribute(h));
285
+ if (at.test(r.tagName)) {
286
+ const h = r.textContent.split(g), f = h.length - 1;
287
+ if (f > 0) {
288
+ r.textContent = N ? N.emptyScript : "";
289
+ for (let $ = 0; $ < f; $++) r.append(h[$], P()), y.nextNode(), a.push({ type: 2, index: ++i });
290
+ r.append(h[f], P());
291
+ }
292
+ }
293
+ } else if (r.nodeType === 8) if (r.data === nt) a.push({ type: 2, index: i });
294
+ else {
295
+ let h = -1;
296
+ for (; (h = r.data.indexOf(g, h + 1)) !== -1; ) a.push({ type: 7, index: i }), h += g.length - 1;
297
+ }
298
+ i++;
299
+ }
300
+ }
301
+ static createElement(t, e) {
302
+ const s = _.createElement("template");
303
+ return s.innerHTML = t, s;
304
+ }
305
+ }
306
+ function E(o, t, e = o, s) {
307
+ if (t === A) return t;
308
+ let r = s !== void 0 ? e._$Co?.[s] : e._$Cl;
309
+ const i = k(t) ? void 0 : t._$litDirective$;
310
+ return r?.constructor !== i && (r?._$AO?.(!1), i === void 0 ? r = void 0 : (r = new i(o), r._$AT(o, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = E(o, r._$AS(o, t.values), r, s)), t;
311
+ }
312
+ class St {
313
+ constructor(t, e) {
314
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
315
+ }
316
+ get parentNode() {
317
+ return this._$AM.parentNode;
318
+ }
319
+ get _$AU() {
320
+ return this._$AM._$AU;
321
+ }
322
+ u(t) {
323
+ const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? _).importNode(e, !0);
324
+ y.currentNode = r;
325
+ let i = y.nextNode(), n = 0, l = 0, a = s[0];
326
+ for (; a !== void 0; ) {
327
+ if (n === a.index) {
328
+ let c;
329
+ a.type === 2 ? c = new U(i, i.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(i, a.name, a.strings, this, t) : a.type === 6 && (c = new kt(i, this, t)), this._$AV.push(c), a = s[++l];
330
+ }
331
+ n !== a?.index && (i = y.nextNode(), n++);
332
+ }
333
+ return y.currentNode = _, r;
334
+ }
335
+ p(t) {
336
+ let e = 0;
337
+ for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
338
+ }
339
+ }
340
+ class U {
341
+ get _$AU() {
342
+ return this._$AM?._$AU ?? this._$Cv;
343
+ }
344
+ constructor(t, e, s, r) {
345
+ this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0;
346
+ }
347
+ get parentNode() {
348
+ let t = this._$AA.parentNode;
349
+ const e = this._$AM;
350
+ return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
351
+ }
352
+ get startNode() {
353
+ return this._$AA;
354
+ }
355
+ get endNode() {
356
+ return this._$AB;
357
+ }
358
+ _$AI(t, e = this) {
359
+ t = E(this, t, e), k(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== A && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : At(t) ? this.k(t) : this._(t);
360
+ }
361
+ O(t) {
362
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
363
+ }
364
+ T(t) {
365
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
366
+ }
367
+ _(t) {
368
+ this._$AH !== d && k(this._$AH) ? this._$AA.nextSibling.data = t : this.T(_.createTextNode(t)), this._$AH = t;
369
+ }
370
+ $(t) {
371
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = T.createElement(lt(s.h, s.h[0]), this.options)), s);
372
+ if (this._$AH?._$AD === r) this._$AH.p(e);
373
+ else {
374
+ const i = new St(r, this), n = i.u(this.options);
375
+ i.p(e), this.T(n), this._$AH = i;
376
+ }
377
+ }
378
+ _$AC(t) {
379
+ let e = st.get(t.strings);
380
+ return e === void 0 && st.set(t.strings, e = new T(t)), e;
381
+ }
382
+ k(t) {
383
+ W(this._$AH) || (this._$AH = [], this._$AR());
384
+ const e = this._$AH;
385
+ let s, r = 0;
386
+ for (const i of t) r === e.length ? e.push(s = new U(this.O(P()), this.O(P()), this, this.options)) : s = e[r], s._$AI(i), r++;
387
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
388
+ }
389
+ _$AR(t = this._$AA.nextSibling, e) {
390
+ for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
391
+ const s = t.nextSibling;
392
+ t.remove(), t = s;
393
+ }
394
+ }
395
+ setConnected(t) {
396
+ this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
397
+ }
398
+ }
399
+ class z {
400
+ get tagName() {
401
+ return this.element.tagName;
402
+ }
403
+ get _$AU() {
404
+ return this._$AM._$AU;
405
+ }
406
+ constructor(t, e, s, r, i) {
407
+ this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = i, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = d;
408
+ }
409
+ _$AI(t, e = this, s, r) {
410
+ const i = this.strings;
411
+ let n = !1;
412
+ if (i === void 0) t = E(this, t, e, 0), n = !k(t) || t !== this._$AH && t !== A, n && (this._$AH = t);
413
+ else {
414
+ const l = t;
415
+ let a, c;
416
+ for (t = i[0], a = 0; a < i.length - 1; a++) c = E(this, l[s + a], e, a), c === A && (c = this._$AH[a]), n ||= !k(c) || c !== this._$AH[a], c === d ? t = d : t !== d && (t += (c ?? "") + i[a + 1]), this._$AH[a] = c;
417
+ }
418
+ n && !r && this.j(t);
419
+ }
420
+ j(t) {
421
+ t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
422
+ }
423
+ }
424
+ class xt extends z {
425
+ constructor() {
426
+ super(...arguments), this.type = 3;
427
+ }
428
+ j(t) {
429
+ this.element[this.name] = t === d ? void 0 : t;
430
+ }
431
+ }
432
+ class Ct extends z {
433
+ constructor() {
434
+ super(...arguments), this.type = 4;
435
+ }
436
+ j(t) {
437
+ this.element.toggleAttribute(this.name, !!t && t !== d);
438
+ }
439
+ }
440
+ class Pt extends z {
441
+ constructor(t, e, s, r, i) {
442
+ super(t, e, s, r, i), this.type = 5;
443
+ }
444
+ _$AI(t, e = this) {
445
+ if ((t = E(this, t, e, 0) ?? d) === A) return;
446
+ const s = this._$AH, r = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, i = t !== d && (s === d || r);
447
+ r && this.element.removeEventListener(this.name, this, s), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
448
+ }
449
+ handleEvent(t) {
450
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
451
+ }
452
+ }
453
+ class kt {
454
+ constructor(t, e, s) {
455
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
456
+ }
457
+ get _$AU() {
458
+ return this._$AM._$AU;
459
+ }
460
+ _$AI(t) {
461
+ E(this, t);
462
+ }
463
+ }
464
+ const Tt = I.litHtmlPolyfillSupport;
465
+ Tt?.(T, U), (I.litHtmlVersions ??= []).push("3.3.1");
466
+ const Ut = (o, t, e) => {
467
+ const s = e?.renderBefore ?? t;
468
+ let r = s._$litPart$;
469
+ if (r === void 0) {
470
+ const i = e?.renderBefore ?? null;
471
+ s._$litPart$ = r = new U(t.insertBefore(P(), i), i, void 0, e ?? {});
472
+ }
473
+ return r._$AI(o), r;
474
+ };
475
+ const V = globalThis;
476
+ let C = class extends w {
477
+ constructor() {
478
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
479
+ }
480
+ createRenderRoot() {
481
+ const t = super.createRenderRoot();
482
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
483
+ }
484
+ update(t) {
485
+ const e = this.render();
486
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ut(e, this.renderRoot, this.renderOptions);
487
+ }
488
+ connectedCallback() {
489
+ super.connectedCallback(), this._$Do?.setConnected(!0);
490
+ }
491
+ disconnectedCallback() {
492
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
493
+ }
494
+ render() {
495
+ return A;
496
+ }
497
+ };
498
+ C._$litElement$ = !0, C.finalized = !0, V.litElementHydrateSupport?.({ LitElement: C });
499
+ const Ot = V.litElementPolyfillSupport;
500
+ Ot?.({ LitElement: C });
501
+ (V.litElementVersions ??= []).push("4.2.1");
502
+ const Mt = (o) => (t, e) => {
503
+ e !== void 0 ? e.addInitializer((() => {
504
+ customElements.define(o, t);
505
+ })) : customElements.define(o, t);
506
+ };
507
+ const Ht = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: L }, Nt = (o = Ht, t, e) => {
508
+ const { kind: s, metadata: r } = e;
509
+ let i = globalThis.litPropertyMetadata.get(r);
510
+ if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()), s === "setter" && ((o = Object.create(o)).wrapped = !0), i.set(e.name, o), s === "accessor") {
511
+ const { name: n } = e;
512
+ return { set(l) {
513
+ const a = t.get.call(this);
514
+ t.set.call(this, l), this.requestUpdate(n, a, o);
515
+ }, init(l) {
516
+ return l !== void 0 && this.C(n, void 0, o, l), l;
517
+ } };
518
+ }
519
+ if (s === "setter") {
520
+ const { name: n } = e;
521
+ return function(l) {
522
+ const a = this[n];
523
+ t.call(this, l), this.requestUpdate(n, a, o);
524
+ };
525
+ }
526
+ throw Error("Unsupported decorator location: " + s);
527
+ };
528
+ function b(o) {
529
+ return (t, e) => typeof e == "object" ? Nt(o, t, e) : ((s, r, i) => {
530
+ const n = r.hasOwnProperty(i);
531
+ return r.constructor.createProperty(i, s), n ? Object.getOwnPropertyDescriptor(r, i) : void 0;
532
+ })(o, t, e);
533
+ }
534
+ const Rt = { ATTRIBUTE: 1 }, zt = (o) => (...t) => ({ _$litDirective$: o, values: t });
535
+ class jt {
536
+ constructor(t) {
537
+ }
538
+ get _$AU() {
539
+ return this._$AM._$AU;
540
+ }
541
+ _$AT(t, e, s) {
542
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
543
+ }
544
+ _$AS(t, e) {
545
+ return this.update(t, e);
546
+ }
547
+ update(t, e) {
548
+ return this.render(...e);
549
+ }
550
+ }
551
+ const rt = zt(class extends jt {
552
+ constructor(o) {
553
+ if (super(o), o.type !== Rt.ATTRIBUTE || o.name !== "class" || o.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
554
+ }
555
+ render(o) {
556
+ return " " + Object.keys(o).filter(((t) => o[t])).join(" ") + " ";
557
+ }
558
+ update(o, [t]) {
559
+ if (this.st === void 0) {
560
+ this.st = /* @__PURE__ */ new Set(), o.strings !== void 0 && (this.nt = new Set(o.strings.join(" ").split(/\s/).filter(((s) => s !== ""))));
561
+ for (const s in t) t[s] && !this.nt?.has(s) && this.st.add(s);
562
+ return this.render(t);
563
+ }
564
+ const e = o.element.classList;
565
+ for (const s of this.st) s in t || (e.remove(s), this.st.delete(s));
566
+ for (const s in t) {
567
+ const r = !!t[s];
568
+ r === this.st.has(s) || this.nt?.has(s) || (r ? (e.add(s), this.st.add(s)) : (e.remove(s), this.st.delete(s)));
569
+ }
570
+ return A;
571
+ }
572
+ });
573
+ var Bt = Object.defineProperty, ht = (o, t, e, s) => {
574
+ for (var r = void 0, i = o.length - 1, n; i >= 0; i--)
575
+ (n = o[i]) && (r = n(t, e, r) || r);
576
+ return r && Bt(t, e, r), r;
577
+ };
578
+ class q extends C {
579
+ constructor() {
580
+ super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
581
+ }
582
+ connectedCallback() {
583
+ super.connectedCallback();
584
+ const t = document.documentElement.getAttribute("data-theme"), e = localStorage.getItem(this.storageKey), s = window.matchMedia("(prefers-color-scheme: dark)").matches;
585
+ t ? this.theme = t : e ? (this.theme = e, this.applyTheme()) : s ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
586
+ }
587
+ disconnectedCallback() {
588
+ window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
589
+ }
590
+ handleGlobalThemeChange(t) {
591
+ const e = t;
592
+ e.target !== this && e.detail.theme !== this.theme && (this.theme = e.detail.theme);
593
+ }
594
+ applyTheme() {
595
+ document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
596
+ new CustomEvent("theme-changed", {
597
+ detail: { theme: this.theme },
598
+ bubbles: !0,
599
+ composed: !0
600
+ })
601
+ );
602
+ }
603
+ }
604
+ ht([
605
+ b({ type: String, attribute: "data-theme", reflect: !0 })
606
+ ], q.prototype, "theme");
607
+ ht([
608
+ b({ type: String, attribute: "storage-key" })
609
+ ], q.prototype, "storageKey");
610
+ var Dt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, m = (o, t, e, s) => {
611
+ for (var r = s > 1 ? void 0 : s ? Lt(t, e) : t, i = o.length - 1, n; i >= 0; i--)
612
+ (n = o[i]) && (r = (s ? n(t, e, r) : n(r)) || r);
613
+ return s && r && Dt(t, e, r), r;
614
+ };
615
+ let p = class extends q {
616
+ constructor() {
617
+ super(...arguments), this.size = "md", this.variant = "primary", this.hover = void 0, this.disabled = !1, this.fullWidth = !1, this.loading = !1, this.type = "button";
618
+ }
619
+ connectedCallback() {
620
+ super.connectedCallback();
621
+ }
622
+ render() {
623
+ const o = {
624
+ "base-button": !0,
625
+ [`base-button--${this.variant}`]: !0,
626
+ [`base-button--${this.size}`]: !0,
627
+ "base-button--full-width": this.fullWidth,
628
+ "base-button--loading": this.loading,
629
+ [`base-button--hover-${this.hover}`]: !!this.hover
630
+ };
631
+ return et`
632
+ <button
633
+ class=${rt(o)}
634
+ type=${this.type}
635
+ ?disabled=${this.disabled || this.loading}
636
+ >
637
+ <span class="button-content">
638
+ <span class=${rt({ "button-text": !0, hidden: this.loading })}>
639
+ <slot></slot>
640
+ </span>
641
+ ${this.loading ? et`
642
+ <span class="loading-container">
643
+ <slot name="loading">
644
+ <svg viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
645
+ <g transform="translate(20, 20)" opacity="0.3">
646
+ <line x1="-11" y1="0" x2="11" y2="0" stroke="#6366f1" stroke-width="2" stroke-linecap="round"/>
647
+ <circle cx="-15" cy="0" r="4" fill="#a855f7" />
648
+ <circle cx="15" cy="0" r="4" fill="#22c55e" />
649
+ </g>
650
+ <g transform="translate(20, 20)">
651
+ <circle cx="-15" cy="0" r="4" fill="none" stroke="#a855f7" stroke-width="0.1" filter="url(#dropShadow)"/>
652
+ <circle cx="15" cy="0" r="4" fill="none" stroke="#22c55e" stroke-width="0.1" filter="url(#dropShadow)"/>
653
+ <line x1="-11.1" y1="1" x2="11.1" y2="1" stroke="#6366f1" stroke-width="0.1"/>
654
+ <line x1="-11.1" y1="-1" x2="11.1" y2="-1" stroke="#6366f1" stroke-width="0.1"/>
655
+ </g>
656
+ </svg>
657
+ </slot>
658
+ </span>
659
+ ` : ""}
660
+ </span>
661
+ </button>
662
+ `;
663
+ }
664
+ };
665
+ p.styles = dt`
666
+ :host {
667
+ display: inline-block;
668
+ }
669
+
670
+ :host([full-width]) {
671
+ display: block;
672
+ width: 100%;
673
+ }
674
+
675
+ /* Base button styles */
676
+ button {
677
+ display: inline-flex;
678
+ align-items: center;
679
+ justify-content: center;
680
+ gap: var(--space-2);
681
+ font-family: var(--font-family-sans);
682
+ font-weight: var(--font-weight-medium);
683
+ line-height: var(--line-height-tight);
684
+ border: 1px solid transparent;
685
+ border-radius: var(--radius-md);
686
+ cursor: pointer;
687
+ transition: all var(--transition-fast);
688
+ text-decoration: none;
689
+ white-space: nowrap;
690
+ user-select: none;
691
+ position: relative;
692
+ width: 100%;
693
+ }
694
+
695
+ button:focus-visible {
696
+ outline: 2px solid var(--color-border-focus);
697
+ outline-offset: 2px;
698
+ }
699
+
700
+ /* Variants */
701
+ .base-button--primary {
702
+ background-color: var(--color-primary);
703
+ color: var(--color-text-inverse);
704
+ border-color: var(--color-primary);
705
+ }
706
+
707
+ .base-button--primary:hover:not(:disabled):not(.base-button--confirming) {
708
+ background-color: var(--color-primary-hover);
709
+ border-color: var(--color-primary-hover);
710
+ }
711
+
712
+ .base-button--secondary {
713
+ background-color: var(--color-secondary);
714
+ color: var(--color-text-inverse);
715
+ border-color: var(--color-secondary);
716
+ }
717
+
718
+ .base-button--secondary:hover:not(:disabled):not(.base-button--confirming) {
719
+ background-color: var(--color-secondary-hover);
720
+ border-color: var(--color-secondary-hover);
721
+ }
722
+
723
+ .base-button--outline {
724
+ background-color: transparent;
725
+ color: var(--color-primary);
726
+ border-color: var(--color-border);
727
+ }
728
+
729
+ .base-button--outline:hover:not(:disabled):not(.base-button--confirming) {
730
+ background-color: var(--color-primary-light);
731
+ border-color: var(--color-primary);
732
+ }
733
+
734
+ .base-button--ghost {
735
+ background-color: transparent;
736
+ color: var(--color-text-secondary);
737
+ border-color: transparent;
738
+ }
739
+
740
+ .base-button--ghost:hover:not(:disabled):not(.base-button--confirming) {
741
+ color: var(--color-text-primary);
742
+ }
743
+
744
+ .base-button--danger {
745
+ background-color: var(--color-primary-bg);
746
+ color: var(--color-text-primary);
747
+ border-color: var(--color-error);
748
+ }
749
+
750
+ .base-button--danger:hover:not(:disabled):not(.base-button--confirming) {
751
+ background-color: var(--color-error-bg);
752
+ border-color: var(--color-error);
753
+ }
754
+
755
+ /* Ghost-hover variants */
756
+ .base-button--ghost-danger {
757
+ background-color: transparent;
758
+ color: var(--color-text-secondary);
759
+ border-color: transparent;
760
+ }
761
+
762
+ .base-button--ghost-danger:hover:not(:disabled):not(.base-button--confirming) {
763
+ color: var(--color-error);
764
+ }
765
+
766
+ .base-button--ghost-warning {
767
+ background-color: transparent;
768
+ color: var(--color-text-secondary);
769
+ border-color: transparent;
770
+ }
771
+
772
+ .base-button--ghost-warning:hover:not(:disabled):not(.base-button--confirming) {
773
+ color: var(--color-warning);
774
+ }
775
+
776
+ .base-button--ghost-info {
777
+ background-color: transparent;
778
+ color: var(--color-text-secondary);
779
+ border-color: transparent;
780
+ }
781
+
782
+ .base-button--ghost-info:hover:not(:disabled):not(.base-button--confirming) {
783
+ color: var(--color-info);
784
+ }
785
+
786
+ .base-button--ghost-success {
787
+ background-color: transparent;
788
+ color: var(--color-text-secondary);
789
+ border-color: transparent;
790
+ }
791
+
792
+ .base-button--ghost-success:hover:not(:disabled):not(.base-button--confirming) {
793
+ color: var(--color-success);
794
+ }
795
+
796
+ /* Sizes */
797
+ .base-button--xs {
798
+ padding: var(--space-1) var(--space-2);
799
+ font-size: var(--font-size-xs);
800
+ }
801
+
802
+ .base-button--sm {
803
+ padding: var(--space-2) var(--space-3);
804
+ font-size: var(--font-size-sm);
805
+ }
806
+
807
+ .base-button--md {
808
+ padding: var(--space-3) var(--space-4);
809
+ font-size: var(--font-size-base);
810
+ }
811
+
812
+ .base-button--lg {
813
+ padding: var(--space-4) var(--space-6);
814
+ font-size: var(--font-size-lg);
815
+ }
816
+
817
+ /* States */
818
+ button:disabled {
819
+ opacity: 0.5;
820
+ cursor: not-allowed;
821
+ }
822
+
823
+ .base-button--loading {
824
+ cursor: wait;
825
+ }
826
+
827
+ .button-content {
828
+ position: relative;
829
+ display: inline-flex;
830
+ align-items: center;
831
+ gap: inherit;
832
+ }
833
+
834
+ .button-text {
835
+ transition: opacity var(--transition-fast);
836
+ }
837
+
838
+ .button-text.hidden {
839
+ opacity: 0;
840
+ }
841
+
842
+ .loading-container {
843
+ filter: brightness(400%);
844
+ position: absolute;
845
+ top: 50%;
846
+ left: 50%;
847
+ transform: translate(-50%, -50%);
848
+ display: flex;
849
+ align-items: center;
850
+ justify-content: center;
851
+ }
852
+
853
+ .loading-container ::slotted(*),
854
+ .loading-container svg {
855
+ width: 1.5em;
856
+ height: 1.5em;
857
+ display: block;
858
+ animation: spin 1s linear infinite;
859
+ }
860
+
861
+ /* Spinner animation */
862
+ @keyframes spin {
863
+ to {
864
+ transform: rotate(360deg);
865
+ }
866
+ }
867
+ `;
868
+ m([
869
+ b({ type: String, attribute: "size" })
870
+ ], p.prototype, "size", 2);
871
+ m([
872
+ b({ type: String, attribute: "variant" })
873
+ ], p.prototype, "variant", 2);
874
+ m([
875
+ b({ type: String, attribute: "hover" })
876
+ ], p.prototype, "hover", 2);
877
+ m([
878
+ b({ type: Boolean, reflect: !0 })
879
+ ], p.prototype, "disabled", 2);
880
+ m([
881
+ b({ type: Boolean, reflect: !0, attribute: "full-width" })
882
+ ], p.prototype, "fullWidth", 2);
883
+ m([
884
+ b({ type: Boolean, reflect: !0, attribute: "loading" })
885
+ ], p.prototype, "loading", 2);
886
+ m([
887
+ b({ type: String, attribute: "type" })
888
+ ], p.prototype, "type", 2);
889
+ p = m([
890
+ Mt("base-button")
891
+ ], p);
892
+ export {
893
+ p as BaseButton
894
+ };