@makefully/notefully 0.1.7 → 0.1.9

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