@remarkablejames/editor 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{ActionMenuButton-NfiUDE60.cjs → ActionMenuButton-DI9_8wC0.cjs} +1 -1
- package/lib/{ActionMenuButton-CpmEfz31.js → ActionMenuButton-DL05l66z.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +2 -2
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +16 -15
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +32 -31
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-DlgdaO_B.cjs → Drawer-DEzhWKwY.cjs} +1 -1
- package/lib/{Drawer-CayP4Ww4.js → Drawer-DhM1qM6R.js} +15 -15
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +8 -8
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +36 -36
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +3 -3
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +3 -3
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +8 -8
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-CANdxSpV.cjs → Iframe-DbYJ82AI.cjs} +1 -1
- package/lib/{Iframe-C6Sb97KS.js → Iframe-yDX_zHls.js} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +28 -28
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +12 -12
- package/lib/{Indent-CcFe8py3.js → Indent-CA46zsbb.js} +1 -1
- package/lib/{Indent-DuB2U6Cs.cjs → Indent-CYaCq_Mv.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/Katex-Dh-kTBjf.cjs +4 -0
- package/lib/{Katex-Bp6AnIUF.js → Katex-g3ZS3zUf.js} +4 -3
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-C2zX0WVK.cjs → LinkEditBlock-ClqpI1FH.cjs} +1 -1
- package/lib/{LinkEditBlock-BiHumIJR.js → LinkEditBlock-qE5KHPQs.js} +7 -7
- package/lib/Mermaid-BmUChJSB.cjs +2 -0
- package/lib/{Mermaid-Dlx0XTJj.js → Mermaid-CefRECZY.js} +24 -23
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +1 -1
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/PaywallSeparator.cjs +1 -1
- package/lib/PaywallSeparator.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +7 -7
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +2 -2
- package/lib/{SlashCommandNodeView-DzmsYaNc.js → SlashCommandNodeView-BsIrWlhS.js} +5 -5
- package/lib/{SlashCommandNodeView-BfWNWGRr.cjs → SlashCommandNodeView-DpXsfGmo.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-BfM6ywrZ.cjs → Table-B-0TePQ3.cjs} +1 -1
- package/lib/{Table-IH34r4jd.js → Table-CG0nisk4.js} +2 -2
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-FVQKPaq6.js → Twitter-DlGSWdh7.js} +7 -7
- package/lib/{Twitter-axcoCgD7.cjs → Twitter-DvMmVNMF.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +83 -81
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/{dropdown-menu-Ce2TorkG.js → dropdown-menu-D-mNjyKn.js} +1 -1
- package/lib/{dropdown-menu-DirUyRAI.cjs → dropdown-menu-gOopBX-L.cjs} +1 -1
- package/lib/index-CUnpdrCy.cjs +28 -0
- package/lib/{index-CnKgiZFQ.js → index-CelRl0mr.js} +1062 -1191
- package/lib/index.cjs +3 -3
- package/lib/index.js +61 -59
- package/lib/{popover-BdLwAlrM.cjs → popover-DEMkixfo.cjs} +1 -1
- package/lib/{popover-BzJyaFvy.js → popover-SMtif0E1.js} +1 -1
- package/lib/select-BqlizSg4.cjs +1 -0
- package/lib/select-Dc3RkAhQ.js +120 -0
- package/lib/{separator-D-fyzbfx.js → separator-DWLSmuSh.js} +14 -14
- package/lib/{separator-CoQaQmFK.cjs → separator-DuP4NoiV.cjs} +1 -1
- package/lib/textarea-C89l2GRG.cjs +1 -0
- package/lib/textarea-DvciwVxS.js +20 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +18 -18
- package/package.json +21 -32
- package/lib/Katex-DFU1unCm.cjs +0 -4
- package/lib/Mermaid-B8lQSOGn.cjs +0 -2
- package/lib/index-BynXHtjJ.cjs +0 -28
package/lib/TextUnderline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as m, m as p } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as h, A as k } from "./index-
|
|
3
|
+
import { u as f, d as h, A as k } from "./index-CelRl0mr.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
var M = m.create({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as U, a8 as rt, h as Mt, N as jt, m as Wt, a9 as Bt, k as Ft } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsx as r, jsxs as h, Fragment as Pt } from "react/jsx-runtime";
|
|
3
3
|
import Be, { useState as se, Fragment as Ut, useEffect as Fe, useMemo as Pe, createContext as zt, useLayoutEffect as Ht, useContext as Gt, useRef as K, useCallback as Te, useDebugValue as Xt } from "react";
|
|
4
|
-
import { L as Kt, j as Qt, B as Jt, h as Yt, u as Zt, d as en, A as tn, I as nn } from "./index-
|
|
4
|
+
import { L as Kt, j as Qt, B as Jt, h as Yt, u as Zt, d as en, A as tn, I as nn } from "./index-CelRl0mr.js";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { u as rn } from "./index-BGd2HiwP.js";
|
|
7
|
+
import { P as on, a as an, b as sn } from "./popover-SMtif0E1.js";
|
|
8
8
|
const cn = "_verified_lvyh0_1", Ue = {
|
|
9
9
|
verified: cn
|
|
10
10
|
}, ln = () => /* @__PURE__ */ r("svg", {
|
|
@@ -1532,7 +1532,7 @@ function ea({ node: e }) {
|
|
|
1532
1532
|
return n ? /* @__PURE__ */ r(Mt, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Zo, { id: n }) }) }) : null;
|
|
1533
1533
|
}
|
|
1534
1534
|
function ta(e) {
|
|
1535
|
-
const { t } =
|
|
1535
|
+
const { t } = rn(), [n, o] = se("");
|
|
1536
1536
|
Fe(() => {
|
|
1537
1537
|
var i;
|
|
1538
1538
|
if (e != null && e.editor) {
|
|
@@ -1570,8 +1570,8 @@ function fa() {
|
|
|
1570
1570
|
function g(m) {
|
|
1571
1571
|
d || c && (c(m), t(!1));
|
|
1572
1572
|
}
|
|
1573
|
-
return /* @__PURE__ */ h(
|
|
1574
|
-
/* @__PURE__ */ r(
|
|
1573
|
+
return /* @__PURE__ */ h(on, { modal: !0, onOpenChange: t, open: e, children: [
|
|
1574
|
+
/* @__PURE__ */ r(an, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1575
1575
|
tn,
|
|
1576
1576
|
{
|
|
1577
1577
|
disabled: d,
|
|
@@ -1581,7 +1581,7 @@ function fa() {
|
|
|
1581
1581
|
children: /* @__PURE__ */ r(nn, { name: a })
|
|
1582
1582
|
}
|
|
1583
1583
|
) }),
|
|
1584
|
-
/* @__PURE__ */ r(
|
|
1584
|
+
/* @__PURE__ */ r(sn, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: /* @__PURE__ */ r(ta, { editor: n, onSetLink: g }) })
|
|
1585
1585
|
] });
|
|
1586
1586
|
}
|
|
1587
1587
|
const na = /(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g, ra = /^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),z=require("./index-BynXHtjJ.cjs");require("./theme.cjs");const we=require("./popover-BdLwAlrM.cjs"),qt=require("./index-DgOXAdKt.cjs"),$t="_verified_lvyh0_1",We={verified:$t},Dt=()=>t.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{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"})})}),At=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsxs("g",{children:[t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-a",x1:"4.411",x2:"18.083",y1:"2.495",y2:"21.508",children:[t.jsx("stop",{offset:"0",stopColor:"#f4e72a"}),t.jsx("stop",{offset:".539",stopColor:"#cd8105"}),t.jsx("stop",{offset:".68",stopColor:"#cb7b00"}),t.jsx("stop",{offset:"1",stopColor:"#f4ec26"}),t.jsx("stop",{offset:"1",stopColor:"#f4e72a"})]}),t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-b",x1:"5.355",x2:"16.361",y1:"3.395",y2:"19.133",children:[t.jsx("stop",{offset:"0",stopColor:"#f9e87f"}),t.jsx("stop",{offset:".406",stopColor:"#e2b719"}),t.jsx("stop",{offset:".989",stopColor:"#e2b719"})]}),t.jsxs("g",{clipRule:"evenodd",fillRule:"evenodd",children:[t.jsx("path",{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",fill:"url(#0-a)"}),t.jsx("path",{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",fill:"url(#0-b)"}),t.jsx("path",{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",fill:"#d18800"})]})]})}),Mt=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{clipRule:"evenodd",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",fillRule:"evenodd"})})}),Vt="_root_98iqw_1",Wt="_article_98iqw_21",et={root:Vt,article:Wt},Be=({className:e,children:n})=>t.jsx("div",{className:S.clsx("react-tweet-theme",et.root,e),children:t.jsx("article",{className:et.article,children:n})}),ht=e=>t.jsx("img",{...e}),Bt="_verifiedOld_lcna5_1",Ft="_verifiedBlue_lcna5_4",Pt="_verifiedGovernment_lcna5_7",ye={verifiedOld:Bt,verifiedBlue:Ft,verifiedGovernment:Pt},_t=({user:e,className:n})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=t.jsx(Dt,{}),o=ye.verifiedBlue;if(r)switch(e.is_blue_verified||(o=ye.verifiedOld),e.verified_type){case"Government":s=t.jsx(Mt,{}),o=ye.verifiedGovernment;break;case"Business":s=t.jsx(At,{}),o=null;break}return r?t.jsx("div",{className:S.clsx(n,o),children:s}):null},Ut="_label_36ucz_1",zt={label:Ut},mt=({user:e,className:n})=>{var r;const s=e.highlighted_label;if(!s)return null;const o=(r=s.badge)==null?void 0:r.url;return o?t.jsx("div",{className:S.clsx(zt.label,n),children:t.jsx("img",{src:o,alt:s.description})}):null},Ht="_header_nqq4j_1",Gt="_avatar_nqq4j_11",Xt="_avatarOverflow_nqq4j_16",Kt="_avatarSquare_nqq4j_23",Qt="_avatarShadow_nqq4j_26",Jt="_author_nqq4j_37",Yt="_authorLink_nqq4j_44",Zt="_authorVerified_nqq4j_53",en="_authorLinkText_nqq4j_56",tn="_authorMeta_nqq4j_63",nn="_authorFollow_nqq4j_66",rn="_username_nqq4j_69",sn="_follow_nqq4j_74",on="_separator_nqq4j_82",an="_brand_nqq4j_86",cn="_twitterIcon_nqq4j_90",T={header:Ht,avatar:Gt,avatarOverflow:Xt,avatarSquare:Kt,avatarShadow:Qt,author:Jt,authorLink:Yt,authorVerified:Zt,authorLinkText:en,authorMeta:tn,authorFollow:nn,username:rn,follow:sn,separator:on,brand:an,twitterIcon:cn},ln=({tweet:e,components:n})=>{var r;const s=(r=n==null?void 0:n.AvatarImg)!=null?r:ht,{user:o}=e;return t.jsxs("div",{className:T.header,children:[t.jsxs("a",{href:e.url,className:T.avatar,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:S.clsx(T.avatarOverflow,o.profile_image_shape==="Square"&&T.avatarSquare),children:t.jsx(s,{src:o.profile_image_url_https,alt:o.name,width:48,height:48})}),t.jsx("div",{className:T.avatarOverflow,children:t.jsx("div",{className:T.avatarShadow})})]}),t.jsxs("div",{className:T.author,children:[t.jsxs("a",{href:e.url,className:T.authorLink,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:T.authorLinkText,children:t.jsx("span",{title:o.name,children:o.name})}),t.jsx(_t,{user:o,className:T.authorVerified}),t.jsx(mt,{user:o})]}),t.jsxs("div",{className:T.authorMeta,children:[t.jsx("a",{href:e.url,className:T.username,target:"_blank",rel:"noopener noreferrer",children:t.jsxs("span",{title:`@${o.screen_name}`,children:["@",o.screen_name]})}),t.jsxs("div",{className:T.authorFollow,children:[t.jsx("span",{className:T.separator,children:"·"}),t.jsx("a",{href:o.follow_url,className:T.follow,target:"_blank",rel:"noopener noreferrer",children:"Follow"})]})]})]}),t.jsx("a",{href:e.url,className:T.brand,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Twitter",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:T.twitterIcon,children:t.jsx("g",{children:t.jsx("path",{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"})})})})]})},dn="_root_1ec15_1",un={root:dn},fn=({tweet:e})=>t.jsxs("a",{href:e.in_reply_to_url,className:un.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),hn="_root_eihfa_1",_n={root:hn},pt=({href:e,children:n})=>t.jsx("a",{href:e,className:_n.root,target:"_blank",rel:"noopener noreferrer nofollow",children:n}),mn="_root_1xq52_1",pn={root:mn},xn=({tweet:e})=>t.jsxs("p",{className:pn.root,lang:e.lang,dir:"auto",children:[e.entities.map((n,r)=>{switch(n.type){case"hashtag":case"mention":case"url":case"symbol":return t.jsx(pt,{href:n.href,children:n.text},r);case"media":return;default:return t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r)}}),e.note_tweet?t.jsx(vn,{tweet:e}):null]});function vn({tweet:e}){return t.jsxs(pt,{href:e.url,children:[t.jsx("span",{children:" "}),"Show more"]})}const gn={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},jn=new Intl.DateTimeFormat("en-US",gn),wn=e=>{const n={};for(const r of e)n[r.type]=r.value;return n},yn=e=>{const n=wn(jn.formatToParts(e)),r=`${n.hour}:${n.minute} ${n.dayPeriod}`,s=`${n.month} ${n.day}, ${n.year}`;return`${r} · ${s}`},tt=e=>`https://x.com/${e.user.screen_name}/status/${e.id_str}`,xt=e=>`https://x.com/${typeof e=="string"?e:e.user.screen_name}`,bn=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,Tn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,Nn=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,Rn=e=>`https://x.com/hashtag/${e.text}`,Sn=e=>`https://x.com/search?q=%24${e.text}`,In=e=>`https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`,vt=(e,n)=>{const r=new URL(e.media_url_https),s=r.pathname.split(".").pop();return s?(r.pathname=r.pathname.replace(`.${s}`,""),r.searchParams.set("format",s),r.searchParams.set("name",n),r.toString()):e.media_url_https},kn=e=>{const{variants:n}=e.video_info;return n.filter(s=>s.content_type==="video/mp4").sort((s,o)=>{var a,i;return((a=o.bitrate)!=null?a:0)-((i=s.bitrate)!=null?i:0)})},En=e=>{const n=kn(e);return n.length>1?n[1]:n[0]},Ce=e=>e>999999?`${(e/1e6).toFixed(1)}M`:e>999?`${(e/1e3).toFixed(1)}K`:e.toString();function nt(e){const n=Array.from(e.text),r=[{indices:e.display_text_range,type:"text"}];return le(r,"hashtag",e.entities.hashtags),le(r,"mention",e.entities.user_mentions),le(r,"url",e.entities.urls),le(r,"symbol",e.entities.symbols),e.entities.media&&le(r,"media",e.entities.media),Cn(e,r),r.map(s=>{const o=n.slice(s.indices[0],s.indices[1]).join("");switch(s.type){case"hashtag":return Object.assign(s,{href:Rn(s),text:o});case"mention":return Object.assign(s,{href:xt(s.screen_name),text:o});case"url":case"media":return Object.assign(s,{href:s.expanded_url,text:s.display_url});case"symbol":return Object.assign(s,{href:Sn(s),text:o});default:return Object.assign(s,{text:o})}})}function le(e,n,r){for(const s of r)for(const[o,a]of e.entries()){if(a.indices[0]>s.indices[0]||a.indices[1]<s.indices[1])continue;const i=[{...s,type:n}];a.indices[0]<s.indices[0]&&i.unshift({indices:[a.indices[0],s.indices[0]],type:"text"}),a.indices[1]>s.indices[1]&&i.push({indices:[s.indices[1],a.indices[1]],type:"text"}),e.splice(o,1,...i);break}}function Cn(e,n){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]);const r=n.at(-1);r&&r.indices[1]>e.display_text_range[1]&&(r.indices[1]=e.display_text_range[1])}const On=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:Nn(e)},like_url:bn(e),reply_url:Tn(e),in_reply_to_url:e.in_reply_to_screen_name?In(e):void 0,entities:nt(e),quoted_tweet:e.quoted_tweet?{...e.quoted_tweet,url:tt(e.quoted_tweet),entities:nt(e.quoted_tweet)}:void 0}),Ln="_root_g9tkv_1",qn="_rounded_g9tkv_6",$n="_mediaWrapper_g9tkv_10",Dn="_grid2Columns_g9tkv_17",An="_grid3_g9tkv_20",Mn="_grid2x2_g9tkv_23",Vn="_mediaContainer_g9tkv_26",Wn="_mediaLink_g9tkv_34",Bn="_skeleton_g9tkv_38",Fn="_image_g9tkv_43",C={root:Ln,rounded:qn,mediaWrapper:$n,grid2Columns:Dn,grid3:An,grid2x2:Mn,mediaContainer:Vn,mediaLink:Wn,skeleton:Bn,image:Fn},Pn="_anchor_fp31d_1",Un="_videoButton_fp31d_17",zn="_videoButtonIcon_fp31d_35",Hn="_watchOnTwitter_fp31d_44",Gn="_viewReplies_fp31d_60",oe={anchor:Pn,videoButton:Un,videoButtonIcon:zn,watchOnTwitter:Hn,viewReplies:Gn},Xn=({tweet:e,media:n})=>{const[r,s]=h.useState(!0),[o,a]=h.useState(!1),[i,c]=h.useState(!1),f=En(n);let d=0;return t.jsxs(t.Fragment,{children:[t.jsx("video",{className:C.image,poster:vt(n,"small"),controls:!r,playsInline:!0,preload:"none",tabIndex:r?-1:0,onPlay:()=>{d&&window.clearTimeout(d),o||a(!0),i&&c(!1)},onPause:()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{o&&a(!1),d=0},100)},onEnded:()=>{c(!0)},children:t.jsx("source",{src:f.url,type:f.content_type})}),r&&t.jsx("button",{type:"button",className:oe.videoButton,"aria-label":"View video on X",onClick:v=>{const m=v.currentTarget.previousSibling;v.preventDefault(),s(!1),m.load(),m.play().then(()=>{a(!0),m.focus()}).catch(w=>{console.error("Error playing video:",w),s(!0),a(!1)})},children:t.jsx("svg",{viewBox:"0 0 24 24",className:oe.videoButtonIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!i&&t.jsx("div",{className:oe.watchOnTwitter,children:t.jsx("a",{href:e.url,className:oe.anchor,target:"_blank",rel:"noopener noreferrer",children:r?"Watch on X":"Continue watching on X"})}),i&&t.jsx("a",{href:e.url,className:S.clsx(oe.anchor,oe.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},Kn=e=>t.jsx("img",{...e}),rt=(e,n)=>{let r=56.25;return n===1&&(r=100/e.original_info.width*e.original_info.height),n===2&&(r=r*2),{width:e.type==="photo"?void 0:"unset",paddingBottom:`${r}%`}},gt=({tweet:e,components:n,quoted:r})=>{var s,o,a;const i=(a=(s=e.mediaDetails)==null?void 0:s.length)!=null?a:0;var c;const f=(c=n==null?void 0:n.MediaImg)!=null?c:Kn;return t.jsx("div",{className:S.clsx(C.root,!r&&C.rounded),children:t.jsx("div",{className:S.clsx(C.mediaWrapper,i>1&&C.grid2Columns,i===3&&C.grid3,i>4&&C.grid2x2),children:(o=e.mediaDetails)==null?void 0:o.map(d=>t.jsx(h.Fragment,{children:d.type==="photo"?t.jsxs("a",{href:e.url,className:S.clsx(C.mediaContainer,C.mediaLink),target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(f,{src:vt(d,"small"),alt:d.ext_alt_text||"Image",className:C.image,draggable:!0})]},d.media_url_https):t.jsxs("div",{className:C.mediaContainer,children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(Xn,{tweet:e,media:d})]},d.media_url_https)},d.media_url_https))})})},Qn="_root_i24yn_1",Jn={root:Qn},Yn=({tweet:e})=>{const n=new Date(e.created_at),r=yn(n);return t.jsx("a",{className:Jn.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:t.jsx("time",{dateTime:n.toISOString(),children:r})})},Zn="_info_19qcj_1",er="_infoLink_19qcj_10",tr="_infoIcon_19qcj_30",be={info:Zn,infoLink:er,infoIcon:tr},nr=({tweet:e})=>t.jsxs("div",{className:be.info,children:[t.jsx(Yn,{tweet:e}),t.jsx("a",{className:be.infoLink,href:"https://help.x.com/en/x-for-websites-ads-info-and-privacy",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter for Websites, Ads Information and Privacy",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:be.infoIcon,children:t.jsx("g",{children:t.jsx("path",{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"})})})})]}),rr="_actions_n2anf_1",sr="_like_n2anf_13",or="_reply_n2anf_14",ir="_copy_n2anf_15",ar="_likeIconWrapper_n2anf_27",cr="_likeCount_n2anf_30",lr="_replyIconWrapper_n2anf_35",dr="_copyIconWrapper_n2anf_36",ur="_likeIcon_n2anf_27",fr="_replyIcon_n2anf_35",hr="_copyIcon_n2anf_36",_r="_replyText_n2anf_56",mr="_copyText_n2anf_57",k={actions:rr,like:sr,reply:or,copy:ir,likeIconWrapper:ar,likeCount:cr,replyIconWrapper:lr,copyIconWrapper:dr,likeIcon:ur,replyIcon:fr,copyIcon:hr,replyText:_r,copyText:mr},pr=({tweet:e})=>{const[n,r]=h.useState(!1),s=()=>{navigator.clipboard.writeText(e.url),r(!0)};return h.useEffect(()=>{if(n){const o=setTimeout(()=>{r(!1)},6e3);return()=>clearTimeout(o)}},[n]),t.jsxs("button",{type:"button",className:k.copy,"aria-label":"Copy link",onClick:s,children:[t.jsx("div",{className:k.copyIconWrapper,children:n?t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})}):t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.copyText,children:n?"Copied!":"Copy link"})]})},xr=({tweet:e})=>{const n=Ce(e.favorite_count);return t.jsxs("div",{className:k.actions,children:[t.jsxs("a",{className:k.like,href:e.like_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Like. This Tweet has ${n} likes`,children:[t.jsx("div",{className:k.likeIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.likeIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.likeCount,children:n})]}),t.jsxs("a",{className:k.reply,href:e.reply_url,target:"_blank",rel:"noopener noreferrer","aria-label":"Reply to this Tweet on Twitter",children:[t.jsx("div",{className:k.replyIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.replyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.replyText,children:"Reply"})]}),t.jsx(pr,{tweet:e})]})},vr="_replies_1cutb_1",gr="_link_1cutb_4",jr="_text_1cutb_23",Te={replies:vr,link:gr,text:jr},wr=({tweet:e})=>t.jsx("div",{className:Te.replies,children:t.jsx("a",{className:Te.link,href:e.url,target:"_blank",rel:"noopener noreferrer",children:t.jsx("span",{className:Te.text,children:e.conversation_count===0?"Read more on X":e.conversation_count===1?`Read ${Ce(e.conversation_count)} reply`:`Read ${Ce(e.conversation_count)} replies`})})}),yr="_root_q5799_1",br="_article_q5799_16",st={root:yr,article:br},Tr=({tweet:e,children:n})=>t.jsx("div",{className:st.root,onClick:r=>{r.preventDefault(),window.open(e.url,"_blank")},children:t.jsx("article",{className:st.article,children:n})}),Nr="_header_f00ab_1",Rr="_avatar_f00ab_11",Sr="_avatarOverflow_f00ab_16",Ir="_avatarSquare_f00ab_23",kr="_author_f00ab_27",Er="_authorText_f00ab_33",Cr="_username_f00ab_40",Q={header:Nr,avatar:Rr,avatarOverflow:Sr,avatarSquare:Ir,author:kr,authorText:Er,username:Cr},Or=({tweet:e,components:n})=>{const{user:r}=e;var s;const o=(s=n==null?void 0:n.AvatarImg)!=null?s:ht;return t.jsxs("div",{className:Q.header,children:[t.jsx("a",{href:e.url,className:Q.avatar,target:"_blank",rel:"noopener noreferrer",children:t.jsx("div",{className:S.clsx(Q.avatarOverflow,r.profile_image_shape==="Square"&&Q.avatarSquare),children:t.jsx(o,{src:r.profile_image_url_https,alt:r.name,width:20,height:20})})}),t.jsxs("div",{className:Q.author,children:[t.jsx("div",{className:Q.authorText,children:t.jsx("span",{title:r.name,children:r.name})}),t.jsx(_t,{user:r}),t.jsx(mt,{user:r}),t.jsx("div",{className:Q.username,children:t.jsxs("span",{title:`@${r.screen_name}`,children:["@",r.screen_name]})})]})]})},Lr="_root_175ot_1",qr={root:Lr},$r=({tweet:e})=>t.jsx("p",{className:qr.root,lang:e.lang,dir:"auto",children:e.entities.map((n,r)=>t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r))}),Dr=({tweet:e,components:n})=>{var r;return t.jsxs(Tr,{tweet:e,children:[t.jsx(Or,{tweet:e,components:n}),t.jsx($r,{tweet:e}),(r=e.mediaDetails)!=null&&r.length?t.jsx(gt,{quoted:!0,tweet:e}):null]})},Ar=({tweet:e,components:n})=>{var r;const s=h.useMemo(()=>On(e),[e]);return t.jsxs(Be,{children:[t.jsx(ln,{tweet:s,components:n}),s.in_reply_to_status_id_str&&t.jsx(fn,{tweet:s}),t.jsx(xn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?t.jsx(gt,{tweet:s,components:n}):null,s.quoted_tweet&&t.jsx(Dr,{tweet:s.quoted_tweet,components:n}),t.jsx(nr,{tweet:s}),t.jsx(xr,{tweet:s}),t.jsx(wr,{tweet:s})]})},Mr="_root_16yxa_1",Vr={root:Mr},Wr=e=>t.jsx(Be,{children:t.jsxs("div",{className:Vr.root,children:[t.jsx("h3",{children:"Tweet not found"}),t.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Br="_skeleton_oi7hr_1",Fr={skeleton:Br},me=({style:e})=>t.jsx("span",{className:Fr.skeleton,style:e}),Pr="_root_17qqv_1",Ur={root:Pr},zr=()=>t.jsxs(Be,{className:Ur.root,children:[t.jsx(me,{style:{height:"3rem",marginBottom:"0.75rem"}}),t.jsx(me,{style:{height:"6rem",margin:"0.5rem 0"}}),t.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),t.jsx(me,{style:{height:"2rem"}}),t.jsx(me,{style:{height:"2rem",borderRadius:"9999px",marginTop:"0.5rem"}})]}),jt=0,wt=1,yt=2,ot=3;var it=Object.prototype.hasOwnProperty;function Oe(e,n){var r,s;if(e===n)return!0;if(e&&n&&(r=e.constructor)===n.constructor){if(r===Date)return e.getTime()===n.getTime();if(r===RegExp)return e.toString()===n.toString();if(r===Array){if((s=e.length)===n.length)for(;s--&&Oe(e[s],n[s]););return s===-1}if(!r||typeof e=="object"){s=0;for(r in e)if(it.call(e,r)&&++s&&!it.call(n,r)||!(r in n)||!Oe(e[r],n[r]))return!1;return Object.keys(n).length===s}}return e!==e&&n!==n}const P=new WeakMap,U=()=>{},R=U(),Le=Object,u=e=>e===R,W=e=>typeof e=="function",H=(e,n)=>({...e,...n}),bt=e=>W(e.then),Ne={},pe={},Fe="undefined",de=typeof window!=Fe,qe=typeof document!=Fe,Hr=de&&"Deno"in window,Gr=()=>de&&typeof window.requestAnimationFrame!=Fe,Tt=(e,n)=>{const r=P.get(e);return[()=>!u(n)&&e.get(n)||Ne,s=>{if(!u(n)){const o=e.get(n);n in pe||(pe[n]=o),r[5](n,H(o,s),o||Ne)}},r[6],()=>!u(n)&&n in pe?pe[n]:!u(n)&&e.get(n)||Ne]};let $e=!0;const Xr=()=>$e,[De,Ae]=de&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],Kr=()=>{const e=qe&&document.visibilityState;return u(e)||e!=="hidden"},Qr=e=>(qe&&document.addEventListener("visibilitychange",e),De("focus",e),()=>{qe&&document.removeEventListener("visibilitychange",e),Ae("focus",e)}),Jr=e=>{const n=()=>{$e=!0,e()},r=()=>{$e=!1};return De("online",n),De("offline",r),()=>{Ae("online",n),Ae("offline",r)}},Yr={isOnline:Xr,isVisible:Kr},Zr={initFocus:Qr,initReconnect:Jr},at=!h.useId,ie=!de||Hr,es=e=>Gr()?window.requestAnimationFrame(e):setTimeout(e,1),Re=ie?h.useEffect:h.useLayoutEffect,Se=typeof navigator<"u"&&navigator.connection,ct=!ie&&Se&&(["slow-2g","2g"].includes(Se.effectiveType)||Se.saveData),xe=new WeakMap,ts=e=>Le.prototype.toString.call(e),Ie=(e,n)=>e===`[object ${n}]`;let ns=0;const Me=e=>{const n=typeof e,r=ts(e),s=Ie(r,"Date"),o=Ie(r,"RegExp"),a=Ie(r,"Object");let i,c;if(Le(e)===e&&!s&&!o){if(i=xe.get(e),i)return i;if(i=++ns+"~",xe.set(e,i),Array.isArray(e)){for(i="@",c=0;c<e.length;c++)i+=Me(e[c])+",";xe.set(e,i)}if(a){i="#";const f=Le.keys(e).sort();for(;!u(c=f.pop());)u(e[c])||(i+=c+":"+Me(e[c])+",");xe.set(e,i)}}else i=s?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return i},Pe=e=>{if(W(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Me(e):"",[e,n]};let rs=0;const Ve=()=>++rs;async function Nt(...e){const[n,r,s,o]=e,a=H({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let i=a.populateCache;const c=a.rollbackOnError;let f=a.optimisticData;const d=w=>typeof c=="function"?c(w):c!==!1,v=a.throwOnError;if(W(r)){const w=r,N=[],E=n.keys();for(const L of E)!/^\$(inf|sub)\$/.test(L)&&w(n.get(L)._k)&&N.push(L);return Promise.all(N.map(m))}return m(r);async function m(w){const[N]=Pe(w);if(!N)return;const[E,L]=Tt(n,N),[D,ae,l,ue]=P.get(n),J=()=>{const q=D[N];return(W(a.revalidate)?a.revalidate(E().data,w):a.revalidate!==!1)&&(delete l[N],delete ue[N],q&&q[0])?q[0](yt).then(()=>E().data):E().data};if(e.length<3)return J();let y=s,A,M=!1;const Y=Ve();ae[N]=[Y,0];const p=!u(f),Z=E(),V=Z.data,ee=Z._c,G=u(ee)?V:ee;if(p&&(f=W(f)?f(G,V):f,L({data:f,_c:G})),W(y))try{y=y(G)}catch(q){A=q,M=!0}if(y&&bt(y))if(y=await y.catch(q=>{A=q,M=!0}),Y!==ae[N][0]){if(M)throw A;return y}else M&&p&&d(A)&&(i=!0,L({data:G,_c:R}));if(i&&!M)if(W(i)){const q=i(y,G);L({data:q,error:R,_c:R})}else L({data:y,error:R,_c:R});if(ae[N][1]=Ve(),Promise.resolve(J()).then(()=>{L({_c:R})}),M){if(v)throw A;return}return y}}const lt=(e,n)=>{for(const r in e)e[r][0]&&e[r][0](n)},ss=(e,n)=>{if(!P.has(e)){const r=H(Zr,n),s=Object.create(null),o=Nt.bind(R,e);let a=U;const i=Object.create(null),c=(v,m)=>{const w=i[v]||[];return i[v]=w,w.push(m),()=>w.splice(w.indexOf(m),1)},f=(v,m,w)=>{e.set(v,m);const N=i[v];if(N)for(const E of N)E(m,w)},d=()=>{if(!P.has(e)&&(P.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,f,c]),!ie)){const v=r.initFocus(setTimeout.bind(R,lt.bind(R,s,jt))),m=r.initReconnect(setTimeout.bind(R,lt.bind(R,s,wt)));a=()=>{v&&v(),m&&m(),P.delete(e)}}};return d(),[e,o,d,a]}return[e,P.get(e)[4]]},os=(e,n,r,s,o)=>{const a=r.errorRetryCount,i=o.retryCount,c=~~((Math.random()+.5)*(1<<(i<8?i:8)))*r.errorRetryInterval;!u(a)&&i>a||setTimeout(s,c,o)},is=Oe,[Rt,as]=ss(new Map),cs=H({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:os,onDiscarded:U,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:ct?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:ct?5e3:3e3,compare:is,isPaused:()=>!1,cache:Rt,mutate:as,fallback:{}},Yr),ls=(e,n)=>{const r=H(e,n);if(n){const{use:s,fallback:o}=e,{use:a,fallback:i}=n;s&&a&&(r.use=s.concat(a)),o&&i&&(r.fallback=H(o,i))}return r},ds=h.createContext({}),us="$inf$",St=de&&window.__SWR_DEVTOOLS_USE__,fs=St?window.__SWR_DEVTOOLS_USE__:[],hs=()=>{St&&(window.__SWR_DEVTOOLS_REACT__=h)},_s=e=>W(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ms=()=>{const e=h.useContext(ds);return h.useMemo(()=>H(cs,e),[e])},ps=e=>(n,r,s)=>e(n,r&&((...a)=>{const[i]=Pe(n),[,,,c]=P.get(Rt);if(i.startsWith(us))return r(...a);const f=c[i];return u(f)?r(...a):(delete c[i],f)}),s),xs=fs.concat(ps),vs=e=>function(...r){const s=ms(),[o,a,i]=_s(r),c=ls(s,i);let f=e;const{use:d}=c,v=(d||[]).concat(xs);for(let m=v.length;m--;)f=v[m](f);return f(o,a||c.fetcher||null,c)},gs=(e,n,r)=>{const s=n[e]||(n[e]=[]);return s.push(r),()=>{const o=s.indexOf(r);o>=0&&(s[o]=s[s.length-1],s.pop())}};hs();const ke=h.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Ee={dedupe:!0},dt=Promise.resolve(R),js=(e,n,r)=>{const{cache:s,compare:o,suspense:a,fallbackData:i,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:d,refreshWhenHidden:v,refreshWhenOffline:m,keepPreviousData:w,strictServerPrefetchWarning:N}=r,[E,L,D,ae]=P.get(s),[l,ue]=Pe(e),J=h.useRef(!1),y=h.useRef(!1),A=h.useRef(l),M=h.useRef(n),Y=h.useRef(r),p=()=>Y.current,Z=()=>p().isVisible()&&p().isOnline(),[V,ee,G,q]=Tt(s,l),te=h.useRef({}).current,fe=u(i)?u(r.fallback)?R:r.fallback[l]:i,ze=(_,x)=>{for(const j in te){const g=j;if(g==="data"){if(!o(_[g],x[g])&&(!u(_[g])||!o(_e,x[g])))return!1}else if(x[g]!==_[g])return!1}return!0},He=h.useMemo(()=>{const _=!l||!n?!1:u(c)?p().isPaused()||a?!1:f!==!1:c,x=I=>{const B=H(I);return delete B._k,_?{isValidating:!0,isLoading:!0,...B}:B},j=V(),g=q(),$=x(j),se=j===g?$:x(g);let b=$;return[()=>{const I=x(V());return ze(I,b)?(b.data=I.data,b.isLoading=I.isLoading,b.isValidating=I.isValidating,b.error=I.error,b):(b=I,I)},()=>se]},[s,l]),ne=S.shimExports.useSyncExternalStore(h.useCallback(_=>G(l,(x,j)=>{ze(j,x)||_()}),[s,l]),He[0],He[1]),Ge=!J.current,kt=E[l]&&E[l].length>0,re=ne.data,X=u(re)?fe&&bt(fe)?ke(fe):fe:re,he=ne.error,ve=h.useRef(X),_e=w?u(re)?u(ve.current)?X:ve.current:re:X,K=l&&u(X),Et=!ie&&S.shimExports.useSyncExternalStore(()=>U,()=>!1,()=>!0);N&&Et&&!a&&K&&console.warn(`Missing pre-initiated data for serialized key "${l}" 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.`);const Xe=kt&&!u(he)?!1:Ge&&!u(c)?c:p().isPaused()?!1:a?u(X)?!1:f:u(X)||f,Ke=!!(l&&n&&Ge&&Xe),Ct=u(ne.isValidating)?Ke:ne.isValidating,Ot=u(ne.isLoading)?Ke:ne.isLoading,ce=h.useCallback(async _=>{const x=M.current;if(!l||!x||y.current||p().isPaused())return!1;let j,g,$=!0;const se=_||{},b=!D[l]||!se.dedupe,I=()=>at?!y.current&&l===A.current&&J.current:l===A.current,B={isValidating:!1,isLoading:!1},Je=()=>{ee(B)},Ye=()=>{const O=D[l];O&&O[1]===g&&delete D[l]},Ze={isValidating:!0};u(V().data)&&(Ze.isLoading=!0);try{if(b&&(ee(Ze),r.loadingTimeout&&u(V().data)&&setTimeout(()=>{$&&I()&&p().onLoadingSlow(l,r)},r.loadingTimeout),D[l]=[x(ue),Ve()]),[j,g]=D[l],j=await j,b&&setTimeout(Ye,r.dedupingInterval),!D[l]||D[l][1]!==g)return b&&I()&&p().onDiscarded(l),!1;B.error=R;const O=L[l];if(!u(O)&&(g<=O[0]||g<=O[1]||O[1]===0))return Je(),b&&I()&&p().onDiscarded(l),!1;const F=V().data;B.data=o(F,j)?F:j,b&&I()&&p().onSuccess(j,l,r)}catch(O){Ye();const F=p(),{shouldRetryOnError:ge}=F;F.isPaused()||(B.error=O,b&&I()&&(F.onError(O,l,F),(ge===!0||W(ge)&&ge(O))&&(!p().revalidateOnFocus||!p().revalidateOnReconnect||Z())&&F.onErrorRetry(O,l,F,Lt=>{const je=E[l];je&&je[0]&&je[0](ot,Lt)},{retryCount:(se.retryCount||0)+1,dedupe:!0})))}return $=!1,Je(),!0},[l,s]),Qe=h.useCallback((..._)=>Nt(s,A.current,..._),[]);if(Re(()=>{M.current=n,Y.current=r,u(re)||(ve.current=re)}),Re(()=>{if(!l)return;const _=ce.bind(R,Ee);let x=0;p().revalidateOnFocus&&(x=Date.now()+p().focusThrottleInterval);const g=gs(l,E,($,se={})=>{if($==jt){const b=Date.now();p().revalidateOnFocus&&b>x&&Z()&&(x=b+p().focusThrottleInterval,_())}else if($==wt)p().revalidateOnReconnect&&Z()&&_();else{if($==yt)return ce();if($==ot)return ce(se)}});return y.current=!1,A.current=l,J.current=!0,ee({_k:ue}),Xe&&(D[l]||(u(X)||ie?_():es(_))),()=>{y.current=!0,g()}},[l]),Re(()=>{let _;function x(){const g=W(d)?d(V().data):d;g&&_!==-1&&(_=setTimeout(j,g))}function j(){!V().error&&(v||p().isVisible())&&(m||p().isOnline())?ce(Ee).then(x):x()}return x(),()=>{_&&(clearTimeout(_),_=-1)}},[d,v,m,l]),h.useDebugValue(_e),a){if(!at&&ie&&K)throw new Error("Fallback data is required when using Suspense in SSR.");K&&(M.current=n,Y.current=r,y.current=!1);const _=ae[l],x=!u(_)&&K?Qe(_):dt;if(ke(x),!u(he)&&K)throw he;const j=K?ce(Ee):dt;!u(_e)&&K&&(j.status="fulfilled",j.value=!0),ke(j)}return{mutate:Qe,get data(){return te.data=!0,_e},get error(){return te.error=!0,he},get isValidating(){return te.isValidating=!0,Ct},get isLoading(){return te.isLoading=!0,Ot}}},ut=vs(js);class ws extends Error{constructor({message:n,status:r,data:s}){super(n),this.name="TwitterApiError",this.status=r,this.data=s}}const ys=ut.default||ut,bs="https://react-tweet.vercel.app";async function Ts([e,n]){const r=await fetch(e,n),s=await r.json();if(r.ok)return s.data||null;throw new ws({message:`Failed to fetch tweet at "${e}" with "${r.status}".`,data:s,status:r.status})}const Ns=(e,n,r)=>{const{isLoading:s,data:o,error:a}=ys(()=>n||e?[n||e&&`${bs}/api/tweet/${e}`,r]:null,Ts,{revalidateIfStale:!1,revalidateOnFocus:!1,shouldRetryOnError:!1});return{isLoading:!!(s||o===void 0&&!a),data:o,error:a}},Rs=({id:e,apiUrl:n,fallback:r=t.jsx(zr,{}),components:s,fetchOptions:o,onError:a})=>{const{data:i,error:c,isLoading:f}=Ns(e,n,o);if(f)return r;if(c||!i){const d=(s==null?void 0:s.TweetNotFound)||Wr;return t.jsx(d,{error:a?a(c):c})}return t.jsx(Ar,{tweet:i,components:s})};function Ss({node:e}){var s;const n=((s=e==null?void 0:e.attrs)==null?void 0:s.src)||"",r=n==null?void 0:n.split("/").pop();return r?t.jsx(S.NodeViewWrapper,{children:t.jsx("div",{"data-twitter":"",children:t.jsx(Rs,{id:r})})}):null}function It(e){const{t:n}=qt.useLocale(),[r,s]=h.useState("");h.useEffect(()=>{var a;if(e!=null&&e.editor){const{src:i}=(a=e.editor)==null?void 0:a.getAttributes(Ue.name);i&&s(i)}},[e==null?void 0:e.editor]);function o(a){a.preventDefault(),a.stopPropagation(),e==null||e.onSetLink(r)}return t.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:o,children:[t.jsx(z.Label,{className:"mb-[6px]",children:n("editor.link.dialog.text")}),t.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:t.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:t.jsx(z.Input,{className:"richtext-w-80",onChange:a=>s(a.target.value),placeholder:"Text",required:!0,type:"text",value:r})})}),t.jsx(z.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:n("editor.link.dialog.button.apply")})]})}function Is(){const[e,n]=h.useState(!1),r=z.useEditorInstance(),s=z.useButtonProps(Ue.name),{icon:o=void 0,tooltip:a=void 0,tooltipOptions:i={},action:c=void 0,isActive:f=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:d}=z.useToggleActive(f);function v(m){d||c&&(c(m),n(!1))}return t.jsxs(we.Popover,{modal:!0,onOpenChange:n,open:e,children:[t.jsx(we.PopoverTrigger,{asChild:!0,children:t.jsx(z.ActionButton,{disabled:d,isActive:f,tooltip:a,tooltipOptions:i,children:t.jsx(z.IconComponent,{name:o})})}),t.jsx(we.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:t.jsx(It,{editor:r,onSetLink:v})})]})}const ks=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,Es=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function ft(e){return e.match(Es)}const Ue=S.Node3.create({name:"twitter",draggable:!0,selectable:!0,addOptions(){return{addPasteHandler:!0,HTMLAttributes:{},inline:!1,origin:"",button:({editor:e,t:n})=>({componentProps:{action:r=>{e.commands.setTweet({src:r})},isActive:()=>!1,disabled:!1,icon:"Twitter",tooltip:n("editor.twitter.tooltip"),editor:e}})}},addNodeView(){return S.ReactNodeViewRenderer(Ss,{attrs:this.options.HTMLAttributes})},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div[data-twitter]"}]},addCommands(){return{setTweet:e=>({commands:n})=>ft(e.src)?n.insertContent({type:this.name,attrs:e}):!1,updateTweet:e=>({commands:n})=>ft(e.src)?n.updateAttributes(this.name,{src:e.src}):!1}},addPasteRules(){return this.options.addPasteHandler?[S.nodePasteRule({find:ks,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes({"data-twitter":""},e)]}});exports.FormEditLinkTwitter=It;exports.RichTextTwitter=Is;exports.Twitter=Ue;
|
|
1
|
+
"use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),z=require("./index-CUnpdrCy.cjs");require("./theme.cjs");const qt=require("./index-DgOXAdKt.cjs"),we=require("./popover-DEMkixfo.cjs"),$t="_verified_lvyh0_1",We={verified:$t},Dt=()=>t.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{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"})})}),At=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsxs("g",{children:[t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-a",x1:"4.411",x2:"18.083",y1:"2.495",y2:"21.508",children:[t.jsx("stop",{offset:"0",stopColor:"#f4e72a"}),t.jsx("stop",{offset:".539",stopColor:"#cd8105"}),t.jsx("stop",{offset:".68",stopColor:"#cb7b00"}),t.jsx("stop",{offset:"1",stopColor:"#f4ec26"}),t.jsx("stop",{offset:"1",stopColor:"#f4e72a"})]}),t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-b",x1:"5.355",x2:"16.361",y1:"3.395",y2:"19.133",children:[t.jsx("stop",{offset:"0",stopColor:"#f9e87f"}),t.jsx("stop",{offset:".406",stopColor:"#e2b719"}),t.jsx("stop",{offset:".989",stopColor:"#e2b719"})]}),t.jsxs("g",{clipRule:"evenodd",fillRule:"evenodd",children:[t.jsx("path",{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",fill:"url(#0-a)"}),t.jsx("path",{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",fill:"url(#0-b)"}),t.jsx("path",{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",fill:"#d18800"})]})]})}),Mt=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{clipRule:"evenodd",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",fillRule:"evenodd"})})}),Vt="_root_98iqw_1",Wt="_article_98iqw_21",et={root:Vt,article:Wt},Be=({className:e,children:n})=>t.jsx("div",{className:S.clsx("react-tweet-theme",et.root,e),children:t.jsx("article",{className:et.article,children:n})}),ht=e=>t.jsx("img",{...e}),Bt="_verifiedOld_lcna5_1",Ft="_verifiedBlue_lcna5_4",Pt="_verifiedGovernment_lcna5_7",ye={verifiedOld:Bt,verifiedBlue:Ft,verifiedGovernment:Pt},_t=({user:e,className:n})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=t.jsx(Dt,{}),o=ye.verifiedBlue;if(r)switch(e.is_blue_verified||(o=ye.verifiedOld),e.verified_type){case"Government":s=t.jsx(Mt,{}),o=ye.verifiedGovernment;break;case"Business":s=t.jsx(At,{}),o=null;break}return r?t.jsx("div",{className:S.clsx(n,o),children:s}):null},Ut="_label_36ucz_1",zt={label:Ut},mt=({user:e,className:n})=>{var r;const s=e.highlighted_label;if(!s)return null;const o=(r=s.badge)==null?void 0:r.url;return o?t.jsx("div",{className:S.clsx(zt.label,n),children:t.jsx("img",{src:o,alt:s.description})}):null},Ht="_header_nqq4j_1",Gt="_avatar_nqq4j_11",Xt="_avatarOverflow_nqq4j_16",Kt="_avatarSquare_nqq4j_23",Qt="_avatarShadow_nqq4j_26",Jt="_author_nqq4j_37",Yt="_authorLink_nqq4j_44",Zt="_authorVerified_nqq4j_53",en="_authorLinkText_nqq4j_56",tn="_authorMeta_nqq4j_63",nn="_authorFollow_nqq4j_66",rn="_username_nqq4j_69",sn="_follow_nqq4j_74",on="_separator_nqq4j_82",an="_brand_nqq4j_86",cn="_twitterIcon_nqq4j_90",T={header:Ht,avatar:Gt,avatarOverflow:Xt,avatarSquare:Kt,avatarShadow:Qt,author:Jt,authorLink:Yt,authorVerified:Zt,authorLinkText:en,authorMeta:tn,authorFollow:nn,username:rn,follow:sn,separator:on,brand:an,twitterIcon:cn},ln=({tweet:e,components:n})=>{var r;const s=(r=n==null?void 0:n.AvatarImg)!=null?r:ht,{user:o}=e;return t.jsxs("div",{className:T.header,children:[t.jsxs("a",{href:e.url,className:T.avatar,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:S.clsx(T.avatarOverflow,o.profile_image_shape==="Square"&&T.avatarSquare),children:t.jsx(s,{src:o.profile_image_url_https,alt:o.name,width:48,height:48})}),t.jsx("div",{className:T.avatarOverflow,children:t.jsx("div",{className:T.avatarShadow})})]}),t.jsxs("div",{className:T.author,children:[t.jsxs("a",{href:e.url,className:T.authorLink,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:T.authorLinkText,children:t.jsx("span",{title:o.name,children:o.name})}),t.jsx(_t,{user:o,className:T.authorVerified}),t.jsx(mt,{user:o})]}),t.jsxs("div",{className:T.authorMeta,children:[t.jsx("a",{href:e.url,className:T.username,target:"_blank",rel:"noopener noreferrer",children:t.jsxs("span",{title:`@${o.screen_name}`,children:["@",o.screen_name]})}),t.jsxs("div",{className:T.authorFollow,children:[t.jsx("span",{className:T.separator,children:"·"}),t.jsx("a",{href:o.follow_url,className:T.follow,target:"_blank",rel:"noopener noreferrer",children:"Follow"})]})]})]}),t.jsx("a",{href:e.url,className:T.brand,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Twitter",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:T.twitterIcon,children:t.jsx("g",{children:t.jsx("path",{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"})})})})]})},dn="_root_1ec15_1",un={root:dn},fn=({tweet:e})=>t.jsxs("a",{href:e.in_reply_to_url,className:un.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),hn="_root_eihfa_1",_n={root:hn},pt=({href:e,children:n})=>t.jsx("a",{href:e,className:_n.root,target:"_blank",rel:"noopener noreferrer nofollow",children:n}),mn="_root_1xq52_1",pn={root:mn},xn=({tweet:e})=>t.jsxs("p",{className:pn.root,lang:e.lang,dir:"auto",children:[e.entities.map((n,r)=>{switch(n.type){case"hashtag":case"mention":case"url":case"symbol":return t.jsx(pt,{href:n.href,children:n.text},r);case"media":return;default:return t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r)}}),e.note_tweet?t.jsx(vn,{tweet:e}):null]});function vn({tweet:e}){return t.jsxs(pt,{href:e.url,children:[t.jsx("span",{children:" "}),"Show more"]})}const gn={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},jn=new Intl.DateTimeFormat("en-US",gn),wn=e=>{const n={};for(const r of e)n[r.type]=r.value;return n},yn=e=>{const n=wn(jn.formatToParts(e)),r=`${n.hour}:${n.minute} ${n.dayPeriod}`,s=`${n.month} ${n.day}, ${n.year}`;return`${r} · ${s}`},tt=e=>`https://x.com/${e.user.screen_name}/status/${e.id_str}`,xt=e=>`https://x.com/${typeof e=="string"?e:e.user.screen_name}`,bn=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,Tn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,Nn=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,Rn=e=>`https://x.com/hashtag/${e.text}`,Sn=e=>`https://x.com/search?q=%24${e.text}`,In=e=>`https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`,vt=(e,n)=>{const r=new URL(e.media_url_https),s=r.pathname.split(".").pop();return s?(r.pathname=r.pathname.replace(`.${s}`,""),r.searchParams.set("format",s),r.searchParams.set("name",n),r.toString()):e.media_url_https},kn=e=>{const{variants:n}=e.video_info;return n.filter(s=>s.content_type==="video/mp4").sort((s,o)=>{var a,i;return((a=o.bitrate)!=null?a:0)-((i=s.bitrate)!=null?i:0)})},En=e=>{const n=kn(e);return n.length>1?n[1]:n[0]},Ce=e=>e>999999?`${(e/1e6).toFixed(1)}M`:e>999?`${(e/1e3).toFixed(1)}K`:e.toString();function nt(e){const n=Array.from(e.text),r=[{indices:e.display_text_range,type:"text"}];return le(r,"hashtag",e.entities.hashtags),le(r,"mention",e.entities.user_mentions),le(r,"url",e.entities.urls),le(r,"symbol",e.entities.symbols),e.entities.media&&le(r,"media",e.entities.media),Cn(e,r),r.map(s=>{const o=n.slice(s.indices[0],s.indices[1]).join("");switch(s.type){case"hashtag":return Object.assign(s,{href:Rn(s),text:o});case"mention":return Object.assign(s,{href:xt(s.screen_name),text:o});case"url":case"media":return Object.assign(s,{href:s.expanded_url,text:s.display_url});case"symbol":return Object.assign(s,{href:Sn(s),text:o});default:return Object.assign(s,{text:o})}})}function le(e,n,r){for(const s of r)for(const[o,a]of e.entries()){if(a.indices[0]>s.indices[0]||a.indices[1]<s.indices[1])continue;const i=[{...s,type:n}];a.indices[0]<s.indices[0]&&i.unshift({indices:[a.indices[0],s.indices[0]],type:"text"}),a.indices[1]>s.indices[1]&&i.push({indices:[s.indices[1],a.indices[1]],type:"text"}),e.splice(o,1,...i);break}}function Cn(e,n){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]);const r=n.at(-1);r&&r.indices[1]>e.display_text_range[1]&&(r.indices[1]=e.display_text_range[1])}const On=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:Nn(e)},like_url:bn(e),reply_url:Tn(e),in_reply_to_url:e.in_reply_to_screen_name?In(e):void 0,entities:nt(e),quoted_tweet:e.quoted_tweet?{...e.quoted_tweet,url:tt(e.quoted_tweet),entities:nt(e.quoted_tweet)}:void 0}),Ln="_root_g9tkv_1",qn="_rounded_g9tkv_6",$n="_mediaWrapper_g9tkv_10",Dn="_grid2Columns_g9tkv_17",An="_grid3_g9tkv_20",Mn="_grid2x2_g9tkv_23",Vn="_mediaContainer_g9tkv_26",Wn="_mediaLink_g9tkv_34",Bn="_skeleton_g9tkv_38",Fn="_image_g9tkv_43",C={root:Ln,rounded:qn,mediaWrapper:$n,grid2Columns:Dn,grid3:An,grid2x2:Mn,mediaContainer:Vn,mediaLink:Wn,skeleton:Bn,image:Fn},Pn="_anchor_fp31d_1",Un="_videoButton_fp31d_17",zn="_videoButtonIcon_fp31d_35",Hn="_watchOnTwitter_fp31d_44",Gn="_viewReplies_fp31d_60",oe={anchor:Pn,videoButton:Un,videoButtonIcon:zn,watchOnTwitter:Hn,viewReplies:Gn},Xn=({tweet:e,media:n})=>{const[r,s]=h.useState(!0),[o,a]=h.useState(!1),[i,c]=h.useState(!1),f=En(n);let d=0;return t.jsxs(t.Fragment,{children:[t.jsx("video",{className:C.image,poster:vt(n,"small"),controls:!r,playsInline:!0,preload:"none",tabIndex:r?-1:0,onPlay:()=>{d&&window.clearTimeout(d),o||a(!0),i&&c(!1)},onPause:()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{o&&a(!1),d=0},100)},onEnded:()=>{c(!0)},children:t.jsx("source",{src:f.url,type:f.content_type})}),r&&t.jsx("button",{type:"button",className:oe.videoButton,"aria-label":"View video on X",onClick:v=>{const m=v.currentTarget.previousSibling;v.preventDefault(),s(!1),m.load(),m.play().then(()=>{a(!0),m.focus()}).catch(w=>{console.error("Error playing video:",w),s(!0),a(!1)})},children:t.jsx("svg",{viewBox:"0 0 24 24",className:oe.videoButtonIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!i&&t.jsx("div",{className:oe.watchOnTwitter,children:t.jsx("a",{href:e.url,className:oe.anchor,target:"_blank",rel:"noopener noreferrer",children:r?"Watch on X":"Continue watching on X"})}),i&&t.jsx("a",{href:e.url,className:S.clsx(oe.anchor,oe.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},Kn=e=>t.jsx("img",{...e}),rt=(e,n)=>{let r=56.25;return n===1&&(r=100/e.original_info.width*e.original_info.height),n===2&&(r=r*2),{width:e.type==="photo"?void 0:"unset",paddingBottom:`${r}%`}},gt=({tweet:e,components:n,quoted:r})=>{var s,o,a;const i=(a=(s=e.mediaDetails)==null?void 0:s.length)!=null?a:0;var c;const f=(c=n==null?void 0:n.MediaImg)!=null?c:Kn;return t.jsx("div",{className:S.clsx(C.root,!r&&C.rounded),children:t.jsx("div",{className:S.clsx(C.mediaWrapper,i>1&&C.grid2Columns,i===3&&C.grid3,i>4&&C.grid2x2),children:(o=e.mediaDetails)==null?void 0:o.map(d=>t.jsx(h.Fragment,{children:d.type==="photo"?t.jsxs("a",{href:e.url,className:S.clsx(C.mediaContainer,C.mediaLink),target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(f,{src:vt(d,"small"),alt:d.ext_alt_text||"Image",className:C.image,draggable:!0})]},d.media_url_https):t.jsxs("div",{className:C.mediaContainer,children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(Xn,{tweet:e,media:d})]},d.media_url_https)},d.media_url_https))})})},Qn="_root_i24yn_1",Jn={root:Qn},Yn=({tweet:e})=>{const n=new Date(e.created_at),r=yn(n);return t.jsx("a",{className:Jn.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:t.jsx("time",{dateTime:n.toISOString(),children:r})})},Zn="_info_19qcj_1",er="_infoLink_19qcj_10",tr="_infoIcon_19qcj_30",be={info:Zn,infoLink:er,infoIcon:tr},nr=({tweet:e})=>t.jsxs("div",{className:be.info,children:[t.jsx(Yn,{tweet:e}),t.jsx("a",{className:be.infoLink,href:"https://help.x.com/en/x-for-websites-ads-info-and-privacy",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter for Websites, Ads Information and Privacy",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:be.infoIcon,children:t.jsx("g",{children:t.jsx("path",{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"})})})})]}),rr="_actions_n2anf_1",sr="_like_n2anf_13",or="_reply_n2anf_14",ir="_copy_n2anf_15",ar="_likeIconWrapper_n2anf_27",cr="_likeCount_n2anf_30",lr="_replyIconWrapper_n2anf_35",dr="_copyIconWrapper_n2anf_36",ur="_likeIcon_n2anf_27",fr="_replyIcon_n2anf_35",hr="_copyIcon_n2anf_36",_r="_replyText_n2anf_56",mr="_copyText_n2anf_57",k={actions:rr,like:sr,reply:or,copy:ir,likeIconWrapper:ar,likeCount:cr,replyIconWrapper:lr,copyIconWrapper:dr,likeIcon:ur,replyIcon:fr,copyIcon:hr,replyText:_r,copyText:mr},pr=({tweet:e})=>{const[n,r]=h.useState(!1),s=()=>{navigator.clipboard.writeText(e.url),r(!0)};return h.useEffect(()=>{if(n){const o=setTimeout(()=>{r(!1)},6e3);return()=>clearTimeout(o)}},[n]),t.jsxs("button",{type:"button",className:k.copy,"aria-label":"Copy link",onClick:s,children:[t.jsx("div",{className:k.copyIconWrapper,children:n?t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})}):t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.copyText,children:n?"Copied!":"Copy link"})]})},xr=({tweet:e})=>{const n=Ce(e.favorite_count);return t.jsxs("div",{className:k.actions,children:[t.jsxs("a",{className:k.like,href:e.like_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Like. This Tweet has ${n} likes`,children:[t.jsx("div",{className:k.likeIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.likeIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.likeCount,children:n})]}),t.jsxs("a",{className:k.reply,href:e.reply_url,target:"_blank",rel:"noopener noreferrer","aria-label":"Reply to this Tweet on Twitter",children:[t.jsx("div",{className:k.replyIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.replyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{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"})})})}),t.jsx("span",{className:k.replyText,children:"Reply"})]}),t.jsx(pr,{tweet:e})]})},vr="_replies_1cutb_1",gr="_link_1cutb_4",jr="_text_1cutb_23",Te={replies:vr,link:gr,text:jr},wr=({tweet:e})=>t.jsx("div",{className:Te.replies,children:t.jsx("a",{className:Te.link,href:e.url,target:"_blank",rel:"noopener noreferrer",children:t.jsx("span",{className:Te.text,children:e.conversation_count===0?"Read more on X":e.conversation_count===1?`Read ${Ce(e.conversation_count)} reply`:`Read ${Ce(e.conversation_count)} replies`})})}),yr="_root_q5799_1",br="_article_q5799_16",st={root:yr,article:br},Tr=({tweet:e,children:n})=>t.jsx("div",{className:st.root,onClick:r=>{r.preventDefault(),window.open(e.url,"_blank")},children:t.jsx("article",{className:st.article,children:n})}),Nr="_header_f00ab_1",Rr="_avatar_f00ab_11",Sr="_avatarOverflow_f00ab_16",Ir="_avatarSquare_f00ab_23",kr="_author_f00ab_27",Er="_authorText_f00ab_33",Cr="_username_f00ab_40",Q={header:Nr,avatar:Rr,avatarOverflow:Sr,avatarSquare:Ir,author:kr,authorText:Er,username:Cr},Or=({tweet:e,components:n})=>{const{user:r}=e;var s;const o=(s=n==null?void 0:n.AvatarImg)!=null?s:ht;return t.jsxs("div",{className:Q.header,children:[t.jsx("a",{href:e.url,className:Q.avatar,target:"_blank",rel:"noopener noreferrer",children:t.jsx("div",{className:S.clsx(Q.avatarOverflow,r.profile_image_shape==="Square"&&Q.avatarSquare),children:t.jsx(o,{src:r.profile_image_url_https,alt:r.name,width:20,height:20})})}),t.jsxs("div",{className:Q.author,children:[t.jsx("div",{className:Q.authorText,children:t.jsx("span",{title:r.name,children:r.name})}),t.jsx(_t,{user:r}),t.jsx(mt,{user:r}),t.jsx("div",{className:Q.username,children:t.jsxs("span",{title:`@${r.screen_name}`,children:["@",r.screen_name]})})]})]})},Lr="_root_175ot_1",qr={root:Lr},$r=({tweet:e})=>t.jsx("p",{className:qr.root,lang:e.lang,dir:"auto",children:e.entities.map((n,r)=>t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r))}),Dr=({tweet:e,components:n})=>{var r;return t.jsxs(Tr,{tweet:e,children:[t.jsx(Or,{tweet:e,components:n}),t.jsx($r,{tweet:e}),(r=e.mediaDetails)!=null&&r.length?t.jsx(gt,{quoted:!0,tweet:e}):null]})},Ar=({tweet:e,components:n})=>{var r;const s=h.useMemo(()=>On(e),[e]);return t.jsxs(Be,{children:[t.jsx(ln,{tweet:s,components:n}),s.in_reply_to_status_id_str&&t.jsx(fn,{tweet:s}),t.jsx(xn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?t.jsx(gt,{tweet:s,components:n}):null,s.quoted_tweet&&t.jsx(Dr,{tweet:s.quoted_tweet,components:n}),t.jsx(nr,{tweet:s}),t.jsx(xr,{tweet:s}),t.jsx(wr,{tweet:s})]})},Mr="_root_16yxa_1",Vr={root:Mr},Wr=e=>t.jsx(Be,{children:t.jsxs("div",{className:Vr.root,children:[t.jsx("h3",{children:"Tweet not found"}),t.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Br="_skeleton_oi7hr_1",Fr={skeleton:Br},me=({style:e})=>t.jsx("span",{className:Fr.skeleton,style:e}),Pr="_root_17qqv_1",Ur={root:Pr},zr=()=>t.jsxs(Be,{className:Ur.root,children:[t.jsx(me,{style:{height:"3rem",marginBottom:"0.75rem"}}),t.jsx(me,{style:{height:"6rem",margin:"0.5rem 0"}}),t.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),t.jsx(me,{style:{height:"2rem"}}),t.jsx(me,{style:{height:"2rem",borderRadius:"9999px",marginTop:"0.5rem"}})]}),jt=0,wt=1,yt=2,ot=3;var it=Object.prototype.hasOwnProperty;function Oe(e,n){var r,s;if(e===n)return!0;if(e&&n&&(r=e.constructor)===n.constructor){if(r===Date)return e.getTime()===n.getTime();if(r===RegExp)return e.toString()===n.toString();if(r===Array){if((s=e.length)===n.length)for(;s--&&Oe(e[s],n[s]););return s===-1}if(!r||typeof e=="object"){s=0;for(r in e)if(it.call(e,r)&&++s&&!it.call(n,r)||!(r in n)||!Oe(e[r],n[r]))return!1;return Object.keys(n).length===s}}return e!==e&&n!==n}const P=new WeakMap,U=()=>{},R=U(),Le=Object,u=e=>e===R,W=e=>typeof e=="function",H=(e,n)=>({...e,...n}),bt=e=>W(e.then),Ne={},pe={},Fe="undefined",de=typeof window!=Fe,qe=typeof document!=Fe,Hr=de&&"Deno"in window,Gr=()=>de&&typeof window.requestAnimationFrame!=Fe,Tt=(e,n)=>{const r=P.get(e);return[()=>!u(n)&&e.get(n)||Ne,s=>{if(!u(n)){const o=e.get(n);n in pe||(pe[n]=o),r[5](n,H(o,s),o||Ne)}},r[6],()=>!u(n)&&n in pe?pe[n]:!u(n)&&e.get(n)||Ne]};let $e=!0;const Xr=()=>$e,[De,Ae]=de&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],Kr=()=>{const e=qe&&document.visibilityState;return u(e)||e!=="hidden"},Qr=e=>(qe&&document.addEventListener("visibilitychange",e),De("focus",e),()=>{qe&&document.removeEventListener("visibilitychange",e),Ae("focus",e)}),Jr=e=>{const n=()=>{$e=!0,e()},r=()=>{$e=!1};return De("online",n),De("offline",r),()=>{Ae("online",n),Ae("offline",r)}},Yr={isOnline:Xr,isVisible:Kr},Zr={initFocus:Qr,initReconnect:Jr},at=!h.useId,ie=!de||Hr,es=e=>Gr()?window.requestAnimationFrame(e):setTimeout(e,1),Re=ie?h.useEffect:h.useLayoutEffect,Se=typeof navigator<"u"&&navigator.connection,ct=!ie&&Se&&(["slow-2g","2g"].includes(Se.effectiveType)||Se.saveData),xe=new WeakMap,ts=e=>Le.prototype.toString.call(e),Ie=(e,n)=>e===`[object ${n}]`;let ns=0;const Me=e=>{const n=typeof e,r=ts(e),s=Ie(r,"Date"),o=Ie(r,"RegExp"),a=Ie(r,"Object");let i,c;if(Le(e)===e&&!s&&!o){if(i=xe.get(e),i)return i;if(i=++ns+"~",xe.set(e,i),Array.isArray(e)){for(i="@",c=0;c<e.length;c++)i+=Me(e[c])+",";xe.set(e,i)}if(a){i="#";const f=Le.keys(e).sort();for(;!u(c=f.pop());)u(e[c])||(i+=c+":"+Me(e[c])+",");xe.set(e,i)}}else i=s?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return i},Pe=e=>{if(W(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Me(e):"",[e,n]};let rs=0;const Ve=()=>++rs;async function Nt(...e){const[n,r,s,o]=e,a=H({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let i=a.populateCache;const c=a.rollbackOnError;let f=a.optimisticData;const d=w=>typeof c=="function"?c(w):c!==!1,v=a.throwOnError;if(W(r)){const w=r,N=[],E=n.keys();for(const L of E)!/^\$(inf|sub)\$/.test(L)&&w(n.get(L)._k)&&N.push(L);return Promise.all(N.map(m))}return m(r);async function m(w){const[N]=Pe(w);if(!N)return;const[E,L]=Tt(n,N),[D,ae,l,ue]=P.get(n),J=()=>{const q=D[N];return(W(a.revalidate)?a.revalidate(E().data,w):a.revalidate!==!1)&&(delete l[N],delete ue[N],q&&q[0])?q[0](yt).then(()=>E().data):E().data};if(e.length<3)return J();let y=s,A,M=!1;const Y=Ve();ae[N]=[Y,0];const p=!u(f),Z=E(),V=Z.data,ee=Z._c,G=u(ee)?V:ee;if(p&&(f=W(f)?f(G,V):f,L({data:f,_c:G})),W(y))try{y=y(G)}catch(q){A=q,M=!0}if(y&&bt(y))if(y=await y.catch(q=>{A=q,M=!0}),Y!==ae[N][0]){if(M)throw A;return y}else M&&p&&d(A)&&(i=!0,L({data:G,_c:R}));if(i&&!M)if(W(i)){const q=i(y,G);L({data:q,error:R,_c:R})}else L({data:y,error:R,_c:R});if(ae[N][1]=Ve(),Promise.resolve(J()).then(()=>{L({_c:R})}),M){if(v)throw A;return}return y}}const lt=(e,n)=>{for(const r in e)e[r][0]&&e[r][0](n)},ss=(e,n)=>{if(!P.has(e)){const r=H(Zr,n),s=Object.create(null),o=Nt.bind(R,e);let a=U;const i=Object.create(null),c=(v,m)=>{const w=i[v]||[];return i[v]=w,w.push(m),()=>w.splice(w.indexOf(m),1)},f=(v,m,w)=>{e.set(v,m);const N=i[v];if(N)for(const E of N)E(m,w)},d=()=>{if(!P.has(e)&&(P.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,f,c]),!ie)){const v=r.initFocus(setTimeout.bind(R,lt.bind(R,s,jt))),m=r.initReconnect(setTimeout.bind(R,lt.bind(R,s,wt)));a=()=>{v&&v(),m&&m(),P.delete(e)}}};return d(),[e,o,d,a]}return[e,P.get(e)[4]]},os=(e,n,r,s,o)=>{const a=r.errorRetryCount,i=o.retryCount,c=~~((Math.random()+.5)*(1<<(i<8?i:8)))*r.errorRetryInterval;!u(a)&&i>a||setTimeout(s,c,o)},is=Oe,[Rt,as]=ss(new Map),cs=H({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:os,onDiscarded:U,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:ct?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:ct?5e3:3e3,compare:is,isPaused:()=>!1,cache:Rt,mutate:as,fallback:{}},Yr),ls=(e,n)=>{const r=H(e,n);if(n){const{use:s,fallback:o}=e,{use:a,fallback:i}=n;s&&a&&(r.use=s.concat(a)),o&&i&&(r.fallback=H(o,i))}return r},ds=h.createContext({}),us="$inf$",St=de&&window.__SWR_DEVTOOLS_USE__,fs=St?window.__SWR_DEVTOOLS_USE__:[],hs=()=>{St&&(window.__SWR_DEVTOOLS_REACT__=h)},_s=e=>W(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ms=()=>{const e=h.useContext(ds);return h.useMemo(()=>H(cs,e),[e])},ps=e=>(n,r,s)=>e(n,r&&((...a)=>{const[i]=Pe(n),[,,,c]=P.get(Rt);if(i.startsWith(us))return r(...a);const f=c[i];return u(f)?r(...a):(delete c[i],f)}),s),xs=fs.concat(ps),vs=e=>function(...r){const s=ms(),[o,a,i]=_s(r),c=ls(s,i);let f=e;const{use:d}=c,v=(d||[]).concat(xs);for(let m=v.length;m--;)f=v[m](f);return f(o,a||c.fetcher||null,c)},gs=(e,n,r)=>{const s=n[e]||(n[e]=[]);return s.push(r),()=>{const o=s.indexOf(r);o>=0&&(s[o]=s[s.length-1],s.pop())}};hs();const ke=h.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Ee={dedupe:!0},dt=Promise.resolve(R),js=(e,n,r)=>{const{cache:s,compare:o,suspense:a,fallbackData:i,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:d,refreshWhenHidden:v,refreshWhenOffline:m,keepPreviousData:w,strictServerPrefetchWarning:N}=r,[E,L,D,ae]=P.get(s),[l,ue]=Pe(e),J=h.useRef(!1),y=h.useRef(!1),A=h.useRef(l),M=h.useRef(n),Y=h.useRef(r),p=()=>Y.current,Z=()=>p().isVisible()&&p().isOnline(),[V,ee,G,q]=Tt(s,l),te=h.useRef({}).current,fe=u(i)?u(r.fallback)?R:r.fallback[l]:i,ze=(_,x)=>{for(const j in te){const g=j;if(g==="data"){if(!o(_[g],x[g])&&(!u(_[g])||!o(_e,x[g])))return!1}else if(x[g]!==_[g])return!1}return!0},He=h.useMemo(()=>{const _=!l||!n?!1:u(c)?p().isPaused()||a?!1:f!==!1:c,x=I=>{const B=H(I);return delete B._k,_?{isValidating:!0,isLoading:!0,...B}:B},j=V(),g=q(),$=x(j),se=j===g?$:x(g);let b=$;return[()=>{const I=x(V());return ze(I,b)?(b.data=I.data,b.isLoading=I.isLoading,b.isValidating=I.isValidating,b.error=I.error,b):(b=I,I)},()=>se]},[s,l]),ne=S.shimExports.useSyncExternalStore(h.useCallback(_=>G(l,(x,j)=>{ze(j,x)||_()}),[s,l]),He[0],He[1]),Ge=!J.current,kt=E[l]&&E[l].length>0,re=ne.data,X=u(re)?fe&&bt(fe)?ke(fe):fe:re,he=ne.error,ve=h.useRef(X),_e=w?u(re)?u(ve.current)?X:ve.current:re:X,K=l&&u(X),Et=!ie&&S.shimExports.useSyncExternalStore(()=>U,()=>!1,()=>!0);N&&Et&&!a&&K&&console.warn(`Missing pre-initiated data for serialized key "${l}" 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.`);const Xe=kt&&!u(he)?!1:Ge&&!u(c)?c:p().isPaused()?!1:a?u(X)?!1:f:u(X)||f,Ke=!!(l&&n&&Ge&&Xe),Ct=u(ne.isValidating)?Ke:ne.isValidating,Ot=u(ne.isLoading)?Ke:ne.isLoading,ce=h.useCallback(async _=>{const x=M.current;if(!l||!x||y.current||p().isPaused())return!1;let j,g,$=!0;const se=_||{},b=!D[l]||!se.dedupe,I=()=>at?!y.current&&l===A.current&&J.current:l===A.current,B={isValidating:!1,isLoading:!1},Je=()=>{ee(B)},Ye=()=>{const O=D[l];O&&O[1]===g&&delete D[l]},Ze={isValidating:!0};u(V().data)&&(Ze.isLoading=!0);try{if(b&&(ee(Ze),r.loadingTimeout&&u(V().data)&&setTimeout(()=>{$&&I()&&p().onLoadingSlow(l,r)},r.loadingTimeout),D[l]=[x(ue),Ve()]),[j,g]=D[l],j=await j,b&&setTimeout(Ye,r.dedupingInterval),!D[l]||D[l][1]!==g)return b&&I()&&p().onDiscarded(l),!1;B.error=R;const O=L[l];if(!u(O)&&(g<=O[0]||g<=O[1]||O[1]===0))return Je(),b&&I()&&p().onDiscarded(l),!1;const F=V().data;B.data=o(F,j)?F:j,b&&I()&&p().onSuccess(j,l,r)}catch(O){Ye();const F=p(),{shouldRetryOnError:ge}=F;F.isPaused()||(B.error=O,b&&I()&&(F.onError(O,l,F),(ge===!0||W(ge)&&ge(O))&&(!p().revalidateOnFocus||!p().revalidateOnReconnect||Z())&&F.onErrorRetry(O,l,F,Lt=>{const je=E[l];je&&je[0]&&je[0](ot,Lt)},{retryCount:(se.retryCount||0)+1,dedupe:!0})))}return $=!1,Je(),!0},[l,s]),Qe=h.useCallback((..._)=>Nt(s,A.current,..._),[]);if(Re(()=>{M.current=n,Y.current=r,u(re)||(ve.current=re)}),Re(()=>{if(!l)return;const _=ce.bind(R,Ee);let x=0;p().revalidateOnFocus&&(x=Date.now()+p().focusThrottleInterval);const g=gs(l,E,($,se={})=>{if($==jt){const b=Date.now();p().revalidateOnFocus&&b>x&&Z()&&(x=b+p().focusThrottleInterval,_())}else if($==wt)p().revalidateOnReconnect&&Z()&&_();else{if($==yt)return ce();if($==ot)return ce(se)}});return y.current=!1,A.current=l,J.current=!0,ee({_k:ue}),Xe&&(D[l]||(u(X)||ie?_():es(_))),()=>{y.current=!0,g()}},[l]),Re(()=>{let _;function x(){const g=W(d)?d(V().data):d;g&&_!==-1&&(_=setTimeout(j,g))}function j(){!V().error&&(v||p().isVisible())&&(m||p().isOnline())?ce(Ee).then(x):x()}return x(),()=>{_&&(clearTimeout(_),_=-1)}},[d,v,m,l]),h.useDebugValue(_e),a){if(!at&&ie&&K)throw new Error("Fallback data is required when using Suspense in SSR.");K&&(M.current=n,Y.current=r,y.current=!1);const _=ae[l],x=!u(_)&&K?Qe(_):dt;if(ke(x),!u(he)&&K)throw he;const j=K?ce(Ee):dt;!u(_e)&&K&&(j.status="fulfilled",j.value=!0),ke(j)}return{mutate:Qe,get data(){return te.data=!0,_e},get error(){return te.error=!0,he},get isValidating(){return te.isValidating=!0,Ct},get isLoading(){return te.isLoading=!0,Ot}}},ut=vs(js);class ws extends Error{constructor({message:n,status:r,data:s}){super(n),this.name="TwitterApiError",this.status=r,this.data=s}}const ys=ut.default||ut,bs="https://react-tweet.vercel.app";async function Ts([e,n]){const r=await fetch(e,n),s=await r.json();if(r.ok)return s.data||null;throw new ws({message:`Failed to fetch tweet at "${e}" with "${r.status}".`,data:s,status:r.status})}const Ns=(e,n,r)=>{const{isLoading:s,data:o,error:a}=ys(()=>n||e?[n||e&&`${bs}/api/tweet/${e}`,r]:null,Ts,{revalidateIfStale:!1,revalidateOnFocus:!1,shouldRetryOnError:!1});return{isLoading:!!(s||o===void 0&&!a),data:o,error:a}},Rs=({id:e,apiUrl:n,fallback:r=t.jsx(zr,{}),components:s,fetchOptions:o,onError:a})=>{const{data:i,error:c,isLoading:f}=Ns(e,n,o);if(f)return r;if(c||!i){const d=(s==null?void 0:s.TweetNotFound)||Wr;return t.jsx(d,{error:a?a(c):c})}return t.jsx(Ar,{tweet:i,components:s})};function Ss({node:e}){var s;const n=((s=e==null?void 0:e.attrs)==null?void 0:s.src)||"",r=n==null?void 0:n.split("/").pop();return r?t.jsx(S.NodeViewWrapper,{children:t.jsx("div",{"data-twitter":"",children:t.jsx(Rs,{id:r})})}):null}function It(e){const{t:n}=qt.useLocale(),[r,s]=h.useState("");h.useEffect(()=>{var a;if(e!=null&&e.editor){const{src:i}=(a=e.editor)==null?void 0:a.getAttributes(Ue.name);i&&s(i)}},[e==null?void 0:e.editor]);function o(a){a.preventDefault(),a.stopPropagation(),e==null||e.onSetLink(r)}return t.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:o,children:[t.jsx(z.Label,{className:"mb-[6px]",children:n("editor.link.dialog.text")}),t.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:t.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:t.jsx(z.Input,{className:"richtext-w-80",onChange:a=>s(a.target.value),placeholder:"Text",required:!0,type:"text",value:r})})}),t.jsx(z.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:n("editor.link.dialog.button.apply")})]})}function Is(){const[e,n]=h.useState(!1),r=z.useEditorInstance(),s=z.useButtonProps(Ue.name),{icon:o=void 0,tooltip:a=void 0,tooltipOptions:i={},action:c=void 0,isActive:f=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:d}=z.useToggleActive(f);function v(m){d||c&&(c(m),n(!1))}return t.jsxs(we.Popover,{modal:!0,onOpenChange:n,open:e,children:[t.jsx(we.PopoverTrigger,{asChild:!0,children:t.jsx(z.ActionButton,{disabled:d,isActive:f,tooltip:a,tooltipOptions:i,children:t.jsx(z.IconComponent,{name:o})})}),t.jsx(we.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:t.jsx(It,{editor:r,onSetLink:v})})]})}const ks=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,Es=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function ft(e){return e.match(Es)}const Ue=S.Node3.create({name:"twitter",draggable:!0,selectable:!0,addOptions(){return{addPasteHandler:!0,HTMLAttributes:{},inline:!1,origin:"",button:({editor:e,t:n})=>({componentProps:{action:r=>{e.commands.setTweet({src:r})},isActive:()=>!1,disabled:!1,icon:"Twitter",tooltip:n("editor.twitter.tooltip"),editor:e}})}},addNodeView(){return S.ReactNodeViewRenderer(Ss,{attrs:this.options.HTMLAttributes})},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div[data-twitter]"}]},addCommands(){return{setTweet:e=>({commands:n})=>ft(e.src)?n.insertContent({type:this.name,attrs:e}):!1,updateTweet:e=>({commands:n})=>ft(e.src)?n.updateAttributes(this.name,{src:e.src}):!1}},addPasteRules(){return this.options.addPasteHandler?[S.nodePasteRule({find:ks,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes({"data-twitter":""},e)]}});exports.FormEditLinkTwitter=It;exports.RichTextTwitter=Is;exports.Twitter=Ue;
|
package/lib/Twitter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const t=require("./Twitter-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const t=require("./Twitter-DvMmVNMF.cjs");exports.RichTextTwitter=t.RichTextTwitter;exports.Twitter=t.Twitter;
|
package/lib/Twitter.js
CHANGED
package/lib/Video.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");require("./index-DgOXAdKt.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");require("./index-DgOXAdKt.cjs");const e=require("./index-CUnpdrCy.cjs");exports.RichTextVideo=e.RichTextVideo;exports.Video=e.Video;
|
package/lib/Video.js
CHANGED