@makefully/notefully 0.1.51 → 0.1.53

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/notefully.js CHANGED
@@ -1,4 +1,4 @@
1
- function Qe(t, e) {
1
+ function tn(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function Qe(t, e) {
8
8
  const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
9
9
  return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href;
10
10
  }
11
- const Ze = /* @__PURE__ */ (() => {
11
+ const en = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -16,33 +16,33 @@ const Ze = /* @__PURE__ */ (() => {
16
16
  );
17
17
  return () => (t += 1, `u${e()}${t}`);
18
18
  })();
19
- function U(t) {
19
+ function j(t) {
20
20
  const e = [];
21
21
  for (let n = 0, r = t.length; n < r; n++)
22
22
  e.push(t[n]);
23
23
  return e;
24
24
  }
25
- let G = null;
26
- function he(t = {}) {
27
- return G || (t.includeStyleProperties ? (G = t.includeStyleProperties, G) : (G = U(window.getComputedStyle(document.documentElement)), G));
25
+ let Z = null;
26
+ function pe(t = {}) {
27
+ return Z || (t.includeStyleProperties ? (Z = t.includeStyleProperties, Z) : (Z = j(window.getComputedStyle(document.documentElement)), Z));
28
28
  }
29
- function st(t, e) {
29
+ function lt(t, e) {
30
30
  const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
31
31
  return r ? parseFloat(r.replace("px", "")) : 0;
32
32
  }
33
- function tn(t) {
34
- const e = st(t, "border-left-width"), n = st(t, "border-right-width");
33
+ function nn(t) {
34
+ const e = lt(t, "border-left-width"), n = lt(t, "border-right-width");
35
35
  return t.clientWidth + e + n;
36
36
  }
37
- function en(t) {
38
- const e = st(t, "border-top-width"), n = st(t, "border-bottom-width");
37
+ function rn(t) {
38
+ const e = lt(t, "border-top-width"), n = lt(t, "border-bottom-width");
39
39
  return t.clientHeight + e + n;
40
40
  }
41
- function pe(t, e = {}) {
42
- const n = e.width || tn(t), r = e.height || en(t);
41
+ function ye(t, e = {}) {
42
+ const n = e.width || nn(t), r = e.height || rn(t);
43
43
  return { width: n, height: r };
44
44
  }
45
- function nn() {
45
+ function an() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -51,11 +51,11 @@ function nn() {
51
51
  const n = e && e.env ? e.env.devicePixelRatio : null;
52
52
  return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
53
  }
54
- const E = 16384;
55
- function rn(t) {
56
- (t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
54
+ const k = 16384;
55
+ function on(t) {
56
+ (t.width > k || t.height > k) && (t.width > k && t.height > k ? t.width > t.height ? (t.height *= k / t.width, t.width = k) : (t.width *= k / t.height, t.height = k) : t.width > k ? (t.height *= k / t.width, t.width = k) : (t.width *= k / t.height, t.height = k));
57
57
  }
58
- function ct(t) {
58
+ function ut(t) {
59
59
  return new Promise((e, n) => {
60
60
  const r = new Image();
61
61
  r.onload = () => {
@@ -65,77 +65,77 @@ function ct(t) {
65
65
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
66
66
  });
67
67
  }
68
- async function an(t) {
68
+ async function sn(t) {
69
69
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
70
70
  }
71
- async function on(t, e, n) {
71
+ async function cn(t, e, n) {
72
72
  const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
73
- return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${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(t), an(i);
73
+ return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${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(t), sn(i);
74
74
  }
75
- const x = (t, e) => {
75
+ const E = (t, e) => {
76
76
  if (t instanceof e)
77
77
  return !0;
78
78
  const n = Object.getPrototypeOf(t);
79
- return n === null ? !1 : n.constructor.name === e.name || x(n, e);
79
+ return n === null ? !1 : n.constructor.name === e.name || E(n, e);
80
80
  };
81
- function sn(t) {
81
+ function ln(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function cn(t, e) {
86
- return he(e).map((n) => {
85
+ function un(t, e) {
86
+ return pe(e).map((n) => {
87
87
  const r = t.getPropertyValue(n), i = t.getPropertyPriority(n);
88
88
  return `${n}: ${r}${i ? " !important" : ""};`;
89
89
  }).join(" ");
90
90
  }
91
- function ln(t, e, n, r) {
92
- const i = `.${t}:${e}`, a = n.cssText ? sn(n) : cn(n, r);
91
+ function dn(t, e, n, r) {
92
+ const i = `.${t}:${e}`, a = n.cssText ? ln(n) : un(n, r);
93
93
  return document.createTextNode(`${i}{${a}}`);
94
94
  }
95
- function Kt(t, e, n, r) {
95
+ function qt(t, e, n, r) {
96
96
  const i = window.getComputedStyle(t, n), a = i.getPropertyValue("content");
97
97
  if (a === "" || a === "none")
98
98
  return;
99
- const o = Ze();
99
+ const o = en();
100
100
  try {
101
101
  e.className = `${e.className} ${o}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const c = document.createElement("style");
106
- c.appendChild(ln(o, n, i, r)), e.appendChild(c);
106
+ c.appendChild(dn(o, n, i, r)), e.appendChild(c);
107
107
  }
108
- function un(t, e, n) {
109
- Kt(t, e, ":before", n), Kt(t, e, ":after", n);
108
+ function fn(t, e, n) {
109
+ qt(t, e, ":before", n), qt(t, e, ":after", n);
110
110
  }
111
- const qt = "application/font-woff", Xt = "image/jpeg", dn = {
112
- woff: qt,
113
- woff2: qt,
111
+ const Xt = "application/font-woff", Yt = "image/jpeg", hn = {
112
+ woff: Xt,
113
+ woff2: Xt,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: Xt,
118
- jpeg: Xt,
117
+ jpg: Yt,
118
+ jpeg: Yt,
119
119
  gif: "image/gif",
120
120
  tiff: "image/tiff",
121
121
  svg: "image/svg+xml",
122
122
  webp: "image/webp"
123
123
  };
124
- function fn(t) {
124
+ function pn(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
- function Bt(t) {
129
- const e = fn(t).toLowerCase();
130
- return dn[e] || "";
128
+ function Ht(t) {
129
+ const e = pn(t).toLowerCase();
130
+ return hn[e] || "";
131
131
  }
132
- function hn(t) {
132
+ function yn(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
- function Lt(t) {
135
+ function $t(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function pn(t, e) {
138
+ function mn(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
141
  async function me(t, e, n) {
@@ -154,84 +154,84 @@ async function me(t, e, n) {
154
154
  }, c.readAsDataURL(i);
155
155
  });
156
156
  }
157
- const St = {};
158
- function mn(t, e, n) {
157
+ const Et = {};
158
+ function gn(t, e, n) {
159
159
  let r = t.replace(/\?.*/, "");
160
160
  return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
161
161
  }
162
- async function Dt(t, e, n) {
163
- const r = mn(t, e, n.includeQueryParams);
164
- if (St[r] != null)
165
- return St[r];
162
+ async function Ft(t, e, n) {
163
+ const r = gn(t, e, n.includeQueryParams);
164
+ if (Et[r] != null)
165
+ return Et[r];
166
166
  n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
167
  let i;
168
168
  try {
169
- const a = await me(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), hn(c)));
170
- i = pn(a, e);
169
+ const a = await me(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), yn(c)));
170
+ i = mn(a, e);
171
171
  } catch (a) {
172
172
  i = n.imagePlaceholder || "";
173
173
  let o = `Failed to fetch resource: ${t}`;
174
174
  a && (o = typeof a == "string" ? a : a.message), o && console.warn(o);
175
175
  }
176
- return St[r] = i, i;
176
+ return Et[r] = i, i;
177
177
  }
178
- async function yn(t) {
178
+ async function wn(t) {
179
179
  const e = t.toDataURL();
180
- return e === "data:," ? t.cloneNode(!1) : ct(e);
180
+ return e === "data:," ? t.cloneNode(!1) : ut(e);
181
181
  }
182
- async function gn(t, e) {
182
+ async function vn(t, e) {
183
183
  if (t.currentSrc) {
184
184
  const a = document.createElement("canvas"), o = a.getContext("2d");
185
185
  a.width = t.clientWidth, a.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, a.width, a.height);
186
186
  const c = a.toDataURL();
187
- return ct(c);
187
+ return ut(c);
188
188
  }
189
- const n = t.poster, r = Bt(n), i = await Dt(n, r, e);
190
- return ct(i);
189
+ const n = t.poster, r = Ht(n), i = await Ft(n, r, e);
190
+ return ut(i);
191
191
  }
192
- async function wn(t, e) {
192
+ async function bn(t, e) {
193
193
  var n;
194
194
  try {
195
195
  if (!((n = t == null ? void 0 : t.contentDocument) === null || n === void 0) && n.body)
196
- return await yt(t.contentDocument.body, e, !0);
196
+ return await wt(t.contentDocument.body, e, !0);
197
197
  } catch {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function vn(t, e) {
202
- return x(t, HTMLCanvasElement) ? yn(t) : x(t, HTMLVideoElement) ? gn(t, e) : x(t, HTMLIFrameElement) ? wn(t, e) : t.cloneNode(ye(t));
201
+ async function Sn(t, e) {
202
+ return E(t, HTMLCanvasElement) ? wn(t) : E(t, HTMLVideoElement) ? vn(t, e) : E(t, HTMLIFrameElement) ? bn(t, e) : t.cloneNode(ge(t));
203
203
  }
204
- const bn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ye = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Sn(t, e, n) {
204
+ const xn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ge = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function En(t, e, n) {
206
206
  var r, i;
207
- if (ye(e))
207
+ if (ge(e))
208
208
  return e;
209
209
  let a = [];
210
- return bn(t) && t.assignedNodes ? a = U(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? a = U(t.contentDocument.body.childNodes) : a = U(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || x(t, HTMLVideoElement) || await a.reduce((o, c) => o.then(() => yt(c, n)).then((l) => {
210
+ return xn(t) && t.assignedNodes ? a = j(t.assignedNodes()) : E(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? a = j(t.contentDocument.body.childNodes) : a = j(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || E(t, HTMLVideoElement) || await a.reduce((o, c) => o.then(() => wt(c, n)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function xn(t, e, n) {
214
+ function Cn(t, e, n) {
215
215
  const r = e.style;
216
216
  if (!r)
217
217
  return;
218
218
  const i = window.getComputedStyle(t);
219
- i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : he(n).forEach((a) => {
219
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : pe(n).forEach((a) => {
220
220
  let o = i.getPropertyValue(a);
221
- a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(a, o, i.getPropertyPriority(a));
221
+ a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), E(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(a, o, i.getPropertyPriority(a));
222
222
  });
223
223
  }
224
- function En(t, e) {
225
- x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
224
+ function kn(t, e) {
225
+ E(t, HTMLTextAreaElement) && (e.innerHTML = t.value), E(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function Cn(t, e) {
228
- if (x(t, HTMLSelectElement)) {
227
+ function Ln(t, e) {
228
+ if (E(t, HTMLSelectElement)) {
229
229
  const r = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
230
230
  r && r.setAttribute("selected", "");
231
231
  }
232
232
  }
233
233
  function An(t, e, n) {
234
- return x(e, Element) && (xn(t, e, n), un(t, e, n), En(t, e), Cn(t, e)), e;
234
+ return E(e, Element) && (Cn(t, e, n), fn(t, e, n), kn(t, e), Ln(t, e)), e;
235
235
  }
236
236
  async function Mn(t, e) {
237
237
  const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
@@ -242,7 +242,7 @@ async function Mn(t, e) {
242
242
  const c = n[a].getAttribute("xlink:href");
243
243
  if (c) {
244
244
  const l = t.querySelector(c), u = document.querySelector(c);
245
- !l && u && !r[c] && (r[c] = await yt(u, e, !0));
245
+ !l && u && !r[c] && (r[c] = await wt(u, e, !0));
246
246
  }
247
247
  }
248
248
  const i = Object.values(r);
@@ -257,31 +257,31 @@ async function Mn(t, e) {
257
257
  }
258
258
  return t;
259
259
  }
260
- async function yt(t, e, n) {
261
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => vn(r, e)).then((r) => Sn(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
260
+ async function wt(t, e, n) {
261
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Sn(r, e)).then((r) => En(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
262
262
  }
263
- const ge = /url\((['"]?)([^'"]+?)\1\)/g, Ln = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $n = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function Rn(t) {
263
+ const we = /url\((['"]?)([^'"]+?)\1\)/g, $n = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Rn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function Tn(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function kn(t) {
268
+ function Pn(t) {
269
269
  const e = [];
270
- return t.replace(ge, (n, r, i) => (e.push(i), n)), e.filter((n) => !Lt(n));
270
+ return t.replace(we, (n, r, i) => (e.push(i), n)), e.filter((n) => !$t(n));
271
271
  }
272
- async function Tn(t, e, n, r, i) {
272
+ async function In(t, e, n, r, i) {
273
273
  try {
274
- const a = n ? Qe(e, n) : e, o = Bt(e);
274
+ const a = n ? tn(e, n) : e, o = Ht(e);
275
275
  let c;
276
- return i || (c = await Dt(a, o, r)), t.replace(Rn(e), `$1${c}$3`);
276
+ return i || (c = await Ft(a, o, r)), t.replace(Tn(e), `$1${c}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function Pn(t, { preferredFontFormat: e }) {
282
- return e ? t.replace($n, (n) => {
281
+ function On(t, { preferredFontFormat: e }) {
282
+ return e ? t.replace(Rn, (n) => {
283
283
  for (; ; ) {
284
- const [r, , i] = Ln.exec(n) || [];
284
+ const [r, , i] = $n.exec(n) || [];
285
285
  if (!i)
286
286
  return "";
287
287
  if (i === e)
@@ -289,32 +289,32 @@ function Pn(t, { preferredFontFormat: e }) {
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function we(t) {
293
- return t.search(ge) !== -1;
292
+ function ve(t) {
293
+ return t.search(we) !== -1;
294
294
  }
295
- async function ve(t, e, n) {
296
- if (!we(t))
295
+ async function be(t, e, n) {
296
+ if (!ve(t))
297
297
  return t;
298
- const r = Pn(t, n);
299
- return kn(r).reduce((a, o) => a.then((c) => Tn(c, o, e, n)), Promise.resolve(r));
298
+ const r = On(t, n);
299
+ return Pn(r).reduce((a, o) => a.then((c) => In(c, o, e, n)), Promise.resolve(r));
300
300
  }
301
- async function J(t, e, n) {
301
+ async function tt(t, e, n) {
302
302
  var r;
303
303
  const i = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
304
304
  if (i) {
305
- const a = await ve(i, null, n);
305
+ const a = await be(i, null, n);
306
306
  return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
307
307
  }
308
308
  return !1;
309
309
  }
310
- async function In(t, e) {
311
- await J("background", t, e) || await J("background-image", t, e), await J("mask", t, e) || await J("-webkit-mask", t, e) || await J("mask-image", t, e) || await J("-webkit-mask-image", t, e);
310
+ async function Bn(t, e) {
311
+ await tt("background", t, e) || await tt("background-image", t, e), await tt("mask", t, e) || await tt("-webkit-mask", t, e) || await tt("mask-image", t, e) || await tt("-webkit-mask-image", t, e);
312
312
  }
313
- async function On(t, e) {
314
- const n = x(t, HTMLImageElement);
315
- if (!(n && !Lt(t.src)) && !(x(t, SVGImageElement) && !Lt(t.href.baseVal)))
313
+ async function Dn(t, e) {
314
+ const n = E(t, HTMLImageElement);
315
+ if (!(n && !$t(t.src)) && !(E(t, SVGImageElement) && !$t(t.href.baseVal)))
316
316
  return;
317
- const r = n ? t.src : t.href.baseVal, i = await Dt(r, Bt(r), e);
317
+ const r = n ? t.src : t.href.baseVal, i = await Ft(r, Ht(r), e);
318
318
  await new Promise((a, o) => {
319
319
  t.onload = a, t.onerror = e.onImageErrorHandler ? (...l) => {
320
320
  try {
@@ -327,14 +327,14 @@ async function On(t, e) {
327
327
  c.decode && (c.decode = a), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
328
328
  });
329
329
  }
330
- async function Bn(t, e) {
331
- const r = U(t.childNodes).map((i) => be(i, e));
330
+ async function Hn(t, e) {
331
+ const r = j(t.childNodes).map((i) => Se(i, e));
332
332
  await Promise.all(r).then(() => t);
333
333
  }
334
- async function be(t, e) {
335
- x(t, Element) && (await In(t, e), await On(t, e), await Bn(t, e));
334
+ async function Se(t, e) {
335
+ E(t, Element) && (await Bn(t, e), await Dn(t, e), await Hn(t, e));
336
336
  }
337
- function Dn(t, e) {
337
+ function Fn(t, e) {
338
338
  const { style: n } = t;
339
339
  e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
340
340
  const r = e.style;
@@ -342,15 +342,15 @@ function Dn(t, e) {
342
342
  n[i] = r[i];
343
343
  }), t;
344
344
  }
345
- const Yt = {};
346
- async function Gt(t) {
347
- let e = Yt[t];
345
+ const Gt = {};
346
+ async function Jt(t) {
347
+ let e = Gt[t];
348
348
  if (e != null)
349
349
  return e;
350
350
  const r = await (await fetch(t)).text();
351
- return e = { url: t, cssText: r }, Yt[t] = e, e;
351
+ return e = { url: t, cssText: r }, Gt[t] = e, e;
352
352
  }
353
- async function Jt(t, e) {
353
+ async function Qt(t, e) {
354
354
  let n = t.cssText;
355
355
  const r = /url\(["']?([^"')]+)["']?\)/g, a = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
356
356
  let c = o.replace(r, "$1");
@@ -358,7 +358,7 @@ async function Jt(t, e) {
358
358
  });
359
359
  return Promise.all(a).then(() => n);
360
360
  }
361
- function Qt(t) {
361
+ function Zt(t) {
362
362
  if (t == null)
363
363
  return [];
364
364
  const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
@@ -384,20 +384,20 @@ function Qt(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function Hn(t, e) {
387
+ async function Un(t, e) {
388
388
  const n = [], r = [];
389
389
  return t.forEach((i) => {
390
390
  if ("cssRules" in i)
391
391
  try {
392
- U(i.cssRules || []).forEach((a, o) => {
392
+ j(i.cssRules || []).forEach((a, o) => {
393
393
  if (a.type === CSSRule.IMPORT_RULE) {
394
394
  let c = o + 1;
395
- const l = a.href, u = Gt(l).then((f) => Jt(f, e)).then((f) => Qt(f).forEach((m) => {
395
+ const l = a.href, u = Jt(l).then((f) => Qt(f, e)).then((f) => Zt(f).forEach((y) => {
396
396
  try {
397
- i.insertRule(m, m.startsWith("@import") ? c += 1 : i.cssRules.length);
397
+ i.insertRule(y, y.startsWith("@import") ? c += 1 : i.cssRules.length);
398
398
  } catch (g) {
399
399
  console.error("Error inserting rule from remote css", {
400
- rule: m,
400
+ rule: y,
401
401
  error: g
402
402
  });
403
403
  }
@@ -409,7 +409,7 @@ async function Hn(t, e) {
409
409
  });
410
410
  } catch (a) {
411
411
  const o = t.find((c) => c.href == null) || document.styleSheets[0];
412
- i.href != null && r.push(Gt(i.href).then((c) => Jt(c, e)).then((c) => Qt(c).forEach((l) => {
412
+ i.href != null && r.push(Jt(i.href).then((c) => Qt(c, e)).then((c) => Zt(c).forEach((l) => {
413
413
  o.insertRule(l, o.cssRules.length);
414
414
  })).catch((c) => {
415
415
  console.error("Error loading remote stylesheet", c);
@@ -418,7 +418,7 @@ async function Hn(t, e) {
418
418
  }), Promise.all(r).then(() => (t.forEach((i) => {
419
419
  if ("cssRules" in i)
420
420
  try {
421
- U(i.cssRules || []).forEach((a) => {
421
+ j(i.cssRules || []).forEach((a) => {
422
422
  n.push(a);
423
423
  });
424
424
  } catch (a) {
@@ -426,60 +426,60 @@ async function Hn(t, e) {
426
426
  }
427
427
  }), n));
428
428
  }
429
- function Fn(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => we(e.style.getPropertyValue("src")));
429
+ function Nn(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ve(e.style.getPropertyValue("src")));
431
431
  }
432
- async function Un(t, e) {
432
+ async function _n(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const n = U(t.ownerDocument.styleSheets), r = await Hn(n, e);
436
- return Fn(r);
435
+ const n = j(t.ownerDocument.styleSheets), r = await Un(n, e);
436
+ return Nn(r);
437
437
  }
438
- function Se(t) {
438
+ function xe(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function Nn(t) {
441
+ function jn(t) {
442
442
  const e = /* @__PURE__ */ new Set();
443
443
  function n(r) {
444
444
  (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((a) => {
445
- e.add(Se(a));
445
+ e.add(xe(a));
446
446
  }), Array.from(r.children).forEach((a) => {
447
447
  a instanceof HTMLElement && n(a);
448
448
  });
449
449
  }
450
450
  return n(t), e;
451
451
  }
452
- async function jn(t, e) {
453
- const n = await Un(t, e), r = Nn(t);
454
- return (await Promise.all(n.filter((a) => r.has(Se(a.style.fontFamily))).map((a) => {
452
+ async function Vn(t, e) {
453
+ const n = await _n(t, e), r = jn(t);
454
+ return (await Promise.all(n.filter((a) => r.has(xe(a.style.fontFamily))).map((a) => {
455
455
  const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
456
- return ve(a.cssText, o, e);
456
+ return be(a.cssText, o, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function _n(t, e) {
461
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await jn(t, e);
460
+ async function Wn(t, e) {
461
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Vn(t, e);
462
462
  if (n) {
463
463
  const r = document.createElement("style"), i = document.createTextNode(n);
464
464
  r.appendChild(i), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
465
465
  }
466
466
  }
467
- async function Vn(t, e = {}) {
468
- const { width: n, height: r } = pe(t, e), i = await yt(t, e, !0);
469
- return await _n(i, e), await be(i, e), Dn(i, e), await on(i, n, r);
467
+ async function zn(t, e = {}) {
468
+ const { width: n, height: r } = ye(t, e), i = await wt(t, e, !0);
469
+ return await Wn(i, e), await Se(i, e), Fn(i, e), await cn(i, n, r);
470
470
  }
471
- async function Wn(t, e = {}) {
472
- const { width: n, height: r } = pe(t, e), i = await Vn(t, e), a = await ct(i), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || nn(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
- return o.width = u * l, o.height = f * l, e.skipAutoScale || rn(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(a, 0, 0, o.width, o.height), o;
471
+ async function Kn(t, e = {}) {
472
+ const { width: n, height: r } = ye(t, e), i = await zn(t, e), a = await ut(i), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || an(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
+ return o.width = u * l, o.height = f * l, e.skipAutoScale || on(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(a, 0, 0, o.width, o.height), o;
474
474
  }
475
- async function Zt(t, e = {}) {
476
- return (await Wn(t, e)).toDataURL();
475
+ async function te(t, e = {}) {
476
+ return (await Kn(t, e)).toDataURL();
477
477
  }
478
- const lt = "data-nf-capture-chrome", zn = "data-nf-canvas-snap", Kn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
- function xe(t) {
480
- return t instanceof Element && (t.hasAttribute(lt) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
478
+ const dt = "data-nf-capture-chrome", qn = "data-nf-canvas-snap", Xn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
+ function Ee(t) {
480
+ return t instanceof Element && (t.hasAttribute(dt) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
481
481
  }
482
- function qn() {
482
+ function Yn() {
483
483
  const t = [];
484
484
  return Array.from(document.styleSheets).forEach((e) => {
485
485
  try {
@@ -503,7 +503,7 @@ function qn() {
503
503
  });
504
504
  };
505
505
  }
506
- function Xn() {
506
+ function Gn() {
507
507
  const t = [];
508
508
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
509
509
  const r = n.getBoundingClientRect(), i = document.createElement("div");
@@ -519,28 +519,28 @@ function Xn() {
519
519
  ].join(";"), document.body.appendChild(i), t.push(i);
520
520
  }), () => t.forEach((n) => n.remove());
521
521
  }
522
- function Yn() {
523
- const t = document.querySelector(`[${lt}]`);
522
+ function Jn() {
523
+ const t = document.querySelector(`[${dt}]`);
524
524
  if (t)
525
525
  return t;
526
526
  const e = document.createElement("div");
527
- return e.setAttribute(lt, "1"), e.className = "nf-capture-chrome", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.innerHTML = '<span class="nf-capture-chrome-pill">Capturing…</span>', document.body.appendChild(e), e;
527
+ return e.setAttribute(dt, "1"), e.className = "nf-capture-chrome", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.innerHTML = '<span class="nf-capture-chrome-pill">Capturing…</span>', document.body.appendChild(e), e;
528
528
  }
529
- function Gn() {
530
- document.querySelectorAll(`[${lt}]`).forEach((t) => t.remove());
529
+ function Qn() {
530
+ document.querySelectorAll(`[${dt}]`).forEach((t) => t.remove());
531
531
  }
532
- function $t() {
532
+ function Rt() {
533
533
  return new Promise((t) => {
534
534
  requestAnimationFrame(() => requestAnimationFrame(t));
535
535
  });
536
536
  }
537
- function N(t) {
537
+ function V(t) {
538
538
  if (typeof t != "string" || !t.startsWith("data:image/"))
539
539
  return !1;
540
540
  const e = t.indexOf(",");
541
541
  return e > 0 && e < t.length - 1;
542
542
  }
543
- function Jn() {
543
+ function Zn() {
544
544
  const t = document.documentElement, e = document.body, n = Math.max(
545
545
  window.innerWidth || 0,
546
546
  (t == null ? void 0 : t.clientWidth) || 0,
@@ -556,10 +556,10 @@ function Jn() {
556
556
  );
557
557
  return { width: n, height: r };
558
558
  }
559
- async function Qn() {
559
+ async function tr() {
560
560
  const t = [], e = Array.from(document.querySelectorAll("canvas"));
561
561
  for (const n of e) {
562
- if (n.closest("#notefully") || xe(n))
562
+ if (n.closest("#notefully") || Ee(n))
563
563
  continue;
564
564
  let r = "";
565
565
  try {
@@ -570,7 +570,7 @@ async function Qn() {
570
570
  if (!r || r === "data:,")
571
571
  continue;
572
572
  const i = document.createElement("img"), a = getComputedStyle(n);
573
- i.setAttribute(zn, "1"), i.alt = "", i.src = r, i.className = n.className, i.style.cssText = n.style.cssText, i.style.width = a.width, i.style.height = a.height, i.style.maxWidth = a.maxWidth, i.style.maxHeight = a.maxHeight, i.style.objectFit = "fill", i.style.display = a.display === "inline" ? "inline-block" : a.display, n.replaceWith(i), t.push({ canvas: n, img: i });
573
+ i.setAttribute(qn, "1"), i.alt = "", i.src = r, i.className = n.className, i.style.cssText = n.style.cssText, i.style.width = a.width, i.style.height = a.height, i.style.maxWidth = a.maxWidth, i.style.maxHeight = a.maxHeight, i.style.objectFit = "fill", i.style.display = a.display === "inline" ? "inline-block" : a.display, n.replaceWith(i), t.push({ canvas: n, img: i });
574
574
  }
575
575
  return await Promise.all(t.map(({ img: n }) => {
576
576
  if (!n.complete)
@@ -586,25 +586,25 @@ async function Qn() {
586
586
  });
587
587
  };
588
588
  }
589
- async function Zn(t) {
589
+ async function er(t) {
590
590
  if (!t)
591
591
  return null;
592
592
  if (typeof t == "string")
593
- return N(t) ? t : null;
593
+ return V(t) ? t : null;
594
594
  if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
595
595
  try {
596
596
  const e = t.toDataURL("image/png");
597
- return N(e) ? e : null;
597
+ return V(e) ? e : null;
598
598
  } catch {
599
599
  return null;
600
600
  }
601
601
  if (typeof Blob < "u" && t instanceof Blob) {
602
- const e = await tr(t);
603
- return N(e) ? e : null;
602
+ const e = await nr(t);
603
+ return V(e) ? e : null;
604
604
  }
605
605
  return null;
606
606
  }
607
- async function tr(t) {
607
+ async function nr(t) {
608
608
  if (typeof FileReader == "function")
609
609
  return new Promise((r, i) => {
610
610
  const a = new FileReader();
@@ -613,7 +613,7 @@ async function tr(t) {
613
613
  const e = Buffer.from(await t.arrayBuffer());
614
614
  return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
615
615
  }
616
- async function er() {
616
+ async function rr() {
617
617
  var e;
618
618
  if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
619
619
  throw new Error("Screen capture is not supported in this browser.");
@@ -627,48 +627,48 @@ async function er() {
627
627
  const n = document.createElement("video");
628
628
  n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
629
629
  n.onloadedmetadata = () => c();
630
- }), await $t();
630
+ }), await Rt();
631
631
  const r = n.videoWidth || 1, i = n.videoHeight || 1, a = document.createElement("canvas");
632
632
  a.width = r, a.height = i, a.getContext("2d").drawImage(n, 0, 0, r, i);
633
633
  const o = a.toDataURL("image/png");
634
- if (!N(o))
634
+ if (!V(o))
635
635
  throw new Error("Screen capture produced an empty image.");
636
636
  return o;
637
637
  } finally {
638
638
  t.getTracks().forEach((n) => n.stop());
639
639
  }
640
640
  }
641
- async function Ee(t = {}) {
642
- const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = Yn(), i = qn();
641
+ async function Ce(t = {}) {
642
+ const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = Jn(), i = Yn();
643
643
  let a = () => {
644
644
  };
645
645
  e && (e.style.display = "none");
646
- const o = Xn();
646
+ const o = Gn();
647
647
  try {
648
- if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await $t(), typeof t.capture == "function") {
649
- const m = await Zn(await t.capture());
650
- if (m)
651
- return m;
648
+ if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await Rt(), typeof t.capture == "function") {
649
+ const y = await er(await t.capture());
650
+ if (y)
651
+ return y;
652
652
  }
653
- a = await Qn(), await $t();
654
- const { width: c, height: l } = Jn(), u = {
653
+ a = await tr(), await Rt();
654
+ const { width: c, height: l } = Zn(), u = {
655
655
  cacheBust: !0,
656
656
  width: c,
657
657
  height: l,
658
658
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
659
- filter: (m) => !xe(m),
659
+ filter: (y) => !Ee(y),
660
660
  // 404 / CORS images must not abort the whole capture.
661
- imagePlaceholder: Kn,
661
+ imagePlaceholder: Xn,
662
662
  onImageErrorHandler: () => {
663
663
  }
664
664
  };
665
665
  let f = "";
666
666
  try {
667
- f = await Zt(document.body, u);
667
+ f = await te(document.body, u);
668
668
  } catch {
669
- f = await Zt(document.body, { ...u, skipFonts: !0 });
669
+ f = await te(document.body, { ...u, skipFonts: !0 });
670
670
  }
671
- if (!N(f))
671
+ if (!V(f))
672
672
  throw new Error("Screenshot capture produced an empty image.");
673
673
  return f;
674
674
  } finally {
@@ -676,25 +676,25 @@ async function Ee(t = {}) {
676
676
  a();
677
677
  } catch {
678
678
  }
679
- o(), i(), r.remove(), Gn(), e && (e.style.display = n);
679
+ o(), i(), r.remove(), Qn(), e && (e.style.display = n);
680
680
  }
681
681
  }
682
- function nr(t = "") {
682
+ function ir(t = "") {
683
683
  const e = String(t || "");
684
684
  return e ? /Windows NT/i.test(e) ? "Windows" : /iPhone|iPad|iPod/i.test(e) ? "iOS" : /Mac OS X|Macintosh/i.test(e) ? "macOS" : /Android/i.test(e) ? "Android" : /CrOS/i.test(e) ? "ChromeOS" : /Linux/i.test(e) ? "Linux" : "Other" : "";
685
685
  }
686
- function rr(t = "") {
686
+ function ar(t = "") {
687
687
  const e = String(t || "");
688
688
  return e ? /Edg\//i.test(e) ? "Edge" : /OPR\/|Opera/i.test(e) ? "Opera" : /Firefox\//i.test(e) ? "Firefox" : /Chrome\//i.test(e) || /CriOS\//i.test(e) ? "Chrome" : /Safari\//i.test(e) ? "Safari" : "Other" : "";
689
689
  }
690
- function ir(t = {}) {
690
+ function or(t = {}) {
691
691
  const e = navigator.userAgent;
692
692
  return {
693
693
  url: location.href,
694
694
  title: document.title,
695
695
  userAgent: e,
696
- os: nr(e),
697
- browser: rr(e),
696
+ os: ir(e),
697
+ browser: ar(e),
698
698
  language: navigator.language,
699
699
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
700
700
  viewport: {
@@ -709,11 +709,11 @@ function ir(t = {}) {
709
709
  }
710
710
  };
711
711
  }
712
- const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
712
+ const ee = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ne = {
713
713
  id: "userId",
714
714
  username: "displayName",
715
715
  name: "displayName"
716
- }, ne = /* @__PURE__ */ new Set([
716
+ }, re = /* @__PURE__ */ new Set([
717
717
  "endpoint",
718
718
  "projectKey",
719
719
  "version",
@@ -725,8 +725,9 @@ const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
725
725
  "consoleLogLimit",
726
726
  "kinds",
727
727
  "capture",
728
- "onBeforeCapture"
729
- ]), re = {
728
+ "onBeforeCapture",
729
+ "displayLink"
730
+ ]), ie = {
730
731
  slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
731
732
  projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
732
733
  project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
@@ -735,14 +736,14 @@ const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
735
736
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
736
737
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
737
738
  };
738
- function ar(t = {}, e = {}) {
739
- const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = {}, a = [];
740
- for (const o of te)
739
+ function sr(t = {}, e = {}) {
740
+ const n = e.warn || ke, r = t && typeof t == "object" ? t : {}, i = {}, a = [];
741
+ for (const o of ee)
741
742
  Object.prototype.hasOwnProperty.call(r, o) && (i[o] = r[o]);
742
- for (const [o, c] of Object.entries(ee))
743
+ for (const [o, c] of Object.entries(ne))
743
744
  Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(i, c) || (i[c] = r[o]));
744
745
  for (const o of Object.keys(r))
745
- te.has(o) || Object.prototype.hasOwnProperty.call(ee, o) || a.push(o);
746
+ ee.has(o) || Object.prototype.hasOwnProperty.call(ne, o) || a.push(o);
746
747
  if (a.length) {
747
748
  const o = a.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
748
749
  n(
@@ -751,24 +752,24 @@ function ar(t = {}, e = {}) {
751
752
  }
752
753
  return i;
753
754
  }
754
- function or(t = {}, e = {}) {
755
- const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((a) => !ne.has(a));
755
+ function cr(t = {}, e = {}) {
756
+ const n = e.warn || ke, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((a) => !re.has(a));
756
757
  if (i.length)
757
758
  for (const a of i) {
758
- if (re[a]) {
759
- n(`Notefully.init: ignoring "${a}". ${re[a]}`);
759
+ if (ie[a]) {
760
+ n(`Notefully.init: ignoring "${a}". ${ie[a]}`);
760
761
  continue;
761
762
  }
762
763
  n(
763
- `Notefully.init: ignoring unknown key "${a}". Supported: ${[...ne].join(", ")}.`
764
+ `Notefully.init: ignoring unknown key "${a}". Supported: ${[...re].join(", ")}.`
764
765
  );
765
766
  }
766
767
  }
767
- function Ce(t) {
768
+ function ke(t) {
768
769
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
769
770
  }
770
- const sr = 80;
771
- function cr() {
771
+ const lr = 80;
772
+ function ur() {
772
773
  const t = [], e = {};
773
774
  let n = !1;
774
775
  const r = (a, o) => {
@@ -782,7 +783,7 @@ function cr() {
782
783
  level: a,
783
784
  text: c.slice(0, 2e3),
784
785
  at: Date.now()
785
- }), t.length > sr && t.shift();
786
+ }), t.length > lr && t.shift();
786
787
  };
787
788
  return {
788
789
  hook: () => {
@@ -801,7 +802,7 @@ function cr() {
801
802
  }
802
803
  };
803
804
  }
804
- function lr(t) {
805
+ function dr(t) {
805
806
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
806
807
  let n = null, r = !1;
807
808
  const i = () => {
@@ -831,8 +832,8 @@ function lr(t) {
831
832
  isActive: () => r
832
833
  };
833
834
  }
834
- const ur = 60 * 1e3;
835
- function dr({ onStart: t, onStop: e, onError: n }) {
835
+ const fr = 60 * 1e3;
836
+ function hr({ onStart: t, onStop: e, onError: n }) {
836
837
  let r = null, i = null, a = [], o = null;
837
838
  const c = () => {
838
839
  if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
@@ -849,7 +850,7 @@ function dr({ onStart: t, onStop: e, onError: n }) {
849
850
  c(), e(null);
850
851
  };
851
852
  return { start: async () => {
852
- var f, m;
853
+ var f, y;
853
854
  if (!((f = navigator.mediaDevices) != null && f.getDisplayMedia))
854
855
  throw new Error("Screen recording is not supported in this browser.");
855
856
  r = await navigator.mediaDevices.getDisplayMedia({
@@ -864,10 +865,10 @@ function dr({ onStart: t, onStop: e, onError: n }) {
864
865
  }, i.onstop = () => {
865
866
  const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
866
867
  c(), e(g);
867
- }, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, ur);
868
+ }, (y = r.getVideoTracks()[0]) == null || y.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, fr);
868
869
  }, stop: l };
869
870
  }
870
- function fr() {
871
+ function pr() {
871
872
  const t = /* @__PURE__ */ new Set();
872
873
  return {
873
874
  alloc() {
@@ -885,19 +886,19 @@ function fr() {
885
886
  }
886
887
  };
887
888
  }
888
- const xt = { x: 0, y: 0, w: 1, h: 1 };
889
- function Ht() {
890
- const t = fr();
891
- let e = [], n = { ...xt }, r = 1;
889
+ const Ct = { x: 0, y: 0, w: 1, h: 1 };
890
+ function Ut() {
891
+ const t = pr();
892
+ let e = [], n = { ...Ct }, r = 1;
892
893
  return {
893
- list: () => e.filter((a) => pr(a, n)),
894
+ list: () => e.filter((a) => mr(a, n)),
894
895
  all: () => e.slice(),
895
896
  crop: () => ({ ...n }),
896
897
  setCrop(a) {
897
- return n = hr(a), n;
898
+ return n = yr(a), n;
898
899
  },
899
900
  resetCrop() {
900
- return n = { ...xt }, n;
901
+ return n = { ...Ct }, n;
901
902
  },
902
903
  isCropped() {
903
904
  return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
@@ -929,20 +930,20 @@ function Ht() {
929
930
  return t.free(c.number), c;
930
931
  },
931
932
  reset() {
932
- for (e = [], n = { ...xt }, r = 1; t.peekUsed().length; )
933
+ for (e = [], n = { ...Ct }, r = 1; t.peekUsed().length; )
933
934
  t.free(t.peekUsed()[0]);
934
935
  }
935
936
  };
936
937
  }
937
- function hr(t) {
938
+ function yr(t) {
938
939
  const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - n);
939
940
  return { x: e, y: n, w: r, h: i };
940
941
  }
941
- function pr(t, e) {
942
+ function mr(t, e) {
942
943
  const n = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, r = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
943
944
  return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
944
945
  }
945
- function Ft(t) {
946
+ function Nt(t) {
946
947
  const e = Math.max(1, Number(t) || 1);
947
948
  return {
948
949
  stroke: Math.max(2, e * 75e-4),
@@ -952,52 +953,52 @@ function Ft(t) {
952
953
  arrowHeadAngle: 0.4
953
954
  };
954
955
  }
955
- function mr(t, {
956
+ function gr(t, {
956
957
  stickers: e = [],
957
958
  crop: n = { x: 0, y: 0, w: 1, h: 1 },
958
959
  width: r,
959
960
  height: i,
960
961
  colors: a = {}
961
962
  }) {
962
- const o = a.mark || "#fdd341", c = a.markText || "#2a2140", l = Ft(r);
963
+ const o = a.mark || "#fdd341", c = a.markText || "#2a2140", l = Nt(r);
963
964
  t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = o, t.fillStyle = o, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
964
- const f = Rt(u.x, n, r), m = kt(u.y, n, i), g = u.w / n.w * r, S = u.h / n.h * i, R = l.stroke / 2;
965
+ const f = Tt(u.x, n, r), y = Pt(u.y, n, i), g = u.w / n.w * r, w = u.h / n.h * i, x = l.stroke / 2;
965
966
  if (u.type === "rect")
966
967
  t.strokeRect(
967
- f + R,
968
- m + R,
968
+ f + x,
969
+ y + x,
969
970
  Math.max(0, g - l.stroke),
970
- Math.max(0, S - l.stroke)
971
+ Math.max(0, w - l.stroke)
971
972
  );
972
973
  else if (u.type === "circle")
973
974
  t.beginPath(), t.ellipse(
974
975
  f + g / 2,
975
- m + S / 2,
976
- Math.max(0.5, g / 2 - R),
977
- Math.max(0.5, S / 2 - R),
976
+ y + w / 2,
977
+ Math.max(0.5, g / 2 - x),
978
+ Math.max(0.5, w / 2 - x),
978
979
  0,
979
980
  0,
980
981
  Math.PI * 2
981
982
  ), t.stroke();
982
983
  else if (u.type === "arrow") {
983
- const q = Rt(u.x2 ?? u.x + u.w, n, r), X = kt(u.y2 ?? u.y, n, i);
984
- gr(t, f, m, q, X, l);
984
+ const A = Tt(u.x2 ?? u.x + u.w, n, r), H = Pt(u.y2 ?? u.y, n, i);
985
+ vr(t, f, y, A, H, l);
985
986
  }
986
987
  if (u.number == null || u.number === "")
987
988
  return;
988
- const D = yr(u, n, r, i, f, m, g), Z = String(u.number);
989
- t.beginPath(), t.arc(D.x, D.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Z, D.x, D.y + 0.5), t.fillStyle = o;
989
+ const C = wr(u, n, r, i, f, y, g), P = String(u.number);
990
+ t.beginPath(), t.arc(C.x, C.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(P, C.x, C.y + 0.5), t.fillStyle = o;
990
991
  }), t.restore();
991
992
  }
992
- function Rt(t, e, n) {
993
+ function Tt(t, e, n) {
993
994
  return (t - e.x) / e.w * n;
994
995
  }
995
- function kt(t, e, n) {
996
+ function Pt(t, e, n) {
996
997
  return (t - e.y) / e.h * n;
997
998
  }
998
- function yr(t, e, n, r, i, a, o) {
999
+ function wr(t, e, n, r, i, a, o) {
999
1000
  if (t.type === "arrow") {
1000
- const c = Rt(t.x2 ?? t.x + t.w, e, n), l = kt(t.y2 ?? t.y, e, r);
1001
+ const c = Tt(t.x2 ?? t.x + t.w, e, n), l = Pt(t.y2 ?? t.y, e, r);
1001
1002
  return {
1002
1003
  x: (i + c) / 2,
1003
1004
  y: (a + l) / 2
@@ -1005,47 +1006,47 @@ function yr(t, e, n, r, i, a, o) {
1005
1006
  }
1006
1007
  return { x: i + o / 2, y: a };
1007
1008
  }
1008
- function Ae(t, e, n, r, i) {
1009
- const a = Math.atan2(r - e, n - t), o = i.arrowHead, c = Math.min(i.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(a) * o, m = r - Math.sin(a) * o, g = {
1009
+ function Le(t, e, n, r, i) {
1010
+ const a = Math.atan2(r - e, n - t), o = i.arrowHead, c = Math.min(i.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(a) * o, y = r - Math.sin(a) * o, g = {
1010
1011
  x: l - o * Math.cos(a - i.arrowHeadAngle),
1011
1012
  y: u - o * Math.sin(a - i.arrowHeadAngle)
1012
- }, S = {
1013
+ }, w = {
1013
1014
  x: l - o * Math.cos(a + i.arrowHeadAngle),
1014
1015
  y: u - o * Math.sin(a + i.arrowHeadAngle)
1015
- }, R = {
1016
+ }, x = {
1016
1017
  x: n - Math.cos(a) * c,
1017
1018
  y: r - Math.sin(a) * c
1018
1019
  };
1019
- return { angle: a, tipX: l, tipY: u, baseX: f, baseY: m, left: g, right: S, shaftEnd: R };
1020
+ return { angle: a, tipX: l, tipY: u, baseX: f, baseY: y, left: g, right: w, shaftEnd: x };
1020
1021
  }
1021
- function gr(t, e, n, r, i, a) {
1022
- const o = Ae(e, n, r, i, a);
1022
+ function vr(t, e, n, r, i, a) {
1023
+ const o = Le(e, n, r, i, a);
1023
1024
  t.beginPath(), t.moveTo(e, n), t.lineTo(o.shaftEnd.x, o.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(o.tipX, o.tipY), t.lineTo(o.left.x, o.left.y), t.lineTo(o.right.x, o.right.y), t.closePath(), t.fill();
1024
1025
  }
1025
- function wr(t, e, n, r = {}) {
1026
+ function br(t, e, n, r = {}) {
1026
1027
  return new Promise((i, a) => {
1027
1028
  const o = new Image();
1028
1029
  o.onload = () => {
1029
- const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), m = document.createElement("canvas");
1030
- m.width = u, m.height = f;
1031
- const g = m.getContext("2d");
1032
- g.drawImage(o, c, l, u, f, 0, 0, u, f), mr(g, {
1030
+ const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), y = document.createElement("canvas");
1031
+ y.width = u, y.height = f;
1032
+ const g = y.getContext("2d");
1033
+ g.drawImage(o, c, l, u, f, 0, 0, u, f), gr(g, {
1033
1034
  stickers: n,
1034
1035
  crop: e,
1035
1036
  width: u,
1036
1037
  height: f,
1037
1038
  colors: r
1038
- }), m.toBlob((S) => {
1039
- if (!S) {
1039
+ }), y.toBlob((w) => {
1040
+ if (!w) {
1040
1041
  a(new Error("Could not encode screenshot"));
1041
1042
  return;
1042
1043
  }
1043
- i(S);
1044
+ i(w);
1044
1045
  }, "image/png");
1045
1046
  }, o.onerror = () => a(new Error("Could not load screenshot")), o.src = t;
1046
1047
  });
1047
1048
  }
1048
- const vr = [
1049
+ const Sr = [
1049
1050
  { key: "url", label: "URL" },
1050
1051
  { key: "title", label: "Title" },
1051
1052
  { key: "userAgent", label: "User agent" },
@@ -1056,14 +1057,14 @@ const vr = [
1056
1057
  { key: "viewport", label: "Viewport" },
1057
1058
  { key: "user", label: "User" }
1058
1059
  ];
1059
- function br(t) {
1060
+ function xr(t) {
1060
1061
  return !t || typeof t != "object" ? !1 : !!(t.userId || t.email || t.displayName);
1061
1062
  }
1062
- function Sr(t = {}) {
1063
+ function Er(t = {}) {
1063
1064
  const e = [];
1064
- for (const n of vr) {
1065
+ for (const n of Sr) {
1065
1066
  const r = t[n.key];
1066
- r == null || r === "" || n.key === "user" && !br(r) || e.push({
1067
+ r == null || r === "" || n.key === "user" && !xr(r) || e.push({
1067
1068
  key: n.key,
1068
1069
  label: n.label,
1069
1070
  value: r,
@@ -1072,7 +1073,7 @@ function Sr(t = {}) {
1072
1073
  }
1073
1074
  return e;
1074
1075
  }
1075
- function xr(t = []) {
1076
+ function Cr(t = []) {
1076
1077
  return t.map((e, n) => ({
1077
1078
  id: `log-${n}-${e.at || 0}`,
1078
1079
  level: e.level || "log",
@@ -1081,18 +1082,18 @@ function xr(t = []) {
1081
1082
  redacted: !1
1082
1083
  }));
1083
1084
  }
1084
- function Er(t = []) {
1085
+ function kr(t = []) {
1085
1086
  if (!t.length)
1086
1087
  return { checked: !1, indeterminate: !1 };
1087
1088
  const e = t.filter((n) => n.redacted).length;
1088
1089
  return e === 0 ? { checked: !1, indeterminate: !1 } : e === t.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
1089
1090
  }
1090
- function ut(t, e) {
1091
+ function ft(t, e) {
1091
1092
  t.forEach((n) => {
1092
1093
  n.redacted = !!e;
1093
1094
  });
1094
1095
  }
1095
- function Cr(t = {}) {
1096
+ function Lr(t = {}) {
1096
1097
  const e = t.diagnostics || [], n = t.logs || [], r = e.some((a) => !a.redacted), i = n.length > 0 && n.some((a) => !a.redacted);
1097
1098
  return r && i ? "Also sending logs and diagnostic information" : r ? "Also sending diagnostic information" : i ? "Also sending logs" : "";
1098
1099
  }
@@ -1119,56 +1120,56 @@ function Mr(t = {}) {
1119
1120
  }));
1120
1121
  return e.console = n, e;
1121
1122
  }
1122
- const _ = [
1123
+ const z = [
1123
1124
  { id: "bug", label: "Bug" },
1124
1125
  { id: "idea", label: "Idea" },
1125
1126
  { id: "other", label: "Other" }
1126
1127
  ];
1127
- function ie(t) {
1128
+ function ae(t) {
1128
1129
  return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
1129
1130
  }
1130
- function Et(t) {
1131
+ function kt(t) {
1131
1132
  const e = String(t || "").trim();
1132
1133
  return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
1133
1134
  }
1134
- function Lr(t) {
1135
+ function $r(t) {
1135
1136
  if (!Array.isArray(t) || !t.length)
1136
- return _.map((r) => ({ ...r }));
1137
+ return z.map((r) => ({ ...r }));
1137
1138
  const e = /* @__PURE__ */ new Set(), n = [];
1138
1139
  for (const r of t) {
1139
1140
  let i = "", a = "";
1140
- typeof r == "string" || typeof r == "number" ? (i = ie(r), a = Et(i)) : r && typeof r == "object" && (i = ie(r.id ?? r.value ?? r.kind), a = String(r.label || r.name || Et(i)).trim() || Et(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: a }));
1141
+ typeof r == "string" || typeof r == "number" ? (i = ae(r), a = kt(i)) : r && typeof r == "object" && (i = ae(r.id ?? r.value ?? r.kind), a = String(r.label || r.name || kt(i)).trim() || kt(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: a }));
1141
1142
  }
1142
- return n.length ? n : _.map((r) => ({ ...r }));
1143
+ return n.length ? n : z.map((r) => ({ ...r }));
1143
1144
  }
1144
- function gt(t) {
1145
+ function vt(t) {
1145
1146
  var n;
1146
- const e = Array.isArray(t) && t.length ? t : _;
1147
+ const e = Array.isArray(t) && t.length ? t : z;
1147
1148
  return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
1148
1149
  }
1149
- const $r = ["maker", "all-business", "brighter-day", "quiet-night"], Me = "maker", Rr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Tt = 0.02, ae = 0.05, kr = `
1150
+ const Rr = ["maker", "all-business", "brighter-day", "quiet-night"], Ae = "maker", Tr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), It = 0.02, oe = 0.05, Pr = `
1150
1151
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
1151
1152
  <path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
1152
1153
  <path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
1153
1154
  </svg>
1154
1155
  `;
1155
- function k(t) {
1156
+ function I(t) {
1156
1157
  return `<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`;
1157
1158
  }
1158
- const M = {
1159
- crop: k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
1160
- resetCrop: k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
1161
- arrow: k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
1162
- rect: k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
1163
- circle: k('<circle cx="12" cy="12" r="8"/>'),
1164
- discard: k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
1165
- recapture: k('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
1166
- privacy: k('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
1167
- audio: k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
1168
- video: k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
1169
- }, Le = cr();
1170
- Le.hook();
1171
- const $e = 10, Tr = 80, Re = "notefully.author", ke = "notefully.kind", Te = "notefully.redactSections", Pt = "Anonymous";
1159
+ const $ = {
1160
+ crop: I('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
1161
+ resetCrop: I('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
1162
+ arrow: I('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
1163
+ rect: I('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
1164
+ circle: I('<circle cx="12" cy="12" r="8"/>'),
1165
+ discard: I('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
1166
+ recapture: I('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
1167
+ privacy: I('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
1168
+ audio: I('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
1169
+ video: I('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
1170
+ }, Me = ur();
1171
+ Me.hook();
1172
+ const $e = 10, Ir = 80, Re = "notefully.author", Te = "notefully.kind", Pe = "notefully.redactSections", Ot = "Anonymous";
1172
1173
  let d = {
1173
1174
  endpoint: "",
1174
1175
  projectKey: "",
@@ -1176,46 +1177,47 @@ let d = {
1176
1177
  name: "",
1177
1178
  targets: null,
1178
1179
  hideLauncher: !1,
1179
- theme: Me,
1180
+ theme: Ae,
1180
1181
  video: !1,
1181
1182
  consoleLogLimit: $e,
1182
- kinds: _.map((t) => ({ ...t })),
1183
+ kinds: z.map((t) => ({ ...t })),
1183
1184
  capture: null,
1184
- onBeforeCapture: null
1185
- }, Ct = !1, T = {}, h = null, s = {}, y = Ht(), I = "", Q = "", P = null, j = gt(_), F = null, L = null, v = null, w = null, ot = null, z = null, tt = null, O = { w: 0, h: 0 }, At = !1, Ut = !1, B = [], $ = [], W = !1;
1186
- function p(t) {
1187
- return h.querySelector(t);
1185
+ onBeforeCapture: null,
1186
+ displayLink: !1
1187
+ }, Lt = !1, O = {}, p = null, s = {}, m = Ut(), D = "", et = "", B = null, W = vt(z), _ = null, R = null, b = null, v = null, ct = null, X = null, rt = null, F = { w: 0, h: 0 }, At = !1, bt = !1, St = !1, U = [], T = [], q = !1;
1188
+ function h(t) {
1189
+ return p.querySelector(t);
1188
1190
  }
1189
- function Pe(t) {
1191
+ function Ie(t) {
1190
1192
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
1191
- return $r.includes(e) ? e : Me;
1193
+ return Rr.includes(e) ? e : Ae;
1192
1194
  }
1193
- function oe(t, e) {
1194
- return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
1195
+ function se(t, e) {
1196
+ return p && getComputedStyle(p).getPropertyValue(t).trim() || e;
1195
1197
  }
1196
- async function Pr(t) {
1198
+ async function Or(t) {
1197
1199
  return (await fetch(t)).blob();
1198
1200
  }
1199
- function b(t, e = !1) {
1200
- s.status && (s.status.textContent = t || "", ot && (clearTimeout(ot), ot = null), t && !e && (ot = setTimeout(() => {
1201
+ function S(t, e = !1) {
1202
+ s.status && (s.status.textContent = t || "", ct && (clearTimeout(ct), ct = null), t && !e && (ct = setTimeout(() => {
1201
1203
  s.status.textContent = "";
1202
1204
  }, 4e3)));
1203
1205
  }
1204
- function Nt() {
1205
- return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
1206
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${kr}</button>
1206
+ function _t() {
1207
+ return p && document.body.contains(p) || (p = document.createElement("div"), p.id = "notefully", p.innerHTML = `
1208
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Pr}</button>
1207
1209
  <div class="nf-dialog" hidden>
1208
1210
  <div class="nf-panel">
1209
1211
  <div class="nf-panel-body">
1210
1212
  <div class="nf-stage" hidden>
1211
1213
  <div class="nf-palette">
1212
- <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${M.crop}</button>
1213
- <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${M.resetCrop}</button>
1214
- <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${M.arrow}</button>
1215
- <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${M.rect}</button>
1216
- <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${M.circle}</button>
1217
- <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${M.discard}</button>
1218
- <button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${M.recapture}</button>
1214
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${$.crop}</button>
1215
+ <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${$.resetCrop}</button>
1216
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${$.arrow}</button>
1217
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${$.rect}</button>
1218
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${$.circle}</button>
1219
+ <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${$.discard}</button>
1220
+ <button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${$.recapture}</button>
1219
1221
  </div>
1220
1222
  <div class="nf-canvas"></div>
1221
1223
  </div>
@@ -1225,7 +1227,7 @@ function Nt() {
1225
1227
  <div class="nf-kind"></div>
1226
1228
  <div class="nf-privacy-summary">
1227
1229
  <span class="nf-privacy-text"></span>
1228
- <button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${M.privacy}</button>
1230
+ <button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${$.privacy}</button>
1229
1231
  </div>
1230
1232
  </div>
1231
1233
  <div class="nf-privacy">
@@ -1235,149 +1237,151 @@ function Nt() {
1235
1237
  </div>
1236
1238
  </div>
1237
1239
  <div class="nf-actions">
1238
- <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${M.resetCrop}</button>
1239
- <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${M.audio}</button>
1240
- <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${M.video}</button>
1240
+ <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${$.resetCrop}</button>
1241
+ <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${$.audio}</button>
1242
+ <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${$.video}</button>
1241
1243
  <button class="nf-submit" type="button">Submit</button>
1242
1244
  </div>
1243
1245
  <div class="nf-status"></div>
1244
1246
  </div>
1245
1247
  <p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
1248
+ <a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer">Open in Tracker</a>
1246
1249
  </div>
1247
1250
  </div>
1248
1251
  <button class="nf-stop-video" type="button" hidden>Stop</button>
1249
- `, document.body.appendChild(h), s = {
1250
- launcher: p(".nf-launcher"),
1251
- dialog: p(".nf-dialog"),
1252
- panel: p(".nf-panel"),
1253
- panelBody: p(".nf-panel-body"),
1254
- successMsg: p(".nf-success-msg"),
1255
- stage: p(".nf-stage"),
1256
- palette: p(".nf-palette"),
1257
- canvas: p(".nf-canvas"),
1258
- text: p(".nf-text"),
1259
- author: p(".nf-author"),
1260
- kindRow: p(".nf-kind-row"),
1261
- kind: p(".nf-kind"),
1262
- privacy: p(".nf-privacy"),
1263
- privacySummary: p(".nf-privacy-summary"),
1264
- privacyText: p(".nf-privacy-text"),
1265
- privacyChange: p(".nf-privacy-change"),
1266
- privacyPanel: p(".nf-privacy-panel"),
1267
- privacyScroll: p(".nf-privacy-scroll"),
1268
- privacyDone: p(".nf-privacy-done"),
1269
- actions: p(".nf-actions"),
1270
- restore: p(".nf-restore"),
1271
- status: p(".nf-status"),
1272
- audio: p(".nf-audio"),
1273
- video: p(".nf-video"),
1274
- discard: p(".nf-discard-shot"),
1275
- recapture: p(".nf-recapture"),
1276
- stop: p(".nf-stop-video"),
1277
- resetCrop: p(".nf-reset-crop"),
1278
- submit: p(".nf-submit"),
1252
+ `, document.body.appendChild(p), s = {
1253
+ launcher: h(".nf-launcher"),
1254
+ dialog: h(".nf-dialog"),
1255
+ panel: h(".nf-panel"),
1256
+ panelBody: h(".nf-panel-body"),
1257
+ successMsg: h(".nf-success-msg"),
1258
+ successLink: h(".nf-success-link"),
1259
+ stage: h(".nf-stage"),
1260
+ palette: h(".nf-palette"),
1261
+ canvas: h(".nf-canvas"),
1262
+ text: h(".nf-text"),
1263
+ author: h(".nf-author"),
1264
+ kindRow: h(".nf-kind-row"),
1265
+ kind: h(".nf-kind"),
1266
+ privacy: h(".nf-privacy"),
1267
+ privacySummary: h(".nf-privacy-summary"),
1268
+ privacyText: h(".nf-privacy-text"),
1269
+ privacyChange: h(".nf-privacy-change"),
1270
+ privacyPanel: h(".nf-privacy-panel"),
1271
+ privacyScroll: h(".nf-privacy-scroll"),
1272
+ privacyDone: h(".nf-privacy-done"),
1273
+ actions: h(".nf-actions"),
1274
+ restore: h(".nf-restore"),
1275
+ status: h(".nf-status"),
1276
+ audio: h(".nf-audio"),
1277
+ video: h(".nf-video"),
1278
+ discard: h(".nf-discard-shot"),
1279
+ recapture: h(".nf-recapture"),
1280
+ stop: h(".nf-stop-video"),
1281
+ resetCrop: h(".nf-reset-crop"),
1282
+ submit: h(".nf-submit"),
1279
1283
  shot: null
1280
- }, Ir(), nt()), h;
1284
+ }, Br(), at()), p;
1281
1285
  }
1282
- function nt() {
1286
+ function at() {
1283
1287
  var t;
1284
- h && (h.dataset.theme = Pe(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Ie(), (t = s.dialog) != null && t.hidden && dt());
1288
+ p && (p.dataset.theme = Ie(d.theme), d.hideLauncher ? p.setAttribute("data-nf-hidden-launcher", "") : p.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Oe(), (t = s.dialog) != null && t.hidden && ht());
1285
1289
  }
1286
- function dt() {
1290
+ function ht() {
1287
1291
  s.launcher && (s.launcher.hidden = !!d.hideLauncher);
1288
1292
  }
1289
- function Ir() {
1290
- s.launcher.addEventListener("click", () => Ye()), p(".nf-dialog").addEventListener("click", (e) => {
1291
- Ut || e.target === s.dialog && at();
1292
- }), h.querySelectorAll(".nf-tool").forEach((e) => {
1293
- e.addEventListener("click", () => et(e.dataset.tool));
1294
- }), s.resetCrop.addEventListener("click", Vr), s.canvas.addEventListener("pointerdown", Fr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1295
- const t = p(".nf-kind");
1293
+ function Br() {
1294
+ s.launcher.addEventListener("click", () => Je()), h(".nf-dialog").addEventListener("click", (e) => {
1295
+ bt && !St || e.target === s.dialog && nt();
1296
+ }), document.addEventListener("keydown", Ke), p.querySelectorAll(".nf-tool").forEach((e) => {
1297
+ e.addEventListener("click", () => it(e.dataset.tool));
1298
+ }), s.resetCrop.addEventListener("click", zr), s.canvas.addEventListener("pointerdown", Nr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1299
+ const t = h(".nf-kind");
1296
1300
  t && t.addEventListener("click", (e) => {
1297
1301
  const n = e.target.closest("[data-kind]");
1298
1302
  n && jt(n.dataset.kind);
1299
- }), s.discard.addEventListener("click", Wr), s.recapture.addEventListener("click", () => {
1300
- Kr().catch((e) => b(e.message || "Recapture failed."));
1301
- }), s.restore.addEventListener("click", zr), s.audio.addEventListener("click", qr), s.video.addEventListener("click", Xr), s.stop.addEventListener("click", () => tt == null ? void 0 : tt.stop()), s.privacyChange.addEventListener("click", () => mt(!W)), s.privacyDone.addEventListener("click", () => mt(!1)), s.privacyScroll.addEventListener("change", ii), p(".nf-submit").addEventListener("click", () => {
1302
- Je().catch((e) => b(e.message || "Submit failed."));
1303
- }), Ie(), et(null);
1303
+ }), s.discard.addEventListener("click", Kr), s.recapture.addEventListener("click", () => {
1304
+ Xr().catch((e) => S(e.message || "Recapture failed."));
1305
+ }), s.restore.addEventListener("click", qr), s.audio.addEventListener("click", Yr), s.video.addEventListener("click", Gr), s.stop.addEventListener("click", () => rt == null ? void 0 : rt.stop()), s.privacyChange.addEventListener("click", () => gt(!q)), s.privacyDone.addEventListener("click", () => gt(!1)), s.privacyScroll.addEventListener("change", oi), h(".nf-submit").addEventListener("click", () => {
1306
+ Ze().catch((e) => S(e.message || "Submit failed."));
1307
+ }), Oe(), it(null);
1304
1308
  }
1305
- function C(t) {
1309
+ function L(t) {
1306
1310
  return String(t || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1307
1311
  }
1308
- function Ie() {
1309
- const t = h == null ? void 0 : h.querySelector(".nf-kind");
1312
+ function Oe() {
1313
+ const t = p == null ? void 0 : p.querySelector(".nf-kind");
1310
1314
  if (!t)
1311
1315
  return;
1312
- const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : _;
1313
- t.innerHTML = e.map((i) => `<button type="button" data-kind="${C(i.id)}">${C(i.label)}</button>`).join("");
1314
- const r = e.map((i) => i.id).includes(j) ? j : gt(e);
1316
+ const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : z;
1317
+ t.innerHTML = e.map((i) => `<button type="button" data-kind="${L(i.id)}">${L(i.label)}</button>`).join("");
1318
+ const r = e.map((i) => i.id).includes(W) ? W : vt(e);
1315
1319
  jt(r);
1316
1320
  }
1317
1321
  function jt(t) {
1318
- j = (d.kinds || _).map((n) => n.id).includes(t) ? t : gt(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
1319
- n.dataset.active = String(n.dataset.kind === j);
1320
- }), Br(j);
1322
+ W = (d.kinds || z).map((n) => n.id).includes(t) ? t : vt(d.kinds), p == null || p.querySelectorAll("[data-kind]").forEach((n) => {
1323
+ n.dataset.active = String(n.dataset.kind === W);
1324
+ }), Hr(W);
1321
1325
  }
1322
- function Or() {
1326
+ function Dr() {
1323
1327
  try {
1324
- return String(localStorage.getItem(ke) || "").trim().toLowerCase();
1328
+ return String(localStorage.getItem(Te) || "").trim().toLowerCase();
1325
1329
  } catch {
1326
1330
  return "";
1327
1331
  }
1328
1332
  }
1329
- function Br(t) {
1333
+ function Hr(t) {
1330
1334
  const e = String(t || "").trim().toLowerCase();
1331
1335
  if (e)
1332
1336
  try {
1333
- localStorage.setItem(ke, e);
1337
+ localStorage.setItem(Te, e);
1334
1338
  } catch {
1335
1339
  }
1336
1340
  }
1337
- function Dr() {
1338
- const t = (d.kinds || _).map((n) => n.id), e = Or();
1339
- return e && t.includes(e) ? e : gt(d.kinds);
1341
+ function Fr() {
1342
+ const t = (d.kinds || z).map((n) => n.id), e = Dr();
1343
+ return e && t.includes(e) ? e : vt(d.kinds);
1340
1344
  }
1341
- function et(t) {
1342
- F = Rr.has(t) ? t : null, L = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1343
- e.dataset.active = String(e.dataset.tool === F);
1344
- }), s.canvas && (s.canvas.dataset.draw = F ? "true" : "false"), V() && A();
1345
+ function it(t) {
1346
+ _ = Tr.has(t) ? t : null, R = null, p.querySelectorAll(".nf-tool").forEach((e) => {
1347
+ e.dataset.active = String(e.dataset.tool === _);
1348
+ }), s.canvas && (s.canvas.dataset.draw = _ ? "true" : "false"), K() && M();
1345
1349
  }
1346
- function se(t) {
1350
+ function ce(t) {
1347
1351
  return Math.min(1, Math.max(0, t));
1348
1352
  }
1349
- function rt() {
1353
+ function ot() {
1350
1354
  return s.shot || s.canvas;
1351
1355
  }
1352
- function ft(t) {
1353
- const e = rt().getBoundingClientRect();
1356
+ function pt(t) {
1357
+ const e = ot().getBoundingClientRect();
1354
1358
  return {
1355
- x: se((t.clientX - e.left) / Math.max(e.width, 1)),
1356
- y: se((t.clientY - e.top) / Math.max(e.height, 1))
1359
+ x: ce((t.clientX - e.left) / Math.max(e.width, 1)),
1360
+ y: ce((t.clientY - e.top) / Math.max(e.height, 1))
1357
1361
  };
1358
1362
  }
1359
- function Hr(t) {
1360
- const e = rt().getBoundingClientRect();
1363
+ function Ur(t) {
1364
+ const e = ot().getBoundingClientRect();
1361
1365
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
1362
1366
  }
1363
- function Oe(t) {
1364
- const e = ft(t), n = y.crop();
1367
+ function Be(t) {
1368
+ const e = pt(t), n = m.crop();
1365
1369
  return {
1366
1370
  x: n.x + e.x * n.w,
1367
1371
  y: n.y + e.y * n.h
1368
1372
  };
1369
1373
  }
1370
- function wt(t, e) {
1374
+ function xt(t, e) {
1371
1375
  const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
1372
1376
  return {
1373
1377
  x: n,
1374
1378
  y: r,
1375
- w: Math.max(Tt, Math.abs(e.x - t.x)),
1376
- h: Math.max(Tt, Math.abs(e.y - t.y))
1379
+ w: Math.max(It, Math.abs(e.x - t.x)),
1380
+ h: Math.max(It, Math.abs(e.y - t.y))
1377
1381
  };
1378
1382
  }
1379
- function _t(t) {
1380
- h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
1383
+ function Vt(t) {
1384
+ p && (t ? p.dataset.grabbing = "true" : delete p.dataset.grabbing);
1381
1385
  }
1382
1386
  function Mt(t) {
1383
1387
  try {
@@ -1385,73 +1389,73 @@ function Mt(t) {
1385
1389
  } catch {
1386
1390
  }
1387
1391
  }
1388
- function It() {
1389
- window.addEventListener("pointermove", De), window.addEventListener("pointerup", ht), window.addEventListener("pointercancel", ht);
1392
+ function Bt() {
1393
+ window.addEventListener("pointermove", He), window.addEventListener("pointerup", yt), window.addEventListener("pointercancel", yt);
1390
1394
  }
1391
- function Be() {
1392
- window.removeEventListener("pointermove", De), window.removeEventListener("pointerup", ht), window.removeEventListener("pointercancel", ht);
1395
+ function De() {
1396
+ window.removeEventListener("pointermove", He), window.removeEventListener("pointerup", yt), window.removeEventListener("pointercancel", yt);
1393
1397
  }
1394
- function Fr(t) {
1395
- if (t.button !== 0 || !V())
1398
+ function Nr(t) {
1399
+ if (t.button !== 0 || !K())
1396
1400
  return;
1397
- if (!t.target.closest(".nf-sticker") && !Hr(t)) {
1398
- L = null, A();
1401
+ if (!t.target.closest(".nf-sticker") && !Ur(t)) {
1402
+ R = null, M();
1399
1403
  return;
1400
1404
  }
1401
1405
  const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
1402
1406
  if (n && n.dataset.preview !== "true") {
1403
- t.preventDefault(), t.stopPropagation(), L = n.dataset.id, Mt(t), Ur({
1407
+ t.preventDefault(), t.stopPropagation(), R = n.dataset.id, Mt(t), _r({
1404
1408
  kind: "sticker",
1405
- id: L,
1409
+ id: R,
1406
1410
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
1407
- }, t), A();
1411
+ }, t), M();
1408
1412
  return;
1409
1413
  }
1410
- if (L = null, F === "crop") {
1411
- t.preventDefault(), Mt(t), v = { kind: "crop", start: ft(t), current: ft(t) }, It(), A();
1414
+ if (R = null, _ === "crop") {
1415
+ t.preventDefault(), Mt(t), b = { kind: "crop", start: pt(t), current: pt(t) }, Bt(), M();
1412
1416
  return;
1413
1417
  }
1414
- if (F === "arrow" || F === "rect" || F === "circle") {
1418
+ if (_ === "arrow" || _ === "rect" || _ === "circle") {
1415
1419
  t.preventDefault(), Mt(t);
1416
- const r = Oe(t);
1417
- v = { kind: "sticker", type: F, start: r, current: r }, It(), A();
1420
+ const r = Be(t);
1421
+ b = { kind: "sticker", type: _, start: r, current: r }, Bt(), M();
1418
1422
  return;
1419
1423
  }
1420
- A();
1424
+ M();
1421
1425
  }
1422
- function Ur(t, e) {
1426
+ function _r(t, e) {
1423
1427
  e.preventDefault(), e.stopPropagation();
1424
- const n = rt().getBoundingClientRect(), r = y.list().find((i) => i.id === t.id);
1425
- w = {
1428
+ const n = ot().getBoundingClientRect(), r = m.list().find((i) => i.id === t.id);
1429
+ v = {
1426
1430
  ...t,
1427
1431
  startX: e.clientX,
1428
1432
  startY: e.clientY,
1429
- crop: y.crop(),
1433
+ crop: m.crop(),
1430
1434
  sticker: r ? { ...r } : null,
1431
1435
  rect: n
1432
- }, _t(t.dir === "move" || t.dir === "start" || t.dir === "end"), It();
1436
+ }, Vt(t.dir === "move" || t.dir === "start" || t.dir === "end"), Bt();
1433
1437
  }
1434
- function De(t) {
1435
- if (v) {
1436
- v.current = v.kind === "crop" ? ft(t) : Oe(t), A();
1438
+ function He(t) {
1439
+ if (b) {
1440
+ b.current = b.kind === "crop" ? pt(t) : Be(t), M();
1437
1441
  return;
1438
1442
  }
1439
- if (!w)
1443
+ if (!v)
1440
1444
  return;
1441
- const e = (t.clientX - w.startX) / w.rect.width * w.crop.w, n = (t.clientY - w.startY) / w.rect.height * w.crop.h, r = w.sticker;
1445
+ const e = (t.clientX - v.startX) / v.rect.width * v.crop.w, n = (t.clientY - v.startY) / v.rect.height * v.crop.h, r = v.sticker;
1442
1446
  if (r) {
1443
- if (w.dir === "end")
1444
- y.update(r.id, {
1447
+ if (v.dir === "end")
1448
+ m.update(r.id, {
1445
1449
  x2: r.x2 + e,
1446
1450
  y2: r.y2 + n
1447
1451
  });
1448
- else if (w.dir === "start")
1449
- y.update(r.id, {
1452
+ else if (v.dir === "start")
1453
+ m.update(r.id, {
1450
1454
  x: r.x + e,
1451
1455
  y: r.y + n
1452
1456
  });
1453
- else if (w.dir === "move")
1454
- y.update(r.id, {
1457
+ else if (v.dir === "move")
1458
+ m.update(r.id, {
1455
1459
  x: r.x + e,
1456
1460
  y: r.y + n,
1457
1461
  x2: (r.x2 || r.x) + e,
@@ -1459,12 +1463,12 @@ function De(t) {
1459
1463
  });
1460
1464
  else {
1461
1465
  const i = { x: r.x, y: r.y, w: r.w, h: r.h };
1462
- Nr(i, w.dir, e, n), y.update(r.id, i);
1466
+ jr(i, v.dir, e, n), m.update(r.id, i);
1463
1467
  }
1464
- A();
1468
+ M();
1465
1469
  }
1466
1470
  }
1467
- function Nr(t, e, n, r) {
1471
+ function jr(t, e, n, r) {
1468
1472
  if (e.includes("e") && (t.w = Math.max(0.04, t.w + n)), e.includes("s") && (t.h = Math.max(0.04, t.h + r)), e.includes("w")) {
1469
1473
  const i = Math.max(0.04, t.w - n);
1470
1474
  t.x += t.w - i, t.w = i;
@@ -1474,52 +1478,52 @@ function Nr(t, e, n, r) {
1474
1478
  t.y += t.h - i, t.h = i;
1475
1479
  }
1476
1480
  }
1477
- function ht(t) {
1478
- if (Be(), _t(!1), v) {
1479
- jr();
1481
+ function yt(t) {
1482
+ if (De(), Vt(!1), b) {
1483
+ Vr();
1480
1484
  return;
1481
1485
  }
1482
- if (w) {
1483
- if (w.kind === "sticker") {
1486
+ if (v) {
1487
+ if (v.kind === "sticker") {
1484
1488
  const e = s.canvas.getBoundingClientRect();
1485
- (t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id), L = null);
1489
+ (t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(v.id), R = null);
1486
1490
  }
1487
- w = null, A();
1491
+ v = null, M();
1488
1492
  }
1489
1493
  }
1490
- function jr() {
1491
- const t = v;
1492
- if (v = null, !t)
1494
+ function Vr() {
1495
+ const t = b;
1496
+ if (b = null, !t)
1493
1497
  return;
1494
1498
  if (t.kind === "crop") {
1495
- const n = wt(t.start, t.current);
1496
- if (Math.abs(t.current.x - t.start.x) < ae || Math.abs(t.current.y - t.start.y) < ae) {
1497
- A();
1499
+ const n = xt(t.start, t.current);
1500
+ if (Math.abs(t.current.x - t.start.x) < oe || Math.abs(t.current.y - t.start.y) < oe) {
1501
+ M();
1498
1502
  return;
1499
1503
  }
1500
- const i = y.crop();
1501
- y.setCrop({
1504
+ const i = m.crop();
1505
+ m.setCrop({
1502
1506
  x: i.x + n.x * i.w,
1503
1507
  y: i.y + n.y * i.h,
1504
1508
  w: n.w * i.w,
1505
1509
  h: n.h * i.h
1506
- }), K();
1510
+ }), Y();
1507
1511
  return;
1508
1512
  }
1509
- const e = _r(t);
1510
- e && (L = e.id), A();
1513
+ const e = Wr(t);
1514
+ e && (R = e.id), M();
1511
1515
  }
1512
- function _r(t) {
1516
+ function Wr(t) {
1513
1517
  if (t.type === "arrow") {
1514
1518
  const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
1515
- return Math.hypot(e, n) < Tt ? y.add("arrow", {
1519
+ return Math.hypot(e, n) < It ? m.add("arrow", {
1516
1520
  x: t.start.x,
1517
1521
  y: t.start.y,
1518
1522
  x2: t.start.x + 0.12,
1519
1523
  y2: t.start.y,
1520
1524
  w: 0.12,
1521
1525
  h: 0.02
1522
- }) : y.add("arrow", {
1526
+ }) : m.add("arrow", {
1523
1527
  x: t.start.x,
1524
1528
  y: t.start.y,
1525
1529
  x2: t.current.x,
@@ -1528,121 +1532,121 @@ function _r(t) {
1528
1532
  h: Math.abs(n)
1529
1533
  });
1530
1534
  }
1531
- return y.add(t.type, wt(t.start, t.current));
1535
+ return m.add(t.type, xt(t.start, t.current));
1532
1536
  }
1533
- function Vr() {
1534
- y.resetCrop(), L = null, K();
1537
+ function zr() {
1538
+ m.resetCrop(), R = null, Y();
1535
1539
  }
1536
- function pt() {
1537
- s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
1540
+ function mt() {
1541
+ s.resetCrop && (s.resetCrop.hidden = !m.isCropped());
1538
1542
  }
1539
- function Vt(t) {
1543
+ function Wt(t) {
1540
1544
  if (!s.audio)
1541
1545
  return;
1542
1546
  const e = t ? "Stop audio" : "Record audio";
1543
1547
  s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
1544
1548
  }
1545
- function V() {
1546
- return N(I);
1549
+ function K() {
1550
+ return V(D);
1547
1551
  }
1548
- function it() {
1552
+ function st() {
1549
1553
  if (!s.stage || !s.palette || !s.actions || !s.recapture)
1550
1554
  return;
1551
- const t = V();
1552
- s.stage.hidden = !t && !P, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !Q), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
1555
+ const t = K();
1556
+ s.stage.hidden = !t && !B, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !et), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
1553
1557
  }
1554
- function Wr() {
1555
- V() && (Q = I), I = "", et(null), it(), K();
1558
+ function Kr() {
1559
+ K() && (et = D), D = "", it(null), st(), Y();
1556
1560
  }
1557
- function zr() {
1558
- N(Q) && (I = Q, it(), K());
1561
+ function qr() {
1562
+ V(et) && (D = et, st(), Y());
1559
1563
  }
1560
- function He() {
1564
+ function Fe() {
1561
1565
  return {
1562
1566
  capture: typeof d.capture == "function" ? d.capture : void 0,
1563
1567
  onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
1564
1568
  };
1565
1569
  }
1566
- function Fe(t) {
1567
- if (!N(t))
1570
+ function Ue(t) {
1571
+ if (!V(t))
1568
1572
  throw new Error("Screenshot failed; you can still send text.");
1569
- I = t, Q = t, y = Ht(), O = { w: 0, h: 0 }, L = null, v = null, w = null, et(null);
1573
+ D = t, et = t, m = Ut(), F = { w: 0, h: 0 }, R = null, b = null, v = null, it(null);
1570
1574
  }
1571
- async function Kr() {
1572
- if (!(Ct || !s.dialog || s.dialog.hidden)) {
1573
- Ct = !0, s.recapture.disabled = !0, b("Capturing…", !0), s.dialog.hidden = !0;
1575
+ async function Xr() {
1576
+ if (!(Lt || !s.dialog || s.dialog.hidden)) {
1577
+ Lt = !0, s.recapture.disabled = !0, S("Capturing…", !0), s.dialog.hidden = !0;
1574
1578
  try {
1575
1579
  let t = "";
1576
1580
  try {
1577
- t = await er();
1581
+ t = await rr();
1578
1582
  } catch {
1579
- t = await Ee(He());
1583
+ t = await Ce(Fe());
1580
1584
  }
1581
- Fe(t), b("");
1585
+ Ue(t), S("");
1582
1586
  } catch (t) {
1583
- b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1587
+ S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1584
1588
  } finally {
1585
- s.dialog.hidden = !1, s.recapture.disabled = !1, Ct = !1, it(), K();
1589
+ s.dialog.hidden = !1, s.recapture.disabled = !1, Lt = !1, st(), Y();
1586
1590
  }
1587
1591
  }
1588
1592
  }
1589
- function qr() {
1593
+ function Yr() {
1590
1594
  try {
1591
- if (z || (z = lr((e) => {
1595
+ if (X || (X = dr((e) => {
1592
1596
  const n = s.text.value.trim();
1593
1597
  s.text.value = n ? `${n} ${e}` : e;
1594
- })), !z.isSupported()) {
1595
- b("Audio-to-text is not supported in this browser.");
1598
+ })), !X.isSupported()) {
1599
+ S("Audio-to-text is not supported in this browser.");
1596
1600
  return;
1597
1601
  }
1598
- const t = z.start();
1599
- Vt(t), b(t ? "Listening…" : "");
1602
+ const t = X.start();
1603
+ Wt(t), S(t ? "Listening…" : "");
1600
1604
  } catch (t) {
1601
- b(t.message);
1605
+ S(t.message);
1602
1606
  }
1603
1607
  }
1604
- async function Xr() {
1608
+ async function Gr() {
1605
1609
  if (!d.video) {
1606
- b("Video is disabled on this host.");
1610
+ S("Video is disabled on this host.");
1607
1611
  return;
1608
1612
  }
1609
- s.dialog.hidden = !0, s.stop.hidden = !1, nt(), s.launcher.hidden = !0, tt = dr({
1613
+ s.dialog.hidden = !0, s.stop.hidden = !1, at(), s.launcher.hidden = !0, rt = hr({
1610
1614
  onStart() {
1611
1615
  },
1612
1616
  onStop(t) {
1613
- P = t, s.stop.hidden = !0, dt(), s.dialog.hidden = !1, it(), K(), b(t ? "Video attached." : "Recording cancelled.");
1617
+ B = t, s.stop.hidden = !0, ht(), s.dialog.hidden = !1, st(), Y(), S(t ? "Video attached." : "Recording cancelled.");
1614
1618
  },
1615
1619
  onError(t) {
1616
- b(t.message);
1620
+ S(t.message);
1617
1621
  }
1618
1622
  });
1619
1623
  try {
1620
- await tt.start();
1624
+ await rt.start();
1621
1625
  } catch (t) {
1622
- s.stop.hidden = !0, dt(), s.dialog.hidden = !1, b(t.message);
1626
+ s.stop.hidden = !0, ht(), s.dialog.hidden = !1, S(t.message);
1623
1627
  }
1624
1628
  }
1625
- function K() {
1626
- if (s.shot = null, !V()) {
1627
- s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = P ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(P)}"></video>` : "", pt();
1629
+ function Y() {
1630
+ if (s.shot = null, !K()) {
1631
+ s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = B ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(B)}"></video>` : "", mt();
1628
1632
  return;
1629
1633
  }
1630
- s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${I}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
1634
+ s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${D}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
1631
1635
  const t = s.shot.querySelector("img");
1632
1636
  t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
1633
1637
  const e = () => {
1634
- Yr(t), A();
1638
+ Jr(t), M();
1635
1639
  };
1636
- t.addEventListener("load", e), t.complete && t.naturalWidth && e(), pt();
1640
+ t.addEventListener("load", e), t.complete && t.naturalWidth && e(), mt();
1637
1641
  }
1638
- function Yr(t) {
1639
- const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
1640
- if (e && n && (O = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !O.w || !O.h)
1642
+ function Jr(t) {
1643
+ const e = t.naturalWidth || F.w, n = t.naturalHeight || F.h;
1644
+ if (e && n && (F = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !F.w || !F.h)
1641
1645
  return;
1642
- const r = y.crop(), i = O.w / O.h, a = r.w / r.h * i, o = Math.min(1, a / i), c = Math.min(1, i / a);
1646
+ const r = m.crop(), i = F.w / F.h, a = r.w / r.h * i, o = Math.min(1, a / i), c = Math.min(1, i / a);
1643
1647
  s.shot.style.left = `${(1 - o) / 2 * 100}%`, s.shot.style.top = `${(1 - c) / 2 * 100}%`, s.shot.style.width = `${o * 100}%`, s.shot.style.height = `${c * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
1644
1648
  }
1645
- function Gr(t) {
1649
+ function Qr(t) {
1646
1650
  return t.type === "arrow" ? {
1647
1651
  id: "preview",
1648
1652
  type: "arrow",
@@ -1657,66 +1661,66 @@ function Gr(t) {
1657
1661
  id: "preview",
1658
1662
  type: t.type,
1659
1663
  number: "",
1660
- ...wt(t.start, t.current)
1664
+ ...xt(t.start, t.current)
1661
1665
  };
1662
1666
  }
1663
- function A() {
1664
- if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !V() || !s.shot) {
1665
- pt();
1667
+ function M() {
1668
+ if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !K() || !s.shot) {
1669
+ mt();
1666
1670
  return;
1667
1671
  }
1668
- const e = y.crop(), n = rt(), r = Ft(n.clientWidth || 400);
1669
- if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (v == null ? void 0 : v.kind) === "crop") {
1672
+ const e = m.crop(), n = ot(), r = Nt(n.clientWidth || 400);
1673
+ if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (b == null ? void 0 : b.kind) === "crop") {
1670
1674
  const a = document.createElement("div");
1671
- a.className = "nf-crop", ce(a, wt(v.start, v.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(a);
1675
+ a.className = "nf-crop", le(a, xt(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(a);
1672
1676
  }
1673
- const i = y.list().slice();
1674
- if ((v == null ? void 0 : v.kind) === "sticker" && i.push(Gr(v)), i.forEach((a) => {
1675
- const o = a.id === "preview", c = !o && a.id === L, l = document.createElement("div");
1676
- if (l.className = `nf-sticker nf-${a.type}`, l.dataset.id = a.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), a.type === "arrow" ? Jr(l, a, e, c, r) : (ce(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Ot(l, u))), !o && a.number) {
1677
+ const i = m.list().slice();
1678
+ if ((b == null ? void 0 : b.kind) === "sticker" && i.push(Qr(b)), i.forEach((a) => {
1679
+ const o = a.id === "preview", c = !o && a.id === R, l = document.createElement("div");
1680
+ if (l.className = `nf-sticker nf-${a.type}`, l.dataset.id = a.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), a.type === "arrow" ? Zr(l, a, e, c, r) : (le(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Dt(l, u))), !o && a.number) {
1677
1681
  const u = document.createElement("span");
1678
1682
  u.className = "nf-badge", u.textContent = String(a.number), l.appendChild(u);
1679
1683
  }
1680
1684
  s.shot.appendChild(l);
1681
- }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((a) => a.remove()), P) {
1685
+ }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((a) => a.remove()), B) {
1682
1686
  const a = document.createElement("video");
1683
- a.className = "nf-recording-preview", a.controls = !0, a.src = URL.createObjectURL(P), a.style.position = "absolute", a.style.right = "8px", a.style.bottom = "8px", a.style.width = "160px", s.canvas.appendChild(a);
1687
+ a.className = "nf-recording-preview", a.controls = !0, a.src = URL.createObjectURL(B), a.style.position = "absolute", a.style.right = "8px", a.style.bottom = "8px", a.style.width = "160px", s.canvas.appendChild(a);
1684
1688
  }
1685
- pt();
1689
+ mt();
1686
1690
  }
1687
- function Jr(t, e, n, r, i = Ft(400)) {
1688
- const a = rt(), o = a.clientWidth, c = a.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, m = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), S = Math.min(l, f) - g, R = Math.min(u, m) - g, D = Math.max(2, Math.abs(f - l)) + g * 2, Z = Math.max(2, Math.abs(m - u)) + g * 2, q = l - S, X = u - R, vt = f - S, bt = m - R, H = Ae(q, X, vt, bt, i), Y = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1689
- t.style.left = `${S}px`, t.style.top = `${R}px`, t.style.width = `${D}px`, t.style.height = `${Z}px`, Y.setAttribute("class", "nf-arrow-svg"), Y.setAttribute("viewBox", `0 0 ${D} ${Z}`), Y.setAttribute("width", String(D)), Y.setAttribute("height", String(Z)), Y.innerHTML = `
1690
- <line class="nf-arrow-hit" x1="${q}" y1="${X}" x2="${vt}" y2="${bt}" />
1691
- <line class="nf-arrow-shaft" x1="${q}" y1="${X}" x2="${H.shaftEnd.x}" y2="${H.shaftEnd.y}" />
1692
- <polygon class="nf-arrow-head" points="${H.tipX},${H.tipY} ${H.left.x},${H.left.y} ${H.right.x},${H.right.y}" />
1693
- `, t.appendChild(Y), r && (Ot(t, "start", { left: q - 5, top: X - 5 }), Ot(t, "end", { left: vt - 5, top: bt - 5 }));
1691
+ function Zr(t, e, n, r, i = Nt(400)) {
1692
+ const a = ot(), o = a.clientWidth, c = a.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, y = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(l, f) - g, x = Math.min(u, y) - g, C = Math.max(2, Math.abs(f - l)) + g * 2, P = Math.max(2, Math.abs(y - u)) + g * 2, A = l - w, H = u - x, G = f - w, J = y - x, N = Le(A, H, G, J, i), Q = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1693
+ t.style.left = `${w}px`, t.style.top = `${x}px`, t.style.width = `${C}px`, t.style.height = `${P}px`, Q.setAttribute("class", "nf-arrow-svg"), Q.setAttribute("viewBox", `0 0 ${C} ${P}`), Q.setAttribute("width", String(C)), Q.setAttribute("height", String(P)), Q.innerHTML = `
1694
+ <line class="nf-arrow-hit" x1="${A}" y1="${H}" x2="${G}" y2="${J}" />
1695
+ <line class="nf-arrow-shaft" x1="${A}" y1="${H}" x2="${N.shaftEnd.x}" y2="${N.shaftEnd.y}" />
1696
+ <polygon class="nf-arrow-head" points="${N.tipX},${N.tipY} ${N.left.x},${N.left.y} ${N.right.x},${N.right.y}" />
1697
+ `, t.appendChild(Q), r && (Dt(t, "start", { left: A - 5, top: H - 5 }), Dt(t, "end", { left: G - 5, top: J - 5 }));
1694
1698
  }
1695
- function Ot(t, e, n) {
1699
+ function Dt(t, e, n) {
1696
1700
  const r = document.createElement("span");
1697
1701
  r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
1698
1702
  }
1699
- function ce(t, e, n) {
1703
+ function le(t, e, n) {
1700
1704
  t.style.left = `${(e.x - n.x) / n.w * 100}%`, t.style.top = `${(e.y - n.y) / n.h * 100}%`, t.style.width = `${e.w / n.w * 100}%`, t.style.height = `${e.h / n.h * 100}%`;
1701
1705
  }
1702
- function Ue() {
1706
+ function Ne() {
1703
1707
  try {
1704
1708
  return String(localStorage.getItem(Re) || "").trim();
1705
1709
  } catch {
1706
1710
  return "";
1707
1711
  }
1708
1712
  }
1709
- function Qr(t) {
1713
+ function ti(t) {
1710
1714
  const e = String(t || "").trim();
1711
- if (!(!e || e === Pt))
1715
+ if (!(!e || e === Ot))
1712
1716
  try {
1713
1717
  localStorage.setItem(Re, e);
1714
1718
  } catch {
1715
1719
  }
1716
1720
  }
1717
- function Ne() {
1721
+ function _e() {
1718
1722
  try {
1719
- const t = localStorage.getItem(Te);
1723
+ const t = localStorage.getItem(Pe);
1720
1724
  if (!t)
1721
1725
  return { diagnostics: !1, logs: !1 };
1722
1726
  const e = JSON.parse(t);
@@ -1728,13 +1732,13 @@ function Ne() {
1728
1732
  return { diagnostics: !1, logs: !1 };
1729
1733
  }
1730
1734
  }
1731
- function le(t = {}) {
1735
+ function ue(t = {}) {
1732
1736
  const e = {
1733
- ...Ne(),
1737
+ ..._e(),
1734
1738
  ...t
1735
1739
  };
1736
1740
  try {
1737
- localStorage.setItem(Te, JSON.stringify({
1741
+ localStorage.setItem(Pe, JSON.stringify({
1738
1742
  diagnostics: !!e.diagnostics,
1739
1743
  logs: !!e.logs
1740
1744
  }));
@@ -1742,21 +1746,21 @@ function le(t = {}) {
1742
1746
  }
1743
1747
  }
1744
1748
  function je() {
1745
- return !!(String(T.userId || "").trim() || String(T.email || "").trim() || String(T.displayName || "").trim());
1749
+ return !!(String(O.userId || "").trim() || String(O.email || "").trim() || String(O.displayName || "").trim());
1746
1750
  }
1747
- function _e() {
1751
+ function Ve() {
1748
1752
  return String(
1749
- T.displayName || T.email || T.userId || ""
1753
+ O.displayName || O.email || O.userId || ""
1750
1754
  ).trim();
1751
1755
  }
1752
- function Zr() {
1756
+ function ei() {
1753
1757
  var e;
1754
1758
  if (je())
1755
- return _e() || Pt;
1759
+ return Ve() || Ot;
1756
1760
  const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
1757
- return t ? (Qr(t), t) : Pt;
1761
+ return t ? (ti(t), t) : Ot;
1758
1762
  }
1759
- function Ve() {
1763
+ function We() {
1760
1764
  if (!s.author)
1761
1765
  return;
1762
1766
  const t = je();
@@ -1764,14 +1768,17 @@ function Ve() {
1764
1768
  s.author.value = "";
1765
1769
  return;
1766
1770
  }
1767
- s.author.value = Ue();
1771
+ s.author.value = Ne();
1768
1772
  }
1769
- function We(t, e = $e) {
1773
+ function ze(t, e = $e) {
1770
1774
  const n = Number(t);
1771
- return Number.isFinite(n) ? Math.min(Tr, Math.max(0, Math.floor(n))) : e;
1775
+ return Number.isFinite(n) ? Math.min(Ir, Math.max(0, Math.floor(n))) : e;
1776
+ }
1777
+ function Ke(t) {
1778
+ t.key !== "Escape" || !s.dialog || s.dialog.hidden || bt && !St || nt();
1772
1779
  }
1773
- function ze(t = {}) {
1774
- or(t);
1780
+ function qe(t = {}) {
1781
+ cr(t);
1775
1782
  const e = Object.prototype.hasOwnProperty.call(t, "kinds");
1776
1783
  d = {
1777
1784
  ...d,
@@ -1781,99 +1788,100 @@ function ze(t = {}) {
1781
1788
  name: t.name == null ? d.name : String(t.name || ""),
1782
1789
  targets: t.targets === void 0 ? d.targets : t.targets,
1783
1790
  hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
1784
- theme: Pe(t.theme ?? d.theme),
1791
+ theme: Ie(t.theme ?? d.theme),
1785
1792
  video: t.video == null ? d.video : !!t.video,
1786
- consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : We(t.consoleLogLimit, d.consoleLogLimit),
1787
- kinds: e ? Lr(t.kinds) : d.kinds,
1793
+ consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : ze(t.consoleLogLimit, d.consoleLogLimit),
1794
+ kinds: e ? $r(t.kinds) : d.kinds,
1788
1795
  capture: t.capture === void 0 ? d.capture : t.capture,
1789
- onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
1796
+ onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture,
1797
+ displayLink: t.displayLink == null ? d.displayLink : !!t.displayLink
1790
1798
  };
1791
1799
  }
1792
- function Wt(t = {}) {
1793
- return ze(t), h && nt(), zt;
1800
+ function zt(t = {}) {
1801
+ return qe(t), p && at(), Kt;
1794
1802
  }
1795
- function ti(t = {}) {
1796
- return ze(t), Nt(), nt(), zt;
1803
+ function ni(t = {}) {
1804
+ return qe(t), _t(), at(), Kt;
1797
1805
  }
1798
- function ei(t) {
1799
- return Wt({ theme: t });
1806
+ function ri(t) {
1807
+ return zt({ theme: t });
1800
1808
  }
1801
- function ni(t) {
1809
+ function ii(t) {
1802
1810
  const e = !!t;
1803
- return !e && h && s.dialog && !s.dialog.hidden && at(), Wt({ hideLauncher: !e });
1811
+ return !e && p && s.dialog && !s.dialog.hidden && nt(), zt({ hideLauncher: !e });
1804
1812
  }
1805
- function ri() {
1806
- const t = _e() || Ue() || void 0, e = ir({
1807
- ...T,
1808
- displayName: T.displayName || t
1813
+ function ai() {
1814
+ const t = Ve() || Ne() || void 0, e = or({
1815
+ ...O,
1816
+ displayName: O.displayName || t
1809
1817
  });
1810
- B = Sr(e), $ = xr(
1811
- Le.snapshot().slice(-We(d.consoleLogLimit))
1818
+ U = Er(e), T = Cr(
1819
+ Me.snapshot().slice(-ze(d.consoleLogLimit))
1812
1820
  );
1813
- const n = Ne();
1814
- n.diagnostics && ut(B, !0), n.logs && $.length && ut($, !0), W = !1;
1821
+ const n = _e();
1822
+ n.diagnostics && ft(U, !0), n.logs && T.length && ft(T, !0), q = !1;
1815
1823
  }
1816
- function mt(t) {
1817
- W = !!t, s.privacyPanel && (s.privacyPanel.hidden = !W), s.privacyChange && (s.privacyChange.setAttribute("aria-expanded", W ? "true" : "false"), s.privacyChange.dataset.active = String(W)), W && Xe();
1824
+ function gt(t) {
1825
+ q = !!t, s.privacyPanel && (s.privacyPanel.hidden = !q), s.privacyChange && (s.privacyChange.setAttribute("aria-expanded", q ? "true" : "false"), s.privacyChange.dataset.active = String(q)), q && Ge();
1818
1826
  }
1819
- function Ke() {
1827
+ function Xe() {
1820
1828
  if (!s.privacy || !s.privacyText || !s.privacyChange)
1821
1829
  return;
1822
- const t = Cr({
1823
- diagnostics: B,
1824
- logs: $
1830
+ const t = Lr({
1831
+ diagnostics: U,
1832
+ logs: T
1825
1833
  });
1826
1834
  s.privacyText.textContent = t, s.privacyText.hidden = !t;
1827
- const e = B.length === 0 && $.length === 0;
1835
+ const e = U.length === 0 && T.length === 0;
1828
1836
  s.privacySummary && (s.privacySummary.hidden = e), s.privacy.hidden = e, s.privacyChange.hidden = !1;
1829
1837
  }
1830
- function qe(t, e, n) {
1838
+ function Ye(t, e, n) {
1831
1839
  return `<label class="nf-privacy-toggle">
1832
1840
  <span class="nf-privacy-toggle-label">Redact</span>
1833
- <input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${C(n)}">
1841
+ <input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${L(n)}">
1834
1842
  </label>`;
1835
1843
  }
1836
- function ue(t, e, n, r, i) {
1837
- const a = qe(i, !1, `Redact ${n}`);
1844
+ function de(t, e, n, r, i) {
1845
+ const a = Ye(i, !1, `Redact ${n}`);
1838
1846
  if (i) {
1839
1847
  const o = r ? `${n}: ${r}` : n;
1840
- return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}" data-redacted="true">
1848
+ return `<div class="nf-privacy-row" data-kind="${L(t)}" data-id="${L(e)}" data-redacted="true">
1841
1849
  <div class="nf-privacy-row-text">
1842
- <div class="nf-privacy-row-summary" title="${C(o)}">${C(o)}</div>
1850
+ <div class="nf-privacy-row-summary" title="${L(o)}">${L(o)}</div>
1843
1851
  </div>
1844
1852
  ${a}
1845
1853
  </div>`;
1846
1854
  }
1847
- return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}">
1855
+ return `<div class="nf-privacy-row" data-kind="${L(t)}" data-id="${L(e)}">
1848
1856
  <div class="nf-privacy-row-text">
1849
- <div class="nf-privacy-row-title">${C(n)}</div>
1850
- <div class="nf-privacy-row-detail">${C(r)}</div>
1857
+ <div class="nf-privacy-row-title">${L(n)}</div>
1858
+ <div class="nf-privacy-row-detail">${L(r)}</div>
1851
1859
  </div>
1852
1860
  ${a}
1853
1861
  </div>`;
1854
1862
  }
1855
- function de(t, e, n, r) {
1863
+ function fe(t, e, n, r) {
1856
1864
  if (!n.length)
1857
1865
  return "";
1858
- const i = Er(n), a = i.checked && !i.indeterminate;
1859
- return `<section class="nf-privacy-section" data-section="${C(t)}"${a ? ' data-redacted="true"' : ""}>
1866
+ const i = kr(n), a = i.checked && !i.indeterminate;
1867
+ return `<section class="nf-privacy-section" data-section="${L(t)}"${a ? ' data-redacted="true"' : ""}>
1860
1868
  <div class="nf-privacy-section-head">
1861
- <h3 class="nf-privacy-section-title">${C(e)}</h3>
1862
- ${qe(i.checked, i.indeterminate, `Redact all ${e.toLowerCase()}`)}
1869
+ <h3 class="nf-privacy-section-title">${L(e)}</h3>
1870
+ ${Ye(i.checked, i.indeterminate, `Redact all ${e.toLowerCase()}`)}
1863
1871
  </div>
1864
1872
  <div class="nf-privacy-rows"${a ? " hidden" : ""}>${r}</div>
1865
1873
  </section>`;
1866
1874
  }
1867
- function Xe() {
1875
+ function Ge() {
1868
1876
  if (!s.privacyScroll)
1869
1877
  return;
1870
- const t = B.map((n) => ue(
1878
+ const t = U.map((n) => de(
1871
1879
  "diagnostic",
1872
1880
  n.key,
1873
1881
  n.label,
1874
1882
  Ar(n.value),
1875
1883
  n.redacted
1876
- )).join(""), e = $.map((n) => ue(
1884
+ )).join(""), e = T.map((n) => de(
1877
1885
  "log",
1878
1886
  n.id,
1879
1887
  n.level,
@@ -1881,13 +1889,13 @@ function Xe() {
1881
1889
  n.redacted
1882
1890
  )).join("");
1883
1891
  s.privacyScroll.innerHTML = [
1884
- de("diagnostics", "Diagnostics", B, t),
1885
- $.length ? de("logs", "Logs", $, e) : ""
1892
+ fe("diagnostics", "Diagnostics", U, t),
1893
+ T.length ? fe("logs", "Logs", T, e) : ""
1886
1894
  ].join(""), s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach((n) => {
1887
1895
  n.indeterminate = !0, n.removeAttribute("data-indeterminate");
1888
- }), Ke();
1896
+ }), Xe();
1889
1897
  }
1890
- function ii(t) {
1898
+ function oi(t) {
1891
1899
  const e = t.target;
1892
1900
  if (!(e instanceof HTMLInputElement) || e.type !== "checkbox")
1893
1901
  return;
@@ -1895,93 +1903,109 @@ function ii(t) {
1895
1903
  if (r) {
1896
1904
  const a = r.dataset.kind, o = r.dataset.id;
1897
1905
  if (a === "diagnostic") {
1898
- const c = B.find((l) => l.key === o);
1906
+ const c = U.find((l) => l.key === o);
1899
1907
  c && (c.redacted = i);
1900
1908
  } else if (a === "log") {
1901
- const c = $.find((l) => l.id === o);
1909
+ const c = T.find((l) => l.id === o);
1902
1910
  c && (c.redacted = i);
1903
1911
  }
1904
1912
  } else if (n) {
1905
1913
  const a = n.dataset.section;
1906
- a === "diagnostics" ? (ut(B, i), le({ diagnostics: i })) : a === "logs" && (ut($, i), le({ logs: i }));
1914
+ a === "diagnostics" ? (ft(U, i), ue({ diagnostics: i })) : a === "logs" && (ft(T, i), ue({ logs: i }));
1907
1915
  } else
1908
1916
  return;
1909
- Xe();
1917
+ Ge();
1910
1918
  }
1911
- async function Ye() {
1912
- Nt(), Ge(), nt(), s.launcher.hidden = !0, y = Ht(), O = { w: 0, h: 0 }, P = null, I = "", Q = "", L = null, v = null, w = null, j = Dr(), jt(j), et(null), Vt(!1), s.text.value = "", Ve(), b(""), ri();
1919
+ async function Je() {
1920
+ _t(), Qe(), at(), s.launcher.hidden = !0, m = Ut(), F = { w: 0, h: 0 }, B = null, D = "", et = "", R = null, b = null, v = null, W = Fr(), jt(W), it(null), Wt(!1), s.text.value = "", We(), S(""), ai();
1913
1921
  try {
1914
- Fe(await Ee(He())), b("");
1922
+ Ue(await Ce(Fe())), S("");
1915
1923
  } catch (t) {
1916
- I = "", b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1924
+ D = "", S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1917
1925
  }
1918
- it(), mt(!1), Ke(), s.dialog.hidden = !1, K(), s.text.focus();
1926
+ st(), gt(!1), Xe(), s.dialog.hidden = !1, Y(), s.text.focus();
1919
1927
  }
1920
- function at() {
1921
- h && (z == null || z.stop(), Vt(!1), Be(), v = null, w = null, _t(!1), Ge(), mt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, dt());
1922
- }
1923
- function ai() {
1924
- const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
1925
- if (!t || !e || !n || !r)
1926
- return Promise.resolve();
1927
- Ut = !0, b("");
1928
- const i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, a = e.getBoundingClientRect();
1929
- if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", i)
1930
- return new Promise((u) => {
1931
- window.setTimeout(() => u(), 1e3);
1928
+ function nt() {
1929
+ p && (X == null || X.stop(), Wt(!1), De(), b = null, v = null, Vt(!1), Qe(), gt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, ht());
1930
+ }
1931
+ function si(t = "") {
1932
+ const e = s.dialog, n = s.panel, r = s.panelBody, i = s.successMsg, a = s.successLink, o = String(t || "").trim(), c = !!(d.displayLink && o);
1933
+ if (!e || !n || !r || !i)
1934
+ return Promise.resolve(!1);
1935
+ bt = !0, St = c, S("");
1936
+ const l = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, u = n.getBoundingClientRect();
1937
+ if (r.hidden = !0, i.hidden = !1, e.classList.add("nf-success"), e.classList.toggle("nf-success-sticky", c), e.style.opacity = "1", a && (c ? (a.hidden = !1, a.href = o, a.textContent = "Open in Tracker") : (a.hidden = !0, a.removeAttribute("href"))), c) {
1938
+ if (l)
1939
+ return Promise.resolve(!0);
1940
+ const w = n.getBoundingClientRect(), x = w.width > 0 ? u.width / w.width : 1, C = w.height > 0 ? u.height / w.height : 1;
1941
+ return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${x}, ${C})`, n.getBoundingClientRect(), new Promise((P) => {
1942
+ let A = !1;
1943
+ const H = () => {
1944
+ A || (A = !0, n.removeEventListener("transitionend", G), P(!0));
1945
+ }, G = (J) => {
1946
+ J.target !== n || J.propertyName !== "transform" || H();
1947
+ };
1948
+ n.addEventListener("transitionend", G), requestAnimationFrame(() => {
1949
+ n.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", n.style.transform = "scale(1)";
1950
+ }), window.setTimeout(H, 700);
1932
1951
  });
1933
- const o = e.getBoundingClientRect(), c = o.width > 0 ? a.width / o.width : 1, l = o.height > 0 ? a.height / o.height : 1;
1934
- return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
1935
- let f = !1;
1936
- const m = () => {
1937
- f || (f = !0, e.removeEventListener("transitionend", g), window.setTimeout(() => {
1938
- t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
1952
+ }
1953
+ if (l)
1954
+ return new Promise((w) => {
1955
+ window.setTimeout(() => w(!1), 1e3);
1956
+ });
1957
+ const f = n.getBoundingClientRect(), y = f.width > 0 ? u.width / f.width : 1, g = f.height > 0 ? u.height / f.height : 1;
1958
+ return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${y}, ${g})`, n.getBoundingClientRect(), new Promise((w) => {
1959
+ let x = !1;
1960
+ const C = () => {
1961
+ x || (x = !0, n.removeEventListener("transitionend", P), window.setTimeout(() => {
1962
+ e.style.transition = "opacity 0.28s ease", e.style.opacity = "0", window.setTimeout(() => w(!1), 280);
1939
1963
  }, 1e3));
1940
- }, g = (S) => {
1941
- S.target !== e || S.propertyName !== "transform" || m();
1964
+ }, P = (A) => {
1965
+ A.target !== n || A.propertyName !== "transform" || C();
1942
1966
  };
1943
- e.addEventListener("transitionend", g), requestAnimationFrame(() => {
1944
- e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
1945
- }), window.setTimeout(m, 700);
1967
+ n.addEventListener("transitionend", P), requestAnimationFrame(() => {
1968
+ n.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", n.style.transform = "scale(1)";
1969
+ }), window.setTimeout(C, 700);
1946
1970
  });
1947
1971
  }
1948
- function Ge() {
1949
- Ut = !1, s.dialog && (s.dialog.classList.remove("nf-success"), s.dialog.style.opacity = "", s.dialog.style.transition = "", s.panel && (s.panel.style.transform = "", s.panel.style.transition = "", s.panel.style.transformOrigin = ""), s.panelBody && (s.panelBody.hidden = !1), s.successMsg && (s.successMsg.hidden = !0));
1972
+ function Qe() {
1973
+ bt = !1, St = !1, s.dialog && (s.dialog.classList.remove("nf-success", "nf-success-sticky"), s.dialog.style.opacity = "", s.dialog.style.transition = "", s.panel && (s.panel.style.transform = "", s.panel.style.transition = "", s.panel.style.transformOrigin = ""), s.panelBody && (s.panelBody.hidden = !1), s.successMsg && (s.successMsg.hidden = !0), s.successLink && (s.successLink.hidden = !0, s.successLink.removeAttribute("href"), s.successLink.textContent = "Open in Tracker"));
1950
1974
  }
1951
- function oi(t = {}) {
1952
- T = { ...T, ...ar(t) }, Ve();
1975
+ function ci(t = {}) {
1976
+ O = { ...O, ...sr(t) }, We();
1953
1977
  }
1954
- async function Je() {
1955
- if (Nt(), At)
1978
+ async function Ze() {
1979
+ if (_t(), At)
1956
1980
  return null;
1957
1981
  const t = s.text.value.trim();
1958
- if (!t && !V() && !P)
1959
- return b("Add a note, screenshot, or video first."), null;
1982
+ if (!t && !K() && !B)
1983
+ return S("Add a note, screenshot, or video first."), null;
1960
1984
  if (!d.endpoint || !d.projectKey)
1961
- return b("Notefully is missing endpoint or projectKey."), null;
1962
- At = !0, fe(!0), b("Submitting…", !0);
1985
+ return S("Notefully is missing endpoint or projectKey."), null;
1986
+ At = !0, he(!0), S("Submitting…", !0);
1963
1987
  try {
1964
- const e = Zr(), n = new FormData();
1965
- if (n.append("message", t), n.append("kind", j), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(Mr({
1988
+ const e = ei(), n = new FormData();
1989
+ if (n.append("message", t), n.append("kind", W), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(Mr({
1966
1990
  author: e,
1967
- diagnostics: B,
1968
- logs: $
1969
- }))), n.append("annotations", JSON.stringify(y.list())), n.append("crop", JSON.stringify(y.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), V()) {
1970
- const a = await Pr(I);
1971
- if (n.append("screenshot", a, "screenshot.png"), y.list().length || y.isCropped()) {
1972
- const o = await wr(
1973
- I,
1974
- y.crop(),
1975
- y.list(),
1991
+ diagnostics: U,
1992
+ logs: T
1993
+ }))), n.append("annotations", JSON.stringify(m.list())), n.append("crop", JSON.stringify(m.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), K()) {
1994
+ const o = await Or(D);
1995
+ if (n.append("screenshot", o, "screenshot.png"), m.list().length || m.isCropped()) {
1996
+ const c = await br(
1997
+ D,
1998
+ m.crop(),
1999
+ m.list(),
1976
2000
  {
1977
- mark: oe("--nf-mark", "#fdd341"),
1978
- markText: oe("--nf-mark-text", "#2a2140")
2001
+ mark: se("--nf-mark", "#fdd341"),
2002
+ markText: se("--nf-mark-text", "#2a2140")
1979
2003
  }
1980
2004
  );
1981
- n.append("screenshotBaked", o, "screenshot.baked.png");
2005
+ n.append("screenshotBaked", c, "screenshot.baked.png");
1982
2006
  }
1983
2007
  }
1984
- P && n.append("recording", P, "recording.webm");
2008
+ B && n.append("recording", B, "recording.webm");
1985
2009
  const r = await fetch(`${d.endpoint}/v1/reports`, {
1986
2010
  method: "POST",
1987
2011
  headers: {
@@ -1996,29 +2020,29 @@ async function Je() {
1996
2020
  i = null;
1997
2021
  }
1998
2022
  if (!r.ok)
1999
- throw b((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
2000
- return await ai(), at(), i;
2023
+ throw S((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
2024
+ return await si((i == null ? void 0 : i.trackerUrl) || "") || nt(), i;
2001
2025
  } finally {
2002
- At = !1, fe(!1);
2026
+ At = !1, he(!1);
2003
2027
  }
2004
2028
  }
2005
- function fe(t) {
2029
+ function he(t) {
2006
2030
  s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
2007
2031
  }
2008
- function si() {
2009
- at(), h == null || h.remove(), h = null, s = {};
2032
+ function li() {
2033
+ nt(), document.removeEventListener("keydown", Ke), p == null || p.remove(), p = null, s = {};
2010
2034
  }
2011
- const zt = { init: ti, configure: Wt, setTheme: ei, setVisible: ni, open: Ye, close: at, identify: oi, submit: Je, destroy: si };
2012
- typeof window < "u" && (window.Notefully = zt);
2035
+ const Kt = { init: ni, configure: zt, setTheme: ri, setVisible: ii, open: Je, close: nt, identify: ci, submit: Ze, destroy: li };
2036
+ typeof window < "u" && (window.Notefully = Kt);
2013
2037
  export {
2014
- at as close,
2015
- Wt as configure,
2016
- zt as default,
2017
- si as destroy,
2018
- oi as identify,
2019
- ti as init,
2020
- Ye as open,
2021
- ei as setTheme,
2022
- ni as setVisible,
2023
- Je as submit
2038
+ nt as close,
2039
+ zt as configure,
2040
+ Kt as default,
2041
+ li as destroy,
2042
+ ci as identify,
2043
+ ni as init,
2044
+ Je as open,
2045
+ ri as setTheme,
2046
+ ii as setVisible,
2047
+ Ze as submit
2024
2048
  };