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