@makefully/notefully 0.1.29 → 0.1.30

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