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