@k34a/blog 0.0.17 → 0.0.19
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.
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Box as
|
|
4
|
-
import { IconHash as
|
|
5
|
-
import { BannerImage as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import { Box as o, Stack as g, Title as f, Text as s, Flex as h, Badge as u } from "@mantine/core";
|
|
4
|
+
import { IconHash as x } from "@tabler/icons-react";
|
|
5
|
+
import { BannerImage as D } from "./banner-image.js";
|
|
6
|
+
import w from "./description.js";
|
|
7
|
+
import { calculateReadingTime as T } from "../utils.js";
|
|
8
|
+
function I(e) {
|
|
9
|
+
const n = new Date(e.created_at), a = new Date(e.updated_at), r = (i) => i.toLocaleDateString("en-US", {
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "long",
|
|
12
|
+
day: "numeric"
|
|
13
|
+
}), m = e.description.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim(), d = T(m), l = a.getTime() !== n.getTime();
|
|
14
|
+
return /* @__PURE__ */ t(o, { maw: 800, mx: "auto", px: "sm", py: "lg", children: /* @__PURE__ */ c(g, { gap: "md", children: [
|
|
15
|
+
/* @__PURE__ */ t(f, { order: 1, children: e.title }),
|
|
16
|
+
/* @__PURE__ */ c(s, { size: "sm", c: "dimmed", children: [
|
|
17
|
+
d.text,
|
|
18
|
+
" · Written on ",
|
|
19
|
+
r(n),
|
|
20
|
+
l && ` · Updated on ${r(a)}`
|
|
21
|
+
] }),
|
|
22
|
+
e.banner_image && /* @__PURE__ */ t(
|
|
23
|
+
D,
|
|
12
24
|
{
|
|
13
25
|
id: e.id,
|
|
14
26
|
src: e.banner_image,
|
|
@@ -16,27 +28,27 @@ function b(e) {
|
|
|
16
28
|
config: e.config
|
|
17
29
|
}
|
|
18
30
|
),
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
w,
|
|
21
33
|
{
|
|
22
34
|
articleId: e.id,
|
|
23
35
|
html: e.description,
|
|
24
36
|
config: e.config
|
|
25
37
|
}
|
|
26
38
|
),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
39
|
+
/* @__PURE__ */ t(h, { wrap: "wrap", gap: "md", align: "center", mb: "lg", children: e.tags.map((i) => /* @__PURE__ */ t("a", { href: i.href, children: /* @__PURE__ */ t(
|
|
40
|
+
u,
|
|
29
41
|
{
|
|
30
42
|
size: "md",
|
|
31
43
|
color: "sky.5",
|
|
32
44
|
variant: "outline",
|
|
33
|
-
leftSection: /* @__PURE__ */
|
|
45
|
+
leftSection: /* @__PURE__ */ t(x, { size: 14 }),
|
|
34
46
|
style: { cursor: "pointer" },
|
|
35
|
-
children:
|
|
47
|
+
children: i.name
|
|
36
48
|
}
|
|
37
|
-
) },
|
|
49
|
+
) }, i.name)) })
|
|
38
50
|
] }) });
|
|
39
51
|
}
|
|
40
52
|
export {
|
|
41
|
-
|
|
53
|
+
I as default
|
|
42
54
|
};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export declare function applyImageFullPaths(html: string, getImageFullPath: (src: string) => string): string;
|
|
2
2
|
export declare function resolveImageForArticle(hostname: string, id: string, imageName: string): string;
|
|
3
|
+
export declare function calculateReadingTime(text: string): {
|
|
4
|
+
minutes: number;
|
|
5
|
+
text: string;
|
|
6
|
+
words: number;
|
|
7
|
+
};
|
package/dist/components/utils.js
CHANGED
|
@@ -77,7 +77,7 @@ var g;
|
|
|
77
77
|
(function(e) {
|
|
78
78
|
e[e.Legacy = 0] = "Legacy", e[e.Strict = 1] = "Strict", e[e.Attribute = 2] = "Attribute";
|
|
79
79
|
})(g || (g = {}));
|
|
80
|
-
class
|
|
80
|
+
class nu {
|
|
81
81
|
constructor(u, t, a) {
|
|
82
82
|
this.decodeTree = u, this.emitCodePoint = t, this.errors = a, this.state = h.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = g.Strict;
|
|
83
83
|
}
|
|
@@ -204,14 +204,14 @@ class du {
|
|
|
204
204
|
const { decodeTree: a } = this;
|
|
205
205
|
let i = a[this.treeIndex], s = (i & w.VALUE_LENGTH) >> 14;
|
|
206
206
|
for (; t < u.length; t++, this.excess++) {
|
|
207
|
-
const
|
|
208
|
-
if (this.treeIndex =
|
|
207
|
+
const n = u.charCodeAt(t);
|
|
208
|
+
if (this.treeIndex = du(a, i, this.treeIndex + Math.max(1, s), n), this.treeIndex < 0)
|
|
209
209
|
return this.result === 0 || // If we are parsing an attribute
|
|
210
210
|
this.decodeMode === g.Attribute && // We shouldn't have consumed any characters after the entity,
|
|
211
211
|
(s === 0 || // And there should be no invalid characters.
|
|
212
|
-
ru(
|
|
212
|
+
ru(n)) ? 0 : this.emitNotTerminatedNamedEntity();
|
|
213
213
|
if (i = a[this.treeIndex], s = (i & w.VALUE_LENGTH) >> 14, s !== 0) {
|
|
214
|
-
if (
|
|
214
|
+
if (n === x.SEMI)
|
|
215
215
|
return this.emitNamedEntityData(this.treeIndex, s, this.consumed + this.excess);
|
|
216
216
|
this.decodeMode !== g.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0);
|
|
217
217
|
}
|
|
@@ -265,7 +265,7 @@ class du {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function du(e, u, t, a) {
|
|
269
269
|
const i = (u & w.BRANCH_LENGTH) >> 7, s = u & w.JUMP_TABLE;
|
|
270
270
|
if (i === 0)
|
|
271
271
|
return s !== 0 && a === s ? t : -1;
|
|
@@ -273,11 +273,11 @@ function nu(e, u, t, a) {
|
|
|
273
273
|
const l = a - s;
|
|
274
274
|
return l < 0 || l >= i ? -1 : e[t + l] - 1;
|
|
275
275
|
}
|
|
276
|
-
let
|
|
277
|
-
for (;
|
|
278
|
-
const l =
|
|
276
|
+
let n = t, b = n + i - 1;
|
|
277
|
+
for (; n <= b; ) {
|
|
278
|
+
const l = n + b >>> 1, S = e[l];
|
|
279
279
|
if (S < a)
|
|
280
|
-
|
|
280
|
+
n = l + 1;
|
|
281
281
|
else if (S > a)
|
|
282
282
|
b = l - 1;
|
|
283
283
|
else
|
|
@@ -337,7 +337,7 @@ const o = {
|
|
|
337
337
|
};
|
|
338
338
|
class bu {
|
|
339
339
|
constructor({ xmlMode: u = !1, decodeEntities: t = !0 }, a) {
|
|
340
|
-
this.cbs = a, this.state = c.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.entityStart = 0, this.baseState = c.Text, this.isSpecial = !1, this.running = !0, this.offset = 0, this.currentSequence = void 0, this.sequenceIndex = 0, this.xmlMode = u, this.decodeEntities = t, this.entityDecoder = new
|
|
340
|
+
this.cbs = a, this.state = c.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.entityStart = 0, this.baseState = c.Text, this.isSpecial = !1, this.running = !0, this.offset = 0, this.currentSequence = void 0, this.sequenceIndex = 0, this.xmlMode = u, this.decodeEntities = t, this.entityDecoder = new nu(u ? eu : uu, (i, s) => this.emitCodePoint(i, s));
|
|
341
341
|
}
|
|
342
342
|
reset() {
|
|
343
343
|
this.state = c.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.baseState = c.Text, this.currentSequence = void 0, this.running = !0, this.offset = 0;
|
|
@@ -748,8 +748,8 @@ const E = /* @__PURE__ */ new Set([
|
|
|
748
748
|
]), hu = /\s|\//;
|
|
749
749
|
class xu {
|
|
750
750
|
constructor(u, t = {}) {
|
|
751
|
-
var a, i, s,
|
|
752
|
-
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (i = t.lowerCaseAttributeNames) !== null && i !== void 0 ? i : this.htmlMode, this.recognizeSelfClosing = (s = t.recognizeSelfClosing) !== null && s !== void 0 ? s : !this.htmlMode, this.tokenizer = new ((
|
|
751
|
+
var a, i, s, n, b, l;
|
|
752
|
+
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (i = t.lowerCaseAttributeNames) !== null && i !== void 0 ? i : this.htmlMode, this.recognizeSelfClosing = (s = t.recognizeSelfClosing) !== null && s !== void 0 ? s : !this.htmlMode, this.tokenizer = new ((n = t.Tokenizer) !== null && n !== void 0 ? n : bu)(this.options, this), this.foreignContext = [!this.htmlMode], (l = (b = this.cbs).onparserinit) === null || l === void 0 || l.call(b, this);
|
|
753
753
|
}
|
|
754
754
|
// Tokenizer event handlers
|
|
755
755
|
/** @internal */
|
|
@@ -779,9 +779,9 @@ class xu {
|
|
|
779
779
|
emitOpenTag(u) {
|
|
780
780
|
var t, a, i, s;
|
|
781
781
|
this.openTagStart = this.startIndex, this.tagname = u;
|
|
782
|
-
const
|
|
783
|
-
if (
|
|
784
|
-
for (; this.stack.length > 0 &&
|
|
782
|
+
const n = this.htmlMode && ou.get(u);
|
|
783
|
+
if (n)
|
|
784
|
+
for (; this.stack.length > 0 && n.has(this.stack[0]); ) {
|
|
785
785
|
const b = this.stack.shift();
|
|
786
786
|
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t, b, !0);
|
|
787
787
|
}
|
|
@@ -797,11 +797,11 @@ class xu {
|
|
|
797
797
|
}
|
|
798
798
|
/** @internal */
|
|
799
799
|
onclosetag(u, t) {
|
|
800
|
-
var a, i, s,
|
|
800
|
+
var a, i, s, n, b, l, S, I;
|
|
801
801
|
this.endIndex = t;
|
|
802
802
|
let m = this.getSlice(u, t);
|
|
803
803
|
if (this.lowerCaseTagNames && (m = m.toLowerCase()), this.htmlMode && (C.has(m) || G.has(m)) && this.foreignContext.shift(), this.isVoidElement(m))
|
|
804
|
-
this.htmlMode && m === "br" && ((
|
|
804
|
+
this.htmlMode && m === "br" && ((n = (s = this.cbs).onopentagname) === null || n === void 0 || n.call(s, "br"), (l = (b = this.cbs).onopentag) === null || l === void 0 || l.call(b, "br", {}, !0), (I = (S = this.cbs).onclosetag) === null || I === void 0 || I.call(S, "br", !1));
|
|
805
805
|
else {
|
|
806
806
|
const T = this.stack.indexOf(m);
|
|
807
807
|
if (T !== -1)
|
|
@@ -868,15 +868,15 @@ class xu {
|
|
|
868
868
|
}
|
|
869
869
|
/** @internal */
|
|
870
870
|
oncomment(u, t, a) {
|
|
871
|
-
var i, s,
|
|
872
|
-
this.endIndex = t, (s = (i = this.cbs).oncomment) === null || s === void 0 || s.call(i, this.getSlice(u, t - a)), (b = (
|
|
871
|
+
var i, s, n, b;
|
|
872
|
+
this.endIndex = t, (s = (i = this.cbs).oncomment) === null || s === void 0 || s.call(i, this.getSlice(u, t - a)), (b = (n = this.cbs).oncommentend) === null || b === void 0 || b.call(n), this.startIndex = t + 1;
|
|
873
873
|
}
|
|
874
874
|
/** @internal */
|
|
875
875
|
oncdata(u, t, a) {
|
|
876
|
-
var i, s,
|
|
876
|
+
var i, s, n, b, l, S, I, m, T, y;
|
|
877
877
|
this.endIndex = t;
|
|
878
878
|
const N = this.getSlice(u, t - a);
|
|
879
|
-
!this.htmlMode || this.options.recognizeCDATA ? ((s = (i = this.cbs).oncdatastart) === null || s === void 0 || s.call(i), (b = (
|
|
879
|
+
!this.htmlMode || this.options.recognizeCDATA ? ((s = (i = this.cbs).oncdatastart) === null || s === void 0 || s.call(i), (b = (n = this.cbs).ontext) === null || b === void 0 || b.call(n, N), (S = (l = this.cbs).oncdataend) === null || S === void 0 || S.call(l)) : ((m = (I = this.cbs).oncomment) === null || m === void 0 || m.call(I, `[CDATA[${N}]]`), (y = (T = this.cbs).oncommentend) === null || y === void 0 || y.call(T)), this.startIndex = t + 1;
|
|
880
880
|
}
|
|
881
881
|
/** @internal */
|
|
882
882
|
onend() {
|
|
@@ -974,14 +974,14 @@ class xu {
|
|
|
974
974
|
this.end(u);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
|
-
var
|
|
977
|
+
var d;
|
|
978
978
|
(function(e) {
|
|
979
979
|
e.Root = "root", e.Text = "text", e.Directive = "directive", e.Comment = "comment", e.Script = "script", e.Style = "style", e.Tag = "tag", e.CDATA = "cdata", e.Doctype = "doctype";
|
|
980
|
-
})(
|
|
980
|
+
})(d || (d = {}));
|
|
981
981
|
function mu(e) {
|
|
982
|
-
return e.type ===
|
|
982
|
+
return e.type === d.Tag || e.type === d.Script || e.type === d.Style;
|
|
983
983
|
}
|
|
984
|
-
const gu =
|
|
984
|
+
const gu = d.Root, pu = d.Text, Su = d.Directive, Au = d.Comment, wu = d.Script, yu = d.Style, Iu = d.Tag, Tu = d.CDATA, Eu = d.Doctype;
|
|
985
985
|
class z {
|
|
986
986
|
constructor() {
|
|
987
987
|
this.parent = null, this.prev = null, this.next = null, this.startIndex = null, this.endIndex = null;
|
|
@@ -1047,7 +1047,7 @@ class _ extends z {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
class L extends _ {
|
|
1049
1049
|
constructor() {
|
|
1050
|
-
super(...arguments), this.type =
|
|
1050
|
+
super(...arguments), this.type = d.Text;
|
|
1051
1051
|
}
|
|
1052
1052
|
get nodeType() {
|
|
1053
1053
|
return 3;
|
|
@@ -1055,7 +1055,7 @@ class L extends _ {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
class j extends _ {
|
|
1057
1057
|
constructor() {
|
|
1058
|
-
super(...arguments), this.type =
|
|
1058
|
+
super(...arguments), this.type = d.Comment;
|
|
1059
1059
|
}
|
|
1060
1060
|
get nodeType() {
|
|
1061
1061
|
return 8;
|
|
@@ -1063,13 +1063,13 @@ class j extends _ {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
class Q extends _ {
|
|
1065
1065
|
constructor(u, t) {
|
|
1066
|
-
super(t), this.name = u, this.type =
|
|
1066
|
+
super(t), this.name = u, this.type = d.Directive;
|
|
1067
1067
|
}
|
|
1068
1068
|
get nodeType() {
|
|
1069
1069
|
return 1;
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
|
-
class
|
|
1072
|
+
class M extends z {
|
|
1073
1073
|
/**
|
|
1074
1074
|
* @param children Children of the node. Only certain node types can have children.
|
|
1075
1075
|
*/
|
|
@@ -1097,29 +1097,29 @@ class R extends z {
|
|
|
1097
1097
|
this.children = u;
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
|
-
class W extends
|
|
1100
|
+
class W extends M {
|
|
1101
1101
|
constructor() {
|
|
1102
|
-
super(...arguments), this.type =
|
|
1102
|
+
super(...arguments), this.type = d.CDATA;
|
|
1103
1103
|
}
|
|
1104
1104
|
get nodeType() {
|
|
1105
1105
|
return 4;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
class B extends
|
|
1108
|
+
class B extends M {
|
|
1109
1109
|
constructor() {
|
|
1110
|
-
super(...arguments), this.type =
|
|
1110
|
+
super(...arguments), this.type = d.Root;
|
|
1111
1111
|
}
|
|
1112
1112
|
get nodeType() {
|
|
1113
1113
|
return 9;
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
|
-
class Z extends
|
|
1116
|
+
class Z extends M {
|
|
1117
1117
|
/**
|
|
1118
1118
|
* @param name Name of the tag, eg. `div`, `span`.
|
|
1119
1119
|
* @param attribs Object mapping attribute names to attribute values.
|
|
1120
1120
|
* @param children Children of the node.
|
|
1121
1121
|
*/
|
|
1122
|
-
constructor(u, t, a = [], i = u === "script" ?
|
|
1122
|
+
constructor(u, t, a = [], i = u === "script" ? d.Script : u === "style" ? d.Style : d.Tag) {
|
|
1123
1123
|
super(a), this.name = u, this.attribs = t, this.type = i;
|
|
1124
1124
|
}
|
|
1125
1125
|
get nodeType() {
|
|
@@ -1152,19 +1152,19 @@ function X(e) {
|
|
|
1152
1152
|
return mu(e);
|
|
1153
1153
|
}
|
|
1154
1154
|
function Nu(e) {
|
|
1155
|
-
return e.type ===
|
|
1155
|
+
return e.type === d.CDATA;
|
|
1156
1156
|
}
|
|
1157
1157
|
function vu(e) {
|
|
1158
|
-
return e.type ===
|
|
1158
|
+
return e.type === d.Text;
|
|
1159
1159
|
}
|
|
1160
1160
|
function qu(e) {
|
|
1161
|
-
return e.type ===
|
|
1161
|
+
return e.type === d.Comment;
|
|
1162
1162
|
}
|
|
1163
1163
|
function ku(e) {
|
|
1164
|
-
return e.type ===
|
|
1164
|
+
return e.type === d.Directive;
|
|
1165
1165
|
}
|
|
1166
1166
|
function Du(e) {
|
|
1167
|
-
return e.type ===
|
|
1167
|
+
return e.type === d.Root;
|
|
1168
1168
|
}
|
|
1169
1169
|
function Lu(e) {
|
|
1170
1170
|
return Object.prototype.hasOwnProperty.call(e, "children");
|
|
@@ -1231,12 +1231,12 @@ class Bu {
|
|
|
1231
1231
|
this.options.withEndIndices && (u.endIndex = this.parser.endIndex), this.elementCB && this.elementCB(u);
|
|
1232
1232
|
}
|
|
1233
1233
|
onopentag(u, t) {
|
|
1234
|
-
const a = this.options.xmlMode ?
|
|
1234
|
+
const a = this.options.xmlMode ? d.Tag : void 0, i = new Z(u, t, void 0, a);
|
|
1235
1235
|
this.addNode(i), this.tagStack.push(i);
|
|
1236
1236
|
}
|
|
1237
1237
|
ontext(u) {
|
|
1238
1238
|
const { lastNode: t } = this;
|
|
1239
|
-
if (t && t.type ===
|
|
1239
|
+
if (t && t.type === d.Text)
|
|
1240
1240
|
t.data += u, this.options.withEndIndices && (t.endIndex = this.parser.endIndex);
|
|
1241
1241
|
else {
|
|
1242
1242
|
const a = new L(u);
|
|
@@ -1244,7 +1244,7 @@ class Bu {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
oncomment(u) {
|
|
1247
|
-
if (this.lastNode && this.lastNode.type ===
|
|
1247
|
+
if (this.lastNode && this.lastNode.type === d.Comment) {
|
|
1248
1248
|
this.lastNode.data += u;
|
|
1249
1249
|
return;
|
|
1250
1250
|
}
|
|
@@ -1282,7 +1282,7 @@ const H = /["&'<>$\x80-\uFFFF]/g, _u = /* @__PURE__ */ new Map([
|
|
|
1282
1282
|
[39, "'"],
|
|
1283
1283
|
[60, "<"],
|
|
1284
1284
|
[62, ">"]
|
|
1285
|
-
]),
|
|
1285
|
+
]), Mu = (
|
|
1286
1286
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1287
1287
|
String.prototype.codePointAt != null ? (e, u) => e.codePointAt(u) : (
|
|
1288
1288
|
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
@@ -1292,20 +1292,20 @@ const H = /["&'<>$\x80-\uFFFF]/g, _u = /* @__PURE__ */ new Map([
|
|
|
1292
1292
|
function Y(e) {
|
|
1293
1293
|
let u = "", t = 0, a;
|
|
1294
1294
|
for (; (a = H.exec(e)) !== null; ) {
|
|
1295
|
-
const i = a.index, s = e.charCodeAt(i),
|
|
1296
|
-
|
|
1295
|
+
const i = a.index, s = e.charCodeAt(i), n = _u.get(s);
|
|
1296
|
+
n !== void 0 ? (u += e.substring(t, i) + n, t = i + 1) : (u += `${e.substring(t, i)}&#x${Mu(e, i).toString(16)};`, t = H.lastIndex += +((s & 64512) === 55296));
|
|
1297
1297
|
}
|
|
1298
1298
|
return u + e.substr(t);
|
|
1299
1299
|
}
|
|
1300
1300
|
function K(e, u) {
|
|
1301
1301
|
return function(a) {
|
|
1302
|
-
let i, s = 0,
|
|
1302
|
+
let i, s = 0, n = "";
|
|
1303
1303
|
for (; i = e.exec(a); )
|
|
1304
|
-
s !== i.index && (
|
|
1305
|
-
return
|
|
1304
|
+
s !== i.index && (n += a.substring(s, i.index)), n += u.get(i[0].charCodeAt(0)), s = i.index + 1;
|
|
1305
|
+
return n + a.substring(s);
|
|
1306
1306
|
};
|
|
1307
1307
|
}
|
|
1308
|
-
const
|
|
1308
|
+
const Ru = K(/["&\u00A0]/g, /* @__PURE__ */ new Map([
|
|
1309
1309
|
[34, """],
|
|
1310
1310
|
[38, "&"],
|
|
1311
1311
|
[160, " "]
|
|
@@ -1429,11 +1429,11 @@ function Gu(e, u) {
|
|
|
1429
1429
|
var t;
|
|
1430
1430
|
if (!e)
|
|
1431
1431
|
return;
|
|
1432
|
-
const a = ((t = u.encodeEntities) !== null && t !== void 0 ? t : u.decodeEntities) === !1 ? Cu : u.xmlMode || u.encodeEntities !== "utf8" ? Y :
|
|
1432
|
+
const a = ((t = u.encodeEntities) !== null && t !== void 0 ? t : u.decodeEntities) === !1 ? Cu : u.xmlMode || u.encodeEntities !== "utf8" ? Y : Ru;
|
|
1433
1433
|
return Object.keys(e).map((i) => {
|
|
1434
|
-
var s,
|
|
1434
|
+
var s, n;
|
|
1435
1435
|
const b = (s = e[i]) !== null && s !== void 0 ? s : "";
|
|
1436
|
-
return u.xmlMode === "foreign" && (i = (
|
|
1436
|
+
return u.xmlMode === "foreign" && (i = (n = Pu.get(i)) !== null && n !== void 0 ? n : i), !u.emptyAttrs && !u.xmlMode && b === "" ? i : `${i}="${a(b)}"`;
|
|
1437
1437
|
}).join(" ");
|
|
1438
1438
|
}
|
|
1439
1439
|
const $ = /* @__PURE__ */ new Set([
|
|
@@ -1457,7 +1457,7 @@ const $ = /* @__PURE__ */ new Set([
|
|
|
1457
1457
|
"track",
|
|
1458
1458
|
"wbr"
|
|
1459
1459
|
]);
|
|
1460
|
-
function
|
|
1460
|
+
function R(e, u = {}) {
|
|
1461
1461
|
const t = "length" in e ? e : [e];
|
|
1462
1462
|
let a = "";
|
|
1463
1463
|
for (let i = 0; i < t.length; i++)
|
|
@@ -1467,7 +1467,7 @@ function M(e, u = {}) {
|
|
|
1467
1467
|
function Fu(e, u) {
|
|
1468
1468
|
switch (e.type) {
|
|
1469
1469
|
case gu:
|
|
1470
|
-
return
|
|
1470
|
+
return R(e.children, u);
|
|
1471
1471
|
// @ts-expect-error We don't use `Doctype` yet
|
|
1472
1472
|
case Eu:
|
|
1473
1473
|
case Su:
|
|
@@ -1506,7 +1506,7 @@ function zu(e, u) {
|
|
|
1506
1506
|
) : (
|
|
1507
1507
|
// User explicitly asked for self-closing tags, even in HTML mode
|
|
1508
1508
|
u.selfClosingTags && $.has(e.name)
|
|
1509
|
-
)) ? (u.xmlMode || (a += " "), a += "/>") : (a += ">", e.children.length > 0 && (a +=
|
|
1509
|
+
)) ? (u.xmlMode || (a += " "), a += "/>") : (a += ">", e.children.length > 0 && (a += R(e.children, u)), (u.xmlMode || !$.has(e.name)) && (a += `</${e.name}>`)), a;
|
|
1510
1510
|
}
|
|
1511
1511
|
function ju(e) {
|
|
1512
1512
|
return `<${e.data}>`;
|
|
@@ -1549,12 +1549,21 @@ function Yu(e, u) {
|
|
|
1549
1549
|
const s = i.attribs?.src;
|
|
1550
1550
|
s && (i.attribs.src = u(s));
|
|
1551
1551
|
}
|
|
1552
|
-
return
|
|
1552
|
+
return R(t);
|
|
1553
1553
|
}
|
|
1554
1554
|
function Ku(e, u, t) {
|
|
1555
1555
|
return t.startsWith("http") ? t : t.startsWith("articles/") ? `https://${e}/storage/v1/object/public/content/${t}` : `https://${e}/storage/v1/object/public/content/articles/${u}/${t.trim()}`;
|
|
1556
1556
|
}
|
|
1557
|
+
function u0(e) {
|
|
1558
|
+
const u = e.trim().split(/\s+/).length, a = Math.max(1, Math.ceil(u / 200));
|
|
1559
|
+
return {
|
|
1560
|
+
minutes: a,
|
|
1561
|
+
text: `${a} min read`,
|
|
1562
|
+
words: u
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1557
1565
|
export {
|
|
1558
1566
|
Yu as applyImageFullPaths,
|
|
1567
|
+
u0 as calculateReadingTime,
|
|
1559
1568
|
Ku as resolveImageForArticle
|
|
1560
1569
|
};
|