@pixelmatters/markup 1.0.1 → 1.1.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 +65 -2
- package/dist/react.js +301 -264
- package/dist/widget.js +298 -261
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -2751,14 +2751,22 @@ function kr(e) {
|
|
|
2751
2751
|
...r.headers ?? {}
|
|
2752
2752
|
}, a = e.getToken?.() ?? null, o = a != null && a.token.length > 0 && a.expiresAt > Date.now();
|
|
2753
2753
|
o && a && (i.authorization = `Bearer ${a.token}`);
|
|
2754
|
-
let s =
|
|
2754
|
+
let s = e.getAnonToken?.() ?? null;
|
|
2755
|
+
s && (i["x-markup-anon-token"] = s);
|
|
2756
|
+
let c = await fetch(`${t}${n}`, {
|
|
2755
2757
|
...r,
|
|
2756
2758
|
headers: i
|
|
2757
|
-
}),
|
|
2758
|
-
if (!
|
|
2759
|
-
return
|
|
2759
|
+
}), l = await c.text(), u = l ? Ar(l) : null;
|
|
2760
|
+
if (!c.ok) throw c.status === 401 && o && e.onUnauthorized?.(), new Or((u && typeof u == "object" && "error" in u && typeof u.error == "string" ? u.error : null) ?? `Request failed with ${c.status}`, c.status);
|
|
2761
|
+
return u;
|
|
2760
2762
|
}
|
|
2761
2763
|
return {
|
|
2764
|
+
mintAnonIdentity() {
|
|
2765
|
+
return n("/widget/anon-identity", { method: "POST" });
|
|
2766
|
+
},
|
|
2767
|
+
getSubscriptionToken() {
|
|
2768
|
+
return n("/widget/subscription-token", { method: "POST" });
|
|
2769
|
+
},
|
|
2762
2770
|
getScreenshotUploadUrl() {
|
|
2763
2771
|
return n("/widget/screenshots/upload-url", { method: "POST" });
|
|
2764
2772
|
},
|
|
@@ -2792,11 +2800,8 @@ function kr(e) {
|
|
|
2792
2800
|
body: JSON.stringify(r)
|
|
2793
2801
|
});
|
|
2794
2802
|
},
|
|
2795
|
-
deleteComment(e, t
|
|
2796
|
-
return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, {
|
|
2797
|
-
method: "DELETE",
|
|
2798
|
-
body: JSON.stringify(r)
|
|
2799
|
-
});
|
|
2803
|
+
deleteComment(e, t) {
|
|
2804
|
+
return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, { method: "DELETE" });
|
|
2800
2805
|
},
|
|
2801
2806
|
toggleReaction(e, t) {
|
|
2802
2807
|
return n(`/widget/comments/${encodeURIComponent(e)}/reactions`, {
|
|
@@ -2831,20 +2836,26 @@ function Nr(e) {
|
|
|
2831
2836
|
localStorage.setItem(jr, JSON.stringify(e));
|
|
2832
2837
|
} catch {}
|
|
2833
2838
|
}
|
|
2834
|
-
function Pr() {
|
|
2835
|
-
let e = crypto;
|
|
2836
|
-
if ("randomUUID" in e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
2837
|
-
let t = new Uint8Array(16);
|
|
2838
|
-
e.getRandomValues(t), t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
2839
|
-
let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
2840
|
-
return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
|
|
2841
|
-
}
|
|
2842
2839
|
//#endregion
|
|
2843
2840
|
//#region src/runtime/popup-auth.ts
|
|
2844
|
-
function
|
|
2845
|
-
let n = new URL(e).origin, r
|
|
2846
|
-
|
|
2847
|
-
|
|
2841
|
+
async function Pr(e, t) {
|
|
2842
|
+
let n = new URL(e).origin, r;
|
|
2843
|
+
try {
|
|
2844
|
+
let n = await fetch(`${e.replace(/\/+$/, "")}/widget/popup-exchange`, {
|
|
2845
|
+
method: "POST",
|
|
2846
|
+
headers: {
|
|
2847
|
+
"content-type": "application/json",
|
|
2848
|
+
"x-markup-api-key": t
|
|
2849
|
+
},
|
|
2850
|
+
body: "{}"
|
|
2851
|
+
});
|
|
2852
|
+
if (!n.ok) throw Error(`popup-exchange responded with ${n.status}`);
|
|
2853
|
+
let { code: i } = await n.json(), a = new URL("/widget/auth", e);
|
|
2854
|
+
a.searchParams.set("code", i), r = a.toString();
|
|
2855
|
+
} catch (e) {
|
|
2856
|
+
return Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
|
|
2857
|
+
}
|
|
2858
|
+
let i = Math.max(0, window.screenX + (window.outerWidth - 420) / 2), a = Math.max(0, window.screenY + (window.outerHeight - 560) / 2), o = window.open(r, "markup-auth", `width=420,height=560,left=${i},top=${a}`);
|
|
2848
2859
|
return o ? new Promise((e, t) => {
|
|
2849
2860
|
function r() {
|
|
2850
2861
|
window.removeEventListener("message", i), clearInterval(a);
|
|
@@ -2866,14 +2877,14 @@ function Fr(e, t) {
|
|
|
2866
2877
|
}
|
|
2867
2878
|
//#endregion
|
|
2868
2879
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js
|
|
2869
|
-
function
|
|
2880
|
+
function Fr(e, t) {
|
|
2870
2881
|
if (e.match(/^[a-z]+:\/\//i)) return e;
|
|
2871
2882
|
if (e.match(/^\/\//)) return window.location.protocol + e;
|
|
2872
2883
|
if (e.match(/^[a-z]+:/i)) return e;
|
|
2873
2884
|
let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
|
|
2874
2885
|
return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
|
|
2875
2886
|
}
|
|
2876
|
-
var
|
|
2887
|
+
var Ir = (() => {
|
|
2877
2888
|
let e = 0, t = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
|
|
2878
2889
|
return () => (e += 1, `u${t()}${e}`);
|
|
2879
2890
|
})();
|
|
@@ -2882,29 +2893,29 @@ function Y(e) {
|
|
|
2882
2893
|
for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
|
|
2883
2894
|
return t;
|
|
2884
2895
|
}
|
|
2885
|
-
var
|
|
2886
|
-
function
|
|
2887
|
-
return
|
|
2896
|
+
var Lr = null;
|
|
2897
|
+
function Rr(e = {}) {
|
|
2898
|
+
return Lr || (e.includeStyleProperties ? (Lr = e.includeStyleProperties, Lr) : (Lr = Y(window.getComputedStyle(document.documentElement)), Lr));
|
|
2888
2899
|
}
|
|
2889
|
-
function
|
|
2900
|
+
function zr(e, t) {
|
|
2890
2901
|
let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
|
|
2891
2902
|
return n ? parseFloat(n.replace("px", "")) : 0;
|
|
2892
2903
|
}
|
|
2893
|
-
function
|
|
2894
|
-
let t =
|
|
2904
|
+
function Br(e) {
|
|
2905
|
+
let t = zr(e, "border-left-width"), n = zr(e, "border-right-width");
|
|
2895
2906
|
return e.clientWidth + t + n;
|
|
2896
2907
|
}
|
|
2897
|
-
function
|
|
2898
|
-
let t =
|
|
2908
|
+
function Vr(e) {
|
|
2909
|
+
let t = zr(e, "border-top-width"), n = zr(e, "border-bottom-width");
|
|
2899
2910
|
return e.clientHeight + t + n;
|
|
2900
2911
|
}
|
|
2901
|
-
function
|
|
2912
|
+
function Hr(e, t = {}) {
|
|
2902
2913
|
return {
|
|
2903
|
-
width: t.width ||
|
|
2904
|
-
height: t.height ||
|
|
2914
|
+
width: t.width || Br(e),
|
|
2915
|
+
height: t.height || Vr(e)
|
|
2905
2916
|
};
|
|
2906
2917
|
}
|
|
2907
|
-
function
|
|
2918
|
+
function Ur() {
|
|
2908
2919
|
let e, t;
|
|
2909
2920
|
try {
|
|
2910
2921
|
t = process;
|
|
@@ -2913,10 +2924,10 @@ function Wr() {
|
|
|
2913
2924
|
return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
|
|
2914
2925
|
}
|
|
2915
2926
|
var X = 16384;
|
|
2916
|
-
function
|
|
2927
|
+
function Wr(e) {
|
|
2917
2928
|
(e.width > X || e.height > X) && (e.width > X && e.height > X ? e.width > e.height ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X) : e.width > X ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X));
|
|
2918
2929
|
}
|
|
2919
|
-
function
|
|
2930
|
+
function Gr(e) {
|
|
2920
2931
|
return new Promise((t, n) => {
|
|
2921
2932
|
let r = new Image();
|
|
2922
2933
|
r.onload = () => {
|
|
@@ -2926,12 +2937,12 @@ function Kr(e) {
|
|
|
2926
2937
|
}, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
|
|
2927
2938
|
});
|
|
2928
2939
|
}
|
|
2929
|
-
async function
|
|
2940
|
+
async function Kr(e) {
|
|
2930
2941
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
2931
2942
|
}
|
|
2932
|
-
async function
|
|
2943
|
+
async function qr(e, t, n) {
|
|
2933
2944
|
let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
|
|
2934
|
-
return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e),
|
|
2945
|
+
return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), Kr(i);
|
|
2935
2946
|
}
|
|
2936
2947
|
var Z = (e, t) => {
|
|
2937
2948
|
if (e instanceof t) return !0;
|
|
@@ -2940,66 +2951,66 @@ var Z = (e, t) => {
|
|
|
2940
2951
|
};
|
|
2941
2952
|
//#endregion
|
|
2942
2953
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js
|
|
2943
|
-
function
|
|
2954
|
+
function Jr(e) {
|
|
2944
2955
|
let t = e.getPropertyValue("content");
|
|
2945
2956
|
return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
2946
2957
|
}
|
|
2947
|
-
function
|
|
2948
|
-
return
|
|
2958
|
+
function Yr(e, t) {
|
|
2959
|
+
return Rr(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
|
|
2949
2960
|
}
|
|
2950
|
-
function
|
|
2951
|
-
let i = `.${e}:${t}`, a = n.cssText ?
|
|
2961
|
+
function Xr(e, t, n, r) {
|
|
2962
|
+
let i = `.${e}:${t}`, a = n.cssText ? Jr(n) : Yr(n, r);
|
|
2952
2963
|
return document.createTextNode(`${i}{${a}}`);
|
|
2953
2964
|
}
|
|
2954
|
-
function
|
|
2965
|
+
function Zr(e, t, n, r) {
|
|
2955
2966
|
let i = window.getComputedStyle(e, n), a = i.getPropertyValue("content");
|
|
2956
2967
|
if (a === "" || a === "none") return;
|
|
2957
|
-
let o =
|
|
2968
|
+
let o = Ir();
|
|
2958
2969
|
try {
|
|
2959
2970
|
t.className = `${t.className} ${o}`;
|
|
2960
2971
|
} catch {
|
|
2961
2972
|
return;
|
|
2962
2973
|
}
|
|
2963
2974
|
let s = document.createElement("style");
|
|
2964
|
-
s.appendChild(
|
|
2975
|
+
s.appendChild(Xr(o, n, i, r)), t.appendChild(s);
|
|
2965
2976
|
}
|
|
2966
|
-
function
|
|
2967
|
-
|
|
2977
|
+
function Qr(e, t, n) {
|
|
2978
|
+
Zr(e, t, ":before", n), Zr(e, t, ":after", n);
|
|
2968
2979
|
}
|
|
2969
2980
|
//#endregion
|
|
2970
2981
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js
|
|
2971
|
-
var
|
|
2972
|
-
woff:
|
|
2973
|
-
woff2:
|
|
2982
|
+
var $r = "application/font-woff", ei = "image/jpeg", ti = {
|
|
2983
|
+
woff: $r,
|
|
2984
|
+
woff2: $r,
|
|
2974
2985
|
ttf: "application/font-truetype",
|
|
2975
2986
|
eot: "application/vnd.ms-fontobject",
|
|
2976
2987
|
png: "image/png",
|
|
2977
|
-
jpg:
|
|
2978
|
-
jpeg:
|
|
2988
|
+
jpg: ei,
|
|
2989
|
+
jpeg: ei,
|
|
2979
2990
|
gif: "image/gif",
|
|
2980
2991
|
tiff: "image/tiff",
|
|
2981
2992
|
svg: "image/svg+xml",
|
|
2982
2993
|
webp: "image/webp"
|
|
2983
2994
|
};
|
|
2984
|
-
function
|
|
2995
|
+
function ni(e) {
|
|
2985
2996
|
let t = /\.([^./]*?)$/g.exec(e);
|
|
2986
2997
|
return t ? t[1] : "";
|
|
2987
2998
|
}
|
|
2988
|
-
function
|
|
2989
|
-
return ni
|
|
2999
|
+
function ri(e) {
|
|
3000
|
+
return ti[ni(e).toLowerCase()] || "";
|
|
2990
3001
|
}
|
|
2991
3002
|
//#endregion
|
|
2992
3003
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js
|
|
2993
|
-
function
|
|
3004
|
+
function ii(e) {
|
|
2994
3005
|
return e.split(/,/)[1];
|
|
2995
3006
|
}
|
|
2996
|
-
function
|
|
3007
|
+
function ai(e) {
|
|
2997
3008
|
return e.search(/^(data:)/) !== -1;
|
|
2998
3009
|
}
|
|
2999
|
-
function
|
|
3010
|
+
function oi(e, t) {
|
|
3000
3011
|
return `data:${t};base64,${e}`;
|
|
3001
3012
|
}
|
|
3002
|
-
async function
|
|
3013
|
+
async function si(e, t, n) {
|
|
3003
3014
|
let r = await fetch(e, t);
|
|
3004
3015
|
if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
|
|
3005
3016
|
let i = await r.blob();
|
|
@@ -3017,78 +3028,78 @@ async function ci(e, t, n) {
|
|
|
3017
3028
|
}, a.readAsDataURL(i);
|
|
3018
3029
|
});
|
|
3019
3030
|
}
|
|
3020
|
-
var
|
|
3021
|
-
function
|
|
3031
|
+
var ci = {};
|
|
3032
|
+
function li(e, t, n) {
|
|
3022
3033
|
let r = e.replace(/\?.*/, "");
|
|
3023
3034
|
return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
3024
3035
|
}
|
|
3025
|
-
async function
|
|
3026
|
-
let r =
|
|
3027
|
-
if (
|
|
3036
|
+
async function ui(e, t, n) {
|
|
3037
|
+
let r = li(e, t, n.includeQueryParams);
|
|
3038
|
+
if (ci[r] != null) return ci[r];
|
|
3028
3039
|
n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
3029
3040
|
let i;
|
|
3030
3041
|
try {
|
|
3031
|
-
i =
|
|
3042
|
+
i = oi(await si(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", ii(n))), t);
|
|
3032
3043
|
} catch (t) {
|
|
3033
3044
|
i = n.imagePlaceholder || "";
|
|
3034
3045
|
let r = `Failed to fetch resource: ${e}`;
|
|
3035
3046
|
t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
|
|
3036
3047
|
}
|
|
3037
|
-
return
|
|
3048
|
+
return ci[r] = i, i;
|
|
3038
3049
|
}
|
|
3039
3050
|
//#endregion
|
|
3040
3051
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js
|
|
3041
|
-
async function
|
|
3052
|
+
async function di(e) {
|
|
3042
3053
|
let t = e.toDataURL();
|
|
3043
|
-
return t === "data:," ? e.cloneNode(!1) :
|
|
3054
|
+
return t === "data:," ? e.cloneNode(!1) : Gr(t);
|
|
3044
3055
|
}
|
|
3045
|
-
async function
|
|
3056
|
+
async function fi(e, t) {
|
|
3046
3057
|
if (e.currentSrc) {
|
|
3047
3058
|
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
3048
|
-
return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height),
|
|
3059
|
+
return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), Gr(t.toDataURL());
|
|
3049
3060
|
}
|
|
3050
3061
|
let n = e.poster;
|
|
3051
|
-
return
|
|
3062
|
+
return Gr(await ui(n, ri(n), t));
|
|
3052
3063
|
}
|
|
3053
|
-
async function
|
|
3064
|
+
async function pi(e, t) {
|
|
3054
3065
|
try {
|
|
3055
|
-
if (e?.contentDocument?.body) return await
|
|
3066
|
+
if (e?.contentDocument?.body) return await Ci(e.contentDocument.body, t, !0);
|
|
3056
3067
|
} catch {}
|
|
3057
3068
|
return e.cloneNode(!1);
|
|
3058
3069
|
}
|
|
3059
|
-
async function
|
|
3060
|
-
return Z(e, HTMLCanvasElement) ?
|
|
3070
|
+
async function mi(e, t) {
|
|
3071
|
+
return Z(e, HTMLCanvasElement) ? di(e) : Z(e, HTMLVideoElement) ? fi(e, t) : Z(e, HTMLIFrameElement) ? pi(e, t) : e.cloneNode(gi(e));
|
|
3061
3072
|
}
|
|
3062
|
-
var
|
|
3063
|
-
async function
|
|
3064
|
-
if (
|
|
3073
|
+
var hi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", gi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
|
|
3074
|
+
async function _i(e, t, n) {
|
|
3075
|
+
if (gi(t)) return t;
|
|
3065
3076
|
let r = [];
|
|
3066
|
-
return r =
|
|
3077
|
+
return r = hi(e) && e.assignedNodes ? Y(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? Y(e.contentDocument.body.childNodes) : Y((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => Ci(r, n)).then((e) => {
|
|
3067
3078
|
e && t.appendChild(e);
|
|
3068
3079
|
}), Promise.resolve()), t;
|
|
3069
3080
|
}
|
|
3070
|
-
function
|
|
3081
|
+
function vi(e, t, n) {
|
|
3071
3082
|
let r = t.style;
|
|
3072
3083
|
if (!r) return;
|
|
3073
3084
|
let i = window.getComputedStyle(e);
|
|
3074
|
-
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) :
|
|
3085
|
+
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : Rr(n).forEach((n) => {
|
|
3075
3086
|
let a = i.getPropertyValue(n);
|
|
3076
3087
|
n === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - .1}px`), Z(e, HTMLIFrameElement) && n === "display" && a === "inline" && (a = "block"), n === "d" && t.getAttribute("d") && (a = `path(${t.getAttribute("d")})`), r.setProperty(n, a, i.getPropertyPriority(n));
|
|
3077
3088
|
});
|
|
3078
3089
|
}
|
|
3079
|
-
function
|
|
3090
|
+
function yi(e, t) {
|
|
3080
3091
|
Z(e, HTMLTextAreaElement) && (t.innerHTML = e.value), Z(e, HTMLInputElement) && t.setAttribute("value", e.value);
|
|
3081
3092
|
}
|
|
3082
|
-
function
|
|
3093
|
+
function bi(e, t) {
|
|
3083
3094
|
if (Z(e, HTMLSelectElement)) {
|
|
3084
3095
|
let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
|
|
3085
3096
|
r && r.setAttribute("selected", "");
|
|
3086
3097
|
}
|
|
3087
3098
|
}
|
|
3088
|
-
function
|
|
3089
|
-
return Z(t, Element) && (
|
|
3099
|
+
function xi(e, t, n) {
|
|
3100
|
+
return Z(t, Element) && (vi(e, t, n), Qr(e, t, n), yi(e, t), bi(e, t)), t;
|
|
3090
3101
|
}
|
|
3091
|
-
async function
|
|
3102
|
+
async function Si(e, t) {
|
|
3092
3103
|
let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
|
|
3093
3104
|
if (n.length === 0) return e;
|
|
3094
3105
|
let r = {};
|
|
@@ -3096,7 +3107,7 @@ async function Ci(e, t) {
|
|
|
3096
3107
|
let a = n[i].getAttribute("xlink:href");
|
|
3097
3108
|
if (a) {
|
|
3098
3109
|
let n = e.querySelector(a), i = document.querySelector(a);
|
|
3099
|
-
!n && i && !r[a] && (r[a] = await
|
|
3110
|
+
!n && i && !r[a] && (r[a] = await Ci(i, t, !0));
|
|
3100
3111
|
}
|
|
3101
3112
|
}
|
|
3102
3113
|
let i = Object.values(r);
|
|
@@ -3110,61 +3121,61 @@ async function Ci(e, t) {
|
|
|
3110
3121
|
}
|
|
3111
3122
|
return e;
|
|
3112
3123
|
}
|
|
3113
|
-
async function
|
|
3114
|
-
return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) =>
|
|
3124
|
+
async function Ci(e, t, n) {
|
|
3125
|
+
return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => mi(e, t)).then((n) => _i(e, n, t)).then((n) => xi(e, n, t)).then((e) => Si(e, t));
|
|
3115
3126
|
}
|
|
3116
3127
|
//#endregion
|
|
3117
3128
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js
|
|
3118
|
-
var
|
|
3119
|
-
function
|
|
3129
|
+
var wi = /url\((['"]?)([^'"]+?)\1\)/g, Ti = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Ei = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
3130
|
+
function Di(e) {
|
|
3120
3131
|
let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
3121
3132
|
return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
3122
3133
|
}
|
|
3123
|
-
function
|
|
3134
|
+
function Oi(e) {
|
|
3124
3135
|
let t = [];
|
|
3125
|
-
return e.replace(
|
|
3136
|
+
return e.replace(wi, (e, n, r) => (t.push(r), e)), t.filter((e) => !ai(e));
|
|
3126
3137
|
}
|
|
3127
|
-
async function
|
|
3138
|
+
async function ki(e, t, n, r, i) {
|
|
3128
3139
|
try {
|
|
3129
|
-
let a = n ?
|
|
3130
|
-
return s = i ?
|
|
3140
|
+
let a = n ? Fr(t, n) : t, o = ri(t), s;
|
|
3141
|
+
return s = i ? oi(await i(a), o) : await ui(a, o, r), e.replace(Di(t), `$1${s}$3`);
|
|
3131
3142
|
} catch {}
|
|
3132
3143
|
return e;
|
|
3133
3144
|
}
|
|
3134
|
-
function
|
|
3135
|
-
return t ? e.replace(
|
|
3145
|
+
function Ai(e, { preferredFontFormat: t }) {
|
|
3146
|
+
return t ? e.replace(Ei, (e) => {
|
|
3136
3147
|
for (;;) {
|
|
3137
|
-
let [n, , r] =
|
|
3148
|
+
let [n, , r] = Ti.exec(e) || [];
|
|
3138
3149
|
if (!r) return "";
|
|
3139
3150
|
if (r === t) return `src: ${n};`;
|
|
3140
3151
|
}
|
|
3141
3152
|
}) : e;
|
|
3142
3153
|
}
|
|
3143
|
-
function
|
|
3144
|
-
return e.search(
|
|
3154
|
+
function ji(e) {
|
|
3155
|
+
return e.search(wi) !== -1;
|
|
3145
3156
|
}
|
|
3146
|
-
async function
|
|
3147
|
-
if (!
|
|
3148
|
-
let r =
|
|
3149
|
-
return
|
|
3157
|
+
async function Mi(e, t, n) {
|
|
3158
|
+
if (!ji(e)) return e;
|
|
3159
|
+
let r = Ai(e, n);
|
|
3160
|
+
return Oi(r).reduce((e, r) => e.then((e) => ki(e, r, t, n)), Promise.resolve(r));
|
|
3150
3161
|
}
|
|
3151
3162
|
//#endregion
|
|
3152
3163
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js
|
|
3153
|
-
async function
|
|
3164
|
+
async function Ni(e, t, n) {
|
|
3154
3165
|
let r = t.style?.getPropertyValue(e);
|
|
3155
3166
|
if (r) {
|
|
3156
|
-
let i = await
|
|
3167
|
+
let i = await Mi(r, null, n);
|
|
3157
3168
|
return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
|
|
3158
3169
|
}
|
|
3159
3170
|
return !1;
|
|
3160
3171
|
}
|
|
3161
|
-
async function
|
|
3162
|
-
await
|
|
3172
|
+
async function Pi(e, t) {
|
|
3173
|
+
await Ni("background", e, t) || await Ni("background-image", e, t), await Ni("mask", e, t) || await Ni("-webkit-mask", e, t) || await Ni("mask-image", e, t) || await Ni("-webkit-mask-image", e, t);
|
|
3163
3174
|
}
|
|
3164
|
-
async function
|
|
3175
|
+
async function Fi(e, t) {
|
|
3165
3176
|
let n = Z(e, HTMLImageElement);
|
|
3166
|
-
if (!(n && !
|
|
3167
|
-
let r = n ? e.src : e.href.baseVal, i = await
|
|
3177
|
+
if (!(n && !ai(e.src)) && !(Z(e, SVGImageElement) && !ai(e.href.baseVal))) return;
|
|
3178
|
+
let r = n ? e.src : e.href.baseVal, i = await ui(r, ri(r), t);
|
|
3168
3179
|
await new Promise((r, a) => {
|
|
3169
3180
|
e.onload = r, e.onerror = t.onImageErrorHandler ? (...e) => {
|
|
3170
3181
|
try {
|
|
@@ -3177,16 +3188,16 @@ async function Ii(e, t) {
|
|
|
3177
3188
|
o.decode &&= r, o.loading === "lazy" && (o.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
|
|
3178
3189
|
});
|
|
3179
3190
|
}
|
|
3180
|
-
async function
|
|
3181
|
-
let n = Y(e.childNodes).map((e) =>
|
|
3191
|
+
async function Ii(e, t) {
|
|
3192
|
+
let n = Y(e.childNodes).map((e) => Li(e, t));
|
|
3182
3193
|
await Promise.all(n).then(() => e);
|
|
3183
3194
|
}
|
|
3184
|
-
async function
|
|
3185
|
-
Z(e, Element) && (await
|
|
3195
|
+
async function Li(e, t) {
|
|
3196
|
+
Z(e, Element) && (await Pi(e, t), await Fi(e, t), await Ii(e, t));
|
|
3186
3197
|
}
|
|
3187
3198
|
//#endregion
|
|
3188
3199
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js
|
|
3189
|
-
function
|
|
3200
|
+
function Ri(e, t) {
|
|
3190
3201
|
let { style: n } = e;
|
|
3191
3202
|
t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
|
|
3192
3203
|
let r = t.style;
|
|
@@ -3196,22 +3207,22 @@ function zi(e, t) {
|
|
|
3196
3207
|
}
|
|
3197
3208
|
//#endregion
|
|
3198
3209
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js
|
|
3199
|
-
var
|
|
3200
|
-
async function
|
|
3201
|
-
let t =
|
|
3210
|
+
var zi = {};
|
|
3211
|
+
async function Bi(e) {
|
|
3212
|
+
let t = zi[e];
|
|
3202
3213
|
return t ?? (t = {
|
|
3203
3214
|
url: e,
|
|
3204
3215
|
cssText: await (await fetch(e)).text()
|
|
3205
|
-
},
|
|
3216
|
+
}, zi[e] = t, t);
|
|
3206
3217
|
}
|
|
3207
|
-
async function
|
|
3218
|
+
async function Vi(e, t) {
|
|
3208
3219
|
let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
|
|
3209
3220
|
let a = i.replace(r, "$1");
|
|
3210
|
-
return a.startsWith("https://") || (a = new URL(a, e.url).href),
|
|
3221
|
+
return a.startsWith("https://") || (a = new URL(a, e.url).href), si(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
|
|
3211
3222
|
});
|
|
3212
3223
|
return Promise.all(i).then(() => n);
|
|
3213
3224
|
}
|
|
3214
|
-
function
|
|
3225
|
+
function Hi(e) {
|
|
3215
3226
|
if (e == null) return [];
|
|
3216
3227
|
let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
3217
3228
|
for (;;) {
|
|
@@ -3231,13 +3242,13 @@ function Ui(e) {
|
|
|
3231
3242
|
}
|
|
3232
3243
|
return t;
|
|
3233
3244
|
}
|
|
3234
|
-
async function
|
|
3245
|
+
async function Ui(e, t) {
|
|
3235
3246
|
let n = [], r = [];
|
|
3236
3247
|
return e.forEach((n) => {
|
|
3237
3248
|
if ("cssRules" in n) try {
|
|
3238
3249
|
Y(n.cssRules || []).forEach((e, i) => {
|
|
3239
3250
|
if (e.type === CSSRule.IMPORT_RULE) {
|
|
3240
|
-
let a = i + 1, o = e.href, s =
|
|
3251
|
+
let a = i + 1, o = e.href, s = Bi(o).then((e) => Vi(e, t)).then((e) => Hi(e).forEach((e) => {
|
|
3241
3252
|
try {
|
|
3242
3253
|
n.insertRule(e, e.startsWith("@import") ? a += 1 : n.cssRules.length);
|
|
3243
3254
|
} catch (t) {
|
|
@@ -3254,7 +3265,7 @@ async function Wi(e, t) {
|
|
|
3254
3265
|
});
|
|
3255
3266
|
} catch (i) {
|
|
3256
3267
|
let a = e.find((e) => e.href == null) || document.styleSheets[0];
|
|
3257
|
-
n.href != null && r.push(
|
|
3268
|
+
n.href != null && r.push(Bi(n.href).then((e) => Vi(e, t)).then((e) => Hi(e).forEach((e) => {
|
|
3258
3269
|
a.insertRule(e, a.cssRules.length);
|
|
3259
3270
|
})).catch((e) => {
|
|
3260
3271
|
console.error("Error loading remote stylesheet", e);
|
|
@@ -3270,36 +3281,36 @@ async function Wi(e, t) {
|
|
|
3270
3281
|
}
|
|
3271
3282
|
}), n));
|
|
3272
3283
|
}
|
|
3273
|
-
function
|
|
3274
|
-
return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
3284
|
+
function Wi(e) {
|
|
3285
|
+
return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ji(e.style.getPropertyValue("src")));
|
|
3275
3286
|
}
|
|
3276
|
-
async function
|
|
3287
|
+
async function Gi(e, t) {
|
|
3277
3288
|
if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
|
|
3278
|
-
return
|
|
3289
|
+
return Wi(await Ui(Y(e.ownerDocument.styleSheets), t));
|
|
3279
3290
|
}
|
|
3280
|
-
function
|
|
3291
|
+
function Ki(e) {
|
|
3281
3292
|
return e.trim().replace(/["']/g, "");
|
|
3282
3293
|
}
|
|
3283
|
-
function
|
|
3294
|
+
function qi(e) {
|
|
3284
3295
|
let t = /* @__PURE__ */ new Set();
|
|
3285
3296
|
function n(e) {
|
|
3286
3297
|
(e.style.fontFamily || getComputedStyle(e).fontFamily).split(",").forEach((e) => {
|
|
3287
|
-
t.add(
|
|
3298
|
+
t.add(Ki(e));
|
|
3288
3299
|
}), Array.from(e.children).forEach((e) => {
|
|
3289
3300
|
e instanceof HTMLElement && n(e);
|
|
3290
3301
|
});
|
|
3291
3302
|
}
|
|
3292
3303
|
return n(e), t;
|
|
3293
3304
|
}
|
|
3294
|
-
async function
|
|
3295
|
-
let n = await
|
|
3296
|
-
return (await Promise.all(n.filter((e) => r.has(
|
|
3305
|
+
async function Ji(e, t) {
|
|
3306
|
+
let n = await Gi(e, t), r = qi(e);
|
|
3307
|
+
return (await Promise.all(n.filter((e) => r.has(Ki(e.style.fontFamily))).map((e) => {
|
|
3297
3308
|
let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
|
|
3298
|
-
return
|
|
3309
|
+
return Mi(e.cssText, n, t);
|
|
3299
3310
|
}))).join("\n");
|
|
3300
3311
|
}
|
|
3301
|
-
async function
|
|
3302
|
-
let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await
|
|
3312
|
+
async function Yi(e, t) {
|
|
3313
|
+
let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await Ji(e, t) : t.fontEmbedCSS;
|
|
3303
3314
|
if (n) {
|
|
3304
3315
|
let t = document.createElement("style"), r = document.createTextNode(n);
|
|
3305
3316
|
t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
|
|
@@ -3307,23 +3318,23 @@ async function Xi(e, t) {
|
|
|
3307
3318
|
}
|
|
3308
3319
|
//#endregion
|
|
3309
3320
|
//#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js
|
|
3310
|
-
async function
|
|
3311
|
-
let { width: n, height: r } =
|
|
3312
|
-
return await
|
|
3321
|
+
async function Xi(e, t = {}) {
|
|
3322
|
+
let { width: n, height: r } = Hr(e, t), i = await Ci(e, t, !0);
|
|
3323
|
+
return await Yi(i, t), await Li(i, t), Ri(i, t), await qr(i, n, r);
|
|
3313
3324
|
}
|
|
3314
|
-
async function
|
|
3315
|
-
let { width: n, height: r } =
|
|
3316
|
-
return a.width = c * s, a.height = l * s, t.skipAutoScale ||
|
|
3325
|
+
async function Zi(e, t = {}) {
|
|
3326
|
+
let { width: n, height: r } = Hr(e, t), i = await Gr(await Xi(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || Ur(), c = t.canvasWidth || n, l = t.canvasHeight || r;
|
|
3327
|
+
return a.width = c * s, a.height = l * s, t.skipAutoScale || Wr(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
|
|
3317
3328
|
}
|
|
3318
3329
|
//#endregion
|
|
3319
3330
|
//#region src/runtime/screenshot.ts
|
|
3320
|
-
var
|
|
3321
|
-
async function
|
|
3331
|
+
var Qi = 2 * 1024 * 1024;
|
|
3332
|
+
async function $i(e, t) {
|
|
3322
3333
|
try {
|
|
3323
3334
|
function n(t) {
|
|
3324
3335
|
return !(e && (t === e || e.contains(t)));
|
|
3325
3336
|
}
|
|
3326
|
-
let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = await
|
|
3337
|
+
let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = await Zi(document.documentElement, {
|
|
3327
3338
|
width: r,
|
|
3328
3339
|
height: i,
|
|
3329
3340
|
cacheBust: !0,
|
|
@@ -3337,21 +3348,21 @@ async function ea(e, t) {
|
|
|
3337
3348
|
});
|
|
3338
3349
|
if (t) {
|
|
3339
3350
|
let e = o.getContext("2d");
|
|
3340
|
-
e &&
|
|
3351
|
+
e && ta(e, t.x, t.y, a);
|
|
3341
3352
|
}
|
|
3342
|
-
let s = await
|
|
3353
|
+
let s = await ea(o, .85);
|
|
3343
3354
|
if (!s) return null;
|
|
3344
|
-
if (s.size <=
|
|
3345
|
-
let c = await
|
|
3346
|
-
return !c || c.size >
|
|
3355
|
+
if (s.size <= Qi) return s;
|
|
3356
|
+
let c = await ea(o, .5);
|
|
3357
|
+
return !c || c.size > Qi ? null : c;
|
|
3347
3358
|
} catch {
|
|
3348
3359
|
return null;
|
|
3349
3360
|
}
|
|
3350
3361
|
}
|
|
3351
|
-
function
|
|
3362
|
+
function ea(e, t) {
|
|
3352
3363
|
return new Promise((n) => e.toBlob(n, "image/jpeg", t));
|
|
3353
3364
|
}
|
|
3354
|
-
function
|
|
3365
|
+
function ta(e, t, n, r) {
|
|
3355
3366
|
let i = r, a = 28 * i, o = a / 2, s = t * i, c = n * i;
|
|
3356
3367
|
e.save(), e.translate(s, c), e.rotate(-Math.PI / 4);
|
|
3357
3368
|
let l = 2 * i;
|
|
@@ -3374,7 +3385,7 @@ function Q(...e) {
|
|
|
3374
3385
|
}
|
|
3375
3386
|
//#endregion
|
|
3376
3387
|
//#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
3377
|
-
var
|
|
3388
|
+
var na = 0;
|
|
3378
3389
|
Array.isArray;
|
|
3379
3390
|
function $(e, n, r, i, a, o) {
|
|
3380
3391
|
n ||= {};
|
|
@@ -3391,7 +3402,7 @@ function $(e, n, r, i, a, o) {
|
|
|
3391
3402
|
__e: null,
|
|
3392
3403
|
__c: null,
|
|
3393
3404
|
constructor: void 0,
|
|
3394
|
-
__v: --
|
|
3405
|
+
__v: --na,
|
|
3395
3406
|
__i: -1,
|
|
3396
3407
|
__u: 0,
|
|
3397
3408
|
__source: a,
|
|
@@ -3402,7 +3413,7 @@ function $(e, n, r, i, a, o) {
|
|
|
3402
3413
|
}
|
|
3403
3414
|
//#endregion
|
|
3404
3415
|
//#region src/runtime/ui/icons.tsx
|
|
3405
|
-
function
|
|
3416
|
+
function ra({ size: e = 16 }) {
|
|
3406
3417
|
return /* @__PURE__ */ $("svg", {
|
|
3407
3418
|
width: e,
|
|
3408
3419
|
height: e,
|
|
@@ -3412,7 +3423,7 @@ function ia({ size: e = 16 }) {
|
|
|
3412
3423
|
children: /* @__PURE__ */ $("path", { d: "M63.4561 0.00557731C70.6277 -0.0175584 76.9025 1.04088 83.5898 3.71066C97.7952 9.43043 109.186 20.5001 115.311 34.5359C119.708 44.8002 120.746 54.7869 119.156 65.8171C116.857 82.7956 105.129 98.8382 90.0566 106.846C83.4394 110.362 74.7336 113.029 67.2051 113.271C62.4204 113.425 61.1274 113.32 56.6807 115.204C50.2035 117.858 43.6874 120.417 37.1348 122.879C34.8442 123.763 32.3203 124.902 29.9404 125.51C29.4023 125.648 28.1978 125.009 27.7598 124.646C26.9046 123.951 27.0582 122.505 27.0264 121.484C26.8123 114.646 27.3302 107.458 26.8604 100.656C25.1578 98.6714 22.4026 96.603 20.3086 94.1989C12.1853 84.8731 7.05334 73.9949 6.18164 61.6101C4.95583 46.292 9.97176 31.1285 20.0908 19.5632C29.989 8.13202 44.0369 1.11921 59.1221 0.0788195C60.2694 -0.0356049 62.2637 0.00944821 63.4561 0.00557731ZM92.2676 55.7497C91.5754 39.5314 77.8207 26.9725 61.6064 27.7536C45.5175 28.5287 33.0758 42.1537 33.7627 58.2468C34.4496 74.3398 48.007 86.8553 64.1035 86.2566C80.3254 85.6533 92.9599 71.968 92.2676 55.7497Z" })
|
|
3413
3424
|
});
|
|
3414
3425
|
}
|
|
3415
|
-
function
|
|
3426
|
+
function ia({ size: e = 16 }) {
|
|
3416
3427
|
return /* @__PURE__ */ $("svg", {
|
|
3417
3428
|
width: e,
|
|
3418
3429
|
height: e,
|
|
@@ -3421,7 +3432,7 @@ function aa({ size: e = 16 }) {
|
|
|
3421
3432
|
children: /* @__PURE__ */ $("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
|
|
3422
3433
|
});
|
|
3423
3434
|
}
|
|
3424
|
-
function
|
|
3435
|
+
function aa({ size: e = 16 }) {
|
|
3425
3436
|
return /* @__PURE__ */ $("svg", {
|
|
3426
3437
|
width: e,
|
|
3427
3438
|
height: e,
|
|
@@ -3430,7 +3441,7 @@ function oa({ size: e = 16 }) {
|
|
|
3430
3441
|
children: /* @__PURE__ */ $("path", { d: "M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" })
|
|
3431
3442
|
});
|
|
3432
3443
|
}
|
|
3433
|
-
function
|
|
3444
|
+
function oa({ size: e = 16 }) {
|
|
3434
3445
|
return /* @__PURE__ */ $("svg", {
|
|
3435
3446
|
width: e,
|
|
3436
3447
|
height: e,
|
|
@@ -3443,7 +3454,7 @@ function sa({ size: e = 16 }) {
|
|
|
3443
3454
|
})
|
|
3444
3455
|
});
|
|
3445
3456
|
}
|
|
3446
|
-
function
|
|
3457
|
+
function sa({ size: e = 16 }) {
|
|
3447
3458
|
return /* @__PURE__ */ $("svg", {
|
|
3448
3459
|
width: e,
|
|
3449
3460
|
height: e,
|
|
@@ -3457,7 +3468,7 @@ function ca({ size: e = 16 }) {
|
|
|
3457
3468
|
})
|
|
3458
3469
|
});
|
|
3459
3470
|
}
|
|
3460
|
-
function
|
|
3471
|
+
function ca({ size: e = 16 }) {
|
|
3461
3472
|
return /* @__PURE__ */ $("svg", {
|
|
3462
3473
|
width: e,
|
|
3463
3474
|
height: e,
|
|
@@ -3466,7 +3477,7 @@ function la({ size: e = 16 }) {
|
|
|
3466
3477
|
children: /* @__PURE__ */ $("path", { d: "M2.87 2.298a.75.75 0 0 0-.812 1.021L3.39 6.624a1 1 0 0 0 .928.626H8.25a.75.75 0 0 1 0 1.5H4.318a1 1 0 0 0-.927.626l-1.333 3.305a.75.75 0 0 0 .811 1.022 24.89 24.89 0 0 0 11.668-5.115.75.75 0 0 0 0-1.175A24.89 24.89 0 0 0 2.869 2.298Z" })
|
|
3467
3478
|
});
|
|
3468
3479
|
}
|
|
3469
|
-
function
|
|
3480
|
+
function la({ size: e = 16 }) {
|
|
3470
3481
|
return /* @__PURE__ */ $("svg", {
|
|
3471
3482
|
width: e,
|
|
3472
3483
|
height: e,
|
|
@@ -3478,7 +3489,7 @@ function ua({ size: e = 16 }) {
|
|
|
3478
3489
|
}
|
|
3479
3490
|
//#endregion
|
|
3480
3491
|
//#region src/runtime/ui/fab.tsx
|
|
3481
|
-
function
|
|
3492
|
+
function ua({ active: e, onToggle: t, onHide: n, position: r = "bottom-right" }) {
|
|
3482
3493
|
return /* @__PURE__ */ $("button", {
|
|
3483
3494
|
type: "button",
|
|
3484
3495
|
class: Q("markup-fab", r === "bottom-left" ? "markup-fab-left" : "markup-fab-right", e && "is-active"),
|
|
@@ -3496,7 +3507,7 @@ function da({ active: e, onToggle: t, onHide: n, position: r = "bottom-right" })
|
|
|
3496
3507
|
"aria-pressed": e,
|
|
3497
3508
|
children: [/* @__PURE__ */ $("span", {
|
|
3498
3509
|
class: "markup-fab-icon",
|
|
3499
|
-
children: $(e ?
|
|
3510
|
+
children: $(e ? ia : ra, { size: 16 })
|
|
3500
3511
|
}), /* @__PURE__ */ $("span", {
|
|
3501
3512
|
class: "markup-fab-label",
|
|
3502
3513
|
children: e ? "Cancel" : "Markup"
|
|
@@ -3505,7 +3516,7 @@ function da({ active: e, onToggle: t, onHide: n, position: r = "bottom-right" })
|
|
|
3505
3516
|
}
|
|
3506
3517
|
//#endregion
|
|
3507
3518
|
//#region src/runtime/use-focus-trap.ts
|
|
3508
|
-
var
|
|
3519
|
+
var da = [
|
|
3509
3520
|
"a[href]",
|
|
3510
3521
|
"button:not([disabled])",
|
|
3511
3522
|
"input:not([disabled])",
|
|
@@ -3513,14 +3524,14 @@ var fa = [
|
|
|
3513
3524
|
"textarea:not([disabled])",
|
|
3514
3525
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
3515
3526
|
].join(",");
|
|
3516
|
-
function
|
|
3527
|
+
function fa(e, t) {
|
|
3517
3528
|
R(() => {
|
|
3518
3529
|
if (!t) return;
|
|
3519
3530
|
let n = e.current;
|
|
3520
3531
|
if (!n) return;
|
|
3521
3532
|
function r(e) {
|
|
3522
3533
|
if (e.key !== "Tab") return;
|
|
3523
|
-
let t = Array.from(n.querySelectorAll(
|
|
3534
|
+
let t = Array.from(n.querySelectorAll(da)), r = t[0], i = t[t.length - 1];
|
|
3524
3535
|
if (!r || !i) return;
|
|
3525
3536
|
let a = n.getRootNode(), o = a instanceof ShadowRoot ? a.activeElement : document.activeElement;
|
|
3526
3537
|
(e.shiftKey ? o === r : o === i) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
|
|
@@ -3530,7 +3541,7 @@ function pa(e, t) {
|
|
|
3530
3541
|
}
|
|
3531
3542
|
//#endregion
|
|
3532
3543
|
//#region src/runtime/ui/author-prompt.tsx
|
|
3533
|
-
function
|
|
3544
|
+
function pa({ pending: e, onSubmit: t, onCancel: n, onSignIn: r }) {
|
|
3534
3545
|
let [i, a] = L(""), [o, s] = L(""), c = z(null);
|
|
3535
3546
|
R(() => {
|
|
3536
3547
|
c.current?.focus();
|
|
@@ -3602,8 +3613,8 @@ function ma({ pending: e, onSubmit: t, onCancel: n, onSignIn: r }) {
|
|
|
3602
3613
|
}
|
|
3603
3614
|
//#endregion
|
|
3604
3615
|
//#region src/runtime/ui/composer.tsx
|
|
3605
|
-
var
|
|
3606
|
-
function
|
|
3616
|
+
var ma = 4e3;
|
|
3617
|
+
function ha({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, pending: i, error: a, onSubmit: o }) {
|
|
3607
3618
|
let [s, c] = L(""), l = z(null), u = z(!1);
|
|
3608
3619
|
R(() => {
|
|
3609
3620
|
r && l.current?.focus();
|
|
@@ -3621,7 +3632,7 @@ function ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
3621
3632
|
function f(e) {
|
|
3622
3633
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && d(e);
|
|
3623
3634
|
}
|
|
3624
|
-
let p =
|
|
3635
|
+
let p = ma - s.length, m = p < 0, h = s.length > 0;
|
|
3625
3636
|
function g(e) {
|
|
3626
3637
|
return /* @__PURE__ */ $("button", {
|
|
3627
3638
|
type: "submit",
|
|
@@ -3630,7 +3641,7 @@ function ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
3630
3641
|
"aria-label": i ? "Sending…" : n,
|
|
3631
3642
|
title: i ? "Sending…" : n,
|
|
3632
3643
|
tabIndex: e,
|
|
3633
|
-
children: /* @__PURE__ */ $(
|
|
3644
|
+
children: /* @__PURE__ */ $(ca, { size: 14 })
|
|
3634
3645
|
});
|
|
3635
3646
|
}
|
|
3636
3647
|
return /* @__PURE__ */ $("form", {
|
|
@@ -3643,7 +3654,7 @@ function ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
3643
3654
|
class: "markup-composer-input",
|
|
3644
3655
|
placeholder: t,
|
|
3645
3656
|
rows: h ? 2 : 1,
|
|
3646
|
-
maxLength:
|
|
3657
|
+
maxLength: ma + 100,
|
|
3647
3658
|
value: s,
|
|
3648
3659
|
onInput: (e) => c(e.currentTarget.value),
|
|
3649
3660
|
onKeyDown: f,
|
|
@@ -3679,9 +3690,9 @@ function ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
3679
3690
|
}
|
|
3680
3691
|
//#endregion
|
|
3681
3692
|
//#region src/runtime/ui/new-thread-popover.tsx
|
|
3682
|
-
function
|
|
3693
|
+
function ga({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, error: a, screenshot: o, screenshotCapturing: s, onAuthor: c, onSignIn: l, onSubmit: u, onClose: d }) {
|
|
3683
3694
|
let f = z(null);
|
|
3684
|
-
|
|
3695
|
+
fa(f, !0);
|
|
3685
3696
|
let [p, m] = L(!1), [h, g] = L(null);
|
|
3686
3697
|
R(() => {
|
|
3687
3698
|
if (!o) return;
|
|
@@ -3698,7 +3709,7 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3698
3709
|
}
|
|
3699
3710
|
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
3700
3711
|
}, [d]);
|
|
3701
|
-
let _ =
|
|
3712
|
+
let _ = _a(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), v = _a(t - window.scrollY - 16, 12, window.innerHeight - 220), y = o != null, b = s || y;
|
|
3702
3713
|
return /* @__PURE__ */ $("div", {
|
|
3703
3714
|
ref: f,
|
|
3704
3715
|
class: "markup-popover",
|
|
@@ -3719,9 +3730,9 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3719
3730
|
class: "markup-icon-btn",
|
|
3720
3731
|
"aria-label": "Discard pin",
|
|
3721
3732
|
onClick: d,
|
|
3722
|
-
children: /* @__PURE__ */ $(
|
|
3733
|
+
children: /* @__PURE__ */ $(ia, { size: 16 })
|
|
3723
3734
|
})]
|
|
3724
|
-
}), n == null ? /* @__PURE__ */ $(
|
|
3735
|
+
}), n == null ? /* @__PURE__ */ $(pa, {
|
|
3725
3736
|
pending: i,
|
|
3726
3737
|
onSubmit: c,
|
|
3727
3738
|
onCancel: d,
|
|
@@ -3743,7 +3754,7 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3743
3754
|
}) : null
|
|
3744
3755
|
]
|
|
3745
3756
|
}),
|
|
3746
|
-
/* @__PURE__ */ $(
|
|
3757
|
+
/* @__PURE__ */ $(ha, {
|
|
3747
3758
|
label: "Feedback",
|
|
3748
3759
|
placeholder: "What's wrong, missing, or worth noting?",
|
|
3749
3760
|
submitLabel: "Post markup",
|
|
@@ -3761,7 +3772,7 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3761
3772
|
class: "markup-screenshot-checkbox",
|
|
3762
3773
|
disabled: !0
|
|
3763
3774
|
}),
|
|
3764
|
-
/* @__PURE__ */ $(
|
|
3775
|
+
/* @__PURE__ */ $(sa, { size: 12 }),
|
|
3765
3776
|
/* @__PURE__ */ $("span", { children: "Capturing…" })
|
|
3766
3777
|
]
|
|
3767
3778
|
}) : /* @__PURE__ */ $("label", {
|
|
@@ -3773,7 +3784,7 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3773
3784
|
checked: p,
|
|
3774
3785
|
onChange: (e) => m(e.currentTarget.checked)
|
|
3775
3786
|
}),
|
|
3776
|
-
/* @__PURE__ */ $(
|
|
3787
|
+
/* @__PURE__ */ $(sa, { size: 12 }),
|
|
3777
3788
|
/* @__PURE__ */ $("span", { children: "Attach screenshot" }),
|
|
3778
3789
|
h && p ? /* @__PURE__ */ $("img", {
|
|
3779
3790
|
class: "markup-screenshot-thumb",
|
|
@@ -3787,12 +3798,12 @@ function _a({ pageX: e, pageY: t, authorName: n, isVerified: r, pending: i, erro
|
|
|
3787
3798
|
})]
|
|
3788
3799
|
});
|
|
3789
3800
|
}
|
|
3790
|
-
function
|
|
3801
|
+
function _a(e, t, n) {
|
|
3791
3802
|
return Math.max(t, Math.min(n, e));
|
|
3792
3803
|
}
|
|
3793
3804
|
//#endregion
|
|
3794
3805
|
//#region src/runtime/ui/pin.tsx
|
|
3795
|
-
function
|
|
3806
|
+
function va({ pageX: e, pageY: t, count: n, active: r, onClick: i }) {
|
|
3796
3807
|
let a = t - window.scrollY, o = e - window.scrollX;
|
|
3797
3808
|
return /* @__PURE__ */ $("button", {
|
|
3798
3809
|
type: "button",
|
|
@@ -3815,7 +3826,7 @@ function ya({ pageX: e, pageY: t, count: n, active: r, onClick: i }) {
|
|
|
3815
3826
|
}) : null]
|
|
3816
3827
|
});
|
|
3817
3828
|
}
|
|
3818
|
-
function
|
|
3829
|
+
function ya({ pageX: e, pageY: t }) {
|
|
3819
3830
|
let n = t - window.scrollY, r = e - window.scrollX;
|
|
3820
3831
|
return /* @__PURE__ */ $("div", {
|
|
3821
3832
|
class: "markup-pin markup-pin-ghost is-anchor",
|
|
@@ -3831,7 +3842,7 @@ function ba({ pageX: e, pageY: t }) {
|
|
|
3831
3842
|
}
|
|
3832
3843
|
//#endregion
|
|
3833
3844
|
//#region src/runtime/ui/placement-overlay.tsx
|
|
3834
|
-
function
|
|
3845
|
+
function ba({ onPlace: e, onCancel: t }) {
|
|
3835
3846
|
R(() => {
|
|
3836
3847
|
function e(e) {
|
|
3837
3848
|
e.key === "Escape" && t();
|
|
@@ -3857,7 +3868,7 @@ function xa({ onPlace: e, onCancel: t }) {
|
|
|
3857
3868
|
}
|
|
3858
3869
|
//#endregion
|
|
3859
3870
|
//#region src/runtime/ui/thread-popover.tsx
|
|
3860
|
-
var
|
|
3871
|
+
var xa = [
|
|
3861
3872
|
"👍",
|
|
3862
3873
|
"❤️",
|
|
3863
3874
|
"🎉",
|
|
@@ -3865,9 +3876,9 @@ var Sa = [
|
|
|
3865
3876
|
"😄",
|
|
3866
3877
|
"❓"
|
|
3867
3878
|
];
|
|
3868
|
-
function
|
|
3879
|
+
function Sa({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDelete: i, pending: a, error: o, onAuthor: s, onSignIn: c, onClose: l, onReply: u, onEditComment: d, onDeleteComment: f, onToggleReaction: p, onResolve: m, onDelete: h }) {
|
|
3869
3880
|
let g = z(null), _ = z(null), v = z(null), y = z(null), b = z(null), [x, S] = L(!1), [C, w] = L(!1), [T, E] = L(null), [D, O] = L(""), [ee, k] = L(null), [A, te] = L("down"), [j, ne] = L(null), [M, N] = L(null), [re, ie] = L("down"), ae = z(null);
|
|
3870
|
-
|
|
3881
|
+
fa(g, !0);
|
|
3871
3882
|
let oe = e.resolvedAt != null, P = we(() => e.comments.filter((e) => !e.deleted), [e.comments]);
|
|
3872
3883
|
function se(e, t) {
|
|
3873
3884
|
E(e), O(t);
|
|
@@ -3932,8 +3943,8 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
3932
3943
|
anchorSelector: e.anchorSelector
|
|
3933
3944
|
});
|
|
3934
3945
|
return {
|
|
3935
|
-
left:
|
|
3936
|
-
top:
|
|
3946
|
+
left: Ea(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
|
|
3947
|
+
top: Ea(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
|
|
3937
3948
|
};
|
|
3938
3949
|
}, [
|
|
3939
3950
|
e.anchorX,
|
|
@@ -3973,7 +3984,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
3973
3984
|
class: Q("markup-icon-btn", x && "is-open"),
|
|
3974
3985
|
title: "More options",
|
|
3975
3986
|
onClick: () => S((e) => !e),
|
|
3976
|
-
children: /* @__PURE__ */ $(
|
|
3987
|
+
children: /* @__PURE__ */ $(aa, { size: 16 })
|
|
3977
3988
|
}), x ? /* @__PURE__ */ $("div", {
|
|
3978
3989
|
class: "markup-thread-menu-list",
|
|
3979
3990
|
children: [/* @__PURE__ */ $("button", {
|
|
@@ -4001,14 +4012,14 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4001
4012
|
title: "Mark as resolved",
|
|
4002
4013
|
disabled: a,
|
|
4003
4014
|
onClick: m,
|
|
4004
|
-
children: /* @__PURE__ */ $(
|
|
4015
|
+
children: /* @__PURE__ */ $(oa, { size: 16 })
|
|
4005
4016
|
}) : null,
|
|
4006
4017
|
/* @__PURE__ */ $("button", {
|
|
4007
4018
|
type: "button",
|
|
4008
4019
|
class: "markup-icon-btn",
|
|
4009
4020
|
title: "Close thread",
|
|
4010
4021
|
onClick: l,
|
|
4011
|
-
children: /* @__PURE__ */ $(
|
|
4022
|
+
children: /* @__PURE__ */ $(ia, { size: 16 })
|
|
4012
4023
|
})
|
|
4013
4024
|
]
|
|
4014
4025
|
})]
|
|
@@ -4035,12 +4046,12 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4035
4046
|
/* @__PURE__ */ $("time", {
|
|
4036
4047
|
class: "markup-comment-time",
|
|
4037
4048
|
datetime: new Date(t.createdAt).toISOString(),
|
|
4038
|
-
title:
|
|
4039
|
-
children:
|
|
4049
|
+
title: Oa(t.createdAt),
|
|
4050
|
+
children: Da(t.createdAt)
|
|
4040
4051
|
}),
|
|
4041
4052
|
/* @__PURE__ */ $("div", {
|
|
4042
4053
|
class: "markup-thread-actions",
|
|
4043
|
-
children: [!oe && !l ? /* @__PURE__ */ $(
|
|
4054
|
+
children: [!oe && !l ? /* @__PURE__ */ $(Ca, {
|
|
4044
4055
|
comment: t,
|
|
4045
4056
|
pickerOpen: M === t._id,
|
|
4046
4057
|
pickerDirection: re,
|
|
@@ -4075,7 +4086,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4075
4086
|
let n = e.currentTarget.getBoundingClientRect(), r = y.current?.getBoundingClientRect(), i = (+!!s + +!!c) * 32 + 8 + 6;
|
|
4076
4087
|
te((r ? r.bottom - n.bottom : Infinity) < i ? "up" : "down"), k(t._id);
|
|
4077
4088
|
},
|
|
4078
|
-
children: /* @__PURE__ */ $(
|
|
4089
|
+
children: /* @__PURE__ */ $(aa, { size: 16 })
|
|
4079
4090
|
}), m ? /* @__PURE__ */ $("div", {
|
|
4080
4091
|
class: "markup-thread-menu-list",
|
|
4081
4092
|
children: [s ? /* @__PURE__ */ $("button", {
|
|
@@ -4138,11 +4149,11 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4138
4149
|
children: [t.body, t.editedAt == null ? null : /* @__PURE__ */ $("time", {
|
|
4139
4150
|
class: "markup-comment-edited",
|
|
4140
4151
|
datetime: new Date(t.editedAt).toISOString(),
|
|
4141
|
-
title:
|
|
4152
|
+
title: Oa(t.editedAt),
|
|
4142
4153
|
children: [" ", "(edited)"]
|
|
4143
4154
|
})]
|
|
4144
4155
|
}),
|
|
4145
|
-
!l && t.reactions.length > 0 ? /* @__PURE__ */ $(
|
|
4156
|
+
!l && t.reactions.length > 0 ? /* @__PURE__ */ $(wa, {
|
|
4146
4157
|
comment: t,
|
|
4147
4158
|
isResolved: oe,
|
|
4148
4159
|
onToggle: (e) => p(t._id, e)
|
|
@@ -4171,7 +4182,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4171
4182
|
onClick: (e) => {
|
|
4172
4183
|
e.stopPropagation(), b.current?.close();
|
|
4173
4184
|
},
|
|
4174
|
-
children: /* @__PURE__ */ $(
|
|
4185
|
+
children: /* @__PURE__ */ $(ia, { size: 16 })
|
|
4175
4186
|
}), /* @__PURE__ */ $("img", {
|
|
4176
4187
|
class: "markup-lightbox-img",
|
|
4177
4188
|
src: e.screenshotUrl,
|
|
@@ -4179,7 +4190,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4179
4190
|
onClick: (e) => e.stopPropagation()
|
|
4180
4191
|
})]
|
|
4181
4192
|
}) : null,
|
|
4182
|
-
t == null ? /* @__PURE__ */ $(
|
|
4193
|
+
t == null ? /* @__PURE__ */ $(pa, {
|
|
4183
4194
|
pending: a,
|
|
4184
4195
|
onSubmit: s,
|
|
4185
4196
|
onCancel: l,
|
|
@@ -4199,7 +4210,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4199
4210
|
children: "team"
|
|
4200
4211
|
}) : null
|
|
4201
4212
|
]
|
|
4202
|
-
}), /* @__PURE__ */ $(
|
|
4213
|
+
}), /* @__PURE__ */ $(ha, {
|
|
4203
4214
|
label: "Reply",
|
|
4204
4215
|
placeholder: "Write a reply…",
|
|
4205
4216
|
submitLabel: "Reply",
|
|
@@ -4212,7 +4223,7 @@ function Ca({ thread: e, authorName: t, currentClientId: n, isVerified: r, canDe
|
|
|
4212
4223
|
]
|
|
4213
4224
|
});
|
|
4214
4225
|
}
|
|
4215
|
-
function
|
|
4226
|
+
function Ca({ comment: e, pickerOpen: t, pickerDirection: n, pickerRef: r, onPickerClick: i, onPickerSelect: a }) {
|
|
4216
4227
|
return /* @__PURE__ */ $("div", {
|
|
4217
4228
|
class: Q("markup-reaction-picker-wrap", t && "is-open", t && n === "up" && "is-up"),
|
|
4218
4229
|
ref: r,
|
|
@@ -4222,11 +4233,11 @@ function wa({ comment: e, pickerOpen: t, pickerDirection: n, pickerRef: r, onPic
|
|
|
4222
4233
|
title: "Add reaction",
|
|
4223
4234
|
"aria-label": "Add reaction",
|
|
4224
4235
|
onClick: i,
|
|
4225
|
-
children: /* @__PURE__ */ $(
|
|
4236
|
+
children: /* @__PURE__ */ $(la, { size: 16 })
|
|
4226
4237
|
}), t ? /* @__PURE__ */ $("div", {
|
|
4227
4238
|
class: "markup-reaction-picker",
|
|
4228
4239
|
role: "menu",
|
|
4229
|
-
children:
|
|
4240
|
+
children: xa.map((t) => /* @__PURE__ */ $("button", {
|
|
4230
4241
|
type: "button",
|
|
4231
4242
|
role: "menuitem",
|
|
4232
4243
|
class: Q("markup-reaction-picker-item", (e.reactions.find((e) => e.emoji === t)?.mine ?? !1) && "is-mine"),
|
|
@@ -4236,11 +4247,11 @@ function wa({ comment: e, pickerOpen: t, pickerDirection: n, pickerRef: r, onPic
|
|
|
4236
4247
|
}) : null]
|
|
4237
4248
|
});
|
|
4238
4249
|
}
|
|
4239
|
-
function
|
|
4250
|
+
function wa({ comment: e, isResolved: t, onToggle: n }) {
|
|
4240
4251
|
return /* @__PURE__ */ $("div", {
|
|
4241
4252
|
class: "markup-reactions",
|
|
4242
4253
|
children: e.reactions.map((e) => {
|
|
4243
|
-
let r =
|
|
4254
|
+
let r = Ta(e.reactors, e.mine, e.count, e.emoji);
|
|
4244
4255
|
return /* @__PURE__ */ $("button", {
|
|
4245
4256
|
type: "button",
|
|
4246
4257
|
class: Q("markup-reaction-chip", e.mine && "is-mine"),
|
|
@@ -4261,14 +4272,14 @@ function Ta({ comment: e, isResolved: t, onToggle: n }) {
|
|
|
4261
4272
|
})
|
|
4262
4273
|
});
|
|
4263
4274
|
}
|
|
4264
|
-
function
|
|
4275
|
+
function Ta(e, t, n, r) {
|
|
4265
4276
|
let i = e.slice(), a = i.length + +!!t, o = Math.max(0, n - a);
|
|
4266
4277
|
return o > 0 && i.push(`${o} other${o === 1 ? "" : "s"}`), t && i.push("you"), i.length === 0 ? `${n} reacted with ${r}` : `${i.length === 1 ? i[0] : `${i.slice(0, -1).join(", ")} and ${i[i.length - 1]}`} reacted with ${r}`;
|
|
4267
4278
|
}
|
|
4268
|
-
function
|
|
4279
|
+
function Ea(e, t, n) {
|
|
4269
4280
|
return Math.max(t, Math.min(n, e));
|
|
4270
4281
|
}
|
|
4271
|
-
function
|
|
4282
|
+
function Da(e) {
|
|
4272
4283
|
let t = Date.now() - e, n = Math.floor(t / 1e3);
|
|
4273
4284
|
if (n < 60) return "just now";
|
|
4274
4285
|
let r = Math.floor(n / 60);
|
|
@@ -4285,7 +4296,7 @@ function Oa(e) {
|
|
|
4285
4296
|
year: "numeric"
|
|
4286
4297
|
});
|
|
4287
4298
|
}
|
|
4288
|
-
function
|
|
4299
|
+
function Oa(e) {
|
|
4289
4300
|
return new Date(e).toLocaleDateString([], {
|
|
4290
4301
|
month: "long",
|
|
4291
4302
|
day: "numeric",
|
|
@@ -4296,7 +4307,7 @@ function ka(e) {
|
|
|
4296
4307
|
}
|
|
4297
4308
|
//#endregion
|
|
4298
4309
|
//#region src/runtime/ui/app.tsx
|
|
4299
|
-
function
|
|
4310
|
+
function ka(e) {
|
|
4300
4311
|
return {
|
|
4301
4312
|
clientId: `markup_user_${e.identity.id}`,
|
|
4302
4313
|
name: e.identity.name,
|
|
@@ -4306,7 +4317,7 @@ function Aa(e) {
|
|
|
4306
4317
|
tokenExpiresAt: e.tokenExpiresAt ?? void 0
|
|
4307
4318
|
};
|
|
4308
4319
|
}
|
|
4309
|
-
function
|
|
4320
|
+
function Aa({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
4310
4321
|
let [r, i] = L(() => window.location.pathname), [a, o] = L([]), [s, c] = L(null), l = z(null);
|
|
4311
4322
|
l.current = s;
|
|
4312
4323
|
let u = we(() => kr({
|
|
@@ -4319,30 +4330,65 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4319
4330
|
expiresAt: e.tokenExpiresAt
|
|
4320
4331
|
} : null;
|
|
4321
4332
|
},
|
|
4333
|
+
getAnonToken: () => {
|
|
4334
|
+
let e = l.current;
|
|
4335
|
+
return e?.token && e.tokenExpiresAt ? null : e?.anonToken ?? null;
|
|
4336
|
+
},
|
|
4322
4337
|
onUnauthorized: () => {
|
|
4323
4338
|
let e = l.current;
|
|
4324
4339
|
if (!e) return;
|
|
4325
4340
|
let t = {
|
|
4326
4341
|
clientId: e.clientId,
|
|
4327
4342
|
name: e.name,
|
|
4328
|
-
email: e.email
|
|
4343
|
+
email: e.email,
|
|
4344
|
+
anonToken: e.anonToken
|
|
4329
4345
|
};
|
|
4330
4346
|
l.current = t, c(t), Nr(t);
|
|
4331
4347
|
}
|
|
4332
4348
|
}), [e, t]), [d, f] = L({ kind: "idle" }), [p, m] = L(!1), [h, g] = L(null), [_, v] = L(!1), [y, b] = L(!1), [, x] = L(0), S = z(null), C = s?.name ?? null, w = s?.isVerified ?? !1;
|
|
4333
4349
|
R(() => {
|
|
4334
4350
|
let e = Mr();
|
|
4335
|
-
if (e) {
|
|
4351
|
+
if (e?.anonToken || e?.isVerified) {
|
|
4336
4352
|
c(e);
|
|
4337
4353
|
return;
|
|
4338
4354
|
}
|
|
4339
|
-
let t =
|
|
4340
|
-
|
|
4341
|
-
|
|
4355
|
+
let t = !1, n = null, r = 1e3;
|
|
4356
|
+
function i() {
|
|
4357
|
+
u.mintAnonIdentity().then(({ clientId: n, token: r }) => {
|
|
4358
|
+
if (t) return;
|
|
4359
|
+
let i = {
|
|
4360
|
+
...e ?? {},
|
|
4361
|
+
clientId: n,
|
|
4362
|
+
anonToken: r
|
|
4363
|
+
};
|
|
4364
|
+
Nr(i), c(i);
|
|
4365
|
+
}).catch(() => {
|
|
4366
|
+
t || (n = setTimeout(i, Math.min(r, 3e4)), r = Math.min(r * 2, 3e4));
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4369
|
+
return i(), () => {
|
|
4370
|
+
t = !0, n && clearTimeout(n);
|
|
4371
|
+
};
|
|
4372
|
+
}, [u]);
|
|
4342
4373
|
let [T, E] = L(null);
|
|
4343
4374
|
R(() => {
|
|
4344
|
-
|
|
4345
|
-
|
|
4375
|
+
let e = !1, t = null;
|
|
4376
|
+
async function n() {
|
|
4377
|
+
try {
|
|
4378
|
+
let r = await u.getSubscriptionToken();
|
|
4379
|
+
if (e) return;
|
|
4380
|
+
E(r.token);
|
|
4381
|
+
let i = Math.max(6e4, r.expiresAt - Date.now() - 30 * 6e4);
|
|
4382
|
+
t = setTimeout(n, i);
|
|
4383
|
+
} catch {
|
|
4384
|
+
if (e) return;
|
|
4385
|
+
t = setTimeout(n, 6e4);
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4388
|
+
return n(), () => {
|
|
4389
|
+
e = !0, t && clearTimeout(t);
|
|
4390
|
+
};
|
|
4391
|
+
}, [u]);
|
|
4346
4392
|
let D = z(null);
|
|
4347
4393
|
R(() => {
|
|
4348
4394
|
let t = new ir(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
|
|
@@ -4354,7 +4400,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4354
4400
|
R(() => {
|
|
4355
4401
|
let e = D.current;
|
|
4356
4402
|
if (!(!e || !T)) return O.current = !1, g(null), e.onUpdate(Jt("widget/queries:subscribeThreadsForRoute"), {
|
|
4357
|
-
|
|
4403
|
+
subscriptionToken: T,
|
|
4358
4404
|
route: r,
|
|
4359
4405
|
viewerClientId: s?.clientId ?? void 0
|
|
4360
4406
|
}, (e) => {
|
|
@@ -4424,7 +4470,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4424
4470
|
pageY: n + window.scrollY,
|
|
4425
4471
|
screenshot: null,
|
|
4426
4472
|
screenshotCapturing: !0
|
|
4427
|
-
}),
|
|
4473
|
+
}), $i(S.current != null && S.current.getRootNode() instanceof ShadowRoot ? S.current.getRootNode().host : null, {
|
|
4428
4474
|
x: t,
|
|
4429
4475
|
y: n
|
|
4430
4476
|
}).then((e) => {
|
|
@@ -4435,8 +4481,9 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4435
4481
|
} : t);
|
|
4436
4482
|
});
|
|
4437
4483
|
}, []), te = B((e, t) => {
|
|
4484
|
+
if (!s) return;
|
|
4438
4485
|
let n = {
|
|
4439
|
-
|
|
4486
|
+
...s,
|
|
4440
4487
|
name: e,
|
|
4441
4488
|
email: t
|
|
4442
4489
|
};
|
|
@@ -4444,7 +4491,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4444
4491
|
}, [s]), j = B(async () => {
|
|
4445
4492
|
g(null);
|
|
4446
4493
|
try {
|
|
4447
|
-
let n =
|
|
4494
|
+
let n = ka(await Pr(e, t));
|
|
4448
4495
|
Nr(n), c(n);
|
|
4449
4496
|
} catch (e) {
|
|
4450
4497
|
g(e instanceof Error ? e.message : "Sign-in failed");
|
|
@@ -4478,7 +4525,6 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4478
4525
|
userAgent: navigator.userAgent,
|
|
4479
4526
|
authorName: s.name,
|
|
4480
4527
|
authorEmail: s.email,
|
|
4481
|
-
authorClientId: s.clientId,
|
|
4482
4528
|
body: e,
|
|
4483
4529
|
screenshotStorageId: n
|
|
4484
4530
|
});
|
|
@@ -4531,8 +4577,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4531
4577
|
let n = await u.addComment(t, {
|
|
4532
4578
|
body: e,
|
|
4533
4579
|
authorName: s.name,
|
|
4534
|
-
authorEmail: s.email
|
|
4535
|
-
authorClientId: s.clientId
|
|
4580
|
+
authorEmail: s.email
|
|
4536
4581
|
});
|
|
4537
4582
|
o((e) => e.map((e) => e._id === t ? n.thread : e));
|
|
4538
4583
|
} catch (e) {
|
|
@@ -4549,10 +4594,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4549
4594
|
let n = d.threadId;
|
|
4550
4595
|
m(!0), g(null);
|
|
4551
4596
|
try {
|
|
4552
|
-
let r = await u.editComment(n, e, {
|
|
4553
|
-
body: t,
|
|
4554
|
-
authorClientId: s.clientId
|
|
4555
|
-
});
|
|
4597
|
+
let r = await u.editComment(n, e, { body: t });
|
|
4556
4598
|
o((e) => e.map((e) => e._id === n ? r.thread : e));
|
|
4557
4599
|
} catch (e) {
|
|
4558
4600
|
throw g(e instanceof Error ? e.message : "Failed to edit"), e;
|
|
@@ -4568,7 +4610,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4568
4610
|
let t = d.threadId;
|
|
4569
4611
|
m(!0), g(null);
|
|
4570
4612
|
try {
|
|
4571
|
-
let n = await u.deleteComment(t, e
|
|
4613
|
+
let n = await u.deleteComment(t, e);
|
|
4572
4614
|
o((e) => e.map((e) => e._id === t ? n.thread : e));
|
|
4573
4615
|
} catch (e) {
|
|
4574
4616
|
g(e instanceof Error ? e.message : "Failed to delete");
|
|
@@ -4586,7 +4628,6 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4586
4628
|
try {
|
|
4587
4629
|
let r = await u.toggleReaction(e, {
|
|
4588
4630
|
emoji: t,
|
|
4589
|
-
authorClientId: s.clientId,
|
|
4590
4631
|
authorName: s.name
|
|
4591
4632
|
});
|
|
4592
4633
|
o((e) => e.map((e) => e._id === n ? r.thread : e));
|
|
@@ -4612,7 +4653,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4612
4653
|
anchorOffsetX: e.anchorOffsetX,
|
|
4613
4654
|
anchorOffsetY: e.anchorOffsetY
|
|
4614
4655
|
}), r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
|
|
4615
|
-
return /* @__PURE__ */ $(
|
|
4656
|
+
return /* @__PURE__ */ $(va, {
|
|
4616
4657
|
pageX: n.pageX,
|
|
4617
4658
|
pageY: n.pageY,
|
|
4618
4659
|
count: r,
|
|
@@ -4622,16 +4663,16 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4622
4663
|
threadId: e._id
|
|
4623
4664
|
})
|
|
4624
4665
|
}, e._id);
|
|
4625
|
-
}), d.kind === "composing-new" ? /* @__PURE__ */ $(
|
|
4666
|
+
}), d.kind === "composing-new" ? /* @__PURE__ */ $(ya, {
|
|
4626
4667
|
pageX: d.pageX,
|
|
4627
4668
|
pageY: d.pageY
|
|
4628
4669
|
}) : null]
|
|
4629
4670
|
}),
|
|
4630
|
-
d.kind === "placing" ? /* @__PURE__ */ $(
|
|
4671
|
+
d.kind === "placing" ? /* @__PURE__ */ $(ba, {
|
|
4631
4672
|
onPlace: A,
|
|
4632
4673
|
onCancel: k
|
|
4633
4674
|
}) : null,
|
|
4634
|
-
d.kind === "thread" && P && !_ ? /* @__PURE__ */ $(
|
|
4675
|
+
d.kind === "thread" && P && !_ ? /* @__PURE__ */ $(Sa, {
|
|
4635
4676
|
thread: P,
|
|
4636
4677
|
authorName: C,
|
|
4637
4678
|
currentClientId: s?.clientId ?? null,
|
|
@@ -4649,7 +4690,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4649
4690
|
onDelete: M,
|
|
4650
4691
|
onResolve: N
|
|
4651
4692
|
}) : null,
|
|
4652
|
-
d.kind === "composing-new" ? /* @__PURE__ */ $(
|
|
4693
|
+
d.kind === "composing-new" ? /* @__PURE__ */ $(ga, {
|
|
4653
4694
|
pageX: d.pageX,
|
|
4654
4695
|
pageY: d.pageY,
|
|
4655
4696
|
authorName: C,
|
|
@@ -4663,7 +4704,7 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4663
4704
|
onSubmit: ne,
|
|
4664
4705
|
onClose: k
|
|
4665
4706
|
}) : null,
|
|
4666
|
-
!_ || d.kind === "placing" || d.kind === "composing-new" ? /* @__PURE__ */ $(
|
|
4707
|
+
!_ || d.kind === "placing" || d.kind === "composing-new" ? /* @__PURE__ */ $(ua, {
|
|
4667
4708
|
active: d.kind === "placing",
|
|
4668
4709
|
onToggle: () => d.kind === "placing" ? k() : ee(),
|
|
4669
4710
|
onHide: () => {
|
|
@@ -4671,11 +4712,11 @@ function ja({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
|
|
|
4671
4712
|
},
|
|
4672
4713
|
position: n
|
|
4673
4714
|
}) : null,
|
|
4674
|
-
_ && y ? /* @__PURE__ */ $(
|
|
4715
|
+
_ && y ? /* @__PURE__ */ $(ja, { position: n }) : null
|
|
4675
4716
|
]
|
|
4676
4717
|
});
|
|
4677
4718
|
}
|
|
4678
|
-
function
|
|
4719
|
+
function ja({ position: e }) {
|
|
4679
4720
|
let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
|
|
4680
4721
|
return /* @__PURE__ */ $("div", {
|
|
4681
4722
|
class: Q("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : "markup-hud-hidden-toast-right"),
|
|
@@ -4695,13 +4736,9 @@ function Ma({ position: e }) {
|
|
|
4695
4736
|
]
|
|
4696
4737
|
});
|
|
4697
4738
|
}
|
|
4698
|
-
async function Na(e) {
|
|
4699
|
-
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
4700
|
-
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
4701
|
-
}
|
|
4702
4739
|
//#endregion
|
|
4703
4740
|
//#region src/runtime/mount.tsx
|
|
4704
|
-
function
|
|
4741
|
+
function Ma(e, t) {
|
|
4705
4742
|
e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
|
|
4706
4743
|
let n = t.theme ?? "auto";
|
|
4707
4744
|
n !== "auto" && (e.dataset.theme = n);
|
|
@@ -4710,23 +4747,23 @@ function Pa(e, t) {
|
|
|
4710
4747
|
let a = document.createElement("div");
|
|
4711
4748
|
a.className = "markup-shadow-root", r.appendChild(a);
|
|
4712
4749
|
let { theme: o, ...s } = t;
|
|
4713
|
-
return le(/* @__PURE__ */ $(
|
|
4750
|
+
return le(/* @__PURE__ */ $(Aa, { ...s }), a), () => le(null, a);
|
|
4714
4751
|
}
|
|
4715
4752
|
//#endregion
|
|
4716
4753
|
//#region src/widget.ts
|
|
4717
|
-
var
|
|
4718
|
-
function
|
|
4719
|
-
|
|
4754
|
+
var Na = null, Pa = null;
|
|
4755
|
+
function Fa(e) {
|
|
4756
|
+
Ia();
|
|
4720
4757
|
let t = document.createElement("div");
|
|
4721
|
-
return t.id = "markup-widget", document.body.appendChild(t),
|
|
4758
|
+
return t.id = "markup-widget", document.body.appendChild(t), Pa = t, Na = Ma(t, e), Ia;
|
|
4722
4759
|
}
|
|
4723
|
-
function
|
|
4724
|
-
|
|
4760
|
+
function Ia() {
|
|
4761
|
+
Na &&= (Na(), null), Pa?.parentNode && Pa.parentNode.removeChild(Pa), Pa = null;
|
|
4725
4762
|
}
|
|
4726
4763
|
if (typeof document < "u") {
|
|
4727
4764
|
let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
|
|
4728
4765
|
if (t && n) {
|
|
4729
|
-
let r = e?.dataset.position, i = e?.dataset.theme, a = () =>
|
|
4766
|
+
let r = e?.dataset.position, i = e?.dataset.theme, a = () => Fa({
|
|
4730
4767
|
apiUrl: t,
|
|
4731
4768
|
apiKey: n,
|
|
4732
4769
|
position: r,
|
|
@@ -4736,4 +4773,4 @@ if (typeof document < "u") {
|
|
|
4736
4773
|
}
|
|
4737
4774
|
}
|
|
4738
4775
|
//#endregion
|
|
4739
|
-
export {
|
|
4776
|
+
export { Ia as destroy, Fa as init };
|