reactjs-tiptap-editor 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/lib/index.d.cts +707 -0
- package/lib/index.d.ts +707 -4
- package/lib/reactjs-tiptap-editor.cjs +1 -0
- package/lib/reactjs-tiptap-editor.js +5456 -1
- package/lib/{vendor-DlmsfAkr.js → vendor-B-W_3NKN.cjs} +162 -162
- package/lib/{vendor-B_w0TZys.mjs → vendor-D8S0CsNZ.js} +2712 -2754
- package/package.json +66 -60
- package/lib/components/ActionButton.d.ts +0 -20
- package/lib/components/ActionMenuButton.d.ts +0 -14
- package/lib/components/ColorPicker.d.ts +0 -12
- package/lib/components/RcTiptapEditor.d.ts +0 -26
- package/lib/components/Toolbar.d.ts +0 -2
- package/lib/components/icons/AspectRatio.d.ts +0 -3
- package/lib/components/icons/Blockquote.d.ts +0 -1
- package/lib/components/icons/DeleteColumn.d.ts +0 -4
- package/lib/components/icons/DeleteRow.d.ts +0 -4
- package/lib/components/icons/FileWordOutline.d.ts +0 -3
- package/lib/components/icons/Icon.d.ts +0 -7
- package/lib/components/icons/LineHeight.d.ts +0 -3
- package/lib/components/icons/MenuDown.d.ts +0 -3
- package/lib/components/icons/SizeL.d.ts +0 -3
- package/lib/components/icons/SizeM.d.ts +0 -3
- package/lib/components/icons/SizeS.d.ts +0 -3
- package/lib/components/icons/icons.d.ts +0 -2
- package/lib/components/menus/bubble.d.ts +0 -56
- package/lib/components/menus/components/BubbleMenuLink.d.ts +0 -2
- package/lib/components/menus/components/BubbleMenuMedia.d.ts +0 -9
- package/lib/components/menus/components/BubbleMenuText.d.ts +0 -8
- package/lib/components/menus/components/ContentMenu.d.ts +0 -2
- package/lib/components/menus/components/TableBubbleMenu.d.ts +0 -2
- package/lib/components/ui/button.d.ts +0 -11
- package/lib/components/ui/dropdown-menu.d.ts +0 -27
- package/lib/components/ui/input.d.ts +0 -5
- package/lib/components/ui/label.d.ts +0 -5
- package/lib/components/ui/popover.d.ts +0 -6
- package/lib/components/ui/separator.d.ts +0 -4
- package/lib/components/ui/switch.d.ts +0 -4
- package/lib/components/ui/tabs.d.ts +0 -7
- package/lib/components/ui/toast.d.ts +0 -15
- package/lib/components/ui/toaster.d.ts +0 -1
- package/lib/components/ui/toggle.d.ts +0 -12
- package/lib/components/ui/tooltip.d.ts +0 -7
- package/lib/components/ui/use-toast.d.ts +0 -44
- package/lib/constants/index.d.ts +0 -44
- package/lib/extensions/BaseKit.d.ts +0 -111
- package/lib/extensions/Blockquote/Blockquote.d.ts +0 -6
- package/lib/extensions/Blockquote/index.d.ts +0 -1
- package/lib/extensions/Bold/Bold.d.ts +0 -6
- package/lib/extensions/Bold/index.d.ts +0 -1
- package/lib/extensions/BulletList/BulletList.d.ts +0 -6
- package/lib/extensions/BulletList/index.d.ts +0 -1
- package/lib/extensions/Clear/Clear.d.ts +0 -6
- package/lib/extensions/Clear/index.d.ts +0 -1
- package/lib/extensions/Code/Code.d.ts +0 -6
- package/lib/extensions/Code/index.d.ts +0 -1
- package/lib/extensions/CodeBlock/CodeBlock.d.ts +0 -6
- package/lib/extensions/CodeBlock/index.d.ts +0 -1
- package/lib/extensions/Color/Color.d.ts +0 -6
- package/lib/extensions/Color/components/ColorActionButton.d.ts +0 -13
- package/lib/extensions/Color/index.d.ts +0 -1
- package/lib/extensions/Document/Document.d.ts +0 -2
- package/lib/extensions/Document/index.d.ts +0 -1
- package/lib/extensions/FontFamily/FontFamily.d.ts +0 -3
- package/lib/extensions/FontFamily/components/FontFamilyButton.d.ts +0 -26
- package/lib/extensions/FontFamily/index.d.ts +0 -1
- package/lib/extensions/FontSize/FontSize.d.ts +0 -32
- package/lib/extensions/FontSize/components/FontSizeMenuButton.d.ts +0 -23
- package/lib/extensions/FontSize/index.d.ts +0 -1
- package/lib/extensions/FormatPainter/FormatPainter.d.ts +0 -24
- package/lib/extensions/FormatPainter/index.d.ts +0 -1
- package/lib/extensions/Heading/Heading.d.ts +0 -6
- package/lib/extensions/Heading/components/HeadingButton.d.ts +0 -26
- package/lib/extensions/Heading/index.d.ts +0 -1
- package/lib/extensions/Highlight/Highlight.d.ts +0 -6
- package/lib/extensions/Highlight/components/HighlightActionButton.d.ts +0 -14
- package/lib/extensions/Highlight/index.d.ts +0 -1
- package/lib/extensions/History/History.d.ts +0 -6
- package/lib/extensions/History/components/HistoryActionButton.d.ts +0 -20
- package/lib/extensions/History/index.d.ts +0 -1
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +0 -6
- package/lib/extensions/HorizontalRule/index.d.ts +0 -1
- package/lib/extensions/Iframe/Iframe.d.ts +0 -23
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +0 -2
- package/lib/extensions/Iframe/embed.d.ts +0 -23
- package/lib/extensions/Iframe/index.d.ts +0 -1
- package/lib/extensions/Image/Image.d.ts +0 -25
- package/lib/extensions/Image/components/ImageView.d.ts +0 -2
- package/lib/extensions/Image/index.d.ts +0 -1
- package/lib/extensions/ImageUpload/ImageUpload.d.ts +0 -16
- package/lib/extensions/ImageUpload/components/ImageUploader.d.ts +0 -2
- package/lib/extensions/ImageUpload/index.d.ts +0 -1
- package/lib/extensions/Indent/Indent.d.ts +0 -23
- package/lib/extensions/Indent/index.d.ts +0 -1
- package/lib/extensions/Italic/Italic.d.ts +0 -6
- package/lib/extensions/Italic/index.d.ts +0 -1
- package/lib/extensions/LineHeight/LineHeight.d.ts +0 -17
- package/lib/extensions/LineHeight/components/LineHeightDropdown.d.ts +0 -12
- package/lib/extensions/LineHeight/index.d.ts +0 -1
- package/lib/extensions/Link/Link.d.ts +0 -6
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +0 -6
- package/lib/extensions/Link/components/LinkEditPopover.d.ts +0 -14
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +0 -8
- package/lib/extensions/Link/index.d.ts +0 -1
- package/lib/extensions/ListItem/ListItem.d.ts +0 -1
- package/lib/extensions/ListItem/index.d.ts +0 -1
- package/lib/extensions/MoreMark/MoreMark.d.ts +0 -20
- package/lib/extensions/MoreMark/components/ActionMoreButton.d.ts +0 -25
- package/lib/extensions/MoreMark/index.d.ts +0 -1
- package/lib/extensions/MultiColumn/Column.d.ts +0 -4
- package/lib/extensions/MultiColumn/ColumnToolbar.d.ts +0 -3
- package/lib/extensions/MultiColumn/Columns.d.ts +0 -22
- package/lib/extensions/MultiColumn/index.d.ts +0 -3
- package/lib/extensions/MultiColumn/menus/ColumnsMenu.d.ts +0 -6
- package/lib/extensions/MultiColumn/menus/index.d.ts +0 -1
- package/lib/extensions/OrderedList/OrderedList.d.ts +0 -6
- package/lib/extensions/OrderedList/index.d.ts +0 -1
- package/lib/extensions/Selection/Selection.d.ts +0 -4
- package/lib/extensions/Selection/index.d.ts +0 -1
- package/lib/extensions/SlashCommand/SlashCommand.d.ts +0 -4
- package/lib/extensions/SlashCommand/components/CommandsList.d.ts +0 -4
- package/lib/extensions/SlashCommand/groups.d.ts +0 -3
- package/lib/extensions/SlashCommand/index.d.ts +0 -1
- package/lib/extensions/SlashCommand/types.d.ts +0 -25
- package/lib/extensions/Strike/Strike.d.ts +0 -6
- package/lib/extensions/Strike/index.d.ts +0 -1
- package/lib/extensions/Subscript/Subscript.d.ts +0 -23
- package/lib/extensions/Subscript/index.d.ts +0 -1
- package/lib/extensions/Table/cell-background.d.ts +0 -19
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +0 -14
- package/lib/extensions/Table/components/TableActionButton.d.ts +0 -13
- package/lib/extensions/Table/index.d.ts +0 -5
- package/lib/extensions/Table/table.d.ts +0 -24
- package/lib/extensions/TaskList/TaskList.d.ts +0 -12
- package/lib/extensions/TaskList/index.d.ts +0 -1
- package/lib/extensions/TextAlign/TextAlign.d.ts +0 -18
- package/lib/extensions/TextAlign/components/TextAlignMenuButton.d.ts +0 -27
- package/lib/extensions/TextAlign/index.d.ts +0 -1
- package/lib/extensions/TextBubble/TextBubble.d.ts +0 -7
- package/lib/extensions/TextBubble/components/TextDropdown.d.ts +0 -10
- package/lib/extensions/TextBubble/index.d.ts +0 -1
- package/lib/extensions/TrailingNode/TrailingNode.d.ts +0 -12
- package/lib/extensions/TrailingNode/index.d.ts +0 -1
- package/lib/extensions/UnderLine/Underline.d.ts +0 -6
- package/lib/extensions/UnderLine/index.d.ts +0 -1
- package/lib/extensions/Video/Video.d.ts +0 -55
- package/lib/extensions/Video/index.d.ts +0 -1
- package/lib/extensions/VideoUpload/VideoUpload.d.ts +0 -14
- package/lib/extensions/VideoUpload/components/VideoUploaderView.d.ts +0 -2
- package/lib/extensions/VideoUpload/index.d.ts +0 -1
- package/lib/extensions/index.d.ts +0 -64
- package/lib/lib/utils.d.ts +0 -3
- package/lib/locales/en.d.ts +0 -2
- package/lib/locales/index.d.ts +0 -35
- package/lib/locales/vi.d.ts +0 -2
- package/lib/locales/zh-cn.d.ts +0 -127
- package/lib/plugins/image-upload.d.ts +0 -12
- package/lib/reactjs-tiptap-editor.mjs +0 -5441
- package/lib/theme/theme.d.ts +0 -4
- package/lib/types.d.ts +0 -80
- package/lib/utils/getRenderContainer.d.ts +0 -4
- package/lib/utils/indent.d.ts +0 -15
- package/lib/utils/is-mobile.d.ts +0 -19
- package/lib/utils/line-height.d.ts +0 -7
- package/lib/utils/mitt.d.ts +0 -24
- package/lib/utils/plateform.d.ts +0 -11
- package/lib/utils/utils.d.ts +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ut=Object.defineProperty;var mt=(e,t,n)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var He=(e,t,n)=>mt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./vendor-B-W_3NKN.cjs"),i=require("react/jsx-runtime"),f=require("react"),Fe=require("react-dom");function ht(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=ht(f);function ft(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function gt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function bt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function xt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function vt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function wt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Ve(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...e,children:i.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function pt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}const yt=e=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4 iconify iconify--hugeicons",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})}),jt=e=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4 iconify iconify--hugeicons",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})}),re={Bold:l.Bold,LoaderCircle:l.LoaderCircle,Italic:l.Italic,Underline:l.Underline,Quote:l.Quote,TextQuote:pt,Strikethrough:l.Strikethrough,Minus:l.Minus,Eraser:l.Eraser,PaintRoller:l.PaintRoller,Redo2:l.Redo2,Undo2:l.Undo2,AlignCenter:l.TextAlignCenterIcon,AlignJustify:l.TextAlignJustifyIcon,AlignLeft:l.TextAlignLeftIcon,AlignRight:l.TextAlignRightIcon,ChevronDown:l.ChevronDown,Subscript:l.Subscript,Superscript:l.Superscript,Code:l.Code,Code2:l.CodeXml,Type:l.Type,IndentIncrease:l.IndentIncrease,IndentDecrease:l.IndentDecrease,List:l.List,ListOrdered:l.ListOrdered,ListTodo:l.ListTodo,Link:l.Link,ImageUp:l.ImageUp,Video:l.Video,Maximize:l.Maximize,Minimize:l.Minimize,Table:l.Table,Sparkles:l.Sparkles,Pencil:l.Pencil,Unlink:l.Unlink,BetweenHorizonalEnd:l.BetweenHorizontalEnd,BetweenHorizonalStart:l.BetweenHorizontalStart,BetweenVerticalStart:l.BetweenVerticalStart,BetweenVerticalEnd:l.BetweenVerticalEnd,TableCellsMerge:l.TableCellsMerge,TableCellsSplit:l.TableCellsSplit,Trash2:l.Trash2,Trash:l.Trash,Replace:l.Replace,ChevronsUpDown:l.ChevronsUpDown,LineHeight:vt,Word:wt,Heading1:l.Heading1,Heading2:l.Heading2,Heading3:l.Heading3,Columns2:l.Columns2,Columns3:l.Columns3,Columns4:l.Columns4,Plus:l.Plus,Grip:l.GripVertical,Copy:l.Copy,Clipboard:l.Clipboard,PanelLeft:l.PanelLeft,PanelRight:l.PanelRight,Columns:l.Columns2,Iframe:l.Frame,MenuDown:Ve,SizeS:ft,SizeM:gt,SizeL:bt,AspectRatio:xt,Emoji:l.SmilePlus,DeleteColumn:yt,DeleteRow:jt};function S(...e){return l.twMerge(l.clsx(e))}const kt=l.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),ve=M.forwardRef(({className:e,variant:t,size:n,...o},a)=>i.jsx(l.Root,{ref:a,className:S(kt({variant:t,size:n,className:e})),...o}));ve.displayName=l.Root.displayName;const Ct=l.Provider,de=l.Root3,ce=l.Trigger,oe=M.forwardRef(({className:e,sideOffset:t=4,...n},o)=>i.jsx(l.Content2,{ref:o,sideOffset:t,className:S("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));oe.displayName=l.Content2.displayName;let je;function ke(){return je===void 0&&(je=navigator.platform.includes("Mac")),je}function Me(e){return`${e}`.toLowerCase()==="mod"?ke()?"⌘":"Ctrl":`${e}`.toLowerCase()==="alt"?ke()?"⌥":"Alt":`${e}`.toLowerCase()==="shift"?ke()?"⇧":"Shift":e}function we(e){return e.map(Me).join(" ")}const v=f.forwardRef((e,t)=>{const{icon:n=void 0,tooltip:o=void 0,disabled:a=!1,customClass:s="",shortcutKeys:r=void 0,tooltipOptions:d={},action:c=void 0,isActive:u=void 0,children:h,asChild:m=!1,upload:g=!1,...x}=e,w=re[n],L=m?l.Slot:ve;return i.jsxs(de,{children:[i.jsx(ce,{asChild:!0,children:i.jsxs(L,{ref:t,size:"sm",className:"w-[32px] h-[32px] "+s,disabled:a,onClick:c,"data-state":u!=null&&u()?"on":"off",...x,children:[w&&i.jsx(w,{className:"w-4 h-4"}),h]})}),o&&i.jsx(oe,{...d,children:i.jsxs("div",{className:"flex flex-col items-center text-center max-w-24",children:[i.jsx("div",{children:o}),!!(r!=null&&r.length)&&i.jsx("span",{children:we(r)})]})})]})});v.displayName="ActionButton";const Ke=l.Bold$1.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleBold(),isActive:()=>t.isActive("bold")||!1,disabled:!t.can().toggleBold(),icon:"Bold",shortcutKeys:["mod","B"],tooltip:n("editor.bold.tooltip")}})}}}),qe=l.Italic$1.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n}){return{component:v,componentProps:{action:()=>t.commands.toggleItalic(),isActive:()=>t.isActive("italic")||!1,disabled:!t.can().toggleItalic(),shortcutKeys:["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}}),We=l.Underline$1.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n}){return{component:v,componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!t.can().toggleUnderline(),icon:"Underline",shortcutKeys:["mod","U"],tooltip:n("editor.underline.tooltip")}}}}}}),Ge=l.Strike.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleStrike(),isActive:()=>t.isActive("strike")||!1,disabled:!t.can().toggleStrike(),icon:"Strikethrough",shortcutKeys:["shift","mod","X"],tooltip:n("editor.strike.tooltip")}})}}}),Xe=l.Code$1.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code")||!1,disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:["mod","E"],tooltip:n("editor.code.tooltip")}})}}}),Nt=l.CodeBlockLowlight.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),defaultLanguage:null,button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleCodeBlock(),isActive:()=>t.isActive("codeBlock")||!1,disabled:!t.can().toggleCodeBlock(),icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}}}),Lt=l.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),I=M.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...a},s)=>{const r=o?l.Slot:"button";return i.jsx(r,{className:S(Lt({variant:t,size:n,className:e})),ref:s,...a})});I.displayName="Button";const pe=f.forwardRef(({asChild:e,...t},n)=>{var s;const o=re[t.icon],a=e?l.Slot:I;return i.jsxs(de,{children:[i.jsx(ce,{asChild:!0,children:i.jsx(a,{ref:n,className:"h-[32px] px-[5px] py-0 min-w-24 max-w-32 overflow-hidden",variant:"ghost",disabled:t==null?void 0:t.disabled,...t,children:i.jsxs("div",{className:"flex items-center h-full font-normal",children:[(t==null?void 0:t.title)&&i.jsx("div",{className:"flex-grow text-sm text-left truncate",children:t==null?void 0:t.title}),o&&i.jsx(o,{className:"flex-shrink-0 w-3 h-3 ml-1 text-zinc-500"})]})})}),i.jsx(oe,{children:i.jsxs("div",{className:"flex flex-col items-center text-center max-w-24",children:[(t==null?void 0:t.tooltip)&&i.jsx("div",{children:t==null?void 0:t.tooltip}),i.jsx("div",{className:"flex",children:!!((s=t==null?void 0:t.shortcutKeys)!=null&&s.length)&&i.jsx("span",{children:we(t==null?void 0:t.shortcutKeys)})})]})})]})});pe.displayName="ActionMenuButton";const Z=l.Root2,Y=l.Trigger$1,De=l.Portal2,ze=l.Sub2,Ce=M.forwardRef(({className:e,inset:t,children:n,...o},a)=>i.jsxs(l.SubTrigger2,{ref:a,className:S("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[n,i.jsx(l.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Ce.displayName=l.SubTrigger2.displayName;const Ne=M.forwardRef(({className:e,...t},n)=>i.jsx(l.SubContent2,{ref:n,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ne.displayName=l.SubContent2.displayName;const V=M.forwardRef(({className:e,sideOffset:t=4,...n},o)=>i.jsx(l.Portal2,{children:i.jsx(l.Content2$1,{ref:o,sideOffset:t,className:S("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));V.displayName=l.Content2$1.displayName;const _=M.forwardRef(({className:e,inset:t,...n},o)=>i.jsx(l.Item2,{ref:o,className:S("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));_.displayName=l.Item2.displayName;const J=M.forwardRef(({className:e,children:t,checked:n,...o},a)=>i.jsxs(l.CheckboxItem2,{ref:a,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...o,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(l.ItemIndicator2,{children:i.jsx(l.Check,{className:"h-4 w-4"})})}),t]}));J.displayName=l.CheckboxItem2.displayName;const Tt=M.forwardRef(({className:e,children:t,...n},o)=>i.jsxs(l.RadioItem2,{ref:o,className:S("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(l.ItemIndicator2,{children:i.jsx(l.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));Tt.displayName=l.RadioItem2.displayName;const St=M.forwardRef(({className:e,inset:t,...n},o)=>i.jsx(l.Label2,{ref:o,className:S("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));St.displayName=l.Label2.displayName;const ye=M.forwardRef(({className:e,...t},n)=>i.jsx(l.Separator2,{ref:n,className:S("-mx-1 my-1 h-px bg-muted",e),...t}));ye.displayName=l.Separator2.displayName;const Ze=({className:e,...t})=>i.jsx("span",{className:S("ml-auto text-xs tracking-widest opacity-60",e),...t});Ze.displayName="DropdownMenuShortcut";const At="en",Mt=200,Rt=Mt-80,Ht=20,Be=1e5,Ie=16,ue=10,me=10,he=2,Ft="#262626",Dt=["#000000","#262626","#595959","#8C8C8C","#BFBFBF","#D9D9D9","#E9E9E9","#F5F5F5","#FAFAFA","#FFFFFF","#F5222D","#FA541C","#FA8C16","#FADB14","#52C41A","#13C2C2","#1890FF","#2F54EB","#722ED1","#EB2F96","#FFE8E6","#FFECE0","#FFEFD1","#FCFCCA","#E4F7D2","#D3F5F0","#D4EEFC","#DEE8FC","#EFE1FA","#FAE1EB","#FFA39E","#FFBB96","#FFD591","#FFFB8F","#B7EB8F","#87E8DE","#91D5FF","#ADC6FF","#D3ADF7","#FFADD2","#FF4D4F","#FF7A45","#FFA940","#FFEC3D","#73D13D","#36CFC9","#40A9FF","#597EF7","#9254DE","#F759AB","#CF1322","#D4380D","#D46B08","#D4B106","#389E0D","#08979C","#096DD9","#1D39C4","#531DAB","#C41D7F","#820014","#871400","#873800","#614700","#135200","#00474F","#003A8C","#061178","#22075E","#780650"],zt=["10px","11px","12px","14px","16px","18px","20px","22px","24px","26px","28px","36px","48px","72px"],te="default";var Le=(e=>(e[e["size-small"]=200]="size-small",e[e["size-medium"]=500]="size-medium",e["size-large"]="100%",e))(Le||{}),be=(e=>(e[e["size-small"]=480]="size-small",e[e["size-medium"]=640]="size-medium",e["size-large"]="100%",e))(be||{});const Ye="1";function Bt(e){return e=e||new Map,{all:e,on(t,n){const o=e.get(t);o?o.push(n):e.set(t,[n])},off(t,n){const o=e.get(t);o&&(n?o.splice(o.indexOf(n)>>>0,1):e.set(t,[]))},emit(t,n){let o=e.get(t);o&&[...o].map(a=>{a(n)}),o=e.get("*"),o&&[...o].map(a=>{a(t,n)})}}}const It={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"No Fill","editor.format":"Format Painter","editor.draghandle.tooltip":"Modify","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Import Word","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.fontFamily.tooltip":"Font Family","editor.fontFamily.default.tooltip":"Default","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"More Colors","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.orderedlist.tooltip":"Ordered List","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.uploading":"Uploading","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.add_column_before":"Add Column Before","editor.table.menu.add_column_after":"Add Column After","editor.table.menu.delete_column":"Delete Column","editor.table.menu.add_row_before":"Add Row Before","editor.table.menu.add_row_after":"Add Row After","editor.table.menu.delete_row":"Delete Row","editor.table.menu.merge_or_split_cells":"Merge Or Split Cells","editor.table.menu.delete_table":"Delete Table","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.emoji.tooltip":"Emoji","editor.iframe.tooltip":"Iframe"},Pt={"editor.remove":"Xóa","editor.copy":"Sao chép","editor.words":"TỪ","editor.characters":"KÝ TỰ","editor.default":"Mặc định","editor.recent":"Đã sử dụng gần đây","editor.nofill":"Không tô","editor.format":"Format Painter","editor.draghandle.tooltip":"Sửa đổi","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Nhập Word","editor.slash":"Nhấn '/' để biết lệnh","editor.slash.empty":"Không có kết quả","editor.slash.format":"Định dạng","editor.slash.insert":"Chèn","editor.slash.embed":"Dịch vụ nhúng","editor.content":"Vui lòng nhập nội dung","editor.moremark":"Nhiều kiểu văn bản hơn","editor.size.small.tooltip":"Nhỏ","editor.fontFamily.tooltip":"Phông chữ","editor.fontFamily.default.tooltip":"Mặc định","editor.size.medium.tooltip":"Trung bình","editor.size.large.tooltip":"Lớn","editor.bold.tooltip":"Đậm","editor.italic.tooltip":"In nghiêng","editor.underline.tooltip":"Gạch chân","editor.strike.tooltip":"Gạch","editor.color.tooltip":"Màu","editor.color.more":"Nhiều màu hơn","editor.highlight.tooltip":"Đánh dấu","editor.lineheight.tooltip":"Chiều cao dòng","editor.heading.tooltip":"Tiêu đề","editor.heading.h1.tooltip":"Tiêu đề 1","editor.heading.h2.tooltip":"Tiêu đề 2","editor.heading.h3.tooltip":"Tiêu đề 3","editor.heading.h4.tooltip":"Tiêu đề 4","editor.heading.h5.tooltip":"Tiêu đề 5","editor.heading.h6.tooltip":"Tiêu đề 6","editor.paragraph.tooltip":"Đoạn văn","editor.textalign.tooltip":"Căn chỉnh","editor.textalign.left.tooltip":"Trái","editor.textalign.center.tooltip":"Giữa","editor.textalign.right.tooltip":"Phải","editor.textalign.justify.tooltip":"Căn đều","editor.indent":"Thụt lề","editor.indent.indent":"Tăng thụt lề","editor.indent.outdent":"Giảm thụt lề","editor.fontSize.tooltip":"Kích thước phông chữ","editor.fontSize.default.tooltip":"Mặc định","editor.superscript.tooltip":"Chỉ số trên","editor.subscript.tooltip":"Chỉ số dưới","editor.bulletlist.tooltip":"Danh sách dấu đầu dòng","editor.orderedlist.tooltip":"Danh sách có thứ tự","editor.tasklist.tooltip":"Danh sách tác vụ","editor.indent.tooltip":"Tăng thụt lề","editor.outdent.tooltip":"Giảm thụt lề","editor.columns.tooltip":"Cột","editor.link.tooltip":"Liên kết","editor.link.unlink.tooltip":"Hủy liên kết","editor.link.open.tooltip":"Mở liên kết","editor.link.edit.tooltip":"Chỉnh sửa liên kết","editor.link.dialog.title":"Chèn liên kết","editor.link.dialog.link":"Liên kết","editor.link.dialog.text":"Văn bản","editor.link.dialog.openInNewTab":"Mở trong tab mới","editor.link.dialog.link.placeholder":"Địa chỉ liên kết","editor.link.dialog.text.placeholder":"Thêm mô tả","editor.link.dialog.button.apply":"Áp dụng","editor.image.tooltip":"Hình ảnh","editor.image.dragger.tooltip":"Nhấp hoặc kéo hình ảnh đến khu vực để tải lên","editor.image.float.left.tooltip":"Trôi sang trái","editor.image.float.none.tooltip":"Trôi không","editor.image.float.right.tooltip":"Trôi sang phải","editor.image.dialog.title":"Thêm hình ảnh","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Tải lên","editor.image.dialog.uploading":"Đang tải lên","editor.image.dialog.form.link":"Liên kết","editor.image.dialog.placeholder":"Liên kết","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Khóa tỷ lệ khung hình gốc","editor.image.dialog.form.file":"Tệp","editor.image.dialog.button.apply":"áp dụng","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Tải lên","editor.video.dialog.uploading":"Đang tải lên","editor.video.dialog.title":"Nhúng hoặc tải lên video","editor.video.dialog.link":"liên kết","editor.video.dialog.placeholder":"Liên kết","editor.video.dialog.button.apply":"áp dụng","editor.table.tooltip":"Bảng","editor.table.menu.insert_table":"Chèn Bảng","editor.table.menu.insert_table.with_header_row":"Có hàng tiêu đề","editor.table.menu.add_column_before":"Thêm Cột Trước","editor.table.menu.add_column_after":"Thêm Cột Sau","editor.table.menu.delete_column":"Xóa Cột","editor.table.menu.add_row_before":"Thêm Hàng Trước","editor.table.menu.add_row_after":"Thêm Hàng Sau","editor.table.menu.delete_row":"Xóa Hàng","editor.table.menu.merge_or_split_cells":"Gộp Hoặc Tách Ô","editor.table.menu.delete_table":"Xóa Bảng","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Quy tắc ngang","editor.code.tooltip":"Mã","editor.codeblock.tooltip":"Khối mã","editor.clear.tooltip":"Xóa định dạng","editor.undo.tooltip":"Hoàn tác","editor.redo.tooltip":"Làm lại","editor.fullscreen.tooltip.fullscreen":"Toàn màn hình","editor.fullscreen.tooltip.exit":"Thoát toàn màn hình","editor.imageUpload.fileTypeNotSupported":"Loại tệp không được hỗ trợ","editor.imageUpload.fileSizeTooBig":"Kích thước tệp quá lớn, Kích thước tối đa là","editor.table.menu.insertColumnBefore":"Chèn cột trước","editor.table.menu.insertColumnAfter":"Chèn cột sau","editor.table.menu.deleteColumn":"Xóa cột","editor.table.menu.insertRowAbove":"Chèn hàng ở trên","editor.table.menu.insertRowBelow":"Chèn hàng ở dưới","editor.table.menu.deleteRow":"Xóa hàng","editor.table.menu.mergeCells":"Gộp các ô","editor.table.menu.splitCells":"Chia ô","editor.table.menu.deleteTable":"Xóa bảng","editor.table.menu.setCellsBgColor":"Màu nền ô","editor.emoji.tooltip":"Biểu tượng","editor.iframe.tooltip":"Iframe"},Et={"editor.remove":"移除","editor.copy":"复制","editor.words":"字数","editor.characters":"字符数","editor.default":"默认","editor.recent":"最近使用","editor.nofill":"无填充","editor.format":"格式刷","editor.draghandle.tooltip":"修改","editor.copyToClipboard":"复制到剪贴板","editor.importWord.tooltip":"导入 Word","editor.slash":"按 '/' 使用命令","editor.slash.empty":"无结果","editor.slash.format":"格式","editor.slash.insert":"插入","editor.slash.embed":"嵌入服务","editor.content":"请输入内容","editor.fontFamily.tooltip":"字体","editor.fontFamily.default.tooltip":"默认","editor.moremark":"更多文本样式","editor.size.small.tooltip":"小","editor.size.medium.tooltip":"中","editor.size.large.tooltip":"封面","editor.bold.tooltip":"粗体","editor.italic.tooltip":"斜体","editor.underline.tooltip":"下划线","editor.strike.tooltip":"删除线","editor.color.tooltip":"颜色","editor.color.more":"更多颜色","editor.highlight.tooltip":"高亮","editor.lineheight.tooltip":"行高","editor.heading.tooltip":"标题","editor.heading.h1.tooltip":"标题 1","editor.heading.h2.tooltip":"标题 2","editor.heading.h3.tooltip":"标题 3","editor.heading.h4.tooltip":"标题 4","editor.heading.h5.tooltip":"标题 5","editor.heading.h6.tooltip":"标题 6","editor.paragraph.tooltip":"段落","editor.textalign.tooltip":"对齐","editor.textalign.left.tooltip":"左对齐","editor.textalign.center.tooltip":"居中","editor.textalign.right.tooltip":"右对齐","editor.textalign.justify.tooltip":"两端对齐","editor.indent":"缩进","editor.indent.indent":"增加缩进","editor.indent.outdent":"减少缩进","editor.fontSize.tooltip":"字号","editor.fontSize.default.tooltip":"默认","editor.superscript.tooltip":"上标","editor.subscript.tooltip":"下标","editor.bulletlist.tooltip":"无序列表","editor.orderedlist.tooltip":"有序列表","editor.tasklist.tooltip":"任务列表","editor.indent.tooltip":"缩进","editor.outdent.tooltip":"减少缩进","editor.columns.tooltip":"列","editor.link.tooltip":"链接","editor.link.unlink.tooltip":"取消链接","editor.link.open.tooltip":"打开链接","editor.link.edit.tooltip":"编辑链接","editor.link.dialog.title":"插入链接","editor.link.dialog.link":"链接","editor.link.dialog.text":"文本","editor.link.dialog.openInNewTab":"在新标签页中打开","editor.link.dialog.link.placeholder":"链接地址","editor.link.dialog.text.placeholder":"添加描述","editor.link.dialog.button.apply":"应用","editor.image.tooltip":"图片","editor.image.dragger.tooltip":"点击或拖拽图片到此区域上传","editor.image.float.left.tooltip":"左浮动","editor.image.float.none.tooltip":"无浮动","editor.image.float.right.tooltip":"右浮动","editor.image.dialog.title":"添加图片","editor.image.dialog.tab.url":"链接","editor.image.dialog.tab.upload":"上传","editor.image.dialog.uploading":"上传中","editor.image.dialog.form.link":"链接","editor.image.dialog.placeholder":"链接","editor.image.dialog.form.alt":"替代文本","editor.image.dialog.form.aspectRatio":"锁定原始宽高比","editor.image.dialog.form.file":"文件","editor.image.dialog.button.apply":"应用","editor.video.tooltip":"视频","editor.video.dialog.tab.upload":"上传","editor.video.dialog.uploading":"上传中","editor.video.dialog.title":"嵌入或上传视频","editor.video.dialog.link":"链接","editor.video.dialog.placeholder":"链接","editor.video.dialog.button.apply":"应用","editor.table.tooltip":"表格","editor.table.menu.insert_table":"插入表格","editor.table.menu.insert_table.with_header_row":"带标题行","editor.table.menu.add_column_before":"在前面插入列","editor.table.menu.add_column_after":"在后面插入列","editor.table.menu.delete_column":"删除列","editor.table.menu.add_row_before":"在上方插入行","editor.table.menu.add_row_after":"在下方插入行","editor.table.menu.delete_row":"删除行","editor.table.menu.merge_or_split_cells":"合并或拆分单元格","editor.table.menu.delete_table":"删除表格","editor.blockquote.tooltip":"引用","editor.horizontalrule.tooltip":"水平线","editor.code.tooltip":"代码","editor.codeblock.tooltip":"代码块","editor.clear.tooltip":"清除格式","editor.undo.tooltip":"撤销","editor.redo.tooltip":"重做","editor.fullscreen.tooltip.fullscreen":"全屏","editor.fullscreen.tooltip.exit":"退出全屏","editor.imageUpload.fileTypeNotSupported":"不支持的文件类型","editor.imageUpload.fileSizeTooBig":"文件大小超出限制,最大大小为","editor.table.menu.insertColumnBefore":"在前面插入列","editor.table.menu.insertColumnAfter":"在后面插入列","editor.table.menu.deleteColumn":"删除列","editor.table.menu.insertRowAbove":"在上方插入行","editor.table.menu.insertRowBelow":"在下方插入行","editor.table.menu.deleteRow":"删除行","editor.table.menu.mergeCells":"合并单元格","editor.table.menu.splitCells":"拆分单元格","editor.table.menu.deleteTable":"删除表格","editor.table.menu.setCellsBgColor":"设置单元格背景色","editor.emoji.tooltip":"表情","editor.iframe.tooltip":"内嵌框架"},ie={lang:At,message:{en:It,vi:Pt,zh_CN:Et}};class Ot{constructor(){He(this,"emitter");this.emitter=Bt()}get lang(){return ie.lang}set lang(t){if(!this.isLangSupported(t)){console.warn(`Can't find the current language "${t}", Using language "${ie.lang}" by default`);return}ie.lang=t,this.emitter.emit("lang",t)}get message(){return ie.message}set message(t){ie.message=t}loadLangMessage(t){return this.message[t]}isLangSupported(t){return Object.keys(this.message).includes(t)}setLang(t){this.lang=t}registerWatchLang(t){return this.emitter.on("lang",t),{unsubscribe:()=>{this.emitter.off("lang",t)}}}setMessage(t,n){this.message[t]=n}buildLocalesHandler(t){t||(t=this.lang);const n=this.loadLangMessage(t);return function(a){return n[a]||a}}}const xe=new Ot,Te=l.proxy({lang:ie.lang}),R=()=>{const e=l.useSnapshot(Te),t=f.useMemo(()=>xe.buildLocalesHandler(e.lang),[e.lang]);return f.useEffect(()=>{const n=xe.registerWatchLang(o=>{Te.lang=o});return()=>{n.unsubscribe()}},[]),{lang:e.lang,t}},T={t:e=>xe.buildLocalesHandler(Te.lang)(e)},_t=xe,$t=e=>{var a,s,r;const{t,lang:n}=R(),o=f.useMemo(()=>{var u;const d=(u=e==null?void 0:e.items)==null?void 0:u.find(h=>h.isActive());return d&&!d.default?{...d}:{title:e.tooltip,font:t("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>e.editor.chain().focus().unsetFontFamily().run()}},[t,n,e]);return i.jsxs(Z,{children:[i.jsx(Y,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(pe,{title:((a=o==null?void 0:o.font)==null?void 0:a.length)>7?`${(s=o==null?void 0:o.font)==null?void 0:s.slice(0,6)}...`:o==null?void 0:o.font,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),i.jsx(V,{className:"w-full",children:(r=e==null?void 0:e.items)==null?void 0:r.map((d,c)=>{const u=d.font===t("editor.fontFamily.default.tooltip")?{}:{fontFamily:d.font};return i.jsxs(f.Fragment,{children:[i.jsx(J,{checked:(o==null?void 0:o.font)===d.font,onClick:d.action,children:i.jsx("div",{className:"ml-1 h-full",style:u,children:d.font})}),d.font===t("editor.fontFamily.default.tooltip")&&i.jsx(ye,{})]},c)})})]})},Ut=l.FontFamily.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),fonts:["Inter","Comic Sans MS, Comic Sans","serif","monospace","cursive"],button({editor:t,extension:n,t:o}){var u;const{extensions:a=[]}=t.extensionManager??[],s=((u=n.options)==null?void 0:u.fonts)||[],r=a.find(h=>h.name==="base-kit"),d=s.map(h=>({action:()=>{t.chain().focus().setFontFamily(h).run()},isActive:()=>t.isActive("textStyle",{fontFamily:h})||!1,disabled:!t.can().setFontFamily(h),title:h,font:h}));r&&r.options.textStyle!==!1&&d.unshift({action:()=>t.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:o("editor.fontFamily.default.tooltip"),title:o("editor.fontFamily.tooltip")});const c=d.filter(h=>h.disabled).length===d.length;return{component:$t,componentProps:{tooltip:o("editor.fontFamily.tooltip"),disabled:c,items:d,editor:t}}}}}}),Vt=e=>{var n;const t=f.useMemo(()=>{var s;const o=(s=e==null?void 0:e.items)==null?void 0:s.find(r=>r.isActive());return o&&!o.default?{...o}:{title:e.tooltip,level:0,isActive:()=>!1}},[e]);return i.jsxs(Z,{children:[i.jsx(Y,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(pe,{title:t==null?void 0:t.title,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),i.jsx(V,{className:"w-full",children:(n=e==null?void 0:e.items)==null?void 0:n.map((o,a)=>{var s,r;return i.jsxs(f.Fragment,{children:[i.jsxs(J,{checked:(t==null?void 0:t.title)===o.title,onClick:o.action,children:[i.jsx("div",{className:`ml-1 h-full heading-${o.level}`,children:o.title}),!!((s=o==null?void 0:o.shortcutKeys)!=null&&s.length)&&i.jsx(Ze,{className:"pl-4",children:(r=o==null?void 0:o.shortcutKeys)==null?void 0:r.map(d=>Me(d)).join(" ")})]}),o.level===0&&i.jsx(ye,{})]},a)})})]})},Kt=l.Heading.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:[1,2,3,4,5,6],button({editor:t,extension:n,t:o}){var u;const{extensions:a=[]}=t.extensionManager??[],s=((u=n.options)==null?void 0:u.levels)||[],r=a.find(h=>h.name==="base-kit"),d=s.map(h=>({action:()=>t.commands.toggleHeading({level:h}),isActive:()=>t.isActive("heading",{level:h})||!1,disabled:!t.can().toggleHeading({level:h}),title:o(`editor.heading.h${h}.tooltip`),level:h,shortcutKeys:["alt","mod",`${h}`]}));r&&r.options.paragraph!==!1&&d.unshift({action:()=>t.commands.setParagraph(),isActive:()=>t.isActive("paragraph")||!1,disabled:!t.can().setParagraph(),level:0,title:o("editor.paragraph.tooltip"),shortcutKeys:["alt","mod","0"]});const c=d.filter(h=>h.disabled).length===d.length;return{component:Vt,componentProps:{tooltip:o("editor.heading.tooltip"),disabled:c,items:d,editor:t}}}}}}),C=e=>{const t=re[e.name];return i.jsx(i.Fragment,{children:t&&i.jsx(t,{onClick:e==null?void 0:e.onClick,className:`w-4 h-4 ${(e==null?void 0:e.className)||""}`})})},Q=l.Root2$1,ee=l.Trigger$2,K=M.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},a)=>i.jsx(l.Portal,{children:i.jsx(l.Content2$2,{ref:a,align:t,sideOffset:n,className:S("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));K.displayName=l.Content2$2.displayName;const qt=e=>{var n;const t=f.useMemo(()=>{var s;const o=(s=e==null?void 0:e.items)==null?void 0:s.find(r=>r.isActive());return o&&!o.default?{...o,icon:o.icon?o.icon:e.icon}:{title:e==null?void 0:e.tooltip,icon:e.icon,isActive:()=>!1}},[e]);return i.jsxs(Q,{children:[i.jsx(ee,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(v,{customClass:"w-12",icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:i.jsx(C,{className:"w-3 h-3 ml-1 text-zinc-500",name:"MenuDown"})})}),i.jsx(K,{className:"min-w-4 w-full !p-[4px] flex flex-row gap-1",align:"start",side:"bottom",children:(n=e==null?void 0:e.items)==null?void 0:n.map((o,a)=>{var s,r;return i.jsxs(de,{children:[i.jsx(ce,{asChild:!0,children:i.jsx(ve,{size:"sm",onClick:o==null?void 0:o.action,className:"p-1 w-7 h-7",pressed:t.title===o.title,"data-state":t.title===o.title?"on":"off",children:(o==null?void 0:o.icon)&&i.jsx(C,{name:o.icon})})}),i.jsxs(oe,{className:"flex flex-col items-center",children:[i.jsx("span",{children:o.title}),!!((s=o.shortcutKeys)!=null&&s.length)&&i.jsx("span",{children:(r=o.shortcutKeys)==null?void 0:r.map(d=>Me(d)).join(" ")})]})]},`text-align-${a}`)})})]})},Wt=l.TextAlign.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:o}){var u;const a=((u=n.options)==null?void 0:u.alignments)||[],s={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},r={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},d=a.map(h=>({title:o(`editor.textalign.${h}.tooltip`),icon:r[h],shortcutKeys:s[h],isActive:()=>t.isActive({textAlign:h})||!1,action:()=>t.commands.setTextAlign(h),disabled:!t.can().setTextAlign(h)})),c=d.filter(h=>h.disabled).length===d.length;return{component:qt,componentProps:{icon:"AlignJustify",tooltip:o("editor.textalign.tooltip"),disabled:c,items:d}}}}}}),Gt=e=>{var o;const{t}=R(),n=f.useMemo(()=>{const a=(e.items||[]).find(r=>r.isActive());return a||{title:t("editor.fontSize.default.tooltip"),isActive:()=>!1}},[e]);return i.jsxs(Z,{children:[i.jsx(Y,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(pe,{title:n==null?void 0:n.title,tooltip:`${e==null?void 0:e.tooltip}`,disabled:e==null?void 0:e.disabled,icon:"MenuDown"})}),i.jsx(V,{className:"w-32 overflow-y-auto max-h-96",children:(o=e==null?void 0:e.items)==null?void 0:o.map((a,s)=>i.jsx(J,{checked:n.title===a.title,onClick:a.action,children:i.jsx("div",{className:"h-full ml-1",children:a.title})},s))})]})},Xt=l.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:[...zt],button({editor:t,extension:n,t:o}){var d;const a=((d=n.options)==null?void 0:d.fontSizes)||[],s=[te,...a].map(c=>({title:c===te?o("editor.fontSize.default.tooltip"):String(c),isActive:()=>{const{fontSize:u}=t.getAttributes("textStyle");return c===te&&u===void 0?!0:t.isActive({fontSize:String(c)})||!1},action:()=>{if(c===te){t.commands.unsetFontSize();return}t.commands.setFontSize(String(c))},disabled:!t.can().setFontSize(String(c)),divider:c===te||!1,default:c===te||!1})),r=s.filter(c=>c.disabled).length===s.length;return{component:Gt,componentProps:{editor:t,tooltip:o("editor.fontSize.tooltip"),disabled:r,items:s,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),X=M.forwardRef(({className:e,type:t,...n},o)=>i.jsx("input",{type:t,className:S("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...n}));X.displayName="Input";const $=M.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...o},a)=>i.jsx(l.Root$1,{ref:a,decorative:n,orientation:t,className:S("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));$.displayName=l.Root$1.displayName;const Pe=Dt,Je=[];for(let e=0;e<Pe.length;e+=10)Je.push(Pe.slice(e,e+10));const Zt=({setColor:e})=>{const[t,n]=f.useState("#000000"),[o,a]=f.useState(!1),{t:s}=R();return f.useEffect(()=>()=>{a(!1)},[]),i.jsxs(Q,{open:o,children:[i.jsx(ee,{asChild:!0,children:i.jsxs("div",{onClick:r=>{r.preventDefault(),a(!0)},className:"text-sm hover:cursor-pointer hover:bg-accent py-1.5 px-1.5",children:[s("editor.color.more"),"..."]})}),i.jsxs(K,{children:[i.jsxs("div",{className:"flex flex-col items-center justify-center",children:[i.jsx(l.Z,{color:t,onChange:n}),i.jsx(X,{className:"mt-[8px] w-full",type:"text",onChange:r=>{r.preventDefault(),n(`#${r.target.value}`)},value:t.slice(1)})]}),i.jsx($,{className:"my-[10px]"}),i.jsx(I,{onClick:r=>{r.preventDefault(),e(t),a(!1)},className:"w-full",children:i.jsx(l.Plus,{size:16})})]})]})},Qe=e=>{const{t}=R(),{highlight:n=!1,disabled:o=!1,selectedColor:a,setSelectedColor:s,onChange:r}=e,[d,c]=f.useState([]),u=m=>{const g=[...d],x=g.indexOf(m);x!==-1&&g.splice(x,1),g.unshift(m),g.length>10&&g.pop(),c(g)};function h(m){if(m===void 0){s==null||s(m),r==null||r(m);return}/^#([\da-f]{3}){1,2}$/i.test(m)&&(s==null||s(m),r==null||r(m),u(m))}return i.jsxs(Q,{children:[i.jsx(ee,{disabled:o,asChild:!0,children:e==null?void 0:e.children}),i.jsx(K,{hideWhenDetached:!0,className:"w-full h-full p-2",align:"start",side:"bottom",children:i.jsxs("div",{className:"flex flex-col",children:[n?i.jsxs("div",{className:"flex items-center p-1 cursor-pointer rd-1 hover:bg-accent",onClick:()=>h(void 0),children:[i.jsx("span",{className:"w-6 h-6 p-0.5 inline-block rounded-sm border cursor-pointer hover:border-border hover:shadow-sm relative after:border-b-2 after:border-b-red-500 after:top-[10px] after:h-0 after:left-0 after:w-6 after:absolute after:block after:rotate-[45deg]",children:i.jsx("span",{style:{backgroundColor:"transparent"},children:i.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgba(0, 0, 0, 0.4)",display:"none"},children:i.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})}),i.jsx("span",{className:"ml-1 text-sm",children:t("editor.nofill")})]}):i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center p-1 cursor-pointer rd-1 hover:bg-accent",onClick:()=>{h(void 0)},children:[i.jsx("span",{className:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent cursor-pointer",children:i.jsx("span",{style:{backgroundColor:Ft},className:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent",children:i.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:i.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})}),i.jsx("span",{className:"ml-1 text-sm",children:t("editor.default")})]})}),Je.map((m,g)=>i.jsx("span",{className:"relative flex w-full h-auto p-0 last:pb-2",children:m.map((x,w)=>i.jsx("span",{className:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent flex-[0 0 auto] cursor-pointer hover:border-border hover:shadow-sm",onClick:()=>h(x),children:i.jsx("span",{style:{backgroundColor:x},className:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent",children:x===a?i.jsx("svg",{className:"absolute top-[-1px] left-[1px] w-3 h-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"block"},children:i.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):i.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:i.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${w}`))},g)),i.jsxs("div",{children:[i.jsx("div",{className:"my-1 text-sm",children:t("editor.recent")}),i.jsx("span",{className:"relative flex w-full h-auto p-0 last:pb-2",children:d==null?void 0:d.map((m,g)=>i.jsx("span",{className:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent flex-[0 0 auto] cursor-pointer hover:border-border hover:shadow-sm",onClick:()=>h(m),children:i.jsx("span",{className:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent",style:{backgroundColor:m},children:i.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:i.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},g))})]}),i.jsx(Zt,{setColor:h})]})})]})},Yt=({fill:e})=>i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:i.jsx("g",{transform:"translate(0.000000, 0.500000)",children:i.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[i.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),i.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),i.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})}),Jt=e=>{const[t,n]=f.useState(void 0);function o(r){var d;(d=e.action)==null||d.call(e,r)}function a(){var r;(r=e.action)==null||r.call(e,t)}const s=f.useCallback(l.debounce(r=>{n(r)},350),[]);return i.jsxs("div",{className:"flex items-center h-[32px]",children:[i.jsx(v,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:a,children:i.jsx("span",{className:"text-sm flex justify-center items-center",children:i.jsx(Yt,{fill:t})})}),i.jsx(Qe,{selectedColor:t,setSelectedColor:s,onChange:o,disabled:e==null?void 0:e.disabled,children:i.jsx(I,{variant:"ghost",size:"icon",className:"h-[32px] w-3",disabled:e==null?void 0:e.disabled,children:i.jsx(C,{className:"w-3 h-3 text-zinc-500",name:"MenuDown"})})})]})},et=l.Color.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n}){return{component:Jt,componentProps:{action:o=>{o===void 0&&t.chain().focus().unsetColor().run(),typeof o=="string"&&t.chain().focus().setColor(o).run()},isActive:()=>{const{color:o}=t.getAttributes("textStyle");return o&&t.isActive({color:o})||!1},editor:t,disabled:!t.can().setColor(""),tooltip:n("editor.color.tooltip")}}}}}}),Qt=({fill:e})=>i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("g",{id:"icon/填充色",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:i.jsxs("g",{id:"icon/背景颜色",children:[i.jsx("g",{id:"编组",fill:"currentColor",children:i.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",id:"矩形",children:[i.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),i.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),i.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),i.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",id:"矩形",fill:e||"#FBDE28"})]})})}),tt=e=>{const[t,n]=f.useState(void 0);function o(r){var d;(d=e.action)==null||d.call(e,r)}function a(){var r;(r=e.action)==null||r.call(e,t)}const s=f.useCallback(l.debounce(r=>{n(r)},350),[]);return i.jsxs("div",{className:"flex items-center h-[32px]",children:[i.jsx(v,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:a,tooltipOptions:e==null?void 0:e.tooltipOptions,shortcutKeys:e==null?void 0:e.shortcutKeys,children:i.jsx("span",{className:"text-sm flex items-center justify-center",children:i.jsx(Qt,{fill:t})})}),i.jsx(Qe,{selectedColor:t,setSelectedColor:s,onChange:o,highlight:!0,disabled:e==null?void 0:e.disabled,children:i.jsx(I,{variant:"ghost",size:"icon",className:"w-3 h-[32px]",disabled:e==null?void 0:e.disabled,children:i.jsx(C,{className:"w-3 h-3 text-zinc-500",name:"MenuDown"})})})]})},it=l.Highlight.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),multicolor:!0,button:({editor:t,t:n})=>({component:tt,componentProps:{action:o=>{typeof o=="string"&&t.chain().focus().setHighlight({color:o}).run(),o===void 0&&t.chain().focus().unsetHighlight().run()},editor:t,isActive:()=>t.isActive("highlight")||!1,disabled:!t.can().setHighlight(),shortcutKeys:["⇧","mod","H"],tooltip:n("editor.highlight.tooltip")}})}}}),ei=l.BulletList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleBulletList(),isActive:()=>t.isActive("bulletList")||!1,disabled:!1,shortcutKeys:["shift","mod","8"],icon:"List",tooltip:n("editor.bulletlist.tooltip")}})}}}),ti=l.Node.create({name:"clear",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!t.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:n("editor.clear.tooltip")}})}}}),ii=l.OrderedList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleOrderedList(),isActive:()=>t.isActive("orderedList")||!1,disabled:!1,icon:"ListOrdered",shortcutKeys:["mod","shift","7"],tooltip:n("editor.orderedlist.tooltip")}})}}}),ni=l.TaskList.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleTaskList(),isActive:()=>t.isActive("taskList")||!1,disabled:!1,icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:n("editor.tasklist.tooltip")}})}},addExtensions(){return[l.TaskItem.configure(this.options.taskItem)]}}),oi=l.Blockquote.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.toggleBlockquote(),isActive:()=>t.isActive("blockquote")||!1,disabled:!t.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:n("editor.blockquote.tooltip")}})}}}),ai=l.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ge=M.forwardRef(({className:e,...t},n)=>i.jsx(l.Root$2,{ref:n,className:S(ai(),e),...t}));ge.displayName=l.Root$2.displayName;const nt=M.forwardRef(({className:e,...t},n)=>i.jsx(l.Root$3,{className:S("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:i.jsx(l.Thumb,{className:S("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));nt.displayName=l.Root$3.displayName;const ot=e=>{const{t}=R(),[n,o]=f.useState({text:"",link:""}),[a,s]=f.useState(!1);f.useEffect(()=>{var d;if(e!=null&&e.editor){const{href:c,target:u}=(d=e.editor)==null?void 0:d.getAttributes("link"),{from:h,to:m}=e.editor.state.selection,g=e.editor.state.doc.textBetween(h,m," ");o({link:c,text:g}),s(u==="_blank")}},[e==null?void 0:e.editor]);function r(d){d.preventDefault(),e==null||e.onSetLink(n.link,n.text,a)}return i.jsx("div",{className:"p-2 bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800",children:i.jsxs("form",{className:"flex flex-col gap-2",onSubmit:r,children:[i.jsxs(ge,{children:[" ",t("editor.link.dialog.text")," "]}),i.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:i.jsx("div",{className:"relative w-full max-w-sm items-center",children:i.jsx(X,{type:"text",value:n.text,required:!0,className:"w-80",placeholder:"Text",onChange:d=>o({...n,text:d.target.value})})})}),i.jsx(ge,{children:t("editor.link.dialog.link")}),i.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:i.jsxs("div",{className:"relative w-full max-w-sm items-center",children:[i.jsx(X,{type:"url",value:n.link,required:!0,className:"pl-10",onChange:d=>o({...n,link:d.target.value})}),i.jsx("span",{className:"absolute start-0 inset-y-0 flex items-center justify-center px-2",children:i.jsx(C,{className:"size-5 text-muted-foreground",name:"Link"})})]})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ge,{children:t("editor.link.dialog.openInNewTab")}),i.jsx(nt,{checked:a,onCheckedChange:d=>{s(d)}})]}),i.jsx(I,{type:"submit",className:"mt-2 self-end",children:t("editor.link.dialog.button.apply")})]})})},li=e=>{function t(n,o,a){e.action&&e.action({link:n,text:o,openInNewTab:a})}return i.jsxs(Q,{children:[i.jsx(ee,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(v,{tooltip:e==null?void 0:e.tooltip,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:i.jsx(C,{name:e==null?void 0:e.icon})})}),i.jsx(K,{hideWhenDetached:!0,className:"w-full",align:"start",side:"bottom",children:i.jsx(ot,{editor:e.editor,onSetLink:t})})]})},at=l.Link$1.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",l.mergeAttributes(this.options.HTMLAttributes,e,{class:"link"}),0]},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),openOnClick:!0,button:({editor:t,t:n})=>({component:li,componentProps:{editor:t,action:o=>{const{link:a,text:s,openInNewTab:r}=o;t.chain().extendMarkRange("link").insertContent({type:"text",text:s,marks:[{type:"link",attrs:{href:a,target:r?"_blank":""}}]}).setLink({href:a}).focus().run()},id:"linkk",isActive:()=>t.isActive("link")||!1,disabled:!t.can().setLink({href:""}),icon:"Link",tooltip:n("editor.link.tooltip")}})}},addProseMirrorPlugins(){return[new l.Plugin({props:{handleClick:(e,t)=>{const{schema:n,doc:o,tr:a}=e.state,s=l.getMarkRange(o.resolve(t),n.marks.link);if(!s)return!1;const r=o.resolve(s.from),d=o.resolve(s.to),c=a.setSelection(new l.TextSelection(r,d));e.dispatch(c)}}})]}}),si=l.HorizontalRule.extend({renderHTML(){return["div",l.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.setHorizontalRule(),disabled:!t.can().setHorizontalRule(),icon:"Minus",shortcutKeys:["mod","alt","S"],tooltip:n("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}}}),ri=e=>{var w;const{icon:t=void 0,title:n=void 0,tooltip:o=void 0,disabled:a=!1,customClass:s="",color:r=void 0,loading:d=!1,shortcutKeys:c=void 0,tooltipOptions:u={},action:h=void 0,isActive:m=void 0,children:g}=e,x=re[t];return i.jsxs(de,{children:[i.jsx(ce,{asChild:!0,children:i.jsxs(ve,{size:"sm",className:"w-[32px] h-[32px] "+s,disabled:m==null?void 0:m(),onClick:h,children:[x&&i.jsx(x,{className:"w-4 h-4"}),g&&i.jsx(i.Fragment,{children:g})]})}),o&&i.jsx(oe,{...u,children:i.jsxs("div",{className:"flex flex-col items-center text-center max-w-24",children:[i.jsx("div",{children:o}),!!((w=e==null?void 0:e.shortcutKeys)!=null&&w.length)&&i.jsx("span",{children:we(e==null?void 0:e.shortcutKeys)})]})})]})},di=["undo","redo"],ci=l.History.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),depth:100,newGroupDelay:500,button:({editor:t,t:n})=>di.map(o=>({component:ri,componentProps:{action:()=>{o==="undo"&&t.chain().focus().undo().run(),o==="redo"&&t.chain().focus().redo().run()},shortcutKeys:o==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:o==="undo"?!t.can().undo():!t.can().redo(),isActive:()=>o==="undo"?!t.can().undo():!t.can().redo(),icon:o==="undo"?"Undo2":"Redo2",tooltip:n(`editor.${o}.tooltip`)}}))}}}),ui=l.Document.extend({content:"(block|columns)+"}),mi=l.Node.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:e=>e.dataset.position,renderHTML:e=>({"data-position":e.position})}}},renderHTML({HTMLAttributes:e}){return["div",l.mergeAttributes(e,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var W=(e=>(e.SidebarLeft="sidebar-left",e.SidebarRight="sidebar-right",e.TwoColumn="two-column",e))(W||{});const lt=l.Node.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:e})=>(e.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:e=>({commands:t})=>t.updateAttributes("columns",{layout:e})}},renderHTML({HTMLAttributes:e}){return["div",{"data-type":"columns",class:`layout-${e.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[mi.configure(this.options.columnOptions)]}}),hi=l.Extension.create({name:"columnToolbar",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>{t.chain().setColumns().focus(t.state.selection.head-1).run()},icon:"Columns",tooltip:n("editor.columns.tooltip")}})}}}),fi=l.Extension.create({name:"selection",addProseMirrorPlugins(){const{editor:e}=this;return[new l.Plugin({key:new l.PluginKey("selection"),props:{decorations(t){return t.selection.empty||e.isFocused===!0?null:l.DecorationSet.create(t.doc,[l.Decoration.inline(t.selection.from,t.selection.to,{class:"selection"})])}}})]}}),gi=e=>{const{t}=R(),n=f.useMemo(()=>[{name:"paragraph",label:t("editor.paragraph.tooltip"),iconName:"Heading1",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:t("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:t("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:t("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:t("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:t("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:t("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:t("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:t("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}],[e.editor,t]),o=f.useMemo(()=>n.filter(a=>a.isActive()).pop()??{label:"Empty"},[n]);return i.jsx(i.Fragment,{children:i.jsxs(Z,{children:[i.jsx(Y,{asChild:!0,children:i.jsxs(I,{variant:"ghost",className:"h-[32px] flex gap-1 px-1.5",children:[i.jsxs("span",{className:"text-sm font-normal whitespace-nowrap",children:[" ",o==null?void 0:o.label]}),i.jsx(l.ChevronDown,{className:"w-4 h-4"})]})}),i.jsx(V,{hideWhenDetached:!0,className:"w-full p-1",align:"start",sideOffset:5,children:n.map((a,s)=>{var d;const r=re[a.iconName];return i.jsx(J,{checked:((d=a.isActive)==null?void 0:d.call(a))||!1,onClick:()=>a.action(),className:"cursor-pointer",children:i.jsxs("div",{className:"flex items-center gap-2 px-2",children:[i.jsx(r,{className:"w-3 h3"}),i.jsxs("span",{children:[" ",a.label]})]})},s)})})]})})},bi=l.Extension.create({name:"text-bubble",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),toolbar:!1,button:()=>({component:gi,componentProps:{}})}}});function Ee({types:e,node:t}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}const xi=l.Extension.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const e=new l.PluginKey(this.name),t=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>this.options.notAfter.includes(n.name));return[new l.Plugin({key:e,appendTransaction:(n,o,a)=>{const{doc:s,tr:r,schema:d}=a,c=e.getState(a),u=s.content.size,h=d.nodes[this.options.node];if(c)return r.insert(u,h.create())},state:{init:(n,o)=>{const a=o.tr.doc.lastChild;return!Ee({node:a,types:t})},apply:(n,o)=>{if(!n.docChanged)return o;const a=n.doc.lastChild;return!Ee({node:a,types:t})}}})]}}),vi=l.Extension.create({name:"base-kit",addExtensions(){const e=[];return this.options.multiColumn?(e.push(ui.configure()),e.push(lt)):e.push(l.Document),this.options.placeholder!==!1&&e.push(l.Placeholder.configure({placeholder:({node:t,pos:n})=>{var o,a,s;return((o=t==null?void 0:t.type)==null?void 0:o.name)==="heading"?`${T.t(`editor.heading.h${t.attrs.level}.tooltip`)}`:((a=t==null?void 0:t.type)==null?void 0:a.name)==="codeBlock"||((s=t==null?void 0:t.type)==null?void 0:s.name)==="table"?"":n===0?T.t("editor.content"):T.t("editor.slash")},...this.options.placeholder})),this.options.focus!==!1&&e.push(l.FocusClasses.configure({className:"focus",...this.options.focus})),this.options.text!==!1&&e.push(l.Text.configure()),this.options.textBubble!==!1&&e.push(bi.configure()),this.options.gapcursor!==!1&&e.push(l.Gapcursor.configure()),this.options.dropcursor!==!1&&e.push(l.Dropcursor.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(l.CharacterCount.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(l.Paragraph.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(l.HardBreak.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(l.ListItem.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(l.TextStyle.configure(this.options.textStyle)),this.options.trailingNode!==!1&&e.push(xi.configure(this.options.trailingNode)),this.options.selection!==!1&&e.push(fi),e}}),wi=l.Extension.create({name:"subAndSuperScript",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,extension:n,t:o})=>{const a=n.options.subscript,s=n.options.superscript,r={component:v,componentProps:{action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",tooltip:o("editor.subscript.tooltip")}},d={component:v,componentProps:{action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",tooltip:o("editor.superscript.tooltip")}},c=[];return a!==!1&&c.push(r),s!==!1&&c.push(d),c}}},addExtensions(){const e=[];return this.options.subscript!==!1&&e.push(l.Subscript$1.configure(this.options.subscript)),this.options.superscript!==!1&&e.push(l.Superscript$1.configure(this.options.superscript)),e}}),pi=e=>{var n;const t=f.useMemo(()=>{var s;const o=(s=e==null?void 0:e.items)==null?void 0:s.find(r=>r.isActive());return o&&!o.default?{...o,icon:o!=null&&o.icon?o==null?void 0:o.icon:e==null?void 0:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}},[e]);return i.jsxs(Z,{children:[i.jsx(Y,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(v,{customClass:"w-12",icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:i.jsx(Ve,{className:"w-3 h-3 text-gray-500"})})}),i.jsx(V,{className:"w-full",children:(n=e==null?void 0:e.items)==null?void 0:n.map((o,a)=>i.jsxs(J,{checked:t.title===o.title,onClick:o.action,className:"flex items-center gap-3",children:[i.jsx(C,{name:o==null?void 0:o.icon}),i.jsx("span",{className:"ml-1",children:o.title}),!!(o!=null&&o.shortcutKeys)&&i.jsx("span",{className:"ml-auto text-xs tracking-widest opacity-60",children:we(o.shortcutKeys)})]},a))})]})},yi=l.Extension.create({name:"moreMark",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,extension:n,t:o}){const a=n.options.subscript,s=n.options.superscript,r={action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",title:o("editor.subscript.tooltip"),shortcutKeys:["mod","."]},d={action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",title:o("editor.superscript.tooltip"),shortcutKeys:["mod",","]},c=[];return a!==!1&&c.push(r),s!==!1&&c.push(d),{component:pi,componentProps:{icon:"Type",tooltip:o("editor.moremark"),disabled:!t.isEditable,items:c}}}}},addExtensions(){const e=[];return this.options.subscript!==!1&&e.push(l.Subscript$1.configure(this.options.subscript)),this.options.superscript!==!1&&e.push(l.Superscript$1.configure(this.options.superscript)),e}});var G=(e=>(e[e.max=7]="max",e[e.min=0]="min",e[e.more=1]="more",e[e.less=-1]="less",e))(G||{});function ji(e,t,n){return e<t?t:e>n?n:e}function ki(e,t,n,o){const{doc:a,selection:s}=e;if(!a||!s||!(s instanceof l.TextSelection||s instanceof l.AllSelection))return e;const{from:r,to:d}=s;return a.nodesBetween(r,d,(c,u)=>{const h=c.type;return n.includes(h.name)?(e=Se(e,u,t),!1):!l.isList(c.type.name,o.extensionManager.extensions)}),e}function Se(e,t,n){if(!e.doc)return e;const o=e.doc.nodeAt(t);if(!o)return e;const r=ji((o.attrs.indent||0)+n,0,7);if(r===o.attrs.indent)return e;const d={...o.attrs,indent:r};return e.setNodeMarkup(t,o.type,d,o.marks)}function Oe({delta:e,types:t}){return({state:n,dispatch:o,editor:a})=>{const{selection:s}=n;let{tr:r}=n;return r=r.setSelection(s),r=ki(r,e,t,a),r.docChanged?(o&&o(r),!0):!1}}const Ci=l.Extension.create({name:"indent",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["paragraph","heading","blockquote"],minIndent:G.min,maxIndent:G.max,button({editor:t,t:n}){return[{component:v,componentProps:{action:()=>{t.commands.indent()},shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:v,componentProps:{action:()=>{t.commands.outdent()},shortcutKeys:["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:e=>{const t=e.dataset.indent;return(t?Number.parseInt(t,10):0)||0},renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}}]},addCommands(){return{indent:()=>Oe({delta:G.more,types:this.options.types}),outdent:()=>Oe({delta:G.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function Ni(e){return Number.parseFloat(e.replace("%",""))/100}const Li=e=>{const{t}=R(),[n,o]=f.useState("default");function a(r){r==="default"?e.editor.commands.unsetLineHeight():e.editor.commands.setLineHeight(r),o(r)}const s=f.useMemo(()=>{const c=e.editor.extensionManager.extensions.find(u=>u.name==="lineHeight").options.lineHeights.map(u=>({label:Ni(u),value:u}));return c.unshift({label:t("editor.default"),value:"default"}),c},[e]);return i.jsxs(Z,{children:[i.jsx(Y,{disabled:e==null?void 0:e.disabled,asChild:!0,children:i.jsx(v,{customClass:"w-12",icon:"LineHeight",tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,children:i.jsx(C,{className:"w-3 h-3 ml-1 text-zinc-500",name:"MenuDown"})})}),i.jsx(V,{className:"min-w-24",children:s==null?void 0:s.map((r,d)=>i.jsx(J,{checked:r.value===n,onClick:()=>a(r.value),children:r.label},`lineHeight-${d}`))})]})},Ti=["paragraph","heading","list_item","todo_item"];function Si(e,t){const{selection:n,doc:o}=e;if(!n||!o||!(n instanceof l.TextSelection||n instanceof l.AllSelection))return e;const{from:a,to:s}=n,r=[],d=t&&t!==Ye?t:null;if(o.nodesBetween(a,s,(c,u)=>{const h=c.type;return Ti.includes(h.name)?((c.attrs.lineHeight||null)!==d&&r.push({node:c,pos:u,nodeType:h}),h.name!=="list_item"&&h.name!=="todo_item"):!0}),r.length===0)return e;for(const c of r){const{node:u,pos:h,nodeType:m}=c;let{attrs:g}=u;g={...g,lineHeight:d},e=e.setNodeMarkup(h,m,g,u.marks)}return e}function Ai(e){return({state:t,dispatch:n})=>{const{selection:o}=t;let{tr:a}=t;return a=a.setSelection(o),a=Si(a,e),a.docChanged?(n&&n(a),!0):!1}}const Mi=l.Extension.create({name:"lineHeight",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:Ye,button({editor:t,t:n}){return{component:Li,componentProps:{editor:t,tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight||this.options.defaultHeight,renderHTML:e=>e.lineHeight===this.options.defaultHeight||!e.lineHeight?{}:{style:`line-height: ${e.lineHeight}`}}}}]},addCommands(){return{setLineHeight:e=>Ai(e),unsetLineHeight:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"lineHeight"))}}}),Ri=(e,t)=>{var H,D;const[n,o]=f.useState(0),[a,s]=f.useState(0),r=f.useRef(null),{t:d}=R(),c=f.useRef([]);f.useImperativeHandle(t,()=>({onKeyDown:u})),f.useEffect(()=>{if(!r.current)return;const p=a*1e3+n,y=c.current[p];y&&y.scrollIntoView({behavior:"smooth",block:"nearest"})},[n,a]);function u({event:p}){return p.key==="ArrowUp"?(h(),!0):p.key==="ArrowDown"?(m(),!0):p.key==="Enter"?(g(),!0):!1}function h(){var k;if(e.items.length===0)return!1;let p=n-1,y=a;p<0&&(y=a-1,p=((k=e.items[y])==null?void 0:k.commands.length)-1||0),y<0&&(y=e.items.length-1,p=e.items[y].commands.length-1),o(p),s(y)}function m(){if(e.items.length===0)return!1;const p=e.items[a].commands;let y=n+1,k=a;p.length-1<y&&(y=0,k=a+1),e.items.length-1<k&&(k=0),o(y),s(k)}function g(){if(e.items.length===0||a===-1||n===-1)return!1;x(a,n)}function x(p,y){const k=e.items[p].commands[y];e.command(k)}function w(p,y){x(p,y)}function L(p,y,k){c.current[p*1e3+y]=k}return i.jsx("div",{className:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1",ref:r,children:(H=e==null?void 0:e.items)!=null&&H.length?i.jsx("div",{className:"grid grid-cols-1 gap-0.5 min-w-48",children:(D=e==null?void 0:e.items)==null?void 0:D.map((p,y)=>i.jsxs(f.Fragment,{children:[i.jsx("div",{className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5",children:p.title}),p.commands.map((k,B)=>i.jsxs("button",{className:`flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors ${a===y&&n===B?"bg-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"}`,ref:O=>L(y,B,O),onClick:()=>w(y,B),children:[k.iconUrl&&i.jsx("img",{className:"w-6 h-6",src:k.iconUrl,alt:""}),k.iconName&&i.jsx(C,{name:k.iconName,className:"mr-1 text-lg"}),k.label]},`command-${B}`))]},p.title))}):i.jsx("div",{className:"p-3",children:i.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-100",children:d("editor.slash.empty")})})})},Hi=f.forwardRef(Ri);function Fi(e){return[{name:"format",title:T.t("editor.slash.format"),commands:[{name:"heading1",label:T.t("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setHeading({level:1}).run()}},{name:"heading2",label:T.t("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setNode("heading",{level:2}).run()}},{name:"heading3",label:T.t("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3"],iconName:"Heading3",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setNode("heading",{level:3}).run()}},{name:"bulletList",label:T.t("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleBulletList().run()}},{name:"numberedList",label:T.t("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleOrderedList().run()}},{name:"taskList",label:T.t("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleTaskList().run()}},{name:"blockquote",label:T.t("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setBlockquote().run()}},{name:"codeBlock",label:T.t("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:n=>n.isActive("columns"),action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setCodeBlock().run()}}]},{name:"insert",title:T.t("editor.slash.insert"),commands:[{name:"image",label:T.t("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:n=>n.isActive("columns"),action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setImageUpload().run()}},{name:"video",label:T.t("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:n=>n.isActive("columns"),action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setVideoUpload().run()}},{name:"table",label:T.t("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:n=>n.isActive("columns"),action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"horizontalRule",label:T.t("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setHorizontalRule().run()}}]}]}const q="slashCommand";let j;const Di=l.Extension.create({name:q,priority:200,onCreate(){j=l.tippy("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[l.Suggestion({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new l.PluginKey(q),allow:({state:e,range:t})=>{var u,h,m;const n=e.doc.resolve(t.from),o=n.depth===1,a=n.parent.type.name==="paragraph",s=((u=n.parent.textContent)==null?void 0:u.charAt(0))==="/",r=this.editor.isActive("column"),d=(m=n.parent.textContent)==null?void 0:m.slice(Math.max(0,(h=n.parent.textContent)==null?void 0:h.indexOf("/"))),c=!(d!=null&&d.endsWith(" "));return(o&&a&&s||r&&a&&s)&&c},command:({editor:e,range:t,props:n})=>{const{view:o}=e;n.action({editor:e,range:t}),o.focus()},items:({query:e})=>(console.log(this),Fi(this.editor).map(s=>({...s,commands:s.commands.filter(r=>{const d=r.label.toLowerCase().trim(),c=e.toLowerCase().trim();if(r.aliases){const u=r.aliases.map(g=>g.toLowerCase().trim()),h=d.match(c),m=u.some(g=>g.match(c));return h||m}return d.match(c)}).filter(r=>r.shouldBeHidden?!r.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(r=>({...r,isEnabled:!0}))}))),render:()=>{let e,t=null;return{onStart:n=>{var s;e=new l.ReactRenderer(Hi,{props:n,editor:n.editor});const{view:o}=n.editor,a=()=>{if(!n.clientRect)return n.editor.storage[q].rect;const r=n.clientRect();if(!r)return n.editor.storage[q].rect;let d=r.y;if(r.top+e.element.offsetHeight+40>window.innerHeight){const c=r.top+e.element.offsetHeight-window.innerHeight+40;d=r.y-c}return new DOMRect(r.x,d,r.width,r.height)};t=()=>{j==null||j[0].setProps({getReferenceClientRect:a})},(s=o.dom.parentElement)==null||s.addEventListener("scroll",t),j==null||j[0].setProps({getReferenceClientRect:a,appendTo:()=>document.body,content:e.element}),j==null||j[0].show()},onUpdate(n){var r;e.updateProps(n);const{view:o}=n.editor,a=()=>{if(!n.clientRect)return n.editor.storage[q].rect;const d=n.clientRect();return d?new DOMRect(d.x,d.y,d.width,d.height):n.editor.storage[q].rect},s=()=>{j==null||j[0].setProps({getReferenceClientRect:a})};(r=o.dom.parentElement)==null||r.addEventListener("scroll",s),n.editor.storage[q].rect=n.clientRect?a():{width:0,height:0,left:0,top:0,right:0,bottom:0},j==null||j[0].setProps({getReferenceClientRect:a})},onKeyDown(n){var o;return n.event.key==="Escape"?(j==null||j[0].hide(),!0):(j!=null&&j[0].state.isShown||j==null||j[0].show(),(o=e.ref)==null?void 0:o.onKeyDown(n))},onExit(n){var o;if(j==null||j[0].hide(),t){const{view:a}=n.editor;(o=a.dom.parentElement)==null||o.removeEventListener("scroll",t)}e.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),zi=(e,t="px")=>{if(!e)return e;const n=Ae(e)?String(e):e,o=Number.parseFloat(n),a=n.match(/[%A-Za-z]+$/),s=a?a[0]:t;return Number.isNaN(o)?e:o+s};function Bi(e,t,n){return e<t?t:e>n?n:e}const Ae=e=>typeof e=="number",Ii=e=>typeof e=="function";function Pi(e,t){if(!e)return!1;const{extensions:n=[]}=(e==null?void 0:e.extensionManager)??{};return!!n.find(a=>a.name===t)}const fe={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},Ei=e=>{var O;const[t,n]=f.useState({width:Be,height:Be}),[o,a]=f.useState({width:0,height:0}),[s,r]=f.useState([fe.TOP_LEFT,fe.TOP_RIGHT,fe.BOTTOM_LEFT,fe.BOTTOM_RIGHT]),[d,c]=f.useState(!1),[u,h]=f.useState({x:0,y:0,w:0,h:0,dir:""}),m=f.useMemo(()=>{var z;const{src:b,alt:F,width:A,height:P}=(z=e==null?void 0:e.node)==null?void 0:z.attrs,U=Ae(A)?A+"px":A,N=Ae(P)?P+"px":P;return{src:b||void 0,alt:F||void 0,style:{width:U||void 0,height:N||void 0}}},[(O=e==null?void 0:e.node)==null?void 0:O.attrs]),g=f.useMemo(()=>{const{style:{width:b}}=m;return{width:b==="100%"?b:void 0}},[m]);function x(b){a({width:b.target.width,height:b.target.height})}function w(){const{editor:b,getPos:F}=e;b.commands.setNodeSelection(F())}const L=f.useCallback(l.throttle(function(){const{editor:b}=e,{width:F}=getComputedStyle(b.view.dom);n(A=>({...A,width:Number.parseInt(F,10)}))},Ie),[e==null?void 0:e.editor]);function H(b,F){b.preventDefault(),b.stopPropagation();const A=o.width,P=o.height,U=A/P;let N=Number(e.node.attrs.width),z=Number(e.node.attrs.height);const E=t.width;N&&!z?(N=N>E?E:N,z=Math.round(N/U)):z&&!N?(N=Math.round(z*U),N=N>E?E:N):!N&&!z?(N=A>E?E:A,z=Math.round(N/U)):N=N>E?E:N,Fe.flushSync(()=>{c(!0),h({x:b.clientX,y:b.clientY,w:N,h:z,dir:F})})}const D=f.useCallback(l.throttle(function(b){if(b.preventDefault(),b.stopPropagation(),!d)return;const{x:F,y:A,w:P,h:U,dir:N}=u,z=(b.clientX-F)*(/l/.test(N)?-1:1);(b.clientY-A)*(/t/.test(N)?-1:1);const E=Bi(P+z,Ht,t.width);e.updateAttributes({width:E,height:null})},Ie),[d,u,t,e.updateAttributes]),p=f.useCallback(b=>{b.preventDefault(),b.stopPropagation(),d&&(Fe.flushSync(()=>{h({x:0,y:0,w:0,h:0,dir:""}),c(!1)}),w())},[d,w]),y=f.useCallback(()=>{document==null||document.addEventListener("mousemove",D,!0),document==null||document.addEventListener("mouseup",p,!0)},[D,p]),k=f.useCallback(()=>{document==null||document.removeEventListener("mousemove",D,!0),document==null||document.removeEventListener("mouseup",p,!0)},[D,p]);f.useEffect(()=>(d?y():k(),()=>{k()}),[d,y,k]);const B=f.useMemo(()=>new ResizeObserver(()=>L()),[L]);return f.useEffect(()=>(B.observe(e.editor.view.dom),()=>{B.disconnect()}),[e.editor.view.dom,B]),i.jsx(l.NodeViewWrapper,{className:"image-view",style:{...g,width:"100%"},children:i.jsxs("div",{draggable:"true","data-drag-handle":!0,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${d?"image-view__body--resizing":""}`,style:g,children:[i.jsx("img",{src:m.src,alt:m.alt,style:m.style,height:"auto",className:"image-view__body__image block",onLoad:x,onClick:w}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||d)&&i.jsx("div",{className:"image-resizer",children:s==null?void 0:s.map(b=>i.jsx("span",{className:`image-resizer__handler image-resizer__handler--${b}`,onMouseDown:F=>H(F,b)},b))})]})})},Oi=l.Image.extend({inline(){return!0},group(){return"inline"},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const n=t.style.width||t.getAttribute("width")||null;return n==null?null:Number.parseInt(n,10)},renderHTML:t=>({width:t.width})}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!0,upload:null}},addNodeView(){return l.ReactNodeViewRenderer(Ei)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),updateImage:t=>({commands:n})=>n.updateAttributes(this.name,t)}},renderHTML({HTMLAttributes:e}){return["img",l.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]},parseHTML(){return[{tag:"img[src]"}]}}),st=l.Root2$2,Re=M.forwardRef(({className:e,...t},n)=>i.jsx(l.List$1,{ref:n,className:S("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Re.displayName=l.List$1.displayName;const le=M.forwardRef(({className:e,...t},n)=>i.jsx(l.Trigger$3,{ref:n,className:S("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));le.displayName=l.Trigger$3.displayName;const se=M.forwardRef(({className:e,...t},n)=>i.jsx(l.Content,{ref:n,className:S("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));se.displayName=l.Content.displayName;const ne=new l.PluginKey("upload-image"),_i=()=>new l.Plugin({key:ne,state:{init(){return l.DecorationSet.empty},apply(e,t){t=t.map(e.mapping,e.doc);const n=e.getMeta(ne);if(n!=null&&n.add)for(const{id:o,pos:a,src:s}of n.add){const r=$i(s),d=l.Decoration.widget(a,r,{id:o});t=t.add(e.doc,[d])}else if(n!=null&&n.remove)for(const o of n.remove)t=t.remove(t.find(void 0,void 0,a=>a.id===o));return t}},props:{decorations(e){return this.getState(e)}}});function $i(e){const t=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=e,n.addEventListener("load",()=>{t.setAttribute("class","img-placeholder")}),t.append(n),t}function Ui(e,t){var a;const o=ne.getState(e).find(void 0,void 0,s=>s.id===t);return o.length>0?(a=o[0])==null?void 0:a.from:null}const rt=({validateFn:e,onUpload:t})=>(n,o,a)=>{for(const s of n){if(e&&!e(s))continue;const r=Date.now().toString(),d=o.state.tr;d.selection.empty||d.deleteSelection();const c=URL.createObjectURL(s);d.setMeta(ne,{add:[{id:r,pos:a,src:c}]}),o.dispatch(d),t(s).then(u=>{var L;const{schema:h}=o.state,m=Ui(o.state,r);if(m===null)return;const g=typeof u=="object"?c:u,x=(L=h.nodes.image)==null?void 0:L.create({src:g});if(!x)return;const w=o.state.tr.replaceWith(m,m,x).setMeta(ne,{remove:[r]});o.dispatch(w)},()=>{const u=o.state.tr.delete(a,a).setMeta(ne,{remove:[r]});o.dispatch(u)})}},Vi=(e,t,n)=>{var a;const o=[...((a=t.clipboardData)==null?void 0:a.files)||[]];if(o.length>0){t.preventDefault();const s=e.state.selection.from;return n(o,e,s+1),!0}return!1},Ki=(e,t,n,o)=>{var s;const a=[...((s=t.dataTransfer)==null?void 0:s.files)||[]];if(!n&&a.length>0){t.preventDefault();const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(r)return o(a,e,r.pos+1),!0}return!1},qi=e=>{const{t}=R(),[n,o]=f.useState(""),a=f.useRef(null);function s(u){var w,L;const h=(w=u==null?void 0:u.target)==null?void 0:w.files;if(!e.editor||e.editor.isDestroyed||h.length===0)return;const m=h[0],g=(L=e.editor.extensionManager.extensions.find(H=>H.name==="imageUpload"))==null?void 0:L.options;rt({validateFn:()=>!0,onUpload:g.upload})([m],e.editor.view,e.getPos())}function r(u){u.preventDefault(),e.editor.chain().setImage({src:n}).deleteRange({from:e.getPos(),to:e.getPos()}).focus().run()}function d(u){u==null||u.preventDefault(),e.deleteNode()}function c(u){var h;u.preventDefault(),(h=a.current)==null||h.click()}return i.jsx(l.NodeViewWrapper,{className:"p-0 m-0","data-drag-handle":!0,children:i.jsxs(Q,{defaultOpen:!0,modal:!0,children:[i.jsx(ee,{asChild:!0,children:i.jsx("div",{className:"flex items-center w-full p-3 my-3 hover:bg-accent border border-border text-muted-foreground cursor-pointer rounded-sm transition-all",children:i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsxs("div",{className:"flex justify-center items-center gap-3",children:[i.jsx(C,{name:"ImageUp",className:"w-6 h-6"}),i.jsx("span",{className:"text-sm",children:t("editor.image.dialog.title")})]}),i.jsx(C,{name:"Trash2",className:"hover:text-foreground",onClick:d})]})})}),i.jsx(K,{className:"w-full",onOpenAutoFocus:u=>u.preventDefault(),children:i.jsxs(st,{defaultValue:"upload",className:"w-[400px]",activationMode:"manual",children:[i.jsxs(Re,{className:"grid w-full grid-cols-2",children:[i.jsxs(le,{value:"upload",children:[t("editor.image.dialog.tab.upload")," "]}),i.jsxs(le,{value:"link",children:[" ",t("editor.image.dialog.tab.url")," "]})]}),i.jsxs(se,{value:"upload",children:[i.jsx(I,{className:"w-full mt-1",size:"sm",onClick:c,children:t("editor.image.dialog.tab.upload")}),i.jsx("input",{type:"file",accept:"image/*",ref:a,multiple:!0,style:{display:"none"},onChange:s})]}),i.jsx(se,{value:"link",children:i.jsx("form",{onSubmit:r,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(X,{type:"url",autoFocus:!0,value:n,onChange:u=>o(u.target.value),required:!0,placeholder:t("editor.image.dialog.placeholder")}),i.jsx(I,{type:"submit",children:t("editor.image.dialog.button.apply")})]})})})]})})]})})},Wi={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},Gi=l.Node.create({name:"imageUpload",isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!0,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new TypeError("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setImageUpload:()=>({commands:e})=>e.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return l.ReactNodeViewRenderer(qi)},addOptions(){var e;return{...Wi,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:n,t:o})=>({component:v,componentProps:{action:()=>t.commands.setImageUpload(),upload:n.options.upload,disabled:!t.can().setImage({}),icon:"ImageUp",tooltip:o("editor.image.tooltip")}})}},addProseMirrorPlugins(){const t=rt({validateFn:n=>!(!this.options.acceptMimes.includes(n.type)||n.size>this.options.maxSize),onUpload:this.options.upload});return[new l.Plugin({props:{handlePaste:(n,o)=>!o.clipboardData||[...o.clipboardData.items||[]].some(s=>s.type==="text/html")?!1:Vi(n,o,t),handleDrop:(n,o,a,s)=>(!(o instanceof DragEvent)||!o.dataTransfer||Ki(n,o,s,t),!1)}}),_i()]}});function Xi(e){return e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),e=e.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/i,"").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 Zi=l.Node.create({name:"video",group:"block",atom:!0,draggable:!0,addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?Xi(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:zi(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%"}=e??{},n={...e,width:"100%",height:"100%"},o=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,a=`flex: 1;padding-bottom: ${9/16*100}%;`,d=["div",{style:o},["div",{style:a}],["iframe",n]];return["div",{...this.options.HTMLAttributes,"data-video":""},d]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}},addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,width:be["size-medium"],HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}}}),Yi=e=>{const{t}=R(),[n,o]=f.useState(""),[a,s]=f.useState(!1),r=f.useRef(null);function d(m){var L,H;s(!0);const g=(L=m==null?void 0:m.target)==null?void 0:L.files;if(!e.editor||e.editor.isDestroyed||g.length===0)return;const x=g[0],w=(H=e.editor.extensionManager.extensions.find(D=>D.name==="videoUpload"))==null?void 0:H.options;w==null||w.upload([x]).then(D=>{e.editor.chain().setVideo({src:D[0].src,width:"100%"}).deleteRange({from:e.getPos(),to:e.getPos()}).focus().run(),s(!1)})}function c(m){m.preventDefault(),e.editor.chain().setVideo({src:n,width:"100%"}).deleteRange({from:e.getPos(),to:e.getPos()}).focus().run()}function u(m){m.preventDefault(),e.deleteNode()}function h(m){var g;m.preventDefault(),(g=r.current)==null||g.click()}return i.jsx(l.NodeViewWrapper,{as:"div","data-drag-handle":!0,children:i.jsxs(Q,{defaultOpen:!0,modal:!0,children:[i.jsx(ee,{asChild:!0,children:i.jsx("div",{className:"flex items-center w-full p-3 my-3 hover:bg-accent border border-border text-muted-foreground cursor-pointer rounded-sm transition-all",children:a?i.jsxs("div",{className:"flex justify-center items-center gap-3 text-s",children:[i.jsx(C,{className:"animate-spin w-6 h-6",name:"LoaderCircle"}),i.jsxs("span",{children:[t("editor.video.dialog.uploading"),"..."]})]}):i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsxs("div",{className:"flex justify-center items-center gap-3",children:[i.jsx(C,{name:"Video",className:"w-6 h-6"}),i.jsx("span",{className:"text-sm",children:t("editor.video.dialog.title")})]}),i.jsx(C,{name:"Trash2",className:"hover:text-foreground",onClick:u})]})})}),i.jsx(K,{className:"w-full",onOpenAutoFocus:m=>m.preventDefault(),children:i.jsxs(st,{defaultValue:"upload",className:"w-[400px]",activationMode:"manual",children:[i.jsxs(Re,{className:"grid w-full grid-cols-2",children:[i.jsxs(le,{value:"upload",children:[t("editor.video.dialog.tab.upload")," "]}),i.jsxs(le,{value:"link",children:[" ",t("editor.video.dialog.link")," "]})]}),i.jsxs(se,{value:"upload",children:[i.jsx(I,{className:"w-full mt-1",size:"sm",onClick:h,children:t("editor.video.dialog.tab.upload")}),i.jsx("input",{type:"file",accept:"video/*",ref:r,multiple:!0,style:{display:"none"},onChange:d})]}),i.jsx(se,{value:"link",children:i.jsx("form",{onSubmit:c,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(X,{type:"url",autoFocus:!0,required:!0,placeholder:t("editor.video.dialog.placeholder"),value:n,onChange:m=>o(m.target.value)}),i.jsx(I,{type:"submit",children:t("editor.video.dialog.button.apply")})]})})})]})})]})})},Ji=l.Node.create({name:"videoUpload",isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!0,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:e})=>e.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return l.ReactNodeViewRenderer(Yi)},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),upload:void 0,button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>t.commands.setVideoUpload(),isActive:()=>t.isActive("video")||!1,disabled:!t.can().setVideo({}),icon:"Video",tooltip:n("editor.video.tooltip")}})}}}),Qi=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,en=/CrOS/,tn=/android|ipad|playbook|silk/i;function _e(e={}){let t=e.ua||typeof navigator<"u"&&navigator.userAgent;return t&&typeof t=="object"&&t.headers&&typeof t.headers["user-agent"]=="string"&&(t=t.headers["user-agent"]),typeof t!="string"?!1:!!(Qi.test(t)&&!en.test(t)||e.tablet&&tn.test(t)||e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&t.includes("Macintosh")&&t.includes("Safari"))}const $e=e=>Array.from({length:e}).map((t,n)=>n+1),nn=e=>{var h;const[t,n]=f.useState(!0),[o,a]=f.useState({rows:_e()?me:ue,cols:_e()?me:ue}),[s,r]=f.useState({rows:he,cols:he});function d(m,g){m===o.rows&&a(x=>({...x,rows:Math.min(m+1,me)})),g===o.cols&&a(x=>({...x,cols:Math.min(g+1,me)})),r({rows:m,cols:g})}function c(m,g){e==null||e.createTable({rows:m,cols:g,withHeaderRow:t}),u()}function u(){n(!1),a({rows:ue,cols:ue}),r({rows:he,cols:he})}return i.jsxs(Q,{children:[i.jsx(ee,{asChild:!0,children:e==null?void 0:e.children}),i.jsx(K,{className:"w-full !p-2",align:"start",side:"bottom",children:i.jsxs("div",{className:"p-0 table-grid-size-editor",children:[i.jsx("div",{className:"flex flex-col flex-wrap justify-between gap-1",children:(h=$e(o==null?void 0:o.rows))==null?void 0:h.map(m=>{var g;return i.jsx("div",{className:"flex gap-1",children:(g=$e(o==null?void 0:o.cols))==null?void 0:g.map(x=>i.jsx("div",{className:`pa-1 cursor-pointer border-border ${x<=s.cols&&m<=s.rows&&"bg-foreground"}`,onMouseOver:()=>d(m,x),onMouseDown:()=>c(m,x),children:i.jsx("div",{className:"w-4 h-4 p-1 border rounded-[2px] box-border border-solid"})},`c-${x}`))},`r-${m}`)})}),i.jsxs("div",{className:"mt-2 text-sm text-center text-zinc-600",children:[s.rows," x ",s.cols]})]})})]})},on=e=>{function t(n){e.disabled||e.editor.chain().focus().insertTable({...n,withHeaderRow:!1}).run()}return i.jsx(nn,{createTable:t,children:i.jsx(v,{icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,color:e==null?void 0:e.color,action:e==null?void 0:e.action,isActive:e==null?void 0:e.isActive})})},an=(e,t,n)=>{if(!e.doc)return e;const o=e.doc.nodeAt(t);if(!o||n===o.attrs.backgroundColor)return e;const a={...o.attrs,backgroundColor:n};return e.setNodeMarkup(t,o.type,a,o.marks)},ln=(e,t,n)=>{const{doc:o,selection:a}=e;return!o||!a||!(a instanceof l.CellSelection)||a.forEachCell((s,r)=>{e=an(e,r,n)}),e},Ue=(e,t)=>({tr:n,state:o,dispatch:a})=>{const{selection:s}=o;return n=n.setSelection(s),n=ln(n,t,e),n.docChanged?(a==null||a(n),!0):!1},sn=l.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:e=>e.style.backgroundColor||"",renderHTML:e=>!e.backgroundColor||e.backgroundColor===""?{}:{style:`background-color: ${e.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:e=>Ue(e,this.options),unsetTableCellBackground:()=>Ue("",this.options)}}}),rn=l.Table$1.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:n})=>({component:on,componentProps:{disabled:t.isActive("table")||!1,icon:"Table",tooltip:n("editor.table.tooltip"),editor:t}})}},addExtensions(){return[l.TableRow.configure(this.options.tableRow),l.TableHeader.configure(this.options.tableHeader),l.TableCell.configure(this.options.tableCell),sn.configure(this.options.tableCellBackground)]}}),dn=l.Extension.create({name:"painter",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:v,componentProps:{action:()=>{t.commands.setPainter(t==null?void 0:t.state.selection.$head.marks())},icon:"PaintRoller",tooltip:n("editor.format")}})}},addCommands(){return{setPainter:e=>({view:{dispatch:t,state:{tr:n},dom:o}})=>{const r=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return o.style.cursor=r,t(n.setMeta("painterAction",{type:"start",marks:e})),!0}}},addProseMirrorPlugins(){return[new l.Plugin({key:new l.PluginKey("format-painter"),state:{init:()=>[],apply:(e,t)=>{const n=e.getMeta("painterAction");return n&&n.type==="start"?t=n.marks:n&&n.type==="end"&&(t=[]),t}},props:{handleDOMEvents:{mousedown(e,t){const n=this.getState(e.state);if(!n||n.length===0)return e.dom.style.cursor="",!1;const o=()=>{document.removeEventListener("mouseup",o);let{dispatch:a,state:{tr:s,selection:r},dom:d}=e;d.style.cursor="",s=s.removeMark(r.from,r.to);for(const c of n)c.type.name!="link"&&(s=s.addMark(r.from,r.to,c));a(s.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",o),!0}}}})]}}),ae={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:["v.youku.com\\/v_show\\/id_\\w+\\=*"],idRule:"id_\\w+\\=*"},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:["www.bilibili.com\\/video\\/\\w+"]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:["v.qq.com\\/x\\/cover\\/\\w+\\/\\w+"]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:["\\.amap\\.com"]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:["map\\.baidu\\.com"]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:["https:\\/\\/\\w+.modao.cc\\/app\\/\\w+\\/embed\\/v2"],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:["https:\\/\\/lanhuapp.com\\/url\\/\\w+"],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:["https:\\/\\/www.figma.com\\/file\\/\\w+"]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:["https:\\/\\/www.canva.cn\\/design\\/.+\\/view"]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:["https:\\/\\/www.processon.com\\/embed\\/\\w+"]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:["https:\\/\\/codepen.io\\/.+\\/embed\\/\\w+"]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:["https:\\/\\/jinshuju.net\\/f\\/\\w+"]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:["https:\\/\\/goo.gl\\/maps\\/\\w+"]}};function cn(e,t){const n=ae.youtube,o=t.matchedUrl;t.validLink=!0;const a=o.split("="),s=a.length;if(s>0){const r=a[s-1];t.src=`${n.srcPrefix}/${r}`,t.validId=!0}return t}function un(e,t){const n=ae.youku,o=t.matchedUrl,a=n.idRule,s=new RegExp(a),r=o.match(s);if(r&&r.length>0){const d=r[0].slice(3);t.validId=!0,t.src=`${n.srcPrefix}/${d}`}else t.validId=!1;return t}function mn(e,t){const n=ae.bilibili,a=t.matchedUrl.split("/"),s=a.length;if(s>0){const r=a[s-1];t.src=`${n.srcPrefix}=${r}`,t.validId=!0}return t}function hn(e,t){const n=ae.qqvideo,a=t.matchedUrl.split("/"),s=a.length;if(s>0){const r=a[s-1];t.src=`${n.srcPrefix}=${r}`,t.validId=!0}return t}function fn(e,t){return t.src=e,t.validId=!0,t}function gn(e,t){return t.src=e,t.validId=!0,t}function bn(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function xn(e,t){return t.src=t.matchedUrl,t.validId=!0,t.originalLink=t.src,t}function vn(e,t){return t.src=t.matchedUrl,t.validId=!0,t.originalLink=t.src,t}function wn(e,t){const n=ae.figma;return t.src=`${n.srcPrefix}=${encodeURIComponent(t.matchedUrl)}`,t.validId=!0,t.originalLink=t.matchedUrl,t}function pn(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function yn(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function jn(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=t.src,t}function kn(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function Cn(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Nn(e,t,n){if(e==="googlemaps")return n.validLink=!0,n.matchedUrl=t,n;const a=ae[e].linkRule;for(const s of a){const r=new RegExp(s),d=t.match(r);if(d&&d.length>0)return n.validLink=!0,n.matchedUrl=e==="youtube"?d[1]:d[0],n}return n}const Ln=e=>{var n,o;let t="iframe";return((n=e.includes)!=null&&n.call(e,"youtube")||(o=e.includes)!=null&&o.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t},Tn=e=>{let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const n=Ln(e);if(t=Nn(n,e,t),!t.validLink)return t;switch(n){case"youtube":return cn(e,t);case"youku":return un(e,t);case"bilibili":return mn(e,t);case"qqvideo":return hn(e,t);case"amap":return fn(e,t);case"baidu_map":return gn(e,t);case"googlemaps":return bn(e,t);case"modao":return xn(e,t);case"lanhu":return vn(e,t);case"figma":return wn(e,t);case"canva":return pn(e,t);case"processon":return yn(e,t);case"codepen":return jn(e,t);case"jinshuju":return kn(e,t);case"iframe":return Cn(e,t)}return t},Sn=e=>{var a,s,r,d,c,u,h,m;const[t,n]=f.useState("");function o(){if(!t)return;const g=Tn(t);g.validLink&&g.validId&&e.updateAttributes({src:g.src})}return i.jsx(i.Fragment,{children:i.jsxs(l.NodeViewWrapper,{as:"section",children:[!((s=(a=e==null?void 0:e.node)==null?void 0:a.attrs)!=null&&s.src)&&i.jsxs("div",{className:"max-w-[600px] mx-[auto] my-[12px] flex items-center justify-center gap-[10px] p-[10px] border-[1px] border-solid border-[#ccc] rounded-[12px]",children:[i.jsx(X,{value:t,onInput:g=>n(g.target.value),type:"url",className:"flex-1",autoFocus:!0,placeholder:"Enter link"}),i.jsx(I,{className:"w-[60px]",onClick:o,children:"OK"})]}),((d=(r=e==null?void 0:e.node)==null?void 0:r.attrs)==null?void 0:d.src)&&i.jsx("iframe",{src:(u=(c=e==null?void 0:e.node)==null?void 0:c.attrs)==null?void 0:u.src,frameBorder:"0",allowFullScreen:!0,title:(m=(h=e==null?void 0:e.node)==null?void 0:h.attrs)==null?void 0:m.src,className:"my-[12px]"})]})})},An=l.Node.create({name:"iframes",group:"block",atom:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"},button:({editor:t,extension:n,t:o})=>({component:v,componentProps:{action:a=>t.commands.setIframe(a),upload:n.options.upload,disabled:!t.can().setIframe({}),icon:"Iframe",tooltip:o("editor.iframe.tooltip")}})}},addAttributes(){return{src:{default:null},service:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["div",this.options.HTMLAttributes,["iframe",e]]},addNodeView(){return l.ReactNodeViewRenderer(Sn)},addCommands(){return{setIframe:e=>({tr:t,dispatch:n})=>{const{selection:o}=t,a=this.type.create(e);return n&&t.replaceRangeWith(o.from,o.to,a),!0}}}}),Mn=e=>{const{t}=R();return i.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800",children:[i.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline break-all",children:l.truncate(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&i.jsx($,{orientation:"vertical",className:"h-4"}),i.jsxs("div",{className:"flex flex-nowrap",children:[i.jsx(v,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),i.jsx(v,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})},Rn=e=>{const[t,n]=f.useState(!1),o=f.useMemo(()=>{const{href:d}=e.editor.getAttributes("link");return d},[e]),a=f.useCallback(({editor:d})=>d.isActive("link"),[]),s=(d,c,u)=>{e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:d,target:u?"_blank":""}}]}).setLink({href:d}).focus().run(),n(!1)},r=f.useCallback(()=>{e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n(!1)},[e.editor]);return i.jsx(i.Fragment,{children:i.jsx(l.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:a,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n(!1)}},children:e!=null&&e.disabled?i.jsx(i.Fragment,{}):i.jsx(i.Fragment,{children:t?i.jsx(ot,{onSetLink:s,editor:e==null?void 0:e.editor}):i.jsx(Mn,{editor:e==null?void 0:e.editor,onClear:r,onEdit:()=>{n(!0)},link:o})})})})},Hn=e=>{const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((o,a)=>({type:`image-${o}`,component:v,componentProps:{tooltip:T.t(`editor.${o.replace("-",".")}.tooltip`),icon:n[a],action:()=>e.commands.updateImage({width:Le[o]}),isActive:()=>e.isActive("image",{width:Le[o]})}}))},Fn=e=>{const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map((o,a)=>({type:`image-${o}`,component:v,componentProps:{tooltip:T.t(`editor.textalign.${o}.tooltip`),icon:n[o],action:()=>e.commands.setTextAlign(o),isActive:()=>e.isActive({textAlign:o})||!1,disabled:!e.can().setTextAlign(o)}}))},Dn=e=>{const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((o,a)=>({type:`video-${o}`,component:v,componentProps:{tooltip:T.t(`editor.${o.replace("-",".")}.tooltip`),icon:n[a],action:()=>e.commands.updateVideo({width:be[o]}),isActive:()=>e.isActive("video",{width:be[o]})}}))},zn=e=>[...Hn(e),...Fn(e),{type:"remove",component:v,componentProps:{editor:e,tooltip:T.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;l.deleteSelection(t,n)}}}],Bn=e=>[...Dn(e),{type:"remove",component:v,componentProps:{editor:e,tooltip:T.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;l.deleteSelection(t,n)}}}],In=(e,t)=>[Ke.configure().options.button({editor:e,t}),qe.configure().options.button({editor:e,t}),We.configure().options.button({editor:e,t}),Ge.configure().options.button({editor:e,t}),Xe.configure().options.button({editor:e,t}),at.configure().options.button({editor:e,t}),{type:"divider",component:void 0,componentProps:{}},et.configure().options.button({editor:e,t}),it.configure().options.button({editor:e,t})],dt={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"},ct=({item:e,disabled:t,editor:n})=>{var a;const o=e.component;return o?i.jsx(f.Fragment,{children:e.type==="divider"?i.jsx($,{orientation:"vertical",className:"mx-1 me-2 h-[16px]"}):i.jsx(i.Fragment,{children:i.jsx(o,{...e.componentProps,editor:n,disabled:t||((a=e==null?void 0:e.componentProps)==null?void 0:a.disabled)})})}):i.jsx(i.Fragment,{})},Pn=e=>e.type.name==="image",En=e=>e.type.name==="video",On=e=>{const{lang:t}=R(),n=({editor:a})=>{const{selection:s}=a.view.state,{$from:r,to:d}=s;let c=!1;return a.view.state.doc.nodesBetween(r.pos,d,u=>{if(Pn(u))return c=!0,!1}),c},o=f.useMemo(()=>e.disabled?[]:zn(e.editor),[e.disabled,e.editor,t]);return i.jsx(i.Fragment,{children:i.jsx(l.BubbleMenu,{shouldShow:n,editor:e==null?void 0:e.editor,tippyOptions:dt,children:o!=null&&o.length?i.jsx("div",{className:"border border-neutral-200 dark:border-neutral-800 px-3 py-2 transition-all select-none pointer-events-auto shadow-sm rounded-sm w-auto bg-background",children:i.jsx("div",{className:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative",children:o==null?void 0:o.map((a,s)=>i.jsx(ct,{item:a,disabled:e.disabled,editor:e.editor},`bubbleMenu-image-${s}`))})}):i.jsx(i.Fragment,{})})})},_n=e=>{const{lang:t}=R(),n=({editor:a})=>{const{selection:s}=a.view.state,{$from:r,to:d}=s;let c=!1;return a.view.state.doc.nodesBetween(r.pos,d,u=>{if(En(u))return c=!0,!1}),c},o=f.useMemo(()=>e.disabled?[]:Bn(e.editor),[e.editor,e.disabled,t]);return i.jsx(i.Fragment,{children:i.jsx(l.BubbleMenu,{shouldShow:n,editor:e==null?void 0:e.editor,tippyOptions:dt,children:o!=null&&o.length?i.jsx("div",{className:"border border-neutral-200 dark:border-neutral-800 px-3 py-2 transition-all select-none pointer-events-auto shadow-sm rounded-sm w-auto bg-background",children:i.jsx("div",{className:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative",children:o==null?void 0:o.map((a,s)=>i.jsx(ct,{item:a,disabled:e.disabled,editor:e.editor},`bubbleMenu-video-${s}`))})}):i.jsx(i.Fragment,{})})})},$n={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"},Un=({item:e,disabled:t,editor:n})=>{var a;const o=e.component;return o?i.jsx(f.Fragment,{children:i.jsx(o,{...e.componentProps,editor:n,disabled:t||((a=e==null?void 0:e.componentProps)==null?void 0:a.disabled)})}):i.jsx(i.Fragment,{})},Vn=e=>{const{t,lang:n}=R(),o=({editor:s})=>{const{selection:r}=s.view.state,{$from:d,to:c}=r;return d.pos===c?!1:r instanceof l.TextSelection},a=f.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:In(e.editor,t),[e.disabled,e.editor,n,t]);return i.jsx(i.Fragment,{children:i.jsx(l.BubbleMenu,{shouldShow:o,editor:e==null?void 0:e.editor,tippyOptions:$n,children:a!=null&&a.length?i.jsx("div",{className:"border border-neutral-200 dark:border-neutral-800 px-3 py-2 transition-all select-none pointer-events-auto shadow-sm rounded-sm w-auto bg-background",children:i.jsx("div",{className:"flex items-center gap-[4px] flex-nowrap whitespace-nowrap h-[26px] justify-start relative",children:a==null?void 0:a.map((s,r)=>(s==null?void 0:s.type)==="divider"?i.jsx($,{orientation:"vertical",className:"mx-1 me-2 h-[16px]"},`bubbleMenu-divider-${r}`):i.jsx(Un,{item:s,disabled:e.disabled,editor:e.editor},`bubbleMenu-text-${r}`))})}):i.jsx(i.Fragment,{})})})},Kn=e=>{var k,B,O;const{t}=R(),[n,o]=f.useState(null),[a,s]=f.useState(-1),r=f.useRef(null),d=f.useRef(null),[c,u]=f.useState(!1);f.useEffect(()=>{r.current&&!e.editor.isDestroyed&&(d.current=l.DragHandlePlugin({editor:e.editor,element:r.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:D}),e.editor.registerPlugin(d.current))},[e.editor,r]);function h(){const b=e.editor.chain();b.setNodeSelection(a).unsetAllMarks(),(n==null?void 0:n.type.name)!=="paragraph"&&b.setParagraph(),b.run()}function m(){e.editor.chain().focus().setNodeSelection(a).run(),document.execCommand("copy")}function g(){e.editor.commands.setNodeSelection(a);const{$anchor:b}=e.editor.state.selection,F=b.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(a+((n==null?void 0:n.nodeSize)||0),F.toJSON()).run()}function x(b){e.editor.commands.setTextAlign(b)}function w(){const b=Se(e.editor.state.tr,a,1);b.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(b)}function L(){const b=Se(e.editor.state.tr,a,-1);e.editor.view.dispatch&&e.editor.view.dispatch(b)}function H(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(a).deleteSelection().run()}function D(b){b.node&&o(b.node),s(b.pos)}function p(){var b;if(a!==-1){const F=(n==null?void 0:n.nodeSize)||0,A=a+F,P=(n==null?void 0:n.type.name)==="paragraph"&&((b=n==null?void 0:n.content)==null?void 0:b.size)===0,U=P?a+2:A+2;e.editor.chain().command(({dispatch:N,tr:z,state:E})=>N?(P?z.insertText("/",a,a+1):z.insert(A,E.schema.nodes.paragraph.create(null,[E.schema.text("/")])),N(z)):!0).focus(U).run()}}f.useEffect(()=>(c?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[c]),f.useEffect(()=>()=>{d.current&&(e.editor.unregisterPlugin(l.dragHandlePluginDefaultKey),d.current=null)},[]),f.useEffect(()=>{var b;(b=e.editor)!=null&&b.isDestroyed&&d.current&&(e.editor.unregisterPlugin(e.pluginKey),d.current=null)},[(k=e.editor)==null?void 0:k.isDestroyed]);const y=b=>{e!=null&&e.disabled||u(b)};return i.jsx(i.Fragment,{children:i.jsx("div",{className:"drag-handle [transition-property:top,_left] ease-in-out duration-200 "+(e==null?void 0:e.className),style:{opacity:e!=null&&e.disabled?0:1},ref:r,children:i.jsxs("div",{className:"flex items-center gap-0.5 [transition-property:top,_left] ease-in-out duration-200",children:[i.jsx(I,{variant:"ghost",size:"icon",className:"w-7 h-7 cursor-grab",disabled:e==null?void 0:e.disabled,onClick:p,children:i.jsx(C,{name:"Plus",className:"text-lg text-neutral-600 dark:text-neutral-200"})}),i.jsxs(Z,{open:c,onOpenChange:y,children:[i.jsxs("div",{className:"flex flex-col relative",children:[i.jsxs(de,{children:[i.jsx(ce,{asChild:!0,disabled:e==null?void 0:e.disabled,children:i.jsx(I,{variant:"ghost",size:"icon",className:"w-7 h-7 cursor-grab relative z-[1]",disabled:e==null?void 0:e.disabled,onMouseUp:()=>{e!=null&&e.disabled||u(!0)},children:i.jsx(C,{name:"Grip",className:"text-sm dark:text-neutral-200 text-neutral-600"})})}),i.jsx(oe,{children:i.jsx("p",{children:t("editor.draghandle.tooltip")})})]}),i.jsx(Y,{className:"absolute top-0 left-0 w-[28px] h-[28px] z-0"})]}),i.jsxs(V,{className:"w-48",align:"start",side:"bottom",sideOffset:0,children:[i.jsxs(_,{onClick:H,className:"flex gap-3 focus:text-red-500 focus:bg-red-400 hover:bg-red-400 dark:hover:text-red-500 bg-opacity-10 hover:bg-opacity-20 focus:bg-opacity-30 dark:hover:bg-opacity-20",children:[i.jsx(C,{name:"Trash2"}),i.jsx("span",{children:t("editor.remove")})]}),i.jsxs(_,{className:"flex gap-3",onClick:h,children:[i.jsx(C,{name:"PaintRoller"}),i.jsx("span",{children:t("editor.clear.tooltip")})]}),i.jsxs(_,{className:"flex gap-3",onClick:m,children:[i.jsx(C,{name:"Clipboard"}),i.jsx("span",{children:t("editor.copyToClipboard")})]}),i.jsxs(_,{className:"flex gap-3",onClick:g,children:[i.jsx(C,{name:"Copy"}),i.jsx("span",{children:t("editor.copy")})]}),i.jsx(ye,{}),i.jsxs(ze,{children:[i.jsxs(Ce,{className:"flex gap-3",children:[i.jsx(C,{name:"AlignCenter"}),i.jsx("span",{children:t("editor.textalign.tooltip")})]}),i.jsx(De,{children:i.jsxs(Ne,{children:[i.jsxs(_,{className:"flex gap-3",onClick:()=>x("left"),children:[i.jsx(C,{name:"AlignLeft"}),i.jsx("span",{children:t("editor.textalign.left.tooltip")})]}),i.jsxs(_,{className:"flex gap-3",onClick:()=>x("center"),children:[i.jsx(C,{name:"AlignCenter"}),i.jsx("span",{children:t("editor.textalign.center.tooltip")})]}),i.jsxs(_,{className:"flex gap-3",onClick:()=>x("right"),children:[i.jsx(C,{name:"AlignRight"}),i.jsx("span",{children:t("editor.textalign.right.tooltip")})]})]})})]}),i.jsxs(ze,{children:[i.jsxs(Ce,{className:"flex gap-3",children:[i.jsx(C,{name:"IndentIncrease"}),i.jsx("span",{children:t("editor.indent")})]}),i.jsx(De,{children:i.jsxs(Ne,{children:[i.jsxs(_,{className:"flex gap-3",onClick:w,disabled:((B=n==null?void 0:n.attrs)==null?void 0:B.indent)>=G.max,children:[i.jsx(C,{name:"IndentIncrease"}),i.jsx("span",{children:t("editor.indent.tooltip")})]}),i.jsxs(_,{className:"flex gap-3",onClick:L,disabled:((O=n==null?void 0:n.attrs)==null?void 0:O.indent)<=G.min,children:[i.jsx(C,{name:"IndentDecrease"}),i.jsx("span",{children:t("editor.outdent.tooltip")})]})]})})]})]})]})]})})})},qn=e=>{var w,L,H,D,p,y,k,B,O;const t=({editor:b})=>l.isActive(b.view.state,"table"),{t:n}=R();function o(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function s(){e.editor.chain().focus().deleteColumn().run()}function r(){e.editor.chain().focus().addRowBefore().run()}function d(){e.editor.chain().focus().addRowAfter().run()}function c(){e.editor.chain().focus().deleteRow().run()}function u(){e.editor.chain().focus().mergeCells().run()}function h(){var b;(b=e.editor)==null||b.chain().focus().splitCell().run()}function m(){e.editor.chain().focus().deleteTable().run()}function g(b){e.editor.chain().focus().setTableCellBackground(b).run()}const x=()=>{const{view:b,state:{selection:{from:F}}}=e.editor,A=b.domAtPos(F).node;if(!A)return new DOMRect(-1e3,-1e3,0,0);const P=A==null?void 0:A.closest(".tableWrapper");return P?P.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)};return i.jsx(l.BubbleMenu,{editor:e==null?void 0:e.editor,pluginKey:"table",shouldShow:t,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:x,plugins:[l.sticky],sticky:"popper"},children:i.jsxs("div",{className:"min-w-32 flex flex-row h-full items-center leading-none gap-0.5 p-2 w-full bg-background rounded-lg shadow-sm border border-border",children:[i.jsx(v,{icon:"BetweenHorizonalEnd",tooltip:n("editor.table.menu.insertColumnBefore"),action:o,"tooltip-options":{sideOffset:15},disabled:!((w=e==null?void 0:e.editor)!=null&&w.can().addColumnBefore())}),i.jsx(v,{icon:"BetweenHorizonalStart",tooltip:n("editor.table.menu.insertColumnAfter"),action:a,"tooltip-options":{sideOffset:15},disabled:!((L=e==null?void 0:e.editor)!=null&&L.can().addColumnAfter())}),i.jsx(v,{icon:"DeleteColumn",action:s,tooltip:n("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((H=e==null?void 0:e.editor)!=null&&H.can().deleteColumn())}),i.jsx($,{orientation:"vertical",className:"mx-1 me-2 h-[16px]"}),i.jsx(v,{icon:"BetweenVerticalEnd",action:r,tooltip:n("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((D=e==null?void 0:e.editor)!=null&&D.can().addRowBefore())}),i.jsx(v,{icon:"BetweenVerticalStart",action:d,tooltip:n("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((p=e==null?void 0:e.editor)!=null&&p.can().addRowAfter())}),i.jsx(v,{icon:"DeleteRow",action:c,tooltip:n("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((y=e==null?void 0:e.editor)!=null&&y.can().deleteRow())}),i.jsx($,{orientation:"vertical",className:"mx-1 me-2 h-[16px]"}),i.jsx(v,{icon:"TableCellsMerge",action:u,tooltip:n("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((k=e==null?void 0:e.editor)!=null&&k.can().mergeCells())}),i.jsx(v,{icon:"TableCellsSplit",action:h,tooltip:n("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((B=e==null?void 0:e.editor)!=null&&B.can().splitCell())}),i.jsx($,{orientation:"vertical",className:"mx-1 me-2 h-[16px]"}),i.jsx(tt,{editor:e==null?void 0:e.editor,tooltip:n("editor.table.menu.setCellsBgColor"),action:g,tooltipOptions:{sideOffset:15}}),i.jsx(v,{icon:"Trash2",tooltip:n("editor.table.menu.deleteTable"),action:m,"tooltip-options":{sideOffset:15},disabled:!((O=e==null?void 0:e.editor)!=null&&O.can().deleteTable())})]})})},Wn=({editor:e,disabled:t})=>{const{t:n,lang:o}=R(),a=f.useMemo(()=>{const r=[...e.extensionManager.extensions].sort((c,u)=>{const h=c.options.sort??-1,m=u.options.sort??-1;return h-m});let d=[];for(const c of r){const{button:u,divider:h=!1,spacer:m=!1,toolbar:g=!0}=c.options;if(!u||!Ii(u)||!g)continue;const x=u({editor:e,extension:c,t:n});if(Array.isArray(x)){const w=x.map((L,H)=>({button:L,divider:H===x.length-1?h:!1,spacer:H===0?m:!1}));d=[...d,...w];continue}d.push({button:x,divider:h,spacer:m})}return d},[e,n,o]);return i.jsx("div",{className:"border-b py-2 px-1",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:i.jsx("div",{className:"flex flex-wrap h-auto relative gap-y-1 gap-x-1",children:a.map((s,r)=>{var c,u;const d=s.button.component;return i.jsxs("div",{className:"flex items-center",children:[(s==null?void 0:s.spacer)&&i.jsx($,{orientation:"vertical",className:"h-[16px] mx-[10px]"}),i.jsx(d,{...s.button.componentProps,disabled:t||((u=(c=s==null?void 0:s.button)==null?void 0:c.componentProps)==null?void 0:u.disabled)}),(s==null?void 0:s.divider)&&i.jsx($,{orientation:"vertical",className:"h-auto mx-2"})]},r)})})})},Gn=(e,t)=>{const{view:n,state:{selection:{from:o}}}=e,a=document.querySelectorAll(".has-focus"),s=a.length,d=a[s-1];if(d&&d.dataset.type&&d.dataset.type===t||d&&d.classList&&d.classList.contains(t))return d;const c=n.domAtPos(o).node;let u=c;for(u.tagName||(u=c.parentElement);u&&!(u.dataset.type&&u.dataset.type===t)&&!u.classList.contains(t);)u=u.parentElement;return u},Xn=({editor:e})=>l.isActive(e.view.state,"columns"),Zn=e=>{const t=()=>{const s=Gn(e.editor,"columns");return(s==null?void 0:s.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},n=()=>{e.editor.chain().focus().setLayout(W.SidebarLeft).run()},o=()=>{e.editor.chain().focus().setLayout(W.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(W.TwoColumn).run()};return i.jsx(l.BubbleMenu,{editor:e==null?void 0:e.editor,pluginKey:"columns",shouldShow:Xn,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:t,plugins:[l.sticky],sticky:"popper"},children:i.jsx("div",{className:"p-2 bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800",children:i.jsxs("div",{className:"flex gap-1 items-center",children:[i.jsx(v,{title:"ok",icon:"PanelLeft",tooltip:"Left Sidebar",action:n,isActive:()=>e==null?void 0:e.editor.isActive("columns",{layout:W.SidebarLeft}),tooltipOptions:{sideOffset:15}}),i.jsx(v,{title:"ok",icon:"Columns",tooltip:"Two-column layout",action:a,isActive:()=>e==null?void 0:e.editor.isActive("columns",{layout:W.TwoColumn}),tooltipOptions:{sideOffset:15}}),i.jsx(v,{title:"ok",icon:"PanelRight",tooltip:"Right Sidebar",action:o,isActive:()=>e==null?void 0:e.editor.isActive("columns",{layout:W.SidebarRight}),tooltipOptions:{sideOffset:15}})]})})})},Yn=l.proxy({theme:"light"}),Jn={setTheme:e=>{Yn.theme=e}};function Qn(e,t){const{content:n,extensions:o,useEditorOptions:a={}}=e,{t:s}=R(),r=f.useMemo(()=>{const m=l.differenceBy(o,o,"name");return[...o.map(x=>{const w=o.find(L=>L.name===x.name);return w?x.configure(w.options):x}),...m].map((x,w)=>x.configure({sort:w}))},[o]),d=l.useEditor({extensions:r,content:n,onUpdate:({editor:m})=>{u(m)},...a});f.useEffect(()=>{document.body.classList.toggle("dark",e.dark),Jn.setTheme(e.dark?"dark":"light")},[e.dark]),f.useEffect(()=>{d==null||d.setEditable(!(e!=null&&e.disabled))},[d,e==null?void 0:e.disabled]);function c(m,g){return e!=null&&e.removeDefaultWrapper?g==="html"?m.isEmpty?"":m.getHTML():g==="json"?m.isEmpty?{}:m.getJSON():g==="text"?m.isEmpty?"":m.getText():"":g==="html"?m.getHTML():g==="json"?m.getJSON():g==="text"?m.getText():""}const u=l.throttle(m=>{var x;const g=c(m,e.output);(x=e==null?void 0:e.onChangeContent)==null||x.call(e,g)},Rt);f.useImperativeHandle(t,()=>({editor:d})),f.useEffect(()=>()=>{var m;(m=d==null?void 0:d.destroy)==null||m.call(d)},[]);const h=Pi(d,"characterCount");return d?i.jsx(Ct,{delayDuration:0,children:i.jsxs("div",{className:"reactjs-tiptap-editor rounded-[0.5rem] bg-background shadow overflow-hidden outline outline-1",children:[!(e!=null&&e.hideBubble)&&i.jsxs(i.Fragment,{children:[i.jsx(Zn,{editor:d}),i.jsx(qn,{editor:d}),i.jsx(Kn,{editor:d,disabled:e==null?void 0:e.disabled}),i.jsx(Rn,{editor:d,disabled:e==null?void 0:e.disabled}),i.jsx(Vn,{editor:d,disabled:e==null?void 0:e.disabled}),i.jsx(On,{editor:d,disabled:e==null?void 0:e.disabled}),i.jsx(_n,{editor:d,disabled:e==null?void 0:e.disabled})]}),i.jsxs("div",{className:"flex flex-col w-full max-h-full",children:[!(e!=null&&e.hideToolbar)&&i.jsx(Wn,{editor:d,disabled:e==null?void 0:e.disabled}),i.jsx(l.EditorContent,{className:`relative ${(e==null?void 0:e.contentClass)||""}`,editor:d}),i.jsx("div",{className:"flex justify-between border-t p-3 items-center",children:h&&i.jsx("div",{className:"flex flex-col",children:i.jsx("div",{className:"flex justify-end gap-3 text-sm",children:i.jsxs("span",{children:[d.storage.characterCount.characters()," ",s("editor.characters")]})})})})]})]})}):i.jsx(i.Fragment,{})}const eo=f.forwardRef(Qn);exports.BaseKit=vi;exports.Blockquote=oi;exports.Bold=Ke;exports.BulletList=ei;exports.Clear=ti;exports.Code=Xe;exports.CodeBlock=Nt;exports.Color=et;exports.ColumnToolbar=hi;exports.Columns=lt;exports.FontFamily=Ut;exports.FontSize=Xt;exports.FormatPainter=dn;exports.Heading=Kt;exports.Highlight=it;exports.History=ci;exports.HorizontalRule=si;exports.Iframe=An;exports.Image=Oi;exports.ImageUpload=Gi;exports.Indent=Ci;exports.Italic=qe;exports.LineHeight=Mi;exports.Link=at;exports.MoreMark=yi;exports.OrderedList=ii;exports.SlashCommand=Di;exports.Strike=Ge;exports.SubAndSuperScript=wi;exports.Table=rn;exports.TaskList=ni;exports.TextAlign=Wt;exports.Underline=We;exports.Video=Zi;exports.VideoUpload=Ji;exports.default=eo;exports.locale=_t;
|