@makefully/notefully 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/notefully.js CHANGED
@@ -1,4 +1,4 @@
1
- function me(t, e) {
1
+ function ye(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function me(t, e) {
8
8
  const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), o = n.createElement("a");
9
9
  return n.head.appendChild(r), n.body.appendChild(o), e && (r.href = e), o.href = t, o.href;
10
10
  }
11
- const ye = /* @__PURE__ */ (() => {
11
+ const ge = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -16,33 +16,33 @@ const ye = /* @__PURE__ */ (() => {
16
16
  );
17
17
  return () => (t += 1, `u${e()}${t}`);
18
18
  })();
19
- function H(t) {
19
+ function D(t) {
20
20
  const e = [];
21
21
  for (let n = 0, r = t.length; n < r; n++)
22
22
  e.push(t[n]);
23
23
  return e;
24
24
  }
25
- let _ = null;
26
- function Vt(t = {}) {
27
- return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = H(window.getComputedStyle(document.documentElement)), _));
25
+ let N = null;
26
+ function Wt(t = {}) {
27
+ return N || (t.includeStyleProperties ? (N = t.includeStyleProperties, N) : (N = D(window.getComputedStyle(document.documentElement)), N));
28
28
  }
29
29
  function K(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 ge(t) {
33
+ function we(t) {
34
34
  const e = K(t, "border-left-width"), n = K(t, "border-right-width");
35
35
  return t.clientWidth + e + n;
36
36
  }
37
- function we(t) {
37
+ function be(t) {
38
38
  const e = K(t, "border-top-width"), n = K(t, "border-bottom-width");
39
39
  return t.clientHeight + e + n;
40
40
  }
41
- function Wt(t, e = {}) {
42
- const n = e.width || ge(t), r = e.height || we(t);
41
+ function qt(t, e = {}) {
42
+ const n = e.width || we(t), r = e.height || be(t);
43
43
  return { width: n, height: r };
44
44
  }
45
- function be() {
45
+ function Se() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -65,12 +65,12 @@ function G(t) {
65
65
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
66
66
  });
67
67
  }
68
- async function Se(t) {
68
+ async function xe(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 xe(t, e, n) {
71
+ async function Ee(t, e, n) {
72
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), Se(o);
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), xe(o);
74
74
  }
75
75
  const x = (t, e) => {
76
76
  if (t instanceof e)
@@ -78,67 +78,67 @@ const x = (t, e) => {
78
78
  const n = Object.getPrototypeOf(t);
79
79
  return n === null ? !1 : n.constructor.name === e.name || x(n, e);
80
80
  };
81
- function Ee(t) {
81
+ function Ce(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function Ce(t, e) {
86
- return Vt(e).map((n) => {
85
+ function Me(t, e) {
86
+ return Wt(e).map((n) => {
87
87
  const r = t.getPropertyValue(n), o = t.getPropertyPriority(n);
88
88
  return `${n}: ${r}${o ? " !important" : ""};`;
89
89
  }).join(" ");
90
90
  }
91
- function Me(t, e, n, r) {
92
- const o = `.${t}:${e}`, i = n.cssText ? Ee(n) : Ce(n, r);
91
+ function Le(t, e, n, r) {
92
+ const o = `.${t}:${e}`, i = n.cssText ? Ce(n) : Me(n, r);
93
93
  return document.createTextNode(`${o}{${i}}`);
94
94
  }
95
- function $t(t, e, n, r) {
95
+ function Rt(t, e, n, r) {
96
96
  const o = window.getComputedStyle(t, n), i = o.getPropertyValue("content");
97
97
  if (i === "" || i === "none")
98
98
  return;
99
- const a = ye();
99
+ const a = ge();
100
100
  try {
101
101
  e.className = `${e.className} ${a}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const s = document.createElement("style");
106
- s.appendChild(Me(a, n, o, r)), e.appendChild(s);
106
+ s.appendChild(Le(a, n, o, r)), e.appendChild(s);
107
107
  }
108
- function Le(t, e, n) {
109
- $t(t, e, ":before", n), $t(t, e, ":after", n);
108
+ function $e(t, e, n) {
109
+ Rt(t, e, ":before", n), Rt(t, e, ":after", n);
110
110
  }
111
- const Rt = "application/font-woff", At = "image/jpeg", $e = {
112
- woff: Rt,
113
- woff2: Rt,
111
+ const At = "application/font-woff", Pt = "image/jpeg", Re = {
112
+ woff: At,
113
+ woff2: At,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: At,
118
- jpeg: At,
117
+ jpg: Pt,
118
+ jpeg: Pt,
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 Re(t) {
124
+ function Ae(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
- function St(t) {
129
- const e = Re(t).toLowerCase();
130
- return $e[e] || "";
128
+ function xt(t) {
129
+ const e = Ae(t).toLowerCase();
130
+ return Re[e] || "";
131
131
  }
132
- function Ae(t) {
132
+ function Pe(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
135
  function ft(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function Pe(t, e) {
138
+ function Te(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
- async function qt(t, e, n) {
141
+ async function zt(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`);
@@ -155,19 +155,19 @@ async function qt(t, e, n) {
155
155
  });
156
156
  }
157
157
  const ct = {};
158
- function Te(t, e, n) {
158
+ function ke(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 xt(t, e, n) {
163
- const r = Te(t, e, n.includeQueryParams);
162
+ async function Et(t, e, n) {
163
+ const r = ke(t, e, n.includeQueryParams);
164
164
  if (ct[r] != null)
165
165
  return ct[r];
166
166
  n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
167
  let o;
168
168
  try {
169
- const i = await qt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), Ae(s)));
170
- o = Pe(i, e);
169
+ const i = await zt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), Pe(s)));
170
+ o = Te(i, e);
171
171
  } catch (i) {
172
172
  o = n.imagePlaceholder || "";
173
173
  let a = `Failed to fetch resource: ${t}`;
@@ -175,21 +175,21 @@ async function xt(t, e, n) {
175
175
  }
176
176
  return ct[r] = o, o;
177
177
  }
178
- async function ke(t) {
178
+ async function Ie(t) {
179
179
  const e = t.toDataURL();
180
180
  return e === "data:," ? t.cloneNode(!1) : G(e);
181
181
  }
182
- async function Ie(t, e) {
182
+ async function Oe(t, e) {
183
183
  if (t.currentSrc) {
184
184
  const i = document.createElement("canvas"), a = i.getContext("2d");
185
185
  i.width = t.clientWidth, i.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, i.width, i.height);
186
186
  const s = i.toDataURL();
187
187
  return G(s);
188
188
  }
189
- const n = t.poster, r = St(n), o = await xt(n, r, e);
189
+ const n = t.poster, r = xt(n), o = await Et(n, r, e);
190
190
  return G(o);
191
191
  }
192
- async function Oe(t, e) {
192
+ async function He(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 Oe(t, e) {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function He(t, e) {
202
- return x(t, HTMLCanvasElement) ? ke(t) : x(t, HTMLVideoElement) ? Ie(t, e) : x(t, HTMLIFrameElement) ? Oe(t, e) : t.cloneNode(zt(t));
201
+ async function De(t, e) {
202
+ return x(t, HTMLCanvasElement) ? Ie(t) : x(t, HTMLVideoElement) ? Oe(t, e) : x(t, HTMLIFrameElement) ? He(t, e) : t.cloneNode(Xt(t));
203
203
  }
204
- const De = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", zt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Fe(t, e, n) {
204
+ const Fe = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Xt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function Ue(t, e, n) {
206
206
  var r, o;
207
- if (zt(e))
207
+ if (Xt(e))
208
208
  return e;
209
209
  let i = [];
210
- return De(t) && t.assignedNodes ? i = H(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((o = t.shadowRoot) !== null && o !== void 0 ? o : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((a, s) => a.then(() => nt(s, n)).then((l) => {
210
+ return Fe(t) && t.assignedNodes ? i = D(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = D(t.contentDocument.body.childNodes) : i = D(((o = t.shadowRoot) !== null && o !== void 0 ? o : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((a, s) => a.then(() => nt(s, n)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function Ue(t, e, n) {
214
+ function je(t, e, n) {
215
215
  const r = e.style;
216
216
  if (!r)
217
217
  return;
218
218
  const o = window.getComputedStyle(t);
219
- o.cssText ? (r.cssText = o.cssText, r.transformOrigin = o.transformOrigin) : Vt(n).forEach((i) => {
219
+ o.cssText ? (r.cssText = o.cssText, r.transformOrigin = o.transformOrigin) : Wt(n).forEach((i) => {
220
220
  let a = o.getPropertyValue(i);
221
221
  i === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), x(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));
222
222
  });
223
223
  }
224
- function je(t, e) {
224
+ function _e(t, e) {
225
225
  x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function _e(t, e) {
227
+ function Ne(t, e) {
228
228
  if (x(t, HTMLSelectElement)) {
229
229
  const r = Array.from(e.children).find((o) => t.value === o.getAttribute("value"));
230
230
  r && r.setAttribute("selected", "");
231
231
  }
232
232
  }
233
- function Ne(t, e, n) {
234
- return x(e, Element) && (Ue(t, e, n), Le(t, e, n), je(t, e), _e(t, e)), e;
233
+ function Be(t, e, n) {
234
+ return x(e, Element) && (je(t, e, n), $e(t, e, n), _e(t, e), Ne(t, e)), e;
235
235
  }
236
- async function Be(t, e) {
236
+ async function Ve(t, e) {
237
237
  const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
238
238
  if (n.length === 0)
239
239
  return t;
@@ -258,30 +258,30 @@ async function Be(t, e) {
258
258
  return t;
259
259
  }
260
260
  async function nt(t, e, n) {
261
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => He(r, e)).then((r) => Fe(t, r, e)).then((r) => Ne(t, r, e)).then((r) => Be(r, e));
261
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => De(r, e)).then((r) => Ue(t, r, e)).then((r) => Be(t, r, e)).then((r) => Ve(r, e));
262
262
  }
263
- const Xt = /url\((['"]?)([^'"]+?)\1\)/g, Ve = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, We = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function qe(t) {
263
+ const Yt = /url\((['"]?)([^'"]+?)\1\)/g, We = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, qe = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function ze(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function ze(t) {
268
+ function Xe(t) {
269
269
  const e = [];
270
- return t.replace(Xt, (n, r, o) => (e.push(o), n)), e.filter((n) => !ft(n));
270
+ return t.replace(Yt, (n, r, o) => (e.push(o), n)), e.filter((n) => !ft(n));
271
271
  }
272
- async function Xe(t, e, n, r, o) {
272
+ async function Ye(t, e, n, r, o) {
273
273
  try {
274
- const i = n ? me(e, n) : e, a = St(e);
274
+ const i = n ? ye(e, n) : e, a = xt(e);
275
275
  let s;
276
- return o || (s = await xt(i, a, r)), t.replace(qe(e), `$1${s}$3`);
276
+ return o || (s = await Et(i, a, r)), t.replace(ze(e), `$1${s}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function Ye(t, { preferredFontFormat: e }) {
282
- return e ? t.replace(We, (n) => {
281
+ function Ke(t, { preferredFontFormat: e }) {
282
+ return e ? t.replace(qe, (n) => {
283
283
  for (; ; ) {
284
- const [r, , o] = Ve.exec(n) || [];
284
+ const [r, , o] = We.exec(n) || [];
285
285
  if (!o)
286
286
  return "";
287
287
  if (o === e)
@@ -289,32 +289,32 @@ function Ye(t, { preferredFontFormat: e }) {
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function Yt(t) {
293
- return t.search(Xt) !== -1;
292
+ function Kt(t) {
293
+ return t.search(Yt) !== -1;
294
294
  }
295
- async function Kt(t, e, n) {
296
- if (!Yt(t))
295
+ async function Gt(t, e, n) {
296
+ if (!Kt(t))
297
297
  return t;
298
- const r = Ye(t, n);
299
- return ze(r).reduce((i, a) => i.then((s) => Xe(s, a, e, n)), Promise.resolve(r));
298
+ const r = Ke(t, n);
299
+ return Xe(r).reduce((i, a) => i.then((s) => Ye(s, a, e, n)), Promise.resolve(r));
300
300
  }
301
- async function N(t, e, n) {
301
+ async function B(t, e, n) {
302
302
  var r;
303
303
  const o = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
304
304
  if (o) {
305
- const i = await Kt(o, null, n);
305
+ const i = await Gt(o, 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 Ke(t, e) {
311
- await N("background", t, e) || await N("background-image", t, e), await N("mask", t, e) || await N("-webkit-mask", t, e) || await N("mask-image", t, e) || await N("-webkit-mask-image", t, e);
312
- }
313
310
  async function Ge(t, e) {
311
+ await B("background", t, e) || await B("background-image", t, e), await B("mask", t, e) || await B("-webkit-mask", t, e) || await B("mask-image", t, e) || await B("-webkit-mask-image", t, e);
312
+ }
313
+ async function Je(t, e) {
314
314
  const n = x(t, HTMLImageElement);
315
315
  if (!(n && !ft(t.src)) && !(x(t, SVGImageElement) && !ft(t.href.baseVal)))
316
316
  return;
317
- const r = n ? t.src : t.href.baseVal, o = await xt(r, St(r), e);
317
+ const r = n ? t.src : t.href.baseVal, o = await Et(r, xt(r), e);
318
318
  await new Promise((i, a) => {
319
319
  t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
320
320
  try {
@@ -327,14 +327,14 @@ async function Ge(t, e) {
327
327
  s.decode && (s.decode = i), s.loading === "lazy" && (s.loading = "eager"), n ? (t.srcset = "", t.src = o) : t.href.baseVal = o;
328
328
  });
329
329
  }
330
- async function Je(t, e) {
331
- const r = H(t.childNodes).map((o) => Gt(o, e));
330
+ async function Qe(t, e) {
331
+ const r = D(t.childNodes).map((o) => Jt(o, e));
332
332
  await Promise.all(r).then(() => t);
333
333
  }
334
- async function Gt(t, e) {
335
- x(t, Element) && (await Ke(t, e), await Ge(t, e), await Je(t, e));
334
+ async function Jt(t, e) {
335
+ x(t, Element) && (await Ge(t, e), await Je(t, e), await Qe(t, e));
336
336
  }
337
- function Qe(t, e) {
337
+ function Ze(t, e) {
338
338
  const { style: n } = t;
339
339
  e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
340
340
  const r = e.style;
@@ -342,23 +342,23 @@ function Qe(t, e) {
342
342
  n[o] = r[o];
343
343
  }), t;
344
344
  }
345
- const Pt = {};
346
- async function Tt(t) {
347
- let e = Pt[t];
345
+ const Tt = {};
346
+ async function kt(t) {
347
+ let e = Tt[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 }, Pt[t] = e, e;
351
+ return e = { url: t, cssText: r }, Tt[t] = e, e;
352
352
  }
353
- async function kt(t, e) {
353
+ async function It(t, e) {
354
354
  let n = t.cssText;
355
355
  const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
356
356
  let s = a.replace(r, "$1");
357
- return s.startsWith("https://") || (s = new URL(s, t.url).href), qt(s, e.fetchRequestInit, ({ result: l }) => (n = n.replace(a, `url(${l})`), [a, l]));
357
+ return s.startsWith("https://") || (s = new URL(s, t.url).href), zt(s, e.fetchRequestInit, ({ result: l }) => (n = n.replace(a, `url(${l})`), [a, l]));
358
358
  });
359
359
  return Promise.all(i).then(() => n);
360
360
  }
361
- function It(t) {
361
+ function Ot(t) {
362
362
  if (t == null)
363
363
  return [];
364
364
  const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
@@ -384,21 +384,21 @@ function It(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function Ze(t, e) {
387
+ async function tn(t, e) {
388
388
  const n = [], r = [];
389
389
  return t.forEach((o) => {
390
390
  if ("cssRules" in o)
391
391
  try {
392
- H(o.cssRules || []).forEach((i, a) => {
392
+ D(o.cssRules || []).forEach((i, a) => {
393
393
  if (i.type === CSSRule.IMPORT_RULE) {
394
394
  let s = a + 1;
395
- const l = i.href, u = Tt(l).then((d) => kt(d, e)).then((d) => It(d).forEach((p) => {
395
+ const l = i.href, u = kt(l).then((d) => It(d, e)).then((d) => Ot(d).forEach((m) => {
396
396
  try {
397
- o.insertRule(p, p.startsWith("@import") ? s += 1 : o.cssRules.length);
398
- } catch (m) {
397
+ o.insertRule(m, m.startsWith("@import") ? s += 1 : o.cssRules.length);
398
+ } catch (p) {
399
399
  console.error("Error inserting rule from remote css", {
400
- rule: p,
401
- error: m
400
+ rule: m,
401
+ error: p
402
402
  });
403
403
  }
404
404
  })).catch((d) => {
@@ -409,7 +409,7 @@ async function Ze(t, e) {
409
409
  });
410
410
  } catch (i) {
411
411
  const a = t.find((s) => s.href == null) || document.styleSheets[0];
412
- o.href != null && r.push(Tt(o.href).then((s) => kt(s, e)).then((s) => It(s).forEach((l) => {
412
+ o.href != null && r.push(kt(o.href).then((s) => It(s, e)).then((s) => Ot(s).forEach((l) => {
413
413
  a.insertRule(l, a.cssRules.length);
414
414
  })).catch((s) => {
415
415
  console.error("Error loading remote stylesheet", s);
@@ -418,7 +418,7 @@ async function Ze(t, e) {
418
418
  }), Promise.all(r).then(() => (t.forEach((o) => {
419
419
  if ("cssRules" in o)
420
420
  try {
421
- H(o.cssRules || []).forEach((i) => {
421
+ D(o.cssRules || []).forEach((i) => {
422
422
  n.push(i);
423
423
  });
424
424
  } catch (i) {
@@ -426,60 +426,60 @@ async function Ze(t, e) {
426
426
  }
427
427
  }), n));
428
428
  }
429
- function tn(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Yt(e.style.getPropertyValue("src")));
429
+ function en(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Kt(e.style.getPropertyValue("src")));
431
431
  }
432
- async function en(t, e) {
432
+ async function nn(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const n = H(t.ownerDocument.styleSheets), r = await Ze(n, e);
436
- return tn(r);
435
+ const n = D(t.ownerDocument.styleSheets), r = await tn(n, e);
436
+ return en(r);
437
437
  }
438
- function Jt(t) {
438
+ function Qt(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function nn(t) {
441
+ function rn(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(Jt(i));
445
+ e.add(Qt(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 rn(t, e) {
453
- const n = await en(t, e), r = nn(t);
454
- return (await Promise.all(n.filter((i) => r.has(Jt(i.style.fontFamily))).map((i) => {
452
+ async function on(t, e) {
453
+ const n = await nn(t, e), r = rn(t);
454
+ return (await Promise.all(n.filter((i) => r.has(Qt(i.style.fontFamily))).map((i) => {
455
455
  const a = i.parentStyleSheet ? i.parentStyleSheet.href : null;
456
- return Kt(i.cssText, a, e);
456
+ return Gt(i.cssText, a, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function on(t, e) {
461
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await rn(t, e);
460
+ async function an(t, e) {
461
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await on(t, e);
462
462
  if (n) {
463
463
  const r = document.createElement("style"), o = document.createTextNode(n);
464
464
  r.appendChild(o), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
465
465
  }
466
466
  }
467
- async function an(t, e = {}) {
468
- const { width: n, height: r } = Wt(t, e), o = await nt(t, e, !0);
469
- return await on(o, e), await Gt(o, e), Qe(o, e), await xe(o, n, r);
470
- }
471
467
  async function sn(t, e = {}) {
472
- const { width: n, height: r } = Wt(t, e), o = await an(t, e), i = await G(o), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || be(), u = e.canvasWidth || n, d = e.canvasHeight || r;
473
- return a.width = u * l, a.height = d * l, e.skipAutoScale || ve(a), a.style.width = `${u}`, a.style.height = `${d}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(i, 0, 0, a.width, a.height), a;
468
+ const { width: n, height: r } = qt(t, e), o = await nt(t, e, !0);
469
+ return await an(o, e), await Jt(o, e), Ze(o, e), await Ee(o, n, r);
474
470
  }
475
471
  async function cn(t, e = {}) {
476
- return (await sn(t, e)).toDataURL();
472
+ const { width: n, height: r } = qt(t, e), o = await sn(t, e), i = await G(o), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || Se(), u = e.canvasWidth || n, d = e.canvasHeight || r;
473
+ return a.width = u * l, a.height = d * l, e.skipAutoScale || ve(a), a.style.width = `${u}`, a.style.height = `${d}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(i, 0, 0, a.width, a.height), a;
474
+ }
475
+ async function ln(t, e = {}) {
476
+ return (await cn(t, e)).toDataURL();
477
477
  }
478
478
  const J = "data-nf-capture-chrome";
479
- function ln(t) {
479
+ function un(t) {
480
480
  return t instanceof Element && (t.hasAttribute(J) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
481
481
  }
482
- function un() {
482
+ function dn() {
483
483
  const t = [];
484
484
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
485
485
  const r = n.getBoundingClientRect(), o = document.createElement("div");
@@ -495,47 +495,47 @@ function un() {
495
495
  ].join(";"), document.body.appendChild(o), t.push(o);
496
496
  }), () => t.forEach((n) => n.remove());
497
497
  }
498
- function dn() {
498
+ function fn() {
499
499
  const t = document.querySelector(`[${J}]`);
500
500
  if (t)
501
501
  return t;
502
502
  const e = document.createElement("div");
503
503
  return e.setAttribute(J, "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;
504
504
  }
505
- function fn() {
505
+ function hn() {
506
506
  document.querySelectorAll(`[${J}]`).forEach((t) => t.remove());
507
507
  }
508
- async function hn() {
509
- const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = dn();
508
+ async function mn() {
509
+ const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = fn();
510
510
  t && (t.style.display = "none");
511
- const r = un();
511
+ const r = dn();
512
512
  await new Promise((o) => requestAnimationFrame(() => requestAnimationFrame(o)));
513
513
  try {
514
- return await cn(document.body, {
514
+ return await ln(document.body, {
515
515
  cacheBust: !0,
516
516
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
517
- filter: (o) => !ln(o)
517
+ filter: (o) => !un(o)
518
518
  });
519
519
  } finally {
520
- r(), n.remove(), fn(), t && (t.style.display = e);
520
+ r(), n.remove(), hn(), t && (t.style.display = e);
521
521
  }
522
522
  }
523
523
  function pn(t = "") {
524
524
  const e = String(t || "");
525
525
  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" : "";
526
526
  }
527
- function mn(t = "") {
527
+ function yn(t = "") {
528
528
  const e = String(t || "");
529
529
  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" : "";
530
530
  }
531
- function yn(t = {}) {
531
+ function gn(t = {}) {
532
532
  const e = navigator.userAgent;
533
533
  return {
534
534
  url: location.href,
535
535
  title: document.title,
536
536
  userAgent: e,
537
537
  os: pn(e),
538
- browser: mn(e),
538
+ browser: yn(e),
539
539
  language: navigator.language,
540
540
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
541
541
  viewport: {
@@ -550,11 +550,11 @@ function yn(t = {}) {
550
550
  }
551
551
  };
552
552
  }
553
- const Ot = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Ht = {
553
+ const Ht = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Dt = {
554
554
  id: "userId",
555
555
  username: "displayName",
556
556
  name: "displayName"
557
- }, Dt = /* @__PURE__ */ new Set([
557
+ }, Ft = /* @__PURE__ */ new Set([
558
558
  "endpoint",
559
559
  "projectKey",
560
560
  "version",
@@ -564,7 +564,7 @@ const Ot = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Ht = {
564
564
  "theme",
565
565
  "video",
566
566
  "consoleLogLimit"
567
- ]), Ft = {
567
+ ]), Ut = {
568
568
  slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
569
569
  projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
570
570
  project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
@@ -573,14 +573,14 @@ const Ot = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Ht = {
573
573
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
574
574
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
575
575
  };
576
- function gn(t = {}, e = {}) {
577
- const n = e.warn || Qt, r = t && typeof t == "object" ? t : {}, o = {}, i = [];
578
- for (const a of Ot)
576
+ function wn(t = {}, e = {}) {
577
+ const n = e.warn || Zt, r = t && typeof t == "object" ? t : {}, o = {}, i = [];
578
+ for (const a of Ht)
579
579
  Object.prototype.hasOwnProperty.call(r, a) && (o[a] = r[a]);
580
- for (const [a, s] of Object.entries(Ht))
580
+ for (const [a, s] of Object.entries(Dt))
581
581
  Object.prototype.hasOwnProperty.call(r, a) && (Object.prototype.hasOwnProperty.call(o, s) || (o[s] = r[a]));
582
582
  for (const a of Object.keys(r))
583
- Ot.has(a) || Object.prototype.hasOwnProperty.call(Ht, a) || i.push(a);
583
+ Ht.has(a) || Object.prototype.hasOwnProperty.call(Dt, a) || i.push(a);
584
584
  if (i.length) {
585
585
  const a = i.some((s) => s === "name" || s === "slug" || s === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
586
586
  n(
@@ -589,23 +589,23 @@ function gn(t = {}, e = {}) {
589
589
  }
590
590
  return o;
591
591
  }
592
- function wn(t = {}, e = {}) {
593
- const n = e.warn || Qt, r = t && typeof t == "object" ? t : {}, o = Object.keys(r).filter((i) => !Dt.has(i));
592
+ function bn(t = {}, e = {}) {
593
+ const n = e.warn || Zt, r = t && typeof t == "object" ? t : {}, o = Object.keys(r).filter((i) => !Ft.has(i));
594
594
  if (o.length)
595
595
  for (const i of o) {
596
- if (Ft[i]) {
597
- n(`Notefully.init: ignoring "${i}". ${Ft[i]}`);
596
+ if (Ut[i]) {
597
+ n(`Notefully.init: ignoring "${i}". ${Ut[i]}`);
598
598
  continue;
599
599
  }
600
600
  n(
601
- `Notefully.init: ignoring unknown key "${i}". Supported: ${[...Dt].join(", ")}.`
601
+ `Notefully.init: ignoring unknown key "${i}". Supported: ${[...Ft].join(", ")}.`
602
602
  );
603
603
  }
604
604
  }
605
- function Qt(t) {
605
+ function Zt(t) {
606
606
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
607
607
  }
608
- const bn = 80;
608
+ const Sn = 80;
609
609
  function vn() {
610
610
  const t = [], e = {};
611
611
  let n = !1;
@@ -620,7 +620,7 @@ function vn() {
620
620
  level: i,
621
621
  text: s.slice(0, 2e3),
622
622
  at: Date.now()
623
- }), t.length > bn && t.shift();
623
+ }), t.length > Sn && t.shift();
624
624
  };
625
625
  return {
626
626
  hook: () => {
@@ -639,7 +639,7 @@ function vn() {
639
639
  }
640
640
  };
641
641
  }
642
- function Sn(t) {
642
+ function xn(t) {
643
643
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
644
644
  let n = null, r = !1;
645
645
  const o = () => {
@@ -669,8 +669,8 @@ function Sn(t) {
669
669
  isActive: () => r
670
670
  };
671
671
  }
672
- const xn = 60 * 1e3;
673
- function En({ onStart: t, onStop: e, onError: n }) {
672
+ const En = 60 * 1e3;
673
+ function Cn({ onStart: t, onStop: e, onError: n }) {
674
674
  let r = null, o = null, i = [], a = null;
675
675
  const s = () => {
676
676
  if (a && (clearTimeout(a), a = null), o && o.state !== "inactive")
@@ -687,7 +687,7 @@ function En({ onStart: t, onStop: e, onError: n }) {
687
687
  s(), e(null);
688
688
  };
689
689
  return { start: async () => {
690
- var d, p;
690
+ var d, m;
691
691
  if (!((d = navigator.mediaDevices) != null && d.getDisplayMedia))
692
692
  throw new Error("Screen recording is not supported in this browser.");
693
693
  r = await navigator.mediaDevices.getDisplayMedia({
@@ -697,15 +697,15 @@ function En({ onStart: t, onStop: e, onError: n }) {
697
697
  selfBrowserSurface: "include"
698
698
  }), i = [], o = new MediaRecorder(r, {
699
699
  mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
700
- }), o.ondataavailable = (m) => {
701
- m.data && m.data.size && i.push(m.data);
700
+ }), o.ondataavailable = (p) => {
701
+ p.data && p.data.size && i.push(p.data);
702
702
  }, o.onstop = () => {
703
- const m = i.length ? new Blob(i, { type: o.mimeType || "video/webm" }) : null;
704
- s(), e(m);
705
- }, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, xn);
703
+ const p = i.length ? new Blob(i, { type: o.mimeType || "video/webm" }) : null;
704
+ s(), e(p);
705
+ }, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, En);
706
706
  }, stop: l };
707
707
  }
708
- function Cn() {
708
+ function Mn() {
709
709
  const t = /* @__PURE__ */ new Set();
710
710
  return {
711
711
  alloc() {
@@ -724,15 +724,15 @@ function Cn() {
724
724
  };
725
725
  }
726
726
  const lt = { x: 0, y: 0, w: 1, h: 1 };
727
- function Zt() {
728
- const t = Cn();
727
+ function te() {
728
+ const t = Mn();
729
729
  let e = [], n = { ...lt }, r = 1;
730
730
  return {
731
- list: () => e.filter((i) => Ln(i, n)),
731
+ list: () => e.filter((i) => $n(i, n)),
732
732
  all: () => e.slice(),
733
733
  crop: () => ({ ...n }),
734
734
  setCrop(i) {
735
- return n = Mn(i), n;
735
+ return n = Ln(i), n;
736
736
  },
737
737
  resetCrop() {
738
738
  return n = { ...lt }, n;
@@ -772,15 +772,15 @@ function Zt() {
772
772
  }
773
773
  };
774
774
  }
775
- function Mn(t) {
775
+ function Ln(t) {
776
776
  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);
777
777
  return { x: e, y: n, w: r, h: o };
778
778
  }
779
- function Ln(t, e) {
779
+ function $n(t, e) {
780
780
  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;
781
781
  return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
782
782
  }
783
- function Et(t) {
783
+ function Ct(t) {
784
784
  const e = Math.max(1, Number(t) || 1);
785
785
  return {
786
786
  stroke: Math.max(2, e * 75e-4),
@@ -790,52 +790,52 @@ function Et(t) {
790
790
  arrowHeadAngle: 0.4
791
791
  };
792
792
  }
793
- function $n(t, {
793
+ function Rn(t, {
794
794
  stickers: e = [],
795
795
  crop: n = { x: 0, y: 0, w: 1, h: 1 },
796
796
  width: r,
797
797
  height: o,
798
798
  colors: i = {}
799
799
  }) {
800
- const a = i.mark || "#fdd341", s = i.markText || "#2a2140", l = Et(r);
800
+ const a = i.mark || "#fdd341", s = i.markText || "#2a2140", l = Ct(r);
801
801
  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) => {
802
- const d = ht(u.x, n, r), p = pt(u.y, n, o), m = u.w / n.w * r, C = u.h / n.h * o, L = l.stroke / 2;
802
+ const d = ht(u.x, n, r), m = mt(u.y, n, o), p = u.w / n.w * r, C = u.h / n.h * o, L = l.stroke / 2;
803
803
  if (u.type === "rect")
804
804
  t.strokeRect(
805
805
  d + L,
806
- p + L,
807
- Math.max(0, m - l.stroke),
806
+ m + L,
807
+ Math.max(0, p - l.stroke),
808
808
  Math.max(0, C - l.stroke)
809
809
  );
810
810
  else if (u.type === "circle")
811
811
  t.beginPath(), t.ellipse(
812
- d + m / 2,
813
- p + C / 2,
814
- Math.max(0.5, m / 2 - L),
812
+ d + p / 2,
813
+ m + C / 2,
814
+ Math.max(0.5, p / 2 - L),
815
815
  Math.max(0.5, C / 2 - L),
816
816
  0,
817
817
  0,
818
818
  Math.PI * 2
819
819
  ), t.stroke();
820
820
  else if (u.type === "arrow") {
821
- const F = ht(u.x2 ?? u.x + u.w, n, r), U = pt(u.y2 ?? u.y, n, o);
822
- An(t, d, p, F, U, l);
821
+ const U = ht(u.x2 ?? u.x + u.w, n, r), j = mt(u.y2 ?? u.y, n, o);
822
+ Pn(t, d, m, U, j, l);
823
823
  }
824
824
  if (u.number == null || u.number === "")
825
825
  return;
826
- const A = Rn(u, n, r, o, d, p, m), B = String(u.number);
827
- t.beginPath(), t.arc(A.x, A.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(B, A.x, A.y + 0.5), t.fillStyle = a;
826
+ const P = An(u, n, r, o, d, m, p), V = String(u.number);
827
+ t.beginPath(), t.arc(P.x, P.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(V, P.x, P.y + 0.5), t.fillStyle = a;
828
828
  }), t.restore();
829
829
  }
830
830
  function ht(t, e, n) {
831
831
  return (t - e.x) / e.w * n;
832
832
  }
833
- function pt(t, e, n) {
833
+ function mt(t, e, n) {
834
834
  return (t - e.y) / e.h * n;
835
835
  }
836
- function Rn(t, e, n, r, o, i, a) {
836
+ function An(t, e, n, r, o, i, a) {
837
837
  if (t.type === "arrow") {
838
- const s = ht(t.x2 ?? t.x + t.w, e, n), l = pt(t.y2 ?? t.y, e, r);
838
+ const s = ht(t.x2 ?? t.x + t.w, e, n), l = mt(t.y2 ?? t.y, e, r);
839
839
  return {
840
840
  x: (o + s) / 2,
841
841
  y: (i + l) / 2
@@ -843,8 +843,8 @@ function Rn(t, e, n, r, o, i, a) {
843
843
  }
844
844
  return { x: o + a / 2, y: i };
845
845
  }
846
- function te(t, e, n, r, o) {
847
- const i = Math.atan2(r - e, n - t), a = o.arrowHead, s = Math.min(o.stroke, a * 0.2), l = n, u = r, d = n - Math.cos(i) * a, p = r - Math.sin(i) * a, m = {
846
+ function ee(t, e, n, r, o) {
847
+ const i = Math.atan2(r - e, n - t), a = o.arrowHead, s = Math.min(o.stroke, a * 0.2), l = n, u = r, d = n - Math.cos(i) * a, m = r - Math.sin(i) * a, p = {
848
848
  x: l - a * Math.cos(i - o.arrowHeadAngle),
849
849
  y: u - a * Math.sin(i - o.arrowHeadAngle)
850
850
  }, C = {
@@ -854,26 +854,26 @@ function te(t, e, n, r, o) {
854
854
  x: n - Math.cos(i) * s,
855
855
  y: r - Math.sin(i) * s
856
856
  };
857
- return { angle: i, tipX: l, tipY: u, baseX: d, baseY: p, left: m, right: C, shaftEnd: L };
857
+ return { angle: i, tipX: l, tipY: u, baseX: d, baseY: m, left: p, right: C, shaftEnd: L };
858
858
  }
859
- function An(t, e, n, r, o, i) {
860
- const a = te(e, n, r, o, i);
859
+ function Pn(t, e, n, r, o, i) {
860
+ const a = ee(e, n, r, o, i);
861
861
  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();
862
862
  }
863
- function Pn(t, e, n, r = {}) {
863
+ function Tn(t, e, n, r = {}) {
864
864
  return new Promise((o, i) => {
865
865
  const a = new Image();
866
866
  a.onload = () => {
867
- const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), d = Math.max(1, Math.round(e.h * a.height)), p = document.createElement("canvas");
868
- p.width = u, p.height = d;
869
- const m = p.getContext("2d");
870
- m.drawImage(a, s, l, u, d, 0, 0, u, d), $n(m, {
867
+ const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), d = Math.max(1, Math.round(e.h * a.height)), m = document.createElement("canvas");
868
+ m.width = u, m.height = d;
869
+ const p = m.getContext("2d");
870
+ p.drawImage(a, s, l, u, d, 0, 0, u, d), Rn(p, {
871
871
  stickers: n,
872
872
  crop: e,
873
873
  width: u,
874
874
  height: d,
875
875
  colors: r
876
- }), p.toBlob((C) => {
876
+ }), m.toBlob((C) => {
877
877
  if (!C) {
878
878
  i(new Error("Could not encode screenshot"));
879
879
  return;
@@ -883,27 +883,27 @@ function Pn(t, e, n, r = {}) {
883
883
  }, a.onerror = () => i(new Error("Could not load screenshot")), a.src = t;
884
884
  });
885
885
  }
886
- const Tn = ["bug", "idea", "other"], kn = ["maker", "all-business", "brighter-day", "quiet-night"], ee = "maker", In = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), mt = 0.02, Ut = 0.05, On = `
886
+ const kn = ["bug", "idea", "other"], In = ["maker", "all-business", "brighter-day", "quiet-night"], ne = "maker", On = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), pt = 0.02, jt = 0.05, Hn = `
887
887
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
888
888
  <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"/>
889
889
  <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"/>
890
890
  </svg>
891
891
  `;
892
- function T(t) {
892
+ function k(t) {
893
893
  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>`;
894
894
  }
895
- const k = {
896
- crop: T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
897
- resetCrop: T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
898
- arrow: T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
899
- rect: T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
900
- circle: T('<circle cx="12" cy="12" r="8"/>'),
901
- discard: T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
902
- 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"/>'),
903
- video: T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
904
- }, ne = vn();
905
- ne.hook();
906
- const re = 10, Hn = 80, ie = "notefully.author", oe = "Anonymous";
895
+ const I = {
896
+ crop: k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
897
+ resetCrop: k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
898
+ arrow: k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
899
+ rect: k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
900
+ circle: k('<circle cx="12" cy="12" r="8"/>'),
901
+ discard: k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
902
+ audio: k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
903
+ video: k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
904
+ }, re = vn();
905
+ re.hook();
906
+ const ie = 10, Dn = 80, oe = "notefully.author", yt = "Anonymous";
907
907
  let f = {
908
908
  endpoint: "",
909
909
  projectKey: "",
@@ -911,37 +911,37 @@ let f = {
911
911
  name: "",
912
912
  targets: null,
913
913
  hideLauncher: !1,
914
- theme: ee,
914
+ theme: ne,
915
915
  video: !1,
916
- consoleLogLimit: re
917
- }, W = {}, h = null, c = {}, y = Zt(), S = "", q = "", R = null, Q = "bug", O = null, $ = null, w = null, g = null, Y = null, D = null, V = null, I = { w: 0, h: 0 }, ut = !1;
916
+ consoleLogLimit: ie
917
+ }, R = {}, h = null, c = {}, y = te(), v = "", q = "", A = null, Q = "bug", H = null, $ = null, w = null, g = null, Y = null, F = null, W = null, O = { w: 0, h: 0 }, ut = !1;
918
918
  function b(t) {
919
919
  return h.querySelector(t);
920
920
  }
921
921
  function ae(t) {
922
922
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
923
- return kn.includes(e) ? e : ee;
923
+ return In.includes(e) ? e : ne;
924
924
  }
925
- function jt(t, e) {
925
+ function _t(t, e) {
926
926
  return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
927
927
  }
928
- function v(t, e = !1) {
928
+ function S(t, e = !1) {
929
929
  c.status && (c.status.textContent = t || "", Y && (clearTimeout(Y), Y = null), t && !e && (Y = setTimeout(() => {
930
930
  c.status.textContent = "";
931
931
  }, 4e3)));
932
932
  }
933
- function Ct() {
933
+ function Mt() {
934
934
  return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
935
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${On}</button>
935
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Hn}</button>
936
936
  <div class="nf-dialog" hidden>
937
937
  <div class="nf-panel">
938
938
  <div class="nf-stage">
939
939
  <div class="nf-palette">
940
- <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${k.crop}</button>
941
- <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${k.resetCrop}</button>
942
- <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${k.arrow}</button>
943
- <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${k.rect}</button>
944
- <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${k.circle}</button>
940
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${I.crop}</button>
941
+ <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${I.resetCrop}</button>
942
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${I.arrow}</button>
943
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${I.rect}</button>
944
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${I.circle}</button>
945
945
  </div>
946
946
  <div class="nf-canvas"></div>
947
947
  </div>
@@ -953,9 +953,9 @@ function Ct() {
953
953
  <button type="button" data-kind="other">Other</button>
954
954
  </div>
955
955
  <div class="nf-actions">
956
- <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${k.discard}</button>
957
- <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${k.audio}</button>
958
- <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${k.video}</button>
956
+ <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${I.discard}</button>
957
+ <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${I.audio}</button>
958
+ <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${I.video}</button>
959
959
  <button class="nf-submit" type="button">Submit</button>
960
960
  </div>
961
961
  <button class="nf-restore" type="button" hidden>Restore screenshot</button>
@@ -979,7 +979,7 @@ function Ct() {
979
979
  resetCrop: b(".nf-reset-crop"),
980
980
  submit: b(".nf-submit"),
981
981
  shot: null
982
- }, Dn(), rt()), h;
982
+ }, Fn(), rt()), h;
983
983
  }
984
984
  function rt() {
985
985
  var t;
@@ -988,28 +988,28 @@ function rt() {
988
988
  function Z() {
989
989
  c.launcher && (c.launcher.hidden = !!f.hideLauncher);
990
990
  }
991
- function Dn() {
992
- c.launcher.addEventListener("click", () => fe()), b(".nf-dialog").addEventListener("click", (t) => {
991
+ function Fn() {
992
+ c.launcher.addEventListener("click", () => he()), b(".nf-dialog").addEventListener("click", (t) => {
993
993
  t.target === c.dialog && ot();
994
994
  }), h.querySelectorAll(".nf-tool").forEach((t) => {
995
- t.addEventListener("click", () => gt(t.dataset.tool));
996
- }), c.resetCrop.addEventListener("click", Vn), c.canvas.addEventListener("pointerdown", Un), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), h.querySelectorAll("[data-kind]").forEach((t) => {
997
- t.addEventListener("click", () => yt(t.dataset.kind));
998
- }), c.discard.addEventListener("click", Wn), c.restore.addEventListener("click", qn), c.audio.addEventListener("click", zn), c.video.addEventListener("click", Xn), c.stop.addEventListener("click", () => V == null ? void 0 : V.stop()), b(".nf-submit").addEventListener("click", () => {
999
- he().catch((t) => v(t.message || "Submit failed."));
1000
- }), yt("bug"), gt(null);
1001
- }
1002
- function yt(t) {
1003
- Q = Tn.includes(t) ? t : "bug", h.querySelectorAll("[data-kind]").forEach((e) => {
995
+ t.addEventListener("click", () => wt(t.dataset.tool));
996
+ }), c.resetCrop.addEventListener("click", Wn), c.canvas.addEventListener("pointerdown", jn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), h.querySelectorAll("[data-kind]").forEach((t) => {
997
+ t.addEventListener("click", () => gt(t.dataset.kind));
998
+ }), c.discard.addEventListener("click", qn), c.restore.addEventListener("click", zn), c.audio.addEventListener("click", Xn), c.video.addEventListener("click", Yn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), b(".nf-submit").addEventListener("click", () => {
999
+ me().catch((t) => S(t.message || "Submit failed."));
1000
+ }), gt("bug"), wt(null);
1001
+ }
1002
+ function gt(t) {
1003
+ Q = kn.includes(t) ? t : "bug", h.querySelectorAll("[data-kind]").forEach((e) => {
1004
1004
  e.dataset.active = String(e.dataset.kind === Q);
1005
1005
  });
1006
1006
  }
1007
- function gt(t) {
1008
- O = In.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1009
- e.dataset.active = String(e.dataset.tool === O);
1010
- }), c.canvas && (c.canvas.dataset.draw = O ? "true" : "false"), S && M();
1007
+ function wt(t) {
1008
+ H = On.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1009
+ e.dataset.active = String(e.dataset.tool === H);
1010
+ }), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), v && M();
1011
1011
  }
1012
- function _t(t) {
1012
+ function Nt(t) {
1013
1013
  return Math.min(1, Math.max(0, t));
1014
1014
  }
1015
1015
  function z() {
@@ -1018,11 +1018,11 @@ function z() {
1018
1018
  function tt(t) {
1019
1019
  const e = z().getBoundingClientRect();
1020
1020
  return {
1021
- x: _t((t.clientX - e.left) / Math.max(e.width, 1)),
1022
- y: _t((t.clientY - e.top) / Math.max(e.height, 1))
1021
+ x: Nt((t.clientX - e.left) / Math.max(e.width, 1)),
1022
+ y: Nt((t.clientY - e.top) / Math.max(e.height, 1))
1023
1023
  };
1024
1024
  }
1025
- function Fn(t) {
1025
+ function Un(t) {
1026
1026
  const e = z().getBoundingClientRect();
1027
1027
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
1028
1028
  }
@@ -1038,11 +1038,11 @@ function it(t, e) {
1038
1038
  return {
1039
1039
  x: n,
1040
1040
  y: r,
1041
- w: Math.max(mt, Math.abs(e.x - t.x)),
1042
- h: Math.max(mt, Math.abs(e.y - t.y))
1041
+ w: Math.max(pt, Math.abs(e.x - t.x)),
1042
+ h: Math.max(pt, Math.abs(e.y - t.y))
1043
1043
  };
1044
1044
  }
1045
- function Mt(t) {
1045
+ function Lt(t) {
1046
1046
  h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
1047
1047
  }
1048
1048
  function dt(t) {
@@ -1051,41 +1051,41 @@ function dt(t) {
1051
1051
  } catch {
1052
1052
  }
1053
1053
  }
1054
- function wt() {
1054
+ function bt() {
1055
1055
  window.addEventListener("pointermove", le), window.addEventListener("pointerup", et), window.addEventListener("pointercancel", et);
1056
1056
  }
1057
1057
  function ce() {
1058
1058
  window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", et), window.removeEventListener("pointercancel", et);
1059
1059
  }
1060
- function Un(t) {
1061
- if (t.button !== 0 || !S)
1060
+ function jn(t) {
1061
+ if (t.button !== 0 || !v)
1062
1062
  return;
1063
- if (!t.target.closest(".nf-sticker") && !Fn(t)) {
1063
+ if (!t.target.closest(".nf-sticker") && !Un(t)) {
1064
1064
  $ = null, M();
1065
1065
  return;
1066
1066
  }
1067
1067
  const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
1068
1068
  if (n && n.dataset.preview !== "true") {
1069
- t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, dt(t), jn({
1069
+ t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, dt(t), _n({
1070
1070
  kind: "sticker",
1071
1071
  id: $,
1072
1072
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
1073
1073
  }, t), M();
1074
1074
  return;
1075
1075
  }
1076
- if ($ = null, O === "crop") {
1077
- t.preventDefault(), dt(t), w = { kind: "crop", start: tt(t), current: tt(t) }, wt(), M();
1076
+ if ($ = null, H === "crop") {
1077
+ t.preventDefault(), dt(t), w = { kind: "crop", start: tt(t), current: tt(t) }, bt(), M();
1078
1078
  return;
1079
1079
  }
1080
- if (O === "arrow" || O === "rect" || O === "circle") {
1080
+ if (H === "arrow" || H === "rect" || H === "circle") {
1081
1081
  t.preventDefault(), dt(t);
1082
1082
  const r = se(t);
1083
- w = { kind: "sticker", type: O, start: r, current: r }, wt(), M();
1083
+ w = { kind: "sticker", type: H, start: r, current: r }, bt(), M();
1084
1084
  return;
1085
1085
  }
1086
1086
  M();
1087
1087
  }
1088
- function jn(t, e) {
1088
+ function _n(t, e) {
1089
1089
  e.preventDefault(), e.stopPropagation();
1090
1090
  const n = z().getBoundingClientRect(), r = y.list().find((o) => o.id === t.id);
1091
1091
  g = {
@@ -1095,7 +1095,7 @@ function jn(t, e) {
1095
1095
  crop: y.crop(),
1096
1096
  sticker: r ? { ...r } : null,
1097
1097
  rect: n
1098
- }, Mt(t.dir === "move" || t.dir === "start" || t.dir === "end"), wt();
1098
+ }, Lt(t.dir === "move" || t.dir === "start" || t.dir === "end"), bt();
1099
1099
  }
1100
1100
  function le(t) {
1101
1101
  if (w) {
@@ -1125,12 +1125,12 @@ function le(t) {
1125
1125
  });
1126
1126
  else {
1127
1127
  const o = { x: r.x, y: r.y, w: r.w, h: r.h };
1128
- _n(o, g.dir, e, n), y.update(r.id, o);
1128
+ Nn(o, g.dir, e, n), y.update(r.id, o);
1129
1129
  }
1130
1130
  M();
1131
1131
  }
1132
1132
  }
1133
- function _n(t, e, n, r) {
1133
+ function Nn(t, e, n, r) {
1134
1134
  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")) {
1135
1135
  const o = Math.max(0.04, t.w - n);
1136
1136
  t.x += t.w - o, t.w = o;
@@ -1141,8 +1141,8 @@ function _n(t, e, n, r) {
1141
1141
  }
1142
1142
  }
1143
1143
  function et(t) {
1144
- if (ce(), Mt(!1), w) {
1145
- Nn();
1144
+ if (ce(), Lt(!1), w) {
1145
+ Bn();
1146
1146
  return;
1147
1147
  }
1148
1148
  if (g) {
@@ -1153,13 +1153,13 @@ function et(t) {
1153
1153
  g = null, M();
1154
1154
  }
1155
1155
  }
1156
- function Nn() {
1156
+ function Bn() {
1157
1157
  const t = w;
1158
1158
  if (w = null, !t)
1159
1159
  return;
1160
1160
  if (t.kind === "crop") {
1161
1161
  const n = it(t.start, t.current);
1162
- if (Math.abs(t.current.x - t.start.x) < Ut || Math.abs(t.current.y - t.start.y) < Ut) {
1162
+ if (Math.abs(t.current.x - t.start.x) < jt || Math.abs(t.current.y - t.start.y) < jt) {
1163
1163
  M();
1164
1164
  return;
1165
1165
  }
@@ -1172,13 +1172,13 @@ function Nn() {
1172
1172
  }), X();
1173
1173
  return;
1174
1174
  }
1175
- const e = Bn(t);
1175
+ const e = Vn(t);
1176
1176
  e && ($ = e.id), M();
1177
1177
  }
1178
- function Bn(t) {
1178
+ function Vn(t) {
1179
1179
  if (t.type === "arrow") {
1180
1180
  const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
1181
- return Math.hypot(e, n) < mt ? y.add("arrow", {
1181
+ return Math.hypot(e, n) < pt ? y.add("arrow", {
1182
1182
  x: t.start.x,
1183
1183
  y: t.start.y,
1184
1184
  x2: t.start.x + 0.12,
@@ -1196,81 +1196,81 @@ function Bn(t) {
1196
1196
  }
1197
1197
  return y.add(t.type, it(t.start, t.current));
1198
1198
  }
1199
- function Vn() {
1199
+ function Wn() {
1200
1200
  y.resetCrop(), $ = null, X();
1201
1201
  }
1202
- function bt() {
1202
+ function St() {
1203
1203
  c.resetCrop && (c.resetCrop.hidden = !y.isCropped());
1204
1204
  }
1205
- function Lt(t) {
1205
+ function $t(t) {
1206
1206
  if (!c.audio)
1207
1207
  return;
1208
1208
  const e = t ? "Stop audio" : "Record audio";
1209
1209
  c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
1210
1210
  }
1211
- function Wn() {
1212
- S && (q = S), S = "", c.stage.hidden = !0, c.restore.hidden = !q;
1213
- }
1214
1211
  function qn() {
1215
- q && (S = q, c.stage.hidden = !1, c.restore.hidden = !0, X());
1212
+ v && (q = v), v = "", c.stage.hidden = !0, c.restore.hidden = !q;
1216
1213
  }
1217
1214
  function zn() {
1215
+ q && (v = q, c.stage.hidden = !1, c.restore.hidden = !0, X());
1216
+ }
1217
+ function Xn() {
1218
1218
  try {
1219
- if (D || (D = Sn((e) => {
1219
+ if (F || (F = xn((e) => {
1220
1220
  const n = c.text.value.trim();
1221
1221
  c.text.value = n ? `${n} ${e}` : e;
1222
- })), !D.isSupported()) {
1223
- v("Audio-to-text is not supported in this browser.");
1222
+ })), !F.isSupported()) {
1223
+ S("Audio-to-text is not supported in this browser.");
1224
1224
  return;
1225
1225
  }
1226
- const t = D.start();
1227
- Lt(t), v(t ? "Listening…" : "");
1226
+ const t = F.start();
1227
+ $t(t), S(t ? "Listening…" : "");
1228
1228
  } catch (t) {
1229
- v(t.message);
1229
+ S(t.message);
1230
1230
  }
1231
1231
  }
1232
- async function Xn() {
1232
+ async function Yn() {
1233
1233
  if (!f.video) {
1234
- v("Video is disabled on this host.");
1234
+ S("Video is disabled on this host.");
1235
1235
  return;
1236
1236
  }
1237
- c.dialog.hidden = !0, c.stop.hidden = !1, rt(), c.launcher.hidden = !0, V = En({
1237
+ c.dialog.hidden = !0, c.stop.hidden = !1, rt(), c.launcher.hidden = !0, W = Cn({
1238
1238
  onStart() {
1239
1239
  },
1240
1240
  onStop(t) {
1241
- R = t, c.stop.hidden = !0, Z(), c.dialog.hidden = !1, X(), v(t ? "Video attached." : "Recording cancelled.");
1241
+ A = t, c.stop.hidden = !0, Z(), c.dialog.hidden = !1, X(), S(t ? "Video attached." : "Recording cancelled.");
1242
1242
  },
1243
1243
  onError(t) {
1244
- v(t.message);
1244
+ S(t.message);
1245
1245
  }
1246
1246
  });
1247
1247
  try {
1248
- await V.start();
1248
+ await W.start();
1249
1249
  } catch (t) {
1250
- c.stop.hidden = !0, Z(), c.dialog.hidden = !1, v(t.message);
1250
+ c.stop.hidden = !0, Z(), c.dialog.hidden = !1, S(t.message);
1251
1251
  }
1252
1252
  }
1253
1253
  function X() {
1254
- if (c.shot = null, !S) {
1255
- c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = R ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(R)}"></video>` : "", bt();
1254
+ if (c.shot = null, !v) {
1255
+ c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = A ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(A)}"></video>` : "", St();
1256
1256
  return;
1257
1257
  }
1258
- c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${S}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
1258
+ c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${v}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
1259
1259
  const t = c.shot.querySelector("img");
1260
1260
  t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
1261
1261
  const e = () => {
1262
- Yn(t), M();
1262
+ Kn(t), M();
1263
1263
  };
1264
1264
  t.addEventListener("load", e), t.complete && t.naturalWidth && e();
1265
1265
  }
1266
- function Yn(t) {
1267
- const e = t.naturalWidth || I.w, n = t.naturalHeight || I.h;
1268
- if (e && n && (I = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !I.w || !I.h)
1266
+ function Kn(t) {
1267
+ const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
1268
+ if (e && n && (O = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !O.w || !O.h)
1269
1269
  return;
1270
- const r = y.crop(), o = I.w / I.h, i = r.w / r.h * o, a = Math.min(1, i / o), s = Math.min(1, o / i);
1270
+ const r = y.crop(), o = O.w / O.h, i = r.w / r.h * o, a = Math.min(1, i / o), s = Math.min(1, o / i);
1271
1271
  c.shot.style.left = `${(1 - a) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${a * 100}%`, c.shot.style.height = `${s * 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}%`;
1272
1272
  }
1273
- function Kn(t) {
1273
+ function Gn(t) {
1274
1274
  return t.type === "arrow" ? {
1275
1275
  id: "preview",
1276
1276
  type: "arrow",
@@ -1289,77 +1289,90 @@ function Kn(t) {
1289
1289
  };
1290
1290
  }
1291
1291
  function M() {
1292
- if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !S || !c.shot) {
1293
- bt();
1292
+ if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !v || !c.shot) {
1293
+ St();
1294
1294
  return;
1295
1295
  }
1296
- const e = y.crop(), n = z(), r = Et(n.clientWidth || 400);
1296
+ const e = y.crop(), n = z(), r = Ct(n.clientWidth || 400);
1297
1297
  if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (w == null ? void 0 : w.kind) === "crop") {
1298
1298
  const i = document.createElement("div");
1299
- i.className = "nf-crop", Nt(i, it(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(i);
1299
+ i.className = "nf-crop", Bt(i, it(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(i);
1300
1300
  }
1301
1301
  const o = y.list().slice();
1302
- if ((w == null ? void 0 : w.kind) === "sticker" && o.push(Kn(w)), o.forEach((i) => {
1302
+ if ((w == null ? void 0 : w.kind) === "sticker" && o.push(Gn(w)), o.forEach((i) => {
1303
1303
  const a = i.id === "preview", s = !a && i.id === $, l = document.createElement("div");
1304
- if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? Gn(l, i, e, s, r) : (Nt(l, i, e), s && ["nw", "ne", "sw", "se"].forEach((u) => vt(l, u))), !a && i.number) {
1304
+ if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? Jn(l, i, e, s, r) : (Bt(l, i, e), s && ["nw", "ne", "sw", "se"].forEach((u) => vt(l, u))), !a && i.number) {
1305
1305
  const u = document.createElement("span");
1306
1306
  u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
1307
1307
  }
1308
1308
  c.shot.appendChild(l);
1309
- }), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), R) {
1309
+ }), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), A) {
1310
1310
  const i = document.createElement("video");
1311
- i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(R), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", c.canvas.appendChild(i);
1311
+ i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(A), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", c.canvas.appendChild(i);
1312
1312
  }
1313
- bt();
1313
+ St();
1314
1314
  }
1315
- function Gn(t, e, n, r, o = Et(400)) {
1316
- const i = z(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, p = ((e.y2 ?? e.y) - n.y) / n.h * s, m = Math.max(18, o.arrowHead + o.stroke * 2), C = Math.min(l, d) - m, L = Math.min(u, p) - m, A = Math.max(2, Math.abs(d - l)) + m * 2, B = Math.max(2, Math.abs(p - u)) + m * 2, F = l - C, U = u - L, at = d - C, st = p - L, P = te(F, U, at, st, o), j = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1317
- t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${A}px`, t.style.height = `${B}px`, j.setAttribute("class", "nf-arrow-svg"), j.setAttribute("viewBox", `0 0 ${A} ${B}`), j.setAttribute("width", String(A)), j.setAttribute("height", String(B)), j.innerHTML = `
1318
- <line class="nf-arrow-hit" x1="${F}" y1="${U}" x2="${at}" y2="${st}" />
1319
- <line class="nf-arrow-shaft" x1="${F}" y1="${U}" x2="${P.shaftEnd.x}" y2="${P.shaftEnd.y}" />
1320
- <polygon class="nf-arrow-head" points="${P.tipX},${P.tipY} ${P.left.x},${P.left.y} ${P.right.x},${P.right.y}" />
1321
- `, t.appendChild(j), r && (vt(t, "start", { left: F - 5, top: U - 5 }), vt(t, "end", { left: at - 5, top: st - 5 }));
1315
+ function Jn(t, e, n, r, o = Ct(400)) {
1316
+ const i = z(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, m = ((e.y2 ?? e.y) - n.y) / n.h * s, p = Math.max(18, o.arrowHead + o.stroke * 2), C = Math.min(l, d) - p, L = Math.min(u, m) - p, P = Math.max(2, Math.abs(d - l)) + p * 2, V = Math.max(2, Math.abs(m - u)) + p * 2, U = l - C, j = u - L, at = d - C, st = m - L, T = ee(U, j, at, st, o), _ = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1317
+ t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${P}px`, t.style.height = `${V}px`, _.setAttribute("class", "nf-arrow-svg"), _.setAttribute("viewBox", `0 0 ${P} ${V}`), _.setAttribute("width", String(P)), _.setAttribute("height", String(V)), _.innerHTML = `
1318
+ <line class="nf-arrow-hit" x1="${U}" y1="${j}" x2="${at}" y2="${st}" />
1319
+ <line class="nf-arrow-shaft" x1="${U}" y1="${j}" x2="${T.shaftEnd.x}" y2="${T.shaftEnd.y}" />
1320
+ <polygon class="nf-arrow-head" points="${T.tipX},${T.tipY} ${T.left.x},${T.left.y} ${T.right.x},${T.right.y}" />
1321
+ `, t.appendChild(_), r && (vt(t, "start", { left: U - 5, top: j - 5 }), vt(t, "end", { left: at - 5, top: st - 5 }));
1322
1322
  }
1323
1323
  function vt(t, e, n) {
1324
1324
  const r = document.createElement("span");
1325
1325
  r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
1326
1326
  }
1327
- function Nt(t, e, n) {
1327
+ function Bt(t, e, n) {
1328
1328
  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}%`;
1329
1329
  }
1330
- function Jn() {
1330
+ function Qn() {
1331
1331
  try {
1332
- return String(localStorage.getItem(ie) || "").trim();
1332
+ return String(localStorage.getItem(oe) || "").trim();
1333
1333
  } catch {
1334
1334
  return "";
1335
1335
  }
1336
1336
  }
1337
- function Qn(t) {
1337
+ function Zn(t) {
1338
1338
  const e = String(t || "").trim();
1339
- if (!(!e || e === oe))
1339
+ if (!(!e || e === yt))
1340
1340
  try {
1341
- localStorage.setItem(ie, e);
1341
+ localStorage.setItem(oe, e);
1342
1342
  } catch {
1343
1343
  }
1344
1344
  }
1345
- function Zn() {
1346
- const t = String(W.displayName || "").trim();
1347
- return t || Jn();
1345
+ function ue() {
1346
+ return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
1348
1347
  }
1349
1348
  function tr() {
1349
+ return String(
1350
+ R.displayName || R.email || R.userId || ""
1351
+ ).trim();
1352
+ }
1353
+ function er() {
1350
1354
  var e;
1355
+ if (ue())
1356
+ return tr() || yt;
1351
1357
  const t = String(((e = c.author) == null ? void 0 : e.value) || "").trim();
1352
- return t ? (Qn(t), t) : oe;
1358
+ return t ? (Zn(t), t) : yt;
1353
1359
  }
1354
- function ue() {
1355
- c.author && (c.author.value = Zn());
1360
+ function de() {
1361
+ if (!c.author)
1362
+ return;
1363
+ const t = ue();
1364
+ if (c.author.hidden = t, t) {
1365
+ c.author.value = "";
1366
+ return;
1367
+ }
1368
+ c.author.value = Qn();
1356
1369
  }
1357
- function de(t, e = re) {
1370
+ function fe(t, e = ie) {
1358
1371
  const n = Number(t);
1359
- return Number.isFinite(n) ? Math.min(Hn, Math.max(0, Math.floor(n))) : e;
1372
+ return Number.isFinite(n) ? Math.min(Dn, Math.max(0, Math.floor(n))) : e;
1360
1373
  }
1361
- function er(t = {}) {
1362
- return wn(t), f = {
1374
+ function nr(t = {}) {
1375
+ return bn(t), f = {
1363
1376
  ...f,
1364
1377
  endpoint: String(t.endpoint || f.endpoint || "").replace(/\/$/, ""),
1365
1378
  projectKey: t.projectKey == null ? f.projectKey : String(t.projectKey),
@@ -1369,55 +1382,55 @@ function er(t = {}) {
1369
1382
  hideLauncher: t.hideLauncher == null ? f.hideLauncher : !!t.hideLauncher,
1370
1383
  theme: ae(t.theme ?? f.theme),
1371
1384
  video: t.video == null ? f.video : !!t.video,
1372
- consoleLogLimit: t.consoleLogLimit == null ? f.consoleLogLimit : de(t.consoleLogLimit, f.consoleLogLimit)
1373
- }, Ct(), rt(), pe;
1385
+ consoleLogLimit: t.consoleLogLimit == null ? f.consoleLogLimit : fe(t.consoleLogLimit, f.consoleLogLimit)
1386
+ }, Mt(), rt(), pe;
1374
1387
  }
1375
- async function fe() {
1376
- Ct(), rt(), c.launcher.hidden = !0, y = Zt(), I = { w: 0, h: 0 }, R = null, $ = null, w = null, g = null, Q = "bug", yt("bug"), gt(null), Lt(!1), c.text.value = "", ue(), v("");
1388
+ async function he() {
1389
+ Mt(), rt(), c.launcher.hidden = !0, y = te(), O = { w: 0, h: 0 }, A = null, $ = null, w = null, g = null, Q = "bug", gt("bug"), wt(null), $t(!1), c.text.value = "", de(), S("");
1377
1390
  try {
1378
- S = await hn(), q = S, c.stage.hidden = !1, c.restore.hidden = !0, v("");
1391
+ v = await mn(), q = v, c.stage.hidden = !1, c.restore.hidden = !0, S("");
1379
1392
  } catch {
1380
- S = "", v("Screenshot failed; you can still send text.");
1393
+ v = "", S("Screenshot failed; you can still send text.");
1381
1394
  }
1382
1395
  c.dialog.hidden = !1, X(), c.text.focus();
1383
1396
  }
1384
1397
  function ot() {
1385
- h && (D == null || D.stop(), Lt(!1), ce(), w = null, g = null, Mt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
1398
+ h && (F == null || F.stop(), $t(!1), ce(), w = null, g = null, Lt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
1386
1399
  }
1387
- function nr(t = {}) {
1388
- W = { ...W, ...gn(t) }, ue();
1400
+ function rr(t = {}) {
1401
+ R = { ...R, ...wn(t) }, de();
1389
1402
  }
1390
- async function he() {
1391
- if (Ct(), ut)
1403
+ async function me() {
1404
+ if (Mt(), ut)
1392
1405
  return null;
1393
1406
  const t = c.text.value.trim();
1394
- if (!t && !S && !R)
1395
- return v("Add a note, screenshot, or video first."), null;
1407
+ if (!t && !v && !A)
1408
+ return S("Add a note, screenshot, or video first."), null;
1396
1409
  if (!f.endpoint || !f.projectKey)
1397
- return v("Notefully is missing endpoint or projectKey."), null;
1398
- ut = !0, Bt(!0), v("Submitting…", !0);
1410
+ return S("Notefully is missing endpoint or projectKey."), null;
1411
+ ut = !0, Vt(!0), S("Submitting…", !0);
1399
1412
  try {
1400
- const e = tr(), n = new FormData();
1413
+ const e = er(), n = new FormData();
1401
1414
  if (n.append("message", t), n.append("kind", Q), n.append("version", f.version || "0.0.0"), n.append("author", e), f.name && n.append("name", f.name), n.append("context", JSON.stringify({
1402
- ...yn({
1403
- ...W,
1404
- displayName: W.displayName || e
1415
+ ...gn({
1416
+ ...R,
1417
+ displayName: R.displayName || e
1405
1418
  }),
1406
1419
  author: e,
1407
- console: ne.snapshot().slice(-de(f.consoleLogLimit))
1408
- })), n.append("annotations", JSON.stringify(y.list())), Array.isArray(f.targets) && n.append("targets", JSON.stringify(f.targets)), S) {
1409
- const i = await Pn(
1410
- S,
1420
+ console: re.snapshot().slice(-fe(f.consoleLogLimit))
1421
+ })), n.append("annotations", JSON.stringify(y.list())), Array.isArray(f.targets) && n.append("targets", JSON.stringify(f.targets)), v) {
1422
+ const i = await Tn(
1423
+ v,
1411
1424
  y.crop(),
1412
1425
  y.list(),
1413
1426
  {
1414
- mark: jt("--nf-mark", "#fdd341"),
1415
- markText: jt("--nf-mark-text", "#2a2140")
1427
+ mark: _t("--nf-mark", "#fdd341"),
1428
+ markText: _t("--nf-mark-text", "#2a2140")
1416
1429
  }
1417
1430
  );
1418
1431
  n.append("screenshot", i, "screenshot.png");
1419
1432
  }
1420
- R && n.append("recording", R, "recording.webm");
1433
+ A && n.append("recording", A, "recording.webm");
1421
1434
  const r = await fetch(`${f.endpoint}/v1/reports`, {
1422
1435
  method: "POST",
1423
1436
  headers: {
@@ -1432,26 +1445,26 @@ async function he() {
1432
1445
  o = null;
1433
1446
  }
1434
1447
  if (!r.ok)
1435
- throw v((o == null ? void 0 : o.error) || "Submit failed."), new Error((o == null ? void 0 : o.error) || `Submit failed (${r.status})`);
1436
- return v("Sent. Thank you."), ot(), o;
1448
+ throw S((o == null ? void 0 : o.error) || "Submit failed."), new Error((o == null ? void 0 : o.error) || `Submit failed (${r.status})`);
1449
+ return S("Sent. Thank you."), ot(), o;
1437
1450
  } finally {
1438
- ut = !1, Bt(!1);
1451
+ ut = !1, Vt(!1);
1439
1452
  }
1440
1453
  }
1441
- function Bt(t) {
1454
+ function Vt(t) {
1442
1455
  c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
1443
1456
  }
1444
- function rr() {
1457
+ function ir() {
1445
1458
  ot(), h == null || h.remove(), h = null, c = {};
1446
1459
  }
1447
- const pe = { init: er, open: fe, close: ot, identify: nr, submit: he, destroy: rr };
1460
+ const pe = { init: nr, open: he, close: ot, identify: rr, submit: me, destroy: ir };
1448
1461
  typeof window < "u" && (window.Notefully = pe);
1449
1462
  export {
1450
1463
  ot as close,
1451
1464
  pe as default,
1452
- rr as destroy,
1453
- nr as identify,
1454
- er as init,
1455
- fe as open,
1456
- he as submit
1465
+ ir as destroy,
1466
+ rr as identify,
1467
+ nr as init,
1468
+ he as open,
1469
+ me as submit
1457
1470
  };