@makefully/notefully 0.1.34 → 0.1.36

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,14 +1,14 @@
1
- function Le(t, e) {
1
+ function ke(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
5
5
  return window.location.protocol + t;
6
6
  if (t.match(/^[a-z]+:/i))
7
7
  return t;
8
- const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), o = n.createElement("a");
9
- return n.head.appendChild(r), n.body.appendChild(o), e && (r.href = e), o.href = t, o.href;
8
+ const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), a = n.createElement("a");
9
+ return n.head.appendChild(r), n.body.appendChild(a), e && (r.href = e), a.href = t, a.href;
10
10
  }
11
- const Re = /* @__PURE__ */ (() => {
11
+ const Ie = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -16,33 +16,33 @@ const Re = /* @__PURE__ */ (() => {
16
16
  );
17
17
  return () => (t += 1, `u${e()}${t}`);
18
18
  })();
19
- function F(t) {
19
+ function H(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
25
  let V = null;
26
- function Zt(t = {}) {
27
- return V || (t.includeStyleProperties ? (V = t.includeStyleProperties, V) : (V = F(window.getComputedStyle(document.documentElement)), V));
26
+ function ne(t = {}) {
27
+ return V || (t.includeStyleProperties ? (V = t.includeStyleProperties, V) : (V = H(window.getComputedStyle(document.documentElement)), V));
28
28
  }
29
29
  function Z(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 $e(t) {
33
+ function Oe(t) {
34
34
  const e = Z(t, "border-left-width"), n = Z(t, "border-right-width");
35
35
  return t.clientWidth + e + n;
36
36
  }
37
- function Pe(t) {
37
+ function Be(t) {
38
38
  const e = Z(t, "border-top-width"), n = Z(t, "border-bottom-width");
39
39
  return t.clientHeight + e + n;
40
40
  }
41
- function te(t, e = {}) {
42
- const n = e.width || $e(t), r = e.height || Pe(t);
41
+ function re(t, e = {}) {
42
+ const n = e.width || Oe(t), r = e.height || Be(t);
43
43
  return { width: n, height: r };
44
44
  }
45
- function ke() {
45
+ function He() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -52,7 +52,7 @@ function ke() {
52
52
  return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
53
  }
54
54
  const C = 16384;
55
- function Te(t) {
55
+ function De(t) {
56
56
  (t.width > C || t.height > C) && (t.width > C && t.height > C ? t.width > t.height ? (t.height *= C / t.width, t.width = C) : (t.width *= C / t.height, t.height = C) : t.width > C ? (t.height *= C / t.width, t.width = C) : (t.width *= C / t.height, t.height = C));
57
57
  }
58
58
  function tt(t) {
@@ -65,12 +65,12 @@ function tt(t) {
65
65
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
66
66
  });
67
67
  }
68
- async function Ie(t) {
68
+ async function Fe(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 Oe(t, e, n) {
72
- const r = "http://www.w3.org/2000/svg", o = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
73
- return o.setAttribute("width", `${e}`), o.setAttribute("height", `${n}`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), o.appendChild(i), i.appendChild(t), Ie(o);
71
+ async function Ue(t, e, n) {
72
+ const r = "http://www.w3.org/2000/svg", a = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
73
+ return a.setAttribute("width", `${e}`), a.setAttribute("height", `${n}`), a.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t), Fe(a);
74
74
  }
75
75
  const E = (t, e) => {
76
76
  if (t instanceof e)
@@ -78,118 +78,118 @@ const E = (t, e) => {
78
78
  const n = Object.getPrototypeOf(t);
79
79
  return n === null ? !1 : n.constructor.name === e.name || E(n, e);
80
80
  };
81
- function He(t) {
81
+ function Ne(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function Fe(t, e) {
86
- return Zt(e).map((n) => {
87
- const r = t.getPropertyValue(n), o = t.getPropertyPriority(n);
88
- return `${n}: ${r}${o ? " !important" : ""};`;
85
+ function je(t, e) {
86
+ return ne(e).map((n) => {
87
+ const r = t.getPropertyValue(n), a = t.getPropertyPriority(n);
88
+ return `${n}: ${r}${a ? " !important" : ""};`;
89
89
  }).join(" ");
90
90
  }
91
- function De(t, e, n, r) {
92
- const o = `.${t}:${e}`, i = n.cssText ? He(n) : Fe(n, r);
93
- return document.createTextNode(`${o}{${i}}`);
91
+ function _e(t, e, n, r) {
92
+ const a = `.${t}:${e}`, i = n.cssText ? Ne(n) : je(n, r);
93
+ return document.createTextNode(`${a}{${i}}`);
94
94
  }
95
- function Ot(t, e, n, r) {
96
- const o = window.getComputedStyle(t, n), i = o.getPropertyValue("content");
95
+ function Dt(t, e, n, r) {
96
+ const a = window.getComputedStyle(t, n), i = a.getPropertyValue("content");
97
97
  if (i === "" || i === "none")
98
98
  return;
99
- const a = Re();
99
+ const o = Ie();
100
100
  try {
101
- e.className = `${e.className} ${a}`;
101
+ e.className = `${e.className} ${o}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const c = document.createElement("style");
106
- c.appendChild(De(a, n, o, r)), e.appendChild(c);
106
+ c.appendChild(_e(o, n, a, r)), e.appendChild(c);
107
107
  }
108
- function Be(t, e, n) {
109
- Ot(t, e, ":before", n), Ot(t, e, ":after", n);
108
+ function Ve(t, e, n) {
109
+ Dt(t, e, ":before", n), Dt(t, e, ":after", n);
110
110
  }
111
- const Ht = "application/font-woff", Ft = "image/jpeg", Ue = {
112
- woff: Ht,
113
- woff2: Ht,
111
+ const Ft = "application/font-woff", Ut = "image/jpeg", We = {
112
+ woff: Ft,
113
+ woff2: Ft,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: Ft,
118
- jpeg: Ft,
117
+ jpg: Ut,
118
+ jpeg: Ut,
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 je(t) {
124
+ function ze(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
- function Ct(t) {
129
- const e = je(t).toLowerCase();
130
- return Ue[e] || "";
128
+ function Mt(t) {
129
+ const e = ze(t).toLowerCase();
130
+ return We[e] || "";
131
131
  }
132
- function Ne(t) {
132
+ function qe(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
- function mt(t) {
135
+ function gt(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function _e(t, e) {
138
+ function Ke(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
- async function ee(t, e, n) {
141
+ async function ie(t, e, n) {
142
142
  const r = await fetch(t, e);
143
143
  if (r.status === 404)
144
144
  throw new Error(`Resource "${r.url}" not found`);
145
- const o = await r.blob();
146
- return new Promise((i, a) => {
145
+ const a = await r.blob();
146
+ return new Promise((i, o) => {
147
147
  const c = new FileReader();
148
- c.onerror = a, c.onloadend = () => {
148
+ c.onerror = o, c.onloadend = () => {
149
149
  try {
150
150
  i(n({ res: r, result: c.result }));
151
151
  } catch (l) {
152
- a(l);
152
+ o(l);
153
153
  }
154
- }, c.readAsDataURL(o);
154
+ }, c.readAsDataURL(a);
155
155
  });
156
156
  }
157
- const ut = {};
158
- function Ve(t, e, n) {
157
+ const dt = {};
158
+ function Xe(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 Mt(t, e, n) {
163
- const r = Ve(t, e, n.includeQueryParams);
164
- if (ut[r] != null)
165
- return ut[r];
162
+ async function Lt(t, e, n) {
163
+ const r = Xe(t, e, n.includeQueryParams);
164
+ if (dt[r] != null)
165
+ return dt[r];
166
166
  n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
- let o;
167
+ let a;
168
168
  try {
169
- const i = await ee(t, n.fetchRequestInit, ({ res: a, result: c }) => (e || (e = a.headers.get("Content-Type") || ""), Ne(c)));
170
- o = _e(i, e);
169
+ const i = await ie(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), qe(c)));
170
+ a = Ke(i, e);
171
171
  } catch (i) {
172
- o = n.imagePlaceholder || "";
173
- let a = `Failed to fetch resource: ${t}`;
174
- i && (a = typeof i == "string" ? i : i.message), a && console.warn(a);
172
+ a = n.imagePlaceholder || "";
173
+ let o = `Failed to fetch resource: ${t}`;
174
+ i && (o = typeof i == "string" ? i : i.message), o && console.warn(o);
175
175
  }
176
- return ut[r] = o, o;
176
+ return dt[r] = a, a;
177
177
  }
178
- async function ze(t) {
178
+ async function Ye(t) {
179
179
  const e = t.toDataURL();
180
180
  return e === "data:," ? t.cloneNode(!1) : tt(e);
181
181
  }
182
- async function qe(t, e) {
182
+ async function Ge(t, e) {
183
183
  if (t.currentSrc) {
184
- const i = document.createElement("canvas"), a = i.getContext("2d");
185
- i.width = t.clientWidth, i.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, i.width, i.height);
184
+ const i = document.createElement("canvas"), o = i.getContext("2d");
185
+ i.width = t.clientWidth, i.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, i.width, i.height);
186
186
  const c = i.toDataURL();
187
187
  return tt(c);
188
188
  }
189
- const n = t.poster, r = Ct(n), o = await Mt(n, r, e);
190
- return tt(o);
189
+ const n = t.poster, r = Mt(n), a = await Lt(n, r, e);
190
+ return tt(a);
191
191
  }
192
- async function We(t, e) {
192
+ async function Je(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)
@@ -198,42 +198,42 @@ async function We(t, e) {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function Ke(t, e) {
202
- return E(t, HTMLCanvasElement) ? ze(t) : E(t, HTMLVideoElement) ? qe(t, e) : E(t, HTMLIFrameElement) ? We(t, e) : t.cloneNode(ne(t));
201
+ async function Qe(t, e) {
202
+ return E(t, HTMLCanvasElement) ? Ye(t) : E(t, HTMLVideoElement) ? Ge(t, e) : E(t, HTMLIFrameElement) ? Je(t, e) : t.cloneNode(ae(t));
203
203
  }
204
- const Xe = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ne = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Ye(t, e, n) {
206
- var r, o;
207
- if (ne(e))
204
+ const Ze = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ae = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function tn(t, e, n) {
206
+ var r, a;
207
+ if (ae(e))
208
208
  return e;
209
209
  let i = [];
210
- return Xe(t) && t.assignedNodes ? i = F(t.assignedNodes()) : E(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = F(t.contentDocument.body.childNodes) : i = F(((o = t.shadowRoot) !== null && o !== void 0 ? o : t).childNodes), i.length === 0 || E(t, HTMLVideoElement) || await i.reduce((a, c) => a.then(() => ot(c, n)).then((l) => {
210
+ return Ze(t) && t.assignedNodes ? i = H(t.assignedNodes()) : E(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((a = t.shadowRoot) !== null && a !== void 0 ? a : t).childNodes), i.length === 0 || E(t, HTMLVideoElement) || await i.reduce((o, c) => o.then(() => ot(c, n)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function Ge(t, e, n) {
214
+ function en(t, e, n) {
215
215
  const r = e.style;
216
216
  if (!r)
217
217
  return;
218
- const o = window.getComputedStyle(t);
219
- o.cssText ? (r.cssText = o.cssText, r.transformOrigin = o.transformOrigin) : Zt(n).forEach((i) => {
220
- let a = o.getPropertyValue(i);
221
- i === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), E(t, HTMLIFrameElement) && i === "display" && a === "inline" && (a = "block"), i === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(i, a, o.getPropertyPriority(i));
218
+ const a = window.getComputedStyle(t);
219
+ a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) : ne(n).forEach((i) => {
220
+ let o = a.getPropertyValue(i);
221
+ i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), E(t, HTMLIFrameElement) && i === "display" && o === "inline" && (o = "block"), i === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(i, o, a.getPropertyPriority(i));
222
222
  });
223
223
  }
224
- function Je(t, e) {
224
+ function nn(t, e) {
225
225
  E(t, HTMLTextAreaElement) && (e.innerHTML = t.value), E(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function Qe(t, e) {
227
+ function rn(t, e) {
228
228
  if (E(t, HTMLSelectElement)) {
229
- const r = Array.from(e.children).find((o) => t.value === o.getAttribute("value"));
229
+ const r = Array.from(e.children).find((a) => t.value === a.getAttribute("value"));
230
230
  r && r.setAttribute("selected", "");
231
231
  }
232
232
  }
233
- function Ze(t, e, n) {
234
- return E(e, Element) && (Ge(t, e, n), Be(t, e, n), Je(t, e), Qe(t, e)), e;
233
+ function an(t, e, n) {
234
+ return E(e, Element) && (en(t, e, n), Ve(t, e, n), nn(t, e), rn(t, e)), e;
235
235
  }
236
- async function tn(t, e) {
236
+ async function on(t, e) {
237
237
  const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
238
238
  if (n.length === 0)
239
239
  return t;
@@ -245,133 +245,133 @@ async function tn(t, e) {
245
245
  !l && u && !r[c] && (r[c] = await ot(u, e, !0));
246
246
  }
247
247
  }
248
- const o = Object.values(r);
249
- if (o.length) {
250
- const i = "http://www.w3.org/1999/xhtml", a = document.createElementNS(i, "svg");
251
- a.setAttribute("xmlns", i), a.style.position = "absolute", a.style.width = "0", a.style.height = "0", a.style.overflow = "hidden", a.style.display = "none";
248
+ const a = Object.values(r);
249
+ if (a.length) {
250
+ const i = "http://www.w3.org/1999/xhtml", o = document.createElementNS(i, "svg");
251
+ o.setAttribute("xmlns", i), o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.overflow = "hidden", o.style.display = "none";
252
252
  const c = document.createElementNS(i, "defs");
253
- a.appendChild(c);
254
- for (let l = 0; l < o.length; l++)
255
- c.appendChild(o[l]);
256
- t.appendChild(a);
253
+ o.appendChild(c);
254
+ for (let l = 0; l < a.length; l++)
255
+ c.appendChild(a[l]);
256
+ t.appendChild(o);
257
257
  }
258
258
  return t;
259
259
  }
260
260
  async function ot(t, e, n) {
261
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Ke(r, e)).then((r) => Ye(t, r, e)).then((r) => Ze(t, r, e)).then((r) => tn(r, e));
261
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Qe(r, e)).then((r) => tn(t, r, e)).then((r) => an(t, r, e)).then((r) => on(r, e));
262
262
  }
263
- const re = /url\((['"]?)([^'"]+?)\1\)/g, en = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, nn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function rn(t) {
263
+ const oe = /url\((['"]?)([^'"]+?)\1\)/g, sn = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, cn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function ln(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function on(t) {
268
+ function un(t) {
269
269
  const e = [];
270
- return t.replace(re, (n, r, o) => (e.push(o), n)), e.filter((n) => !mt(n));
270
+ return t.replace(oe, (n, r, a) => (e.push(a), n)), e.filter((n) => !gt(n));
271
271
  }
272
- async function an(t, e, n, r, o) {
272
+ async function dn(t, e, n, r, a) {
273
273
  try {
274
- const i = n ? Le(e, n) : e, a = Ct(e);
274
+ const i = n ? ke(e, n) : e, o = Mt(e);
275
275
  let c;
276
- return o || (c = await Mt(i, a, r)), t.replace(rn(e), `$1${c}$3`);
276
+ return a || (c = await Lt(i, o, r)), t.replace(ln(e), `$1${c}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function sn(t, { preferredFontFormat: e }) {
282
- return e ? t.replace(nn, (n) => {
281
+ function fn(t, { preferredFontFormat: e }) {
282
+ return e ? t.replace(cn, (n) => {
283
283
  for (; ; ) {
284
- const [r, , o] = en.exec(n) || [];
285
- if (!o)
284
+ const [r, , a] = sn.exec(n) || [];
285
+ if (!a)
286
286
  return "";
287
- if (o === e)
287
+ if (a === e)
288
288
  return `src: ${r};`;
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function ie(t) {
293
- return t.search(re) !== -1;
292
+ function se(t) {
293
+ return t.search(oe) !== -1;
294
294
  }
295
- async function oe(t, e, n) {
296
- if (!ie(t))
295
+ async function ce(t, e, n) {
296
+ if (!se(t))
297
297
  return t;
298
- const r = sn(t, n);
299
- return on(r).reduce((i, a) => i.then((c) => an(c, a, e, n)), Promise.resolve(r));
298
+ const r = fn(t, n);
299
+ return un(r).reduce((i, o) => i.then((c) => dn(c, o, e, n)), Promise.resolve(r));
300
300
  }
301
- async function z(t, e, n) {
301
+ async function W(t, e, n) {
302
302
  var r;
303
- const o = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
304
- if (o) {
305
- const i = await oe(o, null, n);
303
+ const a = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
304
+ if (a) {
305
+ const i = await ce(a, null, n);
306
306
  return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
307
307
  }
308
308
  return !1;
309
309
  }
310
- async function cn(t, e) {
311
- await z("background", t, e) || await z("background-image", t, e), await z("mask", t, e) || await z("-webkit-mask", t, e) || await z("mask-image", t, e) || await z("-webkit-mask-image", t, e);
310
+ async function hn(t, e) {
311
+ await W("background", t, e) || await W("background-image", t, e), await W("mask", t, e) || await W("-webkit-mask", t, e) || await W("mask-image", t, e) || await W("-webkit-mask-image", t, e);
312
312
  }
313
- async function ln(t, e) {
313
+ async function pn(t, e) {
314
314
  const n = E(t, HTMLImageElement);
315
- if (!(n && !mt(t.src)) && !(E(t, SVGImageElement) && !mt(t.href.baseVal)))
315
+ if (!(n && !gt(t.src)) && !(E(t, SVGImageElement) && !gt(t.href.baseVal)))
316
316
  return;
317
- const r = n ? t.src : t.href.baseVal, o = await Mt(r, Ct(r), e);
318
- await new Promise((i, a) => {
317
+ const r = n ? t.src : t.href.baseVal, a = await Lt(r, Mt(r), e);
318
+ await new Promise((i, o) => {
319
319
  t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
320
320
  try {
321
321
  i(e.onImageErrorHandler(...l));
322
322
  } catch (u) {
323
- a(u);
323
+ o(u);
324
324
  }
325
- } : a;
325
+ } : o;
326
326
  const c = t;
327
- c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = o) : t.href.baseVal = o;
327
+ c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = a) : t.href.baseVal = a;
328
328
  });
329
329
  }
330
- async function un(t, e) {
331
- const r = F(t.childNodes).map((o) => ae(o, e));
330
+ async function mn(t, e) {
331
+ const r = H(t.childNodes).map((a) => le(a, e));
332
332
  await Promise.all(r).then(() => t);
333
333
  }
334
- async function ae(t, e) {
335
- E(t, Element) && (await cn(t, e), await ln(t, e), await un(t, e));
334
+ async function le(t, e) {
335
+ E(t, Element) && (await hn(t, e), await pn(t, e), await mn(t, e));
336
336
  }
337
- function dn(t, e) {
337
+ function yn(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;
341
- return r != null && Object.keys(r).forEach((o) => {
342
- n[o] = r[o];
341
+ return r != null && Object.keys(r).forEach((a) => {
342
+ n[a] = r[a];
343
343
  }), t;
344
344
  }
345
- const Dt = {};
346
- async function Bt(t) {
347
- let e = Dt[t];
345
+ const Nt = {};
346
+ async function jt(t) {
347
+ let e = Nt[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 }, Dt[t] = e, e;
351
+ return e = { url: t, cssText: r }, Nt[t] = e, e;
352
352
  }
353
- async function Ut(t, e) {
353
+ async function _t(t, e) {
354
354
  let n = t.cssText;
355
- const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
356
- let c = a.replace(r, "$1");
357
- return c.startsWith("https://") || (c = new URL(c, t.url).href), ee(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(a, `url(${l})`), [a, l]));
355
+ const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
356
+ let c = o.replace(r, "$1");
357
+ return c.startsWith("https://") || (c = new URL(c, t.url).href), ie(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(o, `url(${l})`), [o, l]));
358
358
  });
359
359
  return Promise.all(i).then(() => n);
360
360
  }
361
- function jt(t) {
361
+ function Vt(t) {
362
362
  if (t == null)
363
363
  return [];
364
364
  const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
365
365
  let r = t.replace(n, "");
366
- const o = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
366
+ const a = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
367
367
  for (; ; ) {
368
- const l = o.exec(r);
368
+ const l = a.exec(r);
369
369
  if (l === null)
370
370
  break;
371
371
  e.push(l[0]);
372
372
  }
373
- r = r.replace(o, "");
374
- const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(a, "gi");
373
+ r = r.replace(a, "");
374
+ const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(o, "gi");
375
375
  for (; ; ) {
376
376
  let l = i.exec(r);
377
377
  if (l === null) {
@@ -384,21 +384,21 @@ function jt(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function fn(t, e) {
387
+ async function gn(t, e) {
388
388
  const n = [], r = [];
389
- return t.forEach((o) => {
390
- if ("cssRules" in o)
389
+ return t.forEach((a) => {
390
+ if ("cssRules" in a)
391
391
  try {
392
- F(o.cssRules || []).forEach((i, a) => {
392
+ H(a.cssRules || []).forEach((i, o) => {
393
393
  if (i.type === CSSRule.IMPORT_RULE) {
394
- let c = a + 1;
395
- const l = i.href, u = Bt(l).then((f) => Ut(f, e)).then((f) => jt(f).forEach((p) => {
394
+ let c = o + 1;
395
+ const l = i.href, u = jt(l).then((f) => _t(f, e)).then((f) => Vt(f).forEach((m) => {
396
396
  try {
397
- o.insertRule(p, p.startsWith("@import") ? c += 1 : o.cssRules.length);
398
- } catch (m) {
397
+ a.insertRule(m, m.startsWith("@import") ? c += 1 : a.cssRules.length);
398
+ } catch (y) {
399
399
  console.error("Error inserting rule from remote css", {
400
- rule: p,
401
- error: m
400
+ rule: m,
401
+ error: y
402
402
  });
403
403
  }
404
404
  })).catch((f) => {
@@ -408,78 +408,78 @@ async function fn(t, e) {
408
408
  }
409
409
  });
410
410
  } catch (i) {
411
- const a = t.find((c) => c.href == null) || document.styleSheets[0];
412
- o.href != null && r.push(Bt(o.href).then((c) => Ut(c, e)).then((c) => jt(c).forEach((l) => {
413
- a.insertRule(l, a.cssRules.length);
411
+ const o = t.find((c) => c.href == null) || document.styleSheets[0];
412
+ a.href != null && r.push(jt(a.href).then((c) => _t(c, e)).then((c) => Vt(c).forEach((l) => {
413
+ o.insertRule(l, o.cssRules.length);
414
414
  })).catch((c) => {
415
415
  console.error("Error loading remote stylesheet", c);
416
416
  })), console.error("Error inlining remote css file", i);
417
417
  }
418
- }), Promise.all(r).then(() => (t.forEach((o) => {
419
- if ("cssRules" in o)
418
+ }), Promise.all(r).then(() => (t.forEach((a) => {
419
+ if ("cssRules" in a)
420
420
  try {
421
- F(o.cssRules || []).forEach((i) => {
421
+ H(a.cssRules || []).forEach((i) => {
422
422
  n.push(i);
423
423
  });
424
424
  } catch (i) {
425
- console.error(`Error while reading CSS rules from ${o.href}`, i);
425
+ console.error(`Error while reading CSS rules from ${a.href}`, i);
426
426
  }
427
427
  }), n));
428
428
  }
429
- function hn(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ie(e.style.getPropertyValue("src")));
429
+ function wn(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => se(e.style.getPropertyValue("src")));
431
431
  }
432
- async function pn(t, e) {
432
+ async function bn(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const n = F(t.ownerDocument.styleSheets), r = await fn(n, e);
436
- return hn(r);
435
+ const n = H(t.ownerDocument.styleSheets), r = await gn(n, e);
436
+ return wn(r);
437
437
  }
438
- function se(t) {
438
+ function ue(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function mn(t) {
441
+ function vn(t) {
442
442
  const e = /* @__PURE__ */ new Set();
443
443
  function n(r) {
444
444
  (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((i) => {
445
- e.add(se(i));
445
+ e.add(ue(i));
446
446
  }), Array.from(r.children).forEach((i) => {
447
447
  i instanceof HTMLElement && n(i);
448
448
  });
449
449
  }
450
450
  return n(t), e;
451
451
  }
452
- async function yn(t, e) {
453
- const n = await pn(t, e), r = mn(t);
454
- return (await Promise.all(n.filter((i) => r.has(se(i.style.fontFamily))).map((i) => {
455
- const a = i.parentStyleSheet ? i.parentStyleSheet.href : null;
456
- return oe(i.cssText, a, e);
452
+ async function Sn(t, e) {
453
+ const n = await bn(t, e), r = vn(t);
454
+ return (await Promise.all(n.filter((i) => r.has(ue(i.style.fontFamily))).map((i) => {
455
+ const o = i.parentStyleSheet ? i.parentStyleSheet.href : null;
456
+ return ce(i.cssText, o, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function gn(t, e) {
461
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await yn(t, e);
460
+ async function xn(t, e) {
461
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Sn(t, e);
462
462
  if (n) {
463
- const r = document.createElement("style"), o = document.createTextNode(n);
464
- r.appendChild(o), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
463
+ const r = document.createElement("style"), a = document.createTextNode(n);
464
+ r.appendChild(a), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
465
465
  }
466
466
  }
467
- async function wn(t, e = {}) {
468
- const { width: n, height: r } = te(t, e), o = await ot(t, e, !0);
469
- return await gn(o, e), await ae(o, e), dn(o, e), await Oe(o, n, r);
467
+ async function En(t, e = {}) {
468
+ const { width: n, height: r } = re(t, e), a = await ot(t, e, !0);
469
+ return await xn(a, e), await le(a, e), yn(a, e), await Ue(a, n, r);
470
470
  }
471
- async function bn(t, e = {}) {
472
- const { width: n, height: r } = te(t, e), o = await wn(t, e), i = await tt(o), a = document.createElement("canvas"), c = a.getContext("2d"), l = e.pixelRatio || ke(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
- return a.width = u * l, a.height = f * l, e.skipAutoScale || Te(a), a.style.width = `${u}`, a.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, a.width, a.height)), c.drawImage(i, 0, 0, a.width, a.height), a;
471
+ async function Cn(t, e = {}) {
472
+ const { width: n, height: r } = re(t, e), a = await En(t, e), i = await tt(a), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || He(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
+ return o.width = u * l, o.height = f * l, e.skipAutoScale || De(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(i, 0, 0, o.width, o.height), o;
474
474
  }
475
- async function Nt(t, e = {}) {
476
- return (await bn(t, e)).toDataURL();
475
+ async function Wt(t, e = {}) {
476
+ return (await Cn(t, e)).toDataURL();
477
477
  }
478
- const et = "data-nf-capture-chrome", Sn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
- function vn(t) {
478
+ const et = "data-nf-capture-chrome", An = "data-nf-canvas-snap", Mn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
+ function de(t) {
480
480
  return t instanceof Element && (t.hasAttribute(et) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
481
481
  }
482
- function xn() {
482
+ function Ln() {
483
483
  const t = [];
484
484
  return Array.from(document.styleSheets).forEach((e) => {
485
485
  try {
@@ -503,11 +503,11 @@ function xn() {
503
503
  });
504
504
  };
505
505
  }
506
- function En() {
506
+ function Rn() {
507
507
  const t = [];
508
508
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
509
- const r = n.getBoundingClientRect(), o = document.createElement("div");
510
- o.setAttribute("data-nf-mask-cover", "1"), o.style.cssText = [
509
+ const r = n.getBoundingClientRect(), a = document.createElement("div");
510
+ a.setAttribute("data-nf-mask-cover", "1"), a.style.cssText = [
511
511
  "position:fixed",
512
512
  `left:${r.left}px`,
513
513
  `top:${r.top}px`,
@@ -516,59 +516,148 @@ function En() {
516
516
  "background:#111",
517
517
  "z-index:2147483646",
518
518
  "pointer-events:none"
519
- ].join(";"), document.body.appendChild(o), t.push(o);
519
+ ].join(";"), document.body.appendChild(a), t.push(a);
520
520
  }), () => t.forEach((n) => n.remove());
521
521
  }
522
- function Cn() {
522
+ function $n() {
523
523
  const t = document.querySelector(`[${et}]`);
524
524
  if (t)
525
525
  return t;
526
526
  const e = document.createElement("div");
527
527
  return e.setAttribute(et, "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 Mn() {
529
+ function Tn() {
530
530
  document.querySelectorAll(`[${et}]`).forEach((t) => t.remove());
531
531
  }
532
- async function An() {
533
- const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = Cn(), r = xn();
534
- t && (t.style.display = "none");
535
- const o = En();
536
- await new Promise((a) => requestAnimationFrame(() => requestAnimationFrame(a)));
537
- const i = {
538
- cacheBust: !0,
539
- pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
540
- filter: (a) => !vn(a),
541
- // 404 / CORS images must not abort the whole capture.
542
- imagePlaceholder: Sn,
543
- onImageErrorHandler: () => {
532
+ function wt() {
533
+ return new Promise((t) => {
534
+ requestAnimationFrame(() => requestAnimationFrame(t));
535
+ });
536
+ }
537
+ async function Pn() {
538
+ const t = [], e = Array.from(document.querySelectorAll("canvas"));
539
+ for (const n of e) {
540
+ if (n.closest("#notefully") || de(n))
541
+ continue;
542
+ let r = "";
543
+ try {
544
+ r = n.toDataURL("image/png");
545
+ } catch {
546
+ continue;
544
547
  }
548
+ if (!r || r === "data:,")
549
+ continue;
550
+ const a = document.createElement("img"), i = getComputedStyle(n);
551
+ a.setAttribute(An, "1"), a.alt = "", a.src = r, a.className = n.className, a.style.cssText = n.style.cssText, a.style.width = i.width, a.style.height = i.height, a.style.maxWidth = i.maxWidth, a.style.maxHeight = i.maxHeight, a.style.objectFit = "fill", a.style.display = i.display === "inline" ? "inline-block" : i.display, n.replaceWith(a), t.push({ canvas: n, img: a });
552
+ }
553
+ return await Promise.all(t.map(({ img: n }) => {
554
+ if (!n.complete)
555
+ return new Promise((r) => {
556
+ n.onload = () => r(), n.onerror = () => r();
557
+ });
558
+ })), () => {
559
+ t.forEach(({ canvas: n, img: r }) => {
560
+ try {
561
+ r.parentNode && r.replaceWith(n);
562
+ } catch {
563
+ }
564
+ });
545
565
  };
566
+ }
567
+ async function kn(t) {
568
+ if (!t)
569
+ return null;
570
+ if (typeof t == "string")
571
+ return t.startsWith("data:") ? t : null;
572
+ if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
573
+ try {
574
+ return t.toDataURL("image/png");
575
+ } catch {
576
+ return null;
577
+ }
578
+ return typeof Blob < "u" && t instanceof Blob ? In(t) : null;
579
+ }
580
+ async function In(t) {
581
+ if (typeof FileReader == "function")
582
+ return new Promise((r, a) => {
583
+ const i = new FileReader();
584
+ i.onload = () => r(String(i.result || "")), i.onerror = () => a(i.error || new Error("Could not read capture blob")), i.readAsDataURL(t);
585
+ });
586
+ const e = Buffer.from(await t.arrayBuffer());
587
+ return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
588
+ }
589
+ async function On() {
590
+ var e;
591
+ if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
592
+ throw new Error("Screen capture is not supported in this browser.");
593
+ const t = await navigator.mediaDevices.getDisplayMedia({
594
+ video: { displaySurface: "browser" },
595
+ audio: !1,
596
+ preferCurrentTab: !0,
597
+ selfBrowserSurface: "include"
598
+ });
599
+ try {
600
+ const n = document.createElement("video");
601
+ n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((o) => {
602
+ n.onloadedmetadata = () => o();
603
+ }), await wt();
604
+ const r = n.videoWidth || 1, a = n.videoHeight || 1, i = document.createElement("canvas");
605
+ return i.width = r, i.height = a, i.getContext("2d").drawImage(n, 0, 0, r, a), i.toDataURL("image/png");
606
+ } finally {
607
+ t.getTracks().forEach((n) => n.stop());
608
+ }
609
+ }
610
+ async function fe(t = {}) {
611
+ const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = $n(), a = Ln();
612
+ let i = () => {
613
+ };
614
+ e && (e.style.display = "none");
615
+ const o = Rn();
546
616
  try {
617
+ if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await wt(), typeof t.capture == "function") {
618
+ const l = await kn(await t.capture());
619
+ if (l)
620
+ return l;
621
+ }
622
+ i = await Pn(), await wt();
623
+ const c = {
624
+ cacheBust: !0,
625
+ pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
626
+ filter: (l) => !de(l),
627
+ // 404 / CORS images must not abort the whole capture.
628
+ imagePlaceholder: Mn,
629
+ onImageErrorHandler: () => {
630
+ }
631
+ };
547
632
  try {
548
- return await Nt(document.body, i);
633
+ return await Wt(document.body, c);
549
634
  } catch {
550
- return await Nt(document.body, { ...i, skipFonts: !0 });
635
+ return await Wt(document.body, { ...c, skipFonts: !0 });
551
636
  }
552
637
  } finally {
553
- o(), r(), n.remove(), Mn(), t && (t.style.display = e);
638
+ try {
639
+ i();
640
+ } catch {
641
+ }
642
+ o(), a(), r.remove(), Tn(), e && (e.style.display = n);
554
643
  }
555
644
  }
556
- function Ln(t = "") {
645
+ function Bn(t = "") {
557
646
  const e = String(t || "");
558
647
  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" : "";
559
648
  }
560
- function Rn(t = "") {
649
+ function Hn(t = "") {
561
650
  const e = String(t || "");
562
651
  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" : "";
563
652
  }
564
- function $n(t = {}) {
653
+ function Dn(t = {}) {
565
654
  const e = navigator.userAgent;
566
655
  return {
567
656
  url: location.href,
568
657
  title: document.title,
569
658
  userAgent: e,
570
- os: Ln(e),
571
- browser: Rn(e),
659
+ os: Bn(e),
660
+ browser: Hn(e),
572
661
  language: navigator.language,
573
662
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
574
663
  viewport: {
@@ -583,11 +672,11 @@ function $n(t = {}) {
583
672
  }
584
673
  };
585
674
  }
586
- const _t = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Vt = {
675
+ const zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), qt = {
587
676
  id: "userId",
588
677
  username: "displayName",
589
678
  name: "displayName"
590
- }, zt = /* @__PURE__ */ new Set([
679
+ }, Kt = /* @__PURE__ */ new Set([
591
680
  "endpoint",
592
681
  "projectKey",
593
682
  "version",
@@ -597,8 +686,10 @@ const _t = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Vt = {
597
686
  "theme",
598
687
  "video",
599
688
  "consoleLogLimit",
600
- "kinds"
601
- ]), qt = {
689
+ "kinds",
690
+ "capture",
691
+ "onBeforeCapture"
692
+ ]), Xt = {
602
693
  slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
603
694
  projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
604
695
  project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
@@ -607,60 +698,60 @@ const _t = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Vt = {
607
698
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
608
699
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
609
700
  };
610
- function Pn(t = {}, e = {}) {
611
- const n = e.warn || ce, r = t && typeof t == "object" ? t : {}, o = {}, i = [];
612
- for (const a of _t)
613
- Object.prototype.hasOwnProperty.call(r, a) && (o[a] = r[a]);
614
- for (const [a, c] of Object.entries(Vt))
615
- Object.prototype.hasOwnProperty.call(r, a) && (Object.prototype.hasOwnProperty.call(o, c) || (o[c] = r[a]));
616
- for (const a of Object.keys(r))
617
- _t.has(a) || Object.prototype.hasOwnProperty.call(Vt, a) || i.push(a);
701
+ function Fn(t = {}, e = {}) {
702
+ const n = e.warn || he, r = t && typeof t == "object" ? t : {}, a = {}, i = [];
703
+ for (const o of zt)
704
+ Object.prototype.hasOwnProperty.call(r, o) && (a[o] = r[o]);
705
+ for (const [o, c] of Object.entries(qt))
706
+ Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(a, c) || (a[c] = r[o]));
707
+ for (const o of Object.keys(r))
708
+ zt.has(o) || Object.prototype.hasOwnProperty.call(qt, o) || i.push(o);
618
709
  if (i.length) {
619
- const a = i.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
710
+ const o = i.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
620
711
  n(
621
- `Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + a
712
+ `Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + o
622
713
  );
623
714
  }
624
- return o;
625
- }
626
- function kn(t = {}, e = {}) {
627
- const n = e.warn || ce, r = t && typeof t == "object" ? t : {}, o = Object.keys(r).filter((i) => !zt.has(i));
628
- if (o.length)
629
- for (const i of o) {
630
- if (qt[i]) {
631
- n(`Notefully.init: ignoring "${i}". ${qt[i]}`);
715
+ return a;
716
+ }
717
+ function Un(t = {}, e = {}) {
718
+ const n = e.warn || he, r = t && typeof t == "object" ? t : {}, a = Object.keys(r).filter((i) => !Kt.has(i));
719
+ if (a.length)
720
+ for (const i of a) {
721
+ if (Xt[i]) {
722
+ n(`Notefully.init: ignoring "${i}". ${Xt[i]}`);
632
723
  continue;
633
724
  }
634
725
  n(
635
- `Notefully.init: ignoring unknown key "${i}". Supported: ${[...zt].join(", ")}.`
726
+ `Notefully.init: ignoring unknown key "${i}". Supported: ${[...Kt].join(", ")}.`
636
727
  );
637
728
  }
638
729
  }
639
- function ce(t) {
730
+ function he(t) {
640
731
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
641
732
  }
642
- const Tn = 80;
643
- function In() {
733
+ const Nn = 80;
734
+ function jn() {
644
735
  const t = [], e = {};
645
736
  let n = !1;
646
- const r = (i, a) => {
737
+ const r = (i, o) => {
647
738
  let c = "";
648
739
  try {
649
- c = a.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
740
+ c = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
650
741
  } catch {
651
- c = String(a[0]);
742
+ c = String(o[0]);
652
743
  }
653
744
  t.push({
654
745
  level: i,
655
746
  text: c.slice(0, 2e3),
656
747
  at: Date.now()
657
- }), t.length > Tn && t.shift();
748
+ }), t.length > Nn && t.shift();
658
749
  };
659
750
  return {
660
751
  hook: () => {
661
752
  n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((i) => {
662
- e[i] = console[i].bind(console), console[i] = (...a) => {
663
- r(i, a), e[i](...a);
753
+ e[i] = console[i].bind(console), console[i] = (...o) => {
754
+ r(i, o), e[i](...o);
664
755
  };
665
756
  }), window.addEventListener("error", (i) => {
666
757
  r("error", [i.message || "window.error"]);
@@ -673,10 +764,10 @@ function In() {
673
764
  }
674
765
  };
675
766
  }
676
- function On(t) {
767
+ function _n(t) {
677
768
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
678
769
  let n = null, r = !1;
679
- const o = () => {
770
+ const a = () => {
680
771
  if (r = !1, n)
681
772
  try {
682
773
  n.stop();
@@ -687,10 +778,10 @@ function On(t) {
687
778
  start: () => {
688
779
  if (!e)
689
780
  throw new Error("Speech recognition is not supported in this browser.");
690
- return r ? (o(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (a) => {
781
+ return r ? (a(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (o) => {
691
782
  let c = "";
692
- for (let l = a.resultIndex; l < a.results.length; l += 1)
693
- a.results[l].isFinal && (c += a.results[l][0].transcript);
783
+ for (let l = o.resultIndex; l < o.results.length; l += 1)
784
+ o.results[l].isFinal && (c += o.results[l][0].transcript);
694
785
  c && t(c);
695
786
  }, n.onerror = () => {
696
787
  r = !1;
@@ -698,30 +789,30 @@ function On(t) {
698
789
  r = !1;
699
790
  }, n.start(), r = !0, !0);
700
791
  },
701
- stop: o,
792
+ stop: a,
702
793
  isSupported: () => !!e,
703
794
  isActive: () => r
704
795
  };
705
796
  }
706
- const Hn = 60 * 1e3;
707
- function Fn({ onStart: t, onStop: e, onError: n }) {
708
- let r = null, o = null, i = [], a = null;
797
+ const Vn = 60 * 1e3;
798
+ function Wn({ onStart: t, onStop: e, onError: n }) {
799
+ let r = null, a = null, i = [], o = null;
709
800
  const c = () => {
710
- if (a && (clearTimeout(a), a = null), o && o.state !== "inactive")
801
+ if (o && (clearTimeout(o), o = null), a && a.state !== "inactive")
711
802
  try {
712
- o.stop();
803
+ a.stop();
713
804
  } catch {
714
805
  }
715
806
  r && (r.getTracks().forEach((f) => f.stop()), r = null);
716
807
  }, l = () => {
717
- if (o && o.state === "recording") {
718
- o.stop();
808
+ if (a && a.state === "recording") {
809
+ a.stop();
719
810
  return;
720
811
  }
721
812
  c(), e(null);
722
813
  };
723
814
  return { start: async () => {
724
- var f, p;
815
+ var f, m;
725
816
  if (!((f = navigator.mediaDevices) != null && f.getDisplayMedia))
726
817
  throw new Error("Screen recording is not supported in this browser.");
727
818
  r = await navigator.mediaDevices.getDisplayMedia({
@@ -729,17 +820,17 @@ function Fn({ onStart: t, onStop: e, onError: n }) {
729
820
  audio: !1,
730
821
  preferCurrentTab: !0,
731
822
  selfBrowserSurface: "include"
732
- }), i = [], o = new MediaRecorder(r, {
823
+ }), i = [], a = new MediaRecorder(r, {
733
824
  mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
734
- }), o.ondataavailable = (m) => {
735
- m.data && m.data.size && i.push(m.data);
736
- }, o.onstop = () => {
737
- const m = i.length ? new Blob(i, { type: o.mimeType || "video/webm" }) : null;
738
- c(), e(m);
739
- }, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, Hn);
825
+ }), a.ondataavailable = (y) => {
826
+ y.data && y.data.size && i.push(y.data);
827
+ }, a.onstop = () => {
828
+ const y = i.length ? new Blob(i, { type: a.mimeType || "video/webm" }) : null;
829
+ c(), e(y);
830
+ }, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), a.start(), o = setTimeout(l, Vn);
740
831
  }, stop: l };
741
832
  }
742
- function Dn() {
833
+ function zn() {
743
834
  const t = /* @__PURE__ */ new Set();
744
835
  return {
745
836
  alloc() {
@@ -757,24 +848,24 @@ function Dn() {
757
848
  }
758
849
  };
759
850
  }
760
- const dt = { x: 0, y: 0, w: 1, h: 1 };
761
- function le() {
762
- const t = Dn();
763
- let e = [], n = { ...dt }, r = 1;
851
+ const ft = { x: 0, y: 0, w: 1, h: 1 };
852
+ function Rt() {
853
+ const t = zn();
854
+ let e = [], n = { ...ft }, r = 1;
764
855
  return {
765
- list: () => e.filter((i) => Un(i, n)),
856
+ list: () => e.filter((i) => Kn(i, n)),
766
857
  all: () => e.slice(),
767
858
  crop: () => ({ ...n }),
768
859
  setCrop(i) {
769
- return n = Bn(i), n;
860
+ return n = qn(i), n;
770
861
  },
771
862
  resetCrop() {
772
- return n = { ...dt }, n;
863
+ return n = { ...ft }, n;
773
864
  },
774
865
  isCropped() {
775
866
  return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
776
867
  },
777
- add(i, a) {
868
+ add(i, o) {
778
869
  const c = {
779
870
  id: `s${r++}`,
780
871
  type: i,
@@ -785,36 +876,36 @@ function le() {
785
876
  h: i === "arrow" ? 0.05 : 0.16,
786
877
  x2: 0.4,
787
878
  y2: 0.28,
788
- ...a
879
+ ...o
789
880
  };
790
881
  return e.push(c), c;
791
882
  },
792
- update(i, a) {
883
+ update(i, o) {
793
884
  const c = e.find((l) => l.id === i);
794
- return c ? (Object.assign(c, a), c) : null;
885
+ return c ? (Object.assign(c, o), c) : null;
795
886
  },
796
887
  remove(i) {
797
- const a = e.findIndex((l) => l.id === i);
798
- if (a < 0)
888
+ const o = e.findIndex((l) => l.id === i);
889
+ if (o < 0)
799
890
  return null;
800
- const [c] = e.splice(a, 1);
891
+ const [c] = e.splice(o, 1);
801
892
  return t.free(c.number), c;
802
893
  },
803
894
  reset() {
804
- for (e = [], n = { ...dt }, r = 1; t.peekUsed().length; )
895
+ for (e = [], n = { ...ft }, r = 1; t.peekUsed().length; )
805
896
  t.free(t.peekUsed()[0]);
806
897
  }
807
898
  };
808
899
  }
809
- function Bn(t) {
810
- 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), o = Math.min(Math.max(t.h, 0.05), 1 - n);
811
- return { x: e, y: n, w: r, h: o };
900
+ function qn(t) {
901
+ 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), a = Math.min(Math.max(t.h, 0.05), 1 - n);
902
+ return { x: e, y: n, w: r, h: a };
812
903
  }
813
- function Un(t, e) {
904
+ function Kn(t, e) {
814
905
  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;
815
906
  return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
816
907
  }
817
- function At(t) {
908
+ function $t(t) {
818
909
  const e = Math.max(1, Number(t) || 1);
819
910
  return {
820
911
  stroke: Math.max(2, e * 75e-4),
@@ -824,147 +915,148 @@ function At(t) {
824
915
  arrowHeadAngle: 0.4
825
916
  };
826
917
  }
827
- function jn(t, {
918
+ function Xn(t, {
828
919
  stickers: e = [],
829
920
  crop: n = { x: 0, y: 0, w: 1, h: 1 },
830
921
  width: r,
831
- height: o,
922
+ height: a,
832
923
  colors: i = {}
833
924
  }) {
834
- const a = i.mark || "#fdd341", c = i.markText || "#2a2140", l = At(r);
835
- t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = a, t.fillStyle = a, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
836
- const f = yt(u.x, n, r), p = gt(u.y, n, o), m = u.w / n.w * r, x = u.h / n.h * o, A = l.stroke / 2;
925
+ const o = i.mark || "#fdd341", c = i.markText || "#2a2140", l = $t(r);
926
+ 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) => {
927
+ const f = bt(u.x, n, r), m = vt(u.y, n, a), y = u.w / n.w * r, x = u.h / n.h * a, L = l.stroke / 2;
837
928
  if (u.type === "rect")
838
929
  t.strokeRect(
839
- f + A,
840
- p + A,
841
- Math.max(0, m - l.stroke),
930
+ f + L,
931
+ m + L,
932
+ Math.max(0, y - l.stroke),
842
933
  Math.max(0, x - l.stroke)
843
934
  );
844
935
  else if (u.type === "circle")
845
936
  t.beginPath(), t.ellipse(
846
- f + m / 2,
847
- p + x / 2,
848
- Math.max(0.5, m / 2 - A),
849
- Math.max(0.5, x / 2 - A),
937
+ f + y / 2,
938
+ m + x / 2,
939
+ Math.max(0.5, y / 2 - L),
940
+ Math.max(0.5, x / 2 - L),
850
941
  0,
851
942
  0,
852
943
  Math.PI * 2
853
944
  ), t.stroke();
854
945
  else if (u.type === "arrow") {
855
- const j = yt(u.x2 ?? u.x + u.w, n, r), N = gt(u.y2 ?? u.y, n, o);
856
- _n(t, f, p, j, N, l);
946
+ const N = bt(u.x2 ?? u.x + u.w, n, r), j = vt(u.y2 ?? u.y, n, a);
947
+ Gn(t, f, m, N, j, l);
857
948
  }
858
949
  if (u.number == null || u.number === "")
859
950
  return;
860
- const k = Nn(u, n, r, o, f, p, m), q = String(u.number);
861
- t.beginPath(), t.arc(k.x, k.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(q, k.x, k.y + 0.5), t.fillStyle = a;
951
+ const I = Yn(u, n, r, a, f, m, y), K = String(u.number);
952
+ t.beginPath(), t.arc(I.x, I.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(K, I.x, I.y + 0.5), t.fillStyle = o;
862
953
  }), t.restore();
863
954
  }
864
- function yt(t, e, n) {
955
+ function bt(t, e, n) {
865
956
  return (t - e.x) / e.w * n;
866
957
  }
867
- function gt(t, e, n) {
958
+ function vt(t, e, n) {
868
959
  return (t - e.y) / e.h * n;
869
960
  }
870
- function Nn(t, e, n, r, o, i, a) {
961
+ function Yn(t, e, n, r, a, i, o) {
871
962
  if (t.type === "arrow") {
872
- const c = yt(t.x2 ?? t.x + t.w, e, n), l = gt(t.y2 ?? t.y, e, r);
963
+ const c = bt(t.x2 ?? t.x + t.w, e, n), l = vt(t.y2 ?? t.y, e, r);
873
964
  return {
874
- x: (o + c) / 2,
965
+ x: (a + c) / 2,
875
966
  y: (i + l) / 2
876
967
  };
877
968
  }
878
- return { x: o + a / 2, y: i };
969
+ return { x: a + o / 2, y: i };
879
970
  }
880
- function ue(t, e, n, r, o) {
881
- const i = Math.atan2(r - e, n - t), a = o.arrowHead, c = Math.min(o.stroke, a * 0.2), l = n, u = r, f = n - Math.cos(i) * a, p = r - Math.sin(i) * a, m = {
882
- x: l - a * Math.cos(i - o.arrowHeadAngle),
883
- y: u - a * Math.sin(i - o.arrowHeadAngle)
971
+ function pe(t, e, n, r, a) {
972
+ const i = Math.atan2(r - e, n - t), o = a.arrowHead, c = Math.min(a.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(i) * o, m = r - Math.sin(i) * o, y = {
973
+ x: l - o * Math.cos(i - a.arrowHeadAngle),
974
+ y: u - o * Math.sin(i - a.arrowHeadAngle)
884
975
  }, x = {
885
- x: l - a * Math.cos(i + o.arrowHeadAngle),
886
- y: u - a * Math.sin(i + o.arrowHeadAngle)
887
- }, A = {
976
+ x: l - o * Math.cos(i + a.arrowHeadAngle),
977
+ y: u - o * Math.sin(i + a.arrowHeadAngle)
978
+ }, L = {
888
979
  x: n - Math.cos(i) * c,
889
980
  y: r - Math.sin(i) * c
890
981
  };
891
- return { angle: i, tipX: l, tipY: u, baseX: f, baseY: p, left: m, right: x, shaftEnd: A };
892
- }
893
- function _n(t, e, n, r, o, i) {
894
- const a = ue(e, n, r, o, i);
895
- t.beginPath(), t.moveTo(e, n), t.lineTo(a.shaftEnd.x, a.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(a.tipX, a.tipY), t.lineTo(a.left.x, a.left.y), t.lineTo(a.right.x, a.right.y), t.closePath(), t.fill();
896
- }
897
- function Vn(t, e, n, r = {}) {
898
- return new Promise((o, i) => {
899
- const a = new Image();
900
- a.onload = () => {
901
- const c = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), f = Math.max(1, Math.round(e.h * a.height)), p = document.createElement("canvas");
902
- p.width = u, p.height = f;
903
- const m = p.getContext("2d");
904
- m.drawImage(a, c, l, u, f, 0, 0, u, f), jn(m, {
982
+ return { angle: i, tipX: l, tipY: u, baseX: f, baseY: m, left: y, right: x, shaftEnd: L };
983
+ }
984
+ function Gn(t, e, n, r, a, i) {
985
+ const o = pe(e, n, r, a, i);
986
+ 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();
987
+ }
988
+ function Jn(t, e, n, r = {}) {
989
+ return new Promise((a, i) => {
990
+ const o = new Image();
991
+ o.onload = () => {
992
+ 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");
993
+ m.width = u, m.height = f;
994
+ const y = m.getContext("2d");
995
+ y.drawImage(o, c, l, u, f, 0, 0, u, f), Xn(y, {
905
996
  stickers: n,
906
997
  crop: e,
907
998
  width: u,
908
999
  height: f,
909
1000
  colors: r
910
- }), p.toBlob((x) => {
1001
+ }), m.toBlob((x) => {
911
1002
  if (!x) {
912
1003
  i(new Error("Could not encode screenshot"));
913
1004
  return;
914
1005
  }
915
- o(x);
1006
+ a(x);
916
1007
  }, "image/png");
917
- }, a.onerror = () => i(new Error("Could not load screenshot")), a.src = t;
1008
+ }, o.onerror = () => i(new Error("Could not load screenshot")), o.src = t;
918
1009
  });
919
1010
  }
920
- const B = [
1011
+ const F = [
921
1012
  { id: "bug", label: "Bug" },
922
1013
  { id: "idea", label: "Idea" },
923
1014
  { id: "other", label: "Other" }
924
1015
  ];
925
- function Wt(t) {
1016
+ function Yt(t) {
926
1017
  return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
927
1018
  }
928
- function ft(t) {
1019
+ function ht(t) {
929
1020
  const e = String(t || "").trim();
930
1021
  return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
931
1022
  }
932
- function zn(t) {
1023
+ function Qn(t) {
933
1024
  if (!Array.isArray(t) || !t.length)
934
- return B.map((r) => ({ ...r }));
1025
+ return F.map((r) => ({ ...r }));
935
1026
  const e = /* @__PURE__ */ new Set(), n = [];
936
1027
  for (const r of t) {
937
- let o = "", i = "";
938
- typeof r == "string" || typeof r == "number" ? (o = Wt(r), i = ft(o)) : r && typeof r == "object" && (o = Wt(r.id ?? r.value ?? r.kind), i = String(r.label || r.name || ft(o)).trim() || ft(o)), !(!o || e.has(o)) && (e.add(o), n.push({ id: o, label: i }));
1028
+ let a = "", i = "";
1029
+ typeof r == "string" || typeof r == "number" ? (a = Yt(r), i = ht(a)) : r && typeof r == "object" && (a = Yt(r.id ?? r.value ?? r.kind), i = String(r.label || r.name || ht(a)).trim() || ht(a)), !(!a || e.has(a)) && (e.add(a), n.push({ id: a, label: i }));
939
1030
  }
940
- return n.length ? n : B.map((r) => ({ ...r }));
1031
+ return n.length ? n : F.map((r) => ({ ...r }));
941
1032
  }
942
- function at(t) {
1033
+ function st(t) {
943
1034
  var n;
944
- const e = Array.isArray(t) && t.length ? t : B;
1035
+ const e = Array.isArray(t) && t.length ? t : F;
945
1036
  return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
946
1037
  }
947
- const qn = ["maker", "all-business", "brighter-day", "quiet-night"], de = "maker", Wn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), wt = 0.02, Kt = 0.05, Kn = `
1038
+ const Zn = ["maker", "all-business", "brighter-day", "quiet-night"], me = "maker", tr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), St = 0.02, Gt = 0.05, er = `
948
1039
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
949
1040
  <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"/>
950
1041
  <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"/>
951
1042
  </svg>
952
1043
  `;
953
- function I(t) {
1044
+ function T(t) {
954
1045
  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>`;
955
1046
  }
956
- const $ = {
957
- crop: I('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
958
- resetCrop: I('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
959
- arrow: I('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
960
- rect: I('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
961
- circle: I('<circle cx="12" cy="12" r="8"/>'),
962
- discard: I('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
963
- 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"/>'),
964
- video: I('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
965
- }, fe = In();
966
- fe.hook();
967
- const he = 10, Xn = 80, pe = "notefully.author", bt = "Anonymous";
1047
+ const R = {
1048
+ crop: T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
1049
+ resetCrop: T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
1050
+ arrow: T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
1051
+ rect: T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
1052
+ circle: T('<circle cx="12" cy="12" r="8"/>'),
1053
+ discard: T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
1054
+ recapture: T('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
1055
+ audio: T('<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"/>'),
1056
+ video: T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
1057
+ }, ye = jn();
1058
+ ye.hook();
1059
+ const ge = 10, nr = 80, we = "notefully.author", xt = "Anonymous";
968
1060
  let d = {
969
1061
  endpoint: "",
970
1062
  projectKey: "",
@@ -972,22 +1064,24 @@ let d = {
972
1064
  name: "",
973
1065
  targets: null,
974
1066
  hideLauncher: !1,
975
- theme: de,
1067
+ theme: me,
976
1068
  video: !1,
977
- consoleLogLimit: he,
978
- kinds: B.map((t) => ({ ...t }))
979
- }, R = {}, h = null, s = {}, y = le(), S = "", K = "", P = null, U = at(B), H = null, L = null, b = null, w = null, Q = null, D = null, W = null, O = { w: 0, h: 0 }, ht = !1, Lt = !1;
1069
+ consoleLogLimit: ge,
1070
+ kinds: F.map((t) => ({ ...t })),
1071
+ capture: null,
1072
+ onBeforeCapture: null
1073
+ }, pt = !1, $ = {}, h = null, s = {}, p = Rt(), S = "", z = "", k = null, U = st(F), B = null, M = null, b = null, w = null, Q = null, D = null, X = null, P = { w: 0, h: 0 }, mt = !1, Tt = !1;
980
1074
  function g(t) {
981
1075
  return h.querySelector(t);
982
1076
  }
983
- function me(t) {
1077
+ function be(t) {
984
1078
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
985
- return qn.includes(e) ? e : de;
1079
+ return Zn.includes(e) ? e : me;
986
1080
  }
987
- function Xt(t, e) {
1081
+ function Jt(t, e) {
988
1082
  return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
989
1083
  }
990
- async function Yn(t) {
1084
+ async function rr(t) {
991
1085
  return (await fetch(t)).blob();
992
1086
  }
993
1087
  function v(t, e = !1) {
@@ -995,20 +1089,21 @@ function v(t, e = !1) {
995
1089
  s.status.textContent = "";
996
1090
  }, 4e3)));
997
1091
  }
998
- function Rt() {
1092
+ function Pt() {
999
1093
  return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
1000
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Kn}</button>
1094
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${er}</button>
1001
1095
  <div class="nf-dialog" hidden>
1002
1096
  <div class="nf-panel">
1003
1097
  <div class="nf-panel-body">
1004
1098
  <div class="nf-stage">
1005
1099
  <div class="nf-palette">
1006
- <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${$.crop}</button>
1007
- <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${$.resetCrop}</button>
1008
- <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${$.arrow}</button>
1009
- <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${$.rect}</button>
1010
- <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${$.circle}</button>
1011
- <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${$.discard}</button>
1100
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${R.crop}</button>
1101
+ <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${R.resetCrop}</button>
1102
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${R.arrow}</button>
1103
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${R.rect}</button>
1104
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${R.circle}</button>
1105
+ <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${R.discard}</button>
1106
+ <button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${R.recapture}</button>
1012
1107
  </div>
1013
1108
  <div class="nf-canvas"></div>
1014
1109
  </div>
@@ -1016,9 +1111,9 @@ function Rt() {
1016
1111
  <input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
1017
1112
  <div class="nf-kind"></div>
1018
1113
  <div class="nf-actions">
1019
- <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${$.resetCrop}</button>
1020
- <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${$.audio}</button>
1021
- <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${$.video}</button>
1114
+ <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${R.resetCrop}</button>
1115
+ <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${R.audio}</button>
1116
+ <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${R.video}</button>
1022
1117
  <button class="nf-submit" type="button">Submit</button>
1023
1118
  </div>
1024
1119
  <div class="nf-status"></div>
@@ -1042,146 +1137,149 @@ function Rt() {
1042
1137
  audio: g(".nf-audio"),
1043
1138
  video: g(".nf-video"),
1044
1139
  discard: g(".nf-discard-shot"),
1140
+ recapture: g(".nf-recapture"),
1045
1141
  stop: g(".nf-stop-video"),
1046
1142
  resetCrop: g(".nf-reset-crop"),
1047
1143
  submit: g(".nf-submit"),
1048
1144
  shot: null
1049
- }, Gn(), X()), h;
1145
+ }, ir(), Y()), h;
1050
1146
  }
1051
- function X() {
1147
+ function Y() {
1052
1148
  var t;
1053
- h && (h.dataset.theme = me(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), ye(), (t = s.dialog) != null && t.hidden && nt());
1149
+ h && (h.dataset.theme = be(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), ve(), (t = s.dialog) != null && t.hidden && nt());
1054
1150
  }
1055
1151
  function nt() {
1056
1152
  s.launcher && (s.launcher.hidden = !!d.hideLauncher);
1057
1153
  }
1058
- function Gn() {
1059
- s.launcher.addEventListener("click", () => Ce()), g(".nf-dialog").addEventListener("click", (e) => {
1060
- Lt || e.target === s.dialog && J();
1154
+ function ir() {
1155
+ s.launcher.addEventListener("click", () => $e()), g(".nf-dialog").addEventListener("click", (e) => {
1156
+ Tt || e.target === s.dialog && J();
1061
1157
  }), h.querySelectorAll(".nf-tool").forEach((e) => {
1062
- e.addEventListener("click", () => St(e.dataset.tool));
1063
- }), s.resetCrop.addEventListener("click", rr), s.canvas.addEventListener("pointerdown", Qn), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1158
+ e.addEventListener("click", () => rt(e.dataset.tool));
1159
+ }), s.resetCrop.addEventListener("click", dr), s.canvas.addEventListener("pointerdown", or), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1064
1160
  const t = g(".nf-kind");
1065
1161
  t && t.addEventListener("click", (e) => {
1066
1162
  const n = e.target.closest("[data-kind]");
1067
- n && $t(n.dataset.kind);
1068
- }), s.discard.addEventListener("click", ir), s.restore.addEventListener("click", or), s.audio.addEventListener("click", ar), s.video.addEventListener("click", sr), s.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), g(".nf-submit").addEventListener("click", () => {
1069
- Ae().catch((e) => v(e.message || "Submit failed."));
1070
- }), ye(), St(null);
1163
+ n && kt(n.dataset.kind);
1164
+ }), s.discard.addEventListener("click", fr), s.recapture.addEventListener("click", () => {
1165
+ pr().catch((e) => v(e.message || "Recapture failed."));
1166
+ }), s.restore.addEventListener("click", hr), s.audio.addEventListener("click", mr), s.video.addEventListener("click", yr), s.stop.addEventListener("click", () => X == null ? void 0 : X.stop()), g(".nf-submit").addEventListener("click", () => {
1167
+ Pe().catch((e) => v(e.message || "Submit failed."));
1168
+ }), ve(), rt(null);
1071
1169
  }
1072
- function Yt(t) {
1170
+ function Qt(t) {
1073
1171
  return String(t || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1074
1172
  }
1075
- function ye() {
1173
+ function ve() {
1076
1174
  const t = h == null ? void 0 : h.querySelector(".nf-kind");
1077
1175
  if (!t)
1078
1176
  return;
1079
- const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : B;
1080
- t.innerHTML = e.map((o) => `<button type="button" data-kind="${Yt(o.id)}">${Yt(o.label)}</button>`).join("");
1081
- const r = e.map((o) => o.id).includes(U) ? U : at(e);
1082
- $t(r);
1177
+ const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : F;
1178
+ t.innerHTML = e.map((a) => `<button type="button" data-kind="${Qt(a.id)}">${Qt(a.label)}</button>`).join("");
1179
+ const r = e.map((a) => a.id).includes(U) ? U : st(e);
1180
+ kt(r);
1083
1181
  }
1084
- function $t(t) {
1085
- U = (d.kinds || B).map((n) => n.id).includes(t) ? t : at(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
1182
+ function kt(t) {
1183
+ U = (d.kinds || F).map((n) => n.id).includes(t) ? t : st(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
1086
1184
  n.dataset.active = String(n.dataset.kind === U);
1087
1185
  });
1088
1186
  }
1089
- function St(t) {
1090
- H = Wn.has(t) ? t : null, L = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1091
- e.dataset.active = String(e.dataset.tool === H);
1092
- }), s.canvas && (s.canvas.dataset.draw = H ? "true" : "false"), S && M();
1187
+ function rt(t) {
1188
+ B = tr.has(t) ? t : null, M = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1189
+ e.dataset.active = String(e.dataset.tool === B);
1190
+ }), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"), S && A();
1093
1191
  }
1094
- function Gt(t) {
1192
+ function Zt(t) {
1095
1193
  return Math.min(1, Math.max(0, t));
1096
1194
  }
1097
- function Y() {
1195
+ function G() {
1098
1196
  return s.shot || s.canvas;
1099
1197
  }
1100
- function rt(t) {
1101
- const e = Y().getBoundingClientRect();
1198
+ function it(t) {
1199
+ const e = G().getBoundingClientRect();
1102
1200
  return {
1103
- x: Gt((t.clientX - e.left) / Math.max(e.width, 1)),
1104
- y: Gt((t.clientY - e.top) / Math.max(e.height, 1))
1201
+ x: Zt((t.clientX - e.left) / Math.max(e.width, 1)),
1202
+ y: Zt((t.clientY - e.top) / Math.max(e.height, 1))
1105
1203
  };
1106
1204
  }
1107
- function Jn(t) {
1108
- const e = Y().getBoundingClientRect();
1205
+ function ar(t) {
1206
+ const e = G().getBoundingClientRect();
1109
1207
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
1110
1208
  }
1111
- function ge(t) {
1112
- const e = rt(t), n = y.crop();
1209
+ function Se(t) {
1210
+ const e = it(t), n = p.crop();
1113
1211
  return {
1114
1212
  x: n.x + e.x * n.w,
1115
1213
  y: n.y + e.y * n.h
1116
1214
  };
1117
1215
  }
1118
- function st(t, e) {
1216
+ function ct(t, e) {
1119
1217
  const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
1120
1218
  return {
1121
1219
  x: n,
1122
1220
  y: r,
1123
- w: Math.max(wt, Math.abs(e.x - t.x)),
1124
- h: Math.max(wt, Math.abs(e.y - t.y))
1221
+ w: Math.max(St, Math.abs(e.x - t.x)),
1222
+ h: Math.max(St, Math.abs(e.y - t.y))
1125
1223
  };
1126
1224
  }
1127
- function Pt(t) {
1225
+ function It(t) {
1128
1226
  h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
1129
1227
  }
1130
- function pt(t) {
1228
+ function yt(t) {
1131
1229
  try {
1132
1230
  s.canvas.setPointerCapture(t.pointerId);
1133
1231
  } catch {
1134
1232
  }
1135
1233
  }
1136
- function vt() {
1137
- window.addEventListener("pointermove", be), window.addEventListener("pointerup", it), window.addEventListener("pointercancel", it);
1234
+ function Et() {
1235
+ window.addEventListener("pointermove", Ee), window.addEventListener("pointerup", at), window.addEventListener("pointercancel", at);
1138
1236
  }
1139
- function we() {
1140
- window.removeEventListener("pointermove", be), window.removeEventListener("pointerup", it), window.removeEventListener("pointercancel", it);
1237
+ function xe() {
1238
+ window.removeEventListener("pointermove", Ee), window.removeEventListener("pointerup", at), window.removeEventListener("pointercancel", at);
1141
1239
  }
1142
- function Qn(t) {
1240
+ function or(t) {
1143
1241
  if (t.button !== 0 || !S)
1144
1242
  return;
1145
- if (!t.target.closest(".nf-sticker") && !Jn(t)) {
1146
- L = null, M();
1243
+ if (!t.target.closest(".nf-sticker") && !ar(t)) {
1244
+ M = null, A();
1147
1245
  return;
1148
1246
  }
1149
1247
  const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
1150
1248
  if (n && n.dataset.preview !== "true") {
1151
- t.preventDefault(), t.stopPropagation(), L = n.dataset.id, pt(t), Zn({
1249
+ t.preventDefault(), t.stopPropagation(), M = n.dataset.id, yt(t), sr({
1152
1250
  kind: "sticker",
1153
- id: L,
1251
+ id: M,
1154
1252
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
1155
- }, t), M();
1253
+ }, t), A();
1156
1254
  return;
1157
1255
  }
1158
- if (L = null, H === "crop") {
1159
- t.preventDefault(), pt(t), b = { kind: "crop", start: rt(t), current: rt(t) }, vt(), M();
1256
+ if (M = null, B === "crop") {
1257
+ t.preventDefault(), yt(t), b = { kind: "crop", start: it(t), current: it(t) }, Et(), A();
1160
1258
  return;
1161
1259
  }
1162
- if (H === "arrow" || H === "rect" || H === "circle") {
1163
- t.preventDefault(), pt(t);
1164
- const r = ge(t);
1165
- b = { kind: "sticker", type: H, start: r, current: r }, vt(), M();
1260
+ if (B === "arrow" || B === "rect" || B === "circle") {
1261
+ t.preventDefault(), yt(t);
1262
+ const r = Se(t);
1263
+ b = { kind: "sticker", type: B, start: r, current: r }, Et(), A();
1166
1264
  return;
1167
1265
  }
1168
- M();
1266
+ A();
1169
1267
  }
1170
- function Zn(t, e) {
1268
+ function sr(t, e) {
1171
1269
  e.preventDefault(), e.stopPropagation();
1172
- const n = Y().getBoundingClientRect(), r = y.list().find((o) => o.id === t.id);
1270
+ const n = G().getBoundingClientRect(), r = p.list().find((a) => a.id === t.id);
1173
1271
  w = {
1174
1272
  ...t,
1175
1273
  startX: e.clientX,
1176
1274
  startY: e.clientY,
1177
- crop: y.crop(),
1275
+ crop: p.crop(),
1178
1276
  sticker: r ? { ...r } : null,
1179
1277
  rect: n
1180
- }, Pt(t.dir === "move" || t.dir === "start" || t.dir === "end"), vt();
1278
+ }, It(t.dir === "move" || t.dir === "start" || t.dir === "end"), Et();
1181
1279
  }
1182
- function be(t) {
1280
+ function Ee(t) {
1183
1281
  if (b) {
1184
- b.current = b.kind === "crop" ? rt(t) : ge(t), M();
1282
+ b.current = b.kind === "crop" ? it(t) : Se(t), A();
1185
1283
  return;
1186
1284
  }
1187
1285
  if (!w)
@@ -1189,85 +1287,85 @@ function be(t) {
1189
1287
  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;
1190
1288
  if (r) {
1191
1289
  if (w.dir === "end")
1192
- y.update(r.id, {
1290
+ p.update(r.id, {
1193
1291
  x2: r.x2 + e,
1194
1292
  y2: r.y2 + n
1195
1293
  });
1196
1294
  else if (w.dir === "start")
1197
- y.update(r.id, {
1295
+ p.update(r.id, {
1198
1296
  x: r.x + e,
1199
1297
  y: r.y + n
1200
1298
  });
1201
1299
  else if (w.dir === "move")
1202
- y.update(r.id, {
1300
+ p.update(r.id, {
1203
1301
  x: r.x + e,
1204
1302
  y: r.y + n,
1205
1303
  x2: (r.x2 || r.x) + e,
1206
1304
  y2: (r.y2 || r.y) + n
1207
1305
  });
1208
1306
  else {
1209
- const o = { x: r.x, y: r.y, w: r.w, h: r.h };
1210
- tr(o, w.dir, e, n), y.update(r.id, o);
1307
+ const a = { x: r.x, y: r.y, w: r.w, h: r.h };
1308
+ cr(a, w.dir, e, n), p.update(r.id, a);
1211
1309
  }
1212
- M();
1310
+ A();
1213
1311
  }
1214
1312
  }
1215
- function tr(t, e, n, r) {
1313
+ function cr(t, e, n, r) {
1216
1314
  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")) {
1217
- const o = Math.max(0.04, t.w - n);
1218
- t.x += t.w - o, t.w = o;
1315
+ const a = Math.max(0.04, t.w - n);
1316
+ t.x += t.w - a, t.w = a;
1219
1317
  }
1220
1318
  if (e.includes("n")) {
1221
- const o = Math.max(0.04, t.h - r);
1222
- t.y += t.h - o, t.h = o;
1319
+ const a = Math.max(0.04, t.h - r);
1320
+ t.y += t.h - a, t.h = a;
1223
1321
  }
1224
1322
  }
1225
- function it(t) {
1226
- if (we(), Pt(!1), b) {
1227
- er();
1323
+ function at(t) {
1324
+ if (xe(), It(!1), b) {
1325
+ lr();
1228
1326
  return;
1229
1327
  }
1230
1328
  if (w) {
1231
1329
  if (w.kind === "sticker") {
1232
1330
  const e = s.canvas.getBoundingClientRect();
1233
- (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);
1331
+ (t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (p.remove(w.id), M = null);
1234
1332
  }
1235
- w = null, M();
1333
+ w = null, A();
1236
1334
  }
1237
1335
  }
1238
- function er() {
1336
+ function lr() {
1239
1337
  const t = b;
1240
1338
  if (b = null, !t)
1241
1339
  return;
1242
1340
  if (t.kind === "crop") {
1243
- const n = st(t.start, t.current);
1244
- if (Math.abs(t.current.x - t.start.x) < Kt || Math.abs(t.current.y - t.start.y) < Kt) {
1245
- M();
1341
+ const n = ct(t.start, t.current);
1342
+ if (Math.abs(t.current.x - t.start.x) < Gt || Math.abs(t.current.y - t.start.y) < Gt) {
1343
+ A();
1246
1344
  return;
1247
1345
  }
1248
- const o = y.crop();
1249
- y.setCrop({
1250
- x: o.x + n.x * o.w,
1251
- y: o.y + n.y * o.h,
1252
- w: n.w * o.w,
1253
- h: n.h * o.h
1254
- }), G();
1346
+ const a = p.crop();
1347
+ p.setCrop({
1348
+ x: a.x + n.x * a.w,
1349
+ y: a.y + n.y * a.h,
1350
+ w: n.w * a.w,
1351
+ h: n.h * a.h
1352
+ }), q();
1255
1353
  return;
1256
1354
  }
1257
- const e = nr(t);
1258
- e && (L = e.id), M();
1355
+ const e = ur(t);
1356
+ e && (M = e.id), A();
1259
1357
  }
1260
- function nr(t) {
1358
+ function ur(t) {
1261
1359
  if (t.type === "arrow") {
1262
1360
  const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
1263
- return Math.hypot(e, n) < wt ? y.add("arrow", {
1361
+ return Math.hypot(e, n) < St ? p.add("arrow", {
1264
1362
  x: t.start.x,
1265
1363
  y: t.start.y,
1266
1364
  x2: t.start.x + 0.12,
1267
1365
  y2: t.start.y,
1268
1366
  w: 0.12,
1269
1367
  h: 0.02
1270
- }) : y.add("arrow", {
1368
+ }) : p.add("arrow", {
1271
1369
  x: t.start.x,
1272
1370
  y: t.start.y,
1273
1371
  x2: t.current.x,
@@ -1276,29 +1374,53 @@ function nr(t) {
1276
1374
  h: Math.abs(n)
1277
1375
  });
1278
1376
  }
1279
- return y.add(t.type, st(t.start, t.current));
1377
+ return p.add(t.type, ct(t.start, t.current));
1280
1378
  }
1281
- function rr() {
1282
- y.resetCrop(), L = null, G();
1379
+ function dr() {
1380
+ p.resetCrop(), M = null, q();
1283
1381
  }
1284
- function xt() {
1285
- s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
1382
+ function Ct() {
1383
+ s.resetCrop && (s.resetCrop.hidden = !p.isCropped());
1286
1384
  }
1287
- function kt(t) {
1385
+ function Ot(t) {
1288
1386
  if (!s.audio)
1289
1387
  return;
1290
1388
  const e = t ? "Stop audio" : "Record audio";
1291
1389
  s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
1292
1390
  }
1293
- function ir() {
1294
- S && (K = S), S = "", s.stage.hidden = !0, s.restore.hidden = !K;
1391
+ function fr() {
1392
+ S && (z = S), S = "", s.stage.hidden = !0, s.restore.hidden = !z;
1393
+ }
1394
+ function hr() {
1395
+ z && (S = z, s.stage.hidden = !1, s.restore.hidden = !0, q());
1295
1396
  }
1296
- function or() {
1297
- K && (S = K, s.stage.hidden = !1, s.restore.hidden = !0, G());
1397
+ function Ce() {
1398
+ return {
1399
+ capture: typeof d.capture == "function" ? d.capture : void 0,
1400
+ onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
1401
+ };
1402
+ }
1403
+ async function pr() {
1404
+ if (!(pt || !s.dialog || s.dialog.hidden)) {
1405
+ pt = !0, s.recapture.disabled = !0, v("Capturing…", !0), s.dialog.hidden = !0;
1406
+ try {
1407
+ let t = "";
1408
+ try {
1409
+ t = await On();
1410
+ } catch {
1411
+ t = await fe(Ce());
1412
+ }
1413
+ S = t, z = t, p = Rt(), P = { w: 0, h: 0 }, M = null, b = null, w = null, rt(null), s.stage.hidden = !1, s.restore.hidden = !0, v("");
1414
+ } catch (t) {
1415
+ v((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1416
+ } finally {
1417
+ s.dialog.hidden = !1, s.recapture.disabled = !1, pt = !1, q();
1418
+ }
1419
+ }
1298
1420
  }
1299
- function ar() {
1421
+ function mr() {
1300
1422
  try {
1301
- if (D || (D = On((e) => {
1423
+ if (D || (D = _n((e) => {
1302
1424
  const n = s.text.value.trim();
1303
1425
  s.text.value = n ? `${n} ${e}` : e;
1304
1426
  })), !D.isSupported()) {
@@ -1306,53 +1428,53 @@ function ar() {
1306
1428
  return;
1307
1429
  }
1308
1430
  const t = D.start();
1309
- kt(t), v(t ? "Listening…" : "");
1431
+ Ot(t), v(t ? "Listening…" : "");
1310
1432
  } catch (t) {
1311
1433
  v(t.message);
1312
1434
  }
1313
1435
  }
1314
- async function sr() {
1436
+ async function yr() {
1315
1437
  if (!d.video) {
1316
1438
  v("Video is disabled on this host.");
1317
1439
  return;
1318
1440
  }
1319
- s.dialog.hidden = !0, s.stop.hidden = !1, X(), s.launcher.hidden = !0, W = Fn({
1441
+ s.dialog.hidden = !0, s.stop.hidden = !1, Y(), s.launcher.hidden = !0, X = Wn({
1320
1442
  onStart() {
1321
1443
  },
1322
1444
  onStop(t) {
1323
- P = t, s.stop.hidden = !0, nt(), s.dialog.hidden = !1, G(), v(t ? "Video attached." : "Recording cancelled.");
1445
+ k = t, s.stop.hidden = !0, nt(), s.dialog.hidden = !1, q(), v(t ? "Video attached." : "Recording cancelled.");
1324
1446
  },
1325
1447
  onError(t) {
1326
1448
  v(t.message);
1327
1449
  }
1328
1450
  });
1329
1451
  try {
1330
- await W.start();
1452
+ await X.start();
1331
1453
  } catch (t) {
1332
1454
  s.stop.hidden = !0, nt(), s.dialog.hidden = !1, v(t.message);
1333
1455
  }
1334
1456
  }
1335
- function G() {
1457
+ function q() {
1336
1458
  if (s.shot = null, !S) {
1337
- 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>` : "", xt();
1459
+ s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = k ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(k)}"></video>` : "", Ct();
1338
1460
  return;
1339
1461
  }
1340
1462
  s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${S}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
1341
1463
  const t = s.shot.querySelector("img");
1342
1464
  t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
1343
1465
  const e = () => {
1344
- cr(t), M();
1466
+ gr(t), A();
1345
1467
  };
1346
1468
  t.addEventListener("load", e), t.complete && t.naturalWidth && e();
1347
1469
  }
1348
- function cr(t) {
1349
- const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
1350
- 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)
1470
+ function gr(t) {
1471
+ const e = t.naturalWidth || P.w, n = t.naturalHeight || P.h;
1472
+ if (e && n && (P = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !P.w || !P.h)
1351
1473
  return;
1352
- const r = y.crop(), o = O.w / O.h, i = r.w / r.h * o, a = Math.min(1, i / o), c = Math.min(1, o / i);
1353
- s.shot.style.left = `${(1 - a) / 2 * 100}%`, s.shot.style.top = `${(1 - c) / 2 * 100}%`, s.shot.style.width = `${a * 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}%`;
1474
+ const r = p.crop(), a = P.w / P.h, i = r.w / r.h * a, o = Math.min(1, i / a), c = Math.min(1, a / i);
1475
+ 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}%`;
1354
1476
  }
1355
- function lr(t) {
1477
+ function wr(t) {
1356
1478
  return t.type === "arrow" ? {
1357
1479
  id: "preview",
1358
1480
  type: "arrow",
@@ -1367,94 +1489,94 @@ function lr(t) {
1367
1489
  id: "preview",
1368
1490
  type: t.type,
1369
1491
  number: "",
1370
- ...st(t.start, t.current)
1492
+ ...ct(t.start, t.current)
1371
1493
  };
1372
1494
  }
1373
- function M() {
1495
+ function A() {
1374
1496
  if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !S || !s.shot) {
1375
- xt();
1497
+ Ct();
1376
1498
  return;
1377
1499
  }
1378
- const e = y.crop(), n = Y(), r = At(n.clientWidth || 400);
1500
+ const e = p.crop(), n = G(), r = $t(n.clientWidth || 400);
1379
1501
  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") {
1380
1502
  const i = document.createElement("div");
1381
- i.className = "nf-crop", Jt(i, st(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(i);
1503
+ i.className = "nf-crop", te(i, ct(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(i);
1382
1504
  }
1383
- const o = y.list().slice();
1384
- if ((b == null ? void 0 : b.kind) === "sticker" && o.push(lr(b)), o.forEach((i) => {
1385
- const a = i.id === "preview", c = !a && i.id === L, l = document.createElement("div");
1386
- if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? ur(l, i, e, c, r) : (Jt(l, i, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Et(l, u))), !a && i.number) {
1505
+ const a = p.list().slice();
1506
+ if ((b == null ? void 0 : b.kind) === "sticker" && a.push(wr(b)), a.forEach((i) => {
1507
+ const o = i.id === "preview", c = !o && i.id === M, l = document.createElement("div");
1508
+ if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), i.type === "arrow" ? br(l, i, e, c, r) : (te(l, i, e), c && ["nw", "ne", "sw", "se"].forEach((u) => At(l, u))), !o && i.number) {
1387
1509
  const u = document.createElement("span");
1388
1510
  u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
1389
1511
  }
1390
1512
  s.shot.appendChild(l);
1391
- }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), P) {
1513
+ }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), k) {
1392
1514
  const i = document.createElement("video");
1393
- i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(P), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", s.canvas.appendChild(i);
1515
+ i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(k), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", s.canvas.appendChild(i);
1394
1516
  }
1395
- xt();
1517
+ Ct();
1396
1518
  }
1397
- function ur(t, e, n, r, o = At(400)) {
1398
- const i = Y(), a = i.clientWidth, c = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, p = ((e.y2 ?? e.y) - n.y) / n.h * c, m = Math.max(18, o.arrowHead + o.stroke * 2), x = Math.min(l, f) - m, A = Math.min(u, p) - m, k = Math.max(2, Math.abs(f - l)) + m * 2, q = Math.max(2, Math.abs(p - u)) + m * 2, j = l - x, N = u - A, ct = f - x, lt = p - A, T = ue(j, N, ct, lt, o), _ = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1399
- t.style.left = `${x}px`, t.style.top = `${A}px`, t.style.width = `${k}px`, t.style.height = `${q}px`, _.setAttribute("class", "nf-arrow-svg"), _.setAttribute("viewBox", `0 0 ${k} ${q}`), _.setAttribute("width", String(k)), _.setAttribute("height", String(q)), _.innerHTML = `
1400
- <line class="nf-arrow-hit" x1="${j}" y1="${N}" x2="${ct}" y2="${lt}" />
1401
- <line class="nf-arrow-shaft" x1="${j}" y1="${N}" x2="${T.shaftEnd.x}" y2="${T.shaftEnd.y}" />
1402
- <polygon class="nf-arrow-head" points="${T.tipX},${T.tipY} ${T.left.x},${T.left.y} ${T.right.x},${T.right.y}" />
1403
- `, t.appendChild(_), r && (Et(t, "start", { left: j - 5, top: N - 5 }), Et(t, "end", { left: ct - 5, top: lt - 5 }));
1519
+ function br(t, e, n, r, a = $t(400)) {
1520
+ const i = G(), o = i.clientWidth, c = i.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, y = Math.max(18, a.arrowHead + a.stroke * 2), x = Math.min(l, f) - y, L = Math.min(u, m) - y, I = Math.max(2, Math.abs(f - l)) + y * 2, K = Math.max(2, Math.abs(m - u)) + y * 2, N = l - x, j = u - L, lt = f - x, ut = m - L, O = pe(N, j, lt, ut, a), _ = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1521
+ t.style.left = `${x}px`, t.style.top = `${L}px`, t.style.width = `${I}px`, t.style.height = `${K}px`, _.setAttribute("class", "nf-arrow-svg"), _.setAttribute("viewBox", `0 0 ${I} ${K}`), _.setAttribute("width", String(I)), _.setAttribute("height", String(K)), _.innerHTML = `
1522
+ <line class="nf-arrow-hit" x1="${N}" y1="${j}" x2="${lt}" y2="${ut}" />
1523
+ <line class="nf-arrow-shaft" x1="${N}" y1="${j}" x2="${O.shaftEnd.x}" y2="${O.shaftEnd.y}" />
1524
+ <polygon class="nf-arrow-head" points="${O.tipX},${O.tipY} ${O.left.x},${O.left.y} ${O.right.x},${O.right.y}" />
1525
+ `, t.appendChild(_), r && (At(t, "start", { left: N - 5, top: j - 5 }), At(t, "end", { left: lt - 5, top: ut - 5 }));
1404
1526
  }
1405
- function Et(t, e, n) {
1527
+ function At(t, e, n) {
1406
1528
  const r = document.createElement("span");
1407
1529
  r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
1408
1530
  }
1409
- function Jt(t, e, n) {
1531
+ function te(t, e, n) {
1410
1532
  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}%`;
1411
1533
  }
1412
- function dr() {
1534
+ function vr() {
1413
1535
  try {
1414
- return String(localStorage.getItem(pe) || "").trim();
1536
+ return String(localStorage.getItem(we) || "").trim();
1415
1537
  } catch {
1416
1538
  return "";
1417
1539
  }
1418
1540
  }
1419
- function fr(t) {
1541
+ function Sr(t) {
1420
1542
  const e = String(t || "").trim();
1421
- if (!(!e || e === bt))
1543
+ if (!(!e || e === xt))
1422
1544
  try {
1423
- localStorage.setItem(pe, e);
1545
+ localStorage.setItem(we, e);
1424
1546
  } catch {
1425
1547
  }
1426
1548
  }
1427
- function Se() {
1428
- return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
1549
+ function Ae() {
1550
+ return !!(String($.userId || "").trim() || String($.email || "").trim() || String($.displayName || "").trim());
1429
1551
  }
1430
- function hr() {
1552
+ function xr() {
1431
1553
  return String(
1432
- R.displayName || R.email || R.userId || ""
1554
+ $.displayName || $.email || $.userId || ""
1433
1555
  ).trim();
1434
1556
  }
1435
- function pr() {
1557
+ function Er() {
1436
1558
  var e;
1437
- if (Se())
1438
- return hr() || bt;
1559
+ if (Ae())
1560
+ return xr() || xt;
1439
1561
  const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
1440
- return t ? (fr(t), t) : bt;
1562
+ return t ? (Sr(t), t) : xt;
1441
1563
  }
1442
- function ve() {
1564
+ function Me() {
1443
1565
  if (!s.author)
1444
1566
  return;
1445
- const t = Se();
1567
+ const t = Ae();
1446
1568
  if (s.author.hidden = t, t) {
1447
1569
  s.author.value = "";
1448
1570
  return;
1449
1571
  }
1450
- s.author.value = dr();
1572
+ s.author.value = vr();
1451
1573
  }
1452
- function xe(t, e = he) {
1574
+ function Le(t, e = ge) {
1453
1575
  const n = Number(t);
1454
- return Number.isFinite(n) ? Math.min(Xn, Math.max(0, Math.floor(n))) : e;
1576
+ return Number.isFinite(n) ? Math.min(nr, Math.max(0, Math.floor(n))) : e;
1455
1577
  }
1456
- function Ee(t = {}) {
1457
- kn(t);
1578
+ function Re(t = {}) {
1579
+ Un(t);
1458
1580
  const e = Object.prototype.hasOwnProperty.call(t, "kinds");
1459
1581
  d = {
1460
1582
  ...d,
@@ -1464,102 +1586,104 @@ function Ee(t = {}) {
1464
1586
  name: t.name == null ? d.name : String(t.name || ""),
1465
1587
  targets: t.targets === void 0 ? d.targets : t.targets,
1466
1588
  hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
1467
- theme: me(t.theme ?? d.theme),
1589
+ theme: be(t.theme ?? d.theme),
1468
1590
  video: t.video == null ? d.video : !!t.video,
1469
- consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : xe(t.consoleLogLimit, d.consoleLogLimit),
1470
- kinds: e ? zn(t.kinds) : d.kinds
1591
+ consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : Le(t.consoleLogLimit, d.consoleLogLimit),
1592
+ kinds: e ? Qn(t.kinds) : d.kinds,
1593
+ capture: t.capture === void 0 ? d.capture : t.capture,
1594
+ onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
1471
1595
  };
1472
1596
  }
1473
- function Tt(t = {}) {
1474
- return Ee(t), h && X(), It;
1597
+ function Bt(t = {}) {
1598
+ return Re(t), h && Y(), Ht;
1475
1599
  }
1476
- function mr(t = {}) {
1477
- return Ee(t), Rt(), X(), It;
1600
+ function Cr(t = {}) {
1601
+ return Re(t), Pt(), Y(), Ht;
1478
1602
  }
1479
- function yr(t) {
1480
- return Tt({ theme: t });
1603
+ function Ar(t) {
1604
+ return Bt({ theme: t });
1481
1605
  }
1482
- function gr(t) {
1606
+ function Mr(t) {
1483
1607
  const e = !!t;
1484
- return !e && h && s.dialog && !s.dialog.hidden && J(), Tt({ hideLauncher: !e });
1608
+ return !e && h && s.dialog && !s.dialog.hidden && J(), Bt({ hideLauncher: !e });
1485
1609
  }
1486
- async function Ce() {
1487
- Rt(), Me(), X(), s.launcher.hidden = !0, y = le(), O = { w: 0, h: 0 }, P = null, L = null, b = null, w = null, U = at(d.kinds), $t(U), St(null), kt(!1), s.text.value = "", ve(), v("");
1610
+ async function $e() {
1611
+ Pt(), Te(), Y(), s.launcher.hidden = !0, p = Rt(), P = { w: 0, h: 0 }, k = null, M = null, b = null, w = null, U = st(d.kinds), kt(U), rt(null), Ot(!1), s.text.value = "", Me(), v("");
1488
1612
  try {
1489
- S = await An(), K = S, s.stage.hidden = !1, s.restore.hidden = !0, v("");
1613
+ S = await fe(Ce()), z = S, s.stage.hidden = !1, s.restore.hidden = !0, v("");
1490
1614
  } catch {
1491
1615
  S = "", v("Screenshot failed; you can still send text.");
1492
1616
  }
1493
- s.dialog.hidden = !1, G(), s.text.focus();
1617
+ s.dialog.hidden = !1, q(), s.text.focus();
1494
1618
  }
1495
1619
  function J() {
1496
- h && (D == null || D.stop(), kt(!1), we(), b = null, w = null, Pt(!1), Me(), s.dialog.hidden = !0, s.stop.hidden = !0, nt());
1620
+ h && (D == null || D.stop(), Ot(!1), xe(), b = null, w = null, It(!1), Te(), s.dialog.hidden = !0, s.stop.hidden = !0, nt());
1497
1621
  }
1498
- function wr() {
1622
+ function Lr() {
1499
1623
  const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
1500
1624
  if (!t || !e || !n || !r)
1501
1625
  return Promise.resolve();
1502
- Lt = !0, v("");
1503
- const o = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, i = e.getBoundingClientRect();
1504
- if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", o)
1626
+ Tt = !0, v("");
1627
+ const a = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, i = e.getBoundingClientRect();
1628
+ if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", a)
1505
1629
  return new Promise((u) => {
1506
1630
  window.setTimeout(() => u(), 1e3);
1507
1631
  });
1508
- const a = e.getBoundingClientRect(), c = a.width > 0 ? i.width / a.width : 1, l = a.height > 0 ? i.height / a.height : 1;
1632
+ const o = e.getBoundingClientRect(), c = o.width > 0 ? i.width / o.width : 1, l = o.height > 0 ? i.height / o.height : 1;
1509
1633
  return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
1510
1634
  let f = !1;
1511
- const p = () => {
1512
- f || (f = !0, e.removeEventListener("transitionend", m), window.setTimeout(() => {
1635
+ const m = () => {
1636
+ f || (f = !0, e.removeEventListener("transitionend", y), window.setTimeout(() => {
1513
1637
  t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
1514
1638
  }, 1e3));
1515
- }, m = (x) => {
1516
- x.target !== e || x.propertyName !== "transform" || p();
1639
+ }, y = (x) => {
1640
+ x.target !== e || x.propertyName !== "transform" || m();
1517
1641
  };
1518
- e.addEventListener("transitionend", m), requestAnimationFrame(() => {
1642
+ e.addEventListener("transitionend", y), requestAnimationFrame(() => {
1519
1643
  e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
1520
- }), window.setTimeout(p, 700);
1644
+ }), window.setTimeout(m, 700);
1521
1645
  });
1522
1646
  }
1523
- function Me() {
1524
- Lt = !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));
1647
+ function Te() {
1648
+ Tt = !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));
1525
1649
  }
1526
- function br(t = {}) {
1527
- R = { ...R, ...Pn(t) }, ve();
1650
+ function Rr(t = {}) {
1651
+ $ = { ...$, ...Fn(t) }, Me();
1528
1652
  }
1529
- async function Ae() {
1530
- if (Rt(), ht)
1653
+ async function Pe() {
1654
+ if (Pt(), mt)
1531
1655
  return null;
1532
1656
  const t = s.text.value.trim();
1533
- if (!t && !S && !P)
1657
+ if (!t && !S && !k)
1534
1658
  return v("Add a note, screenshot, or video first."), null;
1535
1659
  if (!d.endpoint || !d.projectKey)
1536
1660
  return v("Notefully is missing endpoint or projectKey."), null;
1537
- ht = !0, Qt(!0), v("Submitting…", !0);
1661
+ mt = !0, ee(!0), v("Submitting…", !0);
1538
1662
  try {
1539
- const e = pr(), n = new FormData();
1663
+ const e = Er(), n = new FormData();
1540
1664
  if (n.append("message", t), n.append("kind", U), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify({
1541
- ...$n({
1542
- ...R,
1543
- displayName: R.displayName || e
1665
+ ...Dn({
1666
+ ...$,
1667
+ displayName: $.displayName || e
1544
1668
  }),
1545
1669
  author: e,
1546
- console: fe.snapshot().slice(-xe(d.consoleLogLimit))
1547
- })), 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)), S) {
1548
- const i = await Yn(S);
1549
- if (n.append("screenshot", i, "screenshot.png"), y.list().length || y.isCropped()) {
1550
- const a = await Vn(
1670
+ console: ye.snapshot().slice(-Le(d.consoleLogLimit))
1671
+ })), n.append("annotations", JSON.stringify(p.list())), n.append("crop", JSON.stringify(p.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), S) {
1672
+ const i = await rr(S);
1673
+ if (n.append("screenshot", i, "screenshot.png"), p.list().length || p.isCropped()) {
1674
+ const o = await Jn(
1551
1675
  S,
1552
- y.crop(),
1553
- y.list(),
1676
+ p.crop(),
1677
+ p.list(),
1554
1678
  {
1555
- mark: Xt("--nf-mark", "#fdd341"),
1556
- markText: Xt("--nf-mark-text", "#2a2140")
1679
+ mark: Jt("--nf-mark", "#fdd341"),
1680
+ markText: Jt("--nf-mark-text", "#2a2140")
1557
1681
  }
1558
1682
  );
1559
- n.append("screenshotBaked", a, "screenshot.baked.png");
1683
+ n.append("screenshotBaked", o, "screenshot.baked.png");
1560
1684
  }
1561
1685
  }
1562
- P && n.append("recording", P, "recording.webm");
1686
+ k && n.append("recording", k, "recording.webm");
1563
1687
  const r = await fetch(`${d.endpoint}/v1/reports`, {
1564
1688
  method: "POST",
1565
1689
  headers: {
@@ -1567,36 +1691,36 @@ async function Ae() {
1567
1691
  },
1568
1692
  body: n
1569
1693
  });
1570
- let o = null;
1694
+ let a = null;
1571
1695
  try {
1572
- o = await r.json();
1696
+ a = await r.json();
1573
1697
  } catch {
1574
- o = null;
1698
+ a = null;
1575
1699
  }
1576
1700
  if (!r.ok)
1577
- throw v((o == null ? void 0 : o.error) || "Submit failed."), new Error((o == null ? void 0 : o.error) || `Submit failed (${r.status})`);
1578
- return await wr(), J(), o;
1701
+ throw v((a == null ? void 0 : a.error) || "Submit failed."), new Error((a == null ? void 0 : a.error) || `Submit failed (${r.status})`);
1702
+ return await Lr(), J(), a;
1579
1703
  } finally {
1580
- ht = !1, Qt(!1);
1704
+ mt = !1, ee(!1);
1581
1705
  }
1582
1706
  }
1583
- function Qt(t) {
1707
+ function ee(t) {
1584
1708
  s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
1585
1709
  }
1586
- function Sr() {
1710
+ function $r() {
1587
1711
  J(), h == null || h.remove(), h = null, s = {};
1588
1712
  }
1589
- const It = { init: mr, configure: Tt, setTheme: yr, setVisible: gr, open: Ce, close: J, identify: br, submit: Ae, destroy: Sr };
1590
- typeof window < "u" && (window.Notefully = It);
1713
+ const Ht = { init: Cr, configure: Bt, setTheme: Ar, setVisible: Mr, open: $e, close: J, identify: Rr, submit: Pe, destroy: $r };
1714
+ typeof window < "u" && (window.Notefully = Ht);
1591
1715
  export {
1592
1716
  J as close,
1593
- Tt as configure,
1594
- It as default,
1595
- Sr as destroy,
1596
- br as identify,
1597
- mr as init,
1598
- Ce as open,
1599
- yr as setTheme,
1600
- gr as setVisible,
1601
- Ae as submit
1717
+ Bt as configure,
1718
+ Ht as default,
1719
+ $r as destroy,
1720
+ Rr as identify,
1721
+ Cr as init,
1722
+ $e as open,
1723
+ Ar as setTheme,
1724
+ Mr as setVisible,
1725
+ Pe as submit
1602
1726
  };