@makefully/notefully 0.1.40 → 0.1.41
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/README.md +1 -1
- package/dist/notefully.iife.js +27 -27
- package/dist/notefully.js +735 -687
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Qe(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"),
|
|
9
|
-
return n.head.appendChild(r), n.body.appendChild(
|
|
8
|
+
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
|
|
9
|
+
return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const Ze = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -16,33 +16,33 @@ const Ye = /* @__PURE__ */ (() => {
|
|
|
16
16
|
);
|
|
17
17
|
return () => (t += 1, `u${e()}${t}`);
|
|
18
18
|
})();
|
|
19
|
-
function
|
|
19
|
+
function U(t) {
|
|
20
20
|
const e = [];
|
|
21
21
|
for (let n = 0, r = t.length; n < r; n++)
|
|
22
22
|
e.push(t[n]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
let G = null;
|
|
26
|
-
function
|
|
27
|
-
return G || (t.includeStyleProperties ? (G = t.includeStyleProperties, G) : (G =
|
|
26
|
+
function he(t = {}) {
|
|
27
|
+
return G || (t.includeStyleProperties ? (G = t.includeStyleProperties, G) : (G = U(window.getComputedStyle(document.documentElement)), G));
|
|
28
28
|
}
|
|
29
29
|
function st(t, e) {
|
|
30
30
|
const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
31
31
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function tn(t) {
|
|
34
34
|
const e = st(t, "border-left-width"), n = st(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function en(t) {
|
|
38
38
|
const e = st(t, "border-top-width"), n = st(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const n = e.width ||
|
|
41
|
+
function pe(t, e = {}) {
|
|
42
|
+
const n = e.width || tn(t), r = e.height || en(t);
|
|
43
43
|
return { width: n, height: r };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function nn() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -52,7 +52,7 @@ function Qe() {
|
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
54
|
const E = 16384;
|
|
55
|
-
function
|
|
55
|
+
function rn(t) {
|
|
56
56
|
(t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
|
|
57
57
|
}
|
|
58
58
|
function ct(t) {
|
|
@@ -65,12 +65,12 @@ function ct(t) {
|
|
|
65
65
|
}, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function an(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
|
|
72
|
-
const r = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
71
|
+
async function on(t, e, n) {
|
|
72
|
+
const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
|
|
73
|
+
return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), 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), an(i);
|
|
74
74
|
}
|
|
75
75
|
const x = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -78,323 +78,323 @@ const x = (t, e) => {
|
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
79
|
return n === null ? !1 : n.constructor.name === e.name || x(n, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function sn(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
const r = t.getPropertyValue(n),
|
|
88
|
-
return `${n}: ${r}${
|
|
85
|
+
function cn(t, e) {
|
|
86
|
+
return he(e).map((n) => {
|
|
87
|
+
const r = t.getPropertyValue(n), i = t.getPropertyPriority(n);
|
|
88
|
+
return `${n}: ${r}${i ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
91
|
+
function ln(t, e, n, r) {
|
|
92
|
+
const i = `.${t}:${e}`, a = n.cssText ? sn(n) : cn(n, r);
|
|
93
|
+
return document.createTextNode(`${i}{${a}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
95
|
+
function Kt(t, e, n, r) {
|
|
96
|
+
const i = window.getComputedStyle(t, n), a = i.getPropertyValue("content");
|
|
97
|
+
if (a === "" || a === "none")
|
|
98
98
|
return;
|
|
99
|
-
const o =
|
|
99
|
+
const o = Ze();
|
|
100
100
|
try {
|
|
101
101
|
e.className = `${e.className} ${o}`;
|
|
102
102
|
} catch {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const c = document.createElement("style");
|
|
106
|
-
c.appendChild(
|
|
106
|
+
c.appendChild(ln(o, n, i, r)), e.appendChild(c);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function un(t, e, n) {
|
|
109
|
+
Kt(t, e, ":before", n), Kt(t, e, ":after", n);
|
|
110
110
|
}
|
|
111
|
-
const qt = "application/font-woff",
|
|
111
|
+
const qt = "application/font-woff", Xt = "image/jpeg", dn = {
|
|
112
112
|
woff: qt,
|
|
113
113
|
woff2: qt,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: Xt,
|
|
118
|
+
jpeg: Xt,
|
|
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
|
|
124
|
+
function fn(t) {
|
|
125
125
|
const e = /\.([^./]*?)$/g.exec(t);
|
|
126
126
|
return e ? e[1] : "";
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
const e =
|
|
130
|
-
return
|
|
128
|
+
function Bt(t) {
|
|
129
|
+
const e = fn(t).toLowerCase();
|
|
130
|
+
return dn[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function hn(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Lt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function pn(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function me(t, e, n) {
|
|
142
142
|
const r = await fetch(t, e);
|
|
143
143
|
if (r.status === 404)
|
|
144
144
|
throw new Error(`Resource "${r.url}" not found`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((
|
|
145
|
+
const i = await r.blob();
|
|
146
|
+
return new Promise((a, o) => {
|
|
147
147
|
const c = new FileReader();
|
|
148
148
|
c.onerror = o, c.onloadend = () => {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
a(n({ res: r, result: c.result }));
|
|
151
151
|
} catch (l) {
|
|
152
152
|
o(l);
|
|
153
153
|
}
|
|
154
|
-
}, c.readAsDataURL(
|
|
154
|
+
}, c.readAsDataURL(i);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const St = {};
|
|
158
|
+
function mn(t, e, n) {
|
|
159
159
|
let r = t.replace(/\?.*/, "");
|
|
160
160
|
return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
|
|
161
161
|
}
|
|
162
|
-
async function
|
|
163
|
-
const r =
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
162
|
+
async function Dt(t, e, n) {
|
|
163
|
+
const r = mn(t, e, n.includeQueryParams);
|
|
164
|
+
if (St[r] != null)
|
|
165
|
+
return St[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let i;
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
169
|
+
const a = await me(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), hn(c)));
|
|
170
|
+
i = pn(a, e);
|
|
171
|
+
} catch (a) {
|
|
172
|
+
i = n.imagePlaceholder || "";
|
|
173
173
|
let o = `Failed to fetch resource: ${t}`;
|
|
174
|
-
|
|
174
|
+
a && (o = typeof a == "string" ? a : a.message), o && console.warn(o);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return St[r] = i, i;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function yn(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
180
|
return e === "data:," ? t.cloneNode(!1) : ct(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function gn(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const c =
|
|
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 c = a.toDataURL();
|
|
187
187
|
return ct(c);
|
|
188
188
|
}
|
|
189
|
-
const n = t.poster, r =
|
|
190
|
-
return ct(
|
|
189
|
+
const n = t.poster, r = Bt(n), i = await Dt(n, r, e);
|
|
190
|
+
return ct(i);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function wn(t, e) {
|
|
193
193
|
var n;
|
|
194
194
|
try {
|
|
195
195
|
if (!((n = t == null ? void 0 : t.contentDocument) === null || n === void 0) && n.body)
|
|
196
|
-
return await
|
|
196
|
+
return await yt(t.contentDocument.body, e, !0);
|
|
197
197
|
} catch {
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return x(t, HTMLCanvasElement) ?
|
|
201
|
+
async function vn(t, e) {
|
|
202
|
+
return x(t, HTMLCanvasElement) ? yn(t) : x(t, HTMLVideoElement) ? gn(t, e) : x(t, HTMLIFrameElement) ? wn(t, e) : t.cloneNode(ye(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
206
|
-
var r,
|
|
207
|
-
if (
|
|
204
|
+
const bn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ye = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function Sn(t, e, n) {
|
|
206
|
+
var r, i;
|
|
207
|
+
if (ye(e))
|
|
208
208
|
return e;
|
|
209
|
-
let
|
|
210
|
-
return
|
|
209
|
+
let a = [];
|
|
210
|
+
return bn(t) && t.assignedNodes ? a = U(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? a = U(t.contentDocument.body.childNodes) : a = U(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || x(t, HTMLVideoElement) || await a.reduce((o, c) => o.then(() => yt(c, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function xn(t, e, n) {
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let o =
|
|
221
|
-
|
|
218
|
+
const i = window.getComputedStyle(t);
|
|
219
|
+
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : he(n).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`), x(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(a, o, i.getPropertyPriority(a));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function En(t, e) {
|
|
225
225
|
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Cn(t, e) {
|
|
228
228
|
if (x(t, HTMLSelectElement)) {
|
|
229
|
-
const r = Array.from(e.children).find((
|
|
229
|
+
const r = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return x(e, Element) && (
|
|
233
|
+
function An(t, e, n) {
|
|
234
|
+
return x(e, Element) && (xn(t, e, n), un(t, e, n), En(t, e), Cn(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Mn(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
240
240
|
const r = {};
|
|
241
|
-
for (let
|
|
242
|
-
const c = n[
|
|
241
|
+
for (let a = 0; a < n.length; a++) {
|
|
242
|
+
const c = n[a].getAttribute("xlink:href");
|
|
243
243
|
if (c) {
|
|
244
244
|
const l = t.querySelector(c), u = document.querySelector(c);
|
|
245
|
-
!l && u && !r[c] && (r[c] = await
|
|
245
|
+
!l && u && !r[c] && (r[c] = await yt(u, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
o.setAttribute("xmlns",
|
|
252
|
-
const c = document.createElementNS(
|
|
248
|
+
const i = Object.values(r);
|
|
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 c = document.createElementNS(a, "defs");
|
|
253
253
|
o.appendChild(c);
|
|
254
|
-
for (let l = 0; l <
|
|
255
|
-
c.appendChild(
|
|
254
|
+
for (let l = 0; l < i.length; l++)
|
|
255
|
+
c.appendChild(i[l]);
|
|
256
256
|
t.appendChild(o);
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) =>
|
|
260
|
+
async function yt(t, e, n) {
|
|
261
|
+
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => vn(r, e)).then((r) => Sn(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const ge = /url\((['"]?)([^'"]+?)\1\)/g, Ln = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $n = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function Rn(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function kn(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(ge, (n, r, i) => (e.push(i), n)), e.filter((n) => !Lt(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function Tn(t, e, n, r, i) {
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
274
|
+
const a = n ? Qe(e, n) : e, o = Bt(e);
|
|
275
275
|
let c;
|
|
276
|
-
return
|
|
276
|
+
return i || (c = await Dt(a, o, r)), t.replace(Rn(e), `$1${c}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function Pn(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace($n, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [r, , i] = Ln.exec(n) || [];
|
|
285
|
+
if (!i)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (i === e)
|
|
288
288
|
return `src: ${r};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function we(t) {
|
|
293
|
+
return t.search(ge) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function ve(t, e, n) {
|
|
296
|
+
if (!we(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return
|
|
298
|
+
const r = Pn(t, n);
|
|
299
|
+
return kn(r).reduce((a, o) => a.then((c) => Tn(c, o, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
301
|
async function J(t, e, n) {
|
|
302
302
|
var r;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
return e.style.setProperty(t,
|
|
303
|
+
const i = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
|
+
if (i) {
|
|
305
|
+
const a = await ve(i, null, n);
|
|
306
|
+
return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
310
|
+
async function In(t, e) {
|
|
311
311
|
await J("background", t, e) || await J("background-image", t, e), await J("mask", t, e) || await J("-webkit-mask", t, e) || await J("mask-image", t, e) || await J("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
313
|
+
async function On(t, e) {
|
|
314
314
|
const n = x(t, HTMLImageElement);
|
|
315
|
-
if (!(n && !
|
|
315
|
+
if (!(n && !Lt(t.src)) && !(x(t, SVGImageElement) && !Lt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const r = n ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((
|
|
319
|
-
t.onload =
|
|
317
|
+
const r = n ? t.src : t.href.baseVal, i = await Dt(r, Bt(r), e);
|
|
318
|
+
await new Promise((a, o) => {
|
|
319
|
+
t.onload = a, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
|
-
|
|
321
|
+
a(e.onImageErrorHandler(...l));
|
|
322
322
|
} catch (u) {
|
|
323
323
|
o(u);
|
|
324
324
|
}
|
|
325
325
|
} : o;
|
|
326
326
|
const c = t;
|
|
327
|
-
c.decode && (c.decode =
|
|
327
|
+
c.decode && (c.decode = a), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const r =
|
|
330
|
+
async function Bn(t, e) {
|
|
331
|
+
const r = U(t.childNodes).map((i) => be(i, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
x(t, Element) && (await
|
|
334
|
+
async function be(t, e) {
|
|
335
|
+
x(t, Element) && (await In(t, e), await On(t, e), await Bn(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Dn(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
341
|
-
return r != null && Object.keys(r).forEach((
|
|
342
|
-
n[
|
|
341
|
+
return r != null && Object.keys(r).forEach((i) => {
|
|
342
|
+
n[i] = r[i];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Yt = {};
|
|
346
|
+
async function Gt(t) {
|
|
347
|
+
let e = Yt[t];
|
|
348
348
|
if (e != null)
|
|
349
349
|
return e;
|
|
350
350
|
const r = await (await fetch(t)).text();
|
|
351
|
-
return e = { url: t, cssText: r },
|
|
351
|
+
return e = { url: t, cssText: r }, Yt[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function Jt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
|
-
const r = /url\(["']?([^"')]+)["']?\)/g,
|
|
355
|
+
const r = /url\(["']?([^"')]+)["']?\)/g, a = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
356
356
|
let c = o.replace(r, "$1");
|
|
357
|
-
return c.startsWith("https://") || (c = new URL(c, t.url).href),
|
|
357
|
+
return c.startsWith("https://") || (c = new URL(c, t.url).href), me(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
|
-
return Promise.all(
|
|
359
|
+
return Promise.all(a).then(() => n);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Qt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let r = t.replace(n, "");
|
|
366
|
-
const
|
|
366
|
+
const i = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = i.exec(r);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
r = r.replace(
|
|
374
|
-
const
|
|
373
|
+
r = r.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]*?)})", c = new RegExp(o, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let l =
|
|
376
|
+
let l = a.exec(r);
|
|
377
377
|
if (l === null) {
|
|
378
378
|
if (l = c.exec(r), l === null)
|
|
379
379
|
break;
|
|
380
|
-
|
|
380
|
+
a.lastIndex = c.lastIndex;
|
|
381
381
|
} else
|
|
382
|
-
c.lastIndex =
|
|
382
|
+
c.lastIndex = a.lastIndex;
|
|
383
383
|
e.push(l[0]);
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function Hn(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((i) => {
|
|
390
|
+
if ("cssRules" in i)
|
|
391
391
|
try {
|
|
392
|
-
|
|
393
|
-
if (
|
|
392
|
+
U(i.cssRules || []).forEach((a, o) => {
|
|
393
|
+
if (a.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let c = o + 1;
|
|
395
|
-
const l =
|
|
395
|
+
const l = a.href, u = Gt(l).then((f) => Jt(f, e)).then((f) => Qt(f).forEach((m) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
397
|
+
i.insertRule(m, m.startsWith("@import") ? c += 1 : i.cssRules.length);
|
|
398
398
|
} catch (g) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: m,
|
|
@@ -407,79 +407,79 @@ async function In(t, e) {
|
|
|
407
407
|
r.push(u);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
} catch (
|
|
410
|
+
} catch (a) {
|
|
411
411
|
const o = t.find((c) => c.href == null) || document.styleSheets[0];
|
|
412
|
-
|
|
412
|
+
i.href != null && r.push(Gt(i.href).then((c) => Jt(c, e)).then((c) => Qt(c).forEach((l) => {
|
|
413
413
|
o.insertRule(l, o.cssRules.length);
|
|
414
414
|
})).catch((c) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", c);
|
|
416
|
-
})), console.error("Error inlining remote css file",
|
|
416
|
+
})), console.error("Error inlining remote css file", a);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(r).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(r).then(() => (t.forEach((i) => {
|
|
419
|
+
if ("cssRules" in i)
|
|
420
420
|
try {
|
|
421
|
-
|
|
422
|
-
n.push(
|
|
421
|
+
U(i.cssRules || []).forEach((a) => {
|
|
422
|
+
n.push(a);
|
|
423
423
|
});
|
|
424
|
-
} catch (
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
424
|
+
} catch (a) {
|
|
425
|
+
console.error(`Error while reading CSS rules from ${i.href}`, a);
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function Fn(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => we(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function Un(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const n =
|
|
436
|
-
return
|
|
435
|
+
const n = U(t.ownerDocument.styleSheets), r = await Hn(n, e);
|
|
436
|
+
return Fn(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Se(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Nn(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
|
-
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((
|
|
445
|
-
e.add(
|
|
446
|
-
}), Array.from(r.children).forEach((
|
|
447
|
-
|
|
444
|
+
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((a) => {
|
|
445
|
+
e.add(Se(a));
|
|
446
|
+
}), Array.from(r.children).forEach((a) => {
|
|
447
|
+
a instanceof HTMLElement && n(a);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return n(t), e;
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
453
|
-
const n = await
|
|
454
|
-
return (await Promise.all(n.filter((
|
|
455
|
-
const o =
|
|
456
|
-
return
|
|
452
|
+
async function jn(t, e) {
|
|
453
|
+
const n = await Un(t, e), r = Nn(t);
|
|
454
|
+
return (await Promise.all(n.filter((a) => r.has(Se(a.style.fontFamily))).map((a) => {
|
|
455
|
+
const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
|
|
456
|
+
return ve(a.cssText, o, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
|
-
async function
|
|
461
|
-
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await
|
|
460
|
+
async function _n(t, e) {
|
|
461
|
+
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await jn(t, e);
|
|
462
462
|
if (n) {
|
|
463
|
-
const r = document.createElement("style"),
|
|
464
|
-
r.appendChild(
|
|
463
|
+
const r = document.createElement("style"), i = document.createTextNode(n);
|
|
464
|
+
r.appendChild(i), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { width: n, height: r } =
|
|
469
|
-
return await
|
|
467
|
+
async function Vn(t, e = {}) {
|
|
468
|
+
const { width: n, height: r } = pe(t, e), i = await yt(t, e, !0);
|
|
469
|
+
return await _n(i, e), await be(i, e), Dn(i, e), await on(i, n, r);
|
|
470
470
|
}
|
|
471
|
-
async function
|
|
472
|
-
const { width: n, height: r } =
|
|
473
|
-
return o.width = u * l, o.height = f * l, e.skipAutoScale ||
|
|
471
|
+
async function Wn(t, e = {}) {
|
|
472
|
+
const { width: n, height: r } = pe(t, e), i = await Vn(t, e), a = await ct(i), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || nn(), u = e.canvasWidth || n, f = e.canvasHeight || r;
|
|
473
|
+
return o.width = u * l, o.height = f * l, e.skipAutoScale || rn(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(a, 0, 0, o.width, o.height), o;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function Zt(t, e = {}) {
|
|
476
|
+
return (await Wn(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
|
-
const lt = "data-nf-capture-chrome",
|
|
479
|
-
function
|
|
478
|
+
const lt = "data-nf-capture-chrome", zn = "data-nf-canvas-snap", Kn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
|
|
479
|
+
function xe(t) {
|
|
480
480
|
return t instanceof Element && (t.hasAttribute(lt) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function qn() {
|
|
483
483
|
const t = [];
|
|
484
484
|
return Array.from(document.styleSheets).forEach((e) => {
|
|
485
485
|
try {
|
|
@@ -503,11 +503,11 @@ function Vn() {
|
|
|
503
503
|
});
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Xn() {
|
|
507
507
|
const t = [];
|
|
508
508
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
509
|
-
const r = n.getBoundingClientRect(),
|
|
510
|
-
|
|
509
|
+
const r = n.getBoundingClientRect(), i = document.createElement("div");
|
|
510
|
+
i.setAttribute("data-nf-mask-cover", "1"), i.style.cssText = [
|
|
511
511
|
"position:fixed",
|
|
512
512
|
`left:${r.left}px`,
|
|
513
513
|
`top:${r.top}px`,
|
|
@@ -516,17 +516,17 @@ function Wn() {
|
|
|
516
516
|
"background:#111",
|
|
517
517
|
"z-index:2147483646",
|
|
518
518
|
"pointer-events:none"
|
|
519
|
-
].join(";"), document.body.appendChild(
|
|
519
|
+
].join(";"), document.body.appendChild(i), t.push(i);
|
|
520
520
|
}), () => t.forEach((n) => n.remove());
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Yn() {
|
|
523
523
|
const t = document.querySelector(`[${lt}]`);
|
|
524
524
|
if (t)
|
|
525
525
|
return t;
|
|
526
526
|
const e = document.createElement("div");
|
|
527
527
|
return e.setAttribute(lt, "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;
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function Gn() {
|
|
530
530
|
document.querySelectorAll(`[${lt}]`).forEach((t) => t.remove());
|
|
531
531
|
}
|
|
532
532
|
function $t() {
|
|
@@ -534,13 +534,13 @@ function $t() {
|
|
|
534
534
|
requestAnimationFrame(() => requestAnimationFrame(t));
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function N(t) {
|
|
538
538
|
if (typeof t != "string" || !t.startsWith("data:image/"))
|
|
539
539
|
return !1;
|
|
540
540
|
const e = t.indexOf(",");
|
|
541
541
|
return e > 0 && e < t.length - 1;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Jn() {
|
|
544
544
|
const t = document.documentElement, e = document.body, n = Math.max(
|
|
545
545
|
window.innerWidth || 0,
|
|
546
546
|
(t == null ? void 0 : t.clientWidth) || 0,
|
|
@@ -556,10 +556,10 @@ function Kn() {
|
|
|
556
556
|
);
|
|
557
557
|
return { width: n, height: r };
|
|
558
558
|
}
|
|
559
|
-
async function
|
|
559
|
+
async function Qn() {
|
|
560
560
|
const t = [], e = Array.from(document.querySelectorAll("canvas"));
|
|
561
561
|
for (const n of e) {
|
|
562
|
-
if (n.closest("#notefully") ||
|
|
562
|
+
if (n.closest("#notefully") || xe(n))
|
|
563
563
|
continue;
|
|
564
564
|
let r = "";
|
|
565
565
|
try {
|
|
@@ -569,8 +569,8 @@ async function Xn() {
|
|
|
569
569
|
}
|
|
570
570
|
if (!r || r === "data:,")
|
|
571
571
|
continue;
|
|
572
|
-
const
|
|
573
|
-
|
|
572
|
+
const i = document.createElement("img"), a = getComputedStyle(n);
|
|
573
|
+
i.setAttribute(zn, "1"), i.alt = "", i.src = r, i.className = n.className, i.style.cssText = n.style.cssText, i.style.width = a.width, i.style.height = a.height, i.style.maxWidth = a.maxWidth, i.style.maxHeight = a.maxHeight, i.style.objectFit = "fill", i.style.display = a.display === "inline" ? "inline-block" : a.display, n.replaceWith(i), t.push({ canvas: n, img: i });
|
|
574
574
|
}
|
|
575
575
|
return await Promise.all(t.map(({ img: n }) => {
|
|
576
576
|
if (!n.complete)
|
|
@@ -586,34 +586,34 @@ async function Xn() {
|
|
|
586
586
|
});
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
|
-
async function
|
|
589
|
+
async function Zn(t) {
|
|
590
590
|
if (!t)
|
|
591
591
|
return null;
|
|
592
592
|
if (typeof t == "string")
|
|
593
|
-
return
|
|
593
|
+
return N(t) ? t : null;
|
|
594
594
|
if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
|
|
595
595
|
try {
|
|
596
596
|
const e = t.toDataURL("image/png");
|
|
597
|
-
return
|
|
597
|
+
return N(e) ? e : null;
|
|
598
598
|
} catch {
|
|
599
599
|
return null;
|
|
600
600
|
}
|
|
601
601
|
if (typeof Blob < "u" && t instanceof Blob) {
|
|
602
|
-
const e = await
|
|
603
|
-
return
|
|
602
|
+
const e = await tr(t);
|
|
603
|
+
return N(e) ? e : null;
|
|
604
604
|
}
|
|
605
605
|
return null;
|
|
606
606
|
}
|
|
607
|
-
async function
|
|
607
|
+
async function tr(t) {
|
|
608
608
|
if (typeof FileReader == "function")
|
|
609
|
-
return new Promise((r,
|
|
610
|
-
const
|
|
611
|
-
|
|
609
|
+
return new Promise((r, i) => {
|
|
610
|
+
const a = new FileReader();
|
|
611
|
+
a.onload = () => r(String(a.result || "")), a.onerror = () => i(a.error || new Error("Could not read capture blob")), a.readAsDataURL(t);
|
|
612
612
|
});
|
|
613
613
|
const e = Buffer.from(await t.arrayBuffer());
|
|
614
614
|
return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
|
|
615
615
|
}
|
|
616
|
-
async function
|
|
616
|
+
async function er() {
|
|
617
617
|
var e;
|
|
618
618
|
if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
|
|
619
619
|
throw new Error("Screen capture is not supported in this browser.");
|
|
@@ -628,73 +628,73 @@ async function Jn() {
|
|
|
628
628
|
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
|
|
629
629
|
n.onloadedmetadata = () => c();
|
|
630
630
|
}), await $t();
|
|
631
|
-
const r = n.videoWidth || 1,
|
|
632
|
-
|
|
633
|
-
const o =
|
|
634
|
-
if (!
|
|
631
|
+
const r = n.videoWidth || 1, i = n.videoHeight || 1, a = document.createElement("canvas");
|
|
632
|
+
a.width = r, a.height = i, a.getContext("2d").drawImage(n, 0, 0, r, i);
|
|
633
|
+
const o = a.toDataURL("image/png");
|
|
634
|
+
if (!N(o))
|
|
635
635
|
throw new Error("Screen capture produced an empty image.");
|
|
636
636
|
return o;
|
|
637
637
|
} finally {
|
|
638
638
|
t.getTracks().forEach((n) => n.stop());
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
async function
|
|
642
|
-
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r =
|
|
643
|
-
let
|
|
641
|
+
async function Ee(t = {}) {
|
|
642
|
+
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = Yn(), i = qn();
|
|
643
|
+
let a = () => {
|
|
644
644
|
};
|
|
645
645
|
e && (e.style.display = "none");
|
|
646
|
-
const o =
|
|
646
|
+
const o = Xn();
|
|
647
647
|
try {
|
|
648
648
|
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await $t(), typeof t.capture == "function") {
|
|
649
|
-
const m = await
|
|
649
|
+
const m = await Zn(await t.capture());
|
|
650
650
|
if (m)
|
|
651
651
|
return m;
|
|
652
652
|
}
|
|
653
|
-
|
|
654
|
-
const { width: c, height: l } =
|
|
653
|
+
a = await Qn(), await $t();
|
|
654
|
+
const { width: c, height: l } = Jn(), u = {
|
|
655
655
|
cacheBust: !0,
|
|
656
656
|
width: c,
|
|
657
657
|
height: l,
|
|
658
658
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
659
|
-
filter: (m) => !
|
|
659
|
+
filter: (m) => !xe(m),
|
|
660
660
|
// 404 / CORS images must not abort the whole capture.
|
|
661
|
-
imagePlaceholder:
|
|
661
|
+
imagePlaceholder: Kn,
|
|
662
662
|
onImageErrorHandler: () => {
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
let f = "";
|
|
666
666
|
try {
|
|
667
|
-
f = await
|
|
667
|
+
f = await Zt(document.body, u);
|
|
668
668
|
} catch {
|
|
669
|
-
f = await
|
|
669
|
+
f = await Zt(document.body, { ...u, skipFonts: !0 });
|
|
670
670
|
}
|
|
671
|
-
if (!
|
|
671
|
+
if (!N(f))
|
|
672
672
|
throw new Error("Screenshot capture produced an empty image.");
|
|
673
673
|
return f;
|
|
674
674
|
} finally {
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
a();
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
o(),
|
|
679
|
+
o(), i(), r.remove(), Gn(), e && (e.style.display = n);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function nr(t = "") {
|
|
683
683
|
const e = String(t || "");
|
|
684
684
|
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" : "";
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function rr(t = "") {
|
|
687
687
|
const e = String(t || "");
|
|
688
688
|
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" : "";
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function ir(t = {}) {
|
|
691
691
|
const e = navigator.userAgent;
|
|
692
692
|
return {
|
|
693
693
|
url: location.href,
|
|
694
694
|
title: document.title,
|
|
695
695
|
userAgent: e,
|
|
696
|
-
os:
|
|
697
|
-
browser:
|
|
696
|
+
os: nr(e),
|
|
697
|
+
browser: rr(e),
|
|
698
698
|
language: navigator.language,
|
|
699
699
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
700
700
|
viewport: {
|
|
@@ -709,11 +709,11 @@ function tr(t = {}) {
|
|
|
709
709
|
}
|
|
710
710
|
};
|
|
711
711
|
}
|
|
712
|
-
const
|
|
712
|
+
const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
|
|
713
713
|
id: "userId",
|
|
714
714
|
username: "displayName",
|
|
715
715
|
name: "displayName"
|
|
716
|
-
},
|
|
716
|
+
}, ne = /* @__PURE__ */ new Set([
|
|
717
717
|
"endpoint",
|
|
718
718
|
"projectKey",
|
|
719
719
|
"version",
|
|
@@ -726,7 +726,7 @@ const Zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), te = {
|
|
|
726
726
|
"kinds",
|
|
727
727
|
"capture",
|
|
728
728
|
"onBeforeCapture"
|
|
729
|
-
]),
|
|
729
|
+
]), re = {
|
|
730
730
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
731
731
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
732
732
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -735,43 +735,43 @@ const Zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), te = {
|
|
|
735
735
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
736
736
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
737
737
|
};
|
|
738
|
-
function
|
|
739
|
-
const n = e.warn ||
|
|
740
|
-
for (const o of
|
|
741
|
-
Object.prototype.hasOwnProperty.call(r, o) && (
|
|
742
|
-
for (const [o, c] of Object.entries(
|
|
743
|
-
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(
|
|
738
|
+
function ar(t = {}, e = {}) {
|
|
739
|
+
const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = {}, a = [];
|
|
740
|
+
for (const o of te)
|
|
741
|
+
Object.prototype.hasOwnProperty.call(r, o) && (i[o] = r[o]);
|
|
742
|
+
for (const [o, c] of Object.entries(ee))
|
|
743
|
+
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(i, c) || (i[c] = r[o]));
|
|
744
744
|
for (const o of Object.keys(r))
|
|
745
|
-
|
|
746
|
-
if (
|
|
747
|
-
const o =
|
|
745
|
+
te.has(o) || Object.prototype.hasOwnProperty.call(ee, o) || a.push(o);
|
|
746
|
+
if (a.length) {
|
|
747
|
+
const o = a.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
748
748
|
n(
|
|
749
|
-
`Notefully.identify: ignoring unknown key(s): ${
|
|
749
|
+
`Notefully.identify: ignoring unknown key(s): ${a.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + o
|
|
750
750
|
);
|
|
751
751
|
}
|
|
752
|
-
return
|
|
753
|
-
}
|
|
754
|
-
function
|
|
755
|
-
const n = e.warn ||
|
|
756
|
-
if (
|
|
757
|
-
for (const
|
|
758
|
-
if (
|
|
759
|
-
n(`Notefully.init: ignoring "${
|
|
752
|
+
return i;
|
|
753
|
+
}
|
|
754
|
+
function or(t = {}, e = {}) {
|
|
755
|
+
const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((a) => !ne.has(a));
|
|
756
|
+
if (i.length)
|
|
757
|
+
for (const a of i) {
|
|
758
|
+
if (re[a]) {
|
|
759
|
+
n(`Notefully.init: ignoring "${a}". ${re[a]}`);
|
|
760
760
|
continue;
|
|
761
761
|
}
|
|
762
762
|
n(
|
|
763
|
-
`Notefully.init: ignoring unknown key "${
|
|
763
|
+
`Notefully.init: ignoring unknown key "${a}". Supported: ${[...ne].join(", ")}.`
|
|
764
764
|
);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function Ce(t) {
|
|
768
768
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
769
769
|
}
|
|
770
|
-
const
|
|
771
|
-
function
|
|
770
|
+
const sr = 80;
|
|
771
|
+
function cr() {
|
|
772
772
|
const t = [], e = {};
|
|
773
773
|
let n = !1;
|
|
774
|
-
const r = (
|
|
774
|
+
const r = (a, o) => {
|
|
775
775
|
let c = "";
|
|
776
776
|
try {
|
|
777
777
|
c = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
@@ -779,21 +779,21 @@ function ir() {
|
|
|
779
779
|
c = String(o[0]);
|
|
780
780
|
}
|
|
781
781
|
t.push({
|
|
782
|
-
level:
|
|
782
|
+
level: a,
|
|
783
783
|
text: c.slice(0, 2e3),
|
|
784
784
|
at: Date.now()
|
|
785
|
-
}), t.length >
|
|
785
|
+
}), t.length > sr && t.shift();
|
|
786
786
|
};
|
|
787
787
|
return {
|
|
788
788
|
hook: () => {
|
|
789
|
-
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((
|
|
790
|
-
e[
|
|
791
|
-
r(
|
|
789
|
+
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((a) => {
|
|
790
|
+
e[a] = console[a].bind(console), console[a] = (...o) => {
|
|
791
|
+
r(a, o), e[a](...o);
|
|
792
792
|
};
|
|
793
|
-
}), window.addEventListener("error", (
|
|
794
|
-
r("error", [
|
|
795
|
-
}), window.addEventListener("unhandledrejection", (
|
|
796
|
-
r("error", [
|
|
793
|
+
}), window.addEventListener("error", (a) => {
|
|
794
|
+
r("error", [a.message || "window.error"]);
|
|
795
|
+
}), window.addEventListener("unhandledrejection", (a) => {
|
|
796
|
+
r("error", [a.reason || "unhandledrejection"]);
|
|
797
797
|
}));
|
|
798
798
|
},
|
|
799
799
|
snapshot() {
|
|
@@ -801,10 +801,10 @@ function ir() {
|
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
-
function
|
|
804
|
+
function lr(t) {
|
|
805
805
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
806
806
|
let n = null, r = !1;
|
|
807
|
-
const
|
|
807
|
+
const i = () => {
|
|
808
808
|
if (r = !1, n)
|
|
809
809
|
try {
|
|
810
810
|
n.stop();
|
|
@@ -815,7 +815,7 @@ function ar(t) {
|
|
|
815
815
|
start: () => {
|
|
816
816
|
if (!e)
|
|
817
817
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
818
|
-
return r ? (
|
|
818
|
+
return r ? (i(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (o) => {
|
|
819
819
|
let c = "";
|
|
820
820
|
for (let l = o.resultIndex; l < o.results.length; l += 1)
|
|
821
821
|
o.results[l].isFinal && (c += o.results[l][0].transcript);
|
|
@@ -826,24 +826,24 @@ function ar(t) {
|
|
|
826
826
|
r = !1;
|
|
827
827
|
}, n.start(), r = !0, !0);
|
|
828
828
|
},
|
|
829
|
-
stop:
|
|
829
|
+
stop: i,
|
|
830
830
|
isSupported: () => !!e,
|
|
831
831
|
isActive: () => r
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
|
-
const
|
|
835
|
-
function
|
|
836
|
-
let r = null,
|
|
834
|
+
const ur = 60 * 1e3;
|
|
835
|
+
function dr({ onStart: t, onStop: e, onError: n }) {
|
|
836
|
+
let r = null, i = null, a = [], o = null;
|
|
837
837
|
const c = () => {
|
|
838
|
-
if (o && (clearTimeout(o), o = null),
|
|
838
|
+
if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
|
|
839
839
|
try {
|
|
840
|
-
|
|
840
|
+
i.stop();
|
|
841
841
|
} catch {
|
|
842
842
|
}
|
|
843
843
|
r && (r.getTracks().forEach((f) => f.stop()), r = null);
|
|
844
844
|
}, l = () => {
|
|
845
|
-
if (
|
|
846
|
-
|
|
845
|
+
if (i && i.state === "recording") {
|
|
846
|
+
i.stop();
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
849
|
c(), e(null);
|
|
@@ -857,17 +857,17 @@ function sr({ onStart: t, onStop: e, onError: n }) {
|
|
|
857
857
|
audio: !1,
|
|
858
858
|
preferCurrentTab: !0,
|
|
859
859
|
selfBrowserSurface: "include"
|
|
860
|
-
}),
|
|
860
|
+
}), a = [], i = new MediaRecorder(r, {
|
|
861
861
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
862
|
-
}),
|
|
863
|
-
g.data && g.data.size &&
|
|
864
|
-
},
|
|
865
|
-
const g =
|
|
862
|
+
}), i.ondataavailable = (g) => {
|
|
863
|
+
g.data && g.data.size && a.push(g.data);
|
|
864
|
+
}, i.onstop = () => {
|
|
865
|
+
const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
|
|
866
866
|
c(), e(g);
|
|
867
|
-
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()),
|
|
867
|
+
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, ur);
|
|
868
868
|
}, stop: l };
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function fr() {
|
|
871
871
|
const t = /* @__PURE__ */ new Set();
|
|
872
872
|
return {
|
|
873
873
|
alloc() {
|
|
@@ -885,64 +885,64 @@ function cr() {
|
|
|
885
885
|
}
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
-
const
|
|
889
|
-
function
|
|
890
|
-
const t =
|
|
891
|
-
let e = [], n = { ...
|
|
888
|
+
const xt = { x: 0, y: 0, w: 1, h: 1 };
|
|
889
|
+
function Ht() {
|
|
890
|
+
const t = fr();
|
|
891
|
+
let e = [], n = { ...xt }, r = 1;
|
|
892
892
|
return {
|
|
893
|
-
list: () => e.filter((
|
|
893
|
+
list: () => e.filter((a) => pr(a, n)),
|
|
894
894
|
all: () => e.slice(),
|
|
895
895
|
crop: () => ({ ...n }),
|
|
896
|
-
setCrop(
|
|
897
|
-
return n =
|
|
896
|
+
setCrop(a) {
|
|
897
|
+
return n = hr(a), n;
|
|
898
898
|
},
|
|
899
899
|
resetCrop() {
|
|
900
|
-
return n = { ...
|
|
900
|
+
return n = { ...xt }, n;
|
|
901
901
|
},
|
|
902
902
|
isCropped() {
|
|
903
903
|
return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
|
|
904
904
|
},
|
|
905
|
-
add(
|
|
905
|
+
add(a, o) {
|
|
906
906
|
const c = {
|
|
907
907
|
id: `s${r++}`,
|
|
908
|
-
type:
|
|
908
|
+
type: a,
|
|
909
909
|
number: t.alloc(),
|
|
910
910
|
x: 0.2,
|
|
911
911
|
y: 0.2,
|
|
912
|
-
w:
|
|
913
|
-
h:
|
|
912
|
+
w: a === "arrow" ? 0.2 : 0.22,
|
|
913
|
+
h: a === "arrow" ? 0.05 : 0.16,
|
|
914
914
|
x2: 0.4,
|
|
915
915
|
y2: 0.28,
|
|
916
916
|
...o
|
|
917
917
|
};
|
|
918
918
|
return e.push(c), c;
|
|
919
919
|
},
|
|
920
|
-
update(
|
|
921
|
-
const c = e.find((l) => l.id ===
|
|
920
|
+
update(a, o) {
|
|
921
|
+
const c = e.find((l) => l.id === a);
|
|
922
922
|
return c ? (Object.assign(c, o), c) : null;
|
|
923
923
|
},
|
|
924
|
-
remove(
|
|
925
|
-
const o = e.findIndex((l) => l.id ===
|
|
924
|
+
remove(a) {
|
|
925
|
+
const o = e.findIndex((l) => l.id === a);
|
|
926
926
|
if (o < 0)
|
|
927
927
|
return null;
|
|
928
928
|
const [c] = e.splice(o, 1);
|
|
929
929
|
return t.free(c.number), c;
|
|
930
930
|
},
|
|
931
931
|
reset() {
|
|
932
|
-
for (e = [], n = { ...
|
|
932
|
+
for (e = [], n = { ...xt }, r = 1; t.peekUsed().length; )
|
|
933
933
|
t.free(t.peekUsed()[0]);
|
|
934
934
|
}
|
|
935
935
|
};
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
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),
|
|
939
|
-
return { x: e, y: n, w: r, h:
|
|
937
|
+
function hr(t) {
|
|
938
|
+
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
939
|
+
return { x: e, y: n, w: r, h: i };
|
|
940
940
|
}
|
|
941
|
-
function
|
|
941
|
+
function pr(t, e) {
|
|
942
942
|
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;
|
|
943
943
|
return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
945
|
+
function Ft(t) {
|
|
946
946
|
const e = Math.max(1, Number(t) || 1);
|
|
947
947
|
return {
|
|
948
948
|
stroke: Math.max(2, e * 75e-4),
|
|
@@ -952,20 +952,20 @@ function Bt(t) {
|
|
|
952
952
|
arrowHeadAngle: 0.4
|
|
953
953
|
};
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function mr(t, {
|
|
956
956
|
stickers: e = [],
|
|
957
957
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
958
958
|
width: r,
|
|
959
|
-
height:
|
|
960
|
-
colors:
|
|
959
|
+
height: i,
|
|
960
|
+
colors: a = {}
|
|
961
961
|
}) {
|
|
962
|
-
const o =
|
|
962
|
+
const o = a.mark || "#fdd341", c = a.markText || "#2a2140", l = Ft(r);
|
|
963
963
|
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = o, t.fillStyle = o, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
964
|
-
const f =
|
|
964
|
+
const f = Rt(u.x, n, r), m = kt(u.y, n, i), g = u.w / n.w * r, S = u.h / n.h * i, R = l.stroke / 2;
|
|
965
965
|
if (u.type === "rect")
|
|
966
966
|
t.strokeRect(
|
|
967
|
-
f +
|
|
968
|
-
m +
|
|
967
|
+
f + R,
|
|
968
|
+
m + R,
|
|
969
969
|
Math.max(0, g - l.stroke),
|
|
970
970
|
Math.max(0, S - l.stroke)
|
|
971
971
|
);
|
|
@@ -973,63 +973,63 @@ function dr(t, {
|
|
|
973
973
|
t.beginPath(), t.ellipse(
|
|
974
974
|
f + g / 2,
|
|
975
975
|
m + S / 2,
|
|
976
|
-
Math.max(0.5, g / 2 -
|
|
977
|
-
Math.max(0.5, S / 2 -
|
|
976
|
+
Math.max(0.5, g / 2 - R),
|
|
977
|
+
Math.max(0.5, S / 2 - R),
|
|
978
978
|
0,
|
|
979
979
|
0,
|
|
980
980
|
Math.PI * 2
|
|
981
981
|
), t.stroke();
|
|
982
982
|
else if (u.type === "arrow") {
|
|
983
|
-
const
|
|
984
|
-
|
|
983
|
+
const q = Rt(u.x2 ?? u.x + u.w, n, r), X = kt(u.y2 ?? u.y, n, i);
|
|
984
|
+
gr(t, f, m, q, X, l);
|
|
985
985
|
}
|
|
986
986
|
if (u.number == null || u.number === "")
|
|
987
987
|
return;
|
|
988
|
-
const
|
|
989
|
-
t.beginPath(), t.arc(
|
|
988
|
+
const D = yr(u, n, r, i, f, m, g), Z = String(u.number);
|
|
989
|
+
t.beginPath(), t.arc(D.x, D.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Z, D.x, D.y + 0.5), t.fillStyle = o;
|
|
990
990
|
}), t.restore();
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function Rt(t, e, n) {
|
|
993
993
|
return (t - e.x) / e.w * n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function kt(t, e, n) {
|
|
996
996
|
return (t - e.y) / e.h * n;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function yr(t, e, n, r, i, a, o) {
|
|
999
999
|
if (t.type === "arrow") {
|
|
1000
|
-
const c =
|
|
1000
|
+
const c = Rt(t.x2 ?? t.x + t.w, e, n), l = kt(t.y2 ?? t.y, e, r);
|
|
1001
1001
|
return {
|
|
1002
|
-
x: (
|
|
1003
|
-
y: (
|
|
1002
|
+
x: (i + c) / 2,
|
|
1003
|
+
y: (a + l) / 2
|
|
1004
1004
|
};
|
|
1005
1005
|
}
|
|
1006
|
-
return { x:
|
|
1006
|
+
return { x: i + o / 2, y: a };
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const
|
|
1010
|
-
x: l - o * Math.cos(
|
|
1011
|
-
y: u - o * Math.sin(
|
|
1008
|
+
function Ae(t, e, n, r, i) {
|
|
1009
|
+
const a = Math.atan2(r - e, n - t), o = i.arrowHead, c = Math.min(i.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(a) * o, m = r - Math.sin(a) * o, g = {
|
|
1010
|
+
x: l - o * Math.cos(a - i.arrowHeadAngle),
|
|
1011
|
+
y: u - o * Math.sin(a - i.arrowHeadAngle)
|
|
1012
1012
|
}, S = {
|
|
1013
|
-
x: l - o * Math.cos(
|
|
1014
|
-
y: u - o * Math.sin(
|
|
1015
|
-
},
|
|
1016
|
-
x: n - Math.cos(
|
|
1017
|
-
y: r - Math.sin(
|
|
1013
|
+
x: l - o * Math.cos(a + i.arrowHeadAngle),
|
|
1014
|
+
y: u - o * Math.sin(a + i.arrowHeadAngle)
|
|
1015
|
+
}, R = {
|
|
1016
|
+
x: n - Math.cos(a) * c,
|
|
1017
|
+
y: r - Math.sin(a) * c
|
|
1018
1018
|
};
|
|
1019
|
-
return { angle:
|
|
1019
|
+
return { angle: a, tipX: l, tipY: u, baseX: f, baseY: m, left: g, right: S, shaftEnd: R };
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1022
|
-
const o =
|
|
1021
|
+
function gr(t, e, n, r, i, a) {
|
|
1022
|
+
const o = Ae(e, n, r, i, a);
|
|
1023
1023
|
t.beginPath(), t.moveTo(e, n), t.lineTo(o.shaftEnd.x, o.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(o.tipX, o.tipY), t.lineTo(o.left.x, o.left.y), t.lineTo(o.right.x, o.right.y), t.closePath(), t.fill();
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
return new Promise((
|
|
1025
|
+
function wr(t, e, n, r = {}) {
|
|
1026
|
+
return new Promise((i, a) => {
|
|
1027
1027
|
const o = new Image();
|
|
1028
1028
|
o.onload = () => {
|
|
1029
1029
|
const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), m = document.createElement("canvas");
|
|
1030
1030
|
m.width = u, m.height = f;
|
|
1031
1031
|
const g = m.getContext("2d");
|
|
1032
|
-
g.drawImage(o, c, l, u, f, 0, 0, u, f),
|
|
1032
|
+
g.drawImage(o, c, l, u, f, 0, 0, u, f), mr(g, {
|
|
1033
1033
|
stickers: n,
|
|
1034
1034
|
crop: e,
|
|
1035
1035
|
width: u,
|
|
@@ -1037,15 +1037,15 @@ function pr(t, e, n, r = {}) {
|
|
|
1037
1037
|
colors: r
|
|
1038
1038
|
}), m.toBlob((S) => {
|
|
1039
1039
|
if (!S) {
|
|
1040
|
-
|
|
1040
|
+
a(new Error("Could not encode screenshot"));
|
|
1041
1041
|
return;
|
|
1042
1042
|
}
|
|
1043
|
-
|
|
1043
|
+
i(S);
|
|
1044
1044
|
}, "image/png");
|
|
1045
|
-
}, o.onerror = () =>
|
|
1045
|
+
}, o.onerror = () => a(new Error("Could not load screenshot")), o.src = t;
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
const
|
|
1048
|
+
const vr = [
|
|
1049
1049
|
{ key: "url", label: "URL" },
|
|
1050
1050
|
{ key: "title", label: "Title" },
|
|
1051
1051
|
{ key: "userAgent", label: "User agent" },
|
|
@@ -1056,14 +1056,14 @@ const mr = [
|
|
|
1056
1056
|
{ key: "viewport", label: "Viewport" },
|
|
1057
1057
|
{ key: "user", label: "User" }
|
|
1058
1058
|
];
|
|
1059
|
-
function
|
|
1059
|
+
function br(t) {
|
|
1060
1060
|
return !t || typeof t != "object" ? !1 : !!(t.userId || t.email || t.displayName);
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function Sr(t = {}) {
|
|
1063
1063
|
const e = [];
|
|
1064
|
-
for (const n of
|
|
1064
|
+
for (const n of vr) {
|
|
1065
1065
|
const r = t[n.key];
|
|
1066
|
-
r == null || r === "" || n.key === "user" && !
|
|
1066
|
+
r == null || r === "" || n.key === "user" && !br(r) || e.push({
|
|
1067
1067
|
key: n.key,
|
|
1068
1068
|
label: n.label,
|
|
1069
1069
|
value: r,
|
|
@@ -1072,7 +1072,7 @@ function gr(t = {}) {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
return e;
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function xr(t = []) {
|
|
1076
1076
|
return t.map((e, n) => ({
|
|
1077
1077
|
id: `log-${n}-${e.at || 0}`,
|
|
1078
1078
|
level: e.level || "log",
|
|
@@ -1081,22 +1081,22 @@ function wr(t = []) {
|
|
|
1081
1081
|
redacted: !1
|
|
1082
1082
|
}));
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1084
|
+
function Er(t = []) {
|
|
1085
1085
|
if (!t.length)
|
|
1086
1086
|
return { checked: !1, indeterminate: !1 };
|
|
1087
1087
|
const e = t.filter((n) => n.redacted).length;
|
|
1088
1088
|
return e === 0 ? { checked: !1, indeterminate: !1 } : e === t.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1090
|
+
function ut(t, e) {
|
|
1091
1091
|
t.forEach((n) => {
|
|
1092
1092
|
n.redacted = !!e;
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const e = t.diagnostics || [], n = t.logs || [], r = e.some((
|
|
1097
|
-
return r &&
|
|
1095
|
+
function Cr(t = {}) {
|
|
1096
|
+
const e = t.diagnostics || [], n = t.logs || [], r = e.some((a) => !a.redacted), i = n.length > 0 && n.some((a) => !a.redacted);
|
|
1097
|
+
return r && i ? "Also sending logs and diagnostic information" : r ? "Also sending diagnostic information" : i ? "Also sending logs" : "";
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function Ar(t) {
|
|
1100
1100
|
if (t == null)
|
|
1101
1101
|
return "";
|
|
1102
1102
|
if (typeof t == "string" || typeof t == "number" || typeof t == "boolean")
|
|
@@ -1107,7 +1107,7 @@ function Sr(t) {
|
|
|
1107
1107
|
return String(t);
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function Mr(t = {}) {
|
|
1111
1111
|
const e = {};
|
|
1112
1112
|
t.author != null && t.author !== "" && (e.author = t.author);
|
|
1113
1113
|
for (const r of t.diagnostics || [])
|
|
@@ -1119,7 +1119,7 @@ function xr(t = {}) {
|
|
|
1119
1119
|
}));
|
|
1120
1120
|
return e.console = n, e;
|
|
1121
1121
|
}
|
|
1122
|
-
const
|
|
1122
|
+
const _ = [
|
|
1123
1123
|
{ id: "bug", label: "Bug" },
|
|
1124
1124
|
{ id: "idea", label: "Idea" },
|
|
1125
1125
|
{ id: "other", label: "Other" }
|
|
@@ -1127,48 +1127,48 @@ const W = [
|
|
|
1127
1127
|
function ie(t) {
|
|
1128
1128
|
return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1130
|
+
function Et(t) {
|
|
1131
1131
|
const e = String(t || "").trim();
|
|
1132
1132
|
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function Lr(t) {
|
|
1135
1135
|
if (!Array.isArray(t) || !t.length)
|
|
1136
|
-
return
|
|
1136
|
+
return _.map((r) => ({ ...r }));
|
|
1137
1137
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
1138
1138
|
for (const r of t) {
|
|
1139
|
-
let
|
|
1140
|
-
typeof r == "string" || typeof r == "number" ? (
|
|
1139
|
+
let i = "", a = "";
|
|
1140
|
+
typeof r == "string" || typeof r == "number" ? (i = ie(r), a = Et(i)) : r && typeof r == "object" && (i = ie(r.id ?? r.value ?? r.kind), a = String(r.label || r.name || Et(i)).trim() || Et(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: a }));
|
|
1141
1141
|
}
|
|
1142
|
-
return n.length ? n :
|
|
1142
|
+
return n.length ? n : _.map((r) => ({ ...r }));
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function gt(t) {
|
|
1145
1145
|
var n;
|
|
1146
|
-
const e = Array.isArray(t) && t.length ? t :
|
|
1146
|
+
const e = Array.isArray(t) && t.length ? t : _;
|
|
1147
1147
|
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
1148
1148
|
}
|
|
1149
|
-
const
|
|
1149
|
+
const $r = ["maker", "all-business", "brighter-day", "quiet-night"], Me = "maker", Rr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Tt = 0.02, ae = 0.05, kr = `
|
|
1150
1150
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
1151
1151
|
<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"/>
|
|
1152
1152
|
<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"/>
|
|
1153
1153
|
</svg>
|
|
1154
1154
|
`;
|
|
1155
|
-
function
|
|
1155
|
+
function k(t) {
|
|
1156
1156
|
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>`;
|
|
1157
1157
|
}
|
|
1158
|
-
const
|
|
1159
|
-
crop:
|
|
1160
|
-
resetCrop:
|
|
1161
|
-
arrow:
|
|
1162
|
-
rect:
|
|
1163
|
-
circle:
|
|
1164
|
-
discard:
|
|
1165
|
-
recapture:
|
|
1166
|
-
privacy:
|
|
1167
|
-
audio:
|
|
1168
|
-
video:
|
|
1169
|
-
},
|
|
1170
|
-
|
|
1171
|
-
const $e = 10,
|
|
1158
|
+
const M = {
|
|
1159
|
+
crop: k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
1160
|
+
resetCrop: k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
1161
|
+
arrow: k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
1162
|
+
rect: k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
|
|
1163
|
+
circle: k('<circle cx="12" cy="12" r="8"/>'),
|
|
1164
|
+
discard: k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
1165
|
+
recapture: k('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
|
|
1166
|
+
privacy: k('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
|
|
1167
|
+
audio: k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
|
|
1168
|
+
video: k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
1169
|
+
}, Le = cr();
|
|
1170
|
+
Le.hook();
|
|
1171
|
+
const $e = 10, Tr = 80, Re = "notefully.author", ke = "notefully.kind", Te = "notefully.redactSections", Pt = "Anonymous";
|
|
1172
1172
|
let d = {
|
|
1173
1173
|
endpoint: "",
|
|
1174
1174
|
projectKey: "",
|
|
@@ -1179,21 +1179,21 @@ let d = {
|
|
|
1179
1179
|
theme: Me,
|
|
1180
1180
|
video: !1,
|
|
1181
1181
|
consoleLogLimit: $e,
|
|
1182
|
-
kinds:
|
|
1182
|
+
kinds: _.map((t) => ({ ...t })),
|
|
1183
1183
|
capture: null,
|
|
1184
1184
|
onBeforeCapture: null
|
|
1185
|
-
},
|
|
1185
|
+
}, Ct = !1, T = {}, h = null, s = {}, y = Ht(), I = "", Q = "", P = null, j = gt(_), F = null, L = null, v = null, w = null, ot = null, z = null, tt = null, O = { w: 0, h: 0 }, At = !1, Ut = !1, B = [], $ = [], W = !1;
|
|
1186
1186
|
function p(t) {
|
|
1187
1187
|
return h.querySelector(t);
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function Pe(t) {
|
|
1190
1190
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
1191
|
-
return
|
|
1191
|
+
return $r.includes(e) ? e : Me;
|
|
1192
1192
|
}
|
|
1193
1193
|
function oe(t, e) {
|
|
1194
1194
|
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
1195
1195
|
}
|
|
1196
|
-
async function
|
|
1196
|
+
async function Pr(t) {
|
|
1197
1197
|
return (await fetch(t)).blob();
|
|
1198
1198
|
}
|
|
1199
1199
|
function b(t, e = !1) {
|
|
@@ -1201,21 +1201,21 @@ function b(t, e = !1) {
|
|
|
1201
1201
|
s.status.textContent = "";
|
|
1202
1202
|
}, 4e3)));
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function Nt() {
|
|
1205
1205
|
return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
|
|
1206
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
1206
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${kr}</button>
|
|
1207
1207
|
<div class="nf-dialog" hidden>
|
|
1208
1208
|
<div class="nf-panel">
|
|
1209
1209
|
<div class="nf-panel-body">
|
|
1210
1210
|
<div class="nf-stage" hidden>
|
|
1211
1211
|
<div class="nf-palette">
|
|
1212
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
1213
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
1214
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
1215
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
1216
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
1217
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
1218
|
-
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${
|
|
1212
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${M.crop}</button>
|
|
1213
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${M.resetCrop}</button>
|
|
1214
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${M.arrow}</button>
|
|
1215
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${M.rect}</button>
|
|
1216
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${M.circle}</button>
|
|
1217
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${M.discard}</button>
|
|
1218
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${M.recapture}</button>
|
|
1219
1219
|
</div>
|
|
1220
1220
|
<div class="nf-canvas"></div>
|
|
1221
1221
|
</div>
|
|
@@ -1225,7 +1225,7 @@ function Ut() {
|
|
|
1225
1225
|
<div class="nf-kind"></div>
|
|
1226
1226
|
<div class="nf-privacy-summary">
|
|
1227
1227
|
<span class="nf-privacy-text"></span>
|
|
1228
|
-
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${
|
|
1228
|
+
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${M.privacy}</button>
|
|
1229
1229
|
</div>
|
|
1230
1230
|
</div>
|
|
1231
1231
|
<div class="nf-privacy">
|
|
@@ -1235,9 +1235,9 @@ function Ut() {
|
|
|
1235
1235
|
</div>
|
|
1236
1236
|
</div>
|
|
1237
1237
|
<div class="nf-actions">
|
|
1238
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
1239
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
1240
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
1238
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${M.resetCrop}</button>
|
|
1239
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${M.audio}</button>
|
|
1240
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${M.video}</button>
|
|
1241
1241
|
<button class="nf-submit" type="button">Submit</button>
|
|
1242
1242
|
</div>
|
|
1243
1243
|
<div class="nf-status"></div>
|
|
@@ -1277,52 +1277,71 @@ function Ut() {
|
|
|
1277
1277
|
resetCrop: p(".nf-reset-crop"),
|
|
1278
1278
|
submit: p(".nf-submit"),
|
|
1279
1279
|
shot: null
|
|
1280
|
-
},
|
|
1280
|
+
}, Ir(), nt()), h;
|
|
1281
1281
|
}
|
|
1282
1282
|
function nt() {
|
|
1283
1283
|
var t;
|
|
1284
|
-
h && (h.dataset.theme =
|
|
1284
|
+
h && (h.dataset.theme = Pe(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Ie(), (t = s.dialog) != null && t.hidden && dt());
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function dt() {
|
|
1287
1287
|
s.launcher && (s.launcher.hidden = !!d.hideLauncher);
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1290
|
-
s.launcher.addEventListener("click", () =>
|
|
1291
|
-
|
|
1289
|
+
function Ir() {
|
|
1290
|
+
s.launcher.addEventListener("click", () => Ye()), p(".nf-dialog").addEventListener("click", (e) => {
|
|
1291
|
+
Ut || e.target === s.dialog && at();
|
|
1292
1292
|
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1293
1293
|
e.addEventListener("click", () => et(e.dataset.tool));
|
|
1294
|
-
}), s.resetCrop.addEventListener("click",
|
|
1294
|
+
}), s.resetCrop.addEventListener("click", Vr), s.canvas.addEventListener("pointerdown", Fr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1295
1295
|
const t = p(".nf-kind");
|
|
1296
1296
|
t && t.addEventListener("click", (e) => {
|
|
1297
1297
|
const n = e.target.closest("[data-kind]");
|
|
1298
|
-
n &&
|
|
1299
|
-
}), s.discard.addEventListener("click",
|
|
1300
|
-
|
|
1301
|
-
}), s.restore.addEventListener("click",
|
|
1302
|
-
|
|
1303
|
-
}),
|
|
1298
|
+
n && jt(n.dataset.kind);
|
|
1299
|
+
}), s.discard.addEventListener("click", Wr), s.recapture.addEventListener("click", () => {
|
|
1300
|
+
Kr().catch((e) => b(e.message || "Recapture failed."));
|
|
1301
|
+
}), s.restore.addEventListener("click", zr), s.audio.addEventListener("click", qr), s.video.addEventListener("click", Xr), s.stop.addEventListener("click", () => tt == null ? void 0 : tt.stop()), s.privacyChange.addEventListener("click", () => mt(!W)), s.privacyDone.addEventListener("click", () => mt(!1)), s.privacyScroll.addEventListener("change", ii), p(".nf-submit").addEventListener("click", () => {
|
|
1302
|
+
Je().catch((e) => b(e.message || "Submit failed."));
|
|
1303
|
+
}), Ie(), et(null);
|
|
1304
1304
|
}
|
|
1305
1305
|
function C(t) {
|
|
1306
1306
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function Ie() {
|
|
1309
1309
|
const t = h == null ? void 0 : h.querySelector(".nf-kind");
|
|
1310
1310
|
if (!t)
|
|
1311
1311
|
return;
|
|
1312
|
-
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds :
|
|
1313
|
-
t.innerHTML = e.map((
|
|
1314
|
-
const r = e.map((
|
|
1315
|
-
|
|
1316
|
-
}
|
|
1317
|
-
function
|
|
1318
|
-
|
|
1319
|
-
n.dataset.active = String(n.dataset.kind ===
|
|
1320
|
-
});
|
|
1312
|
+
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : _;
|
|
1313
|
+
t.innerHTML = e.map((i) => `<button type="button" data-kind="${C(i.id)}">${C(i.label)}</button>`).join("");
|
|
1314
|
+
const r = e.map((i) => i.id).includes(j) ? j : gt(e);
|
|
1315
|
+
jt(r);
|
|
1316
|
+
}
|
|
1317
|
+
function jt(t) {
|
|
1318
|
+
j = (d.kinds || _).map((n) => n.id).includes(t) ? t : gt(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1319
|
+
n.dataset.active = String(n.dataset.kind === j);
|
|
1320
|
+
}), Br(j);
|
|
1321
|
+
}
|
|
1322
|
+
function Or() {
|
|
1323
|
+
try {
|
|
1324
|
+
return String(localStorage.getItem(ke) || "").trim().toLowerCase();
|
|
1325
|
+
} catch {
|
|
1326
|
+
return "";
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
function Br(t) {
|
|
1330
|
+
const e = String(t || "").trim().toLowerCase();
|
|
1331
|
+
if (e)
|
|
1332
|
+
try {
|
|
1333
|
+
localStorage.setItem(ke, e);
|
|
1334
|
+
} catch {
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function Dr() {
|
|
1338
|
+
const t = (d.kinds || _).map((n) => n.id), e = Or();
|
|
1339
|
+
return e && t.includes(e) ? e : gt(d.kinds);
|
|
1321
1340
|
}
|
|
1322
1341
|
function et(t) {
|
|
1323
|
-
|
|
1324
|
-
e.dataset.active = String(e.dataset.tool ===
|
|
1325
|
-
}), s.canvas && (s.canvas.dataset.draw =
|
|
1342
|
+
F = Rr.has(t) ? t : null, L = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1343
|
+
e.dataset.active = String(e.dataset.tool === F);
|
|
1344
|
+
}), s.canvas && (s.canvas.dataset.draw = F ? "true" : "false"), V() && A();
|
|
1326
1345
|
}
|
|
1327
1346
|
function se(t) {
|
|
1328
1347
|
return Math.min(1, Math.max(0, t));
|
|
@@ -1330,34 +1349,34 @@ function se(t) {
|
|
|
1330
1349
|
function rt() {
|
|
1331
1350
|
return s.shot || s.canvas;
|
|
1332
1351
|
}
|
|
1333
|
-
function
|
|
1352
|
+
function ft(t) {
|
|
1334
1353
|
const e = rt().getBoundingClientRect();
|
|
1335
1354
|
return {
|
|
1336
1355
|
x: se((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1337
1356
|
y: se((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1338
1357
|
};
|
|
1339
1358
|
}
|
|
1340
|
-
function
|
|
1359
|
+
function Hr(t) {
|
|
1341
1360
|
const e = rt().getBoundingClientRect();
|
|
1342
1361
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1343
1362
|
}
|
|
1344
|
-
function
|
|
1345
|
-
const e =
|
|
1363
|
+
function Oe(t) {
|
|
1364
|
+
const e = ft(t), n = y.crop();
|
|
1346
1365
|
return {
|
|
1347
1366
|
x: n.x + e.x * n.w,
|
|
1348
1367
|
y: n.y + e.y * n.h
|
|
1349
1368
|
};
|
|
1350
1369
|
}
|
|
1351
|
-
function
|
|
1370
|
+
function wt(t, e) {
|
|
1352
1371
|
const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
|
|
1353
1372
|
return {
|
|
1354
1373
|
x: n,
|
|
1355
1374
|
y: r,
|
|
1356
|
-
w: Math.max(
|
|
1357
|
-
h: Math.max(
|
|
1375
|
+
w: Math.max(Tt, Math.abs(e.x - t.x)),
|
|
1376
|
+
h: Math.max(Tt, Math.abs(e.y - t.y))
|
|
1358
1377
|
};
|
|
1359
1378
|
}
|
|
1360
|
-
function
|
|
1379
|
+
function _t(t) {
|
|
1361
1380
|
h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
|
|
1362
1381
|
}
|
|
1363
1382
|
function Mt(t) {
|
|
@@ -1366,43 +1385,43 @@ function Mt(t) {
|
|
|
1366
1385
|
} catch {
|
|
1367
1386
|
}
|
|
1368
1387
|
}
|
|
1369
|
-
function
|
|
1370
|
-
window.addEventListener("pointermove",
|
|
1388
|
+
function It() {
|
|
1389
|
+
window.addEventListener("pointermove", De), window.addEventListener("pointerup", ht), window.addEventListener("pointercancel", ht);
|
|
1371
1390
|
}
|
|
1372
|
-
function
|
|
1373
|
-
window.removeEventListener("pointermove",
|
|
1391
|
+
function Be() {
|
|
1392
|
+
window.removeEventListener("pointermove", De), window.removeEventListener("pointerup", ht), window.removeEventListener("pointercancel", ht);
|
|
1374
1393
|
}
|
|
1375
|
-
function
|
|
1376
|
-
if (t.button !== 0 || !
|
|
1394
|
+
function Fr(t) {
|
|
1395
|
+
if (t.button !== 0 || !V())
|
|
1377
1396
|
return;
|
|
1378
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1379
|
-
|
|
1397
|
+
if (!t.target.closest(".nf-sticker") && !Hr(t)) {
|
|
1398
|
+
L = null, A();
|
|
1380
1399
|
return;
|
|
1381
1400
|
}
|
|
1382
1401
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1383
1402
|
if (n && n.dataset.preview !== "true") {
|
|
1384
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1403
|
+
t.preventDefault(), t.stopPropagation(), L = n.dataset.id, Mt(t), Ur({
|
|
1385
1404
|
kind: "sticker",
|
|
1386
|
-
id:
|
|
1405
|
+
id: L,
|
|
1387
1406
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
1388
|
-
}, t),
|
|
1407
|
+
}, t), A();
|
|
1389
1408
|
return;
|
|
1390
1409
|
}
|
|
1391
|
-
if (
|
|
1392
|
-
t.preventDefault(), Mt(t), v = { kind: "crop", start:
|
|
1410
|
+
if (L = null, F === "crop") {
|
|
1411
|
+
t.preventDefault(), Mt(t), v = { kind: "crop", start: ft(t), current: ft(t) }, It(), A();
|
|
1393
1412
|
return;
|
|
1394
1413
|
}
|
|
1395
|
-
if (
|
|
1414
|
+
if (F === "arrow" || F === "rect" || F === "circle") {
|
|
1396
1415
|
t.preventDefault(), Mt(t);
|
|
1397
|
-
const r =
|
|
1398
|
-
v = { kind: "sticker", type:
|
|
1416
|
+
const r = Oe(t);
|
|
1417
|
+
v = { kind: "sticker", type: F, start: r, current: r }, It(), A();
|
|
1399
1418
|
return;
|
|
1400
1419
|
}
|
|
1401
|
-
|
|
1420
|
+
A();
|
|
1402
1421
|
}
|
|
1403
|
-
function
|
|
1422
|
+
function Ur(t, e) {
|
|
1404
1423
|
e.preventDefault(), e.stopPropagation();
|
|
1405
|
-
const n = rt().getBoundingClientRect(), r = y.list().find((
|
|
1424
|
+
const n = rt().getBoundingClientRect(), r = y.list().find((i) => i.id === t.id);
|
|
1406
1425
|
w = {
|
|
1407
1426
|
...t,
|
|
1408
1427
|
startX: e.clientX,
|
|
@@ -1410,11 +1429,11 @@ function Pr(t, e) {
|
|
|
1410
1429
|
crop: y.crop(),
|
|
1411
1430
|
sticker: r ? { ...r } : null,
|
|
1412
1431
|
rect: n
|
|
1413
|
-
},
|
|
1432
|
+
}, _t(t.dir === "move" || t.dir === "start" || t.dir === "end"), It();
|
|
1414
1433
|
}
|
|
1415
|
-
function
|
|
1434
|
+
function De(t) {
|
|
1416
1435
|
if (v) {
|
|
1417
|
-
v.current = v.kind === "crop" ?
|
|
1436
|
+
v.current = v.kind === "crop" ? ft(t) : Oe(t), A();
|
|
1418
1437
|
return;
|
|
1419
1438
|
}
|
|
1420
1439
|
if (!w)
|
|
@@ -1439,61 +1458,61 @@ function Ie(t) {
|
|
|
1439
1458
|
y2: (r.y2 || r.y) + n
|
|
1440
1459
|
});
|
|
1441
1460
|
else {
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1461
|
+
const i = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1462
|
+
Nr(i, w.dir, e, n), y.update(r.id, i);
|
|
1444
1463
|
}
|
|
1445
|
-
|
|
1464
|
+
A();
|
|
1446
1465
|
}
|
|
1447
1466
|
}
|
|
1448
|
-
function
|
|
1467
|
+
function Nr(t, e, n, r) {
|
|
1449
1468
|
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")) {
|
|
1450
|
-
const
|
|
1451
|
-
t.x += t.w -
|
|
1469
|
+
const i = Math.max(0.04, t.w - n);
|
|
1470
|
+
t.x += t.w - i, t.w = i;
|
|
1452
1471
|
}
|
|
1453
1472
|
if (e.includes("n")) {
|
|
1454
|
-
const
|
|
1455
|
-
t.y += t.h -
|
|
1473
|
+
const i = Math.max(0.04, t.h - r);
|
|
1474
|
+
t.y += t.h - i, t.h = i;
|
|
1456
1475
|
}
|
|
1457
1476
|
}
|
|
1458
|
-
function
|
|
1459
|
-
if (
|
|
1460
|
-
|
|
1477
|
+
function ht(t) {
|
|
1478
|
+
if (Be(), _t(!1), v) {
|
|
1479
|
+
jr();
|
|
1461
1480
|
return;
|
|
1462
1481
|
}
|
|
1463
1482
|
if (w) {
|
|
1464
1483
|
if (w.kind === "sticker") {
|
|
1465
1484
|
const e = s.canvas.getBoundingClientRect();
|
|
1466
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id),
|
|
1485
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id), L = null);
|
|
1467
1486
|
}
|
|
1468
|
-
w = null,
|
|
1487
|
+
w = null, A();
|
|
1469
1488
|
}
|
|
1470
1489
|
}
|
|
1471
|
-
function
|
|
1490
|
+
function jr() {
|
|
1472
1491
|
const t = v;
|
|
1473
1492
|
if (v = null, !t)
|
|
1474
1493
|
return;
|
|
1475
1494
|
if (t.kind === "crop") {
|
|
1476
|
-
const n =
|
|
1495
|
+
const n = wt(t.start, t.current);
|
|
1477
1496
|
if (Math.abs(t.current.x - t.start.x) < ae || Math.abs(t.current.y - t.start.y) < ae) {
|
|
1478
|
-
|
|
1497
|
+
A();
|
|
1479
1498
|
return;
|
|
1480
1499
|
}
|
|
1481
|
-
const
|
|
1500
|
+
const i = y.crop();
|
|
1482
1501
|
y.setCrop({
|
|
1483
|
-
x:
|
|
1484
|
-
y:
|
|
1485
|
-
w: n.w *
|
|
1486
|
-
h: n.h *
|
|
1487
|
-
}),
|
|
1502
|
+
x: i.x + n.x * i.w,
|
|
1503
|
+
y: i.y + n.y * i.h,
|
|
1504
|
+
w: n.w * i.w,
|
|
1505
|
+
h: n.h * i.h
|
|
1506
|
+
}), K();
|
|
1488
1507
|
return;
|
|
1489
1508
|
}
|
|
1490
|
-
const e =
|
|
1491
|
-
e && (
|
|
1509
|
+
const e = _r(t);
|
|
1510
|
+
e && (L = e.id), A();
|
|
1492
1511
|
}
|
|
1493
|
-
function
|
|
1512
|
+
function _r(t) {
|
|
1494
1513
|
if (t.type === "arrow") {
|
|
1495
1514
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1496
|
-
return Math.hypot(e, n) <
|
|
1515
|
+
return Math.hypot(e, n) < Tt ? y.add("arrow", {
|
|
1497
1516
|
x: t.start.x,
|
|
1498
1517
|
y: t.start.y,
|
|
1499
1518
|
x2: t.start.x + 0.12,
|
|
@@ -1509,89 +1528,89 @@ function Hr(t) {
|
|
|
1509
1528
|
h: Math.abs(n)
|
|
1510
1529
|
});
|
|
1511
1530
|
}
|
|
1512
|
-
return y.add(t.type,
|
|
1531
|
+
return y.add(t.type, wt(t.start, t.current));
|
|
1513
1532
|
}
|
|
1514
|
-
function
|
|
1515
|
-
y.resetCrop(),
|
|
1533
|
+
function Vr() {
|
|
1534
|
+
y.resetCrop(), L = null, K();
|
|
1516
1535
|
}
|
|
1517
|
-
function
|
|
1536
|
+
function pt() {
|
|
1518
1537
|
s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
|
|
1519
1538
|
}
|
|
1520
|
-
function
|
|
1539
|
+
function Vt(t) {
|
|
1521
1540
|
if (!s.audio)
|
|
1522
1541
|
return;
|
|
1523
1542
|
const e = t ? "Stop audio" : "Record audio";
|
|
1524
1543
|
s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
|
|
1525
1544
|
}
|
|
1526
|
-
function
|
|
1527
|
-
return
|
|
1545
|
+
function V() {
|
|
1546
|
+
return N(I);
|
|
1528
1547
|
}
|
|
1529
1548
|
function it() {
|
|
1530
1549
|
if (!s.stage || !s.palette || !s.actions || !s.recapture)
|
|
1531
1550
|
return;
|
|
1532
|
-
const t =
|
|
1533
|
-
s.stage.hidden = !t && !
|
|
1551
|
+
const t = V();
|
|
1552
|
+
s.stage.hidden = !t && !P, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !Q), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
|
|
1534
1553
|
}
|
|
1535
|
-
function
|
|
1536
|
-
|
|
1554
|
+
function Wr() {
|
|
1555
|
+
V() && (Q = I), I = "", et(null), it(), K();
|
|
1537
1556
|
}
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1557
|
+
function zr() {
|
|
1558
|
+
N(Q) && (I = Q, it(), K());
|
|
1540
1559
|
}
|
|
1541
|
-
function
|
|
1560
|
+
function He() {
|
|
1542
1561
|
return {
|
|
1543
1562
|
capture: typeof d.capture == "function" ? d.capture : void 0,
|
|
1544
1563
|
onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
|
|
1545
1564
|
};
|
|
1546
1565
|
}
|
|
1547
|
-
function
|
|
1548
|
-
if (!
|
|
1566
|
+
function Fe(t) {
|
|
1567
|
+
if (!N(t))
|
|
1549
1568
|
throw new Error("Screenshot failed; you can still send text.");
|
|
1550
|
-
|
|
1569
|
+
I = t, Q = t, y = Ht(), O = { w: 0, h: 0 }, L = null, v = null, w = null, et(null);
|
|
1551
1570
|
}
|
|
1552
|
-
async function
|
|
1553
|
-
if (!(
|
|
1554
|
-
|
|
1571
|
+
async function Kr() {
|
|
1572
|
+
if (!(Ct || !s.dialog || s.dialog.hidden)) {
|
|
1573
|
+
Ct = !0, s.recapture.disabled = !0, b("Capturing…", !0), s.dialog.hidden = !0;
|
|
1555
1574
|
try {
|
|
1556
1575
|
let t = "";
|
|
1557
1576
|
try {
|
|
1558
|
-
t = await
|
|
1577
|
+
t = await er();
|
|
1559
1578
|
} catch {
|
|
1560
|
-
t = await
|
|
1579
|
+
t = await Ee(He());
|
|
1561
1580
|
}
|
|
1562
|
-
|
|
1581
|
+
Fe(t), b("");
|
|
1563
1582
|
} catch (t) {
|
|
1564
1583
|
b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1565
1584
|
} finally {
|
|
1566
|
-
s.dialog.hidden = !1, s.recapture.disabled = !1,
|
|
1585
|
+
s.dialog.hidden = !1, s.recapture.disabled = !1, Ct = !1, it(), K();
|
|
1567
1586
|
}
|
|
1568
1587
|
}
|
|
1569
1588
|
}
|
|
1570
|
-
function
|
|
1589
|
+
function qr() {
|
|
1571
1590
|
try {
|
|
1572
|
-
if (
|
|
1591
|
+
if (z || (z = lr((e) => {
|
|
1573
1592
|
const n = s.text.value.trim();
|
|
1574
1593
|
s.text.value = n ? `${n} ${e}` : e;
|
|
1575
|
-
})), !
|
|
1594
|
+
})), !z.isSupported()) {
|
|
1576
1595
|
b("Audio-to-text is not supported in this browser.");
|
|
1577
1596
|
return;
|
|
1578
1597
|
}
|
|
1579
|
-
const t =
|
|
1580
|
-
|
|
1598
|
+
const t = z.start();
|
|
1599
|
+
Vt(t), b(t ? "Listening…" : "");
|
|
1581
1600
|
} catch (t) {
|
|
1582
1601
|
b(t.message);
|
|
1583
1602
|
}
|
|
1584
1603
|
}
|
|
1585
|
-
async function
|
|
1604
|
+
async function Xr() {
|
|
1586
1605
|
if (!d.video) {
|
|
1587
1606
|
b("Video is disabled on this host.");
|
|
1588
1607
|
return;
|
|
1589
1608
|
}
|
|
1590
|
-
s.dialog.hidden = !0, s.stop.hidden = !1, nt(), s.launcher.hidden = !0, tt =
|
|
1609
|
+
s.dialog.hidden = !0, s.stop.hidden = !1, nt(), s.launcher.hidden = !0, tt = dr({
|
|
1591
1610
|
onStart() {
|
|
1592
1611
|
},
|
|
1593
1612
|
onStop(t) {
|
|
1594
|
-
|
|
1613
|
+
P = t, s.stop.hidden = !0, dt(), s.dialog.hidden = !1, it(), K(), b(t ? "Video attached." : "Recording cancelled.");
|
|
1595
1614
|
},
|
|
1596
1615
|
onError(t) {
|
|
1597
1616
|
b(t.message);
|
|
@@ -1600,30 +1619,30 @@ async function jr() {
|
|
|
1600
1619
|
try {
|
|
1601
1620
|
await tt.start();
|
|
1602
1621
|
} catch (t) {
|
|
1603
|
-
s.stop.hidden = !0,
|
|
1622
|
+
s.stop.hidden = !0, dt(), s.dialog.hidden = !1, b(t.message);
|
|
1604
1623
|
}
|
|
1605
1624
|
}
|
|
1606
|
-
function
|
|
1607
|
-
if (s.shot = null, !
|
|
1608
|
-
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML =
|
|
1625
|
+
function K() {
|
|
1626
|
+
if (s.shot = null, !V()) {
|
|
1627
|
+
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = P ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(P)}"></video>` : "", pt();
|
|
1609
1628
|
return;
|
|
1610
1629
|
}
|
|
1611
|
-
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1630
|
+
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${I}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
|
|
1612
1631
|
const t = s.shot.querySelector("img");
|
|
1613
1632
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1614
1633
|
const e = () => {
|
|
1615
|
-
|
|
1634
|
+
Yr(t), A();
|
|
1616
1635
|
};
|
|
1617
|
-
t.addEventListener("load", e), t.complete && t.naturalWidth && e(),
|
|
1636
|
+
t.addEventListener("load", e), t.complete && t.naturalWidth && e(), pt();
|
|
1618
1637
|
}
|
|
1619
|
-
function
|
|
1620
|
-
const e = t.naturalWidth ||
|
|
1621
|
-
if (e && n && (
|
|
1638
|
+
function Yr(t) {
|
|
1639
|
+
const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
|
|
1640
|
+
if (e && n && (O = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !O.w || !O.h)
|
|
1622
1641
|
return;
|
|
1623
|
-
const r = y.crop(),
|
|
1642
|
+
const r = y.crop(), i = O.w / O.h, a = r.w / r.h * i, o = Math.min(1, a / i), c = Math.min(1, i / a);
|
|
1624
1643
|
s.shot.style.left = `${(1 - o) / 2 * 100}%`, s.shot.style.top = `${(1 - c) / 2 * 100}%`, s.shot.style.width = `${o * 100}%`, s.shot.style.height = `${c * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
|
|
1625
1644
|
}
|
|
1626
|
-
function
|
|
1645
|
+
function Gr(t) {
|
|
1627
1646
|
return t.type === "arrow" ? {
|
|
1628
1647
|
id: "preview",
|
|
1629
1648
|
type: "arrow",
|
|
@@ -1638,94 +1657,121 @@ function Vr(t) {
|
|
|
1638
1657
|
id: "preview",
|
|
1639
1658
|
type: t.type,
|
|
1640
1659
|
number: "",
|
|
1641
|
-
...
|
|
1660
|
+
...wt(t.start, t.current)
|
|
1642
1661
|
};
|
|
1643
1662
|
}
|
|
1644
|
-
function
|
|
1645
|
-
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((
|
|
1646
|
-
|
|
1663
|
+
function A() {
|
|
1664
|
+
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !V() || !s.shot) {
|
|
1665
|
+
pt();
|
|
1647
1666
|
return;
|
|
1648
1667
|
}
|
|
1649
|
-
const e = y.crop(), n = rt(), r =
|
|
1668
|
+
const e = y.crop(), n = rt(), r = Ft(n.clientWidth || 400);
|
|
1650
1669
|
if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (v == null ? void 0 : v.kind) === "crop") {
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1670
|
+
const a = document.createElement("div");
|
|
1671
|
+
a.className = "nf-crop", ce(a, wt(v.start, v.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(a);
|
|
1653
1672
|
}
|
|
1654
|
-
const
|
|
1655
|
-
if ((v == null ? void 0 : v.kind) === "sticker" &&
|
|
1656
|
-
const o =
|
|
1657
|
-
if (l.className = `nf-sticker nf-${
|
|
1673
|
+
const i = y.list().slice();
|
|
1674
|
+
if ((v == null ? void 0 : v.kind) === "sticker" && i.push(Gr(v)), i.forEach((a) => {
|
|
1675
|
+
const o = a.id === "preview", c = !o && a.id === L, l = document.createElement("div");
|
|
1676
|
+
if (l.className = `nf-sticker nf-${a.type}`, l.dataset.id = a.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), a.type === "arrow" ? Jr(l, a, e, c, r) : (ce(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Ot(l, u))), !o && a.number) {
|
|
1658
1677
|
const u = document.createElement("span");
|
|
1659
|
-
u.className = "nf-badge", u.textContent = String(
|
|
1678
|
+
u.className = "nf-badge", u.textContent = String(a.number), l.appendChild(u);
|
|
1660
1679
|
}
|
|
1661
1680
|
s.shot.appendChild(l);
|
|
1662
|
-
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1681
|
+
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((a) => a.remove()), P) {
|
|
1682
|
+
const a = document.createElement("video");
|
|
1683
|
+
a.className = "nf-recording-preview", a.controls = !0, a.src = URL.createObjectURL(P), a.style.position = "absolute", a.style.right = "8px", a.style.bottom = "8px", a.style.width = "160px", s.canvas.appendChild(a);
|
|
1665
1684
|
}
|
|
1666
|
-
|
|
1685
|
+
pt();
|
|
1667
1686
|
}
|
|
1668
|
-
function
|
|
1669
|
-
const
|
|
1670
|
-
t.style.left = `${S}px`, t.style.top = `${
|
|
1671
|
-
<line class="nf-arrow-hit" x1="${
|
|
1672
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1673
|
-
<polygon class="nf-arrow-head" points="${
|
|
1674
|
-
`, t.appendChild(Y), r && (
|
|
1687
|
+
function Jr(t, e, n, r, i = Ft(400)) {
|
|
1688
|
+
const a = rt(), o = a.clientWidth, c = a.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, m = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), S = Math.min(l, f) - g, R = Math.min(u, m) - g, D = Math.max(2, Math.abs(f - l)) + g * 2, Z = Math.max(2, Math.abs(m - u)) + g * 2, q = l - S, X = u - R, vt = f - S, bt = m - R, H = Ae(q, X, vt, bt, i), Y = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1689
|
+
t.style.left = `${S}px`, t.style.top = `${R}px`, t.style.width = `${D}px`, t.style.height = `${Z}px`, Y.setAttribute("class", "nf-arrow-svg"), Y.setAttribute("viewBox", `0 0 ${D} ${Z}`), Y.setAttribute("width", String(D)), Y.setAttribute("height", String(Z)), Y.innerHTML = `
|
|
1690
|
+
<line class="nf-arrow-hit" x1="${q}" y1="${X}" x2="${vt}" y2="${bt}" />
|
|
1691
|
+
<line class="nf-arrow-shaft" x1="${q}" y1="${X}" x2="${H.shaftEnd.x}" y2="${H.shaftEnd.y}" />
|
|
1692
|
+
<polygon class="nf-arrow-head" points="${H.tipX},${H.tipY} ${H.left.x},${H.left.y} ${H.right.x},${H.right.y}" />
|
|
1693
|
+
`, t.appendChild(Y), r && (Ot(t, "start", { left: q - 5, top: X - 5 }), Ot(t, "end", { left: vt - 5, top: bt - 5 }));
|
|
1675
1694
|
}
|
|
1676
|
-
function
|
|
1695
|
+
function Ot(t, e, n) {
|
|
1677
1696
|
const r = document.createElement("span");
|
|
1678
1697
|
r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
|
|
1679
1698
|
}
|
|
1680
1699
|
function ce(t, e, n) {
|
|
1681
1700
|
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}%`;
|
|
1682
1701
|
}
|
|
1683
|
-
function
|
|
1702
|
+
function Ue() {
|
|
1684
1703
|
try {
|
|
1685
|
-
return String(localStorage.getItem(
|
|
1704
|
+
return String(localStorage.getItem(Re) || "").trim();
|
|
1686
1705
|
} catch {
|
|
1687
1706
|
return "";
|
|
1688
1707
|
}
|
|
1689
1708
|
}
|
|
1690
|
-
function
|
|
1709
|
+
function Qr(t) {
|
|
1691
1710
|
const e = String(t || "").trim();
|
|
1692
|
-
if (!(!e || e ===
|
|
1711
|
+
if (!(!e || e === Pt))
|
|
1693
1712
|
try {
|
|
1694
|
-
localStorage.setItem(
|
|
1713
|
+
localStorage.setItem(Re, e);
|
|
1695
1714
|
} catch {
|
|
1696
1715
|
}
|
|
1697
1716
|
}
|
|
1698
|
-
function
|
|
1699
|
-
|
|
1717
|
+
function Ne() {
|
|
1718
|
+
try {
|
|
1719
|
+
const t = localStorage.getItem(Te);
|
|
1720
|
+
if (!t)
|
|
1721
|
+
return { diagnostics: !1, logs: !1 };
|
|
1722
|
+
const e = JSON.parse(t);
|
|
1723
|
+
return {
|
|
1724
|
+
diagnostics: !!(e != null && e.diagnostics),
|
|
1725
|
+
logs: !!(e != null && e.logs)
|
|
1726
|
+
};
|
|
1727
|
+
} catch {
|
|
1728
|
+
return { diagnostics: !1, logs: !1 };
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
function le(t = {}) {
|
|
1732
|
+
const e = {
|
|
1733
|
+
...Ne(),
|
|
1734
|
+
...t
|
|
1735
|
+
};
|
|
1736
|
+
try {
|
|
1737
|
+
localStorage.setItem(Te, JSON.stringify({
|
|
1738
|
+
diagnostics: !!e.diagnostics,
|
|
1739
|
+
logs: !!e.logs
|
|
1740
|
+
}));
|
|
1741
|
+
} catch {
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
function je() {
|
|
1745
|
+
return !!(String(T.userId || "").trim() || String(T.email || "").trim() || String(T.displayName || "").trim());
|
|
1700
1746
|
}
|
|
1701
|
-
function
|
|
1747
|
+
function _e() {
|
|
1702
1748
|
return String(
|
|
1703
|
-
|
|
1749
|
+
T.displayName || T.email || T.userId || ""
|
|
1704
1750
|
).trim();
|
|
1705
1751
|
}
|
|
1706
|
-
function
|
|
1752
|
+
function Zr() {
|
|
1707
1753
|
var e;
|
|
1708
|
-
if (
|
|
1709
|
-
return
|
|
1754
|
+
if (je())
|
|
1755
|
+
return _e() || Pt;
|
|
1710
1756
|
const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
|
|
1711
|
-
return t ? (
|
|
1757
|
+
return t ? (Qr(t), t) : Pt;
|
|
1712
1758
|
}
|
|
1713
|
-
function
|
|
1759
|
+
function Ve() {
|
|
1714
1760
|
if (!s.author)
|
|
1715
1761
|
return;
|
|
1716
|
-
const t =
|
|
1762
|
+
const t = je();
|
|
1717
1763
|
if (s.author.hidden = t, t) {
|
|
1718
1764
|
s.author.value = "";
|
|
1719
1765
|
return;
|
|
1720
1766
|
}
|
|
1721
|
-
s.author.value =
|
|
1767
|
+
s.author.value = Ue();
|
|
1722
1768
|
}
|
|
1723
|
-
function
|
|
1769
|
+
function We(t, e = $e) {
|
|
1724
1770
|
const n = Number(t);
|
|
1725
|
-
return Number.isFinite(n) ? Math.min(
|
|
1771
|
+
return Number.isFinite(n) ? Math.min(Tr, Math.max(0, Math.floor(n))) : e;
|
|
1726
1772
|
}
|
|
1727
|
-
function
|
|
1728
|
-
|
|
1773
|
+
function ze(t = {}) {
|
|
1774
|
+
or(t);
|
|
1729
1775
|
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1730
1776
|
d = {
|
|
1731
1777
|
...d,
|
|
@@ -1735,65 +1781,67 @@ function je(t = {}) {
|
|
|
1735
1781
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1736
1782
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1737
1783
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1738
|
-
theme:
|
|
1784
|
+
theme: Pe(t.theme ?? d.theme),
|
|
1739
1785
|
video: t.video == null ? d.video : !!t.video,
|
|
1740
|
-
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit :
|
|
1741
|
-
kinds: e ?
|
|
1786
|
+
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : We(t.consoleLogLimit, d.consoleLogLimit),
|
|
1787
|
+
kinds: e ? Lr(t.kinds) : d.kinds,
|
|
1742
1788
|
capture: t.capture === void 0 ? d.capture : t.capture,
|
|
1743
1789
|
onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
|
|
1744
1790
|
};
|
|
1745
1791
|
}
|
|
1746
|
-
function
|
|
1747
|
-
return
|
|
1792
|
+
function Wt(t = {}) {
|
|
1793
|
+
return ze(t), h && nt(), zt;
|
|
1748
1794
|
}
|
|
1749
|
-
function
|
|
1750
|
-
return
|
|
1795
|
+
function ti(t = {}) {
|
|
1796
|
+
return ze(t), Nt(), nt(), zt;
|
|
1751
1797
|
}
|
|
1752
|
-
function
|
|
1753
|
-
return
|
|
1798
|
+
function ei(t) {
|
|
1799
|
+
return Wt({ theme: t });
|
|
1754
1800
|
}
|
|
1755
|
-
function
|
|
1801
|
+
function ni(t) {
|
|
1756
1802
|
const e = !!t;
|
|
1757
|
-
return !e && h && s.dialog && !s.dialog.hidden && at(),
|
|
1803
|
+
return !e && h && s.dialog && !s.dialog.hidden && at(), Wt({ hideLauncher: !e });
|
|
1758
1804
|
}
|
|
1759
|
-
function
|
|
1760
|
-
const t =
|
|
1761
|
-
...
|
|
1762
|
-
displayName:
|
|
1805
|
+
function ri() {
|
|
1806
|
+
const t = _e() || Ue() || void 0, e = ir({
|
|
1807
|
+
...T,
|
|
1808
|
+
displayName: T.displayName || t
|
|
1763
1809
|
});
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
)
|
|
1810
|
+
B = Sr(e), $ = xr(
|
|
1811
|
+
Le.snapshot().slice(-We(d.consoleLogLimit))
|
|
1812
|
+
);
|
|
1813
|
+
const n = Ne();
|
|
1814
|
+
n.diagnostics && ut(B, !0), n.logs && $.length && ut($, !0), W = !1;
|
|
1767
1815
|
}
|
|
1768
|
-
function
|
|
1769
|
-
|
|
1816
|
+
function mt(t) {
|
|
1817
|
+
W = !!t, s.privacyPanel && (s.privacyPanel.hidden = !W), s.privacyChange && (s.privacyChange.setAttribute("aria-expanded", W ? "true" : "false"), s.privacyChange.dataset.active = String(W)), W && Xe();
|
|
1770
1818
|
}
|
|
1771
|
-
function
|
|
1819
|
+
function Ke() {
|
|
1772
1820
|
if (!s.privacy || !s.privacyText || !s.privacyChange)
|
|
1773
1821
|
return;
|
|
1774
|
-
const t =
|
|
1775
|
-
diagnostics:
|
|
1776
|
-
logs:
|
|
1822
|
+
const t = Cr({
|
|
1823
|
+
diagnostics: B,
|
|
1824
|
+
logs: $
|
|
1777
1825
|
});
|
|
1778
1826
|
s.privacyText.textContent = t, s.privacyText.hidden = !t;
|
|
1779
|
-
const e =
|
|
1827
|
+
const e = B.length === 0 && $.length === 0;
|
|
1780
1828
|
s.privacySummary && (s.privacySummary.hidden = e), s.privacy.hidden = e, s.privacyChange.hidden = !1;
|
|
1781
1829
|
}
|
|
1782
|
-
function
|
|
1830
|
+
function qe(t, e, n) {
|
|
1783
1831
|
return `<label class="nf-privacy-toggle">
|
|
1784
1832
|
<span class="nf-privacy-toggle-label">Redact</span>
|
|
1785
1833
|
<input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${C(n)}">
|
|
1786
1834
|
</label>`;
|
|
1787
1835
|
}
|
|
1788
|
-
function
|
|
1789
|
-
const
|
|
1790
|
-
if (
|
|
1836
|
+
function ue(t, e, n, r, i) {
|
|
1837
|
+
const a = qe(i, !1, `Redact ${n}`);
|
|
1838
|
+
if (i) {
|
|
1791
1839
|
const o = r ? `${n}: ${r}` : n;
|
|
1792
1840
|
return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}" data-redacted="true">
|
|
1793
1841
|
<div class="nf-privacy-row-text">
|
|
1794
1842
|
<div class="nf-privacy-row-summary" title="${C(o)}">${C(o)}</div>
|
|
1795
1843
|
</div>
|
|
1796
|
-
${
|
|
1844
|
+
${a}
|
|
1797
1845
|
</div>`;
|
|
1798
1846
|
}
|
|
1799
1847
|
return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}">
|
|
@@ -1801,31 +1849,31 @@ function le(t, e, n, r, a) {
|
|
|
1801
1849
|
<div class="nf-privacy-row-title">${C(n)}</div>
|
|
1802
1850
|
<div class="nf-privacy-row-detail">${C(r)}</div>
|
|
1803
1851
|
</div>
|
|
1804
|
-
${
|
|
1852
|
+
${a}
|
|
1805
1853
|
</div>`;
|
|
1806
1854
|
}
|
|
1807
|
-
function
|
|
1855
|
+
function de(t, e, n, r) {
|
|
1808
1856
|
if (!n.length)
|
|
1809
1857
|
return "";
|
|
1810
|
-
const
|
|
1811
|
-
return `<section class="nf-privacy-section" data-section="${C(t)}"${
|
|
1858
|
+
const i = Er(n), a = i.checked && !i.indeterminate;
|
|
1859
|
+
return `<section class="nf-privacy-section" data-section="${C(t)}"${a ? ' data-redacted="true"' : ""}>
|
|
1812
1860
|
<div class="nf-privacy-section-head">
|
|
1813
1861
|
<h3 class="nf-privacy-section-title">${C(e)}</h3>
|
|
1814
|
-
${
|
|
1862
|
+
${qe(i.checked, i.indeterminate, `Redact all ${e.toLowerCase()}`)}
|
|
1815
1863
|
</div>
|
|
1816
|
-
<div class="nf-privacy-rows"${
|
|
1864
|
+
<div class="nf-privacy-rows"${a ? " hidden" : ""}>${r}</div>
|
|
1817
1865
|
</section>`;
|
|
1818
1866
|
}
|
|
1819
|
-
function
|
|
1867
|
+
function Xe() {
|
|
1820
1868
|
if (!s.privacyScroll)
|
|
1821
1869
|
return;
|
|
1822
|
-
const t =
|
|
1870
|
+
const t = B.map((n) => ue(
|
|
1823
1871
|
"diagnostic",
|
|
1824
1872
|
n.key,
|
|
1825
1873
|
n.label,
|
|
1826
|
-
|
|
1874
|
+
Ar(n.value),
|
|
1827
1875
|
n.redacted
|
|
1828
|
-
)).join(""), e =
|
|
1876
|
+
)).join(""), e = $.map((n) => ue(
|
|
1829
1877
|
"log",
|
|
1830
1878
|
n.id,
|
|
1831
1879
|
n.level,
|
|
@@ -1833,56 +1881,56 @@ function We() {
|
|
|
1833
1881
|
n.redacted
|
|
1834
1882
|
)).join("");
|
|
1835
1883
|
s.privacyScroll.innerHTML = [
|
|
1836
|
-
|
|
1837
|
-
|
|
1884
|
+
de("diagnostics", "Diagnostics", B, t),
|
|
1885
|
+
$.length ? de("logs", "Logs", $, e) : ""
|
|
1838
1886
|
].join(""), s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach((n) => {
|
|
1839
1887
|
n.indeterminate = !0, n.removeAttribute("data-indeterminate");
|
|
1840
|
-
}),
|
|
1888
|
+
}), Ke();
|
|
1841
1889
|
}
|
|
1842
|
-
function
|
|
1890
|
+
function ii(t) {
|
|
1843
1891
|
const e = t.target;
|
|
1844
1892
|
if (!(e instanceof HTMLInputElement) || e.type !== "checkbox")
|
|
1845
1893
|
return;
|
|
1846
|
-
const n = e.closest("[data-section]"), r = e.closest(".nf-privacy-row"),
|
|
1894
|
+
const n = e.closest("[data-section]"), r = e.closest(".nf-privacy-row"), i = e.checked;
|
|
1847
1895
|
if (r) {
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1850
|
-
const c =
|
|
1851
|
-
c && (c.redacted =
|
|
1852
|
-
} else if (
|
|
1853
|
-
const c =
|
|
1854
|
-
c && (c.redacted =
|
|
1896
|
+
const a = r.dataset.kind, o = r.dataset.id;
|
|
1897
|
+
if (a === "diagnostic") {
|
|
1898
|
+
const c = B.find((l) => l.key === o);
|
|
1899
|
+
c && (c.redacted = i);
|
|
1900
|
+
} else if (a === "log") {
|
|
1901
|
+
const c = $.find((l) => l.id === o);
|
|
1902
|
+
c && (c.redacted = i);
|
|
1855
1903
|
}
|
|
1856
1904
|
} else if (n) {
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1905
|
+
const a = n.dataset.section;
|
|
1906
|
+
a === "diagnostics" ? (ut(B, i), le({ diagnostics: i })) : a === "logs" && (ut($, i), le({ logs: i }));
|
|
1859
1907
|
} else
|
|
1860
1908
|
return;
|
|
1861
|
-
|
|
1909
|
+
Xe();
|
|
1862
1910
|
}
|
|
1863
|
-
async function
|
|
1864
|
-
|
|
1911
|
+
async function Ye() {
|
|
1912
|
+
Nt(), Ge(), nt(), s.launcher.hidden = !0, y = Ht(), O = { w: 0, h: 0 }, P = null, I = "", Q = "", L = null, v = null, w = null, j = Dr(), jt(j), et(null), Vt(!1), s.text.value = "", Ve(), b(""), ri();
|
|
1865
1913
|
try {
|
|
1866
|
-
|
|
1914
|
+
Fe(await Ee(He())), b("");
|
|
1867
1915
|
} catch (t) {
|
|
1868
|
-
|
|
1916
|
+
I = "", b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1869
1917
|
}
|
|
1870
|
-
it(),
|
|
1918
|
+
it(), mt(!1), Ke(), s.dialog.hidden = !1, K(), s.text.focus();
|
|
1871
1919
|
}
|
|
1872
1920
|
function at() {
|
|
1873
|
-
h && (
|
|
1921
|
+
h && (z == null || z.stop(), Vt(!1), Be(), v = null, w = null, _t(!1), Ge(), mt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, dt());
|
|
1874
1922
|
}
|
|
1875
|
-
function
|
|
1923
|
+
function ai() {
|
|
1876
1924
|
const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
|
|
1877
1925
|
if (!t || !e || !n || !r)
|
|
1878
1926
|
return Promise.resolve();
|
|
1879
|
-
|
|
1880
|
-
const
|
|
1881
|
-
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1",
|
|
1927
|
+
Ut = !0, b("");
|
|
1928
|
+
const i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, a = e.getBoundingClientRect();
|
|
1929
|
+
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", i)
|
|
1882
1930
|
return new Promise((u) => {
|
|
1883
1931
|
window.setTimeout(() => u(), 1e3);
|
|
1884
1932
|
});
|
|
1885
|
-
const o = e.getBoundingClientRect(), c = o.width > 0 ?
|
|
1933
|
+
const o = e.getBoundingClientRect(), c = o.width > 0 ? a.width / o.width : 1, l = o.height > 0 ? a.height / o.height : 1;
|
|
1886
1934
|
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
|
|
1887
1935
|
let f = !1;
|
|
1888
1936
|
const m = () => {
|
|
@@ -1897,32 +1945,32 @@ function Qr() {
|
|
|
1897
1945
|
}), window.setTimeout(m, 700);
|
|
1898
1946
|
});
|
|
1899
1947
|
}
|
|
1900
|
-
function
|
|
1901
|
-
|
|
1948
|
+
function Ge() {
|
|
1949
|
+
Ut = !1, s.dialog && (s.dialog.classList.remove("nf-success"), s.dialog.style.opacity = "", s.dialog.style.transition = "", s.panel && (s.panel.style.transform = "", s.panel.style.transition = "", s.panel.style.transformOrigin = ""), s.panelBody && (s.panelBody.hidden = !1), s.successMsg && (s.successMsg.hidden = !0));
|
|
1902
1950
|
}
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1951
|
+
function oi(t = {}) {
|
|
1952
|
+
T = { ...T, ...ar(t) }, Ve();
|
|
1905
1953
|
}
|
|
1906
|
-
async function
|
|
1907
|
-
if (
|
|
1954
|
+
async function Je() {
|
|
1955
|
+
if (Nt(), At)
|
|
1908
1956
|
return null;
|
|
1909
1957
|
const t = s.text.value.trim();
|
|
1910
|
-
if (!t && !
|
|
1958
|
+
if (!t && !V() && !P)
|
|
1911
1959
|
return b("Add a note, screenshot, or video first."), null;
|
|
1912
1960
|
if (!d.endpoint || !d.projectKey)
|
|
1913
1961
|
return b("Notefully is missing endpoint or projectKey."), null;
|
|
1914
|
-
|
|
1962
|
+
At = !0, fe(!0), b("Submitting…", !0);
|
|
1915
1963
|
try {
|
|
1916
|
-
const e =
|
|
1917
|
-
if (n.append("message", t), n.append("kind",
|
|
1964
|
+
const e = Zr(), n = new FormData();
|
|
1965
|
+
if (n.append("message", t), n.append("kind", j), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(Mr({
|
|
1918
1966
|
author: e,
|
|
1919
|
-
diagnostics:
|
|
1920
|
-
logs:
|
|
1921
|
-
}))), n.append("annotations", JSON.stringify(y.list())), n.append("crop", JSON.stringify(y.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)),
|
|
1922
|
-
const
|
|
1923
|
-
if (n.append("screenshot",
|
|
1924
|
-
const o = await
|
|
1925
|
-
|
|
1967
|
+
diagnostics: B,
|
|
1968
|
+
logs: $
|
|
1969
|
+
}))), n.append("annotations", JSON.stringify(y.list())), n.append("crop", JSON.stringify(y.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), V()) {
|
|
1970
|
+
const a = await Pr(I);
|
|
1971
|
+
if (n.append("screenshot", a, "screenshot.png"), y.list().length || y.isCropped()) {
|
|
1972
|
+
const o = await wr(
|
|
1973
|
+
I,
|
|
1926
1974
|
y.crop(),
|
|
1927
1975
|
y.list(),
|
|
1928
1976
|
{
|
|
@@ -1933,7 +1981,7 @@ async function Ke() {
|
|
|
1933
1981
|
n.append("screenshotBaked", o, "screenshot.baked.png");
|
|
1934
1982
|
}
|
|
1935
1983
|
}
|
|
1936
|
-
|
|
1984
|
+
P && n.append("recording", P, "recording.webm");
|
|
1937
1985
|
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1938
1986
|
method: "POST",
|
|
1939
1987
|
headers: {
|
|
@@ -1941,36 +1989,36 @@ async function Ke() {
|
|
|
1941
1989
|
},
|
|
1942
1990
|
body: n
|
|
1943
1991
|
});
|
|
1944
|
-
let
|
|
1992
|
+
let i = null;
|
|
1945
1993
|
try {
|
|
1946
|
-
|
|
1994
|
+
i = await r.json();
|
|
1947
1995
|
} catch {
|
|
1948
|
-
|
|
1996
|
+
i = null;
|
|
1949
1997
|
}
|
|
1950
1998
|
if (!r.ok)
|
|
1951
|
-
throw b((
|
|
1952
|
-
return await
|
|
1999
|
+
throw b((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
|
|
2000
|
+
return await ai(), at(), i;
|
|
1953
2001
|
} finally {
|
|
1954
|
-
|
|
2002
|
+
At = !1, fe(!1);
|
|
1955
2003
|
}
|
|
1956
2004
|
}
|
|
1957
|
-
function
|
|
2005
|
+
function fe(t) {
|
|
1958
2006
|
s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1959
2007
|
}
|
|
1960
|
-
function
|
|
2008
|
+
function si() {
|
|
1961
2009
|
at(), h == null || h.remove(), h = null, s = {};
|
|
1962
2010
|
}
|
|
1963
|
-
const
|
|
1964
|
-
typeof window < "u" && (window.Notefully =
|
|
2011
|
+
const zt = { init: ti, configure: Wt, setTheme: ei, setVisible: ni, open: Ye, close: at, identify: oi, submit: Je, destroy: si };
|
|
2012
|
+
typeof window < "u" && (window.Notefully = zt);
|
|
1965
2013
|
export {
|
|
1966
2014
|
at as close,
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2015
|
+
Wt as configure,
|
|
2016
|
+
zt as default,
|
|
2017
|
+
si as destroy,
|
|
2018
|
+
oi as identify,
|
|
2019
|
+
ti as init,
|
|
2020
|
+
Ye as open,
|
|
2021
|
+
ei as setTheme,
|
|
2022
|
+
ni as setVisible,
|
|
2023
|
+
Je as submit
|
|
1976
2024
|
};
|