@makefully/notefully 0.1.5 → 0.1.7

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 oe(t, e) {
1
+ function le(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function oe(t, e) {
8
8
  const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), i = r.createElement("a");
9
9
  return r.head.appendChild(n), r.body.appendChild(i), e && (n.href = e), i.href = t, i.href;
10
10
  }
11
- const se = /* @__PURE__ */ (() => {
11
+ const ue = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -23,26 +23,26 @@ function j(t) {
23
23
  return e;
24
24
  }
25
25
  let _ = null;
26
- function jt(t = {}) {
26
+ function Vt(t = {}) {
27
27
  return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = j(window.getComputedStyle(document.documentElement)), _));
28
28
  }
29
29
  function X(t, e) {
30
30
  const n = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
31
31
  return n ? parseFloat(n.replace("px", "")) : 0;
32
32
  }
33
- function ce(t) {
33
+ function de(t) {
34
34
  const e = X(t, "border-left-width"), r = X(t, "border-right-width");
35
35
  return t.clientWidth + e + r;
36
36
  }
37
- function le(t) {
37
+ function fe(t) {
38
38
  const e = X(t, "border-top-width"), r = X(t, "border-bottom-width");
39
39
  return t.clientHeight + e + r;
40
40
  }
41
- function Ut(t, e = {}) {
42
- const r = e.width || ce(t), n = e.height || le(t);
41
+ function _t(t, e = {}) {
42
+ const r = e.width || de(t), n = e.height || fe(t);
43
43
  return { width: r, height: n };
44
44
  }
45
- function ue() {
45
+ function he() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -52,7 +52,7 @@ function ue() {
52
52
  return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
53
  }
54
54
  const M = 16384;
55
- function de(t) {
55
+ function pe(t) {
56
56
  (t.width > M || t.height > M) && (t.width > M && t.height > M ? t.width > t.height ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M) : t.width > M ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M));
57
57
  }
58
58
  function Y(t) {
@@ -65,12 +65,12 @@ function Y(t) {
65
65
  }, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = t;
66
66
  });
67
67
  }
68
- async function fe(t) {
68
+ async function me(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 he(t, e, r) {
71
+ async function ye(t, e, r) {
72
72
  const n = "http://www.w3.org/2000/svg", i = document.createElementNS(n, "svg"), a = document.createElementNS(n, "foreignObject");
73
- return i.setAttribute("width", `${e}`), i.setAttribute("height", `${r}`), i.setAttribute("viewBox", `0 0 ${e} ${r}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(t), fe(i);
73
+ return i.setAttribute("width", `${e}`), i.setAttribute("height", `${r}`), i.setAttribute("viewBox", `0 0 ${e} ${r}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(t), me(i);
74
74
  }
75
75
  const C = (t, e) => {
76
76
  if (t instanceof e)
@@ -78,67 +78,67 @@ const C = (t, e) => {
78
78
  const r = Object.getPrototypeOf(t);
79
79
  return r === null ? !1 : r.constructor.name === e.name || C(r, e);
80
80
  };
81
- function pe(t) {
81
+ function ge(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function me(t, e) {
86
- return jt(e).map((r) => {
85
+ function we(t, e) {
86
+ return Vt(e).map((r) => {
87
87
  const n = t.getPropertyValue(r), i = t.getPropertyPriority(r);
88
88
  return `${r}: ${n}${i ? " !important" : ""};`;
89
89
  }).join(" ");
90
90
  }
91
- function ye(t, e, r, n) {
92
- const i = `.${t}:${e}`, a = r.cssText ? pe(r) : me(r, n);
91
+ function be(t, e, r, n) {
92
+ const i = `.${t}:${e}`, a = r.cssText ? ge(r) : we(r, n);
93
93
  return document.createTextNode(`${i}{${a}}`);
94
94
  }
95
- function Et(t, e, r, n) {
95
+ function Mt(t, e, r, n) {
96
96
  const i = window.getComputedStyle(t, r), a = i.getPropertyValue("content");
97
97
  if (a === "" || a === "none")
98
98
  return;
99
- const o = se();
99
+ const o = ue();
100
100
  try {
101
101
  e.className = `${e.className} ${o}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const s = document.createElement("style");
106
- s.appendChild(ye(o, r, i, n)), e.appendChild(s);
106
+ s.appendChild(be(o, r, i, n)), e.appendChild(s);
107
107
  }
108
- function ge(t, e, r) {
109
- Et(t, e, ":before", r), Et(t, e, ":after", r);
108
+ function ve(t, e, r) {
109
+ Mt(t, e, ":before", r), Mt(t, e, ":after", r);
110
110
  }
111
- const Ct = "application/font-woff", Mt = "image/jpeg", we = {
112
- woff: Ct,
113
- woff2: Ct,
111
+ const $t = "application/font-woff", Rt = "image/jpeg", xe = {
112
+ woff: $t,
113
+ woff2: $t,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: Mt,
118
- jpeg: Mt,
117
+ jpg: Rt,
118
+ jpeg: Rt,
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 be(t) {
124
+ function Se(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
- function wt(t) {
129
- const e = be(t).toLowerCase();
130
- return we[e] || "";
128
+ function vt(t) {
129
+ const e = Se(t).toLowerCase();
130
+ return xe[e] || "";
131
131
  }
132
- function ve(t) {
132
+ function Ee(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
- function ct(t) {
135
+ function ut(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function xe(t, e) {
138
+ function Ce(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
- async function Vt(t, e, r) {
141
+ async function Nt(t, e, r) {
142
142
  const n = await fetch(t, e);
143
143
  if (n.status === 404)
144
144
  throw new Error(`Resource "${n.url}" not found`);
@@ -154,86 +154,86 @@ async function Vt(t, e, r) {
154
154
  }, s.readAsDataURL(i);
155
155
  });
156
156
  }
157
- const at = {};
158
- function Se(t, e, r) {
157
+ const ot = {};
158
+ function Me(t, e, r) {
159
159
  let n = t.replace(/\?.*/, "");
160
160
  return r && (n = t), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), e ? `[${e}]${n}` : n;
161
161
  }
162
- async function bt(t, e, r) {
163
- const n = Se(t, e, r.includeQueryParams);
164
- if (at[n] != null)
165
- return at[n];
162
+ async function xt(t, e, r) {
163
+ const n = Me(t, e, r.includeQueryParams);
164
+ if (ot[n] != null)
165
+ return ot[n];
166
166
  r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
167
  let i;
168
168
  try {
169
- const a = await Vt(t, r.fetchRequestInit, ({ res: o, result: s }) => (e || (e = o.headers.get("Content-Type") || ""), ve(s)));
170
- i = xe(a, e);
169
+ const a = await Nt(t, r.fetchRequestInit, ({ res: o, result: s }) => (e || (e = o.headers.get("Content-Type") || ""), Ee(s)));
170
+ i = Ce(a, e);
171
171
  } catch (a) {
172
172
  i = r.imagePlaceholder || "";
173
173
  let o = `Failed to fetch resource: ${t}`;
174
174
  a && (o = typeof a == "string" ? a : a.message), o && console.warn(o);
175
175
  }
176
- return at[n] = i, i;
176
+ return ot[n] = i, i;
177
177
  }
178
- async function Ee(t) {
178
+ async function $e(t) {
179
179
  const e = t.toDataURL();
180
180
  return e === "data:," ? t.cloneNode(!1) : Y(e);
181
181
  }
182
- async function Ce(t, e) {
182
+ async function Re(t, e) {
183
183
  if (t.currentSrc) {
184
184
  const a = document.createElement("canvas"), o = a.getContext("2d");
185
185
  a.width = t.clientWidth, a.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, a.width, a.height);
186
186
  const s = a.toDataURL();
187
187
  return Y(s);
188
188
  }
189
- const r = t.poster, n = wt(r), i = await bt(r, n, e);
189
+ const r = t.poster, n = vt(r), i = await xt(r, n, e);
190
190
  return Y(i);
191
191
  }
192
- async function Me(t, e) {
192
+ async function Le(t, e) {
193
193
  var r;
194
194
  try {
195
195
  if (!((r = t == null ? void 0 : t.contentDocument) === null || r === void 0) && r.body)
196
- return await tt(t.contentDocument.body, e, !0);
196
+ return await et(t.contentDocument.body, e, !0);
197
197
  } catch {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function $e(t, e) {
202
- return C(t, HTMLCanvasElement) ? Ee(t) : C(t, HTMLVideoElement) ? Ce(t, e) : C(t, HTMLIFrameElement) ? Me(t, e) : t.cloneNode(Bt(t));
201
+ async function Pe(t, e) {
202
+ return C(t, HTMLCanvasElement) ? $e(t) : C(t, HTMLVideoElement) ? Re(t, e) : C(t, HTMLIFrameElement) ? Le(t, e) : t.cloneNode(Wt(t));
203
203
  }
204
- const Re = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Bt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Le(t, e, r) {
204
+ const Te = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Wt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function ke(t, e, r) {
206
206
  var n, i;
207
- if (Bt(e))
207
+ if (Wt(e))
208
208
  return e;
209
209
  let a = [];
210
- return Re(t) && t.assignedNodes ? a = j(t.assignedNodes()) : C(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? a = j(t.contentDocument.body.childNodes) : a = j(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || C(t, HTMLVideoElement) || await a.reduce((o, s) => o.then(() => tt(s, r)).then((l) => {
210
+ return Te(t) && t.assignedNodes ? a = j(t.assignedNodes()) : C(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? a = j(t.contentDocument.body.childNodes) : a = j(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || C(t, HTMLVideoElement) || await a.reduce((o, s) => o.then(() => et(s, r)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function Pe(t, e, r) {
214
+ function Ae(t, e, r) {
215
215
  const n = e.style;
216
216
  if (!n)
217
217
  return;
218
218
  const i = window.getComputedStyle(t);
219
- i.cssText ? (n.cssText = i.cssText, n.transformOrigin = i.transformOrigin) : jt(r).forEach((a) => {
219
+ i.cssText ? (n.cssText = i.cssText, n.transformOrigin = i.transformOrigin) : Vt(r).forEach((a) => {
220
220
  let o = i.getPropertyValue(a);
221
221
  a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), C(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), n.setProperty(a, o, i.getPropertyPriority(a));
222
222
  });
223
223
  }
224
- function ke(t, e) {
224
+ function Ie(t, e) {
225
225
  C(t, HTMLTextAreaElement) && (e.innerHTML = t.value), C(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function Te(t, e) {
227
+ function De(t, e) {
228
228
  if (C(t, HTMLSelectElement)) {
229
229
  const n = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
230
230
  n && n.setAttribute("selected", "");
231
231
  }
232
232
  }
233
- function Ae(t, e, r) {
234
- return C(e, Element) && (Pe(t, e, r), ge(t, e, r), ke(t, e), Te(t, e)), e;
233
+ function Fe(t, e, r) {
234
+ return C(e, Element) && (Ae(t, e, r), ve(t, e, r), Ie(t, e), De(t, e)), e;
235
235
  }
236
- async function Ie(t, e) {
236
+ async function Oe(t, e) {
237
237
  const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
238
238
  if (r.length === 0)
239
239
  return t;
@@ -242,7 +242,7 @@ async function Ie(t, e) {
242
242
  const s = r[a].getAttribute("xlink:href");
243
243
  if (s) {
244
244
  const l = t.querySelector(s), v = document.querySelector(s);
245
- !l && v && !n[s] && (n[s] = await tt(v, e, !0));
245
+ !l && v && !n[s] && (n[s] = await et(v, e, !0));
246
246
  }
247
247
  }
248
248
  const i = Object.values(n);
@@ -257,31 +257,31 @@ async function Ie(t, e) {
257
257
  }
258
258
  return t;
259
259
  }
260
- async function tt(t, e, r) {
261
- return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => $e(n, e)).then((n) => Le(t, n, e)).then((n) => Ae(t, n, e)).then((n) => Ie(n, e));
260
+ async function et(t, e, r) {
261
+ return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => Pe(n, e)).then((n) => ke(t, n, e)).then((n) => Fe(t, n, e)).then((n) => Oe(n, e));
262
262
  }
263
- const _t = /url\((['"]?)([^'"]+?)\1\)/g, De = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Fe = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function Oe(t) {
263
+ const qt = /url\((['"]?)([^'"]+?)\1\)/g, He = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, je = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function Ue(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function He(t) {
268
+ function Be(t) {
269
269
  const e = [];
270
- return t.replace(_t, (r, n, i) => (e.push(i), r)), e.filter((r) => !ct(r));
270
+ return t.replace(qt, (r, n, i) => (e.push(i), r)), e.filter((r) => !ut(r));
271
271
  }
272
- async function je(t, e, r, n, i) {
272
+ async function Ve(t, e, r, n, i) {
273
273
  try {
274
- const a = r ? oe(e, r) : e, o = wt(e);
274
+ const a = r ? le(e, r) : e, o = vt(e);
275
275
  let s;
276
- return i || (s = await bt(a, o, n)), t.replace(Oe(e), `$1${s}$3`);
276
+ return i || (s = await xt(a, o, n)), t.replace(Ue(e), `$1${s}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function Ue(t, { preferredFontFormat: e }) {
282
- return e ? t.replace(Fe, (r) => {
281
+ function _e(t, { preferredFontFormat: e }) {
282
+ return e ? t.replace(je, (r) => {
283
283
  for (; ; ) {
284
- const [n, , i] = De.exec(r) || [];
284
+ const [n, , i] = He.exec(r) || [];
285
285
  if (!i)
286
286
  return "";
287
287
  if (i === e)
@@ -289,32 +289,32 @@ function Ue(t, { preferredFontFormat: e }) {
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function Nt(t) {
293
- return t.search(_t) !== -1;
292
+ function zt(t) {
293
+ return t.search(qt) !== -1;
294
294
  }
295
- async function Wt(t, e, r) {
296
- if (!Nt(t))
295
+ async function Kt(t, e, r) {
296
+ if (!zt(t))
297
297
  return t;
298
- const n = Ue(t, r);
299
- return He(n).reduce((a, o) => a.then((s) => je(s, o, e, r)), Promise.resolve(n));
298
+ const n = _e(t, r);
299
+ return Be(n).reduce((a, o) => a.then((s) => Ve(s, o, e, r)), Promise.resolve(n));
300
300
  }
301
301
  async function N(t, e, r) {
302
302
  var n;
303
303
  const i = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
304
304
  if (i) {
305
- const a = await Wt(i, null, r);
305
+ const a = await Kt(i, null, r);
306
306
  return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
307
307
  }
308
308
  return !1;
309
309
  }
310
- async function Ve(t, e) {
310
+ async function Ne(t, e) {
311
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
312
  }
313
- async function Be(t, e) {
313
+ async function We(t, e) {
314
314
  const r = C(t, HTMLImageElement);
315
- if (!(r && !ct(t.src)) && !(C(t, SVGImageElement) && !ct(t.href.baseVal)))
315
+ if (!(r && !ut(t.src)) && !(C(t, SVGImageElement) && !ut(t.href.baseVal)))
316
316
  return;
317
- const n = r ? t.src : t.href.baseVal, i = await bt(n, wt(n), e);
317
+ const n = r ? t.src : t.href.baseVal, i = await xt(n, vt(n), e);
318
318
  await new Promise((a, o) => {
319
319
  t.onload = a, t.onerror = e.onImageErrorHandler ? (...l) => {
320
320
  try {
@@ -327,14 +327,14 @@ async function Be(t, e) {
327
327
  s.decode && (s.decode = a), s.loading === "lazy" && (s.loading = "eager"), r ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
328
328
  });
329
329
  }
330
- async function _e(t, e) {
331
- const n = j(t.childNodes).map((i) => qt(i, e));
330
+ async function qe(t, e) {
331
+ const n = j(t.childNodes).map((i) => Xt(i, e));
332
332
  await Promise.all(n).then(() => t);
333
333
  }
334
- async function qt(t, e) {
335
- C(t, Element) && (await Ve(t, e), await Be(t, e), await _e(t, e));
334
+ async function Xt(t, e) {
335
+ C(t, Element) && (await Ne(t, e), await We(t, e), await qe(t, e));
336
336
  }
337
- function Ne(t, e) {
337
+ function ze(t, e) {
338
338
  const { style: r } = t;
339
339
  e.backgroundColor && (r.backgroundColor = e.backgroundColor), e.width && (r.width = `${e.width}px`), e.height && (r.height = `${e.height}px`);
340
340
  const n = e.style;
@@ -342,23 +342,23 @@ function Ne(t, e) {
342
342
  r[i] = n[i];
343
343
  }), t;
344
344
  }
345
- const $t = {};
346
- async function Rt(t) {
347
- let e = $t[t];
345
+ const Lt = {};
346
+ async function Pt(t) {
347
+ let e = Lt[t];
348
348
  if (e != null)
349
349
  return e;
350
350
  const n = await (await fetch(t)).text();
351
- return e = { url: t, cssText: n }, $t[t] = e, e;
351
+ return e = { url: t, cssText: n }, Lt[t] = e, e;
352
352
  }
353
- async function Lt(t, e) {
353
+ async function Tt(t, e) {
354
354
  let r = t.cssText;
355
355
  const n = /url\(["']?([^"')]+)["']?\)/g, a = (r.match(/url\([^)]+\)/g) || []).map(async (o) => {
356
356
  let s = o.replace(n, "$1");
357
- return s.startsWith("https://") || (s = new URL(s, t.url).href), Vt(s, e.fetchRequestInit, ({ result: l }) => (r = r.replace(o, `url(${l})`), [o, l]));
357
+ return s.startsWith("https://") || (s = new URL(s, t.url).href), Nt(s, e.fetchRequestInit, ({ result: l }) => (r = r.replace(o, `url(${l})`), [o, l]));
358
358
  });
359
359
  return Promise.all(a).then(() => r);
360
360
  }
361
- function Pt(t) {
361
+ function kt(t) {
362
362
  if (t == null)
363
363
  return [];
364
364
  const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
@@ -384,7 +384,7 @@ function Pt(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function We(t, e) {
387
+ async function Ke(t, e) {
388
388
  const r = [], n = [];
389
389
  return t.forEach((i) => {
390
390
  if ("cssRules" in i)
@@ -392,7 +392,7 @@ async function We(t, e) {
392
392
  j(i.cssRules || []).forEach((a, o) => {
393
393
  if (a.type === CSSRule.IMPORT_RULE) {
394
394
  let s = o + 1;
395
- const l = a.href, v = Rt(l).then((y) => Lt(y, e)).then((y) => Pt(y).forEach((p) => {
395
+ const l = a.href, v = Pt(l).then((y) => Tt(y, e)).then((y) => kt(y).forEach((p) => {
396
396
  try {
397
397
  i.insertRule(p, p.startsWith("@import") ? s += 1 : i.cssRules.length);
398
398
  } catch (g) {
@@ -409,7 +409,7 @@ async function We(t, e) {
409
409
  });
410
410
  } catch (a) {
411
411
  const o = t.find((s) => s.href == null) || document.styleSheets[0];
412
- i.href != null && n.push(Rt(i.href).then((s) => Lt(s, e)).then((s) => Pt(s).forEach((l) => {
412
+ i.href != null && n.push(Pt(i.href).then((s) => Tt(s, e)).then((s) => kt(s).forEach((l) => {
413
413
  o.insertRule(l, o.cssRules.length);
414
414
  })).catch((s) => {
415
415
  console.error("Error loading remote stylesheet", s);
@@ -426,56 +426,60 @@ async function We(t, e) {
426
426
  }
427
427
  }), r));
428
428
  }
429
- function qe(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Nt(e.style.getPropertyValue("src")));
429
+ function Xe(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => zt(e.style.getPropertyValue("src")));
431
431
  }
432
- async function ze(t, e) {
432
+ async function Ye(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const r = j(t.ownerDocument.styleSheets), n = await We(r, e);
436
- return qe(n);
435
+ const r = j(t.ownerDocument.styleSheets), n = await Ke(r, e);
436
+ return Xe(n);
437
437
  }
438
- function zt(t) {
438
+ function Yt(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function Ke(t) {
441
+ function Ge(t) {
442
442
  const e = /* @__PURE__ */ new Set();
443
443
  function r(n) {
444
444
  (n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((a) => {
445
- e.add(zt(a));
445
+ e.add(Yt(a));
446
446
  }), Array.from(n.children).forEach((a) => {
447
447
  a instanceof HTMLElement && r(a);
448
448
  });
449
449
  }
450
450
  return r(t), e;
451
451
  }
452
- async function Xe(t, e) {
453
- const r = await ze(t, e), n = Ke(t);
454
- return (await Promise.all(r.filter((a) => n.has(zt(a.style.fontFamily))).map((a) => {
452
+ async function Je(t, e) {
453
+ const r = await Ye(t, e), n = Ge(t);
454
+ return (await Promise.all(r.filter((a) => n.has(Yt(a.style.fontFamily))).map((a) => {
455
455
  const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
456
- return Wt(a.cssText, o, e);
456
+ return Kt(a.cssText, o, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function Ye(t, e) {
461
- const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Xe(t, e);
460
+ async function Ze(t, e) {
461
+ const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Je(t, e);
462
462
  if (r) {
463
463
  const n = document.createElement("style"), i = document.createTextNode(r);
464
464
  n.appendChild(i), t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n);
465
465
  }
466
466
  }
467
- async function Ge(t, e = {}) {
468
- const { width: r, height: n } = Ut(t, e), i = await tt(t, e, !0);
469
- return await Ye(i, e), await qt(i, e), Ne(i, e), await he(i, r, n);
467
+ async function Qe(t, e = {}) {
468
+ const { width: r, height: n } = _t(t, e), i = await et(t, e, !0);
469
+ return await Ze(i, e), await Xt(i, e), ze(i, e), await ye(i, r, n);
470
+ }
471
+ async function tn(t, e = {}) {
472
+ const { width: r, height: n } = _t(t, e), i = await Qe(t, e), a = await Y(i), o = document.createElement("canvas"), s = o.getContext("2d"), l = e.pixelRatio || he(), v = e.canvasWidth || r, y = e.canvasHeight || n;
473
+ return o.width = v * l, o.height = y * l, e.skipAutoScale || pe(o), o.style.width = `${v}`, o.style.height = `${y}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(a, 0, 0, o.width, o.height), o;
470
474
  }
471
- async function Je(t, e = {}) {
472
- const { width: r, height: n } = Ut(t, e), i = await Ge(t, e), a = await Y(i), o = document.createElement("canvas"), s = o.getContext("2d"), l = e.pixelRatio || ue(), v = e.canvasWidth || r, y = e.canvasHeight || n;
473
- return o.width = v * l, o.height = y * l, e.skipAutoScale || de(o), o.style.width = `${v}`, o.style.height = `${y}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(a, 0, 0, o.width, o.height), o;
475
+ async function en(t, e = {}) {
476
+ return (await tn(t, e)).toDataURL();
474
477
  }
475
- async function Ze(t, e = {}) {
476
- return (await Je(t, e)).toDataURL();
478
+ const G = "data-nf-capture-chrome";
479
+ function nn(t) {
480
+ return t instanceof Element && (t.hasAttribute(G) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
477
481
  }
478
- function Qe() {
482
+ function rn() {
479
483
  const t = [];
480
484
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((r) => {
481
485
  const n = r.getBoundingClientRect(), i = document.createElement("div");
@@ -491,22 +495,32 @@ function Qe() {
491
495
  ].join(";"), document.body.appendChild(i), t.push(i);
492
496
  }), () => t.forEach((r) => r.remove());
493
497
  }
494
- async function tn() {
495
- const t = document.getElementById("notefully"), e = t ? t.style.display : "";
498
+ function an() {
499
+ const t = document.querySelector(`[${G}]`);
500
+ if (t)
501
+ return t;
502
+ const e = document.createElement("div");
503
+ return e.setAttribute(G, "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
+ }
505
+ function on() {
506
+ document.querySelectorAll(`[${G}]`).forEach((t) => t.remove());
507
+ }
508
+ async function sn() {
509
+ const t = document.getElementById("notefully"), e = t ? t.style.display : "", r = an();
496
510
  t && (t.style.display = "none");
497
- const r = Qe();
498
- await new Promise((n) => requestAnimationFrame(() => requestAnimationFrame(n)));
511
+ const n = rn();
512
+ await new Promise((i) => requestAnimationFrame(() => requestAnimationFrame(i)));
499
513
  try {
500
- return await Ze(document.body, {
514
+ return await en(document.body, {
501
515
  cacheBust: !0,
502
516
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
503
- filter: (n) => n instanceof Element ? n.id !== "notefully" && !n.hasAttribute("data-nf-mask-cover") : !0
517
+ filter: (i) => !nn(i)
504
518
  });
505
519
  } finally {
506
- r(), t && (t.style.display = e);
520
+ n(), r.remove(), on(), t && (t.style.display = e);
507
521
  }
508
522
  }
509
- function en(t = {}) {
523
+ function cn(t = {}) {
510
524
  return {
511
525
  url: location.href,
512
526
  title: document.title,
@@ -525,11 +539,11 @@ function en(t = {}) {
525
539
  }
526
540
  };
527
541
  }
528
- const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
542
+ const At = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), It = {
529
543
  id: "userId",
530
544
  username: "displayName",
531
545
  name: "displayName"
532
- }, At = /* @__PURE__ */ new Set([
546
+ }, Dt = /* @__PURE__ */ new Set([
533
547
  "endpoint",
534
548
  "projectKey",
535
549
  "version",
@@ -538,7 +552,7 @@ const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
538
552
  "hideLauncher",
539
553
  "theme",
540
554
  "video"
541
- ]), It = {
555
+ ]), Ft = {
542
556
  slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
543
557
  projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
544
558
  project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
@@ -547,14 +561,14 @@ const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
547
561
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
548
562
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
549
563
  };
550
- function nn(t = {}, e = {}) {
551
- const r = e.warn || Kt, n = t && typeof t == "object" ? t : {}, i = {}, a = [];
552
- for (const o of kt)
564
+ function ln(t = {}, e = {}) {
565
+ const r = e.warn || Gt, n = t && typeof t == "object" ? t : {}, i = {}, a = [];
566
+ for (const o of At)
553
567
  Object.prototype.hasOwnProperty.call(n, o) && (i[o] = n[o]);
554
- for (const [o, s] of Object.entries(Tt))
568
+ for (const [o, s] of Object.entries(It))
555
569
  Object.prototype.hasOwnProperty.call(n, o) && (Object.prototype.hasOwnProperty.call(i, s) || (i[s] = n[o]));
556
570
  for (const o of Object.keys(n))
557
- kt.has(o) || Object.prototype.hasOwnProperty.call(Tt, o) || a.push(o);
571
+ At.has(o) || Object.prototype.hasOwnProperty.call(It, o) || a.push(o);
558
572
  if (a.length) {
559
573
  const o = a.some((s) => s === "name" || s === "slug" || s === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
560
574
  r(
@@ -563,24 +577,24 @@ function nn(t = {}, e = {}) {
563
577
  }
564
578
  return i;
565
579
  }
566
- function rn(t = {}, e = {}) {
567
- const r = e.warn || Kt, n = t && typeof t == "object" ? t : {}, i = Object.keys(n).filter((a) => !At.has(a));
580
+ function un(t = {}, e = {}) {
581
+ const r = e.warn || Gt, n = t && typeof t == "object" ? t : {}, i = Object.keys(n).filter((a) => !Dt.has(a));
568
582
  if (i.length)
569
583
  for (const a of i) {
570
- if (It[a]) {
571
- r(`Notefully.init: ignoring "${a}". ${It[a]}`);
584
+ if (Ft[a]) {
585
+ r(`Notefully.init: ignoring "${a}". ${Ft[a]}`);
572
586
  continue;
573
587
  }
574
588
  r(
575
- `Notefully.init: ignoring unknown key "${a}". Supported: ${[...At].join(", ")}.`
589
+ `Notefully.init: ignoring unknown key "${a}". Supported: ${[...Dt].join(", ")}.`
576
590
  );
577
591
  }
578
592
  }
579
- function Kt(t) {
593
+ function Gt(t) {
580
594
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
581
595
  }
582
- const an = 80;
583
- function on() {
596
+ const dn = 80;
597
+ function fn() {
584
598
  const t = [], e = {};
585
599
  let r = !1;
586
600
  const n = (a, o) => {
@@ -594,7 +608,7 @@ function on() {
594
608
  level: a,
595
609
  text: s.slice(0, 2e3),
596
610
  at: Date.now()
597
- }), t.length > an && t.shift();
611
+ }), t.length > dn && t.shift();
598
612
  };
599
613
  return {
600
614
  hook: () => {
@@ -613,7 +627,7 @@ function on() {
613
627
  }
614
628
  };
615
629
  }
616
- function sn(t) {
630
+ function hn(t) {
617
631
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
618
632
  let r = null, n = !1;
619
633
  const i = () => {
@@ -643,8 +657,8 @@ function sn(t) {
643
657
  isActive: () => n
644
658
  };
645
659
  }
646
- const cn = 60 * 1e3;
647
- function ln({ onStart: t, onStop: e, onError: r }) {
660
+ const pn = 60 * 1e3;
661
+ function mn({ onStart: t, onStop: e, onError: r }) {
648
662
  let n = null, i = null, a = [], o = null;
649
663
  const s = () => {
650
664
  if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
@@ -676,10 +690,10 @@ function ln({ onStart: t, onStop: e, onError: r }) {
676
690
  }, i.onstop = () => {
677
691
  const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
678
692
  s(), e(g);
679
- }, (p = n.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, cn);
693
+ }, (p = n.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, pn);
680
694
  }, stop: l };
681
695
  }
682
- function un() {
696
+ function yn() {
683
697
  const t = /* @__PURE__ */ new Set();
684
698
  return {
685
699
  alloc() {
@@ -697,19 +711,19 @@ function un() {
697
711
  }
698
712
  };
699
713
  }
700
- const ot = { x: 0, y: 0, w: 1, h: 1 };
701
- function Xt() {
702
- const t = un();
703
- let e = [], r = { ...ot }, n = 1;
714
+ const st = { x: 0, y: 0, w: 1, h: 1 };
715
+ function Jt() {
716
+ const t = yn();
717
+ let e = [], r = { ...st }, n = 1;
704
718
  return {
705
- list: () => e.filter((a) => fn(a, r)),
719
+ list: () => e.filter((a) => wn(a, r)),
706
720
  all: () => e.slice(),
707
721
  crop: () => ({ ...r }),
708
722
  setCrop(a) {
709
- return r = dn(a), r;
723
+ return r = gn(a), r;
710
724
  },
711
725
  resetCrop() {
712
- return r = { ...ot }, r;
726
+ return r = { ...st }, r;
713
727
  },
714
728
  isCropped() {
715
729
  return r.x > 1e-6 || r.y > 1e-6 || r.w < 1 - 1e-6 || r.h < 1 - 1e-6;
@@ -741,20 +755,20 @@ function Xt() {
741
755
  return t.free(s.number), s;
742
756
  },
743
757
  reset() {
744
- for (e = [], r = { ...ot }, n = 1; t.peekUsed().length; )
758
+ for (e = [], r = { ...st }, n = 1; t.peekUsed().length; )
745
759
  t.free(t.peekUsed()[0]);
746
760
  }
747
761
  };
748
762
  }
749
- function dn(t) {
763
+ function gn(t) {
750
764
  const e = Math.min(Math.max(t.x, 0), 0.95), r = Math.min(Math.max(t.y, 0), 0.95), n = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - r);
751
765
  return { x: e, y: r, w: n, h: i };
752
766
  }
753
- function fn(t, e) {
767
+ function wn(t, e) {
754
768
  const r = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, n = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
755
769
  return r >= e.x && n >= e.y && r <= e.x + e.w && n <= e.y + e.h;
756
770
  }
757
- function hn(t, e, r, n = {}) {
771
+ function bn(t, e, r, n = {}) {
758
772
  const i = n.mark || "#fdd341", a = n.markText || "#2a2140";
759
773
  return new Promise((o, s) => {
760
774
  const l = new Image();
@@ -763,17 +777,17 @@ function hn(t, e, r, n = {}) {
763
777
  P.width = p, P.height = g;
764
778
  const f = P.getContext("2d");
765
779
  f.drawImage(l, v, y, p, g, 0, 0, p, g), f.lineWidth = Math.max(3, Math.round(p / 400)), f.strokeStyle = i, f.fillStyle = i, f.font = `700 ${Math.max(14, Math.round(p / 40))}px sans-serif`, r.forEach((m) => {
766
- const k = lt(m.x, e, p), T = ut(m.y, e, g), A = m.w / e.w * p, U = m.h / e.h * g;
780
+ const T = dt(m.x, e, p), k = ft(m.y, e, g), A = m.w / e.w * p, U = m.h / e.h * g;
767
781
  if (m.type === "rect")
768
- f.strokeRect(k, T, A, U);
782
+ f.strokeRect(T, k, A, U);
769
783
  else if (m.type === "circle")
770
- f.beginPath(), f.ellipse(k + A / 2, T + U / 2, A / 2, U / 2, 0, 0, Math.PI * 2), f.stroke();
784
+ f.beginPath(), f.ellipse(T + A / 2, k + U / 2, A / 2, U / 2, 0, 0, Math.PI * 2), f.stroke();
771
785
  else if (m.type === "arrow") {
772
- const ie = lt(m.x2 ?? m.x + m.w, e, p), ae = ut(m.y2 ?? m.y, e, g);
773
- mn(f, k, T, ie, ae);
786
+ const se = dt(m.x2 ?? m.x + m.w, e, p), ce = ft(m.y2 ?? m.y, e, g);
787
+ xn(f, T, k, se, ce);
774
788
  }
775
- const V = pn(m, e, p, g, k, T, A), I = String(m.number);
776
- f.beginPath(), f.arc(V.x, V.y, 11, 0, Math.PI * 2), f.fill(), f.fillStyle = a, f.textAlign = "center", f.textBaseline = "middle", f.fillText(I, V.x, V.y), f.fillStyle = i;
789
+ const B = vn(m, e, p, g, T, k, A), I = String(m.number);
790
+ f.beginPath(), f.arc(B.x, B.y, 11, 0, Math.PI * 2), f.fill(), f.fillStyle = a, f.textAlign = "center", f.textBaseline = "middle", f.fillText(I, B.x, B.y), f.fillStyle = i;
777
791
  }), P.toBlob((m) => {
778
792
  if (!m) {
779
793
  s(new Error("Could not encode screenshot"));
@@ -784,15 +798,15 @@ function hn(t, e, r, n = {}) {
784
798
  }, l.onerror = () => s(new Error("Could not load screenshot")), l.src = t;
785
799
  });
786
800
  }
787
- function lt(t, e, r) {
801
+ function dt(t, e, r) {
788
802
  return (t - e.x) / e.w * r;
789
803
  }
790
- function ut(t, e, r) {
804
+ function ft(t, e, r) {
791
805
  return (t - e.y) / e.h * r;
792
806
  }
793
- function pn(t, e, r, n, i, a, o) {
807
+ function vn(t, e, r, n, i, a, o) {
794
808
  if (t.type === "arrow") {
795
- const s = lt(t.x2 ?? t.x + t.w, e, r), l = ut(t.y2 ?? t.y, e, n);
809
+ const s = dt(t.x2 ?? t.x + t.w, e, r), l = ft(t.y2 ?? t.y, e, n);
796
810
  return {
797
811
  x: (i + s) / 2,
798
812
  y: (a + l) / 2
@@ -800,11 +814,11 @@ function pn(t, e, r, n, i, a, o) {
800
814
  }
801
815
  return { x: i + o / 2, y: a };
802
816
  }
803
- function mn(t, e, r, n, i) {
817
+ function xn(t, e, r, n, i) {
804
818
  const a = Math.atan2(i - r, n - e), o = 14, s = 2, l = n - Math.cos(a) * s, v = i - Math.sin(a) * s;
805
819
  t.beginPath(), t.moveTo(e, r), t.lineTo(l, v), t.stroke(), t.beginPath(), t.moveTo(n, i), t.lineTo(n - o * Math.cos(a - 0.4), i - o * Math.sin(a - 0.4)), t.lineTo(n - o * Math.cos(a + 0.4), i - o * Math.sin(a + 0.4)), t.closePath(), t.fill();
806
820
  }
807
- const yn = ["bug", "idea", "other"], gn = ["maker", "all-business", "brighter-day", "quiet-night"], Yt = "maker", wn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), dt = 0.02, Dt = 0.05, bn = `
821
+ const Sn = ["bug", "idea", "other"], En = ["maker", "all-business", "brighter-day", "quiet-night"], Zt = "maker", Cn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), ht = 0.02, Ot = 0.05, Mn = `
808
822
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
809
823
  <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"/>
810
824
  <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"/>
@@ -822,8 +836,8 @@ const F = {
822
836
  discard: D('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
823
837
  audio: D('<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"/>'),
824
838
  video: D('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
825
- }, Gt = on();
826
- Gt.hook();
839
+ }, Qt = fn();
840
+ Qt.hook();
827
841
  let d = {
828
842
  endpoint: "",
829
843
  projectKey: "",
@@ -831,17 +845,17 @@ let d = {
831
845
  name: "",
832
846
  targets: null,
833
847
  hideLauncher: !1,
834
- theme: Yt,
848
+ theme: Zt,
835
849
  video: !1
836
- }, ft = {}, u = null, c = {}, h = Xt(), S = "", q = "", L = null, G = "bug", H = null, R = null, b = null, w = null, K = null, B = null, W = null, O = { w: 0, h: 0 };
837
- function E(t) {
850
+ }, pt = {}, u = null, c = {}, h = Jt(), E = "", q = "", L = null, J = "bug", H = null, R = null, b = null, w = null, K = null, V = null, W = null, O = { w: 0, h: 0 }, ct = !1;
851
+ function S(t) {
838
852
  return u.querySelector(t);
839
853
  }
840
- function Jt(t) {
854
+ function te(t) {
841
855
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
842
- return gn.includes(e) ? e : Yt;
856
+ return En.includes(e) ? e : Zt;
843
857
  }
844
- function Ft(t, e) {
858
+ function Ht(t, e) {
845
859
  return u && getComputedStyle(u).getPropertyValue(t).trim() || e;
846
860
  }
847
861
  function x(t, e = !1) {
@@ -849,9 +863,9 @@ function x(t, e = !1) {
849
863
  c.status.textContent = "";
850
864
  }, 4e3)));
851
865
  }
852
- function vt() {
866
+ function St() {
853
867
  return u && document.body.contains(u) || (u = document.createElement("div"), u.id = "notefully", u.innerHTML = `
854
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${bn}</button>
868
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Mn}</button>
855
869
  <div class="nf-dialog" hidden>
856
870
  <div class="nf-panel">
857
871
  <div class="nf-stage">
@@ -882,107 +896,108 @@ function vt() {
882
896
  </div>
883
897
  <button class="nf-stop-video" type="button" hidden>Stop</button>
884
898
  `, document.body.appendChild(u), c = {
885
- launcher: E(".nf-launcher"),
886
- dialog: E(".nf-dialog"),
887
- stage: E(".nf-stage"),
888
- canvas: E(".nf-canvas"),
889
- text: E(".nf-text"),
890
- restore: E(".nf-restore"),
891
- status: E(".nf-status"),
892
- audio: E(".nf-audio"),
893
- video: E(".nf-video"),
894
- discard: E(".nf-discard-shot"),
895
- stop: E(".nf-stop-video"),
896
- resetCrop: E(".nf-reset-crop"),
899
+ launcher: S(".nf-launcher"),
900
+ dialog: S(".nf-dialog"),
901
+ stage: S(".nf-stage"),
902
+ canvas: S(".nf-canvas"),
903
+ text: S(".nf-text"),
904
+ restore: S(".nf-restore"),
905
+ status: S(".nf-status"),
906
+ audio: S(".nf-audio"),
907
+ video: S(".nf-video"),
908
+ discard: S(".nf-discard-shot"),
909
+ stop: S(".nf-stop-video"),
910
+ resetCrop: S(".nf-reset-crop"),
911
+ submit: S(".nf-submit"),
897
912
  shot: null
898
- }, vn(), et()), u;
913
+ }, $n(), nt()), u;
899
914
  }
900
- function et() {
915
+ function nt() {
901
916
  var t;
902
- u && (u.dataset.theme = Jt(d.theme), d.hideLauncher ? u.setAttribute("data-nf-hidden-launcher", "") : u.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !d.video), (t = c.dialog) != null && t.hidden && J());
917
+ u && (u.dataset.theme = te(d.theme), d.hideLauncher ? u.setAttribute("data-nf-hidden-launcher", "") : u.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !d.video), (t = c.dialog) != null && t.hidden && Z());
903
918
  }
904
- function J() {
919
+ function Z() {
905
920
  c.launcher && (c.launcher.hidden = !!d.hideLauncher);
906
921
  }
907
- function vn() {
908
- c.launcher.addEventListener("click", () => ee()), E(".nf-dialog").addEventListener("click", (t) => {
909
- t.target === c.dialog && it();
922
+ function $n() {
923
+ c.launcher.addEventListener("click", () => ie()), S(".nf-dialog").addEventListener("click", (t) => {
924
+ t.target === c.dialog && at();
910
925
  }), u.querySelectorAll(".nf-tool").forEach((t) => {
911
- t.addEventListener("click", () => pt(t.dataset.tool));
912
- }), c.resetCrop.addEventListener("click", Rn), c.canvas.addEventListener("pointerdown", Sn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), u.querySelectorAll("[data-kind]").forEach((t) => {
913
- t.addEventListener("click", () => ht(t.dataset.kind));
914
- }), c.discard.addEventListener("click", Ln), c.restore.addEventListener("click", Pn), c.audio.addEventListener("click", kn), c.video.addEventListener("click", Tn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), E(".nf-submit").addEventListener("click", () => {
915
- ne().catch((t) => x(t.message || "Submit failed."));
916
- }), ht("bug"), pt(null);
917
- }
918
- function ht(t) {
919
- G = yn.includes(t) ? t : "bug", u.querySelectorAll("[data-kind]").forEach((e) => {
920
- e.dataset.active = String(e.dataset.kind === G);
926
+ t.addEventListener("click", () => yt(t.dataset.tool));
927
+ }), c.resetCrop.addEventListener("click", In), c.canvas.addEventListener("pointerdown", Ln), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), u.querySelectorAll("[data-kind]").forEach((t) => {
928
+ t.addEventListener("click", () => mt(t.dataset.kind));
929
+ }), c.discard.addEventListener("click", Dn), c.restore.addEventListener("click", Fn), c.audio.addEventListener("click", On), c.video.addEventListener("click", Hn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), S(".nf-submit").addEventListener("click", () => {
930
+ ae().catch((t) => x(t.message || "Submit failed."));
931
+ }), mt("bug"), yt(null);
932
+ }
933
+ function mt(t) {
934
+ J = Sn.includes(t) ? t : "bug", u.querySelectorAll("[data-kind]").forEach((e) => {
935
+ e.dataset.active = String(e.dataset.kind === J);
921
936
  });
922
937
  }
923
- function pt(t) {
924
- H = wn.has(t) ? t : null, R = null, u.querySelectorAll(".nf-tool").forEach((e) => {
938
+ function yt(t) {
939
+ H = Cn.has(t) ? t : null, R = null, u.querySelectorAll(".nf-tool").forEach((e) => {
925
940
  e.dataset.active = String(e.dataset.tool === H);
926
- }), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), S && $();
941
+ }), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), E && $();
927
942
  }
928
- function Ot(t) {
943
+ function jt(t) {
929
944
  return Math.min(1, Math.max(0, t));
930
945
  }
931
- function nt() {
946
+ function rt() {
932
947
  return c.shot || c.canvas;
933
948
  }
934
- function Z(t) {
935
- const e = nt().getBoundingClientRect();
949
+ function Q(t) {
950
+ const e = rt().getBoundingClientRect();
936
951
  return {
937
- x: Ot((t.clientX - e.left) / Math.max(e.width, 1)),
938
- y: Ot((t.clientY - e.top) / Math.max(e.height, 1))
952
+ x: jt((t.clientX - e.left) / Math.max(e.width, 1)),
953
+ y: jt((t.clientY - e.top) / Math.max(e.height, 1))
939
954
  };
940
955
  }
941
- function xn(t) {
942
- const e = nt().getBoundingClientRect();
956
+ function Rn(t) {
957
+ const e = rt().getBoundingClientRect();
943
958
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
944
959
  }
945
- function Zt(t) {
946
- const e = Z(t), r = h.crop();
960
+ function ee(t) {
961
+ const e = Q(t), r = h.crop();
947
962
  return {
948
963
  x: r.x + e.x * r.w,
949
964
  y: r.y + e.y * r.h
950
965
  };
951
966
  }
952
- function rt(t, e) {
967
+ function it(t, e) {
953
968
  const r = Math.min(t.x, e.x), n = Math.min(t.y, e.y);
954
969
  return {
955
970
  x: r,
956
971
  y: n,
957
- w: Math.max(dt, Math.abs(e.x - t.x)),
958
- h: Math.max(dt, Math.abs(e.y - t.y))
972
+ w: Math.max(ht, Math.abs(e.x - t.x)),
973
+ h: Math.max(ht, Math.abs(e.y - t.y))
959
974
  };
960
975
  }
961
- function xt(t) {
976
+ function Et(t) {
962
977
  u && (t ? u.dataset.grabbing = "true" : delete u.dataset.grabbing);
963
978
  }
964
- function st(t) {
979
+ function lt(t) {
965
980
  try {
966
981
  c.canvas.setPointerCapture(t.pointerId);
967
982
  } catch {
968
983
  }
969
984
  }
970
- function mt() {
971
- window.addEventListener("pointermove", te), window.addEventListener("pointerup", Q), window.addEventListener("pointercancel", Q);
985
+ function gt() {
986
+ window.addEventListener("pointermove", re), window.addEventListener("pointerup", tt), window.addEventListener("pointercancel", tt);
972
987
  }
973
- function Qt() {
974
- window.removeEventListener("pointermove", te), window.removeEventListener("pointerup", Q), window.removeEventListener("pointercancel", Q);
988
+ function ne() {
989
+ window.removeEventListener("pointermove", re), window.removeEventListener("pointerup", tt), window.removeEventListener("pointercancel", tt);
975
990
  }
976
- function Sn(t) {
977
- if (t.button !== 0 || !S)
991
+ function Ln(t) {
992
+ if (t.button !== 0 || !E)
978
993
  return;
979
- if (!t.target.closest(".nf-sticker") && !xn(t)) {
994
+ if (!t.target.closest(".nf-sticker") && !Rn(t)) {
980
995
  R = null, $();
981
996
  return;
982
997
  }
983
998
  const e = t.target.closest(".nf-handle"), r = t.target.closest(".nf-sticker");
984
999
  if (r && r.dataset.preview !== "true") {
985
- t.preventDefault(), t.stopPropagation(), R = r.dataset.id, st(t), En({
1000
+ t.preventDefault(), t.stopPropagation(), R = r.dataset.id, lt(t), Pn({
986
1001
  kind: "sticker",
987
1002
  id: R,
988
1003
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
@@ -990,20 +1005,20 @@ function Sn(t) {
990
1005
  return;
991
1006
  }
992
1007
  if (R = null, H === "crop") {
993
- t.preventDefault(), st(t), b = { kind: "crop", start: Z(t), current: Z(t) }, mt(), $();
1008
+ t.preventDefault(), lt(t), b = { kind: "crop", start: Q(t), current: Q(t) }, gt(), $();
994
1009
  return;
995
1010
  }
996
1011
  if (H === "arrow" || H === "rect" || H === "circle") {
997
- t.preventDefault(), st(t);
998
- const n = Zt(t);
999
- b = { kind: "sticker", type: H, start: n, current: n }, mt(), $();
1012
+ t.preventDefault(), lt(t);
1013
+ const n = ee(t);
1014
+ b = { kind: "sticker", type: H, start: n, current: n }, gt(), $();
1000
1015
  return;
1001
1016
  }
1002
1017
  $();
1003
1018
  }
1004
- function En(t, e) {
1019
+ function Pn(t, e) {
1005
1020
  e.preventDefault(), e.stopPropagation();
1006
- const r = nt().getBoundingClientRect(), n = h.list().find((i) => i.id === t.id);
1021
+ const r = rt().getBoundingClientRect(), n = h.list().find((i) => i.id === t.id);
1007
1022
  w = {
1008
1023
  ...t,
1009
1024
  startX: e.clientX,
@@ -1011,11 +1026,11 @@ function En(t, e) {
1011
1026
  crop: h.crop(),
1012
1027
  sticker: n ? { ...n } : null,
1013
1028
  rect: r
1014
- }, xt(t.dir === "move" || t.dir === "start" || t.dir === "end"), mt();
1029
+ }, Et(t.dir === "move" || t.dir === "start" || t.dir === "end"), gt();
1015
1030
  }
1016
- function te(t) {
1031
+ function re(t) {
1017
1032
  if (b) {
1018
- b.current = b.kind === "crop" ? Z(t) : Zt(t), $();
1033
+ b.current = b.kind === "crop" ? Q(t) : ee(t), $();
1019
1034
  return;
1020
1035
  }
1021
1036
  if (!w)
@@ -1041,12 +1056,12 @@ function te(t) {
1041
1056
  });
1042
1057
  else {
1043
1058
  const i = { x: n.x, y: n.y, w: n.w, h: n.h };
1044
- Cn(i, w.dir, e, r), h.update(n.id, i);
1059
+ Tn(i, w.dir, e, r), h.update(n.id, i);
1045
1060
  }
1046
1061
  $();
1047
1062
  }
1048
1063
  }
1049
- function Cn(t, e, r, n) {
1064
+ function Tn(t, e, r, n) {
1050
1065
  if (e.includes("e") && (t.w = Math.max(0.04, t.w + r)), e.includes("s") && (t.h = Math.max(0.04, t.h + n)), e.includes("w")) {
1051
1066
  const i = Math.max(0.04, t.w - r);
1052
1067
  t.x += t.w - i, t.w = i;
@@ -1056,9 +1071,9 @@ function Cn(t, e, r, n) {
1056
1071
  t.y += t.h - i, t.h = i;
1057
1072
  }
1058
1073
  }
1059
- function Q(t) {
1060
- if (Qt(), xt(!1), b) {
1061
- Mn();
1074
+ function tt(t) {
1075
+ if (ne(), Et(!1), b) {
1076
+ kn();
1062
1077
  return;
1063
1078
  }
1064
1079
  if (w) {
@@ -1069,13 +1084,13 @@ function Q(t) {
1069
1084
  w = null, $();
1070
1085
  }
1071
1086
  }
1072
- function Mn() {
1087
+ function kn() {
1073
1088
  const t = b;
1074
1089
  if (b = null, !t)
1075
1090
  return;
1076
1091
  if (t.kind === "crop") {
1077
- const r = rt(t.start, t.current);
1078
- if (Math.abs(t.current.x - t.start.x) < Dt || Math.abs(t.current.y - t.start.y) < Dt) {
1092
+ const r = it(t.start, t.current);
1093
+ if (Math.abs(t.current.x - t.start.x) < Ot || Math.abs(t.current.y - t.start.y) < Ot) {
1079
1094
  $();
1080
1095
  return;
1081
1096
  }
@@ -1088,13 +1103,13 @@ function Mn() {
1088
1103
  }), z();
1089
1104
  return;
1090
1105
  }
1091
- const e = $n(t);
1106
+ const e = An(t);
1092
1107
  e && (R = e.id), $();
1093
1108
  }
1094
- function $n(t) {
1109
+ function An(t) {
1095
1110
  if (t.type === "arrow") {
1096
1111
  const e = t.current.x - t.start.x, r = t.current.y - t.start.y;
1097
- return Math.hypot(e, r) < dt ? h.add("arrow", {
1112
+ return Math.hypot(e, r) < ht ? h.add("arrow", {
1098
1113
  x: t.start.x,
1099
1114
  y: t.start.y,
1100
1115
  x2: t.start.x + 0.12,
@@ -1110,51 +1125,51 @@ function $n(t) {
1110
1125
  h: Math.abs(r)
1111
1126
  });
1112
1127
  }
1113
- return h.add(t.type, rt(t.start, t.current));
1128
+ return h.add(t.type, it(t.start, t.current));
1114
1129
  }
1115
- function Rn() {
1130
+ function In() {
1116
1131
  h.resetCrop(), R = null, z();
1117
1132
  }
1118
- function yt() {
1133
+ function wt() {
1119
1134
  c.resetCrop && (c.resetCrop.hidden = !h.isCropped());
1120
1135
  }
1121
- function St(t) {
1136
+ function Ct(t) {
1122
1137
  if (!c.audio)
1123
1138
  return;
1124
1139
  const e = t ? "Stop audio" : "Record audio";
1125
1140
  c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
1126
1141
  }
1127
- function Ln() {
1128
- S && (q = S), S = "", c.stage.hidden = !0, c.restore.hidden = !q;
1142
+ function Dn() {
1143
+ E && (q = E), E = "", c.stage.hidden = !0, c.restore.hidden = !q;
1129
1144
  }
1130
- function Pn() {
1131
- q && (S = q, c.stage.hidden = !1, c.restore.hidden = !0, z());
1145
+ function Fn() {
1146
+ q && (E = q, c.stage.hidden = !1, c.restore.hidden = !0, z());
1132
1147
  }
1133
- function kn() {
1148
+ function On() {
1134
1149
  try {
1135
- if (B || (B = sn((e) => {
1150
+ if (V || (V = hn((e) => {
1136
1151
  const r = c.text.value.trim();
1137
1152
  c.text.value = r ? `${r} ${e}` : e;
1138
- })), !B.isSupported()) {
1153
+ })), !V.isSupported()) {
1139
1154
  x("Audio-to-text is not supported in this browser.");
1140
1155
  return;
1141
1156
  }
1142
- const t = B.start();
1143
- St(t), x(t ? "Listening…" : "");
1157
+ const t = V.start();
1158
+ Ct(t), x(t ? "Listening…" : "");
1144
1159
  } catch (t) {
1145
1160
  x(t.message);
1146
1161
  }
1147
1162
  }
1148
- async function Tn() {
1163
+ async function Hn() {
1149
1164
  if (!d.video) {
1150
1165
  x("Video is disabled on this host.");
1151
1166
  return;
1152
1167
  }
1153
- c.dialog.hidden = !0, c.stop.hidden = !1, et(), c.launcher.hidden = !0, W = ln({
1168
+ c.dialog.hidden = !0, c.stop.hidden = !1, nt(), c.launcher.hidden = !0, W = mn({
1154
1169
  onStart() {
1155
1170
  },
1156
1171
  onStop(t) {
1157
- L = t, c.stop.hidden = !0, J(), c.dialog.hidden = !1, z(), x(t ? "Video attached." : "Recording cancelled.");
1172
+ L = t, c.stop.hidden = !0, Z(), c.dialog.hidden = !1, z(), x(t ? "Video attached." : "Recording cancelled.");
1158
1173
  },
1159
1174
  onError(t) {
1160
1175
  x(t.message);
@@ -1163,30 +1178,30 @@ async function Tn() {
1163
1178
  try {
1164
1179
  await W.start();
1165
1180
  } catch (t) {
1166
- c.stop.hidden = !0, J(), c.dialog.hidden = !1, x(t.message);
1181
+ c.stop.hidden = !0, Z(), c.dialog.hidden = !1, x(t.message);
1167
1182
  }
1168
1183
  }
1169
1184
  function z() {
1170
- if (c.shot = null, !S) {
1171
- c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = L ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>` : "", yt();
1185
+ if (c.shot = null, !E) {
1186
+ c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = L ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>` : "", wt();
1172
1187
  return;
1173
1188
  }
1174
- c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${S}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
1189
+ c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${E}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
1175
1190
  const t = c.shot.querySelector("img");
1176
1191
  t.draggable = !1, t.addEventListener("dragstart", (r) => r.preventDefault());
1177
1192
  const e = () => {
1178
- An(t), $();
1193
+ jn(t), $();
1179
1194
  };
1180
1195
  t.addEventListener("load", e), t.complete && t.naturalWidth && e();
1181
1196
  }
1182
- function An(t) {
1197
+ function jn(t) {
1183
1198
  const e = t.naturalWidth || O.w, r = t.naturalHeight || O.h;
1184
1199
  if (e && r && (O = { w: e, h: r }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / r)), c.canvas.style.aspectRatio = `${e} / ${r}`), !c.shot || !O.w || !O.h)
1185
1200
  return;
1186
1201
  const n = h.crop(), i = O.w / O.h, a = n.w / n.h * i, o = Math.min(1, a / i), s = Math.min(1, i / a);
1187
1202
  c.shot.style.left = `${(1 - o) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${o * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / n.w}%`, t.style.height = `${100 / n.h}%`, t.style.left = `${-n.x / n.w * 100}%`, t.style.top = `${-n.y / n.h * 100}%`;
1188
1203
  }
1189
- function In(t) {
1204
+ function Un(t) {
1190
1205
  return t.type === "arrow" ? {
1191
1206
  id: "preview",
1192
1207
  type: "arrow",
@@ -1201,23 +1216,23 @@ function In(t) {
1201
1216
  id: "preview",
1202
1217
  type: t.type,
1203
1218
  number: "",
1204
- ...rt(t.start, t.current)
1219
+ ...it(t.start, t.current)
1205
1220
  };
1206
1221
  }
1207
1222
  function $() {
1208
- if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !S || !c.shot) {
1209
- yt();
1223
+ if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !E || !c.shot) {
1224
+ wt();
1210
1225
  return;
1211
1226
  }
1212
1227
  const e = h.crop();
1213
1228
  if ((b == null ? void 0 : b.kind) === "crop") {
1214
1229
  const n = document.createElement("div");
1215
- n.className = "nf-crop", Ht(n, rt(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(n);
1230
+ n.className = "nf-crop", Ut(n, it(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(n);
1216
1231
  }
1217
1232
  const r = h.list().slice();
1218
- if ((b == null ? void 0 : b.kind) === "sticker" && r.push(In(b)), r.forEach((n) => {
1233
+ if ((b == null ? void 0 : b.kind) === "sticker" && r.push(Un(b)), r.forEach((n) => {
1219
1234
  const i = n.id === "preview", a = !i && n.id === R, o = document.createElement("div");
1220
- if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id, a && (o.dataset.selected = "true"), i && (o.dataset.preview = "true"), n.type === "arrow" ? Dn(o, n, e, a) : (Ht(o, n, e), a && ["nw", "ne", "sw", "se"].forEach((s) => gt(o, s))), !i && n.number) {
1235
+ if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id, a && (o.dataset.selected = "true"), i && (o.dataset.preview = "true"), n.type === "arrow" ? Bn(o, n, e, a) : (Ut(o, n, e), a && ["nw", "ne", "sw", "se"].forEach((s) => bt(o, s))), !i && n.number) {
1221
1236
  const s = document.createElement("span");
1222
1237
  s.className = "nf-badge", s.textContent = String(n.number), o.appendChild(s);
1223
1238
  }
@@ -1226,29 +1241,29 @@ function $() {
1226
1241
  const n = document.createElement("video");
1227
1242
  n.className = "nf-recording-preview", n.controls = !0, n.src = URL.createObjectURL(L), n.style.position = "absolute", n.style.right = "8px", n.style.bottom = "8px", n.style.width = "160px", c.canvas.appendChild(n);
1228
1243
  }
1229
- yt();
1244
+ wt();
1230
1245
  }
1231
- function Dn(t, e, r, n) {
1232
- const i = nt(), a = i.clientWidth, o = i.clientHeight, s = (e.x - r.x) / r.w * a, l = (e.y - r.y) / r.h * o, v = ((e.x2 ?? e.x + e.w) - r.x) / r.w * a, y = ((e.y2 ?? e.y) - r.y) / r.h * o, p = 18, g = Math.min(s, v) - p, P = Math.min(l, y) - p, f = Math.max(2, Math.abs(v - s)) + p * 2, m = Math.max(2, Math.abs(y - l)) + p * 2, k = s - g, T = l - P, A = v - g, U = y - P, V = `nf-ah-${e.id}`, I = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1246
+ function Bn(t, e, r, n) {
1247
+ const i = rt(), a = i.clientWidth, o = i.clientHeight, s = (e.x - r.x) / r.w * a, l = (e.y - r.y) / r.h * o, v = ((e.x2 ?? e.x + e.w) - r.x) / r.w * a, y = ((e.y2 ?? e.y) - r.y) / r.h * o, p = 18, g = Math.min(s, v) - p, P = Math.min(l, y) - p, f = Math.max(2, Math.abs(v - s)) + p * 2, m = Math.max(2, Math.abs(y - l)) + p * 2, T = s - g, k = l - P, A = v - g, U = y - P, B = `nf-ah-${e.id}`, I = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1233
1248
  t.style.left = `${g}px`, t.style.top = `${P}px`, t.style.width = `${f}px`, t.style.height = `${m}px`, I.setAttribute("class", "nf-arrow-svg"), I.setAttribute("viewBox", `0 0 ${f} ${m}`), I.setAttribute("width", String(f)), I.setAttribute("height", String(m)), I.innerHTML = `
1234
1249
  <defs>
1235
- <marker id="${V}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
1250
+ <marker id="${B}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
1236
1251
  <path d="M0,0 L10,5 L0,10 Z" fill="currentColor" />
1237
1252
  </marker>
1238
1253
  </defs>
1239
- <line class="nf-arrow-hit" x1="${k}" y1="${T}" x2="${A}" y2="${U}" />
1240
- <line class="nf-arrow-shaft" x1="${k}" y1="${T}" x2="${A}" y2="${U}" marker-end="url(#${V})" />
1241
- `, t.appendChild(I), n && (gt(t, "start", { left: k - 5, top: T - 5 }), gt(t, "end", { left: A - 5, top: U - 5 }));
1254
+ <line class="nf-arrow-hit" x1="${T}" y1="${k}" x2="${A}" y2="${U}" />
1255
+ <line class="nf-arrow-shaft" x1="${T}" y1="${k}" x2="${A}" y2="${U}" marker-end="url(#${B})" />
1256
+ `, t.appendChild(I), n && (bt(t, "start", { left: T - 5, top: k - 5 }), bt(t, "end", { left: A - 5, top: U - 5 }));
1242
1257
  }
1243
- function gt(t, e, r) {
1258
+ function bt(t, e, r) {
1244
1259
  const n = document.createElement("span");
1245
1260
  n.className = "nf-handle", n.dataset.dir = e, r && (n.style.left = `${r.left}px`, n.style.top = `${r.top}px`), t.appendChild(n);
1246
1261
  }
1247
- function Ht(t, e, r) {
1262
+ function Ut(t, e, r) {
1248
1263
  t.style.left = `${(e.x - r.x) / r.w * 100}%`, t.style.top = `${(e.y - r.y) / r.h * 100}%`, t.style.width = `${e.w / r.w * 100}%`, t.style.height = `${e.h / r.h * 100}%`;
1249
1264
  }
1250
- function Fn(t = {}) {
1251
- return rn(t), d = {
1265
+ function Vn(t = {}) {
1266
+ return un(t), d = {
1252
1267
  ...d,
1253
1268
  endpoint: String(t.endpoint || d.endpoint || "").replace(/\/$/, ""),
1254
1269
  projectKey: t.projectKey == null ? d.projectKey : String(t.projectKey),
@@ -1256,78 +1271,86 @@ function Fn(t = {}) {
1256
1271
  name: t.name == null ? d.name : String(t.name || ""),
1257
1272
  targets: t.targets === void 0 ? d.targets : t.targets,
1258
1273
  hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
1259
- theme: Jt(t.theme ?? d.theme),
1274
+ theme: te(t.theme ?? d.theme),
1260
1275
  video: t.video == null ? d.video : !!t.video
1261
- }, vt(), et(), re;
1276
+ }, St(), nt(), oe;
1262
1277
  }
1263
- async function ee() {
1264
- vt(), et(), c.launcher.hidden = !0, h = Xt(), O = { w: 0, h: 0 }, L = null, R = null, b = null, w = null, G = "bug", ht("bug"), pt(null), St(!1), c.text.value = "", x("Capturing…");
1278
+ async function ie() {
1279
+ St(), nt(), c.launcher.hidden = !0, h = Jt(), O = { w: 0, h: 0 }, L = null, R = null, b = null, w = null, J = "bug", mt("bug"), yt(null), Ct(!1), c.text.value = "", x("");
1265
1280
  try {
1266
- S = await tn(), q = S, c.stage.hidden = !1, c.restore.hidden = !0;
1281
+ E = await sn(), q = E, c.stage.hidden = !1, c.restore.hidden = !0, x("");
1267
1282
  } catch {
1268
- S = "", x("Screenshot failed; you can still send text.");
1283
+ E = "", x("Screenshot failed; you can still send text.");
1269
1284
  }
1270
1285
  c.dialog.hidden = !1, z(), c.text.focus();
1271
1286
  }
1272
- function it() {
1273
- u && (B == null || B.stop(), St(!1), Qt(), b = null, w = null, xt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, J());
1287
+ function at() {
1288
+ u && (V == null || V.stop(), Ct(!1), ne(), b = null, w = null, Et(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
1274
1289
  }
1275
- function On(t = {}) {
1276
- ft = { ...ft, ...nn(t) };
1290
+ function _n(t = {}) {
1291
+ pt = { ...pt, ...ln(t) };
1277
1292
  }
1278
- async function ne() {
1279
- vt();
1293
+ async function ae() {
1294
+ if (St(), ct)
1295
+ return null;
1280
1296
  const t = c.text.value.trim();
1281
- if (!t && !S && !L)
1297
+ if (!t && !E && !L)
1282
1298
  return x("Add a note, screenshot, or video first."), null;
1283
1299
  if (!d.endpoint || !d.projectKey)
1284
1300
  return x("Notefully is missing endpoint or projectKey."), null;
1285
- x("Submitting…", !0);
1286
- const e = new FormData();
1287
- if (e.append("message", t), e.append("kind", G), e.append("version", d.version || "0.0.0"), d.name && e.append("name", d.name), e.append("context", JSON.stringify({
1288
- ...en(ft),
1289
- console: Gt.snapshot()
1290
- })), e.append("annotations", JSON.stringify(h.list())), Array.isArray(d.targets) && e.append("targets", JSON.stringify(d.targets)), S) {
1291
- const i = await hn(
1292
- S,
1293
- h.crop(),
1294
- h.list(),
1295
- {
1296
- mark: Ft("--nf-mark", "#fdd341"),
1297
- markText: Ft("--nf-mark-text", "#2a2140")
1298
- }
1299
- );
1300
- e.append("screenshot", i, "screenshot.png");
1301
- }
1302
- L && e.append("recording", L, "recording.webm");
1303
- const r = await fetch(`${d.endpoint}/v1/reports`, {
1304
- method: "POST",
1305
- headers: {
1306
- "X-Notefully-Key": d.projectKey
1307
- },
1308
- body: e
1309
- });
1310
- let n = null;
1301
+ ct = !0, Bt(!0), x("Submitting…", !0);
1311
1302
  try {
1312
- n = await r.json();
1313
- } catch {
1314
- n = null;
1303
+ const e = new FormData();
1304
+ if (e.append("message", t), e.append("kind", J), e.append("version", d.version || "0.0.0"), d.name && e.append("name", d.name), e.append("context", JSON.stringify({
1305
+ ...cn(pt),
1306
+ console: Qt.snapshot()
1307
+ })), e.append("annotations", JSON.stringify(h.list())), Array.isArray(d.targets) && e.append("targets", JSON.stringify(d.targets)), E) {
1308
+ const i = await bn(
1309
+ E,
1310
+ h.crop(),
1311
+ h.list(),
1312
+ {
1313
+ mark: Ht("--nf-mark", "#fdd341"),
1314
+ markText: Ht("--nf-mark-text", "#2a2140")
1315
+ }
1316
+ );
1317
+ e.append("screenshot", i, "screenshot.png");
1318
+ }
1319
+ L && e.append("recording", L, "recording.webm");
1320
+ const r = await fetch(`${d.endpoint}/v1/reports`, {
1321
+ method: "POST",
1322
+ headers: {
1323
+ "X-Notefully-Key": d.projectKey
1324
+ },
1325
+ body: e
1326
+ });
1327
+ let n = null;
1328
+ try {
1329
+ n = await r.json();
1330
+ } catch {
1331
+ n = null;
1332
+ }
1333
+ if (!r.ok)
1334
+ throw x((n == null ? void 0 : n.error) || "Submit failed."), new Error((n == null ? void 0 : n.error) || `Submit failed (${r.status})`);
1335
+ return x("Sent. Thank you."), at(), n;
1336
+ } finally {
1337
+ ct = !1, Bt(!1);
1315
1338
  }
1316
- if (!r.ok)
1317
- throw x((n == null ? void 0 : n.error) || "Submit failed."), new Error((n == null ? void 0 : n.error) || `Submit failed (${r.status})`);
1318
- return x("Sent. Thank you."), it(), n;
1319
1339
  }
1320
- function Hn() {
1321
- it(), u == null || u.remove(), u = null, c = {};
1340
+ function Bt(t) {
1341
+ c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
1342
+ }
1343
+ function Nn() {
1344
+ at(), u == null || u.remove(), u = null, c = {};
1322
1345
  }
1323
- const re = { init: Fn, open: ee, close: it, identify: On, submit: ne, destroy: Hn };
1324
- typeof window < "u" && (window.Notefully = re);
1346
+ const oe = { init: Vn, open: ie, close: at, identify: _n, submit: ae, destroy: Nn };
1347
+ typeof window < "u" && (window.Notefully = oe);
1325
1348
  export {
1326
- it as close,
1327
- re as default,
1328
- Hn as destroy,
1329
- On as identify,
1330
- Fn as init,
1331
- ee as open,
1332
- ne as submit
1349
+ at as close,
1350
+ oe as default,
1351
+ Nn as destroy,
1352
+ _n as identify,
1353
+ Vn as init,
1354
+ ie as open,
1355
+ ae as submit
1333
1356
  };