@makefully/notefully 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +31 -28
- package/dist/notefully.js +481 -447
- package/package.json +3 -2
package/dist/notefully.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Ce(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
@@ -8,7 +8,7 @@ function xe(t, e) {
|
|
|
8
8
|
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
|
|
9
9
|
return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const Me = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -16,33 +16,33 @@ const Ee = /* @__PURE__ */ (() => {
|
|
|
16
16
|
);
|
|
17
17
|
return () => (t += 1, `u${e()}${t}`);
|
|
18
18
|
})();
|
|
19
|
-
function
|
|
19
|
+
function F(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 Gt(t = {}) {
|
|
27
|
+
return V || (t.includeStyleProperties ? (V = t.includeStyleProperties, V) : (V = F(window.getComputedStyle(document.documentElement)), V));
|
|
28
28
|
}
|
|
29
29
|
function J(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 Le(t) {
|
|
34
34
|
const e = J(t, "border-left-width"), n = J(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function $e(t) {
|
|
38
38
|
const e = J(t, "border-top-width"), n = J(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const n = e.width ||
|
|
41
|
+
function Jt(t, e = {}) {
|
|
42
|
+
const n = e.width || Le(t), r = e.height || $e(t);
|
|
43
43
|
return { width: n, height: r };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Re() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -51,9 +51,9 @@ function Le() {
|
|
|
51
51
|
const n = e && e.env ? e.env.devicePixelRatio : null;
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
(t.width >
|
|
54
|
+
const C = 16384;
|
|
55
|
+
function Ae(t) {
|
|
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 Q(t) {
|
|
59
59
|
return new Promise((e, n) => {
|
|
@@ -65,80 +65,80 @@ function Q(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 ke(t) {
|
|
69
69
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
70
70
|
}
|
|
71
|
-
async function
|
|
71
|
+
async function Pe(t, e, n) {
|
|
72
72
|
const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), o = document.createElementNS(r, "foreignObject");
|
|
73
|
-
return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), o.setAttribute("width", "100%"), o.setAttribute("height", "100%"), o.setAttribute("x", "0"), o.setAttribute("y", "0"), o.setAttribute("externalResourcesRequired", "true"), i.appendChild(o), o.appendChild(t),
|
|
73
|
+
return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), o.setAttribute("width", "100%"), o.setAttribute("height", "100%"), o.setAttribute("x", "0"), o.setAttribute("y", "0"), o.setAttribute("externalResourcesRequired", "true"), i.appendChild(o), o.appendChild(t), ke(i);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const E = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
77
77
|
return !0;
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
|
-
return n === null ? !1 : n.constructor.name === e.name ||
|
|
79
|
+
return n === null ? !1 : n.constructor.name === e.name || E(n, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function Te(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
85
|
+
function Ie(t, e) {
|
|
86
|
+
return Gt(e).map((n) => {
|
|
87
87
|
const r = t.getPropertyValue(n), i = t.getPropertyPriority(n);
|
|
88
88
|
return `${n}: ${r}${i ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const i = `.${t}:${e}`, o = n.cssText ?
|
|
91
|
+
function Oe(t, e, n, r) {
|
|
92
|
+
const i = `.${t}:${e}`, o = n.cssText ? Te(n) : Ie(n, r);
|
|
93
93
|
return document.createTextNode(`${i}{${o}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Tt(t, e, n, r) {
|
|
96
96
|
const i = window.getComputedStyle(t, n), o = i.getPropertyValue("content");
|
|
97
97
|
if (o === "" || o === "none")
|
|
98
98
|
return;
|
|
99
|
-
const a =
|
|
99
|
+
const a = Me();
|
|
100
100
|
try {
|
|
101
101
|
e.className = `${e.className} ${a}`;
|
|
102
102
|
} catch {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const s = document.createElement("style");
|
|
106
|
-
s.appendChild(
|
|
106
|
+
s.appendChild(Oe(a, n, i, r)), e.appendChild(s);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function He(t, e, n) {
|
|
109
|
+
Tt(t, e, ":before", n), Tt(t, e, ":after", n);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const It = "application/font-woff", Ot = "image/jpeg", Fe = {
|
|
112
|
+
woff: It,
|
|
113
|
+
woff2: It,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: Ot,
|
|
118
|
+
jpeg: Ot,
|
|
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 De(t) {
|
|
125
125
|
const e = /\.([^./]*?)$/g.exec(t);
|
|
126
126
|
return e ? e[1] : "";
|
|
127
127
|
}
|
|
128
128
|
function Ct(t) {
|
|
129
|
-
const e =
|
|
130
|
-
return
|
|
129
|
+
const e = De(t).toLowerCase();
|
|
130
|
+
return Fe[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Be(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
135
|
function mt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Ue(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function Qt(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`);
|
|
@@ -155,19 +155,19 @@ async function Jt(t, e, n) {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
const ut = {};
|
|
158
|
-
function
|
|
158
|
+
function je(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
162
|
async function Mt(t, e, n) {
|
|
163
|
-
const r =
|
|
163
|
+
const r = je(t, e, n.includeQueryParams);
|
|
164
164
|
if (ut[r] != null)
|
|
165
165
|
return ut[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
167
|
let i;
|
|
168
168
|
try {
|
|
169
|
-
const o = await
|
|
170
|
-
i =
|
|
169
|
+
const o = await Qt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), Be(s)));
|
|
170
|
+
i = Ue(o, e);
|
|
171
171
|
} catch (o) {
|
|
172
172
|
i = n.imagePlaceholder || "";
|
|
173
173
|
let a = `Failed to fetch resource: ${t}`;
|
|
@@ -175,11 +175,11 @@ async function Mt(t, e, n) {
|
|
|
175
175
|
}
|
|
176
176
|
return ut[r] = i, i;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function _e(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
180
|
return e === "data:," ? t.cloneNode(!1) : Q(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function Ne(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
184
|
const o = document.createElement("canvas"), a = o.getContext("2d");
|
|
185
185
|
o.width = t.clientWidth, o.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, o.width, o.height);
|
|
@@ -189,7 +189,7 @@ async function Be(t, e) {
|
|
|
189
189
|
const n = t.poster, r = Ct(n), i = await Mt(n, r, e);
|
|
190
190
|
return Q(i);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function Ve(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 _e(t, e) {
|
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return
|
|
201
|
+
async function ze(t, e) {
|
|
202
|
+
return E(t, HTMLCanvasElement) ? _e(t) : E(t, HTMLVideoElement) ? Ne(t, e) : E(t, HTMLIFrameElement) ? Ve(t, e) : t.cloneNode(Zt(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
204
|
+
const We = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Zt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function qe(t, e, n) {
|
|
206
206
|
var r, i;
|
|
207
|
-
if (
|
|
207
|
+
if (Zt(e))
|
|
208
208
|
return e;
|
|
209
209
|
let o = [];
|
|
210
|
-
return
|
|
210
|
+
return We(t) && t.assignedNodes ? o = F(t.assignedNodes()) : E(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? o = F(t.contentDocument.body.childNodes) : o = F(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), o.length === 0 || E(t, HTMLVideoElement) || await o.reduce((a, s) => a.then(() => rt(s, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Ke(t, e, n) {
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
218
|
const i = window.getComputedStyle(t);
|
|
219
|
-
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) :
|
|
219
|
+
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : Gt(n).forEach((o) => {
|
|
220
220
|
let a = i.getPropertyValue(o);
|
|
221
|
-
o === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`),
|
|
221
|
+
o === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), E(t, HTMLIFrameElement) && o === "display" && a === "inline" && (a = "block"), o === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(o, a, i.getPropertyPriority(o));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
224
|
+
function Xe(t, e) {
|
|
225
|
+
E(t, HTMLTextAreaElement) && (e.innerHTML = t.value), E(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
227
|
+
function Ye(t, e) {
|
|
228
|
+
if (E(t, HTMLSelectElement)) {
|
|
229
229
|
const r = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
233
|
+
function Ge(t, e, n) {
|
|
234
|
+
return E(e, Element) && (Ke(t, e, n), He(t, e, n), Xe(t, e), Ye(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Je(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
@@ -258,30 +258,30 @@ async function Ye(t, e) {
|
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
260
|
async function rt(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) => ze(r, e)).then((r) => qe(t, r, e)).then((r) => Ge(t, r, e)).then((r) => Je(r, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const te = /url\((['"]?)([^'"]+?)\1\)/g, Qe = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Ze = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function tn(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function en(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(te, (n, r, i) => (e.push(i), n)), e.filter((n) => !mt(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function nn(t, e, n, r, i) {
|
|
273
273
|
try {
|
|
274
|
-
const o = n ?
|
|
274
|
+
const o = n ? Ce(e, n) : e, a = Ct(e);
|
|
275
275
|
let s;
|
|
276
|
-
return i || (s = await Mt(o, a, r)), t.replace(
|
|
276
|
+
return i || (s = await Mt(o, a, r)), t.replace(tn(e), `$1${s}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function rn(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(Ze, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, , i] =
|
|
284
|
+
const [r, , i] = Qe.exec(n) || [];
|
|
285
285
|
if (!i)
|
|
286
286
|
return "";
|
|
287
287
|
if (i === e)
|
|
@@ -289,30 +289,30 @@ function en(t, { preferredFontFormat: e }) {
|
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function ee(t) {
|
|
293
|
+
return t.search(te) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function ne(t, e, n) {
|
|
296
|
+
if (!ee(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return
|
|
298
|
+
const r = rn(t, n);
|
|
299
|
+
return en(r).reduce((o, a) => o.then((s) => nn(s, a, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
301
|
async function z(t, e, n) {
|
|
302
302
|
var r;
|
|
303
303
|
const i = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
304
|
if (i) {
|
|
305
|
-
const o = await
|
|
305
|
+
const o = await ne(i, null, n);
|
|
306
306
|
return e.style.setProperty(t, o, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
310
|
+
async function on(t, e) {
|
|
311
311
|
await z("background", t, e) || await z("background-image", t, e), await z("mask", t, e) || await z("-webkit-mask", t, e) || await z("mask-image", t, e) || await z("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
314
|
-
const n =
|
|
315
|
-
if (!(n && !mt(t.src)) && !(
|
|
313
|
+
async function an(t, e) {
|
|
314
|
+
const n = E(t, HTMLImageElement);
|
|
315
|
+
if (!(n && !mt(t.src)) && !(E(t, SVGImageElement) && !mt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
317
|
const r = n ? t.src : t.href.baseVal, i = await Mt(r, Ct(r), e);
|
|
318
318
|
await new Promise((o, a) => {
|
|
@@ -327,14 +327,14 @@ async function rn(t, e) {
|
|
|
327
327
|
s.decode && (s.decode = o), s.loading === "lazy" && (s.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const r =
|
|
330
|
+
async function sn(t, e) {
|
|
331
|
+
const r = F(t.childNodes).map((i) => re(i, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
|
|
334
|
+
async function re(t, e) {
|
|
335
|
+
E(t, Element) && (await on(t, e), await an(t, e), await sn(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function cn(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
@@ -342,23 +342,23 @@ function an(t, e) {
|
|
|
342
342
|
n[i] = r[i];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Ht = {};
|
|
346
|
+
async function Ft(t) {
|
|
347
|
+
let e = Ht[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 }, Ht[t] = e, e;
|
|
352
352
|
}
|
|
353
353
|
async function Dt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
355
|
const r = /url\(["']?([^"')]+)["']?\)/g, o = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
|
|
356
356
|
let s = a.replace(r, "$1");
|
|
357
|
-
return s.startsWith("https://") || (s = new URL(s, t.url).href),
|
|
357
|
+
return s.startsWith("https://") || (s = new URL(s, t.url).href), Qt(s, e.fetchRequestInit, ({ result: l }) => (n = n.replace(a, `url(${l})`), [a, l]));
|
|
358
358
|
});
|
|
359
359
|
return Promise.all(o).then(() => n);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Bt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -384,32 +384,32 @@ function Ft(t) {
|
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function ln(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
389
|
return t.forEach((i) => {
|
|
390
390
|
if ("cssRules" in i)
|
|
391
391
|
try {
|
|
392
|
-
|
|
392
|
+
F(i.cssRules || []).forEach((o, a) => {
|
|
393
393
|
if (o.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let s = a + 1;
|
|
395
|
-
const l = o.href, u =
|
|
395
|
+
const l = o.href, u = Ft(l).then((f) => Dt(f, e)).then((f) => Bt(f).forEach((p) => {
|
|
396
396
|
try {
|
|
397
|
-
i.insertRule(
|
|
398
|
-
} catch (
|
|
397
|
+
i.insertRule(p, p.startsWith("@import") ? s += 1 : i.cssRules.length);
|
|
398
|
+
} catch (m) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
|
-
rule:
|
|
401
|
-
error:
|
|
400
|
+
rule: p,
|
|
401
|
+
error: m
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
})).catch((
|
|
405
|
-
console.error("Error loading remote css",
|
|
404
|
+
})).catch((f) => {
|
|
405
|
+
console.error("Error loading remote css", f.toString());
|
|
406
406
|
});
|
|
407
407
|
r.push(u);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
} catch (o) {
|
|
411
411
|
const a = t.find((s) => s.href == null) || document.styleSheets[0];
|
|
412
|
-
i.href != null && r.push(
|
|
412
|
+
i.href != null && r.push(Ft(i.href).then((s) => Dt(s, e)).then((s) => Bt(s).forEach((l) => {
|
|
413
413
|
a.insertRule(l, a.cssRules.length);
|
|
414
414
|
})).catch((s) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", s);
|
|
@@ -418,7 +418,7 @@ async function sn(t, e) {
|
|
|
418
418
|
}), Promise.all(r).then(() => (t.forEach((i) => {
|
|
419
419
|
if ("cssRules" in i)
|
|
420
420
|
try {
|
|
421
|
-
|
|
421
|
+
F(i.cssRules || []).forEach((o) => {
|
|
422
422
|
n.push(o);
|
|
423
423
|
});
|
|
424
424
|
} catch (o) {
|
|
@@ -426,60 +426,60 @@ async function sn(t, e) {
|
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function un(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ee(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function dn(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 = F(t.ownerDocument.styleSheets), r = await ln(n, e);
|
|
436
|
+
return un(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function ie(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function fn(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
444
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((o) => {
|
|
445
|
-
e.add(
|
|
445
|
+
e.add(ie(o));
|
|
446
446
|
}), Array.from(r.children).forEach((o) => {
|
|
447
447
|
o instanceof HTMLElement && n(o);
|
|
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((o) => r.has(
|
|
452
|
+
async function hn(t, e) {
|
|
453
|
+
const n = await dn(t, e), r = fn(t);
|
|
454
|
+
return (await Promise.all(n.filter((o) => r.has(ie(o.style.fontFamily))).map((o) => {
|
|
455
455
|
const a = o.parentStyleSheet ? o.parentStyleSheet.href : null;
|
|
456
|
-
return
|
|
456
|
+
return ne(o.cssText, a, 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 pn(t, e) {
|
|
461
|
+
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await hn(t, e);
|
|
462
462
|
if (n) {
|
|
463
463
|
const r = document.createElement("style"), i = document.createTextNode(n);
|
|
464
464
|
r.appendChild(i), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { width: n, height: r } =
|
|
469
|
-
return await
|
|
467
|
+
async function mn(t, e = {}) {
|
|
468
|
+
const { width: n, height: r } = Jt(t, e), i = await rt(t, e, !0);
|
|
469
|
+
return await pn(i, e), await re(i, e), cn(i, e), await Pe(i, n, r);
|
|
470
470
|
}
|
|
471
|
-
async function
|
|
472
|
-
const { width: n, height: r } =
|
|
473
|
-
return a.width = u * l, a.height =
|
|
471
|
+
async function yn(t, e = {}) {
|
|
472
|
+
const { width: n, height: r } = Jt(t, e), i = await mn(t, e), o = await Q(i), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || Re(), u = e.canvasWidth || n, f = e.canvasHeight || r;
|
|
473
|
+
return a.width = u * l, a.height = f * l, e.skipAutoScale || Ae(a), a.style.width = `${u}`, a.style.height = `${f}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(o, 0, 0, a.width, a.height), a;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function gn(t, e = {}) {
|
|
476
|
+
return (await yn(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
478
|
const Z = "data-nf-capture-chrome";
|
|
479
|
-
function
|
|
479
|
+
function wn(t) {
|
|
480
480
|
return t instanceof Element && (t.hasAttribute(Z) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function bn() {
|
|
483
483
|
const t = [];
|
|
484
484
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
485
485
|
const r = n.getBoundingClientRect(), i = document.createElement("div");
|
|
@@ -495,47 +495,47 @@ function gn() {
|
|
|
495
495
|
].join(";"), document.body.appendChild(i), t.push(i);
|
|
496
496
|
}), () => t.forEach((n) => n.remove());
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Sn() {
|
|
499
499
|
const t = document.querySelector(`[${Z}]`);
|
|
500
500
|
if (t)
|
|
501
501
|
return t;
|
|
502
502
|
const e = document.createElement("div");
|
|
503
503
|
return e.setAttribute(Z, "1"), e.className = "nf-capture-chrome", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.innerHTML = '<span class="nf-capture-chrome-pill">Capturing…</span>', document.body.appendChild(e), e;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function vn() {
|
|
506
506
|
document.querySelectorAll(`[${Z}]`).forEach((t) => t.remove());
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
509
|
-
const t = document.getElementById("notefully"), e = t ? t.style.display : "", n =
|
|
508
|
+
async function xn() {
|
|
509
|
+
const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = Sn();
|
|
510
510
|
t && (t.style.display = "none");
|
|
511
|
-
const r =
|
|
511
|
+
const r = bn();
|
|
512
512
|
await new Promise((i) => requestAnimationFrame(() => requestAnimationFrame(i)));
|
|
513
513
|
try {
|
|
514
|
-
return await
|
|
514
|
+
return await gn(document.body, {
|
|
515
515
|
cacheBust: !0,
|
|
516
516
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
517
|
-
filter: (i) => !
|
|
517
|
+
filter: (i) => !wn(i)
|
|
518
518
|
});
|
|
519
519
|
} finally {
|
|
520
|
-
r(), n.remove(),
|
|
520
|
+
r(), n.remove(), vn(), t && (t.style.display = e);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function En(t = "") {
|
|
524
524
|
const e = String(t || "");
|
|
525
525
|
return e ? /Windows NT/i.test(e) ? "Windows" : /iPhone|iPad|iPod/i.test(e) ? "iOS" : /Mac OS X|Macintosh/i.test(e) ? "macOS" : /Android/i.test(e) ? "Android" : /CrOS/i.test(e) ? "ChromeOS" : /Linux/i.test(e) ? "Linux" : "Other" : "";
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Cn(t = "") {
|
|
528
528
|
const e = String(t || "");
|
|
529
529
|
return e ? /Edg\//i.test(e) ? "Edge" : /OPR\/|Opera/i.test(e) ? "Opera" : /Firefox\//i.test(e) ? "Firefox" : /Chrome\//i.test(e) || /CriOS\//i.test(e) ? "Chrome" : /Safari\//i.test(e) ? "Safari" : "Other" : "";
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Mn(t = {}) {
|
|
532
532
|
const e = navigator.userAgent;
|
|
533
533
|
return {
|
|
534
534
|
url: location.href,
|
|
535
535
|
title: document.title,
|
|
536
536
|
userAgent: e,
|
|
537
|
-
os:
|
|
538
|
-
browser:
|
|
537
|
+
os: En(e),
|
|
538
|
+
browser: Cn(e),
|
|
539
539
|
language: navigator.language,
|
|
540
540
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
541
541
|
viewport: {
|
|
@@ -554,7 +554,7 @@ const Ut = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), jt = {
|
|
|
554
554
|
id: "userId",
|
|
555
555
|
username: "displayName",
|
|
556
556
|
name: "displayName"
|
|
557
|
-
},
|
|
557
|
+
}, _t = /* @__PURE__ */ new Set([
|
|
558
558
|
"endpoint",
|
|
559
559
|
"projectKey",
|
|
560
560
|
"version",
|
|
@@ -565,7 +565,7 @@ const Ut = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), jt = {
|
|
|
565
565
|
"video",
|
|
566
566
|
"consoleLogLimit",
|
|
567
567
|
"kinds"
|
|
568
|
-
]),
|
|
568
|
+
]), Nt = {
|
|
569
569
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
570
570
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
571
571
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -574,8 +574,8 @@ const Ut = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), jt = {
|
|
|
574
574
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
575
575
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
576
576
|
};
|
|
577
|
-
function
|
|
578
|
-
const n = e.warn ||
|
|
577
|
+
function Ln(t = {}, e = {}) {
|
|
578
|
+
const n = e.warn || oe, r = t && typeof t == "object" ? t : {}, i = {}, o = [];
|
|
579
579
|
for (const a of Ut)
|
|
580
580
|
Object.prototype.hasOwnProperty.call(r, a) && (i[a] = r[a]);
|
|
581
581
|
for (const [a, s] of Object.entries(jt))
|
|
@@ -590,24 +590,24 @@ function Cn(t = {}, e = {}) {
|
|
|
590
590
|
}
|
|
591
591
|
return i;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
const n = e.warn ||
|
|
593
|
+
function $n(t = {}, e = {}) {
|
|
594
|
+
const n = e.warn || oe, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((o) => !_t.has(o));
|
|
595
595
|
if (i.length)
|
|
596
596
|
for (const o of i) {
|
|
597
|
-
if (
|
|
598
|
-
n(`Notefully.init: ignoring "${o}". ${
|
|
597
|
+
if (Nt[o]) {
|
|
598
|
+
n(`Notefully.init: ignoring "${o}". ${Nt[o]}`);
|
|
599
599
|
continue;
|
|
600
600
|
}
|
|
601
601
|
n(
|
|
602
|
-
`Notefully.init: ignoring unknown key "${o}". Supported: ${[...
|
|
602
|
+
`Notefully.init: ignoring unknown key "${o}". Supported: ${[..._t].join(", ")}.`
|
|
603
603
|
);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function oe(t) {
|
|
607
607
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
608
608
|
}
|
|
609
|
-
const
|
|
610
|
-
function
|
|
609
|
+
const Rn = 80;
|
|
610
|
+
function An() {
|
|
611
611
|
const t = [], e = {};
|
|
612
612
|
let n = !1;
|
|
613
613
|
const r = (o, a) => {
|
|
@@ -621,7 +621,7 @@ function $n() {
|
|
|
621
621
|
level: o,
|
|
622
622
|
text: s.slice(0, 2e3),
|
|
623
623
|
at: Date.now()
|
|
624
|
-
}), t.length >
|
|
624
|
+
}), t.length > Rn && t.shift();
|
|
625
625
|
};
|
|
626
626
|
return {
|
|
627
627
|
hook: () => {
|
|
@@ -640,7 +640,7 @@ function $n() {
|
|
|
640
640
|
}
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function kn(t) {
|
|
644
644
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
645
645
|
let n = null, r = !1;
|
|
646
646
|
const i = () => {
|
|
@@ -670,8 +670,8 @@ function An(t) {
|
|
|
670
670
|
isActive: () => r
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const
|
|
674
|
-
function
|
|
673
|
+
const Pn = 60 * 1e3;
|
|
674
|
+
function Tn({ onStart: t, onStop: e, onError: n }) {
|
|
675
675
|
let r = null, i = null, o = [], a = null;
|
|
676
676
|
const s = () => {
|
|
677
677
|
if (a && (clearTimeout(a), a = null), i && i.state !== "inactive")
|
|
@@ -679,7 +679,7 @@ function kn({ onStart: t, onStop: e, onError: n }) {
|
|
|
679
679
|
i.stop();
|
|
680
680
|
} catch {
|
|
681
681
|
}
|
|
682
|
-
r && (r.getTracks().forEach((
|
|
682
|
+
r && (r.getTracks().forEach((f) => f.stop()), r = null);
|
|
683
683
|
}, l = () => {
|
|
684
684
|
if (i && i.state === "recording") {
|
|
685
685
|
i.stop();
|
|
@@ -688,8 +688,8 @@ function kn({ onStart: t, onStop: e, onError: n }) {
|
|
|
688
688
|
s(), e(null);
|
|
689
689
|
};
|
|
690
690
|
return { start: async () => {
|
|
691
|
-
var
|
|
692
|
-
if (!((
|
|
691
|
+
var f, p;
|
|
692
|
+
if (!((f = navigator.mediaDevices) != null && f.getDisplayMedia))
|
|
693
693
|
throw new Error("Screen recording is not supported in this browser.");
|
|
694
694
|
r = await navigator.mediaDevices.getDisplayMedia({
|
|
695
695
|
video: { displaySurface: "browser" },
|
|
@@ -698,15 +698,15 @@ function kn({ onStart: t, onStop: e, onError: n }) {
|
|
|
698
698
|
selfBrowserSurface: "include"
|
|
699
699
|
}), o = [], i = new MediaRecorder(r, {
|
|
700
700
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
701
|
-
}), i.ondataavailable = (
|
|
702
|
-
|
|
701
|
+
}), i.ondataavailable = (m) => {
|
|
702
|
+
m.data && m.data.size && o.push(m.data);
|
|
703
703
|
}, i.onstop = () => {
|
|
704
|
-
const
|
|
705
|
-
s(), e(
|
|
706
|
-
}, (
|
|
704
|
+
const m = o.length ? new Blob(o, { type: i.mimeType || "video/webm" }) : null;
|
|
705
|
+
s(), e(m);
|
|
706
|
+
}, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), a = setTimeout(l, Pn);
|
|
707
707
|
}, stop: l };
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function In() {
|
|
710
710
|
const t = /* @__PURE__ */ new Set();
|
|
711
711
|
return {
|
|
712
712
|
alloc() {
|
|
@@ -725,15 +725,15 @@ function Pn() {
|
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
const dt = { x: 0, y: 0, w: 1, h: 1 };
|
|
728
|
-
function
|
|
729
|
-
const t =
|
|
728
|
+
function ae() {
|
|
729
|
+
const t = In();
|
|
730
730
|
let e = [], n = { ...dt }, r = 1;
|
|
731
731
|
return {
|
|
732
|
-
list: () => e.filter((o) =>
|
|
732
|
+
list: () => e.filter((o) => Hn(o, n)),
|
|
733
733
|
all: () => e.slice(),
|
|
734
734
|
crop: () => ({ ...n }),
|
|
735
735
|
setCrop(o) {
|
|
736
|
-
return n =
|
|
736
|
+
return n = On(o), n;
|
|
737
737
|
},
|
|
738
738
|
resetCrop() {
|
|
739
739
|
return n = { ...dt }, n;
|
|
@@ -773,11 +773,11 @@ function oe() {
|
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function On(t) {
|
|
777
777
|
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
778
778
|
return { x: e, y: n, w: r, h: i };
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Hn(t, e) {
|
|
781
781
|
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;
|
|
782
782
|
return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
|
|
783
783
|
}
|
|
@@ -791,7 +791,7 @@ function Lt(t) {
|
|
|
791
791
|
arrowHeadAngle: 0.4
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function Fn(t, {
|
|
795
795
|
stickers: e = [],
|
|
796
796
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
797
797
|
width: r,
|
|
@@ -800,31 +800,31 @@ function On(t, {
|
|
|
800
800
|
}) {
|
|
801
801
|
const a = o.mark || "#fdd341", s = o.markText || "#2a2140", l = Lt(r);
|
|
802
802
|
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = a, t.fillStyle = a, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
803
|
-
const
|
|
803
|
+
const f = yt(u.x, n, r), p = gt(u.y, n, i), m = u.w / n.w * r, x = u.h / n.h * i, L = l.stroke / 2;
|
|
804
804
|
if (u.type === "rect")
|
|
805
805
|
t.strokeRect(
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
Math.max(0,
|
|
809
|
-
Math.max(0,
|
|
806
|
+
f + L,
|
|
807
|
+
p + L,
|
|
808
|
+
Math.max(0, m - l.stroke),
|
|
809
|
+
Math.max(0, x - l.stroke)
|
|
810
810
|
);
|
|
811
811
|
else if (u.type === "circle")
|
|
812
812
|
t.beginPath(), t.ellipse(
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
Math.max(0.5,
|
|
816
|
-
Math.max(0.5,
|
|
813
|
+
f + m / 2,
|
|
814
|
+
p + x / 2,
|
|
815
|
+
Math.max(0.5, m / 2 - L),
|
|
816
|
+
Math.max(0.5, x / 2 - L),
|
|
817
817
|
0,
|
|
818
818
|
0,
|
|
819
819
|
Math.PI * 2
|
|
820
820
|
), t.stroke();
|
|
821
821
|
else if (u.type === "arrow") {
|
|
822
|
-
const
|
|
823
|
-
|
|
822
|
+
const j = yt(u.x2 ?? u.x + u.w, n, r), _ = gt(u.y2 ?? u.y, n, i);
|
|
823
|
+
Bn(t, f, p, j, _, l);
|
|
824
824
|
}
|
|
825
825
|
if (u.number == null || u.number === "")
|
|
826
826
|
return;
|
|
827
|
-
const k =
|
|
827
|
+
const k = Dn(u, n, r, i, f, p, m), W = String(u.number);
|
|
828
828
|
t.beginPath(), t.arc(k.x, k.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(W, k.x, k.y + 0.5), t.fillStyle = a;
|
|
829
829
|
}), t.restore();
|
|
830
830
|
}
|
|
@@ -834,7 +834,7 @@ function yt(t, e, n) {
|
|
|
834
834
|
function gt(t, e, n) {
|
|
835
835
|
return (t - e.y) / e.h * n;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Dn(t, e, n, r, i, o, a) {
|
|
838
838
|
if (t.type === "arrow") {
|
|
839
839
|
const s = yt(t.x2 ?? t.x + t.w, e, n), l = gt(t.y2 ?? t.y, e, r);
|
|
840
840
|
return {
|
|
@@ -844,74 +844,74 @@ function Hn(t, e, n, r, i, o, a) {
|
|
|
844
844
|
}
|
|
845
845
|
return { x: i + a / 2, y: o };
|
|
846
846
|
}
|
|
847
|
-
function
|
|
848
|
-
const o = Math.atan2(r - e, n - t), a = i.arrowHead, s = Math.min(i.stroke, a * 0.2), l = n, u = r,
|
|
847
|
+
function se(t, e, n, r, i) {
|
|
848
|
+
const o = Math.atan2(r - e, n - t), a = i.arrowHead, s = Math.min(i.stroke, a * 0.2), l = n, u = r, f = n - Math.cos(o) * a, p = r - Math.sin(o) * a, m = {
|
|
849
849
|
x: l - a * Math.cos(o - i.arrowHeadAngle),
|
|
850
850
|
y: u - a * Math.sin(o - i.arrowHeadAngle)
|
|
851
|
-
},
|
|
851
|
+
}, x = {
|
|
852
852
|
x: l - a * Math.cos(o + i.arrowHeadAngle),
|
|
853
853
|
y: u - a * Math.sin(o + i.arrowHeadAngle)
|
|
854
854
|
}, L = {
|
|
855
855
|
x: n - Math.cos(o) * s,
|
|
856
856
|
y: r - Math.sin(o) * s
|
|
857
857
|
};
|
|
858
|
-
return { angle: o, tipX: l, tipY: u, baseX:
|
|
858
|
+
return { angle: o, tipX: l, tipY: u, baseX: f, baseY: p, left: m, right: x, shaftEnd: L };
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
const a =
|
|
860
|
+
function Bn(t, e, n, r, i, o) {
|
|
861
|
+
const a = se(e, n, r, i, o);
|
|
862
862
|
t.beginPath(), t.moveTo(e, n), t.lineTo(a.shaftEnd.x, a.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(a.tipX, a.tipY), t.lineTo(a.left.x, a.left.y), t.lineTo(a.right.x, a.right.y), t.closePath(), t.fill();
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function Un(t, e, n, r = {}) {
|
|
865
865
|
return new Promise((i, o) => {
|
|
866
866
|
const a = new Image();
|
|
867
867
|
a.onload = () => {
|
|
868
|
-
const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)),
|
|
869
|
-
|
|
870
|
-
const
|
|
871
|
-
|
|
868
|
+
const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), f = Math.max(1, Math.round(e.h * a.height)), p = document.createElement("canvas");
|
|
869
|
+
p.width = u, p.height = f;
|
|
870
|
+
const m = p.getContext("2d");
|
|
871
|
+
m.drawImage(a, s, l, u, f, 0, 0, u, f), Fn(m, {
|
|
872
872
|
stickers: n,
|
|
873
873
|
crop: e,
|
|
874
874
|
width: u,
|
|
875
|
-
height:
|
|
875
|
+
height: f,
|
|
876
876
|
colors: r
|
|
877
|
-
}),
|
|
878
|
-
if (!
|
|
877
|
+
}), p.toBlob((x) => {
|
|
878
|
+
if (!x) {
|
|
879
879
|
o(new Error("Could not encode screenshot"));
|
|
880
880
|
return;
|
|
881
881
|
}
|
|
882
|
-
i(
|
|
882
|
+
i(x);
|
|
883
883
|
}, "image/png");
|
|
884
884
|
}, a.onerror = () => o(new Error("Could not load screenshot")), a.src = t;
|
|
885
885
|
});
|
|
886
886
|
}
|
|
887
|
-
const
|
|
887
|
+
const B = [
|
|
888
888
|
{ id: "bug", label: "Bug" },
|
|
889
889
|
{ id: "idea", label: "Idea" },
|
|
890
890
|
{ id: "other", label: "Other" }
|
|
891
891
|
];
|
|
892
|
-
function
|
|
892
|
+
function Vt(t) {
|
|
893
893
|
return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
894
894
|
}
|
|
895
895
|
function ft(t) {
|
|
896
896
|
const e = String(t || "").trim();
|
|
897
897
|
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function jn(t) {
|
|
900
900
|
if (!Array.isArray(t) || !t.length)
|
|
901
|
-
return
|
|
901
|
+
return B.map((r) => ({ ...r }));
|
|
902
902
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
903
903
|
for (const r of t) {
|
|
904
904
|
let i = "", o = "";
|
|
905
|
-
typeof r == "string" || typeof r == "number" ? (i =
|
|
905
|
+
typeof r == "string" || typeof r == "number" ? (i = Vt(r), o = ft(i)) : r && typeof r == "object" && (i = Vt(r.id ?? r.value ?? r.kind), o = String(r.label || r.name || ft(i)).trim() || ft(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: o }));
|
|
906
906
|
}
|
|
907
|
-
return n.length ? n :
|
|
907
|
+
return n.length ? n : B.map((r) => ({ ...r }));
|
|
908
908
|
}
|
|
909
909
|
function it(t) {
|
|
910
910
|
var n;
|
|
911
|
-
const e = Array.isArray(t) && t.length ? t :
|
|
911
|
+
const e = Array.isArray(t) && t.length ? t : B;
|
|
912
912
|
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
913
913
|
}
|
|
914
|
-
const
|
|
914
|
+
const _n = ["maker", "all-business", "brighter-day", "quiet-night"], ce = "maker", Nn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), wt = 0.02, zt = 0.05, Vn = `
|
|
915
915
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
916
916
|
<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"/>
|
|
917
917
|
<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"/>
|
|
@@ -929,9 +929,9 @@ const I = {
|
|
|
929
929
|
discard: T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
930
930
|
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"/>'),
|
|
931
931
|
video: T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
const
|
|
932
|
+
}, le = An();
|
|
933
|
+
le.hook();
|
|
934
|
+
const ue = 10, zn = 80, de = "notefully.author", bt = "Anonymous";
|
|
935
935
|
let d = {
|
|
936
936
|
endpoint: "",
|
|
937
937
|
projectKey: "",
|
|
@@ -939,120 +939,126 @@ let d = {
|
|
|
939
939
|
name: "",
|
|
940
940
|
targets: null,
|
|
941
941
|
hideLauncher: !1,
|
|
942
|
-
theme:
|
|
942
|
+
theme: ce,
|
|
943
943
|
video: !1,
|
|
944
|
-
consoleLogLimit:
|
|
945
|
-
kinds:
|
|
946
|
-
},
|
|
947
|
-
function
|
|
948
|
-
return
|
|
944
|
+
consoleLogLimit: ue,
|
|
945
|
+
kinds: B.map((t) => ({ ...t }))
|
|
946
|
+
}, R = {}, h = null, c = {}, y = ae(), S = "", K = "", A = null, U = it(B), H = null, $ = null, b = null, w = null, G = null, D = null, q = null, O = { w: 0, h: 0 }, ht = !1, $t = !1;
|
|
947
|
+
function g(t) {
|
|
948
|
+
return h.querySelector(t);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function fe(t) {
|
|
951
951
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
952
|
-
return
|
|
952
|
+
return _n.includes(e) ? e : ce;
|
|
953
953
|
}
|
|
954
|
-
function
|
|
955
|
-
return
|
|
954
|
+
function Wt(t, e) {
|
|
955
|
+
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
956
956
|
}
|
|
957
|
-
async function
|
|
957
|
+
async function Wn(t) {
|
|
958
958
|
return (await fetch(t)).blob();
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function v(t, e = !1) {
|
|
961
961
|
c.status && (c.status.textContent = t || "", G && (clearTimeout(G), G = null), t && !e && (G = setTimeout(() => {
|
|
962
962
|
c.status.textContent = "";
|
|
963
963
|
}, 4e3)));
|
|
964
964
|
}
|
|
965
|
-
function
|
|
966
|
-
return
|
|
967
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
965
|
+
function Rt() {
|
|
966
|
+
return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
|
|
967
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Vn}</button>
|
|
968
968
|
<div class="nf-dialog" hidden>
|
|
969
969
|
<div class="nf-panel">
|
|
970
|
-
<div class="nf-
|
|
971
|
-
<div class="nf-
|
|
972
|
-
<
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
970
|
+
<div class="nf-panel-body">
|
|
971
|
+
<div class="nf-stage">
|
|
972
|
+
<div class="nf-palette">
|
|
973
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${I.crop}</button>
|
|
974
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${I.resetCrop}</button>
|
|
975
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${I.arrow}</button>
|
|
976
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${I.rect}</button>
|
|
977
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${I.circle}</button>
|
|
978
|
+
</div>
|
|
979
|
+
<div class="nf-canvas"></div>
|
|
977
980
|
</div>
|
|
978
|
-
<
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
<button class="nf-
|
|
981
|
+
<textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
|
|
982
|
+
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
983
|
+
<div class="nf-kind"></div>
|
|
984
|
+
<div class="nf-actions">
|
|
985
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${I.discard}</button>
|
|
986
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${I.audio}</button>
|
|
987
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${I.video}</button>
|
|
988
|
+
<button class="nf-submit" type="button">Submit</button>
|
|
989
|
+
</div>
|
|
990
|
+
<button class="nf-restore" type="button" hidden>Restore screenshot</button>
|
|
991
|
+
<div class="nf-status"></div>
|
|
988
992
|
</div>
|
|
989
|
-
<
|
|
990
|
-
<div class="nf-status"></div>
|
|
993
|
+
<p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
|
|
991
994
|
</div>
|
|
992
995
|
</div>
|
|
993
996
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
994
|
-
`, document.body.appendChild(
|
|
995
|
-
launcher:
|
|
996
|
-
dialog:
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
997
|
+
`, document.body.appendChild(h), c = {
|
|
998
|
+
launcher: g(".nf-launcher"),
|
|
999
|
+
dialog: g(".nf-dialog"),
|
|
1000
|
+
panel: g(".nf-panel"),
|
|
1001
|
+
panelBody: g(".nf-panel-body"),
|
|
1002
|
+
successMsg: g(".nf-success-msg"),
|
|
1003
|
+
stage: g(".nf-stage"),
|
|
1004
|
+
canvas: g(".nf-canvas"),
|
|
1005
|
+
text: g(".nf-text"),
|
|
1006
|
+
author: g(".nf-author"),
|
|
1007
|
+
restore: g(".nf-restore"),
|
|
1008
|
+
status: g(".nf-status"),
|
|
1009
|
+
audio: g(".nf-audio"),
|
|
1010
|
+
video: g(".nf-video"),
|
|
1011
|
+
discard: g(".nf-discard-shot"),
|
|
1012
|
+
stop: g(".nf-stop-video"),
|
|
1013
|
+
resetCrop: g(".nf-reset-crop"),
|
|
1014
|
+
submit: g(".nf-submit"),
|
|
1009
1015
|
shot: null
|
|
1010
|
-
},
|
|
1016
|
+
}, qn(), ot()), h;
|
|
1011
1017
|
}
|
|
1012
1018
|
function ot() {
|
|
1013
1019
|
var t;
|
|
1014
|
-
|
|
1020
|
+
h && (h.dataset.theme = fe(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !d.video), he(), (t = c.dialog) != null && t.hidden && tt());
|
|
1015
1021
|
}
|
|
1016
1022
|
function tt() {
|
|
1017
1023
|
c.launcher && (c.launcher.hidden = !!d.hideLauncher);
|
|
1018
1024
|
}
|
|
1019
|
-
function
|
|
1020
|
-
c.launcher.addEventListener("click", () =>
|
|
1021
|
-
e.target === c.dialog && st();
|
|
1022
|
-
}),
|
|
1025
|
+
function qn() {
|
|
1026
|
+
c.launcher.addEventListener("click", () => Se()), g(".nf-dialog").addEventListener("click", (e) => {
|
|
1027
|
+
$t || e.target === c.dialog && st();
|
|
1028
|
+
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1023
1029
|
e.addEventListener("click", () => St(e.dataset.tool));
|
|
1024
|
-
}), c.resetCrop.addEventListener("click",
|
|
1025
|
-
const t =
|
|
1030
|
+
}), c.resetCrop.addEventListener("click", Zn), c.canvas.addEventListener("pointerdown", Xn), c.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1031
|
+
const t = g(".nf-kind");
|
|
1026
1032
|
t && t.addEventListener("click", (e) => {
|
|
1027
1033
|
const n = e.target.closest("[data-kind]");
|
|
1028
1034
|
n && At(n.dataset.kind);
|
|
1029
|
-
}), c.discard.addEventListener("click",
|
|
1030
|
-
|
|
1031
|
-
}),
|
|
1035
|
+
}), c.discard.addEventListener("click", tr), c.restore.addEventListener("click", er), c.audio.addEventListener("click", nr), c.video.addEventListener("click", rr), c.stop.addEventListener("click", () => q == null ? void 0 : q.stop()), g(".nf-submit").addEventListener("click", () => {
|
|
1036
|
+
xe().catch((e) => v(e.message || "Submit failed."));
|
|
1037
|
+
}), he(), St(null);
|
|
1032
1038
|
}
|
|
1033
|
-
function
|
|
1039
|
+
function qt(t) {
|
|
1034
1040
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1035
1041
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const t =
|
|
1042
|
+
function he() {
|
|
1043
|
+
const t = h == null ? void 0 : h.querySelector(".nf-kind");
|
|
1038
1044
|
if (!t)
|
|
1039
1045
|
return;
|
|
1040
|
-
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds :
|
|
1041
|
-
t.innerHTML = e.map((i) => `<button type="button" data-kind="${
|
|
1042
|
-
const r = e.map((i) => i.id).includes(
|
|
1046
|
+
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : B;
|
|
1047
|
+
t.innerHTML = e.map((i) => `<button type="button" data-kind="${qt(i.id)}">${qt(i.label)}</button>`).join("");
|
|
1048
|
+
const r = e.map((i) => i.id).includes(U) ? U : it(e);
|
|
1043
1049
|
At(r);
|
|
1044
1050
|
}
|
|
1045
1051
|
function At(t) {
|
|
1046
|
-
|
|
1047
|
-
n.dataset.active = String(n.dataset.kind ===
|
|
1052
|
+
U = (d.kinds || B).map((n) => n.id).includes(t) ? t : it(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1053
|
+
n.dataset.active = String(n.dataset.kind === U);
|
|
1048
1054
|
});
|
|
1049
1055
|
}
|
|
1050
1056
|
function St(t) {
|
|
1051
|
-
H =
|
|
1057
|
+
H = Nn.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1052
1058
|
e.dataset.active = String(e.dataset.tool === H);
|
|
1053
|
-
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"),
|
|
1059
|
+
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), S && M();
|
|
1054
1060
|
}
|
|
1055
|
-
function
|
|
1061
|
+
function Kt(t) {
|
|
1056
1062
|
return Math.min(1, Math.max(0, t));
|
|
1057
1063
|
}
|
|
1058
1064
|
function X() {
|
|
@@ -1061,16 +1067,16 @@ function X() {
|
|
|
1061
1067
|
function et(t) {
|
|
1062
1068
|
const e = X().getBoundingClientRect();
|
|
1063
1069
|
return {
|
|
1064
|
-
x:
|
|
1065
|
-
y:
|
|
1070
|
+
x: Kt((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1071
|
+
y: Kt((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1066
1072
|
};
|
|
1067
1073
|
}
|
|
1068
|
-
function
|
|
1074
|
+
function Kn(t) {
|
|
1069
1075
|
const e = X().getBoundingClientRect();
|
|
1070
1076
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1071
1077
|
}
|
|
1072
|
-
function
|
|
1073
|
-
const e = et(t), n =
|
|
1078
|
+
function pe(t) {
|
|
1079
|
+
const e = et(t), n = y.crop();
|
|
1074
1080
|
return {
|
|
1075
1081
|
x: n.x + e.x * n.w,
|
|
1076
1082
|
y: n.y + e.y * n.h
|
|
@@ -1085,8 +1091,8 @@ function at(t, e) {
|
|
|
1085
1091
|
h: Math.max(wt, Math.abs(e.y - t.y))
|
|
1086
1092
|
};
|
|
1087
1093
|
}
|
|
1088
|
-
function
|
|
1089
|
-
|
|
1094
|
+
function kt(t) {
|
|
1095
|
+
h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
|
|
1090
1096
|
}
|
|
1091
1097
|
function pt(t) {
|
|
1092
1098
|
try {
|
|
@@ -1095,21 +1101,21 @@ function pt(t) {
|
|
|
1095
1101
|
}
|
|
1096
1102
|
}
|
|
1097
1103
|
function vt() {
|
|
1098
|
-
window.addEventListener("pointermove",
|
|
1104
|
+
window.addEventListener("pointermove", ye), window.addEventListener("pointerup", nt), window.addEventListener("pointercancel", nt);
|
|
1099
1105
|
}
|
|
1100
|
-
function
|
|
1101
|
-
window.removeEventListener("pointermove",
|
|
1106
|
+
function me() {
|
|
1107
|
+
window.removeEventListener("pointermove", ye), window.removeEventListener("pointerup", nt), window.removeEventListener("pointercancel", nt);
|
|
1102
1108
|
}
|
|
1103
|
-
function
|
|
1104
|
-
if (t.button !== 0 || !
|
|
1109
|
+
function Xn(t) {
|
|
1110
|
+
if (t.button !== 0 || !S)
|
|
1105
1111
|
return;
|
|
1106
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1112
|
+
if (!t.target.closest(".nf-sticker") && !Kn(t)) {
|
|
1107
1113
|
$ = null, M();
|
|
1108
1114
|
return;
|
|
1109
1115
|
}
|
|
1110
1116
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1111
1117
|
if (n && n.dataset.preview !== "true") {
|
|
1112
|
-
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, pt(t),
|
|
1118
|
+
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, pt(t), Yn({
|
|
1113
1119
|
kind: "sticker",
|
|
1114
1120
|
id: $,
|
|
1115
1121
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
@@ -1117,50 +1123,50 @@ function qn(t) {
|
|
|
1117
1123
|
return;
|
|
1118
1124
|
}
|
|
1119
1125
|
if ($ = null, H === "crop") {
|
|
1120
|
-
t.preventDefault(), pt(t),
|
|
1126
|
+
t.preventDefault(), pt(t), b = { kind: "crop", start: et(t), current: et(t) }, vt(), M();
|
|
1121
1127
|
return;
|
|
1122
1128
|
}
|
|
1123
1129
|
if (H === "arrow" || H === "rect" || H === "circle") {
|
|
1124
1130
|
t.preventDefault(), pt(t);
|
|
1125
|
-
const r =
|
|
1126
|
-
|
|
1131
|
+
const r = pe(t);
|
|
1132
|
+
b = { kind: "sticker", type: H, start: r, current: r }, vt(), M();
|
|
1127
1133
|
return;
|
|
1128
1134
|
}
|
|
1129
1135
|
M();
|
|
1130
1136
|
}
|
|
1131
|
-
function
|
|
1137
|
+
function Yn(t, e) {
|
|
1132
1138
|
e.preventDefault(), e.stopPropagation();
|
|
1133
|
-
const n = X().getBoundingClientRect(), r =
|
|
1134
|
-
|
|
1139
|
+
const n = X().getBoundingClientRect(), r = y.list().find((i) => i.id === t.id);
|
|
1140
|
+
w = {
|
|
1135
1141
|
...t,
|
|
1136
1142
|
startX: e.clientX,
|
|
1137
1143
|
startY: e.clientY,
|
|
1138
|
-
crop:
|
|
1144
|
+
crop: y.crop(),
|
|
1139
1145
|
sticker: r ? { ...r } : null,
|
|
1140
1146
|
rect: n
|
|
1141
|
-
},
|
|
1147
|
+
}, kt(t.dir === "move" || t.dir === "start" || t.dir === "end"), vt();
|
|
1142
1148
|
}
|
|
1143
|
-
function
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
1149
|
+
function ye(t) {
|
|
1150
|
+
if (b) {
|
|
1151
|
+
b.current = b.kind === "crop" ? et(t) : pe(t), M();
|
|
1146
1152
|
return;
|
|
1147
1153
|
}
|
|
1148
|
-
if (!
|
|
1154
|
+
if (!w)
|
|
1149
1155
|
return;
|
|
1150
|
-
const e = (t.clientX -
|
|
1156
|
+
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;
|
|
1151
1157
|
if (r) {
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1158
|
+
if (w.dir === "end")
|
|
1159
|
+
y.update(r.id, {
|
|
1154
1160
|
x2: r.x2 + e,
|
|
1155
1161
|
y2: r.y2 + n
|
|
1156
1162
|
});
|
|
1157
|
-
else if (
|
|
1158
|
-
|
|
1163
|
+
else if (w.dir === "start")
|
|
1164
|
+
y.update(r.id, {
|
|
1159
1165
|
x: r.x + e,
|
|
1160
1166
|
y: r.y + n
|
|
1161
1167
|
});
|
|
1162
|
-
else if (
|
|
1163
|
-
|
|
1168
|
+
else if (w.dir === "move")
|
|
1169
|
+
y.update(r.id, {
|
|
1164
1170
|
x: r.x + e,
|
|
1165
1171
|
y: r.y + n,
|
|
1166
1172
|
x2: (r.x2 || r.x) + e,
|
|
@@ -1168,12 +1174,12 @@ function me(t) {
|
|
|
1168
1174
|
});
|
|
1169
1175
|
else {
|
|
1170
1176
|
const i = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1171
|
-
|
|
1177
|
+
Gn(i, w.dir, e, n), y.update(r.id, i);
|
|
1172
1178
|
}
|
|
1173
1179
|
M();
|
|
1174
1180
|
}
|
|
1175
1181
|
}
|
|
1176
|
-
function
|
|
1182
|
+
function Gn(t, e, n, r) {
|
|
1177
1183
|
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")) {
|
|
1178
1184
|
const i = Math.max(0.04, t.w - n);
|
|
1179
1185
|
t.x += t.w - i, t.w = i;
|
|
@@ -1184,30 +1190,30 @@ function Xn(t, e, n, r) {
|
|
|
1184
1190
|
}
|
|
1185
1191
|
}
|
|
1186
1192
|
function nt(t) {
|
|
1187
|
-
if (
|
|
1188
|
-
|
|
1193
|
+
if (me(), kt(!1), b) {
|
|
1194
|
+
Jn();
|
|
1189
1195
|
return;
|
|
1190
1196
|
}
|
|
1191
|
-
if (
|
|
1192
|
-
if (
|
|
1197
|
+
if (w) {
|
|
1198
|
+
if (w.kind === "sticker") {
|
|
1193
1199
|
const e = c.canvas.getBoundingClientRect();
|
|
1194
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1200
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id), $ = null);
|
|
1195
1201
|
}
|
|
1196
|
-
|
|
1202
|
+
w = null, M();
|
|
1197
1203
|
}
|
|
1198
1204
|
}
|
|
1199
|
-
function
|
|
1200
|
-
const t =
|
|
1201
|
-
if (
|
|
1205
|
+
function Jn() {
|
|
1206
|
+
const t = b;
|
|
1207
|
+
if (b = null, !t)
|
|
1202
1208
|
return;
|
|
1203
1209
|
if (t.kind === "crop") {
|
|
1204
1210
|
const n = at(t.start, t.current);
|
|
1205
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1211
|
+
if (Math.abs(t.current.x - t.start.x) < zt || Math.abs(t.current.y - t.start.y) < zt) {
|
|
1206
1212
|
M();
|
|
1207
1213
|
return;
|
|
1208
1214
|
}
|
|
1209
|
-
const i =
|
|
1210
|
-
|
|
1215
|
+
const i = y.crop();
|
|
1216
|
+
y.setCrop({
|
|
1211
1217
|
x: i.x + n.x * i.w,
|
|
1212
1218
|
y: i.y + n.y * i.h,
|
|
1213
1219
|
w: n.w * i.w,
|
|
@@ -1215,20 +1221,20 @@ function Yn() {
|
|
|
1215
1221
|
}), Y();
|
|
1216
1222
|
return;
|
|
1217
1223
|
}
|
|
1218
|
-
const e =
|
|
1224
|
+
const e = Qn(t);
|
|
1219
1225
|
e && ($ = e.id), M();
|
|
1220
1226
|
}
|
|
1221
|
-
function
|
|
1227
|
+
function Qn(t) {
|
|
1222
1228
|
if (t.type === "arrow") {
|
|
1223
1229
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1224
|
-
return Math.hypot(e, n) < wt ?
|
|
1230
|
+
return Math.hypot(e, n) < wt ? y.add("arrow", {
|
|
1225
1231
|
x: t.start.x,
|
|
1226
1232
|
y: t.start.y,
|
|
1227
1233
|
x2: t.start.x + 0.12,
|
|
1228
1234
|
y2: t.start.y,
|
|
1229
1235
|
w: 0.12,
|
|
1230
1236
|
h: 0.02
|
|
1231
|
-
}) :
|
|
1237
|
+
}) : y.add("arrow", {
|
|
1232
1238
|
x: t.start.x,
|
|
1233
1239
|
y: t.start.y,
|
|
1234
1240
|
x2: t.current.x,
|
|
@@ -1237,83 +1243,83 @@ function Gn(t) {
|
|
|
1237
1243
|
h: Math.abs(n)
|
|
1238
1244
|
});
|
|
1239
1245
|
}
|
|
1240
|
-
return
|
|
1246
|
+
return y.add(t.type, at(t.start, t.current));
|
|
1241
1247
|
}
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1248
|
+
function Zn() {
|
|
1249
|
+
y.resetCrop(), $ = null, Y();
|
|
1244
1250
|
}
|
|
1245
1251
|
function xt() {
|
|
1246
|
-
c.resetCrop && (c.resetCrop.hidden = !
|
|
1252
|
+
c.resetCrop && (c.resetCrop.hidden = !y.isCropped());
|
|
1247
1253
|
}
|
|
1248
|
-
function
|
|
1254
|
+
function Pt(t) {
|
|
1249
1255
|
if (!c.audio)
|
|
1250
1256
|
return;
|
|
1251
1257
|
const e = t ? "Stop audio" : "Record audio";
|
|
1252
1258
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1253
1259
|
}
|
|
1254
|
-
function
|
|
1255
|
-
|
|
1260
|
+
function tr() {
|
|
1261
|
+
S && (K = S), S = "", c.stage.hidden = !0, c.restore.hidden = !K;
|
|
1256
1262
|
}
|
|
1257
|
-
function
|
|
1258
|
-
K && (
|
|
1263
|
+
function er() {
|
|
1264
|
+
K && (S = K, c.stage.hidden = !1, c.restore.hidden = !0, Y());
|
|
1259
1265
|
}
|
|
1260
|
-
function
|
|
1266
|
+
function nr() {
|
|
1261
1267
|
try {
|
|
1262
|
-
if (
|
|
1268
|
+
if (D || (D = kn((e) => {
|
|
1263
1269
|
const n = c.text.value.trim();
|
|
1264
1270
|
c.text.value = n ? `${n} ${e}` : e;
|
|
1265
|
-
})), !
|
|
1266
|
-
|
|
1271
|
+
})), !D.isSupported()) {
|
|
1272
|
+
v("Audio-to-text is not supported in this browser.");
|
|
1267
1273
|
return;
|
|
1268
1274
|
}
|
|
1269
|
-
const t =
|
|
1270
|
-
|
|
1275
|
+
const t = D.start();
|
|
1276
|
+
Pt(t), v(t ? "Listening…" : "");
|
|
1271
1277
|
} catch (t) {
|
|
1272
|
-
|
|
1278
|
+
v(t.message);
|
|
1273
1279
|
}
|
|
1274
1280
|
}
|
|
1275
|
-
async function
|
|
1281
|
+
async function rr() {
|
|
1276
1282
|
if (!d.video) {
|
|
1277
|
-
|
|
1283
|
+
v("Video is disabled on this host.");
|
|
1278
1284
|
return;
|
|
1279
1285
|
}
|
|
1280
|
-
c.dialog.hidden = !0, c.stop.hidden = !1, ot(), c.launcher.hidden = !0, q =
|
|
1286
|
+
c.dialog.hidden = !0, c.stop.hidden = !1, ot(), c.launcher.hidden = !0, q = Tn({
|
|
1281
1287
|
onStart() {
|
|
1282
1288
|
},
|
|
1283
1289
|
onStop(t) {
|
|
1284
|
-
|
|
1290
|
+
A = t, c.stop.hidden = !0, tt(), c.dialog.hidden = !1, Y(), v(t ? "Video attached." : "Recording cancelled.");
|
|
1285
1291
|
},
|
|
1286
1292
|
onError(t) {
|
|
1287
|
-
|
|
1293
|
+
v(t.message);
|
|
1288
1294
|
}
|
|
1289
1295
|
});
|
|
1290
1296
|
try {
|
|
1291
1297
|
await q.start();
|
|
1292
1298
|
} catch (t) {
|
|
1293
|
-
c.stop.hidden = !0, tt(), c.dialog.hidden = !1,
|
|
1299
|
+
c.stop.hidden = !0, tt(), c.dialog.hidden = !1, v(t.message);
|
|
1294
1300
|
}
|
|
1295
1301
|
}
|
|
1296
1302
|
function Y() {
|
|
1297
|
-
if (c.shot = null, !
|
|
1298
|
-
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML =
|
|
1303
|
+
if (c.shot = null, !S) {
|
|
1304
|
+
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = A ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(A)}"></video>` : "", xt();
|
|
1299
1305
|
return;
|
|
1300
1306
|
}
|
|
1301
|
-
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1307
|
+
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${S}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
|
|
1302
1308
|
const t = c.shot.querySelector("img");
|
|
1303
1309
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1304
1310
|
const e = () => {
|
|
1305
|
-
|
|
1311
|
+
ir(t), M();
|
|
1306
1312
|
};
|
|
1307
1313
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1308
1314
|
}
|
|
1309
|
-
function
|
|
1315
|
+
function ir(t) {
|
|
1310
1316
|
const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
|
|
1311
1317
|
if (e && n && (O = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !O.w || !O.h)
|
|
1312
1318
|
return;
|
|
1313
|
-
const r =
|
|
1319
|
+
const r = y.crop(), i = O.w / O.h, o = r.w / r.h * i, a = Math.min(1, o / i), s = Math.min(1, i / o);
|
|
1314
1320
|
c.shot.style.left = `${(1 - a) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${a * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
|
|
1315
1321
|
}
|
|
1316
|
-
function
|
|
1322
|
+
function or(t) {
|
|
1317
1323
|
return t.type === "arrow" ? {
|
|
1318
1324
|
id: "preview",
|
|
1319
1325
|
type: "arrow",
|
|
@@ -1332,90 +1338,90 @@ function rr(t) {
|
|
|
1332
1338
|
};
|
|
1333
1339
|
}
|
|
1334
1340
|
function M() {
|
|
1335
|
-
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((o) => o.remove()), !
|
|
1341
|
+
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((o) => o.remove()), !S || !c.shot) {
|
|
1336
1342
|
xt();
|
|
1337
1343
|
return;
|
|
1338
1344
|
}
|
|
1339
|
-
const e =
|
|
1340
|
-
if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (
|
|
1345
|
+
const e = y.crop(), n = X(), r = Lt(n.clientWidth || 400);
|
|
1346
|
+
if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (b == null ? void 0 : b.kind) === "crop") {
|
|
1341
1347
|
const o = document.createElement("div");
|
|
1342
|
-
o.className = "nf-crop",
|
|
1348
|
+
o.className = "nf-crop", Xt(o, at(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(o);
|
|
1343
1349
|
}
|
|
1344
|
-
const i =
|
|
1345
|
-
if ((
|
|
1350
|
+
const i = y.list().slice();
|
|
1351
|
+
if ((b == null ? void 0 : b.kind) === "sticker" && i.push(or(b)), i.forEach((o) => {
|
|
1346
1352
|
const a = o.id === "preview", s = !a && o.id === $, l = document.createElement("div");
|
|
1347
|
-
if (l.className = `nf-sticker nf-${o.type}`, l.dataset.id = o.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), o.type === "arrow" ?
|
|
1353
|
+
if (l.className = `nf-sticker nf-${o.type}`, l.dataset.id = o.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), o.type === "arrow" ? ar(l, o, e, s, r) : (Xt(l, o, e), s && ["nw", "ne", "sw", "se"].forEach((u) => Et(l, u))), !a && o.number) {
|
|
1348
1354
|
const u = document.createElement("span");
|
|
1349
1355
|
u.className = "nf-badge", u.textContent = String(o.number), l.appendChild(u);
|
|
1350
1356
|
}
|
|
1351
1357
|
c.shot.appendChild(l);
|
|
1352
|
-
}), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((o) => o.remove()),
|
|
1358
|
+
}), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((o) => o.remove()), A) {
|
|
1353
1359
|
const o = document.createElement("video");
|
|
1354
|
-
o.className = "nf-recording-preview", o.controls = !0, o.src = URL.createObjectURL(
|
|
1360
|
+
o.className = "nf-recording-preview", o.controls = !0, o.src = URL.createObjectURL(A), o.style.position = "absolute", o.style.right = "8px", o.style.bottom = "8px", o.style.width = "160px", c.canvas.appendChild(o);
|
|
1355
1361
|
}
|
|
1356
1362
|
xt();
|
|
1357
1363
|
}
|
|
1358
|
-
function
|
|
1359
|
-
const o = X(), a = o.clientWidth, s = o.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s,
|
|
1360
|
-
t.style.left = `${
|
|
1361
|
-
<line class="nf-arrow-hit" x1="${
|
|
1362
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1364
|
+
function ar(t, e, n, r, i = Lt(400)) {
|
|
1365
|
+
const o = X(), a = o.clientWidth, s = o.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, p = ((e.y2 ?? e.y) - n.y) / n.h * s, m = Math.max(18, i.arrowHead + i.stroke * 2), x = Math.min(l, f) - m, L = Math.min(u, p) - m, k = Math.max(2, Math.abs(f - l)) + m * 2, W = Math.max(2, Math.abs(p - u)) + m * 2, j = l - x, _ = u - L, ct = f - x, lt = p - L, P = se(j, _, ct, lt, i), N = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1366
|
+
t.style.left = `${x}px`, t.style.top = `${L}px`, t.style.width = `${k}px`, t.style.height = `${W}px`, N.setAttribute("class", "nf-arrow-svg"), N.setAttribute("viewBox", `0 0 ${k} ${W}`), N.setAttribute("width", String(k)), N.setAttribute("height", String(W)), N.innerHTML = `
|
|
1367
|
+
<line class="nf-arrow-hit" x1="${j}" y1="${_}" x2="${ct}" y2="${lt}" />
|
|
1368
|
+
<line class="nf-arrow-shaft" x1="${j}" y1="${_}" x2="${P.shaftEnd.x}" y2="${P.shaftEnd.y}" />
|
|
1363
1369
|
<polygon class="nf-arrow-head" points="${P.tipX},${P.tipY} ${P.left.x},${P.left.y} ${P.right.x},${P.right.y}" />
|
|
1364
|
-
`, t.appendChild(N), r && (Et(t, "start", { left:
|
|
1370
|
+
`, t.appendChild(N), r && (Et(t, "start", { left: j - 5, top: _ - 5 }), Et(t, "end", { left: ct - 5, top: lt - 5 }));
|
|
1365
1371
|
}
|
|
1366
1372
|
function Et(t, e, n) {
|
|
1367
1373
|
const r = document.createElement("span");
|
|
1368
1374
|
r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
|
|
1369
1375
|
}
|
|
1370
|
-
function
|
|
1376
|
+
function Xt(t, e, n) {
|
|
1371
1377
|
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}%`;
|
|
1372
1378
|
}
|
|
1373
|
-
function
|
|
1379
|
+
function sr() {
|
|
1374
1380
|
try {
|
|
1375
|
-
return String(localStorage.getItem(
|
|
1381
|
+
return String(localStorage.getItem(de) || "").trim();
|
|
1376
1382
|
} catch {
|
|
1377
1383
|
return "";
|
|
1378
1384
|
}
|
|
1379
1385
|
}
|
|
1380
|
-
function
|
|
1386
|
+
function cr(t) {
|
|
1381
1387
|
const e = String(t || "").trim();
|
|
1382
1388
|
if (!(!e || e === bt))
|
|
1383
1389
|
try {
|
|
1384
|
-
localStorage.setItem(
|
|
1390
|
+
localStorage.setItem(de, e);
|
|
1385
1391
|
} catch {
|
|
1386
1392
|
}
|
|
1387
1393
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return !!(String(
|
|
1394
|
+
function ge() {
|
|
1395
|
+
return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
|
|
1390
1396
|
}
|
|
1391
|
-
function
|
|
1397
|
+
function lr() {
|
|
1392
1398
|
return String(
|
|
1393
|
-
|
|
1399
|
+
R.displayName || R.email || R.userId || ""
|
|
1394
1400
|
).trim();
|
|
1395
1401
|
}
|
|
1396
|
-
function
|
|
1402
|
+
function ur() {
|
|
1397
1403
|
var e;
|
|
1398
|
-
if (
|
|
1399
|
-
return
|
|
1404
|
+
if (ge())
|
|
1405
|
+
return lr() || bt;
|
|
1400
1406
|
const t = String(((e = c.author) == null ? void 0 : e.value) || "").trim();
|
|
1401
|
-
return t ? (
|
|
1407
|
+
return t ? (cr(t), t) : bt;
|
|
1402
1408
|
}
|
|
1403
|
-
function
|
|
1409
|
+
function we() {
|
|
1404
1410
|
if (!c.author)
|
|
1405
1411
|
return;
|
|
1406
|
-
const t =
|
|
1412
|
+
const t = ge();
|
|
1407
1413
|
if (c.author.hidden = t, t) {
|
|
1408
1414
|
c.author.value = "";
|
|
1409
1415
|
return;
|
|
1410
1416
|
}
|
|
1411
|
-
c.author.value =
|
|
1417
|
+
c.author.value = sr();
|
|
1412
1418
|
}
|
|
1413
|
-
function
|
|
1419
|
+
function be(t, e = ue) {
|
|
1414
1420
|
const n = Number(t);
|
|
1415
|
-
return Number.isFinite(n) ? Math.min(
|
|
1421
|
+
return Number.isFinite(n) ? Math.min(zn, Math.max(0, Math.floor(n))) : e;
|
|
1416
1422
|
}
|
|
1417
|
-
function
|
|
1418
|
-
|
|
1423
|
+
function dr(t = {}) {
|
|
1424
|
+
$n(t);
|
|
1419
1425
|
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1420
1426
|
return d = {
|
|
1421
1427
|
...d,
|
|
@@ -1425,61 +1431,89 @@ function lr(t = {}) {
|
|
|
1425
1431
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1426
1432
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1427
1433
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1428
|
-
theme:
|
|
1434
|
+
theme: fe(t.theme ?? d.theme),
|
|
1429
1435
|
video: t.video == null ? d.video : !!t.video,
|
|
1430
|
-
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit :
|
|
1431
|
-
kinds: e ?
|
|
1432
|
-
},
|
|
1436
|
+
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : be(t.consoleLogLimit, d.consoleLogLimit),
|
|
1437
|
+
kinds: e ? jn(t.kinds) : d.kinds
|
|
1438
|
+
}, Rt(), ot(), Ee;
|
|
1433
1439
|
}
|
|
1434
|
-
async function
|
|
1435
|
-
|
|
1440
|
+
async function Se() {
|
|
1441
|
+
Rt(), ve(), ot(), c.launcher.hidden = !0, y = ae(), O = { w: 0, h: 0 }, A = null, $ = null, b = null, w = null, U = it(d.kinds), At(U), St(null), Pt(!1), c.text.value = "", we(), v("");
|
|
1436
1442
|
try {
|
|
1437
|
-
|
|
1443
|
+
S = await xn(), K = S, c.stage.hidden = !1, c.restore.hidden = !0, v("");
|
|
1438
1444
|
} catch {
|
|
1439
|
-
|
|
1445
|
+
S = "", v("Screenshot failed; you can still send text.");
|
|
1440
1446
|
}
|
|
1441
1447
|
c.dialog.hidden = !1, Y(), c.text.focus();
|
|
1442
1448
|
}
|
|
1443
1449
|
function st() {
|
|
1444
|
-
|
|
1450
|
+
h && (D == null || D.stop(), Pt(!1), me(), b = null, w = null, kt(!1), ve(), c.dialog.hidden = !0, c.stop.hidden = !0, tt());
|
|
1451
|
+
}
|
|
1452
|
+
function fr() {
|
|
1453
|
+
const t = c.dialog, e = c.panel, n = c.panelBody, r = c.successMsg;
|
|
1454
|
+
if (!t || !e || !n || !r)
|
|
1455
|
+
return Promise.resolve();
|
|
1456
|
+
$t = !0, v("");
|
|
1457
|
+
const i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, o = e.getBoundingClientRect();
|
|
1458
|
+
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", i)
|
|
1459
|
+
return new Promise((u) => {
|
|
1460
|
+
window.setTimeout(() => u(), 1e3);
|
|
1461
|
+
});
|
|
1462
|
+
const a = e.getBoundingClientRect(), s = a.width > 0 ? o.width / a.width : 1, l = a.height > 0 ? o.height / a.height : 1;
|
|
1463
|
+
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${s}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
|
|
1464
|
+
let f = !1;
|
|
1465
|
+
const p = () => {
|
|
1466
|
+
f || (f = !0, e.removeEventListener("transitionend", m), window.setTimeout(() => {
|
|
1467
|
+
t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
|
|
1468
|
+
}, 1e3));
|
|
1469
|
+
}, m = (x) => {
|
|
1470
|
+
x.target !== e || x.propertyName !== "transform" || p();
|
|
1471
|
+
};
|
|
1472
|
+
e.addEventListener("transitionend", m), requestAnimationFrame(() => {
|
|
1473
|
+
e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
|
|
1474
|
+
}), window.setTimeout(p, 700);
|
|
1475
|
+
});
|
|
1445
1476
|
}
|
|
1446
|
-
function
|
|
1447
|
-
|
|
1477
|
+
function ve() {
|
|
1478
|
+
$t = !1, c.dialog && (c.dialog.classList.remove("nf-success"), c.dialog.style.opacity = "", c.dialog.style.transition = "", c.panel && (c.panel.style.transform = "", c.panel.style.transition = "", c.panel.style.transformOrigin = ""), c.panelBody && (c.panelBody.hidden = !1), c.successMsg && (c.successMsg.hidden = !0));
|
|
1448
1479
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1480
|
+
function hr(t = {}) {
|
|
1481
|
+
R = { ...R, ...Ln(t) }, we();
|
|
1482
|
+
}
|
|
1483
|
+
async function xe() {
|
|
1484
|
+
if (Rt(), ht)
|
|
1451
1485
|
return null;
|
|
1452
1486
|
const t = c.text.value.trim();
|
|
1453
|
-
if (!t && !
|
|
1454
|
-
return
|
|
1487
|
+
if (!t && !S && !A)
|
|
1488
|
+
return v("Add a note, screenshot, or video first."), null;
|
|
1455
1489
|
if (!d.endpoint || !d.projectKey)
|
|
1456
|
-
return
|
|
1457
|
-
ht = !0,
|
|
1490
|
+
return v("Notefully is missing endpoint or projectKey."), null;
|
|
1491
|
+
ht = !0, Yt(!0), v("Submitting…", !0);
|
|
1458
1492
|
try {
|
|
1459
|
-
const e =
|
|
1460
|
-
if (n.append("message", t), n.append("kind",
|
|
1461
|
-
...
|
|
1462
|
-
...
|
|
1463
|
-
displayName:
|
|
1493
|
+
const e = ur(), n = new FormData();
|
|
1494
|
+
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({
|
|
1495
|
+
...Mn({
|
|
1496
|
+
...R,
|
|
1497
|
+
displayName: R.displayName || e
|
|
1464
1498
|
}),
|
|
1465
1499
|
author: e,
|
|
1466
|
-
console:
|
|
1467
|
-
})), n.append("annotations", JSON.stringify(
|
|
1468
|
-
const o = await
|
|
1469
|
-
if (n.append("screenshot", o, "screenshot.png"),
|
|
1470
|
-
const a = await
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1500
|
+
console: le.snapshot().slice(-be(d.consoleLogLimit))
|
|
1501
|
+
})), n.append("annotations", JSON.stringify(y.list())), n.append("crop", JSON.stringify(y.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), S) {
|
|
1502
|
+
const o = await Wn(S);
|
|
1503
|
+
if (n.append("screenshot", o, "screenshot.png"), y.list().length || y.isCropped()) {
|
|
1504
|
+
const a = await Un(
|
|
1505
|
+
S,
|
|
1506
|
+
y.crop(),
|
|
1507
|
+
y.list(),
|
|
1474
1508
|
{
|
|
1475
|
-
mark:
|
|
1476
|
-
markText:
|
|
1509
|
+
mark: Wt("--nf-mark", "#fdd341"),
|
|
1510
|
+
markText: Wt("--nf-mark-text", "#2a2140")
|
|
1477
1511
|
}
|
|
1478
1512
|
);
|
|
1479
1513
|
n.append("screenshotBaked", a, "screenshot.baked.png");
|
|
1480
1514
|
}
|
|
1481
1515
|
}
|
|
1482
|
-
|
|
1516
|
+
A && n.append("recording", A, "recording.webm");
|
|
1483
1517
|
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1484
1518
|
method: "POST",
|
|
1485
1519
|
headers: {
|
|
@@ -1494,26 +1528,26 @@ async function Se() {
|
|
|
1494
1528
|
i = null;
|
|
1495
1529
|
}
|
|
1496
1530
|
if (!r.ok)
|
|
1497
|
-
throw
|
|
1498
|
-
return
|
|
1531
|
+
throw v((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
|
|
1532
|
+
return await fr(), st(), i;
|
|
1499
1533
|
} finally {
|
|
1500
|
-
ht = !1,
|
|
1534
|
+
ht = !1, Yt(!1);
|
|
1501
1535
|
}
|
|
1502
1536
|
}
|
|
1503
|
-
function
|
|
1537
|
+
function Yt(t) {
|
|
1504
1538
|
c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1505
1539
|
}
|
|
1506
|
-
function
|
|
1507
|
-
st(),
|
|
1540
|
+
function pr() {
|
|
1541
|
+
st(), h == null || h.remove(), h = null, c = {};
|
|
1508
1542
|
}
|
|
1509
|
-
const
|
|
1510
|
-
typeof window < "u" && (window.Notefully =
|
|
1543
|
+
const Ee = { init: dr, open: Se, close: st, identify: hr, submit: xe, destroy: pr };
|
|
1544
|
+
typeof window < "u" && (window.Notefully = Ee);
|
|
1511
1545
|
export {
|
|
1512
1546
|
st as close,
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1547
|
+
Ee as default,
|
|
1548
|
+
pr as destroy,
|
|
1549
|
+
hr as identify,
|
|
1550
|
+
dr as init,
|
|
1551
|
+
Se as open,
|
|
1552
|
+
xe as submit
|
|
1519
1553
|
};
|