@pixelmatters/markup 1.12.0 → 1.13.0
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/README.md +6 -6
- package/dist/widget.d.ts +7 -0
- package/dist/widget.js +369 -314
- package/dist/widget.js.map +1 -1
- package/package.json +4 -1
package/dist/widget.js
CHANGED
|
@@ -302,33 +302,33 @@ function ve(e, t, n) {
|
|
|
302
302
|
context: n?.context
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
var
|
|
306
|
-
function
|
|
307
|
-
|
|
305
|
+
var P = null;
|
|
306
|
+
function ye(e) {
|
|
307
|
+
P = e;
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
309
|
+
function F(e, t) {
|
|
310
|
+
P && ve(P, e, t);
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/hooks/dist/hooks.module.js
|
|
314
|
-
var
|
|
314
|
+
var be, I, xe, Se, Ce = 0, we = [], L = t, Te = L.__b, Ee = L.__r, De = L.diffed, Oe = L.__c, ke = L.unmount, Ae = L.__;
|
|
315
315
|
function je(e, t) {
|
|
316
|
-
|
|
317
|
-
var n =
|
|
316
|
+
L.__h && L.__h(I, e, Ce || t), Ce = 0;
|
|
317
|
+
var n = I.__H ||= {
|
|
318
318
|
__: [],
|
|
319
319
|
__h: []
|
|
320
320
|
};
|
|
321
321
|
return e >= n.__.length && n.__.push({}), n.__[e];
|
|
322
322
|
}
|
|
323
323
|
function R(e) {
|
|
324
|
-
return
|
|
324
|
+
return Ce = 1, Me(Be, e);
|
|
325
325
|
}
|
|
326
326
|
function Me(e, t, n) {
|
|
327
|
-
var r = je(
|
|
327
|
+
var r = je(be++, 2);
|
|
328
328
|
if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Be(void 0, t), function(e) {
|
|
329
329
|
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
|
|
330
330
|
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
|
|
331
|
-
}], r.__c =
|
|
331
|
+
}], r.__c = I, !I.__f)) {
|
|
332
332
|
var i = function(e, t, n) {
|
|
333
333
|
if (!r.__c.__H) return !0;
|
|
334
334
|
var i = r.__c.__H.__.filter(function(e) {
|
|
@@ -345,63 +345,63 @@ function Me(e, t, n) {
|
|
|
345
345
|
}
|
|
346
346
|
}), a && a.call(this, e, t, n) || o;
|
|
347
347
|
};
|
|
348
|
-
|
|
349
|
-
var a =
|
|
350
|
-
|
|
348
|
+
I.__f = !0;
|
|
349
|
+
var a = I.shouldComponentUpdate, o = I.componentWillUpdate;
|
|
350
|
+
I.componentWillUpdate = function(e, t, n) {
|
|
351
351
|
if (this.__e) {
|
|
352
352
|
var r = a;
|
|
353
353
|
a = void 0, i(e, t, n), a = r;
|
|
354
354
|
}
|
|
355
355
|
o && o.call(this, e, t, n);
|
|
356
|
-
},
|
|
356
|
+
}, I.shouldComponentUpdate = i;
|
|
357
357
|
}
|
|
358
358
|
return r.__N || r.__;
|
|
359
359
|
}
|
|
360
360
|
function z(e, t) {
|
|
361
|
-
var n = je(
|
|
362
|
-
!
|
|
361
|
+
var n = je(be++, 3);
|
|
362
|
+
!L.__s && ze(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
|
|
363
363
|
}
|
|
364
364
|
function B(e) {
|
|
365
|
-
return
|
|
365
|
+
return Ce = 5, Ne(function() {
|
|
366
366
|
return { current: e };
|
|
367
367
|
}, []);
|
|
368
368
|
}
|
|
369
369
|
function Ne(e, t) {
|
|
370
|
-
var n = je(
|
|
370
|
+
var n = je(be++, 7);
|
|
371
371
|
return ze(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
|
|
372
372
|
}
|
|
373
373
|
function V(e, t) {
|
|
374
|
-
return
|
|
374
|
+
return Ce = 8, Ne(function() {
|
|
375
375
|
return e;
|
|
376
376
|
}, t);
|
|
377
377
|
}
|
|
378
378
|
function Pe() {
|
|
379
|
-
for (var e; e =
|
|
379
|
+
for (var e; e = we.shift();) {
|
|
380
380
|
var t = e.__H;
|
|
381
381
|
if (e.__P && t) try {
|
|
382
382
|
t.__h.some(Le), t.__h.some(Re), t.__h = [];
|
|
383
383
|
} catch (n) {
|
|
384
|
-
t.__h = [],
|
|
384
|
+
t.__h = [], L.__e(n, e.__v);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
},
|
|
388
|
+
L.__b = function(e) {
|
|
389
|
+
I = null, Te && Te(e);
|
|
390
|
+
}, L.__ = function(e, t) {
|
|
391
391
|
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ae && Ae(e, t);
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
var t = (
|
|
395
|
-
t && (
|
|
392
|
+
}, L.__r = function(e) {
|
|
393
|
+
Ee && Ee(e), be = 0;
|
|
394
|
+
var t = (I = e.__c).__H;
|
|
395
|
+
t && (xe === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
|
|
396
396
|
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
|
|
397
|
-
})) : (t.__h.some(Le), t.__h.some(Re), t.__h = [],
|
|
398
|
-
},
|
|
399
|
-
|
|
397
|
+
})) : (t.__h.some(Le), t.__h.some(Re), t.__h = [], be = 0)), xe = I;
|
|
398
|
+
}, L.diffed = function(e) {
|
|
399
|
+
De && De(e);
|
|
400
400
|
var t = e.__c;
|
|
401
|
-
t && t.__H && (t.__H.__h.length && (
|
|
401
|
+
t && t.__H && (t.__H.__h.length && (we.push(t) !== 1 && Se === L.requestAnimationFrame || ((Se = L.requestAnimationFrame) || Ie)(Pe)), t.__H.__.some(function(e) {
|
|
402
402
|
e.u && (e.__H = e.u), e.u = void 0;
|
|
403
|
-
})),
|
|
404
|
-
},
|
|
403
|
+
})), xe = I = null;
|
|
404
|
+
}, L.__c = function(e, t) {
|
|
405
405
|
t.some(function(e) {
|
|
406
406
|
try {
|
|
407
407
|
e.__h.some(Le), e.__h = e.__h.filter(function(e) {
|
|
@@ -410,10 +410,10 @@ I.__b = function(e) {
|
|
|
410
410
|
} catch (n) {
|
|
411
411
|
t.some(function(e) {
|
|
412
412
|
e.__h &&= [];
|
|
413
|
-
}), t = [],
|
|
413
|
+
}), t = [], L.__e(n, e.__v);
|
|
414
414
|
}
|
|
415
415
|
}), Oe && Oe(e, t);
|
|
416
|
-
},
|
|
416
|
+
}, L.unmount = function(e) {
|
|
417
417
|
ke && ke(e);
|
|
418
418
|
var t, n = e.__c;
|
|
419
419
|
n && n.__H && (n.__H.__.some(function(e) {
|
|
@@ -422,7 +422,7 @@ I.__b = function(e) {
|
|
|
422
422
|
} catch (e) {
|
|
423
423
|
t = e;
|
|
424
424
|
}
|
|
425
|
-
}), n.__H = void 0, t &&
|
|
425
|
+
}), n.__H = void 0, t && L.__e(t, n.__v));
|
|
426
426
|
};
|
|
427
427
|
var Fe = typeof requestAnimationFrame == "function";
|
|
428
428
|
function Ie(e) {
|
|
@@ -432,12 +432,12 @@ function Ie(e) {
|
|
|
432
432
|
Fe && (t = requestAnimationFrame(n));
|
|
433
433
|
}
|
|
434
434
|
function Le(e) {
|
|
435
|
-
var t =
|
|
436
|
-
typeof n == "function" && (e.__c = void 0, n()),
|
|
435
|
+
var t = I, n = e.__c;
|
|
436
|
+
typeof n == "function" && (e.__c = void 0, n()), I = t;
|
|
437
437
|
}
|
|
438
438
|
function Re(e) {
|
|
439
|
-
var t =
|
|
440
|
-
e.__c = e.__(),
|
|
439
|
+
var t = I;
|
|
440
|
+
e.__c = e.__(), I = t;
|
|
441
441
|
}
|
|
442
442
|
function ze(e, t) {
|
|
443
443
|
return !e || e.length !== t.length || t.some(function(t, n) {
|
|
@@ -3030,6 +3030,14 @@ function qr(e) {
|
|
|
3030
3030
|
operation: "forget-me",
|
|
3031
3031
|
signal: e?.signal
|
|
3032
3032
|
});
|
|
3033
|
+
},
|
|
3034
|
+
signOut(e) {
|
|
3035
|
+
return n("/widget/sign-out", { method: "POST" }, {
|
|
3036
|
+
timeoutMs: Gr,
|
|
3037
|
+
category: "write",
|
|
3038
|
+
operation: "sign-out",
|
|
3039
|
+
signal: e?.signal
|
|
3040
|
+
});
|
|
3033
3041
|
}
|
|
3034
3042
|
};
|
|
3035
3043
|
}
|
|
@@ -3068,7 +3076,7 @@ async function Xr(e, t) {
|
|
|
3068
3076
|
} catch {}
|
|
3069
3077
|
return i;
|
|
3070
3078
|
} catch (e) {
|
|
3071
|
-
return e?.name !== "TypeError" &&
|
|
3079
|
+
return e?.name !== "TypeError" && F(e, { context: "cookie-probe" }), !1;
|
|
3072
3080
|
}
|
|
3073
3081
|
}
|
|
3074
3082
|
//#endregion
|
|
@@ -3079,7 +3087,7 @@ function $r(e) {
|
|
|
3079
3087
|
try {
|
|
3080
3088
|
e();
|
|
3081
3089
|
} catch (e) {
|
|
3082
|
-
|
|
3090
|
+
F(e, { context: "history-observer-listener" });
|
|
3083
3091
|
}
|
|
3084
3092
|
});
|
|
3085
3093
|
}
|
|
@@ -3252,7 +3260,7 @@ async function di(e) {
|
|
|
3252
3260
|
let s = r ? "refresh,cookies" : "refresh";
|
|
3253
3261
|
o.searchParams.set("capabilities", s), a = o.toString();
|
|
3254
3262
|
} catch (e) {
|
|
3255
|
-
return e?.name !== "TypeError" &&
|
|
3263
|
+
return e?.name !== "TypeError" && F(e, { context: "popup-exchange" }), Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
|
|
3256
3264
|
}
|
|
3257
3265
|
let o = Math.max(0, window.screenX + (window.outerWidth - 420) / 2), s = Math.max(0, window.screenY + (window.outerHeight - 560) / 2), c = window.open(a, "markup-auth", `width=420,height=560,left=${o},top=${s}`);
|
|
3258
3266
|
if (!c) return Promise.reject(/* @__PURE__ */ Error("Popup blocked — allow popups for this site to sign in"));
|
|
@@ -3294,7 +3302,7 @@ async function di(e) {
|
|
|
3294
3302
|
});
|
|
3295
3303
|
if (!e.ok) {
|
|
3296
3304
|
let t = /* @__PURE__ */ Error(`Failed to install widget cookies (${e.status})`);
|
|
3297
|
-
throw
|
|
3305
|
+
throw F(t, { context: "install-cookies" }), t;
|
|
3298
3306
|
}
|
|
3299
3307
|
return {
|
|
3300
3308
|
...l,
|
|
@@ -3776,7 +3784,7 @@ function Pa(e) {
|
|
|
3776
3784
|
if (e.redactSelector) try {
|
|
3777
3785
|
for (let t of document.querySelectorAll(e.redactSelector)) Na(t) || r(t);
|
|
3778
3786
|
} catch (e) {
|
|
3779
|
-
|
|
3787
|
+
F(e, { context: "screenshot-redact-selector" });
|
|
3780
3788
|
}
|
|
3781
3789
|
if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Na(e) || r(e);
|
|
3782
3790
|
return n;
|
|
@@ -3831,7 +3839,7 @@ async function La(e, t, n) {
|
|
|
3831
3839
|
redactedSelectors: s
|
|
3832
3840
|
};
|
|
3833
3841
|
} catch (e) {
|
|
3834
|
-
return
|
|
3842
|
+
return F(e, { context: "screenshot-capture" }), null;
|
|
3835
3843
|
}
|
|
3836
3844
|
}
|
|
3837
3845
|
function Ra(e, t) {
|
|
@@ -3884,7 +3892,7 @@ function Wa(e) {
|
|
|
3884
3892
|
r = setTimeout(i, o);
|
|
3885
3893
|
} catch (e) {
|
|
3886
3894
|
if (t) return;
|
|
3887
|
-
e?.name !== "TypeError" &&
|
|
3895
|
+
e?.name !== "TypeError" && F(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ua);
|
|
3888
3896
|
}
|
|
3889
3897
|
}
|
|
3890
3898
|
return i(), () => {
|
|
@@ -3925,7 +3933,7 @@ async function Ga(e) {
|
|
|
3925
3933
|
};
|
|
3926
3934
|
} catch (e) {
|
|
3927
3935
|
let t = e?.name;
|
|
3928
|
-
return t !== "AbortError" && t !== "TypeError" &&
|
|
3936
|
+
return t !== "AbortError" && t !== "TypeError" && F(e, { context: "refresh-token" }), null;
|
|
3929
3937
|
}
|
|
3930
3938
|
}
|
|
3931
3939
|
//#endregion
|
|
@@ -4197,70 +4205,89 @@ function oo({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
|
|
|
4197
4205
|
}
|
|
4198
4206
|
//#endregion
|
|
4199
4207
|
//#region src/runtime/ui/fab-menu.tsx
|
|
4200
|
-
function so({ identity: e, position: t, isSigningIn: n,
|
|
4201
|
-
let [
|
|
4208
|
+
function so({ identity: e, position: t, isSigningIn: n, isSigningOut: r, dashboardUrl: i, onSignIn: a, onSignOut: o, onForgetMe: s }) {
|
|
4209
|
+
let [c, l] = R(!1), [u, d] = R(!1), [f, p] = R(!1), m = B(null);
|
|
4202
4210
|
z(() => {
|
|
4203
|
-
if (!
|
|
4211
|
+
if (!c) return;
|
|
4204
4212
|
function e(e) {
|
|
4205
|
-
let t =
|
|
4206
|
-
t && (e.composedPath().includes(t) ||
|
|
4213
|
+
let t = m.current;
|
|
4214
|
+
t && (e.composedPath().includes(t) || l(!1));
|
|
4207
4215
|
}
|
|
4208
4216
|
function t(e) {
|
|
4209
|
-
e.key === "Escape" &&
|
|
4217
|
+
e.key === "Escape" && l(!1);
|
|
4210
4218
|
}
|
|
4211
4219
|
return document.addEventListener("click", e, !0), document.addEventListener("keydown", t), () => {
|
|
4212
4220
|
document.removeEventListener("click", e, !0), document.removeEventListener("keydown", t);
|
|
4213
4221
|
};
|
|
4214
|
-
}, [
|
|
4215
|
-
|
|
4216
|
-
}, [
|
|
4217
|
-
let
|
|
4222
|
+
}, [c]), z(() => {
|
|
4223
|
+
c || (d(!1), p(!1));
|
|
4224
|
+
}, [c]);
|
|
4225
|
+
let h = li(e), g = e.kind === "verified" ? e.identity.email : e.kind === "anon" ? "Commenting anonymously" : null, _ = e.kind === "anon", v = e.kind !== "verified", y = e.kind === "verified", b = e.kind === "verified" && !!i, x = v || _ || y || b, S = t === "bottom-left" ? "is-anchor-left" : "is-anchor-right";
|
|
4218
4226
|
return /* @__PURE__ */ Q("div", {
|
|
4219
4227
|
class: "markup-fab-menu",
|
|
4220
|
-
ref:
|
|
4228
|
+
ref: m,
|
|
4221
4229
|
children: [/* @__PURE__ */ Q("button", {
|
|
4222
4230
|
type: "button",
|
|
4223
|
-
class: Z("markup-fab-caret",
|
|
4231
|
+
class: Z("markup-fab-caret", c && "is-open"),
|
|
4224
4232
|
"aria-label": "Widget menu",
|
|
4225
|
-
"aria-expanded":
|
|
4233
|
+
"aria-expanded": c,
|
|
4226
4234
|
"aria-haspopup": "menu",
|
|
4227
4235
|
onClick: (e) => {
|
|
4228
|
-
e.preventDefault(), e.stopPropagation(),
|
|
4236
|
+
e.preventDefault(), e.stopPropagation(), l((e) => !e);
|
|
4229
4237
|
},
|
|
4230
4238
|
children: /* @__PURE__ */ Q(eo, { size: 14 })
|
|
4231
|
-
}),
|
|
4239
|
+
}), c ? /* @__PURE__ */ Q("div", {
|
|
4232
4240
|
role: "menu",
|
|
4233
|
-
class: Z("markup-fab-menu-list",
|
|
4241
|
+
class: Z("markup-fab-menu-list", S),
|
|
4234
4242
|
children: [
|
|
4235
4243
|
/* @__PURE__ */ Q("div", {
|
|
4236
4244
|
class: "markup-fab-menu-header",
|
|
4237
4245
|
children: [/* @__PURE__ */ Q("div", {
|
|
4238
4246
|
class: "markup-fab-menu-name",
|
|
4239
|
-
children:
|
|
4240
|
-
}),
|
|
4247
|
+
children: h ?? "Anonymous"
|
|
4248
|
+
}), g ? /* @__PURE__ */ Q("div", {
|
|
4241
4249
|
class: "markup-fab-menu-sub",
|
|
4242
|
-
children:
|
|
4250
|
+
children: g
|
|
4243
4251
|
}) : null]
|
|
4244
4252
|
}),
|
|
4245
|
-
|
|
4246
|
-
|
|
4253
|
+
x ? /* @__PURE__ */ Q("div", { class: "markup-fab-menu-divider" }) : null,
|
|
4254
|
+
v ? /* @__PURE__ */ Q("button", {
|
|
4247
4255
|
type: "button",
|
|
4248
4256
|
role: "menuitem",
|
|
4249
4257
|
class: "markup-fab-menu-item",
|
|
4250
4258
|
disabled: n,
|
|
4251
4259
|
onClick: () => {
|
|
4252
|
-
|
|
4260
|
+
l(!1), a();
|
|
4253
4261
|
},
|
|
4254
4262
|
children: n ? "Signing in…" : "Sign in"
|
|
4255
4263
|
}) : null,
|
|
4256
|
-
|
|
4264
|
+
b ? /* @__PURE__ */ Q("a", {
|
|
4265
|
+
role: "menuitem",
|
|
4266
|
+
class: "markup-fab-menu-item",
|
|
4267
|
+
href: i,
|
|
4268
|
+
target: "_blank",
|
|
4269
|
+
rel: "noopener noreferrer",
|
|
4270
|
+
onClick: () => l(!1),
|
|
4271
|
+
children: "Account →"
|
|
4272
|
+
}) : null,
|
|
4273
|
+
y ? /* @__PURE__ */ Q("button", {
|
|
4274
|
+
type: "button",
|
|
4275
|
+
role: "menuitem",
|
|
4276
|
+
class: Z("markup-fab-menu-item", f && "is-danger"),
|
|
4277
|
+
disabled: r,
|
|
4278
|
+
onClick: () => {
|
|
4279
|
+
f ? (l(!1), o()) : p(!0);
|
|
4280
|
+
},
|
|
4281
|
+
children: r ? "Signing out…" : f ? "Confirm — sign out of this site" : "Sign out"
|
|
4282
|
+
}) : null,
|
|
4283
|
+
_ ? /* @__PURE__ */ Q("button", {
|
|
4257
4284
|
type: "button",
|
|
4258
4285
|
role: "menuitem",
|
|
4259
|
-
class: Z("markup-fab-menu-item",
|
|
4286
|
+
class: Z("markup-fab-menu-item", u && "is-danger"),
|
|
4260
4287
|
onClick: () => {
|
|
4261
|
-
|
|
4288
|
+
u ? (l(!1), s()) : d(!0);
|
|
4262
4289
|
},
|
|
4263
|
-
children:
|
|
4290
|
+
children: u ? "Confirm — comments stay, name/email cleared" : "Forget me on this site…"
|
|
4264
4291
|
}) : null
|
|
4265
4292
|
]
|
|
4266
4293
|
}) : null]
|
|
@@ -5284,7 +5311,8 @@ var Mo = hr({
|
|
|
5284
5311
|
name: e.identity.name,
|
|
5285
5312
|
email: e.identity.email
|
|
5286
5313
|
}
|
|
5287
|
-
})
|
|
5314
|
+
}),
|
|
5315
|
+
"signed-out": () => $({ kind: "unresolved" })
|
|
5288
5316
|
},
|
|
5289
5317
|
recovering: {
|
|
5290
5318
|
"mint-success": (e, t) => $({
|
|
@@ -5297,53 +5325,53 @@ var Mo = hr({
|
|
|
5297
5325
|
})
|
|
5298
5326
|
}
|
|
5299
5327
|
});
|
|
5300
|
-
function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
|
|
5301
|
-
let [
|
|
5328
|
+
function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i, dashboardUrl: a }) {
|
|
5329
|
+
let [o, s] = R(Ao), [c, l] = R([]), [u, d] = R(!1), f = Ne(() => oi(), []), [p, m] = gr(Mo, f.state), [h, g] = R(null);
|
|
5302
5330
|
z(() => {
|
|
5303
5331
|
let n = !1;
|
|
5304
5332
|
return Xr(e, t).then((e) => {
|
|
5305
|
-
n ||
|
|
5333
|
+
n || g(e);
|
|
5306
5334
|
}), () => {
|
|
5307
5335
|
n = !0;
|
|
5308
5336
|
};
|
|
5309
5337
|
}, [e, t]);
|
|
5310
|
-
let [
|
|
5311
|
-
|
|
5338
|
+
let [_, v] = R(n), y = B(p);
|
|
5339
|
+
y.current = p, Ja(p, e, t, (e) => m({
|
|
5312
5340
|
type: "signed-in",
|
|
5313
5341
|
identity: e
|
|
5314
|
-
}), () =>
|
|
5315
|
-
let
|
|
5342
|
+
}), () => m({ type: "unauthorized" }));
|
|
5343
|
+
let b = Ne(() => qr({
|
|
5316
5344
|
apiUrl: e,
|
|
5317
5345
|
apiKey: t,
|
|
5318
5346
|
getToken: () => {
|
|
5319
|
-
let e =
|
|
5347
|
+
let e = y.current;
|
|
5320
5348
|
return e.kind !== "verified" || e.identity.token == null ? null : {
|
|
5321
5349
|
token: e.identity.token,
|
|
5322
5350
|
expiresAt: e.identity.tokenExpiresAt
|
|
5323
5351
|
};
|
|
5324
5352
|
},
|
|
5325
5353
|
getStorageMode: () => {
|
|
5326
|
-
let e =
|
|
5354
|
+
let e = y.current;
|
|
5327
5355
|
return e.kind === "verified" ? e.identity.storage : null;
|
|
5328
5356
|
},
|
|
5329
5357
|
getAnonToken: () => {
|
|
5330
|
-
let e =
|
|
5358
|
+
let e = y.current;
|
|
5331
5359
|
return e.kind === "anon" ? e.identity.anonToken : null;
|
|
5332
5360
|
},
|
|
5333
5361
|
onUnauthorized: () => {
|
|
5334
|
-
|
|
5362
|
+
m({ type: "unauthorized" });
|
|
5335
5363
|
}
|
|
5336
5364
|
}), [
|
|
5337
5365
|
e,
|
|
5338
5366
|
t,
|
|
5339
|
-
|
|
5340
|
-
]), [
|
|
5367
|
+
m
|
|
5368
|
+
]), [x, S] = R({ kind: "idle" }), C = vr(), w = vr(), T = vr(), E = vr(), D = vr(), { run: O, reset: k } = C, { run: A } = w, { run: j, reset: M } = T, { run: N } = E, { run: ee } = D, te = D.isPending, ne = C.isPending, re = C.error ?? w.error ?? T.error, [ie, ae] = gr(jo, { kind: "visible" }), oe = ie.kind !== "visible", [se, ce] = R(0), le = B(null), ue = li(p), de = p.kind === "verified", fe = p.kind === "unresolved" || p.kind === "recovering", pe = ci(p);
|
|
5341
5369
|
z(() => {
|
|
5342
|
-
if (
|
|
5343
|
-
let e =
|
|
5370
|
+
if (p.kind !== "unresolved" && p.kind !== "recovering") return;
|
|
5371
|
+
let e = p.kind === "recovering" ? p.preserved : f.preserved, t = !1, n = null, r = 1e3;
|
|
5344
5372
|
function i() {
|
|
5345
|
-
|
|
5346
|
-
t ||
|
|
5373
|
+
b.mintAnonIdentity().then(({ clientId: n, token: r }) => {
|
|
5374
|
+
t || m({
|
|
5347
5375
|
type: "mint-success",
|
|
5348
5376
|
identity: {
|
|
5349
5377
|
clientId: n,
|
|
@@ -5360,59 +5388,59 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5360
5388
|
t = !0, n && clearTimeout(n);
|
|
5361
5389
|
};
|
|
5362
5390
|
}, [
|
|
5363
|
-
|
|
5364
|
-
f,
|
|
5391
|
+
b,
|
|
5365
5392
|
p,
|
|
5366
|
-
|
|
5393
|
+
m,
|
|
5394
|
+
f
|
|
5367
5395
|
]);
|
|
5368
|
-
let
|
|
5396
|
+
let me = Wa(b), [he, ge] = R(null);
|
|
5369
5397
|
z(() => {
|
|
5370
5398
|
let t = new mr(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
|
|
5371
|
-
return
|
|
5372
|
-
t.close(),
|
|
5399
|
+
return ge(t), () => {
|
|
5400
|
+
t.close(), ge((e) => e === t ? null : e);
|
|
5373
5401
|
};
|
|
5374
5402
|
}, [e]);
|
|
5375
|
-
let
|
|
5403
|
+
let _e = B(!1);
|
|
5376
5404
|
z(() => {
|
|
5377
|
-
if (!(!
|
|
5378
|
-
subscriptionToken:
|
|
5379
|
-
route:
|
|
5380
|
-
viewerClientId:
|
|
5405
|
+
if (!(!he || !me)) return k(), M(), he.onUpdate(an("widget/queries:subscribeThreadsForRoute"), {
|
|
5406
|
+
subscriptionToken: me,
|
|
5407
|
+
route: o,
|
|
5408
|
+
viewerClientId: pe
|
|
5381
5409
|
}, (e) => {
|
|
5382
|
-
e !== void 0 && (
|
|
5410
|
+
e !== void 0 && (l(e), d(!0));
|
|
5383
5411
|
});
|
|
5384
5412
|
}, [
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5413
|
+
he,
|
|
5414
|
+
me,
|
|
5415
|
+
o,
|
|
5416
|
+
pe,
|
|
5417
|
+
k,
|
|
5418
|
+
M
|
|
5391
5419
|
]), z(() => {
|
|
5392
|
-
if (
|
|
5420
|
+
if (_e.current || !u) return;
|
|
5393
5421
|
let e = window.location.hash.match(/^#markup-thread=(.+)$/);
|
|
5394
5422
|
if (e) {
|
|
5395
5423
|
let t = decodeURIComponent(e[1] ?? "");
|
|
5396
|
-
|
|
5424
|
+
c.find((e) => e._id === t) && S({
|
|
5397
5425
|
kind: "thread",
|
|
5398
5426
|
threadId: t
|
|
5399
5427
|
}), history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
5400
5428
|
}
|
|
5401
|
-
|
|
5402
|
-
}, [
|
|
5429
|
+
_e.current = !0;
|
|
5430
|
+
}, [c, u]), z(() => ni(() => s(Ao())), []), z(() => {
|
|
5403
5431
|
function e(e) {
|
|
5404
|
-
e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(),
|
|
5432
|
+
e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), ae({ type: "toggle" })));
|
|
5405
5433
|
}
|
|
5406
5434
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
5407
|
-
}, [
|
|
5408
|
-
if (
|
|
5409
|
-
let e = window.setTimeout(() =>
|
|
5435
|
+
}, [ae]), z(() => {
|
|
5436
|
+
if (ie.kind !== "hidden-with-toast") return;
|
|
5437
|
+
let e = window.setTimeout(() => ae({ type: "dismiss-toast" }), 5e3);
|
|
5410
5438
|
return () => window.clearTimeout(e);
|
|
5411
|
-
}, [
|
|
5439
|
+
}, [ie.kind, ae]), z(() => {
|
|
5412
5440
|
let e = null;
|
|
5413
5441
|
function t() {
|
|
5414
5442
|
e ??= requestAnimationFrame(() => {
|
|
5415
|
-
e = null,
|
|
5443
|
+
e = null, ce((e) => e + 1);
|
|
5416
5444
|
});
|
|
5417
5445
|
}
|
|
5418
5446
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t);
|
|
@@ -5421,14 +5449,14 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5421
5449
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n.disconnect(), e != null && cancelAnimationFrame(e);
|
|
5422
5450
|
};
|
|
5423
5451
|
}, []);
|
|
5424
|
-
let
|
|
5425
|
-
|
|
5426
|
-
}, [
|
|
5427
|
-
|
|
5428
|
-
}, [
|
|
5429
|
-
let r = t + window.scrollX, a = n + window.scrollY, o = ++
|
|
5452
|
+
let ve = V(() => {
|
|
5453
|
+
k(), M(), S({ kind: "placing" });
|
|
5454
|
+
}, [k, M]), P = V(() => {
|
|
5455
|
+
S({ kind: "idle" }), k(), M();
|
|
5456
|
+
}, [k, M]), ye = B(0), F = V((e, t, n) => {
|
|
5457
|
+
let r = t + window.scrollX, a = n + window.scrollY, o = ++ye.current;
|
|
5430
5458
|
if (i?.enabled === !1) {
|
|
5431
|
-
|
|
5459
|
+
S({
|
|
5432
5460
|
kind: "composing-new",
|
|
5433
5461
|
coords: e,
|
|
5434
5462
|
pageX: r,
|
|
@@ -5441,7 +5469,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5441
5469
|
});
|
|
5442
5470
|
return;
|
|
5443
5471
|
}
|
|
5444
|
-
|
|
5472
|
+
S({
|
|
5445
5473
|
kind: "composing-new",
|
|
5446
5474
|
coords: e,
|
|
5447
5475
|
pageX: r,
|
|
@@ -5452,7 +5480,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5452
5480
|
screenshotRedactedSelectors: [],
|
|
5453
5481
|
captureToken: o
|
|
5454
5482
|
});
|
|
5455
|
-
let s =
|
|
5483
|
+
let s = le.current != null && le.current.getRootNode() instanceof ShadowRoot ? le.current.getRootNode().host : null, c = {
|
|
5456
5484
|
strictScrub: i?.strictScrub,
|
|
5457
5485
|
redactSelector: i?.redactSelector
|
|
5458
5486
|
};
|
|
@@ -5460,7 +5488,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5460
5488
|
x: t,
|
|
5461
5489
|
y: n
|
|
5462
5490
|
}, c).then((e) => {
|
|
5463
|
-
|
|
5491
|
+
S((t) => t.kind !== "composing-new" || t.captureToken !== o ? t : {
|
|
5464
5492
|
...t,
|
|
5465
5493
|
screenshot: e?.blob ?? null,
|
|
5466
5494
|
isScreenshotCapturing: !1,
|
|
@@ -5468,21 +5496,21 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5468
5496
|
screenshotRedactedSelectors: e?.redactedSelectors ?? []
|
|
5469
5497
|
});
|
|
5470
5498
|
});
|
|
5471
|
-
}, [i]),
|
|
5472
|
-
|
|
5499
|
+
}, [i]), be = V((e, t) => {
|
|
5500
|
+
m({
|
|
5473
5501
|
type: "author-set",
|
|
5474
5502
|
name: e,
|
|
5475
5503
|
email: t
|
|
5476
5504
|
});
|
|
5477
|
-
}, [
|
|
5478
|
-
await
|
|
5505
|
+
}, [m]), I = w.isPending, xe = V(async () => {
|
|
5506
|
+
await A(async () => {
|
|
5479
5507
|
let n = ko(await di({
|
|
5480
5508
|
apiUrl: e,
|
|
5481
5509
|
apiKey: t,
|
|
5482
|
-
useCookies:
|
|
5510
|
+
useCookies: h === !0
|
|
5483
5511
|
}));
|
|
5484
5512
|
if (!n) throw Error("Sign-in did not return a verified token");
|
|
5485
|
-
|
|
5513
|
+
m({
|
|
5486
5514
|
type: "signed-in",
|
|
5487
5515
|
identity: n
|
|
5488
5516
|
});
|
|
@@ -5490,21 +5518,21 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5490
5518
|
}, [
|
|
5491
5519
|
e,
|
|
5492
5520
|
t,
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
]),
|
|
5497
|
-
if (
|
|
5498
|
-
let n = ui(
|
|
5499
|
-
n && await
|
|
5521
|
+
h,
|
|
5522
|
+
A,
|
|
5523
|
+
m
|
|
5524
|
+
]), Se = V(async (e, t) => {
|
|
5525
|
+
if (x.kind !== "composing-new") return;
|
|
5526
|
+
let n = ui(p);
|
|
5527
|
+
n && await O(async () => {
|
|
5500
5528
|
let r;
|
|
5501
|
-
if (t &&
|
|
5502
|
-
let { uploadUrl: e } = await
|
|
5529
|
+
if (t && x.screenshot) {
|
|
5530
|
+
let { uploadUrl: e } = await b.getScreenshotUploadUrl(), t;
|
|
5503
5531
|
try {
|
|
5504
5532
|
t = await fetch(e, {
|
|
5505
5533
|
method: "POST",
|
|
5506
|
-
headers: { "Content-Type":
|
|
5507
|
-
body:
|
|
5534
|
+
headers: { "Content-Type": x.screenshot.type || "image/png" },
|
|
5535
|
+
body: x.screenshot,
|
|
5508
5536
|
signal: AbortSignal.timeout(6e4)
|
|
5509
5537
|
});
|
|
5510
5538
|
} catch (e) {
|
|
@@ -5514,128 +5542,142 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5514
5542
|
let { storageId: n } = await t.json();
|
|
5515
5543
|
r = n;
|
|
5516
5544
|
}
|
|
5517
|
-
let i = await
|
|
5545
|
+
let i = await b.createThread({
|
|
5518
5546
|
url: window.location.href,
|
|
5519
|
-
route:
|
|
5520
|
-
anchorSelector:
|
|
5521
|
-
anchorX:
|
|
5522
|
-
anchorY:
|
|
5523
|
-
anchorOffsetX:
|
|
5524
|
-
anchorOffsetY:
|
|
5525
|
-
viewportW:
|
|
5526
|
-
viewportY:
|
|
5547
|
+
route: o,
|
|
5548
|
+
anchorSelector: x.coords.anchorSelector,
|
|
5549
|
+
anchorX: x.coords.anchorX,
|
|
5550
|
+
anchorY: x.coords.anchorY,
|
|
5551
|
+
anchorOffsetX: x.coords.anchorOffsetX,
|
|
5552
|
+
anchorOffsetY: x.coords.anchorOffsetY,
|
|
5553
|
+
viewportW: x.coords.viewportW,
|
|
5554
|
+
viewportY: x.coords.viewportY,
|
|
5527
5555
|
userAgent: navigator.userAgent,
|
|
5528
5556
|
authorName: n.name,
|
|
5529
5557
|
authorEmail: n.email,
|
|
5530
5558
|
body: e,
|
|
5531
5559
|
screenshotStorageId: r
|
|
5532
5560
|
});
|
|
5533
|
-
|
|
5561
|
+
l((e) => [...e, i.thread]), S({
|
|
5534
5562
|
kind: "thread",
|
|
5535
5563
|
threadId: i.thread._id
|
|
5536
5564
|
});
|
|
5537
5565
|
});
|
|
5538
5566
|
}, [
|
|
5539
|
-
y,
|
|
5540
|
-
f,
|
|
5541
5567
|
b,
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5568
|
+
p,
|
|
5569
|
+
x,
|
|
5570
|
+
o,
|
|
5571
|
+
O
|
|
5572
|
+
]), Ce = V(async () => {
|
|
5573
|
+
if (x.kind !== "thread") return;
|
|
5574
|
+
let e = x.threadId;
|
|
5575
|
+
await O(async () => {
|
|
5576
|
+
await b.deleteThread(e), l((t) => t.filter((t) => t._id !== e)), S({ kind: "idle" });
|
|
5549
5577
|
});
|
|
5550
5578
|
}, [
|
|
5551
|
-
y,
|
|
5552
5579
|
b,
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5580
|
+
x,
|
|
5581
|
+
O
|
|
5582
|
+
]), we = V(async () => {
|
|
5583
|
+
if (x.kind !== "thread") return;
|
|
5584
|
+
let e = x.threadId;
|
|
5585
|
+
await O(async () => {
|
|
5586
|
+
await b.resolveThread(e, pe), l((t) => t.filter((t) => t._id !== e)), S({ kind: "idle" });
|
|
5559
5587
|
});
|
|
5560
5588
|
}, [
|
|
5561
|
-
y,
|
|
5562
5589
|
b,
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5590
|
+
x,
|
|
5591
|
+
pe,
|
|
5592
|
+
O
|
|
5593
|
+
]), L = V(async (e) => {
|
|
5594
|
+
if (x.kind !== "thread") return;
|
|
5595
|
+
let t = ui(p);
|
|
5568
5596
|
if (!t) return;
|
|
5569
|
-
let n =
|
|
5570
|
-
await
|
|
5571
|
-
let r = await
|
|
5597
|
+
let n = x.threadId;
|
|
5598
|
+
await O(async () => {
|
|
5599
|
+
let r = await b.addComment(n, {
|
|
5572
5600
|
body: e,
|
|
5573
5601
|
authorName: t.name,
|
|
5574
5602
|
authorEmail: t.email
|
|
5575
5603
|
});
|
|
5576
|
-
|
|
5604
|
+
l((e) => e.map((e) => e._id === n ? r.thread : e));
|
|
5577
5605
|
});
|
|
5578
5606
|
}, [
|
|
5579
|
-
y,
|
|
5580
|
-
f,
|
|
5581
5607
|
b,
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5608
|
+
p,
|
|
5609
|
+
x,
|
|
5610
|
+
O
|
|
5611
|
+
]), Te = V(async (e, t) => {
|
|
5612
|
+
if (x.kind !== "thread" || p.kind !== "anon" && p.kind !== "verified") return;
|
|
5613
|
+
let n = x.threadId;
|
|
5614
|
+
await O(async () => {
|
|
5615
|
+
let r = await b.editComment(n, e, { body: t });
|
|
5616
|
+
l((e) => e.map((e) => e._id === n ? r.thread : e));
|
|
5589
5617
|
}, { rethrow: !0 });
|
|
5590
5618
|
}, [
|
|
5591
|
-
y,
|
|
5592
|
-
f,
|
|
5593
5619
|
b,
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5620
|
+
p,
|
|
5621
|
+
x,
|
|
5622
|
+
O
|
|
5623
|
+
]), Ee = V(async (e) => {
|
|
5624
|
+
if (x.kind !== "thread" || p.kind !== "anon" && p.kind !== "verified") return;
|
|
5625
|
+
let t = x.threadId;
|
|
5626
|
+
await O(async () => {
|
|
5627
|
+
let n = await b.deleteComment(t, e);
|
|
5628
|
+
l((e) => e.map((e) => e._id === t ? n.thread : e));
|
|
5601
5629
|
});
|
|
5602
5630
|
}, [
|
|
5603
|
-
y,
|
|
5604
|
-
f,
|
|
5605
5631
|
b,
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5632
|
+
p,
|
|
5633
|
+
x,
|
|
5634
|
+
O
|
|
5635
|
+
]), De = V(async (e, t) => {
|
|
5636
|
+
if (x.kind !== "thread") return;
|
|
5637
|
+
let n = ui(p);
|
|
5610
5638
|
if (!n) return;
|
|
5611
|
-
let r =
|
|
5612
|
-
await
|
|
5613
|
-
let i = await
|
|
5639
|
+
let r = x.threadId;
|
|
5640
|
+
await j(async () => {
|
|
5641
|
+
let i = await b.toggleReaction(e, {
|
|
5614
5642
|
emoji: t,
|
|
5615
5643
|
authorName: n.name
|
|
5616
5644
|
});
|
|
5617
|
-
|
|
5645
|
+
l((e) => e.map((e) => e._id === r ? i.thread : e));
|
|
5618
5646
|
});
|
|
5619
5647
|
}, [
|
|
5620
|
-
y,
|
|
5621
|
-
f,
|
|
5622
5648
|
b,
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5649
|
+
p,
|
|
5650
|
+
x,
|
|
5651
|
+
j
|
|
5652
|
+
]), [Oe, ke] = R(!1), Ae = V(async () => {
|
|
5653
|
+
await N(async () => {
|
|
5654
|
+
await b.forgetMe(), S({ kind: "idle" }), m({ type: "forget-me" }), ke(!0);
|
|
5627
5655
|
});
|
|
5628
5656
|
}, [
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5657
|
+
b,
|
|
5658
|
+
N,
|
|
5659
|
+
m
|
|
5632
5660
|
]);
|
|
5633
5661
|
z(() => {
|
|
5634
|
-
if (!
|
|
5635
|
-
let e = window.setTimeout(() =>
|
|
5662
|
+
if (!Oe) return;
|
|
5663
|
+
let e = window.setTimeout(() => ke(!1), 5e3);
|
|
5636
5664
|
return () => window.clearTimeout(e);
|
|
5637
|
-
}, [
|
|
5638
|
-
let
|
|
5665
|
+
}, [Oe]);
|
|
5666
|
+
let [je, Me] = R(!1), Pe = V(async () => {
|
|
5667
|
+
await ee(async () => {
|
|
5668
|
+
await b.signOut(), S({ kind: "idle" }), m({ type: "signed-out" }), Me(!0);
|
|
5669
|
+
});
|
|
5670
|
+
}, [
|
|
5671
|
+
b,
|
|
5672
|
+
ee,
|
|
5673
|
+
m
|
|
5674
|
+
]);
|
|
5675
|
+
z(() => {
|
|
5676
|
+
if (!je) return;
|
|
5677
|
+
let e = window.setTimeout(() => Me(!1), 5e3);
|
|
5678
|
+
return () => window.clearTimeout(e);
|
|
5679
|
+
}, [je]);
|
|
5680
|
+
let Fe = x.kind === "thread" ? c.find((e) => e._id === x.threadId) ?? null : null, Ie = de || pe != null && pe === Fe?.authorClientId, Le = Ne(() => c.map((e) => ({
|
|
5639
5681
|
thread: e,
|
|
5640
5682
|
point: Br({
|
|
5641
5683
|
anchorX: e.anchorX,
|
|
@@ -5644,13 +5686,13 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5644
5686
|
anchorOffsetX: e.anchorOffsetX,
|
|
5645
5687
|
anchorOffsetY: e.anchorOffsetY
|
|
5646
5688
|
})
|
|
5647
|
-
})), [
|
|
5689
|
+
})), [c, se]), Re = Le.some((e) => !e.point.resolved);
|
|
5648
5690
|
return z(() => {
|
|
5649
|
-
if (!
|
|
5691
|
+
if (!Re) return;
|
|
5650
5692
|
let e = null;
|
|
5651
5693
|
function t() {
|
|
5652
5694
|
e ??= requestAnimationFrame(() => {
|
|
5653
|
-
e = null,
|
|
5695
|
+
e = null, ce((e) => e + 1);
|
|
5654
5696
|
});
|
|
5655
5697
|
}
|
|
5656
5698
|
let n = new MutationObserver(t);
|
|
@@ -5660,96 +5702,100 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5660
5702
|
}), () => {
|
|
5661
5703
|
n.disconnect(), e != null && cancelAnimationFrame(e);
|
|
5662
5704
|
};
|
|
5663
|
-
}, [
|
|
5664
|
-
|
|
5705
|
+
}, [Re]), z(() => {
|
|
5706
|
+
x.kind === "thread" && Fe == null && P();
|
|
5665
5707
|
}, [
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5708
|
+
x,
|
|
5709
|
+
Fe,
|
|
5710
|
+
P
|
|
5669
5711
|
]), /* @__PURE__ */ Q("div", {
|
|
5670
5712
|
class: "markup-root",
|
|
5671
|
-
ref:
|
|
5713
|
+
ref: le,
|
|
5672
5714
|
children: [
|
|
5673
|
-
|
|
5715
|
+
x.kind === "placing" ? null : /* @__PURE__ */ Q("div", {
|
|
5674
5716
|
class: "markup-pins-layer",
|
|
5675
|
-
children: [
|
|
5676
|
-
let n =
|
|
5717
|
+
children: [oe ? null : Le.map(({ thread: e, point: t }) => {
|
|
5718
|
+
let n = x.kind === "thread" && x.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
|
|
5677
5719
|
return /* @__PURE__ */ Q(_o, {
|
|
5678
5720
|
pageX: t.pageX,
|
|
5679
5721
|
pageY: t.pageY,
|
|
5680
5722
|
count: r,
|
|
5681
5723
|
isActive: n,
|
|
5682
5724
|
isUnresolved: !t.resolved,
|
|
5683
|
-
onClick: () =>
|
|
5725
|
+
onClick: () => S({
|
|
5684
5726
|
kind: "thread",
|
|
5685
5727
|
threadId: e._id
|
|
5686
5728
|
})
|
|
5687
5729
|
}, e._id);
|
|
5688
|
-
}),
|
|
5689
|
-
pageX:
|
|
5690
|
-
pageY:
|
|
5730
|
+
}), x.kind === "composing-new" ? /* @__PURE__ */ Q(vo, {
|
|
5731
|
+
pageX: x.pageX,
|
|
5732
|
+
pageY: x.pageY
|
|
5691
5733
|
}) : null]
|
|
5692
5734
|
}),
|
|
5693
|
-
|
|
5694
|
-
onPlace:
|
|
5695
|
-
onCancel:
|
|
5735
|
+
x.kind === "placing" ? /* @__PURE__ */ Q(yo, {
|
|
5736
|
+
onPlace: F,
|
|
5737
|
+
onCancel: P
|
|
5696
5738
|
}) : null,
|
|
5697
|
-
|
|
5698
|
-
thread:
|
|
5699
|
-
authorName:
|
|
5700
|
-
currentClientId:
|
|
5701
|
-
isVerified:
|
|
5702
|
-
isIdentityResolving:
|
|
5703
|
-
isSigningIn:
|
|
5704
|
-
canDelete:
|
|
5705
|
-
isPending:
|
|
5706
|
-
error:
|
|
5707
|
-
isHidden:
|
|
5708
|
-
onAuthor:
|
|
5709
|
-
onSignIn:
|
|
5710
|
-
onClose:
|
|
5711
|
-
onReply:
|
|
5712
|
-
onEditComment:
|
|
5713
|
-
onDeleteComment:
|
|
5714
|
-
onToggleReaction:
|
|
5715
|
-
onDelete:
|
|
5716
|
-
onResolve:
|
|
5717
|
-
},
|
|
5718
|
-
|
|
5719
|
-
pageX:
|
|
5720
|
-
pageY:
|
|
5721
|
-
authorName:
|
|
5722
|
-
isVerified:
|
|
5723
|
-
isIdentityResolving:
|
|
5724
|
-
isSigningIn:
|
|
5725
|
-
isPending:
|
|
5726
|
-
error:
|
|
5727
|
-
screenshot:
|
|
5728
|
-
isScreenshotCapturing:
|
|
5729
|
-
screenshotRedactedCount:
|
|
5730
|
-
screenshotRedactedSelectors:
|
|
5731
|
-
onAuthor:
|
|
5732
|
-
onSignIn:
|
|
5733
|
-
onSubmit:
|
|
5734
|
-
onClose:
|
|
5739
|
+
x.kind === "thread" && Fe ? /* @__PURE__ */ Q(So, {
|
|
5740
|
+
thread: Fe,
|
|
5741
|
+
authorName: ue,
|
|
5742
|
+
currentClientId: pe ?? null,
|
|
5743
|
+
isVerified: de,
|
|
5744
|
+
isIdentityResolving: fe,
|
|
5745
|
+
isSigningIn: I,
|
|
5746
|
+
canDelete: Ie,
|
|
5747
|
+
isPending: ne,
|
|
5748
|
+
error: re,
|
|
5749
|
+
isHidden: oe,
|
|
5750
|
+
onAuthor: be,
|
|
5751
|
+
onSignIn: xe,
|
|
5752
|
+
onClose: P,
|
|
5753
|
+
onReply: L,
|
|
5754
|
+
onEditComment: Te,
|
|
5755
|
+
onDeleteComment: Ee,
|
|
5756
|
+
onToggleReaction: De,
|
|
5757
|
+
onDelete: Ce,
|
|
5758
|
+
onResolve: we
|
|
5759
|
+
}, Fe._id) : null,
|
|
5760
|
+
x.kind === "composing-new" ? /* @__PURE__ */ Q(ho, {
|
|
5761
|
+
pageX: x.pageX,
|
|
5762
|
+
pageY: x.pageY,
|
|
5763
|
+
authorName: ue,
|
|
5764
|
+
isVerified: de,
|
|
5765
|
+
isIdentityResolving: fe,
|
|
5766
|
+
isSigningIn: I,
|
|
5767
|
+
isPending: ne,
|
|
5768
|
+
error: re,
|
|
5769
|
+
screenshot: x.screenshot,
|
|
5770
|
+
isScreenshotCapturing: x.isScreenshotCapturing,
|
|
5771
|
+
screenshotRedactedCount: x.screenshotRedactedCount,
|
|
5772
|
+
screenshotRedactedSelectors: x.screenshotRedactedSelectors,
|
|
5773
|
+
onAuthor: be,
|
|
5774
|
+
onSignIn: xe,
|
|
5775
|
+
onSubmit: Se,
|
|
5776
|
+
onClose: P
|
|
5735
5777
|
}) : null,
|
|
5736
|
-
!
|
|
5737
|
-
isActive:
|
|
5738
|
-
onToggle: () =>
|
|
5739
|
-
onHide: () =>
|
|
5740
|
-
position:
|
|
5741
|
-
onPositionChange:
|
|
5778
|
+
!oe || x.kind === "placing" || x.kind === "composing-new" ? /* @__PURE__ */ Q(oo, {
|
|
5779
|
+
isActive: x.kind === "placing",
|
|
5780
|
+
onToggle: () => x.kind === "placing" ? P() : ve(),
|
|
5781
|
+
onHide: () => ae({ type: "hide-with-toast" }),
|
|
5782
|
+
position: _,
|
|
5783
|
+
onPositionChange: v,
|
|
5742
5784
|
variant: r,
|
|
5743
5785
|
menu: /* @__PURE__ */ Q(so, {
|
|
5744
|
-
identity:
|
|
5745
|
-
position:
|
|
5746
|
-
isSigningIn:
|
|
5747
|
-
|
|
5748
|
-
|
|
5786
|
+
identity: p,
|
|
5787
|
+
position: _,
|
|
5788
|
+
isSigningIn: I,
|
|
5789
|
+
isSigningOut: te,
|
|
5790
|
+
dashboardUrl: a,
|
|
5791
|
+
onSignIn: xe,
|
|
5792
|
+
onSignOut: Pe,
|
|
5793
|
+
onForgetMe: Ae
|
|
5749
5794
|
})
|
|
5750
5795
|
}) : null,
|
|
5751
|
-
|
|
5752
|
-
|
|
5796
|
+
ie.kind === "hidden-with-toast" ? /* @__PURE__ */ Q(Po, { position: _ }) : null,
|
|
5797
|
+
Oe ? /* @__PURE__ */ Q(Fo, { position: _ }) : null,
|
|
5798
|
+
je ? /* @__PURE__ */ Q(Io, { position: _ }) : null
|
|
5753
5799
|
]
|
|
5754
5800
|
});
|
|
5755
5801
|
}
|
|
@@ -5781,62 +5827,71 @@ function Fo({ position: e }) {
|
|
|
5781
5827
|
children: "Forgotten on this site — your name and email were cleared."
|
|
5782
5828
|
});
|
|
5783
5829
|
}
|
|
5830
|
+
function Io({ position: e }) {
|
|
5831
|
+
return /* @__PURE__ */ Q("div", {
|
|
5832
|
+
class: Z("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : e === "bottom-center" ? "markup-hud-hidden-toast-center" : "markup-hud-hidden-toast-right"),
|
|
5833
|
+
role: "status",
|
|
5834
|
+
"aria-live": "polite",
|
|
5835
|
+
children: "Signed out — commenting anonymously again."
|
|
5836
|
+
});
|
|
5837
|
+
}
|
|
5784
5838
|
//#endregion
|
|
5785
5839
|
//#region src/runtime/mount.tsx
|
|
5786
|
-
function
|
|
5840
|
+
function Lo(e, t) {
|
|
5787
5841
|
e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
|
|
5788
5842
|
let n = t.theme ?? "auto";
|
|
5789
5843
|
n !== "auto" && (e.dataset.theme = n);
|
|
5790
5844
|
let r = e.attachShadow({ mode: "open" }), i = document.createElement("style");
|
|
5791
5845
|
i.textContent = de, r.appendChild(i);
|
|
5792
5846
|
let a = document.createElement("div");
|
|
5793
|
-
a.className = "markup-shadow-root", r.appendChild(a),
|
|
5847
|
+
a.className = "markup-shadow-root", r.appendChild(a), ye({
|
|
5794
5848
|
apiUrl: t.apiUrl,
|
|
5795
5849
|
apiKey: t.apiKey,
|
|
5796
|
-
widgetVersion: "1.
|
|
5850
|
+
widgetVersion: "1.13.0"
|
|
5797
5851
|
});
|
|
5798
5852
|
let { theme: o, ...s } = t;
|
|
5799
5853
|
return ue(/* @__PURE__ */ Q(fe, {
|
|
5800
|
-
onError: (e) =>
|
|
5854
|
+
onError: (e) => F(e, { context: "render" }),
|
|
5801
5855
|
children: /* @__PURE__ */ Q(No, { ...s })
|
|
5802
5856
|
}), a), () => {
|
|
5803
|
-
|
|
5857
|
+
ye(null), ue(null, a);
|
|
5804
5858
|
};
|
|
5805
5859
|
}
|
|
5806
5860
|
//#endregion
|
|
5807
5861
|
//#region src/widget.ts
|
|
5808
|
-
var
|
|
5809
|
-
function
|
|
5862
|
+
var Ro = null, zo = null, Bo = null;
|
|
5863
|
+
function Vo(e) {
|
|
5810
5864
|
if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
|
|
5811
|
-
|
|
5865
|
+
Ho();
|
|
5812
5866
|
let t = () => {
|
|
5813
|
-
if (
|
|
5867
|
+
if (Bo = null, !document.body) return;
|
|
5814
5868
|
let t = document.createElement("div");
|
|
5815
|
-
t.id = "markup-widget", document.body.appendChild(t),
|
|
5869
|
+
t.id = "markup-widget", document.body.appendChild(t), zo = t, Ro = Lo(t, e);
|
|
5816
5870
|
};
|
|
5817
5871
|
if (document.readyState === "loading" || !document.body) {
|
|
5818
5872
|
let e = () => t();
|
|
5819
|
-
|
|
5873
|
+
Bo = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
|
|
5820
5874
|
} else t();
|
|
5821
|
-
return
|
|
5875
|
+
return Ho;
|
|
5822
5876
|
}
|
|
5823
|
-
function
|
|
5824
|
-
|
|
5877
|
+
function Ho() {
|
|
5878
|
+
Bo &&= (Bo(), null), Ro &&= (Ro(), null), zo?.parentNode && zo.parentNode.removeChild(zo), zo = null;
|
|
5825
5879
|
}
|
|
5826
5880
|
if (typeof document < "u") {
|
|
5827
5881
|
let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
|
|
5828
5882
|
if (t && n) {
|
|
5829
|
-
let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () =>
|
|
5883
|
+
let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = e?.dataset.dashboardUrl, s = () => Vo({
|
|
5830
5884
|
apiUrl: t,
|
|
5831
5885
|
apiKey: n,
|
|
5832
5886
|
position: r,
|
|
5833
5887
|
theme: i,
|
|
5834
|
-
fab: a
|
|
5888
|
+
fab: a,
|
|
5889
|
+
dashboardUrl: o
|
|
5835
5890
|
});
|
|
5836
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
5891
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", s, { once: !0 }) : s();
|
|
5837
5892
|
}
|
|
5838
5893
|
}
|
|
5839
5894
|
//#endregion
|
|
5840
|
-
export {
|
|
5895
|
+
export { Ho as destroy, Vo as init };
|
|
5841
5896
|
|
|
5842
5897
|
//# sourceMappingURL=widget.js.map
|