@makefully/notefully 0.1.0 → 0.1.1
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 +44 -44
- package/dist/notefully.iife.js +8 -7
- package/dist/notefully.js +232 -231
- package/package.json +47 -47
package/dist/notefully.js
CHANGED
|
@@ -5,8 +5,8 @@ function te(t, e) {
|
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"),
|
|
9
|
-
return r.head.appendChild(n), r.body.appendChild(
|
|
8
|
+
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), a = r.createElement("a");
|
|
9
|
+
return r.head.appendChild(n), r.body.appendChild(a), e && (n.href = e), a.href = t, a.href;
|
|
10
10
|
}
|
|
11
11
|
const ee = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
@@ -42,7 +42,7 @@ function Dt(t, e = {}) {
|
|
|
42
42
|
const r = e.width || ne(t), n = e.height || re(t);
|
|
43
43
|
return { width: r, height: n };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function ae() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -52,7 +52,7 @@ function ie() {
|
|
|
52
52
|
return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
54
|
const M = 16384;
|
|
55
|
-
function
|
|
55
|
+
function ie(t) {
|
|
56
56
|
(t.width > M || t.height > M) && (t.width > M && t.height > M ? t.width > t.height ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M) : t.width > M ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M));
|
|
57
57
|
}
|
|
58
58
|
function K(t) {
|
|
@@ -69,8 +69,8 @@ async function oe(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
71
|
async function se(t, e, r) {
|
|
72
|
-
const n = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
72
|
+
const n = "http://www.w3.org/2000/svg", a = document.createElementNS(n, "svg"), i = document.createElementNS(n, "foreignObject");
|
|
73
|
+
return a.setAttribute("width", `${e}`), a.setAttribute("height", `${r}`), a.setAttribute("viewBox", `0 0 ${e} ${r}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t), oe(a);
|
|
74
74
|
}
|
|
75
75
|
const C = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -84,17 +84,17 @@ function ce(t) {
|
|
|
84
84
|
}
|
|
85
85
|
function le(t, e) {
|
|
86
86
|
return It(e).map((r) => {
|
|
87
|
-
const n = t.getPropertyValue(r),
|
|
88
|
-
return `${r}: ${n}${
|
|
87
|
+
const n = t.getPropertyValue(r), a = t.getPropertyPriority(r);
|
|
88
|
+
return `${r}: ${n}${a ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
91
|
function ue(t, e, r, n) {
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
92
|
+
const a = `.${t}:${e}`, i = r.cssText ? ce(r) : le(r, n);
|
|
93
|
+
return document.createTextNode(`${a}{${i}}`);
|
|
94
94
|
}
|
|
95
95
|
function St(t, e, r, n) {
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
96
|
+
const a = window.getComputedStyle(t, r), i = a.getPropertyValue("content");
|
|
97
|
+
if (i === "" || i === "none")
|
|
98
98
|
return;
|
|
99
99
|
const o = ee();
|
|
100
100
|
try {
|
|
@@ -103,7 +103,7 @@ function St(t, e, r, n) {
|
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const s = document.createElement("style");
|
|
106
|
-
s.appendChild(ue(o, r,
|
|
106
|
+
s.appendChild(ue(o, r, a, n)), e.appendChild(s);
|
|
107
107
|
}
|
|
108
108
|
function de(t, e, r) {
|
|
109
109
|
St(t, e, ":before", r), St(t, e, ":after", r);
|
|
@@ -142,38 +142,38 @@ async function Ft(t, e, r) {
|
|
|
142
142
|
const n = await fetch(t, e);
|
|
143
143
|
if (n.status === 404)
|
|
144
144
|
throw new Error(`Resource "${n.url}" not found`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((
|
|
145
|
+
const a = await n.blob();
|
|
146
|
+
return new Promise((i, o) => {
|
|
147
147
|
const s = new FileReader();
|
|
148
148
|
s.onerror = o, s.onloadend = () => {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
i(r({ res: n, result: s.result }));
|
|
151
151
|
} catch (l) {
|
|
152
152
|
o(l);
|
|
153
153
|
}
|
|
154
|
-
}, s.readAsDataURL(
|
|
154
|
+
}, s.readAsDataURL(a);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const at = {};
|
|
158
158
|
function ge(t, e, r) {
|
|
159
159
|
let n = t.replace(/\?.*/, "");
|
|
160
160
|
return r && (n = t), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), e ? `[${e}]${n}` : n;
|
|
161
161
|
}
|
|
162
162
|
async function wt(t, e, r) {
|
|
163
163
|
const n = ge(t, e, r.includeQueryParams);
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
164
|
+
if (at[n] != null)
|
|
165
|
+
return at[n];
|
|
166
166
|
r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let a;
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
169
|
+
const i = await Ft(t, r.fetchRequestInit, ({ res: o, result: s }) => (e || (e = o.headers.get("Content-Type") || ""), me(s)));
|
|
170
|
+
a = pe(i, e);
|
|
171
|
+
} catch (i) {
|
|
172
|
+
a = r.imagePlaceholder || "";
|
|
173
173
|
let o = `Failed to fetch resource: ${t}`;
|
|
174
|
-
|
|
174
|
+
i && (o = typeof i == "string" ? i : i.message), o && console.warn(o);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return at[n] = a, a;
|
|
177
177
|
}
|
|
178
178
|
async function ye(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
@@ -181,13 +181,13 @@ async function ye(t) {
|
|
|
181
181
|
}
|
|
182
182
|
async function we(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const s =
|
|
184
|
+
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
185
|
+
i.width = t.clientWidth, i.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, i.width, i.height);
|
|
186
|
+
const s = i.toDataURL();
|
|
187
187
|
return K(s);
|
|
188
188
|
}
|
|
189
|
-
const r = t.poster, n = yt(r),
|
|
190
|
-
return K(
|
|
189
|
+
const r = t.poster, n = yt(r), a = await wt(r, n, e);
|
|
190
|
+
return K(a);
|
|
191
191
|
}
|
|
192
192
|
async function be(t, e) {
|
|
193
193
|
var r;
|
|
@@ -203,11 +203,11 @@ async function xe(t, e) {
|
|
|
203
203
|
}
|
|
204
204
|
const ve = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Ht = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
205
|
async function Se(t, e, r) {
|
|
206
|
-
var n,
|
|
206
|
+
var n, a;
|
|
207
207
|
if (Ht(e))
|
|
208
208
|
return e;
|
|
209
|
-
let
|
|
210
|
-
return ve(t) && t.assignedNodes ?
|
|
209
|
+
let i = [];
|
|
210
|
+
return ve(t) && t.assignedNodes ? i = O(t.assignedNodes()) : C(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? i = O(t.contentDocument.body.childNodes) : i = O(((a = t.shadowRoot) !== null && a !== void 0 ? a : t).childNodes), i.length === 0 || C(t, HTMLVideoElement) || await i.reduce((o, s) => o.then(() => Q(s, r)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
@@ -215,10 +215,10 @@ function Ee(t, e, r) {
|
|
|
215
215
|
const n = e.style;
|
|
216
216
|
if (!n)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let o =
|
|
221
|
-
|
|
218
|
+
const a = window.getComputedStyle(t);
|
|
219
|
+
a.cssText ? (n.cssText = a.cssText, n.transformOrigin = a.transformOrigin) : It(r).forEach((i) => {
|
|
220
|
+
let o = a.getPropertyValue(i);
|
|
221
|
+
i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), C(t, HTMLIFrameElement) && i === "display" && o === "inline" && (o = "block"), i === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), n.setProperty(i, o, a.getPropertyPriority(i));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
function Ce(t, e) {
|
|
@@ -226,39 +226,39 @@ function Ce(t, e) {
|
|
|
226
226
|
}
|
|
227
227
|
function Me(t, e) {
|
|
228
228
|
if (C(t, HTMLSelectElement)) {
|
|
229
|
-
const n = Array.from(e.children).find((
|
|
229
|
+
const n = Array.from(e.children).find((a) => t.value === a.getAttribute("value"));
|
|
230
230
|
n && n.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function $e(t, e, r) {
|
|
234
234
|
return C(e, Element) && (Ee(t, e, r), de(t, e, r), Ce(t, e), Me(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Re(t, e) {
|
|
237
237
|
const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (r.length === 0)
|
|
239
239
|
return t;
|
|
240
240
|
const n = {};
|
|
241
|
-
for (let
|
|
242
|
-
const s = r[
|
|
241
|
+
for (let i = 0; i < r.length; i++) {
|
|
242
|
+
const s = r[i].getAttribute("xlink:href");
|
|
243
243
|
if (s) {
|
|
244
244
|
const l = t.querySelector(s), b = document.querySelector(s);
|
|
245
245
|
!l && b && !n[s] && (n[s] = await Q(b, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
o.setAttribute("xmlns",
|
|
252
|
-
const s = document.createElementNS(
|
|
248
|
+
const a = Object.values(n);
|
|
249
|
+
if (a.length) {
|
|
250
|
+
const i = "http://www.w3.org/1999/xhtml", o = document.createElementNS(i, "svg");
|
|
251
|
+
o.setAttribute("xmlns", i), o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.overflow = "hidden", o.style.display = "none";
|
|
252
|
+
const s = document.createElementNS(i, "defs");
|
|
253
253
|
o.appendChild(s);
|
|
254
|
-
for (let l = 0; l <
|
|
255
|
-
s.appendChild(
|
|
254
|
+
for (let l = 0; l < a.length; l++)
|
|
255
|
+
s.appendChild(a[l]);
|
|
256
256
|
t.appendChild(o);
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
260
|
async function Q(t, e, r) {
|
|
261
|
-
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => xe(n, e)).then((n) => Se(t, n, e)).then((n) =>
|
|
261
|
+
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => xe(n, e)).then((n) => Se(t, n, e)).then((n) => $e(t, n, e)).then((n) => Re(n, e));
|
|
262
262
|
}
|
|
263
263
|
const Ut = /url\((['"]?)([^'"]+?)\1\)/g, Le = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Pe = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
264
|
function Te(t) {
|
|
@@ -267,13 +267,13 @@ function Te(t) {
|
|
|
267
267
|
}
|
|
268
268
|
function Ae(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(Ut, (r, n,
|
|
270
|
+
return t.replace(Ut, (r, n, a) => (e.push(a), r)), e.filter((r) => !st(r));
|
|
271
271
|
}
|
|
272
|
-
async function ke(t, e, r, n,
|
|
272
|
+
async function ke(t, e, r, n, a) {
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
274
|
+
const i = r ? te(e, r) : e, o = yt(e);
|
|
275
275
|
let s;
|
|
276
|
-
return
|
|
276
|
+
return a || (s = await wt(i, o, n)), t.replace(Te(e), `$1${s}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
@@ -281,10 +281,10 @@ async function ke(t, e, r, n, i) {
|
|
|
281
281
|
function Ie(t, { preferredFontFormat: e }) {
|
|
282
282
|
return e ? t.replace(Pe, (r) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [n, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [n, , a] = Le.exec(r) || [];
|
|
285
|
+
if (!a)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (a === e)
|
|
288
288
|
return `src: ${n};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
@@ -296,14 +296,14 @@ async function Vt(t, e, r) {
|
|
|
296
296
|
if (!Ot(t))
|
|
297
297
|
return t;
|
|
298
298
|
const n = Ie(t, r);
|
|
299
|
-
return Ae(n).reduce((
|
|
299
|
+
return Ae(n).reduce((i, o) => i.then((s) => ke(s, o, e, r)), Promise.resolve(n));
|
|
300
300
|
}
|
|
301
301
|
async function q(t, e, r) {
|
|
302
302
|
var n;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
return e.style.setProperty(t,
|
|
303
|
+
const a = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
|
|
304
|
+
if (a) {
|
|
305
|
+
const i = await Vt(a, null, r);
|
|
306
|
+
return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
@@ -314,21 +314,21 @@ async function Fe(t, e) {
|
|
|
314
314
|
const r = C(t, HTMLImageElement);
|
|
315
315
|
if (!(r && !st(t.src)) && !(C(t, SVGImageElement) && !st(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const n = r ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((
|
|
319
|
-
t.onload =
|
|
317
|
+
const n = r ? t.src : t.href.baseVal, a = await wt(n, yt(n), e);
|
|
318
|
+
await new Promise((i, o) => {
|
|
319
|
+
t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
|
-
|
|
321
|
+
i(e.onImageErrorHandler(...l));
|
|
322
322
|
} catch (b) {
|
|
323
323
|
o(b);
|
|
324
324
|
}
|
|
325
325
|
} : o;
|
|
326
326
|
const s = t;
|
|
327
|
-
s.decode && (s.decode =
|
|
327
|
+
s.decode && (s.decode = i), s.loading === "lazy" && (s.loading = "eager"), r ? (t.srcset = "", t.src = a) : t.href.baseVal = a;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
async function He(t, e) {
|
|
331
|
-
const n = O(t.childNodes).map((
|
|
331
|
+
const n = O(t.childNodes).map((a) => Bt(a, e));
|
|
332
332
|
await Promise.all(n).then(() => t);
|
|
333
333
|
}
|
|
334
334
|
async function Bt(t, e) {
|
|
@@ -338,63 +338,63 @@ function Ue(t, e) {
|
|
|
338
338
|
const { style: r } = t;
|
|
339
339
|
e.backgroundColor && (r.backgroundColor = e.backgroundColor), e.width && (r.width = `${e.width}px`), e.height && (r.height = `${e.height}px`);
|
|
340
340
|
const n = e.style;
|
|
341
|
-
return n != null && Object.keys(n).forEach((
|
|
342
|
-
r[
|
|
341
|
+
return n != null && Object.keys(n).forEach((a) => {
|
|
342
|
+
r[a] = n[a];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
345
|
const Mt = {};
|
|
346
|
-
async function
|
|
346
|
+
async function $t(t) {
|
|
347
347
|
let e = Mt[t];
|
|
348
348
|
if (e != null)
|
|
349
349
|
return e;
|
|
350
350
|
const n = await (await fetch(t)).text();
|
|
351
351
|
return e = { url: t, cssText: n }, Mt[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function Rt(t, e) {
|
|
354
354
|
let r = t.cssText;
|
|
355
|
-
const n = /url\(["']?([^"')]+)["']?\)/g,
|
|
355
|
+
const n = /url\(["']?([^"')]+)["']?\)/g, i = (r.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
356
356
|
let s = o.replace(n, "$1");
|
|
357
357
|
return s.startsWith("https://") || (s = new URL(s, t.url).href), Ft(s, e.fetchRequestInit, ({ result: l }) => (r = r.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
|
-
return Promise.all(
|
|
359
|
+
return Promise.all(i).then(() => r);
|
|
360
360
|
}
|
|
361
361
|
function Lt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let n = t.replace(r, "");
|
|
366
|
-
const
|
|
366
|
+
const a = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = a.exec(n);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
n = n.replace(
|
|
374
|
-
const
|
|
373
|
+
n = n.replace(a, "");
|
|
374
|
+
const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", s = new RegExp(o, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let l =
|
|
376
|
+
let l = i.exec(n);
|
|
377
377
|
if (l === null) {
|
|
378
378
|
if (l = s.exec(n), l === null)
|
|
379
379
|
break;
|
|
380
|
-
|
|
380
|
+
i.lastIndex = s.lastIndex;
|
|
381
381
|
} else
|
|
382
|
-
s.lastIndex =
|
|
382
|
+
s.lastIndex = i.lastIndex;
|
|
383
383
|
e.push(l[0]);
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
387
|
async function Oe(t, e) {
|
|
388
388
|
const r = [], n = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((a) => {
|
|
390
|
+
if ("cssRules" in a)
|
|
391
391
|
try {
|
|
392
|
-
O(
|
|
393
|
-
if (
|
|
392
|
+
O(a.cssRules || []).forEach((i, o) => {
|
|
393
|
+
if (i.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let s = o + 1;
|
|
395
|
-
const l =
|
|
395
|
+
const l = i.href, b = $t(l).then((p) => Rt(p, e)).then((p) => Lt(p).forEach((h) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
397
|
+
a.insertRule(h, h.startsWith("@import") ? s += 1 : a.cssRules.length);
|
|
398
398
|
} catch (g) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: h,
|
|
@@ -407,22 +407,22 @@ async function Oe(t, e) {
|
|
|
407
407
|
n.push(b);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
} catch (
|
|
410
|
+
} catch (i) {
|
|
411
411
|
const o = t.find((s) => s.href == null) || document.styleSheets[0];
|
|
412
|
-
|
|
412
|
+
a.href != null && n.push($t(a.href).then((s) => Rt(s, e)).then((s) => Lt(s).forEach((l) => {
|
|
413
413
|
o.insertRule(l, o.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", i);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(n).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(n).then(() => (t.forEach((a) => {
|
|
419
|
+
if ("cssRules" in a)
|
|
420
420
|
try {
|
|
421
|
-
O(
|
|
422
|
-
r.push(
|
|
421
|
+
O(a.cssRules || []).forEach((i) => {
|
|
422
|
+
r.push(i);
|
|
423
423
|
});
|
|
424
|
-
} catch (
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
424
|
+
} catch (i) {
|
|
425
|
+
console.error(`Error while reading CSS rules from ${a.href}`, i);
|
|
426
426
|
}
|
|
427
427
|
}), r));
|
|
428
428
|
}
|
|
@@ -441,45 +441,45 @@ function Wt(t) {
|
|
|
441
441
|
function We(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function r(n) {
|
|
444
|
-
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((
|
|
445
|
-
e.add(Wt(
|
|
446
|
-
}), Array.from(n.children).forEach((
|
|
447
|
-
|
|
444
|
+
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((i) => {
|
|
445
|
+
e.add(Wt(i));
|
|
446
|
+
}), Array.from(n.children).forEach((i) => {
|
|
447
|
+
i instanceof HTMLElement && r(i);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return r(t), e;
|
|
451
451
|
}
|
|
452
452
|
async function _e(t, e) {
|
|
453
453
|
const r = await Be(t, e), n = We(t);
|
|
454
|
-
return (await Promise.all(r.filter((
|
|
455
|
-
const o =
|
|
456
|
-
return Vt(
|
|
454
|
+
return (await Promise.all(r.filter((i) => n.has(Wt(i.style.fontFamily))).map((i) => {
|
|
455
|
+
const o = i.parentStyleSheet ? i.parentStyleSheet.href : null;
|
|
456
|
+
return Vt(i.cssText, o, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
460
|
async function qe(t, e) {
|
|
461
461
|
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await _e(t, e);
|
|
462
462
|
if (r) {
|
|
463
|
-
const n = document.createElement("style"),
|
|
464
|
-
n.appendChild(
|
|
463
|
+
const n = document.createElement("style"), a = document.createTextNode(r);
|
|
464
|
+
n.appendChild(a), t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
+
async function ze(t, e = {}) {
|
|
468
|
+
const { width: r, height: n } = Dt(t, e), a = await Q(t, e, !0);
|
|
469
|
+
return await qe(a, e), await Bt(a, e), Ue(a, e), await se(a, r, n);
|
|
470
|
+
}
|
|
467
471
|
async function je(t, e = {}) {
|
|
468
|
-
const { width: r, height: n } = Dt(t, e),
|
|
469
|
-
return
|
|
472
|
+
const { width: r, height: n } = Dt(t, e), a = await ze(t, e), i = await K(a), o = document.createElement("canvas"), s = o.getContext("2d"), l = e.pixelRatio || ae(), b = e.canvasWidth || r, p = e.canvasHeight || n;
|
|
473
|
+
return o.width = b * l, o.height = p * l, e.skipAutoScale || ie(o), o.style.width = `${b}`, o.style.height = `${p}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(i, 0, 0, o.width, o.height), o;
|
|
470
474
|
}
|
|
471
475
|
async function Xe(t, e = {}) {
|
|
472
|
-
|
|
473
|
-
return o.width = b * l, o.height = p * l, e.skipAutoScale || ae(o), o.style.width = `${b}`, o.style.height = `${p}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(a, 0, 0, o.width, o.height), o;
|
|
474
|
-
}
|
|
475
|
-
async function ze(t, e = {}) {
|
|
476
|
-
return (await Xe(t, e)).toDataURL();
|
|
476
|
+
return (await je(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
478
|
function Ge() {
|
|
479
479
|
const t = [];
|
|
480
480
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((r) => {
|
|
481
|
-
const n = r.getBoundingClientRect(),
|
|
482
|
-
|
|
481
|
+
const n = r.getBoundingClientRect(), a = document.createElement("div");
|
|
482
|
+
a.setAttribute("data-nf-mask-cover", "1"), a.style.cssText = [
|
|
483
483
|
"position:fixed",
|
|
484
484
|
`left:${n.left}px`,
|
|
485
485
|
`top:${n.top}px`,
|
|
@@ -488,7 +488,7 @@ function Ge() {
|
|
|
488
488
|
"background:#111",
|
|
489
489
|
"z-index:2147483646",
|
|
490
490
|
"pointer-events:none"
|
|
491
|
-
].join(";"), document.body.appendChild(
|
|
491
|
+
].join(";"), document.body.appendChild(a), t.push(a);
|
|
492
492
|
}), () => t.forEach((r) => r.remove());
|
|
493
493
|
}
|
|
494
494
|
async function Ye() {
|
|
@@ -497,7 +497,7 @@ async function Ye() {
|
|
|
497
497
|
const r = Ge();
|
|
498
498
|
await new Promise((n) => requestAnimationFrame(() => requestAnimationFrame(n)));
|
|
499
499
|
try {
|
|
500
|
-
return await
|
|
500
|
+
return await Xe(document.body, {
|
|
501
501
|
cacheBust: !0,
|
|
502
502
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
503
503
|
filter: (n) => n instanceof Element ? n.id !== "notefully" && !n.hasAttribute("data-nf-mask-cover") : !0
|
|
@@ -529,7 +529,7 @@ const Je = 80;
|
|
|
529
529
|
function Ze() {
|
|
530
530
|
const t = [], e = {};
|
|
531
531
|
let r = !1;
|
|
532
|
-
const n = (
|
|
532
|
+
const n = (i, o) => {
|
|
533
533
|
let s = "";
|
|
534
534
|
try {
|
|
535
535
|
s = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
@@ -537,21 +537,21 @@ function Ze() {
|
|
|
537
537
|
s = String(o[0]);
|
|
538
538
|
}
|
|
539
539
|
t.push({
|
|
540
|
-
level:
|
|
540
|
+
level: i,
|
|
541
541
|
text: s.slice(0, 2e3),
|
|
542
542
|
at: Date.now()
|
|
543
543
|
}), t.length > Je && t.shift();
|
|
544
544
|
};
|
|
545
545
|
return {
|
|
546
546
|
hook: () => {
|
|
547
|
-
r || typeof window > "u" || (r = !0, ["log", "info", "warn", "error"].forEach((
|
|
548
|
-
e[
|
|
549
|
-
n(
|
|
547
|
+
r || typeof window > "u" || (r = !0, ["log", "info", "warn", "error"].forEach((i) => {
|
|
548
|
+
e[i] = console[i].bind(console), console[i] = (...o) => {
|
|
549
|
+
n(i, o), e[i](...o);
|
|
550
550
|
};
|
|
551
|
-
}), window.addEventListener("error", (
|
|
552
|
-
n("error", [
|
|
553
|
-
}), window.addEventListener("unhandledrejection", (
|
|
554
|
-
n("error", [
|
|
551
|
+
}), window.addEventListener("error", (i) => {
|
|
552
|
+
n("error", [i.message || "window.error"]);
|
|
553
|
+
}), window.addEventListener("unhandledrejection", (i) => {
|
|
554
|
+
n("error", [i.reason || "unhandledrejection"]);
|
|
555
555
|
}));
|
|
556
556
|
},
|
|
557
557
|
snapshot() {
|
|
@@ -562,7 +562,7 @@ function Ze() {
|
|
|
562
562
|
function Ne(t) {
|
|
563
563
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
564
564
|
let r = null, n = !1;
|
|
565
|
-
const
|
|
565
|
+
const a = () => {
|
|
566
566
|
if (n = !1, r)
|
|
567
567
|
try {
|
|
568
568
|
r.stop();
|
|
@@ -573,7 +573,7 @@ function Ne(t) {
|
|
|
573
573
|
start: () => {
|
|
574
574
|
if (!e)
|
|
575
575
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
576
|
-
return n ? (
|
|
576
|
+
return n ? (a(), !1) : (r = new e(), r.continuous = !0, r.interimResults = !0, r.lang = navigator.language || "en-US", r.onresult = (o) => {
|
|
577
577
|
let s = "";
|
|
578
578
|
for (let l = o.resultIndex; l < o.results.length; l += 1)
|
|
579
579
|
o.results[l].isFinal && (s += o.results[l][0].transcript);
|
|
@@ -584,24 +584,24 @@ function Ne(t) {
|
|
|
584
584
|
n = !1;
|
|
585
585
|
}, r.start(), n = !0, !0);
|
|
586
586
|
},
|
|
587
|
-
stop:
|
|
587
|
+
stop: a,
|
|
588
588
|
isSupported: () => !!e,
|
|
589
589
|
isActive: () => n
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
const Qe = 60 * 1e3;
|
|
593
593
|
function tn({ onStart: t, onStop: e, onError: r }) {
|
|
594
|
-
let n = null,
|
|
594
|
+
let n = null, a = null, i = [], o = null;
|
|
595
595
|
const s = () => {
|
|
596
|
-
if (o && (clearTimeout(o), o = null),
|
|
596
|
+
if (o && (clearTimeout(o), o = null), a && a.state !== "inactive")
|
|
597
597
|
try {
|
|
598
|
-
|
|
598
|
+
a.stop();
|
|
599
599
|
} catch {
|
|
600
600
|
}
|
|
601
601
|
n && (n.getTracks().forEach((p) => p.stop()), n = null);
|
|
602
602
|
}, l = () => {
|
|
603
|
-
if (
|
|
604
|
-
|
|
603
|
+
if (a && a.state === "recording") {
|
|
604
|
+
a.stop();
|
|
605
605
|
return;
|
|
606
606
|
}
|
|
607
607
|
s(), e(null);
|
|
@@ -615,14 +615,14 @@ function tn({ onStart: t, onStop: e, onError: r }) {
|
|
|
615
615
|
audio: !1,
|
|
616
616
|
preferCurrentTab: !0,
|
|
617
617
|
selfBrowserSurface: "include"
|
|
618
|
-
}),
|
|
618
|
+
}), i = [], a = new MediaRecorder(n, {
|
|
619
619
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
620
|
-
}),
|
|
621
|
-
g.data && g.data.size &&
|
|
622
|
-
},
|
|
623
|
-
const g =
|
|
620
|
+
}), a.ondataavailable = (g) => {
|
|
621
|
+
g.data && g.data.size && i.push(g.data);
|
|
622
|
+
}, a.onstop = () => {
|
|
623
|
+
const g = i.length ? new Blob(i, { type: a.mimeType || "video/webm" }) : null;
|
|
624
624
|
s(), e(g);
|
|
625
|
-
}, (h = n.getVideoTracks()[0]) == null || h.addEventListener("ended", () => l()),
|
|
625
|
+
}, (h = n.getVideoTracks()[0]) == null || h.addEventListener("ended", () => l()), a.start(), o = setTimeout(l, Qe);
|
|
626
626
|
}, stop: l };
|
|
627
627
|
}
|
|
628
628
|
function en() {
|
|
@@ -643,72 +643,72 @@ function en() {
|
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
const
|
|
646
|
+
const it = { x: 0, y: 0, w: 1, h: 1 };
|
|
647
647
|
function _t() {
|
|
648
648
|
const t = en();
|
|
649
|
-
let e = [], r = { ...
|
|
649
|
+
let e = [], r = { ...it }, n = 1;
|
|
650
650
|
return {
|
|
651
|
-
list: () => e.filter((
|
|
651
|
+
list: () => e.filter((i) => rn(i, r)),
|
|
652
652
|
all: () => e.slice(),
|
|
653
653
|
crop: () => ({ ...r }),
|
|
654
|
-
setCrop(
|
|
655
|
-
return r = nn(
|
|
654
|
+
setCrop(i) {
|
|
655
|
+
return r = nn(i), r;
|
|
656
656
|
},
|
|
657
657
|
resetCrop() {
|
|
658
|
-
return r = { ...
|
|
658
|
+
return r = { ...it }, r;
|
|
659
659
|
},
|
|
660
660
|
isCropped() {
|
|
661
661
|
return r.x > 1e-6 || r.y > 1e-6 || r.w < 1 - 1e-6 || r.h < 1 - 1e-6;
|
|
662
662
|
},
|
|
663
|
-
add(
|
|
663
|
+
add(i, o) {
|
|
664
664
|
const s = {
|
|
665
665
|
id: `s${n++}`,
|
|
666
|
-
type:
|
|
666
|
+
type: i,
|
|
667
667
|
number: t.alloc(),
|
|
668
668
|
x: 0.2,
|
|
669
669
|
y: 0.2,
|
|
670
|
-
w:
|
|
671
|
-
h:
|
|
670
|
+
w: i === "arrow" ? 0.2 : 0.22,
|
|
671
|
+
h: i === "arrow" ? 0.05 : 0.16,
|
|
672
672
|
x2: 0.4,
|
|
673
673
|
y2: 0.28,
|
|
674
674
|
...o
|
|
675
675
|
};
|
|
676
676
|
return e.push(s), s;
|
|
677
677
|
},
|
|
678
|
-
update(
|
|
679
|
-
const s = e.find((l) => l.id ===
|
|
678
|
+
update(i, o) {
|
|
679
|
+
const s = e.find((l) => l.id === i);
|
|
680
680
|
return s ? (Object.assign(s, o), s) : null;
|
|
681
681
|
},
|
|
682
|
-
remove(
|
|
683
|
-
const o = e.findIndex((l) => l.id ===
|
|
682
|
+
remove(i) {
|
|
683
|
+
const o = e.findIndex((l) => l.id === i);
|
|
684
684
|
if (o < 0)
|
|
685
685
|
return null;
|
|
686
686
|
const [s] = e.splice(o, 1);
|
|
687
687
|
return t.free(s.number), s;
|
|
688
688
|
},
|
|
689
689
|
reset() {
|
|
690
|
-
for (e = [], r = { ...
|
|
690
|
+
for (e = [], r = { ...it }, n = 1; t.peekUsed().length; )
|
|
691
691
|
t.free(t.peekUsed()[0]);
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
function nn(t) {
|
|
696
|
-
const e = Math.min(Math.max(t.x, 0), 0.95), r = Math.min(Math.max(t.y, 0), 0.95), n = Math.min(Math.max(t.w, 0.05), 1 - e),
|
|
697
|
-
return { x: e, y: r, w: n, h:
|
|
696
|
+
const e = Math.min(Math.max(t.x, 0), 0.95), r = Math.min(Math.max(t.y, 0), 0.95), n = Math.min(Math.max(t.w, 0.05), 1 - e), a = Math.min(Math.max(t.h, 0.05), 1 - r);
|
|
697
|
+
return { x: e, y: r, w: n, h: a };
|
|
698
698
|
}
|
|
699
699
|
function rn(t, e) {
|
|
700
700
|
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;
|
|
701
701
|
return r >= e.x && n >= e.y && r <= e.x + e.w && n <= e.y + e.h;
|
|
702
702
|
}
|
|
703
703
|
function an(t, e, r, n = {}) {
|
|
704
|
-
const
|
|
704
|
+
const a = n.mark || "#fdd341", i = n.markText || "#2a2140";
|
|
705
705
|
return new Promise((o, s) => {
|
|
706
706
|
const l = new Image();
|
|
707
707
|
l.onload = () => {
|
|
708
708
|
const b = Math.round(e.x * l.width), p = Math.round(e.y * l.height), h = Math.max(1, Math.round(e.w * l.width)), g = Math.max(1, Math.round(e.h * l.height)), P = document.createElement("canvas");
|
|
709
709
|
P.width = h, P.height = g;
|
|
710
710
|
const d = P.getContext("2d");
|
|
711
|
-
d.drawImage(l, b, p, h, g, 0, 0, h, g), d.lineWidth = Math.max(3, Math.round(h / 400)), d.strokeStyle =
|
|
711
|
+
d.drawImage(l, b, p, h, g, 0, 0, h, g), d.lineWidth = Math.max(3, Math.round(h / 400)), d.strokeStyle = a, d.fillStyle = a, d.font = `700 ${Math.max(14, Math.round(h / 40))}px sans-serif`, r.forEach((m) => {
|
|
712
712
|
const T = ct(m.x, e, h), A = lt(m.y, e, g), k = m.w / e.w * h, V = m.h / e.h * g;
|
|
713
713
|
if (m.type === "rect")
|
|
714
714
|
d.strokeRect(T, A, k, V);
|
|
@@ -719,7 +719,7 @@ function an(t, e, r, n = {}) {
|
|
|
719
719
|
sn(d, T, A, Nt, Qt);
|
|
720
720
|
}
|
|
721
721
|
const B = on(m, e, h, g, T, A, k), I = String(m.number);
|
|
722
|
-
d.beginPath(), d.arc(B.x, B.y, 11, 0, Math.PI * 2), d.fill(), d.fillStyle =
|
|
722
|
+
d.beginPath(), d.arc(B.x, B.y, 11, 0, Math.PI * 2), d.fill(), d.fillStyle = i, d.textAlign = "center", d.textBaseline = "middle", d.fillText(I, B.x, B.y), d.fillStyle = a;
|
|
723
723
|
}), P.toBlob((m) => {
|
|
724
724
|
if (!m) {
|
|
725
725
|
s(new Error("Could not encode screenshot"));
|
|
@@ -736,23 +736,24 @@ function ct(t, e, r) {
|
|
|
736
736
|
function lt(t, e, r) {
|
|
737
737
|
return (t - e.y) / e.h * r;
|
|
738
738
|
}
|
|
739
|
-
function on(t, e, r, n,
|
|
739
|
+
function on(t, e, r, n, a, i, o) {
|
|
740
740
|
if (t.type === "arrow") {
|
|
741
741
|
const s = ct(t.x2 ?? t.x + t.w, e, r), l = lt(t.y2 ?? t.y, e, n);
|
|
742
742
|
return {
|
|
743
|
-
x: (
|
|
744
|
-
y: (
|
|
743
|
+
x: (a + s) / 2,
|
|
744
|
+
y: (i + l) / 2
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
|
-
return { x:
|
|
747
|
+
return { x: a + o / 2, y: i };
|
|
748
748
|
}
|
|
749
|
-
function sn(t, e, r, n,
|
|
750
|
-
const
|
|
751
|
-
t.beginPath(), t.moveTo(e, r), t.lineTo(l, b), t.stroke(), t.beginPath(), t.moveTo(n,
|
|
749
|
+
function sn(t, e, r, n, a) {
|
|
750
|
+
const i = Math.atan2(a - r, n - e), o = 14, s = 2, l = n - Math.cos(i) * s, b = a - Math.sin(i) * s;
|
|
751
|
+
t.beginPath(), t.moveTo(e, r), t.lineTo(l, b), t.stroke(), t.beginPath(), t.moveTo(n, a), t.lineTo(n - o * Math.cos(i - 0.4), a - o * Math.sin(i - 0.4)), t.lineTo(n - o * Math.cos(i + 0.4), a - o * Math.sin(i + 0.4)), t.closePath(), t.fill();
|
|
752
752
|
}
|
|
753
753
|
const cn = ["bug", "idea", "other"], ln = ["maker", "all-business", "brighter-day", "quiet-night"], qt = "maker", un = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), ut = 0.02, Pt = 0.05, dn = `
|
|
754
754
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
755
|
-
<path fill="currentColor" d="
|
|
755
|
+
<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"/>
|
|
756
|
+
<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"/>
|
|
756
757
|
</svg>
|
|
757
758
|
`;
|
|
758
759
|
function D(t) {
|
|
@@ -767,8 +768,8 @@ const F = {
|
|
|
767
768
|
discard: D('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
768
769
|
audio: D('<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"/>'),
|
|
769
770
|
video: D('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
770
|
-
},
|
|
771
|
-
|
|
771
|
+
}, zt = Ze();
|
|
772
|
+
zt.hook();
|
|
772
773
|
let x = {
|
|
773
774
|
endpoint: "",
|
|
774
775
|
projectKey: "",
|
|
@@ -777,11 +778,11 @@ let x = {
|
|
|
777
778
|
hideLauncher: !1,
|
|
778
779
|
theme: qt,
|
|
779
780
|
video: !1
|
|
780
|
-
}, dt = {}, u = null, c = {}, f = _t(), S = "",
|
|
781
|
+
}, dt = {}, u = null, c = {}, f = _t(), S = "", j = "", L = null, J = "bug", U = null, R = null, w = null, y = null, G = null, W = null, z = null, H = { w: 0, h: 0 };
|
|
781
782
|
function E(t) {
|
|
782
783
|
return u.querySelector(t);
|
|
783
784
|
}
|
|
784
|
-
function
|
|
785
|
+
function jt(t) {
|
|
785
786
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
786
787
|
return ln.includes(e) ? e : qt;
|
|
787
788
|
}
|
|
@@ -795,7 +796,7 @@ function v(t, e = !1) {
|
|
|
795
796
|
}
|
|
796
797
|
function bt() {
|
|
797
798
|
return u && document.body.contains(u) || (u = document.createElement("div"), u.id = "notefully", u.innerHTML = `
|
|
798
|
-
<button class="nf-launcher" type="button" title="
|
|
799
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${dn}</button>
|
|
799
800
|
<div class="nf-dialog" hidden>
|
|
800
801
|
<div class="nf-panel">
|
|
801
802
|
<div class="nf-stage">
|
|
@@ -842,7 +843,7 @@ function bt() {
|
|
|
842
843
|
}, fn(), tt()), u;
|
|
843
844
|
}
|
|
844
845
|
function tt() {
|
|
845
|
-
u && (u.dataset.theme =
|
|
846
|
+
u && (u.dataset.theme = jt(x.theme), x.hideLauncher ? u.setAttribute("data-nf-hidden-launcher", "") : u.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !x.video));
|
|
846
847
|
}
|
|
847
848
|
function fn() {
|
|
848
849
|
c.launcher.addEventListener("click", () => Kt()), E(".nf-dialog").addEventListener("click", (t) => {
|
|
@@ -851,7 +852,7 @@ function fn() {
|
|
|
851
852
|
t.addEventListener("click", () => ht(t.dataset.tool));
|
|
852
853
|
}), c.resetCrop.addEventListener("click", bn), c.canvas.addEventListener("pointerdown", mn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), u.querySelectorAll("[data-kind]").forEach((t) => {
|
|
853
854
|
t.addEventListener("click", () => ft(t.dataset.kind));
|
|
854
|
-
}), c.discard.addEventListener("click", xn), c.restore.addEventListener("click", vn), c.audio.addEventListener("click", Sn), c.video.addEventListener("click", En), c.stop.addEventListener("click", () =>
|
|
855
|
+
}), c.discard.addEventListener("click", xn), c.restore.addEventListener("click", vn), c.audio.addEventListener("click", Sn), c.video.addEventListener("click", En), c.stop.addEventListener("click", () => z == null ? void 0 : z.stop()), E(".nf-submit").addEventListener("click", () => {
|
|
855
856
|
Jt().catch((t) => v(t.message || "Submit failed."));
|
|
856
857
|
}), ft("bug"), ht(null);
|
|
857
858
|
}
|
|
@@ -861,9 +862,9 @@ function ft(t) {
|
|
|
861
862
|
});
|
|
862
863
|
}
|
|
863
864
|
function ht(t) {
|
|
864
|
-
U = un.has(t) ? t : null,
|
|
865
|
+
U = un.has(t) ? t : null, R = null, u.querySelectorAll(".nf-tool").forEach((e) => {
|
|
865
866
|
e.dataset.active = String(e.dataset.tool === U);
|
|
866
|
-
}), c.canvas && (c.canvas.dataset.draw = U ? "true" : "false"), S &&
|
|
867
|
+
}), c.canvas && (c.canvas.dataset.draw = U ? "true" : "false"), S && $();
|
|
867
868
|
}
|
|
868
869
|
function At(t) {
|
|
869
870
|
return Math.min(1, Math.max(0, t));
|
|
@@ -882,7 +883,7 @@ function hn(t) {
|
|
|
882
883
|
const e = et().getBoundingClientRect();
|
|
883
884
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
884
885
|
}
|
|
885
|
-
function
|
|
886
|
+
function Xt(t) {
|
|
886
887
|
const e = Z(t), r = f.crop();
|
|
887
888
|
return {
|
|
888
889
|
x: r.x + e.x * r.w,
|
|
@@ -917,33 +918,33 @@ function mn(t) {
|
|
|
917
918
|
if (t.button !== 0 || !S)
|
|
918
919
|
return;
|
|
919
920
|
if (!t.target.closest(".nf-sticker") && !hn(t)) {
|
|
920
|
-
|
|
921
|
+
R = null, $();
|
|
921
922
|
return;
|
|
922
923
|
}
|
|
923
924
|
const e = t.target.closest(".nf-handle"), r = t.target.closest(".nf-sticker");
|
|
924
925
|
if (r && r.dataset.preview !== "true") {
|
|
925
|
-
t.preventDefault(), t.stopPropagation(),
|
|
926
|
+
t.preventDefault(), t.stopPropagation(), R = r.dataset.id, ot(t), pn({
|
|
926
927
|
kind: "sticker",
|
|
927
|
-
id:
|
|
928
|
+
id: R,
|
|
928
929
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
929
|
-
}, t),
|
|
930
|
+
}, t), $();
|
|
930
931
|
return;
|
|
931
932
|
}
|
|
932
|
-
if (
|
|
933
|
-
t.preventDefault(), ot(t), w = { kind: "crop", start: Z(t), current: Z(t) }, mt(),
|
|
933
|
+
if (R = null, U === "crop") {
|
|
934
|
+
t.preventDefault(), ot(t), w = { kind: "crop", start: Z(t), current: Z(t) }, mt(), $();
|
|
934
935
|
return;
|
|
935
936
|
}
|
|
936
937
|
if (U === "arrow" || U === "rect" || U === "circle") {
|
|
937
938
|
t.preventDefault(), ot(t);
|
|
938
|
-
const n =
|
|
939
|
-
w = { kind: "sticker", type: U, start: n, current: n }, mt(),
|
|
939
|
+
const n = Xt(t);
|
|
940
|
+
w = { kind: "sticker", type: U, start: n, current: n }, mt(), $();
|
|
940
941
|
return;
|
|
941
942
|
}
|
|
942
|
-
|
|
943
|
+
$();
|
|
943
944
|
}
|
|
944
945
|
function pn(t, e) {
|
|
945
946
|
e.preventDefault(), e.stopPropagation();
|
|
946
|
-
const r = et().getBoundingClientRect(), n = f.list().find((
|
|
947
|
+
const r = et().getBoundingClientRect(), n = f.list().find((a) => a.id === t.id);
|
|
947
948
|
y = {
|
|
948
949
|
...t,
|
|
949
950
|
startX: e.clientX,
|
|
@@ -955,7 +956,7 @@ function pn(t, e) {
|
|
|
955
956
|
}
|
|
956
957
|
function Yt(t) {
|
|
957
958
|
if (w) {
|
|
958
|
-
w.current = w.kind === "crop" ? Z(t) :
|
|
959
|
+
w.current = w.kind === "crop" ? Z(t) : Xt(t), $();
|
|
959
960
|
return;
|
|
960
961
|
}
|
|
961
962
|
if (!y)
|
|
@@ -980,20 +981,20 @@ function Yt(t) {
|
|
|
980
981
|
y2: (n.y2 || n.y) + r
|
|
981
982
|
});
|
|
982
983
|
else {
|
|
983
|
-
const
|
|
984
|
-
gn(
|
|
984
|
+
const a = { x: n.x, y: n.y, w: n.w, h: n.h };
|
|
985
|
+
gn(a, y.dir, e, r), f.update(n.id, a);
|
|
985
986
|
}
|
|
986
|
-
|
|
987
|
+
$();
|
|
987
988
|
}
|
|
988
989
|
}
|
|
989
990
|
function gn(t, e, r, n) {
|
|
990
991
|
if (e.includes("e") && (t.w = Math.max(0.04, t.w + r)), e.includes("s") && (t.h = Math.max(0.04, t.h + n)), e.includes("w")) {
|
|
991
|
-
const
|
|
992
|
-
t.x += t.w -
|
|
992
|
+
const a = Math.max(0.04, t.w - r);
|
|
993
|
+
t.x += t.w - a, t.w = a;
|
|
993
994
|
}
|
|
994
995
|
if (e.includes("n")) {
|
|
995
|
-
const
|
|
996
|
-
t.y += t.h -
|
|
996
|
+
const a = Math.max(0.04, t.h - n);
|
|
997
|
+
t.y += t.h - a, t.h = a;
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
1000
|
function N(t) {
|
|
@@ -1004,9 +1005,9 @@ function N(t) {
|
|
|
1004
1005
|
if (y) {
|
|
1005
1006
|
if (y.kind === "sticker") {
|
|
1006
1007
|
const e = c.canvas.getBoundingClientRect();
|
|
1007
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (f.remove(y.id),
|
|
1008
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (f.remove(y.id), R = null);
|
|
1008
1009
|
}
|
|
1009
|
-
y = null,
|
|
1010
|
+
y = null, $();
|
|
1010
1011
|
}
|
|
1011
1012
|
}
|
|
1012
1013
|
function yn() {
|
|
@@ -1016,20 +1017,20 @@ function yn() {
|
|
|
1016
1017
|
if (t.kind === "crop") {
|
|
1017
1018
|
const r = nt(t.start, t.current);
|
|
1018
1019
|
if (Math.abs(t.current.x - t.start.x) < Pt || Math.abs(t.current.y - t.start.y) < Pt) {
|
|
1019
|
-
|
|
1020
|
+
$();
|
|
1020
1021
|
return;
|
|
1021
1022
|
}
|
|
1022
|
-
const
|
|
1023
|
+
const a = f.crop();
|
|
1023
1024
|
f.setCrop({
|
|
1024
|
-
x:
|
|
1025
|
-
y:
|
|
1026
|
-
w: r.w *
|
|
1027
|
-
h: r.h *
|
|
1028
|
-
}),
|
|
1025
|
+
x: a.x + r.x * a.w,
|
|
1026
|
+
y: a.y + r.y * a.h,
|
|
1027
|
+
w: r.w * a.w,
|
|
1028
|
+
h: r.h * a.h
|
|
1029
|
+
}), X();
|
|
1029
1030
|
return;
|
|
1030
1031
|
}
|
|
1031
1032
|
const e = wn(t);
|
|
1032
|
-
e && (
|
|
1033
|
+
e && (R = e.id), $();
|
|
1033
1034
|
}
|
|
1034
1035
|
function wn(t) {
|
|
1035
1036
|
if (t.type === "arrow") {
|
|
@@ -1053,7 +1054,7 @@ function wn(t) {
|
|
|
1053
1054
|
return f.add(t.type, nt(t.start, t.current));
|
|
1054
1055
|
}
|
|
1055
1056
|
function bn() {
|
|
1056
|
-
f.resetCrop(),
|
|
1057
|
+
f.resetCrop(), R = null, X();
|
|
1057
1058
|
}
|
|
1058
1059
|
function pt() {
|
|
1059
1060
|
c.resetCrop && (c.resetCrop.hidden = !f.isCropped());
|
|
@@ -1065,10 +1066,10 @@ function vt(t) {
|
|
|
1065
1066
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1066
1067
|
}
|
|
1067
1068
|
function xn() {
|
|
1068
|
-
S && (
|
|
1069
|
+
S && (j = S), S = "", c.stage.hidden = !0, c.restore.hidden = !j;
|
|
1069
1070
|
}
|
|
1070
1071
|
function vn() {
|
|
1071
|
-
|
|
1072
|
+
j && (S = j, c.stage.hidden = !1, c.restore.hidden = !0, X());
|
|
1072
1073
|
}
|
|
1073
1074
|
function Sn() {
|
|
1074
1075
|
try {
|
|
@@ -1090,23 +1091,23 @@ async function En() {
|
|
|
1090
1091
|
v("Video is disabled on this host.");
|
|
1091
1092
|
return;
|
|
1092
1093
|
}
|
|
1093
|
-
c.dialog.hidden = !0, c.stop.hidden = !1, tt(), c.launcher.hidden = !0,
|
|
1094
|
+
c.dialog.hidden = !0, c.stop.hidden = !1, tt(), c.launcher.hidden = !0, z = tn({
|
|
1094
1095
|
onStart() {
|
|
1095
1096
|
},
|
|
1096
1097
|
onStop(t) {
|
|
1097
|
-
L = t, c.stop.hidden = !0, c.launcher.hidden = !1, c.dialog.hidden = !1,
|
|
1098
|
+
L = t, c.stop.hidden = !0, c.launcher.hidden = !1, c.dialog.hidden = !1, X(), v(t ? "Video attached." : "Recording cancelled.");
|
|
1098
1099
|
},
|
|
1099
1100
|
onError(t) {
|
|
1100
1101
|
v(t.message);
|
|
1101
1102
|
}
|
|
1102
1103
|
});
|
|
1103
1104
|
try {
|
|
1104
|
-
await
|
|
1105
|
+
await z.start();
|
|
1105
1106
|
} catch (t) {
|
|
1106
1107
|
c.stop.hidden = !0, c.launcher.hidden = !1, c.dialog.hidden = !1, v(t.message);
|
|
1107
1108
|
}
|
|
1108
1109
|
}
|
|
1109
|
-
function
|
|
1110
|
+
function X() {
|
|
1110
1111
|
if (c.shot = null, !S) {
|
|
1111
1112
|
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = L ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>` : "", pt();
|
|
1112
1113
|
return;
|
|
@@ -1115,7 +1116,7 @@ function z() {
|
|
|
1115
1116
|
const t = c.shot.querySelector("img");
|
|
1116
1117
|
t.draggable = !1, t.addEventListener("dragstart", (r) => r.preventDefault());
|
|
1117
1118
|
const e = () => {
|
|
1118
|
-
Cn(t),
|
|
1119
|
+
Cn(t), $();
|
|
1119
1120
|
};
|
|
1120
1121
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1121
1122
|
}
|
|
@@ -1123,7 +1124,7 @@ function Cn(t) {
|
|
|
1123
1124
|
const e = t.naturalWidth || H.w, r = t.naturalHeight || H.h;
|
|
1124
1125
|
if (e && r && (H = { w: e, h: r }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / r)), c.canvas.style.aspectRatio = `${e} / ${r}`), !c.shot || !H.w || !H.h)
|
|
1125
1126
|
return;
|
|
1126
|
-
const n = f.crop(),
|
|
1127
|
+
const n = f.crop(), a = H.w / H.h, i = n.w / n.h * a, o = Math.min(1, i / a), s = Math.min(1, a / i);
|
|
1127
1128
|
c.shot.style.left = `${(1 - o) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${o * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / n.w}%`, t.style.height = `${100 / n.h}%`, t.style.left = `${-n.x / n.w * 100}%`, t.style.top = `${-n.y / n.h * 100}%`;
|
|
1128
1129
|
}
|
|
1129
1130
|
function Mn(t) {
|
|
@@ -1144,7 +1145,7 @@ function Mn(t) {
|
|
|
1144
1145
|
...nt(t.start, t.current)
|
|
1145
1146
|
};
|
|
1146
1147
|
}
|
|
1147
|
-
function
|
|
1148
|
+
function $() {
|
|
1148
1149
|
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !S || !c.shot) {
|
|
1149
1150
|
pt();
|
|
1150
1151
|
return;
|
|
@@ -1156,8 +1157,8 @@ function R() {
|
|
|
1156
1157
|
}
|
|
1157
1158
|
const r = f.list().slice();
|
|
1158
1159
|
if ((w == null ? void 0 : w.kind) === "sticker" && r.push(Mn(w)), r.forEach((n) => {
|
|
1159
|
-
const
|
|
1160
|
-
if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id,
|
|
1160
|
+
const a = n.id === "preview", i = !a && n.id === R, o = document.createElement("div");
|
|
1161
|
+
if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id, i && (o.dataset.selected = "true"), a && (o.dataset.preview = "true"), n.type === "arrow" ? $n(o, n, e, i) : (kt(o, n, e), i && ["nw", "ne", "sw", "se"].forEach((s) => gt(o, s))), !a && n.number) {
|
|
1161
1162
|
const s = document.createElement("span");
|
|
1162
1163
|
s.className = "nf-badge", s.textContent = String(n.number), o.appendChild(s);
|
|
1163
1164
|
}
|
|
@@ -1168,8 +1169,8 @@ function R() {
|
|
|
1168
1169
|
}
|
|
1169
1170
|
pt();
|
|
1170
1171
|
}
|
|
1171
|
-
function
|
|
1172
|
-
const
|
|
1172
|
+
function $n(t, e, r, n) {
|
|
1173
|
+
const a = et(), i = a.clientWidth, o = a.clientHeight, s = (e.x - r.x) / r.w * i, l = (e.y - r.y) / r.h * o, b = ((e.x2 ?? e.x + e.w) - r.x) / r.w * i, p = ((e.y2 ?? e.y) - r.y) / r.h * o, h = 18, g = Math.min(s, b) - h, P = Math.min(l, p) - h, d = Math.max(2, Math.abs(b - s)) + h * 2, m = Math.max(2, Math.abs(p - l)) + h * 2, T = s - g, A = l - P, k = b - g, V = p - P, B = `nf-ah-${e.id}`, I = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1173
1174
|
t.style.left = `${g}px`, t.style.top = `${P}px`, t.style.width = `${d}px`, t.style.height = `${m}px`, I.setAttribute("class", "nf-arrow-svg"), I.setAttribute("viewBox", `0 0 ${d} ${m}`), I.setAttribute("width", String(d)), I.setAttribute("height", String(m)), I.innerHTML = `
|
|
1174
1175
|
<defs>
|
|
1175
1176
|
<marker id="${B}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
@@ -1187,23 +1188,23 @@ function gt(t, e, r) {
|
|
|
1187
1188
|
function kt(t, e, r) {
|
|
1188
1189
|
t.style.left = `${(e.x - r.x) / r.w * 100}%`, t.style.top = `${(e.y - r.y) / r.h * 100}%`, t.style.width = `${e.w / r.w * 100}%`, t.style.height = `${e.h / r.h * 100}%`;
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
+
function Rn(t = {}) {
|
|
1191
1192
|
return x = {
|
|
1192
1193
|
...x,
|
|
1193
1194
|
...t,
|
|
1194
1195
|
endpoint: String(t.endpoint || x.endpoint || "").replace(/\/$/, ""),
|
|
1195
|
-
theme:
|
|
1196
|
+
theme: jt(t.theme ?? x.theme),
|
|
1196
1197
|
video: t.video == null ? x.video : !!t.video
|
|
1197
1198
|
}, bt(), tt(), Zt;
|
|
1198
1199
|
}
|
|
1199
1200
|
async function Kt() {
|
|
1200
|
-
bt(), tt(), c.launcher.hidden = !0, f = _t(), H = { w: 0, h: 0 }, L = null,
|
|
1201
|
+
bt(), tt(), c.launcher.hidden = !0, f = _t(), H = { w: 0, h: 0 }, L = null, R = null, w = null, y = null, J = "bug", ft("bug"), ht(null), vt(!1), c.text.value = "", v("Capturing…");
|
|
1201
1202
|
try {
|
|
1202
|
-
S = await Ye(),
|
|
1203
|
+
S = await Ye(), j = S, c.stage.hidden = !1, c.restore.hidden = !0;
|
|
1203
1204
|
} catch {
|
|
1204
1205
|
S = "", v("Screenshot failed; you can still send text.");
|
|
1205
1206
|
}
|
|
1206
|
-
c.dialog.hidden = !1,
|
|
1207
|
+
c.dialog.hidden = !1, X(), c.text.focus();
|
|
1207
1208
|
}
|
|
1208
1209
|
function rt() {
|
|
1209
1210
|
u && (W == null || W.stop(), vt(!1), Gt(), w = null, y = null, xt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, c.launcher.hidden = !1);
|
|
@@ -1222,9 +1223,9 @@ async function Jt() {
|
|
|
1222
1223
|
const e = new FormData();
|
|
1223
1224
|
if (e.append("message", t), e.append("kind", J), e.append("version", x.version || "0.0.0"), e.append("context", JSON.stringify({
|
|
1224
1225
|
...Ke(dt),
|
|
1225
|
-
console:
|
|
1226
|
+
console: zt.snapshot()
|
|
1226
1227
|
})), e.append("annotations", JSON.stringify(f.list())), Array.isArray(x.targets) && e.append("targets", JSON.stringify(x.targets)), S) {
|
|
1227
|
-
const
|
|
1228
|
+
const a = await an(
|
|
1228
1229
|
S,
|
|
1229
1230
|
f.crop(),
|
|
1230
1231
|
f.list(),
|
|
@@ -1233,7 +1234,7 @@ async function Jt() {
|
|
|
1233
1234
|
markText: Tt("--nf-mark-text", "#2a2140")
|
|
1234
1235
|
}
|
|
1235
1236
|
);
|
|
1236
|
-
e.append("screenshot",
|
|
1237
|
+
e.append("screenshot", a, "screenshot.png");
|
|
1237
1238
|
}
|
|
1238
1239
|
L && e.append("recording", L, "recording.webm");
|
|
1239
1240
|
const r = await fetch(`${x.endpoint}/v1/reports`, {
|
|
@@ -1256,14 +1257,14 @@ async function Jt() {
|
|
|
1256
1257
|
function Pn() {
|
|
1257
1258
|
rt(), u == null || u.remove(), u = null, c = {};
|
|
1258
1259
|
}
|
|
1259
|
-
const Zt = { init:
|
|
1260
|
+
const Zt = { init: Rn, open: Kt, close: rt, identify: Ln, submit: Jt, destroy: Pn };
|
|
1260
1261
|
typeof window < "u" && (window.Notefully = Zt);
|
|
1261
1262
|
export {
|
|
1262
1263
|
rt as close,
|
|
1263
1264
|
Zt as default,
|
|
1264
1265
|
Pn as destroy,
|
|
1265
1266
|
Ln as identify,
|
|
1266
|
-
|
|
1267
|
+
Rn as init,
|
|
1267
1268
|
Kt as open,
|
|
1268
1269
|
Jt as submit
|
|
1269
1270
|
};
|