@makefully/notefully 0.1.1 → 0.1.2

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