@makefully/notefully 0.1.22 → 0.1.25

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