reactjs-tiptap-editor 1.0.12 → 1.0.13
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/lib/{ActionMenuButton-CPPHERbq.cjs → ActionMenuButton-DNj0f_A4.cjs} +1 -1
- package/lib/{ActionMenuButton-BKqin6Kz.js → ActionMenuButton-l5rSmAO_.js} +11 -11
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +6 -6
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +4 -4
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +4 -4
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +4 -4
- package/lib/Callout.cjs +1 -0
- package/lib/Callout.js +230 -0
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +4 -4
- package/lib/CodeBlock.cjs +20 -20
- package/lib/CodeBlock.js +90 -89
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +4 -4
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +6 -6
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +4 -4
- package/lib/{Drawer-DUPsBE0H.js → Drawer-Cbi_MURj.js} +16 -16
- package/lib/{Drawer-fplzqNI6.cjs → Drawer-DKU32YW_.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +16 -16
- package/lib/{Excalidraw-BEzpvRLx.js → Excalidraw-CWrVL5hs.js} +30 -30
- package/lib/{Excalidraw-qjnQspLq.cjs → Excalidraw-Kb-TRcWY.cjs} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +4 -4
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +4 -4
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +6 -6
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +6 -6
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +14 -14
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +6 -6
- package/lib/History.cjs +1 -1
- package/lib/History.js +13 -13
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +4 -4
- package/lib/{Icon-ONE1AwKo.js → Icon-Ctva8VeB.js} +2 -2
- package/lib/{Icon-CiR8RqdQ.cjs → Icon-yqCglrdK.cjs} +1 -1
- package/lib/{Iframe-DsUNJ2n2.cjs → Iframe-BczF8Hex.cjs} +1 -1
- package/lib/{Iframe-CBTnv2mk.js → Iframe-C942bNjs.js} +12 -12
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +48 -48
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +15 -15
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.js +9 -9
- package/lib/{Indent-B00o0P0M.js → Indent-C_O5WdyR.js} +4 -4
- package/lib/{Indent-CaGP0qTp.cjs → Indent-CkEC7x36.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +4 -4
- package/lib/{Katex-x370CSXZ.js → Katex-D3PEWimM.js} +24 -24
- package/lib/{Katex-XsfpKgJU.cjs → Katex-DW_HjgNM.cjs} +2 -2
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +14 -14
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-xt88G5fb.cjs → LinkEditBlock-DL1e2ILk.cjs} +2 -2
- package/lib/{LinkEditBlock-C_ipl3EA.js → LinkEditBlock-h5054QDo.js} +31 -31
- package/lib/Mention.js +3 -3
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +28 -29
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +14 -14
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +4 -4
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +17 -17
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/{SlashCommandNodeView-BT5ystah.cjs → SlashCommandNodeView-BqrmHCpu.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DX6axvLs.js → SlashCommandNodeView-DXUqkx82.js} +12 -12
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +4 -4
- package/lib/{Table-DidusYID.js → Table-DdrY4jcM.js} +7 -7
- package/lib/{Table-DSRSwtXx.cjs → Table-kY0nbqJo.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +4 -4
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +16 -16
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +16 -16
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +4 -4
- package/lib/{Twitter-D58T0Zt3.js → Twitter-B-JQ3ZJ1.js} +18 -18
- package/lib/{Twitter-CBuVBQM1.cjs → Twitter-DjZcVa3l.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +24 -24
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +2083 -1950
- package/lib/button-BS3n6_Aq.cjs +1 -0
- package/lib/{button-9_8t7ca7.js → button-Uv01FNnd.js} +7 -7
- package/lib/{checkbox-BQRKTXXr.cjs → checkbox-C8ByRi7-.cjs} +1 -1
- package/lib/{checkbox-DnkkV6qo.js → checkbox-DEFNwGwb.js} +1 -1
- package/lib/{clsx-DmuN0U_8.js → clsx-BWSGDJNJ.js} +13 -13
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
- package/lib/components/Bubble/index.d.ts +1 -0
- package/lib/components/ui/index.d.ts +1 -0
- package/lib/{dialog-BS3zm-T9.cjs → dialog-Bt5zwGYB.cjs} +1 -1
- package/lib/{dialog-DhayAPvV.js → dialog-DwTMZSt6.js} +1 -1
- package/lib/{dropdown-menu-DQqKeZcx.js → dropdown-menu-BetI14G6.js} +1 -1
- package/lib/{dropdown-menu-CxwWX0yj.cjs → dropdown-menu-Bo68IEOT.cjs} +1 -1
- package/lib/extensions/Callout/Callout.d.ts +18 -0
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
- package/lib/extensions/Callout/index.d.ts +1 -0
- package/lib/{index-D1jd7elj.js → index-BDKHXe7R.js} +1 -1
- package/lib/{index-CKmT9KAQ.js → index-CHKWG6E8.js} +1 -1
- package/lib/{index-EAK64CCA.js → index-CcoWj0mF.js} +131 -130
- package/lib/index-D3RLYf-J.cjs +1 -0
- package/lib/{index-D9JOHlso.js → index-DF5ZPtWM.js} +369 -482
- package/lib/{index-DdEmgiAA.js → index-DJbmnBzK.js} +1 -1
- package/lib/index-Doks9cbR.cjs +1 -0
- package/lib/{index-BDX1uE62.js → index-Dujzr6bY.js} +135 -39
- package/lib/{index-CBFmXCcU.cjs → index-VhKd73hZ.cjs} +1 -1
- package/lib/{index-DvvwJvau.js → index-mR8PNv5P.js} +23 -23
- package/lib/index.cjs +1 -1
- package/lib/index.js +3 -3
- package/lib/{input-YoheBL2D.js → input-DUBdJD3L.js} +5 -5
- package/lib/{input-BJ7ihMq-.cjs → input-Dt_BA_9B.cjs} +1 -1
- package/lib/{isNumber-DmQXlKp3.js → isNumber-CIgubz2e.js} +1 -1
- package/lib/{label-Y7_hvqf2.cjs → label-JNOksCA-.cjs} +1 -1
- package/lib/{label-C8PLcjFI.js → label-topD46-u.js} +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/en.d.ts +16 -0
- package/lib/locales/fi.d.ts +16 -0
- package/lib/locales/hu.d.ts +16 -0
- package/lib/locales/index.d.ts +96 -0
- package/lib/locales/pt-br.d.ts +16 -0
- package/lib/locales/vi.d.ts +16 -0
- package/lib/locales/zh-cn.d.ts +16 -0
- package/lib/{popover-CWmTzHSy.js → popover-LfNBhRyz.js} +1 -1
- package/lib/{popover-BiSrlM4j.cjs → popover-mL-2sX5r.cjs} +1 -1
- package/lib/select-CwGYPsPq.cjs +1 -0
- package/lib/select-DctYuHLH.js +117 -0
- package/lib/{separator-C-DKMYmg.js → separator-Ddfrhn4D.js} +18 -18
- package/lib/{separator-CJ_adziN.cjs → separator-NoH_SLRW.cjs} +1 -1
- package/lib/{store-BKMaw1AW.cjs → store-CkjKIgjQ.cjs} +1 -1
- package/lib/{store-DG7cMfET.js → store-DNpS8vXA.js} +1 -1
- package/lib/style.css +1 -1
- package/lib/{tabs-DxlKKM-N.js → tabs-BT3AeqQQ.js} +1 -1
- package/lib/{tabs-DpHSMyF_.cjs → tabs-DRSwUeKP.cjs} +1 -1
- package/lib/{textarea-DU9RMi6u.cjs → textarea-BDO6XQoF.cjs} +1 -1
- package/lib/{textarea-D7m-apUh.js → textarea-DZzMEDfZ.js} +1 -1
- package/lib/{throttle-BRtichEP.js → throttle-IERhwcLa.js} +1 -1
- package/lib/{toggle-BYvLnjCL.cjs → toggle-BQHMh_Q-.cjs} +1 -1
- package/lib/{toggle-Bxwwb_Kp.js → toggle-DKHg5sLm.js} +10 -10
- package/lib/{tooltip-COvf4_R-.cjs → tooltip-BYtGp6FM.cjs} +1 -1
- package/lib/{tooltip-BTy5CRrN.js → tooltip-DNKq7zgN.js} +1 -1
- package/lib/{updatePosition-CUukgu-Q.js → updatePosition-Bie75EFq.js} +2 -2
- package/lib/{useButtonProps-CydzndG1.cjs → useButtonProps-DBJkNDS2.cjs} +1 -1
- package/lib/{useButtonProps-CfYtuEnd.js → useButtonProps-DVP4s_ER.js} +3 -3
- package/package.json +1 -1
- package/lib/button-Cs9TroWr.cjs +0 -1
- package/lib/index-CVFzP1Dc.cjs +0 -1
- package/lib/index-CX4pNJlH.cjs +0 -1
package/lib/TextAlign.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),m=require("react"),M=require("./toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),m=require("react"),M=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const y=require("./useButtonProps-DBJkNDS2.cjs"),T=require("./popover-mL-2sX5r.cjs"),S=require("./Icon-yqCglrdK.cjs"),j=require("./tooltip-BYtGp6FM.cjs");var K=q.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P=K;function R(){const[e,t]=m.useState(!1),n=y.useButtonProps(C.name),{icon:g=void 0,tooltip:f=void 0,items:r=[],isActive:A=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:l,dataState:c}=y.useActive(A),u=m.useMemo(()=>(c==null?void 0:c.title)||"",[c]),x=m.useMemo(()=>r==null?void 0:r.some(i=>i.title===u),[r,u]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":x?"on":"off",disabled:l,children:s.jsx(M.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:g,tooltip:f,children:s.jsx(S.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:r==null?void 0:r.map((i,p)=>{var o,a;return s.jsxs(j.Tooltip,{children:[s.jsx(j.TooltipTrigger,{asChild:!0,children:s.jsx(M.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":u===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(S.IconComponent,{name:i.icon})})}),s.jsxs(j.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(a=i.shortcutKeys)==null?void 0:a.map(h=>y.getShortcutKey(h)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const C=P.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:g}){var c,u,x,i,p;const f=((c=n.options)==null?void 0:c.alignments)||[],r={left:((u=n.options.shortcutKeys)==null?void 0:u[0])??["mod","Shift","L"],center:((x=n.options.shortcutKeys)==null?void 0:x[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},A={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},l=f.map(o=>{var a,h,v;return{title:g(`editor.textalign.${o}.tooltip`),icon:A[o],shortcutKeys:r[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var d,b;return(b=(d=t.commands)==null?void 0:d.setTextAlign)==null?void 0:b.call(d,o)},disabled:!((v=(h=(a=t==null?void 0:t.can)==null?void 0:a.call(t))==null?void 0:h.setTextAlign)!=null&&v.call(h,o))}});return{componentProps:{icon:"AlignJustify",tooltip:g("editor.textalign.tooltip"),items:l,isActive:()=>l==null?void 0:l.find(a=>a.isActive())}}}}}});exports.RichTextAlign=R;exports.TextAlign=C;
|
package/lib/TextAlign.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { E as C } from "./clsx-
|
|
1
|
+
import { E as C } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as o, Fragment as K, jsxs as A } from "react/jsx-runtime";
|
|
3
3
|
import M, { useMemo as v } from "react";
|
|
4
|
-
import { A as S, T as j } from "./toggle-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { A as S, T as j } from "./toggle-DKHg5sLm.js";
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { P,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { u as P, b as w, h as N } from "./useButtonProps-DVP4s_ER.js";
|
|
8
|
+
import { P as z, a as L, b as O } from "./popover-LfNBhRyz.js";
|
|
9
|
+
import { I as b } from "./Icon-Ctva8VeB.js";
|
|
10
|
+
import { T as R, a as _, b as $ } from "./tooltip-DNKq7zgN.js";
|
|
11
11
|
var E = C.create({
|
|
12
12
|
name: "textAlign",
|
|
13
13
|
addOptions() {
|
|
@@ -51,21 +51,21 @@ var E = C.create({
|
|
|
51
51
|
}
|
|
52
52
|
}), J = E;
|
|
53
53
|
function X() {
|
|
54
|
-
const [e, t] = M.useState(!1), n =
|
|
54
|
+
const [e, t] = M.useState(!1), n = P(B.name), {
|
|
55
55
|
icon: p = void 0,
|
|
56
56
|
tooltip: x = void 0,
|
|
57
57
|
items: r = [],
|
|
58
58
|
isActive: m = void 0
|
|
59
|
-
} = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } =
|
|
59
|
+
} = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = w(m), h = v(() => (a == null ? void 0 : a.title) || "", [a]), g = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
|
|
60
60
|
return n ? /* @__PURE__ */ A(
|
|
61
|
-
|
|
61
|
+
z,
|
|
62
62
|
{
|
|
63
63
|
modal: !0,
|
|
64
64
|
onOpenChange: t,
|
|
65
65
|
open: e,
|
|
66
66
|
children: [
|
|
67
67
|
/* @__PURE__ */ o(
|
|
68
|
-
|
|
68
|
+
L,
|
|
69
69
|
{
|
|
70
70
|
asChild: !0,
|
|
71
71
|
className: "hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",
|
|
@@ -90,15 +90,15 @@ function X() {
|
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
92
|
/* @__PURE__ */ o(
|
|
93
|
-
|
|
93
|
+
O,
|
|
94
94
|
{
|
|
95
95
|
align: "start",
|
|
96
96
|
className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
|
|
97
97
|
side: "bottom",
|
|
98
98
|
children: r == null ? void 0 : r.map((i, d) => {
|
|
99
99
|
var s, c;
|
|
100
|
-
return /* @__PURE__ */ A(
|
|
101
|
-
/* @__PURE__ */ o(
|
|
100
|
+
return /* @__PURE__ */ A(R, { children: [
|
|
101
|
+
/* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ o(
|
|
102
102
|
j,
|
|
103
103
|
{
|
|
104
104
|
className: "richtext-size-7 richtext-p-1",
|
|
@@ -110,9 +110,9 @@ function X() {
|
|
|
110
110
|
children: (i == null ? void 0 : i.icon) && /* @__PURE__ */ o(b, { name: i.icon })
|
|
111
111
|
}
|
|
112
112
|
) }),
|
|
113
|
-
/* @__PURE__ */ A(
|
|
113
|
+
/* @__PURE__ */ A($, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
|
|
114
114
|
/* @__PURE__ */ o("span", { children: i.title }),
|
|
115
|
-
!!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) =>
|
|
115
|
+
!!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => N(u)).join(" ") })
|
|
116
116
|
] })
|
|
117
117
|
] }, `text-align-${d}`);
|
|
118
118
|
})
|
package/lib/TextDirection.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),j=require("react"),m=require("./toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),j=require("react"),m=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const d=require("./useButtonProps-DBJkNDS2.cjs"),T=require("./popover-mL-2sX5r.cjs"),D=require("./Icon-yqCglrdK.cjs"),g=require("./tooltip-BYtGp6FM.cjs");function b(){const i=d.useButtonProps(v.name),[c,u]=j.useState(!1),{icon:x=void 0,tooltip:h=void 0,items:s=[],isActive:p=void 0}=(i==null?void 0:i.componentProps)??{},{editorDisabled:l,dataState:o}=d.useActive(p),n=j.useMemo(()=>(o==null?void 0:o.dir)||"unset",[o]);return i?e.jsxs(T.Popover,{open:c,onOpenChange:u,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:l,children:e.jsx(m.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:x,tooltip:h,children:e.jsx(D.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:s==null?void 0:s.map((t,r)=>{var a,f;return e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{"data-state":n===t.value?"on":"off",asChild:!0,children:e.jsx(m.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),u(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(D.IconComponent,{name:t.icon})})}),e.jsxs(g.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((a=t.shortcutKeys)!=null&&a.length)&&e.jsx("span",{children:(f=t.shortcutKeys)==null?void 0:f.map(q=>d.getShortcutKey(q)).join(" ")})]})]},`text-direction-${r}`)})})]}):e.jsx(e.Fragment,{})}const v=C.Extension.create({name:"richTextTextDirection",addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:c,extension:u,t:x}){var l;const h=((l=u.options)==null?void 0:l.directions)||[],s={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=h.map(o=>({title:x(`editor.textDirection.${o}.tooltip`),value:o,icon:s[o],action:()=>{var n,t,r,a;if(o==="unset"){(t=(n=c.commands)==null?void 0:n.unsetTextDirection)==null||t.call(n);return}(a=(r=c.commands)==null?void 0:r.setTextDirection)==null||a.call(r,o)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:x("editor.textDirection.tooltip"),items:p,isActive:()=>c.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=b;exports.TextDirection=v;
|
package/lib/TextDirection.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { E as g } from "./clsx-
|
|
1
|
+
import { E as g } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as o, Fragment as D, jsxs as x } from "react/jsx-runtime";
|
|
3
3
|
import v, { useMemo as b } from "react";
|
|
4
|
-
import { A as C, T as A } from "./toggle-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { A as C, T as A } from "./toggle-DKHg5sLm.js";
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { P,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { u as P, b as w, h as z } from "./useButtonProps-DVP4s_ER.js";
|
|
8
|
+
import { P as N, a as R, b as j } from "./popover-LfNBhRyz.js";
|
|
9
|
+
import { I as f } from "./Icon-Ctva8VeB.js";
|
|
10
|
+
import { T as y, a as K, b as M } from "./tooltip-DNKq7zgN.js";
|
|
11
11
|
function q() {
|
|
12
|
-
const i =
|
|
12
|
+
const i = P(O.name), [c, h] = v.useState(!1), {
|
|
13
13
|
icon: p = void 0,
|
|
14
14
|
tooltip: u = void 0,
|
|
15
15
|
items: s = [],
|
|
16
16
|
isActive: d = void 0
|
|
17
|
-
} = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } =
|
|
17
|
+
} = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = w(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
|
|
18
18
|
return i ? /* @__PURE__ */ x(
|
|
19
|
-
|
|
19
|
+
N,
|
|
20
20
|
{
|
|
21
21
|
open: c,
|
|
22
22
|
onOpenChange: h,
|
|
23
23
|
modal: !0,
|
|
24
24
|
children: [
|
|
25
25
|
/* @__PURE__ */ o(
|
|
26
|
-
|
|
26
|
+
R,
|
|
27
27
|
{
|
|
28
28
|
asChild: !0,
|
|
29
29
|
disabled: a,
|
|
@@ -46,7 +46,7 @@ function q() {
|
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
48
|
/* @__PURE__ */ o(
|
|
49
|
-
|
|
49
|
+
j,
|
|
50
50
|
{
|
|
51
51
|
align: "start",
|
|
52
52
|
className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
|
|
@@ -54,9 +54,9 @@ function q() {
|
|
|
54
54
|
hideWhenDetached: !0,
|
|
55
55
|
children: s == null ? void 0 : s.map((t, n) => {
|
|
56
56
|
var l, m;
|
|
57
|
-
return /* @__PURE__ */ x(
|
|
57
|
+
return /* @__PURE__ */ x(y, { children: [
|
|
58
58
|
/* @__PURE__ */ o(
|
|
59
|
-
|
|
59
|
+
K,
|
|
60
60
|
{
|
|
61
61
|
"data-state": r === t.value ? "on" : "off",
|
|
62
62
|
asChild: !0,
|
|
@@ -73,9 +73,9 @@ function q() {
|
|
|
73
73
|
)
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
/* @__PURE__ */ x(
|
|
76
|
+
/* @__PURE__ */ x(M, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
|
|
77
77
|
/* @__PURE__ */ o("span", { children: t.title }),
|
|
78
|
-
!!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) =>
|
|
78
|
+
!!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => z(T)).join(" ") })
|
|
79
79
|
] })
|
|
80
80
|
] }, `text-direction-${n}`);
|
|
81
81
|
})
|
package/lib/TextUnderline.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const a=require("./useButtonProps-DBJkNDS2.cjs");var k=u.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",u.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),v=k;function x(){const e=a.useButtonProps(l.name),{icon:t=void 0,tooltip:n=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:d,update:p}=a.useToggleActive(c),g=()=>{d||i&&(i(),p())};return e?s.jsx(h.ActionButton,{action:g,dataState:m,disabled:d,icon:t,shortcutKeys:o,tooltip:n,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n,extension:o}){return{componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:n("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=x;exports.TextUnderline=l;
|
package/lib/TextUnderline.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as m, m as p } from "./clsx-
|
|
1
|
+
import { M as m, m as p } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import { A as f } from "./toggle-
|
|
3
|
+
import { A as f } from "./toggle-DKHg5sLm.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./index-
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { u as h, a as k } from "./useButtonProps-
|
|
7
|
+
import { u as h, a as k } from "./useButtonProps-DVP4s_ER.js";
|
|
8
8
|
var M = m.create({
|
|
9
9
|
name: "underline",
|
|
10
10
|
addOptions() {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as U, aa as rt, h as Mt, N as jt, m as Wt, ab as Bt, k as Ft } from "./clsx-BWSGDJNJ.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 { A as Kt } from "./toggle-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { A as Kt } from "./toggle-DKHg5sLm.js";
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { I as
|
|
10
|
-
import {
|
|
11
|
-
import { u as nn } from "./
|
|
12
|
-
import {
|
|
13
|
-
import { I as sn } from "./Icon-
|
|
7
|
+
import { u as Qt } from "./index-Dujzr6bY.js";
|
|
8
|
+
import { L as Jt } from "./label-topD46-u.js";
|
|
9
|
+
import { I as Yt } from "./input-DUBdJD3L.js";
|
|
10
|
+
import { B as Zt } from "./button-Uv01FNnd.js";
|
|
11
|
+
import { c as en, u as tn, a as nn } from "./useButtonProps-DVP4s_ER.js";
|
|
12
|
+
import { P as rn, a as on, b as an } from "./popover-LfNBhRyz.js";
|
|
13
|
+
import { I as sn } from "./Icon-Ctva8VeB.js";
|
|
14
14
|
const cn = "_verified_lvyh0_1", Ue = {
|
|
15
15
|
verified: cn
|
|
16
16
|
}, ln = () => /* @__PURE__ */ r("svg", {
|
|
@@ -1538,7 +1538,7 @@ function ea({ node: e }) {
|
|
|
1538
1538
|
return n ? /* @__PURE__ */ r(Mt, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Zo, { id: n }) }) }) : null;
|
|
1539
1539
|
}
|
|
1540
1540
|
function ta(e) {
|
|
1541
|
-
const { t } =
|
|
1541
|
+
const { t } = Qt(), [n, o] = se("");
|
|
1542
1542
|
Fe(() => {
|
|
1543
1543
|
var i;
|
|
1544
1544
|
if (e != null && e.editor) {
|
|
@@ -1555,9 +1555,9 @@ function ta(e) {
|
|
|
1555
1555
|
className: "richtext-flex richtext-flex-col richtext-gap-2",
|
|
1556
1556
|
onSubmit: a,
|
|
1557
1557
|
children: [
|
|
1558
|
-
/* @__PURE__ */ r(
|
|
1558
|
+
/* @__PURE__ */ r(Jt, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
|
|
1559
1559
|
/* @__PURE__ */ r("div", { className: "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(
|
|
1560
|
-
|
|
1560
|
+
Yt,
|
|
1561
1561
|
{
|
|
1562
1562
|
className: "richtext-w-80",
|
|
1563
1563
|
onChange: (i) => o(i.target.value),
|
|
@@ -1580,24 +1580,24 @@ function ta(e) {
|
|
|
1580
1580
|
);
|
|
1581
1581
|
}
|
|
1582
1582
|
function ga() {
|
|
1583
|
-
const [e, t] = se(!1), n =
|
|
1583
|
+
const [e, t] = se(!1), n = en(), o = tn(Lt.name), {
|
|
1584
1584
|
icon: a = void 0,
|
|
1585
1585
|
tooltip: i = void 0,
|
|
1586
1586
|
tooltipOptions: s = {},
|
|
1587
1587
|
action: c = void 0,
|
|
1588
1588
|
isActive: f = void 0
|
|
1589
|
-
} = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } =
|
|
1589
|
+
} = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = nn(f);
|
|
1590
1590
|
function g(m) {
|
|
1591
1591
|
d || c && (c(m), t(!1));
|
|
1592
1592
|
}
|
|
1593
1593
|
return /* @__PURE__ */ h(
|
|
1594
|
-
|
|
1594
|
+
rn,
|
|
1595
1595
|
{
|
|
1596
1596
|
modal: !0,
|
|
1597
1597
|
onOpenChange: t,
|
|
1598
1598
|
open: e,
|
|
1599
1599
|
children: [
|
|
1600
|
-
/* @__PURE__ */ r(
|
|
1600
|
+
/* @__PURE__ */ r(on, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1601
1601
|
Kt,
|
|
1602
1602
|
{
|
|
1603
1603
|
disabled: d,
|
|
@@ -1608,7 +1608,7 @@ function ga() {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
) }),
|
|
1610
1610
|
/* @__PURE__ */ r(
|
|
1611
|
-
|
|
1611
|
+
an,
|
|
1612
1612
|
{
|
|
1613
1613
|
align: "start",
|
|
1614
1614
|
className: "richtext-w-full",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),qt=require("./toggle-BYvLnjCL.cjs");require("./index-CX4pNJlH.cjs");require("./theme.cjs");const je=require("./popover-BiSrlM4j.cjs"),$t=require("./button-Cs9TroWr.cjs"),Dt=require("./input-BJ7ihMq-.cjs"),At=require("./label-Y7_hvqf2.cjs"),Mt=require("./index-CVFzP1Dc.cjs"),we=require("./useButtonProps-CydzndG1.cjs"),Vt=require("./Icon-CiR8RqdQ.cjs"),Wt="_verified_lvyh0_1",We={verified:Wt},Bt=()=>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"})})}),Pt=()=>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"})]})]})}),Ft=()=>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"})})}),Ut="_root_98iqw_1",zt="_article_98iqw_21",et={root:Ut,article:zt},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}),Ht="_verifiedOld_lcna5_1",Gt="_verifiedBlue_lcna5_4",Xt="_verifiedGovernment_lcna5_7",ye={verifiedOld:Ht,verifiedBlue:Gt,verifiedGovernment:Xt},_t=({user:e,className:n})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=t.jsx(Bt,{}),o=ye.verifiedBlue;if(r)switch(e.is_blue_verified||(o=ye.verifiedOld),e.verified_type){case"Government":s=t.jsx(Ft,{}),o=ye.verifiedGovernment;break;case"Business":s=t.jsx(Pt,{}),o=null;break}return r?t.jsx("div",{className:S.clsx(n,o),children:s}):null},Kt="_label_36ucz_1",Qt={label:Kt},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(Qt.label,n),children:t.jsx("img",{src:o,alt:s.description})}):null},Jt="_header_nqq4j_1",Yt="_avatar_nqq4j_11",Zt="_avatarOverflow_nqq4j_16",en="_avatarSquare_nqq4j_23",tn="_avatarShadow_nqq4j_26",nn="_author_nqq4j_37",rn="_authorLink_nqq4j_44",sn="_authorVerified_nqq4j_53",on="_authorLinkText_nqq4j_56",an="_authorMeta_nqq4j_63",cn="_authorFollow_nqq4j_66",ln="_username_nqq4j_69",dn="_follow_nqq4j_74",un="_separator_nqq4j_82",fn="_brand_nqq4j_86",hn="_twitterIcon_nqq4j_90",T={header:Jt,avatar:Yt,avatarOverflow:Zt,avatarSquare:en,avatarShadow:tn,author:nn,authorLink:rn,authorVerified:sn,authorLinkText:on,authorMeta:an,authorFollow:cn,username:ln,follow:dn,separator:un,brand:fn,twitterIcon:hn},_n=({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"})})})})]})},mn="_root_1ec15_1",pn={root:mn},xn=({tweet:e})=>t.jsxs("a",{href:e.in_reply_to_url,className:pn.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),vn="_root_eihfa_1",gn={root:vn},pt=({href:e,children:n})=>t.jsx("a",{href:e,className:gn.root,target:"_blank",rel:"noopener noreferrer nofollow",children:n}),jn="_root_1xq52_1",wn={root:jn},yn=({tweet:e})=>t.jsxs("p",{className:wn.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(bn,{tweet:e}):null]});function bn({tweet:e}){return t.jsxs(pt,{href:e.url,children:[t.jsx("span",{children:" "}),"Show more"]})}const Tn={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},Nn=new Intl.DateTimeFormat("en-US",Tn),Rn=e=>{const n={};for(const r of e)n[r.type]=r.value;return n},Sn=e=>{const n=Rn(Nn.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}`,In=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,kn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,En=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,Cn=e=>`https://x.com/hashtag/${e.text}`,On=e=>`https://x.com/search?q=%24${e.text}`,Ln=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},qn=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)})},$n=e=>{const n=qn(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 ce(r,"hashtag",e.entities.hashtags),ce(r,"mention",e.entities.user_mentions),ce(r,"url",e.entities.urls),ce(r,"symbol",e.entities.symbols),e.entities.media&&ce(r,"media",e.entities.media),Dn(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:Cn(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:On(s),text:o});default:return Object.assign(s,{text:o})}})}function ce(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 Dn(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 An=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:En(e)},like_url:In(e),reply_url:kn(e),in_reply_to_url:e.in_reply_to_screen_name?Ln(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}),Mn="_root_g9tkv_1",Vn="_rounded_g9tkv_6",Wn="_mediaWrapper_g9tkv_10",Bn="_grid2Columns_g9tkv_17",Pn="_grid3_g9tkv_20",Fn="_grid2x2_g9tkv_23",Un="_mediaContainer_g9tkv_26",zn="_mediaLink_g9tkv_34",Hn="_skeleton_g9tkv_38",Gn="_image_g9tkv_43",C={root:Mn,rounded:Vn,mediaWrapper:Wn,grid2Columns:Bn,grid3:Pn,grid2x2:Fn,mediaContainer:Un,mediaLink:zn,skeleton:Hn,image:Gn},Xn="_anchor_fp31d_1",Kn="_videoButton_fp31d_17",Qn="_videoButtonIcon_fp31d_35",Jn="_watchOnTwitter_fp31d_44",Yn="_viewReplies_fp31d_60",se={anchor:Xn,videoButton:Kn,videoButtonIcon:Qn,watchOnTwitter:Jn,viewReplies:Yn},Zn=({tweet:e,media:n})=>{const[r,s]=h.useState(!0),[o,a]=h.useState(!1),[i,c]=h.useState(!1),f=$n(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:se.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:se.videoButtonIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!i&&t.jsx("div",{className:se.watchOnTwitter,children:t.jsx("a",{href:e.url,className:se.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(se.anchor,se.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},er=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:er;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(Zn,{tweet:e,media:d})]},d.media_url_https)},d.media_url_https))})})},tr="_root_i24yn_1",nr={root:tr},rr=({tweet:e})=>{const n=new Date(e.created_at),r=Sn(n);return t.jsx("a",{className:nr.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:t.jsx("time",{dateTime:n.toISOString(),children:r})})},sr="_info_19qcj_1",or="_infoLink_19qcj_10",ir="_infoIcon_19qcj_30",be={info:sr,infoLink:or,infoIcon:ir},ar=({tweet:e})=>t.jsxs("div",{className:be.info,children:[t.jsx(rr,{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"})})})})]}),cr="_actions_n2anf_1",lr="_like_n2anf_13",dr="_reply_n2anf_14",ur="_copy_n2anf_15",fr="_likeIconWrapper_n2anf_27",hr="_likeCount_n2anf_30",_r="_replyIconWrapper_n2anf_35",mr="_copyIconWrapper_n2anf_36",pr="_likeIcon_n2anf_27",xr="_replyIcon_n2anf_35",vr="_copyIcon_n2anf_36",gr="_replyText_n2anf_56",jr="_copyText_n2anf_57",k={actions:cr,like:lr,reply:dr,copy:ur,likeIconWrapper:fr,likeCount:hr,replyIconWrapper:_r,copyIconWrapper:mr,likeIcon:pr,replyIcon:xr,copyIcon:vr,replyText:gr,copyText:jr},wr=({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"})]})},yr=({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(wr,{tweet:e})]})},br="_replies_1cutb_1",Tr="_link_1cutb_4",Nr="_text_1cutb_23",Te={replies:br,link:Tr,text:Nr},Rr=({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`})})}),Sr="_root_q5799_1",Ir="_article_q5799_16",st={root:Sr,article:Ir},kr=({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})}),Er="_header_f00ab_1",Cr="_avatar_f00ab_11",Or="_avatarOverflow_f00ab_16",Lr="_avatarSquare_f00ab_23",qr="_author_f00ab_27",$r="_authorText_f00ab_33",Dr="_username_f00ab_40",K={header:Er,avatar:Cr,avatarOverflow:Or,avatarSquare:Lr,author:qr,authorText:$r,username:Dr},Ar=({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:K.header,children:[t.jsx("a",{href:e.url,className:K.avatar,target:"_blank",rel:"noopener noreferrer",children:t.jsx("div",{className:S.clsx(K.avatarOverflow,r.profile_image_shape==="Square"&&K.avatarSquare),children:t.jsx(o,{src:r.profile_image_url_https,alt:r.name,width:20,height:20})})}),t.jsxs("div",{className:K.author,children:[t.jsx("div",{className:K.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:K.username,children:t.jsxs("span",{title:`@${r.screen_name}`,children:["@",r.screen_name]})})]})]})},Mr="_root_175ot_1",Vr={root:Mr},Wr=({tweet:e})=>t.jsx("p",{className:Vr.root,lang:e.lang,dir:"auto",children:e.entities.map((n,r)=>t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r))}),Br=({tweet:e,components:n})=>{var r;return t.jsxs(kr,{tweet:e,children:[t.jsx(Ar,{tweet:e,components:n}),t.jsx(Wr,{tweet:e}),(r=e.mediaDetails)!=null&&r.length?t.jsx(gt,{quoted:!0,tweet:e}):null]})},Pr=({tweet:e,components:n})=>{var r;const s=h.useMemo(()=>An(e),[e]);return t.jsxs(Be,{children:[t.jsx(_n,{tweet:s,components:n}),s.in_reply_to_status_id_str&&t.jsx(xn,{tweet:s}),t.jsx(yn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?t.jsx(gt,{tweet:s,components:n}):null,s.quoted_tweet&&t.jsx(Br,{tweet:s.quoted_tweet,components:n}),t.jsx(ar,{tweet:s}),t.jsx(yr,{tweet:s}),t.jsx(Rr,{tweet:s})]})},Fr="_root_16yxa_1",Ur={root:Fr},zr=e=>t.jsx(Be,{children:t.jsxs("div",{className:Ur.root,children:[t.jsx("h3",{children:"Tweet not found"}),t.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Hr="_skeleton_oi7hr_1",Gr={skeleton:Hr},_e=({style:e})=>t.jsx("span",{className:Gr.skeleton,style:e}),Xr="_root_17qqv_1",Kr={root:Xr},Qr=()=>t.jsxs(Be,{className:Kr.root,children:[t.jsx(_e,{style:{height:"3rem",marginBottom:"0.75rem"}}),t.jsx(_e,{style:{height:"6rem",margin:"0.5rem 0"}}),t.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),t.jsx(_e,{style:{height:"2rem"}}),t.jsx(_e,{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 F=new WeakMap,U=()=>{},R=U(),Le=Object,u=e=>e===R,W=e=>typeof e=="function",z=(e,n)=>({...e,...n}),bt=e=>W(e.then),Ne={},me={},Pe="undefined",le=typeof window!=Pe,qe=typeof document!=Pe,Jr=le&&"Deno"in window,Yr=()=>le&&typeof window.requestAnimationFrame!=Pe,Tt=(e,n)=>{const r=F.get(e);return[()=>!u(n)&&e.get(n)||Ne,s=>{if(!u(n)){const o=e.get(n);n in me||(me[n]=o),r[5](n,z(o,s),o||Ne)}},r[6],()=>!u(n)&&n in me?me[n]:!u(n)&&e.get(n)||Ne]};let $e=!0;const Zr=()=>$e,[De,Ae]=le&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],es=()=>{const e=qe&&document.visibilityState;return u(e)||e!=="hidden"},ts=e=>(qe&&document.addEventListener("visibilitychange",e),De("focus",e),()=>{qe&&document.removeEventListener("visibilitychange",e),Ae("focus",e)}),ns=e=>{const n=()=>{$e=!0,e()},r=()=>{$e=!1};return De("online",n),De("offline",r),()=>{Ae("online",n),Ae("offline",r)}},rs={isOnline:Zr,isVisible:es},ss={initFocus:ts,initReconnect:ns},at=!h.useId,oe=!le||Jr,os=e=>Yr()?window.requestAnimationFrame(e):setTimeout(e,1),Re=oe?h.useEffect:h.useLayoutEffect,Se=typeof navigator<"u"&&navigator.connection,ct=!oe&&Se&&(["slow-2g","2g"].includes(Se.effectiveType)||Se.saveData),pe=new WeakMap,is=e=>Le.prototype.toString.call(e),Ie=(e,n)=>e===`[object ${n}]`;let as=0;const Me=e=>{const n=typeof e,r=is(e),s=Ie(r,"Date"),o=Ie(r,"RegExp"),a=Ie(r,"Object");let i,c;if(Le(e)===e&&!s&&!o){if(i=pe.get(e),i)return i;if(i=++as+"~",pe.set(e,i),Array.isArray(e)){for(i="@",c=0;c<e.length;c++)i+=Me(e[c])+",";pe.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])+",");pe.set(e,i)}}else i=s?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return i},Fe=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 cs=0;const Ve=()=>++cs;async function Nt(...e){const[n,r,s,o]=e,a=z({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]=Fe(w);if(!N)return;const[E,L]=Tt(n,N),[D,ie,l,de]=F.get(n),Q=()=>{const q=D[N];return(W(a.revalidate)?a.revalidate(E().data,w):a.revalidate!==!1)&&(delete l[N],delete de[N],q&&q[0])?q[0](yt).then(()=>E().data):E().data};if(e.length<3)return Q();let y=s,A,M=!1;const J=Ve();ie[N]=[J,0];const p=!u(f),Y=E(),V=Y.data,Z=Y._c,H=u(Z)?V:Z;if(p&&(f=W(f)?f(H,V):f,L({data:f,_c:H})),W(y))try{y=y(H)}catch(q){A=q,M=!0}if(y&&bt(y))if(y=await y.catch(q=>{A=q,M=!0}),J!==ie[N][0]){if(M)throw A;return y}else M&&p&&d(A)&&(i=!0,L({data:H,_c:R}));if(i&&!M)if(W(i)){const q=i(y,H);L({data:q,error:R,_c:R})}else L({data:y,error:R,_c:R});if(ie[N][1]=Ve(),Promise.resolve(Q()).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)},ls=(e,n)=>{if(!F.has(e)){const r=z(ss,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(!F.has(e)&&(F.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,f,c]),!oe)){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(),F.delete(e)}}};return d(),[e,o,d,a]}return[e,F.get(e)[4]]},ds=(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)},us=Oe,[Rt,fs]=ls(new Map),hs=z({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:ds,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:us,isPaused:()=>!1,cache:Rt,mutate:fs,fallback:{}},rs),_s=(e,n)=>{const r=z(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=z(o,i))}return r},ms=h.createContext({}),ps="$inf$",St=le&&window.__SWR_DEVTOOLS_USE__,xs=St?window.__SWR_DEVTOOLS_USE__:[],vs=()=>{St&&(window.__SWR_DEVTOOLS_REACT__=h)},gs=e=>W(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],js=()=>{const e=h.useContext(ms);return h.useMemo(()=>z(hs,e),[e])},ws=e=>(n,r,s)=>e(n,r&&((...a)=>{const[i]=Fe(n),[,,,c]=F.get(Rt);if(i.startsWith(ps))return r(...a);const f=c[i];return u(f)?r(...a):(delete c[i],f)}),s),ys=xs.concat(ws),bs=e=>function(...r){const s=js(),[o,a,i]=gs(r),c=_s(s,i);let f=e;const{use:d}=c,v=(d||[]).concat(ys);for(let m=v.length;m--;)f=v[m](f);return f(o,a||c.fetcher||null,c)},Ts=(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())}};vs();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),Ns=(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,ie]=F.get(s),[l,de]=Fe(e),Q=h.useRef(!1),y=h.useRef(!1),A=h.useRef(l),M=h.useRef(n),J=h.useRef(r),p=()=>J.current,Y=()=>p().isVisible()&&p().isOnline(),[V,Z,H,q]=Tt(s,l),ee=h.useRef({}).current,ue=u(i)?u(r.fallback)?R:r.fallback[l]:i,ze=(_,x)=>{for(const j in ee){const g=j;if(g==="data"){if(!o(_[g],x[g])&&(!u(_[g])||!o(he,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=z(I);return delete B._k,_?{isValidating:!0,isLoading:!0,...B}:B},j=V(),g=q(),$=x(j),re=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)},()=>re]},[s,l]),te=S.shimExports.useSyncExternalStore(h.useCallback(_=>H(l,(x,j)=>{ze(j,x)||_()}),[s,l]),He[0],He[1]),Ge=!Q.current,kt=E[l]&&E[l].length>0,ne=te.data,G=u(ne)?ue&&bt(ue)?ke(ue):ue:ne,fe=te.error,xe=h.useRef(G),he=w?u(ne)?u(xe.current)?G:xe.current:ne:G,X=l&&u(G),Et=!oe&&S.shimExports.useSyncExternalStore(()=>U,()=>!1,()=>!0);N&&Et&&!a&&X&&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(fe)?!1:Ge&&!u(c)?c:p().isPaused()?!1:a?u(G)?!1:f:u(G)||f,Ke=!!(l&&n&&Ge&&Xe),Ct=u(te.isValidating)?Ke:te.isValidating,Ot=u(te.isLoading)?Ke:te.isLoading,ae=h.useCallback(async _=>{const x=M.current;if(!l||!x||y.current||p().isPaused())return!1;let j,g,$=!0;const re=_||{},b=!D[l]||!re.dedupe,I=()=>at?!y.current&&l===A.current&&Q.current:l===A.current,B={isValidating:!1,isLoading:!1},Je=()=>{Z(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&&(Z(Ze),r.loadingTimeout&&u(V().data)&&setTimeout(()=>{$&&I()&&p().onLoadingSlow(l,r)},r.loadingTimeout),D[l]=[x(de),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 P=V().data;B.data=o(P,j)?P:j,b&&I()&&p().onSuccess(j,l,r)}catch(O){Ye();const P=p(),{shouldRetryOnError:ve}=P;P.isPaused()||(B.error=O,b&&I()&&(P.onError(O,l,P),(ve===!0||W(ve)&&ve(O))&&(!p().revalidateOnFocus||!p().revalidateOnReconnect||Y())&&P.onErrorRetry(O,l,P,Lt=>{const ge=E[l];ge&&ge[0]&&ge[0](ot,Lt)},{retryCount:(re.retryCount||0)+1,dedupe:!0})))}return $=!1,Je(),!0},[l,s]),Qe=h.useCallback((..._)=>Nt(s,A.current,..._),[]);if(Re(()=>{M.current=n,J.current=r,u(ne)||(xe.current=ne)}),Re(()=>{if(!l)return;const _=ae.bind(R,Ee);let x=0;p().revalidateOnFocus&&(x=Date.now()+p().focusThrottleInterval);const g=Ts(l,E,($,re={})=>{if($==jt){const b=Date.now();p().revalidateOnFocus&&b>x&&Y()&&(x=b+p().focusThrottleInterval,_())}else if($==wt)p().revalidateOnReconnect&&Y()&&_();else{if($==yt)return ae();if($==ot)return ae(re)}});return y.current=!1,A.current=l,Q.current=!0,Z({_k:de}),Xe&&(D[l]||(u(G)||oe?_():os(_))),()=>{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())?ae(Ee).then(x):x()}return x(),()=>{_&&(clearTimeout(_),_=-1)}},[d,v,m,l]),h.useDebugValue(he),a){if(!at&&oe&&X)throw new Error("Fallback data is required when using Suspense in SSR.");X&&(M.current=n,J.current=r,y.current=!1);const _=ie[l],x=!u(_)&&X?Qe(_):dt;if(ke(x),!u(fe)&&X)throw fe;const j=X?ae(Ee):dt;!u(he)&&X&&(j.status="fulfilled",j.value=!0),ke(j)}return{mutate:Qe,get data(){return ee.data=!0,he},get error(){return ee.error=!0,fe},get isValidating(){return ee.isValidating=!0,Ct},get isLoading(){return ee.isLoading=!0,Ot}}},ut=bs(Ns);class Rs extends Error{constructor({message:n,status:r,data:s}){super(n),this.name="TwitterApiError",this.status=r,this.data=s}}const Ss=ut.default||ut,Is="https://react-tweet.vercel.app";async function ks([e,n]){const r=await fetch(e,n),s=await r.json();if(r.ok)return s.data||null;throw new Rs({message:`Failed to fetch tweet at "${e}" with "${r.status}".`,data:s,status:r.status})}const Es=(e,n,r)=>{const{isLoading:s,data:o,error:a}=Ss(()=>n||e?[n||e&&`${Is}/api/tweet/${e}`,r]:null,ks,{revalidateIfStale:!1,revalidateOnFocus:!1,shouldRetryOnError:!1});return{isLoading:!!(s||o===void 0&&!a),data:o,error:a}},Cs=({id:e,apiUrl:n,fallback:r=t.jsx(Qr,{}),components:s,fetchOptions:o,onError:a})=>{const{data:i,error:c,isLoading:f}=Es(e,n,o);if(f)return r;if(c||!i){const d=(s==null?void 0:s.TweetNotFound)||zr;return t.jsx(d,{error:a?a(c):c})}return t.jsx(Pr,{tweet:i,components:s})};function Os({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(Cs,{id:r})})}):null}function It(e){const{t:n}=Mt.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(At.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(Dt.Input,{className:"richtext-w-80",onChange:a=>s(a.target.value),placeholder:"Text",required:!0,type:"text",value:r})})}),t.jsx($t.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:n("editor.link.dialog.button.apply")})]})}function Ls(){const[e,n]=h.useState(!1),r=we.useEditorInstance(),s=we.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}=we.useToggleActive(f);function v(m){d||c&&(c(m),n(!1))}return t.jsxs(je.Popover,{modal:!0,onOpenChange:n,open:e,children:[t.jsx(je.PopoverTrigger,{asChild:!0,children:t.jsx(qt.ActionButton,{disabled:d,isActive:f,tooltip:a,tooltipOptions:i,children:t.jsx(Vt.IconComponent,{name:o})})}),t.jsx(je.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:t.jsx(It,{editor:r,onSetLink:v})})]})}const qs=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,$s=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function ft(e){return e.match($s)}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(Os,{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:qs,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes({"data-twitter":""},e)]}});exports.FormEditLinkTwitter=It;exports.RichTextTwitter=Ls;exports.Twitter=Ue;
|
|
1
|
+
"use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),qt=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const $t=require("./index-Doks9cbR.cjs"),Dt=require("./label-JNOksCA-.cjs"),At=require("./input-Dt_BA_9B.cjs"),Mt=require("./button-BS3n6_Aq.cjs"),je=require("./useButtonProps-DBJkNDS2.cjs"),we=require("./popover-mL-2sX5r.cjs"),Vt=require("./Icon-yqCglrdK.cjs"),Wt="_verified_lvyh0_1",We={verified:Wt},Bt=()=>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"})})}),Pt=()=>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"})]})]})}),Ft=()=>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"})})}),Ut="_root_98iqw_1",zt="_article_98iqw_21",et={root:Ut,article:zt},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}),Ht="_verifiedOld_lcna5_1",Gt="_verifiedBlue_lcna5_4",Xt="_verifiedGovernment_lcna5_7",ye={verifiedOld:Ht,verifiedBlue:Gt,verifiedGovernment:Xt},_t=({user:e,className:n})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=t.jsx(Bt,{}),o=ye.verifiedBlue;if(r)switch(e.is_blue_verified||(o=ye.verifiedOld),e.verified_type){case"Government":s=t.jsx(Ft,{}),o=ye.verifiedGovernment;break;case"Business":s=t.jsx(Pt,{}),o=null;break}return r?t.jsx("div",{className:S.clsx(n,o),children:s}):null},Kt="_label_36ucz_1",Qt={label:Kt},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(Qt.label,n),children:t.jsx("img",{src:o,alt:s.description})}):null},Jt="_header_nqq4j_1",Yt="_avatar_nqq4j_11",Zt="_avatarOverflow_nqq4j_16",en="_avatarSquare_nqq4j_23",tn="_avatarShadow_nqq4j_26",nn="_author_nqq4j_37",rn="_authorLink_nqq4j_44",sn="_authorVerified_nqq4j_53",on="_authorLinkText_nqq4j_56",an="_authorMeta_nqq4j_63",cn="_authorFollow_nqq4j_66",ln="_username_nqq4j_69",dn="_follow_nqq4j_74",un="_separator_nqq4j_82",fn="_brand_nqq4j_86",hn="_twitterIcon_nqq4j_90",T={header:Jt,avatar:Yt,avatarOverflow:Zt,avatarSquare:en,avatarShadow:tn,author:nn,authorLink:rn,authorVerified:sn,authorLinkText:on,authorMeta:an,authorFollow:cn,username:ln,follow:dn,separator:un,brand:fn,twitterIcon:hn},_n=({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"})})})})]})},mn="_root_1ec15_1",pn={root:mn},xn=({tweet:e})=>t.jsxs("a",{href:e.in_reply_to_url,className:pn.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),vn="_root_eihfa_1",gn={root:vn},pt=({href:e,children:n})=>t.jsx("a",{href:e,className:gn.root,target:"_blank",rel:"noopener noreferrer nofollow",children:n}),jn="_root_1xq52_1",wn={root:jn},yn=({tweet:e})=>t.jsxs("p",{className:wn.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(bn,{tweet:e}):null]});function bn({tweet:e}){return t.jsxs(pt,{href:e.url,children:[t.jsx("span",{children:" "}),"Show more"]})}const Tn={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},Nn=new Intl.DateTimeFormat("en-US",Tn),Rn=e=>{const n={};for(const r of e)n[r.type]=r.value;return n},Sn=e=>{const n=Rn(Nn.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}`,In=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,kn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,En=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,Cn=e=>`https://x.com/hashtag/${e.text}`,On=e=>`https://x.com/search?q=%24${e.text}`,Ln=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},qn=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)})},$n=e=>{const n=qn(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 ce(r,"hashtag",e.entities.hashtags),ce(r,"mention",e.entities.user_mentions),ce(r,"url",e.entities.urls),ce(r,"symbol",e.entities.symbols),e.entities.media&&ce(r,"media",e.entities.media),Dn(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:Cn(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:On(s),text:o});default:return Object.assign(s,{text:o})}})}function ce(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 Dn(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 An=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:En(e)},like_url:In(e),reply_url:kn(e),in_reply_to_url:e.in_reply_to_screen_name?Ln(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}),Mn="_root_g9tkv_1",Vn="_rounded_g9tkv_6",Wn="_mediaWrapper_g9tkv_10",Bn="_grid2Columns_g9tkv_17",Pn="_grid3_g9tkv_20",Fn="_grid2x2_g9tkv_23",Un="_mediaContainer_g9tkv_26",zn="_mediaLink_g9tkv_34",Hn="_skeleton_g9tkv_38",Gn="_image_g9tkv_43",C={root:Mn,rounded:Vn,mediaWrapper:Wn,grid2Columns:Bn,grid3:Pn,grid2x2:Fn,mediaContainer:Un,mediaLink:zn,skeleton:Hn,image:Gn},Xn="_anchor_fp31d_1",Kn="_videoButton_fp31d_17",Qn="_videoButtonIcon_fp31d_35",Jn="_watchOnTwitter_fp31d_44",Yn="_viewReplies_fp31d_60",se={anchor:Xn,videoButton:Kn,videoButtonIcon:Qn,watchOnTwitter:Jn,viewReplies:Yn},Zn=({tweet:e,media:n})=>{const[r,s]=h.useState(!0),[o,a]=h.useState(!1),[i,c]=h.useState(!1),f=$n(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:se.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:se.videoButtonIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!i&&t.jsx("div",{className:se.watchOnTwitter,children:t.jsx("a",{href:e.url,className:se.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(se.anchor,se.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},er=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:er;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(Zn,{tweet:e,media:d})]},d.media_url_https)},d.media_url_https))})})},tr="_root_i24yn_1",nr={root:tr},rr=({tweet:e})=>{const n=new Date(e.created_at),r=Sn(n);return t.jsx("a",{className:nr.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:t.jsx("time",{dateTime:n.toISOString(),children:r})})},sr="_info_19qcj_1",or="_infoLink_19qcj_10",ir="_infoIcon_19qcj_30",be={info:sr,infoLink:or,infoIcon:ir},ar=({tweet:e})=>t.jsxs("div",{className:be.info,children:[t.jsx(rr,{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"})})})})]}),cr="_actions_n2anf_1",lr="_like_n2anf_13",dr="_reply_n2anf_14",ur="_copy_n2anf_15",fr="_likeIconWrapper_n2anf_27",hr="_likeCount_n2anf_30",_r="_replyIconWrapper_n2anf_35",mr="_copyIconWrapper_n2anf_36",pr="_likeIcon_n2anf_27",xr="_replyIcon_n2anf_35",vr="_copyIcon_n2anf_36",gr="_replyText_n2anf_56",jr="_copyText_n2anf_57",k={actions:cr,like:lr,reply:dr,copy:ur,likeIconWrapper:fr,likeCount:hr,replyIconWrapper:_r,copyIconWrapper:mr,likeIcon:pr,replyIcon:xr,copyIcon:vr,replyText:gr,copyText:jr},wr=({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"})]})},yr=({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(wr,{tweet:e})]})},br="_replies_1cutb_1",Tr="_link_1cutb_4",Nr="_text_1cutb_23",Te={replies:br,link:Tr,text:Nr},Rr=({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`})})}),Sr="_root_q5799_1",Ir="_article_q5799_16",st={root:Sr,article:Ir},kr=({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})}),Er="_header_f00ab_1",Cr="_avatar_f00ab_11",Or="_avatarOverflow_f00ab_16",Lr="_avatarSquare_f00ab_23",qr="_author_f00ab_27",$r="_authorText_f00ab_33",Dr="_username_f00ab_40",K={header:Er,avatar:Cr,avatarOverflow:Or,avatarSquare:Lr,author:qr,authorText:$r,username:Dr},Ar=({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:K.header,children:[t.jsx("a",{href:e.url,className:K.avatar,target:"_blank",rel:"noopener noreferrer",children:t.jsx("div",{className:S.clsx(K.avatarOverflow,r.profile_image_shape==="Square"&&K.avatarSquare),children:t.jsx(o,{src:r.profile_image_url_https,alt:r.name,width:20,height:20})})}),t.jsxs("div",{className:K.author,children:[t.jsx("div",{className:K.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:K.username,children:t.jsxs("span",{title:`@${r.screen_name}`,children:["@",r.screen_name]})})]})]})},Mr="_root_175ot_1",Vr={root:Mr},Wr=({tweet:e})=>t.jsx("p",{className:Vr.root,lang:e.lang,dir:"auto",children:e.entities.map((n,r)=>t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r))}),Br=({tweet:e,components:n})=>{var r;return t.jsxs(kr,{tweet:e,children:[t.jsx(Ar,{tweet:e,components:n}),t.jsx(Wr,{tweet:e}),(r=e.mediaDetails)!=null&&r.length?t.jsx(gt,{quoted:!0,tweet:e}):null]})},Pr=({tweet:e,components:n})=>{var r;const s=h.useMemo(()=>An(e),[e]);return t.jsxs(Be,{children:[t.jsx(_n,{tweet:s,components:n}),s.in_reply_to_status_id_str&&t.jsx(xn,{tweet:s}),t.jsx(yn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?t.jsx(gt,{tweet:s,components:n}):null,s.quoted_tweet&&t.jsx(Br,{tweet:s.quoted_tweet,components:n}),t.jsx(ar,{tweet:s}),t.jsx(yr,{tweet:s}),t.jsx(Rr,{tweet:s})]})},Fr="_root_16yxa_1",Ur={root:Fr},zr=e=>t.jsx(Be,{children:t.jsxs("div",{className:Ur.root,children:[t.jsx("h3",{children:"Tweet not found"}),t.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Hr="_skeleton_oi7hr_1",Gr={skeleton:Hr},_e=({style:e})=>t.jsx("span",{className:Gr.skeleton,style:e}),Xr="_root_17qqv_1",Kr={root:Xr},Qr=()=>t.jsxs(Be,{className:Kr.root,children:[t.jsx(_e,{style:{height:"3rem",marginBottom:"0.75rem"}}),t.jsx(_e,{style:{height:"6rem",margin:"0.5rem 0"}}),t.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),t.jsx(_e,{style:{height:"2rem"}}),t.jsx(_e,{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 F=new WeakMap,U=()=>{},R=U(),Le=Object,u=e=>e===R,W=e=>typeof e=="function",z=(e,n)=>({...e,...n}),bt=e=>W(e.then),Ne={},me={},Pe="undefined",le=typeof window!=Pe,qe=typeof document!=Pe,Jr=le&&"Deno"in window,Yr=()=>le&&typeof window.requestAnimationFrame!=Pe,Tt=(e,n)=>{const r=F.get(e);return[()=>!u(n)&&e.get(n)||Ne,s=>{if(!u(n)){const o=e.get(n);n in me||(me[n]=o),r[5](n,z(o,s),o||Ne)}},r[6],()=>!u(n)&&n in me?me[n]:!u(n)&&e.get(n)||Ne]};let $e=!0;const Zr=()=>$e,[De,Ae]=le&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],es=()=>{const e=qe&&document.visibilityState;return u(e)||e!=="hidden"},ts=e=>(qe&&document.addEventListener("visibilitychange",e),De("focus",e),()=>{qe&&document.removeEventListener("visibilitychange",e),Ae("focus",e)}),ns=e=>{const n=()=>{$e=!0,e()},r=()=>{$e=!1};return De("online",n),De("offline",r),()=>{Ae("online",n),Ae("offline",r)}},rs={isOnline:Zr,isVisible:es},ss={initFocus:ts,initReconnect:ns},at=!h.useId,oe=!le||Jr,os=e=>Yr()?window.requestAnimationFrame(e):setTimeout(e,1),Re=oe?h.useEffect:h.useLayoutEffect,Se=typeof navigator<"u"&&navigator.connection,ct=!oe&&Se&&(["slow-2g","2g"].includes(Se.effectiveType)||Se.saveData),pe=new WeakMap,is=e=>Le.prototype.toString.call(e),Ie=(e,n)=>e===`[object ${n}]`;let as=0;const Me=e=>{const n=typeof e,r=is(e),s=Ie(r,"Date"),o=Ie(r,"RegExp"),a=Ie(r,"Object");let i,c;if(Le(e)===e&&!s&&!o){if(i=pe.get(e),i)return i;if(i=++as+"~",pe.set(e,i),Array.isArray(e)){for(i="@",c=0;c<e.length;c++)i+=Me(e[c])+",";pe.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])+",");pe.set(e,i)}}else i=s?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return i},Fe=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 cs=0;const Ve=()=>++cs;async function Nt(...e){const[n,r,s,o]=e,a=z({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]=Fe(w);if(!N)return;const[E,L]=Tt(n,N),[D,ie,l,de]=F.get(n),Q=()=>{const q=D[N];return(W(a.revalidate)?a.revalidate(E().data,w):a.revalidate!==!1)&&(delete l[N],delete de[N],q&&q[0])?q[0](yt).then(()=>E().data):E().data};if(e.length<3)return Q();let y=s,A,M=!1;const J=Ve();ie[N]=[J,0];const p=!u(f),Y=E(),V=Y.data,Z=Y._c,H=u(Z)?V:Z;if(p&&(f=W(f)?f(H,V):f,L({data:f,_c:H})),W(y))try{y=y(H)}catch(q){A=q,M=!0}if(y&&bt(y))if(y=await y.catch(q=>{A=q,M=!0}),J!==ie[N][0]){if(M)throw A;return y}else M&&p&&d(A)&&(i=!0,L({data:H,_c:R}));if(i&&!M)if(W(i)){const q=i(y,H);L({data:q,error:R,_c:R})}else L({data:y,error:R,_c:R});if(ie[N][1]=Ve(),Promise.resolve(Q()).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)},ls=(e,n)=>{if(!F.has(e)){const r=z(ss,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(!F.has(e)&&(F.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,f,c]),!oe)){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(),F.delete(e)}}};return d(),[e,o,d,a]}return[e,F.get(e)[4]]},ds=(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)},us=Oe,[Rt,fs]=ls(new Map),hs=z({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:ds,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:us,isPaused:()=>!1,cache:Rt,mutate:fs,fallback:{}},rs),_s=(e,n)=>{const r=z(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=z(o,i))}return r},ms=h.createContext({}),ps="$inf$",St=le&&window.__SWR_DEVTOOLS_USE__,xs=St?window.__SWR_DEVTOOLS_USE__:[],vs=()=>{St&&(window.__SWR_DEVTOOLS_REACT__=h)},gs=e=>W(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],js=()=>{const e=h.useContext(ms);return h.useMemo(()=>z(hs,e),[e])},ws=e=>(n,r,s)=>e(n,r&&((...a)=>{const[i]=Fe(n),[,,,c]=F.get(Rt);if(i.startsWith(ps))return r(...a);const f=c[i];return u(f)?r(...a):(delete c[i],f)}),s),ys=xs.concat(ws),bs=e=>function(...r){const s=js(),[o,a,i]=gs(r),c=_s(s,i);let f=e;const{use:d}=c,v=(d||[]).concat(ys);for(let m=v.length;m--;)f=v[m](f);return f(o,a||c.fetcher||null,c)},Ts=(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())}};vs();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),Ns=(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,ie]=F.get(s),[l,de]=Fe(e),Q=h.useRef(!1),y=h.useRef(!1),A=h.useRef(l),M=h.useRef(n),J=h.useRef(r),p=()=>J.current,Y=()=>p().isVisible()&&p().isOnline(),[V,Z,H,q]=Tt(s,l),ee=h.useRef({}).current,ue=u(i)?u(r.fallback)?R:r.fallback[l]:i,ze=(_,x)=>{for(const j in ee){const g=j;if(g==="data"){if(!o(_[g],x[g])&&(!u(_[g])||!o(he,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=z(I);return delete B._k,_?{isValidating:!0,isLoading:!0,...B}:B},j=V(),g=q(),$=x(j),re=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)},()=>re]},[s,l]),te=S.shimExports.useSyncExternalStore(h.useCallback(_=>H(l,(x,j)=>{ze(j,x)||_()}),[s,l]),He[0],He[1]),Ge=!Q.current,kt=E[l]&&E[l].length>0,ne=te.data,G=u(ne)?ue&&bt(ue)?ke(ue):ue:ne,fe=te.error,xe=h.useRef(G),he=w?u(ne)?u(xe.current)?G:xe.current:ne:G,X=l&&u(G),Et=!oe&&S.shimExports.useSyncExternalStore(()=>U,()=>!1,()=>!0);N&&Et&&!a&&X&&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(fe)?!1:Ge&&!u(c)?c:p().isPaused()?!1:a?u(G)?!1:f:u(G)||f,Ke=!!(l&&n&&Ge&&Xe),Ct=u(te.isValidating)?Ke:te.isValidating,Ot=u(te.isLoading)?Ke:te.isLoading,ae=h.useCallback(async _=>{const x=M.current;if(!l||!x||y.current||p().isPaused())return!1;let j,g,$=!0;const re=_||{},b=!D[l]||!re.dedupe,I=()=>at?!y.current&&l===A.current&&Q.current:l===A.current,B={isValidating:!1,isLoading:!1},Je=()=>{Z(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&&(Z(Ze),r.loadingTimeout&&u(V().data)&&setTimeout(()=>{$&&I()&&p().onLoadingSlow(l,r)},r.loadingTimeout),D[l]=[x(de),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 P=V().data;B.data=o(P,j)?P:j,b&&I()&&p().onSuccess(j,l,r)}catch(O){Ye();const P=p(),{shouldRetryOnError:ve}=P;P.isPaused()||(B.error=O,b&&I()&&(P.onError(O,l,P),(ve===!0||W(ve)&&ve(O))&&(!p().revalidateOnFocus||!p().revalidateOnReconnect||Y())&&P.onErrorRetry(O,l,P,Lt=>{const ge=E[l];ge&&ge[0]&&ge[0](ot,Lt)},{retryCount:(re.retryCount||0)+1,dedupe:!0})))}return $=!1,Je(),!0},[l,s]),Qe=h.useCallback((..._)=>Nt(s,A.current,..._),[]);if(Re(()=>{M.current=n,J.current=r,u(ne)||(xe.current=ne)}),Re(()=>{if(!l)return;const _=ae.bind(R,Ee);let x=0;p().revalidateOnFocus&&(x=Date.now()+p().focusThrottleInterval);const g=Ts(l,E,($,re={})=>{if($==jt){const b=Date.now();p().revalidateOnFocus&&b>x&&Y()&&(x=b+p().focusThrottleInterval,_())}else if($==wt)p().revalidateOnReconnect&&Y()&&_();else{if($==yt)return ae();if($==ot)return ae(re)}});return y.current=!1,A.current=l,Q.current=!0,Z({_k:de}),Xe&&(D[l]||(u(G)||oe?_():os(_))),()=>{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())?ae(Ee).then(x):x()}return x(),()=>{_&&(clearTimeout(_),_=-1)}},[d,v,m,l]),h.useDebugValue(he),a){if(!at&&oe&&X)throw new Error("Fallback data is required when using Suspense in SSR.");X&&(M.current=n,J.current=r,y.current=!1);const _=ie[l],x=!u(_)&&X?Qe(_):dt;if(ke(x),!u(fe)&&X)throw fe;const j=X?ae(Ee):dt;!u(he)&&X&&(j.status="fulfilled",j.value=!0),ke(j)}return{mutate:Qe,get data(){return ee.data=!0,he},get error(){return ee.error=!0,fe},get isValidating(){return ee.isValidating=!0,Ct},get isLoading(){return ee.isLoading=!0,Ot}}},ut=bs(Ns);class Rs extends Error{constructor({message:n,status:r,data:s}){super(n),this.name="TwitterApiError",this.status=r,this.data=s}}const Ss=ut.default||ut,Is="https://react-tweet.vercel.app";async function ks([e,n]){const r=await fetch(e,n),s=await r.json();if(r.ok)return s.data||null;throw new Rs({message:`Failed to fetch tweet at "${e}" with "${r.status}".`,data:s,status:r.status})}const Es=(e,n,r)=>{const{isLoading:s,data:o,error:a}=Ss(()=>n||e?[n||e&&`${Is}/api/tweet/${e}`,r]:null,ks,{revalidateIfStale:!1,revalidateOnFocus:!1,shouldRetryOnError:!1});return{isLoading:!!(s||o===void 0&&!a),data:o,error:a}},Cs=({id:e,apiUrl:n,fallback:r=t.jsx(Qr,{}),components:s,fetchOptions:o,onError:a})=>{const{data:i,error:c,isLoading:f}=Es(e,n,o);if(f)return r;if(c||!i){const d=(s==null?void 0:s.TweetNotFound)||zr;return t.jsx(d,{error:a?a(c):c})}return t.jsx(Pr,{tweet:i,components:s})};function Os({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(Cs,{id:r})})}):null}function It(e){const{t:n}=$t.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(Dt.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(At.Input,{className:"richtext-w-80",onChange:a=>s(a.target.value),placeholder:"Text",required:!0,type:"text",value:r})})}),t.jsx(Mt.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:n("editor.link.dialog.button.apply")})]})}function Ls(){const[e,n]=h.useState(!1),r=je.useEditorInstance(),s=je.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}=je.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(qt.ActionButton,{disabled:d,isActive:f,tooltip:a,tooltipOptions:i,children:t.jsx(Vt.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 qs=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,$s=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function ft(e){return e.match($s)}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(Os,{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:qs,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes({"data-twitter":""},e)]}});exports.FormEditLinkTwitter=It;exports.RichTextTwitter=Ls;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-DjZcVa3l.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"});const E=require("./clsx-CXbNJWDD.cjs"),k=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./clsx-CXbNJWDD.cjs"),k=require("./index-Doks9cbR.cjs"),p=require("./useButtonProps-DBJkNDS2.cjs"),o=require("react/jsx-runtime"),d=require("react"),I=require("./toggle-BQHMh_Q-.cjs");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const b=require("./dialog-Bt5zwGYB.cjs"),M=require("./events.constant-Dq21NPdV.cjs"),u=require("./tabs-DRSwUeKP.cjs"),D=require("./button-BS3n6_Aq.cjs"),R=require("./input-Dt_BA_9B.cjs");function $(e,t){let s;try{s=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const l=n.replace(/\./g,String.raw`\.`).replace(/\*/g,".*");return new RegExp(`^${l}$`).test(s.hostname)}return s.hostname.includes(n)})}function H(){const{t:e}=k.useLocale(),t=p.useEditorInstance(),s=p.useButtonProps(T.name),{icon:n,tooltip:l}=(s==null?void 0:s.componentProps)??{},{editorDisabled:c}=p.useToggleActive(),[f,x]=d.useState(""),w=d.useRef(null),[y,m]=d.useState(""),[V,h]=d.useState(!1),v=p.useExtension(T.name),q=r=>{h(r.detail)};d.useEffect(()=>{const r=M.listenEvent(M.EVENTS.UPLOAD_VIDEO(t.id),q);return()=>{r()}},[t]);const i=d.useMemo(()=>(v==null?void 0:v.options)??{},[v]);async function C(r){var L;const a=(L=r==null?void 0:r.target)==null?void 0:L.files;if(!t||t.isDestroyed||a.length===0)return;const g=a[0];let j="";i.upload?j=await i.upload(g):j=URL.createObjectURL(g),t.chain().focus().setVideo({src:j,width:"100%"}).run(),h(!1)}function S(r){r.preventDefault(),r.stopPropagation(),f&&(t.chain().focus().setVideo({src:f,width:"100%"}).run(),h(!1),x(""))}function A(r){var a;r.preventDefault(),(a=w.current)==null||a.click()}return o.jsxs(b.Dialog,{onOpenChange:h,open:V,children:[o.jsx(b.DialogTrigger,{asChild:!0,children:o.jsx(I.ActionButton,{disabled:c,icon:n,tooltip:l,action:()=>{c||h(!0)}})}),o.jsxs(b.DialogContent,{children:[o.jsx(b.DialogTitle,{children:e("editor.video.dialog.title")}),o.jsxs(u.Tabs,{activationMode:"manual",defaultValue:(i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload"?"upload":"link",children:[o.jsxs(u.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload")&&o.jsx(u.TabsTrigger,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="link")&&o.jsx(u.TabsTrigger,{value:"link",children:e("editor.video.dialog.link")})]}),o.jsxs(u.TabsContent,{value:"upload",children:[o.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:o.jsx(D.Button,{className:"richtext-mt-1 richtext-w-full",onClick:A,size:"sm",children:e("editor.video.dialog.tab.upload")})}),o.jsx("input",{accept:"video/*",multiple:!0,onChange:C,ref:w,type:"file",style:{display:"none"}})]}),o.jsxs(u.TabsContent,{value:"link",children:[o.jsx("div",{children:o.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[o.jsx(R.Input,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:f,onBlur:r=>{const a=r.target.value,g=i.videoProviders||["."];a&&!$(a,g)?m("Invalid video URL"):m("")},onChange:r=>{x(r.target.value)}}),o.jsx(D.Button,{onClick:S,type:"button",children:e("editor.video.dialog.button.apply")})]})}),y&&o.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:y})]})]})]})]})}function B(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const s=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(s){const l=s[1],c=s[2];c?e=`https://player.vimeo.com/video/${l}?h=${c}`:e=`https://player.vimeo.com/video/${l}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const T=E.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:k.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var s,n;return{componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(s=e.can()).setVideo)!=null&&n.call(s,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?B(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:p.getCssUnitWithDefault(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:s="center"}=e??{},n={...e,width:"100%",height:"100%"},l=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,c=`flex: 1;padding-bottom: ${9/16*100}%;`,m=["div",{style:`display: flex; justify-content: ${s};`},["div",{style:l},["div",{style:c}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},m]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});exports.RichTextVideo=H;exports.Video=T;
|