@makefully/notefully 0.1.36 → 0.1.37
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.css +1 -1
- package/dist/notefully.iife.js +20 -20
- package/dist/notefully.js +593 -540
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function He(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
@@ -8,7 +8,7 @@ function ke(t, e) {
|
|
|
8
8
|
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), a = n.createElement("a");
|
|
9
9
|
return n.head.appendChild(r), n.body.appendChild(a), e && (r.href = e), a.href = t, a.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const De = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -22,27 +22,27 @@ function H(t) {
|
|
|
22
22
|
e.push(t[n]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
function
|
|
27
|
-
return
|
|
25
|
+
let q = null;
|
|
26
|
+
function ae(t = {}) {
|
|
27
|
+
return q || (t.includeStyleProperties ? (q = t.includeStyleProperties, q) : (q = H(window.getComputedStyle(document.documentElement)), q));
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function rt(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
|
|
34
|
-
const e =
|
|
33
|
+
function Fe(t) {
|
|
34
|
+
const e = rt(t, "border-left-width"), n = rt(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const e =
|
|
37
|
+
function Ue(t) {
|
|
38
|
+
const e = rt(t, "border-top-width"), n = rt(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const n = e.width ||
|
|
41
|
+
function oe(t, e = {}) {
|
|
42
|
+
const n = e.width || Fe(t), r = e.height || Ue(t);
|
|
43
43
|
return { width: n, height: r };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Ne() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -51,11 +51,11 @@ function He() {
|
|
|
51
51
|
const n = e && e.env ? e.env.devicePixelRatio : null;
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
(t.width >
|
|
54
|
+
const E = 16384;
|
|
55
|
+
function je(t) {
|
|
56
|
+
(t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function it(t) {
|
|
59
59
|
return new Promise((e, n) => {
|
|
60
60
|
const r = new Image();
|
|
61
61
|
r.onload = () => {
|
|
@@ -65,80 +65,80 @@ function tt(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 _e(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
|
|
71
|
+
async function Ve(t, e, n) {
|
|
72
72
|
const r = "http://www.w3.org/2000/svg", a = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
|
|
73
|
-
return a.setAttribute("width", `${e}`), a.setAttribute("height", `${n}`), a.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t),
|
|
73
|
+
return a.setAttribute("width", `${e}`), a.setAttribute("height", `${n}`), a.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t), _e(a);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const x = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
77
77
|
return !0;
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
|
-
return n === null ? !1 : n.constructor.name === e.name ||
|
|
79
|
+
return n === null ? !1 : n.constructor.name === e.name || x(n, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function We(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
85
|
+
function ze(t, e) {
|
|
86
|
+
return ae(e).map((n) => {
|
|
87
87
|
const r = t.getPropertyValue(n), a = t.getPropertyPriority(n);
|
|
88
88
|
return `${n}: ${r}${a ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const a = `.${t}:${e}`, i = n.cssText ?
|
|
91
|
+
function qe(t, e, n, r) {
|
|
92
|
+
const a = `.${t}:${e}`, i = n.cssText ? We(n) : ze(n, r);
|
|
93
93
|
return document.createTextNode(`${a}{${i}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Nt(t, e, n, r) {
|
|
96
96
|
const a = window.getComputedStyle(t, n), i = a.getPropertyValue("content");
|
|
97
97
|
if (i === "" || i === "none")
|
|
98
98
|
return;
|
|
99
|
-
const o =
|
|
99
|
+
const o = De();
|
|
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(qe(o, n, a, r)), e.appendChild(c);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function Ke(t, e, n) {
|
|
109
|
+
Nt(t, e, ":before", n), Nt(t, e, ":after", n);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const jt = "application/font-woff", _t = "image/jpeg", Xe = {
|
|
112
|
+
woff: jt,
|
|
113
|
+
woff2: jt,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: _t,
|
|
118
|
+
jpeg: _t,
|
|
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 Ye(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 $t(t) {
|
|
129
|
+
const e = Ye(t).toLowerCase();
|
|
130
|
+
return Xe[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Ge(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function vt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Je(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function se(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`);
|
|
@@ -154,86 +154,86 @@ async function ie(t, e, n) {
|
|
|
154
154
|
}, c.readAsDataURL(a);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const mt = {};
|
|
158
|
+
function Qe(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 Tt(t, e, n) {
|
|
163
|
+
const r = Qe(t, e, n.includeQueryParams);
|
|
164
|
+
if (mt[r] != null)
|
|
165
|
+
return mt[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
167
|
let a;
|
|
168
168
|
try {
|
|
169
|
-
const i = await
|
|
170
|
-
a =
|
|
169
|
+
const i = await se(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), Ge(c)));
|
|
170
|
+
a = Je(i, e);
|
|
171
171
|
} catch (i) {
|
|
172
172
|
a = n.imagePlaceholder || "";
|
|
173
173
|
let o = `Failed to fetch resource: ${t}`;
|
|
174
174
|
i && (o = typeof i == "string" ? i : i.message), o && console.warn(o);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return mt[r] = a, a;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function Ze(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
|
-
return e === "data:," ? t.cloneNode(!1) :
|
|
180
|
+
return e === "data:," ? t.cloneNode(!1) : it(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function tn(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
184
|
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
185
185
|
i.width = t.clientWidth, i.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, i.width, i.height);
|
|
186
186
|
const c = i.toDataURL();
|
|
187
|
-
return
|
|
187
|
+
return it(c);
|
|
188
188
|
}
|
|
189
|
-
const n = t.poster, r =
|
|
190
|
-
return
|
|
189
|
+
const n = t.poster, r = $t(n), a = await Tt(n, r, e);
|
|
190
|
+
return it(a);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function en(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 ut(t.contentDocument.body, e, !0);
|
|
197
197
|
} catch {
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return
|
|
201
|
+
async function nn(t, e) {
|
|
202
|
+
return x(t, HTMLCanvasElement) ? Ze(t) : x(t, HTMLVideoElement) ? tn(t, e) : x(t, HTMLIFrameElement) ? en(t, e) : t.cloneNode(ce(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
204
|
+
const rn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ce = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function an(t, e, n) {
|
|
206
206
|
var r, a;
|
|
207
|
-
if (
|
|
207
|
+
if (ce(e))
|
|
208
208
|
return e;
|
|
209
209
|
let i = [];
|
|
210
|
-
return
|
|
210
|
+
return rn(t) && t.assignedNodes ? i = H(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((a = t.shadowRoot) !== null && a !== void 0 ? a : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((o, c) => o.then(() => ut(c, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function on(t, e, n) {
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
218
|
const a = window.getComputedStyle(t);
|
|
219
|
-
a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) :
|
|
219
|
+
a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) : ae(n).forEach((i) => {
|
|
220
220
|
let o = a.getPropertyValue(i);
|
|
221
|
-
i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`),
|
|
221
|
+
i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && i === "display" && o === "inline" && (o = "block"), i === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(i, o, a.getPropertyPriority(i));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
224
|
+
function sn(t, e) {
|
|
225
|
+
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
227
|
+
function cn(t, e) {
|
|
228
|
+
if (x(t, HTMLSelectElement)) {
|
|
229
229
|
const r = Array.from(e.children).find((a) => t.value === a.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
233
|
+
function ln(t, e, n) {
|
|
234
|
+
return x(e, Element) && (on(t, e, n), Ke(t, e, n), sn(t, e), cn(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function un(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
@@ -242,7 +242,7 @@ async function on(t, e) {
|
|
|
242
242
|
const c = n[i].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 ut(u, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
const a = Object.values(r);
|
|
@@ -257,31 +257,31 @@ async function on(t, e) {
|
|
|
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 ut(t, e, n) {
|
|
261
|
+
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => nn(r, e)).then((r) => an(t, r, e)).then((r) => ln(t, r, e)).then((r) => un(r, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const le = /url\((['"]?)([^'"]+?)\1\)/g, dn = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, fn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function hn(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function pn(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(le, (n, r, a) => (e.push(a), n)), e.filter((n) => !vt(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function mn(t, e, n, r, a) {
|
|
273
273
|
try {
|
|
274
|
-
const i = n ?
|
|
274
|
+
const i = n ? He(e, n) : e, o = $t(e);
|
|
275
275
|
let c;
|
|
276
|
-
return a || (c = await
|
|
276
|
+
return a || (c = await Tt(i, o, r)), t.replace(hn(e), `$1${c}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function yn(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(fn, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, , a] =
|
|
284
|
+
const [r, , a] = dn.exec(n) || [];
|
|
285
285
|
if (!a)
|
|
286
286
|
return "";
|
|
287
287
|
if (a === e)
|
|
@@ -289,32 +289,32 @@ function fn(t, { preferredFontFormat: e }) {
|
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function ue(t) {
|
|
293
|
+
return t.search(le) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function de(t, e, n) {
|
|
296
|
+
if (!ue(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return
|
|
298
|
+
const r = yn(t, n);
|
|
299
|
+
return pn(r).reduce((i, o) => i.then((c) => mn(c, o, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
301
|
+
async function K(t, e, n) {
|
|
302
302
|
var r;
|
|
303
303
|
const a = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
304
|
if (a) {
|
|
305
|
-
const i = await
|
|
305
|
+
const i = await de(a, null, n);
|
|
306
306
|
return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
await
|
|
310
|
+
async function gn(t, e) {
|
|
311
|
+
await K("background", t, e) || await K("background-image", t, e), await K("mask", t, e) || await K("-webkit-mask", t, e) || await K("mask-image", t, e) || await K("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
314
|
-
const n =
|
|
315
|
-
if (!(n && !
|
|
313
|
+
async function wn(t, e) {
|
|
314
|
+
const n = x(t, HTMLImageElement);
|
|
315
|
+
if (!(n && !vt(t.src)) && !(x(t, SVGImageElement) && !vt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const r = n ? t.src : t.href.baseVal, a = await
|
|
317
|
+
const r = n ? t.src : t.href.baseVal, a = await Tt(r, $t(r), e);
|
|
318
318
|
await new Promise((i, o) => {
|
|
319
319
|
t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
@@ -327,14 +327,14 @@ async function pn(t, e) {
|
|
|
327
327
|
c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = a) : t.href.baseVal = a;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const r = H(t.childNodes).map((a) =>
|
|
330
|
+
async function bn(t, e) {
|
|
331
|
+
const r = H(t.childNodes).map((a) => fe(a, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
|
|
334
|
+
async function fe(t, e) {
|
|
335
|
+
x(t, Element) && (await gn(t, e), await wn(t, e), await bn(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Sn(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
@@ -342,23 +342,23 @@ function yn(t, e) {
|
|
|
342
342
|
n[a] = r[a];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Vt = {};
|
|
346
|
+
async function Wt(t) {
|
|
347
|
+
let e = Vt[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 }, Vt[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function zt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
355
|
const r = /url\(["']?([^"')]+)["']?\)/g, i = (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), se(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
359
|
return Promise.all(i).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;
|
|
@@ -384,7 +384,7 @@ function Vt(t) {
|
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function vn(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
389
|
return t.forEach((a) => {
|
|
390
390
|
if ("cssRules" in a)
|
|
@@ -392,12 +392,12 @@ async function gn(t, e) {
|
|
|
392
392
|
H(a.cssRules || []).forEach((i, o) => {
|
|
393
393
|
if (i.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let c = o + 1;
|
|
395
|
-
const l = i.href, u =
|
|
395
|
+
const l = i.href, u = Wt(l).then((f) => zt(f, e)).then((f) => qt(f).forEach((p) => {
|
|
396
396
|
try {
|
|
397
|
-
a.insertRule(
|
|
397
|
+
a.insertRule(p, p.startsWith("@import") ? c += 1 : a.cssRules.length);
|
|
398
398
|
} catch (y) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
|
-
rule:
|
|
400
|
+
rule: p,
|
|
401
401
|
error: y
|
|
402
402
|
});
|
|
403
403
|
}
|
|
@@ -409,7 +409,7 @@ async function gn(t, e) {
|
|
|
409
409
|
});
|
|
410
410
|
} catch (i) {
|
|
411
411
|
const o = t.find((c) => c.href == null) || document.styleSheets[0];
|
|
412
|
-
a.href != null && r.push(
|
|
412
|
+
a.href != null && r.push(Wt(a.href).then((c) => zt(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);
|
|
@@ -426,60 +426,60 @@ async function gn(t, e) {
|
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function xn(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ue(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function En(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const n = H(t.ownerDocument.styleSheets), r = await
|
|
436
|
-
return
|
|
435
|
+
const n = H(t.ownerDocument.styleSheets), r = await vn(n, e);
|
|
436
|
+
return xn(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function he(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Cn(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
444
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((i) => {
|
|
445
|
-
e.add(
|
|
445
|
+
e.add(he(i));
|
|
446
446
|
}), Array.from(r.children).forEach((i) => {
|
|
447
447
|
i instanceof HTMLElement && n(i);
|
|
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((i) => r.has(
|
|
452
|
+
async function Mn(t, e) {
|
|
453
|
+
const n = await En(t, e), r = Cn(t);
|
|
454
|
+
return (await Promise.all(n.filter((i) => r.has(he(i.style.fontFamily))).map((i) => {
|
|
455
455
|
const o = i.parentStyleSheet ? i.parentStyleSheet.href : null;
|
|
456
|
-
return
|
|
456
|
+
return de(i.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 An(t, e) {
|
|
461
|
+
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Mn(t, e);
|
|
462
462
|
if (n) {
|
|
463
463
|
const r = document.createElement("style"), a = document.createTextNode(n);
|
|
464
464
|
r.appendChild(a), 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 Ln(t, e = {}) {
|
|
468
|
+
const { width: n, height: r } = oe(t, e), a = await ut(t, e, !0);
|
|
469
|
+
return await An(a, e), await fe(a, e), Sn(a, e), await Ve(a, 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 Rn(t, e = {}) {
|
|
472
|
+
const { width: n, height: r } = oe(t, e), a = await Ln(t, e), i = await it(a), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || Ne(), u = e.canvasWidth || n, f = e.canvasHeight || r;
|
|
473
|
+
return o.width = u * l, o.height = f * l, e.skipAutoScale || je(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(i, 0, 0, o.width, o.height), o;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function Kt(t, e = {}) {
|
|
476
|
+
return (await Rn(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
|
-
const
|
|
479
|
-
function
|
|
480
|
-
return t instanceof Element && (t.hasAttribute(
|
|
478
|
+
const at = "data-nf-capture-chrome", $n = "data-nf-canvas-snap", Tn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
|
|
479
|
+
function pe(t) {
|
|
480
|
+
return t instanceof Element && (t.hasAttribute(at) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Pn() {
|
|
483
483
|
const t = [];
|
|
484
484
|
return Array.from(document.styleSheets).forEach((e) => {
|
|
485
485
|
try {
|
|
@@ -503,7 +503,7 @@ function Ln() {
|
|
|
503
503
|
});
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function kn() {
|
|
507
507
|
const t = [];
|
|
508
508
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
509
509
|
const r = n.getBoundingClientRect(), a = document.createElement("div");
|
|
@@ -519,25 +519,47 @@ function Rn() {
|
|
|
519
519
|
].join(";"), document.body.appendChild(a), t.push(a);
|
|
520
520
|
}), () => t.forEach((n) => n.remove());
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
const t = document.querySelector(`[${
|
|
522
|
+
function In() {
|
|
523
|
+
const t = document.querySelector(`[${at}]`);
|
|
524
524
|
if (t)
|
|
525
525
|
return t;
|
|
526
526
|
const e = document.createElement("div");
|
|
527
|
-
return e.setAttribute(
|
|
527
|
+
return e.setAttribute(at, "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
|
|
530
|
-
document.querySelectorAll(`[${
|
|
529
|
+
function On() {
|
|
530
|
+
document.querySelectorAll(`[${at}]`).forEach((t) => t.remove());
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function xt() {
|
|
533
533
|
return new Promise((t) => {
|
|
534
534
|
requestAnimationFrame(() => requestAnimationFrame(t));
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
function D(t) {
|
|
538
|
+
if (typeof t != "string" || !t.startsWith("data:image/"))
|
|
539
|
+
return !1;
|
|
540
|
+
const e = t.indexOf(",");
|
|
541
|
+
return e > 0 && e < t.length - 1;
|
|
542
|
+
}
|
|
543
|
+
function Bn() {
|
|
544
|
+
const t = document.documentElement, e = document.body, n = Math.max(
|
|
545
|
+
window.innerWidth || 0,
|
|
546
|
+
(t == null ? void 0 : t.clientWidth) || 0,
|
|
547
|
+
(t == null ? void 0 : t.scrollWidth) || 0,
|
|
548
|
+
(e == null ? void 0 : e.scrollWidth) || 0,
|
|
549
|
+
1
|
|
550
|
+
), r = Math.max(
|
|
551
|
+
window.innerHeight || 0,
|
|
552
|
+
(t == null ? void 0 : t.clientHeight) || 0,
|
|
553
|
+
(t == null ? void 0 : t.scrollHeight) || 0,
|
|
554
|
+
(e == null ? void 0 : e.scrollHeight) || 0,
|
|
555
|
+
1
|
|
556
|
+
);
|
|
557
|
+
return { width: n, height: r };
|
|
558
|
+
}
|
|
559
|
+
async function Hn() {
|
|
538
560
|
const t = [], e = Array.from(document.querySelectorAll("canvas"));
|
|
539
561
|
for (const n of e) {
|
|
540
|
-
if (n.closest("#notefully") ||
|
|
562
|
+
if (n.closest("#notefully") || pe(n))
|
|
541
563
|
continue;
|
|
542
564
|
let r = "";
|
|
543
565
|
try {
|
|
@@ -548,7 +570,7 @@ async function Pn() {
|
|
|
548
570
|
if (!r || r === "data:,")
|
|
549
571
|
continue;
|
|
550
572
|
const a = document.createElement("img"), i = getComputedStyle(n);
|
|
551
|
-
a.setAttribute(
|
|
573
|
+
a.setAttribute($n, "1"), a.alt = "", a.src = r, a.className = n.className, a.style.cssText = n.style.cssText, a.style.width = i.width, a.style.height = i.height, a.style.maxWidth = i.maxWidth, a.style.maxHeight = i.maxHeight, a.style.objectFit = "fill", a.style.display = i.display === "inline" ? "inline-block" : i.display, n.replaceWith(a), t.push({ canvas: n, img: a });
|
|
552
574
|
}
|
|
553
575
|
return await Promise.all(t.map(({ img: n }) => {
|
|
554
576
|
if (!n.complete)
|
|
@@ -564,20 +586,25 @@ async function Pn() {
|
|
|
564
586
|
});
|
|
565
587
|
};
|
|
566
588
|
}
|
|
567
|
-
async function
|
|
589
|
+
async function Dn(t) {
|
|
568
590
|
if (!t)
|
|
569
591
|
return null;
|
|
570
592
|
if (typeof t == "string")
|
|
571
|
-
return t
|
|
593
|
+
return D(t) ? t : null;
|
|
572
594
|
if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
|
|
573
595
|
try {
|
|
574
|
-
|
|
596
|
+
const e = t.toDataURL("image/png");
|
|
597
|
+
return D(e) ? e : null;
|
|
575
598
|
} catch {
|
|
576
599
|
return null;
|
|
577
600
|
}
|
|
578
|
-
|
|
601
|
+
if (typeof Blob < "u" && t instanceof Blob) {
|
|
602
|
+
const e = await Fn(t);
|
|
603
|
+
return D(e) ? e : null;
|
|
604
|
+
}
|
|
605
|
+
return null;
|
|
579
606
|
}
|
|
580
|
-
async function
|
|
607
|
+
async function Fn(t) {
|
|
581
608
|
if (typeof FileReader == "function")
|
|
582
609
|
return new Promise((r, a) => {
|
|
583
610
|
const i = new FileReader();
|
|
@@ -586,7 +613,7 @@ async function In(t) {
|
|
|
586
613
|
const e = Buffer.from(await t.arrayBuffer());
|
|
587
614
|
return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
|
|
588
615
|
}
|
|
589
|
-
async function
|
|
616
|
+
async function Un() {
|
|
590
617
|
var e;
|
|
591
618
|
if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
|
|
592
619
|
throw new Error("Screen capture is not supported in this browser.");
|
|
@@ -598,66 +625,76 @@ async function On() {
|
|
|
598
625
|
});
|
|
599
626
|
try {
|
|
600
627
|
const n = document.createElement("video");
|
|
601
|
-
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((
|
|
602
|
-
n.onloadedmetadata = () =>
|
|
603
|
-
}), await
|
|
628
|
+
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
|
|
629
|
+
n.onloadedmetadata = () => c();
|
|
630
|
+
}), await xt();
|
|
604
631
|
const r = n.videoWidth || 1, a = n.videoHeight || 1, i = document.createElement("canvas");
|
|
605
|
-
|
|
632
|
+
i.width = r, i.height = a, i.getContext("2d").drawImage(n, 0, 0, r, a);
|
|
633
|
+
const o = i.toDataURL("image/png");
|
|
634
|
+
if (!D(o))
|
|
635
|
+
throw new Error("Screen capture produced an empty image.");
|
|
636
|
+
return o;
|
|
606
637
|
} finally {
|
|
607
638
|
t.getTracks().forEach((n) => n.stop());
|
|
608
639
|
}
|
|
609
640
|
}
|
|
610
|
-
async function
|
|
611
|
-
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r =
|
|
641
|
+
async function me(t = {}) {
|
|
642
|
+
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = In(), a = Pn();
|
|
612
643
|
let i = () => {
|
|
613
644
|
};
|
|
614
645
|
e && (e.style.display = "none");
|
|
615
|
-
const o =
|
|
646
|
+
const o = kn();
|
|
616
647
|
try {
|
|
617
|
-
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
620
|
-
return
|
|
648
|
+
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await xt(), typeof t.capture == "function") {
|
|
649
|
+
const p = await Dn(await t.capture());
|
|
650
|
+
if (p)
|
|
651
|
+
return p;
|
|
621
652
|
}
|
|
622
|
-
i = await
|
|
623
|
-
const c = {
|
|
653
|
+
i = await Hn(), await xt();
|
|
654
|
+
const { width: c, height: l } = Bn(), u = {
|
|
624
655
|
cacheBust: !0,
|
|
656
|
+
width: c,
|
|
657
|
+
height: l,
|
|
625
658
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
626
|
-
filter: (
|
|
659
|
+
filter: (p) => !pe(p),
|
|
627
660
|
// 404 / CORS images must not abort the whole capture.
|
|
628
|
-
imagePlaceholder:
|
|
661
|
+
imagePlaceholder: Tn,
|
|
629
662
|
onImageErrorHandler: () => {
|
|
630
663
|
}
|
|
631
664
|
};
|
|
665
|
+
let f = "";
|
|
632
666
|
try {
|
|
633
|
-
|
|
667
|
+
f = await Kt(document.body, u);
|
|
634
668
|
} catch {
|
|
635
|
-
|
|
669
|
+
f = await Kt(document.body, { ...u, skipFonts: !0 });
|
|
636
670
|
}
|
|
671
|
+
if (!D(f))
|
|
672
|
+
throw new Error("Screenshot capture produced an empty image.");
|
|
673
|
+
return f;
|
|
637
674
|
} finally {
|
|
638
675
|
try {
|
|
639
676
|
i();
|
|
640
677
|
} catch {
|
|
641
678
|
}
|
|
642
|
-
o(), a(), r.remove(),
|
|
679
|
+
o(), a(), r.remove(), On(), e && (e.style.display = n);
|
|
643
680
|
}
|
|
644
681
|
}
|
|
645
|
-
function
|
|
682
|
+
function Nn(t = "") {
|
|
646
683
|
const e = String(t || "");
|
|
647
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" : "";
|
|
648
685
|
}
|
|
649
|
-
function
|
|
686
|
+
function jn(t = "") {
|
|
650
687
|
const e = String(t || "");
|
|
651
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" : "";
|
|
652
689
|
}
|
|
653
|
-
function
|
|
690
|
+
function _n(t = {}) {
|
|
654
691
|
const e = navigator.userAgent;
|
|
655
692
|
return {
|
|
656
693
|
url: location.href,
|
|
657
694
|
title: document.title,
|
|
658
695
|
userAgent: e,
|
|
659
|
-
os:
|
|
660
|
-
browser:
|
|
696
|
+
os: Nn(e),
|
|
697
|
+
browser: jn(e),
|
|
661
698
|
language: navigator.language,
|
|
662
699
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
663
700
|
viewport: {
|
|
@@ -672,11 +709,11 @@ function Dn(t = {}) {
|
|
|
672
709
|
}
|
|
673
710
|
};
|
|
674
711
|
}
|
|
675
|
-
const
|
|
712
|
+
const Xt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Yt = {
|
|
676
713
|
id: "userId",
|
|
677
714
|
username: "displayName",
|
|
678
715
|
name: "displayName"
|
|
679
|
-
},
|
|
716
|
+
}, Gt = /* @__PURE__ */ new Set([
|
|
680
717
|
"endpoint",
|
|
681
718
|
"projectKey",
|
|
682
719
|
"version",
|
|
@@ -689,7 +726,7 @@ const zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), qt = {
|
|
|
689
726
|
"kinds",
|
|
690
727
|
"capture",
|
|
691
728
|
"onBeforeCapture"
|
|
692
|
-
]),
|
|
729
|
+
]), Jt = {
|
|
693
730
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
694
731
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
695
732
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -698,14 +735,14 @@ const zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), qt = {
|
|
|
698
735
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
699
736
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
700
737
|
};
|
|
701
|
-
function
|
|
702
|
-
const n = e.warn ||
|
|
703
|
-
for (const o of
|
|
738
|
+
function Vn(t = {}, e = {}) {
|
|
739
|
+
const n = e.warn || ye, r = t && typeof t == "object" ? t : {}, a = {}, i = [];
|
|
740
|
+
for (const o of Xt)
|
|
704
741
|
Object.prototype.hasOwnProperty.call(r, o) && (a[o] = r[o]);
|
|
705
|
-
for (const [o, c] of Object.entries(
|
|
742
|
+
for (const [o, c] of Object.entries(Yt))
|
|
706
743
|
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(a, c) || (a[c] = r[o]));
|
|
707
744
|
for (const o of Object.keys(r))
|
|
708
|
-
|
|
745
|
+
Xt.has(o) || Object.prototype.hasOwnProperty.call(Yt, o) || i.push(o);
|
|
709
746
|
if (i.length) {
|
|
710
747
|
const o = i.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
711
748
|
n(
|
|
@@ -714,24 +751,24 @@ function Fn(t = {}, e = {}) {
|
|
|
714
751
|
}
|
|
715
752
|
return a;
|
|
716
753
|
}
|
|
717
|
-
function
|
|
718
|
-
const n = e.warn ||
|
|
754
|
+
function Wn(t = {}, e = {}) {
|
|
755
|
+
const n = e.warn || ye, r = t && typeof t == "object" ? t : {}, a = Object.keys(r).filter((i) => !Gt.has(i));
|
|
719
756
|
if (a.length)
|
|
720
757
|
for (const i of a) {
|
|
721
|
-
if (
|
|
722
|
-
n(`Notefully.init: ignoring "${i}". ${
|
|
758
|
+
if (Jt[i]) {
|
|
759
|
+
n(`Notefully.init: ignoring "${i}". ${Jt[i]}`);
|
|
723
760
|
continue;
|
|
724
761
|
}
|
|
725
762
|
n(
|
|
726
|
-
`Notefully.init: ignoring unknown key "${i}". Supported: ${[...
|
|
763
|
+
`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Gt].join(", ")}.`
|
|
727
764
|
);
|
|
728
765
|
}
|
|
729
766
|
}
|
|
730
|
-
function
|
|
767
|
+
function ye(t) {
|
|
731
768
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
732
769
|
}
|
|
733
|
-
const
|
|
734
|
-
function
|
|
770
|
+
const zn = 80;
|
|
771
|
+
function qn() {
|
|
735
772
|
const t = [], e = {};
|
|
736
773
|
let n = !1;
|
|
737
774
|
const r = (i, o) => {
|
|
@@ -745,7 +782,7 @@ function jn() {
|
|
|
745
782
|
level: i,
|
|
746
783
|
text: c.slice(0, 2e3),
|
|
747
784
|
at: Date.now()
|
|
748
|
-
}), t.length >
|
|
785
|
+
}), t.length > zn && t.shift();
|
|
749
786
|
};
|
|
750
787
|
return {
|
|
751
788
|
hook: () => {
|
|
@@ -764,7 +801,7 @@ function jn() {
|
|
|
764
801
|
}
|
|
765
802
|
};
|
|
766
803
|
}
|
|
767
|
-
function
|
|
804
|
+
function Kn(t) {
|
|
768
805
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
769
806
|
let n = null, r = !1;
|
|
770
807
|
const a = () => {
|
|
@@ -794,8 +831,8 @@ function _n(t) {
|
|
|
794
831
|
isActive: () => r
|
|
795
832
|
};
|
|
796
833
|
}
|
|
797
|
-
const
|
|
798
|
-
function
|
|
834
|
+
const Xn = 60 * 1e3;
|
|
835
|
+
function Yn({ onStart: t, onStop: e, onError: n }) {
|
|
799
836
|
let r = null, a = null, i = [], o = null;
|
|
800
837
|
const c = () => {
|
|
801
838
|
if (o && (clearTimeout(o), o = null), a && a.state !== "inactive")
|
|
@@ -812,7 +849,7 @@ function Wn({ onStart: t, onStop: e, onError: n }) {
|
|
|
812
849
|
c(), e(null);
|
|
813
850
|
};
|
|
814
851
|
return { start: async () => {
|
|
815
|
-
var f,
|
|
852
|
+
var f, p;
|
|
816
853
|
if (!((f = navigator.mediaDevices) != null && f.getDisplayMedia))
|
|
817
854
|
throw new Error("Screen recording is not supported in this browser.");
|
|
818
855
|
r = await navigator.mediaDevices.getDisplayMedia({
|
|
@@ -827,10 +864,10 @@ function Wn({ onStart: t, onStop: e, onError: n }) {
|
|
|
827
864
|
}, a.onstop = () => {
|
|
828
865
|
const y = i.length ? new Blob(i, { type: a.mimeType || "video/webm" }) : null;
|
|
829
866
|
c(), e(y);
|
|
830
|
-
}, (
|
|
867
|
+
}, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), a.start(), o = setTimeout(l, Xn);
|
|
831
868
|
}, stop: l };
|
|
832
869
|
}
|
|
833
|
-
function
|
|
870
|
+
function Gn() {
|
|
834
871
|
const t = /* @__PURE__ */ new Set();
|
|
835
872
|
return {
|
|
836
873
|
alloc() {
|
|
@@ -848,19 +885,19 @@ function zn() {
|
|
|
848
885
|
}
|
|
849
886
|
};
|
|
850
887
|
}
|
|
851
|
-
const
|
|
852
|
-
function
|
|
853
|
-
const t =
|
|
854
|
-
let e = [], n = { ...
|
|
888
|
+
const yt = { x: 0, y: 0, w: 1, h: 1 };
|
|
889
|
+
function Pt() {
|
|
890
|
+
const t = Gn();
|
|
891
|
+
let e = [], n = { ...yt }, r = 1;
|
|
855
892
|
return {
|
|
856
|
-
list: () => e.filter((i) =>
|
|
893
|
+
list: () => e.filter((i) => Qn(i, n)),
|
|
857
894
|
all: () => e.slice(),
|
|
858
895
|
crop: () => ({ ...n }),
|
|
859
896
|
setCrop(i) {
|
|
860
|
-
return n =
|
|
897
|
+
return n = Jn(i), n;
|
|
861
898
|
},
|
|
862
899
|
resetCrop() {
|
|
863
|
-
return n = { ...
|
|
900
|
+
return n = { ...yt }, n;
|
|
864
901
|
},
|
|
865
902
|
isCropped() {
|
|
866
903
|
return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
|
|
@@ -892,20 +929,20 @@ function Rt() {
|
|
|
892
929
|
return t.free(c.number), c;
|
|
893
930
|
},
|
|
894
931
|
reset() {
|
|
895
|
-
for (e = [], n = { ...
|
|
932
|
+
for (e = [], n = { ...yt }, r = 1; t.peekUsed().length; )
|
|
896
933
|
t.free(t.peekUsed()[0]);
|
|
897
934
|
}
|
|
898
935
|
};
|
|
899
936
|
}
|
|
900
|
-
function
|
|
937
|
+
function Jn(t) {
|
|
901
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), a = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
902
939
|
return { x: e, y: n, w: r, h: a };
|
|
903
940
|
}
|
|
904
|
-
function
|
|
941
|
+
function Qn(t, e) {
|
|
905
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;
|
|
906
943
|
return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
|
|
907
944
|
}
|
|
908
|
-
function
|
|
945
|
+
function kt(t) {
|
|
909
946
|
const e = Math.max(1, Number(t) || 1);
|
|
910
947
|
return {
|
|
911
948
|
stroke: Math.max(2, e * 75e-4),
|
|
@@ -915,52 +952,52 @@ function $t(t) {
|
|
|
915
952
|
arrowHeadAngle: 0.4
|
|
916
953
|
};
|
|
917
954
|
}
|
|
918
|
-
function
|
|
955
|
+
function Zn(t, {
|
|
919
956
|
stickers: e = [],
|
|
920
957
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
921
958
|
width: r,
|
|
922
959
|
height: a,
|
|
923
960
|
colors: i = {}
|
|
924
961
|
}) {
|
|
925
|
-
const o = i.mark || "#fdd341", c = i.markText || "#2a2140", l =
|
|
962
|
+
const o = i.mark || "#fdd341", c = i.markText || "#2a2140", l = kt(r);
|
|
926
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) => {
|
|
927
|
-
const f =
|
|
964
|
+
const f = Et(u.x, n, r), p = Ct(u.y, n, a), y = u.w / n.w * r, v = u.h / n.h * a, A = l.stroke / 2;
|
|
928
965
|
if (u.type === "rect")
|
|
929
966
|
t.strokeRect(
|
|
930
|
-
f +
|
|
931
|
-
|
|
967
|
+
f + A,
|
|
968
|
+
p + A,
|
|
932
969
|
Math.max(0, y - l.stroke),
|
|
933
|
-
Math.max(0,
|
|
970
|
+
Math.max(0, v - l.stroke)
|
|
934
971
|
);
|
|
935
972
|
else if (u.type === "circle")
|
|
936
973
|
t.beginPath(), t.ellipse(
|
|
937
974
|
f + y / 2,
|
|
938
|
-
|
|
939
|
-
Math.max(0.5, y / 2 -
|
|
940
|
-
Math.max(0.5,
|
|
975
|
+
p + v / 2,
|
|
976
|
+
Math.max(0.5, y / 2 - A),
|
|
977
|
+
Math.max(0.5, v / 2 - A),
|
|
941
978
|
0,
|
|
942
979
|
0,
|
|
943
980
|
Math.PI * 2
|
|
944
981
|
), t.stroke();
|
|
945
982
|
else if (u.type === "arrow") {
|
|
946
|
-
const
|
|
947
|
-
|
|
983
|
+
const V = Et(u.x2 ?? u.x + u.w, n, r), W = Ct(u.y2 ?? u.y, n, a);
|
|
984
|
+
er(t, f, p, V, W, l);
|
|
948
985
|
}
|
|
949
986
|
if (u.number == null || u.number === "")
|
|
950
987
|
return;
|
|
951
|
-
const I =
|
|
952
|
-
t.beginPath(), t.arc(I.x, I.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(
|
|
988
|
+
const I = tr(u, n, r, a, f, p, y), Y = String(u.number);
|
|
989
|
+
t.beginPath(), t.arc(I.x, I.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Y, I.x, I.y + 0.5), t.fillStyle = o;
|
|
953
990
|
}), t.restore();
|
|
954
991
|
}
|
|
955
|
-
function
|
|
992
|
+
function Et(t, e, n) {
|
|
956
993
|
return (t - e.x) / e.w * n;
|
|
957
994
|
}
|
|
958
|
-
function
|
|
995
|
+
function Ct(t, e, n) {
|
|
959
996
|
return (t - e.y) / e.h * n;
|
|
960
997
|
}
|
|
961
|
-
function
|
|
998
|
+
function tr(t, e, n, r, a, i, o) {
|
|
962
999
|
if (t.type === "arrow") {
|
|
963
|
-
const c =
|
|
1000
|
+
const c = Et(t.x2 ?? t.x + t.w, e, n), l = Ct(t.y2 ?? t.y, e, r);
|
|
964
1001
|
return {
|
|
965
1002
|
x: (a + c) / 2,
|
|
966
1003
|
y: (i + l) / 2
|
|
@@ -968,95 +1005,95 @@ function Yn(t, e, n, r, a, i, o) {
|
|
|
968
1005
|
}
|
|
969
1006
|
return { x: a + o / 2, y: i };
|
|
970
1007
|
}
|
|
971
|
-
function
|
|
972
|
-
const i = Math.atan2(r - e, n - t), o = a.arrowHead, c = Math.min(a.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(i) * o,
|
|
1008
|
+
function ge(t, e, n, r, a) {
|
|
1009
|
+
const i = Math.atan2(r - e, n - t), o = a.arrowHead, c = Math.min(a.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(i) * o, p = r - Math.sin(i) * o, y = {
|
|
973
1010
|
x: l - o * Math.cos(i - a.arrowHeadAngle),
|
|
974
1011
|
y: u - o * Math.sin(i - a.arrowHeadAngle)
|
|
975
|
-
},
|
|
1012
|
+
}, v = {
|
|
976
1013
|
x: l - o * Math.cos(i + a.arrowHeadAngle),
|
|
977
1014
|
y: u - o * Math.sin(i + a.arrowHeadAngle)
|
|
978
|
-
},
|
|
1015
|
+
}, A = {
|
|
979
1016
|
x: n - Math.cos(i) * c,
|
|
980
1017
|
y: r - Math.sin(i) * c
|
|
981
1018
|
};
|
|
982
|
-
return { angle: i, tipX: l, tipY: u, baseX: f, baseY:
|
|
1019
|
+
return { angle: i, tipX: l, tipY: u, baseX: f, baseY: p, left: y, right: v, shaftEnd: A };
|
|
983
1020
|
}
|
|
984
|
-
function
|
|
985
|
-
const o =
|
|
1021
|
+
function er(t, e, n, r, a, i) {
|
|
1022
|
+
const o = ge(e, n, r, a, i);
|
|
986
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();
|
|
987
1024
|
}
|
|
988
|
-
function
|
|
1025
|
+
function nr(t, e, n, r = {}) {
|
|
989
1026
|
return new Promise((a, i) => {
|
|
990
1027
|
const o = new Image();
|
|
991
1028
|
o.onload = () => {
|
|
992
|
-
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)),
|
|
993
|
-
|
|
994
|
-
const y =
|
|
995
|
-
y.drawImage(o, c, l, u, f, 0, 0, u, f),
|
|
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)), p = document.createElement("canvas");
|
|
1030
|
+
p.width = u, p.height = f;
|
|
1031
|
+
const y = p.getContext("2d");
|
|
1032
|
+
y.drawImage(o, c, l, u, f, 0, 0, u, f), Zn(y, {
|
|
996
1033
|
stickers: n,
|
|
997
1034
|
crop: e,
|
|
998
1035
|
width: u,
|
|
999
1036
|
height: f,
|
|
1000
1037
|
colors: r
|
|
1001
|
-
}),
|
|
1002
|
-
if (!
|
|
1038
|
+
}), p.toBlob((v) => {
|
|
1039
|
+
if (!v) {
|
|
1003
1040
|
i(new Error("Could not encode screenshot"));
|
|
1004
1041
|
return;
|
|
1005
1042
|
}
|
|
1006
|
-
a(
|
|
1043
|
+
a(v);
|
|
1007
1044
|
}, "image/png");
|
|
1008
1045
|
}, o.onerror = () => i(new Error("Could not load screenshot")), o.src = t;
|
|
1009
1046
|
});
|
|
1010
1047
|
}
|
|
1011
|
-
const
|
|
1048
|
+
const N = [
|
|
1012
1049
|
{ id: "bug", label: "Bug" },
|
|
1013
1050
|
{ id: "idea", label: "Idea" },
|
|
1014
1051
|
{ id: "other", label: "Other" }
|
|
1015
1052
|
];
|
|
1016
|
-
function
|
|
1053
|
+
function Qt(t) {
|
|
1017
1054
|
return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
1018
1055
|
}
|
|
1019
|
-
function
|
|
1056
|
+
function gt(t) {
|
|
1020
1057
|
const e = String(t || "").trim();
|
|
1021
1058
|
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
1022
1059
|
}
|
|
1023
|
-
function
|
|
1060
|
+
function rr(t) {
|
|
1024
1061
|
if (!Array.isArray(t) || !t.length)
|
|
1025
|
-
return
|
|
1062
|
+
return N.map((r) => ({ ...r }));
|
|
1026
1063
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
1027
1064
|
for (const r of t) {
|
|
1028
1065
|
let a = "", i = "";
|
|
1029
|
-
typeof r == "string" || typeof r == "number" ? (a =
|
|
1066
|
+
typeof r == "string" || typeof r == "number" ? (a = Qt(r), i = gt(a)) : r && typeof r == "object" && (a = Qt(r.id ?? r.value ?? r.kind), i = String(r.label || r.name || gt(a)).trim() || gt(a)), !(!a || e.has(a)) && (e.add(a), n.push({ id: a, label: i }));
|
|
1030
1067
|
}
|
|
1031
|
-
return n.length ? n :
|
|
1068
|
+
return n.length ? n : N.map((r) => ({ ...r }));
|
|
1032
1069
|
}
|
|
1033
|
-
function
|
|
1070
|
+
function dt(t) {
|
|
1034
1071
|
var n;
|
|
1035
|
-
const e = Array.isArray(t) && t.length ? t :
|
|
1072
|
+
const e = Array.isArray(t) && t.length ? t : N;
|
|
1036
1073
|
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
1037
1074
|
}
|
|
1038
|
-
const
|
|
1075
|
+
const ir = ["maker", "all-business", "brighter-day", "quiet-night"], we = "maker", ar = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Mt = 0.02, Zt = 0.05, or = `
|
|
1039
1076
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
1040
1077
|
<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"/>
|
|
1041
1078
|
<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"/>
|
|
1042
1079
|
</svg>
|
|
1043
1080
|
`;
|
|
1044
|
-
function
|
|
1081
|
+
function P(t) {
|
|
1045
1082
|
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>`;
|
|
1046
1083
|
}
|
|
1047
|
-
const
|
|
1048
|
-
crop:
|
|
1049
|
-
resetCrop:
|
|
1050
|
-
arrow:
|
|
1051
|
-
rect:
|
|
1052
|
-
circle:
|
|
1053
|
-
discard:
|
|
1054
|
-
recapture:
|
|
1055
|
-
audio:
|
|
1056
|
-
video:
|
|
1057
|
-
},
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1084
|
+
const L = {
|
|
1085
|
+
crop: P('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
1086
|
+
resetCrop: P('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
1087
|
+
arrow: P('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
1088
|
+
rect: P('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
|
|
1089
|
+
circle: P('<circle cx="12" cy="12" r="8"/>'),
|
|
1090
|
+
discard: P('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
1091
|
+
recapture: P('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
|
|
1092
|
+
audio: P('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
|
|
1093
|
+
video: P('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
1094
|
+
}, be = qn();
|
|
1095
|
+
be.hook();
|
|
1096
|
+
const Se = 10, sr = 80, ve = "notefully.author", At = "Anonymous";
|
|
1060
1097
|
let d = {
|
|
1061
1098
|
endpoint: "",
|
|
1062
1099
|
projectKey: "",
|
|
@@ -1064,46 +1101,46 @@ let d = {
|
|
|
1064
1101
|
name: "",
|
|
1065
1102
|
targets: null,
|
|
1066
1103
|
hideLauncher: !1,
|
|
1067
|
-
theme:
|
|
1104
|
+
theme: we,
|
|
1068
1105
|
video: !1,
|
|
1069
|
-
consoleLogLimit:
|
|
1070
|
-
kinds:
|
|
1106
|
+
consoleLogLimit: Se,
|
|
1107
|
+
kinds: N.map((t) => ({ ...t })),
|
|
1071
1108
|
capture: null,
|
|
1072
1109
|
onBeforeCapture: null
|
|
1073
|
-
},
|
|
1110
|
+
}, wt = !1, R = {}, h = null, s = {}, m = Pt(), T = "", X = "", $ = null, j = dt(N), B = null, M = null, b = null, w = null, nt = null, U = null, G = null, k = { w: 0, h: 0 }, bt = !1, It = !1;
|
|
1074
1111
|
function g(t) {
|
|
1075
1112
|
return h.querySelector(t);
|
|
1076
1113
|
}
|
|
1077
|
-
function
|
|
1114
|
+
function xe(t) {
|
|
1078
1115
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
1079
|
-
return
|
|
1116
|
+
return ir.includes(e) ? e : we;
|
|
1080
1117
|
}
|
|
1081
|
-
function
|
|
1118
|
+
function te(t, e) {
|
|
1082
1119
|
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
1083
1120
|
}
|
|
1084
|
-
async function
|
|
1121
|
+
async function cr(t) {
|
|
1085
1122
|
return (await fetch(t)).blob();
|
|
1086
1123
|
}
|
|
1087
|
-
function
|
|
1088
|
-
s.status && (s.status.textContent = t || "",
|
|
1124
|
+
function S(t, e = !1) {
|
|
1125
|
+
s.status && (s.status.textContent = t || "", nt && (clearTimeout(nt), nt = null), t && !e && (nt = setTimeout(() => {
|
|
1089
1126
|
s.status.textContent = "";
|
|
1090
1127
|
}, 4e3)));
|
|
1091
1128
|
}
|
|
1092
|
-
function
|
|
1129
|
+
function Ot() {
|
|
1093
1130
|
return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
|
|
1094
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
1131
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${or}</button>
|
|
1095
1132
|
<div class="nf-dialog" hidden>
|
|
1096
1133
|
<div class="nf-panel">
|
|
1097
1134
|
<div class="nf-panel-body">
|
|
1098
|
-
<div class="nf-stage">
|
|
1135
|
+
<div class="nf-stage" hidden>
|
|
1099
1136
|
<div class="nf-palette">
|
|
1100
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
1101
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
1102
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
1103
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
1104
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
1105
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
1106
|
-
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${
|
|
1137
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${L.crop}</button>
|
|
1138
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${L.resetCrop}</button>
|
|
1139
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${L.arrow}</button>
|
|
1140
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${L.rect}</button>
|
|
1141
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${L.circle}</button>
|
|
1142
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${L.discard}</button>
|
|
1143
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${L.recapture}</button>
|
|
1107
1144
|
</div>
|
|
1108
1145
|
<div class="nf-canvas"></div>
|
|
1109
1146
|
</div>
|
|
@@ -1111,9 +1148,9 @@ function Pt() {
|
|
|
1111
1148
|
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
1112
1149
|
<div class="nf-kind"></div>
|
|
1113
1150
|
<div class="nf-actions">
|
|
1114
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
1115
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
1116
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
1151
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${L.resetCrop}</button>
|
|
1152
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${L.audio}</button>
|
|
1153
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${L.video}</button>
|
|
1117
1154
|
<button class="nf-submit" type="button">Submit</button>
|
|
1118
1155
|
</div>
|
|
1119
1156
|
<div class="nf-status"></div>
|
|
@@ -1129,9 +1166,11 @@ function Pt() {
|
|
|
1129
1166
|
panelBody: g(".nf-panel-body"),
|
|
1130
1167
|
successMsg: g(".nf-success-msg"),
|
|
1131
1168
|
stage: g(".nf-stage"),
|
|
1169
|
+
palette: g(".nf-palette"),
|
|
1132
1170
|
canvas: g(".nf-canvas"),
|
|
1133
1171
|
text: g(".nf-text"),
|
|
1134
1172
|
author: g(".nf-author"),
|
|
1173
|
+
actions: g(".nf-actions"),
|
|
1135
1174
|
restore: g(".nf-restore"),
|
|
1136
1175
|
status: g(".nf-status"),
|
|
1137
1176
|
audio: g(".nf-audio"),
|
|
@@ -1142,144 +1181,144 @@ function Pt() {
|
|
|
1142
1181
|
resetCrop: g(".nf-reset-crop"),
|
|
1143
1182
|
submit: g(".nf-submit"),
|
|
1144
1183
|
shot: null
|
|
1145
|
-
},
|
|
1184
|
+
}, lr(), Q()), h;
|
|
1146
1185
|
}
|
|
1147
|
-
function
|
|
1186
|
+
function Q() {
|
|
1148
1187
|
var t;
|
|
1149
|
-
h && (h.dataset.theme =
|
|
1188
|
+
h && (h.dataset.theme = xe(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Ee(), (t = s.dialog) != null && t.hidden && ot());
|
|
1150
1189
|
}
|
|
1151
|
-
function
|
|
1190
|
+
function ot() {
|
|
1152
1191
|
s.launcher && (s.launcher.hidden = !!d.hideLauncher);
|
|
1153
1192
|
}
|
|
1154
|
-
function
|
|
1155
|
-
s.launcher.addEventListener("click", () =>
|
|
1156
|
-
|
|
1193
|
+
function lr() {
|
|
1194
|
+
s.launcher.addEventListener("click", () => Ie()), g(".nf-dialog").addEventListener("click", (e) => {
|
|
1195
|
+
It || e.target === s.dialog && et();
|
|
1157
1196
|
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1158
|
-
e.addEventListener("click", () =>
|
|
1159
|
-
}), s.resetCrop.addEventListener("click",
|
|
1197
|
+
e.addEventListener("click", () => J(e.dataset.tool));
|
|
1198
|
+
}), s.resetCrop.addEventListener("click", yr), s.canvas.addEventListener("pointerdown", dr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1160
1199
|
const t = g(".nf-kind");
|
|
1161
1200
|
t && t.addEventListener("click", (e) => {
|
|
1162
1201
|
const n = e.target.closest("[data-kind]");
|
|
1163
|
-
n &&
|
|
1164
|
-
}), s.discard.addEventListener("click",
|
|
1165
|
-
|
|
1166
|
-
}), s.restore.addEventListener("click",
|
|
1167
|
-
|
|
1168
|
-
}),
|
|
1202
|
+
n && Bt(n.dataset.kind);
|
|
1203
|
+
}), s.discard.addEventListener("click", gr), s.recapture.addEventListener("click", () => {
|
|
1204
|
+
br().catch((e) => S(e.message || "Recapture failed."));
|
|
1205
|
+
}), s.restore.addEventListener("click", wr), s.audio.addEventListener("click", Sr), s.video.addEventListener("click", vr), s.stop.addEventListener("click", () => G == null ? void 0 : G.stop()), g(".nf-submit").addEventListener("click", () => {
|
|
1206
|
+
Be().catch((e) => S(e.message || "Submit failed."));
|
|
1207
|
+
}), Ee(), J(null);
|
|
1169
1208
|
}
|
|
1170
|
-
function
|
|
1209
|
+
function ee(t) {
|
|
1171
1210
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1172
1211
|
}
|
|
1173
|
-
function
|
|
1212
|
+
function Ee() {
|
|
1174
1213
|
const t = h == null ? void 0 : h.querySelector(".nf-kind");
|
|
1175
1214
|
if (!t)
|
|
1176
1215
|
return;
|
|
1177
|
-
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds :
|
|
1178
|
-
t.innerHTML = e.map((a) => `<button type="button" data-kind="${
|
|
1179
|
-
const r = e.map((a) => a.id).includes(
|
|
1180
|
-
|
|
1181
|
-
}
|
|
1182
|
-
function
|
|
1183
|
-
|
|
1184
|
-
n.dataset.active = String(n.dataset.kind ===
|
|
1216
|
+
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : N;
|
|
1217
|
+
t.innerHTML = e.map((a) => `<button type="button" data-kind="${ee(a.id)}">${ee(a.label)}</button>`).join("");
|
|
1218
|
+
const r = e.map((a) => a.id).includes(j) ? j : dt(e);
|
|
1219
|
+
Bt(r);
|
|
1220
|
+
}
|
|
1221
|
+
function Bt(t) {
|
|
1222
|
+
j = (d.kinds || N).map((n) => n.id).includes(t) ? t : dt(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1223
|
+
n.dataset.active = String(n.dataset.kind === j);
|
|
1185
1224
|
});
|
|
1186
1225
|
}
|
|
1187
|
-
function
|
|
1188
|
-
B =
|
|
1226
|
+
function J(t) {
|
|
1227
|
+
B = ar.has(t) ? t : null, M = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1189
1228
|
e.dataset.active = String(e.dataset.tool === B);
|
|
1190
|
-
}), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"),
|
|
1229
|
+
}), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"), F() && C();
|
|
1191
1230
|
}
|
|
1192
|
-
function
|
|
1231
|
+
function ne(t) {
|
|
1193
1232
|
return Math.min(1, Math.max(0, t));
|
|
1194
1233
|
}
|
|
1195
|
-
function
|
|
1234
|
+
function Z() {
|
|
1196
1235
|
return s.shot || s.canvas;
|
|
1197
1236
|
}
|
|
1198
|
-
function
|
|
1199
|
-
const e =
|
|
1237
|
+
function st(t) {
|
|
1238
|
+
const e = Z().getBoundingClientRect();
|
|
1200
1239
|
return {
|
|
1201
|
-
x:
|
|
1202
|
-
y:
|
|
1240
|
+
x: ne((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1241
|
+
y: ne((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1203
1242
|
};
|
|
1204
1243
|
}
|
|
1205
|
-
function
|
|
1206
|
-
const e =
|
|
1244
|
+
function ur(t) {
|
|
1245
|
+
const e = Z().getBoundingClientRect();
|
|
1207
1246
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1208
1247
|
}
|
|
1209
|
-
function
|
|
1210
|
-
const e =
|
|
1248
|
+
function Ce(t) {
|
|
1249
|
+
const e = st(t), n = m.crop();
|
|
1211
1250
|
return {
|
|
1212
1251
|
x: n.x + e.x * n.w,
|
|
1213
1252
|
y: n.y + e.y * n.h
|
|
1214
1253
|
};
|
|
1215
1254
|
}
|
|
1216
|
-
function
|
|
1255
|
+
function ft(t, e) {
|
|
1217
1256
|
const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
|
|
1218
1257
|
return {
|
|
1219
1258
|
x: n,
|
|
1220
1259
|
y: r,
|
|
1221
|
-
w: Math.max(
|
|
1222
|
-
h: Math.max(
|
|
1260
|
+
w: Math.max(Mt, Math.abs(e.x - t.x)),
|
|
1261
|
+
h: Math.max(Mt, Math.abs(e.y - t.y))
|
|
1223
1262
|
};
|
|
1224
1263
|
}
|
|
1225
|
-
function
|
|
1264
|
+
function Ht(t) {
|
|
1226
1265
|
h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
|
|
1227
1266
|
}
|
|
1228
|
-
function
|
|
1267
|
+
function St(t) {
|
|
1229
1268
|
try {
|
|
1230
1269
|
s.canvas.setPointerCapture(t.pointerId);
|
|
1231
1270
|
} catch {
|
|
1232
1271
|
}
|
|
1233
1272
|
}
|
|
1234
|
-
function
|
|
1235
|
-
window.addEventListener("pointermove",
|
|
1273
|
+
function Lt() {
|
|
1274
|
+
window.addEventListener("pointermove", Ae), window.addEventListener("pointerup", ct), window.addEventListener("pointercancel", ct);
|
|
1236
1275
|
}
|
|
1237
|
-
function
|
|
1238
|
-
window.removeEventListener("pointermove",
|
|
1276
|
+
function Me() {
|
|
1277
|
+
window.removeEventListener("pointermove", Ae), window.removeEventListener("pointerup", ct), window.removeEventListener("pointercancel", ct);
|
|
1239
1278
|
}
|
|
1240
|
-
function
|
|
1241
|
-
if (t.button !== 0 || !
|
|
1279
|
+
function dr(t) {
|
|
1280
|
+
if (t.button !== 0 || !F())
|
|
1242
1281
|
return;
|
|
1243
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1244
|
-
M = null,
|
|
1282
|
+
if (!t.target.closest(".nf-sticker") && !ur(t)) {
|
|
1283
|
+
M = null, C();
|
|
1245
1284
|
return;
|
|
1246
1285
|
}
|
|
1247
1286
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1248
1287
|
if (n && n.dataset.preview !== "true") {
|
|
1249
|
-
t.preventDefault(), t.stopPropagation(), M = n.dataset.id,
|
|
1288
|
+
t.preventDefault(), t.stopPropagation(), M = n.dataset.id, St(t), fr({
|
|
1250
1289
|
kind: "sticker",
|
|
1251
1290
|
id: M,
|
|
1252
1291
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
1253
|
-
}, t),
|
|
1292
|
+
}, t), C();
|
|
1254
1293
|
return;
|
|
1255
1294
|
}
|
|
1256
1295
|
if (M = null, B === "crop") {
|
|
1257
|
-
t.preventDefault(),
|
|
1296
|
+
t.preventDefault(), St(t), b = { kind: "crop", start: st(t), current: st(t) }, Lt(), C();
|
|
1258
1297
|
return;
|
|
1259
1298
|
}
|
|
1260
1299
|
if (B === "arrow" || B === "rect" || B === "circle") {
|
|
1261
|
-
t.preventDefault(),
|
|
1262
|
-
const r =
|
|
1263
|
-
b = { kind: "sticker", type: B, start: r, current: r },
|
|
1300
|
+
t.preventDefault(), St(t);
|
|
1301
|
+
const r = Ce(t);
|
|
1302
|
+
b = { kind: "sticker", type: B, start: r, current: r }, Lt(), C();
|
|
1264
1303
|
return;
|
|
1265
1304
|
}
|
|
1266
|
-
|
|
1305
|
+
C();
|
|
1267
1306
|
}
|
|
1268
|
-
function
|
|
1307
|
+
function fr(t, e) {
|
|
1269
1308
|
e.preventDefault(), e.stopPropagation();
|
|
1270
|
-
const n =
|
|
1309
|
+
const n = Z().getBoundingClientRect(), r = m.list().find((a) => a.id === t.id);
|
|
1271
1310
|
w = {
|
|
1272
1311
|
...t,
|
|
1273
1312
|
startX: e.clientX,
|
|
1274
1313
|
startY: e.clientY,
|
|
1275
|
-
crop:
|
|
1314
|
+
crop: m.crop(),
|
|
1276
1315
|
sticker: r ? { ...r } : null,
|
|
1277
1316
|
rect: n
|
|
1278
|
-
},
|
|
1317
|
+
}, Ht(t.dir === "move" || t.dir === "start" || t.dir === "end"), Lt();
|
|
1279
1318
|
}
|
|
1280
|
-
function
|
|
1319
|
+
function Ae(t) {
|
|
1281
1320
|
if (b) {
|
|
1282
|
-
b.current = b.kind === "crop" ?
|
|
1321
|
+
b.current = b.kind === "crop" ? st(t) : Ce(t), C();
|
|
1283
1322
|
return;
|
|
1284
1323
|
}
|
|
1285
1324
|
if (!w)
|
|
@@ -1287,17 +1326,17 @@ function Ee(t) {
|
|
|
1287
1326
|
const e = (t.clientX - w.startX) / w.rect.width * w.crop.w, n = (t.clientY - w.startY) / w.rect.height * w.crop.h, r = w.sticker;
|
|
1288
1327
|
if (r) {
|
|
1289
1328
|
if (w.dir === "end")
|
|
1290
|
-
|
|
1329
|
+
m.update(r.id, {
|
|
1291
1330
|
x2: r.x2 + e,
|
|
1292
1331
|
y2: r.y2 + n
|
|
1293
1332
|
});
|
|
1294
1333
|
else if (w.dir === "start")
|
|
1295
|
-
|
|
1334
|
+
m.update(r.id, {
|
|
1296
1335
|
x: r.x + e,
|
|
1297
1336
|
y: r.y + n
|
|
1298
1337
|
});
|
|
1299
1338
|
else if (w.dir === "move")
|
|
1300
|
-
|
|
1339
|
+
m.update(r.id, {
|
|
1301
1340
|
x: r.x + e,
|
|
1302
1341
|
y: r.y + n,
|
|
1303
1342
|
x2: (r.x2 || r.x) + e,
|
|
@@ -1305,12 +1344,12 @@ function Ee(t) {
|
|
|
1305
1344
|
});
|
|
1306
1345
|
else {
|
|
1307
1346
|
const a = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1308
|
-
|
|
1347
|
+
hr(a, w.dir, e, n), m.update(r.id, a);
|
|
1309
1348
|
}
|
|
1310
|
-
|
|
1349
|
+
C();
|
|
1311
1350
|
}
|
|
1312
1351
|
}
|
|
1313
|
-
function
|
|
1352
|
+
function hr(t, e, n, r) {
|
|
1314
1353
|
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")) {
|
|
1315
1354
|
const a = Math.max(0.04, t.w - n);
|
|
1316
1355
|
t.x += t.w - a, t.w = a;
|
|
@@ -1320,52 +1359,52 @@ function cr(t, e, n, r) {
|
|
|
1320
1359
|
t.y += t.h - a, t.h = a;
|
|
1321
1360
|
}
|
|
1322
1361
|
}
|
|
1323
|
-
function
|
|
1324
|
-
if (
|
|
1325
|
-
|
|
1362
|
+
function ct(t) {
|
|
1363
|
+
if (Me(), Ht(!1), b) {
|
|
1364
|
+
pr();
|
|
1326
1365
|
return;
|
|
1327
1366
|
}
|
|
1328
1367
|
if (w) {
|
|
1329
1368
|
if (w.kind === "sticker") {
|
|
1330
1369
|
const e = s.canvas.getBoundingClientRect();
|
|
1331
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1370
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(w.id), M = null);
|
|
1332
1371
|
}
|
|
1333
|
-
w = null,
|
|
1372
|
+
w = null, C();
|
|
1334
1373
|
}
|
|
1335
1374
|
}
|
|
1336
|
-
function
|
|
1375
|
+
function pr() {
|
|
1337
1376
|
const t = b;
|
|
1338
1377
|
if (b = null, !t)
|
|
1339
1378
|
return;
|
|
1340
1379
|
if (t.kind === "crop") {
|
|
1341
|
-
const n =
|
|
1342
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1343
|
-
|
|
1380
|
+
const n = ft(t.start, t.current);
|
|
1381
|
+
if (Math.abs(t.current.x - t.start.x) < Zt || Math.abs(t.current.y - t.start.y) < Zt) {
|
|
1382
|
+
C();
|
|
1344
1383
|
return;
|
|
1345
1384
|
}
|
|
1346
|
-
const a =
|
|
1347
|
-
|
|
1385
|
+
const a = m.crop();
|
|
1386
|
+
m.setCrop({
|
|
1348
1387
|
x: a.x + n.x * a.w,
|
|
1349
1388
|
y: a.y + n.y * a.h,
|
|
1350
1389
|
w: n.w * a.w,
|
|
1351
1390
|
h: n.h * a.h
|
|
1352
|
-
}),
|
|
1391
|
+
}), _();
|
|
1353
1392
|
return;
|
|
1354
1393
|
}
|
|
1355
|
-
const e =
|
|
1356
|
-
e && (M = e.id),
|
|
1394
|
+
const e = mr(t);
|
|
1395
|
+
e && (M = e.id), C();
|
|
1357
1396
|
}
|
|
1358
|
-
function
|
|
1397
|
+
function mr(t) {
|
|
1359
1398
|
if (t.type === "arrow") {
|
|
1360
1399
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1361
|
-
return Math.hypot(e, n) <
|
|
1400
|
+
return Math.hypot(e, n) < Mt ? m.add("arrow", {
|
|
1362
1401
|
x: t.start.x,
|
|
1363
1402
|
y: t.start.y,
|
|
1364
1403
|
x2: t.start.x + 0.12,
|
|
1365
1404
|
y2: t.start.y,
|
|
1366
1405
|
w: 0.12,
|
|
1367
1406
|
h: 0.02
|
|
1368
|
-
}) :
|
|
1407
|
+
}) : m.add("arrow", {
|
|
1369
1408
|
x: t.start.x,
|
|
1370
1409
|
y: t.start.y,
|
|
1371
1410
|
x2: t.current.x,
|
|
@@ -1374,107 +1413,121 @@ function ur(t) {
|
|
|
1374
1413
|
h: Math.abs(n)
|
|
1375
1414
|
});
|
|
1376
1415
|
}
|
|
1377
|
-
return
|
|
1416
|
+
return m.add(t.type, ft(t.start, t.current));
|
|
1378
1417
|
}
|
|
1379
|
-
function
|
|
1380
|
-
|
|
1418
|
+
function yr() {
|
|
1419
|
+
m.resetCrop(), M = null, _();
|
|
1381
1420
|
}
|
|
1382
|
-
function
|
|
1383
|
-
s.resetCrop && (s.resetCrop.hidden = !
|
|
1421
|
+
function lt() {
|
|
1422
|
+
s.resetCrop && (s.resetCrop.hidden = !m.isCropped());
|
|
1384
1423
|
}
|
|
1385
|
-
function
|
|
1424
|
+
function Dt(t) {
|
|
1386
1425
|
if (!s.audio)
|
|
1387
1426
|
return;
|
|
1388
1427
|
const e = t ? "Stop audio" : "Record audio";
|
|
1389
1428
|
s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
|
|
1390
1429
|
}
|
|
1391
|
-
function
|
|
1392
|
-
|
|
1430
|
+
function F() {
|
|
1431
|
+
return D(T);
|
|
1432
|
+
}
|
|
1433
|
+
function tt() {
|
|
1434
|
+
if (!s.stage || !s.palette || !s.actions || !s.recapture)
|
|
1435
|
+
return;
|
|
1436
|
+
const t = F();
|
|
1437
|
+
s.stage.hidden = !t && !$, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !X), 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;
|
|
1438
|
+
}
|
|
1439
|
+
function gr() {
|
|
1440
|
+
F() && (X = T), T = "", J(null), tt(), _();
|
|
1393
1441
|
}
|
|
1394
|
-
function
|
|
1395
|
-
|
|
1442
|
+
function wr() {
|
|
1443
|
+
D(X) && (T = X, tt(), _());
|
|
1396
1444
|
}
|
|
1397
|
-
function
|
|
1445
|
+
function Le() {
|
|
1398
1446
|
return {
|
|
1399
1447
|
capture: typeof d.capture == "function" ? d.capture : void 0,
|
|
1400
1448
|
onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
|
|
1401
1449
|
};
|
|
1402
1450
|
}
|
|
1403
|
-
|
|
1404
|
-
if (!(
|
|
1405
|
-
|
|
1451
|
+
function Re(t) {
|
|
1452
|
+
if (!D(t))
|
|
1453
|
+
throw new Error("Screenshot failed; you can still send text.");
|
|
1454
|
+
T = t, X = t, m = Pt(), k = { w: 0, h: 0 }, M = null, b = null, w = null, J(null);
|
|
1455
|
+
}
|
|
1456
|
+
async function br() {
|
|
1457
|
+
if (!(wt || !s.dialog || s.dialog.hidden)) {
|
|
1458
|
+
wt = !0, s.recapture.disabled = !0, S("Capturing…", !0), s.dialog.hidden = !0;
|
|
1406
1459
|
try {
|
|
1407
1460
|
let t = "";
|
|
1408
1461
|
try {
|
|
1409
|
-
t = await
|
|
1462
|
+
t = await Un();
|
|
1410
1463
|
} catch {
|
|
1411
|
-
t = await
|
|
1464
|
+
t = await me(Le());
|
|
1412
1465
|
}
|
|
1413
|
-
|
|
1466
|
+
Re(t), S("");
|
|
1414
1467
|
} catch (t) {
|
|
1415
|
-
|
|
1468
|
+
S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1416
1469
|
} finally {
|
|
1417
|
-
s.dialog.hidden = !1, s.recapture.disabled = !1,
|
|
1470
|
+
s.dialog.hidden = !1, s.recapture.disabled = !1, wt = !1, tt(), _();
|
|
1418
1471
|
}
|
|
1419
1472
|
}
|
|
1420
1473
|
}
|
|
1421
|
-
function
|
|
1474
|
+
function Sr() {
|
|
1422
1475
|
try {
|
|
1423
|
-
if (
|
|
1476
|
+
if (U || (U = Kn((e) => {
|
|
1424
1477
|
const n = s.text.value.trim();
|
|
1425
1478
|
s.text.value = n ? `${n} ${e}` : e;
|
|
1426
|
-
})), !
|
|
1427
|
-
|
|
1479
|
+
})), !U.isSupported()) {
|
|
1480
|
+
S("Audio-to-text is not supported in this browser.");
|
|
1428
1481
|
return;
|
|
1429
1482
|
}
|
|
1430
|
-
const t =
|
|
1431
|
-
|
|
1483
|
+
const t = U.start();
|
|
1484
|
+
Dt(t), S(t ? "Listening…" : "");
|
|
1432
1485
|
} catch (t) {
|
|
1433
|
-
|
|
1486
|
+
S(t.message);
|
|
1434
1487
|
}
|
|
1435
1488
|
}
|
|
1436
|
-
async function
|
|
1489
|
+
async function vr() {
|
|
1437
1490
|
if (!d.video) {
|
|
1438
|
-
|
|
1491
|
+
S("Video is disabled on this host.");
|
|
1439
1492
|
return;
|
|
1440
1493
|
}
|
|
1441
|
-
s.dialog.hidden = !0, s.stop.hidden = !1,
|
|
1494
|
+
s.dialog.hidden = !0, s.stop.hidden = !1, Q(), s.launcher.hidden = !0, G = Yn({
|
|
1442
1495
|
onStart() {
|
|
1443
1496
|
},
|
|
1444
1497
|
onStop(t) {
|
|
1445
|
-
|
|
1498
|
+
$ = t, s.stop.hidden = !0, ot(), s.dialog.hidden = !1, tt(), _(), S(t ? "Video attached." : "Recording cancelled.");
|
|
1446
1499
|
},
|
|
1447
1500
|
onError(t) {
|
|
1448
|
-
|
|
1501
|
+
S(t.message);
|
|
1449
1502
|
}
|
|
1450
1503
|
});
|
|
1451
1504
|
try {
|
|
1452
|
-
await
|
|
1505
|
+
await G.start();
|
|
1453
1506
|
} catch (t) {
|
|
1454
|
-
s.stop.hidden = !0,
|
|
1507
|
+
s.stop.hidden = !0, ot(), s.dialog.hidden = !1, S(t.message);
|
|
1455
1508
|
}
|
|
1456
1509
|
}
|
|
1457
|
-
function
|
|
1458
|
-
if (s.shot = null, !
|
|
1459
|
-
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML =
|
|
1510
|
+
function _() {
|
|
1511
|
+
if (s.shot = null, !F()) {
|
|
1512
|
+
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = $ ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL($)}"></video>` : "", lt();
|
|
1460
1513
|
return;
|
|
1461
1514
|
}
|
|
1462
|
-
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1515
|
+
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${T}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
|
|
1463
1516
|
const t = s.shot.querySelector("img");
|
|
1464
1517
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1465
1518
|
const e = () => {
|
|
1466
|
-
|
|
1519
|
+
xr(t), C();
|
|
1467
1520
|
};
|
|
1468
|
-
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1521
|
+
t.addEventListener("load", e), t.complete && t.naturalWidth && e(), lt();
|
|
1469
1522
|
}
|
|
1470
|
-
function
|
|
1471
|
-
const e = t.naturalWidth ||
|
|
1472
|
-
if (e && n && (
|
|
1523
|
+
function xr(t) {
|
|
1524
|
+
const e = t.naturalWidth || k.w, n = t.naturalHeight || k.h;
|
|
1525
|
+
if (e && n && (k = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !k.w || !k.h)
|
|
1473
1526
|
return;
|
|
1474
|
-
const r =
|
|
1527
|
+
const r = m.crop(), a = k.w / k.h, i = r.w / r.h * a, o = Math.min(1, i / a), c = Math.min(1, a / i);
|
|
1475
1528
|
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}%`;
|
|
1476
1529
|
}
|
|
1477
|
-
function
|
|
1530
|
+
function Er(t) {
|
|
1478
1531
|
return t.type === "arrow" ? {
|
|
1479
1532
|
id: "preview",
|
|
1480
1533
|
type: "arrow",
|
|
@@ -1489,94 +1542,94 @@ function wr(t) {
|
|
|
1489
1542
|
id: "preview",
|
|
1490
1543
|
type: t.type,
|
|
1491
1544
|
number: "",
|
|
1492
|
-
...
|
|
1545
|
+
...ft(t.start, t.current)
|
|
1493
1546
|
};
|
|
1494
1547
|
}
|
|
1495
|
-
function
|
|
1496
|
-
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !
|
|
1497
|
-
|
|
1548
|
+
function C() {
|
|
1549
|
+
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !F() || !s.shot) {
|
|
1550
|
+
lt();
|
|
1498
1551
|
return;
|
|
1499
1552
|
}
|
|
1500
|
-
const e =
|
|
1553
|
+
const e = m.crop(), n = Z(), r = kt(n.clientWidth || 400);
|
|
1501
1554
|
if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (b == null ? void 0 : b.kind) === "crop") {
|
|
1502
1555
|
const i = document.createElement("div");
|
|
1503
|
-
i.className = "nf-crop",
|
|
1556
|
+
i.className = "nf-crop", re(i, ft(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(i);
|
|
1504
1557
|
}
|
|
1505
|
-
const a =
|
|
1506
|
-
if ((b == null ? void 0 : b.kind) === "sticker" && a.push(
|
|
1558
|
+
const a = m.list().slice();
|
|
1559
|
+
if ((b == null ? void 0 : b.kind) === "sticker" && a.push(Er(b)), a.forEach((i) => {
|
|
1507
1560
|
const o = i.id === "preview", c = !o && i.id === M, l = document.createElement("div");
|
|
1508
|
-
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), i.type === "arrow" ?
|
|
1561
|
+
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), i.type === "arrow" ? Cr(l, i, e, c, r) : (re(l, i, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Rt(l, u))), !o && i.number) {
|
|
1509
1562
|
const u = document.createElement("span");
|
|
1510
1563
|
u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
|
|
1511
1564
|
}
|
|
1512
1565
|
s.shot.appendChild(l);
|
|
1513
|
-
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()),
|
|
1566
|
+
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), $) {
|
|
1514
1567
|
const i = document.createElement("video");
|
|
1515
|
-
i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(
|
|
1568
|
+
i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL($), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", s.canvas.appendChild(i);
|
|
1516
1569
|
}
|
|
1517
|
-
|
|
1570
|
+
lt();
|
|
1518
1571
|
}
|
|
1519
|
-
function
|
|
1520
|
-
const i =
|
|
1521
|
-
t.style.left = `${
|
|
1522
|
-
<line class="nf-arrow-hit" x1="${
|
|
1523
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1572
|
+
function Cr(t, e, n, r, a = kt(400)) {
|
|
1573
|
+
const i = Z(), o = i.clientWidth, c = i.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, p = ((e.y2 ?? e.y) - n.y) / n.h * c, y = Math.max(18, a.arrowHead + a.stroke * 2), v = Math.min(l, f) - y, A = Math.min(u, p) - y, I = Math.max(2, Math.abs(f - l)) + y * 2, Y = Math.max(2, Math.abs(p - u)) + y * 2, V = l - v, W = u - A, ht = f - v, pt = p - A, O = ge(V, W, ht, pt, a), z = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1574
|
+
t.style.left = `${v}px`, t.style.top = `${A}px`, t.style.width = `${I}px`, t.style.height = `${Y}px`, z.setAttribute("class", "nf-arrow-svg"), z.setAttribute("viewBox", `0 0 ${I} ${Y}`), z.setAttribute("width", String(I)), z.setAttribute("height", String(Y)), z.innerHTML = `
|
|
1575
|
+
<line class="nf-arrow-hit" x1="${V}" y1="${W}" x2="${ht}" y2="${pt}" />
|
|
1576
|
+
<line class="nf-arrow-shaft" x1="${V}" y1="${W}" x2="${O.shaftEnd.x}" y2="${O.shaftEnd.y}" />
|
|
1524
1577
|
<polygon class="nf-arrow-head" points="${O.tipX},${O.tipY} ${O.left.x},${O.left.y} ${O.right.x},${O.right.y}" />
|
|
1525
|
-
`, t.appendChild(
|
|
1578
|
+
`, t.appendChild(z), r && (Rt(t, "start", { left: V - 5, top: W - 5 }), Rt(t, "end", { left: ht - 5, top: pt - 5 }));
|
|
1526
1579
|
}
|
|
1527
|
-
function
|
|
1580
|
+
function Rt(t, e, n) {
|
|
1528
1581
|
const r = document.createElement("span");
|
|
1529
1582
|
r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
|
|
1530
1583
|
}
|
|
1531
|
-
function
|
|
1584
|
+
function re(t, e, n) {
|
|
1532
1585
|
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}%`;
|
|
1533
1586
|
}
|
|
1534
|
-
function
|
|
1587
|
+
function Mr() {
|
|
1535
1588
|
try {
|
|
1536
|
-
return String(localStorage.getItem(
|
|
1589
|
+
return String(localStorage.getItem(ve) || "").trim();
|
|
1537
1590
|
} catch {
|
|
1538
1591
|
return "";
|
|
1539
1592
|
}
|
|
1540
1593
|
}
|
|
1541
|
-
function
|
|
1594
|
+
function Ar(t) {
|
|
1542
1595
|
const e = String(t || "").trim();
|
|
1543
|
-
if (!(!e || e ===
|
|
1596
|
+
if (!(!e || e === At))
|
|
1544
1597
|
try {
|
|
1545
|
-
localStorage.setItem(
|
|
1598
|
+
localStorage.setItem(ve, e);
|
|
1546
1599
|
} catch {
|
|
1547
1600
|
}
|
|
1548
1601
|
}
|
|
1549
|
-
function
|
|
1550
|
-
return !!(String(
|
|
1602
|
+
function $e() {
|
|
1603
|
+
return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
|
|
1551
1604
|
}
|
|
1552
|
-
function
|
|
1605
|
+
function Lr() {
|
|
1553
1606
|
return String(
|
|
1554
|
-
|
|
1607
|
+
R.displayName || R.email || R.userId || ""
|
|
1555
1608
|
).trim();
|
|
1556
1609
|
}
|
|
1557
|
-
function
|
|
1610
|
+
function Rr() {
|
|
1558
1611
|
var e;
|
|
1559
|
-
if (
|
|
1560
|
-
return
|
|
1612
|
+
if ($e())
|
|
1613
|
+
return Lr() || At;
|
|
1561
1614
|
const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
|
|
1562
|
-
return t ? (
|
|
1615
|
+
return t ? (Ar(t), t) : At;
|
|
1563
1616
|
}
|
|
1564
|
-
function
|
|
1617
|
+
function Te() {
|
|
1565
1618
|
if (!s.author)
|
|
1566
1619
|
return;
|
|
1567
|
-
const t =
|
|
1620
|
+
const t = $e();
|
|
1568
1621
|
if (s.author.hidden = t, t) {
|
|
1569
1622
|
s.author.value = "";
|
|
1570
1623
|
return;
|
|
1571
1624
|
}
|
|
1572
|
-
s.author.value =
|
|
1625
|
+
s.author.value = Mr();
|
|
1573
1626
|
}
|
|
1574
|
-
function
|
|
1627
|
+
function Pe(t, e = Se) {
|
|
1575
1628
|
const n = Number(t);
|
|
1576
|
-
return Number.isFinite(n) ? Math.min(
|
|
1629
|
+
return Number.isFinite(n) ? Math.min(sr, Math.max(0, Math.floor(n))) : e;
|
|
1577
1630
|
}
|
|
1578
|
-
function
|
|
1579
|
-
|
|
1631
|
+
function ke(t = {}) {
|
|
1632
|
+
Wn(t);
|
|
1580
1633
|
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1581
1634
|
d = {
|
|
1582
1635
|
...d,
|
|
@@ -1586,44 +1639,44 @@ function Re(t = {}) {
|
|
|
1586
1639
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1587
1640
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1588
1641
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1589
|
-
theme:
|
|
1642
|
+
theme: xe(t.theme ?? d.theme),
|
|
1590
1643
|
video: t.video == null ? d.video : !!t.video,
|
|
1591
|
-
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit :
|
|
1592
|
-
kinds: e ?
|
|
1644
|
+
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : Pe(t.consoleLogLimit, d.consoleLogLimit),
|
|
1645
|
+
kinds: e ? rr(t.kinds) : d.kinds,
|
|
1593
1646
|
capture: t.capture === void 0 ? d.capture : t.capture,
|
|
1594
1647
|
onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
|
|
1595
1648
|
};
|
|
1596
1649
|
}
|
|
1597
|
-
function
|
|
1598
|
-
return
|
|
1650
|
+
function Ft(t = {}) {
|
|
1651
|
+
return ke(t), h && Q(), Ut;
|
|
1599
1652
|
}
|
|
1600
|
-
function
|
|
1601
|
-
return
|
|
1653
|
+
function $r(t = {}) {
|
|
1654
|
+
return ke(t), Ot(), Q(), Ut;
|
|
1602
1655
|
}
|
|
1603
|
-
function
|
|
1604
|
-
return
|
|
1656
|
+
function Tr(t) {
|
|
1657
|
+
return Ft({ theme: t });
|
|
1605
1658
|
}
|
|
1606
|
-
function
|
|
1659
|
+
function Pr(t) {
|
|
1607
1660
|
const e = !!t;
|
|
1608
|
-
return !e && h && s.dialog && !s.dialog.hidden &&
|
|
1661
|
+
return !e && h && s.dialog && !s.dialog.hidden && et(), Ft({ hideLauncher: !e });
|
|
1609
1662
|
}
|
|
1610
|
-
async function
|
|
1611
|
-
|
|
1663
|
+
async function Ie() {
|
|
1664
|
+
Ot(), Oe(), Q(), s.launcher.hidden = !0, m = Pt(), k = { w: 0, h: 0 }, $ = null, T = "", X = "", M = null, b = null, w = null, j = dt(d.kinds), Bt(j), J(null), Dt(!1), s.text.value = "", Te(), S("");
|
|
1612
1665
|
try {
|
|
1613
|
-
|
|
1614
|
-
} catch {
|
|
1615
|
-
|
|
1666
|
+
Re(await me(Le())), S("");
|
|
1667
|
+
} catch (t) {
|
|
1668
|
+
T = "", S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1616
1669
|
}
|
|
1617
|
-
s.dialog.hidden = !1,
|
|
1670
|
+
tt(), s.dialog.hidden = !1, _(), s.text.focus();
|
|
1618
1671
|
}
|
|
1619
|
-
function
|
|
1620
|
-
h && (
|
|
1672
|
+
function et() {
|
|
1673
|
+
h && (U == null || U.stop(), Dt(!1), Me(), b = null, w = null, Ht(!1), Oe(), s.dialog.hidden = !0, s.stop.hidden = !0, ot());
|
|
1621
1674
|
}
|
|
1622
|
-
function
|
|
1675
|
+
function kr() {
|
|
1623
1676
|
const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
|
|
1624
1677
|
if (!t || !e || !n || !r)
|
|
1625
1678
|
return Promise.resolve();
|
|
1626
|
-
|
|
1679
|
+
It = !0, S("");
|
|
1627
1680
|
const a = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, i = e.getBoundingClientRect();
|
|
1628
1681
|
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", a)
|
|
1629
1682
|
return new Promise((u) => {
|
|
@@ -1632,58 +1685,58 @@ function Lr() {
|
|
|
1632
1685
|
const o = e.getBoundingClientRect(), c = o.width > 0 ? i.width / o.width : 1, l = o.height > 0 ? i.height / o.height : 1;
|
|
1633
1686
|
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
|
|
1634
1687
|
let f = !1;
|
|
1635
|
-
const
|
|
1688
|
+
const p = () => {
|
|
1636
1689
|
f || (f = !0, e.removeEventListener("transitionend", y), window.setTimeout(() => {
|
|
1637
1690
|
t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
|
|
1638
1691
|
}, 1e3));
|
|
1639
|
-
}, y = (
|
|
1640
|
-
|
|
1692
|
+
}, y = (v) => {
|
|
1693
|
+
v.target !== e || v.propertyName !== "transform" || p();
|
|
1641
1694
|
};
|
|
1642
1695
|
e.addEventListener("transitionend", y), requestAnimationFrame(() => {
|
|
1643
1696
|
e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
|
|
1644
|
-
}), window.setTimeout(
|
|
1697
|
+
}), window.setTimeout(p, 700);
|
|
1645
1698
|
});
|
|
1646
1699
|
}
|
|
1647
|
-
function
|
|
1648
|
-
|
|
1700
|
+
function Oe() {
|
|
1701
|
+
It = !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));
|
|
1649
1702
|
}
|
|
1650
|
-
function
|
|
1651
|
-
|
|
1703
|
+
function Ir(t = {}) {
|
|
1704
|
+
R = { ...R, ...Vn(t) }, Te();
|
|
1652
1705
|
}
|
|
1653
|
-
async function
|
|
1654
|
-
if (
|
|
1706
|
+
async function Be() {
|
|
1707
|
+
if (Ot(), bt)
|
|
1655
1708
|
return null;
|
|
1656
1709
|
const t = s.text.value.trim();
|
|
1657
|
-
if (!t && !
|
|
1658
|
-
return
|
|
1710
|
+
if (!t && !F() && !$)
|
|
1711
|
+
return S("Add a note, screenshot, or video first."), null;
|
|
1659
1712
|
if (!d.endpoint || !d.projectKey)
|
|
1660
|
-
return
|
|
1661
|
-
|
|
1713
|
+
return S("Notefully is missing endpoint or projectKey."), null;
|
|
1714
|
+
bt = !0, ie(!0), S("Submitting…", !0);
|
|
1662
1715
|
try {
|
|
1663
|
-
const e =
|
|
1664
|
-
if (n.append("message", t), n.append("kind",
|
|
1665
|
-
...
|
|
1666
|
-
|
|
1667
|
-
displayName:
|
|
1716
|
+
const e = Rr(), n = new FormData();
|
|
1717
|
+
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({
|
|
1718
|
+
..._n({
|
|
1719
|
+
...R,
|
|
1720
|
+
displayName: R.displayName || e
|
|
1668
1721
|
}),
|
|
1669
1722
|
author: e,
|
|
1670
|
-
console:
|
|
1671
|
-
})), n.append("annotations", JSON.stringify(
|
|
1672
|
-
const i = await
|
|
1673
|
-
if (n.append("screenshot", i, "screenshot.png"),
|
|
1674
|
-
const o = await
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1723
|
+
console: be.snapshot().slice(-Pe(d.consoleLogLimit))
|
|
1724
|
+
})), n.append("annotations", JSON.stringify(m.list())), n.append("crop", JSON.stringify(m.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), F()) {
|
|
1725
|
+
const i = await cr(T);
|
|
1726
|
+
if (n.append("screenshot", i, "screenshot.png"), m.list().length || m.isCropped()) {
|
|
1727
|
+
const o = await nr(
|
|
1728
|
+
T,
|
|
1729
|
+
m.crop(),
|
|
1730
|
+
m.list(),
|
|
1678
1731
|
{
|
|
1679
|
-
mark:
|
|
1680
|
-
markText:
|
|
1732
|
+
mark: te("--nf-mark", "#fdd341"),
|
|
1733
|
+
markText: te("--nf-mark-text", "#2a2140")
|
|
1681
1734
|
}
|
|
1682
1735
|
);
|
|
1683
1736
|
n.append("screenshotBaked", o, "screenshot.baked.png");
|
|
1684
1737
|
}
|
|
1685
1738
|
}
|
|
1686
|
-
|
|
1739
|
+
$ && n.append("recording", $, "recording.webm");
|
|
1687
1740
|
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1688
1741
|
method: "POST",
|
|
1689
1742
|
headers: {
|
|
@@ -1698,29 +1751,29 @@ async function Pe() {
|
|
|
1698
1751
|
a = null;
|
|
1699
1752
|
}
|
|
1700
1753
|
if (!r.ok)
|
|
1701
|
-
throw
|
|
1702
|
-
return await
|
|
1754
|
+
throw S((a == null ? void 0 : a.error) || "Submit failed."), new Error((a == null ? void 0 : a.error) || `Submit failed (${r.status})`);
|
|
1755
|
+
return await kr(), et(), a;
|
|
1703
1756
|
} finally {
|
|
1704
|
-
|
|
1757
|
+
bt = !1, ie(!1);
|
|
1705
1758
|
}
|
|
1706
1759
|
}
|
|
1707
|
-
function
|
|
1760
|
+
function ie(t) {
|
|
1708
1761
|
s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1709
1762
|
}
|
|
1710
|
-
function
|
|
1711
|
-
|
|
1763
|
+
function Or() {
|
|
1764
|
+
et(), h == null || h.remove(), h = null, s = {};
|
|
1712
1765
|
}
|
|
1713
|
-
const
|
|
1714
|
-
typeof window < "u" && (window.Notefully =
|
|
1766
|
+
const Ut = { init: $r, configure: Ft, setTheme: Tr, setVisible: Pr, open: Ie, close: et, identify: Ir, submit: Be, destroy: Or };
|
|
1767
|
+
typeof window < "u" && (window.Notefully = Ut);
|
|
1715
1768
|
export {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1769
|
+
et as close,
|
|
1770
|
+
Ft as configure,
|
|
1771
|
+
Ut as default,
|
|
1772
|
+
Or as destroy,
|
|
1773
|
+
Ir as identify,
|
|
1774
|
+
$r as init,
|
|
1775
|
+
Ie as open,
|
|
1776
|
+
Tr as setTheme,
|
|
1777
|
+
Pr as setVisible,
|
|
1778
|
+
Be as submit
|
|
1726
1779
|
};
|