@makefully/notefully 0.1.26 → 0.1.27

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