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