reactjs-tiptap-editor 0.3.30 → 0.4.0
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 +8 -2
- package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
- package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-DKRF6oa0.js} +5 -5
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +47 -51
- package/lib/Attachment.d.ts +47 -51
- package/lib/Attachment.js +7 -6
- package/lib/BaseKit.cjs +3 -0
- package/lib/BaseKit.d.cts +481 -0
- package/lib/BaseKit.d.ts +481 -0
- package/lib/BaseKit.js +132 -0
- package/lib/Blockquote.cjs +5 -1
- package/lib/Blockquote.d.cts +47 -51
- package/lib/Blockquote.d.ts +47 -51
- package/lib/Blockquote.js +33 -17
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +47 -51
- package/lib/Bold.d.ts +47 -51
- package/lib/Bold.js +23 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +48 -52
- package/lib/BulletList.d.ts +48 -52
- package/lib/BulletList.js +11 -57
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +47 -51
- package/lib/Clear.d.ts +47 -51
- package/lib/Clear.js +4 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +47 -51
- package/lib/Code.d.ts +47 -51
- package/lib/Code.js +29 -25
- package/lib/CodeBlock.cjs +2 -2
- package/lib/CodeBlock.d.cts +47 -51
- package/lib/CodeBlock.d.ts +47 -51
- package/lib/CodeBlock.js +5 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +47 -51
- package/lib/CodeView.d.ts +47 -51
- package/lib/CodeView.js +3 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +48 -52
- package/lib/Color.d.ts +48 -52
- package/lib/Color.js +42 -74
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +47 -51
- package/lib/Document.d.ts +47 -51
- package/lib/Document.js +4 -8
- package/lib/{Drawer-BKTU9CpU.js → Drawer-CaAfmqNo.js} +268 -265
- package/lib/Drawer-CdvCMSzN.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +47 -51
- package/lib/Drawer.d.ts +47 -51
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +50 -52
- package/lib/Emoji.d.ts +50 -52
- package/lib/Emoji.js +19790 -178
- package/lib/Excalidraw-BbMQhNvs.cjs +1 -0
- package/lib/Excalidraw-CVWz2Vyn.js +290 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +47 -51
- package/lib/Excalidraw.d.ts +47 -51
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +47 -51
- package/lib/ExportPdf.d.ts +47 -51
- package/lib/ExportPdf.js +4 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +47 -51
- package/lib/ExportWord.d.ts +47 -51
- package/lib/ExportWord.js +22 -51
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +48 -52
- package/lib/FontFamily.d.ts +48 -52
- package/lib/FontFamily.js +46 -74
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +47 -51
- package/lib/FontSize.d.ts +47 -51
- package/lib/FontSize.js +11 -8
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +47 -51
- package/lib/FormatPainter.d.ts +47 -51
- package/lib/FormatPainter.js +4 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +47 -51
- package/lib/Heading.d.ts +47 -51
- package/lib/Heading.js +77 -65
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +47 -51
- package/lib/Highlight.d.ts +47 -51
- package/lib/Highlight.js +5 -4
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +49 -53
- package/lib/History.d.ts +49 -53
- package/lib/History.js +39 -403
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +47 -51
- package/lib/HorizontalRule.d.ts +47 -51
- package/lib/HorizontalRule.js +16 -65
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +47 -51
- package/lib/Iframe.d.ts +47 -51
- package/lib/Iframe.js +4 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +47 -51
- package/lib/Image.d.ts +47 -51
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +47 -51
- package/lib/ImageGif.d.ts +47 -51
- package/lib/ImageGif.js +5 -5
- package/lib/ImportWord.cjs +72 -72
- package/lib/ImportWord.d.cts +47 -51
- package/lib/ImportWord.d.ts +47 -51
- package/lib/ImportWord.js +5654 -5616
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +47 -51
- package/lib/Indent.d.ts +47 -51
- package/lib/Indent.js +4 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +47 -51
- package/lib/Italic.d.ts +47 -51
- package/lib/Italic.js +20 -14
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +47 -51
- package/lib/Katex.d.ts +47 -51
- package/lib/Katex.js +49 -48
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +47 -51
- package/lib/LineHeight.d.ts +47 -51
- package/lib/LineHeight.js +21 -18
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +47 -51
- package/lib/Link.d.ts +47 -51
- package/lib/Link.js +4 -4
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +52 -52
- package/lib/ListItem.d.ts +52 -52
- package/lib/ListItem.js +4 -30
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +47 -51
- package/lib/Mention.d.ts +47 -51
- package/lib/Mention.js +161 -132
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +47 -51
- package/lib/Mermaid.d.ts +47 -51
- package/lib/Mermaid.js +150 -147
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +47 -51
- package/lib/MoreMark.d.ts +47 -51
- package/lib/MoreMark.js +5 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +47 -51
- package/lib/MultiColumn.d.ts +47 -51
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +48 -52
- package/lib/OrderedList.d.ts +48 -52
- package/lib/OrderedList.js +11 -75
- package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
- package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +60 -134
- package/lib/SearchAndReplace.d.ts +60 -134
- package/lib/SearchAndReplace.js +207 -194
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +47 -51
- package/lib/Selection.d.ts +47 -51
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +47 -51
- package/lib/SlashCommand.d.ts +47 -51
- package/lib/SlashCommand.js +177 -222
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +47 -51
- package/lib/Strike.d.ts +47 -51
- package/lib/Strike.js +20 -14
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +47 -51
- package/lib/SubAndSuperScript.d.ts +47 -51
- package/lib/SubAndSuperScript.js +5 -3
- package/lib/Table.cjs +8 -10
- package/lib/Table.d.cts +50 -54
- package/lib/Table.d.ts +50 -54
- package/lib/Table.js +382 -2021
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +47 -51
- package/lib/TableOfContent.d.ts +47 -51
- package/lib/TableOfContent.js +53 -52
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +49 -53
- package/lib/TaskList.d.ts +49 -53
- package/lib/TaskList.js +12 -154
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +47 -51
- package/lib/TextAlign.d.ts +47 -51
- package/lib/TextAlign.js +11 -8
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +47 -51
- package/lib/TextBubble.d.ts +47 -51
- package/lib/TextBubble.js +5 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +47 -51
- package/lib/TextDirection.d.ts +47 -51
- package/lib/TextDirection.js +15 -15
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +47 -51
- package/lib/TextUnderline.d.ts +47 -51
- package/lib/TextUnderline.js +40 -12
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +47 -51
- package/lib/TrailingNode.d.ts +47 -51
- package/lib/TrailingNode.js +1 -1
- package/lib/Twitter-BFULyqdR.js +1628 -0
- package/lib/Twitter-Cutpkh3h.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +47 -51
- package/lib/Twitter.d.ts +47 -51
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +47 -51
- package/lib/Video.d.ts +47 -51
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +47 -51
- package/lib/bubble-extra.d.ts +47 -51
- package/lib/bubble-extra.js +200 -192
- package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
- package/lib/dom-dataset-lYeH6gfI.js +2361 -0
- package/lib/index-5iBZLua9.cjs +12 -0
- package/lib/index-6D1J-A-o.cjs +1 -0
- package/lib/index-B96Cclrj.cjs +3 -0
- package/lib/index-BBz7Nmv9.js +55 -0
- package/lib/index-BeCTd5v2.cjs +1 -0
- package/lib/index-ByurDDMv.js +237 -0
- package/lib/index-CUogRI7j.cjs +1 -0
- package/lib/index-Ch6dBBad.js +709 -0
- package/lib/index-DF2Lp4HZ.cjs +100 -0
- package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
- package/lib/index-Dbvi-Bvh.cjs +1 -0
- package/lib/index-DpCrt7xs.cjs +1 -0
- package/lib/index-DsAX1Vq8.cjs +1 -0
- package/lib/index-Dy4DlW9o.js +12 -0
- package/lib/index-J3jHHZ4d.js +200 -0
- package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
- package/lib/index-VvXaaKe3.js +898 -0
- package/lib/index-kbO3iWqL.js +13432 -0
- package/lib/index.cjs +1 -2
- package/lib/index.d.cts +49 -251
- package/lib/index.d.ts +49 -251
- package/lib/index.js +2 -588
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +47 -51
- package/lib/locale-bundle.d.ts +47 -51
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-D5WVZMgt.cjs → textarea-DFo_aXnj.cjs} +1 -1
- package/lib/{textarea-BglwYF6b.js → textarea-aPtytkDx.js} +1 -1
- package/package.json +76 -70
- package/lib/Drawer-CmoEF-Zg.cjs +0 -1
- package/lib/Excalidraw-CM74U5tG.js +0 -289
- package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
- package/lib/RichTextEditor-BQN2eLD_.js +0 -12775
- package/lib/RichTextEditor-C8Sm1E6J.cjs +0 -140
- package/lib/Twitter-CL2pu4QM.cjs +0 -17
- package/lib/Twitter-Dg6WWauX.js +0 -1743
- package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
- package/lib/dom-dataset-Di3tIRrR.js +0 -1031
- package/lib/index-BI-IcZcN.cjs +0 -1
- package/lib/index-ByRfqzMr.cjs +0 -89
- package/lib/index-C1fzuXpN.js +0 -46
- package/lib/index-CbQQFj2T.js +0 -133
- package/lib/index-DI9T3iLd.js +0 -12354
- package/lib/index-D_A0TBRA.cjs +0 -1
- package/lib/index-DclQSrIx.cjs +0 -1
- package/lib/index-Z4b9rzn-.cjs +0 -1
|
@@ -0,0 +1,1628 @@
|
|
|
1
|
+
import { N as Dt, m as At, V as Vt } from "./index-kbO3iWqL.js";
|
|
2
|
+
import { c as U, s as rt, N as Mt, R as jt } from "./dom-dataset-lYeH6gfI.js";
|
|
3
|
+
import { jsx as r, jsxs as f, Fragment as Wt } from "react/jsx-runtime";
|
|
4
|
+
import Be, { useState as de, Fragment as Bt, useEffect as Fe, useMemo as Pe, createContext as Ft, useLayoutEffect as Pt, useContext as Ut, useRef as K, useCallback as Te, useDebugValue as zt } from "react";
|
|
5
|
+
import { L as Ht, q as Gt, B as Xt, P as Kt, o as Qt, A as Jt, f as Yt, p as Zt } from "./RichTextEditor-DGcKEUGr.js";
|
|
6
|
+
import { u as en } from "./index-LmrOdnen.js";
|
|
7
|
+
const tn = "_verified_lvyh0_1", Ue = {
|
|
8
|
+
verified: tn
|
|
9
|
+
}, nn = () => /* @__PURE__ */ r("svg", {
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
"aria-label": "Verified account",
|
|
12
|
+
role: "img",
|
|
13
|
+
className: Ue.verified,
|
|
14
|
+
children: /* @__PURE__ */ r("g", {
|
|
15
|
+
children: /* @__PURE__ */ r("path", {
|
|
16
|
+
d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z"
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
}), rn = () => /* @__PURE__ */ r("svg", {
|
|
20
|
+
viewBox: "0 0 22 22",
|
|
21
|
+
"aria-label": "Verified account",
|
|
22
|
+
role: "img",
|
|
23
|
+
className: Ue.verified,
|
|
24
|
+
children: /* @__PURE__ */ f("g", {
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ f("linearGradient", {
|
|
27
|
+
gradientUnits: "userSpaceOnUse",
|
|
28
|
+
id: "0-a",
|
|
29
|
+
x1: "4.411",
|
|
30
|
+
x2: "18.083",
|
|
31
|
+
y1: "2.495",
|
|
32
|
+
y2: "21.508",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ r("stop", {
|
|
35
|
+
offset: "0",
|
|
36
|
+
stopColor: "#f4e72a"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ r("stop", {
|
|
39
|
+
offset: ".539",
|
|
40
|
+
stopColor: "#cd8105"
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ r("stop", {
|
|
43
|
+
offset: ".68",
|
|
44
|
+
stopColor: "#cb7b00"
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ r("stop", {
|
|
47
|
+
offset: "1",
|
|
48
|
+
stopColor: "#f4ec26"
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ r("stop", {
|
|
51
|
+
offset: "1",
|
|
52
|
+
stopColor: "#f4e72a"
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ f("linearGradient", {
|
|
57
|
+
gradientUnits: "userSpaceOnUse",
|
|
58
|
+
id: "0-b",
|
|
59
|
+
x1: "5.355",
|
|
60
|
+
x2: "16.361",
|
|
61
|
+
y1: "3.395",
|
|
62
|
+
y2: "19.133",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ r("stop", {
|
|
65
|
+
offset: "0",
|
|
66
|
+
stopColor: "#f9e87f"
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ r("stop", {
|
|
69
|
+
offset: ".406",
|
|
70
|
+
stopColor: "#e2b719"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ r("stop", {
|
|
73
|
+
offset: ".989",
|
|
74
|
+
stopColor: "#e2b719"
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ f("g", {
|
|
79
|
+
clipRule: "evenodd",
|
|
80
|
+
fillRule: "evenodd",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ r("path", {
|
|
83
|
+
d: "M13.324 3.848L11 1.6 8.676 3.848l-3.201-.453-.559 3.184L2.06 8.095 3.48 11l-1.42 2.904 2.856 1.516.559 3.184 3.201-.452L11 20.4l2.324-2.248 3.201.452.559-3.184 2.856-1.516L18.52 11l1.42-2.905-2.856-1.516-.559-3.184zm-7.09 7.575l3.428 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",
|
|
84
|
+
fill: "url(#0-a)"
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ r("path", {
|
|
87
|
+
d: "M13.101 4.533L11 2.5 8.899 4.533l-2.895-.41-.505 2.88-2.583 1.37L4.2 11l-1.284 2.627 2.583 1.37.505 2.88 2.895-.41L11 19.5l2.101-2.033 2.895.41.505-2.88 2.583-1.37L17.8 11l1.284-2.627-2.583-1.37-.505-2.88zm-6.868 6.89l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",
|
|
88
|
+
fill: "url(#0-b)"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ r("path", {
|
|
91
|
+
d: "M6.233 11.423l3.429 3.428 5.65-6.17.038-.033-.005 1.398-5.683 6.206-3.429-3.429-.003-1.405.005.003z",
|
|
92
|
+
fill: "#d18800"
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
}), on = () => /* @__PURE__ */ r("svg", {
|
|
99
|
+
viewBox: "0 0 22 22",
|
|
100
|
+
"aria-label": "Verified account",
|
|
101
|
+
role: "img",
|
|
102
|
+
className: Ue.verified,
|
|
103
|
+
children: /* @__PURE__ */ r("g", {
|
|
104
|
+
children: /* @__PURE__ */ r("path", {
|
|
105
|
+
clipRule: "evenodd",
|
|
106
|
+
d: "M12.05 2.056c-.568-.608-1.532-.608-2.1 0l-1.393 1.49c-.284.303-.685.47-1.1.455L5.42 3.932c-.832-.028-1.514.654-1.486 1.486l.069 2.039c.014.415-.152.816-.456 1.1l-1.49 1.392c-.608.568-.608 1.533 0 2.101l1.49 1.393c.304.284.47.684.456 1.1l-.07 2.038c-.027.832.655 1.514 1.487 1.486l2.038-.069c.415-.014.816.152 1.1.455l1.392 1.49c.569.609 1.533.609 2.102 0l1.393-1.49c.283-.303.684-.47 1.099-.455l2.038.069c.832.028 1.515-.654 1.486-1.486L18 14.542c-.015-.415.152-.815.455-1.099l1.49-1.393c.608-.568.608-1.533 0-2.101l-1.49-1.393c-.303-.283-.47-.684-.455-1.1l.068-2.038c.029-.832-.654-1.514-1.486-1.486l-2.038.07c-.415.013-.816-.153-1.1-.456zm-5.817 9.367l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",
|
|
107
|
+
fillRule: "evenodd"
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
}), an = "_root_98iqw_1", sn = "_article_98iqw_21", ot = {
|
|
111
|
+
root: an,
|
|
112
|
+
article: sn
|
|
113
|
+
}, ze = ({ className: e, children: t }) => /* @__PURE__ */ r("div", {
|
|
114
|
+
className: U("react-tweet-theme", ot.root, e),
|
|
115
|
+
children: /* @__PURE__ */ r("article", {
|
|
116
|
+
className: ot.article,
|
|
117
|
+
children: t
|
|
118
|
+
})
|
|
119
|
+
}), vt = (e) => /* @__PURE__ */ r("img", {
|
|
120
|
+
...e
|
|
121
|
+
}), cn = "_header_nqq4j_1", ln = "_avatar_nqq4j_11", dn = "_avatarOverflow_nqq4j_16", un = "_avatarSquare_nqq4j_23", fn = "_avatarShadow_nqq4j_26", hn = "_author_nqq4j_37", _n = "_authorLink_nqq4j_44", mn = "_authorVerified_nqq4j_53", pn = "_authorLinkText_nqq4j_56", vn = "_authorMeta_nqq4j_63", gn = "_authorFollow_nqq4j_66", wn = "_username_nqq4j_69", yn = "_follow_nqq4j_74", bn = "_separator_nqq4j_82", Tn = "_brand_nqq4j_86", xn = "_twitterIcon_nqq4j_90", N = {
|
|
122
|
+
header: cn,
|
|
123
|
+
avatar: ln,
|
|
124
|
+
avatarOverflow: dn,
|
|
125
|
+
avatarSquare: un,
|
|
126
|
+
avatarShadow: fn,
|
|
127
|
+
author: hn,
|
|
128
|
+
authorLink: _n,
|
|
129
|
+
authorVerified: mn,
|
|
130
|
+
authorLinkText: pn,
|
|
131
|
+
authorMeta: vn,
|
|
132
|
+
authorFollow: gn,
|
|
133
|
+
username: wn,
|
|
134
|
+
follow: yn,
|
|
135
|
+
separator: bn,
|
|
136
|
+
brand: Tn,
|
|
137
|
+
twitterIcon: xn
|
|
138
|
+
}, Nn = "_verifiedOld_lcna5_1", Rn = "_verifiedBlue_lcna5_4", kn = "_verifiedGovernment_lcna5_7", xe = {
|
|
139
|
+
verifiedOld: Nn,
|
|
140
|
+
verifiedBlue: Rn,
|
|
141
|
+
verifiedGovernment: kn
|
|
142
|
+
}, gt = ({ user: e, className: t }) => {
|
|
143
|
+
const n = e.verified || e.is_blue_verified || e.verified_type;
|
|
144
|
+
let o = /* @__PURE__ */ r(nn, {}), i = xe.verifiedBlue;
|
|
145
|
+
if (n)
|
|
146
|
+
switch (e.is_blue_verified || (i = xe.verifiedOld), e.verified_type) {
|
|
147
|
+
case "Government":
|
|
148
|
+
o = /* @__PURE__ */ r(on, {}), i = xe.verifiedGovernment;
|
|
149
|
+
break;
|
|
150
|
+
case "Business":
|
|
151
|
+
o = /* @__PURE__ */ r(rn, {}), i = null;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return n ? /* @__PURE__ */ r("div", {
|
|
155
|
+
className: U(t, i),
|
|
156
|
+
children: o
|
|
157
|
+
}) : null;
|
|
158
|
+
}, In = ({ tweet: e, components: t }) => {
|
|
159
|
+
var n;
|
|
160
|
+
const o = (n = t == null ? void 0 : t.AvatarImg) != null ? n : vt, { user: i } = e;
|
|
161
|
+
return /* @__PURE__ */ f("div", {
|
|
162
|
+
className: N.header,
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ f("a", {
|
|
165
|
+
href: e.url,
|
|
166
|
+
className: N.avatar,
|
|
167
|
+
target: "_blank",
|
|
168
|
+
rel: "noopener noreferrer",
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ r("div", {
|
|
171
|
+
className: U(N.avatarOverflow, i.profile_image_shape === "Square" && N.avatarSquare),
|
|
172
|
+
children: /* @__PURE__ */ r(o, {
|
|
173
|
+
src: i.profile_image_url_https,
|
|
174
|
+
alt: i.name,
|
|
175
|
+
width: 48,
|
|
176
|
+
height: 48
|
|
177
|
+
})
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ r("div", {
|
|
180
|
+
className: N.avatarOverflow,
|
|
181
|
+
children: /* @__PURE__ */ r("div", {
|
|
182
|
+
className: N.avatarShadow
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ f("div", {
|
|
188
|
+
className: N.author,
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ f("a", {
|
|
191
|
+
href: e.url,
|
|
192
|
+
className: N.authorLink,
|
|
193
|
+
target: "_blank",
|
|
194
|
+
rel: "noopener noreferrer",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ r("div", {
|
|
197
|
+
className: N.authorLinkText,
|
|
198
|
+
children: /* @__PURE__ */ r("span", {
|
|
199
|
+
title: i.name,
|
|
200
|
+
children: i.name
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ r(gt, {
|
|
204
|
+
user: i,
|
|
205
|
+
className: N.authorVerified
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ f("div", {
|
|
210
|
+
className: N.authorMeta,
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ r("a", {
|
|
213
|
+
href: e.url,
|
|
214
|
+
className: N.username,
|
|
215
|
+
target: "_blank",
|
|
216
|
+
rel: "noopener noreferrer",
|
|
217
|
+
children: /* @__PURE__ */ f("span", {
|
|
218
|
+
title: `@${i.screen_name}`,
|
|
219
|
+
children: [
|
|
220
|
+
"@",
|
|
221
|
+
i.screen_name
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ f("div", {
|
|
226
|
+
className: N.authorFollow,
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ r("span", {
|
|
229
|
+
className: N.separator,
|
|
230
|
+
children: "·"
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ r("a", {
|
|
233
|
+
href: i.follow_url,
|
|
234
|
+
className: N.follow,
|
|
235
|
+
target: "_blank",
|
|
236
|
+
rel: "noopener noreferrer",
|
|
237
|
+
children: "Follow"
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ r("a", {
|
|
246
|
+
href: e.url,
|
|
247
|
+
className: N.brand,
|
|
248
|
+
target: "_blank",
|
|
249
|
+
rel: "noopener noreferrer",
|
|
250
|
+
"aria-label": "View on Twitter",
|
|
251
|
+
children: /* @__PURE__ */ r("svg", {
|
|
252
|
+
viewBox: "0 0 24 24",
|
|
253
|
+
"aria-hidden": "true",
|
|
254
|
+
className: N.twitterIcon,
|
|
255
|
+
children: /* @__PURE__ */ r("g", {
|
|
256
|
+
children: /* @__PURE__ */ r("path", {
|
|
257
|
+
d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
}, Sn = "_root_1ec15_1", En = {
|
|
265
|
+
root: Sn
|
|
266
|
+
}, Cn = ({ tweet: e }) => /* @__PURE__ */ f("a", {
|
|
267
|
+
href: e.in_reply_to_url,
|
|
268
|
+
className: En.root,
|
|
269
|
+
target: "_blank",
|
|
270
|
+
rel: "noopener noreferrer",
|
|
271
|
+
children: [
|
|
272
|
+
"Replying to @",
|
|
273
|
+
e.in_reply_to_screen_name
|
|
274
|
+
]
|
|
275
|
+
}), Ln = "_root_eihfa_1", On = {
|
|
276
|
+
root: Ln
|
|
277
|
+
}, qn = ({ href: e, children: t }) => /* @__PURE__ */ r("a", {
|
|
278
|
+
href: e,
|
|
279
|
+
className: On.root,
|
|
280
|
+
target: "_blank",
|
|
281
|
+
rel: "noopener noreferrer nofollow",
|
|
282
|
+
children: t
|
|
283
|
+
}), $n = "_root_1xq52_1", Dn = {
|
|
284
|
+
root: $n
|
|
285
|
+
}, An = ({ tweet: e }) => /* @__PURE__ */ r("p", {
|
|
286
|
+
className: Dn.root,
|
|
287
|
+
lang: e.lang,
|
|
288
|
+
dir: "auto",
|
|
289
|
+
children: e.entities.map((t, n) => {
|
|
290
|
+
switch (t.type) {
|
|
291
|
+
case "hashtag":
|
|
292
|
+
case "mention":
|
|
293
|
+
case "url":
|
|
294
|
+
case "symbol":
|
|
295
|
+
return /* @__PURE__ */ r(qn, {
|
|
296
|
+
href: t.href,
|
|
297
|
+
children: t.text
|
|
298
|
+
}, n);
|
|
299
|
+
case "media":
|
|
300
|
+
return;
|
|
301
|
+
default:
|
|
302
|
+
return /* @__PURE__ */ r("span", {
|
|
303
|
+
dangerouslySetInnerHTML: {
|
|
304
|
+
__html: t.text
|
|
305
|
+
}
|
|
306
|
+
}, n);
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
}), it = (e) => `https://x.com/${e.user.screen_name}/status/${e.id_str}`, wt = (e) => `https://x.com/${typeof e == "string" ? e : e.user.screen_name}`, Vn = (e) => `https://x.com/intent/like?tweet_id=${e.id_str}`, Mn = (e) => `https://x.com/intent/tweet?in_reply_to=${e.id_str}`, jn = (e) => `https://x.com/intent/follow?screen_name=${e.user.screen_name}`, Wn = (e) => `https://x.com/hashtag/${e.text}`, Bn = (e) => `https://x.com/search?q=%24${e.text}`, Fn = (e) => `https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`, yt = (e, t) => {
|
|
310
|
+
const n = new URL(e.media_url_https), o = n.pathname.split(".").pop();
|
|
311
|
+
return o ? (n.pathname = n.pathname.replace(`.${o}`, ""), n.searchParams.set("format", o), n.searchParams.set("name", t), n.toString()) : e.media_url_https;
|
|
312
|
+
}, Pn = (e) => {
|
|
313
|
+
const { variants: t } = e.video_info;
|
|
314
|
+
return t.filter((o) => o.content_type === "video/mp4").sort((o, i) => {
|
|
315
|
+
var s, a;
|
|
316
|
+
return ((s = i.bitrate) != null ? s : 0) - ((a = o.bitrate) != null ? a : 0);
|
|
317
|
+
});
|
|
318
|
+
}, Un = (e) => {
|
|
319
|
+
const t = Pn(e);
|
|
320
|
+
return t.length > 1 ? t[1] : t[0];
|
|
321
|
+
}, Oe = (e) => e > 999999 ? `${(e / 1e6).toFixed(1)}M` : e > 999 ? `${(e / 1e3).toFixed(1)}K` : e.toString();
|
|
322
|
+
function at(e) {
|
|
323
|
+
const t = Array.from(e.text), n = [
|
|
324
|
+
{
|
|
325
|
+
indices: e.display_text_range,
|
|
326
|
+
type: "text"
|
|
327
|
+
}
|
|
328
|
+
];
|
|
329
|
+
return le(n, "hashtag", e.entities.hashtags), le(n, "mention", e.entities.user_mentions), le(n, "url", e.entities.urls), le(n, "symbol", e.entities.symbols), e.entities.media && le(n, "media", e.entities.media), zn(e, n), n.map((o) => {
|
|
330
|
+
const i = t.slice(o.indices[0], o.indices[1]).join("");
|
|
331
|
+
switch (o.type) {
|
|
332
|
+
case "hashtag":
|
|
333
|
+
return Object.assign(o, {
|
|
334
|
+
href: Wn(o),
|
|
335
|
+
text: i
|
|
336
|
+
});
|
|
337
|
+
case "mention":
|
|
338
|
+
return Object.assign(o, {
|
|
339
|
+
href: wt(o.screen_name),
|
|
340
|
+
text: i
|
|
341
|
+
});
|
|
342
|
+
case "url":
|
|
343
|
+
case "media":
|
|
344
|
+
return Object.assign(o, {
|
|
345
|
+
href: o.expanded_url,
|
|
346
|
+
text: o.display_url
|
|
347
|
+
});
|
|
348
|
+
case "symbol":
|
|
349
|
+
return Object.assign(o, {
|
|
350
|
+
href: Bn(o),
|
|
351
|
+
text: i
|
|
352
|
+
});
|
|
353
|
+
default:
|
|
354
|
+
return Object.assign(o, {
|
|
355
|
+
text: i
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
function le(e, t, n) {
|
|
361
|
+
for (const o of n)
|
|
362
|
+
for (const [i, s] of e.entries()) {
|
|
363
|
+
if (s.indices[0] > o.indices[0] || s.indices[1] < o.indices[1])
|
|
364
|
+
continue;
|
|
365
|
+
const a = [
|
|
366
|
+
{
|
|
367
|
+
...o,
|
|
368
|
+
type: t
|
|
369
|
+
}
|
|
370
|
+
];
|
|
371
|
+
s.indices[0] < o.indices[0] && a.unshift({
|
|
372
|
+
indices: [
|
|
373
|
+
s.indices[0],
|
|
374
|
+
o.indices[0]
|
|
375
|
+
],
|
|
376
|
+
type: "text"
|
|
377
|
+
}), s.indices[1] > o.indices[1] && a.push({
|
|
378
|
+
indices: [
|
|
379
|
+
o.indices[1],
|
|
380
|
+
s.indices[1]
|
|
381
|
+
],
|
|
382
|
+
type: "text"
|
|
383
|
+
}), e.splice(i, 1, ...a);
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function zn(e, t) {
|
|
388
|
+
e.entities.media && e.entities.media[0].indices[0] < e.display_text_range[1] && (e.display_text_range[1] = e.entities.media[0].indices[0]);
|
|
389
|
+
const n = t.at(-1);
|
|
390
|
+
n && n.indices[1] > e.display_text_range[1] && (n.indices[1] = e.display_text_range[1]);
|
|
391
|
+
}
|
|
392
|
+
const Hn = (e) => ({
|
|
393
|
+
...e,
|
|
394
|
+
url: it(e),
|
|
395
|
+
user: {
|
|
396
|
+
...e.user,
|
|
397
|
+
url: wt(e),
|
|
398
|
+
follow_url: jn(e)
|
|
399
|
+
},
|
|
400
|
+
like_url: Vn(e),
|
|
401
|
+
reply_url: Mn(e),
|
|
402
|
+
in_reply_to_url: e.in_reply_to_screen_name ? Fn(e) : void 0,
|
|
403
|
+
entities: at(e),
|
|
404
|
+
quoted_tweet: e.quoted_tweet ? {
|
|
405
|
+
...e.quoted_tweet,
|
|
406
|
+
url: it(e.quoted_tweet),
|
|
407
|
+
entities: at(e.quoted_tweet)
|
|
408
|
+
} : void 0
|
|
409
|
+
}), Gn = "_root_g9tkv_1", Xn = "_rounded_g9tkv_6", Kn = "_mediaWrapper_g9tkv_10", Qn = "_grid2Columns_g9tkv_17", Jn = "_grid3_g9tkv_20", Yn = "_grid2x2_g9tkv_23", Zn = "_mediaContainer_g9tkv_26", er = "_mediaLink_g9tkv_34", tr = "_skeleton_g9tkv_38", nr = "_image_g9tkv_43", C = {
|
|
410
|
+
root: Gn,
|
|
411
|
+
rounded: Xn,
|
|
412
|
+
mediaWrapper: Kn,
|
|
413
|
+
grid2Columns: Qn,
|
|
414
|
+
grid3: Jn,
|
|
415
|
+
grid2x2: Yn,
|
|
416
|
+
mediaContainer: Zn,
|
|
417
|
+
mediaLink: er,
|
|
418
|
+
skeleton: tr,
|
|
419
|
+
image: nr
|
|
420
|
+
}, rr = "_anchor_fp31d_1", or = "_videoButton_fp31d_17", ir = "_videoButtonIcon_fp31d_35", ar = "_watchOnTwitter_fp31d_44", sr = "_viewReplies_fp31d_60", ie = {
|
|
421
|
+
anchor: rr,
|
|
422
|
+
videoButton: or,
|
|
423
|
+
videoButtonIcon: ir,
|
|
424
|
+
watchOnTwitter: ar,
|
|
425
|
+
viewReplies: sr
|
|
426
|
+
}, cr = ({ tweet: e, media: t }) => {
|
|
427
|
+
const [n, o] = de(!0), [i, s] = de(!1), [a, l] = de(!1), h = Un(t);
|
|
428
|
+
let u = 0;
|
|
429
|
+
return /* @__PURE__ */ f(Wt, {
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ r("video", {
|
|
432
|
+
className: C.image,
|
|
433
|
+
poster: yt(t, "small"),
|
|
434
|
+
controls: !n,
|
|
435
|
+
playsInline: !0,
|
|
436
|
+
preload: "none",
|
|
437
|
+
tabIndex: n ? -1 : 0,
|
|
438
|
+
onPlay: () => {
|
|
439
|
+
u && window.clearTimeout(u), i || s(!0), a && l(!1);
|
|
440
|
+
},
|
|
441
|
+
onPause: () => {
|
|
442
|
+
u && window.clearTimeout(u), u = window.setTimeout(() => {
|
|
443
|
+
i && s(!1), u = 0;
|
|
444
|
+
}, 100);
|
|
445
|
+
},
|
|
446
|
+
onEnded: () => {
|
|
447
|
+
l(!0);
|
|
448
|
+
},
|
|
449
|
+
children: /* @__PURE__ */ r("source", {
|
|
450
|
+
src: h.url,
|
|
451
|
+
type: h.content_type
|
|
452
|
+
})
|
|
453
|
+
}),
|
|
454
|
+
n && /* @__PURE__ */ r("button", {
|
|
455
|
+
type: "button",
|
|
456
|
+
className: ie.videoButton,
|
|
457
|
+
"aria-label": "View video on X",
|
|
458
|
+
onClick: (y) => {
|
|
459
|
+
const v = y.currentTarget.previousSibling;
|
|
460
|
+
y.preventDefault(), o(!1), v.load(), v.play().then(() => {
|
|
461
|
+
s(!0), v.focus();
|
|
462
|
+
}).catch((b) => {
|
|
463
|
+
console.error("Error playing video:", b), o(!0), s(!1);
|
|
464
|
+
});
|
|
465
|
+
},
|
|
466
|
+
children: /* @__PURE__ */ r("svg", {
|
|
467
|
+
viewBox: "0 0 24 24",
|
|
468
|
+
className: ie.videoButtonIcon,
|
|
469
|
+
"aria-hidden": "true",
|
|
470
|
+
children: /* @__PURE__ */ r("g", {
|
|
471
|
+
children: /* @__PURE__ */ r("path", {
|
|
472
|
+
d: "M21 12L4 2v20l17-10z"
|
|
473
|
+
})
|
|
474
|
+
})
|
|
475
|
+
})
|
|
476
|
+
}),
|
|
477
|
+
!i && !a && /* @__PURE__ */ r("div", {
|
|
478
|
+
className: ie.watchOnTwitter,
|
|
479
|
+
children: /* @__PURE__ */ r("a", {
|
|
480
|
+
href: e.url,
|
|
481
|
+
className: ie.anchor,
|
|
482
|
+
target: "_blank",
|
|
483
|
+
rel: "noopener noreferrer",
|
|
484
|
+
children: n ? "Watch on X" : "Continue watching on X"
|
|
485
|
+
})
|
|
486
|
+
}),
|
|
487
|
+
a && /* @__PURE__ */ r("a", {
|
|
488
|
+
href: e.url,
|
|
489
|
+
className: U(ie.anchor, ie.viewReplies),
|
|
490
|
+
target: "_blank",
|
|
491
|
+
rel: "noopener noreferrer",
|
|
492
|
+
children: "View replies"
|
|
493
|
+
})
|
|
494
|
+
]
|
|
495
|
+
});
|
|
496
|
+
}, lr = (e) => /* @__PURE__ */ r("img", {
|
|
497
|
+
...e
|
|
498
|
+
}), st = (e, t) => {
|
|
499
|
+
let n = 56.25;
|
|
500
|
+
return t === 1 && (n = 100 / e.original_info.width * e.original_info.height), t === 2 && (n = n * 2), {
|
|
501
|
+
width: e.type === "photo" ? void 0 : "unset",
|
|
502
|
+
paddingBottom: `${n}%`
|
|
503
|
+
};
|
|
504
|
+
}, bt = ({ tweet: e, components: t, quoted: n }) => {
|
|
505
|
+
var o, i, s;
|
|
506
|
+
const a = (s = (o = e.mediaDetails) == null ? void 0 : o.length) != null ? s : 0;
|
|
507
|
+
var l;
|
|
508
|
+
const h = (l = t == null ? void 0 : t.MediaImg) != null ? l : lr;
|
|
509
|
+
return /* @__PURE__ */ r("div", {
|
|
510
|
+
className: U(C.root, !n && C.rounded),
|
|
511
|
+
children: /* @__PURE__ */ r("div", {
|
|
512
|
+
className: U(C.mediaWrapper, a > 1 && C.grid2Columns, a === 3 && C.grid3, a > 4 && C.grid2x2),
|
|
513
|
+
children: (i = e.mediaDetails) == null ? void 0 : i.map((u) => /* @__PURE__ */ r(Bt, {
|
|
514
|
+
children: u.type === "photo" ? /* @__PURE__ */ f("a", {
|
|
515
|
+
href: e.url,
|
|
516
|
+
className: U(C.mediaContainer, C.mediaLink),
|
|
517
|
+
target: "_blank",
|
|
518
|
+
rel: "noopener noreferrer",
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ r("div", {
|
|
521
|
+
className: C.skeleton,
|
|
522
|
+
style: st(u, a)
|
|
523
|
+
}),
|
|
524
|
+
/* @__PURE__ */ r(h, {
|
|
525
|
+
src: yt(u, "small"),
|
|
526
|
+
alt: u.ext_alt_text || "Image",
|
|
527
|
+
className: C.image,
|
|
528
|
+
draggable: !0
|
|
529
|
+
})
|
|
530
|
+
]
|
|
531
|
+
}, u.media_url_https) : /* @__PURE__ */ f("div", {
|
|
532
|
+
className: C.mediaContainer,
|
|
533
|
+
children: [
|
|
534
|
+
/* @__PURE__ */ r("div", {
|
|
535
|
+
className: C.skeleton,
|
|
536
|
+
style: st(u, a)
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ r(cr, {
|
|
539
|
+
tweet: e,
|
|
540
|
+
media: u
|
|
541
|
+
})
|
|
542
|
+
]
|
|
543
|
+
}, u.media_url_https)
|
|
544
|
+
}, u.media_url_https))
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
}, dr = {
|
|
548
|
+
hour: "numeric",
|
|
549
|
+
minute: "2-digit",
|
|
550
|
+
hour12: !0,
|
|
551
|
+
weekday: "short",
|
|
552
|
+
month: "short",
|
|
553
|
+
day: "numeric",
|
|
554
|
+
year: "numeric"
|
|
555
|
+
}, ur = new Intl.DateTimeFormat("en-US", dr), fr = (e) => {
|
|
556
|
+
const t = {};
|
|
557
|
+
for (const n of e)
|
|
558
|
+
t[n.type] = n.value;
|
|
559
|
+
return t;
|
|
560
|
+
}, hr = (e) => {
|
|
561
|
+
const t = fr(ur.formatToParts(e)), n = `${t.hour}:${t.minute} ${t.dayPeriod}`, o = `${t.month} ${t.day}, ${t.year}`;
|
|
562
|
+
return `${n} · ${o}`;
|
|
563
|
+
}, _r = "_root_i24yn_1", mr = {
|
|
564
|
+
root: _r
|
|
565
|
+
}, pr = ({ tweet: e }) => {
|
|
566
|
+
const t = new Date(e.created_at), n = hr(t);
|
|
567
|
+
return /* @__PURE__ */ r("a", {
|
|
568
|
+
className: mr.root,
|
|
569
|
+
href: e.url,
|
|
570
|
+
target: "_blank",
|
|
571
|
+
rel: "noopener noreferrer",
|
|
572
|
+
"aria-label": n,
|
|
573
|
+
children: /* @__PURE__ */ r("time", {
|
|
574
|
+
dateTime: t.toISOString(),
|
|
575
|
+
children: n
|
|
576
|
+
})
|
|
577
|
+
});
|
|
578
|
+
}, vr = "_info_19qcj_1", gr = "_infoLink_19qcj_10", wr = "_infoIcon_19qcj_30", Ne = {
|
|
579
|
+
info: vr,
|
|
580
|
+
infoLink: gr,
|
|
581
|
+
infoIcon: wr
|
|
582
|
+
}, yr = ({ tweet: e }) => /* @__PURE__ */ f("div", {
|
|
583
|
+
className: Ne.info,
|
|
584
|
+
children: [
|
|
585
|
+
/* @__PURE__ */ r(pr, {
|
|
586
|
+
tweet: e
|
|
587
|
+
}),
|
|
588
|
+
/* @__PURE__ */ r("a", {
|
|
589
|
+
className: Ne.infoLink,
|
|
590
|
+
href: "https://help.x.com/en/x-for-websites-ads-info-and-privacy",
|
|
591
|
+
target: "_blank",
|
|
592
|
+
rel: "noopener noreferrer",
|
|
593
|
+
"aria-label": "Twitter for Websites, Ads Information and Privacy",
|
|
594
|
+
children: /* @__PURE__ */ r("svg", {
|
|
595
|
+
viewBox: "0 0 24 24",
|
|
596
|
+
"aria-hidden": "true",
|
|
597
|
+
className: Ne.infoIcon,
|
|
598
|
+
children: /* @__PURE__ */ r("g", {
|
|
599
|
+
children: /* @__PURE__ */ r("path", {
|
|
600
|
+
d: "M13.5 8.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5S11.17 7 12 7s1.5.67 1.5 1.5zM13 17v-5h-2v5h2zm-1 5.25c5.66 0 10.25-4.59 10.25-10.25S17.66 1.75 12 1.75 1.75 6.34 1.75 12 6.34 22.25 12 22.25zM20.25 12c0 4.56-3.69 8.25-8.25 8.25S3.75 16.56 3.75 12 7.44 3.75 12 3.75s8.25 3.69 8.25 8.25z"
|
|
601
|
+
})
|
|
602
|
+
})
|
|
603
|
+
})
|
|
604
|
+
})
|
|
605
|
+
]
|
|
606
|
+
}), br = "_actions_n2anf_1", Tr = "_like_n2anf_13", xr = "_reply_n2anf_14", Nr = "_copy_n2anf_15", Rr = "_likeIconWrapper_n2anf_27", kr = "_likeCount_n2anf_30", Ir = "_replyIconWrapper_n2anf_35", Sr = "_copyIconWrapper_n2anf_36", Er = "_likeIcon_n2anf_27", Cr = "_replyIcon_n2anf_35", Lr = "_copyIcon_n2anf_36", Or = "_replyText_n2anf_56", qr = "_copyText_n2anf_57", S = {
|
|
607
|
+
actions: br,
|
|
608
|
+
like: Tr,
|
|
609
|
+
reply: xr,
|
|
610
|
+
copy: Nr,
|
|
611
|
+
likeIconWrapper: Rr,
|
|
612
|
+
likeCount: kr,
|
|
613
|
+
replyIconWrapper: Ir,
|
|
614
|
+
copyIconWrapper: Sr,
|
|
615
|
+
likeIcon: Er,
|
|
616
|
+
replyIcon: Cr,
|
|
617
|
+
copyIcon: Lr,
|
|
618
|
+
replyText: Or,
|
|
619
|
+
copyText: qr
|
|
620
|
+
}, $r = ({ tweet: e }) => {
|
|
621
|
+
const [t, n] = de(!1), o = () => {
|
|
622
|
+
navigator.clipboard.writeText(e.url), n(!0);
|
|
623
|
+
};
|
|
624
|
+
return Fe(() => {
|
|
625
|
+
if (t) {
|
|
626
|
+
const i = setTimeout(() => {
|
|
627
|
+
n(!1);
|
|
628
|
+
}, 6e3);
|
|
629
|
+
return () => clearTimeout(i);
|
|
630
|
+
}
|
|
631
|
+
}, [
|
|
632
|
+
t
|
|
633
|
+
]), /* @__PURE__ */ f("button", {
|
|
634
|
+
type: "button",
|
|
635
|
+
className: S.copy,
|
|
636
|
+
"aria-label": "Copy link",
|
|
637
|
+
onClick: o,
|
|
638
|
+
children: [
|
|
639
|
+
/* @__PURE__ */ r("div", {
|
|
640
|
+
className: S.copyIconWrapper,
|
|
641
|
+
children: t ? /* @__PURE__ */ r("svg", {
|
|
642
|
+
viewBox: "0 0 24 24",
|
|
643
|
+
className: S.copyIcon,
|
|
644
|
+
"aria-hidden": "true",
|
|
645
|
+
children: /* @__PURE__ */ r("g", {
|
|
646
|
+
children: /* @__PURE__ */ r("path", {
|
|
647
|
+
d: "M9.64 18.952l-5.55-4.861 1.317-1.504 3.951 3.459 8.459-10.948L19.4 6.32 9.64 18.952z"
|
|
648
|
+
})
|
|
649
|
+
})
|
|
650
|
+
}) : /* @__PURE__ */ r("svg", {
|
|
651
|
+
viewBox: "0 0 24 24",
|
|
652
|
+
className: S.copyIcon,
|
|
653
|
+
"aria-hidden": "true",
|
|
654
|
+
children: /* @__PURE__ */ r("g", {
|
|
655
|
+
children: /* @__PURE__ */ r("path", {
|
|
656
|
+
d: "M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"
|
|
657
|
+
})
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
}),
|
|
661
|
+
/* @__PURE__ */ r("span", {
|
|
662
|
+
className: S.copyText,
|
|
663
|
+
children: t ? "Copied!" : "Copy link"
|
|
664
|
+
})
|
|
665
|
+
]
|
|
666
|
+
});
|
|
667
|
+
}, Dr = ({ tweet: e }) => {
|
|
668
|
+
const t = Oe(e.favorite_count);
|
|
669
|
+
return /* @__PURE__ */ f("div", {
|
|
670
|
+
className: S.actions,
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ f("a", {
|
|
673
|
+
className: S.like,
|
|
674
|
+
href: e.like_url,
|
|
675
|
+
target: "_blank",
|
|
676
|
+
rel: "noopener noreferrer",
|
|
677
|
+
"aria-label": `Like. This Tweet has ${t} likes`,
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ r("div", {
|
|
680
|
+
className: S.likeIconWrapper,
|
|
681
|
+
children: /* @__PURE__ */ r("svg", {
|
|
682
|
+
viewBox: "0 0 24 24",
|
|
683
|
+
className: S.likeIcon,
|
|
684
|
+
"aria-hidden": "true",
|
|
685
|
+
children: /* @__PURE__ */ r("g", {
|
|
686
|
+
children: /* @__PURE__ */ r("path", {
|
|
687
|
+
d: "M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"
|
|
688
|
+
})
|
|
689
|
+
})
|
|
690
|
+
})
|
|
691
|
+
}),
|
|
692
|
+
/* @__PURE__ */ r("span", {
|
|
693
|
+
className: S.likeCount,
|
|
694
|
+
children: t
|
|
695
|
+
})
|
|
696
|
+
]
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ f("a", {
|
|
699
|
+
className: S.reply,
|
|
700
|
+
href: e.reply_url,
|
|
701
|
+
target: "_blank",
|
|
702
|
+
rel: "noopener noreferrer",
|
|
703
|
+
"aria-label": "Reply to this Tweet on Twitter",
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ r("div", {
|
|
706
|
+
className: S.replyIconWrapper,
|
|
707
|
+
children: /* @__PURE__ */ r("svg", {
|
|
708
|
+
viewBox: "0 0 24 24",
|
|
709
|
+
className: S.replyIcon,
|
|
710
|
+
"aria-hidden": "true",
|
|
711
|
+
children: /* @__PURE__ */ r("g", {
|
|
712
|
+
children: /* @__PURE__ */ r("path", {
|
|
713
|
+
d: "M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01z"
|
|
714
|
+
})
|
|
715
|
+
})
|
|
716
|
+
})
|
|
717
|
+
}),
|
|
718
|
+
/* @__PURE__ */ r("span", {
|
|
719
|
+
className: S.replyText,
|
|
720
|
+
children: "Reply"
|
|
721
|
+
})
|
|
722
|
+
]
|
|
723
|
+
}),
|
|
724
|
+
/* @__PURE__ */ r($r, {
|
|
725
|
+
tweet: e
|
|
726
|
+
})
|
|
727
|
+
]
|
|
728
|
+
});
|
|
729
|
+
}, Ar = "_replies_1cutb_1", Vr = "_link_1cutb_4", Mr = "_text_1cutb_23", Re = {
|
|
730
|
+
replies: Ar,
|
|
731
|
+
link: Vr,
|
|
732
|
+
text: Mr
|
|
733
|
+
}, jr = ({ tweet: e }) => /* @__PURE__ */ r("div", {
|
|
734
|
+
className: Re.replies,
|
|
735
|
+
children: /* @__PURE__ */ r("a", {
|
|
736
|
+
className: Re.link,
|
|
737
|
+
href: e.url,
|
|
738
|
+
target: "_blank",
|
|
739
|
+
rel: "noopener noreferrer",
|
|
740
|
+
children: /* @__PURE__ */ r("span", {
|
|
741
|
+
className: Re.text,
|
|
742
|
+
children: e.conversation_count === 0 ? "Read more on X" : e.conversation_count === 1 ? `Read ${Oe(e.conversation_count)} reply` : `Read ${Oe(e.conversation_count)} replies`
|
|
743
|
+
})
|
|
744
|
+
})
|
|
745
|
+
}), Wr = "_root_q5799_1", Br = "_article_q5799_16", ct = {
|
|
746
|
+
root: Wr,
|
|
747
|
+
article: Br
|
|
748
|
+
}, Fr = ({ tweet: e, children: t }) => /* @__PURE__ */ r("div", {
|
|
749
|
+
className: ct.root,
|
|
750
|
+
onClick: (n) => {
|
|
751
|
+
n.preventDefault(), window.open(e.url, "_blank");
|
|
752
|
+
},
|
|
753
|
+
children: /* @__PURE__ */ r("article", {
|
|
754
|
+
className: ct.article,
|
|
755
|
+
children: t
|
|
756
|
+
})
|
|
757
|
+
}), Pr = "_header_r31i5_1", Ur = "_avatar_r31i5_11", zr = "_avatarSquare_r31i5_17", Hr = "_author_r31i5_21", Gr = "_authorText_r31i5_26", Xr = "_username_r31i5_33", Q = {
|
|
758
|
+
header: Pr,
|
|
759
|
+
avatar: Ur,
|
|
760
|
+
avatarSquare: zr,
|
|
761
|
+
author: Hr,
|
|
762
|
+
authorText: Gr,
|
|
763
|
+
username: Xr
|
|
764
|
+
}, Kr = ({ tweet: e }) => {
|
|
765
|
+
const { user: t } = e;
|
|
766
|
+
return /* @__PURE__ */ f("div", {
|
|
767
|
+
className: Q.header,
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ r("a", {
|
|
770
|
+
href: e.url,
|
|
771
|
+
className: Q.avatar,
|
|
772
|
+
target: "_blank",
|
|
773
|
+
rel: "noopener noreferrer",
|
|
774
|
+
children: /* @__PURE__ */ r("div", {
|
|
775
|
+
className: U(Q.avatarOverflow, t.profile_image_shape === "Square" && Q.avatarSquare),
|
|
776
|
+
children: /* @__PURE__ */ r(vt, {
|
|
777
|
+
src: t.profile_image_url_https,
|
|
778
|
+
alt: t.name,
|
|
779
|
+
width: 20,
|
|
780
|
+
height: 20
|
|
781
|
+
})
|
|
782
|
+
})
|
|
783
|
+
}),
|
|
784
|
+
/* @__PURE__ */ f("div", {
|
|
785
|
+
className: Q.author,
|
|
786
|
+
children: [
|
|
787
|
+
/* @__PURE__ */ r("div", {
|
|
788
|
+
className: Q.authorText,
|
|
789
|
+
children: /* @__PURE__ */ r("span", {
|
|
790
|
+
title: t.name,
|
|
791
|
+
children: t.name
|
|
792
|
+
})
|
|
793
|
+
}),
|
|
794
|
+
/* @__PURE__ */ r(gt, {
|
|
795
|
+
user: t
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ r("div", {
|
|
798
|
+
className: Q.username,
|
|
799
|
+
children: /* @__PURE__ */ f("span", {
|
|
800
|
+
title: `@${t.screen_name}`,
|
|
801
|
+
children: [
|
|
802
|
+
"@",
|
|
803
|
+
t.screen_name
|
|
804
|
+
]
|
|
805
|
+
})
|
|
806
|
+
})
|
|
807
|
+
]
|
|
808
|
+
})
|
|
809
|
+
]
|
|
810
|
+
});
|
|
811
|
+
}, Qr = "_root_175ot_1", Jr = {
|
|
812
|
+
root: Qr
|
|
813
|
+
}, Yr = ({ tweet: e }) => /* @__PURE__ */ r("p", {
|
|
814
|
+
className: Jr.root,
|
|
815
|
+
lang: e.lang,
|
|
816
|
+
dir: "auto",
|
|
817
|
+
children: e.entities.map((t, n) => /* @__PURE__ */ r("span", {
|
|
818
|
+
dangerouslySetInnerHTML: {
|
|
819
|
+
__html: t.text
|
|
820
|
+
}
|
|
821
|
+
}, n))
|
|
822
|
+
}), Zr = ({ tweet: e }) => {
|
|
823
|
+
var t;
|
|
824
|
+
return /* @__PURE__ */ f(Fr, {
|
|
825
|
+
tweet: e,
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ r(Kr, {
|
|
828
|
+
tweet: e
|
|
829
|
+
}),
|
|
830
|
+
/* @__PURE__ */ r(Yr, {
|
|
831
|
+
tweet: e
|
|
832
|
+
}),
|
|
833
|
+
(t = e.mediaDetails) != null && t.length ? /* @__PURE__ */ r(bt, {
|
|
834
|
+
quoted: !0,
|
|
835
|
+
tweet: e
|
|
836
|
+
}) : null
|
|
837
|
+
]
|
|
838
|
+
});
|
|
839
|
+
}, eo = ({ tweet: e, components: t }) => {
|
|
840
|
+
var n;
|
|
841
|
+
const o = Pe(() => Hn(e), [
|
|
842
|
+
e
|
|
843
|
+
]);
|
|
844
|
+
return /* @__PURE__ */ f(ze, {
|
|
845
|
+
children: [
|
|
846
|
+
/* @__PURE__ */ r(In, {
|
|
847
|
+
tweet: o,
|
|
848
|
+
components: t
|
|
849
|
+
}),
|
|
850
|
+
o.in_reply_to_status_id_str && /* @__PURE__ */ r(Cn, {
|
|
851
|
+
tweet: o
|
|
852
|
+
}),
|
|
853
|
+
/* @__PURE__ */ r(An, {
|
|
854
|
+
tweet: o
|
|
855
|
+
}),
|
|
856
|
+
(n = o.mediaDetails) != null && n.length ? /* @__PURE__ */ r(bt, {
|
|
857
|
+
tweet: o,
|
|
858
|
+
components: t
|
|
859
|
+
}) : null,
|
|
860
|
+
o.quoted_tweet && /* @__PURE__ */ r(Zr, {
|
|
861
|
+
tweet: o.quoted_tweet
|
|
862
|
+
}),
|
|
863
|
+
/* @__PURE__ */ r(yr, {
|
|
864
|
+
tweet: o
|
|
865
|
+
}),
|
|
866
|
+
/* @__PURE__ */ r(Dr, {
|
|
867
|
+
tweet: o
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ r(jr, {
|
|
870
|
+
tweet: o
|
|
871
|
+
})
|
|
872
|
+
]
|
|
873
|
+
});
|
|
874
|
+
}, to = "_root_16yxa_1", no = {
|
|
875
|
+
root: to
|
|
876
|
+
}, ro = (e) => /* @__PURE__ */ r(ze, {
|
|
877
|
+
children: /* @__PURE__ */ f("div", {
|
|
878
|
+
className: no.root,
|
|
879
|
+
children: [
|
|
880
|
+
/* @__PURE__ */ r("h3", {
|
|
881
|
+
children: "Tweet not found"
|
|
882
|
+
}),
|
|
883
|
+
/* @__PURE__ */ r("p", {
|
|
884
|
+
children: "The embedded tweet could not be found…"
|
|
885
|
+
})
|
|
886
|
+
]
|
|
887
|
+
})
|
|
888
|
+
}), oo = "_skeleton_oi7hr_1", io = {
|
|
889
|
+
skeleton: oo
|
|
890
|
+
}, pe = ({ style: e }) => /* @__PURE__ */ r("span", {
|
|
891
|
+
className: io.skeleton,
|
|
892
|
+
style: e
|
|
893
|
+
}), ao = "_root_17qqv_1", so = {
|
|
894
|
+
root: ao
|
|
895
|
+
}, co = () => /* @__PURE__ */ f(ze, {
|
|
896
|
+
className: so.root,
|
|
897
|
+
children: [
|
|
898
|
+
/* @__PURE__ */ r(pe, {
|
|
899
|
+
style: {
|
|
900
|
+
height: "3rem",
|
|
901
|
+
marginBottom: "0.75rem"
|
|
902
|
+
}
|
|
903
|
+
}),
|
|
904
|
+
/* @__PURE__ */ r(pe, {
|
|
905
|
+
style: {
|
|
906
|
+
height: "6rem",
|
|
907
|
+
margin: "0.5rem 0"
|
|
908
|
+
}
|
|
909
|
+
}),
|
|
910
|
+
/* @__PURE__ */ r("div", {
|
|
911
|
+
style: {
|
|
912
|
+
borderTop: "var(--tweet-border)",
|
|
913
|
+
margin: "0.5rem 0"
|
|
914
|
+
}
|
|
915
|
+
}),
|
|
916
|
+
/* @__PURE__ */ r(pe, {
|
|
917
|
+
style: {
|
|
918
|
+
height: "2rem"
|
|
919
|
+
}
|
|
920
|
+
}),
|
|
921
|
+
/* @__PURE__ */ r(pe, {
|
|
922
|
+
style: {
|
|
923
|
+
height: "2rem",
|
|
924
|
+
borderRadius: "9999px",
|
|
925
|
+
marginTop: "0.5rem"
|
|
926
|
+
}
|
|
927
|
+
})
|
|
928
|
+
]
|
|
929
|
+
}), Tt = 0, xt = 1, Nt = 2, lt = 3;
|
|
930
|
+
var dt = Object.prototype.hasOwnProperty;
|
|
931
|
+
function qe(e, t) {
|
|
932
|
+
var n, o;
|
|
933
|
+
if (e === t) return !0;
|
|
934
|
+
if (e && t && (n = e.constructor) === t.constructor) {
|
|
935
|
+
if (n === Date) return e.getTime() === t.getTime();
|
|
936
|
+
if (n === RegExp) return e.toString() === t.toString();
|
|
937
|
+
if (n === Array) {
|
|
938
|
+
if ((o = e.length) === t.length)
|
|
939
|
+
for (; o-- && qe(e[o], t[o]); ) ;
|
|
940
|
+
return o === -1;
|
|
941
|
+
}
|
|
942
|
+
if (!n || typeof e == "object") {
|
|
943
|
+
o = 0;
|
|
944
|
+
for (n in e)
|
|
945
|
+
if (dt.call(e, n) && ++o && !dt.call(t, n) || !(n in t) || !qe(e[n], t[n])) return !1;
|
|
946
|
+
return Object.keys(t).length === o;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return e !== e && t !== t;
|
|
950
|
+
}
|
|
951
|
+
const F = /* @__PURE__ */ new WeakMap(), P = () => {
|
|
952
|
+
}, k = (
|
|
953
|
+
/*#__NOINLINE__*/
|
|
954
|
+
P()
|
|
955
|
+
), $e = Object, d = (e) => e === k, j = (e) => typeof e == "function", z = (e, t) => ({
|
|
956
|
+
...e,
|
|
957
|
+
...t
|
|
958
|
+
}), Rt = (e) => j(e.then), ke = {}, ve = {}, He = "undefined", ue = typeof window != He, De = typeof document != He, lo = ue && "Deno" in window, uo = () => ue && typeof window.requestAnimationFrame != He, kt = (e, t) => {
|
|
959
|
+
const n = F.get(e);
|
|
960
|
+
return [
|
|
961
|
+
// Getter
|
|
962
|
+
() => !d(t) && e.get(t) || ke,
|
|
963
|
+
// Setter
|
|
964
|
+
(o) => {
|
|
965
|
+
if (!d(t)) {
|
|
966
|
+
const i = e.get(t);
|
|
967
|
+
t in ve || (ve[t] = i), n[5](t, z(i, o), i || ke);
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
// Subscriber
|
|
971
|
+
n[6],
|
|
972
|
+
// Get server cache snapshot
|
|
973
|
+
() => !d(t) && t in ve ? ve[t] : !d(t) && e.get(t) || ke
|
|
974
|
+
];
|
|
975
|
+
};
|
|
976
|
+
let Ae = !0;
|
|
977
|
+
const fo = () => Ae, [Ve, Me] = ue && window.addEventListener ? [
|
|
978
|
+
window.addEventListener.bind(window),
|
|
979
|
+
window.removeEventListener.bind(window)
|
|
980
|
+
] : [
|
|
981
|
+
P,
|
|
982
|
+
P
|
|
983
|
+
], ho = () => {
|
|
984
|
+
const e = De && document.visibilityState;
|
|
985
|
+
return d(e) || e !== "hidden";
|
|
986
|
+
}, _o = (e) => (De && document.addEventListener("visibilitychange", e), Ve("focus", e), () => {
|
|
987
|
+
De && document.removeEventListener("visibilitychange", e), Me("focus", e);
|
|
988
|
+
}), mo = (e) => {
|
|
989
|
+
const t = () => {
|
|
990
|
+
Ae = !0, e();
|
|
991
|
+
}, n = () => {
|
|
992
|
+
Ae = !1;
|
|
993
|
+
};
|
|
994
|
+
return Ve("online", t), Ve("offline", n), () => {
|
|
995
|
+
Me("online", t), Me("offline", n);
|
|
996
|
+
};
|
|
997
|
+
}, po = {
|
|
998
|
+
isOnline: fo,
|
|
999
|
+
isVisible: ho
|
|
1000
|
+
}, vo = {
|
|
1001
|
+
initFocus: _o,
|
|
1002
|
+
initReconnect: mo
|
|
1003
|
+
}, ut = !Be.useId, ae = !ue || lo, go = (e) => uo() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ie = ae ? Fe : Pt, Se = typeof navigator < "u" && navigator.connection, ft = !ae && Se && ([
|
|
1004
|
+
"slow-2g",
|
|
1005
|
+
"2g"
|
|
1006
|
+
].includes(Se.effectiveType) || Se.saveData), ge = /* @__PURE__ */ new WeakMap(), wo = (e) => $e.prototype.toString.call(e), Ee = (e, t) => e === `[object ${t}]`;
|
|
1007
|
+
let yo = 0;
|
|
1008
|
+
const je = (e) => {
|
|
1009
|
+
const t = typeof e, n = wo(e), o = Ee(n, "Date"), i = Ee(n, "RegExp"), s = Ee(n, "Object");
|
|
1010
|
+
let a, l;
|
|
1011
|
+
if ($e(e) === e && !o && !i) {
|
|
1012
|
+
if (a = ge.get(e), a) return a;
|
|
1013
|
+
if (a = ++yo + "~", ge.set(e, a), Array.isArray(e)) {
|
|
1014
|
+
for (a = "@", l = 0; l < e.length; l++)
|
|
1015
|
+
a += je(e[l]) + ",";
|
|
1016
|
+
ge.set(e, a);
|
|
1017
|
+
}
|
|
1018
|
+
if (s) {
|
|
1019
|
+
a = "#";
|
|
1020
|
+
const h = $e.keys(e).sort();
|
|
1021
|
+
for (; !d(l = h.pop()); )
|
|
1022
|
+
d(e[l]) || (a += l + ":" + je(e[l]) + ",");
|
|
1023
|
+
ge.set(e, a);
|
|
1024
|
+
}
|
|
1025
|
+
} else
|
|
1026
|
+
a = o ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
1027
|
+
return a;
|
|
1028
|
+
}, Ge = (e) => {
|
|
1029
|
+
if (j(e))
|
|
1030
|
+
try {
|
|
1031
|
+
e = e();
|
|
1032
|
+
} catch {
|
|
1033
|
+
e = "";
|
|
1034
|
+
}
|
|
1035
|
+
const t = e;
|
|
1036
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? je(e) : "", [
|
|
1037
|
+
e,
|
|
1038
|
+
t
|
|
1039
|
+
];
|
|
1040
|
+
};
|
|
1041
|
+
let bo = 0;
|
|
1042
|
+
const We = () => ++bo;
|
|
1043
|
+
async function It(...e) {
|
|
1044
|
+
const [t, n, o, i] = e, s = z({
|
|
1045
|
+
populateCache: !0,
|
|
1046
|
+
throwOnError: !0
|
|
1047
|
+
}, typeof i == "boolean" ? {
|
|
1048
|
+
revalidate: i
|
|
1049
|
+
} : i || {});
|
|
1050
|
+
let a = s.populateCache;
|
|
1051
|
+
const l = s.rollbackOnError;
|
|
1052
|
+
let h = s.optimisticData;
|
|
1053
|
+
const u = (b) => typeof l == "function" ? l(b) : l !== !1, y = s.throwOnError;
|
|
1054
|
+
if (j(n)) {
|
|
1055
|
+
const b = n, R = [], E = t.keys();
|
|
1056
|
+
for (const O of E)
|
|
1057
|
+
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
1058
|
+
!/^\$(inf|sub)\$/.test(O) && b(t.get(O)._k) && R.push(O);
|
|
1059
|
+
return Promise.all(R.map(v));
|
|
1060
|
+
}
|
|
1061
|
+
return v(n);
|
|
1062
|
+
async function v(b) {
|
|
1063
|
+
const [R] = Ge(b);
|
|
1064
|
+
if (!R) return;
|
|
1065
|
+
const [E, O] = kt(t, R), [D, se, c, fe] = F.get(t), J = () => {
|
|
1066
|
+
const q = D[R];
|
|
1067
|
+
return (j(s.revalidate) ? s.revalidate(E().data, b) : s.revalidate !== !1) && (delete c[R], delete fe[R], q && q[0]) ? q[0](Nt).then(() => E().data) : E().data;
|
|
1068
|
+
};
|
|
1069
|
+
if (e.length < 3)
|
|
1070
|
+
return J();
|
|
1071
|
+
let T = o, A, V = !1;
|
|
1072
|
+
const Y = We();
|
|
1073
|
+
se[R] = [
|
|
1074
|
+
Y,
|
|
1075
|
+
0
|
|
1076
|
+
];
|
|
1077
|
+
const m = !d(h), Z = E(), M = Z.data, ee = Z._c, H = d(ee) ? M : ee;
|
|
1078
|
+
if (m && (h = j(h) ? h(H, M) : h, O({
|
|
1079
|
+
data: h,
|
|
1080
|
+
_c: H
|
|
1081
|
+
})), j(T))
|
|
1082
|
+
try {
|
|
1083
|
+
T = T(H);
|
|
1084
|
+
} catch (q) {
|
|
1085
|
+
A = q, V = !0;
|
|
1086
|
+
}
|
|
1087
|
+
if (T && Rt(T))
|
|
1088
|
+
if (T = await T.catch((q) => {
|
|
1089
|
+
A = q, V = !0;
|
|
1090
|
+
}), Y !== se[R][0]) {
|
|
1091
|
+
if (V) throw A;
|
|
1092
|
+
return T;
|
|
1093
|
+
} else V && m && u(A) && (a = !0, O({
|
|
1094
|
+
data: H,
|
|
1095
|
+
_c: k
|
|
1096
|
+
}));
|
|
1097
|
+
if (a && !V)
|
|
1098
|
+
if (j(a)) {
|
|
1099
|
+
const q = a(T, H);
|
|
1100
|
+
O({
|
|
1101
|
+
data: q,
|
|
1102
|
+
error: k,
|
|
1103
|
+
_c: k
|
|
1104
|
+
});
|
|
1105
|
+
} else
|
|
1106
|
+
O({
|
|
1107
|
+
data: T,
|
|
1108
|
+
error: k,
|
|
1109
|
+
_c: k
|
|
1110
|
+
});
|
|
1111
|
+
if (se[R][1] = We(), Promise.resolve(J()).then(() => {
|
|
1112
|
+
O({
|
|
1113
|
+
_c: k
|
|
1114
|
+
});
|
|
1115
|
+
}), V) {
|
|
1116
|
+
if (y) throw A;
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
return T;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
const ht = (e, t) => {
|
|
1123
|
+
for (const n in e)
|
|
1124
|
+
e[n][0] && e[n][0](t);
|
|
1125
|
+
}, To = (e, t) => {
|
|
1126
|
+
if (!F.has(e)) {
|
|
1127
|
+
const n = z(vo, t), o = /* @__PURE__ */ Object.create(null), i = It.bind(k, e);
|
|
1128
|
+
let s = P;
|
|
1129
|
+
const a = /* @__PURE__ */ Object.create(null), l = (y, v) => {
|
|
1130
|
+
const b = a[y] || [];
|
|
1131
|
+
return a[y] = b, b.push(v), () => b.splice(b.indexOf(v), 1);
|
|
1132
|
+
}, h = (y, v, b) => {
|
|
1133
|
+
e.set(y, v);
|
|
1134
|
+
const R = a[y];
|
|
1135
|
+
if (R)
|
|
1136
|
+
for (const E of R)
|
|
1137
|
+
E(v, b);
|
|
1138
|
+
}, u = () => {
|
|
1139
|
+
if (!F.has(e) && (F.set(e, [
|
|
1140
|
+
o,
|
|
1141
|
+
/* @__PURE__ */ Object.create(null),
|
|
1142
|
+
/* @__PURE__ */ Object.create(null),
|
|
1143
|
+
/* @__PURE__ */ Object.create(null),
|
|
1144
|
+
i,
|
|
1145
|
+
h,
|
|
1146
|
+
l
|
|
1147
|
+
]), !ae)) {
|
|
1148
|
+
const y = n.initFocus(setTimeout.bind(k, ht.bind(k, o, Tt))), v = n.initReconnect(setTimeout.bind(k, ht.bind(k, o, xt)));
|
|
1149
|
+
s = () => {
|
|
1150
|
+
y && y(), v && v(), F.delete(e);
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
return u(), [
|
|
1155
|
+
e,
|
|
1156
|
+
i,
|
|
1157
|
+
u,
|
|
1158
|
+
s
|
|
1159
|
+
];
|
|
1160
|
+
}
|
|
1161
|
+
return [
|
|
1162
|
+
e,
|
|
1163
|
+
F.get(e)[4]
|
|
1164
|
+
];
|
|
1165
|
+
}, xo = (e, t, n, o, i) => {
|
|
1166
|
+
const s = n.errorRetryCount, a = i.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
1167
|
+
!d(s) && a > s || setTimeout(o, l, i);
|
|
1168
|
+
}, No = qe, [St, Ro] = To(/* @__PURE__ */ new Map()), ko = z(
|
|
1169
|
+
{
|
|
1170
|
+
// events
|
|
1171
|
+
onLoadingSlow: P,
|
|
1172
|
+
onSuccess: P,
|
|
1173
|
+
onError: P,
|
|
1174
|
+
onErrorRetry: xo,
|
|
1175
|
+
onDiscarded: P,
|
|
1176
|
+
// switches
|
|
1177
|
+
revalidateOnFocus: !0,
|
|
1178
|
+
revalidateOnReconnect: !0,
|
|
1179
|
+
revalidateIfStale: !0,
|
|
1180
|
+
shouldRetryOnError: !0,
|
|
1181
|
+
// timeouts
|
|
1182
|
+
errorRetryInterval: ft ? 1e4 : 5e3,
|
|
1183
|
+
focusThrottleInterval: 5 * 1e3,
|
|
1184
|
+
dedupingInterval: 2 * 1e3,
|
|
1185
|
+
loadingTimeout: ft ? 5e3 : 3e3,
|
|
1186
|
+
// providers
|
|
1187
|
+
compare: No,
|
|
1188
|
+
isPaused: () => !1,
|
|
1189
|
+
cache: St,
|
|
1190
|
+
mutate: Ro,
|
|
1191
|
+
fallback: {}
|
|
1192
|
+
},
|
|
1193
|
+
// use web preset by default
|
|
1194
|
+
po
|
|
1195
|
+
), Io = (e, t) => {
|
|
1196
|
+
const n = z(e, t);
|
|
1197
|
+
if (t) {
|
|
1198
|
+
const { use: o, fallback: i } = e, { use: s, fallback: a } = t;
|
|
1199
|
+
o && s && (n.use = o.concat(s)), i && a && (n.fallback = z(i, a));
|
|
1200
|
+
}
|
|
1201
|
+
return n;
|
|
1202
|
+
}, So = Ft({}), Eo = "$inf$", Et = ue && window.__SWR_DEVTOOLS_USE__, Co = Et ? window.__SWR_DEVTOOLS_USE__ : [], Lo = () => {
|
|
1203
|
+
Et && (window.__SWR_DEVTOOLS_REACT__ = Be);
|
|
1204
|
+
}, Oo = (e) => j(e[1]) ? [
|
|
1205
|
+
e[0],
|
|
1206
|
+
e[1],
|
|
1207
|
+
e[2] || {}
|
|
1208
|
+
] : [
|
|
1209
|
+
e[0],
|
|
1210
|
+
null,
|
|
1211
|
+
(e[1] === null ? e[2] : e[1]) || {}
|
|
1212
|
+
], qo = () => {
|
|
1213
|
+
const e = Ut(So);
|
|
1214
|
+
return Pe(() => z(ko, e), [
|
|
1215
|
+
e
|
|
1216
|
+
]);
|
|
1217
|
+
}, $o = (e) => (t, n, o) => e(t, n && ((...s) => {
|
|
1218
|
+
const [a] = Ge(t), [, , , l] = F.get(St);
|
|
1219
|
+
if (a.startsWith(Eo))
|
|
1220
|
+
return n(...s);
|
|
1221
|
+
const h = l[a];
|
|
1222
|
+
return d(h) ? n(...s) : (delete l[a], h);
|
|
1223
|
+
}), o), Do = Co.concat($o), Ao = (e) => function(...n) {
|
|
1224
|
+
const o = qo(), [i, s, a] = Oo(n), l = Io(o, a);
|
|
1225
|
+
let h = e;
|
|
1226
|
+
const { use: u } = l, y = (u || []).concat(Do);
|
|
1227
|
+
for (let v = y.length; v--; )
|
|
1228
|
+
h = y[v](h);
|
|
1229
|
+
return h(i, s || l.fetcher || null, l);
|
|
1230
|
+
}, Vo = (e, t, n) => {
|
|
1231
|
+
const o = t[e] || (t[e] = []);
|
|
1232
|
+
return o.push(n), () => {
|
|
1233
|
+
const i = o.indexOf(n);
|
|
1234
|
+
i >= 0 && (o[i] = o[o.length - 1], o.pop());
|
|
1235
|
+
};
|
|
1236
|
+
};
|
|
1237
|
+
Lo();
|
|
1238
|
+
const Ce = Be.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
1239
|
+
// and emitting an error.
|
|
1240
|
+
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
1241
|
+
// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
|
|
1242
|
+
((e) => {
|
|
1243
|
+
switch (e.status) {
|
|
1244
|
+
case "pending":
|
|
1245
|
+
throw e;
|
|
1246
|
+
case "fulfilled":
|
|
1247
|
+
return e.value;
|
|
1248
|
+
case "rejected":
|
|
1249
|
+
throw e.reason;
|
|
1250
|
+
default:
|
|
1251
|
+
throw e.status = "pending", e.then((t) => {
|
|
1252
|
+
e.status = "fulfilled", e.value = t;
|
|
1253
|
+
}, (t) => {
|
|
1254
|
+
e.status = "rejected", e.reason = t;
|
|
1255
|
+
}), e;
|
|
1256
|
+
}
|
|
1257
|
+
}), Le = {
|
|
1258
|
+
dedupe: !0
|
|
1259
|
+
}, _t = Promise.resolve(k), Mo = (e, t, n) => {
|
|
1260
|
+
const { cache: o, compare: i, suspense: s, fallbackData: a, revalidateOnMount: l, revalidateIfStale: h, refreshInterval: u, refreshWhenHidden: y, refreshWhenOffline: v, keepPreviousData: b, strictServerPrefetchWarning: R } = n, [E, O, D, se] = F.get(o), [c, fe] = Ge(e), J = K(!1), T = K(!1), A = K(c), V = K(t), Y = K(n), m = () => Y.current, Z = () => m().isVisible() && m().isOnline(), [M, ee, H, q] = kt(o, c), te = K({}).current, he = d(a) ? d(n.fallback) ? k : n.fallback[c] : a, Xe = (_, p) => {
|
|
1261
|
+
for (const w in te) {
|
|
1262
|
+
const g = w;
|
|
1263
|
+
if (g === "data") {
|
|
1264
|
+
if (!i(_[g], p[g]) && (!d(_[g]) || !i(me, p[g])))
|
|
1265
|
+
return !1;
|
|
1266
|
+
} else if (p[g] !== _[g])
|
|
1267
|
+
return !1;
|
|
1268
|
+
}
|
|
1269
|
+
return !0;
|
|
1270
|
+
}, Ke = Pe(() => {
|
|
1271
|
+
const _ = !c || !t ? !1 : d(l) ? m().isPaused() || s ? !1 : h !== !1 : l, p = (I) => {
|
|
1272
|
+
const W = z(I);
|
|
1273
|
+
return delete W._k, _ ? {
|
|
1274
|
+
isValidating: !0,
|
|
1275
|
+
isLoading: !0,
|
|
1276
|
+
...W
|
|
1277
|
+
} : W;
|
|
1278
|
+
}, w = M(), g = q(), $ = p(w), oe = w === g ? $ : p(g);
|
|
1279
|
+
let x = $;
|
|
1280
|
+
return [
|
|
1281
|
+
() => {
|
|
1282
|
+
const I = p(M());
|
|
1283
|
+
return Xe(I, x) ? (x.data = I.data, x.isLoading = I.isLoading, x.isValidating = I.isValidating, x.error = I.error, x) : (x = I, I);
|
|
1284
|
+
},
|
|
1285
|
+
() => oe
|
|
1286
|
+
];
|
|
1287
|
+
}, [
|
|
1288
|
+
o,
|
|
1289
|
+
c
|
|
1290
|
+
]), ne = rt.useSyncExternalStore(Te(
|
|
1291
|
+
(_) => H(c, (p, w) => {
|
|
1292
|
+
Xe(w, p) || _();
|
|
1293
|
+
}),
|
|
1294
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1295
|
+
[
|
|
1296
|
+
o,
|
|
1297
|
+
c
|
|
1298
|
+
]
|
|
1299
|
+
), Ke[0], Ke[1]), Qe = !J.current, Ct = E[c] && E[c].length > 0, re = ne.data, G = d(re) ? he && Rt(he) ? Ce(he) : he : re, _e = ne.error, we = K(G), me = b ? d(re) ? d(we.current) ? G : we.current : re : G, X = c && d(G), Lt = !ae && // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1300
|
+
rt.useSyncExternalStore(() => P, () => !1, () => !0);
|
|
1301
|
+
R && Lt && !s && X && console.warn(`Missing pre-initiated data for serialized key "${c}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
|
|
1302
|
+
const Je = Ct && !d(_e) ? !1 : Qe && !d(l) ? l : m().isPaused() ? !1 : s ? d(G) ? !1 : h : d(G) || h, Ye = !!(c && t && Qe && Je), Ot = d(ne.isValidating) ? Ye : ne.isValidating, qt = d(ne.isLoading) ? Ye : ne.isLoading, ce = Te(
|
|
1303
|
+
async (_) => {
|
|
1304
|
+
const p = V.current;
|
|
1305
|
+
if (!c || !p || T.current || m().isPaused())
|
|
1306
|
+
return !1;
|
|
1307
|
+
let w, g, $ = !0;
|
|
1308
|
+
const oe = _ || {}, x = !D[c] || !oe.dedupe, I = () => ut ? !T.current && c === A.current && J.current : c === A.current, W = {
|
|
1309
|
+
isValidating: !1,
|
|
1310
|
+
isLoading: !1
|
|
1311
|
+
}, et = () => {
|
|
1312
|
+
ee(W);
|
|
1313
|
+
}, tt = () => {
|
|
1314
|
+
const L = D[c];
|
|
1315
|
+
L && L[1] === g && delete D[c];
|
|
1316
|
+
}, nt = {
|
|
1317
|
+
isValidating: !0
|
|
1318
|
+
};
|
|
1319
|
+
d(M().data) && (nt.isLoading = !0);
|
|
1320
|
+
try {
|
|
1321
|
+
if (x && (ee(nt), n.loadingTimeout && d(M().data) && setTimeout(() => {
|
|
1322
|
+
$ && I() && m().onLoadingSlow(c, n);
|
|
1323
|
+
}, n.loadingTimeout), D[c] = [
|
|
1324
|
+
p(fe),
|
|
1325
|
+
We()
|
|
1326
|
+
]), [w, g] = D[c], w = await w, x && setTimeout(tt, n.dedupingInterval), !D[c] || D[c][1] !== g)
|
|
1327
|
+
return x && I() && m().onDiscarded(c), !1;
|
|
1328
|
+
W.error = k;
|
|
1329
|
+
const L = O[c];
|
|
1330
|
+
if (!d(L) && // case 1
|
|
1331
|
+
(g <= L[0] || // case 2
|
|
1332
|
+
g <= L[1] || // case 3
|
|
1333
|
+
L[1] === 0))
|
|
1334
|
+
return et(), x && I() && m().onDiscarded(c), !1;
|
|
1335
|
+
const B = M().data;
|
|
1336
|
+
W.data = i(B, w) ? B : w, x && I() && m().onSuccess(w, c, n);
|
|
1337
|
+
} catch (L) {
|
|
1338
|
+
tt();
|
|
1339
|
+
const B = m(), { shouldRetryOnError: ye } = B;
|
|
1340
|
+
B.isPaused() || (W.error = L, x && I() && (B.onError(L, c, B), (ye === !0 || j(ye) && ye(L)) && (!m().revalidateOnFocus || !m().revalidateOnReconnect || Z()) && B.onErrorRetry(L, c, B, ($t) => {
|
|
1341
|
+
const be = E[c];
|
|
1342
|
+
be && be[0] && be[0](lt, $t);
|
|
1343
|
+
}, {
|
|
1344
|
+
retryCount: (oe.retryCount || 0) + 1,
|
|
1345
|
+
dedupe: !0
|
|
1346
|
+
})));
|
|
1347
|
+
}
|
|
1348
|
+
return $ = !1, et(), !0;
|
|
1349
|
+
},
|
|
1350
|
+
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
1351
|
+
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
1352
|
+
// the deps array.
|
|
1353
|
+
//
|
|
1354
|
+
// FIXME:
|
|
1355
|
+
// `fn` and `config` might be changed during the lifecycle,
|
|
1356
|
+
// but they might be changed every render like this.
|
|
1357
|
+
// `useSWR('key', () => fetch('/api/'), { suspense: true })`
|
|
1358
|
+
// So we omit the values from the deps array
|
|
1359
|
+
// even though it might cause unexpected behaviors.
|
|
1360
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1361
|
+
[
|
|
1362
|
+
c,
|
|
1363
|
+
o
|
|
1364
|
+
]
|
|
1365
|
+
), Ze = Te(
|
|
1366
|
+
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
1367
|
+
(..._) => It(o, A.current, ..._),
|
|
1368
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1369
|
+
[]
|
|
1370
|
+
);
|
|
1371
|
+
if (Ie(() => {
|
|
1372
|
+
V.current = t, Y.current = n, d(re) || (we.current = re);
|
|
1373
|
+
}), Ie(() => {
|
|
1374
|
+
if (!c) return;
|
|
1375
|
+
const _ = ce.bind(k, Le);
|
|
1376
|
+
let p = 0;
|
|
1377
|
+
m().revalidateOnFocus && (p = Date.now() + m().focusThrottleInterval);
|
|
1378
|
+
const g = Vo(c, E, ($, oe = {}) => {
|
|
1379
|
+
if ($ == Tt) {
|
|
1380
|
+
const x = Date.now();
|
|
1381
|
+
m().revalidateOnFocus && x > p && Z() && (p = x + m().focusThrottleInterval, _());
|
|
1382
|
+
} else if ($ == xt)
|
|
1383
|
+
m().revalidateOnReconnect && Z() && _();
|
|
1384
|
+
else {
|
|
1385
|
+
if ($ == Nt)
|
|
1386
|
+
return ce();
|
|
1387
|
+
if ($ == lt)
|
|
1388
|
+
return ce(oe);
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
return T.current = !1, A.current = c, J.current = !0, ee({
|
|
1392
|
+
_k: fe
|
|
1393
|
+
}), Je && (D[c] || (d(G) || ae ? _() : go(_))), () => {
|
|
1394
|
+
T.current = !0, g();
|
|
1395
|
+
};
|
|
1396
|
+
}, [
|
|
1397
|
+
c
|
|
1398
|
+
]), Ie(() => {
|
|
1399
|
+
let _;
|
|
1400
|
+
function p() {
|
|
1401
|
+
const g = j(u) ? u(M().data) : u;
|
|
1402
|
+
g && _ !== -1 && (_ = setTimeout(w, g));
|
|
1403
|
+
}
|
|
1404
|
+
function w() {
|
|
1405
|
+
!M().error && (y || m().isVisible()) && (v || m().isOnline()) ? ce(Le).then(p) : p();
|
|
1406
|
+
}
|
|
1407
|
+
return p(), () => {
|
|
1408
|
+
_ && (clearTimeout(_), _ = -1);
|
|
1409
|
+
};
|
|
1410
|
+
}, [
|
|
1411
|
+
u,
|
|
1412
|
+
y,
|
|
1413
|
+
v,
|
|
1414
|
+
c
|
|
1415
|
+
]), zt(me), s) {
|
|
1416
|
+
if (!ut && ae && X)
|
|
1417
|
+
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
1418
|
+
X && (V.current = t, Y.current = n, T.current = !1);
|
|
1419
|
+
const _ = se[c], p = !d(_) && X ? Ze(_) : _t;
|
|
1420
|
+
if (Ce(p), !d(_e) && X)
|
|
1421
|
+
throw _e;
|
|
1422
|
+
const w = X ? ce(Le) : _t;
|
|
1423
|
+
!d(me) && X && (w.status = "fulfilled", w.value = !0), Ce(w);
|
|
1424
|
+
}
|
|
1425
|
+
return {
|
|
1426
|
+
mutate: Ze,
|
|
1427
|
+
get data() {
|
|
1428
|
+
return te.data = !0, me;
|
|
1429
|
+
},
|
|
1430
|
+
get error() {
|
|
1431
|
+
return te.error = !0, _e;
|
|
1432
|
+
},
|
|
1433
|
+
get isValidating() {
|
|
1434
|
+
return te.isValidating = !0, Ot;
|
|
1435
|
+
},
|
|
1436
|
+
get isLoading() {
|
|
1437
|
+
return te.isLoading = !0, qt;
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
}, mt = Ao(Mo);
|
|
1441
|
+
class jo extends Error {
|
|
1442
|
+
constructor({ message: t, status: n, data: o }) {
|
|
1443
|
+
super(t), this.name = "TwitterApiError", this.status = n, this.data = o;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
const Wo = mt.default || mt, Bo = "https://react-tweet.vercel.app";
|
|
1447
|
+
async function Fo([e, t]) {
|
|
1448
|
+
const n = await fetch(e, t), o = await n.json();
|
|
1449
|
+
if (n.ok) return o.data || null;
|
|
1450
|
+
throw new jo({
|
|
1451
|
+
message: `Failed to fetch tweet at "${e}" with "${n.status}".`,
|
|
1452
|
+
data: o,
|
|
1453
|
+
status: n.status
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
const Po = (e, t, n) => {
|
|
1457
|
+
const { isLoading: o, data: i, error: s } = Wo(() => t || e ? [
|
|
1458
|
+
t || e && `${Bo}/api/tweet/${e}`,
|
|
1459
|
+
n
|
|
1460
|
+
] : null, Fo, {
|
|
1461
|
+
revalidateIfStale: !1,
|
|
1462
|
+
revalidateOnFocus: !1,
|
|
1463
|
+
shouldRetryOnError: !1
|
|
1464
|
+
});
|
|
1465
|
+
return {
|
|
1466
|
+
// If data is `undefined` then it might be the first render where SWR hasn't started doing
|
|
1467
|
+
// any work, so we set `isLoading` to `true`.
|
|
1468
|
+
isLoading: !!(o || i === void 0 && !s),
|
|
1469
|
+
data: i,
|
|
1470
|
+
error: s
|
|
1471
|
+
};
|
|
1472
|
+
}, Uo = ({ id: e, apiUrl: t, fallback: n = /* @__PURE__ */ r(co, {}), components: o, fetchOptions: i, onError: s }) => {
|
|
1473
|
+
const { data: a, error: l, isLoading: h } = Po(e, t, i);
|
|
1474
|
+
if (h) return n;
|
|
1475
|
+
if (l || !a) {
|
|
1476
|
+
const u = (o == null ? void 0 : o.TweetNotFound) || ro;
|
|
1477
|
+
return /* @__PURE__ */ r(u, {
|
|
1478
|
+
error: s ? s(l) : l
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
return /* @__PURE__ */ r(eo, {
|
|
1482
|
+
tweet: a,
|
|
1483
|
+
components: o
|
|
1484
|
+
});
|
|
1485
|
+
};
|
|
1486
|
+
function zo({ node: e }) {
|
|
1487
|
+
var o;
|
|
1488
|
+
const t = ((o = e == null ? void 0 : e.attrs) == null ? void 0 : o.src) || "", n = t == null ? void 0 : t.split("/").pop();
|
|
1489
|
+
return n ? /* @__PURE__ */ r(Mt, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Uo, { id: n }) }) }) : null;
|
|
1490
|
+
}
|
|
1491
|
+
function Ho(e) {
|
|
1492
|
+
const { t } = en(), [n, o] = de("");
|
|
1493
|
+
Fe(() => {
|
|
1494
|
+
var s;
|
|
1495
|
+
if (e != null && e.editor) {
|
|
1496
|
+
const { src: a } = (s = e.editor) == null ? void 0 : s.getAttributes(Qo.name);
|
|
1497
|
+
a && o(a);
|
|
1498
|
+
}
|
|
1499
|
+
}, [e == null ? void 0 : e.editor]);
|
|
1500
|
+
function i(s) {
|
|
1501
|
+
s.preventDefault(), s.stopPropagation(), e == null || e.onSetLink(n);
|
|
1502
|
+
}
|
|
1503
|
+
return /* @__PURE__ */ r("div", { className: "border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black", children: /* @__PURE__ */ f(
|
|
1504
|
+
"form",
|
|
1505
|
+
{
|
|
1506
|
+
className: "richtext-flex richtext-flex-col richtext-gap-2",
|
|
1507
|
+
onSubmit: i,
|
|
1508
|
+
children: [
|
|
1509
|
+
/* @__PURE__ */ r(Ht, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
|
|
1510
|
+
/* @__PURE__ */ r("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ r("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ r(
|
|
1511
|
+
Gt,
|
|
1512
|
+
{
|
|
1513
|
+
className: "richtext-w-80",
|
|
1514
|
+
onChange: (s) => o(s.target.value),
|
|
1515
|
+
placeholder: "Text",
|
|
1516
|
+
required: !0,
|
|
1517
|
+
type: "text",
|
|
1518
|
+
value: n
|
|
1519
|
+
}
|
|
1520
|
+
) }) }),
|
|
1521
|
+
/* @__PURE__ */ r(
|
|
1522
|
+
Xt,
|
|
1523
|
+
{
|
|
1524
|
+
className: "richtext-mt-2 richtext-self-end",
|
|
1525
|
+
type: "submit",
|
|
1526
|
+
children: t("editor.link.dialog.button.apply")
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
]
|
|
1530
|
+
}
|
|
1531
|
+
) });
|
|
1532
|
+
}
|
|
1533
|
+
function Go(e) {
|
|
1534
|
+
function t(n) {
|
|
1535
|
+
e.action && e.action(n);
|
|
1536
|
+
}
|
|
1537
|
+
return /* @__PURE__ */ f(Kt, { modal: !0, children: [
|
|
1538
|
+
/* @__PURE__ */ r(Qt, { disabled: e == null ? void 0 : e.disabled, asChild: !0, children: /* @__PURE__ */ r(
|
|
1539
|
+
Jt,
|
|
1540
|
+
{
|
|
1541
|
+
tooltip: e == null ? void 0 : e.tooltip,
|
|
1542
|
+
tooltipOptions: e == null ? void 0 : e.tooltipOptions,
|
|
1543
|
+
isActive: e == null ? void 0 : e.isActive,
|
|
1544
|
+
disabled: e == null ? void 0 : e.disabled,
|
|
1545
|
+
children: /* @__PURE__ */ r(Yt, { name: e == null ? void 0 : e.icon })
|
|
1546
|
+
}
|
|
1547
|
+
) }),
|
|
1548
|
+
/* @__PURE__ */ r(Zt, { hideWhenDetached: !0, className: "richtext-w-full", align: "start", side: "bottom", children: /* @__PURE__ */ r(Ho, { editor: e.editor, onSetLink: t }) })
|
|
1549
|
+
] });
|
|
1550
|
+
}
|
|
1551
|
+
const Xo = /(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g, Ko = /^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;
|
|
1552
|
+
function pt(e) {
|
|
1553
|
+
return e.match(Ko);
|
|
1554
|
+
}
|
|
1555
|
+
const Qo = /* @__PURE__ */ Dt.create({
|
|
1556
|
+
name: "twitter",
|
|
1557
|
+
draggable: !0,
|
|
1558
|
+
selectable: !0,
|
|
1559
|
+
addOptions() {
|
|
1560
|
+
return {
|
|
1561
|
+
addPasteHandler: !0,
|
|
1562
|
+
HTMLAttributes: {},
|
|
1563
|
+
inline: !1,
|
|
1564
|
+
origin: "",
|
|
1565
|
+
button: ({ editor: e, t }) => ({
|
|
1566
|
+
component: Go,
|
|
1567
|
+
componentProps: {
|
|
1568
|
+
action: (n) => {
|
|
1569
|
+
e.commands.setTweet({ src: n });
|
|
1570
|
+
},
|
|
1571
|
+
isActive: () => !1,
|
|
1572
|
+
disabled: !1,
|
|
1573
|
+
icon: "Twitter",
|
|
1574
|
+
tooltip: t("editor.twitter.tooltip"),
|
|
1575
|
+
editor: e
|
|
1576
|
+
}
|
|
1577
|
+
})
|
|
1578
|
+
};
|
|
1579
|
+
},
|
|
1580
|
+
addNodeView() {
|
|
1581
|
+
return jt(zo, { attrs: this.options.HTMLAttributes });
|
|
1582
|
+
},
|
|
1583
|
+
inline() {
|
|
1584
|
+
return this.options.inline;
|
|
1585
|
+
},
|
|
1586
|
+
group() {
|
|
1587
|
+
return this.options.inline ? "inline" : "block";
|
|
1588
|
+
},
|
|
1589
|
+
addAttributes() {
|
|
1590
|
+
return {
|
|
1591
|
+
src: {
|
|
1592
|
+
default: null
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
},
|
|
1596
|
+
parseHTML() {
|
|
1597
|
+
return [
|
|
1598
|
+
{
|
|
1599
|
+
tag: "div[data-twitter]"
|
|
1600
|
+
}
|
|
1601
|
+
];
|
|
1602
|
+
},
|
|
1603
|
+
addCommands() {
|
|
1604
|
+
return {
|
|
1605
|
+
setTweet: (e) => ({ commands: t }) => pt(e.src) ? t.insertContent({
|
|
1606
|
+
type: this.name,
|
|
1607
|
+
attrs: e
|
|
1608
|
+
}) : !1,
|
|
1609
|
+
updateTweet: (e) => ({ commands: t }) => pt(e.src) ? t.updateAttributes(this.name, { src: e.src }) : !1
|
|
1610
|
+
};
|
|
1611
|
+
},
|
|
1612
|
+
addPasteRules() {
|
|
1613
|
+
return this.options.addPasteHandler ? [
|
|
1614
|
+
Vt({
|
|
1615
|
+
find: Xo,
|
|
1616
|
+
type: this.type,
|
|
1617
|
+
getAttributes: (e) => ({ src: e.input })
|
|
1618
|
+
})
|
|
1619
|
+
] : [];
|
|
1620
|
+
},
|
|
1621
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
1622
|
+
return ["div", At({ "data-twitter": "" }, e)];
|
|
1623
|
+
}
|
|
1624
|
+
});
|
|
1625
|
+
export {
|
|
1626
|
+
Ho as F,
|
|
1627
|
+
Qo as T
|
|
1628
|
+
};
|