@vinylproject/washtub-player 0.0.0-dev.faaadf8
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.
- package/dist/index.d.ts +83 -0
- package/dist/washtub-embed.js +1105 -0
- package/dist/washtub-embed.js.map +1 -0
- package/dist/washtub-embed.umd.cjs +317 -0
- package/dist/washtub-embed.umd.cjs.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,1105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const R = globalThis, F = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Z = Symbol(), G = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let ct = class {
|
|
8
|
+
constructor(t, e, i) {
|
|
9
|
+
if (this._$cssResult$ = !0, i !== Z) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
|
+
this.cssText = t, this.t = e;
|
|
11
|
+
}
|
|
12
|
+
get styleSheet() {
|
|
13
|
+
let t = this.o;
|
|
14
|
+
const e = this.t;
|
|
15
|
+
if (F && t === void 0) {
|
|
16
|
+
const i = e !== void 0 && e.length === 1;
|
|
17
|
+
i && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && G.set(e, t));
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return this.cssText;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const ft = (s) => new ct(typeof s == "string" ? s : s + "", void 0, Z), gt = (s, ...t) => {
|
|
26
|
+
const e = s.length === 1 ? s[0] : t.reduce((i, r, n) => i + ((a) => {
|
|
27
|
+
if (a._$cssResult$ === !0) return a.cssText;
|
|
28
|
+
if (typeof a == "number") return a;
|
|
29
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
|
+
})(r) + s[n + 1], s[0]);
|
|
31
|
+
return new ct(e, s, Z);
|
|
32
|
+
}, $t = (s, t) => {
|
|
33
|
+
if (F) s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
|
+
else for (const e of t) {
|
|
35
|
+
const i = document.createElement("style"), r = R.litNonce;
|
|
36
|
+
r !== void 0 && i.setAttribute("nonce", r), i.textContent = e.cssText, s.appendChild(i);
|
|
37
|
+
}
|
|
38
|
+
}, Q = F ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
39
|
+
let e = "";
|
|
40
|
+
for (const i of t.cssRules) e += i.cssText;
|
|
41
|
+
return ft(e);
|
|
42
|
+
})(s) : s;
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/
|
|
48
|
+
const { is: vt, defineProperty: _t, getOwnPropertyDescriptor: bt, getOwnPropertyNames: yt, getOwnPropertySymbols: At, getPrototypeOf: wt } = Object, _ = globalThis, Y = _.trustedTypes, kt = Y ? Y.emptyScript : "", j = _.reactiveElementPolyfillSupport, C = (s, t) => s, L = { toAttribute(s, t) {
|
|
49
|
+
switch (t) {
|
|
50
|
+
case Boolean:
|
|
51
|
+
s = s ? kt : null;
|
|
52
|
+
break;
|
|
53
|
+
case Object:
|
|
54
|
+
case Array:
|
|
55
|
+
s = s == null ? s : JSON.stringify(s);
|
|
56
|
+
}
|
|
57
|
+
return s;
|
|
58
|
+
}, fromAttribute(s, t) {
|
|
59
|
+
let e = s;
|
|
60
|
+
switch (t) {
|
|
61
|
+
case Boolean:
|
|
62
|
+
e = s !== null;
|
|
63
|
+
break;
|
|
64
|
+
case Number:
|
|
65
|
+
e = s === null ? null : Number(s);
|
|
66
|
+
break;
|
|
67
|
+
case Object:
|
|
68
|
+
case Array:
|
|
69
|
+
try {
|
|
70
|
+
e = JSON.parse(s);
|
|
71
|
+
} catch {
|
|
72
|
+
e = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return e;
|
|
76
|
+
} }, J = (s, t) => !vt(s, t), tt = { attribute: !0, type: String, converter: L, reflect: !1, useDefault: !1, hasChanged: J };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
let S = class extends HTMLElement {
|
|
79
|
+
static addInitializer(t) {
|
|
80
|
+
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
|
+
}
|
|
82
|
+
static get observedAttributes() {
|
|
83
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
|
+
}
|
|
85
|
+
static createProperty(t, e = tt) {
|
|
86
|
+
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) {
|
|
87
|
+
const i = Symbol(), r = this.getPropertyDescriptor(t, i, e);
|
|
88
|
+
r !== void 0 && _t(this.prototype, t, r);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
static getPropertyDescriptor(t, e, i) {
|
|
92
|
+
const { get: r, set: n } = bt(this.prototype, t) ?? { get() {
|
|
93
|
+
return this[e];
|
|
94
|
+
}, set(a) {
|
|
95
|
+
this[e] = a;
|
|
96
|
+
} };
|
|
97
|
+
return { get: r, set(a) {
|
|
98
|
+
const l = r == null ? void 0 : r.call(this);
|
|
99
|
+
n == null || n.call(this, a), this.requestUpdate(t, l, i);
|
|
100
|
+
}, configurable: !0, enumerable: !0 };
|
|
101
|
+
}
|
|
102
|
+
static getPropertyOptions(t) {
|
|
103
|
+
return this.elementProperties.get(t) ?? tt;
|
|
104
|
+
}
|
|
105
|
+
static _$Ei() {
|
|
106
|
+
if (this.hasOwnProperty(C("elementProperties"))) return;
|
|
107
|
+
const t = wt(this);
|
|
108
|
+
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
109
|
+
}
|
|
110
|
+
static finalize() {
|
|
111
|
+
if (this.hasOwnProperty(C("finalized"))) return;
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
|
|
113
|
+
const e = this.properties, i = [...yt(e), ...At(e)];
|
|
114
|
+
for (const r of i) this.createProperty(r, e[r]);
|
|
115
|
+
}
|
|
116
|
+
const t = this[Symbol.metadata];
|
|
117
|
+
if (t !== null) {
|
|
118
|
+
const e = litPropertyMetadata.get(t);
|
|
119
|
+
if (e !== void 0) for (const [i, r] of e) this.elementProperties.set(i, r);
|
|
120
|
+
}
|
|
121
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
122
|
+
for (const [e, i] of this.elementProperties) {
|
|
123
|
+
const r = this._$Eu(e, i);
|
|
124
|
+
r !== void 0 && this._$Eh.set(r, e);
|
|
125
|
+
}
|
|
126
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
127
|
+
}
|
|
128
|
+
static finalizeStyles(t) {
|
|
129
|
+
const e = [];
|
|
130
|
+
if (Array.isArray(t)) {
|
|
131
|
+
const i = new Set(t.flat(1 / 0).reverse());
|
|
132
|
+
for (const r of i) e.unshift(Q(r));
|
|
133
|
+
} else t !== void 0 && e.push(Q(t));
|
|
134
|
+
return e;
|
|
135
|
+
}
|
|
136
|
+
static _$Eu(t, e) {
|
|
137
|
+
const i = e.attribute;
|
|
138
|
+
return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
|
|
139
|
+
}
|
|
140
|
+
constructor() {
|
|
141
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
142
|
+
}
|
|
143
|
+
_$Ev() {
|
|
144
|
+
var t;
|
|
145
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
|
|
146
|
+
}
|
|
147
|
+
addController(t) {
|
|
148
|
+
var e;
|
|
149
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
|
|
150
|
+
}
|
|
151
|
+
removeController(t) {
|
|
152
|
+
var e;
|
|
153
|
+
(e = this._$EO) == null || e.delete(t);
|
|
154
|
+
}
|
|
155
|
+
_$E_() {
|
|
156
|
+
const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
|
|
157
|
+
for (const i of e.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
158
|
+
t.size > 0 && (this._$Ep = t);
|
|
159
|
+
}
|
|
160
|
+
createRenderRoot() {
|
|
161
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
162
|
+
return $t(t, this.constructor.elementStyles), t;
|
|
163
|
+
}
|
|
164
|
+
connectedCallback() {
|
|
165
|
+
var t;
|
|
166
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
|
|
167
|
+
var i;
|
|
168
|
+
return (i = e.hostConnected) == null ? void 0 : i.call(e);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
enableUpdating(t) {
|
|
172
|
+
}
|
|
173
|
+
disconnectedCallback() {
|
|
174
|
+
var t;
|
|
175
|
+
(t = this._$EO) == null || t.forEach((e) => {
|
|
176
|
+
var i;
|
|
177
|
+
return (i = e.hostDisconnected) == null ? void 0 : i.call(e);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
attributeChangedCallback(t, e, i) {
|
|
181
|
+
this._$AK(t, i);
|
|
182
|
+
}
|
|
183
|
+
_$ET(t, e) {
|
|
184
|
+
var n;
|
|
185
|
+
const i = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, i);
|
|
186
|
+
if (r !== void 0 && i.reflect === !0) {
|
|
187
|
+
const a = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : L).toAttribute(e, i.type);
|
|
188
|
+
this._$Em = t, a == null ? this.removeAttribute(r) : this.setAttribute(r, a), this._$Em = null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
_$AK(t, e) {
|
|
192
|
+
var n, a;
|
|
193
|
+
const i = this.constructor, r = i._$Eh.get(t);
|
|
194
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
195
|
+
const l = i.getPropertyOptions(r), o = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((n = l.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? l.converter : L;
|
|
196
|
+
this._$Em = r;
|
|
197
|
+
const d = o.fromAttribute(e, l.type);
|
|
198
|
+
this[r] = d ?? ((a = this._$Ej) == null ? void 0 : a.get(r)) ?? d, this._$Em = null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
requestUpdate(t, e, i, r = !1, n) {
|
|
202
|
+
var a;
|
|
203
|
+
if (t !== void 0) {
|
|
204
|
+
const l = this.constructor;
|
|
205
|
+
if (r === !1 && (n = this[t]), i ?? (i = l.getPropertyOptions(t)), !((i.hasChanged ?? J)(n, e) || i.useDefault && i.reflect && n === ((a = this._$Ej) == null ? void 0 : a.get(t)) && !this.hasAttribute(l._$Eu(t, i)))) return;
|
|
206
|
+
this.C(t, e, i);
|
|
207
|
+
}
|
|
208
|
+
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
209
|
+
}
|
|
210
|
+
C(t, e, { useDefault: i, reflect: r, wrapped: n }, a) {
|
|
211
|
+
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, a ?? e ?? this[t]), n !== !0 || a !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
|
|
212
|
+
}
|
|
213
|
+
async _$EP() {
|
|
214
|
+
this.isUpdatePending = !0;
|
|
215
|
+
try {
|
|
216
|
+
await this._$ES;
|
|
217
|
+
} catch (e) {
|
|
218
|
+
Promise.reject(e);
|
|
219
|
+
}
|
|
220
|
+
const t = this.scheduleUpdate();
|
|
221
|
+
return t != null && await t, !this.isUpdatePending;
|
|
222
|
+
}
|
|
223
|
+
scheduleUpdate() {
|
|
224
|
+
return this.performUpdate();
|
|
225
|
+
}
|
|
226
|
+
performUpdate() {
|
|
227
|
+
var i;
|
|
228
|
+
if (!this.isUpdatePending) return;
|
|
229
|
+
if (!this.hasUpdated) {
|
|
230
|
+
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
231
|
+
for (const [n, a] of this._$Ep) this[n] = a;
|
|
232
|
+
this._$Ep = void 0;
|
|
233
|
+
}
|
|
234
|
+
const r = this.constructor.elementProperties;
|
|
235
|
+
if (r.size > 0) for (const [n, a] of r) {
|
|
236
|
+
const { wrapped: l } = a, o = this[n];
|
|
237
|
+
l !== !0 || this._$AL.has(n) || o === void 0 || this.C(n, void 0, a, o);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
let t = !1;
|
|
241
|
+
const e = this._$AL;
|
|
242
|
+
try {
|
|
243
|
+
t = this.shouldUpdate(e), t ? (this.willUpdate(e), (i = this._$EO) == null || i.forEach((r) => {
|
|
244
|
+
var n;
|
|
245
|
+
return (n = r.hostUpdate) == null ? void 0 : n.call(r);
|
|
246
|
+
}), this.update(e)) : this._$EM();
|
|
247
|
+
} catch (r) {
|
|
248
|
+
throw t = !1, this._$EM(), r;
|
|
249
|
+
}
|
|
250
|
+
t && this._$AE(e);
|
|
251
|
+
}
|
|
252
|
+
willUpdate(t) {
|
|
253
|
+
}
|
|
254
|
+
_$AE(t) {
|
|
255
|
+
var e;
|
|
256
|
+
(e = this._$EO) == null || e.forEach((i) => {
|
|
257
|
+
var r;
|
|
258
|
+
return (r = i.hostUpdated) == null ? void 0 : r.call(i);
|
|
259
|
+
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
260
|
+
}
|
|
261
|
+
_$EM() {
|
|
262
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
263
|
+
}
|
|
264
|
+
get updateComplete() {
|
|
265
|
+
return this.getUpdateComplete();
|
|
266
|
+
}
|
|
267
|
+
getUpdateComplete() {
|
|
268
|
+
return this._$ES;
|
|
269
|
+
}
|
|
270
|
+
shouldUpdate(t) {
|
|
271
|
+
return !0;
|
|
272
|
+
}
|
|
273
|
+
update(t) {
|
|
274
|
+
this._$Eq && (this._$Eq = this._$Eq.forEach((e) => this._$ET(e, this[e]))), this._$EM();
|
|
275
|
+
}
|
|
276
|
+
updated(t) {
|
|
277
|
+
}
|
|
278
|
+
firstUpdated(t) {
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[C("elementProperties")] = /* @__PURE__ */ new Map(), S[C("finalized")] = /* @__PURE__ */ new Map(), j == null || j({ ReactiveElement: S }), (_.reactiveElementVersions ?? (_.reactiveElementVersions = [])).push("2.1.2");
|
|
282
|
+
/**
|
|
283
|
+
* @license
|
|
284
|
+
* Copyright 2017 Google LLC
|
|
285
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
|
+
*/
|
|
287
|
+
const P = globalThis, et = (s) => s, B = P.trustedTypes, st = B ? B.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, dt = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, ut = "?" + v, St = `<${ut}>`, w = document, U = () => w.createComment(""), M = (s) => s === null || typeof s != "object" && typeof s != "function", K = Array.isArray, Et = (s) => K(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", D = `[
|
|
288
|
+
\f\r]`, T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, rt = />/g, b = RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^
|
|
289
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), nt = /'/g, at = /"/g, pt = /^(?:script|style|textarea|title)$/i, xt = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), p = xt(1), E = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), y = w.createTreeWalker(w, 129);
|
|
290
|
+
function mt(s, t) {
|
|
291
|
+
if (!K(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
292
|
+
return st !== void 0 ? st.createHTML(t) : t;
|
|
293
|
+
}
|
|
294
|
+
const Tt = (s, t) => {
|
|
295
|
+
const e = s.length - 1, i = [];
|
|
296
|
+
let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = T;
|
|
297
|
+
for (let l = 0; l < e; l++) {
|
|
298
|
+
const o = s[l];
|
|
299
|
+
let d, u, h = -1, g = 0;
|
|
300
|
+
for (; g < o.length && (a.lastIndex = g, u = a.exec(o), u !== null); ) g = a.lastIndex, a === T ? u[1] === "!--" ? a = it : u[1] !== void 0 ? a = rt : u[2] !== void 0 ? (pt.test(u[2]) && (r = RegExp("</" + u[2], "g")), a = b) : u[3] !== void 0 && (a = b) : a === b ? u[0] === ">" ? (a = r ?? T, h = -1) : u[1] === void 0 ? h = -2 : (h = a.lastIndex - u[2].length, d = u[1], a = u[3] === void 0 ? b : u[3] === '"' ? at : nt) : a === at || a === nt ? a = b : a === it || a === rt ? a = T : (a = b, r = void 0);
|
|
301
|
+
const $ = a === b && s[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
+
n += a === T ? o + St : h >= 0 ? (i.push(d), o.slice(0, h) + dt + o.slice(h) + v + $) : o + v + (h === -2 ? l : $);
|
|
303
|
+
}
|
|
304
|
+
return [mt(s, n + (s[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
|
305
|
+
};
|
|
306
|
+
class H {
|
|
307
|
+
constructor({ strings: t, _$litType$: e }, i) {
|
|
308
|
+
let r;
|
|
309
|
+
this.parts = [];
|
|
310
|
+
let n = 0, a = 0;
|
|
311
|
+
const l = t.length - 1, o = this.parts, [d, u] = Tt(t, e);
|
|
312
|
+
if (this.el = H.createElement(d, i), y.currentNode = this.el.content, e === 2 || e === 3) {
|
|
313
|
+
const h = this.el.content.firstChild;
|
|
314
|
+
h.replaceWith(...h.childNodes);
|
|
315
|
+
}
|
|
316
|
+
for (; (r = y.nextNode()) !== null && o.length < l; ) {
|
|
317
|
+
if (r.nodeType === 1) {
|
|
318
|
+
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(dt)) {
|
|
319
|
+
const g = u[a++], $ = r.getAttribute(h).split(v), N = /([.?@])?(.*)/.exec(g);
|
|
320
|
+
o.push({ type: 1, index: n, name: N[2], strings: $, ctor: N[1] === "." ? Pt : N[1] === "?" ? Ot : N[1] === "@" ? Ut : I }), r.removeAttribute(h);
|
|
321
|
+
} else h.startsWith(v) && (o.push({ type: 6, index: n }), r.removeAttribute(h));
|
|
322
|
+
if (pt.test(r.tagName)) {
|
|
323
|
+
const h = r.textContent.split(v), g = h.length - 1;
|
|
324
|
+
if (g > 0) {
|
|
325
|
+
r.textContent = B ? B.emptyScript : "";
|
|
326
|
+
for (let $ = 0; $ < g; $++) r.append(h[$], U()), y.nextNode(), o.push({ type: 2, index: ++n });
|
|
327
|
+
r.append(h[g], U());
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
} else if (r.nodeType === 8) if (r.data === ut) o.push({ type: 2, index: n });
|
|
331
|
+
else {
|
|
332
|
+
let h = -1;
|
|
333
|
+
for (; (h = r.data.indexOf(v, h + 1)) !== -1; ) o.push({ type: 7, index: n }), h += v.length - 1;
|
|
334
|
+
}
|
|
335
|
+
n++;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
static createElement(t, e) {
|
|
339
|
+
const i = w.createElement("template");
|
|
340
|
+
return i.innerHTML = t, i;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function x(s, t, e = s, i) {
|
|
344
|
+
var a, l;
|
|
345
|
+
if (t === E) return t;
|
|
346
|
+
let r = i !== void 0 ? (a = e._$Co) == null ? void 0 : a[i] : e._$Cl;
|
|
347
|
+
const n = M(t) ? void 0 : t._$litDirective$;
|
|
348
|
+
return (r == null ? void 0 : r.constructor) !== n && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, e, i)), i !== void 0 ? (e._$Co ?? (e._$Co = []))[i] = r : e._$Cl = r), r !== void 0 && (t = x(s, r._$AS(s, t.values), r, i)), t;
|
|
349
|
+
}
|
|
350
|
+
class Ct {
|
|
351
|
+
constructor(t, e) {
|
|
352
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
353
|
+
}
|
|
354
|
+
get parentNode() {
|
|
355
|
+
return this._$AM.parentNode;
|
|
356
|
+
}
|
|
357
|
+
get _$AU() {
|
|
358
|
+
return this._$AM._$AU;
|
|
359
|
+
}
|
|
360
|
+
u(t) {
|
|
361
|
+
const { el: { content: e }, parts: i } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? w).importNode(e, !0);
|
|
362
|
+
y.currentNode = r;
|
|
363
|
+
let n = y.nextNode(), a = 0, l = 0, o = i[0];
|
|
364
|
+
for (; o !== void 0; ) {
|
|
365
|
+
if (a === o.index) {
|
|
366
|
+
let d;
|
|
367
|
+
o.type === 2 ? d = new z(n, n.nextSibling, this, t) : o.type === 1 ? d = new o.ctor(n, o.name, o.strings, this, t) : o.type === 6 && (d = new Mt(n, this, t)), this._$AV.push(d), o = i[++l];
|
|
368
|
+
}
|
|
369
|
+
a !== (o == null ? void 0 : o.index) && (n = y.nextNode(), a++);
|
|
370
|
+
}
|
|
371
|
+
return y.currentNode = w, r;
|
|
372
|
+
}
|
|
373
|
+
p(t) {
|
|
374
|
+
let e = 0;
|
|
375
|
+
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
class z {
|
|
379
|
+
get _$AU() {
|
|
380
|
+
var t;
|
|
381
|
+
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
382
|
+
}
|
|
383
|
+
constructor(t, e, i, r) {
|
|
384
|
+
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
|
|
385
|
+
}
|
|
386
|
+
get parentNode() {
|
|
387
|
+
let t = this._$AA.parentNode;
|
|
388
|
+
const e = this._$AM;
|
|
389
|
+
return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
|
|
390
|
+
}
|
|
391
|
+
get startNode() {
|
|
392
|
+
return this._$AA;
|
|
393
|
+
}
|
|
394
|
+
get endNode() {
|
|
395
|
+
return this._$AB;
|
|
396
|
+
}
|
|
397
|
+
_$AI(t, e = this) {
|
|
398
|
+
t = x(this, t, e), M(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Et(t) ? this.k(t) : this._(t);
|
|
399
|
+
}
|
|
400
|
+
O(t) {
|
|
401
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
402
|
+
}
|
|
403
|
+
T(t) {
|
|
404
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
405
|
+
}
|
|
406
|
+
_(t) {
|
|
407
|
+
this._$AH !== c && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(w.createTextNode(t)), this._$AH = t;
|
|
408
|
+
}
|
|
409
|
+
$(t) {
|
|
410
|
+
var n;
|
|
411
|
+
const { values: e, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = H.createElement(mt(i.h, i.h[0]), this.options)), i);
|
|
412
|
+
if (((n = this._$AH) == null ? void 0 : n._$AD) === r) this._$AH.p(e);
|
|
413
|
+
else {
|
|
414
|
+
const a = new Ct(r, this), l = a.u(this.options);
|
|
415
|
+
a.p(e), this.T(l), this._$AH = a;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
_$AC(t) {
|
|
419
|
+
let e = ot.get(t.strings);
|
|
420
|
+
return e === void 0 && ot.set(t.strings, e = new H(t)), e;
|
|
421
|
+
}
|
|
422
|
+
k(t) {
|
|
423
|
+
K(this._$AH) || (this._$AH = [], this._$AR());
|
|
424
|
+
const e = this._$AH;
|
|
425
|
+
let i, r = 0;
|
|
426
|
+
for (const n of t) r === e.length ? e.push(i = new z(this.O(U()), this.O(U()), this, this.options)) : i = e[r], i._$AI(n), r++;
|
|
427
|
+
r < e.length && (this._$AR(i && i._$AB.nextSibling, r), e.length = r);
|
|
428
|
+
}
|
|
429
|
+
_$AR(t = this._$AA.nextSibling, e) {
|
|
430
|
+
var i;
|
|
431
|
+
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, e); t !== this._$AB; ) {
|
|
432
|
+
const r = et(t).nextSibling;
|
|
433
|
+
et(t).remove(), t = r;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
setConnected(t) {
|
|
437
|
+
var e;
|
|
438
|
+
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
class I {
|
|
442
|
+
get tagName() {
|
|
443
|
+
return this.element.tagName;
|
|
444
|
+
}
|
|
445
|
+
get _$AU() {
|
|
446
|
+
return this._$AM._$AU;
|
|
447
|
+
}
|
|
448
|
+
constructor(t, e, i, r, n) {
|
|
449
|
+
this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = c;
|
|
450
|
+
}
|
|
451
|
+
_$AI(t, e = this, i, r) {
|
|
452
|
+
const n = this.strings;
|
|
453
|
+
let a = !1;
|
|
454
|
+
if (n === void 0) t = x(this, t, e, 0), a = !M(t) || t !== this._$AH && t !== E, a && (this._$AH = t);
|
|
455
|
+
else {
|
|
456
|
+
const l = t;
|
|
457
|
+
let o, d;
|
|
458
|
+
for (t = n[0], o = 0; o < n.length - 1; o++) d = x(this, l[i + o], e, o), d === E && (d = this._$AH[o]), a || (a = !M(d) || d !== this._$AH[o]), d === c ? t = c : t !== c && (t += (d ?? "") + n[o + 1]), this._$AH[o] = d;
|
|
459
|
+
}
|
|
460
|
+
a && !r && this.j(t);
|
|
461
|
+
}
|
|
462
|
+
j(t) {
|
|
463
|
+
t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
class Pt extends I {
|
|
467
|
+
constructor() {
|
|
468
|
+
super(...arguments), this.type = 3;
|
|
469
|
+
}
|
|
470
|
+
j(t) {
|
|
471
|
+
this.element[this.name] = t === c ? void 0 : t;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
class Ot extends I {
|
|
475
|
+
constructor() {
|
|
476
|
+
super(...arguments), this.type = 4;
|
|
477
|
+
}
|
|
478
|
+
j(t) {
|
|
479
|
+
this.element.toggleAttribute(this.name, !!t && t !== c);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
class Ut extends I {
|
|
483
|
+
constructor(t, e, i, r, n) {
|
|
484
|
+
super(t, e, i, r, n), this.type = 5;
|
|
485
|
+
}
|
|
486
|
+
_$AI(t, e = this) {
|
|
487
|
+
if ((t = x(this, t, e, 0) ?? c) === E) return;
|
|
488
|
+
const i = this._$AH, r = t === c && i !== c || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, n = t !== c && (i === c || r);
|
|
489
|
+
r && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
490
|
+
}
|
|
491
|
+
handleEvent(t) {
|
|
492
|
+
var e;
|
|
493
|
+
typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
class Mt {
|
|
497
|
+
constructor(t, e, i) {
|
|
498
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
|
|
499
|
+
}
|
|
500
|
+
get _$AU() {
|
|
501
|
+
return this._$AM._$AU;
|
|
502
|
+
}
|
|
503
|
+
_$AI(t) {
|
|
504
|
+
x(this, t);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const W = P.litHtmlPolyfillSupport;
|
|
508
|
+
W == null || W(H, z), (P.litHtmlVersions ?? (P.litHtmlVersions = [])).push("3.3.2");
|
|
509
|
+
const Ht = (s, t, e) => {
|
|
510
|
+
const i = (e == null ? void 0 : e.renderBefore) ?? t;
|
|
511
|
+
let r = i._$litPart$;
|
|
512
|
+
if (r === void 0) {
|
|
513
|
+
const n = (e == null ? void 0 : e.renderBefore) ?? null;
|
|
514
|
+
i._$litPart$ = r = new z(t.insertBefore(U(), n), n, void 0, e ?? {});
|
|
515
|
+
}
|
|
516
|
+
return r._$AI(s), r;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* @license
|
|
520
|
+
* Copyright 2017 Google LLC
|
|
521
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
522
|
+
*/
|
|
523
|
+
const A = globalThis;
|
|
524
|
+
class O extends S {
|
|
525
|
+
constructor() {
|
|
526
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
527
|
+
}
|
|
528
|
+
createRenderRoot() {
|
|
529
|
+
var e;
|
|
530
|
+
const t = super.createRenderRoot();
|
|
531
|
+
return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
|
|
532
|
+
}
|
|
533
|
+
update(t) {
|
|
534
|
+
const e = this.render();
|
|
535
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ht(e, this.renderRoot, this.renderOptions);
|
|
536
|
+
}
|
|
537
|
+
connectedCallback() {
|
|
538
|
+
var t;
|
|
539
|
+
super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
|
|
540
|
+
}
|
|
541
|
+
disconnectedCallback() {
|
|
542
|
+
var t;
|
|
543
|
+
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
544
|
+
}
|
|
545
|
+
render() {
|
|
546
|
+
return E;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
var ht;
|
|
550
|
+
O._$litElement$ = !0, O.finalized = !0, (ht = A.litElementHydrateSupport) == null || ht.call(A, { LitElement: O });
|
|
551
|
+
const q = A.litElementPolyfillSupport;
|
|
552
|
+
q == null || q({ LitElement: O });
|
|
553
|
+
(A.litElementVersions ?? (A.litElementVersions = [])).push("4.2.2");
|
|
554
|
+
/**
|
|
555
|
+
* @license
|
|
556
|
+
* Copyright 2017 Google LLC
|
|
557
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
558
|
+
*/
|
|
559
|
+
const zt = (s) => (t, e) => {
|
|
560
|
+
e !== void 0 ? e.addInitializer(() => {
|
|
561
|
+
customElements.define(s, t);
|
|
562
|
+
}) : customElements.define(s, t);
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* @license
|
|
566
|
+
* Copyright 2017 Google LLC
|
|
567
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
|
+
*/
|
|
569
|
+
const Nt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: J }, Rt = (s = Nt, t, e) => {
|
|
570
|
+
const { kind: i, metadata: r } = e;
|
|
571
|
+
let n = globalThis.litPropertyMetadata.get(r);
|
|
572
|
+
if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(e.name, s), i === "accessor") {
|
|
573
|
+
const { name: a } = e;
|
|
574
|
+
return { set(l) {
|
|
575
|
+
const o = t.get.call(this);
|
|
576
|
+
t.set.call(this, l), this.requestUpdate(a, o, s, !0, l);
|
|
577
|
+
}, init(l) {
|
|
578
|
+
return l !== void 0 && this.C(a, void 0, s, l), l;
|
|
579
|
+
} };
|
|
580
|
+
}
|
|
581
|
+
if (i === "setter") {
|
|
582
|
+
const { name: a } = e;
|
|
583
|
+
return function(l) {
|
|
584
|
+
const o = this[a];
|
|
585
|
+
t.call(this, l), this.requestUpdate(a, o, s, !0, l);
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
throw Error("Unsupported decorator location: " + i);
|
|
589
|
+
};
|
|
590
|
+
function X(s) {
|
|
591
|
+
return (t, e) => typeof e == "object" ? Rt(s, t, e) : ((i, r, n) => {
|
|
592
|
+
const a = r.hasOwnProperty(n);
|
|
593
|
+
return r.constructor.createProperty(n, i), a ? Object.getOwnPropertyDescriptor(r, n) : void 0;
|
|
594
|
+
})(s, t, e);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* @license
|
|
598
|
+
* Copyright 2017 Google LLC
|
|
599
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
|
+
*/
|
|
601
|
+
function k(s) {
|
|
602
|
+
return X({ ...s, state: !0, attribute: !1 });
|
|
603
|
+
}
|
|
604
|
+
const Lt = gt`
|
|
605
|
+
:host {
|
|
606
|
+
--wt-accent: #6366f1;
|
|
607
|
+
--wt-bg: transparent;
|
|
608
|
+
--wt-text: inherit;
|
|
609
|
+
--wt-text-muted: #a3a3a3;
|
|
610
|
+
--wt-border: #333;
|
|
611
|
+
--wt-border-light: rgba(255, 255, 255, 0.06);
|
|
612
|
+
--wt-hover: rgba(99, 102, 241, 0.06);
|
|
613
|
+
--wt-radius: 2px;
|
|
614
|
+
--wt-font: inherit;
|
|
615
|
+
--wt-cover-size: 56px;
|
|
616
|
+
--wt-cover-size-album: 64px;
|
|
617
|
+
|
|
618
|
+
display: block;
|
|
619
|
+
font-family: var(--wt-font);
|
|
620
|
+
color: var(--wt-text);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.embed-player {
|
|
624
|
+
display: flex;
|
|
625
|
+
flex-direction: column;
|
|
626
|
+
background: var(--wt-bg);
|
|
627
|
+
border: 1px solid var(--wt-border);
|
|
628
|
+
border-left: 3px solid var(--wt-accent);
|
|
629
|
+
border-radius: var(--wt-radius);
|
|
630
|
+
overflow: hidden;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.embed-loading,
|
|
634
|
+
.embed-error {
|
|
635
|
+
padding: 1rem;
|
|
636
|
+
font-size: 0.9rem;
|
|
637
|
+
color: var(--wt-text-muted);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.embed-error {
|
|
641
|
+
color: #ef4444;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/* ── tags / header ── */
|
|
645
|
+
.embed-tags {
|
|
646
|
+
display: flex;
|
|
647
|
+
gap: 1rem;
|
|
648
|
+
align-items: center;
|
|
649
|
+
padding: 0.75rem 1rem;
|
|
650
|
+
border-bottom: 1px dashed var(--wt-border);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.embed-cover {
|
|
654
|
+
width: var(--wt-cover-size);
|
|
655
|
+
height: var(--wt-cover-size);
|
|
656
|
+
border-radius: var(--wt-radius);
|
|
657
|
+
object-fit: cover;
|
|
658
|
+
flex-shrink: 0;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.embed-cover--album {
|
|
662
|
+
width: var(--wt-cover-size-album);
|
|
663
|
+
height: var(--wt-cover-size-album);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.tag-details {
|
|
667
|
+
display: flex;
|
|
668
|
+
flex-direction: column;
|
|
669
|
+
gap: 0.15rem;
|
|
670
|
+
min-width: 0;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.tag-title {
|
|
674
|
+
font-weight: 600;
|
|
675
|
+
font-size: 1.05rem;
|
|
676
|
+
line-height: 1.3;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.tag-artist {
|
|
680
|
+
font-size: 0.95rem;
|
|
681
|
+
color: var(--wt-text-muted);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.tag-meta {
|
|
685
|
+
display: flex;
|
|
686
|
+
flex-wrap: wrap;
|
|
687
|
+
gap: 0.25rem;
|
|
688
|
+
font-size: 0.8rem;
|
|
689
|
+
color: var(--wt-text-muted);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.tag-meta span + span::before {
|
|
693
|
+
content: '\u00b7';
|
|
694
|
+
margin-right: 0.25rem;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/* ── controls ── */
|
|
698
|
+
.embed-controls {
|
|
699
|
+
display: flex;
|
|
700
|
+
align-items: center;
|
|
701
|
+
gap: 0.75rem;
|
|
702
|
+
padding: 0.6rem 1rem;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.embed-btn {
|
|
706
|
+
background: none;
|
|
707
|
+
border: none;
|
|
708
|
+
color: var(--wt-accent);
|
|
709
|
+
font-size: 1.1rem;
|
|
710
|
+
cursor: pointer;
|
|
711
|
+
padding: 0;
|
|
712
|
+
flex-shrink: 0;
|
|
713
|
+
line-height: 1;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.embed-btn:hover {
|
|
717
|
+
opacity: 0.8;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.embed-seek {
|
|
721
|
+
flex: 1;
|
|
722
|
+
height: 4px;
|
|
723
|
+
background: var(--wt-border);
|
|
724
|
+
border-radius: 2px;
|
|
725
|
+
cursor: pointer;
|
|
726
|
+
position: relative;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.embed-seek__fill {
|
|
730
|
+
height: 100%;
|
|
731
|
+
background: var(--wt-accent);
|
|
732
|
+
border-radius: 2px;
|
|
733
|
+
transition: width 0.15s linear;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
.embed-time {
|
|
737
|
+
font-size: 0.7rem;
|
|
738
|
+
color: var(--wt-text-muted);
|
|
739
|
+
flex-shrink: 0;
|
|
740
|
+
font-variant-numeric: tabular-nums;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/* ── native audio fallback ── */
|
|
744
|
+
audio {
|
|
745
|
+
width: 100%;
|
|
746
|
+
display: block;
|
|
747
|
+
padding: 0.5rem 1rem;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/* ── tracklist ── */
|
|
751
|
+
.embed-tracklist {
|
|
752
|
+
display: flex;
|
|
753
|
+
flex-direction: column;
|
|
754
|
+
max-height: 320px;
|
|
755
|
+
overflow-y: auto;
|
|
756
|
+
border-top: 1px dashed var(--wt-border);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
.embed-track {
|
|
760
|
+
display: flex;
|
|
761
|
+
align-items: center;
|
|
762
|
+
gap: 0.5rem;
|
|
763
|
+
padding: 0.45rem 1rem;
|
|
764
|
+
border: none;
|
|
765
|
+
background: none;
|
|
766
|
+
cursor: pointer;
|
|
767
|
+
text-align: left;
|
|
768
|
+
font-family: var(--wt-font);
|
|
769
|
+
font-size: 0.85rem;
|
|
770
|
+
color: var(--wt-text);
|
|
771
|
+
transition: background 0.1s;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.embed-track:hover {
|
|
775
|
+
background: var(--wt-hover);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
.embed-track--active {
|
|
779
|
+
background: var(--wt-hover);
|
|
780
|
+
color: var(--wt-accent);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
.embed-track + .embed-track {
|
|
784
|
+
border-top: 1px solid var(--wt-border-light);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
.track-num {
|
|
788
|
+
width: 1.8rem;
|
|
789
|
+
flex-shrink: 0;
|
|
790
|
+
text-align: right;
|
|
791
|
+
font-size: 0.75rem;
|
|
792
|
+
color: var(--wt-text-muted);
|
|
793
|
+
font-variant-numeric: tabular-nums;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.embed-track--active .track-num {
|
|
797
|
+
color: var(--wt-accent);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.track-playing-icon {
|
|
801
|
+
font-size: 0.65rem;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.track-title {
|
|
805
|
+
flex: 1;
|
|
806
|
+
min-width: 0;
|
|
807
|
+
overflow: hidden;
|
|
808
|
+
text-overflow: ellipsis;
|
|
809
|
+
white-space: nowrap;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
.track-artist {
|
|
813
|
+
font-size: 0.75rem;
|
|
814
|
+
color: var(--wt-text-muted);
|
|
815
|
+
flex-shrink: 0;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
.track-duration {
|
|
819
|
+
font-size: 0.75rem;
|
|
820
|
+
color: var(--wt-text-muted);
|
|
821
|
+
flex-shrink: 0;
|
|
822
|
+
font-variant-numeric: tabular-nums;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/* ── badge ── */
|
|
826
|
+
.embed-badge {
|
|
827
|
+
padding: 0.4rem 1rem;
|
|
828
|
+
border-top: 1px dashed var(--wt-border);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
.badge-label {
|
|
832
|
+
font-size: 0.7rem;
|
|
833
|
+
color: var(--wt-accent);
|
|
834
|
+
opacity: 0.7;
|
|
835
|
+
}
|
|
836
|
+
`;
|
|
837
|
+
async function Bt(s, t) {
|
|
838
|
+
const e = await fetch(`${s}/api/embed/${t}/resolve`);
|
|
839
|
+
if (!e.ok)
|
|
840
|
+
throw e.status === 403 ? new Error("Invalid or expired token") : new Error(`Error ${e.status}`);
|
|
841
|
+
return e.json();
|
|
842
|
+
}
|
|
843
|
+
class It {
|
|
844
|
+
constructor() {
|
|
845
|
+
this._playing = !1, this._currentTime = 0, this._duration = 0, this._currentSrc = "", this.onStateChange = null, this.onTrackEnded = null, this.el = new Audio(), this.el.addEventListener("play", () => {
|
|
846
|
+
var t;
|
|
847
|
+
this._playing = !0, (t = this.onStateChange) == null || t.call(this);
|
|
848
|
+
}), this.el.addEventListener("pause", () => {
|
|
849
|
+
var t;
|
|
850
|
+
this._playing = !1, (t = this.onStateChange) == null || t.call(this);
|
|
851
|
+
}), this.el.addEventListener("timeupdate", () => {
|
|
852
|
+
var t;
|
|
853
|
+
this._currentTime = this.el.currentTime, (t = this.onStateChange) == null || t.call(this);
|
|
854
|
+
}), this.el.addEventListener("loadedmetadata", () => {
|
|
855
|
+
var t;
|
|
856
|
+
this._duration = this.el.duration, (t = this.onStateChange) == null || t.call(this);
|
|
857
|
+
}), this.el.addEventListener("ended", () => {
|
|
858
|
+
var t, e;
|
|
859
|
+
this._playing = !1, (t = this.onStateChange) == null || t.call(this), (e = this.onTrackEnded) == null || e.call(this);
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
get playing() {
|
|
863
|
+
return this._playing;
|
|
864
|
+
}
|
|
865
|
+
get currentTime() {
|
|
866
|
+
return this._currentTime;
|
|
867
|
+
}
|
|
868
|
+
get duration() {
|
|
869
|
+
return this._duration;
|
|
870
|
+
}
|
|
871
|
+
get currentSrc() {
|
|
872
|
+
return this._currentSrc;
|
|
873
|
+
}
|
|
874
|
+
play(t) {
|
|
875
|
+
this._currentSrc !== t && (this.el.src = t, this._currentSrc = t), this.el.play();
|
|
876
|
+
}
|
|
877
|
+
pause() {
|
|
878
|
+
this.el.pause();
|
|
879
|
+
}
|
|
880
|
+
toggle() {
|
|
881
|
+
this._playing ? this.pause() : this.el.play();
|
|
882
|
+
}
|
|
883
|
+
seek(t) {
|
|
884
|
+
this.el.currentTime = t;
|
|
885
|
+
}
|
|
886
|
+
dispose() {
|
|
887
|
+
this.el.pause(), this.el.removeAttribute("src"), this.el.load(), this.onStateChange = null, this.onTrackEnded = null;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
function lt(s) {
|
|
891
|
+
if (!s || !isFinite(s)) return "0:00";
|
|
892
|
+
const t = Math.floor(s / 60), e = Math.floor(s % 60);
|
|
893
|
+
return `${t}:${e.toString().padStart(2, "0")}`;
|
|
894
|
+
}
|
|
895
|
+
function V(s) {
|
|
896
|
+
const t = Math.floor(s / 1e3), e = Math.floor(t / 60), i = t % 60;
|
|
897
|
+
return `${e}:${i.toString().padStart(2, "0")}`;
|
|
898
|
+
}
|
|
899
|
+
function jt(s) {
|
|
900
|
+
return s > 1e3 ? Math.round(s / 1e3) + " kbps" : s + " kbps";
|
|
901
|
+
}
|
|
902
|
+
var Dt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, f = (s, t, e, i) => {
|
|
903
|
+
for (var r = i > 1 ? void 0 : i ? Wt(t, e) : t, n = s.length - 1, a; n >= 0; n--)
|
|
904
|
+
(a = s[n]) && (r = (i ? a(t, e, r) : a(r)) || r);
|
|
905
|
+
return i && r && Dt(t, e, r), r;
|
|
906
|
+
};
|
|
907
|
+
let m = class extends O {
|
|
908
|
+
constructor() {
|
|
909
|
+
super(...arguments), this.token = "", this.apiBase = "", this.meta = null, this.loading = !0, this.error = "", this.activeTrackIndex = 0, this.playing = !1, this.currentTime = 0, this.duration = 0, this.audio = null;
|
|
910
|
+
}
|
|
911
|
+
connectedCallback() {
|
|
912
|
+
super.connectedCallback(), this.audio = new It(), this.audio.onStateChange = () => {
|
|
913
|
+
this.playing = this.audio.playing, this.currentTime = this.audio.currentTime, this.duration = this.audio.duration;
|
|
914
|
+
}, this.audio.onTrackEnded = () => this.handleTrackEnded(), this.resolve();
|
|
915
|
+
}
|
|
916
|
+
disconnectedCallback() {
|
|
917
|
+
var s;
|
|
918
|
+
super.disconnectedCallback(), (s = this.audio) == null || s.dispose(), this.audio = null;
|
|
919
|
+
}
|
|
920
|
+
get resolvedApiBase() {
|
|
921
|
+
return this.apiBase || window.location.origin;
|
|
922
|
+
}
|
|
923
|
+
get isAlbum() {
|
|
924
|
+
var s;
|
|
925
|
+
return ((s = this.meta) == null ? void 0 : s.type) === "album";
|
|
926
|
+
}
|
|
927
|
+
get tracks() {
|
|
928
|
+
var s;
|
|
929
|
+
return ((s = this.meta) == null ? void 0 : s.type) === "album" ? this.meta.tracks : [];
|
|
930
|
+
}
|
|
931
|
+
get activeTrack() {
|
|
932
|
+
return this.tracks[this.activeTrackIndex] ?? null;
|
|
933
|
+
}
|
|
934
|
+
get isActiveTrack() {
|
|
935
|
+
var s;
|
|
936
|
+
return this.audio ? this.isAlbum ? this.activeTrack !== null && this.audio.currentSrc === this.activeTrack.stream_url : ((s = this.meta) == null ? void 0 : s.type) === "song" && this.audio.currentSrc === this.meta.stream_url : !1;
|
|
937
|
+
}
|
|
938
|
+
get progressPercent() {
|
|
939
|
+
return this.isActiveTrack && this.duration > 0 ? this.currentTime / this.duration * 100 : 0;
|
|
940
|
+
}
|
|
941
|
+
async resolve() {
|
|
942
|
+
try {
|
|
943
|
+
this.meta = await Bt(this.resolvedApiBase, this.token), this.meta.type === "album" && this.meta.tracks.length > 0 && (this.activeTrackIndex = 0);
|
|
944
|
+
} catch (s) {
|
|
945
|
+
this.error = s.message || "Failed to resolve token";
|
|
946
|
+
} finally {
|
|
947
|
+
this.loading = !1;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
handlePlay() {
|
|
951
|
+
var s;
|
|
952
|
+
if (this.audio) {
|
|
953
|
+
if (this.isAlbum)
|
|
954
|
+
this.handleTrackPlay(this.activeTrackIndex);
|
|
955
|
+
else if (((s = this.meta) == null ? void 0 : s.type) === "song") {
|
|
956
|
+
if (!this.meta.stream_url) return;
|
|
957
|
+
this.isActiveTrack ? this.audio.toggle() : this.audio.play(this.meta.stream_url);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
handleTrackPlay(s) {
|
|
962
|
+
if (!this.audio || !this.tracks[s]) return;
|
|
963
|
+
const t = this.tracks[s];
|
|
964
|
+
this.activeTrackIndex = s, this.audio.currentSrc === t.stream_url ? this.audio.toggle() : this.audio.play(t.stream_url);
|
|
965
|
+
}
|
|
966
|
+
isTrackPlaying(s) {
|
|
967
|
+
return !this.audio || !this.tracks[s] ? !1 : this.audio.currentSrc === this.tracks[s].stream_url && this.playing;
|
|
968
|
+
}
|
|
969
|
+
isTrackActive(s) {
|
|
970
|
+
return !this.audio || !this.tracks[s] ? !1 : this.audio.currentSrc === this.tracks[s].stream_url;
|
|
971
|
+
}
|
|
972
|
+
handleTrackEnded() {
|
|
973
|
+
if (!this.isAlbum) return;
|
|
974
|
+
const s = this.activeTrackIndex + 1;
|
|
975
|
+
s < this.tracks.length && this.handleTrackPlay(s);
|
|
976
|
+
}
|
|
977
|
+
handleSeek(s) {
|
|
978
|
+
if (!this.audio || !this.isActiveTrack) return;
|
|
979
|
+
const e = s.currentTarget.getBoundingClientRect(), i = Math.max(0, Math.min(1, (s.clientX - e.left) / e.width));
|
|
980
|
+
this.audio.seek(i * this.duration);
|
|
981
|
+
}
|
|
982
|
+
get playButtonLabel() {
|
|
983
|
+
return this.isActiveTrack && this.playing ? "⏸" : "▶";
|
|
984
|
+
}
|
|
985
|
+
mimeType(s) {
|
|
986
|
+
return s === "mp3" ? "audio/mpeg" : s === "ogg" ? "audio/ogg" : "audio/flac";
|
|
987
|
+
}
|
|
988
|
+
render() {
|
|
989
|
+
return this.loading ? p`<div class="embed-player"><div class="embed-loading">Loading...</div></div>` : this.error ? p`<div class="embed-player"><div class="embed-error">${this.error}</div></div>` : this.meta ? p`
|
|
990
|
+
<div class="embed-player">
|
|
991
|
+
${this.isAlbum ? this.renderAlbum() : this.renderSong()}
|
|
992
|
+
<div class="embed-badge">
|
|
993
|
+
<span class="badge-label">Powered by Washtub</span>
|
|
994
|
+
</div>
|
|
995
|
+
</div>
|
|
996
|
+
` : c;
|
|
997
|
+
}
|
|
998
|
+
renderSong() {
|
|
999
|
+
const s = this.meta;
|
|
1000
|
+
return p`
|
|
1001
|
+
${this.renderTags(s.cover_url, !1, s.title, s.artist, [
|
|
1002
|
+
s.album,
|
|
1003
|
+
s.year != null ? String(s.year) : null,
|
|
1004
|
+
s.genre,
|
|
1005
|
+
s.duration_ms ? V(s.duration_ms) : null,
|
|
1006
|
+
s.format ? s.format.toUpperCase() : null,
|
|
1007
|
+
s.bit_rate ? jt(s.bit_rate) : null
|
|
1008
|
+
])}
|
|
1009
|
+
${this.renderControls(s.duration_ms)}
|
|
1010
|
+
`;
|
|
1011
|
+
}
|
|
1012
|
+
renderAlbum() {
|
|
1013
|
+
var t;
|
|
1014
|
+
const s = this.meta;
|
|
1015
|
+
return p`
|
|
1016
|
+
${this.renderTags(s.cover_url, !0, s.title, s.artist, [
|
|
1017
|
+
s.year != null ? String(s.year) : null,
|
|
1018
|
+
`${s.tracks.length} tracks`
|
|
1019
|
+
])}
|
|
1020
|
+
${this.renderControls(((t = this.activeTrack) == null ? void 0 : t.duration_ms) ?? null)}
|
|
1021
|
+
<div class="embed-tracklist">
|
|
1022
|
+
${s.tracks.map((e, i) => p`
|
|
1023
|
+
<button
|
|
1024
|
+
class="embed-track ${this.isTrackActive(i) ? "embed-track--active" : ""}"
|
|
1025
|
+
@click=${() => this.handleTrackPlay(i)}
|
|
1026
|
+
>
|
|
1027
|
+
<span class="track-num">
|
|
1028
|
+
${this.isTrackPlaying(i) ? p`<span class="track-playing-icon">\u25B6</span>` : e.track_number}
|
|
1029
|
+
</span>
|
|
1030
|
+
<span class="track-title">${e.title}</span>
|
|
1031
|
+
${e.artist && e.artist !== s.artist ? p`<span class="track-artist">${e.artist}</span>` : c}
|
|
1032
|
+
<span class="track-duration">${V(e.duration_ms)}</span>
|
|
1033
|
+
</button>
|
|
1034
|
+
`)}
|
|
1035
|
+
</div>
|
|
1036
|
+
`;
|
|
1037
|
+
}
|
|
1038
|
+
renderTags(s, t, e, i, r) {
|
|
1039
|
+
const n = r.filter(Boolean);
|
|
1040
|
+
return p`
|
|
1041
|
+
<div class="embed-tags">
|
|
1042
|
+
${s ? p`<img
|
|
1043
|
+
src="${s}"
|
|
1044
|
+
class="embed-cover ${t ? "embed-cover--album" : ""}"
|
|
1045
|
+
alt=""
|
|
1046
|
+
/>` : c}
|
|
1047
|
+
<div class="tag-details">
|
|
1048
|
+
<div class="tag-title">${e}</div>
|
|
1049
|
+
${i ? p`<div class="tag-artist">${i}</div>` : c}
|
|
1050
|
+
${n.length > 0 ? p`<div class="tag-meta">${n.map((a) => p`<span>${a}</span>`)}</div>` : c}
|
|
1051
|
+
</div>
|
|
1052
|
+
</div>
|
|
1053
|
+
`;
|
|
1054
|
+
}
|
|
1055
|
+
renderControls(s) {
|
|
1056
|
+
return p`
|
|
1057
|
+
<div class="embed-controls">
|
|
1058
|
+
<button class="embed-btn" @click=${this.handlePlay}>
|
|
1059
|
+
${this.playButtonLabel}
|
|
1060
|
+
</button>
|
|
1061
|
+
<div class="embed-seek" @click=${this.handleSeek}>
|
|
1062
|
+
<div class="embed-seek__fill" style="width: ${this.progressPercent}%"></div>
|
|
1063
|
+
</div>
|
|
1064
|
+
<span class="embed-time">
|
|
1065
|
+
${this.isActiveTrack && this.duration > 0 ? `${lt(this.currentTime)} / ${lt(this.duration)}` : s ? V(s) : ""}
|
|
1066
|
+
</span>
|
|
1067
|
+
</div>
|
|
1068
|
+
`;
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
m.styles = Lt;
|
|
1072
|
+
f([
|
|
1073
|
+
X()
|
|
1074
|
+
], m.prototype, "token", 2);
|
|
1075
|
+
f([
|
|
1076
|
+
X({ attribute: "api-base" })
|
|
1077
|
+
], m.prototype, "apiBase", 2);
|
|
1078
|
+
f([
|
|
1079
|
+
k()
|
|
1080
|
+
], m.prototype, "meta", 2);
|
|
1081
|
+
f([
|
|
1082
|
+
k()
|
|
1083
|
+
], m.prototype, "loading", 2);
|
|
1084
|
+
f([
|
|
1085
|
+
k()
|
|
1086
|
+
], m.prototype, "error", 2);
|
|
1087
|
+
f([
|
|
1088
|
+
k()
|
|
1089
|
+
], m.prototype, "activeTrackIndex", 2);
|
|
1090
|
+
f([
|
|
1091
|
+
k()
|
|
1092
|
+
], m.prototype, "playing", 2);
|
|
1093
|
+
f([
|
|
1094
|
+
k()
|
|
1095
|
+
], m.prototype, "currentTime", 2);
|
|
1096
|
+
f([
|
|
1097
|
+
k()
|
|
1098
|
+
], m.prototype, "duration", 2);
|
|
1099
|
+
m = f([
|
|
1100
|
+
zt("washtub-player")
|
|
1101
|
+
], m);
|
|
1102
|
+
export {
|
|
1103
|
+
m as WashtubPlayer
|
|
1104
|
+
};
|
|
1105
|
+
//# sourceMappingURL=washtub-embed.js.map
|