@popgrids/embed 0.0.1 → 0.0.3
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/AGENTS.md +141 -0
- package/LICENSE +21 -0
- package/README.md +60 -1
- package/dist/components/base-element.d.ts +33 -0
- package/dist/components/base-element.d.ts.map +1 -0
- package/dist/components/pop-auth-panel.d.ts +14 -0
- package/dist/components/pop-auth-panel.d.ts.map +1 -0
- package/dist/components/pop-comment-avatar.d.ts +16 -0
- package/dist/components/pop-comment-avatar.d.ts.map +1 -0
- package/dist/components/pop-comment-bar.d.ts +14 -0
- package/dist/components/pop-comment-bar.d.ts.map +1 -0
- package/dist/components/pop-comment-icon.d.ts +33 -0
- package/dist/components/pop-comment-icon.d.ts.map +1 -0
- package/dist/components/pop-comment-input.d.ts +19 -0
- package/dist/components/pop-comment-input.d.ts.map +1 -0
- package/dist/components/pop-comment-thread.d.ts +14 -0
- package/dist/components/pop-comment-thread.d.ts.map +1 -0
- package/dist/components/pop-comment.d.ts +32 -0
- package/dist/components/pop-comment.d.ts.map +1 -0
- package/dist/components/pop-feed.d.ts +17 -0
- package/dist/components/pop-feed.d.ts.map +1 -0
- package/dist/components/pop-grid.d.ts +12 -0
- package/dist/components/pop-grid.d.ts.map +1 -0
- package/dist/components/pop-widget.d.ts +13 -0
- package/dist/components/pop-widget.d.ts.map +1 -0
- package/dist/embed.js +2240 -0
- package/dist/embed.js.map +1 -0
- package/dist/helpers/author.d.ts +2 -0
- package/dist/helpers/author.d.ts.map +1 -0
- package/dist/helpers/color.d.ts +7 -0
- package/dist/helpers/color.d.ts.map +1 -0
- package/dist/helpers/theme.d.ts +3 -0
- package/dist/helpers/theme.d.ts.map +1 -0
- package/dist/helpers/time.d.ts +2 -0
- package/dist/helpers/time.d.ts.map +1 -0
- package/dist/index.cjs +1135 -741
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -989
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1246 -1045
- package/dist/index.js.map +1 -1
- package/dist/lib/popup-auth.d.ts +22 -0
- package/dist/lib/popup-auth.d.ts.map +1 -0
- package/dist/store/auth-store.d.ts +8 -0
- package/dist/store/auth-store.d.ts.map +1 -0
- package/dist/store/grid-store.d.ts +45 -0
- package/dist/store/grid-store.d.ts.map +1 -0
- package/dist/store/registry.d.ts +5 -0
- package/dist/store/registry.d.ts.map +1 -0
- package/dist/types/models.d.ts +47 -0
- package/dist/types/models.d.ts.map +1 -0
- package/package.json +55 -45
- package/dist/apple-IX52EWYN.png +0 -0
- package/dist/google-Q3MFTU5A.png +0 -0
- package/dist/index.d.cts +0 -989
- package/dist/swirling-ovals-ZDTHSA3L.gif +0 -0
package/dist/embed.js
ADDED
|
@@ -0,0 +1,2240 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/@preact+signals-core@1.14.3/node_modules/@preact/signals-core/dist/signals-core.module.js
|
|
2
|
+
var e = Symbol.for("preact-signals");
|
|
3
|
+
function t() {
|
|
4
|
+
if (o > 1) o--;
|
|
5
|
+
else {
|
|
6
|
+
var e, t = !1;
|
|
7
|
+
for ((function() {
|
|
8
|
+
var e = l;
|
|
9
|
+
for (l = void 0; e !== void 0;) e.S.v === e.v && (e.S.i = e.i), e = e.o;
|
|
10
|
+
})(); a !== void 0;) {
|
|
11
|
+
var n = a;
|
|
12
|
+
for (a = void 0, s++; n !== void 0;) {
|
|
13
|
+
var r = n.u;
|
|
14
|
+
if (n.u = void 0, n.f &= -3, !(8 & n.f) && m(n)) try {
|
|
15
|
+
n.c();
|
|
16
|
+
} catch (n) {
|
|
17
|
+
t ||= (e = n, !0);
|
|
18
|
+
}
|
|
19
|
+
n = r;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (s = 0, o--, t) throw e;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var n = void 0;
|
|
26
|
+
function r(e) {
|
|
27
|
+
var t = n;
|
|
28
|
+
n = void 0;
|
|
29
|
+
try {
|
|
30
|
+
return e();
|
|
31
|
+
} finally {
|
|
32
|
+
n = t;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
var i, a = void 0, o = 0, s = 0, c = 0, l = void 0, u = 0;
|
|
36
|
+
function d(e) {
|
|
37
|
+
if (n !== void 0) {
|
|
38
|
+
var t = e.n;
|
|
39
|
+
if (t === void 0 || t.t !== n) return t = {
|
|
40
|
+
i: 0,
|
|
41
|
+
S: e,
|
|
42
|
+
p: n.s,
|
|
43
|
+
n: void 0,
|
|
44
|
+
t: n,
|
|
45
|
+
e: void 0,
|
|
46
|
+
x: void 0,
|
|
47
|
+
r: t
|
|
48
|
+
}, n.s !== void 0 && (n.s.n = t), n.s = t, e.n = t, 32 & n.f && e.S(t), t;
|
|
49
|
+
if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = n.s, t.n = void 0, n.s.n = t, n.s = t), t;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function f(e, t) {
|
|
53
|
+
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
54
|
+
}
|
|
55
|
+
f.prototype.brand = e, f.prototype.h = function() {
|
|
56
|
+
return !0;
|
|
57
|
+
}, f.prototype.S = function(e) {
|
|
58
|
+
var t = this, n = this.t;
|
|
59
|
+
n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? r(function() {
|
|
60
|
+
var e;
|
|
61
|
+
(e = t.W) == null || e.call(t);
|
|
62
|
+
}) : n.e = e);
|
|
63
|
+
}, f.prototype.U = function(e) {
|
|
64
|
+
var t = this;
|
|
65
|
+
if (this.t !== void 0) {
|
|
66
|
+
var n = e.e, i = e.x;
|
|
67
|
+
n !== void 0 && (n.x = i, e.e = void 0), i !== void 0 && (i.e = n, e.x = void 0), e === this.t && (this.t = i, i === void 0 && r(function() {
|
|
68
|
+
var e;
|
|
69
|
+
(e = t.Z) == null || e.call(t);
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
}, f.prototype.subscribe = function(e) {
|
|
73
|
+
var t = this;
|
|
74
|
+
return ee(function() {
|
|
75
|
+
var n = t.value;
|
|
76
|
+
r(function() {
|
|
77
|
+
return e(n);
|
|
78
|
+
});
|
|
79
|
+
}, { name: "sub" });
|
|
80
|
+
}, f.prototype.valueOf = function() {
|
|
81
|
+
return this.value;
|
|
82
|
+
}, f.prototype.toString = function() {
|
|
83
|
+
return this.value + "";
|
|
84
|
+
}, f.prototype.toJSON = function() {
|
|
85
|
+
return this.value;
|
|
86
|
+
}, f.prototype.peek = function() {
|
|
87
|
+
var e = this;
|
|
88
|
+
return r(function() {
|
|
89
|
+
return e.value;
|
|
90
|
+
});
|
|
91
|
+
}, Object.defineProperty(f.prototype, "value", {
|
|
92
|
+
get: function() {
|
|
93
|
+
var e = d(this);
|
|
94
|
+
return e !== void 0 && (e.i = this.i), this.v;
|
|
95
|
+
},
|
|
96
|
+
set: function(e) {
|
|
97
|
+
if (e !== this.v) {
|
|
98
|
+
if (s > 100) throw Error("Cycle detected");
|
|
99
|
+
(function(e) {
|
|
100
|
+
o !== 0 && s === 0 && e.l !== c && (e.l = c, l = {
|
|
101
|
+
S: e,
|
|
102
|
+
v: e.v,
|
|
103
|
+
i: e.i,
|
|
104
|
+
o: l
|
|
105
|
+
});
|
|
106
|
+
})(this), this.v = e, this.i++, u++, o++;
|
|
107
|
+
try {
|
|
108
|
+
for (var n = this.t; n !== void 0; n = n.x) n.t.N();
|
|
109
|
+
} finally {
|
|
110
|
+
t();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
function p(e, t) {
|
|
116
|
+
return new f(e, t);
|
|
117
|
+
}
|
|
118
|
+
function m(e) {
|
|
119
|
+
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
120
|
+
return !1;
|
|
121
|
+
}
|
|
122
|
+
function h(e) {
|
|
123
|
+
for (var t = e.s; t !== void 0; t = t.n) {
|
|
124
|
+
var n = t.S.n;
|
|
125
|
+
if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
126
|
+
e.s = t;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function g(e) {
|
|
132
|
+
for (var t = e.s, n = void 0; t !== void 0;) {
|
|
133
|
+
var r = t.p;
|
|
134
|
+
t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;
|
|
135
|
+
}
|
|
136
|
+
e.s = n;
|
|
137
|
+
}
|
|
138
|
+
function _(e, t) {
|
|
139
|
+
f.call(this, void 0, t), this.x = e, this.s = void 0, this.g = u - 1, this.f = 4;
|
|
140
|
+
}
|
|
141
|
+
_.prototype = new f(), _.prototype.h = function() {
|
|
142
|
+
if (this.f &= -3, 1 & this.f) return !1;
|
|
143
|
+
if ((36 & this.f) == 32 || (this.f &= -5, this.g === u)) return !0;
|
|
144
|
+
if (this.g = u, this.f |= 1, this.i > 0 && !m(this)) return this.f &= -2, !0;
|
|
145
|
+
var e = n;
|
|
146
|
+
try {
|
|
147
|
+
h(this), n = this;
|
|
148
|
+
var t = this.x();
|
|
149
|
+
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
this.v = e, this.f |= 16, this.i++;
|
|
152
|
+
}
|
|
153
|
+
return n = e, g(this), this.f &= -2, !0;
|
|
154
|
+
}, _.prototype.S = function(e) {
|
|
155
|
+
if (this.t === void 0) {
|
|
156
|
+
this.f |= 36;
|
|
157
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
158
|
+
}
|
|
159
|
+
f.prototype.S.call(this, e);
|
|
160
|
+
}, _.prototype.U = function(e) {
|
|
161
|
+
if (this.t !== void 0 && (f.prototype.U.call(this, e), this.t === void 0)) {
|
|
162
|
+
this.f &= -33;
|
|
163
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
164
|
+
}
|
|
165
|
+
}, _.prototype.N = function() {
|
|
166
|
+
if (!(2 & this.f)) {
|
|
167
|
+
this.f |= 6;
|
|
168
|
+
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
169
|
+
}
|
|
170
|
+
}, Object.defineProperty(_.prototype, "value", { get: function() {
|
|
171
|
+
if (1 & this.f) throw Error("Cycle detected");
|
|
172
|
+
var e = d(this);
|
|
173
|
+
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
174
|
+
return this.v;
|
|
175
|
+
} });
|
|
176
|
+
function v(e, t) {
|
|
177
|
+
return new _(e, t);
|
|
178
|
+
}
|
|
179
|
+
function y(e) {
|
|
180
|
+
var r = e.m;
|
|
181
|
+
if (e.m = void 0, typeof r == "function") {
|
|
182
|
+
o++;
|
|
183
|
+
var i = n;
|
|
184
|
+
n = void 0;
|
|
185
|
+
try {
|
|
186
|
+
r();
|
|
187
|
+
} catch (t) {
|
|
188
|
+
throw e.f &= -2, e.f |= 8, b(e), t;
|
|
189
|
+
} finally {
|
|
190
|
+
n = i, t();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function b(e) {
|
|
195
|
+
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
196
|
+
e.x = void 0, e.s = void 0, y(e);
|
|
197
|
+
}
|
|
198
|
+
function x(e) {
|
|
199
|
+
if (n !== this) throw Error("Out-of-order effect");
|
|
200
|
+
g(this), n = e, this.f &= -2, 8 & this.f && b(this), t();
|
|
201
|
+
}
|
|
202
|
+
function S(e, t) {
|
|
203
|
+
this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, i && i.push(this);
|
|
204
|
+
}
|
|
205
|
+
S.prototype.c = function() {
|
|
206
|
+
var e = this.S();
|
|
207
|
+
try {
|
|
208
|
+
if (8 & this.f || this.x === void 0) return;
|
|
209
|
+
var t = this.x();
|
|
210
|
+
typeof t == "function" && (this.m = t);
|
|
211
|
+
} finally {
|
|
212
|
+
e();
|
|
213
|
+
}
|
|
214
|
+
}, S.prototype.S = function() {
|
|
215
|
+
if (1 & this.f) throw Error("Cycle detected");
|
|
216
|
+
this.f |= 1, this.f &= -9, y(this), h(this), o++;
|
|
217
|
+
var e = n;
|
|
218
|
+
return n = this, x.bind(this, e);
|
|
219
|
+
}, S.prototype.N = function() {
|
|
220
|
+
2 & this.f || (this.f |= 2, this.u = a, a = this);
|
|
221
|
+
}, S.prototype.d = function() {
|
|
222
|
+
this.f |= 8, 1 & this.f || b(this);
|
|
223
|
+
}, S.prototype.dispose = function() {
|
|
224
|
+
this.d();
|
|
225
|
+
};
|
|
226
|
+
function ee(e, t) {
|
|
227
|
+
var n = new S(e, t);
|
|
228
|
+
try {
|
|
229
|
+
n.c();
|
|
230
|
+
} catch (e) {
|
|
231
|
+
throw n.d(), e;
|
|
232
|
+
}
|
|
233
|
+
var r = n.d.bind(n);
|
|
234
|
+
return r[Symbol.dispose] = r, r;
|
|
235
|
+
}
|
|
236
|
+
var C = "/embed/auth/login", w = "popgrids-auth", te = "popup,width=480,height=640", ne = 300 * 1e3, re = 250, T = class extends Error {
|
|
237
|
+
constructor(e) {
|
|
238
|
+
super(e), this.name = "PopupAuthError";
|
|
239
|
+
}
|
|
240
|
+
}, ie = (e, t, n) => {
|
|
241
|
+
let r = new URL(C, e);
|
|
242
|
+
return r.searchParams.set("publicKey", t), r.searchParams.set("returnOrigin", n), r.toString();
|
|
243
|
+
}, ae = (e, t) => {
|
|
244
|
+
let n = window.open(ie(e, t, window.location.origin), w, te);
|
|
245
|
+
if (!n) throw new T("Popup blocked. Allow popups for this site and try again.");
|
|
246
|
+
return n;
|
|
247
|
+
}, oe = (e, t) => typeof e == "object" && !!e && "type" in e && "source" in e && e.type === t && e.source === "popgrids-embed", se = (e) => {
|
|
248
|
+
if (typeof e != "object" || !e || !("user" in e)) return null;
|
|
249
|
+
let t = e.user;
|
|
250
|
+
if (typeof t != "object" || !t || !("id" in t)) return null;
|
|
251
|
+
let n = t;
|
|
252
|
+
return typeof n.id == "string" ? {
|
|
253
|
+
id: n.id,
|
|
254
|
+
name: typeof n.name == "string" ? n.name : "",
|
|
255
|
+
email: typeof n.email == "string" ? n.email : "",
|
|
256
|
+
image: typeof n.image == "string" ? n.image : null
|
|
257
|
+
} : null;
|
|
258
|
+
}, ce = (e, t, n) => new Promise((r, i) => {
|
|
259
|
+
let a = new URL(e).origin, o = !1, s = !1, c = !1, l = (e, t) => {
|
|
260
|
+
if (!o) {
|
|
261
|
+
if (o = !0, p(), e === "resolve") {
|
|
262
|
+
r();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
i(t ?? new T("Sign-in failed"));
|
|
266
|
+
}
|
|
267
|
+
}, u = (e) => {
|
|
268
|
+
if (e.origin === a) {
|
|
269
|
+
if (oe(e.data, "popgrids:auth:success")) {
|
|
270
|
+
s = !0;
|
|
271
|
+
let t = se(e.data);
|
|
272
|
+
t && n?.onAuthUser?.(t), l("resolve");
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
oe(e.data, "popgrids:auth:error") && (s = !0, l("reject", new T(typeof e.data == "object" && e.data !== null && "error" in e.data && typeof e.data.error == "string" ? e.data.error : "Sign-in failed")));
|
|
276
|
+
}
|
|
277
|
+
}, d = window.setInterval(() => {
|
|
278
|
+
t.closed && (c || (c = !0, (async () => {
|
|
279
|
+
if (await new Promise((e) => window.setTimeout(e, re)), !(s || o)) {
|
|
280
|
+
if (n?.verifySignedIn && await n.verifySignedIn()) {
|
|
281
|
+
l("resolve");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
l("reject", new T("Sign-in was cancelled"));
|
|
285
|
+
}
|
|
286
|
+
})()));
|
|
287
|
+
}, 300), f = window.setTimeout(() => {
|
|
288
|
+
try {
|
|
289
|
+
t.close();
|
|
290
|
+
} catch {}
|
|
291
|
+
l("reject", new T("Sign-in timed out"));
|
|
292
|
+
}, ne), p = () => {
|
|
293
|
+
window.removeEventListener("message", u), clearInterval(d), clearTimeout(f);
|
|
294
|
+
};
|
|
295
|
+
window.addEventListener("message", u);
|
|
296
|
+
}), le = async (e, t, n) => {
|
|
297
|
+
await ce(e, ae(e, t), n);
|
|
298
|
+
}, E = p(null), ue = p(null), de = p(!1), fe = [
|
|
299
|
+
0,
|
|
300
|
+
150,
|
|
301
|
+
400
|
|
302
|
+
], pe = [
|
|
303
|
+
0,
|
|
304
|
+
100,
|
|
305
|
+
200,
|
|
306
|
+
400,
|
|
307
|
+
800,
|
|
308
|
+
1500,
|
|
309
|
+
2500,
|
|
310
|
+
4e3
|
|
311
|
+
];
|
|
312
|
+
async function me(e, t, n = fe) {
|
|
313
|
+
if (!e || !t) return E.value = null, !1;
|
|
314
|
+
let r = new URL(`/api/v1/embed/grids/${t}/session`, e);
|
|
315
|
+
r.searchParams.set("pageUrl", window.location.href);
|
|
316
|
+
for (let e = 0; e < n.length; e++) {
|
|
317
|
+
let t = n[e] ?? 0;
|
|
318
|
+
t > 0 && await new Promise((e) => window.setTimeout(e, t));
|
|
319
|
+
try {
|
|
320
|
+
let e = await fetch(r, { credentials: "include" });
|
|
321
|
+
if (!e.ok) continue;
|
|
322
|
+
if (E.value = (await e.json()).user ?? null, E.value !== null) return !0;
|
|
323
|
+
} catch {}
|
|
324
|
+
}
|
|
325
|
+
return E.value = null, !1;
|
|
326
|
+
}
|
|
327
|
+
async function D(e, t) {
|
|
328
|
+
ue.value = null, de.value = !0;
|
|
329
|
+
try {
|
|
330
|
+
return await le(e, t, {
|
|
331
|
+
onAuthUser: (e) => {
|
|
332
|
+
E.value = e;
|
|
333
|
+
},
|
|
334
|
+
verifySignedIn: () => me(e, t, pe)
|
|
335
|
+
}), E.value ? !0 : await me(e, t, pe);
|
|
336
|
+
} catch (e) {
|
|
337
|
+
return ue.value = e instanceof Error ? e.message : "Sign-in failed", !1;
|
|
338
|
+
} finally {
|
|
339
|
+
de.value = !1;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function he() {
|
|
343
|
+
ue.value = null;
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/store/registry.ts
|
|
347
|
+
var ge = /* @__PURE__ */ new WeakMap(), _e = (e, t, n = t.constructor) => {
|
|
348
|
+
let r = ge.get(e);
|
|
349
|
+
r || (r = /* @__PURE__ */ new Map(), ge.set(e, r)), r.set(n, t);
|
|
350
|
+
}, ve = (e) => {
|
|
351
|
+
ge.delete(e);
|
|
352
|
+
}, ye = (e, t) => {
|
|
353
|
+
let n = e;
|
|
354
|
+
for (; n;) {
|
|
355
|
+
let e = ge.get(n)?.get(t);
|
|
356
|
+
if (e) return e;
|
|
357
|
+
let r = n.getRootNode();
|
|
358
|
+
if (!(r instanceof ShadowRoot)) break;
|
|
359
|
+
n = r.host;
|
|
360
|
+
}
|
|
361
|
+
return null;
|
|
362
|
+
};
|
|
363
|
+
function O(e) {
|
|
364
|
+
return function(t, n) {
|
|
365
|
+
let r = Symbol("context_" + (e.name || "store"));
|
|
366
|
+
Object.defineProperty(t, n, {
|
|
367
|
+
get() {
|
|
368
|
+
if (this[r]) return this[r];
|
|
369
|
+
let t = ye(this, e);
|
|
370
|
+
if (!t) throw console.error(`[Context] resolveStore failed! isConnected: ${this.isConnected}`, this), Error(`[Context] Store for key "${e.name || e}" not resolved on <${this.localName}>.`);
|
|
371
|
+
return this[r] = t, t;
|
|
372
|
+
},
|
|
373
|
+
enumerable: !0,
|
|
374
|
+
configurable: !0
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/store/grid-store.ts
|
|
380
|
+
var be = 3e4, xe = 3, Se = (e) => {
|
|
381
|
+
let t = typeof e.createdAt == "number" ? e.createdAt : Date.parse(String(e.createdAt));
|
|
382
|
+
return Number.isFinite(t) ? t : 0;
|
|
383
|
+
}, Ce = (e, t) => {
|
|
384
|
+
let n = e?.previewCount ?? t;
|
|
385
|
+
return n > 0 ? n : xe;
|
|
386
|
+
}, k = class {
|
|
387
|
+
constructor(e) {
|
|
388
|
+
this.previewCount = xe, this.grid = p(null), this.comments = p([]), this.loading = p(!0), this.error = p(null), this.open = p(!1), this.replyingTo = p(null), this.editingCommentId = p(null), this.scrollingCommentId = p(null), this.socket = null, this.reconnectAttempt = 0, this.reconnectTimer = null, this.disposed = !1, this.topLevelComments = v(() => this.comments.value.filter((e) => e.parentCommentId === null).sort((e, t) => String(e.sortKey).localeCompare(String(t.sortKey)))), this.replyingToComment = v(() => {
|
|
389
|
+
let e = this.replyingTo.value;
|
|
390
|
+
return e ? this.comments.value.find((t) => t.id === e) ?? null : null;
|
|
391
|
+
}), this.editingComment = v(() => {
|
|
392
|
+
let e = this.editingCommentId.value;
|
|
393
|
+
return e ? this.comments.value.find((t) => t.id === e) ?? null : null;
|
|
394
|
+
}), this.previewComments = v(() => this.topLevelComments.value.slice(0, Ce(this.grid.value, this.previewCount))), this.previewAvatars = v(() => {
|
|
395
|
+
let e = Ce(this.grid.value, this.previewCount), t = /* @__PURE__ */ new Set(), n = [], r = [...this.comments.value].sort((e, t) => Se(t) - Se(e));
|
|
396
|
+
for (let i of r) {
|
|
397
|
+
let r = i.author;
|
|
398
|
+
if (!(!r?.id || t.has(r.id)) && (t.add(r.id), n.push(r), n.length >= e)) break;
|
|
399
|
+
}
|
|
400
|
+
return n.reverse();
|
|
401
|
+
}), this.apiUrl = e.apiUrl, this.publicKey = e.publicKey, this.pageUrl = e.pageUrl, this.externalId = e.externalId?.trim() || null;
|
|
402
|
+
}
|
|
403
|
+
identityParams() {
|
|
404
|
+
let e = new URLSearchParams({ pageUrl: this.pageUrl });
|
|
405
|
+
return this.externalId && e.set("externalId", this.externalId), e.toString();
|
|
406
|
+
}
|
|
407
|
+
repliesFor(e) {
|
|
408
|
+
let t = this.comments.value.find((t) => t.id === e);
|
|
409
|
+
return t ? this.comments.value.filter((n) => n.id !== e && (n.sortKey === t.sortKey || n.sortKey.startsWith(t.sortKey + "/"))).sort((e, t) => String(e.sortKey).localeCompare(String(t.sortKey))) : [];
|
|
410
|
+
}
|
|
411
|
+
async load() {
|
|
412
|
+
this.loading.value = !0, this.error.value = null;
|
|
413
|
+
try {
|
|
414
|
+
let e = await fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}`, { credentials: "include" });
|
|
415
|
+
if (!e.ok) return this.error.value = "There was a problem loading the PopGrid", !1;
|
|
416
|
+
let t = await e.json();
|
|
417
|
+
this.grid.value = t.grid, this.connectRealtime();
|
|
418
|
+
let n = await fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments?${this.identityParams()}`, { credentials: "include" });
|
|
419
|
+
if (n.ok) {
|
|
420
|
+
let e = await n.json();
|
|
421
|
+
this.comments.value = e.comments;
|
|
422
|
+
}
|
|
423
|
+
return !0;
|
|
424
|
+
} catch {
|
|
425
|
+
return console.error("Failed to load PopGrid"), this.error.value = "There was a problem loading the PopGrid", !1;
|
|
426
|
+
} finally {
|
|
427
|
+
this.loading.value = !1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
async postComment(e, t) {
|
|
431
|
+
let n = async () => fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments`, {
|
|
432
|
+
method: "POST",
|
|
433
|
+
credentials: "include",
|
|
434
|
+
headers: { "Content-Type": "application/json" },
|
|
435
|
+
body: JSON.stringify({
|
|
436
|
+
body: e,
|
|
437
|
+
pageUrl: this.pageUrl,
|
|
438
|
+
externalId: this.externalId ?? void 0,
|
|
439
|
+
parentCommentId: t
|
|
440
|
+
})
|
|
441
|
+
}), r = await n();
|
|
442
|
+
if (r.status === 401) {
|
|
443
|
+
if (!await D(this.apiUrl, this.publicKey)) return null;
|
|
444
|
+
r = await n();
|
|
445
|
+
}
|
|
446
|
+
if (!r.ok) return null;
|
|
447
|
+
let i = await r.json();
|
|
448
|
+
return this.upsertComment(i.comment), i.comment.author && !E.value && (E.value = {
|
|
449
|
+
id: i.comment.author.id,
|
|
450
|
+
name: i.comment.author.name ?? "",
|
|
451
|
+
email: "",
|
|
452
|
+
image: i.comment.author.image
|
|
453
|
+
}), i.comment;
|
|
454
|
+
}
|
|
455
|
+
destroy() {
|
|
456
|
+
this.disposed = !0, this.reconnectTimer &&= (clearTimeout(this.reconnectTimer), null), this.socket &&= (this.socket.onopen = null, this.socket.onmessage = null, this.socket.onclose = null, this.socket.onerror = null, this.socket.close(), null);
|
|
457
|
+
}
|
|
458
|
+
connectRealtime() {
|
|
459
|
+
let e = this.grid.value?.connectUrl;
|
|
460
|
+
if (!e || this.disposed) return;
|
|
461
|
+
this.socket &&= (this.socket.onopen = null, this.socket.onmessage = null, this.socket.onclose = null, this.socket.onerror = null, this.socket.close(), null);
|
|
462
|
+
let t = new URL(e, this.apiUrl);
|
|
463
|
+
t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.searchParams.set("pageUrl", this.pageUrl), this.externalId && t.searchParams.set("externalId", this.externalId);
|
|
464
|
+
let n = new WebSocket(t.toString());
|
|
465
|
+
this.socket = n, n.onopen = () => {
|
|
466
|
+
this.reconnectAttempt = 0;
|
|
467
|
+
}, n.onmessage = (e) => {
|
|
468
|
+
try {
|
|
469
|
+
let t = JSON.parse(String(e.data));
|
|
470
|
+
t.type === "comment.created" && t.comment ? this.upsertComment(t.comment) : t.type === "comment.updated" && t.comment && this.updateCommentInList(t.comment);
|
|
471
|
+
} catch {}
|
|
472
|
+
}, n.onclose = () => {
|
|
473
|
+
this.disposed || this.scheduleReconnect();
|
|
474
|
+
}, n.onerror = () => {
|
|
475
|
+
n.close();
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
scheduleReconnect() {
|
|
479
|
+
if (this.disposed || this.reconnectTimer) return;
|
|
480
|
+
let e = Math.min(1e3 * 2 ** this.reconnectAttempt, be);
|
|
481
|
+
this.reconnectAttempt += 1, this.reconnectTimer = setTimeout(() => {
|
|
482
|
+
this.reconnectTimer = null, this.connectRealtime();
|
|
483
|
+
}, e);
|
|
484
|
+
}
|
|
485
|
+
upsertComment(e) {
|
|
486
|
+
this.comments.value.some((t) => t.id === e.id) || (this.comments.value = [...this.comments.value, e]);
|
|
487
|
+
}
|
|
488
|
+
async editComment(e, t) {
|
|
489
|
+
let n = async () => fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}`, {
|
|
490
|
+
method: "PATCH",
|
|
491
|
+
credentials: "include",
|
|
492
|
+
headers: { "Content-Type": "application/json" },
|
|
493
|
+
body: JSON.stringify({
|
|
494
|
+
body: t,
|
|
495
|
+
pageUrl: this.pageUrl,
|
|
496
|
+
externalId: this.externalId ?? void 0
|
|
497
|
+
})
|
|
498
|
+
}), r = await n();
|
|
499
|
+
if (r.status === 401) {
|
|
500
|
+
if (!await D(this.apiUrl, this.publicKey)) return null;
|
|
501
|
+
r = await n();
|
|
502
|
+
}
|
|
503
|
+
if (!r.ok) return null;
|
|
504
|
+
let i = await r.json();
|
|
505
|
+
return this.updateCommentInList(i.comment), i.comment;
|
|
506
|
+
}
|
|
507
|
+
async deleteComment(e) {
|
|
508
|
+
let t = async () => fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}?${this.identityParams()}`, {
|
|
509
|
+
method: "DELETE",
|
|
510
|
+
credentials: "include"
|
|
511
|
+
}), n = await t();
|
|
512
|
+
if (n.status === 401) {
|
|
513
|
+
if (!await D(this.apiUrl, this.publicKey)) return null;
|
|
514
|
+
n = await t();
|
|
515
|
+
}
|
|
516
|
+
if (!n.ok) return null;
|
|
517
|
+
let r = await n.json();
|
|
518
|
+
return this.updateCommentInList(r.comment), r.comment;
|
|
519
|
+
}
|
|
520
|
+
async flagComment(e) {
|
|
521
|
+
let t = async () => fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}/flag?${this.identityParams()}`, {
|
|
522
|
+
method: "POST",
|
|
523
|
+
credentials: "include"
|
|
524
|
+
}), n = await t();
|
|
525
|
+
if (n.status === 401) {
|
|
526
|
+
if (!await D(this.apiUrl, this.publicKey)) return !1;
|
|
527
|
+
n = await t();
|
|
528
|
+
}
|
|
529
|
+
return n.ok;
|
|
530
|
+
}
|
|
531
|
+
updateCommentInList(e) {
|
|
532
|
+
this.comments.value = this.comments.value.map((t) => t.id === e.id ? e : t);
|
|
533
|
+
}
|
|
534
|
+
}, we = "@layer base{:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--pop-color-brand-midnight-100:oklch(96.58% .0161 262.75);--pop-color-brand-midnight-900:oklch(15% .03 255.43);--pop-color-brand-midnight-800:oklch(19% .05 255.43);--pop-color-brand-ocean-400:oklch(63% .19 255.43);--pop-color-brand-ocean-100:oklch(91% .05 255.43);--pop-color-brand-forest-900:oklch(38.66% .0698 180.75);--pop-color-brand-forest-700:oklch(45% .15 165.43);--pop-color-brand-forest-100:oklch(97% .04 165.43);--pop-color-brand-highlight-400:oklch(88% .25 105.43);--pop-color-brand-pumpkin-500:oklch(62% .18 45.43);--pop-color-brand-pumpkin-200:oklch(89% .08 45.43);--pop-color-brand-lemon-300:oklch(91% .12 85.43);--pop-color-brand-lemon-100:oklch(97% .04 85.43);--pop-duration-bouncy:1s;--pop-duration-card-highlight:.6s;--pop-duration-gentle:.833s;--pop-duration-menu:.4s;--pop-duration-pop-hover:.6s;--pop-duration-pop-text:.3s;--pop-duration-quick:.833s;--pop-duration-slow:1.167s;--pop-ease-bouncy:linear(0, .011, .045 1.3%, .184 2.7%, .911 7.4%, 1.153 9.4%, 1.301 11.2%, 1.342, 1.362 13%, 1.363, 1.355 14.4%, 1.306 16%, 1.028 21%, .939 23%, .89 24.7%, .876, .868 26.4%, .869, .882 29%, .907 30.5%, 1.014 35.9%, 1.038, 1.048 39.8% 41.1%, 1.043 42.5%, .995 49.3%, .987, .983 53.2%, .984 55.9%, 1.002 62.7%, 1.006 66.4%, .998 79.7%, 1);--pop-ease-card-highlight:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-gentle:linear(0, .007, .026, .059 4.5%, .106 6.3%, .209 9.5%, .558 19.3%, .658, .742, .812, .87, .918, .957, .986 41.6%, 1.007 45.3%, 1.021 49.4%, 1.027 54% 60.9%, 1.007 83.2%, 1);--pop-ease-menu:linear(0, .0034 0.81%, .0278 2.42%, .097 4.84%, .5361 15.32%, .655 18.55%, .7314, .7964 23.39%, .8662, .9185, .9561, .9818, .9984, 1.0083 42.74%, 1.014 46.77%, 1.0145 53.22%, 1.0053 68.55%, 1.0019 77.42%, .9998 100%);--pop-ease-pop-hover:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-pop-text:linear(0, .0051 0.99%, .0261, .0607 3.61%, .1192 5.26%, .2531 8.21%, .6509 16.1%, .7652 18.73%, .8512, .9232 23.33%, .9881 25.96%, 1.0305 28.26%, 1.0642 30.88%, 1.0782 32.53%, 1.089, 1.094 36.47%, 1.0942, 1.0896 41.07%, 1.0804 43.7%, 1.0354 53.23%, 1.0181 57.5%, 1.0061 61.44%, .9974 65.71%, .9925 70.31%, .991 75.9%, .9996 99.88%);--pop-ease-quick:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-slow:linear(0, .005, .02 2%, .081 4.5%, .469 15.2%, .567, .65, .722 24.4%, .784, .835 31.1%, .878 34.9%, .914 39.1%, .942 43.8%, .964 49.1%, .979 55.4%, .989 62.4%, .995 71.1%, 1);--pop-shadow-xs:0px 1px 2px 0px #1018280d;--pop-shadow-sm:0px 1px 3px 0px #1018281a, 0px 1px 2px 0px #1018280f;--pop-shadow-md:0px 4px 8px -2px #1018281a, 0px 2px 4px -2px #1018280f;--pop-shadow-lg:0px 12px 16px -4px #10182814, 0px 4px 6px -2px #10182808;--pop-shadow-xl:0px 20px 24px -4px #10182814, 0px 8px 8px -4px #10182808;--pop-shadow-2xl:0px 24px 48px -12px #1018282e;--pop-shadow-3xl:0px 32px 48px -12px #10182852;--pop-shadow-4xl:0px 24px 32px -12px #10182847;--pop-radius-none:0;--pop-radius-xxs:.125rem;--pop-radius-xs:.25rem;--pop-radius-sm:.375rem;--pop-radius-md:.5rem;--pop-radius-lg:.625rem;--pop-radius-xl:.75rem;--pop-radius-2xl:1rem;--pop-radius-3xl:1.25rem;--pop-radius-4xl:1.5rem;--pop-radius-full:9999px;--pop-radius:.625rem;--pop-background:oklch(100% 0 0);--pop-foreground:oklch(0% 0 0);--pop-card:oklch(100% 0 0);--pop-card-foreground:oklch(14.5% 0 0);--pop-popover:oklch(100% 0 0);--pop-popover-foreground:oklch(0% 0 0);--pop-primary:oklch(20.5% 0 0);--pop-primary-foreground:oklch(98.5% 0 0);--pop-secondary:oklch(97% 0 0);--pop-secondary-foreground:oklch(20.5% 0 0);--pop-muted:oklch(97% 0 0);--pop-muted-foreground:oklch(71.52% .0233 256.76);--pop-accent:oklch(97% 0 0);--pop-accent-foreground:oklch(20.5% 0 0);--pop-destructive:var(--color-error-600);--pop-border:oklch(11.01% .0763 264.05/.102);--pop-input:oklch(92.2% 0 0);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(64.6% .222 41.116);--pop-chart-2:oklch(60% .118 184.704);--pop-chart-3:oklch(39.8% .07 227.392);--pop-chart-4:oklch(82.8% .189 84.429);--pop-chart-5:oklch(76.9% .188 70.08);--pop-sidebar:oklch(98.5% 0 0);--pop-sidebar-foreground:oklch(14.5% 0 0);--pop-sidebar-primary:oklch(20.5% 0 0);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(97% 0 0);--pop-sidebar-accent-foreground:oklch(20.5% 0 0);--pop-sidebar-border:oklch(92.2% 0 0);--pop-sidebar-ring:oklch(70.8% 0 0);font-family:Inter,sans-serif;font-size:16px}@media (prefers-color-scheme:dark){:host{--pop-background:oklch(15% .03 255.43);--pop-foreground:oklch(66% .006 255.43);--pop-card:oklch(20.5% 0 0);--pop-card-foreground:oklch(98.5% 0 0);--pop-popover:oklch(15% .03 255.43);--pop-popover-foreground:oklch(66% .006 255.43);--pop-primary:oklch(92.2% 0 0);--pop-primary-foreground:oklch(20.5% 0 0);--pop-secondary:oklch(26.9% 0 0);--pop-secondary-foreground:oklch(98.5% 0 0);--pop-muted:oklch(26.9% 0 0);--pop-muted-foreground:oklch(66% .006 255.43);--pop-accent:oklch(26.9% 0 0);--pop-accent-foreground:oklch(98.5% 0 0);--pop-destructive:var(--color-error-400);--pop-border:oklch(100% 0 0/.1);--pop-input:oklch(100% 0 0/.15);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(48.8% .243 264.376);--pop-chart-2:oklch(69.6% .17 162.48);--pop-chart-3:oklch(76.9% .188 70.08);--pop-chart-4:oklch(62.7% .265 303.9);--pop-chart-5:oklch(64.5% .246 16.439);--pop-sidebar:oklch(20.5% 0 0);--pop-sidebar-foreground:oklch(98.5% 0 0);--pop-sidebar-primary:oklch(48.8% .243 264.376);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(26.9% 0 0);--pop-sidebar-accent-foreground:oklch(98.5% 0 0);--pop-sidebar-border:oklch(100% 0 0/.1);--pop-sidebar-ring:oklch(55.6% 0 0)}}:host(.dark){--pop-background:oklch(15% .03 255.43);--pop-foreground:oklch(66% .006 255.43);--pop-card:oklch(20.5% 0 0);--pop-card-foreground:oklch(98.5% 0 0);--pop-popover:oklch(15% .03 255.43);--pop-popover-foreground:oklch(66% .006 255.43);--pop-primary:oklch(92.2% 0 0);--pop-primary-foreground:oklch(20.5% 0 0);--pop-secondary:oklch(26.9% 0 0);--pop-secondary-foreground:oklch(98.5% 0 0);--pop-muted:oklch(26.9% 0 0);--pop-muted-foreground:oklch(66% .006 255.43);--pop-accent:oklch(26.9% 0 0);--pop-accent-foreground:oklch(98.5% 0 0);--pop-destructive:var(--color-error-400);--pop-border:oklch(100% 0 0/.1);--pop-input:oklch(100% 0 0/.15);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(48.8% .243 264.376);--pop-chart-2:oklch(69.6% .17 162.48);--pop-chart-3:oklch(76.9% .188 70.08);--pop-chart-4:oklch(62.7% .265 303.9);--pop-chart-5:oklch(64.5% .246 16.439);--pop-sidebar:oklch(20.5% 0 0);--pop-sidebar-foreground:oklch(98.5% 0 0);--pop-sidebar-primary:oklch(48.8% .243 264.376);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(26.9% 0 0);--pop-sidebar-accent-foreground:oklch(98.5% 0 0);--pop-sidebar-border:oklch(100% 0 0/.1);--pop-sidebar-ring:oklch(55.6% 0 0)}*,:before,:after{box-sizing:inherit}html,body{margin:0;padding:0}svg{display:block}p{margin:0;padding:0}button{cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;display:flex}}", Te = "@layer components{.btn{text-align:center;cursor:pointer;border:0;border-radius:4px;justify-content:center;align-items:center;gap:.625rem;height:auto;padding:.625rem 1.25rem;transition:background-color .2s,color .2s;display:flex}.btn-link{border-radius:var(--pop-radius-xs,4px);cursor:pointer;background-color:#0000;border-style:solid;border-color:#0000;justify-content:center;align-items:center;gap:2px;font-weight:500;text-decoration:none;transition:background-color .2s,border-color .2s,color .2s;display:inline-flex}.btn-link--size-sm{letter-spacing:-.08px;border-width:1px 2px;font-size:13px;line-height:18px}.btn-link--size-md{letter-spacing:0;border-width:1px 3px;font-size:14px;line-height:20px}.btn-link--size-lg{letter-spacing:0;border-width:1px 4px;font-size:16px;line-height:24px}.btn-link--theme-default{color:color-mix(in srgb, var(--pop-foreground) 50%, transparent)}.btn-link--theme-default.btn-link--primary{color:var(--pop-foreground)}.btn-link--theme-white{color:#fff}.btn-link--theme-black{color:#000}.btn-link--theme-default:hover,.btn-link--theme-black:hover{background-color:color-mix(in srgb, var(--pop-foreground) 10%, transparent);border-color:color-mix(in srgb, var(--pop-foreground) 10%, transparent)}.btn-link--theme-default:not(.btn-link--primary):hover{color:var(--pop-foreground)}.btn-link--theme-white:hover{background-color:#ffffff29;border-color:#ffffff29}.btn-link:active{background-color:#0000;border-color:#0000}.btn-link--theme-default:not(.btn-link--primary):active{color:color-mix(in srgb, var(--pop-foreground) 50%, transparent)}.btn-link:focus-visible{background-color:var(--pop-ring,#155eef);border-color:var(--pop-ring,#155eef);outline:none;color:#fff!important}.btn-link:disabled,.btn-link.is-disabled{cursor:not-allowed;pointer-events:none;color:color-mix(in srgb, var(--pop-foreground) 35%, transparent)!important;background-color:#0000!important;border-color:#0000!important}.btn:focus-visible{outline-offset:2px;outline:2px solid}}", Ee = "@layer components{.mask{-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.mask-squircle{-webkit-mask-image:url(\"data:image/svg+xml,%3csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M 0 80 C 0 14.12 14.12 0 80 0 C 145.88 0 160 14.12 160 80 C 160 145.88 145.88 160 80 160 C 14.12 160 0 145.88 0 80 Z'/%3e%3c/svg%3e\");mask-image:url(\"data:image/svg+xml,%3csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M 0 80 C 0 14.12 14.12 0 80 0 C 145.88 0 160 14.12 160 80 C 160 145.88 145.88 160 80 160 C 14.12 160 0 145.88 0 80 Z'/%3e%3c/svg%3e\")}}", De = !1, A = /* @__PURE__ */ new Set(), j = null, M = null;
|
|
535
|
+
function Oe() {
|
|
536
|
+
if (typeof window > "u" || typeof document > "u") return !1;
|
|
537
|
+
let e = document.documentElement.classList.contains("dark") || document.body.classList.contains("dark"), t = document.documentElement.classList.contains("light") || document.body.classList.contains("light");
|
|
538
|
+
return e ? !0 : t ? !1 : (M ||= window.matchMedia("(prefers-color-scheme: dark)"), M.matches);
|
|
539
|
+
}
|
|
540
|
+
function ke() {
|
|
541
|
+
let e = Oe();
|
|
542
|
+
e !== De && (De = e, A.forEach((e) => {
|
|
543
|
+
let t = De || !!e.closest(".dark");
|
|
544
|
+
e.classList.toggle("dark", t);
|
|
545
|
+
}));
|
|
546
|
+
}
|
|
547
|
+
var Ae = () => {
|
|
548
|
+
ke();
|
|
549
|
+
};
|
|
550
|
+
function je(e) {
|
|
551
|
+
if (typeof window > "u" || typeof document > "u") return;
|
|
552
|
+
A.size === 0 && (De = Oe(), j = new MutationObserver(() => {
|
|
553
|
+
ke();
|
|
554
|
+
}), j.observe(document.documentElement, {
|
|
555
|
+
attributes: !0,
|
|
556
|
+
attributeFilter: ["class"]
|
|
557
|
+
}), j.observe(document.body, {
|
|
558
|
+
attributes: !0,
|
|
559
|
+
attributeFilter: ["class"]
|
|
560
|
+
}), M = window.matchMedia("(prefers-color-scheme: dark)"), M.addEventListener("change", Ae)), A.add(e);
|
|
561
|
+
let t = De || !!e.closest(".dark");
|
|
562
|
+
e.classList.toggle("dark", t);
|
|
563
|
+
}
|
|
564
|
+
function Me(e) {
|
|
565
|
+
A.delete(e), A.size === 0 && (j &&= (j.disconnect(), null), M &&= (M.removeEventListener("change", Ae), null));
|
|
566
|
+
}
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/components/base-element.ts
|
|
569
|
+
function N(e) {
|
|
570
|
+
let t = new CSSStyleSheet();
|
|
571
|
+
return t.replaceSync(e), t;
|
|
572
|
+
}
|
|
573
|
+
var Ne = N(we), Pe = N(Te), Fe = N(Ee), P = class extends HTMLElement {
|
|
574
|
+
get styleSheets() {
|
|
575
|
+
return [];
|
|
576
|
+
}
|
|
577
|
+
constructor() {
|
|
578
|
+
super(), this.baseStyleSheets = [
|
|
579
|
+
Ne,
|
|
580
|
+
Pe,
|
|
581
|
+
Fe
|
|
582
|
+
], this._hasRendered = !1, this._disposables = [], this.events = {}, this.attachShadow({ mode: "open" }), this.shadowRoot && (this.shadowRoot.adoptedStyleSheets = this.styles);
|
|
583
|
+
}
|
|
584
|
+
attributeChangedCallback(e, t, n) {
|
|
585
|
+
if (t === n) return;
|
|
586
|
+
let r = `on${e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")}Changed`;
|
|
587
|
+
typeof this[r] == "function" && this[r](n, t);
|
|
588
|
+
}
|
|
589
|
+
addEffect(e) {
|
|
590
|
+
this._disposables.push(ee(e));
|
|
591
|
+
}
|
|
592
|
+
connectedCallback() {
|
|
593
|
+
je(this), r(() => {
|
|
594
|
+
this.render(), this._bindEvents(), this.setupEffects();
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
disconnectedCallback() {
|
|
598
|
+
Me(this), this._disposables.forEach((e) => e()), this._disposables = [];
|
|
599
|
+
}
|
|
600
|
+
_bindEvents() {
|
|
601
|
+
let e = this.shadowRoot;
|
|
602
|
+
e && Object.keys(this.events).forEach((t) => {
|
|
603
|
+
e.addEventListener(t, this);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
handleEvent(e) {
|
|
607
|
+
let t = this.events[e.type];
|
|
608
|
+
t && typeof this[t] == "function" && this[t](e);
|
|
609
|
+
}
|
|
610
|
+
emit(e, t = {}) {
|
|
611
|
+
this.dispatchEvent(new CustomEvent(e, {
|
|
612
|
+
bubbles: !0,
|
|
613
|
+
composed: !0,
|
|
614
|
+
...t
|
|
615
|
+
}));
|
|
616
|
+
}
|
|
617
|
+
get styles() {
|
|
618
|
+
return [...this.baseStyleSheets, ...this.styleSheets];
|
|
619
|
+
}
|
|
620
|
+
setupEffects() {}
|
|
621
|
+
render() {
|
|
622
|
+
this.shadowRoot && (this.shadowRoot.innerHTML = this.getTemplate(), this._hasRendered = !0);
|
|
623
|
+
}
|
|
624
|
+
hideElement(e, t, n = !0) {
|
|
625
|
+
if (!this.shadowRoot || !this._hasRendered) return;
|
|
626
|
+
let r = this.shadowRoot.querySelector(e);
|
|
627
|
+
if (!r) {
|
|
628
|
+
console.warn(`Element not found for selector: ${e}`);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
n ? r.classList.toggle("hidden", t) : r.classList.toggle("invisible", t);
|
|
632
|
+
}
|
|
633
|
+
setText(e, t) {
|
|
634
|
+
let n = this.shadowRoot?.querySelector(e);
|
|
635
|
+
n && n.textContent !== String(t) && (n.textContent = String(t));
|
|
636
|
+
}
|
|
637
|
+
setAttr(e, t, n) {
|
|
638
|
+
let r = this.shadowRoot?.querySelector(e);
|
|
639
|
+
r && (n === null ? r.removeAttribute(t) : r.getAttribute(t) !== n && r.setAttribute(t, n));
|
|
640
|
+
}
|
|
641
|
+
toggleClass(e, t, n) {
|
|
642
|
+
let r = this.shadowRoot?.querySelector(e);
|
|
643
|
+
r && r.classList.toggle(t, n);
|
|
644
|
+
}
|
|
645
|
+
getElement(e) {
|
|
646
|
+
return this.shadowRoot?.querySelector(e) ?? null;
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
|
|
651
|
+
function F(e, t, n, r) {
|
|
652
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
653
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
654
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
655
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
656
|
+
}
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/components/pop-auth-panel.ts
|
|
659
|
+
var Ie = N("\n :host {\n display: block;\n position: relative;\n\n --pop-auth-border: var(--pop-border, rgba(0, 0, 32, 0.04));\n --pop-auth-watermark: rgba(0, 0, 32, 0.4);\n --pop-auth-btn: #000000;\n --pop-auth-logo: rgba(0, 0, 32, 0.35);\n --pop-auth-error: #dc2626;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --pop-auth-border: var(--pop-border, rgba(255, 255, 255, 0.1));\n --pop-auth-watermark: rgba(255, 255, 255, 0.4);\n --pop-auth-btn: #ffffff;\n --pop-auth-logo: rgba(255, 255, 255, 0.35);\n --pop-auth-error: var(--pop-destructive, #f87171);\n }\n }\n\n :host(.dark) {\n --pop-auth-border: var(--pop-border, rgba(255, 255, 255, 0.1));\n --pop-auth-watermark: rgba(255, 255, 255, 0.4);\n --pop-auth-btn: #ffffff;\n --pop-auth-logo: rgba(255, 255, 255, 0.35);\n --pop-auth-error: var(--pop-destructive, #f87171);\n }\n\n .panel {\n position: relative;\n border-top: 1px solid var(--pop-auth-border);\n }\n\n .watermark {\n position: absolute;\n top: -16px;\n left: 8px;\n font-family: Inter, sans-serif;\n font-size: 8px;\n font-weight: 700;\n letter-spacing: 1px;\n color: var(--pop-auth-watermark);\n text-transform: uppercase;\n backdrop-filter: blur(4px);\n border-radius: 9999px;\n padding: 2px 6px;\n pointer-events: none;\n }\n\n .actions {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n }\n\n .join-btn {\n font-family: Inter, sans-serif;\n font-size: 13px;\n font-weight: 600;\n color: var(--pop-auth-btn);\n background: none;\n border: none;\n cursor: pointer;\n padding: 0;\n letter-spacing: -0.08px;\n line-height: 18px;\n }\n\n .join-btn:disabled {\n opacity: 0.6;\n cursor: default;\n }\n\n .logo {\n font-family: Inter, sans-serif;\n font-size: 9px;\n font-weight: 700;\n letter-spacing: 1.5px;\n color: var(--pop-auth-logo);\n text-transform: uppercase;\n }\n\n .error {\n padding: 0 16px 12px;\n font-family: Inter, sans-serif;\n font-size: 12px;\n line-height: 16px;\n color: var(--pop-auth-error);\n text-align: center;\n }\n"), Le = class extends P {
|
|
660
|
+
constructor(...e) {
|
|
661
|
+
super(...e), this.events = { click: "onClick" };
|
|
662
|
+
}
|
|
663
|
+
get styleSheets() {
|
|
664
|
+
return [Ie];
|
|
665
|
+
}
|
|
666
|
+
onClick(e) {
|
|
667
|
+
e.target.closest(".join-btn") && this.handleJoin();
|
|
668
|
+
}
|
|
669
|
+
setupEffects() {
|
|
670
|
+
this.addEffect(() => {
|
|
671
|
+
let e = de.value, t = ue.value, n = this.getElement(".join-btn");
|
|
672
|
+
n && (n.disabled = e, n.textContent = e ? "Signing in…" : "Join the Conversation");
|
|
673
|
+
let r = this.getElement(".error");
|
|
674
|
+
r && (t ? (r.hidden = !1, r.textContent = t) : (r.hidden = !0, r.textContent = ""));
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
async handleJoin() {
|
|
678
|
+
he(), await D(this.gridStore.apiUrl, this.gridStore.publicKey);
|
|
679
|
+
}
|
|
680
|
+
getTemplate() {
|
|
681
|
+
return "\n <div class=\"panel\">\n <div class=\"watermark\">Popgrids</div>\n <div class=\"actions\">\n <button class=\"join-btn\" type=\"button\">Join the Conversation</button>\n <span class=\"logo\">POPGRIDS</span>\n </div>\n <div class=\"error\" hidden></div>\n </div>\n ";
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
F([O(k)], Le.prototype, "gridStore", void 0), customElements.get("pop-auth-panel") || customElements.define("pop-auth-panel", Le);
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region src/assets/popgrids-letter-p.png?inline
|
|
687
|
+
var Re = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAABMCAYAAADa6W+wAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAUuSURBVHgB5ZyBceIwEEX3bq4AOsAdQAdxKggl+Co4rgKcCkgqgFRAUgGkAqACOxVAKvDpg+VRHEmWQSubuTezg8Ega7UrebWS+UG8jIXEQoZCovI9lcd1ciHHUnZCPsrXXflZ7xkISYSshByEFJ5kLWRO54bsHRGdK+dTYZNkQhbUg4aI6FyRoiNBQyQUGLj3jMJYuleNMC4v1gel67Ig/WCq5Qe144+QlM6Wb2QwGNB4PD7JaDQ6veIzKZLj8XiSPM9Pr/v9nna73UnwWUtyIb+FbMgjM3K0QBzHxXq9Lg6HQ3Et2+22WCwWpzJdr1/KjDzRqLiwZDGbzbwobCLLslNDRFEUrAEmTReBVVCxkLRohIsbICLLiA5roxJdAm9zaIAJXUBmKhCtHtraJjAuNHjBgVrcBcDsFhSXoD4NDbB2VTyyFNI7xSUODTB1UX5hKmA+nxd9Bl0AYxGZ3X9wkdWTJCluARjIYv2ULrG6T3eHhabT6SkY4sASFB1aWx23FJ+IULcqm6MBUKbF+rFO+ZQCje6qa6J8jsjQYv2FTvmMAvb1yWRSXePp6anwzWq1cnb9MQXo6yqwthyZ0Q04y9e5/k9F+VjnCpiGCrckDjCtFV51OpZTWN/lo/4Gxqryd7pvCNckTkS/rI7f39/JN5b6j1TltU10d3dHnKjl+7Y8sHhtpS+iHm3f4JyfS2RIytHvMV4ZdMt+1lvhS9OUaSdu5DUuSFk5l60hksoPWv7QK9I1kb/zjU2HRsuHIFQj17FanusWV4fD4i5I5Ye6k8PhkELAqbxlHDn2os9L5Tm6mUX5vBfKy/s7x/U+Pz9Np7q3/GazqY7VaI+j/Br7zpV/e3urjjmiSUvUWJ3QRkHcqAlHzL58g+iUzAmNLxOboGAgur+/rwYkjgnU6+ur6VROXVpezbLA6hw5A9dMTnDlZRoLinPk8CwTmm85vE76PCdIvRn0ympdQL8YGWI6y0GD1atVGzngaePLrmLua8FAaqEaBTsb7bl4fHy0hbTPdB7pv7AmjYtwraZw0eDu6OuRqrTV7T8+PuhWkHGDhUeqWV0qr43+b6XPI4RVAyYNGyHL+odS+Vz3i1tQ/vn5uUlxnPitO/FL+cL3XzEkFAFmWsjRY28eZnKXTKBQBgY3y6xN8pcM+km0O66wlhZiUMJ1lstlY1yB8y335KU2peUOTKRQtvWTyOGJypJv4FGwmlD42zl4Aq6rZnQhFyxnYYBLXb4YEemXpjlx2ENziSBaTaglncT3nhtgTS23nEkyXYEhdl417KJwtfaUrkCrPPbOhEDdqNBS6ZQcd4HbWOkugN0NIWhhfRhpQR4eM/mlHGujPEvq1ysNOXu4tHzaKidPqLO6XPcFrkCnDgIdy/IYUryYiubkEVV5bSwbSnlgW04mBhqVDxnfh16tVZXXhk8hLW9bVCQGemV5y7VyCkAnUR5APEHmezkL9RxeZ4Oey5qab5yUVxcTuXh5eTGd2lMgnkjjepg/c9JmdYWT2FQJjo3BEsusLqPAbHUV4VpMTNPUZvUFBSYxVMT7vvsGxWH1iDpgTYbbDjzg2i6AXBweMSH77C2hjsAUy/psPLwASce2OD4GuqIA2B4hxzRyrrzHbfBb8I2ZGJKODw8PVeJRxujysXDcw/FYOBKWDhFjLuSeAkV1NlJqn125RjLqqJ+bSOk/VVwSEe9fRSzJQx6Om4T8NgLKiunGSMh8O3QR/Damjmn7hyF14KpxKSM6d49IOa/7u6dX6snfPf0DiVL6IWhCmZ4AAAAASUVORK5CYII=", I = /* @__PURE__ */ "#DDD0BE.#E9DCBB.#E9DCBB.#C7D1B0.#C6D0CB.#E9DCBB.#C7D1B0.#E9DCBB.#DFC2C0.#CFD4C6.#D7E3E8.#CFD4C6.#D6B3B3.#E9DCBB.#CFCBDC.#BFD6D7.#E3D2C6.#D1E2E7.#D6B3B3.#BFD6D7.#E9DCBB.#C7D1B0.#DFC2C0.#D1E2E7.#CFD4C6.#E9DCBB.#D7E3E8.#CFD4C6.#C6D0CB.#E9DCBB.#C7D1B0.#E9DCBB.#CFCBDC.#E3D2C6.#E9DCBB".split("."), ze = (e) => typeof e == "number" ? I[e % I.length] ?? "#e5e7eb" : I[Math.floor(Math.random() * I.length)];
|
|
688
|
+
function Be(e) {
|
|
689
|
+
let t = new TextEncoder().encode(e), n = 2166136261;
|
|
690
|
+
for (let e = 0; e < t.length; e++) {
|
|
691
|
+
let r = t[e] ?? 0;
|
|
692
|
+
n ^= r, n = Math.imul(n, 16777619);
|
|
693
|
+
}
|
|
694
|
+
return n >>> 0;
|
|
695
|
+
}
|
|
696
|
+
function Ve(e) {
|
|
697
|
+
return I[Be(e) % I.length] ?? "#e5e7eb";
|
|
698
|
+
}
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/components/pop-comment-avatar.ts
|
|
701
|
+
var He = N("\n :host {\n display: block;\n\n --comment-avatar-border-size: 1px;\n --comment-avatar-border-color: var(--color-background, #fff);\n --comment-avatar-size: 32px;\n }\n\n .comment-avatar {\n align-items: center;\n display: flex;\n flex-shrink: 0;\n isolation: isolate;\n justify-content: center;\n position: relative;\n width: calc(var(--comment-avatar-size) + calc(var(--comment-avatar-border-size) * 2));\n height: calc(var(--comment-avatar-size) + calc(var(--comment-avatar-border-size) * 2));\n }\n\n .comment-avatar--size-xs {\n --comment-avatar-size: 32px;\n }\n\n .comment-avatar--size-sm {\n --comment-avatar-size: 56px;\n }\n\n .comment-avatar--size-md {\n --comment-avatar-size: 80px;\n }\n\n .comment-avatar--size-lg {\n --comment-avatar-size: 120px;\n }\n\n .comment-avatar--size-xl {\n --comment-avatar-size: 140px;\n }\n\n .comment-avatar__background {\n background-color: var(--comment-avatar-border-color);\n position: absolute;\n top: 0;\n left: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n }\n\n /**\n * Content\n */\n\n .comment-avatar__content {\n align-items: center;\n background-color: var(--color-surface-bg-default);\n display: flex;\n justify-content: center;\n overflow: hidden;\n position: relative;\n height: var(--comment-avatar-size);\n width: var(--comment-avatar-size);\n z-index: 20;\n\n /* Initials styling */\n font-family: Inter, sans-serif;\n font-weight: 600;\n color: #374151;\n font-size: calc(var(--comment-avatar-size) * 0.35);\n line-height: 1;\n }\n\n .comment-avatar__content::slotted(img) {\n -webkit-user-drag: none;\n align-self: stretch;\n flex: 1 0 0;\n height: var(--comment-avatar-size);\n object-fit: cover;\n pointer-events: none;\n position: absolute;\n user-select: none;\n width: var(--comment-avatar-size);\n }\n\n .comment-avatar__deleted-mark {\n -webkit-user-drag: none;\n bottom: -3px;\n height: auto;\n left: 0;\n object-fit: cover;\n pointer-events: none;\n position: absolute;\n user-select: none;\n width: 100%;\n transform: scale(0.57);\n }\n"), Ue = class extends P {
|
|
702
|
+
constructor() {
|
|
703
|
+
super(), this._backgroundColor = ze() ?? "#e5e7eb";
|
|
704
|
+
}
|
|
705
|
+
static get observedAttributes() {
|
|
706
|
+
return [
|
|
707
|
+
"size",
|
|
708
|
+
"data-color-key",
|
|
709
|
+
"deleted"
|
|
710
|
+
];
|
|
711
|
+
}
|
|
712
|
+
onSizeChanged() {
|
|
713
|
+
this.render();
|
|
714
|
+
}
|
|
715
|
+
onDataColorKeyChanged() {
|
|
716
|
+
this.render();
|
|
717
|
+
}
|
|
718
|
+
onDeletedChanged() {
|
|
719
|
+
this.render();
|
|
720
|
+
}
|
|
721
|
+
get styleSheets() {
|
|
722
|
+
return [He];
|
|
723
|
+
}
|
|
724
|
+
get size() {
|
|
725
|
+
return this.getAttribute("size") || "md";
|
|
726
|
+
}
|
|
727
|
+
set size(e) {
|
|
728
|
+
this.setAttribute("size", e);
|
|
729
|
+
}
|
|
730
|
+
get deleted() {
|
|
731
|
+
return this.hasAttribute("deleted");
|
|
732
|
+
}
|
|
733
|
+
set deleted(e) {
|
|
734
|
+
e ? this.setAttribute("deleted", "") : this.removeAttribute("deleted");
|
|
735
|
+
}
|
|
736
|
+
getTemplate() {
|
|
737
|
+
let e = this.size, t = this.deleted, n = this.getAttribute("data-color-key"), r = t ? "var(--pop-muted-foreground, #e5e7eb)" : n ? Ve(n) : this._backgroundColor;
|
|
738
|
+
return `
|
|
739
|
+
<div class="comment-avatar comment-avatar--size-${e}" part="base">
|
|
740
|
+
<div class="comment-avatar__background mask mask-squircle" part="background"></div>
|
|
741
|
+
${t ? `<div
|
|
742
|
+
class="comment-avatar__content mask mask-squircle"
|
|
743
|
+
part="content"
|
|
744
|
+
style="background-color: ${r}; opacity: 0.15"
|
|
745
|
+
><img class="comment-avatar__deleted-mark" src="${Re}" alt="Deleted user" /></div>` : `<slot
|
|
746
|
+
class="comment-avatar__content mask mask-squircle"
|
|
747
|
+
part="content"
|
|
748
|
+
style="background-color: ${r};"
|
|
749
|
+
></slot>`}
|
|
750
|
+
</div>
|
|
751
|
+
`;
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
customElements.get("pop-comment-avatar") || customElements.define("pop-comment-avatar", Ue);
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region src/helpers/author.ts
|
|
757
|
+
function L(e) {
|
|
758
|
+
return e ? e.split(" ").map((e) => e[0] ?? "").join("").toUpperCase().slice(0, 2) : "?";
|
|
759
|
+
}
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/components/pop-comment-bar.ts
|
|
762
|
+
var We = N("\n :host {\n background: var(--pop-background);\n border-top: 1px solid var(--pop-bar-input-bg);\n display: block;\n padding: 6px;\n position: relative;\n\n --pop-bar-avatar-bg: #e5e7eb;\n --pop-bar-avatar-color: #374151;\n --pop-bar-avatar-border: #ffffff;\n --pop-bar-input-bg: rgba(0, 0, 32, 0.04);\n --pop-bar-send-hover: rgba(0, 0, 32, 0.06);\n --pop-bar-send-color: #000000;\n --pop-bar-watermark: rgba(0, 0, 32, 0.1);\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --pop-bar-avatar-bg: #1f2937;\n --pop-bar-avatar-color: #d1d5db;\n --pop-bar-avatar-border: var(--pop-popover, #151d2a);\n --pop-bar-input-bg: rgba(255, 255, 255, 0.05);\n --pop-bar-send-hover: rgba(255, 255, 255, 0.08);\n --pop-bar-send-color: #ffffff;\n --pop-bar-watermark: rgba(255, 255, 255, 0.1);\n }\n }\n\n :host(.dark) {\n --pop-bar-avatar-bg: #1f2937;\n --pop-bar-avatar-color: #d1d5db;\n --pop-bar-avatar-border: var(--pop-popover, #151d2a);\n --pop-bar-input-bg: rgba(255, 255, 255, 0.05);\n --pop-bar-send-hover: rgba(255, 255, 255, 0.08);\n --pop-bar-send-color: #ffffff;\n --pop-bar-watermark: rgba(255, 255, 255, 0.1);\n }\n\n .bar {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n\n .bar__user {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n padding-top: 2px;\n }\n\n .bar__avatar {\n flex-shrink: 0;\n --comment-avatar-border-size: 0px;\n }\n\n .bar__avatar--reply {\n margin-right: -4px;\n z-index: 1;\n }\n\n .bar__avatar--user {\n z-index: 2;\n }\n\n .bar__user.has-reply .bar__avatar--user {\n --comment-avatar-border-size: 2px;\n --comment-avatar-border-color: var(--pop-bar-avatar-border);\n }\n\n .bar__input-wrap {\n flex: 1;\n min-width: 0;\n background: var(--pop-bar-input-bg);\n border-radius: 18px;\n overflow: hidden;\n display: flex;\n align-items: flex-end;\n padding: 4px 8px 4px 12px;\n max-height: 280px;\n }\n\n .bar__send {\n align-items: center;\n align-self: flex-end;\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n justify-content: center;\n padding-bottom: 2px;\n }\n\n .logo-watermark {\n position: absolute;\n top: -16px;\n left: 8px;\n font-family: Inter, sans-serif;\n font-size: 8px;\n font-weight: 700;\n letter-spacing: 1px;\n color: var(--pop-bar-watermark);\n text-transform: uppercase;\n border-radius: 9999px;\n padding: 2px 6px;\n pointer-events: none;\n user-select: none;\n }\n"), Ge = "<svg width=\"64\" height=\"11\" viewBox=\"0 0 64 11\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M3.91111 0C0.892839 0 0 2.11357 0 4.77714C0 5.76321 0.0987654 6.73357 0.213333 7.70786C0.25679 8.08893 0.240988 8.50929 0.312099 8.89036C0.497778 9.89214 1.44593 10.3557 2.36642 10.3557C3.62667 10.3557 4.4642 9.56607 4.4642 8.30107C4.4642 7.57036 4.22321 7.09107 3.5279 6.80821C3.48444 6.7925 3.44099 6.78071 3.44099 6.72179C3.44099 6.62357 3.59901 6.55286 3.69778 6.55286C4.03753 6.55286 4.57481 6.89071 5.04494 6.89071C6.88593 6.89071 7.90519 5.13071 7.90519 3.48071C7.90519 1.08429 6.13136 0 3.91111 0ZM3.89531 5.18179C3.78074 5.18179 3.68198 5.08357 3.68198 4.96964C3.68198 4.81643 3.89531 4.7025 3.96642 4.57679C4.12049 4.29393 4.16395 3.81464 4.16395 3.4925C4.16395 3.11143 4.06519 2.40821 3.8242 2.12536C3.75309 2.04286 3.65432 1.99964 3.65432 1.88571C3.65432 1.77179 3.76889 1.67357 3.87951 1.67357C4.36148 1.67357 4.60247 3.08393 4.60247 3.44929C4.60247 3.84214 4.47605 5.18179 3.89531 5.18179Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M12.7368 0.239637C9.73433 0.239637 7.93285 2.35321 7.93285 5.25249C7.93285 8.15178 9.73038 10.2654 12.7368 10.2654C15.7432 10.2654 17.5249 8.12428 17.5249 5.25249C17.5249 2.38071 15.7116 0.239637 12.7368 0.239637ZM12.8672 8.83142C12.8198 8.89035 12.7249 9.00035 12.6104 9.00035C12.4958 9.00035 12.3852 8.90214 12.3852 8.78821C12.3852 8.74499 12.7526 8.19499 12.8119 8.02607C13.037 7.36214 13.0805 6.64321 13.0805 5.93999C13.0805 4.99714 12.9106 3.78321 12.3299 3.00928C12.2153 2.86785 11.8637 2.60071 11.8637 2.44749C11.8637 2.33357 11.9625 2.23535 12.077 2.23535C12.1758 2.23535 12.2746 2.32178 12.3457 2.37678C13.2504 3.12321 13.523 4.82821 13.523 5.93999C13.523 6.81214 13.4874 8.08499 12.8711 8.82749L12.8672 8.83142Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M21.6533 0C18.6351 0 17.7422 2.11357 17.7422 4.77714C17.7422 5.76321 17.841 6.73357 17.9555 7.70786C17.999 8.08893 17.9832 8.50929 18.0543 8.89036C18.24 9.89214 19.1881 10.3557 20.1086 10.3557C21.3689 10.3557 22.2064 9.56607 22.2064 8.30107C22.2064 7.57036 21.9654 7.09107 21.2701 6.80821C21.2267 6.7925 21.1832 6.78071 21.1832 6.72179C21.1832 6.62357 21.3412 6.55286 21.44 6.55286C21.7797 6.55286 22.317 6.89071 22.7871 6.89071C24.6281 6.89071 25.6474 5.13071 25.6474 3.48071C25.6474 1.08429 23.8775 0 21.6533 0ZM21.6415 5.18179C21.5269 5.18179 21.4281 5.08357 21.4281 4.96964C21.4281 4.81643 21.6415 4.7025 21.7126 4.57679C21.8667 4.29393 21.9101 3.81464 21.9101 3.4925C21.9101 3.11143 21.8113 2.40821 21.5704 2.12536C21.4992 2.04286 21.4005 1.99964 21.4005 1.88571C21.4005 1.77179 21.5151 1.67357 21.6257 1.67357C22.1076 1.67357 22.3486 3.08393 22.3486 3.44929C22.3486 3.84214 22.2222 5.18179 21.6415 5.18179Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M31.9012 4.16822C30.882 4.16822 29.4637 4.6318 29.4637 5.84572C29.4637 6.53715 29.9733 7.56251 30.7832 7.56251C31.2929 7.56251 31.6208 7.16965 31.7906 7.16965C31.8341 7.16965 31.8736 7.19715 31.8736 7.24037C31.8736 7.64894 31.0795 7.83358 30.7674 7.83358C29.677 7.83358 29.0963 6.90251 29.0963 5.91644C29.0963 4.70644 30.242 3.77537 31.4035 3.77537C31.7432 3.77537 32.0988 3.87358 32.4385 3.87358C33.4459 3.87358 34.165 2.97394 34.165 2.01537C34.165 0.424295 32.2687 0.0589382 31.0045 0.0589382C27.6464 0.0589382 25.6909 2.22751 25.6909 5.52358C25.6909 8.56822 27.279 10.5089 30.4237 10.5089C32.4622 10.5089 34.6864 9.6368 34.6864 7.26787C34.6864 5.6493 33.6237 4.16822 31.8973 4.16822H31.9012Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M41.2681 6.56464C41.0113 6.56464 40.802 6.66286 40.5886 6.66286C40.5452 6.66286 40.5333 6.61964 40.5333 6.59214C40.5333 6.49393 40.5768 6.45071 40.6479 6.42321C40.8889 6.34071 41.1457 6.28179 41.3827 6.16786C42.4612 5.66107 43.0973 4.7575 43.0973 3.56321C43.0973 1.40643 41.2405 0.0982143 39.202 0.0982143C38.4632 0.0982143 37.7442 0.310357 37.12 0.648214C35.4212 1.56357 35.0933 2.87571 34.9946 4.66321C34.9511 5.36643 34.9511 6.07357 34.9511 6.77679V8.48179C34.9511 9.55036 35.6583 10.4107 36.7763 10.4107C37.5822 10.4107 38.3052 9.83321 38.4909 9.07107C38.5896 8.61929 38.5343 8.085 38.5343 7.64893C38.5343 7.60571 38.5501 7.59393 38.5896 7.59393C38.6291 7.59393 38.6765 7.62143 38.7042 7.63714C39.202 8.83536 39.8815 10.3557 41.4222 10.3557C42.4849 10.3557 43.362 9.60929 43.362 8.525C43.362 7.44071 42.3427 6.56857 41.2642 6.56857L41.2681 6.56464ZM38.961 5.18179C38.8464 5.18179 38.7476 5.08357 38.7476 4.96964C38.7476 4.81643 38.961 4.7025 39.0321 4.57679C39.1862 4.29393 39.2296 3.81464 39.2296 3.4925C39.2296 3.11143 39.1309 2.40821 38.8899 2.12536C38.8188 2.04286 38.7358 1.99964 38.7358 1.88571C38.7358 1.77179 38.8346 1.67357 38.9491 1.67357C39.4311 1.67357 39.6721 3.08393 39.6721 3.44929C39.6721 3.84214 39.5575 5.18179 38.9649 5.18179H38.961Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M46.7674 0.549991C46.4277 0.326063 45.9457 0.212134 45.5348 0.212134C44.642 0.212134 43.8756 0.915349 43.7768 1.79142C43.7491 2.04678 43.761 2.28642 43.761 2.55356V4.94606L43.7175 7.46821V8.72142C43.7175 9.70749 44.5669 10.4814 45.5467 10.4814C46.2696 10.4814 47.0637 10.0296 47.3324 9.35392C47.4864 8.97285 47.5022 8.43856 47.5022 8.02999V6.92999L47.518 4.73392V2.53785C47.518 1.72071 47.5022 1.07249 46.7674 0.549991Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M50.2993 0.125713C48.8533 0.125713 48.1304 0.801428 48.1304 2.25107V2.82857L48.1462 3.96786V4.54536C48.1462 4.98143 48.1462 5.39 48.1304 5.82607C48.1027 6.34857 48.0316 6.86714 48.0316 7.40536C48.0316 9.3775 49.0509 10.3361 51.0222 10.3361C54.0523 10.3361 56.1067 9.03964 56.1067 5.81429C56.1067 1.925 54.2222 0.121785 50.2993 0.121785V0.125713ZM51.6583 7.91607C51.5437 7.91607 51.4449 7.81786 51.4449 7.70393C51.4449 7.66071 51.4608 7.83352 51.4884 7.59C51.8558 6.985 51.9546 6.14036 51.9546 5.44893C51.9546 4.80071 51.8835 3.84214 51.4726 3.33536C51.4015 3.22143 51.2593 3.13893 51.2593 2.9975C51.2593 2.88357 51.358 2.78536 51.4726 2.78536C51.6859 2.78536 51.9822 3.31964 52.0691 3.50428C52.3378 4.125 52.3812 4.80071 52.3812 5.46071C52.3812 5.86928 52.1679 7.91214 51.6583 7.91214V7.91607Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n<path d=\"M62.7239 5.1268C61.9022 5.05608 60.7249 4.77322 60.0889 4.23894C60.0059 4.16822 59.8637 4.07001 59.8637 3.9443C59.8637 3.90108 59.8795 3.83037 59.9348 3.83037C60.0889 3.83037 61.0805 4.62001 61.9338 4.62001C63.0123 4.62001 64 3.78715 64 2.69108C64 0.887867 61.5941 0.157152 60.1324 0.157152C57.9635 0.157152 56.3516 1.5518 56.3516 3.76358C56.3516 4.24287 56.4227 4.90287 56.7783 5.27215C56.9482 5.4568 57.2326 5.4568 57.4578 5.4568C58.3072 5.4568 59.3857 5.72394 59.836 6.49787C59.8795 6.56858 59.919 6.68251 59.919 6.76501C59.919 6.79251 59.919 6.83572 59.8914 6.82001C59.8084 6.79251 59.7373 6.7218 59.678 6.6668C59.1802 6.18751 58.5007 5.70822 57.7817 5.70822C56.7032 5.70822 56.324 6.73751 56.324 7.63715C56.324 9.45215 57.9674 10.4539 59.6385 10.4539C61.6217 10.4539 64 9.15751 64 6.94572C64 6.12858 63.6444 5.21322 62.7239 5.13072V5.1268Z\" fill=\"#000020\" fill-opacity=\"0.1\"/>\n</svg>", Ke = class extends P {
|
|
763
|
+
constructor(...e) {
|
|
764
|
+
super(...e), this.events = { click: "onClick" };
|
|
765
|
+
}
|
|
766
|
+
get styleSheets() {
|
|
767
|
+
return [We];
|
|
768
|
+
}
|
|
769
|
+
onClick(e) {
|
|
770
|
+
e.target.closest(".bar__send") && this.handleSend();
|
|
771
|
+
}
|
|
772
|
+
setupEffects() {
|
|
773
|
+
let e = null, t = null;
|
|
774
|
+
this.addEffect(() => {
|
|
775
|
+
let t = this.gridStore.replyingTo.value;
|
|
776
|
+
if (t && t !== e) {
|
|
777
|
+
let e = this.getElement("pop-comment-input");
|
|
778
|
+
e && setTimeout(() => e.focus(), 0);
|
|
779
|
+
}
|
|
780
|
+
e = t;
|
|
781
|
+
}), this.addEffect(() => {
|
|
782
|
+
let e = this.gridStore.editingComment.value;
|
|
783
|
+
if (e && e.id !== t) {
|
|
784
|
+
let t = this.getElement("pop-comment-input");
|
|
785
|
+
t && (t.setValue(e.body), setTimeout(() => t.focus(), 0));
|
|
786
|
+
} else if (!e && t) {
|
|
787
|
+
let e = this.getElement("pop-comment-input");
|
|
788
|
+
e && e.clear();
|
|
789
|
+
}
|
|
790
|
+
t = e?.id ?? null;
|
|
791
|
+
}), this.addEffect(() => {
|
|
792
|
+
let e = E.value, t = this.getElement(".bar__user");
|
|
793
|
+
if (!t) return;
|
|
794
|
+
let n = this.gridStore.replyingToComment.value?.author;
|
|
795
|
+
if (this.gridStore.editingComment.value) {
|
|
796
|
+
t.classList.remove("has-reply");
|
|
797
|
+
let n = e?.id ?? e?.name ?? "";
|
|
798
|
+
t.innerHTML = e?.image ? `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}"><img src="${e.image}" alt="${e.name ?? "User"}'s avatar"></pop-comment-avatar>` : `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}">${L(e?.name)}</pop-comment-avatar>`;
|
|
799
|
+
} else if (n) {
|
|
800
|
+
t.classList.add("has-reply");
|
|
801
|
+
let r = n.id ?? n.name ?? "", i = e?.id ?? e?.name ?? "";
|
|
802
|
+
t.innerHTML = (n.image ? `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--reply" data-color-key="${r}"><img src="${n.image}" alt="${n.name ?? "User"}'s avatar"></pop-comment-avatar>` : `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--reply" data-color-key="${r}">${L(n.name)}</pop-comment-avatar>`) + (e?.image ? `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${i}"><img src="${e.image}" alt="${e.name ?? "User"}'s avatar"></pop-comment-avatar>` : `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${i}">${L(e?.name)}</pop-comment-avatar>`);
|
|
803
|
+
} else {
|
|
804
|
+
t.classList.remove("has-reply");
|
|
805
|
+
let n = e?.id ?? e?.name ?? "";
|
|
806
|
+
t.innerHTML = e?.image ? `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}"><img src="${e.image}" alt="${e.name ?? "User"}'s avatar"></pop-comment-avatar>` : `<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}">${L(e?.name)}</pop-comment-avatar>`;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
async handleSend() {
|
|
811
|
+
let e = this.getElement("pop-comment-input");
|
|
812
|
+
if (!e) return;
|
|
813
|
+
let t = e.getValue().trim();
|
|
814
|
+
if (!t) return;
|
|
815
|
+
let n = this.gridStore.editingCommentId.value;
|
|
816
|
+
if (n) e.clear(), this.gridStore.editingCommentId.value = null, await this.gridStore.editComment(n, t);
|
|
817
|
+
else {
|
|
818
|
+
e.clear();
|
|
819
|
+
let n = await this.gridStore.postComment(t, this.gridStore.replyingTo.value ?? void 0);
|
|
820
|
+
this.gridStore.replyingTo.value = null, n && (this.gridStore.scrollingCommentId.value = n.id);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
getTemplate() {
|
|
824
|
+
return `
|
|
825
|
+
<div class="logo-watermark">${Ge}</div>
|
|
826
|
+
<div class="bar">
|
|
827
|
+
<div class="bar__user">
|
|
828
|
+
<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user">?</pop-comment-avatar>
|
|
829
|
+
</div>
|
|
830
|
+
<div class="bar__input-wrap">
|
|
831
|
+
<pop-comment-input></pop-comment-input>
|
|
832
|
+
</div>
|
|
833
|
+
<button class="bar__send" type="button" aria-label="Send comment">
|
|
834
|
+
<pop-comment-icon theme="neutral" variant="send"></pop-comment-icon>
|
|
835
|
+
</button>
|
|
836
|
+
</div>
|
|
837
|
+
`;
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
F([O(k)], Ke.prototype, "gridStore", void 0), customElements.get("pop-comment-bar") || customElements.define("pop-comment-bar", Ke);
|
|
841
|
+
//#endregion
|
|
842
|
+
//#region src/components/pop-comment-icon.ts
|
|
843
|
+
var qe = N("\n :host {\n /* Mode-level theme colors (defaults for light mode) */\n --pop-comment-color-black: #000000;\n --pop-comment-color-white: #ffffff;\n --pop-comment-color-default: #000000;\n --pop-comment-color-reversed: #ffffff;\n --pop-comment-bg-singular-resting: #121926;\n --pop-comment-bg-singular-hover: rgba(0, 0, 32, 0.08);\n --pop-comment-bg-reversed: #121926;\n --pop-comment-bg-blank-resting: #ffffff;\n\n display: flex;\n\n --pop-comment-icon-scale: 1;\n --pop-comment-icon-scale-hover: 1.1875;\n --pop-comment-icon-scale-active: 0.9375;\n --pop-comment-icon-size: 32px;\n --pop-comment-icon-color: var(--pop-foreground, #000000);\n --pop-comment-icon-color-hover: var(--pop-foreground, #000000);\n --pop-comment-icon-color-active: var(--pop-foreground, #000000);\n --pop-comment-icon-color-focused: var(--pop-foreground, #000000);\n --pop-comment-icon-background: var(\n --color-surface-buttons-singular-bg-launch-icon-hover,\n rgba(0, 0, 32, 0.08)\n );\n --pop-comment-icon-background-hover: var(\n --color-surface-buttons-singular-bg-launch-icon-hover,\n rgba(0, 0, 32, 0.08)\n );\n --pop-comment-icon-background-active: var(\n --color-surface-buttons-singular-bg-launch-icon-hover,\n rgba(0, 0, 32, 0.08)\n );\n --pop-comment-icon-background-focused: var(\n --color-surface-buttons-singular-bg-launch-icon-hover,\n rgba(0, 0, 32, 0.08)\n );\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n /* Overrides for dark mode */\n --pop-comment-color-black: #ffffff;\n --pop-comment-color-white: #000000;\n --pop-comment-color-default: #ffffff;\n --pop-comment-color-reversed: #000000;\n --pop-comment-bg-singular-resting: #ffffff;\n --pop-comment-bg-singular-hover: rgba(255, 255, 255, 0.15);\n --pop-comment-bg-reversed: #ffffff;\n --pop-comment-bg-blank-resting: #121926;\n }\n }\n\n :host(.dark) {\n /* Overrides for dark mode (.dark class on host) */\n --pop-comment-color-black: #ffffff;\n --pop-comment-color-white: #000000;\n --pop-comment-color-default: #ffffff;\n --pop-comment-color-reversed: #000000;\n --pop-comment-bg-singular-resting: #ffffff;\n --pop-comment-bg-singular-hover: rgba(255, 255, 255, 0.15);\n --pop-comment-bg-reversed: #ffffff;\n --pop-comment-bg-blank-resting: #121926;\n }\n\n .comment-icon {\n align-items: center;\n background: transparent;\n border: none;\n display: inline-flex;\n height: var(--pop-comment-icon-size);\n justify-content: center;\n padding: 0;\n position: relative;\n transform-origin: center;\n width: var(--pop-comment-icon-size);\n }\n\n .comment-icon--size-sm {\n --pop-comment-icon-size: 24px;\n }\n\n .comment-icon:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .comment-icon__focus-indicator {\n display: none;\n height: calc(100% + 3px);\n inset: -1.5px;\n transform-origin: center;\n transform: scale(var(--pop-comment-icon-scale));\n transition: all 200ms ease-out;\n width: calc(100% + 3px);\n }\n\n .comment-icon:focus-visible .comment-icon__focus-indicator {\n display: flex;\n }\n\n .comment-icon:focus-visible {\n outline: none;\n }\n\n .comment-icon__inner {\n align-items: center;\n background: var(--pop-comment-icon-background);\n color: var(--pop-comment-icon-color);\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n height: var(--pop-comment-icon-size);\n justify-content: center;\n position: absolute;\n transform-origin: center;\n transition: all 200ms ease-out;\n transform: scale(var(--pop-comment-icon-scale));\n width: var(--pop-comment-icon-size);\n }\n\n .comment-icon__icon-container {\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n transition: transform ease-out 150ms;\n width: 100%;\n }\n\n .comment-icon__icon-container svg {\n width: calc(var(--pop-comment-icon-size) * 0.6875);\n height: calc(var(--pop-comment-icon-size) * 0.6875);\n }\n\n .comment-icon--variant-close.comment-icon--theme-neutral .comment-icon__icon-container svg {\n width: var(--pop-comment-icon-size);\n height: var(--pop-comment-icon-size);\n }\n\n .comment-icon__icon-image {\n display: flex;\n width: var(--pop-comment-icon-size);\n height: var(--pop-comment-icon-size);\n }\n\n .comment-icon__icon {\n display: flex;\n }\n\n .comment-icon__icon-image + .comment-icon__icon {\n display: none;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .comment-icon:hover .comment-icon__inner {\n background: var(--pop-comment-icon-background-hover);\n color: var(--pop-comment-icon-color-hover);\n transition: transform var(--pop-ease-pop-hover) var(--pop-duration-pop-hover);\n transform: scale(var(--pop-comment-icon-scale-hover));\n }\n\n .comment-icon:hover .comment-icon__icon-image {\n display: none;\n }\n\n .comment-icon:hover .comment-icon__icon-image + .comment-icon__icon {\n display: flex;\n }\n }\n\n .comment-icon:active .comment-icon__inner {\n background: var(--pop-comment-icon-background-active);\n color: var(--pop-comment-icon-color-active);\n transform: scale(var(--pop-comment-icon-scale-active));\n transition-duration: 100ms;\n }\n\n .comment-icon:is(:focus-visible) .comment-icon__inner {\n background: var(--pop-comment-icon-background-focused);\n color: var(--pop-comment-icon-color-focused);\n }\n\n /* Brand / Add */\n .comment-icon--theme-brand.comment-icon--variant-add {\n --pop-comment-icon-color: var(--pop-comment-color-black);\n --pop-comment-icon-color-hover: var(--pop-comment-color-black);\n --pop-comment-icon-color-active: var(--pop-comment-color-black);\n --pop-comment-icon-color-focused: var(--pop-comment-color-black);\n --pop-comment-icon-background: transparent;\n --pop-comment-icon-background-hover: var(--pop-comment-bg-singular-hover);\n --pop-comment-icon-background-active: var(--pop-comment-bg-singular-hover);\n --pop-comment-icon-background-focused: transparent;\n }\n\n /* Brand / Close */\n .comment-icon--theme-brand.comment-icon--variant-close {\n --pop-comment-icon-color: var(--pop-comment-color-white);\n --pop-comment-icon-color-hover: var(--pop-comment-color-white);\n --pop-comment-icon-color-active: var(--pop-comment-color-white);\n --pop-comment-icon-color-focused: var(--pop-comment-color-white);\n --pop-comment-icon-background: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-active: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);\n }\n\n /* Neutral / Add */\n .comment-icon--theme-neutral.comment-icon--variant-add {\n --pop-comment-icon-color: var(--pop-comment-color-white);\n --pop-comment-icon-color-hover: var(--pop-comment-color-black);\n --pop-comment-icon-color-active: var(--pop-comment-color-black);\n --pop-comment-icon-color-focused: var(--pop-comment-color-white);\n --pop-comment-icon-background: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-singular-hover);\n --pop-comment-icon-background-active: var(--pop-comment-bg-singular-hover);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);\n }\n\n /* Neutral / Close */\n .comment-icon--theme-neutral.comment-icon--variant-close {\n --pop-comment-icon-color: var(--pop-comment-color-white);\n --pop-comment-icon-color-hover: var(--pop-comment-color-white);\n --pop-comment-icon-color-active: var(--pop-comment-color-white);\n --pop-comment-icon-color-focused: var(--pop-comment-color-white);\n --pop-comment-icon-background: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-active: var(--pop-comment-bg-singular-resting);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);\n }\n\n /* Neutral / Send */\n .comment-icon--theme-neutral.comment-icon--variant-send {\n --pop-comment-icon-color: var(--pop-comment-color-reversed);\n --pop-comment-icon-color-hover: var(--pop-comment-color-reversed);\n --pop-comment-icon-color-active: var(--pop-comment-color-reversed);\n --pop-comment-icon-color-focused: var(--pop-comment-color-reversed);\n --pop-comment-icon-background: var(--pop-comment-bg-reversed);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-reversed);\n --pop-comment-icon-background-active: var(--pop-comment-bg-reversed);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-reversed);\n }\n\n /* Neutral / More */\n .comment-icon--theme-neutral.comment-icon--variant-more {\n --pop-comment-icon-color: var(--pop-comment-color-default);\n --pop-comment-icon-color-hover: var(--pop-comment-color-reversed);\n --pop-comment-icon-color-active: var(--pop-comment-color-default);\n --pop-comment-icon-color-focused: var(--pop-comment-color-default);\n --pop-comment-icon-background: var(--pop-comment-bg-blank-resting);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-reversed);\n --pop-comment-icon-background-active: var(--pop-comment-bg-blank-resting);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-blank-resting);\n }\n\n /* Neutral / Cancel */\n .comment-icon--theme-neutral.comment-icon--variant-cancel {\n --pop-comment-icon-color: var(--pop-comment-color-default);\n --pop-comment-icon-color-hover: var(--pop-comment-color-default);\n --pop-comment-icon-color-active: var(--pop-comment-color-reversed);\n --pop-comment-icon-color-focused: var(--pop-comment-color-default);\n --pop-comment-icon-background: var(--pop-comment-bg-blank-resting);\n --pop-comment-icon-background-hover: var(--pop-comment-bg-blank-resting);\n --pop-comment-icon-background-active: var(--pop-comment-bg-reversed);\n --pop-comment-icon-background-focused: var(--pop-comment-bg-blank-resting);\n }\n"), Je = class extends P {
|
|
844
|
+
constructor(...e) {
|
|
845
|
+
super(...e), this.events = { click: "onClick" };
|
|
846
|
+
}
|
|
847
|
+
get styleSheets() {
|
|
848
|
+
return [qe];
|
|
849
|
+
}
|
|
850
|
+
static get observedAttributes() {
|
|
851
|
+
return [
|
|
852
|
+
"counter",
|
|
853
|
+
"icon-url",
|
|
854
|
+
"size",
|
|
855
|
+
"theme",
|
|
856
|
+
"variant",
|
|
857
|
+
"type",
|
|
858
|
+
"disabled"
|
|
859
|
+
];
|
|
860
|
+
}
|
|
861
|
+
onCounterChanged() {
|
|
862
|
+
this.render();
|
|
863
|
+
}
|
|
864
|
+
onIconUrlChanged() {
|
|
865
|
+
this.render();
|
|
866
|
+
}
|
|
867
|
+
onSizeChanged() {
|
|
868
|
+
this.render();
|
|
869
|
+
}
|
|
870
|
+
onThemeChanged() {
|
|
871
|
+
this.render();
|
|
872
|
+
}
|
|
873
|
+
onVariantChanged() {
|
|
874
|
+
this.render();
|
|
875
|
+
}
|
|
876
|
+
onTypeChanged() {
|
|
877
|
+
this.render();
|
|
878
|
+
}
|
|
879
|
+
onDisabledChanged() {
|
|
880
|
+
this.render();
|
|
881
|
+
}
|
|
882
|
+
get counter() {
|
|
883
|
+
return Number(this.getAttribute("counter") || "0");
|
|
884
|
+
}
|
|
885
|
+
set counter(e) {
|
|
886
|
+
this.setAttribute("counter", String(e));
|
|
887
|
+
}
|
|
888
|
+
get iconUrl() {
|
|
889
|
+
return this.getAttribute("icon-url") || void 0;
|
|
890
|
+
}
|
|
891
|
+
set iconUrl(e) {
|
|
892
|
+
e === void 0 ? this.removeAttribute("icon-url") : this.setAttribute("icon-url", e);
|
|
893
|
+
}
|
|
894
|
+
get size() {
|
|
895
|
+
return this.getAttribute("size") || "md";
|
|
896
|
+
}
|
|
897
|
+
set size(e) {
|
|
898
|
+
this.setAttribute("size", e);
|
|
899
|
+
}
|
|
900
|
+
get theme() {
|
|
901
|
+
return this.getAttribute("theme") || "brand";
|
|
902
|
+
}
|
|
903
|
+
set theme(e) {
|
|
904
|
+
this.setAttribute("theme", e);
|
|
905
|
+
}
|
|
906
|
+
get variant() {
|
|
907
|
+
return this.getAttribute("variant") || "add";
|
|
908
|
+
}
|
|
909
|
+
set variant(e) {
|
|
910
|
+
this.setAttribute("variant", e);
|
|
911
|
+
}
|
|
912
|
+
get type() {
|
|
913
|
+
return this.getAttribute("type") || "button";
|
|
914
|
+
}
|
|
915
|
+
set type(e) {
|
|
916
|
+
this.setAttribute("type", e);
|
|
917
|
+
}
|
|
918
|
+
get disabled() {
|
|
919
|
+
return this.hasAttribute("disabled");
|
|
920
|
+
}
|
|
921
|
+
set disabled(e) {
|
|
922
|
+
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
923
|
+
}
|
|
924
|
+
onClick(e) {
|
|
925
|
+
if (this.disabled) {
|
|
926
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
this.emit("pop-click");
|
|
930
|
+
}
|
|
931
|
+
get icon() {
|
|
932
|
+
let e = "";
|
|
933
|
+
return this.theme === "brand" ? this.variant === "add" ? e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11 4.58331V17.4166M4.58333 11H17.4167\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n " : this.variant === "close" && (e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M16.5 5.5L5.5 16.5M5.5 5.5L16.5 16.5\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n ") : this.theme === "neutral" && (this.variant === "add" ? e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.0002 4.58301V17.4163M4.5835 10.9997H17.4168\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n " : this.variant === "close" ? e = "\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.4628 11.4627L20.5373 20.5373M11.4628 20.5373L20.5373 11.4627\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n " : this.variant === "more" ? e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12.8335 16.5L7.3335 11L12.8335 5.5\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n " : this.variant === "send" ? e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M18.0394 3.68048C18.2139 3.61601 18.3837 3.78583 18.3193 3.96036L12.3858 20.0241C12.314 20.2185 12.0369 20.2123 11.9739 20.0149L9.89172 13.4908C9.86908 13.4199 9.88424 13.3423 9.93191 13.2851L14.4838 7.82287C14.6536 7.61906 14.3807 7.34616 14.1769 7.516L8.71467 12.0678C8.65746 12.1155 8.57987 12.1307 8.50893 12.108L1.98489 10.0259C1.78743 9.96287 1.78121 9.68575 1.97565 9.61393L18.0394 3.68048Z\"\n fill=\"currentColor\"\n />\n </svg>\n " : this.variant === "cancel" && (e = "\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M16.5 5.5L5.5 16.5M5.5 5.5L16.5 16.5\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n ")), e;
|
|
934
|
+
}
|
|
935
|
+
getTemplate() {
|
|
936
|
+
let e = this.disabled ? "disabled" : "", t = [
|
|
937
|
+
"comment-icon",
|
|
938
|
+
this.size ? `comment-icon--size-${this.size}` : "",
|
|
939
|
+
this.theme ? `comment-icon--theme-${this.theme}` : "",
|
|
940
|
+
this.variant ? `comment-icon--variant-${this.variant}` : ""
|
|
941
|
+
].filter(Boolean).join(" "), n = this.iconUrl ? `<img src="${this.iconUrl}" alt="" class="comment-icon__icon-image" />
|
|
942
|
+
<slot class="comment-icon__icon" name="icon">${this.icon}</slot>` : `<slot class="comment-icon__icon" name="icon">${this.icon}</slot>`;
|
|
943
|
+
return `
|
|
944
|
+
<button
|
|
945
|
+
class="${t}"
|
|
946
|
+
part="base"
|
|
947
|
+
type="${this.type}"
|
|
948
|
+
${e}
|
|
949
|
+
>
|
|
950
|
+
<pop-focus-indicator class="comment-icon__focus-indicator"></pop-focus-indicator>
|
|
951
|
+
<div class="comment-icon__inner mask mask-squircle">
|
|
952
|
+
<div class="comment-icon__icon-container" part="icon">${n}</div>
|
|
953
|
+
</div>
|
|
954
|
+
</button>
|
|
955
|
+
`;
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
customElements.get("pop-comment-icon") || customElements.define("pop-comment-icon", Je);
|
|
959
|
+
//#endregion
|
|
960
|
+
//#region src/components/pop-comment-input.ts
|
|
961
|
+
var Ye = N("\n :host {\n display: flex;\n flex: 1;\n min-width: 0;\n align-items: flex-end;\n }\n\n textarea {\n flex: 1;\n min-width: 0;\n background: none;\n border: none;\n outline: none;\n resize: none;\n font-family: Inter, sans-serif;\n font-size: 13px;\n color: black;\n line-height: 18px;\n padding: 5px 0;\n max-height: 200px;\n overflow-y: auto;\n width: 100%;\n letter-spacing: -0.08px;\n }\n\n textarea::placeholder {\n color: #697586;\n }\n"), Xe = class extends P {
|
|
962
|
+
constructor(...e) {
|
|
963
|
+
super(...e), this.events = {
|
|
964
|
+
input: "onInput",
|
|
965
|
+
keydown: "onKeyDown"
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
get styleSheets() {
|
|
969
|
+
return [Ye];
|
|
970
|
+
}
|
|
971
|
+
onInput(e) {
|
|
972
|
+
let t = e.target;
|
|
973
|
+
t.style.height = "auto", t.style.height = `${t.scrollHeight}px`;
|
|
974
|
+
}
|
|
975
|
+
onKeyDown(e) {
|
|
976
|
+
e.key === "Escape" && (this.gridStore.editingCommentId.value || this.gridStore.replyingTo.value) && (e.stopPropagation(), this.gridStore.editingCommentId.value = null, this.gridStore.replyingTo.value = null);
|
|
977
|
+
}
|
|
978
|
+
getValue() {
|
|
979
|
+
return this.getElement("textarea")?.value ?? "";
|
|
980
|
+
}
|
|
981
|
+
setValue(e) {
|
|
982
|
+
let t = this.getElement("textarea");
|
|
983
|
+
t && (t.value = e, t.style.height = "auto", t.style.height = `${t.scrollHeight}px`);
|
|
984
|
+
}
|
|
985
|
+
clear() {
|
|
986
|
+
let e = this.getElement("textarea");
|
|
987
|
+
e && (e.value = "", e.style.height = "auto");
|
|
988
|
+
}
|
|
989
|
+
focus() {
|
|
990
|
+
this.getElement("textarea")?.focus();
|
|
991
|
+
}
|
|
992
|
+
setupEffects() {
|
|
993
|
+
this.addEffect(() => {
|
|
994
|
+
let e = this.gridStore.replyingToComment.value, t = this.gridStore.editingComment.value, n = "Comment";
|
|
995
|
+
t ? n = "Edit comment..." : e?.author?.name && (n = `Reply to ${e.author.name}`), this.setAttr("textarea", "placeholder", n);
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
getTemplate() {
|
|
999
|
+
return "\n <textarea rows=\"1\" placeholder=\"Comment\"></textarea>\n ";
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
F([O(k)], Xe.prototype, "gridStore", void 0), customElements.get("pop-comment-input") || customElements.define("pop-comment-input", Xe);
|
|
1003
|
+
//#endregion
|
|
1004
|
+
//#region src/components/pop-comment-thread.ts
|
|
1005
|
+
var Ze = N("\n :host {\n display: block;\n\n --pop-thread-link: rgba(0, 0, 32, 0.5);\n --pop-thread-link-hover: rgba(0, 0, 32, 0.8);\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --pop-thread-link: rgba(255, 255, 255, 0.5);\n --pop-thread-link-hover: rgba(255, 255, 255, 0.8);\n }\n }\n\n :host(.dark) {\n --pop-thread-link: rgba(255, 255, 255, 0.5);\n --pop-thread-link-hover: rgba(255, 255, 255, 0.8);\n }\n\n .thread {\n align-items: stretch;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .thread__replies {\n align-items: center;\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding-left: 24px;\n }\n\n .thread__more {\n display: flex;\n align-items: center;\n font-size: 13px;\n gap: 6px;\n padding-left: 30px;\n transition: opacity 0.15s ease;\n width: 100%;\n }\n\n .thread__more:hover {\n opacity: 1;\n }\n\n .thread__more-dot {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n background: var(--pop-muted-foreground);\n flex-shrink: 0;\n opacity: 0.1;\n }\n"), Qe = 2, $e = class extends P {
|
|
1006
|
+
constructor(...e) {
|
|
1007
|
+
super(...e), this._showAll = !1, this.events = { click: "onClick" };
|
|
1008
|
+
}
|
|
1009
|
+
get styleSheets() {
|
|
1010
|
+
return [Ze];
|
|
1011
|
+
}
|
|
1012
|
+
onClick(e) {
|
|
1013
|
+
e.target.closest(".thread__more-btn") && (this._showAll = !0, this.render());
|
|
1014
|
+
}
|
|
1015
|
+
setupEffects() {
|
|
1016
|
+
this.addEffect(() => {
|
|
1017
|
+
let e = this.getAttribute("comment-id"), t = this.gridStore.scrollingCommentId.value;
|
|
1018
|
+
e && t && this.gridStore.repliesFor(e).some((e) => e.id === t) && (this._showAll = !0), this.gridStore.comments.value, this.render();
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
getTemplate() {
|
|
1022
|
+
let e = this.getAttribute("comment-id");
|
|
1023
|
+
if (!e) return "";
|
|
1024
|
+
let t = this.gridStore.repliesFor(e), n = this._showAll || t.length <= Qe ? t : t.slice(0, Qe), r = t.length - n.length, i = r > 0 ? `<div class="thread__more">
|
|
1025
|
+
<div class="thread__more-dot"></div>
|
|
1026
|
+
<button class="thread__more-btn btn-link btn-link--size-sm btn-link--theme-default" type="button">
|
|
1027
|
+
Show ${r} more ${r === 1 ? "reply" : "replies"}
|
|
1028
|
+
</button>
|
|
1029
|
+
</div>` : "";
|
|
1030
|
+
return `
|
|
1031
|
+
<div class="thread">
|
|
1032
|
+
<pop-comment comment-id="${e}"></pop-comment>
|
|
1033
|
+
${t.length > 0 ? `<div class="thread__replies">
|
|
1034
|
+
${n.map((e) => `<pop-comment comment-id="${e.id}"></pop-comment>`).join("")}
|
|
1035
|
+
${i}
|
|
1036
|
+
</div>` : ""}
|
|
1037
|
+
</div>
|
|
1038
|
+
`;
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
F([O(k)], $e.prototype, "gridStore", void 0), customElements.get("pop-comment-thread") || customElements.define("pop-comment-thread", $e);
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/helpers/time.ts
|
|
1044
|
+
function et(e) {
|
|
1045
|
+
let t = e instanceof Date ? e : new Date(e), n = (Date.now() - t.getTime()) / 1e3;
|
|
1046
|
+
return n < 1 ? "now" : n < 60 ? `${Math.floor(n)}s` : n < 3600 ? `${Math.floor(n / 60)}m` : n < 86400 ? `${Math.floor(n / 3600)}h` : n < 604800 ? `${Math.floor(n / 86400)}d` : `${Math.floor(n / 604800)}w`;
|
|
1047
|
+
}
|
|
1048
|
+
//#endregion
|
|
1049
|
+
//#region node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1050
|
+
var tt = Math.min, R = Math.max, nt = Math.round, rt = Math.floor, z = (e) => ({
|
|
1051
|
+
x: e,
|
|
1052
|
+
y: e
|
|
1053
|
+
}), it = {
|
|
1054
|
+
left: "right",
|
|
1055
|
+
right: "left",
|
|
1056
|
+
bottom: "top",
|
|
1057
|
+
top: "bottom"
|
|
1058
|
+
};
|
|
1059
|
+
function at(e, t, n) {
|
|
1060
|
+
return R(e, tt(t, n));
|
|
1061
|
+
}
|
|
1062
|
+
function ot(e, t) {
|
|
1063
|
+
return typeof e == "function" ? e(t) : e;
|
|
1064
|
+
}
|
|
1065
|
+
function B(e) {
|
|
1066
|
+
return e.split("-")[0];
|
|
1067
|
+
}
|
|
1068
|
+
function st(e) {
|
|
1069
|
+
return e.split("-")[1];
|
|
1070
|
+
}
|
|
1071
|
+
function ct(e) {
|
|
1072
|
+
return e === "x" ? "y" : "x";
|
|
1073
|
+
}
|
|
1074
|
+
function lt(e) {
|
|
1075
|
+
return e === "y" ? "height" : "width";
|
|
1076
|
+
}
|
|
1077
|
+
function V(e) {
|
|
1078
|
+
let t = e[0];
|
|
1079
|
+
return t === "t" || t === "b" ? "y" : "x";
|
|
1080
|
+
}
|
|
1081
|
+
function ut(e) {
|
|
1082
|
+
return ct(V(e));
|
|
1083
|
+
}
|
|
1084
|
+
function dt(e, t, n) {
|
|
1085
|
+
n === void 0 && (n = !1);
|
|
1086
|
+
let r = st(e), i = ut(e), a = lt(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
1087
|
+
return t.reference[a] > t.floating[a] && (o = bt(o)), [o, bt(o)];
|
|
1088
|
+
}
|
|
1089
|
+
function ft(e) {
|
|
1090
|
+
let t = bt(e);
|
|
1091
|
+
return [
|
|
1092
|
+
pt(e),
|
|
1093
|
+
t,
|
|
1094
|
+
pt(t)
|
|
1095
|
+
];
|
|
1096
|
+
}
|
|
1097
|
+
function pt(e) {
|
|
1098
|
+
return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
|
|
1099
|
+
}
|
|
1100
|
+
var mt = ["left", "right"], ht = ["right", "left"], gt = ["top", "bottom"], _t = ["bottom", "top"];
|
|
1101
|
+
function vt(e, t, n) {
|
|
1102
|
+
switch (e) {
|
|
1103
|
+
case "top":
|
|
1104
|
+
case "bottom": return n ? t ? ht : mt : t ? mt : ht;
|
|
1105
|
+
case "left":
|
|
1106
|
+
case "right": return t ? gt : _t;
|
|
1107
|
+
default: return [];
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
function yt(e, t, n, r) {
|
|
1111
|
+
let i = st(e), a = vt(B(e), n === "start", r);
|
|
1112
|
+
return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(pt)))), a;
|
|
1113
|
+
}
|
|
1114
|
+
function bt(e) {
|
|
1115
|
+
let t = B(e);
|
|
1116
|
+
return it[t] + e.slice(t.length);
|
|
1117
|
+
}
|
|
1118
|
+
function xt(e) {
|
|
1119
|
+
return {
|
|
1120
|
+
top: 0,
|
|
1121
|
+
right: 0,
|
|
1122
|
+
bottom: 0,
|
|
1123
|
+
left: 0,
|
|
1124
|
+
...e
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
function St(e) {
|
|
1128
|
+
return typeof e == "number" ? {
|
|
1129
|
+
top: e,
|
|
1130
|
+
right: e,
|
|
1131
|
+
bottom: e,
|
|
1132
|
+
left: e
|
|
1133
|
+
} : xt(e);
|
|
1134
|
+
}
|
|
1135
|
+
function Ct(e) {
|
|
1136
|
+
let { x: t, y: n, width: r, height: i } = e;
|
|
1137
|
+
return {
|
|
1138
|
+
width: r,
|
|
1139
|
+
height: i,
|
|
1140
|
+
top: n,
|
|
1141
|
+
left: t,
|
|
1142
|
+
right: t + r,
|
|
1143
|
+
bottom: n + i,
|
|
1144
|
+
x: t,
|
|
1145
|
+
y: n
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
//#endregion
|
|
1149
|
+
//#region node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
1150
|
+
function wt(e, t, n) {
|
|
1151
|
+
let { reference: r, floating: i } = e, a = V(t), o = ut(t), s = lt(o), c = B(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
|
|
1152
|
+
switch (c) {
|
|
1153
|
+
case "top":
|
|
1154
|
+
p = {
|
|
1155
|
+
x: u,
|
|
1156
|
+
y: r.y - i.height
|
|
1157
|
+
};
|
|
1158
|
+
break;
|
|
1159
|
+
case "bottom":
|
|
1160
|
+
p = {
|
|
1161
|
+
x: u,
|
|
1162
|
+
y: r.y + r.height
|
|
1163
|
+
};
|
|
1164
|
+
break;
|
|
1165
|
+
case "right":
|
|
1166
|
+
p = {
|
|
1167
|
+
x: r.x + r.width,
|
|
1168
|
+
y: d
|
|
1169
|
+
};
|
|
1170
|
+
break;
|
|
1171
|
+
case "left":
|
|
1172
|
+
p = {
|
|
1173
|
+
x: r.x - i.width,
|
|
1174
|
+
y: d
|
|
1175
|
+
};
|
|
1176
|
+
break;
|
|
1177
|
+
default: p = {
|
|
1178
|
+
x: r.x,
|
|
1179
|
+
y: r.y
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
switch (st(t)) {
|
|
1183
|
+
case "start":
|
|
1184
|
+
p[o] -= f * (n && l ? -1 : 1);
|
|
1185
|
+
break;
|
|
1186
|
+
case "end":
|
|
1187
|
+
p[o] += f * (n && l ? -1 : 1);
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
return p;
|
|
1191
|
+
}
|
|
1192
|
+
async function Tt(e, t) {
|
|
1193
|
+
t === void 0 && (t = {});
|
|
1194
|
+
let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = ot(t, e), p = St(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = Ct(await i.getClippingRect({
|
|
1195
|
+
element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
|
|
1196
|
+
boundary: c,
|
|
1197
|
+
rootBoundary: l,
|
|
1198
|
+
strategy: s
|
|
1199
|
+
})), g = u === "floating" ? {
|
|
1200
|
+
x: n,
|
|
1201
|
+
y: r,
|
|
1202
|
+
width: a.floating.width,
|
|
1203
|
+
height: a.floating.height
|
|
1204
|
+
} : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
|
|
1205
|
+
x: 1,
|
|
1206
|
+
y: 1
|
|
1207
|
+
}, y = Ct(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1208
|
+
elements: o,
|
|
1209
|
+
rect: g,
|
|
1210
|
+
offsetParent: _,
|
|
1211
|
+
strategy: s
|
|
1212
|
+
}) : g);
|
|
1213
|
+
return {
|
|
1214
|
+
top: (h.top - y.top + p.top) / v.y,
|
|
1215
|
+
bottom: (y.bottom - h.bottom + p.bottom) / v.y,
|
|
1216
|
+
left: (h.left - y.left + p.left) / v.x,
|
|
1217
|
+
right: (y.right - h.right + p.right) / v.x
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
var Et = 50, Dt = async (e, t, n) => {
|
|
1221
|
+
let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = o.detectOverflow ? o : {
|
|
1222
|
+
...o,
|
|
1223
|
+
detectOverflow: Tt
|
|
1224
|
+
}, c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
|
|
1225
|
+
reference: e,
|
|
1226
|
+
floating: t,
|
|
1227
|
+
strategy: i
|
|
1228
|
+
}), { x: u, y: d } = wt(l, r, c), f = r, p = 0, m = {};
|
|
1229
|
+
for (let n = 0; n < a.length; n++) {
|
|
1230
|
+
let h = a[n];
|
|
1231
|
+
if (!h) continue;
|
|
1232
|
+
let { name: g, fn: _ } = h, { x: v, y, data: b, reset: x } = await _({
|
|
1233
|
+
x: u,
|
|
1234
|
+
y: d,
|
|
1235
|
+
initialPlacement: r,
|
|
1236
|
+
placement: f,
|
|
1237
|
+
strategy: i,
|
|
1238
|
+
middlewareData: m,
|
|
1239
|
+
rects: l,
|
|
1240
|
+
platform: s,
|
|
1241
|
+
elements: {
|
|
1242
|
+
reference: e,
|
|
1243
|
+
floating: t
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
u = v ?? u, d = y ?? d, m[g] = {
|
|
1247
|
+
...m[g],
|
|
1248
|
+
...b
|
|
1249
|
+
}, x && p < Et && (p++, typeof x == "object" && (x.placement && (f = x.placement), x.rects && (l = x.rects === !0 ? await o.getElementRects({
|
|
1250
|
+
reference: e,
|
|
1251
|
+
floating: t,
|
|
1252
|
+
strategy: i
|
|
1253
|
+
}) : x.rects), {x: u, y: d} = wt(l, f, c)), n = -1);
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
x: u,
|
|
1257
|
+
y: d,
|
|
1258
|
+
placement: f,
|
|
1259
|
+
strategy: i,
|
|
1260
|
+
middlewareData: m
|
|
1261
|
+
};
|
|
1262
|
+
}, Ot = function(e) {
|
|
1263
|
+
return e === void 0 && (e = {}), {
|
|
1264
|
+
name: "flip",
|
|
1265
|
+
options: e,
|
|
1266
|
+
async fn(t) {
|
|
1267
|
+
var n;
|
|
1268
|
+
let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = ot(e, t);
|
|
1269
|
+
if ((n = i.arrow) != null && n.alignmentOffset) return {};
|
|
1270
|
+
let g = B(r), _ = V(o), v = B(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [bt(o)] : ft(o)), x = p !== "none";
|
|
1271
|
+
!d && x && b.push(...yt(o, m, p, y));
|
|
1272
|
+
let S = [o, ...b], ee = await s.detectOverflow(t, h), C = [], w = i.flip?.overflows || [];
|
|
1273
|
+
if (l && C.push(ee[g]), u) {
|
|
1274
|
+
let e = dt(r, a, y);
|
|
1275
|
+
C.push(ee[e[0]], ee[e[1]]);
|
|
1276
|
+
}
|
|
1277
|
+
if (w = [...w, {
|
|
1278
|
+
placement: r,
|
|
1279
|
+
overflows: C
|
|
1280
|
+
}], !C.every((e) => e <= 0)) {
|
|
1281
|
+
let e = (i.flip?.index || 0) + 1, t = S[e];
|
|
1282
|
+
if (t && (!(u === "alignment" && _ !== V(t)) || w.every((e) => V(e.placement) === _ ? e.overflows[0] > 0 : !0))) return {
|
|
1283
|
+
data: {
|
|
1284
|
+
index: e,
|
|
1285
|
+
overflows: w
|
|
1286
|
+
},
|
|
1287
|
+
reset: { placement: t }
|
|
1288
|
+
};
|
|
1289
|
+
let n = w.filter((e) => e.overflows[0] <= 0).sort((e, t) => e.overflows[1] - t.overflows[1])[0]?.placement;
|
|
1290
|
+
if (!n) switch (f) {
|
|
1291
|
+
case "bestFit": {
|
|
1292
|
+
let e = w.filter((e) => {
|
|
1293
|
+
if (x) {
|
|
1294
|
+
let t = V(e.placement);
|
|
1295
|
+
return t === _ || t === "y";
|
|
1296
|
+
}
|
|
1297
|
+
return !0;
|
|
1298
|
+
}).map((e) => [e.placement, e.overflows.filter((e) => e > 0).reduce((e, t) => e + t, 0)]).sort((e, t) => e[1] - t[1])[0]?.[0];
|
|
1299
|
+
e && (n = e);
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
case "initialPlacement":
|
|
1303
|
+
n = o;
|
|
1304
|
+
break;
|
|
1305
|
+
}
|
|
1306
|
+
if (r !== n) return { reset: { placement: n } };
|
|
1307
|
+
}
|
|
1308
|
+
return {};
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
}, kt = /*#__PURE__*/ new Set(["left", "top"]);
|
|
1312
|
+
async function At(e, t) {
|
|
1313
|
+
let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = B(n), s = st(n), c = V(n) === "y", l = kt.has(o) ? -1 : 1, u = a && c ? -1 : 1, d = ot(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
|
|
1314
|
+
mainAxis: d,
|
|
1315
|
+
crossAxis: 0,
|
|
1316
|
+
alignmentAxis: null
|
|
1317
|
+
} : {
|
|
1318
|
+
mainAxis: d.mainAxis || 0,
|
|
1319
|
+
crossAxis: d.crossAxis || 0,
|
|
1320
|
+
alignmentAxis: d.alignmentAxis
|
|
1321
|
+
};
|
|
1322
|
+
return s && typeof m == "number" && (p = s === "end" ? m * -1 : m), c ? {
|
|
1323
|
+
x: p * u,
|
|
1324
|
+
y: f * l
|
|
1325
|
+
} : {
|
|
1326
|
+
x: f * l,
|
|
1327
|
+
y: p * u
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
var jt = function(e) {
|
|
1331
|
+
return e === void 0 && (e = 0), {
|
|
1332
|
+
name: "offset",
|
|
1333
|
+
options: e,
|
|
1334
|
+
async fn(t) {
|
|
1335
|
+
var n;
|
|
1336
|
+
let { x: r, y: i, placement: a, middlewareData: o } = t, s = await At(t, e);
|
|
1337
|
+
return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
|
|
1338
|
+
x: r + s.x,
|
|
1339
|
+
y: i + s.y,
|
|
1340
|
+
data: {
|
|
1341
|
+
...s,
|
|
1342
|
+
placement: a
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
}, Mt = function(e) {
|
|
1348
|
+
return e === void 0 && (e = {}), {
|
|
1349
|
+
name: "shift",
|
|
1350
|
+
options: e,
|
|
1351
|
+
async fn(t) {
|
|
1352
|
+
let { x: n, y: r, placement: i, platform: a } = t, { mainAxis: o = !0, crossAxis: s = !1, limiter: c = { fn: (e) => {
|
|
1353
|
+
let { x: t, y: n } = e;
|
|
1354
|
+
return {
|
|
1355
|
+
x: t,
|
|
1356
|
+
y: n
|
|
1357
|
+
};
|
|
1358
|
+
} }, ...l } = ot(e, t), u = {
|
|
1359
|
+
x: n,
|
|
1360
|
+
y: r
|
|
1361
|
+
}, d = await a.detectOverflow(t, l), f = V(B(i)), p = ct(f), m = u[p], h = u[f];
|
|
1362
|
+
if (o) {
|
|
1363
|
+
let e = p === "y" ? "top" : "left", t = p === "y" ? "bottom" : "right", n = m + d[e], r = m - d[t];
|
|
1364
|
+
m = at(n, m, r);
|
|
1365
|
+
}
|
|
1366
|
+
if (s) {
|
|
1367
|
+
let e = f === "y" ? "top" : "left", t = f === "y" ? "bottom" : "right", n = h + d[e], r = h - d[t];
|
|
1368
|
+
h = at(n, h, r);
|
|
1369
|
+
}
|
|
1370
|
+
let g = c.fn({
|
|
1371
|
+
...t,
|
|
1372
|
+
[p]: m,
|
|
1373
|
+
[f]: h
|
|
1374
|
+
});
|
|
1375
|
+
return {
|
|
1376
|
+
...g,
|
|
1377
|
+
data: {
|
|
1378
|
+
x: g.x - n,
|
|
1379
|
+
y: g.y - r,
|
|
1380
|
+
enabled: {
|
|
1381
|
+
[p]: o,
|
|
1382
|
+
[f]: s
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
1391
|
+
function Nt() {
|
|
1392
|
+
return typeof window < "u";
|
|
1393
|
+
}
|
|
1394
|
+
function H(e) {
|
|
1395
|
+
return Pt(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
1396
|
+
}
|
|
1397
|
+
function U(e) {
|
|
1398
|
+
var t;
|
|
1399
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
1400
|
+
}
|
|
1401
|
+
function W(e) {
|
|
1402
|
+
return ((Pt(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
|
|
1403
|
+
}
|
|
1404
|
+
function Pt(e) {
|
|
1405
|
+
return Nt() ? e instanceof Node || e instanceof U(e).Node : !1;
|
|
1406
|
+
}
|
|
1407
|
+
function G(e) {
|
|
1408
|
+
return Nt() ? e instanceof Element || e instanceof U(e).Element : !1;
|
|
1409
|
+
}
|
|
1410
|
+
function K(e) {
|
|
1411
|
+
return Nt() ? e instanceof HTMLElement || e instanceof U(e).HTMLElement : !1;
|
|
1412
|
+
}
|
|
1413
|
+
function Ft(e) {
|
|
1414
|
+
return !Nt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof U(e).ShadowRoot;
|
|
1415
|
+
}
|
|
1416
|
+
function q(e) {
|
|
1417
|
+
let { overflow: t, overflowX: n, overflowY: r, display: i } = X(e);
|
|
1418
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && i !== "inline" && i !== "contents";
|
|
1419
|
+
}
|
|
1420
|
+
function It(e) {
|
|
1421
|
+
return /^(table|td|th)$/.test(H(e));
|
|
1422
|
+
}
|
|
1423
|
+
function Lt(e) {
|
|
1424
|
+
try {
|
|
1425
|
+
if (e.matches(":popover-open")) return !0;
|
|
1426
|
+
} catch {}
|
|
1427
|
+
try {
|
|
1428
|
+
return e.matches(":modal");
|
|
1429
|
+
} catch {
|
|
1430
|
+
return !1;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
var Rt = /transform|translate|scale|rotate|perspective|filter/, zt = /paint|layout|strict|content/, J = (e) => !!e && e !== "none", Bt;
|
|
1434
|
+
function Vt(e) {
|
|
1435
|
+
let t = G(e) ? X(e) : e;
|
|
1436
|
+
return J(t.transform) || J(t.translate) || J(t.scale) || J(t.rotate) || J(t.perspective) || !Ut() && (J(t.backdropFilter) || J(t.filter)) || Rt.test(t.willChange || "") || zt.test(t.contain || "");
|
|
1437
|
+
}
|
|
1438
|
+
function Ht(e) {
|
|
1439
|
+
let t = Z(e);
|
|
1440
|
+
for (; K(t) && !Y(t);) {
|
|
1441
|
+
if (Vt(t)) return t;
|
|
1442
|
+
if (Lt(t)) return null;
|
|
1443
|
+
t = Z(t);
|
|
1444
|
+
}
|
|
1445
|
+
return null;
|
|
1446
|
+
}
|
|
1447
|
+
function Ut() {
|
|
1448
|
+
return Bt ??= typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"), Bt;
|
|
1449
|
+
}
|
|
1450
|
+
function Y(e) {
|
|
1451
|
+
return /^(html|body|#document)$/.test(H(e));
|
|
1452
|
+
}
|
|
1453
|
+
function X(e) {
|
|
1454
|
+
return U(e).getComputedStyle(e);
|
|
1455
|
+
}
|
|
1456
|
+
function Wt(e) {
|
|
1457
|
+
return G(e) ? {
|
|
1458
|
+
scrollLeft: e.scrollLeft,
|
|
1459
|
+
scrollTop: e.scrollTop
|
|
1460
|
+
} : {
|
|
1461
|
+
scrollLeft: e.scrollX,
|
|
1462
|
+
scrollTop: e.scrollY
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
function Z(e) {
|
|
1466
|
+
if (H(e) === "html") return e;
|
|
1467
|
+
let t = e.assignedSlot || e.parentNode || Ft(e) && e.host || W(e);
|
|
1468
|
+
return Ft(t) ? t.host : t;
|
|
1469
|
+
}
|
|
1470
|
+
function Gt(e) {
|
|
1471
|
+
let t = Z(e);
|
|
1472
|
+
return Y(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : K(t) && q(t) ? t : Gt(t);
|
|
1473
|
+
}
|
|
1474
|
+
function Kt(e, t, n) {
|
|
1475
|
+
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
1476
|
+
let r = Gt(e), i = r === e.ownerDocument?.body, a = U(r);
|
|
1477
|
+
if (i) {
|
|
1478
|
+
let e = qt(a);
|
|
1479
|
+
return t.concat(a, a.visualViewport || [], q(r) ? r : [], e && n ? Kt(e) : []);
|
|
1480
|
+
} else return t.concat(r, Kt(r, [], n));
|
|
1481
|
+
}
|
|
1482
|
+
function qt(e) {
|
|
1483
|
+
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
1484
|
+
}
|
|
1485
|
+
//#endregion
|
|
1486
|
+
//#region node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
1487
|
+
function Jt(e) {
|
|
1488
|
+
let t = X(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = K(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = nt(n) !== a || nt(r) !== o;
|
|
1489
|
+
return s && (n = a, r = o), {
|
|
1490
|
+
width: n,
|
|
1491
|
+
height: r,
|
|
1492
|
+
$: s
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function Yt(e) {
|
|
1496
|
+
return G(e) ? e : e.contextElement;
|
|
1497
|
+
}
|
|
1498
|
+
function Q(e) {
|
|
1499
|
+
let t = Yt(e);
|
|
1500
|
+
if (!K(t)) return z(1);
|
|
1501
|
+
let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = Jt(t), o = (a ? nt(n.width) : n.width) / r, s = (a ? nt(n.height) : n.height) / i;
|
|
1502
|
+
return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
|
|
1503
|
+
x: o,
|
|
1504
|
+
y: s
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
var Xt = /*#__PURE__*/ z(0);
|
|
1508
|
+
function Zt(e) {
|
|
1509
|
+
let t = U(e);
|
|
1510
|
+
return !Ut() || !t.visualViewport ? Xt : {
|
|
1511
|
+
x: t.visualViewport.offsetLeft,
|
|
1512
|
+
y: t.visualViewport.offsetTop
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
function Qt(e, t, n) {
|
|
1516
|
+
return t === void 0 && (t = !1), !n || t && n !== U(e) ? !1 : t;
|
|
1517
|
+
}
|
|
1518
|
+
function $(e, t, n, r) {
|
|
1519
|
+
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
1520
|
+
let i = e.getBoundingClientRect(), a = Yt(e), o = z(1);
|
|
1521
|
+
t && (r ? G(r) && (o = Q(r)) : o = Q(e));
|
|
1522
|
+
let s = Qt(a, n, r) ? Zt(a) : z(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
|
|
1523
|
+
if (a) {
|
|
1524
|
+
let e = U(a), t = r && G(r) ? U(r) : r, n = e, i = qt(n);
|
|
1525
|
+
for (; i && r && t !== n;) {
|
|
1526
|
+
let e = Q(i), t = i.getBoundingClientRect(), r = X(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
|
|
1527
|
+
c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = U(i), i = qt(n);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
return Ct({
|
|
1531
|
+
width: u,
|
|
1532
|
+
height: d,
|
|
1533
|
+
x: c,
|
|
1534
|
+
y: l
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
function $t(e, t) {
|
|
1538
|
+
let n = Wt(e).scrollLeft;
|
|
1539
|
+
return t ? t.left + n : $(W(e)).left + n;
|
|
1540
|
+
}
|
|
1541
|
+
function en(e, t) {
|
|
1542
|
+
let n = e.getBoundingClientRect();
|
|
1543
|
+
return {
|
|
1544
|
+
x: n.left + t.scrollLeft - $t(e, n),
|
|
1545
|
+
y: n.top + t.scrollTop
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function tn(e) {
|
|
1549
|
+
let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = W(r), s = t ? Lt(t.floating) : !1;
|
|
1550
|
+
if (r === o || s && a) return n;
|
|
1551
|
+
let c = {
|
|
1552
|
+
scrollLeft: 0,
|
|
1553
|
+
scrollTop: 0
|
|
1554
|
+
}, l = z(1), u = z(0), d = K(r);
|
|
1555
|
+
if ((d || !d && !a) && ((H(r) !== "body" || q(o)) && (c = Wt(r)), d)) {
|
|
1556
|
+
let e = $(r);
|
|
1557
|
+
l = Q(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
|
|
1558
|
+
}
|
|
1559
|
+
let f = o && !d && !a ? en(o, c) : z(0);
|
|
1560
|
+
return {
|
|
1561
|
+
width: n.width * l.x,
|
|
1562
|
+
height: n.height * l.y,
|
|
1563
|
+
x: n.x * l.x - c.scrollLeft * l.x + u.x + f.x,
|
|
1564
|
+
y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
function nn(e) {
|
|
1568
|
+
return Array.from(e.getClientRects());
|
|
1569
|
+
}
|
|
1570
|
+
function rn(e) {
|
|
1571
|
+
let t = W(e), n = Wt(e), r = e.ownerDocument.body, i = R(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = R(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + $t(e), s = -n.scrollTop;
|
|
1572
|
+
return X(r).direction === "rtl" && (o += R(t.clientWidth, r.clientWidth) - i), {
|
|
1573
|
+
width: i,
|
|
1574
|
+
height: a,
|
|
1575
|
+
x: o,
|
|
1576
|
+
y: s
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
var an = 25;
|
|
1580
|
+
function on(e, t) {
|
|
1581
|
+
let n = U(e), r = W(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
|
|
1582
|
+
if (i) {
|
|
1583
|
+
a = i.width, o = i.height;
|
|
1584
|
+
let e = Ut();
|
|
1585
|
+
(!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
|
|
1586
|
+
}
|
|
1587
|
+
let l = $t(r);
|
|
1588
|
+
if (l <= 0) {
|
|
1589
|
+
let e = r.ownerDocument, t = e.body, n = getComputedStyle(t), i = e.compatMode === "CSS1Compat" && parseFloat(n.marginLeft) + parseFloat(n.marginRight) || 0, o = Math.abs(r.clientWidth - t.clientWidth - i);
|
|
1590
|
+
o <= an && (a -= o);
|
|
1591
|
+
} else l <= an && (a += l);
|
|
1592
|
+
return {
|
|
1593
|
+
width: a,
|
|
1594
|
+
height: o,
|
|
1595
|
+
x: s,
|
|
1596
|
+
y: c
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
function sn(e, t) {
|
|
1600
|
+
let n = $(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = K(e) ? Q(e) : z(1);
|
|
1601
|
+
return {
|
|
1602
|
+
width: e.clientWidth * a.x,
|
|
1603
|
+
height: e.clientHeight * a.y,
|
|
1604
|
+
x: i * a.x,
|
|
1605
|
+
y: r * a.y
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
function cn(e, t, n) {
|
|
1609
|
+
let r;
|
|
1610
|
+
if (t === "viewport") r = on(e, n);
|
|
1611
|
+
else if (t === "document") r = rn(W(e));
|
|
1612
|
+
else if (G(t)) r = sn(t, n);
|
|
1613
|
+
else {
|
|
1614
|
+
let n = Zt(e);
|
|
1615
|
+
r = {
|
|
1616
|
+
x: t.x - n.x,
|
|
1617
|
+
y: t.y - n.y,
|
|
1618
|
+
width: t.width,
|
|
1619
|
+
height: t.height
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
return Ct(r);
|
|
1623
|
+
}
|
|
1624
|
+
function ln(e, t) {
|
|
1625
|
+
let n = Z(e);
|
|
1626
|
+
return n === t || !G(n) || Y(n) ? !1 : X(n).position === "fixed" || ln(n, t);
|
|
1627
|
+
}
|
|
1628
|
+
function un(e, t) {
|
|
1629
|
+
let n = t.get(e);
|
|
1630
|
+
if (n) return n;
|
|
1631
|
+
let r = Kt(e, [], !1).filter((e) => G(e) && H(e) !== "body"), i = null, a = X(e).position === "fixed", o = a ? Z(e) : e;
|
|
1632
|
+
for (; G(o) && !Y(o);) {
|
|
1633
|
+
let t = X(o), n = Vt(o);
|
|
1634
|
+
!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && (i.position === "absolute" || i.position === "fixed") || q(o) && !n && ln(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = Z(o);
|
|
1635
|
+
}
|
|
1636
|
+
return t.set(e, r), r;
|
|
1637
|
+
}
|
|
1638
|
+
function dn(e) {
|
|
1639
|
+
let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? Lt(t) ? [] : un(t, this._c) : [].concat(n), r], o = cn(t, a[0], i), s = o.top, c = o.right, l = o.bottom, u = o.left;
|
|
1640
|
+
for (let e = 1; e < a.length; e++) {
|
|
1641
|
+
let n = cn(t, a[e], i);
|
|
1642
|
+
s = R(n.top, s), c = tt(n.right, c), l = tt(n.bottom, l), u = R(n.left, u);
|
|
1643
|
+
}
|
|
1644
|
+
return {
|
|
1645
|
+
width: c - u,
|
|
1646
|
+
height: l - s,
|
|
1647
|
+
x: u,
|
|
1648
|
+
y: s
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
function fn(e) {
|
|
1652
|
+
let { width: t, height: n } = Jt(e);
|
|
1653
|
+
return {
|
|
1654
|
+
width: t,
|
|
1655
|
+
height: n
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
function pn(e, t, n) {
|
|
1659
|
+
let r = K(t), i = W(t), a = n === "fixed", o = $(e, !0, a, t), s = {
|
|
1660
|
+
scrollLeft: 0,
|
|
1661
|
+
scrollTop: 0
|
|
1662
|
+
}, c = z(0);
|
|
1663
|
+
function l() {
|
|
1664
|
+
c.x = $t(i);
|
|
1665
|
+
}
|
|
1666
|
+
if (r || !r && !a) if ((H(t) !== "body" || q(i)) && (s = Wt(t)), r) {
|
|
1667
|
+
let e = $(t, !0, a, t);
|
|
1668
|
+
c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
|
|
1669
|
+
} else i && l();
|
|
1670
|
+
a && !r && i && l();
|
|
1671
|
+
let u = i && !r && !a ? en(i, s) : z(0);
|
|
1672
|
+
return {
|
|
1673
|
+
x: o.left + s.scrollLeft - c.x - u.x,
|
|
1674
|
+
y: o.top + s.scrollTop - c.y - u.y,
|
|
1675
|
+
width: o.width,
|
|
1676
|
+
height: o.height
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
function mn(e) {
|
|
1680
|
+
return X(e).position === "static";
|
|
1681
|
+
}
|
|
1682
|
+
function hn(e, t) {
|
|
1683
|
+
if (!K(e) || X(e).position === "fixed") return null;
|
|
1684
|
+
if (t) return t(e);
|
|
1685
|
+
let n = e.offsetParent;
|
|
1686
|
+
return W(e) === n && (n = n.ownerDocument.body), n;
|
|
1687
|
+
}
|
|
1688
|
+
function gn(e, t) {
|
|
1689
|
+
let n = U(e);
|
|
1690
|
+
if (Lt(e)) return n;
|
|
1691
|
+
if (!K(e)) {
|
|
1692
|
+
let t = Z(e);
|
|
1693
|
+
for (; t && !Y(t);) {
|
|
1694
|
+
if (G(t) && !mn(t)) return t;
|
|
1695
|
+
t = Z(t);
|
|
1696
|
+
}
|
|
1697
|
+
return n;
|
|
1698
|
+
}
|
|
1699
|
+
let r = hn(e, t);
|
|
1700
|
+
for (; r && It(r) && mn(r);) r = hn(r, t);
|
|
1701
|
+
return r && Y(r) && mn(r) && !Vt(r) ? n : r || Ht(e) || n;
|
|
1702
|
+
}
|
|
1703
|
+
var _n = async function(e) {
|
|
1704
|
+
let t = this.getOffsetParent || gn, n = this.getDimensions, r = await n(e.floating);
|
|
1705
|
+
return {
|
|
1706
|
+
reference: pn(e.reference, await t(e.floating), e.strategy),
|
|
1707
|
+
floating: {
|
|
1708
|
+
x: 0,
|
|
1709
|
+
y: 0,
|
|
1710
|
+
width: r.width,
|
|
1711
|
+
height: r.height
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
};
|
|
1715
|
+
function vn(e) {
|
|
1716
|
+
return X(e).direction === "rtl";
|
|
1717
|
+
}
|
|
1718
|
+
var yn = {
|
|
1719
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: tn,
|
|
1720
|
+
getDocumentElement: W,
|
|
1721
|
+
getClippingRect: dn,
|
|
1722
|
+
getOffsetParent: gn,
|
|
1723
|
+
getElementRects: _n,
|
|
1724
|
+
getClientRects: nn,
|
|
1725
|
+
getDimensions: fn,
|
|
1726
|
+
getScale: Q,
|
|
1727
|
+
isElement: G,
|
|
1728
|
+
isRTL: vn
|
|
1729
|
+
};
|
|
1730
|
+
function bn(e, t) {
|
|
1731
|
+
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
1732
|
+
}
|
|
1733
|
+
function xn(e, t) {
|
|
1734
|
+
let n = null, r, i = W(e);
|
|
1735
|
+
function a() {
|
|
1736
|
+
var e;
|
|
1737
|
+
clearTimeout(r), (e = n) == null || e.disconnect(), n = null;
|
|
1738
|
+
}
|
|
1739
|
+
function o(s, c) {
|
|
1740
|
+
s === void 0 && (s = !1), c === void 0 && (c = 1), a();
|
|
1741
|
+
let l = e.getBoundingClientRect(), { left: u, top: d, width: f, height: p } = l;
|
|
1742
|
+
if (s || t(), !f || !p) return;
|
|
1743
|
+
let m = rt(d), h = rt(i.clientWidth - (u + f)), g = rt(i.clientHeight - (d + p)), _ = rt(u), v = {
|
|
1744
|
+
rootMargin: -m + "px " + -h + "px " + -g + "px " + -_ + "px",
|
|
1745
|
+
threshold: R(0, tt(1, c)) || 1
|
|
1746
|
+
}, y = !0;
|
|
1747
|
+
function b(t) {
|
|
1748
|
+
let n = t[0].intersectionRatio;
|
|
1749
|
+
if (n !== c) {
|
|
1750
|
+
if (!y) return o();
|
|
1751
|
+
n ? o(!1, n) : r = setTimeout(() => {
|
|
1752
|
+
o(!1, 1e-7);
|
|
1753
|
+
}, 1e3);
|
|
1754
|
+
}
|
|
1755
|
+
n === 1 && !bn(l, e.getBoundingClientRect()) && o(), y = !1;
|
|
1756
|
+
}
|
|
1757
|
+
try {
|
|
1758
|
+
n = new IntersectionObserver(b, {
|
|
1759
|
+
...v,
|
|
1760
|
+
root: i.ownerDocument
|
|
1761
|
+
});
|
|
1762
|
+
} catch {
|
|
1763
|
+
n = new IntersectionObserver(b, v);
|
|
1764
|
+
}
|
|
1765
|
+
n.observe(e);
|
|
1766
|
+
}
|
|
1767
|
+
return o(!0), a;
|
|
1768
|
+
}
|
|
1769
|
+
function Sn(e, t, n, r) {
|
|
1770
|
+
r === void 0 && (r = {});
|
|
1771
|
+
let { ancestorScroll: i = !0, ancestorResize: a = !0, elementResize: o = typeof ResizeObserver == "function", layoutShift: s = typeof IntersectionObserver == "function", animationFrame: c = !1 } = r, l = Yt(e), u = i || a ? [...l ? Kt(l) : [], ...t ? Kt(t) : []] : [];
|
|
1772
|
+
u.forEach((e) => {
|
|
1773
|
+
i && e.addEventListener("scroll", n, { passive: !0 }), a && e.addEventListener("resize", n);
|
|
1774
|
+
});
|
|
1775
|
+
let d = l && s ? xn(l, n) : null, f = -1, p = null;
|
|
1776
|
+
o && (p = new ResizeObserver((e) => {
|
|
1777
|
+
let [r] = e;
|
|
1778
|
+
r && r.target === l && p && t && (p.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
|
|
1779
|
+
var e;
|
|
1780
|
+
(e = p) == null || e.observe(t);
|
|
1781
|
+
})), n();
|
|
1782
|
+
}), l && !c && p.observe(l), t && p.observe(t));
|
|
1783
|
+
let m, h = c ? $(e) : null;
|
|
1784
|
+
c && g();
|
|
1785
|
+
function g() {
|
|
1786
|
+
let t = $(e);
|
|
1787
|
+
h && !bn(h, t) && n(), h = t, m = requestAnimationFrame(g);
|
|
1788
|
+
}
|
|
1789
|
+
return n(), () => {
|
|
1790
|
+
var e;
|
|
1791
|
+
u.forEach((e) => {
|
|
1792
|
+
i && e.removeEventListener("scroll", n), a && e.removeEventListener("resize", n);
|
|
1793
|
+
}), d?.(), (e = p) == null || e.disconnect(), p = null, c && cancelAnimationFrame(m);
|
|
1794
|
+
};
|
|
1795
|
+
}
|
|
1796
|
+
var Cn = jt, wn = Mt, Tn = Ot, En = (e, t, n) => {
|
|
1797
|
+
let r = /* @__PURE__ */ new Map(), i = {
|
|
1798
|
+
platform: yn,
|
|
1799
|
+
...n
|
|
1800
|
+
}, a = {
|
|
1801
|
+
...i.platform,
|
|
1802
|
+
_c: r
|
|
1803
|
+
};
|
|
1804
|
+
return Dt(e, t, {
|
|
1805
|
+
...i,
|
|
1806
|
+
platform: a
|
|
1807
|
+
});
|
|
1808
|
+
}, Dn = N("\n :host {\n display: block;\n width: 100%;\n --pop-comment-hover: rgba(0, 0, 32, 0.04);\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --pop-comment-hover: rgba(255, 255, 255, 0.04);\n }\n }\n\n .comment {\n display: flex;\n width: 100%;\n gap: 8px;\n align-items: center;\n background-color: transparent;\n border: none;\n padding: 0;\n border-radius: var(--pop-radius-md);\n outline: 6px solid transparent;\n text-align: left;\n transition:\n background-color 150ms ease,\n outline-color 150ms ease;\n }\n\n :host([data-size=\"sm\"]) .comment,\n :host:not([data-size]) .comment {\n --avatar-size: 32px;\n --width: 32px;\n gap: 8px;\n }\n\n :host([data-size=\"lg\"]) .comment {\n --avatar-size: 56px;\n --width: 56px;\n gap: 12px;\n }\n\n .comment--is-selected {\n background-color: var(--pop-muted);\n outline-color: var(--pop-muted);\n }\n\n :host(.is-signed-in) .comment {\n cursor: pointer;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .comment:hover .comment__avatar {\n --avatar-translate-x: 2px;\n }\n\n .comment__avatar:hover {\n /* --avatar-scale: 1.06; */\n }\n\n .comment .comment__menu {\n display: none;\n }\n\n .comment:hover .comment__menu {\n display: flex;\n }\n }\n\n .comment--is-selected .comment__avatar {\n --avatar-translate-x: 2px;\n }\n\n .comment__avatar {\n --comment-avatar-border-size: 0;\n --avatar-translate-x: 0px;\n --avatar-scale: 1;\n width: var(--avatar-size);\n height: var(--avatar-size);\n transform: translateX(var(--avatar-translate-x)) scale(var(--avatar-scale));\n transition: transform var(--pop-duration-quick) var(--pop-ease-quick);\n }\n\n .comment__user {\n display: flex;\n width: var(--width);\n align-items: flex-start;\n gap: 10px;\n flex-shrink: 0;\n align-self: stretch;\n }\n\n .comment__content {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .comment__info {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .comment__menu {\n display: flex;\n justify-self: flex-end;\n }\n\n .comment__menu-trigger {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 9999px;\n aspect-ratio: 1;\n position: relative;\n }\n\n .comment__menu-trigger:before {\n content: \"\";\n height: 40px;\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 40px;\n }\n\n .comment__user-meta {\n display: flex;\n align-items: flex-start;\n gap: 4px;\n flex-shrink: 0;\n align-self: stretch;\n flex-grow: 1;\n }\n\n .comment__user-name {\n color: var(--pop-foreground);\n font-feature-settings:\n \"liga\" off,\n \"clig\" off;\n font-family: Inter, sans-serif;\n font-size: var(--text-widget-base, 13px);\n font-style: normal;\n font-weight: 500;\n line-height: var(--text-widget-base--line-height, 18px);\n letter-spacing: -0.08px;\n }\n\n .comment__timestamp {\n color: var(--pop-muted-foreground);\n font-feature-settings:\n \"liga\" off,\n \"clig\" off;\n font-family: Inter, sans-serif;\n font-size: var(--text-widget-base, 13px);\n font-style: normal;\n font-weight: 400;\n line-height: var(--text-widget-base--line-height, 18px);\n letter-spacing: -0.08px;\n opacity: 0.5;\n }\n\n .comment__text {\n align-self: stretch;\n color: var(--pop-foreground);\n font-feature-settings:\n \"liga\" off,\n \"clig\" off;\n font-family: Inter, sans-serif;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: 18px;\n letter-spacing: -0.08px;\n text-align: left;\n\n /* Clamping when not expanded */\n display: -webkit-box;\n -webkit-line-clamp: 4;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n .comment__text.expanded,\n .comment--is-selected .comment__text {\n -webkit-line-clamp: initial;\n display: block;\n }\n\n .comment__mention {\n color: #155eef;\n font-weight: 500;\n }\n\n .comment__menu {\n position: relative;\n }\n\n .comment__dropdown {\n background-color: var(--pop-background);\n border-radius: 6px;\n box-shadow: var(--pop-shadow-xl);\n display: none;\n flex-direction: column;\n gap: 6px;\n padding: 6px;\n pointer-events: auto;\n position: fixed;\n width: 120px;\n z-index: 1000;\n }\n\n .comment__dropdown.is-open {\n display: flex;\n }\n\n .comment__dropdown-item {\n align-items: center;\n background: none;\n border-radius: 4px;\n border: none;\n color: var(--pop-foreground);\n cursor: pointer;\n display: flex;\n flex: 1 0 0;\n font-family: Inter, sans-serif;\n font-size: 14px;\n font-weight: 500;\n justify-content: center;\n min-height: 40px;\n padding: 0 12px;\n text-align: left;\n transition: background-color 100ms ease;\n width: 100%;\n }\n\n .comment__dropdown-item:hover {\n background-color: var(--pop-comment-hover, rgba(0, 0, 0, 0.04));\n }\n\n .comment__dropdown-item--danger {\n color: #ef4444;\n }\n\n .comment__edit-form {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 8px;\n margin-top: 4px;\n }\n\n .comment__edit-input {\n width: 100%;\n background: var(--pop-background, #ffffff);\n color: var(--pop-foreground, #000000);\n border: 1px solid var(--pop-border, #e4e4e7);\n border-radius: var(--pop-radius-sm, 4px);\n padding: 6px 8px;\n font-family: Inter, sans-serif;\n font-size: 13px;\n line-height: 18px;\n resize: vertical;\n outline: none;\n }\n\n .comment__edit-input:focus {\n border-color: var(--pop-ring, #000020);\n }\n\n .comment__edit-actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n }\n\n .comment__edit-save,\n .comment__edit-cancel {\n font-size: 12px;\n padding: 4px 8px;\n cursor: pointer;\n }\n\n .comment--deleted .comment__text {\n color: var(--pop-muted-foreground, #697586);\n font-style: italic;\n opacity: 0.8;\n }\n"), On = class extends P {
|
|
1809
|
+
constructor(...e) {
|
|
1810
|
+
super(...e), this.events = { click: "onClick" }, this._expanded = !1, this._dropdownOpen = !1, this._onOutsideClick = (e) => {
|
|
1811
|
+
let t = e.composedPath(), n = this.getElement(".comment__dropdown"), r = this.getElement(".comment__menu-trigger");
|
|
1812
|
+
n && r && !t.includes(n) && !t.includes(r) && this.closeDropdown();
|
|
1813
|
+
}, this._timeUpdateTimer = null;
|
|
1814
|
+
}
|
|
1815
|
+
static get observedAttributes() {
|
|
1816
|
+
return ["data-size", "comment-id"];
|
|
1817
|
+
}
|
|
1818
|
+
onDataSizeChanged() {
|
|
1819
|
+
this.render();
|
|
1820
|
+
}
|
|
1821
|
+
onCommentIdChanged() {
|
|
1822
|
+
this.render();
|
|
1823
|
+
}
|
|
1824
|
+
get size() {
|
|
1825
|
+
return this.getAttribute("data-size") || "sm";
|
|
1826
|
+
}
|
|
1827
|
+
get commentAvatarSize() {
|
|
1828
|
+
return this.size === "sm" ? "xs" : "sm";
|
|
1829
|
+
}
|
|
1830
|
+
get styleSheets() {
|
|
1831
|
+
return [Dn];
|
|
1832
|
+
}
|
|
1833
|
+
toggleDropdown() {
|
|
1834
|
+
this._dropdownOpen ? this.closeDropdown() : this.openDropdown();
|
|
1835
|
+
}
|
|
1836
|
+
openDropdown() {
|
|
1837
|
+
this._dropdownOpen = !0;
|
|
1838
|
+
let e = this.getElement(".comment__dropdown"), t = this.getElement(".comment__menu-trigger");
|
|
1839
|
+
if (e && t) {
|
|
1840
|
+
e.classList.add("is-open");
|
|
1841
|
+
let n = () => {
|
|
1842
|
+
En(t, e, {
|
|
1843
|
+
placement: "bottom-end",
|
|
1844
|
+
middleware: [
|
|
1845
|
+
Cn(4),
|
|
1846
|
+
Tn(),
|
|
1847
|
+
wn({ padding: 8 })
|
|
1848
|
+
],
|
|
1849
|
+
strategy: "fixed"
|
|
1850
|
+
}).then(({ x: t, y: n }) => {
|
|
1851
|
+
Object.assign(e.style, {
|
|
1852
|
+
left: `${t}px`,
|
|
1853
|
+
top: `${n}px`,
|
|
1854
|
+
position: "fixed"
|
|
1855
|
+
});
|
|
1856
|
+
});
|
|
1857
|
+
};
|
|
1858
|
+
this._floatingCleanup = Sn(t, e, n), document.addEventListener("mousedown", this._onOutsideClick);
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
closeDropdown() {
|
|
1862
|
+
this._dropdownOpen = !1;
|
|
1863
|
+
let e = this.getElement(".comment__dropdown");
|
|
1864
|
+
e && e.classList.remove("is-open"), this._floatingCleanup &&= (this._floatingCleanup(), void 0), document.removeEventListener("mousedown", this._onOutsideClick);
|
|
1865
|
+
}
|
|
1866
|
+
async deleteComment() {
|
|
1867
|
+
let e = this.getAttribute("comment-id");
|
|
1868
|
+
e && confirm("Are you sure you want to delete this comment?") && await this.gridStore.deleteComment(e);
|
|
1869
|
+
}
|
|
1870
|
+
async flagComment() {
|
|
1871
|
+
let e = this.getAttribute("comment-id");
|
|
1872
|
+
e && (await this.gridStore.flagComment(e) ? alert("Comment flagged successfully.") : alert("Failed to flag comment."));
|
|
1873
|
+
}
|
|
1874
|
+
onClick(e) {
|
|
1875
|
+
let t = e.target;
|
|
1876
|
+
if (t.closest(".comment__menu-trigger")) {
|
|
1877
|
+
e.stopPropagation(), this.toggleDropdown();
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
let n = t.closest(".comment__dropdown-item");
|
|
1881
|
+
if (n) {
|
|
1882
|
+
e.stopPropagation();
|
|
1883
|
+
let t = n.getAttribute("data-action"), r = this.getAttribute("comment-id");
|
|
1884
|
+
t === "edit" && r ? (this.gridStore.replyingTo.value = null, this.gridStore.editingCommentId.value = r) : t === "delete" ? this.deleteComment() : t === "flag" && this.flagComment(), this.closeDropdown();
|
|
1885
|
+
return;
|
|
1886
|
+
}
|
|
1887
|
+
if (t.closest(".comment__dropdown")) {
|
|
1888
|
+
e.stopPropagation();
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (!E.value) return;
|
|
1892
|
+
let r = this.getAttribute("comment-id");
|
|
1893
|
+
r && this.gridStore.comments.value.find((e) => e.id === r)?.status !== "deleted" && (this.gridStore.replyingTo.value === r ? this.gridStore.replyingTo.value = null : this.gridStore.replyingTo.value = r, this.expandText());
|
|
1894
|
+
}
|
|
1895
|
+
expandText() {
|
|
1896
|
+
let e = this.getElement(".comment__text");
|
|
1897
|
+
if (!this._expanded && e) {
|
|
1898
|
+
let t = e.offsetHeight;
|
|
1899
|
+
this._expanded = !0, this.render();
|
|
1900
|
+
let n = this.getElement(".comment__text");
|
|
1901
|
+
if (n) {
|
|
1902
|
+
let e = n.scrollHeight;
|
|
1903
|
+
n.style.height = `${t}px`, n.style.overflow = "hidden", n.offsetHeight, n.style.transition = "height var(--pop-duration-quick) var(--pop-ease-quick)", n.style.height = `${e}px`, setTimeout(() => {
|
|
1904
|
+
n.style.height = "", n.style.overflow = "";
|
|
1905
|
+
}, 300);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
disconnectedCallback() {
|
|
1910
|
+
this.closeDropdown(), this.stopTimeUpdates(), super.disconnectedCallback();
|
|
1911
|
+
}
|
|
1912
|
+
startTimeUpdates() {
|
|
1913
|
+
this.stopTimeUpdates();
|
|
1914
|
+
let e = this.getAttribute("comment-id");
|
|
1915
|
+
if (!e) return;
|
|
1916
|
+
let t = this.gridStore.comments.value.find((t) => t.id === e);
|
|
1917
|
+
if (!t) return;
|
|
1918
|
+
let n = () => {
|
|
1919
|
+
let e = this.getElement(".comment__timestamp");
|
|
1920
|
+
e && (e.textContent = et(t.createdAt));
|
|
1921
|
+
let r = Date.now() - (typeof t.createdAt == "number" ? t.createdAt : Date.parse(String(t.createdAt))), i = 6e4;
|
|
1922
|
+
i = r < 6e4 ? 5e3 : r < 36e5 ? 6e4 : 18e5, this._timeUpdateTimer = setTimeout(n, i);
|
|
1923
|
+
}, r = Date.now() - (typeof t.createdAt == "number" ? t.createdAt : Date.parse(String(t.createdAt))) < 6e4 ? 5e3 : 6e4;
|
|
1924
|
+
this._timeUpdateTimer = setTimeout(n, r);
|
|
1925
|
+
}
|
|
1926
|
+
stopTimeUpdates() {
|
|
1927
|
+
this._timeUpdateTimer &&= (clearTimeout(this._timeUpdateTimer), null);
|
|
1928
|
+
}
|
|
1929
|
+
setupEffects() {
|
|
1930
|
+
this.addEffect(() => {
|
|
1931
|
+
let e = this.getAttribute("comment-id"), t = E.value, n = this.gridStore.replyingTo.value, r = this.gridStore.editingCommentId.value, i = this.gridStore.scrollingCommentId.value;
|
|
1932
|
+
this.classList.toggle("is-signed-in", t !== null), this.classList.toggle("is-replying", e !== null && n === e), this.classList.toggle("is-editing", e !== null && r === e), this.gridStore.comments.value, this.render(), this.startTimeUpdates(), e && i === e && setTimeout(() => {
|
|
1933
|
+
let t = this.shadowRoot?.querySelector(`#comment-${e}`);
|
|
1934
|
+
t ? t.scrollIntoView({
|
|
1935
|
+
behavior: "smooth",
|
|
1936
|
+
block: "center"
|
|
1937
|
+
}) : this.scrollIntoView({
|
|
1938
|
+
behavior: "smooth",
|
|
1939
|
+
block: "center"
|
|
1940
|
+
}), this.gridStore.scrollingCommentId.value = null;
|
|
1941
|
+
}, 50);
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
getTemplate() {
|
|
1945
|
+
let e = this.getAttribute("comment-id");
|
|
1946
|
+
if (!e) return "";
|
|
1947
|
+
let t = this.gridStore.comments.value.find((t) => t.id === e);
|
|
1948
|
+
if (!t) return "";
|
|
1949
|
+
let n = t.status === "deleted", r = t.authorDeleted === !0, i = n || r, a = i ? "" : t.author?.image ? `<img src="${t.author.image}" alt="${t.author.name ?? "User avatar"}" />` : L(t.author?.name), o = this.gridStore.replyingTo.value, s = e !== null && o === e, c = this.size, l = E.value && t.author && E.value.id === t.author.id, u = E.value && !n ? `<div class="comment__menu">
|
|
1950
|
+
<button class="comment__menu-trigger" type="button">
|
|
1951
|
+
<svg
|
|
1952
|
+
width="18"
|
|
1953
|
+
height="18"
|
|
1954
|
+
viewBox="0 0 18 18"
|
|
1955
|
+
fill="none"
|
|
1956
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1957
|
+
>
|
|
1958
|
+
<path
|
|
1959
|
+
d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z"
|
|
1960
|
+
fill="white"
|
|
1961
|
+
/>
|
|
1962
|
+
<path
|
|
1963
|
+
d="M12.5 9.5C12.7761 9.5 13 9.27614 13 9C13 8.72386 12.7761 8.5 12.5 8.5C12.2239 8.5 12 8.72386 12 9C12 9.27614 12.2239 9.5 12.5 9.5Z"
|
|
1964
|
+
fill="white"
|
|
1965
|
+
/>
|
|
1966
|
+
<path
|
|
1967
|
+
d="M5.5 9.5C5.77614 9.5 6 9.27614 6 9C6 8.72386 5.77614 8.5 5.5 8.5C5.22386 8.5 5 8.72386 5 9C5 9.27614 5.22386 9.5 5.5 9.5Z"
|
|
1968
|
+
fill="white"
|
|
1969
|
+
/>
|
|
1970
|
+
<path
|
|
1971
|
+
d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z"
|
|
1972
|
+
stroke="#000020"
|
|
1973
|
+
stroke-opacity="0.5"
|
|
1974
|
+
stroke-linecap="round"
|
|
1975
|
+
stroke-linejoin="round"
|
|
1976
|
+
/>
|
|
1977
|
+
<path
|
|
1978
|
+
d="M12.5 9.5C12.7761 9.5 13 9.27614 13 9C13 8.72386 12.7761 8.5 12.5 8.5C12.2239 8.5 12 8.72386 12 9C12 9.27614 12.2239 9.5 12.5 9.5Z"
|
|
1979
|
+
stroke="#000020"
|
|
1980
|
+
stroke-opacity="0.5"
|
|
1981
|
+
stroke-linecap="round"
|
|
1982
|
+
stroke-linejoin="round"
|
|
1983
|
+
/>
|
|
1984
|
+
<path
|
|
1985
|
+
d="M5.5 9.5C5.77614 9.5 6 9.27614 6 9C6 8.72386 5.77614 8.5 5.5 8.5C5.22386 8.5 5 8.72386 5 9C5 9.27614 5.22386 9.5 5.5 9.5Z"
|
|
1986
|
+
stroke="#000020"
|
|
1987
|
+
stroke-opacity="0.5"
|
|
1988
|
+
stroke-linecap="round"
|
|
1989
|
+
stroke-linejoin="round"
|
|
1990
|
+
/>
|
|
1991
|
+
</svg>
|
|
1992
|
+
</button>
|
|
1993
|
+
<div class="comment__dropdown">
|
|
1994
|
+
${l ? "<button class=\"comment__dropdown-item\" type=\"button\" data-action=\"edit\">Edit</button>\n <button class=\"comment__dropdown-item comment__dropdown-item--danger\" type=\"button\" data-action=\"delete\">Delete</button>" : ""}
|
|
1995
|
+
<button class="comment__dropdown-item" type="button" data-action="flag">Flag</button>
|
|
1996
|
+
</div>
|
|
1997
|
+
</div>` : "";
|
|
1998
|
+
return `
|
|
1999
|
+
<div
|
|
2000
|
+
class="comment comment--size-${c}${s ? " comment--is-selected" : ""}${n ? " comment--deleted" : ""}"
|
|
2001
|
+
id="comment-${e}"
|
|
2002
|
+
>
|
|
2003
|
+
<div class="comment__user">
|
|
2004
|
+
<pop-comment-avatar
|
|
2005
|
+
class="comment__avatar"
|
|
2006
|
+
size="${this.commentAvatarSize}"
|
|
2007
|
+
data-color-key="${t.author?.id ?? t.author?.name ?? ""}"
|
|
2008
|
+
${i ? "deleted" : ""}
|
|
2009
|
+
>
|
|
2010
|
+
${a}
|
|
2011
|
+
</pop-comment-avatar>
|
|
2012
|
+
</div>
|
|
2013
|
+
<div class="comment__content">
|
|
2014
|
+
<div class="comment__info">
|
|
2015
|
+
<div class="comment__user-meta">
|
|
2016
|
+
<div class="comment__user-name">
|
|
2017
|
+
${n ? "[Deleted]" : r ? "[Deleted user]" : t.author?.name ?? ""}
|
|
2018
|
+
</div>
|
|
2019
|
+
<div class="comment__timestamp">${et(t.createdAt)}</div>
|
|
2020
|
+
</div>
|
|
2021
|
+
${u}
|
|
2022
|
+
</div>
|
|
2023
|
+
<div class="comment__text${this._expanded ? " expanded" : ""}">${t.body}</div>
|
|
2024
|
+
</div>
|
|
2025
|
+
</div>
|
|
2026
|
+
`;
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
F([O(k)], On.prototype, "gridStore", void 0), customElements.get("pop-comment") || customElements.define("pop-comment", On);
|
|
2030
|
+
//#endregion
|
|
2031
|
+
//#region src/components/pop-feed.ts
|
|
2032
|
+
var kn = N("\n :host {\n display: flex;\n background: var(--pop-background);\n border-radius: var(--pop-radius-2xl);\n border: 1px solid var(--pop-background);\n box-shadow: var(--pop-shadow-3xl);\n display: block;\n left: 0;\n max-height: 400px;\n max-width: 400px;\n min-width: 343px;\n opacity: 0;\n overflow: hidden;\n padding: 0 4px 0 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n transform: scale(0.94);\n transition:\n opacity var(--pop-duration-quick) var(--pop-ease-quick),\n transform var(--pop-duration-quick) var(--pop-ease-quick),\n display var(--pop-duration-quick) allow-discrete;\n }\n\n :host([data-current-placement=\"top-start\"]) {\n transform-origin: left bottom;\n }\n\n :host([data-current-placement=\"bottom-start\"]) {\n transform-origin: left top;\n }\n\n :host([data-current-placement=\"top-end\"]) {\n transform-origin: right bottom;\n }\n\n :host([data-current-placement=\"bottom-end\"]) {\n transform-origin: right top;\n }\n\n :host([data-current-placement=\"top\"]) {\n transform-origin: bottom;\n }\n\n :host([data-current-placement=\"bottom\"]) {\n transform-origin: top;\n }\n\n :host([open]) {\n opacity: 1;\n pointer-events: auto;\n transform: scale(1);\n\n @starting-style {\n display: flex;\n opacity: 0;\n transform: scale(0.94);\n }\n }\n\n .feed {\n display: grid;\n grid-template-rows: 1fr 50px;\n }\n\n .feed__content {\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n gap: 8px;\n min-height: 80px;\n max-height: 290px;\n }\n\n .feed__empty {\n padding: 24px 16px 24px 8px;\n text-align: center;\n font-family: Inter, sans-serif;\n font-size: 13px;\n color: var(--pop-muted-foreground);\n line-height: 18px;\n }\n\n .feed__footer {\n position: absolute;\n bottom: 0;\n min-height: 50px;\n width: 100%;\n }\n\n .feed__main {\n align-items: stretch;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n flex: 1 0 0;\n gap: 16px;\n min-height: 100%;\n overflow: hidden auto;\n padding: 8px 10px 8px 8px;\n }\n\n .feed__main::-webkit-scrollbar {\n width: 4px;\n }\n\n .feed__main::-webkit-scrollbar-track {\n background: transparent;\n }\n\n .feed__main::-webkit-scrollbar-thumb {\n background: var(--pop-border);\n border-radius: 100px;\n }\n"), An = class extends P {
|
|
2033
|
+
constructor(...e) {
|
|
2034
|
+
super(...e), this._footerChild = null, this._wasOpen = !1;
|
|
2035
|
+
}
|
|
2036
|
+
get styleSheets() {
|
|
2037
|
+
return [kn];
|
|
2038
|
+
}
|
|
2039
|
+
connectedCallback() {
|
|
2040
|
+
super.connectedCallback(), document.addEventListener("mousedown", this), document.addEventListener("keydown", this);
|
|
2041
|
+
}
|
|
2042
|
+
disconnectedCallback() {
|
|
2043
|
+
document.removeEventListener("mousedown", this), document.removeEventListener("keydown", this), super.disconnectedCallback();
|
|
2044
|
+
}
|
|
2045
|
+
handleEvent(e) {
|
|
2046
|
+
if (e.type === "mousedown") {
|
|
2047
|
+
this.onOutsideClick(e);
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
if (e.type === "keydown") {
|
|
2051
|
+
this.onKeyDown(e);
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
super.handleEvent(e);
|
|
2055
|
+
}
|
|
2056
|
+
onOutsideClick(e) {
|
|
2057
|
+
if (!this.gridStore.open.value) return;
|
|
2058
|
+
let t = e.composedPath(), n = this.getRootNode(), r = n instanceof ShadowRoot ? n.host : null;
|
|
2059
|
+
!t.includes(this) && (!r || !t.includes(r)) && (this.gridStore.open.value = !1);
|
|
2060
|
+
}
|
|
2061
|
+
onKeyDown(e) {
|
|
2062
|
+
e.key === "Escape" && (this.gridStore.open.value = !1);
|
|
2063
|
+
}
|
|
2064
|
+
setupEffects() {
|
|
2065
|
+
this.addEffect(() => {
|
|
2066
|
+
let e = this.gridStore.open.value;
|
|
2067
|
+
e && !this._wasOpen && this.gridStore.grid.value && me(this.gridStore.apiUrl, this.gridStore.publicKey), this._wasOpen = e, this.update();
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
update() {
|
|
2071
|
+
this.gridStore.open.value ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
2072
|
+
let e = this.getElement(".feed__main");
|
|
2073
|
+
if (e) {
|
|
2074
|
+
let t = this.gridStore.topLevelComments.value;
|
|
2075
|
+
if (t.length === 0) e.querySelector(".feed__empty") || (e.innerHTML = "<div class=\"feed__empty\">Waiting for your thoughts…</div>");
|
|
2076
|
+
else {
|
|
2077
|
+
let n = Array.from(e.querySelectorAll("pop-comment-thread")).map((e) => e.getAttribute("comment-id")), r = t.map((e) => e.id);
|
|
2078
|
+
(n.length !== r.length || n.some((e, t) => e !== r[t])) && (e.innerHTML = t.map((e) => `<pop-comment-thread comment-id="${e.id}"></pop-comment-thread>`).join(""));
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
let t = this.getElement(".feed__footer");
|
|
2082
|
+
if (t) {
|
|
2083
|
+
let e = E.value === null ? "pop-auth-panel" : "pop-comment-bar";
|
|
2084
|
+
this._footerChild !== e && (this._footerChild = e, t.innerHTML = `<${e}></${e}>`);
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
getTemplate() {
|
|
2088
|
+
return "\n <div class=\"feed\">\n <div class=\"feed__content\">\n <div class=\"feed__main\"></div>\n </div>\n <div class=\"feed__footer\"></div>\n </div>\n ";
|
|
2089
|
+
}
|
|
2090
|
+
};
|
|
2091
|
+
F([O(k)], An.prototype, "gridStore", void 0), customElements.get("pop-feed") || customElements.define("pop-feed", An);
|
|
2092
|
+
//#endregion
|
|
2093
|
+
//#region node_modules/.pnpm/composed-offset-position@0.0.6_@floating-ui+utils@0.2.11/node_modules/composed-offset-position/dist/composed-offset-position.browser.min.mjs
|
|
2094
|
+
function jn(e) {
|
|
2095
|
+
return Nn(e);
|
|
2096
|
+
}
|
|
2097
|
+
function Mn(e) {
|
|
2098
|
+
return e.assignedSlot ? e.assignedSlot : e.parentNode instanceof ShadowRoot ? e.parentNode.host : e.parentNode;
|
|
2099
|
+
}
|
|
2100
|
+
function Nn(e) {
|
|
2101
|
+
for (let t = e; t; t = Mn(t)) if (t instanceof Element && getComputedStyle(t).display === "none") return null;
|
|
2102
|
+
for (let t = Mn(e); t; t = Mn(t)) {
|
|
2103
|
+
if (!(t instanceof Element)) continue;
|
|
2104
|
+
let e = getComputedStyle(t);
|
|
2105
|
+
if (e.display !== "contents" && (e.position !== "static" || Vt(e) || t.tagName === "BODY")) return t;
|
|
2106
|
+
}
|
|
2107
|
+
return null;
|
|
2108
|
+
}
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region src/components/pop-grid.ts
|
|
2111
|
+
var Pn = "https://www.popgrids.io", Fn = N("\n :host {\n display: block;\n position: relative;\n }\n\n .grid {\n display: flex;\n height: 100%;\n position: relative;\n width: 100%;\n }\n\n .grid--align-start {\n justify-content: flex-start;\n }\n\n .grid--align-center {\n justify-content: center;\n }\n\n .grid--align-end {\n justify-content: flex-end;\n }\n"), In = class extends P {
|
|
2112
|
+
constructor(...e) {
|
|
2113
|
+
super(...e), this._initialized = !1;
|
|
2114
|
+
}
|
|
2115
|
+
get styleSheets() {
|
|
2116
|
+
return [Fn];
|
|
2117
|
+
}
|
|
2118
|
+
connectedCallback() {
|
|
2119
|
+
if (this._initialized) return;
|
|
2120
|
+
this._initialized = !0;
|
|
2121
|
+
let e = this.getAttribute("data-key") ?? this.getAttribute("public-key") ?? "", t = this.getAttribute("data-api-url") ?? this.getAttribute("api-url") ?? Pn, n = this.getAttribute("data-page-url") ?? this.getAttribute("page-url") ?? location.href, r = this.getAttribute("data-id");
|
|
2122
|
+
this._store = new k({
|
|
2123
|
+
apiUrl: t,
|
|
2124
|
+
publicKey: e,
|
|
2125
|
+
pageUrl: n,
|
|
2126
|
+
externalId: r
|
|
2127
|
+
}), _e(this, this._store), super.connectedCallback(), this._store.load().then((n) => {
|
|
2128
|
+
n && me(t, e);
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
disconnectedCallback() {
|
|
2132
|
+
this._floatingCleanup?.(), this._store.destroy(), ve(this), super.disconnectedCallback();
|
|
2133
|
+
}
|
|
2134
|
+
setupEffects() {
|
|
2135
|
+
this.addEffect(() => {
|
|
2136
|
+
let e = this._store.grid.value, t = this.getElement(".grid");
|
|
2137
|
+
if (!t) return;
|
|
2138
|
+
let n = Array.from(t.classList).filter((e) => e.startsWith("grid--"));
|
|
2139
|
+
if (n.length > 0 && t.classList.remove(...n), e) {
|
|
2140
|
+
e.align && t.classList.add(`grid--align-${e.align}`), e.appearance && t.classList.add(`grid--appearance-${e.appearance}`), e.icon && t.classList.add(`grid--icon-${e.icon}`), e.layout && t.classList.add(`grid--layout-${e.layout}`), e.position && t.classList.add(`grid--position-${e.position}`);
|
|
2141
|
+
let n = e.previewCount ?? this._store.previewCount;
|
|
2142
|
+
t.classList.add(`grid--preview-${n}`);
|
|
2143
|
+
}
|
|
2144
|
+
}), this.addEffect(() => {
|
|
2145
|
+
let e = this._store.open.value;
|
|
2146
|
+
if (this._floatingCleanup &&= (this._floatingCleanup(), void 0), !e) return;
|
|
2147
|
+
let t = this.getElement("pop-widget"), n = this.getElement("pop-feed");
|
|
2148
|
+
if (!t || !n) return;
|
|
2149
|
+
let r = this._store.grid.value;
|
|
2150
|
+
if (!r) return;
|
|
2151
|
+
let i = [];
|
|
2152
|
+
i = [Cn({
|
|
2153
|
+
mainAxis: r.position === "down" ? -16 : -54,
|
|
2154
|
+
crossAxis: -18
|
|
2155
|
+
})], (!r.position || r.position === "auto") && i.push(Tn({
|
|
2156
|
+
fallbackPlacements: ["bottom-start", "top-start"],
|
|
2157
|
+
fallbackStrategy: "bestFit",
|
|
2158
|
+
padding: 16
|
|
2159
|
+
}));
|
|
2160
|
+
let a = (e) => yn.getOffsetParent(e, jn), o = () => {
|
|
2161
|
+
En(t, n, {
|
|
2162
|
+
placement: r.position === "down" ? "bottom-start" : "top-start",
|
|
2163
|
+
middleware: i,
|
|
2164
|
+
strategy: "fixed",
|
|
2165
|
+
platform: {
|
|
2166
|
+
...yn,
|
|
2167
|
+
getOffsetParent: a
|
|
2168
|
+
}
|
|
2169
|
+
}).then(({ x: e, y: t, placement: r }) => {
|
|
2170
|
+
n.setAttribute("data-current-placement", r), Object.assign(n.style, {
|
|
2171
|
+
left: `${e}px`,
|
|
2172
|
+
top: `${t}px`
|
|
2173
|
+
});
|
|
2174
|
+
});
|
|
2175
|
+
};
|
|
2176
|
+
this._floatingCleanup = Sn(t, n, o);
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
getTemplate() {
|
|
2180
|
+
return "\n <div class=\"grid\">\n <pop-widget></pop-widget>\n <pop-feed></pop-feed>\n </div>\n ";
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
customElements.get("pop-grid") || customElements.define("pop-grid", In);
|
|
2184
|
+
//#endregion
|
|
2185
|
+
//#region src/components/pop-widget.ts
|
|
2186
|
+
var Ln = N("\n :host {\n --error-badge-bg: #fef2f2;\n --error-badge-text: #991b1b;\n --error-badge-border: #fecaca;\n\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --error-badge-bg: #450a0a;\n --error-badge-text: #fca5a5;\n --error-badge-border: #7f1d1d;\n }\n }\n\n :host(.dark) {\n --error-badge-bg: #450a0a;\n --error-badge-text: #fca5a5;\n --error-badge-border: #7f1d1d;\n }\n\n :host([data-error]) {\n cursor: default;\n }\n\n .error-badge {\n display: inline-flex;\n align-items: center;\n padding: 2px 10px;\n border-radius: var(--pop-radius-full);\n border: 1px solid var(--error-badge-border);\n background: var(--error-badge-bg);\n color: var(--error-badge-text);\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n white-space: nowrap;\n }\n\n .widget {\n display: inline-flex;\n align-items: flex-start;\n }\n\n .widget > :not([hidden]) ~ :not([hidden]) {\n margin-left: -6px;\n }\n\n .skeleton {\n width: 32px;\n height: 32px;\n background: var(--pop-muted);\n animation: pulse 1.5s ease-in-out infinite;\n }\n\n @keyframes pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n }\n\n .count {\n --count-size: calc(32px + var(--count-border-size));\n --count-background: var(--pop-background);\n --count-border-color: rgba(0 0 32 / 16%);\n --count-border-size: 1px;\n --count-color: var(--pop-foreground);\n\n align-items: center;\n background-color: var(--pop-background);\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n padding: calc(var(--count-border-size) / 2);\n position: relative;\n z-index: 10;\n\n width: calc(var(--count-size) + (calc(var(--count-border-size))));\n height: calc(var(--count-size) + (calc(var(--count-border-size))));\n }\n\n .count__background {\n background-color: var(--count-border-color);\n position: absolute;\n top: 0;\n left: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n }\n\n .count__content {\n align-items: center;\n background: var(--count-background);\n display: flex;\n justify-content: center;\n overflow: hidden;\n height: var(--count-size);\n width: var(--count-size);\n }\n\n .count__label {\n color: var(--count-color);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n letter-spacing: -0.96px;\n line-height: 28px;\n text-align: center;\n user-select: none;\n }\n\n .count__label-container {\n align-items: center;\n background: var(--pop-background);\n display: flex;\n height: calc(100% - calc(var(--count-border-size) * 2));\n justify-content: center;\n position: relative;\n text-indent: calc(calc(var(--count-border-size) * 2) * -1);\n width: calc(100% - calc(var(--count-border-size) * 2));\n z-index: 20;\n }\n"), Rn = class extends P {
|
|
2187
|
+
constructor(...e) {
|
|
2188
|
+
super(...e), this.events = { click: "onClick" };
|
|
2189
|
+
}
|
|
2190
|
+
get styleSheets() {
|
|
2191
|
+
return [Ln];
|
|
2192
|
+
}
|
|
2193
|
+
onClick() {
|
|
2194
|
+
this.gridStore.error.value || (this.gridStore.open.value = !this.gridStore.open.value);
|
|
2195
|
+
}
|
|
2196
|
+
setupEffects() {
|
|
2197
|
+
this.addEffect(() => {
|
|
2198
|
+
this.gridStore.loading.value, this.gridStore.error.value, this.gridStore.previewAvatars.value, this.gridStore.comments.value, this.gridStore.grid.value;
|
|
2199
|
+
let e = !!this.gridStore.error.value;
|
|
2200
|
+
this.toggleAttribute("data-error", e), e && this.gridStore.open.value && (this.gridStore.open.value = !1), this.render();
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
getTemplate() {
|
|
2204
|
+
if (this.gridStore.loading.value) return "<div class=\"widget\"><div class=\"skeleton mask mask-squircle\"></div></div>";
|
|
2205
|
+
if (this.gridStore.error.value) return "<div class=\"error-badge\">Error: there was a problem loading the PopGrid</div>";
|
|
2206
|
+
let e = this.gridStore.previewAvatars.value, t = this.gridStore.comments.value.length;
|
|
2207
|
+
return `
|
|
2208
|
+
<div class="widget">
|
|
2209
|
+
${e.map((t, n) => {
|
|
2210
|
+
let r = e.length + n, i = t?.id ?? t?.name ?? "";
|
|
2211
|
+
return t?.image ? `<pop-comment-avatar size="xs" style="z-index: ${r}" data-color-key="${i}">
|
|
2212
|
+
<img src="${t.image}" alt="${t.name ?? "User"}" />
|
|
2213
|
+
</pop-comment-avatar>` : `<pop-comment-avatar size="xs" style="z-index: ${r}" data-color-key="${i}">
|
|
2214
|
+
${L(t?.name)}
|
|
2215
|
+
</pop-comment-avatar>`;
|
|
2216
|
+
}).join("")}
|
|
2217
|
+
<div class="count mask mask-squircle">
|
|
2218
|
+
<span class="count__content mask mask-squircle">
|
|
2219
|
+
<div class="count__background mask mask-squircle"></div>
|
|
2220
|
+
<div class="count__label-container mask mask-squircle">
|
|
2221
|
+
<div class="count__label">${t}</div>
|
|
2222
|
+
</div>
|
|
2223
|
+
</span>
|
|
2224
|
+
</div>
|
|
2225
|
+
</div>
|
|
2226
|
+
`;
|
|
2227
|
+
}
|
|
2228
|
+
};
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region src/index.ts
|
|
2231
|
+
if (F([O(k)], Rn.prototype, "gridStore", void 0), customElements.get("pop-widget") || customElements.define("pop-widget", Rn), typeof document < "u") {
|
|
2232
|
+
let e = "https://rsms.me/inter/inter.css";
|
|
2233
|
+
if (!document.querySelector(`link[href="${e}"]`)) {
|
|
2234
|
+
let t = document.createElement("link");
|
|
2235
|
+
t.rel = "stylesheet", t.href = e, document.head.appendChild(t);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
//#endregion
|
|
2239
|
+
|
|
2240
|
+
//# sourceMappingURL=embed.js.map
|