@telepath-computer/television 0.1.83 → 0.1.85

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,716 @@
1
+ var te = Object.defineProperty;
2
+ var At = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var ee = (n, t, e) => t in n ? te(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
+ var E = (n, t, e) => ee(n, typeof t != "symbol" ? t + "" : t, e), it = (n, t, e) => t.has(n) || At("Cannot " + e);
7
+ var a = (n, t, e) => (it(n, t, "read from private field"), e ? e.call(n) : t.get(n)), g = (n, t, e) => t.has(n) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), $ = (n, t, e, s) => (it(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), y = (n, t, e) => (it(n, t, "access private method"), e);
8
+ function tt(n) {
9
+ return typeof n == "object" && n !== null;
10
+ }
11
+ const ot = /* @__PURE__ */ new WeakMap(), gt = Object.prototype.hasOwnProperty, se = (() => {
12
+ const n = /* @__PURE__ */ new Set();
13
+ let t = HTMLElement.prototype;
14
+ for (; t; ) {
15
+ for (const e of Object.getOwnPropertyNames(t)) n.add(e);
16
+ if (t === Node.prototype) break;
17
+ t = Object.getPrototypeOf(t);
18
+ }
19
+ return n;
20
+ })();
21
+ function ne(n, t) {
22
+ if (tt(n))
23
+ return t === null ? void 0 : n.parse(t);
24
+ if (n === Boolean) return t !== null;
25
+ if (t !== null)
26
+ return n === Number ? Number(t) : t;
27
+ }
28
+ function re(n, t) {
29
+ return tt(n) ? t == null ? null : n.serialize(t) : n === Boolean ? t ? "" : null : t == null ? null : String(t);
30
+ }
31
+ var F, ct, D, v, M, R, N, L, f, U, Tt, Dt, Nt, It, J;
32
+ const w = class w extends HTMLElement {
33
+ constructor() {
34
+ var r;
35
+ super();
36
+ g(this, f);
37
+ g(this, D, /* @__PURE__ */ new Map());
38
+ g(this, v, /* @__PURE__ */ new Map());
39
+ g(this, M, /* @__PURE__ */ new Map());
40
+ g(this, R, !1);
41
+ g(this, N, !1);
42
+ g(this, L, !1);
43
+ const e = y(r = w, F, ct).call(r, this.constructor), s = this;
44
+ for (const i of e.properties)
45
+ gt.call(s, i) && (a(this, M).set(i, s[i]), delete s[i]);
46
+ }
47
+ static get observedAttributes() {
48
+ var e;
49
+ return y(e = w, F, ct).call(e, this).observedAttributes;
50
+ }
51
+ connected() {
52
+ }
53
+ disconnected() {
54
+ }
55
+ changed(e) {
56
+ }
57
+ connectedCallback() {
58
+ if (y(this, f, It).call(this), !a(this, N))
59
+ for (const e of y(this, f, U).call(this).properties)
60
+ a(this, v).has(e) || a(this, v).set(e, void 0);
61
+ this.dispatchEvent(new Event("reactive:connect")), this.connected(), y(this, f, J).call(this);
62
+ }
63
+ disconnectedCallback() {
64
+ this.dispatchEvent(new Event("reactive:disconnect")), this.disconnected();
65
+ }
66
+ attributeChangedCallback(e, s, r) {
67
+ if (s === r) return;
68
+ const i = y(this, f, U).call(this).byAttr.get(e);
69
+ i && (a(this, M).has(i.property) || (this[i.property] = ne(i.type, r)));
70
+ }
71
+ };
72
+ F = new WeakSet(), ct = function(e) {
73
+ const s = ot.get(e);
74
+ if (s) return s;
75
+ const r = [...e.properties ?? []], i = e.attributes ?? {}, o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
76
+ for (const h of r)
77
+ if (se.has(h))
78
+ throw new Error(
79
+ `Reactive property "${h}" collides with a built-in DOM property. Rename it to avoid shadowing the platform API.`
80
+ );
81
+ for (const [h, d] of Object.entries(i)) {
82
+ if (h.includes("-") && d.property === void 0)
83
+ throw new Error(
84
+ `Attribute "${h}" must declare a "property" name because kebab-case cannot be a property.`
85
+ );
86
+ const u = d.property ?? h;
87
+ if (!r.includes(u))
88
+ throw new Error(
89
+ `Attribute '${h}' references property '${u}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`
90
+ );
91
+ if (tt(d.type)) {
92
+ if (typeof d.type.parse != "function")
93
+ throw new Error(
94
+ `Attribute "${h}" custom coercer is missing a \`parse\` function.`
95
+ );
96
+ if (typeof d.type.serialize != "function")
97
+ throw new Error(
98
+ `Attribute "${h}" custom coercer is missing a \`serialize\` function.`
99
+ );
100
+ }
101
+ const b = { attribute: h, property: u, type: d.type };
102
+ o.set(h, b), l.set(u, b);
103
+ }
104
+ for (const h of r) {
105
+ const d = Object.getOwnPropertyDescriptor(e.prototype, h);
106
+ if ((d == null ? void 0 : d.get) !== void 0 || (d == null ? void 0 : d.set) !== void 0)
107
+ throw new Error(
108
+ `Observed property "${h}" cannot define a custom getter/setter. Use changed() for side effects instead.`
109
+ );
110
+ d === void 0 && Object.defineProperty(e.prototype, h, {
111
+ configurable: !0,
112
+ enumerable: !0,
113
+ get() {
114
+ return a(this, D).get(h);
115
+ },
116
+ set(u) {
117
+ y(this, f, Tt).call(this, h, u);
118
+ }
119
+ });
120
+ }
121
+ const c = {
122
+ properties: r,
123
+ observedAttributes: Object.keys(i),
124
+ byAttr: o,
125
+ byProp: l
126
+ };
127
+ return ot.set(e, c), c;
128
+ }, D = new WeakMap(), v = new WeakMap(), M = new WeakMap(), R = new WeakMap(), N = new WeakMap(), L = new WeakMap(), f = new WeakSet(), U = function() {
129
+ return ot.get(this.constructor);
130
+ }, Tt = function(e, s) {
131
+ if (!a(this, L) && a(this, M).has(e)) return;
132
+ const r = a(this, D).get(e);
133
+ y(this, f, Dt).call(this, e, r, s) || (a(this, v).has(e) || a(this, v).set(e, r), a(this, D).set(e, s), a(this, M).delete(e), y(this, f, Nt).call(this, e, s), this.isConnected && y(this, f, J).call(this));
134
+ }, Dt = function(e, s, r) {
135
+ if (Object.is(s, r)) return !0;
136
+ const i = y(this, f, U).call(this).byProp.get(e);
137
+ if (!i || !tt(i.type)) return !1;
138
+ const o = s == null, l = r == null;
139
+ if (o || l) return o && l;
140
+ try {
141
+ return i.type.serialize(s) === i.type.serialize(r);
142
+ } catch {
143
+ return !1;
144
+ }
145
+ }, Nt = function(e, s) {
146
+ const r = y(this, f, U).call(this).byProp.get(e);
147
+ if (!r) return;
148
+ const { attribute: i, type: o } = r;
149
+ if (o === Boolean) {
150
+ const c = this.hasAttribute(i);
151
+ s && !c ? this.setAttribute(i, "") : !s && c && this.removeAttribute(i);
152
+ return;
153
+ }
154
+ const l = re(o, s);
155
+ if (l === null) {
156
+ this.hasAttribute(i) && this.removeAttribute(i);
157
+ return;
158
+ }
159
+ this.getAttribute(i) !== l && this.setAttribute(i, l);
160
+ }, It = function() {
161
+ const e = this, s = y(this, f, U).call(this);
162
+ for (const r of s.properties) {
163
+ if (!gt.call(e, r)) continue;
164
+ const i = e[r];
165
+ delete e[r], !(a(this, M).has(r) || a(this, D).has(r)) && (e[r] = i);
166
+ }
167
+ $(this, L, !0);
168
+ try {
169
+ for (const [r, i] of a(this, M))
170
+ e[r] = i;
171
+ a(this, M).clear();
172
+ } finally {
173
+ $(this, L, !1);
174
+ }
175
+ }, J = function() {
176
+ a(this, R) || !this.isConnected || a(this, N) && a(this, v).size === 0 || ($(this, R, !0), queueMicrotask(() => {
177
+ if ($(this, R, !1), !this.isConnected || a(this, N) && a(this, v).size === 0) return;
178
+ const e = new Map(a(this, v));
179
+ a(this, v).clear(), $(this, N, !0);
180
+ try {
181
+ this.changed(e);
182
+ } catch (s) {
183
+ console.error(s);
184
+ }
185
+ this.isConnected && a(this, v).size > 0 && y(this, f, J).call(this);
186
+ }));
187
+ }, g(w, F), E(w, "properties"), E(w, "attributes");
188
+ let j = w;
189
+ class ie extends j {
190
+ changed() {
191
+ }
192
+ }
193
+ customElements.define("calendar-event", ie);
194
+ /**
195
+ * @license
196
+ * Copyright 2017 Google LLC
197
+ * SPDX-License-Identifier: BSD-3-Clause
198
+ */
199
+ const B = globalThis, $t = (n) => n, et = B.trustedTypes, _t = et ? et.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, kt = "$lit$", H = `lit$${Math.random().toFixed(9).slice(2)}$`, Ot = "?" + H, oe = `<${Ot}>`, O = document, q = () => O.createComment(""), W = (n) => n === null || typeof n != "object" && typeof n != "function", ft = Array.isArray, ae = (n) => ft(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", at = `[
200
+ \f\r]`, z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, bt = /-->/g, vt = />/g, C = RegExp(`>|${at}(?:([^\\s"'>=/]+)(${at}*=${at}*(?:[^
201
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), St = /'/g, Mt = /"/g, Ut = /^(?:script|style|textarea|title)$/i, le = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), xt = le(1), V = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), Et = /* @__PURE__ */ new WeakMap(), T = O.createTreeWalker(O, 129);
202
+ function Rt(n, t) {
203
+ if (!ft(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
204
+ return _t !== void 0 ? _t.createHTML(t) : t;
205
+ }
206
+ const ce = (n, t) => {
207
+ const e = n.length - 1, s = [];
208
+ let r, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = z;
209
+ for (let l = 0; l < e; l++) {
210
+ const c = n[l];
211
+ let h, d, u = -1, b = 0;
212
+ for (; b < c.length && (o.lastIndex = b, d = o.exec(c), d !== null); ) b = o.lastIndex, o === z ? d[1] === "!--" ? o = bt : d[1] !== void 0 ? o = vt : d[2] !== void 0 ? (Ut.test(d[2]) && (r = RegExp("</" + d[2], "g")), o = C) : d[3] !== void 0 && (o = C) : o === C ? d[0] === ">" ? (o = r ?? z, u = -1) : d[1] === void 0 ? u = -2 : (u = o.lastIndex - d[2].length, h = d[1], o = d[3] === void 0 ? C : d[3] === '"' ? Mt : St) : o === Mt || o === St ? o = C : o === bt || o === vt ? o = z : (o = C, r = void 0);
213
+ const P = o === C && n[l + 1].startsWith("/>") ? " " : "";
214
+ i += o === z ? c + oe : u >= 0 ? (s.push(h), c.slice(0, u) + kt + c.slice(u) + H + P) : c + H + (u === -2 ? l : P);
215
+ }
216
+ return [Rt(n, i + (n[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
217
+ };
218
+ class Y {
219
+ constructor({ strings: t, _$litType$: e }, s) {
220
+ let r;
221
+ this.parts = [];
222
+ let i = 0, o = 0;
223
+ const l = t.length - 1, c = this.parts, [h, d] = ce(t, e);
224
+ if (this.el = Y.createElement(h, s), T.currentNode = this.el.content, e === 2 || e === 3) {
225
+ const u = this.el.content.firstChild;
226
+ u.replaceWith(...u.childNodes);
227
+ }
228
+ for (; (r = T.nextNode()) !== null && c.length < l; ) {
229
+ if (r.nodeType === 1) {
230
+ if (r.hasAttributes()) for (const u of r.getAttributeNames()) if (u.endsWith(kt)) {
231
+ const b = d[o++], P = r.getAttribute(u).split(H), X = /([.?@])?(.*)/.exec(b);
232
+ c.push({ type: 1, index: i, name: X[2], strings: P, ctor: X[1] === "." ? de : X[1] === "?" ? ue : X[1] === "@" ? ye : nt }), r.removeAttribute(u);
233
+ } else u.startsWith(H) && (c.push({ type: 6, index: i }), r.removeAttribute(u));
234
+ if (Ut.test(r.tagName)) {
235
+ const u = r.textContent.split(H), b = u.length - 1;
236
+ if (b > 0) {
237
+ r.textContent = et ? et.emptyScript : "";
238
+ for (let P = 0; P < b; P++) r.append(u[P], q()), T.nextNode(), c.push({ type: 2, index: ++i });
239
+ r.append(u[b], q());
240
+ }
241
+ }
242
+ } else if (r.nodeType === 8) if (r.data === Ot) c.push({ type: 2, index: i });
243
+ else {
244
+ let u = -1;
245
+ for (; (u = r.data.indexOf(H, u + 1)) !== -1; ) c.push({ type: 7, index: i }), u += H.length - 1;
246
+ }
247
+ i++;
248
+ }
249
+ }
250
+ static createElement(t, e) {
251
+ const s = O.createElement("template");
252
+ return s.innerHTML = t, s;
253
+ }
254
+ }
255
+ function K(n, t, e = n, s) {
256
+ var o, l;
257
+ if (t === V) return t;
258
+ let r = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
259
+ const i = W(t) ? void 0 : t._$litDirective$;
260
+ return (r == null ? void 0 : r.constructor) !== i && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), i === void 0 ? r = void 0 : (r = new i(n), r._$AT(n, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = r : e._$Cl = r), r !== void 0 && (t = K(n, r._$AS(n, t.values), r, s)), t;
261
+ }
262
+ class he {
263
+ constructor(t, e) {
264
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
265
+ }
266
+ get parentNode() {
267
+ return this._$AM.parentNode;
268
+ }
269
+ get _$AU() {
270
+ return this._$AM._$AU;
271
+ }
272
+ u(t) {
273
+ const { el: { content: e }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? O).importNode(e, !0);
274
+ T.currentNode = r;
275
+ let i = T.nextNode(), o = 0, l = 0, c = s[0];
276
+ for (; c !== void 0; ) {
277
+ if (o === c.index) {
278
+ let h;
279
+ c.type === 2 ? h = new Z(i, i.nextSibling, this, t) : c.type === 1 ? h = new c.ctor(i, c.name, c.strings, this, t) : c.type === 6 && (h = new pe(i, this, t)), this._$AV.push(h), c = s[++l];
280
+ }
281
+ o !== (c == null ? void 0 : c.index) && (i = T.nextNode(), o++);
282
+ }
283
+ return T.currentNode = O, r;
284
+ }
285
+ p(t) {
286
+ let e = 0;
287
+ 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++;
288
+ }
289
+ }
290
+ class Z {
291
+ get _$AU() {
292
+ var t;
293
+ return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
294
+ }
295
+ constructor(t, e, s, r) {
296
+ this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
297
+ }
298
+ get parentNode() {
299
+ let t = this._$AA.parentNode;
300
+ const e = this._$AM;
301
+ return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
302
+ }
303
+ get startNode() {
304
+ return this._$AA;
305
+ }
306
+ get endNode() {
307
+ return this._$AB;
308
+ }
309
+ _$AI(t, e = this) {
310
+ t = K(this, t, e), W(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== V && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ae(t) ? this.k(t) : this._(t);
311
+ }
312
+ O(t) {
313
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
314
+ }
315
+ T(t) {
316
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
317
+ }
318
+ _(t) {
319
+ this._$AH !== m && W(this._$AH) ? this._$AA.nextSibling.data = t : this.T(O.createTextNode(t)), this._$AH = t;
320
+ }
321
+ $(t) {
322
+ var i;
323
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = Y.createElement(Rt(s.h, s.h[0]), this.options)), s);
324
+ if (((i = this._$AH) == null ? void 0 : i._$AD) === r) this._$AH.p(e);
325
+ else {
326
+ const o = new he(r, this), l = o.u(this.options);
327
+ o.p(e), this.T(l), this._$AH = o;
328
+ }
329
+ }
330
+ _$AC(t) {
331
+ let e = Et.get(t.strings);
332
+ return e === void 0 && Et.set(t.strings, e = new Y(t)), e;
333
+ }
334
+ k(t) {
335
+ ft(this._$AH) || (this._$AH = [], this._$AR());
336
+ const e = this._$AH;
337
+ let s, r = 0;
338
+ for (const i of t) r === e.length ? e.push(s = new Z(this.O(q()), this.O(q()), this, this.options)) : s = e[r], s._$AI(i), r++;
339
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
340
+ }
341
+ _$AR(t = this._$AA.nextSibling, e) {
342
+ var s;
343
+ for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t !== this._$AB; ) {
344
+ const r = $t(t).nextSibling;
345
+ $t(t).remove(), t = r;
346
+ }
347
+ }
348
+ setConnected(t) {
349
+ var e;
350
+ this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
351
+ }
352
+ }
353
+ class nt {
354
+ get tagName() {
355
+ return this.element.tagName;
356
+ }
357
+ get _$AU() {
358
+ return this._$AM._$AU;
359
+ }
360
+ constructor(t, e, s, r, i) {
361
+ this.type = 1, this._$AH = m, 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 = m;
362
+ }
363
+ _$AI(t, e = this, s, r) {
364
+ const i = this.strings;
365
+ let o = !1;
366
+ if (i === void 0) t = K(this, t, e, 0), o = !W(t) || t !== this._$AH && t !== V, o && (this._$AH = t);
367
+ else {
368
+ const l = t;
369
+ let c, h;
370
+ for (t = i[0], c = 0; c < i.length - 1; c++) h = K(this, l[s + c], e, c), h === V && (h = this._$AH[c]), o || (o = !W(h) || h !== this._$AH[c]), h === m ? t = m : t !== m && (t += (h ?? "") + i[c + 1]), this._$AH[c] = h;
371
+ }
372
+ o && !r && this.j(t);
373
+ }
374
+ j(t) {
375
+ t === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
376
+ }
377
+ }
378
+ class de extends nt {
379
+ constructor() {
380
+ super(...arguments), this.type = 3;
381
+ }
382
+ j(t) {
383
+ this.element[this.name] = t === m ? void 0 : t;
384
+ }
385
+ }
386
+ class ue extends nt {
387
+ constructor() {
388
+ super(...arguments), this.type = 4;
389
+ }
390
+ j(t) {
391
+ this.element.toggleAttribute(this.name, !!t && t !== m);
392
+ }
393
+ }
394
+ class ye extends nt {
395
+ constructor(t, e, s, r, i) {
396
+ super(t, e, s, r, i), this.type = 5;
397
+ }
398
+ _$AI(t, e = this) {
399
+ if ((t = K(this, t, e, 0) ?? m) === V) return;
400
+ const s = this._$AH, r = t === m && s !== m || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, i = t !== m && (s === m || r);
401
+ r && this.element.removeEventListener(this.name, this, s), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
402
+ }
403
+ handleEvent(t) {
404
+ var e;
405
+ typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
406
+ }
407
+ }
408
+ class pe {
409
+ constructor(t, e, s) {
410
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
411
+ }
412
+ get _$AU() {
413
+ return this._$AM._$AU;
414
+ }
415
+ _$AI(t) {
416
+ K(this, t);
417
+ }
418
+ }
419
+ const lt = B.litHtmlPolyfillSupport;
420
+ lt == null || lt(Y, Z), (B.litHtmlVersions ?? (B.litHtmlVersions = [])).push("3.3.2");
421
+ const fe = (n, t, e) => {
422
+ const s = t;
423
+ let r = s._$litPart$;
424
+ return r === void 0 && (s._$litPart$ = r = new Z(t.insertBefore(q(), null), null, void 0, {})), r._$AI(n), r;
425
+ }, G = 12;
426
+ class Lt extends j {
427
+ changed() {
428
+ fe(
429
+ xt`${Array.from({ length: 24 }, (t, e) => xt`<div
430
+ class="hour-label"
431
+ style="--hour-index: ${e};"
432
+ data-hour=${e}
433
+ >${me(e)}</div>`)}`,
434
+ this
435
+ );
436
+ }
437
+ }
438
+ E(Lt, "properties", []);
439
+ customElements.define("calendar-time-axis", Lt);
440
+ function me(n) {
441
+ const t = n < G ? "AM" : "PM";
442
+ return `${n % G === 0 ? G : n % G} ${t}`;
443
+ }
444
+ const ht = 24, Ae = 8, ge = 6e4, Kt = 23, $e = 59, _e = 1e3, rt = 60, dt = ht * rt, zt = dt * rt * _e, be = /^(\d{4})-(\d{2})-(\d{2})$/, ve = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
445
+ var S, A, _, x, I, k, p, Bt, jt, qt, Wt, yt, Vt, Yt, Ft, pt, Zt, Q;
446
+ class ut extends j {
447
+ constructor() {
448
+ super(...arguments);
449
+ g(this, p);
450
+ E(this, "days", 0);
451
+ E(this, "startDate", "");
452
+ E(this, "startHour");
453
+ g(this, S, null);
454
+ g(this, A, null);
455
+ g(this, _, null);
456
+ g(this, x, null);
457
+ g(this, I, null);
458
+ g(this, k, null);
459
+ }
460
+ connected() {
461
+ $(this, I, setInterval(() => y(this, p, pt).call(this), ge));
462
+ }
463
+ disconnected() {
464
+ var e;
465
+ a(this, I) !== null && (clearInterval(a(this, I)), $(this, I, null)), (e = a(this, x)) == null || e.disconnect();
466
+ }
467
+ changed() {
468
+ const e = y(this, p, jt).call(this), s = we(this.startDate, this.days), r = e.map((l) => ({
469
+ event: l,
470
+ placement: s ? He(l, s) : null
471
+ })), i = De(r), o = Ce(this.startHour, r.map(({ placement: l }) => l));
472
+ if ($(this, k, s), this.style.setProperty("--day-count", String((s == null ? void 0 : s.dayCount) ?? 0)), this.style.setProperty("--hour-count", String(ht)), this.style.setProperty("--start-hour", String(o)), !s) {
473
+ y(this, p, Vt).call(this);
474
+ for (const { event: l } of r)
475
+ Ht(l), this.append(l);
476
+ return;
477
+ }
478
+ y(this, p, Yt).call(this, s), y(this, p, Ft).call(this, r, s, i), y(this, p, pt).call(this), y(this, p, Bt).call(this);
479
+ }
480
+ }
481
+ S = new WeakMap(), A = new WeakMap(), _ = new WeakMap(), x = new WeakMap(), I = new WeakMap(), k = new WeakMap(), p = new WeakSet(), Bt = function() {
482
+ requestAnimationFrame(() => {
483
+ var o, l, c;
484
+ y(this, p, Q).call(this);
485
+ const e = (o = a(this, A)) == null ? void 0 : o.querySelector(":scope > .start-hour-marker");
486
+ if (!e) return;
487
+ const s = (((l = a(this, _)) == null ? void 0 : l.offsetHeight) ?? 0) + (((c = a(this, S)) == null ? void 0 : c.offsetHeight) ?? 0), r = Math.max(this.scrollHeight - this.clientHeight, 0);
488
+ if (r <= 0) return;
489
+ const i = this.scrollTop + (e.getBoundingClientRect().top - this.getBoundingClientRect().top) - s;
490
+ this.scrollTop = Math.max(0, Math.min(i, r));
491
+ });
492
+ }, jt = function() {
493
+ return Array.from(this.querySelectorAll("calendar-event"));
494
+ }, qt = function() {
495
+ a(this, _) || ($(this, _, document.createElement("calendar-headers")), this.append(a(this, _))), a(this, A) || ($(this, A, document.createElement("calendar-grid")), this.append(a(this, A)));
496
+ }, Wt = function(e) {
497
+ a(this, S) || ($(this, S, document.createElement("calendar-allday")), this.insertBefore(a(this, S), a(this, A)));
498
+ const s = e.days.map((r, i) => Se(r, i + 1));
499
+ a(this, S).replaceChildren(...s);
500
+ }, yt = function() {
501
+ var e;
502
+ (e = a(this, S)) == null || e.remove(), $(this, S, null), this.style.removeProperty("--allday-lane-count");
503
+ }, Vt = function() {
504
+ var e, s, r;
505
+ (e = a(this, x)) == null || e.disconnect(), (s = a(this, _)) == null || s.remove(), y(this, p, yt).call(this), (r = a(this, A)) == null || r.remove(), $(this, _, null), $(this, A, null), this.style.removeProperty("--headers-height"), this.style.removeProperty("--allday-lane-count");
506
+ }, Yt = function(e) {
507
+ y(this, p, qt).call(this);
508
+ const s = e.days.map((i, o) => Me(i, o + 1)), r = [
509
+ document.createElement("calendar-time-axis"),
510
+ ...e.days.map((i, o) => xe(i, o + 1)),
511
+ Ee()
512
+ ];
513
+ a(this, _).replaceChildren(...s), a(this, A).replaceChildren(...r), y(this, p, Zt).call(this);
514
+ }, Ft = function(e, s, r) {
515
+ const i = e.filter(Jt);
516
+ if (i.length > 0) {
517
+ y(this, p, Wt).call(this, s), this.style.setProperty("--allday-lane-count", String(r));
518
+ for (const { event: o, placement: l } of i)
519
+ Pt(o, l), a(this, S).append(o);
520
+ } else
521
+ y(this, p, yt).call(this);
522
+ for (const { event: o, placement: l } of e.filter(Qt).sort(Gt))
523
+ Pt(o, l), a(this, A).append(o);
524
+ for (const { event: o } of e.filter(({ placement: l }) => l === null))
525
+ Ht(o), this.append(o);
526
+ }, pt = function() {
527
+ var d, u;
528
+ const e = (d = a(this, A)) == null ? void 0 : d.querySelector(":scope > .now-line"), s = (u = a(this, A)) == null ? void 0 : u.querySelector(":scope > .now-line-faint");
529
+ if (!a(this, A) || !a(this, k)) {
530
+ s == null || s.remove(), e == null || e.remove();
531
+ return;
532
+ }
533
+ const r = /* @__PURE__ */ new Date(), o = mt(r.getFullYear(), r.getMonth() + 1, r.getDate()) - a(this, k).startDayKey + 1;
534
+ if (o < 1 || o > a(this, k).dayCount) {
535
+ s == null || s.remove(), e == null || e.remove();
536
+ return;
537
+ }
538
+ const l = (r.getHours() + r.getMinutes() / rt) / ht, c = s ?? document.createElement("div");
539
+ s || (c.classList.add("now-line-faint"), a(this, A).append(c));
540
+ const h = e ?? document.createElement("div");
541
+ e || (h.classList.add("now-line"), a(this, A).append(h)), c.style.setProperty("--y-fraction", String(l)), h.style.setProperty("--day-index", String(o)), h.style.setProperty("--y-fraction", String(l));
542
+ }, Zt = function() {
543
+ var e;
544
+ if (!a(this, _)) {
545
+ (e = a(this, x)) == null || e.disconnect(), this.style.removeProperty("--headers-height");
546
+ return;
547
+ }
548
+ if (typeof ResizeObserver != "function") {
549
+ y(this, p, Q).call(this);
550
+ return;
551
+ }
552
+ a(this, x) || $(this, x, new ResizeObserver(() => y(this, p, Q).call(this))), a(this, x).disconnect(), a(this, x).observe(a(this, _));
553
+ }, Q = function() {
554
+ var e;
555
+ this.style.setProperty("--headers-height", `${((e = a(this, _)) == null ? void 0 : e.offsetHeight) ?? 0}px`);
556
+ }, E(ut, "properties", ["days", "startDate", "startHour"]), E(ut, "attributes", {
557
+ days: { type: Number },
558
+ "start-date": { type: String, property: "startDate" },
559
+ "start-hour": { type: Number, property: "startHour" }
560
+ });
561
+ customElements.define("calendar-week", ut);
562
+ function Se(n, t) {
563
+ const e = document.createElement("calendar-cell");
564
+ return e.setAttribute("date", n.iso), e.style.setProperty("--day-index", String(t)), e;
565
+ }
566
+ function Me(n, t) {
567
+ const e = document.createElement("calendar-day");
568
+ e.setAttribute("date", n.iso), e.style.setProperty("--day-index", String(t));
569
+ const s = document.createElement("span");
570
+ s.classList.add("weekday"), s.textContent = n.labelWeekday;
571
+ const r = document.createElement("span");
572
+ return r.classList.add("date-num"), r.textContent = n.labelDay, e.append(s, r), e;
573
+ }
574
+ function xe(n, t) {
575
+ const e = document.createElement("calendar-column");
576
+ return e.setAttribute("date", n.iso), e.style.setProperty("--day-index", String(t)), e;
577
+ }
578
+ function Ee() {
579
+ const n = document.createElement("div");
580
+ return n.classList.add("start-hour-marker"), n;
581
+ }
582
+ function Pt(n, t) {
583
+ const e = Pe(n), s = n.getAttribute("title") ?? "";
584
+ if (e.querySelector("h3").textContent = s, t.kind === "all-day") {
585
+ n.style.setProperty("--day-start", String(t.dayStart)), n.style.setProperty("--day-span", String(t.daySpan)), n.style.setProperty("--lane-index", String(t.laneIndex)), n.style.removeProperty("--day-index"), n.style.removeProperty("--y-start"), n.style.removeProperty("--y-end"), n.style.removeProperty("--cascade-depth");
586
+ return;
587
+ }
588
+ n.style.setProperty("--day-index", String(t.dayIndex)), n.style.setProperty("--y-start", String(t.yStart)), n.style.setProperty("--y-end", String(t.yEnd)), n.style.setProperty("--cascade-depth", String(t.cascadeDepth)), n.style.removeProperty("--day-start"), n.style.removeProperty("--day-span"), n.style.removeProperty("--lane-index");
589
+ }
590
+ function Ht(n) {
591
+ var t;
592
+ (t = n.querySelector(":scope > .event-block")) == null || t.remove(), n.style.removeProperty("--day-index"), n.style.removeProperty("--y-start"), n.style.removeProperty("--y-end"), n.style.removeProperty("--day-start"), n.style.removeProperty("--day-span"), n.style.removeProperty("--lane-index"), n.style.removeProperty("--cascade-depth");
593
+ }
594
+ function Pe(n) {
595
+ let t = n.querySelector(":scope > .event-block");
596
+ if (t) return t;
597
+ t = document.createElement("div"), t.classList.add("event-block");
598
+ const e = document.createElement("div");
599
+ e.classList.add("event-block-inner");
600
+ const s = document.createElement("h3");
601
+ return e.append(s), t.append(e), n.append(t), t;
602
+ }
603
+ function He(n, t) {
604
+ const e = n.getAttribute("title"), s = n.getAttribute("start"), r = n.getAttribute("end");
605
+ if (e === null || s === null || r === null) return null;
606
+ if (n.hasAttribute("all-day")) {
607
+ const c = st(s), h = st(r);
608
+ if (!c || !h || h.dayKey <= c.dayKey) return null;
609
+ const d = Math.max(c.dayKey, t.startDayKey), u = Math.min(h.dayKey, t.endDayKey);
610
+ return u <= d ? null : {
611
+ kind: "all-day",
612
+ daySpan: u - d,
613
+ dayStart: d - t.startDayKey + 1,
614
+ laneIndex: 1
615
+ };
616
+ }
617
+ const i = Ct(s), o = Ct(r);
618
+ if (!i || !o || i.dayKey !== o.dayKey || o.totalMinutes <= i.totalMinutes) return null;
619
+ const l = i.dayKey - t.startDayKey + 1;
620
+ return l < 1 || l > t.dayCount ? null : {
621
+ cascadeDepth: 0,
622
+ kind: "timed",
623
+ dayIndex: l,
624
+ endMinutes: o.totalMinutes,
625
+ startHour: i.hour,
626
+ startMinutes: i.totalMinutes,
627
+ yEnd: o.totalMinutes / dt,
628
+ yStart: i.totalMinutes / dt
629
+ };
630
+ }
631
+ function Ce(n, t) {
632
+ if (Number.isInteger(n) && n >= 0 && n <= Kt)
633
+ return n;
634
+ const e = t.filter((s) => (s == null ? void 0 : s.kind) === "timed").map((s) => s.startHour);
635
+ return e.length > 0 ? Math.max(Math.min(...e) - 1, 0) : Ae;
636
+ }
637
+ function we(n, t) {
638
+ if (!Number.isInteger(t) || t < 1) return null;
639
+ const e = st(n);
640
+ if (!e) return null;
641
+ const s = Array.from({ length: t }, (r, i) => Te(e, i));
642
+ return {
643
+ dayCount: t,
644
+ days: s,
645
+ endDayKey: e.dayKey + t,
646
+ startDayKey: e.dayKey
647
+ };
648
+ }
649
+ function st(n) {
650
+ const t = be.exec(n);
651
+ if (!t) return null;
652
+ const [, e, s, r] = t, i = Number(e), o = Number(s), l = Number(r);
653
+ if (!Xt(i, o, l)) return null;
654
+ const c = new Date(i, o - 1, l);
655
+ return {
656
+ dayKey: mt(i, o, l),
657
+ iso: n,
658
+ labelDay: String(l),
659
+ labelWeekday: c.toLocaleDateString(void 0, { weekday: "short" })
660
+ };
661
+ }
662
+ function Ct(n) {
663
+ const t = ve.exec(n);
664
+ if (!t) return null;
665
+ const [, e, s, r, i, o] = t, l = Number(e), c = Number(s), h = Number(r), d = Number(i), u = Number(o);
666
+ return !Xt(l, c, h) || !Number.isInteger(d) || d < 0 || d > Kt || !Number.isInteger(u) || u < 0 || u > $e ? null : {
667
+ dayKey: mt(l, c, h),
668
+ hour: d,
669
+ totalMinutes: d * rt + u
670
+ };
671
+ }
672
+ function Te(n, t) {
673
+ const e = new Date((n.dayKey + t) * zt), s = e.getUTCFullYear(), r = e.getUTCMonth() + 1, i = e.getUTCDate();
674
+ return st(
675
+ `${s}-${String(r).padStart(2, "0")}-${String(i).padStart(2, "0")}`
676
+ );
677
+ }
678
+ function Xt(n, t, e) {
679
+ const s = new Date(Date.UTC(n, t - 1, e));
680
+ return s.getUTCFullYear() === n && s.getUTCMonth() === t - 1 && s.getUTCDate() === e;
681
+ }
682
+ function mt(n, t, e) {
683
+ return Date.UTC(n, t - 1, e) / zt;
684
+ }
685
+ function De(n) {
686
+ const t = [];
687
+ for (const { placement: s } of n.filter(Jt)) {
688
+ const r = s.dayStart + s.daySpan;
689
+ let i = t.findIndex(
690
+ (o) => o.every((l) => !wt(l.dayStart, l.dayStart + l.daySpan, s.dayStart, r))
691
+ );
692
+ i === -1 && (t.push([]), i = t.length - 1), s.laneIndex = i + 1, t[i].push(s);
693
+ }
694
+ const e = /* @__PURE__ */ new Map();
695
+ for (const { placement: s } of n.filter(Qt).sort(Gt)) {
696
+ const r = e.get(s.dayIndex) ?? [];
697
+ s.cascadeDepth = r.filter(
698
+ (i) => i.startMinutes < s.startMinutes && wt(i.startMinutes, i.endMinutes, s.startMinutes, s.endMinutes)
699
+ ).length, r.push(s), e.set(s.dayIndex, r);
700
+ }
701
+ return t.length;
702
+ }
703
+ function Gt(n, t) {
704
+ return n.placement.dayIndex - t.placement.dayIndex || n.placement.startMinutes - t.placement.startMinutes || n.placement.endMinutes - t.placement.endMinutes;
705
+ }
706
+ function Jt(n) {
707
+ var t;
708
+ return ((t = n.placement) == null ? void 0 : t.kind) === "all-day";
709
+ }
710
+ function Qt(n) {
711
+ var t;
712
+ return ((t = n.placement) == null ? void 0 : t.kind) === "timed";
713
+ }
714
+ function wt(n, t, e, s) {
715
+ return n < s && e < t;
716
+ }