@pixelmatters/markup 1.10.0 → 1.11.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/dist/widget.js CHANGED
@@ -2882,79 +2882,150 @@ var Vr = class extends Error {
2882
2882
  constructor(e, t) {
2883
2883
  super(e), this.name = "WidgetApiError", this.status = t;
2884
2884
  }
2885
- };
2886
- function Hr(e) {
2885
+ }, Hr = class extends Vr {
2886
+ category;
2887
+ constructor(e, t) {
2888
+ super(`${e} took too long — check your connection`, 0), this.name = "WidgetTimeoutError", this.category = t;
2889
+ }
2890
+ }, Ur = 15e3, Wr = 3e4;
2891
+ function Gr(e, t) {
2892
+ let n = AbortSignal.timeout(e);
2893
+ return t ? AbortSignal.any([t, n]) : n;
2894
+ }
2895
+ function Kr(e) {
2887
2896
  let t = e.apiUrl.replace(/\/+$/, "");
2888
- async function n(n, r = {}) {
2889
- let i = {
2897
+ async function n(n, r, i) {
2898
+ let a = {
2890
2899
  "content-type": "application/json",
2891
2900
  "x-markup-api-key": e.apiKey,
2892
2901
  ...r.headers ?? {}
2893
- }, a = e.getToken?.() ?? null, o = a != null && a.token.length > 0 && a.expiresAt > Date.now();
2894
- o && a && (i.authorization = `Bearer ${a.token}`);
2895
- let s = e.getAnonToken?.() ?? null;
2896
- s && (i["x-markup-anon-token"] = s);
2897
- let c = e.getStorageMode?.() === "cookies", l = {
2902
+ }, o = e.getToken?.() ?? null, s = o != null && o.token.length > 0 && o.expiresAt > Date.now();
2903
+ s && o && (a.authorization = `Bearer ${o.token}`);
2904
+ let c = e.getAnonToken?.() ?? null;
2905
+ c && (a["x-markup-anon-token"] = c);
2906
+ let l = e.getStorageMode?.() === "cookies", u = {
2898
2907
  ...r,
2899
- headers: i
2908
+ headers: a,
2909
+ signal: Gr(i.timeoutMs, i.signal)
2900
2910
  };
2901
- c && (l.credentials = "include");
2902
- let u = await fetch(`${t}${n}`, l), d = await u.text(), f = d ? Ur(d) : null;
2903
- if (!u.ok) throw u.status === 401 && (o || c) && e.onUnauthorized?.(), new Vr((f && typeof f == "object" && "error" in f && typeof f.error == "string" ? f.error : null) ?? `Request failed with ${u.status}`, u.status);
2904
- return f;
2911
+ l && (u.credentials = "include");
2912
+ let d;
2913
+ try {
2914
+ d = await fetch(`${t}${n}`, u);
2915
+ } catch (e) {
2916
+ throw e instanceof DOMException && e.name === "TimeoutError" ? new Hr(i.operation, i.category) : e;
2917
+ }
2918
+ let f = await d.text(), p = f ? qr(f) : null;
2919
+ if (!d.ok) throw d.status === 401 && (s || l) && e.onUnauthorized?.(), new Vr((p && typeof p == "object" && "error" in p && typeof p.error == "string" ? p.error : null) ?? `Request failed with ${d.status}`, d.status);
2920
+ return p;
2905
2921
  }
2906
2922
  return {
2907
- mintAnonIdentity() {
2908
- return n("/widget/anon-identity", { method: "POST" });
2923
+ mintAnonIdentity(e) {
2924
+ return n("/widget/anon-identity", { method: "POST" }, {
2925
+ timeoutMs: Ur,
2926
+ category: "read",
2927
+ operation: "mint-anon-identity",
2928
+ signal: e?.signal
2929
+ });
2909
2930
  },
2910
- getSubscriptionToken() {
2911
- return n("/widget/subscription-token", { method: "POST" });
2931
+ getSubscriptionToken(e) {
2932
+ return n("/widget/subscription-token", { method: "POST" }, {
2933
+ timeoutMs: Ur,
2934
+ category: "read",
2935
+ operation: "mint-subscription-token",
2936
+ signal: e?.signal
2937
+ });
2912
2938
  },
2913
- getScreenshotUploadUrl() {
2914
- return n("/widget/screenshots/upload-url", { method: "POST" });
2939
+ getScreenshotUploadUrl(e) {
2940
+ return n("/widget/screenshots/upload-url", { method: "POST" }, {
2941
+ timeoutMs: Ur,
2942
+ category: "read",
2943
+ operation: "mint-screenshot-upload-url",
2944
+ signal: e?.signal
2945
+ });
2915
2946
  },
2916
- listThreads(e) {
2917
- return n(`/widget/threads?route=${encodeURIComponent(e)}`, { method: "GET" });
2947
+ listThreads(e, t) {
2948
+ return n(`/widget/threads?route=${encodeURIComponent(e)}`, { method: "GET" }, {
2949
+ timeoutMs: Ur,
2950
+ category: "read",
2951
+ operation: "list-threads",
2952
+ signal: t?.signal
2953
+ });
2918
2954
  },
2919
- createThread(e) {
2955
+ createThread(e, t) {
2920
2956
  return n("/widget/threads", {
2921
2957
  method: "POST",
2922
2958
  body: JSON.stringify(e)
2959
+ }, {
2960
+ timeoutMs: Wr,
2961
+ category: "write",
2962
+ operation: "create-thread",
2963
+ signal: t?.signal
2923
2964
  });
2924
2965
  },
2925
- deleteThread(e) {
2926
- return n(`/widget/threads/${encodeURIComponent(e)}`, { method: "DELETE" });
2966
+ deleteThread(e, t) {
2967
+ return n(`/widget/threads/${encodeURIComponent(e)}`, { method: "DELETE" }, {
2968
+ timeoutMs: Wr,
2969
+ category: "write",
2970
+ operation: "delete-thread",
2971
+ signal: t?.signal
2972
+ });
2927
2973
  },
2928
- resolveThread(e, t) {
2974
+ resolveThread(e, t, r) {
2929
2975
  return n(`/widget/threads/${encodeURIComponent(e)}`, {
2930
2976
  method: "PATCH",
2931
2977
  body: JSON.stringify({ resolvedBy: t })
2978
+ }, {
2979
+ timeoutMs: Wr,
2980
+ category: "write",
2981
+ operation: "resolve-thread",
2982
+ signal: r?.signal
2932
2983
  });
2933
2984
  },
2934
- addComment(e, t) {
2985
+ addComment(e, t, r) {
2935
2986
  return n(`/widget/threads/${encodeURIComponent(e)}/comments`, {
2936
2987
  method: "POST",
2937
2988
  body: JSON.stringify(t)
2989
+ }, {
2990
+ timeoutMs: Wr,
2991
+ category: "write",
2992
+ operation: "add-comment",
2993
+ signal: r?.signal
2938
2994
  });
2939
2995
  },
2940
- editComment(e, t, r) {
2996
+ editComment(e, t, r, i) {
2941
2997
  return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, {
2942
2998
  method: "PATCH",
2943
2999
  body: JSON.stringify(r)
3000
+ }, {
3001
+ timeoutMs: Wr,
3002
+ category: "write",
3003
+ operation: "edit-comment",
3004
+ signal: i?.signal
2944
3005
  });
2945
3006
  },
2946
- deleteComment(e, t) {
2947
- return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, { method: "DELETE" });
3007
+ deleteComment(e, t, r) {
3008
+ return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, { method: "DELETE" }, {
3009
+ timeoutMs: Wr,
3010
+ category: "write",
3011
+ operation: "delete-comment",
3012
+ signal: r?.signal
3013
+ });
2948
3014
  },
2949
- toggleReaction(e, t) {
3015
+ toggleReaction(e, t, r) {
2950
3016
  return n(`/widget/comments/${encodeURIComponent(e)}/reactions`, {
2951
3017
  method: "POST",
2952
3018
  body: JSON.stringify(t)
3019
+ }, {
3020
+ timeoutMs: Wr,
3021
+ category: "write",
3022
+ operation: "toggle-reaction",
3023
+ signal: r?.signal
2953
3024
  });
2954
3025
  }
2955
3026
  };
2956
3027
  }
2957
- function Ur(e) {
3028
+ function qr(e) {
2958
3029
  try {
2959
3030
  return JSON.parse(e);
2960
3031
  } catch {
@@ -2963,10 +3034,10 @@ function Ur(e) {
2963
3034
  }
2964
3035
  //#endregion
2965
3036
  //#region src/runtime/cookie-probe.ts
2966
- var Wr = "markup.cookieProbe";
2967
- async function Gr(e, t) {
3037
+ var Jr = "markup.cookieProbe";
3038
+ async function Yr(e, t) {
2968
3039
  try {
2969
- let e = sessionStorage.getItem(Wr);
3040
+ let e = sessionStorage.getItem(Jr);
2970
3041
  if (e === "supported") return !0;
2971
3042
  if (e === "unsupported") return !1;
2972
3043
  } catch {}
@@ -2985,7 +3056,7 @@ async function Gr(e, t) {
2985
3056
  if (!e.ok) return !1;
2986
3057
  let { supported: t } = await e.json(), i = t === !0;
2987
3058
  try {
2988
- sessionStorage.setItem(Wr, i ? "supported" : "unsupported");
3059
+ sessionStorage.setItem(Jr, i ? "supported" : "unsupported");
2989
3060
  } catch {}
2990
3061
  return i;
2991
3062
  } catch (e) {
@@ -2994,8 +3065,8 @@ async function Gr(e, t) {
2994
3065
  }
2995
3066
  //#endregion
2996
3067
  //#region src/runtime/history-observer.ts
2997
- var Kr = "__markup_history_observer__", qr = "__markup_history_listeners__";
2998
- function Jr(e) {
3068
+ var Xr = "__markup_history_observer__", Zr = "__markup_history_listeners__";
3069
+ function Qr(e) {
2999
3070
  e.forEach((e) => {
3000
3071
  try {
3001
3072
  e();
@@ -3004,44 +3075,44 @@ function Jr(e) {
3004
3075
  }
3005
3076
  });
3006
3077
  }
3007
- function Yr() {
3078
+ function $r() {
3008
3079
  let e = history.pushState;
3009
- if (e[Kr]) return e[qr];
3080
+ if (e[Xr]) return e[Zr];
3010
3081
  let t = /* @__PURE__ */ new Set(), n = history.pushState, r = history.replaceState;
3011
3082
  function i(...e) {
3012
- n.apply(this, e), Jr(t);
3083
+ n.apply(this, e), Qr(t);
3013
3084
  }
3014
3085
  function a(...e) {
3015
- r.apply(this, e), Jr(t);
3086
+ r.apply(this, e), Qr(t);
3016
3087
  }
3017
- return Object.defineProperty(i, Kr, { value: 1 }), Object.defineProperty(i, qr, { value: t }), Object.defineProperty(a, Kr, { value: 1 }), history.pushState = i, history.replaceState = a, window.addEventListener("popstate", () => Jr(t)), t;
3088
+ return Object.defineProperty(i, Xr, { value: 1 }), Object.defineProperty(i, Zr, { value: t }), Object.defineProperty(a, Xr, { value: 1 }), history.pushState = i, history.replaceState = a, window.addEventListener("popstate", () => Qr(t)), t;
3018
3089
  }
3019
- var Xr = null;
3020
- function Zr(e) {
3021
- return Xr ||= Yr(), Xr.add(e), () => Xr.delete(e);
3090
+ var ei = null;
3091
+ function ti(e) {
3092
+ return ei ||= $r(), ei.add(e), () => ei.delete(e);
3022
3093
  }
3023
3094
  //#endregion
3024
3095
  //#region src/runtime/identity-store.ts
3025
- var Qr = "markup.identity";
3026
- function $r() {
3096
+ var ni = "markup.identity";
3097
+ function ri() {
3027
3098
  try {
3028
- let e = localStorage.getItem(Qr);
3099
+ let e = localStorage.getItem(ni);
3029
3100
  return e ? JSON.parse(e) : null;
3030
3101
  } catch {
3031
3102
  return null;
3032
3103
  }
3033
3104
  }
3034
- function ei(e) {
3105
+ function ii(e) {
3035
3106
  try {
3036
3107
  if (e == null) {
3037
- localStorage.removeItem(Qr);
3108
+ localStorage.removeItem(ni);
3038
3109
  return;
3039
3110
  }
3040
- localStorage.setItem(Qr, JSON.stringify(e));
3111
+ localStorage.setItem(ni, JSON.stringify(e));
3041
3112
  } catch {}
3042
3113
  }
3043
- function ti() {
3044
- let e = $r(), t = {
3114
+ function ai() {
3115
+ let e = ri(), t = {
3045
3116
  name: e?.name,
3046
3117
  email: e?.email
3047
3118
  };
@@ -3101,10 +3172,10 @@ function ti() {
3101
3172
  preserved: t
3102
3173
  };
3103
3174
  }
3104
- function ni(e) {
3175
+ function oi(e) {
3105
3176
  switch (e.kind) {
3106
3177
  case "verified":
3107
- ei({
3178
+ ii({
3108
3179
  clientId: e.identity.clientId,
3109
3180
  storage: e.identity.storage,
3110
3181
  token: e.identity.storage === "cookies" ? void 0 : e.identity.token,
@@ -3117,7 +3188,7 @@ function ni(e) {
3117
3188
  });
3118
3189
  return;
3119
3190
  case "anon":
3120
- ei({
3191
+ ii({
3121
3192
  clientId: e.identity.clientId,
3122
3193
  anonToken: e.identity.anonToken,
3123
3194
  name: e.identity.name,
@@ -3125,23 +3196,23 @@ function ni(e) {
3125
3196
  });
3126
3197
  return;
3127
3198
  case "recovering":
3128
- ei({
3199
+ ii({
3129
3200
  name: e.preserved.name,
3130
3201
  email: e.preserved.email
3131
3202
  });
3132
3203
  return;
3133
3204
  case "unresolved":
3134
- ei(null);
3205
+ ii(null);
3135
3206
  return;
3136
3207
  }
3137
3208
  }
3138
- function ri(e) {
3209
+ function si(e) {
3139
3210
  if (e.kind === "anon" || e.kind === "verified") return e.identity.clientId;
3140
3211
  }
3141
- function ii(e) {
3212
+ function ci(e) {
3142
3213
  return e.kind === "anon" ? e.identity.name ?? null : e.kind === "verified" ? e.identity.name : null;
3143
3214
  }
3144
- function ai(e) {
3215
+ function li(e) {
3145
3216
  if (e.kind === "anon") {
3146
3217
  let t = e.identity.name;
3147
3218
  return t ? {
@@ -3156,7 +3227,7 @@ function ai(e) {
3156
3227
  }
3157
3228
  //#endregion
3158
3229
  //#region src/runtime/popup-auth.ts
3159
- async function oi(e) {
3230
+ async function ui(e) {
3160
3231
  let { apiUrl: t, apiKey: n, useCookies: r } = e, i = new URL(t).origin, a;
3161
3232
  try {
3162
3233
  let e = await fetch(`${t.replace(/\/+$/, "")}/widget/popup-exchange`, {
@@ -3227,45 +3298,45 @@ async function oi(e) {
3227
3298
  }
3228
3299
  //#endregion
3229
3300
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js
3230
- function si(e, t) {
3301
+ function di(e, t) {
3231
3302
  if (e.match(/^[a-z]+:\/\//i)) return e;
3232
3303
  if (e.match(/^\/\//)) return window.location.protocol + e;
3233
3304
  if (e.match(/^[a-z]+:/i)) return e;
3234
3305
  let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
3235
3306
  return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
3236
3307
  }
3237
- var ci = (() => {
3308
+ var fi = (() => {
3238
3309
  let e = 0, t = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
3239
3310
  return () => (e += 1, `u${t()}${e}`);
3240
3311
  })();
3241
- function li(e) {
3312
+ function pi(e) {
3242
3313
  let t = [];
3243
3314
  for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
3244
3315
  return t;
3245
3316
  }
3246
- var ui = null;
3247
- function di(e = {}) {
3248
- return ui || (e.includeStyleProperties ? (ui = e.includeStyleProperties, ui) : (ui = li(window.getComputedStyle(document.documentElement)), ui));
3317
+ var mi = null;
3318
+ function hi(e = {}) {
3319
+ return mi || (e.includeStyleProperties ? (mi = e.includeStyleProperties, mi) : (mi = pi(window.getComputedStyle(document.documentElement)), mi));
3249
3320
  }
3250
- function fi(e, t) {
3321
+ function gi(e, t) {
3251
3322
  let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
3252
3323
  return n ? parseFloat(n.replace("px", "")) : 0;
3253
3324
  }
3254
- function pi(e) {
3255
- let t = fi(e, "border-left-width"), n = fi(e, "border-right-width");
3325
+ function _i(e) {
3326
+ let t = gi(e, "border-left-width"), n = gi(e, "border-right-width");
3256
3327
  return e.clientWidth + t + n;
3257
3328
  }
3258
- function mi(e) {
3259
- let t = fi(e, "border-top-width"), n = fi(e, "border-bottom-width");
3329
+ function vi(e) {
3330
+ let t = gi(e, "border-top-width"), n = gi(e, "border-bottom-width");
3260
3331
  return e.clientHeight + t + n;
3261
3332
  }
3262
- function hi(e, t = {}) {
3333
+ function yi(e, t = {}) {
3263
3334
  return {
3264
- width: t.width || pi(e),
3265
- height: t.height || mi(e)
3335
+ width: t.width || _i(e),
3336
+ height: t.height || vi(e)
3266
3337
  };
3267
3338
  }
3268
- function gi() {
3339
+ function bi() {
3269
3340
  let e, t;
3270
3341
  try {
3271
3342
  t = process;
@@ -3274,10 +3345,10 @@ function gi() {
3274
3345
  return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
3275
3346
  }
3276
3347
  var X = 16384;
3277
- function _i(e) {
3348
+ function xi(e) {
3278
3349
  (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));
3279
3350
  }
3280
- function vi(e) {
3351
+ function Si(e) {
3281
3352
  return new Promise((t, n) => {
3282
3353
  let r = new Image();
3283
3354
  r.onload = () => {
@@ -3287,12 +3358,12 @@ function vi(e) {
3287
3358
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
3288
3359
  });
3289
3360
  }
3290
- async function yi(e) {
3361
+ async function Ci(e) {
3291
3362
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
3292
3363
  }
3293
- async function bi(e, t, n) {
3364
+ async function wi(e, t, n) {
3294
3365
  let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
3295
- 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), yi(i);
3366
+ 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), Ci(i);
3296
3367
  }
3297
3368
  var Z = (e, t) => {
3298
3369
  if (e instanceof t) return !0;
@@ -3301,66 +3372,66 @@ var Z = (e, t) => {
3301
3372
  };
3302
3373
  //#endregion
3303
3374
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js
3304
- function xi(e) {
3375
+ function Ti(e) {
3305
3376
  let t = e.getPropertyValue("content");
3306
3377
  return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
3307
3378
  }
3308
- function Si(e, t) {
3309
- return di(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3379
+ function Ei(e, t) {
3380
+ return hi(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3310
3381
  }
3311
- function Ci(e, t, n, r) {
3312
- let i = `.${e}:${t}`, a = n.cssText ? xi(n) : Si(n, r);
3382
+ function Di(e, t, n, r) {
3383
+ let i = `.${e}:${t}`, a = n.cssText ? Ti(n) : Ei(n, r);
3313
3384
  return document.createTextNode(`${i}{${a}}`);
3314
3385
  }
3315
- function wi(e, t, n, r) {
3386
+ function Oi(e, t, n, r) {
3316
3387
  let i = window.getComputedStyle(e, n), a = i.getPropertyValue("content");
3317
3388
  if (a === "" || a === "none") return;
3318
- let o = ci();
3389
+ let o = fi();
3319
3390
  try {
3320
3391
  t.className = `${t.className} ${o}`;
3321
3392
  } catch {
3322
3393
  return;
3323
3394
  }
3324
3395
  let s = document.createElement("style");
3325
- s.appendChild(Ci(o, n, i, r)), t.appendChild(s);
3396
+ s.appendChild(Di(o, n, i, r)), t.appendChild(s);
3326
3397
  }
3327
- function Ti(e, t, n) {
3328
- wi(e, t, ":before", n), wi(e, t, ":after", n);
3398
+ function ki(e, t, n) {
3399
+ Oi(e, t, ":before", n), Oi(e, t, ":after", n);
3329
3400
  }
3330
3401
  //#endregion
3331
3402
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js
3332
- var Ei = "application/font-woff", Di = "image/jpeg", Oi = {
3333
- woff: Ei,
3334
- woff2: Ei,
3403
+ var Ai = "application/font-woff", ji = "image/jpeg", Mi = {
3404
+ woff: Ai,
3405
+ woff2: Ai,
3335
3406
  ttf: "application/font-truetype",
3336
3407
  eot: "application/vnd.ms-fontobject",
3337
3408
  png: "image/png",
3338
- jpg: Di,
3339
- jpeg: Di,
3409
+ jpg: ji,
3410
+ jpeg: ji,
3340
3411
  gif: "image/gif",
3341
3412
  tiff: "image/tiff",
3342
3413
  svg: "image/svg+xml",
3343
3414
  webp: "image/webp"
3344
3415
  };
3345
- function ki(e) {
3416
+ function Ni(e) {
3346
3417
  let t = /\.([^./]*?)$/g.exec(e);
3347
3418
  return t ? t[1] : "";
3348
3419
  }
3349
- function Ai(e) {
3350
- return Oi[ki(e).toLowerCase()] || "";
3420
+ function Pi(e) {
3421
+ return Mi[Ni(e).toLowerCase()] || "";
3351
3422
  }
3352
3423
  //#endregion
3353
3424
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js
3354
- function ji(e) {
3425
+ function Fi(e) {
3355
3426
  return e.split(/,/)[1];
3356
3427
  }
3357
- function Mi(e) {
3428
+ function Ii(e) {
3358
3429
  return e.search(/^(data:)/) !== -1;
3359
3430
  }
3360
- function Ni(e, t) {
3431
+ function Li(e, t) {
3361
3432
  return `data:${t};base64,${e}`;
3362
3433
  }
3363
- async function Pi(e, t, n) {
3434
+ async function Ri(e, t, n) {
3364
3435
  let r = await fetch(e, t);
3365
3436
  if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
3366
3437
  let i = await r.blob();
@@ -3378,78 +3449,78 @@ async function Pi(e, t, n) {
3378
3449
  }, a.readAsDataURL(i);
3379
3450
  });
3380
3451
  }
3381
- var Fi = {};
3382
- function Ii(e, t, n) {
3452
+ var zi = {};
3453
+ function Bi(e, t, n) {
3383
3454
  let r = e.replace(/\?.*/, "");
3384
3455
  return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
3385
3456
  }
3386
- async function Li(e, t, n) {
3387
- let r = Ii(e, t, n.includeQueryParams);
3388
- if (Fi[r] != null) return Fi[r];
3457
+ async function Vi(e, t, n) {
3458
+ let r = Bi(e, t, n.includeQueryParams);
3459
+ if (zi[r] != null) return zi[r];
3389
3460
  n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
3390
3461
  let i;
3391
3462
  try {
3392
- i = Ni(await Pi(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", ji(n))), t);
3463
+ i = Li(await Ri(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", Fi(n))), t);
3393
3464
  } catch (t) {
3394
3465
  i = n.imagePlaceholder || "";
3395
3466
  let r = `Failed to fetch resource: ${e}`;
3396
3467
  t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
3397
3468
  }
3398
- return Fi[r] = i, i;
3469
+ return zi[r] = i, i;
3399
3470
  }
3400
3471
  //#endregion
3401
3472
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js
3402
- async function Ri(e) {
3473
+ async function Hi(e) {
3403
3474
  let t = e.toDataURL();
3404
- return t === "data:," ? e.cloneNode(!1) : vi(t);
3475
+ return t === "data:," ? e.cloneNode(!1) : Si(t);
3405
3476
  }
3406
- async function zi(e, t) {
3477
+ async function Ui(e, t) {
3407
3478
  if (e.currentSrc) {
3408
3479
  let t = document.createElement("canvas"), n = t.getContext("2d");
3409
- return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), vi(t.toDataURL());
3480
+ return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), Si(t.toDataURL());
3410
3481
  }
3411
3482
  let n = e.poster;
3412
- return vi(await Li(n, Ai(n), t));
3483
+ return Si(await Vi(n, Pi(n), t));
3413
3484
  }
3414
- async function Bi(e, t) {
3485
+ async function Wi(e, t) {
3415
3486
  try {
3416
- if (e?.contentDocument?.body) return await Xi(e.contentDocument.body, t, !0);
3487
+ if (e?.contentDocument?.body) return await ea(e.contentDocument.body, t, !0);
3417
3488
  } catch {}
3418
3489
  return e.cloneNode(!1);
3419
3490
  }
3420
- async function Vi(e, t) {
3421
- return Z(e, HTMLCanvasElement) ? Ri(e) : Z(e, HTMLVideoElement) ? zi(e, t) : Z(e, HTMLIFrameElement) ? Bi(e, t) : e.cloneNode(Ui(e));
3491
+ async function Gi(e, t) {
3492
+ return Z(e, HTMLCanvasElement) ? Hi(e) : Z(e, HTMLVideoElement) ? Ui(e, t) : Z(e, HTMLIFrameElement) ? Wi(e, t) : e.cloneNode(qi(e));
3422
3493
  }
3423
- var Hi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", Ui = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3424
- async function Wi(e, t, n) {
3425
- if (Ui(t)) return t;
3494
+ var Ki = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", qi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3495
+ async function Ji(e, t, n) {
3496
+ if (qi(t)) return t;
3426
3497
  let r = [];
3427
- return r = Hi(e) && e.assignedNodes ? li(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? li(e.contentDocument.body.childNodes) : li((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => Xi(r, n)).then((e) => {
3498
+ return r = Ki(e) && e.assignedNodes ? pi(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? pi(e.contentDocument.body.childNodes) : pi((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => ea(r, n)).then((e) => {
3428
3499
  e && t.appendChild(e);
3429
3500
  }), Promise.resolve()), t;
3430
3501
  }
3431
- function Gi(e, t, n) {
3502
+ function Yi(e, t, n) {
3432
3503
  let r = t.style;
3433
3504
  if (!r) return;
3434
3505
  let i = window.getComputedStyle(e);
3435
- i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : di(n).forEach((n) => {
3506
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : hi(n).forEach((n) => {
3436
3507
  let a = i.getPropertyValue(n);
3437
3508
  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));
3438
3509
  });
3439
3510
  }
3440
- function Ki(e, t) {
3511
+ function Xi(e, t) {
3441
3512
  Z(e, HTMLTextAreaElement) && (t.innerHTML = e.value), Z(e, HTMLInputElement) && t.setAttribute("value", e.value);
3442
3513
  }
3443
- function qi(e, t) {
3514
+ function Zi(e, t) {
3444
3515
  if (Z(e, HTMLSelectElement)) {
3445
3516
  let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
3446
3517
  r && r.setAttribute("selected", "");
3447
3518
  }
3448
3519
  }
3449
- function Ji(e, t, n) {
3450
- return Z(t, Element) && (Gi(e, t, n), Ti(e, t, n), Ki(e, t), qi(e, t)), t;
3520
+ function Qi(e, t, n) {
3521
+ return Z(t, Element) && (Yi(e, t, n), ki(e, t, n), Xi(e, t), Zi(e, t)), t;
3451
3522
  }
3452
- async function Yi(e, t) {
3523
+ async function $i(e, t) {
3453
3524
  let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
3454
3525
  if (n.length === 0) return e;
3455
3526
  let r = {};
@@ -3457,7 +3528,7 @@ async function Yi(e, t) {
3457
3528
  let a = n[i].getAttribute("xlink:href");
3458
3529
  if (a) {
3459
3530
  let n = e.querySelector(a), i = document.querySelector(a);
3460
- !n && i && !r[a] && (r[a] = await Xi(i, t, !0));
3531
+ !n && i && !r[a] && (r[a] = await ea(i, t, !0));
3461
3532
  }
3462
3533
  }
3463
3534
  let i = Object.values(r);
@@ -3471,61 +3542,61 @@ async function Yi(e, t) {
3471
3542
  }
3472
3543
  return e;
3473
3544
  }
3474
- async function Xi(e, t, n) {
3475
- return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => Vi(e, t)).then((n) => Wi(e, n, t)).then((n) => Ji(e, n, t)).then((e) => Yi(e, t));
3545
+ async function ea(e, t, n) {
3546
+ return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => Gi(e, t)).then((n) => Ji(e, n, t)).then((n) => Qi(e, n, t)).then((e) => $i(e, t));
3476
3547
  }
3477
3548
  //#endregion
3478
3549
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js
3479
- var Zi = /url\((['"]?)([^'"]+?)\1\)/g, Qi = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $i = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3480
- function ea(e) {
3550
+ var ta = /url\((['"]?)([^'"]+?)\1\)/g, na = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ra = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3551
+ function ia(e) {
3481
3552
  let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
3482
3553
  return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
3483
3554
  }
3484
- function ta(e) {
3555
+ function aa(e) {
3485
3556
  let t = [];
3486
- return e.replace(Zi, (e, n, r) => (t.push(r), e)), t.filter((e) => !Mi(e));
3557
+ return e.replace(ta, (e, n, r) => (t.push(r), e)), t.filter((e) => !Ii(e));
3487
3558
  }
3488
- async function na(e, t, n, r, i) {
3559
+ async function oa(e, t, n, r, i) {
3489
3560
  try {
3490
- let a = n ? si(t, n) : t, o = Ai(t), s;
3491
- return s = i ? Ni(await i(a), o) : await Li(a, o, r), e.replace(ea(t), `$1${s}$3`);
3561
+ let a = n ? di(t, n) : t, o = Pi(t), s;
3562
+ return s = i ? Li(await i(a), o) : await Vi(a, o, r), e.replace(ia(t), `$1${s}$3`);
3492
3563
  } catch {}
3493
3564
  return e;
3494
3565
  }
3495
- function ra(e, { preferredFontFormat: t }) {
3496
- return t ? e.replace($i, (e) => {
3566
+ function sa(e, { preferredFontFormat: t }) {
3567
+ return t ? e.replace(ra, (e) => {
3497
3568
  for (;;) {
3498
- let [n, , r] = Qi.exec(e) || [];
3569
+ let [n, , r] = na.exec(e) || [];
3499
3570
  if (!r) return "";
3500
3571
  if (r === t) return `src: ${n};`;
3501
3572
  }
3502
3573
  }) : e;
3503
3574
  }
3504
- function ia(e) {
3505
- return e.search(Zi) !== -1;
3575
+ function ca(e) {
3576
+ return e.search(ta) !== -1;
3506
3577
  }
3507
- async function aa(e, t, n) {
3508
- if (!ia(e)) return e;
3509
- let r = ra(e, n);
3510
- return ta(r).reduce((e, r) => e.then((e) => na(e, r, t, n)), Promise.resolve(r));
3578
+ async function la(e, t, n) {
3579
+ if (!ca(e)) return e;
3580
+ let r = sa(e, n);
3581
+ return aa(r).reduce((e, r) => e.then((e) => oa(e, r, t, n)), Promise.resolve(r));
3511
3582
  }
3512
3583
  //#endregion
3513
3584
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js
3514
- async function oa(e, t, n) {
3585
+ async function ua(e, t, n) {
3515
3586
  let r = t.style?.getPropertyValue(e);
3516
3587
  if (r) {
3517
- let i = await aa(r, null, n);
3588
+ let i = await la(r, null, n);
3518
3589
  return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
3519
3590
  }
3520
3591
  return !1;
3521
3592
  }
3522
- async function sa(e, t) {
3523
- await oa("background", e, t) || await oa("background-image", e, t), await oa("mask", e, t) || await oa("-webkit-mask", e, t) || await oa("mask-image", e, t) || await oa("-webkit-mask-image", e, t);
3593
+ async function da(e, t) {
3594
+ await ua("background", e, t) || await ua("background-image", e, t), await ua("mask", e, t) || await ua("-webkit-mask", e, t) || await ua("mask-image", e, t) || await ua("-webkit-mask-image", e, t);
3524
3595
  }
3525
- async function ca(e, t) {
3596
+ async function fa(e, t) {
3526
3597
  let n = Z(e, HTMLImageElement);
3527
- if (!(n && !Mi(e.src)) && !(Z(e, SVGImageElement) && !Mi(e.href.baseVal))) return;
3528
- let r = n ? e.src : e.href.baseVal, i = await Li(r, Ai(r), t);
3598
+ if (!(n && !Ii(e.src)) && !(Z(e, SVGImageElement) && !Ii(e.href.baseVal))) return;
3599
+ let r = n ? e.src : e.href.baseVal, i = await Vi(r, Pi(r), t);
3529
3600
  await new Promise((r, a) => {
3530
3601
  e.onload = r, e.onerror = t.onImageErrorHandler ? (...e) => {
3531
3602
  try {
@@ -3538,16 +3609,16 @@ async function ca(e, t) {
3538
3609
  o.decode &&= r, o.loading === "lazy" && (o.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
3539
3610
  });
3540
3611
  }
3541
- async function la(e, t) {
3542
- let n = li(e.childNodes).map((e) => ua(e, t));
3612
+ async function pa(e, t) {
3613
+ let n = pi(e.childNodes).map((e) => ma(e, t));
3543
3614
  await Promise.all(n).then(() => e);
3544
3615
  }
3545
- async function ua(e, t) {
3546
- Z(e, Element) && (await sa(e, t), await ca(e, t), await la(e, t));
3616
+ async function ma(e, t) {
3617
+ Z(e, Element) && (await da(e, t), await fa(e, t), await pa(e, t));
3547
3618
  }
3548
3619
  //#endregion
3549
3620
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js
3550
- function da(e, t) {
3621
+ function ha(e, t) {
3551
3622
  let { style: n } = e;
3552
3623
  t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
3553
3624
  let r = t.style;
@@ -3557,22 +3628,22 @@ function da(e, t) {
3557
3628
  }
3558
3629
  //#endregion
3559
3630
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js
3560
- var fa = {};
3561
- async function pa(e) {
3562
- let t = fa[e];
3631
+ var ga = {};
3632
+ async function _a(e) {
3633
+ let t = ga[e];
3563
3634
  return t ?? (t = {
3564
3635
  url: e,
3565
3636
  cssText: await (await fetch(e)).text()
3566
- }, fa[e] = t, t);
3637
+ }, ga[e] = t, t);
3567
3638
  }
3568
- async function ma(e, t) {
3639
+ async function va(e, t) {
3569
3640
  let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
3570
3641
  let a = i.replace(r, "$1");
3571
- return a.startsWith("https://") || (a = new URL(a, e.url).href), Pi(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3642
+ return a.startsWith("https://") || (a = new URL(a, e.url).href), Ri(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3572
3643
  });
3573
3644
  return Promise.all(i).then(() => n);
3574
3645
  }
3575
- function ha(e) {
3646
+ function ya(e) {
3576
3647
  if (e == null) return [];
3577
3648
  let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
3578
3649
  for (;;) {
@@ -3592,13 +3663,13 @@ function ha(e) {
3592
3663
  }
3593
3664
  return t;
3594
3665
  }
3595
- async function ga(e, t) {
3666
+ async function ba(e, t) {
3596
3667
  let n = [], r = [];
3597
3668
  return e.forEach((n) => {
3598
3669
  if ("cssRules" in n) try {
3599
- li(n.cssRules || []).forEach((e, i) => {
3670
+ pi(n.cssRules || []).forEach((e, i) => {
3600
3671
  if (e.type === CSSRule.IMPORT_RULE) {
3601
- let a = i + 1, o = e.href, s = pa(o).then((e) => ma(e, t)).then((e) => ha(e).forEach((e) => {
3672
+ let a = i + 1, o = e.href, s = _a(o).then((e) => va(e, t)).then((e) => ya(e).forEach((e) => {
3602
3673
  try {
3603
3674
  n.insertRule(e, e.startsWith("@import") ? a += 1 : n.cssRules.length);
3604
3675
  } catch (t) {
@@ -3615,7 +3686,7 @@ async function ga(e, t) {
3615
3686
  });
3616
3687
  } catch (i) {
3617
3688
  let a = e.find((e) => e.href == null) || document.styleSheets[0];
3618
- n.href != null && r.push(pa(n.href).then((e) => ma(e, t)).then((e) => ha(e).forEach((e) => {
3689
+ n.href != null && r.push(_a(n.href).then((e) => va(e, t)).then((e) => ya(e).forEach((e) => {
3619
3690
  a.insertRule(e, a.cssRules.length);
3620
3691
  })).catch((e) => {
3621
3692
  console.error("Error loading remote stylesheet", e);
@@ -3623,7 +3694,7 @@ async function ga(e, t) {
3623
3694
  }
3624
3695
  }), Promise.all(r).then(() => (e.forEach((e) => {
3625
3696
  if ("cssRules" in e) try {
3626
- li(e.cssRules || []).forEach((e) => {
3697
+ pi(e.cssRules || []).forEach((e) => {
3627
3698
  n.push(e);
3628
3699
  });
3629
3700
  } catch (t) {
@@ -3631,36 +3702,36 @@ async function ga(e, t) {
3631
3702
  }
3632
3703
  }), n));
3633
3704
  }
3634
- function _a(e) {
3635
- return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ia(e.style.getPropertyValue("src")));
3705
+ function xa(e) {
3706
+ return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ca(e.style.getPropertyValue("src")));
3636
3707
  }
3637
- async function va(e, t) {
3708
+ async function Sa(e, t) {
3638
3709
  if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
3639
- return _a(await ga(li(e.ownerDocument.styleSheets), t));
3710
+ return xa(await ba(pi(e.ownerDocument.styleSheets), t));
3640
3711
  }
3641
- function ya(e) {
3712
+ function Ca(e) {
3642
3713
  return e.trim().replace(/["']/g, "");
3643
3714
  }
3644
- function ba(e) {
3715
+ function wa(e) {
3645
3716
  let t = /* @__PURE__ */ new Set();
3646
3717
  function n(e) {
3647
3718
  (e.style.fontFamily || getComputedStyle(e).fontFamily).split(",").forEach((e) => {
3648
- t.add(ya(e));
3719
+ t.add(Ca(e));
3649
3720
  }), Array.from(e.children).forEach((e) => {
3650
3721
  e instanceof HTMLElement && n(e);
3651
3722
  });
3652
3723
  }
3653
3724
  return n(e), t;
3654
3725
  }
3655
- async function xa(e, t) {
3656
- let n = await va(e, t), r = ba(e);
3657
- return (await Promise.all(n.filter((e) => r.has(ya(e.style.fontFamily))).map((e) => {
3726
+ async function Ta(e, t) {
3727
+ let n = await Sa(e, t), r = wa(e);
3728
+ return (await Promise.all(n.filter((e) => r.has(Ca(e.style.fontFamily))).map((e) => {
3658
3729
  let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
3659
- return aa(e.cssText, n, t);
3730
+ return la(e.cssText, n, t);
3660
3731
  }))).join("\n");
3661
3732
  }
3662
- async function Sa(e, t) {
3663
- let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await xa(e, t) : t.fontEmbedCSS;
3733
+ async function Ea(e, t) {
3734
+ let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await Ta(e, t) : t.fontEmbedCSS;
3664
3735
  if (n) {
3665
3736
  let t = document.createElement("style"), r = document.createTextNode(n);
3666
3737
  t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
@@ -3668,18 +3739,18 @@ async function Sa(e, t) {
3668
3739
  }
3669
3740
  //#endregion
3670
3741
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js
3671
- async function Ca(e, t = {}) {
3672
- let { width: n, height: r } = hi(e, t), i = await Xi(e, t, !0);
3673
- return await Sa(i, t), await ua(i, t), da(i, t), await bi(i, n, r);
3742
+ async function Da(e, t = {}) {
3743
+ let { width: n, height: r } = yi(e, t), i = await ea(e, t, !0);
3744
+ return await Ea(i, t), await ma(i, t), ha(i, t), await wi(i, n, r);
3674
3745
  }
3675
- async function wa(e, t = {}) {
3676
- let { width: n, height: r } = hi(e, t), i = await vi(await Ca(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || gi(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3677
- return a.width = c * s, a.height = l * s, t.skipAutoScale || _i(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;
3746
+ async function Oa(e, t = {}) {
3747
+ let { width: n, height: r } = yi(e, t), i = await Si(await Da(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || bi(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3748
+ return a.width = c * s, a.height = l * s, t.skipAutoScale || xi(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;
3678
3749
  }
3679
3750
  //#endregion
3680
3751
  //#region src/runtime/screenshot.ts
3681
- var Ta = 2 * 1024 * 1024, Ea = "background:currentColor!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important", Da = "input[type=\"password\"],input[autocomplete~=\"cc-number\"],input[autocomplete~=\"cc-csc\"],input[autocomplete~=\"cc-exp\"],input[autocomplete~=\"cc-name\"],input[autocomplete~=\"cc-type\"],input[autocomplete~=\"current-password\"],input[autocomplete~=\"new-password\"],input[autocomplete~=\"one-time-code\"]";
3682
- function Oa(e) {
3752
+ var ka = 2 * 1024 * 1024, Aa = "background:currentColor!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important", ja = "input[type=\"password\"],input[autocomplete~=\"cc-number\"],input[autocomplete~=\"cc-csc\"],input[autocomplete~=\"cc-exp\"],input[autocomplete~=\"cc-name\"],input[autocomplete~=\"cc-type\"],input[autocomplete~=\"current-password\"],input[autocomplete~=\"new-password\"],input[autocomplete~=\"one-time-code\"]";
3753
+ function Ma(e) {
3683
3754
  let t = e.parentElement;
3684
3755
  for (; t;) {
3685
3756
  if (t.hasAttribute("data-markup-safe")) return !0;
@@ -3687,37 +3758,37 @@ function Oa(e) {
3687
3758
  }
3688
3759
  return !1;
3689
3760
  }
3690
- function ka(e) {
3761
+ function Na(e) {
3691
3762
  let t = /* @__PURE__ */ new Set(), n = [];
3692
3763
  function r(e) {
3693
3764
  t.has(e) || (t.add(e), n.push(e));
3694
3765
  }
3695
3766
  for (let e of document.querySelectorAll("[data-markup-private],[data-markup-redact]")) r(e);
3696
- for (let e of document.querySelectorAll(Da)) Oa(e) || r(e);
3767
+ for (let e of document.querySelectorAll(ja)) Ma(e) || r(e);
3697
3768
  if (e.redactSelector) try {
3698
- for (let t of document.querySelectorAll(e.redactSelector)) Oa(t) || r(t);
3769
+ for (let t of document.querySelectorAll(e.redactSelector)) Ma(t) || r(t);
3699
3770
  } catch (e) {
3700
3771
  F(e, { context: "screenshot-redact-selector" });
3701
3772
  }
3702
- if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Oa(e) || r(e);
3773
+ if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Ma(e) || r(e);
3703
3774
  return n;
3704
3775
  }
3705
- function Aa(e) {
3776
+ function Pa(e) {
3706
3777
  let t = e.getAttribute("style");
3707
- return e.setAttribute("style", t ? `${t};${Ea}` : Ea), () => {
3778
+ return e.setAttribute("style", t ? `${t};${Aa}` : Aa), () => {
3708
3779
  t === null ? e.removeAttribute("style") : e.setAttribute("style", t);
3709
3780
  };
3710
3781
  }
3711
- function ja(e) {
3782
+ function Fa(e) {
3712
3783
  if (e.id) return `#${CSS.escape(e.id)}`;
3713
3784
  let t = e.tagName.toLowerCase(), n = e.getAttribute("type"), r = e.getAttribute("name");
3714
3785
  return n && r ? `${t}[type="${n}"][name="${r}"]` : n ? `${t}[type="${n}"]` : r ? `${t}[name="${r}"]` : t;
3715
3786
  }
3716
- async function Ma(e, t, n) {
3787
+ async function Ia(e, t, n) {
3717
3788
  try {
3718
- let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = n ? ka(n) : [], s = o.map(ja), c = o.map(Aa), l;
3789
+ let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = n ? Na(n) : [], s = o.map(Fa), c = o.map(Pa), l;
3719
3790
  try {
3720
- l = await wa(document.documentElement, {
3791
+ l = await Oa(document.documentElement, {
3721
3792
  width: r,
3722
3793
  height: i,
3723
3794
  cacheBust: !0,
@@ -3736,17 +3807,17 @@ async function Ma(e, t, n) {
3736
3807
  }
3737
3808
  if (t) {
3738
3809
  let e = l.getContext("2d");
3739
- e && Pa(e, t.x, t.y, a);
3810
+ e && Ra(e, t.x, t.y, a);
3740
3811
  }
3741
- let u = await Na(l, .85);
3812
+ let u = await La(l, .85);
3742
3813
  if (!u) return null;
3743
- if (u.size <= Ta) return {
3814
+ if (u.size <= ka) return {
3744
3815
  blob: u,
3745
3816
  redactedCount: s.length,
3746
3817
  redactedSelectors: s
3747
3818
  };
3748
- let d = await Na(l, .5);
3749
- return !d || d.size > Ta ? null : {
3819
+ let d = await La(l, .5);
3820
+ return !d || d.size > ka ? null : {
3750
3821
  blob: d,
3751
3822
  redactedCount: s.length,
3752
3823
  redactedSelectors: s
@@ -3755,10 +3826,10 @@ async function Ma(e, t, n) {
3755
3826
  return F(e, { context: "screenshot-capture" }), null;
3756
3827
  }
3757
3828
  }
3758
- function Na(e, t) {
3829
+ function La(e, t) {
3759
3830
  return new Promise((n) => e.toBlob(n, "image/jpeg", t));
3760
3831
  }
3761
- function Pa(e, t, n, r) {
3832
+ function Ra(e, t, n, r) {
3762
3833
  let i = r, a = 28 * i, o = a / 2, s = t * i, c = n * i;
3763
3834
  e.save();
3764
3835
  let l = 2 * i;
@@ -3776,7 +3847,7 @@ function Pa(e, t, n, r) {
3776
3847
  }
3777
3848
  //#endregion
3778
3849
  //#region src/runtime/use-subscription-token.ts
3779
- var Fa = mr({
3850
+ var za = mr({
3780
3851
  idle: { issued: (e, t) => ({
3781
3852
  kind: "active",
3782
3853
  token: t.token,
@@ -3787,9 +3858,9 @@ var Fa = mr({
3787
3858
  token: t.token,
3788
3859
  expiresAt: t.expiresAt
3789
3860
  }) }
3790
- }), Ia = 30 * 6e4, La = 6e4, Ra = 6e4;
3791
- function za(e) {
3792
- let [t, n] = hr(Fa, { kind: "idle" });
3861
+ }), Ba = 30 * 6e4, Va = 6e4, Ha = 6e4;
3862
+ function Ua(e) {
3863
+ let [t, n] = hr(za, { kind: "idle" });
3793
3864
  return B(() => {
3794
3865
  let t = !1, r = null;
3795
3866
  async function i() {
@@ -3801,11 +3872,11 @@ function za(e) {
3801
3872
  token: a.token,
3802
3873
  expiresAt: a.expiresAt
3803
3874
  });
3804
- let o = Math.max(La, a.expiresAt - Date.now() - Ia);
3875
+ let o = Math.max(Va, a.expiresAt - Date.now() - Ba);
3805
3876
  r = setTimeout(i, o);
3806
3877
  } catch (e) {
3807
3878
  if (t) return;
3808
- e?.name !== "TypeError" && F(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ra);
3879
+ e?.name !== "TypeError" && F(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ha);
3809
3880
  }
3810
3881
  }
3811
3882
  return i(), () => {
@@ -3815,7 +3886,7 @@ function za(e) {
3815
3886
  }
3816
3887
  //#endregion
3817
3888
  //#region src/runtime/refresh-token.ts
3818
- async function Ba(e) {
3889
+ async function Wa(e) {
3819
3890
  try {
3820
3891
  let t = {
3821
3892
  method: "POST",
@@ -3851,8 +3922,8 @@ async function Ba(e) {
3851
3922
  }
3852
3923
  //#endregion
3853
3924
  //#region src/runtime/use-token-refresh.ts
3854
- var Va = 6e4, Ha = 500;
3855
- function Ua(e, t, n, r, i) {
3925
+ var Ga = 6e4, Ka = 500;
3926
+ function qa(e, t, n, r, i) {
3856
3927
  let a = e.kind === "verified", o = a ? e.identity.storage : void 0, s = a ? e.identity.refreshToken : void 0, c = a ? e.identity.refreshTokenExpiresAt : void 0, l = a ? e.identity.tokenExpiresAt : void 0;
3857
3928
  B(() => {
3858
3929
  if (!a || c == null || l == null || o === "localStorage" && s == null || o !== "cookies" && o !== "localStorage") return;
@@ -3861,8 +3932,8 @@ function Ua(e, t, n, r, i) {
3861
3932
  i();
3862
3933
  return;
3863
3934
  }
3864
- let d = Math.max(Ha, l - Va - u), f = new AbortController(), p = window.setTimeout(async () => {
3865
- let a = await Ba({
3935
+ let d = Math.max(Ka, l - Ga - u), f = new AbortController(), p = window.setTimeout(async () => {
3936
+ let a = await Wa({
3866
3937
  apiUrl: t,
3867
3938
  apiKey: n,
3868
3939
  mode: o,
@@ -3907,7 +3978,7 @@ function Q(...e) {
3907
3978
  }
3908
3979
  //#endregion
3909
3980
  //#region src/runtime/use-drag.ts
3910
- function Wa(e) {
3981
+ function Ja(e) {
3911
3982
  let t = V(e);
3912
3983
  t.current = e;
3913
3984
  let [n, r] = z(!1), i = V(!1);
@@ -3936,8 +4007,8 @@ function Wa(e) {
3936
4007
  g = !0, i.current = !0, r(!0), t.current.onStart?.();
3937
4008
  }
3938
4009
  let o = Math.max(m, window.innerWidth - d - m), v = Math.max(m, window.innerHeight - f - m), y = {
3939
- left: Ga(l + n, m, o),
3940
- top: Ga(u + a, m, v)
4010
+ left: Ya(l + n, m, o),
4011
+ top: Ya(u + a, m, v)
3941
4012
  };
3942
4013
  _ = y, t.current.onMove(y);
3943
4014
  }
@@ -3953,12 +4024,12 @@ function Wa(e) {
3953
4024
  consumeClickIfDragged: H(() => i.current ? (i.current = !1, !0) : !1, [])
3954
4025
  };
3955
4026
  }
3956
- function Ga(e, t, n) {
4027
+ function Ya(e, t, n) {
3957
4028
  return Math.max(t, Math.min(n, e));
3958
4029
  }
3959
4030
  //#endregion
3960
4031
  //#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
3961
- var Ka = 0;
4032
+ var Xa = 0;
3962
4033
  Array.isArray;
3963
4034
  function $(e, n, r, i, a, o) {
3964
4035
  n ||= {};
@@ -3975,7 +4046,7 @@ function $(e, n, r, i, a, o) {
3975
4046
  __e: null,
3976
4047
  __c: null,
3977
4048
  constructor: void 0,
3978
- __v: --Ka,
4049
+ __v: --Xa,
3979
4050
  __i: -1,
3980
4051
  __u: 0,
3981
4052
  __source: a,
@@ -3986,7 +4057,7 @@ function $(e, n, r, i, a, o) {
3986
4057
  }
3987
4058
  //#endregion
3988
4059
  //#region src/runtime/ui/icons.tsx
3989
- function qa({ size: e = 16 }) {
4060
+ function Za({ size: e = 16 }) {
3990
4061
  return /* @__PURE__ */ $("svg", {
3991
4062
  width: e,
3992
4063
  height: e,
@@ -3996,7 +4067,7 @@ function qa({ size: e = 16 }) {
3996
4067
  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" })
3997
4068
  });
3998
4069
  }
3999
- function Ja({ size: e = 16 }) {
4070
+ function Qa({ size: e = 16 }) {
4000
4071
  return /* @__PURE__ */ $("svg", {
4001
4072
  width: e,
4002
4073
  height: e,
@@ -4005,7 +4076,7 @@ function Ja({ size: e = 16 }) {
4005
4076
  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" })
4006
4077
  });
4007
4078
  }
4008
- function Ya({ size: e = 16 }) {
4079
+ function $a({ size: e = 16 }) {
4009
4080
  return /* @__PURE__ */ $("svg", {
4010
4081
  width: e,
4011
4082
  height: e,
@@ -4014,7 +4085,7 @@ function Ya({ size: e = 16 }) {
4014
4085
  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" })
4015
4086
  });
4016
4087
  }
4017
- function Xa({ size: e = 16 }) {
4088
+ function eo({ size: e = 16 }) {
4018
4089
  return /* @__PURE__ */ $("svg", {
4019
4090
  width: e,
4020
4091
  height: e,
@@ -4027,7 +4098,7 @@ function Xa({ size: e = 16 }) {
4027
4098
  })
4028
4099
  });
4029
4100
  }
4030
- function Za({ size: e = 16 }) {
4101
+ function to({ size: e = 16 }) {
4031
4102
  return /* @__PURE__ */ $("svg", {
4032
4103
  width: e,
4033
4104
  height: e,
@@ -4041,7 +4112,7 @@ function Za({ size: e = 16 }) {
4041
4112
  })
4042
4113
  });
4043
4114
  }
4044
- function Qa({ size: e = 16 }) {
4115
+ function no({ size: e = 16 }) {
4045
4116
  return /* @__PURE__ */ $("svg", {
4046
4117
  width: e,
4047
4118
  height: e,
@@ -4050,7 +4121,7 @@ function Qa({ size: e = 16 }) {
4050
4121
  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" })
4051
4122
  });
4052
4123
  }
4053
- function $a({ size: e = 16 }) {
4124
+ function ro({ size: e = 16 }) {
4054
4125
  return /* @__PURE__ */ $("svg", {
4055
4126
  width: e,
4056
4127
  height: e,
@@ -4062,8 +4133,8 @@ function $a({ size: e = 16 }) {
4062
4133
  }
4063
4134
  //#endregion
4064
4135
  //#region src/runtime/ui/fab.tsx
4065
- function eo({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
4066
- let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = z(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = Wa({
4136
+ function io({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
4137
+ let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = z(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = Ja({
4067
4138
  preventDefault: !0,
4068
4139
  stopPropagation: !0,
4069
4140
  onMove: l,
@@ -4095,7 +4166,7 @@ function eo({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
4095
4166
  "aria-pressed": e,
4096
4167
  children: [/* @__PURE__ */ $("span", {
4097
4168
  class: "markup-fab-icon",
4098
- children: $(e ? Ja : qa, { size: 16 })
4169
+ children: $(e ? Qa : Za, { size: 16 })
4099
4170
  }), o ? null : /* @__PURE__ */ $("span", {
4100
4171
  class: "markup-fab-label",
4101
4172
  children: e ? "Cancel" : "Markup"
@@ -4104,7 +4175,7 @@ function eo({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
4104
4175
  }
4105
4176
  //#endregion
4106
4177
  //#region src/runtime/use-focus-trap.ts
4107
- var to = [
4178
+ var ao = [
4108
4179
  "a[href]",
4109
4180
  "button:not([disabled])",
4110
4181
  "input:not([disabled])",
@@ -4112,14 +4183,14 @@ var to = [
4112
4183
  "textarea:not([disabled])",
4113
4184
  "[tabindex]:not([tabindex=\"-1\"])"
4114
4185
  ].join(",");
4115
- function no(e, t) {
4186
+ function oo(e, t) {
4116
4187
  B(() => {
4117
4188
  if (!t) return;
4118
4189
  let n = e.current;
4119
4190
  if (!n) return;
4120
4191
  function r(e) {
4121
4192
  if (e.key !== "Tab") return;
4122
- let t = Array.from(n.querySelectorAll(to)), r = t[0], i = t[t.length - 1];
4193
+ let t = Array.from(n.querySelectorAll(ao)), r = t[0], i = t[t.length - 1];
4123
4194
  if (!r || !i) return;
4124
4195
  let a = n.getRootNode(), o = a instanceof ShadowRoot ? a.activeElement : document.activeElement;
4125
4196
  (e.shiftKey ? o === r : o === i) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
@@ -4129,7 +4200,7 @@ function no(e, t) {
4129
4200
  }
4130
4201
  //#endregion
4131
4202
  //#region src/runtime/use-object-url.ts
4132
- function ro(e) {
4203
+ function so(e) {
4133
4204
  let [t, n] = z(null);
4134
4205
  return B(() => {
4135
4206
  if (!e) {
@@ -4142,7 +4213,7 @@ function ro(e) {
4142
4213
  }
4143
4214
  //#endregion
4144
4215
  //#region src/runtime/ui/author-prompt.tsx
4145
- function io({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
4216
+ function co({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
4146
4217
  let [o, s] = z(""), [c, l] = z(""), u = V(null);
4147
4218
  B(() => {
4148
4219
  u.current?.focus();
@@ -4221,8 +4292,8 @@ function io({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit:
4221
4292
  }
4222
4293
  //#endregion
4223
4294
  //#region src/runtime/ui/composer.tsx
4224
- var ao = 4e3;
4225
- function oo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, isPending: i, error: a, onSubmit: o }) {
4295
+ var lo = 4e3;
4296
+ function uo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, isPending: i, error: a, onSubmit: o }) {
4226
4297
  let [s, c] = z(""), l = V(null), u = V(!1);
4227
4298
  B(() => {
4228
4299
  r && l.current?.focus();
@@ -4232,7 +4303,7 @@ function oo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4232
4303
  }, [s]), B(() => {
4233
4304
  u.current && !i && !a && (c(""), l.current?.focus()), u.current = i;
4234
4305
  }, [i, a]);
4235
- let d = ao - s.length, f = d < 0;
4306
+ let d = lo - s.length, f = d < 0;
4236
4307
  function p(e) {
4237
4308
  e?.preventDefault();
4238
4309
  let t = s.trim();
@@ -4250,7 +4321,7 @@ function oo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4250
4321
  "aria-label": i ? "Sending…" : n,
4251
4322
  title: i ? "Sending…" : n,
4252
4323
  tabIndex: e,
4253
- children: /* @__PURE__ */ $(Qa, { size: 14 })
4324
+ children: /* @__PURE__ */ $(no, { size: 14 })
4254
4325
  });
4255
4326
  }
4256
4327
  return /* @__PURE__ */ $("form", {
@@ -4263,7 +4334,7 @@ function oo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4263
4334
  class: "markup-composer-input",
4264
4335
  placeholder: t,
4265
4336
  rows: h ? 2 : 1,
4266
- maxLength: ao + 100,
4337
+ maxLength: lo + 100,
4267
4338
  value: s,
4268
4339
  onInput: (e) => c(e.currentTarget.value),
4269
4340
  onKeyDown: m,
@@ -4299,10 +4370,10 @@ function oo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4299
4370
  }
4300
4371
  //#endregion
4301
4372
  //#region src/runtime/ui/new-thread-popover.tsx
4302
- function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, isPending: o, error: s, screenshot: c, isScreenshotCapturing: l, screenshotRedactedCount: u, screenshotRedactedSelectors: d, onAuthor: f, onSignIn: p, onSubmit: m, onClose: h }) {
4373
+ function fo({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, isPending: o, error: s, screenshot: c, isScreenshotCapturing: l, screenshotRedactedCount: u, screenshotRedactedSelectors: d, onAuthor: f, onSignIn: p, onSubmit: m, onClose: h }) {
4303
4374
  let g = V(null);
4304
- no(g, !0);
4305
- let [_, v] = z(!1), [y, b] = z(!1), x = ro(c), [C, w] = z(null), { onPointerDown: T, isDragging: E } = Wa({
4375
+ oo(g, !0);
4376
+ let [_, v] = z(!1), [y, b] = z(!1), x = so(c), [C, w] = z(null), { onPointerDown: T, isDragging: E } = Ja({
4306
4377
  targetRef: g,
4307
4378
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
4308
4379
  onMove: w
@@ -4318,7 +4389,7 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4318
4389
  }
4319
4390
  return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
4320
4391
  }, [h]);
4321
- let D = co(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), O = co(t - window.scrollY - 16, 12, window.innerHeight - 220), k = c != null, A = l || k;
4392
+ let D = po(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), O = po(t - window.scrollY - 16, 12, window.innerHeight - 220), k = c != null, A = l || k;
4322
4393
  return /* @__PURE__ */ $("div", {
4323
4394
  ref: g,
4324
4395
  class: Q("markup-popover", C && "is-floating", E && "is-dragging"),
@@ -4340,9 +4411,9 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4340
4411
  class: "markup-icon-btn",
4341
4412
  "aria-label": "Discard pin",
4342
4413
  onClick: h,
4343
- children: /* @__PURE__ */ $(Ja, { size: 16 })
4414
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4344
4415
  })]
4345
- }), n == null ? /* @__PURE__ */ $(io, {
4416
+ }), n == null ? /* @__PURE__ */ $(co, {
4346
4417
  isPending: o,
4347
4418
  isConnecting: i,
4348
4419
  isSigningIn: a,
@@ -4366,7 +4437,7 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4366
4437
  }) : null
4367
4438
  ]
4368
4439
  }),
4369
- /* @__PURE__ */ $(oo, {
4440
+ /* @__PURE__ */ $(uo, {
4370
4441
  label: "Feedback",
4371
4442
  placeholder: "What's wrong, missing, or worth noting?",
4372
4443
  submitLabel: "Post markup",
@@ -4384,7 +4455,7 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4384
4455
  class: "markup-screenshot-checkbox",
4385
4456
  disabled: !0
4386
4457
  }),
4387
- /* @__PURE__ */ $(Za, { size: 12 }),
4458
+ /* @__PURE__ */ $(to, { size: 12 }),
4388
4459
  /* @__PURE__ */ $("span", { children: "Capturing…" })
4389
4460
  ]
4390
4461
  }) : /* @__PURE__ */ $("label", {
@@ -4396,7 +4467,7 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4396
4467
  checked: _,
4397
4468
  onChange: (e) => v(e.currentTarget.checked)
4398
4469
  }),
4399
- /* @__PURE__ */ $(Za, { size: 12 }),
4470
+ /* @__PURE__ */ $(to, { size: 12 }),
4400
4471
  /* @__PURE__ */ $("span", { children: "Attach screenshot" }),
4401
4472
  x && _ ? /* @__PURE__ */ $("img", {
4402
4473
  class: "markup-screenshot-thumb",
@@ -4444,12 +4515,12 @@ function so({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4444
4515
  })]
4445
4516
  });
4446
4517
  }
4447
- function co(e, t, n) {
4518
+ function po(e, t, n) {
4448
4519
  return Math.max(t, Math.min(n, e));
4449
4520
  }
4450
4521
  //#endregion
4451
4522
  //#region src/runtime/ui/pin.tsx
4452
- function lo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClick: a }) {
4523
+ function mo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClick: a }) {
4453
4524
  let o = t - window.scrollY, s = e - window.scrollX;
4454
4525
  return /* @__PURE__ */ $("button", {
4455
4526
  type: "button",
@@ -4472,7 +4543,7 @@ function lo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClic
4472
4543
  }) : null]
4473
4544
  });
4474
4545
  }
4475
- function uo({ pageX: e, pageY: t }) {
4546
+ function ho({ pageX: e, pageY: t }) {
4476
4547
  let n = t - window.scrollY, r = e - window.scrollX;
4477
4548
  return /* @__PURE__ */ $("div", {
4478
4549
  class: "markup-pin markup-pin-ghost is-anchor",
@@ -4488,7 +4559,7 @@ function uo({ pageX: e, pageY: t }) {
4488
4559
  }
4489
4560
  //#endregion
4490
4561
  //#region src/runtime/ui/placement-overlay.tsx
4491
- function fo({ onPlace: e, onCancel: t }) {
4562
+ function go({ onPlace: e, onCancel: t }) {
4492
4563
  B(() => {
4493
4564
  function e(e) {
4494
4565
  e.key === "Escape" && t();
@@ -4514,14 +4585,14 @@ function fo({ onPlace: e, onCancel: t }) {
4514
4585
  }
4515
4586
  //#endregion
4516
4587
  //#region src/runtime/ui/thread-popover.tsx
4517
- var po = [
4588
+ var _o = [
4518
4589
  "👍",
4519
4590
  "❤️",
4520
4591
  "🎉",
4521
4592
  "😮",
4522
4593
  "😄",
4523
4594
  "❓"
4524
- ], mo = mr({
4595
+ ], vo = mr({
4525
4596
  none: {
4526
4597
  "toggle-thread-menu": () => ({
4527
4598
  kind: "thread-menu",
@@ -4577,13 +4648,13 @@ var po = [
4577
4648
  dismiss: () => ({ kind: "none" })
4578
4649
  }
4579
4650
  });
4580
- function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, canDelete: o, isPending: s, error: c, isHidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4581
- let y = V(null), b = V(null), x = V(null), S = V(null), [C, w] = hr(mo, { kind: "none" }), [T, E] = z(null), { onPointerDown: D, isDragging: O } = Wa({
4651
+ function yo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, canDelete: o, isPending: s, error: c, isHidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4652
+ let y = V(null), b = V(null), x = V(null), S = V(null), [C, w] = hr(vo, { kind: "none" }), [T, E] = z(null), { onPointerDown: D, isDragging: O } = Ja({
4582
4653
  targetRef: y,
4583
4654
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
4584
4655
  onMove: E
4585
4656
  });
4586
- no(y, !0);
4657
+ oo(y, !0);
4587
4658
  let k = e.resolvedAt != null, A = Me(() => e.comments.filter((e) => !e.deleted), [e.comments]);
4588
4659
  B(() => {
4589
4660
  if (C.kind === "none" || C.kind === "editing") return;
@@ -4629,8 +4700,8 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4629
4700
  anchorSelector: e.anchorSelector
4630
4701
  });
4631
4702
  return {
4632
- left: yo(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4633
- top: yo(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4703
+ left: Co(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4704
+ top: Co(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4634
4705
  };
4635
4706
  }, [
4636
4707
  e.anchorX,
@@ -4674,7 +4745,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4674
4745
  class: Q("markup-icon-btn", C.kind === "thread-menu" && "is-open"),
4675
4746
  title: "More options",
4676
4747
  onClick: () => w({ type: "toggle-thread-menu" }),
4677
- children: /* @__PURE__ */ $(Ya, { size: 16 })
4748
+ children: /* @__PURE__ */ $($a, { size: 16 })
4678
4749
  }), C.kind === "thread-menu" ? /* @__PURE__ */ $("div", {
4679
4750
  class: "markup-thread-menu-list",
4680
4751
  children: [/* @__PURE__ */ $("button", {
@@ -4702,14 +4773,14 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4702
4773
  title: "Mark as resolved",
4703
4774
  disabled: s,
4704
4775
  onClick: _,
4705
- children: /* @__PURE__ */ $(Xa, { size: 16 })
4776
+ children: /* @__PURE__ */ $(eo, { size: 16 })
4706
4777
  }) : null,
4707
4778
  /* @__PURE__ */ $("button", {
4708
4779
  type: "button",
4709
4780
  class: "markup-icon-btn",
4710
4781
  title: "Close thread",
4711
4782
  onClick: f,
4712
- children: /* @__PURE__ */ $(Ja, { size: 16 })
4783
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4713
4784
  })
4714
4785
  ]
4715
4786
  })]
@@ -4736,12 +4807,12 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4736
4807
  /* @__PURE__ */ $("time", {
4737
4808
  class: "markup-comment-time",
4738
4809
  datetime: new Date(t.createdAt).toISOString(),
4739
- title: xo(t.createdAt),
4740
- children: bo(t.createdAt)
4810
+ title: To(t.createdAt),
4811
+ children: wo(t.createdAt)
4741
4812
  }),
4742
4813
  /* @__PURE__ */ $("div", {
4743
4814
  class: "markup-thread-actions",
4744
- children: [!k && !l ? /* @__PURE__ */ $(go, {
4815
+ children: [!k && !l ? /* @__PURE__ */ $(bo, {
4745
4816
  comment: t,
4746
4817
  pickerOpen: p,
4747
4818
  pickerDirection: _,
@@ -4809,7 +4880,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4809
4880
  direction: a < i ? "up" : "down"
4810
4881
  });
4811
4882
  },
4812
- children: /* @__PURE__ */ $(Ya, { size: 16 })
4883
+ children: /* @__PURE__ */ $($a, { size: 16 })
4813
4884
  }), d ? /* @__PURE__ */ $("div", {
4814
4885
  class: "markup-thread-menu-list",
4815
4886
  children: [o ? /* @__PURE__ */ $("button", {
@@ -4881,7 +4952,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4881
4952
  children: [t.body, t.editedAt == null ? null : /* @__PURE__ */ $("time", {
4882
4953
  class: "markup-comment-edited",
4883
4954
  datetime: new Date(t.editedAt).toISOString(),
4884
- title: xo(t.editedAt),
4955
+ title: To(t.editedAt),
4885
4956
  children: [" ", "(edited)"]
4886
4957
  })]
4887
4958
  }),
@@ -4894,7 +4965,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4894
4965
  alt: "Screenshot"
4895
4966
  })
4896
4967
  }) : null,
4897
- !l && t.reactions.length > 0 ? /* @__PURE__ */ $(_o, {
4968
+ !l && t.reactions.length > 0 ? /* @__PURE__ */ $(xo, {
4898
4969
  comment: t,
4899
4970
  isResolved: k,
4900
4971
  onToggle: (e) => g(t._id, e)
@@ -4914,7 +4985,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4914
4985
  onClick: (e) => {
4915
4986
  e.stopPropagation(), x.current?.close();
4916
4987
  },
4917
- children: /* @__PURE__ */ $(Ja, { size: 16 })
4988
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4918
4989
  }), /* @__PURE__ */ $("img", {
4919
4990
  class: "markup-lightbox-img",
4920
4991
  src: e.screenshotUrl,
@@ -4922,7 +4993,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4922
4993
  onClick: (e) => e.stopPropagation()
4923
4994
  })]
4924
4995
  }) : null,
4925
- t == null ? /* @__PURE__ */ $(io, {
4996
+ t == null ? /* @__PURE__ */ $(co, {
4926
4997
  isPending: s,
4927
4998
  isConnecting: i,
4928
4999
  isSigningIn: a,
@@ -4944,7 +5015,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4944
5015
  children: "team"
4945
5016
  }) : null
4946
5017
  ]
4947
- }), /* @__PURE__ */ $(oo, {
5018
+ }), /* @__PURE__ */ $(uo, {
4948
5019
  label: "Reply",
4949
5020
  placeholder: "Write a reply…",
4950
5021
  submitLabel: "Reply",
@@ -4957,7 +5028,7 @@ function ho({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4957
5028
  ]
4958
5029
  });
4959
5030
  }
4960
- function go({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
5031
+ function bo({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
4961
5032
  return /* @__PURE__ */ $("div", {
4962
5033
  class: Q("markup-reaction-picker-wrap", t && "is-open", t && n === "up" && "is-up", r && "is-side"),
4963
5034
  ref: i,
@@ -4967,11 +5038,11 @@ function go({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4967
5038
  title: "Add reaction",
4968
5039
  "aria-label": "Add reaction",
4969
5040
  onClick: a,
4970
- children: /* @__PURE__ */ $($a, { size: 16 })
5041
+ children: /* @__PURE__ */ $(ro, { size: 16 })
4971
5042
  }), t ? /* @__PURE__ */ $("div", {
4972
5043
  class: "markup-reaction-picker",
4973
5044
  role: "menu",
4974
- children: po.map((t) => /* @__PURE__ */ $("button", {
5045
+ children: _o.map((t) => /* @__PURE__ */ $("button", {
4975
5046
  type: "button",
4976
5047
  role: "menuitem",
4977
5048
  class: Q("markup-reaction-picker-item", (e.reactions.find((e) => e.emoji === t)?.mine ?? !1) && "is-mine"),
@@ -4981,11 +5052,11 @@ function go({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4981
5052
  }) : null]
4982
5053
  });
4983
5054
  }
4984
- function _o({ comment: e, isResolved: t, onToggle: n }) {
5055
+ function xo({ comment: e, isResolved: t, onToggle: n }) {
4985
5056
  return /* @__PURE__ */ $("div", {
4986
5057
  class: "markup-reactions",
4987
5058
  children: e.reactions.map((e) => {
4988
- let r = vo(e.reactors, e.mine, e.count, e.emoji);
5059
+ let r = So(e.reactors, e.mine, e.count, e.emoji);
4989
5060
  return /* @__PURE__ */ $("button", {
4990
5061
  type: "button",
4991
5062
  class: Q("markup-reaction-chip", e.mine && "is-mine"),
@@ -5006,14 +5077,14 @@ function _o({ comment: e, isResolved: t, onToggle: n }) {
5006
5077
  })
5007
5078
  });
5008
5079
  }
5009
- function vo(e, t, n, r) {
5080
+ function So(e, t, n, r) {
5010
5081
  let i = e.slice(), a = i.length + +!!t, o = Math.max(0, n - a);
5011
5082
  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}`;
5012
5083
  }
5013
- function yo(e, t, n) {
5084
+ function Co(e, t, n) {
5014
5085
  return Math.max(t, Math.min(n, e));
5015
5086
  }
5016
- function bo(e) {
5087
+ function wo(e) {
5017
5088
  let t = Date.now() - e, n = Math.floor(t / 1e3);
5018
5089
  if (n < 60) return "just now";
5019
5090
  let r = Math.floor(n / 60);
@@ -5030,7 +5101,7 @@ function bo(e) {
5030
5101
  year: "numeric"
5031
5102
  });
5032
5103
  }
5033
- function xo(e) {
5104
+ function To(e) {
5034
5105
  return new Date(e).toLocaleDateString([], {
5035
5106
  month: "long",
5036
5107
  day: "numeric",
@@ -5041,7 +5112,7 @@ function xo(e) {
5041
5112
  }
5042
5113
  //#endregion
5043
5114
  //#region src/runtime/ui/app.tsx
5044
- function So(e) {
5115
+ function Eo(e) {
5045
5116
  let t = {
5046
5117
  clientId: `markup_user_${e.identity.id}`,
5047
5118
  name: e.identity.name,
@@ -5066,10 +5137,10 @@ function So(e) {
5066
5137
  } : {}
5067
5138
  };
5068
5139
  }
5069
- function Co() {
5140
+ function Do() {
5070
5141
  return window.location.host + window.location.pathname;
5071
5142
  }
5072
- var wo = mr({
5143
+ var Oo = mr({
5073
5144
  visible: {
5074
5145
  "hide-with-toast": () => ({ kind: "hidden-with-toast" }),
5075
5146
  toggle: () => ({ kind: "hidden" })
@@ -5080,26 +5151,26 @@ var wo = mr({
5080
5151
  },
5081
5152
  hidden: { toggle: () => ({ kind: "visible" }) }
5082
5153
  });
5083
- function To(e) {
5084
- return ni(e), e;
5154
+ function ko(e) {
5155
+ return oi(e), e;
5085
5156
  }
5086
- var Eo = mr({
5157
+ var Ao = mr({
5087
5158
  unresolved: {
5088
- "mint-success": (e, t) => To({
5159
+ "mint-success": (e, t) => ko({
5089
5160
  kind: "anon",
5090
5161
  identity: t.identity
5091
5162
  }),
5092
- "signed-in": (e, t) => To({
5163
+ "signed-in": (e, t) => ko({
5093
5164
  kind: "verified",
5094
5165
  identity: t.identity
5095
5166
  })
5096
5167
  },
5097
5168
  anon: {
5098
- "signed-in": (e, t) => To({
5169
+ "signed-in": (e, t) => ko({
5099
5170
  kind: "verified",
5100
5171
  identity: t.identity
5101
5172
  }),
5102
- "author-set": (e, t) => To({
5173
+ "author-set": (e, t) => ko({
5103
5174
  kind: "anon",
5104
5175
  identity: {
5105
5176
  ...e.identity,
@@ -5109,11 +5180,11 @@ var Eo = mr({
5109
5180
  })
5110
5181
  },
5111
5182
  verified: {
5112
- "signed-in": (e, t) => To({
5183
+ "signed-in": (e, t) => ko({
5113
5184
  kind: "verified",
5114
5185
  identity: t.identity
5115
5186
  }),
5116
- unauthorized: (e) => To({
5187
+ unauthorized: (e) => ko({
5117
5188
  kind: "recovering",
5118
5189
  preserved: {
5119
5190
  name: e.identity.name,
@@ -5122,32 +5193,32 @@ var Eo = mr({
5122
5193
  })
5123
5194
  },
5124
5195
  recovering: {
5125
- "mint-success": (e, t) => To({
5196
+ "mint-success": (e, t) => ko({
5126
5197
  kind: "anon",
5127
5198
  identity: t.identity
5128
5199
  }),
5129
- "signed-in": (e, t) => To({
5200
+ "signed-in": (e, t) => ko({
5130
5201
  kind: "verified",
5131
5202
  identity: t.identity
5132
5203
  })
5133
5204
  }
5134
5205
  });
5135
- function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
5136
- let [a, o] = z(Co), [s, c] = z([]), [l, u] = z(!1), d = Me(() => ti(), []), [f, p] = hr(Eo, d.state), [m, h] = z(null);
5206
+ function jo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
5207
+ let [a, o] = z(Do), [s, c] = z([]), [l, u] = z(!1), d = Me(() => ai(), []), [f, p] = hr(Ao, d.state), [m, h] = z(null);
5137
5208
  B(() => {
5138
5209
  let n = !1;
5139
- return Gr(e, t).then((e) => {
5210
+ return Yr(e, t).then((e) => {
5140
5211
  n || h(e);
5141
5212
  }), () => {
5142
5213
  n = !0;
5143
5214
  };
5144
5215
  }, [e, t]);
5145
5216
  let [g, _] = z(n), v = V(f);
5146
- v.current = f, Ua(f, e, t, (e) => p({
5217
+ v.current = f, qa(f, e, t, (e) => p({
5147
5218
  type: "signed-in",
5148
5219
  identity: e
5149
5220
  }), () => p({ type: "unauthorized" }));
5150
- let y = Me(() => Hr({
5221
+ let y = Me(() => Kr({
5151
5222
  apiUrl: e,
5152
5223
  apiKey: t,
5153
5224
  getToken: () => {
@@ -5172,7 +5243,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5172
5243
  e,
5173
5244
  t,
5174
5245
  p
5175
- ]), [b, x] = z({ kind: "idle" }), S = _r(), C = _r(), w = _r(), { run: T, reset: E } = S, { run: D } = C, { run: O, reset: k } = w, A = S.isPending, j = S.error ?? C.error ?? w.error, [M, N] = hr(wo, { kind: "visible" }), ee = M.kind !== "visible", [te, ne] = z(0), re = V(null), ie = ii(f), ae = f.kind === "verified", oe = f.kind === "unresolved" || f.kind === "recovering", P = ri(f);
5246
+ ]), [b, x] = z({ kind: "idle" }), S = _r(), C = _r(), w = _r(), { run: T, reset: E } = S, { run: D } = C, { run: O, reset: k } = w, A = S.isPending, j = S.error ?? C.error ?? w.error, [M, N] = hr(Oo, { kind: "visible" }), ee = M.kind !== "visible", [te, ne] = z(0), re = V(null), ie = ci(f), ae = f.kind === "verified", oe = f.kind === "unresolved" || f.kind === "recovering", P = si(f);
5176
5247
  B(() => {
5177
5248
  if (f.kind !== "unresolved" && f.kind !== "recovering") return;
5178
5249
  let e = f.kind === "recovering" ? f.preserved : d.preserved, t = !1, n = null, r = 1e3;
@@ -5200,7 +5271,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5200
5271
  p,
5201
5272
  d
5202
5273
  ]);
5203
- let se = za(y), [ce, le] = z(null);
5274
+ let se = Ua(y), [ce, le] = z(null);
5204
5275
  B(() => {
5205
5276
  let t = new pr(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
5206
5277
  return le(t), () => {
@@ -5234,7 +5305,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5234
5305
  }), history.replaceState(null, "", window.location.pathname + window.location.search);
5235
5306
  }
5236
5307
  ue.current = !0;
5237
- }, [s, l]), B(() => Zr(() => o(Co())), []), B(() => {
5308
+ }, [s, l]), B(() => ti(() => o(Do())), []), B(() => {
5238
5309
  function e(e) {
5239
5310
  e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), N({ type: "toggle" })));
5240
5311
  }
@@ -5291,7 +5362,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5291
5362
  strictScrub: i?.strictScrub,
5292
5363
  redactSelector: i?.redactSelector
5293
5364
  };
5294
- Ma(s, {
5365
+ Ia(s, {
5295
5366
  x: t,
5296
5367
  y: n
5297
5368
  }, c).then((e) => {
@@ -5311,7 +5382,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5311
5382
  });
5312
5383
  }, [p]), ge = C.isPending, _e = H(async () => {
5313
5384
  await D(async () => {
5314
- let n = So(await oi({
5385
+ let n = Eo(await ui({
5315
5386
  apiUrl: e,
5316
5387
  apiKey: t,
5317
5388
  useCookies: m === !0
@@ -5330,15 +5401,21 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5330
5401
  p
5331
5402
  ]), ve = H(async (e, t) => {
5332
5403
  if (b.kind !== "composing-new") return;
5333
- let n = ai(f);
5404
+ let n = li(f);
5334
5405
  n && await T(async () => {
5335
5406
  let r;
5336
5407
  if (t && b.screenshot) {
5337
- let { uploadUrl: e } = await y.getScreenshotUploadUrl(), t = await fetch(e, {
5338
- method: "POST",
5339
- headers: { "Content-Type": b.screenshot.type || "image/png" },
5340
- body: b.screenshot
5341
- });
5408
+ let { uploadUrl: e } = await y.getScreenshotUploadUrl(), t;
5409
+ try {
5410
+ t = await fetch(e, {
5411
+ method: "POST",
5412
+ headers: { "Content-Type": b.screenshot.type || "image/png" },
5413
+ body: b.screenshot,
5414
+ signal: AbortSignal.timeout(6e4)
5415
+ });
5416
+ } catch (e) {
5417
+ throw e instanceof DOMException && e.name === "TimeoutError" ? Error("Screenshot upload took too long — check your connection") : e;
5418
+ }
5342
5419
  if (!t.ok) throw Error(`Screenshot upload failed (${t.status})`);
5343
5420
  let { storageId: n } = await t.json();
5344
5421
  r = n;
@@ -5393,7 +5470,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5393
5470
  T
5394
5471
  ]), be = H(async (e) => {
5395
5472
  if (b.kind !== "thread") return;
5396
- let t = ai(f);
5473
+ let t = li(f);
5397
5474
  if (!t) return;
5398
5475
  let n = b.threadId;
5399
5476
  await T(async () => {
@@ -5435,7 +5512,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5435
5512
  T
5436
5513
  ]), Se = H(async (e, t) => {
5437
5514
  if (b.kind !== "thread") return;
5438
- let n = ai(f);
5515
+ let n = li(f);
5439
5516
  if (!n) return;
5440
5517
  let r = b.threadId;
5441
5518
  await O(async () => {
@@ -5489,7 +5566,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5489
5566
  class: "markup-pins-layer",
5490
5567
  children: [ee ? null : R.map(({ thread: e, point: t }) => {
5491
5568
  let n = b.kind === "thread" && b.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
5492
- return /* @__PURE__ */ $(lo, {
5569
+ return /* @__PURE__ */ $(mo, {
5493
5570
  pageX: t.pageX,
5494
5571
  pageY: t.pageY,
5495
5572
  count: r,
@@ -5500,16 +5577,16 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5500
5577
  threadId: e._id
5501
5578
  })
5502
5579
  }, e._id);
5503
- }), b.kind === "composing-new" ? /* @__PURE__ */ $(uo, {
5580
+ }), b.kind === "composing-new" ? /* @__PURE__ */ $(ho, {
5504
5581
  pageX: b.pageX,
5505
5582
  pageY: b.pageY
5506
5583
  }) : null]
5507
5584
  }),
5508
- b.kind === "placing" ? /* @__PURE__ */ $(fo, {
5585
+ b.kind === "placing" ? /* @__PURE__ */ $(go, {
5509
5586
  onPlace: me,
5510
5587
  onCancel: fe
5511
5588
  }) : null,
5512
- b.kind === "thread" && L ? /* @__PURE__ */ $(ho, {
5589
+ b.kind === "thread" && L ? /* @__PURE__ */ $(yo, {
5513
5590
  thread: L,
5514
5591
  authorName: ie,
5515
5592
  currentClientId: P ?? null,
@@ -5530,7 +5607,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5530
5607
  onDelete: ye,
5531
5608
  onResolve: F
5532
5609
  }, L._id) : null,
5533
- b.kind === "composing-new" ? /* @__PURE__ */ $(so, {
5610
+ b.kind === "composing-new" ? /* @__PURE__ */ $(fo, {
5534
5611
  pageX: b.pageX,
5535
5612
  pageY: b.pageY,
5536
5613
  authorName: ie,
@@ -5548,7 +5625,7 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5548
5625
  onSubmit: ve,
5549
5626
  onClose: fe
5550
5627
  }) : null,
5551
- !ee || b.kind === "placing" || b.kind === "composing-new" ? /* @__PURE__ */ $(eo, {
5628
+ !ee || b.kind === "placing" || b.kind === "composing-new" ? /* @__PURE__ */ $(io, {
5552
5629
  isActive: b.kind === "placing",
5553
5630
  onToggle: () => b.kind === "placing" ? fe() : de(),
5554
5631
  onHide: () => N({ type: "hide-with-toast" }),
@@ -5556,11 +5633,11 @@ function Do({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5556
5633
  onPositionChange: _,
5557
5634
  variant: r
5558
5635
  }) : null,
5559
- M.kind === "hidden-with-toast" ? /* @__PURE__ */ $(Oo, { position: g }) : null
5636
+ M.kind === "hidden-with-toast" ? /* @__PURE__ */ $(Mo, { position: g }) : null
5560
5637
  ]
5561
5638
  });
5562
5639
  }
5563
- function Oo({ position: e }) {
5640
+ function Mo({ position: e }) {
5564
5641
  let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
5565
5642
  return /* @__PURE__ */ $("div", {
5566
5643
  class: Q("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"),
@@ -5582,7 +5659,7 @@ function Oo({ position: e }) {
5582
5659
  }
5583
5660
  //#endregion
5584
5661
  //#region src/runtime/mount.tsx
5585
- function ko(e, t) {
5662
+ function No(e, t) {
5586
5663
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
5587
5664
  let n = t.theme ?? "auto";
5588
5665
  n !== "auto" && (e.dataset.theme = n);
@@ -5592,40 +5669,40 @@ function ko(e, t) {
5592
5669
  a.className = "markup-shadow-root", r.appendChild(a), ye({
5593
5670
  apiUrl: t.apiUrl,
5594
5671
  apiKey: t.apiKey,
5595
- widgetVersion: "1.10.0"
5672
+ widgetVersion: "1.11.0"
5596
5673
  });
5597
5674
  let { theme: o, ...s } = t;
5598
5675
  return le(/* @__PURE__ */ $(de, {
5599
5676
  onError: (e) => F(e, { context: "render" }),
5600
- children: /* @__PURE__ */ $(Do, { ...s })
5677
+ children: /* @__PURE__ */ $(jo, { ...s })
5601
5678
  }), a), () => {
5602
5679
  ye(null), le(null, a);
5603
5680
  };
5604
5681
  }
5605
5682
  //#endregion
5606
5683
  //#region src/widget.ts
5607
- var Ao = null, jo = null, Mo = null;
5608
- function No(e) {
5684
+ var Po = null, Fo = null, Io = null;
5685
+ function Lo(e) {
5609
5686
  if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
5610
- Po();
5687
+ Ro();
5611
5688
  let t = () => {
5612
- if (Mo = null, !document.body) return;
5689
+ if (Io = null, !document.body) return;
5613
5690
  let t = document.createElement("div");
5614
- t.id = "markup-widget", document.body.appendChild(t), jo = t, Ao = ko(t, e);
5691
+ t.id = "markup-widget", document.body.appendChild(t), Fo = t, Po = No(t, e);
5615
5692
  };
5616
5693
  if (document.readyState === "loading" || !document.body) {
5617
5694
  let e = () => t();
5618
- Mo = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5695
+ Io = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5619
5696
  } else t();
5620
- return Po;
5697
+ return Ro;
5621
5698
  }
5622
- function Po() {
5623
- Mo &&= (Mo(), null), Ao &&= (Ao(), null), jo?.parentNode && jo.parentNode.removeChild(jo), jo = null;
5699
+ function Ro() {
5700
+ Io &&= (Io(), null), Po &&= (Po(), null), Fo?.parentNode && Fo.parentNode.removeChild(Fo), Fo = null;
5624
5701
  }
5625
5702
  if (typeof document < "u") {
5626
5703
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5627
5704
  if (t && n) {
5628
- let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => No({
5705
+ let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Lo({
5629
5706
  apiUrl: t,
5630
5707
  apiKey: n,
5631
5708
  position: r,
@@ -5636,6 +5713,6 @@ if (typeof document < "u") {
5636
5713
  }
5637
5714
  }
5638
5715
  //#endregion
5639
- export { Po as destroy, No as init };
5716
+ export { Ro as destroy, Lo as init };
5640
5717
 
5641
5718
  //# sourceMappingURL=widget.js.map