@openim/im-composer 1.0.2 → 1.0.3

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/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- 'use strict';var react$1=require('react'),react=require('@tiptap/react'),Mi=require('@tiptap/extension-document'),Pi=require('@tiptap/extension-paragraph'),Ri=require('@tiptap/extension-text'),Ti=require('@tiptap/extension-hard-break'),Ei=require('@tiptap/extension-history'),ki=require('@tiptap/extension-placeholder'),core=require('@tiptap/core'),state=require('@tiptap/pm/state'),mi=require('@tiptap/extension-mention'),jsxRuntime=require('react/jsx-runtime'),react$2=require('@floating-ui/react'),starterKit=require('@tiptap/starter-kit'),extensionList=require('@tiptap/extension-list'),extensionTextAlign=require('@tiptap/extension-text-align'),extensionTypography=require('@tiptap/extension-typography'),extensionHighlight=require('@tiptap/extension-highlight'),extensionSubscript=require('@tiptap/extension-subscript'),extensionSuperscript=require('@tiptap/extension-superscript'),extensions=require('@tiptap/extensions'),extensionImage=require('@tiptap/extension-image');require('@tiptap/pm/tables');var Qs=require('@tiptap/extension-horizontal-rule'),B=require('@radix-ui/react-dropdown-menu'),reactHotkeysHook=require('react-hotkeys-hook'),ue=require('@radix-ui/react-popover');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Mi__default=/*#__PURE__*/_interopDefault(Mi);var Pi__default=/*#__PURE__*/_interopDefault(Pi);var Ri__default=/*#__PURE__*/_interopDefault(Ri);var Ti__default=/*#__PURE__*/_interopDefault(Ti);var Ei__default=/*#__PURE__*/_interopDefault(Ei);var ki__default=/*#__PURE__*/_interopDefault(ki);var mi__default=/*#__PURE__*/_interopDefault(mi);var Qs__default=/*#__PURE__*/_interopDefault(Qs);var B__namespace=/*#__PURE__*/_interopNamespace(B);var ue__namespace=/*#__PURE__*/_interopNamespace(ue);var xe={placeholderPlain:"Type a message...",placeholderRich:"Write something...",mentionNoResults:"No results found",mentionLoading:"Loading...",mentionError:"Failed to load",removeAttachment:"Remove",removeQuote:"Remove quote",uploadFailed:"Upload failed",uploading:"Uploading...",undo:"Undo",redo:"Redo",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",paragraph:"Paragraph",list:"List",bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List",blockquote:"Blockquote",codeBlock:"Code Block",bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Code",underline:"Underline",highlight:"Highlight",removeHighlight:"Remove Highlight",link:"Link",linkPlaceholder:"Paste a link...",applyLink:"Apply",openLink:"Open in new window",removeLink:"Remove link",superscript:"Superscript",subscript:"Subscript",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Justify",insertImage:"Insert Image",uploadImage:"Upload Image",clickToUpload:"Click to upload",orDragAndDrop:"or drag and drop",maxFiles:"Maximum {limit} file(s), {size}MB each",clearAll:"Clear All"};var ni=new state.PluginKey("composition"),mn=core.Extension.create({name:"composition",addStorage(){return {isComposing:false}},addProseMirrorPlugins(){let e=this;return [new state.Plugin({key:ni,props:{handleDOMEvents:{compositionstart:()=>(e.storage.isComposing=true,false),compositionend:()=>(e.storage.isComposing=false,false)}}})]}});new state.PluginKey("imKeymap");var fn=core.Extension.create({name:"imKeymap",addOptions(){return {send:"enter",onSend:void 0,isMentionListOpen:()=>false,isUploading:()=>false,isComposing:()=>false}},addStorage(){return {options:this.options}},addKeyboardShortcuts(){let e=()=>{let{send:n}=this.options;return typeof n=="function"?n():n},t=n=>{switch(e()){case "enter":return n.key==="Enter"&&!n.shiftKey&&!n.ctrlKey&&!n.metaKey;case "ctrlEnter":return n.key==="Enter"&&n.ctrlKey;case "cmdEnter":return n.key==="Enter"&&n.metaKey;default:return false}},o=n=>{switch(e()){case "enter":return n.key==="Enter"&&n.shiftKey;case "ctrlEnter":case "cmdEnter":return n.key==="Enter"&&!n.ctrlKey&&!n.metaKey;default:return false}};return {Enter:({editor:n})=>{let r=n.view.dom.ownerDocument.defaultView?.event;if(!r||this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;if(t(r)){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return o(r)?n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]):false},"Shift-Enter":({editor:n})=>{let r=e();return this.options.isComposing?.()?false:r==="enter"?n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]):false},"Mod-Enter":({editor:n})=>{if(this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;let r=e();if(r==="cmdEnter"||r==="ctrlEnter"){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return false},"Ctrl-Enter":()=>{if(this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;if(e()==="ctrlEnter"){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return false}}}});var pi=new state.PluginKey("plainText");function ci(e){let t="",o=true;return e.content.forEach(n=>{n.type.name!=="quote"&&n.type.name==="paragraph"&&(o||(t+=`
1
+ 'use strict';var react$1=require('react'),react=require('@tiptap/react'),Pi=require('@tiptap/extension-document'),Ri=require('@tiptap/extension-paragraph'),Ti=require('@tiptap/extension-text'),Ei=require('@tiptap/extension-hard-break'),ki=require('@tiptap/extension-history'),Si=require('@tiptap/extension-placeholder'),core=require('@tiptap/core'),state=require('@tiptap/pm/state'),fi=require('@tiptap/extension-mention'),jsxRuntime=require('react/jsx-runtime'),react$2=require('@floating-ui/react'),starterKit=require('@tiptap/starter-kit'),extensionList=require('@tiptap/extension-list'),extensionTextAlign=require('@tiptap/extension-text-align'),extensionTypography=require('@tiptap/extension-typography'),extensionHighlight=require('@tiptap/extension-highlight'),extensionSubscript=require('@tiptap/extension-subscript'),extensionSuperscript=require('@tiptap/extension-superscript'),extensions=require('@tiptap/extensions'),extensionImage=require('@tiptap/extension-image');require('@tiptap/pm/tables');var Ys=require('@tiptap/extension-horizontal-rule'),B=require('@radix-ui/react-dropdown-menu'),reactHotkeysHook=require('react-hotkeys-hook'),ue=require('@radix-ui/react-popover');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Pi__default=/*#__PURE__*/_interopDefault(Pi);var Ri__default=/*#__PURE__*/_interopDefault(Ri);var Ti__default=/*#__PURE__*/_interopDefault(Ti);var Ei__default=/*#__PURE__*/_interopDefault(Ei);var ki__default=/*#__PURE__*/_interopDefault(ki);var Si__default=/*#__PURE__*/_interopDefault(Si);var fi__default=/*#__PURE__*/_interopDefault(fi);var Ys__default=/*#__PURE__*/_interopDefault(Ys);var B__namespace=/*#__PURE__*/_interopNamespace(B);var ue__namespace=/*#__PURE__*/_interopNamespace(ue);var xe={placeholderPlain:"Type a message...",placeholderRich:"Write something...",mentionNoResults:"No results found",mentionLoading:"Loading...",mentionError:"Failed to load",removeAttachment:"Remove",removeQuote:"Remove quote",uploadFailed:"Upload failed",uploading:"Uploading...",undo:"Undo",redo:"Redo",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",paragraph:"Paragraph",list:"List",bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List",blockquote:"Blockquote",codeBlock:"Code Block",bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Code",underline:"Underline",highlight:"Highlight",removeHighlight:"Remove Highlight",link:"Link",linkPlaceholder:"Paste a link...",applyLink:"Apply",openLink:"Open in new window",removeLink:"Remove link",superscript:"Superscript",subscript:"Subscript",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Justify",insertImage:"Insert Image",uploadImage:"Upload Image",clickToUpload:"Click to upload",orDragAndDrop:"or drag and drop",maxFiles:"Maximum {limit} file(s), {size}MB each",clearAll:"Clear All"};var ri=new state.PluginKey("composition"),fn=core.Extension.create({name:"composition",addStorage(){return {isComposing:false}},addProseMirrorPlugins(){let e=this;return [new state.Plugin({key:ri,props:{handleDOMEvents:{compositionstart:()=>(e.storage.isComposing=true,false),compositionend:()=>(e.storage.isComposing=false,false)}}})]}});new state.PluginKey("imKeymap");var gn=core.Extension.create({name:"imKeymap",addOptions(){return {send:"enter",onSend:void 0,isMentionListOpen:()=>false,isUploading:()=>false,isComposing:()=>false}},addStorage(){return {options:this.options}},addKeyboardShortcuts(){let e=()=>{let{send:n}=this.options;return typeof n=="function"?n():n},t=n=>{switch(e()){case "enter":return n.key==="Enter"&&!n.shiftKey&&!n.ctrlKey&&!n.metaKey;case "ctrlEnter":return n.key==="Enter"&&n.ctrlKey;case "cmdEnter":return n.key==="Enter"&&n.metaKey;default:return false}},o=n=>{switch(e()){case "enter":return n.key==="Enter"&&n.shiftKey;case "ctrlEnter":case "cmdEnter":return n.key==="Enter"&&!n.ctrlKey&&!n.metaKey;default:return false}};return {Enter:({editor:n})=>{let r=n.view.dom.ownerDocument.defaultView?.event;if(!r||this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;if(t(r)){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return o(r)?n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]):false},"Shift-Enter":({editor:n})=>{let r=e();return this.options.isComposing?.()?false:r==="enter"?n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]):false},"Mod-Enter":({editor:n})=>{if(this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;let r=e();if(r==="cmdEnter"||r==="ctrlEnter"){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return false},"Ctrl-Enter":()=>{if(this.options.isComposing?.()||this.options.isMentionListOpen?.())return false;if(e()==="ctrlEnter"){if(this.options.isUploading?.())return true;if(this.options.onSend)return this.options.onSend(),true}return false}}}});var ci=new state.PluginKey("plainText");function di(e){let t="",o=true;return e.content.forEach(n=>{n.type.name!=="quote"&&n.type.name==="paragraph"&&(o||(t+=`
2
2
  `),o=false,n.content?.forEach(r=>{r.isText?t+=r.text||"":r.type.name==="mention"?t+=`@${r.attrs.display||r.attrs.userId}`:r.type.name==="hardBreak"&&(t+=`
3
- `);}));}),t}var gn=core.Extension.create({name:"plainText",addOptions(){return {onPasteFiles:void 0}},addProseMirrorPlugins(){let e=this;return [new state.Plugin({key:pi,props:{handlePaste:(t,o)=>{let n=o.clipboardData;if(!n)return false;let r=Array.from(n.files);if(r.length>0)return o.preventDefault(),e.options.onPasteFiles?.(r),true;let i=n.getData("text/plain");if(i){o.preventDefault();let{state:a,dispatch:s}=t,{tr:l,schema:c}=a,d=i.split(/\r?\n/),p=[];if(d.forEach((m,f)=>{f>0&&p.push(c.nodes.hardBreak?.create()||c.text(`
4
- `)),m&&p.push(c.text(m));}),p.length>0){let m=a.schema.nodes.doc.create(null,a.schema.nodes.paragraph.create(null,p)),f=m.slice(1,m.content.size-1);s(l.replaceSelection(f));}return true}return false},handleDrop:(t,o)=>{let n=o.dataTransfer;if(!n)return false;let r=Array.from(n.files);return r.length>0?(o.preventDefault(),e.options.onPasteFiles?.(r),true):false},clipboardTextSerializer:t=>ci(t)}})]}});var fi=new state.PluginKey("mentionSuggestion");core.Node.create({name:"mention",addOptions(){return {HTMLAttributes:{},renderLabel:({node:e})=>`@${e.attrs.display}`,suggestion:{}}},group:"inline",inline:true,selectable:false,atom:true,addAttributes(){return {userId:{default:null,parseHTML:e=>e.getAttribute("data-user-id"),renderHTML:e=>({"data-user-id":e.userId})},display:{default:null,parseHTML:e=>e.getAttribute("data-display"),renderHTML:e=>({"data-display":e.display})}}},parseHTML(){return [{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){return ["span",core.mergeAttributes({"data-type":this.name,class:"im-mention"},this.options.HTMLAttributes,t),`@${e.attrs.display}`]},renderText({node:e}){return `@${e.attrs.userId}`},addKeyboardShortcuts(){return {Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=false,{selection:n}=t,{empty:r,anchor:i}=n;return r?(t.doc.nodesBetween(i-1,i,(a,s)=>a.type.name===this.name?(o=true,e.insertText("",s,s+a.nodeSize),false):true),o):false})}}});function Cn(e){let t={active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null},o=n=>{t={...t,...n},e.onMentionStateChange?.(t);};return mi__default.default.extend({name:"mention",addOptions(){return {...this.parent?.(),suggestion:{char:"@",pluginKey:fi,items:async({query:n})=>{if(!e.mentionProvider)return [];o({loading:true,error:false,query:n});try{let r=await e.mentionProvider(n);return o({items:r,loading:!1}),r}catch{return o({error:true,loading:false,items:[]}),[]}},render:()=>({onStart:n=>{let r=i=>{n.command({userId:i.userId,display:i.display});};o({active:true,query:n.query,selectedIndex:0,command:r});},onUpdate:n=>{let r=i=>{n.command({userId:i.userId,display:i.display});};o({query:n.query,selectedIndex:0,command:r});},onKeyDown:n=>{let{event:r}=n;if(e.isComposing?.()||r.isComposing)return false;if(r.key==="ArrowUp")return o({selectedIndex:(t.selectedIndex-1+t.items.length)%t.items.length}),true;if(r.key==="ArrowDown")return o({selectedIndex:(t.selectedIndex+1)%t.items.length}),true;if(r.key==="Enter"){let i=t.items[t.selectedIndex];return i&&t.command&&t.command({userId:i.userId,display:i.display}),true}return r.key==="Escape"?(o({active:false,command:null}),true):false},onExit:()=>{o({active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null});}}),command:({editor:n,range:r,props:i})=>{if(e.maxMentions){let a=0;if(n.state.doc.descendants(s=>{s.type.name==="mention"&&a++;}),a>=e.maxMentions)return}n.chain().focus().insertContentAt(r,[{type:"mention",attrs:{userId:i.userId,display:i.display}}]).run();}}}},addAttributes(){return {userId:{default:null,parseHTML:n=>n.getAttribute("data-user-id"),renderHTML:n=>({"data-user-id":n.userId})},display:{default:null,parseHTML:n=>n.getAttribute("data-display"),renderHTML:n=>({"data-display":n.display})}}},parseHTML(){return [{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:r}){return ["span",core.mergeAttributes({"data-type":this.name,class:"im-mention"},r),`@${n.attrs.display}`]}})}function vn({node:e,editor:t,selected:o}){let{title:n,content:r}=e.attrs;return jsxRuntime.jsxs(react.NodeViewWrapper,{className:`im-quote-node ${o?"im-quote-node--selected":""}`,"data-type":"quote",children:[jsxRuntime.jsxs("div",{className:"im-quote-node__content",children:[jsxRuntime.jsx("span",{className:"im-quote-node__title",children:n}),jsxRuntime.jsx("span",{className:"im-quote-node__text",children:r})]}),jsxRuntime.jsx("button",{type:"button",className:"im-quote-node__remove-btn",onClick:a=>{a.preventDefault(),a.stopPropagation(),t.commands.removeQuote();},contentEditable:false,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})})]})}var bn=core.Node.create({name:"quote",addOptions(){return {onQuoteRemoved:void 0,removeLabel:"Remove quote"}},group:"block",atom:true,selectable:true,draggable:false,addAttributes(){return {title:{default:"",parseHTML:e=>e.getAttribute("data-title"),renderHTML:e=>({"data-title":e.title})},content:{default:"",parseHTML:e=>e.getAttribute("data-content"),renderHTML:e=>({"data-content":e.content})}}},parseHTML(){return [{tag:'div[data-type="quote"]'}]},renderHTML({HTMLAttributes:e}){return ["div",core.mergeAttributes({"data-type":"quote",class:"im-quote-node"},e)]},addNodeView(){return react.ReactNodeViewRenderer(vn)},addCommands(){return {insertQuote:(e,t)=>({tr:o,dispatch:n})=>{if(n){let r=this.type.create({title:e,content:t}),i=o.doc.firstChild;i?.type.name==="quote"?o.replaceWith(0,i.nodeSize,r):o.insert(0,r);}return true},removeQuote:()=>({tr:e,dispatch:t,state:o})=>{if(t){let n=o.doc.firstChild;n?.type.name==="quote"&&(e.delete(0,n.nodeSize),this.options.onQuoteRemoved?.());}return true}}},addKeyboardShortcuts(){return {Backspace:({editor:e})=>{let{selection:t}=e.state,{$anchor:o,empty:n}=t,r=e.state.doc.firstChild;if(r?.type.name==="quote"){let i=r.nodeSize;if(n&&o.pos===i+1||e.state.doc.nodeAt(t.from)?.type.name==="quote")return e.commands.removeQuote(),true}return false},Delete:({editor:e})=>{let{selection:t}=e.state;return e.state.doc.nodeAt(t.from)?.type.name==="quote"?(e.commands.removeQuote(),true):false}}}});function nt(e){let t=[],o="",n=e.state.doc,r=false;return n.descendants((i,a)=>{if(i.type.name==="mention"){let s=i.attrs.userId,l=i.attrs.display,c=o.length,d=`@${s}`;o+=d;let p=o.length;return t.push({userId:s,display:l,start:c,end:p}),r=true,false}if(i.isText){let s=i.text||"";return r&&s.length>0&&!s.startsWith(" ")&&(o+=" "),o+=s,r=false,false}return i.type.name==="hardBreak"?(r&&(o+=" "),o+=`
3
+ `);}));}),t}var hn=core.Extension.create({name:"plainText",addOptions(){return {onPasteFiles:void 0}},addProseMirrorPlugins(){let e=this;return [new state.Plugin({key:ci,props:{handlePaste:(t,o)=>{let n=o.clipboardData;if(!n)return false;let r=Array.from(n.files);if(r.length>0)return o.preventDefault(),e.options.onPasteFiles?.(r),true;let i=n.getData("text/plain");if(i){o.preventDefault();let{state:a,dispatch:s}=t,{tr:l,schema:c}=a,d=i.split(/\r?\n/),p=[];if(d.forEach((m,f)=>{f>0&&p.push(c.nodes.hardBreak?.create()||c.text(`
4
+ `)),m&&p.push(c.text(m));}),p.length>0){let m=a.schema.nodes.doc.create(null,a.schema.nodes.paragraph.create(null,p)),f=m.slice(1,m.content.size-1);s(l.replaceSelection(f));}return true}return false},handleDrop:(t,o)=>{let n=o.dataTransfer;if(!n)return false;let r=Array.from(n.files);return r.length>0?(o.preventDefault(),e.options.onPasteFiles?.(r),true):false},clipboardTextSerializer:t=>di(t)}})]}});var gi=new state.PluginKey("mentionSuggestion");core.Node.create({name:"mention",addOptions(){return {HTMLAttributes:{},renderLabel:({node:e})=>`@${e.attrs.display}`,suggestion:{}}},group:"inline",inline:true,selectable:false,atom:true,addAttributes(){return {userId:{default:null,parseHTML:e=>e.getAttribute("data-user-id"),renderHTML:e=>({"data-user-id":e.userId})},display:{default:null,parseHTML:e=>e.getAttribute("data-display"),renderHTML:e=>({"data-display":e.display})}}},parseHTML(){return [{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){return ["span",core.mergeAttributes({"data-type":this.name,class:"im-mention"},this.options.HTMLAttributes,t),`@${e.attrs.display}`]},renderText({node:e}){return `@${e.attrs.userId}`},addKeyboardShortcuts(){return {Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=false,{selection:n}=t,{empty:r,anchor:i}=n;return r?(t.doc.nodesBetween(i-1,i,(a,s)=>a.type.name===this.name?(o=true,e.insertText("",s,s+a.nodeSize),false):true),o):false})}}});function vn(e){let t={active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null},o=n=>{t={...t,...n},e.onMentionStateChange?.(t);};return fi__default.default.extend({name:"mention",addOptions(){return {...this.parent?.(),suggestion:{char:"@",pluginKey:gi,items:async({query:n})=>{if(!e.mentionProvider)return [];o({loading:true,error:false,query:n});try{let r=await e.mentionProvider(n);return o({items:r,loading:!1}),r}catch{return o({error:true,loading:false,items:[]}),[]}},render:()=>({onStart:n=>{let r=i=>{n.command({userId:i.userId,display:i.display});};o({active:true,query:n.query,selectedIndex:0,command:r});},onUpdate:n=>{let r=i=>{n.command({userId:i.userId,display:i.display});};o({query:n.query,selectedIndex:0,command:r});},onKeyDown:n=>{let{event:r}=n;if(e.isComposing?.()||r.isComposing)return false;if(r.key==="ArrowUp")return o({selectedIndex:(t.selectedIndex-1+t.items.length)%t.items.length}),true;if(r.key==="ArrowDown")return o({selectedIndex:(t.selectedIndex+1)%t.items.length}),true;if(r.key==="Enter"){let i=t.items[t.selectedIndex];return i&&t.command&&t.command({userId:i.userId,display:i.display}),true}return r.key==="Escape"?(o({active:false,command:null}),true):false},onExit:()=>{o({active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null});}}),command:({editor:n,range:r,props:i})=>{if(e.maxMentions){let a=0;if(n.state.doc.descendants(s=>{s.type.name==="mention"&&a++;}),a>=e.maxMentions)return}n.chain().focus().insertContentAt(r,[{type:"mention",attrs:{userId:i.userId,display:i.display}}]).run();}}}},addAttributes(){return {userId:{default:null,parseHTML:n=>n.getAttribute("data-user-id"),renderHTML:n=>({"data-user-id":n.userId})},display:{default:null,parseHTML:n=>n.getAttribute("data-display"),renderHTML:n=>({"data-display":n.display})}}},parseHTML(){return [{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:r}){return ["span",core.mergeAttributes({"data-type":this.name,class:"im-mention"},r),`@${n.attrs.display}`]}})}function bn({node:e,editor:t,selected:o}){let{title:n,content:r}=e.attrs;return jsxRuntime.jsxs(react.NodeViewWrapper,{className:`im-quote-node ${o?"im-quote-node--selected":""}`,"data-type":"quote",children:[jsxRuntime.jsxs("div",{className:"im-quote-node__content",children:[jsxRuntime.jsx("span",{className:"im-quote-node__title",children:n}),jsxRuntime.jsx("span",{className:"im-quote-node__text",children:r})]}),jsxRuntime.jsx("button",{type:"button",className:"im-quote-node__remove-btn",onClick:a=>{a.preventDefault(),a.stopPropagation(),t.commands.removeQuote();},contentEditable:false,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})})]})}var yn=core.Node.create({name:"quote",addOptions(){return {onQuoteRemoved:void 0,removeLabel:"Remove quote"}},group:"block",atom:true,selectable:true,draggable:false,addAttributes(){return {title:{default:"",parseHTML:e=>e.getAttribute("data-title"),renderHTML:e=>({"data-title":e.title})},content:{default:"",parseHTML:e=>e.getAttribute("data-content"),renderHTML:e=>({"data-content":e.content})}}},parseHTML(){return [{tag:'div[data-type="quote"]'}]},renderHTML({HTMLAttributes:e}){return ["div",core.mergeAttributes({"data-type":"quote",class:"im-quote-node"},e)]},addNodeView(){return react.ReactNodeViewRenderer(bn)},addCommands(){return {insertQuote:(e,t)=>({tr:o,dispatch:n})=>{if(n){let r=this.type.create({title:e,content:t}),i=o.doc.firstChild;i?.type.name==="quote"?o.replaceWith(0,i.nodeSize,r):o.insert(0,r);}return true},removeQuote:()=>({tr:e,dispatch:t,state:o})=>{if(t){let n=o.doc.firstChild;n?.type.name==="quote"&&(e.delete(0,n.nodeSize),this.options.onQuoteRemoved?.());}return true}}},addKeyboardShortcuts(){return {Backspace:({editor:e})=>{let{selection:t}=e.state,{$anchor:o,empty:n}=t,r=e.state.doc.firstChild;if(r?.type.name==="quote"){let i=r.nodeSize;if(n&&o.pos===i+1||e.state.doc.nodeAt(t.from)?.type.name==="quote")return e.commands.removeQuote(),true}return false},Delete:({editor:e})=>{let{selection:t}=e.state;return e.state.doc.nodeAt(t.from)?.type.name==="quote"?(e.commands.removeQuote(),true):false}}}});function nt(e){let t=[],o="",n=e.state.doc,r=false;return n.descendants((i,a)=>{if(i.type.name==="mention"){let s=i.attrs.userId,l=i.attrs.display,c=o.length,d=`@${s}`;o+=d;let p=o.length;return t.push({userId:s,display:l,start:c,end:p}),r=true,false}if(i.isText){let s=i.text||"";return r&&s.length>0&&!s.startsWith(" ")&&(o+=" "),o+=s,r=false,false}return i.type.name==="hardBreak"?(r&&(o+=" "),o+=`
5
5
  `,r=false,false):(i.type.name==="paragraph"&&(o.length>0&&(r&&(o+=" "),o.endsWith(`
6
6
  `)||(o+=`
7
- `)),r=false),true)}),r&&(o+=" "),{plainText:o.trim(),mentions:t}}function bi(e){return e.length}function yi(e,t){for(let o of t){if(o.start<0||o.end>e.length||o.start>=o.end)return false;let n=e.slice(o.start,o.end),r=`@${o.userId}`;if(n!==r)return false}return true}function xi(e,t,o){let n=`@${e}`;return {userId:e,display:t,start:o,end:o+bi(n)}}function Rt(e){if(!e)return;let t=e.state.doc.firstChild;if(t?.type.name==="quote")return {title:t.attrs.title,content:t.attrs.content}}function Tt(e={}){let{placeholder:t="Type a message...",sendKeymap:o="enter",onSend:n,enableMention:r=true,mentionProvider:i,maxMentions:a,onMentionStateChange:s,onPasteFiles:l,isUploading:c=()=>false,disabled:d=false,onChange:p,onQuoteRemoved:m}=e,f=react$1.useRef(false),h=react$1.useRef(false),u=react$1.useRef(o),g=react$1.useRef(n);u.current=o,g.current=n;let v=react$1.useCallback(R=>{f.current=R.active,s?.(R);},[s]),b=react$1.useMemo(()=>{let R=[Mi__default.default,Pi__default.default,Ri__default.default,Ti__default.default,Ei__default.default,ki__default.default.configure({placeholder:t}),mn.configure({}),gn.configure({onPasteFiles:l}),fn.configure({send:()=>u.current,onSend:()=>g.current?.(),isMentionListOpen:()=>f.current,isUploading:c,isComposing:()=>h.current}),bn.configure({onQuoteRemoved:m})];return r&&R.push(Cn({mentionProvider:i,maxMentions:a,onMentionStateChange:v,isComposing:()=>h.current})),R},[t,r,i,a,v,l,c,m]),C=react.useEditor({extensions:b,editable:!d,onUpdate:()=>{p?.();},onCreate:({editor:R})=>{let H=R.view.dom;H.addEventListener("compositionstart",()=>{h.current=true;}),H.addEventListener("compositionend",()=>{h.current=false;});}}),w=react$1.useCallback(()=>h.current,[]),L=react$1.useCallback(()=>f.current,[]),T=react$1.useCallback(R=>{if(!C)return null;let{plainText:O,mentions:H}=nt(C),fe=Rt(C);return !O.trim()&&R.length===0?null:{type:"text",plainText:O,mentions:H,attachments:R,quote:fe}},[C]),E=react$1.useCallback(R=>{if(!C)return {mode:"plain"};let{plainText:O}=nt(C),H=Rt(C);return !O.trim()&&!H&&R.length===0?{mode:"plain"}:{mode:"plain",editorState:JSON.stringify(C.getJSON()),attachments:R,text:O,quote:H}},[C]),me=react$1.useCallback(R=>{if(C)try{if(R.json)C.commands.setContent(R.json);else if(R.editorState){let O=JSON.parse(R.editorState);C.commands.setContent(O);}}catch(O){console.error("Failed to restore draft:",O);}},[C]),Y=react$1.useCallback((R,O)=>{C&&C.chain().focus().insertContent([{type:"mention",attrs:{userId:R,display:O}},{type:"text",text:" "}]).run();},[C]),re=react$1.useCallback((R,O)=>{C&&queueMicrotask(()=>{C.commands.insertQuote(R,O);});},[C]),q=react$1.useCallback(()=>{C&&C.commands.removeQuote();},[C]),Ie=react$1.useCallback(()=>Rt(C),[C]),ie=react$1.useCallback(R=>{C&&C.commands.setContent({type:"doc",content:[{type:"paragraph",content:R?[{type:"text",text:R}]:[]}]});},[C]),z=react$1.useCallback(R=>{C&&C.commands.insertContent(R);},[C]),ye=react$1.useCallback(()=>{C&&C.commands.clearContent();},[C]),He=react$1.useCallback(()=>{C&&C.commands.focus();},[C]);return {editor:C,isComposing:w,isMentionListOpen:L,exportPayload:T,getDraft:E,setDraft:me,insertMention:Y,insertQuote:re,removeQuote:q,getQuote:Ie,setText:ie,insertText:z,clear:ye,focus:He}}function Si(){return `att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function Et(e){let t=e.type.startsWith("image/");return {id:Si(),file:e,name:e.name,size:e.size,mime:e.type,lastModified:e.lastModified,previewUrl:t?URL.createObjectURL(e):void 0}}function it(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl);}function Ne(e){e.forEach(it);}function Ii(e,t){if(t==="*/*"||t==="*")return true;if(t.endsWith("/*")){let o=t.slice(0,-2);return e.startsWith(o+"/")}return e===t}function Hi(e,t){return !t||t.length===0?true:t.some(o=>Ii(e,o))}function kt(e,t,o){return o.maxAttachments!==void 0&&t>=o.maxAttachments?"count":o.maxFileSize!==void 0&&e.size>o.maxFileSize?"size":Hi(e.type,o.allowedMimeTypes)?null:"mime"}function St(e){if(e===0)return "0 B";let t=1024,o=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return `${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${o[n]}`}function It(e={}){let{maxAttachments:t=10,maxFileSize:o,allowedMimeTypes:n,onLimitExceeded:r,onChange:i}=e,[a,s]=react$1.useState([]),l=react$1.useRef([]);react$1.useEffect(()=>{l.current=a;},[a]),react$1.useEffect(()=>()=>{Ne(l.current);},[]);let c=react$1.useCallback(h=>{let u=Array.from(h),g=l.current,v=[],b=g.length;for(let C of u){let w=kt(C,b,{maxAttachments:t,maxFileSize:o,allowedMimeTypes:n});if(w){r?.(w,C);continue}let L=Et(C);v.push(L),b++;}if(v.length>0){let C=[...g,...v];s(C),i?.(C);}},[t,o,n,r,i]),d=react$1.useCallback(h=>{let u=l.current.find(v=>v.id===h);u&&it(u);let g=l.current.filter(v=>v.id!==h);s(g),i?.(g);},[i]),p=react$1.useCallback(()=>{Ne(l.current),s([]),i?.([]);},[i]),m=react$1.useCallback(h=>{let u=new Set(h.map(b=>b.id)),g=l.current.filter(b=>!u.has(b.id));Ne(g);let v=h.map(b=>b.file&&b.mime.startsWith("image/")?{...b,previewUrl:URL.createObjectURL(b.file)}:b);s(v),i?.(v);},[i]),f=react$1.useCallback(()=>l.current,[]);return {attachments:a,addFiles:c,removeAttachment:d,clearAttachments:p,setAttachments:m,getAttachments:f}}function Ht({items:e,selectedIndex:t,loading:o,error:n,onSelect:r,onHover:i,renderItem:a,locale:s={}}){let{noResults:l="No results found",loading:c="Loading...",error:d="Failed to load"}=s,p=react$1.useRef(null),m=react$1.useRef([]);return react$1.useEffect(()=>{let f=m.current[t];f&&p.current&&typeof f.scrollIntoView=="function"&&f.scrollIntoView({block:"nearest",inline:"nearest"});},[t]),react$1.useEffect(()=>{m.current=m.current.slice(0,e.length);},[e.length]),o?jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:jsxRuntime.jsx("div",{className:"im-mention-list__status",children:c})}):n?jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:jsxRuntime.jsx("div",{className:"im-mention-list__status",children:d})}):e.length===0?null:jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:e.map((f,h)=>{let u=h===t;return a?jsxRuntime.jsx("div",{ref:g=>{m.current[h]=g;},className:`im-mention-list__item ${u?"im-mention-list__item--selected":""}`,onClick:()=>r(f),onMouseEnter:()=>i(h),children:a({member:f,isSelected:u})},f.userId):jsxRuntime.jsxs("div",{ref:g=>{m.current[h]=g;},className:`im-mention-list__item ${u?"im-mention-list__item--selected":""}`,onClick:()=>r(f),onMouseEnter:()=>i(h),children:[f.avatarUrl&&jsxRuntime.jsx("img",{src:f.avatarUrl,alt:f.display,className:"im-mention-list__avatar"}),jsxRuntime.jsx("span",{className:"im-mention-list__display",children:f.display})]},f.userId)})})}function Zi(e){if(!e||!e.view)return null;try{let{state:t}=e.view,{from:o}=t.selection,n=e.view.coordsAtPos(o);return new DOMRect(n.left,n.top,1,n.bottom-n.top)}catch{return null}}function Pn({mentionState:e,editor:t,placement:o="bottom",portalContainer:n,zIndex:r=9999,onSelect:i,onHover:a,renderItem:s,locale:l}){let[c,d]=react$1.useState(false),p=react$1.useRef(null),m=o==="top"?"top-start":"bottom-start",f=o==="top"?["bottom-start","top-end","bottom-end"]:["top-start","bottom-end","top-end"],h=react$1.useRef({getBoundingClientRect:()=>p.current||new DOMRect(0,0,0,0)}).current,{refs:u,floatingStyles:g,update:v}=react$2.useFloating({open:e.active&&c,placement:m,middleware:[react$2.offset(4),react$2.flip({fallbackPlacements:f}),react$2.shift({padding:8}),react$2.size({apply({availableHeight:b,elements:C}){Object.assign(C.floating.style,{maxHeight:`${Math.min(b-16,300)}px`});},padding:8})],whileElementsMounted:react$2.autoUpdate});return react$1.useEffect(()=>{u.setReference(h);},[u,h]),react$1.useLayoutEffect(()=>{if(e.active&&t){let b=requestAnimationFrame(()=>{let C=Zi(t);C&&(p.current=C,d(true),v?.());});return ()=>cancelAnimationFrame(b)}else p.current=null,d(false);},[e.active,e.query,t,v]),react$1.useEffect(()=>{e.active&&c&&v&&v();},[e.items,e.loading,v,e.active,c]),!e.active||!c?null:jsxRuntime.jsx(react$2.FloatingPortal,{root:n,children:jsxRuntime.jsx("div",{ref:u.setFloating,style:{...g,zIndex:r},className:"im-mention-popover",children:jsxRuntime.jsx(Ht,{items:e.items,selectedIndex:e.selectedIndex,loading:e.loading,error:e.error,onSelect:i,onHover:a,renderItem:s,locale:l})})})}function at({attachments:e,onRemove:t,placement:o="bottom",removeLabel:n="Remove"}){return e.length===0?null:jsxRuntime.jsx("div",{className:`im-attachment-preview im-attachment-preview--${o}`,children:e.map(r=>jsxRuntime.jsxs("div",{className:"im-attachment-preview__item",children:[r.previewUrl?jsxRuntime.jsx("img",{src:r.previewUrl,alt:r.name,className:"im-attachment-preview__thumbnail"}):jsxRuntime.jsx("div",{className:"im-attachment-preview__file-icon",children:jsxRuntime.jsx(qi,{})}),jsxRuntime.jsxs("div",{className:"im-attachment-preview__info",children:[jsxRuntime.jsx("span",{className:"im-attachment-preview__name",title:r.name,children:r.name}),jsxRuntime.jsx("span",{className:"im-attachment-preview__size",children:St(r.size)})]}),jsxRuntime.jsx("button",{type:"button",className:"im-attachment-preview__remove-btn",onClick:()=>t(r.id),"aria-label":n,children:jsxRuntime.jsx($i,{})})]},r.id))})}function qi(){return jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function $i(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}function Rn({orientation:e="horizontal",size:t,style:o={},...n}){let r={...o,...e==="horizontal"&&!t&&{flex:1},...t&&{width:e==="vertical"?"1px":t,height:e==="horizontal"?"1px":t}};return jsxRuntime.jsx("div",{...n,style:r})}var lt=5*1024*1024,Ji={mod:"\u2318",command:"\u2318",meta:"\u2318",ctrl:"\u2303",control:"\u2303",alt:"\u2325",option:"\u2325",shift:"\u21E7",backspace:"Del",delete:"\u2326",enter:"\u23CE",escape:"\u238B",capslock:"\u21EA"};function S(...e){return e.filter(Boolean).join(" ")}function Xi(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}var ji=(e,t,o=true)=>{if(t){let n=e.toLowerCase();return Ji[n]||(o?e.toUpperCase():e)}return o?e.charAt(0).toUpperCase()+e.slice(1):e},I=e=>{let{shortcutKeys:t,delimiter:o="+",capitalize:n=true}=e;return t?t.split(o).map(r=>r.trim()).map(r=>ji(r,Xi(),n)):[]},ae=(e,t)=>t?.schema?t.schema.spec.marks.get(e)!==void 0:false,_=(e,t)=>t?.schema?t.schema.spec.nodes.get(e)!==void 0:false;function pt(e){let{state:t,view:o}=e,{doc:n,selection:r}=t,i=state.Selection.findFrom(r.$to,1,true);if(i)return o.dispatch(t.tr.setSelection(i).scrollIntoView()),true;let a=t.schema.nodes.paragraph;if(!a)return console.warn("No paragraph node type found in schema."),false;let s=n.content.size,l=a.create(),c=t.tr.insert(s,l),d=c.doc.resolve(s+1);return c=c.setSelection(state.TextSelection.near(d)).scrollIntoView(),o.dispatch(c),true}function G(e){return typeof e=="number"&&e>=0}function J(e,t){if(!e)return false;let o=Array.isArray(t)?t:[t],n=o.some(r=>e.extensionManager.extensions.some(i=>i.name===r));return n||console.warn(`None of the extensions [${o.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),n}function es(e,t){try{let o=e.state.doc.nodeAt(t);return o||(console.warn(`No node found at position ${t}`),null)}catch(o){return console.error(`Error getting node at position ${t}:`,o),null}}function le(e){let{editor:t,node:o,nodePos:n}=e;if(!t||!t.state?.doc)return null;let r=o!=null,i=G(n);if(!r&&!i)return null;if(r){let a=-1,s=null;if(t.state.doc.descendants((l,c)=>l===o?(a=c,s=l,false):true),a!==-1&&s!==null)return {pos:a,node:s}}if(i){let a=es(t,n);if(a)return {pos:n,node:a}}return null}function D(e,t=[],o=false){if(!e||!e.state.selection)return false;let{selection:n}=e.state;if(n.empty)return false;if(n instanceof state.NodeSelection){let r=n.node;return r?t.includes(r.type.name):false}if(o){let{$from:r}=n;for(let i=r.depth;i>0;i--){let a=r.node(i);if(t.includes(a.type.name))return true}}return false}function pe(e,t=[]){if(!e||t.length===0)return false;let{state:o}=e,{selection:n}=o,r=new Set(t);if(n instanceof state.NodeSelection){let i=n.node?.type?.name;return !!i&&r.has(i)}if(n instanceof state.TextSelection||n instanceof state.AllSelection){let i=true;return o.doc.nodesBetween(n.from,n.to,a=>a.isTextblock&&!r.has(a.type.name)?(i=false,false):i),i}return false}var ts=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function os(e,t){let o=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return !e||e.replace(ts,"").match(new RegExp(`^(?:(?:${o.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function kn(e,t,o){try{let n=new URL(e,t);if(os(n.href,o))return n.href}catch{}return "#"}var he=react$1.forwardRef(({decorative:e,orientation:t="vertical",className:o,...n},r)=>{let a=e?{role:"none"}:{"aria-orientation":t==="vertical"?t:void 0,role:"separator"};return jsxRuntime.jsx("div",{className:S("tiptap-separator",o),"data-orientation":t,...a,...n,ref:r})});he.displayName="Separator";function ct({editor:e,containerRef:t,query:o,items:n,onSelect:r,onClose:i,orientation:a="vertical",autoSelectFirstItem:s=true}){let[l,c]=react$1.useState(s?0:-1);return react$1.useEffect(()=>{let d=m=>{if(!n.length)return false;let f=()=>c(u=>u===-1?0:(u+1)%n.length),h=()=>c(u=>u===-1?n.length-1:(u-1+n.length)%n.length);switch(m.key){case "ArrowUp":return a==="horizontal"?false:(m.preventDefault(),h(),true);case "ArrowDown":return a==="horizontal"?false:(m.preventDefault(),f(),true);case "ArrowLeft":return a==="vertical"?false:(m.preventDefault(),h(),true);case "ArrowRight":return a==="vertical"?false:(m.preventDefault(),f(),true);case "Tab":return m.preventDefault(),m.shiftKey?h():f(),true;case "Home":return m.preventDefault(),c(0),true;case "End":return m.preventDefault(),c(n.length-1),true;case "Enter":return m.isComposing?false:(m.preventDefault(),l!==-1&&n[l]&&r?.(n[l]),true);case "Escape":return m.preventDefault(),i?.(),true;default:return false}},p=null;if(e?p=e.view.dom:t?.current&&(p=t.current),p)return p.addEventListener("keydown",d,true),()=>{p?.removeEventListener("keydown",d,true);}},[e,t,n,l,r,i,a]),react$1.useEffect(()=>{o&&c(s?0:-1);},[o,s]),{selectedIndex:n.length?l:void 0,setSelectedIndex:c}}var In=(e,t)=>{typeof e=="function"?e(t):e&&typeof e=="object"&&"current"in e&&(e.current=t);},Hn=(e,t)=>{let o=react$1.useRef(null);return react$1.useCallback(n=>{e&&"current"in e&&(e.current=n),o.current&&In(o.current,null),o.current=t,t&&In(t,n);},[e,t])};var ds=e=>{let[t,o]=react$1.useState([]),n=react$1.useCallback(()=>e.current?Array.from(e.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[e]);react$1.useEffect(()=>{let i=e.current;if(!i)return;let a=()=>o(n());a();let s=new MutationObserver(a);return s.observe(i,{childList:true,subtree:true}),()=>s.disconnect()},[n,e]);let{selectedIndex:r}=ct({containerRef:e,items:t,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:false});react$1.useEffect(()=>{let i=e.current;if(!i)return;let a=l=>{let c=l.target;i.contains(c)&&c.setAttribute("data-focus-visible","true");},s=l=>{let c=l.target;i.contains(c)&&c.removeAttribute("data-focus-visible");};return i.addEventListener("focus",a,true),i.addEventListener("blur",s,true),()=>{i.removeEventListener("focus",a,true),i.removeEventListener("blur",s,true);}},[e]),react$1.useEffect(()=>{r!==void 0&&t[r]&&t[r].focus();},[r,t]);},Ut=react$1.forwardRef(({children:e,className:t,variant:o="fixed",...n},r)=>{let i=react$1.useRef(null),a=Hn(i,r);return ds(i),jsxRuntime.jsx("div",{ref:a,role:"toolbar","aria-label":"toolbar","data-variant":o,className:S("tiptap-toolbar",t),...n,children:e})});Ut.displayName="Toolbar";var ce=react$1.forwardRef(({children:e,className:t,...o},n)=>jsxRuntime.jsx("div",{ref:n,role:"group",className:S("tiptap-toolbar-group",t),...o,children:e}));ce.displayName="ToolbarGroup";var Ce=react$1.forwardRef(({...e},t)=>jsxRuntime.jsx(he,{ref:t,orientation:"vertical",decorative:true,...e}));Ce.displayName="ToolbarSeparator";function Ss({initialOpen:e=false,placement:t="top",open:o,onOpenChange:n,delay:r=600,closeDelay:i=0}={}){let[a,s]=react$1.useState(e),l=o??a,c=n??s,d=react$2.useFloating({placement:t,open:l,onOpenChange:c,whileElementsMounted:react$2.autoUpdate,middleware:[react$2.offset(4),react$2.flip({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:4}),react$2.shift({padding:4})]}),p=d.context,m=react$2.useHover(p,{mouseOnly:true,move:false,restMs:r,enabled:o==null,delay:{close:i}}),f=react$2.useFocus(p,{enabled:o==null}),h=react$2.useDismiss(p),u=react$2.useRole(p,{role:"tooltip"}),g=react$2.useInteractions([m,f,h,u]);return react$1.useMemo(()=>({open:l,setOpen:c,...g,...d}),[l,c,g,d])}var Ot=react$1.createContext(null);function Un(){let e=react$1.useContext(Ot);if(e==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return e}function Vt({children:e,...t}){let o=Ss(t);return t.useDelayGroup?jsxRuntime.jsx(react$2.FloatingDelayGroup,{delay:{open:t.delay??0,close:t.closeDelay??0},timeoutMs:t.timeout,children:jsxRuntime.jsx(Ot.Provider,{value:o,children:e})}):jsxRuntime.jsx(Ot.Provider,{value:o,children:e})}var Ft=react$1.forwardRef(function({children:t,asChild:o=false,...n},r){let i=Un(),a=react$1.isValidElement(t)?parseInt(react$1.version,10)>=19?t.props.ref:t.ref:void 0,s=react$2.useMergeRefs([i.refs.setReference,r,a]);if(o&&react$1.isValidElement(t)){let l={"data-tooltip-state":i.open?"open":"closed"};return react$1.cloneElement(t,i.getReferenceProps({ref:s,...n,...typeof t.props=="object"?t.props:{},...l}))}return jsxRuntime.jsx("button",{ref:s,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(n),children:t})}),Kt=react$1.forwardRef(function({style:t,children:o,portal:n=true,portalProps:r={},...i},a){let s=Un(),l=react$2.useMergeRefs([s.refs.setFloating,a]);if(!s.open)return null;let c=jsxRuntime.jsx("div",{ref:l,style:{...s.floatingStyles,...t},...s.getFloatingProps(i),className:"tiptap-tooltip",children:o});return n?jsxRuntime.jsx(react$2.FloatingPortal,{...r,children:c}):c});Vt.displayName="Tooltip";Ft.displayName="TooltipTrigger";Kt.displayName="TooltipContent";var As=({shortcuts:e})=>e.length===0?null:jsxRuntime.jsx("div",{children:e.map((t,o)=>jsxRuntime.jsxs(react$1.Fragment,{children:[o>0&&jsxRuntime.jsx("kbd",{children:"+"}),jsxRuntime.jsx("kbd",{children:t})]},o))}),M=react$1.forwardRef(({className:e,children:t,tooltip:o,showTooltip:n=true,shortcutKeys:r,"aria-label":i,...a},s)=>{let l=react$1.useMemo(()=>I({shortcutKeys:r}),[r]);return !o||!n?jsxRuntime.jsx("button",{className:S("tiptap-button",e),ref:s,"aria-label":i,...a,children:t}):jsxRuntime.jsxs(Vt,{delay:200,children:[jsxRuntime.jsx(Ft,{className:S("tiptap-button",e),ref:s,"aria-label":i,...a,children:t}),jsxRuntime.jsxs(Kt,{children:[o,jsxRuntime.jsx(As,{shortcuts:l})]})]})});M.displayName="Button";var Q=react$1.forwardRef(({className:e,children:t,orientation:o="vertical",...n},r)=>jsxRuntime.jsx("div",{ref:r,className:S("tiptap-button-group",e),"data-orientation":o,role:"group",...n,children:t}));Q.displayName="ButtonGroup";var _t=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));_t.displayName="CloseIcon";function Ds(e){let[t,o]=react$1.useState([]),n=async s=>{if(s.size>e.maxSize){let p=new Error(`File size exceeds maximum allowed (${e.maxSize/1024/1024}MB)`);return e.onError?.(p),null}let l=new AbortController,c=crypto.randomUUID(),d={id:c,file:s,progress:0,status:"uploading",abortController:l};o(p=>[...p,d]);try{if(!e.upload)throw new Error("Upload function is not defined");let p=await e.upload(s,({progress:m})=>{o(f=>f.map(h=>h.id===c?{...h,progress:Math.round(m)}:h));},l.signal);if(!p)throw new Error("Upload failed: No URL returned");return l.signal.aborted?null:(o(m=>m.map(f=>f.id===c?{...f,status:"success",url:p,progress:100}:f)),e.onSuccess?.(p),p)}catch(p){return l.signal.aborted||(o(m=>m.map(f=>f.id===c?{...f,status:"error",progress:0}:f)),e.onError?.(p instanceof Error?p:new Error("Upload failed"))),null}};return {fileItems:t,uploadFiles:async s=>{if(!s||s.length===0)return e.onError?.(new Error("No files to upload")),[];if(e.limit&&s.length>e.limit)return e.onError?.(new Error(`Maximum ${e.limit} file${e.limit===1?"":"s"} allowed`)),[];let l=s.map(d=>n(d));return (await Promise.all(l)).filter(d=>d!==null)},removeFileItem:s=>{o(l=>{let c=l.find(d=>d.id===s);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),l.filter(d=>d.id!==s)});},clearAllFiles:()=>{t.forEach(s=>{s.abortController&&s.abortController.abort(),s.url&&URL.revokeObjectURL(s.url);}),o([]);}}}var Vn=()=>jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Os=()=>jsxRuntime.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),Vs=()=>jsxRuntime.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Fs=(e,t)=>!t||t==="*"||t==="*/*"?true:t.split(",").map(n=>n.trim()).some(n=>{if(n.endsWith("/*")){let r=n.slice(0,-2);return e.type.startsWith(r)}return n.startsWith(".")?e.name.toLowerCase().endsWith(n.toLowerCase()):e.type===n}),Ks=({onFile:e,accept:t="image/*",children:o})=>{let[n,r]=react$1.useState(false),[i,a]=react$1.useState(false);return jsxRuntime.jsx("div",{className:`tiptap-image-upload-drag-area ${i?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:p=>{p.preventDefault(),p.stopPropagation(),a(true);},onDragLeave:p=>{p.preventDefault(),p.stopPropagation(),p.currentTarget.contains(p.relatedTarget)||(a(false),r(false));},onDragOver:p=>{p.preventDefault(),p.stopPropagation(),r(true);},onDrop:p=>{p.preventDefault(),p.stopPropagation(),a(false),r(false);let m=Array.from(p.dataTransfer.files).filter(f=>Fs(f,t));m.length>0&&e(m);},children:o})},Ws=({fileItem:e,onRemove:t})=>{let o=n=>{if(n===0)return "0 Bytes";let r=1024,i=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(n)/Math.log(r));return `${parseFloat((n/Math.pow(r,a)).toFixed(2))} ${i[a]}`};return jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview",children:[e.status==="uploading"&&jsxRuntime.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${e.progress}%`}}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-file-info",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-file-icon",children:jsxRuntime.jsx(Vn,{})}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-details",children:[jsxRuntime.jsx("span",{className:"tiptap-image-upload-text",children:e.file.name}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:o(e.file.size)})]})]}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-actions",children:[e.status==="uploading"&&jsxRuntime.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[e.progress,"%"]}),jsxRuntime.jsx(M,{type:"button","data-style":"ghost",onClick:n=>{n.stopPropagation(),t();},children:jsxRuntime.jsx(_t,{className:"tiptap-button-icon"})})]})]})]})},_s=({maxSize:e,limit:t,locale:o})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[jsxRuntime.jsx(Os,{}),jsxRuntime.jsx(Vs,{}),jsxRuntime.jsx("div",{className:"tiptap-image-upload-icon-container",children:jsxRuntime.jsx(Vn,{})})]}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-content",children:[jsxRuntime.jsxs("span",{className:"tiptap-image-upload-text",children:[jsxRuntime.jsx("em",{children:o?.clickToUpload??"Click to upload"})," ",o?.orDragAndDrop??"or drag and drop"]}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:o?.maxFiles?o.maxFiles.replace("{limit}",String(t)).replace("{size}",String(e/1024/1024)):`Maximum ${t} file${t===1?"":"s"}, ${e/1024/1024}MB each.`})]})]}),Fn=e=>{let{accept:t,limit:o,maxSize:n}=e.node.attrs,r=react$1.useRef(null),i=e.extension,a=i.options.locale,s={maxSize:n,limit:o,accept:t,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:c,removeFileItem:d,clearAllFiles:p}=Ds(s),m=async g=>{let v=await c(g);if(v.length>0){let b=e.getPos();if(G(b)){let C=v.map((w,L)=>{let T=g[L]?.name.replace(/\.[^/.]+$/,"")||"unknown";return {type:i.options.type,attrs:{...i.options,src:w,alt:T,title:T}}});e.editor.chain().focus().deleteRange({from:b,to:b+e.node.nodeSize}).insertContentAt(b,C).run(),pt(e.editor);}}},f=g=>{let v=g.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}m(Array.from(v));},h=()=>{r.current&&l.length===0&&(r.current.value="",r.current.click());},u=l.length>0;return jsxRuntime.jsxs(react.NodeViewWrapper,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!u&&jsxRuntime.jsx(Ks,{onFile:m,accept:t,children:jsxRuntime.jsx(_s,{maxSize:n,limit:o,locale:a})}),u&&jsxRuntime.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&jsxRuntime.jsxs("div",{className:"tiptap-image-upload-header",children:[jsxRuntime.jsxs("span",{children:[a?.uploading??"Uploading"," ",l.length," files"]}),jsxRuntime.jsx(M,{type:"button","data-style":"ghost",onClick:g=>{g.stopPropagation(),p();},children:a?.clearAll??"Clear All"})]}),l.map(g=>jsxRuntime.jsx(Ws,{fileItem:g,onRemove:()=>d(g.id)},g.id))]}),jsxRuntime.jsx("input",{ref:r,name:"file",accept:t,type:"file",multiple:o>1,onChange:f,onClick:g=>g.stopPropagation()})]})};var Kn=react.Node.create({name:"imageUpload",group:"block",draggable:true,selectable:true,atom:true,addOptions(){return {type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{},locale:void 0}},addAttributes(){return {accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return [{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:e}){return ["div",react.mergeAttributes({"data-type":"image-upload"},e)]},addNodeView(){return react.ReactNodeViewRenderer(Fn)},addCommands(){return {setImageUploadNode:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return {Enter:({editor:e})=>{let{selection:t}=e.state,{nodeAfter:o}=t.$from;if(o&&o.type.name==="imageUpload"&&e.isActive("imageUpload")){let n=e.view.nodeDOM(t.$from.pos);if(n&&n instanceof HTMLElement){let r=n.firstChild;if(r&&r instanceof HTMLElement)return r.click(),true}}return false}}}});var Wn=Qs__default.default.extend({renderHTML(){return ["div",react.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});var Ue=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));Ue.displayName="ChevronDownIcon";function y(e){let{editor:t}=react.useCurrentEditor(),o=react$1.useMemo(()=>e||t,[e,t]);return react.useEditorState({editor:o,selector(r){return r.editor?{editor:r.editor,editorState:r.editor.state,canCommand:r.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}var N=react$1.forwardRef(({variant:e,size:t="default",appearance:o="default",trimText:n=false,className:r,children:i,...a},s)=>jsxRuntime.jsx("div",{ref:s,className:`tiptap-badge ${r||""}`,"data-style":e,"data-size":t,"data-appearance":o,"data-text-trim":n?"on":"off",...a,children:i}));N.displayName="Badge";function ra({level:e,shortcutKeys:t=qt[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var Zt=react$1.forwardRef(({editor:e,level:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canToggle:m,isActive:f,handleToggle:h,label:u,Icon:g,shortcutKeys:v}=zn({editor:d,level:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&h();},[h,a]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":u,"aria-pressed":f,tooltip:u,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(ra,{level:t,shortcutKeys:v})]})}):null});Zt.displayName="HeadingButton";var $t=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));$t.displayName="HeadingOneIcon";var Gt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Gt.displayName="HeadingTwoIcon";var Yt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));Yt.displayName="HeadingThreeIcon";var Jt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Jt.displayName="HeadingFourIcon";var Xt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Xt.displayName="HeadingFiveIcon";var jt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));jt.displayName="HeadingSixIcon";var eo={1:$t,2:Gt,3:Yt,4:Jt,5:Xt,6:jt},qt={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Le(e,t,o=true){return !e||!e.isEditable||!_("heading",e)||D(e,["image"])?false:o?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?t?e.can().setNode("heading",{level:t})||e.can().clearNodes():e.can().setNode("heading")||e.can().clearNodes():false:t?e.can().setNode("heading",{level:t}):e.can().setNode("heading")}function dt(e,t){return !e||!e.isEditable?false:Array.isArray(t)?t.some(o=>e.isActive("heading",{level:o})):t?e.isActive("heading",{level:t}):e.isActive("heading")}function wa(e,t){if(!e||!e.isEditable)return false;let o=Array.isArray(t)?t:[t],n=o.find(r=>Le(e,r));if(!n)return false;try{let r=e.view,i=r.state,a=i.tr;if(i.selection.empty||i.selection instanceof state.TextSelection){let p=le({editor:e,node:i.selection.$anchor.node(1)})?.pos;if(!G(p))return !1;a=a.setSelection(state.NodeSelection.create(i.doc,p)),r.dispatch(a),i=r.state;}let s=i.selection,l=e.chain().focus();if(s instanceof state.NodeSelection){let p=s.node.firstChild?.firstChild,m=s.node.lastChild?.lastChild,f=p?s.from+p.nodeSize:s.from+1,h=m?s.to-m.nodeSize:s.to-1,u=i.doc.resolve(f),g=i.doc.resolve(h);l=l.setTextSelection(state.TextSelection.between(u,g)).clearNodes();}return (o.some(p=>e.isActive("heading",{level:p}))?l.setNode("paragraph"):l.setNode("heading",{level:n})).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function to(e){let{editor:t,level:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!_("heading",t)?false:n&&!t.isActive("code")?Array.isArray(o)?o.some(r=>Le(t,r)):Le(t,o):true}function zn(e){let{editor:t,level:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=Le(i,o),c=dt(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(to({editor:i,level:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=wa(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleToggle:d,canToggle:l,label:`Heading ${o}`,shortcutKeys:qt[o],Icon:eo[o]}}function ut({...e}){return jsxRuntime.jsx(B__namespace.Root,{modal:false,...e})}function Xn({...e}){return jsxRuntime.jsx(B__namespace.Portal,{...e})}var Oe=react$1.forwardRef(({...e},t)=>jsxRuntime.jsx(B__namespace.Trigger,{ref:t,...e}));Oe.displayName=B__namespace.Trigger.displayName;var mt=B__namespace.Item;var La=react$1.forwardRef(({className:e,portal:t=true,...o},n)=>{let r=jsxRuntime.jsx(B__namespace.SubContent,{ref:n,className:S("tiptap-dropdown-menu",e),...o});return t?jsxRuntime.jsx(Xn,{...typeof t=="object"?t:{},children:r}):r});La.displayName=B__namespace.SubContent.displayName;var Ve=react$1.forwardRef(({className:e,sideOffset:t=4,portal:o=false,...n},r)=>{let i=jsxRuntime.jsx(B__namespace.Content,{ref:r,sideOffset:t,onCloseAutoFocus:a=>a.preventDefault(),className:S("tiptap-dropdown-menu",e),...n});return o?jsxRuntime.jsx(Xn,{...typeof o=="object"?o:{},children:i}):i});Ve.displayName=B__namespace.Content.displayName;var X=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card",e),...t}));X.displayName="Card";var Ma=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-header",e),...t}));Ma.displayName="CardHeader";var j=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-body",e),...t}));j.displayName="CardBody";var Fe=react$1.forwardRef(({className:e,orientation:t="vertical",...o},n)=>jsxRuntime.jsx("div",{ref:n,"data-orientation":t,className:S("tiptap-card-item-group",e),...o}));Fe.displayName="CardItemGroup";var Pa=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-group-label",e),...t}));Pa.displayName="CardGroupLabel";var Ra=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-footer",e),...t}));Ra.displayName="CardFooter";var no=react$1.forwardRef(({editor:e,levels:t=[1,2,3,4,5,6],hideWhenUnavailable:o=false,portal:n=false,onOpenChange:r,labels:i,...a},s)=>{let{editor:l}=y(e),[c,d]=react$1.useState(false),{isVisible:p,isActive:m,canToggle:f,Icon:h}=er({editor:l,levels:t,hideWhenUnavailable:o}),u=react$1.useCallback(g=>{!l||!f||(d(g),r?.(g));},[f,l,r]);return p?jsxRuntime.jsxs(ut,{modal:true,open:c,onOpenChange:u,children:[jsxRuntime.jsx(Oe,{asChild:true,children:jsxRuntime.jsxs(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":m,tooltip:"Heading",...a,ref:s,children:[jsxRuntime.jsx(h,{className:"tiptap-button-icon"}),jsxRuntime.jsx(Ue,{className:"tiptap-button-dropdown-small"})]})}),jsxRuntime.jsx(Ve,{align:"start",portal:n,children:jsxRuntime.jsx(X,{children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Q,{children:t.map(g=>jsxRuntime.jsx(mt,{asChild:true,children:jsxRuntime.jsx(Zt,{editor:l,level:g,text:i?.[`heading${g}`]??`Heading ${g}`,showTooltip:false})},`heading-${g}`))})})})})]}):null});no.displayName="HeadingDropdownMenu";var ro=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));ro.displayName="HeadingIcon";function Aa(e,t=[1,2,3,4,5,6]){if(!(!e||!e.isEditable))return t.find(o=>dt(e,o))}function er(e){let{editor:t,levels:o=[1,2,3,4,5,6],hideWhenUnavailable:n=false}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=Aa(r,o),l=dt(r),c=Le(r);return react$1.useEffect(()=>{if(!r)return;let d=()=>{a(to({editor:r,hideWhenUnavailable:n,level:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,n,o]),{isVisible:i,activeLevel:s,isActive:l,canToggle:c,levels:o,label:"Heading",Icon:s?eo[s]:ro}}function Ua({shortcutKeys:e=ft}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var io=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onInserted:n,showShortcut:r=false,onClick:i,icon:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canInsert:m,handleImage:f,label:h,isActive:u,shortcutKeys:g,Icon:v}=or({editor:d,hideWhenUnavailable:o,onInserted:n}),b=react$1.useCallback(w=>{i?.(w),!w.defaultPrevented&&f();},[f,i]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":u?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":h,"aria-pressed":u,tooltip:h,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a??v,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Ua,{shortcutKeys:g})]})}):null});io.displayName="ImageUploadButton";function de(e="max",t=768){let[o,n]=react$1.useState(void 0);return react$1.useEffect(()=>{let r=e==="min"?`(min-width: ${t}px)`:`(max-width: ${t-1}px)`,i=window.matchMedia(r),a=s=>n(s.matches);return n(i.matches),i.addEventListener("change",a),()=>i.removeEventListener("change",a)},[e,t]),!!o}var so=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));so.displayName="ImagePlusIcon";var ft="mod+shift+i";function ao(e){return !e||!e.isEditable||!J(e,"imageUpload")?false:e.can().insertContent({type:"imageUpload"})}function qa(e){return !e||!e.isEditable?false:e.isActive("imageUpload")}function $a(e){if(!e||!e.isEditable||!ao(e))return false;try{return e.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return false}}function Ga(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!J(t,"imageUpload")?false:o&&!t.isActive("code")?ao(t):true}function or(e){let{editor:t,hideWhenUnavailable:o=false,onInserted:n}=e||{},{editor:r}=y(t),i=de(),[a,s]=react$1.useState(true),l=ao(r),c=qa(r);react$1.useEffect(()=>{if(!r)return;let p=()=>{s(Ga({editor:r,hideWhenUnavailable:o}));};return p(),r.on("selectionUpdate",p),()=>{r.off("selectionUpdate",p);}},[r,o]);let d=react$1.useCallback(()=>{if(!r)return false;let p=$a(r);return p&&n?.(),p},[r,n]);return reactHotkeysHook.useHotkeys(ft,p=>{p.preventDefault(),d();},{enabled:a&&l,enableOnContentEditable:!i,enableOnFormTags:true}),{isVisible:a,isActive:c,handleImage:d,canInsert:l,label:"Add image",shortcutKeys:ft,Icon:so}}function Ja({type:e,shortcutKeys:t=po[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var lo=react$1.forwardRef(({editor:e,type:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canToggle:m,isActive:f,handleToggle:h,label:u,shortcutKeys:g,Icon:v}=rr({editor:d,type:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&h();},[h,a]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":u,"aria-pressed":f,tooltip:u,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(v,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(Ja,{type:t,shortcutKeys:g})]})}):null});lo.displayName="ListButton";var Te=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Te.displayName="ListIcon";var _e=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));_e.displayName="ListOrderedIcon";var Ze=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Ze.displayName="ListTodoIcon";var co={bulletList:Te,orderedList:_e,taskList:Ze},pl={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},po={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function qe(e,t,o=true){if(!e||!e.isEditable||!_(t,e)||D(e,["image"]))return false;if(!o)switch(t){case "bulletList":return e.can().toggleBulletList();case "orderedList":return e.can().toggleOrderedList();case "taskList":return e.can().toggleList("taskList","taskItem");default:return false}if(!pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"]))return false;switch(t){case "bulletList":return e.can().toggleBulletList()||e.can().clearNodes();case "orderedList":return e.can().toggleOrderedList()||e.can().clearNodes();case "taskList":return e.can().toggleList("taskList","taskItem")||e.can().clearNodes();default:return false}}function gt(e,t){if(!e||!e.isEditable)return false;switch(t){case "bulletList":return e.isActive("bulletList");case "orderedList":return e.isActive("orderedList");case "taskList":return e.isActive("taskList");default:return false}}function cl(e,t){if(!e||!e.isEditable||!qe(e,t))return false;try{let o=e.view,n=o.state,r=n.tr;if(n.selection.empty||n.selection instanceof state.TextSelection){let s=le({editor:e,node:n.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;r=r.setSelection(state.NodeSelection.create(n.doc,s)),o.dispatch(r),n=o.state;}let i=n.selection,a=e.chain().focus();if(i instanceof state.NodeSelection){let s=i.node.firstChild?.firstChild,l=i.node.lastChild?.lastChild,c=s?i.from+s.nodeSize:i.from+1,d=l?i.to-l.nodeSize:i.to-1,p=n.doc.resolve(c),m=n.doc.resolve(d);a=a.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}if(e.isActive(t))a.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else {let l={bulletList:()=>a.toggleBulletList(),orderedList:()=>a.toggleOrderedList(),taskList:()=>a.toggleList("taskList","taskItem")}[t];if(!l)return !1;l().run();}return e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function dl(e){let{editor:t,type:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!_(o,t)?false:n&&!t.isActive("code")?qe(t,o):true}function rr(e){let{editor:t,type:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=qe(i,o),c=gt(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(dl({editor:i,type:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=cl(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleToggle:d,canToggle:l,label:pl[o],shortcutKeys:po[o],Icon:co[o]}}var gl=[{label:"Bullet List",type:"bulletList",icon:Te},{label:"Ordered List",type:"orderedList",icon:_e},{label:"Task List",type:"taskList",icon:Ze}];function hl(e,t){return !e||!e.isEditable?false:t.some(o=>qe(e,o))}function Cl(e,t){return !e||!e.isEditable?false:t.some(o=>gt(e,o))}function vl(e){return gl.filter(t=>!t.type||e.includes(t.type))}function bl(e){let{editor:t,hideWhenUnavailable:o,listInSchema:n,canToggleAny:r}=e;return !n||!t?false:o&&!t.isActive("code")?r:true}function yl(e,t){if(!(!e||!e.isEditable))return t.find(o=>gt(e,o))}function ar(e){let{editor:t,types:o=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=false}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=o.some(f=>_(f,r)),l=react$1.useMemo(()=>vl(o),[o]),c=hl(r,o),d=Cl(r,o),p=yl(r,o),m=l.find(f=>f.type===p);return react$1.useEffect(()=>{if(!r)return;let f=()=>{a(bl({editor:r,hideWhenUnavailable:n,listInSchema:s,canToggleAny:c}));};return f(),r.on("selectionUpdate",f),()=>{r.off("selectionUpdate",f);}},[c,r,n,s,o]),{isVisible:i,activeType:p,isActive:d,canToggle:c,types:o,filteredLists:l,label:"List",Icon:m?co[m.type]:Te}}function pr({editor:e,types:t=["bulletList","orderedList","taskList"],hideWhenUnavailable:o=false,onOpenChange:n,portal:r=false,labels:i,...a}){let{editor:s}=y(e),[l,c]=react$1.useState(false),{filteredLists:d,canToggle:p,isActive:m,isVisible:f,Icon:h}=ar({editor:s,types:t,hideWhenUnavailable:o}),u=react$1.useCallback(g=>{c(g),n?.(g);},[n]);return f?jsxRuntime.jsxs(ut,{open:l,onOpenChange:u,children:[jsxRuntime.jsx(Oe,{asChild:true,children:jsxRuntime.jsxs(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":"List options",tooltip:"List",...a,children:[jsxRuntime.jsx(h,{className:"tiptap-button-icon"}),jsxRuntime.jsx(Ue,{className:"tiptap-button-dropdown-small"})]})}),jsxRuntime.jsx(Ve,{align:"start",portal:r,children:jsxRuntime.jsx(X,{children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Q,{children:d.map(g=>jsxRuntime.jsx(mt,{asChild:true,children:jsxRuntime.jsx(lo,{editor:s,type:g.type,text:i?.[g.type]??g.label,showTooltip:false})},g.type))})})})})]}):null}function Pl({shortcutKeys:e=mo}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var uo=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onToggled:n,showShortcut:r=false,onClick:i,children:a,...s},l)=>{let{editor:c}=y(e),{isVisible:d,canToggle:p,isActive:m,handleToggle:f,label:h,shortcutKeys:u,Icon:g}=cr({editor:c,hideWhenUnavailable:o,onToggled:n}),v=react$1.useCallback(b=>{i?.(b),!b.defaultPrevented&&f();},[f,i]);return d?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":h,"aria-pressed":m,tooltip:"Blockquote",onClick:v,...s,ref:l,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Pl,{shortcutKeys:u})]})}):null});uo.displayName="BlockquoteButton";var fo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));fo.displayName="BlockquoteIcon";var mo="mod+shift+b";function go(e,t=true){return !e||!e.isEditable||!_("blockquote",e)||D(e,["image"])?false:t?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?e.can().toggleWrap("blockquote")||e.can().clearNodes():false:e.can().toggleWrap("blockquote")}function Al(e){if(!e||!e.isEditable||!go(e))return false;try{let t=e.view,o=t.state,n=o.tr;if(o.selection.empty||o.selection instanceof state.TextSelection){let s=le({editor:e,node:o.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;n=n.setSelection(state.NodeSelection.create(o.doc,s)),t.dispatch(n),o=t.state;}let r=o.selection,i=e.chain().focus();if(r instanceof state.NodeSelection){let s=r.node.firstChild?.firstChild,l=r.node.lastChild?.lastChild,c=s?r.from+s.nodeSize:r.from+1,d=l?r.to-l.nodeSize:r.to-1,p=o.doc.resolve(c),m=o.doc.resolve(d);i=i.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}return (e.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function Nl(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!_("blockquote",t)?false:o&&!t.isActive("code")?go(t):true}function cr(e){let{editor:t,hideWhenUnavailable:o=false,onToggled:n}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=go(r),l=r?.isActive("blockquote")||false;react$1.useEffect(()=>{if(!r)return;let d=()=>{a(Nl({editor:r,hideWhenUnavailable:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,o]);let c=react$1.useCallback(()=>{if(!r)return false;let d=Al(r);return d&&n?.(),d},[r,n]);return {isVisible:i,isActive:l,handleToggle:c,canToggle:s,label:"Blockquote",shortcutKeys:mo,Icon:fo}}function Dl({shortcutKeys:e=Co}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var ho=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onToggled:n,showShortcut:r=false,onClick:i,children:a,...s},l)=>{let{editor:c}=y(e),{isVisible:d,canToggle:p,isActive:m,handleToggle:f,label:h,shortcutKeys:u,Icon:g}=mr({editor:c,hideWhenUnavailable:o,onToggled:n}),v=react$1.useCallback(b=>{i?.(b),!b.defaultPrevented&&f();},[f,i]);return d?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",disabled:!p,"data-disabled":!p,tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:"Code Block",onClick:v,...s,ref:l,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Dl,{shortcutKeys:u})]})}):null});ho.displayName="CodeBlockButton";var bo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));bo.displayName="CodeBlockIcon";var Co="mod+alt+c";function yo(e,t=true){return !e||!e.isEditable||!_("codeBlock",e)||D(e,["image"])?false:t?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?e.can().toggleNode("codeBlock","paragraph")||e.can().clearNodes():false:e.can().toggleNode("codeBlock","paragraph")}function Zl(e){if(!e||!e.isEditable||!yo(e))return false;try{let t=e.view,o=t.state,n=o.tr;if(o.selection.empty||o.selection instanceof state.TextSelection){let s=le({editor:e,node:o.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;n=n.setSelection(state.NodeSelection.create(o.doc,s)),t.dispatch(n),o=t.state;}let r=o.selection,i=e.chain().focus();if(r instanceof state.NodeSelection){let s=r.node.firstChild?.firstChild,l=r.node.lastChild?.lastChild,c=s?r.from+s.nodeSize:r.from+1,d=l?r.to-l.nodeSize:r.to-1,p=o.doc.resolve(c),m=o.doc.resolve(d);i=i.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}return (e.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function ql(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!_("codeBlock",t)?false:o&&!t.isActive("code")?yo(t):true}function mr(e){let{editor:t,hideWhenUnavailable:o=false,onToggled:n}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=yo(r),l=r?.isActive("codeBlock")||false;react$1.useEffect(()=>{if(!r)return;let d=()=>{a(ql({editor:r,hideWhenUnavailable:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,o]);let c=react$1.useCallback(()=>{if(!r)return false;let d=Zl(r);return d&&n?.(),d},[r,n]);return {isVisible:i,isActive:l,handleToggle:c,canToggle:s,label:"Code Block",shortcutKeys:Co,Icon:bo}}var xo=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));xo.displayName="BanIcon";var Qe=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));Qe.displayName="HighlighterIcon";function vt({...e}){return jsxRuntime.jsx(ue__namespace.Root,{...e})}function bt({...e}){return jsxRuntime.jsx(ue__namespace.Trigger,{...e})}function yt({className:e,align:t="center",sideOffset:o=4,...n}){return jsxRuntime.jsx(ue__namespace.Portal,{children:jsxRuntime.jsx(ue__namespace.Content,{align:t,sideOffset:o,className:S("tiptap-popover",e),...n})})}function Xl({shortcutKeys:e=xt}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var wo=react$1.forwardRef(({editor:e,highlightColor:t,text:o,hideWhenUnavailable:n=false,mode:r="mark",onApplied:i,showShortcut:a=false,onClick:s,children:l,style:c,...d},p)=>{let{editor:m}=y(e),{isVisible:f,canColorHighlight:h,isActive:u,handleColorHighlight:g,label:v,shortcutKeys:b}=Je({editor:m,highlightColor:t,label:o||`Toggle highlight (${t})`,hideWhenUnavailable:n,mode:r,onApplied:i}),C=react$1.useCallback(L=>{s?.(L),!L.defaultPrevented&&g();},[g,s]),w=react$1.useMemo(()=>({...c,"--highlight-color":t}),[t,c]);return f?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":u?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":u,tooltip:v,onClick:C,style:w,...d,ref:p,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":t}}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),a&&jsxRuntime.jsx(Xl,{shortcutKeys:b})]})}):null});wo.displayName="ColorHighlightButton";var xt="mod+shift+h",r1=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Lo(e){let t=new Map(r1.map(o=>[o.value,o]));return e.map(o=>t.get(o)).filter(o=>!!o)}function Mo(e,t="mark"){if(!e||!e.isEditable)return false;if(t==="mark")return !ae("highlight",e)||D(e,["image"])?false:e.can().setMark("highlight");if(!J(e,["nodeBackground"]))return false;try{return e.can().toggleNodeBackgroundColor("test")}catch{return false}}function i1(e,t,o="mark"){if(!e||!e.isEditable)return false;if(o==="mark")return t?e.isActive("highlight",{color:t}):e.isActive("highlight");if(!t)return false;try{let{state:n}=e,{selection:r}=n,i=r.$anchor;for(let a=i.depth;a>=0;a--){let s=i.node(a);if(s&&s.attrs?.backgroundColor===t)return !0}return !1}catch{return false}}function s1(e,t="mark"){return !e||!e.isEditable||!Mo(e,t)?false:t==="mark"?e.chain().focus().unsetMark("highlight").run():e.chain().focus().unsetNodeBackgroundColor().run()}function a1(e){let{editor:t,hideWhenUnavailable:o,mode:n}=e;if(!t||!t.isEditable)return false;if(n==="mark"){if(!ae("highlight",t))return false}else if(!J(t,["nodeBackground"]))return false;return o&&!t.isActive("code")?Mo(t,n):true}function Je(e){let{editor:t,label:o,highlightColor:n,hideWhenUnavailable:r=false,mode:i="mark",onApplied:a}=e,{editor:s}=y(t),l=de(),[c,d]=react$1.useState(true),p=Mo(s,i),m=i1(s,n,i);react$1.useEffect(()=>{if(!s)return;let u=()=>{d(a1({editor:s,hideWhenUnavailable:r,mode:i}));};return u(),s.on("selectionUpdate",u),()=>{s.off("selectionUpdate",u);}},[s,r,i]);let f=react$1.useCallback(()=>{if(!s||!p||!n||!o)return false;if(i==="mark"){if(s.state.storedMarks){let u=s.schema.marks.highlight;u&&s.view.dispatch(s.state.tr.removeStoredMark(u));}return setTimeout(()=>{let u=s.chain().focus().toggleMark("highlight",{color:n}).run();return u&&a?.({color:n,label:o,mode:i}),u},0),true}else {let u=s.chain().focus().toggleNodeBackgroundColor(n).run();return u&&a?.({color:n,label:o,mode:i}),u}},[p,n,s,o,a,i]),h=react$1.useCallback(()=>{let u=s1(s,i);return u&&a?.({color:"",label:"Remove highlight",mode:i}),u},[s,a,i]);return reactHotkeysHook.useHotkeys(xt,u=>{u.preventDefault(),f();},{enabled:c&&p,enableOnContentEditable:!l,enableOnFormTags:true}),{isVisible:c,isActive:m,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:p,label:o||"Highlight",shortcutKeys:xt,Icon:Qe,mode:i}}var br=react$1.forwardRef(({className:e,children:t,...o},n)=>jsxRuntime.jsx(M,{type:"button",className:e,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:n,...o,children:t??jsxRuntime.jsx(Qe,{className:"tiptap-button-icon"})}));br.displayName="ColorHighlightPopoverButton";function u1({editor:e,colors:t=Lo(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),removeTooltip:o="Remove highlight"}){let{handleRemoveHighlight:n}=Je({editor:e}),r=de(),i=react$1.useRef(null),a=react$1.useMemo(()=>[...t,{label:o,value:"none"}],[t,o]),{selectedIndex:s}=ct({containerRef:i,items:a,orientation:"both",onSelect:l=>{if(!i.current)return false;let c=i.current.querySelector('[data-highlighted="true"]');return c&&c.click(),l.value==="none"&&n(),true},autoSelectFirstItem:false});return jsxRuntime.jsx(X,{ref:i,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:jsxRuntime.jsx(j,{style:r?{padding:0}:{},children:jsxRuntime.jsxs(Fe,{orientation:"horizontal",children:[jsxRuntime.jsx(Q,{orientation:"horizontal",children:t.map((l,c)=>jsxRuntime.jsx(wo,{editor:e,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:c===s?0:-1,"data-highlighted":s===c},l.value))}),jsxRuntime.jsx(he,{}),jsxRuntime.jsx(Q,{orientation:"horizontal",children:jsxRuntime.jsx(M,{onClick:n,"aria-label":o,tooltip:o,tabIndex:s===t.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===t.length,children:jsxRuntime.jsx(xo,{className:"tiptap-button-icon"})})})]})})})}function yr({editor:e,colors:t=Lo(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:o=false,onApplied:n,removeTooltip:r,...i}){let{editor:a}=y(e),[s,l]=react$1.useState(false),{isVisible:c,canColorHighlight:d,isActive:p,label:m,Icon:f}=Je({editor:a,hideWhenUnavailable:o,onApplied:n});return c?jsxRuntime.jsxs(vt,{open:s,onOpenChange:l,children:[jsxRuntime.jsx(bt,{asChild:true,children:jsxRuntime.jsx(br,{disabled:!d,"data-active-state":p?"on":"off","data-disabled":!d,"aria-pressed":p,"aria-label":m,tooltip:m,...i,children:jsxRuntime.jsx(f,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(yt,{"aria-label":"Highlight colors",children:jsxRuntime.jsx(u1,{editor:a,colors:t,removeTooltip:r})})]}):null}var Po=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Po.displayName="CornerDownLeftIcon";var Ro=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));Ro.displayName="ExternalLinkIcon";var Xe=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));Xe.displayName="LinkIcon";var To=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));To.displayName="TrashIcon";function Rr({className:e,type:t,...o}){return jsxRuntime.jsx("input",{type:t,className:S("tiptap-input",e),...o})}function Tr({className:e,children:t,...o}){return jsxRuntime.jsx("div",{className:S("tiptap-input-group",e),...o,children:t})}var Sr=react$1.forwardRef(({className:e,children:t,...o},n)=>jsxRuntime.jsx(M,{type:"button",className:e,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:n,...o,children:t||jsxRuntime.jsx(Xe,{className:"tiptap-button-icon"})}));Sr.displayName="LinkButton";var x1=({url:e,setUrl:t,setLink:o,removeLink:n,openLink:r,isActive:i,placeholder:a="Paste a link...",applyTooltip:s="Apply link",openTooltip:l="Open in new window",removeTooltip:c="Remove link"})=>{let d=de(),p=m=>{m.key==="Enter"&&(m.preventDefault(),o());};return jsxRuntime.jsx(X,{style:{...d?{boxShadow:"none",border:0}:{}},children:jsxRuntime.jsx(j,{style:{...d?{padding:0}:{}},children:jsxRuntime.jsxs(Fe,{orientation:"horizontal",children:[jsxRuntime.jsx(Tr,{children:jsxRuntime.jsx(Rr,{type:"url",placeholder:a,value:e,onChange:m=>t(m.target.value),onKeyDown:p,autoFocus:true,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),jsxRuntime.jsx(Q,{orientation:"horizontal",children:jsxRuntime.jsx(M,{type:"button",onClick:o,title:s,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(Po,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(he,{}),jsxRuntime.jsxs(Q,{orientation:"horizontal",children:[jsxRuntime.jsx(M,{type:"button",onClick:r,title:l,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(Ro,{className:"tiptap-button-icon"})}),jsxRuntime.jsx(M,{type:"button",onClick:n,title:c,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(To,{className:"tiptap-button-icon"})})]})]})})})};var So=react$1.forwardRef(({editor:e,hideWhenUnavailable:t=false,onSetLink:o,onOpenChange:n,autoOpenOnLinkActive:r=true,onClick:i,children:a,placeholder:s,applyTooltip:l,openTooltip:c,removeTooltip:d,...p},m)=>{let{editor:f}=y(e),[h,u]=react$1.useState(false),{isVisible:g,canSet:v,isActive:b,url:C,setUrl:w,setLink:L,removeLink:T,openLink:E,label:me,Icon:Y}=Ir({editor:f,hideWhenUnavailable:t,onSetLink:o}),re=react$1.useCallback(ie=>{u(ie),n?.(ie);},[n]),q=react$1.useCallback(()=>{L(),u(false);},[L]),Ie=react$1.useCallback(ie=>{i?.(ie),!ie.defaultPrevented&&u(!h);},[i,h]);return react$1.useEffect(()=>{r&&b&&u(true);},[r,b]),g?jsxRuntime.jsxs(vt,{open:h,onOpenChange:re,children:[jsxRuntime.jsx(bt,{asChild:true,children:jsxRuntime.jsx(Sr,{disabled:!v,"data-active-state":b?"on":"off","data-disabled":!v,"aria-label":me,"aria-pressed":b,onClick:Ie,...p,ref:m,children:a??jsxRuntime.jsx(Y,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsx(x1,{url:C,setUrl:w,setLink:q,removeLink:T,openLink:E,isActive:b,placeholder:s,applyTooltip:l,openTooltip:c,removeTooltip:d})})]}):null});So.displayName="LinkPopover";function Ar(e){return !e||!e.isEditable||D(e,["image"],true)?false:e.can().setMark("link")}function Nr(e){return !e||!e.isEditable?false:e.isActive("link")}function w1(e){let{editor:t,hideWhenUnavailable:o}=e;return !ae("link",t)||!t?false:o&&!t.isActive("code")?Ar(t):true}function L1(e){let{editor:t,onSetLink:o}=e,[n,r]=react$1.useState(null);react$1.useEffect(()=>{if(!t)return;let{href:l}=t.getAttributes("link");Nr(t)&&n===null&&r(l||"");},[t,n]),react$1.useEffect(()=>{if(!t)return;let l=()=>{let{href:c}=t.getAttributes("link");r(c||"");};return t.on("selectionUpdate",l),()=>{t.off("selectionUpdate",l);}},[t]);let i=react$1.useCallback(()=>{if(!n||!t)return;let{selection:l}=t.state,c=l.empty,d=t.chain().focus();d=d.extendMarkRange("link").setLink({href:n}),c&&(d=d.insertContent({type:"text",text:n})),d.run(),r(null),o?.();},[t,o,n]),a=react$1.useCallback(()=>{t&&(t.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",true).run(),r(""));},[t]),s=react$1.useCallback((l="_blank",c="noopener,noreferrer")=>{if(!n)return;let d=kn(n,window.location.href);d!=="#"&&window.open(d,l,c);},[n]);return {url:n||"",setUrl:r,setLink:i,removeLink:a,openLink:s}}function M1(e){let{editor:t,hideWhenUnavailable:o=false}=e,n=Ar(t),r=Nr(t),[i,a]=react$1.useState(true);return react$1.useEffect(()=>{if(!t)return;let s=()=>{a(w1({editor:t,hideWhenUnavailable:o}));};return s(),t.on("selectionUpdate",s),()=>{t.off("selectionUpdate",s);}},[t,o]),{isVisible:i,canSet:n,isActive:r}}function Ir(e){let{editor:t,hideWhenUnavailable:o=false,onSetLink:n}=e||{},{editor:r}=y(t),{isVisible:i,canSet:a,isActive:s}=M1({editor:r,hideWhenUnavailable:o}),l=L1({editor:r,onSetLink:n});return {isVisible:i,canSet:a,isActive:s,label:"Link",Icon:Xe,...l}}function T1({type:e,shortcutKeys:t=Ao[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var oe=react$1.forwardRef(({editor:e,type:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,handleMark:m,label:f,canToggle:h,isActive:u,Icon:g,shortcutKeys:v}=Br({editor:d,type:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&m();},[m,a]);return p?jsxRuntime.jsx(M,{type:"button",disabled:!h,"data-style":"ghost","data-active-state":u?"on":"off","data-disabled":!h,role:"button",tabIndex:-1,"aria-label":f,"aria-pressed":u,tooltip:f,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(T1,{type:t,shortcutKeys:v})]})}):null});oe.displayName="MarkButton";var No=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));No.displayName="BoldIcon";var Uo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));Uo.displayName="Code2Icon";var Do=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));Do.displayName="ItalicIcon";var Oo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));Oo.displayName="StrikeIcon";var Fo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));Fo.displayName="SubscriptIcon";var Wo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));Wo.displayName="SuperscriptIcon";var _o=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));_o.displayName="UnderlineIcon";var z1={bold:No,italic:Do,underline:_o,strike:Oo,code:Uo,superscript:Wo,subscript:Fo},Ao={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function zo(e,t){return !e||!e.isEditable||!ae(t,e)||D(e,["image"])?false:e.can().toggleMark(t)}function Z1(e,t){return !e||!e.isEditable?false:e.isActive(t)}function q1(e,t){return !e||!e.isEditable||!zo(e,t)?false:e.chain().focus().toggleMark(t).run()}function $1(e){let{editor:t,type:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!ae(o,t)?false:n&&!t.isActive("code")?zo(t,o):true}function G1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Br(e){let{editor:t,type:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=zo(i,o),c=Z1(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s($1({editor:i,type:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=q1(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleMark:d,canToggle:l,label:G1(o),shortcutKeys:Ao[o],Icon:z1[o]}}function J1({align:e,shortcutKeys:t=Zo[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var ke=react$1.forwardRef(({editor:e,align:t,text:o,hideWhenUnavailable:n=false,onAligned:r,showShortcut:i=false,onClick:a,icon:s,children:l,...c},d)=>{let{editor:p}=y(e),{isVisible:m,handleTextAlign:f,label:h,canAlign:u,isActive:g,Icon:v,shortcutKeys:b}=Fr({editor:p,align:t,hideWhenUnavailable:n,onAligned:r}),C=react$1.useCallback(L=>{a?.(L),!L.defaultPrevented&&f();},[f,a]);return m?jsxRuntime.jsx(M,{type:"button",disabled:!u,"data-style":"ghost","data-active-state":g?"on":"off","data-disabled":!u,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":g,tooltip:h,onClick:C,...c,ref:d,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(s??v,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(J1,{align:t,shortcutKeys:b})]})}):null});ke.displayName="TextAlignButton";var $o=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));$o.displayName="AlignCenterIcon";var Qo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Qo.displayName="AlignJustifyIcon";var Jo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Jo.displayName="AlignLeftIcon";var jo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));jo.displayName="AlignRightIcon";var Zo={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},dp={left:Jo,center:$o,right:jo,justify:Qo},up={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function en(e,t){return !e||!e.isEditable||!J(e,"textAlign")||D(e,["image","horizontalRule"])?false:e.can().setTextAlign(t)}function mp(e){return "setTextAlign"in e}function fp(e,t){return !e||!e.isEditable?false:e.isActive({textAlign:t})}function gp(e,t){if(!e||!e.isEditable||!en(e,t))return false;let o=e.chain().focus();return mp(o)?o.setTextAlign(t).run():false}function hp(e){let{editor:t,hideWhenUnavailable:o,align:n}=e;return !t||!t.isEditable||!J(t,"textAlign")?false:o&&!t.isActive("code")?en(t,n):true}function Fr(e){let{editor:t,align:o,hideWhenUnavailable:n=false,onAligned:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=en(i,o),c=fp(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(hp({editor:i,align:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,n,o]);let d=react$1.useCallback(()=>{if(!i)return false;let p=gp(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleTextAlign:d,canAlign:l,label:up[o],shortcutKeys:Zo[o],Icon:dp[o]}}function bp({action:e,shortcutKeys:t=tn[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var wt=react$1.forwardRef(({editor:e,action:t,text:o,hideWhenUnavailable:n=false,onExecuted:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,handleAction:m,label:f,canExecute:h,Icon:u,shortcutKeys:g}=Kr({editor:d,action:t,hideWhenUnavailable:n,onExecuted:r}),v=react$1.useCallback(b=>{a?.(b),!b.defaultPrevented&&m();},[m,a]);return p?jsxRuntime.jsx(M,{type:"button",disabled:!h,"data-style":"ghost","data-disabled":!h,role:"button",tabIndex:-1,"aria-label":f,tooltip:f,onClick:v,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(u,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(bp,{action:t,shortcutKeys:g})]})}):null});wt.displayName="UndoRedoButton";var on=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));on.displayName="Redo2Icon";var nn=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));nn.displayName="Undo2Icon";var tn={undo:"mod+z",redo:"mod+shift+z"},Tp={undo:"Undo",redo:"Redo"},Ep={undo:nn,redo:on};function rn(e,t){return !e||!e.isEditable||D(e,["image"])?false:t==="undo"?e.can().undo():e.can().redo()}function kp(e,t){if(!e||!e.isEditable||!rn(e,t))return false;let o=e.chain().focus();return t==="undo"?o.undo().run():o.redo().run()}function Sp(e){let{editor:t,hideWhenUnavailable:o,action:n}=e;return !t||!t.isEditable?false:o&&!t.isActive("code")?rn(t,n):true}function Kr(e){let{editor:t,action:o,hideWhenUnavailable:n=false,onExecuted:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=rn(i,o);react$1.useEffect(()=>{if(!i)return;let d=()=>{s(Sp({editor:i,hideWhenUnavailable:n,action:o}));};return d(),i.on("transaction",d),()=>{i.off("transaction",d);}},[i,n,o]);let c=react$1.useCallback(()=>{if(!i)return false;let d=kp(i,o);return d&&r?.(),d},[i,o,r]);return {isVisible:a,handleAction:c,canExecute:l,label:Tp[o],shortcutKeys:tn[o],Icon:Ep[o]}}var zr=react$1.createContext(xe);function sn({locale:e,children:t}){let o={...xe,...e};return jsxRuntime.jsx(zr.Provider,{value:o,children:t})}function Lt(){return react$1.useContext(zr)}var ec=()=>{let e=Lt();return jsxRuntime.jsxs(Ut,{className:"im-rich-toolbar",children:[jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(wt,{action:"undo",tooltip:e.undo}),jsxRuntime.jsx(wt,{action:"redo",tooltip:e.redo})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(no,{levels:[1,2,3,4],tooltip:e.heading,labels:{heading1:e.heading1,heading2:e.heading2,heading3:e.heading3,heading4:e.heading4,paragraph:e.paragraph}}),jsxRuntime.jsx(pr,{types:["bulletList","orderedList","taskList"],tooltip:e.list,labels:{bulletList:e.bulletList,orderedList:e.orderedList,taskList:e.taskList}}),jsxRuntime.jsx(uo,{tooltip:e.blockquote}),jsxRuntime.jsx(ho,{tooltip:e.codeBlock})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(oe,{type:"bold",tooltip:e.bold}),jsxRuntime.jsx(oe,{type:"italic",tooltip:e.italic}),jsxRuntime.jsx(oe,{type:"strike",tooltip:e.strike}),jsxRuntime.jsx(oe,{type:"code",tooltip:e.code}),jsxRuntime.jsx(oe,{type:"underline",tooltip:e.underline}),jsxRuntime.jsx(yr,{tooltip:e.highlight,removeTooltip:e.removeHighlight}),jsxRuntime.jsx(So,{tooltip:e.link,placeholder:e.linkPlaceholder,applyTooltip:e.applyLink,openTooltip:e.openLink,removeTooltip:e.removeLink})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(oe,{type:"superscript",tooltip:e.superscript}),jsxRuntime.jsx(oe,{type:"subscript",tooltip:e.subscript})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(ke,{align:"left",tooltip:e.alignLeft}),jsxRuntime.jsx(ke,{align:"center",tooltip:e.alignCenter}),jsxRuntime.jsx(ke,{align:"right",tooltip:e.alignRight}),jsxRuntime.jsx(ke,{align:"justify",tooltip:e.alignJustify})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsx(ce,{children:jsxRuntime.jsx(io,{tooltip:e.insertImage})}),jsxRuntime.jsx(Rn,{})]})},an=react$1.forwardRef(function({placeholder:t="Write something...",disabled:o=false,uploadImage:n,onUploadingChange:r,onSend:i,onChange:a,sendKeymap:s="enter"},l){let c=Lt(),d=react$1.useRef(0),[p,m]=react$1.useState(new Map),f=react$1.useCallback(async(u,g,v)=>{if(!n)throw new Error("No upload handler provided");if(u.size>lt)throw new Error(`File size exceeds maximum allowed (${lt/(1024*1024)}MB)`);d.current++,r?.(d.current);try{if(v?.aborted)throw new Error("Upload cancelled");let b=await n(u,C=>{g?.(C);});return g?.({progress:100}),b.url}finally{d.current--,r?.(d.current);}},[n,r]),h=react.useEditor({immediatelyRender:false,editable:!o,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",class:"im-rich-editor-content"},handleClick:(u,g,v)=>{let b=v.target,{state:C}=u;if(b.tagName==="IMG"){let{doc:w}=C,L=-1;if(w.descendants((T,E)=>T.type.name==="image"&&L===-1&&g>=E&&g<=E+T.nodeSize?(L=E,false):true),L>=0){let T=C.tr.setSelection(state.NodeSelection.create(w,L));return u.dispatch(T),true}}if(C.selection instanceof state.NodeSelection){let w=C.doc.resolve(g),L=C.tr.setSelection(state.TextSelection.near(w));return u.dispatch(L),u.focus(),true}return false},handlePaste:(u,g)=>{if(!n)return false;let v=g.clipboardData?.items;if(!v)return false;let b=[];for(let C=0;C<v.length;C++){let w=v[C];if(w.type.startsWith("image/")){let L=w.getAsFile();L&&b.push(L);}}return b.length===0?false:(g.preventDefault(),b.forEach(C=>{let w=crypto.randomUUID();m(T=>{let E=new Map(T);return E.set(w,{name:C.name,size:C.size,progress:0}),E}),(async()=>{try{let T=await f(C,E=>{m(me=>{let Y=new Map(me),re=Y.get(w);return re&&Y.set(w,{...re,progress:E.progress}),Y});});if(h){let E=h.state.selection.from;h.chain().focus().insertContentAt(E,{type:"image",attrs:{src:T}}).run(),pt(h);}}catch(T){console.error("Failed to upload pasted image:",T);}finally{m(T=>{let E=new Map(T);return E.delete(w),E});}})();}),true)},handleDrop:(u,g)=>{if(!n)return false;let v=g.dataTransfer?.files;if(!v||v.length===0)return false;let b=Array.from(v).filter(w=>w.type.startsWith("image/"));if(b.length===0)return false;g.preventDefault();let C=u.posAtCoords({left:g.clientX,top:g.clientY});return b.forEach(async w=>{try{let L=await f(w),T=u.state.schema.nodes.image.create({src:L}),E=u.state.tr.insert(C?.pos??u.state.selection.from,T);u.dispatch(E);}catch(L){console.error("Failed to upload dropped image:",L);}}),true},handleKeyDown:(u,g)=>{let v=g.metaKey||g.ctrlKey;return g.key==="Enter"&&!g.shiftKey&&(s==="enter"&&!v||s==="ctrlEnter"&&g.ctrlKey||s==="cmdEnter"&&g.metaKey)?(g.preventDefault(),i?.(),true):false}},extensions:[starterKit.StarterKit.configure({horizontalRule:false,link:{openOnClick:false,enableClickSelection:true}}),Wn,extensionTextAlign.TextAlign.configure({types:["heading","paragraph"]}),extensionList.TaskList,extensionList.TaskItem.configure({nested:true}),extensionHighlight.Highlight.configure({multicolor:true}),extensionTypography.Typography,extensionSuperscript.Superscript,extensionSubscript.Subscript,extensions.Selection,ki.Placeholder.configure({placeholder:t}),extensionImage.Image,...n?[Kn.configure({accept:"image/*",maxSize:lt,limit:3,upload:f,onError:u=>console.error("Upload failed:",u),locale:{clickToUpload:c.clickToUpload,orDragAndDrop:c.orDragAndDrop,maxFiles:c.maxFiles,clearAll:c.clearAll,uploading:c.uploading}})]:[]],onUpdate:()=>{a?.();}});return react$1.useImperativeHandle(l,()=>({editor:h,focus:()=>{h?.commands.focus();},clear:()=>{h?.commands.clearContent();},exportPayload:()=>{if(!h||d.current>0)return null;let u=h.getText();return u.trim()?{type:"markdown",markdown:u}:null},importMarkdown:u=>{h&&h.commands.setContent(u);},getDraft:()=>({mode:"rich",json:h?.getJSON()}),setDraft:u=>{u.json&&h&&h.commands.setContent(u.json);},setText:u=>{h?.commands.setContent(u);},insertText:u=>{h?.commands.insertContent(u);},isUploading:()=>d.current>0}),[h]),jsxRuntime.jsx("div",{className:"im-rich-editor-wrapper",children:jsxRuntime.jsxs(react.EditorContext.Provider,{value:{editor:h},children:[jsxRuntime.jsx(ec,{}),jsxRuntime.jsx("div",{className:"im-rich-editor-container",children:jsxRuntime.jsx(react.EditorContent,{editor:h,role:"presentation"})}),p.size>0&&jsxRuntime.jsx("div",{className:"im-paste-upload-progress tiptap-image-upload",children:Array.from(p.entries()).map(([u,{name:g,size:v,progress:b}])=>jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${b}%`}}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-file-info",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-file-icon",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]})}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-details",children:[jsxRuntime.jsx("span",{className:"tiptap-image-upload-text",children:g}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:v===0?"0 Bytes":(()=>{let w=["Bytes","KB","MB","GB"],L=Math.floor(Math.log(v)/Math.log(1024));return `${parseFloat((v/Math.pow(1024,L)).toFixed(2))} ${w[L]}`})()})]})]}),jsxRuntime.jsx("div",{className:"tiptap-image-upload-actions",children:jsxRuntime.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[b,"%"]})})]})]},u))})]})})});var ic=react$1.forwardRef(function({mode:t,defaultMode:o="plain",onSend:n,onChange:r,onContextMenu:i,onQuoteRemoved:a,enableMention:s=true,mentionProvider:l,maxMentions:c,renderMentionItem:d,mentionPlacement:p="bottom",enableAttachments:m=true,attachmentPreviewPlacement:f="bottom",maxAttachments:h=10,allowedMimeTypes:u,maxFileSize:g,onAttachmentLimitExceeded:v,onFilesChange:b,showAttachmentPreview:C=true,uploadImage:w,keymap:L,placeholder:T,disabled:E=false,className:me,locale:Y},re){let q={...xe,...Y},[Ie,ie]=react$1.useState(o),z=t??Ie,[ye,He]=react$1.useState({active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null}),[R,O]=react$1.useState(0),H=react$1.useRef(null),fe=()=>typeof T=="string"?T:T?z==="plain"?T.plain:T.rich:z==="plain"?q.placeholderPlain:q.placeholderRich,A=It({maxAttachments:h,maxFileSize:g,allowedMimeTypes:u,onLimitExceeded:v,onChange:b}),Qr=react$1.useCallback(()=>{if(E)return;let P=K.exportPayload(A.getAttachments());P&&n&&(n(P),K.clear(),A.clearAttachments());},[E,n]),Yr=react$1.useCallback(()=>{if(E||R>0)return;let P=H.current?.exportPayload();P&&n&&(n(P),H.current?.clear());},[E,n,R]),K=Tt({placeholder:fe(),sendKeymap:L?.send||"enter",onSend:Qr,enableMention:s,mentionProvider:l,maxMentions:c,onMentionStateChange:He,onPasteFiles:m?A.addFiles:void 0,isUploading:()=>false,disabled:E,onChange:r,onQuoteRemoved:a}),Jr=react$1.useCallback(P=>{ye.command&&ye.command(P),He(ge=>({...ge,active:false,command:null}));},[ye.command]);react$1.useImperativeHandle(re,()=>({focus:()=>{z==="plain"?K.focus():H.current?.focus();},clear:()=>{z==="plain"?(K.clear(),A.clearAttachments()):H.current?.clear();},exportPayload:()=>z==="plain"?K.exportPayload(A.getAttachments()):H.current?.exportPayload()||null,importMarkdown:P=>{H.current?.importMarkdown(P);},getAttachments:()=>A.getAttachments(),setAttachments:P=>A.setAttachments(P),addFiles:P=>A.addFiles(P),removeAttachment:P=>A.removeAttachment(P),clearAttachments:()=>A.clearAttachments(),insertQuote:(P,ge)=>{K.insertQuote(P,ge);},insertMention:(P,ge)=>{K.insertMention(P,ge);},getDraft:()=>z==="plain"?K.getDraft(A.getAttachments()):H.current?.getDraft()||{mode:"rich"},setDraft:P=>{z==="plain"?(K.setDraft(P),P.attachments&&A.setAttachments(P.attachments)):H.current?.setDraft(P);},setText:P=>{z==="plain"?K.setText(P):H.current?.setText(P);},insertText:P=>{z==="plain"?K.insertText(P):H.current?.insertText(P);}}),[z,K,A]);let Xr=()=>jsxRuntime.jsxs("div",{className:"im-composer__plain-wrapper",children:[C&&f==="top"&&A.attachments.length>0&&jsxRuntime.jsx(at,{attachments:A.attachments,onRemove:A.removeAttachment,placement:"top",removeLabel:q.removeAttachment}),jsxRuntime.jsx("div",{className:"im-composer__editor-wrapper",children:jsxRuntime.jsx(react.EditorContent,{editor:K.editor,className:"im-composer__editor"})}),jsxRuntime.jsx(Pn,{mentionState:ye,editor:K.editor,placement:p,onSelect:Jr,onHover:P=>He(ge=>({...ge,selectedIndex:P})),renderItem:d,locale:{noResults:q.mentionNoResults,loading:q.mentionLoading,error:q.mentionError}}),C&&f==="bottom"&&A.attachments.length>0&&jsxRuntime.jsx(at,{attachments:A.attachments,onRemove:A.removeAttachment,placement:"bottom",removeLabel:q.removeAttachment})]}),jr=()=>jsxRuntime.jsx("div",{className:"im-composer__rich-wrapper",children:jsxRuntime.jsx(an,{ref:H,placeholder:fe(),disabled:E,uploadImage:w,onUploadingChange:O,onSend:Yr,onChange:r,sendKeymap:L?.send})});return jsxRuntime.jsx(sn,{locale:q,children:jsxRuntime.jsx("div",{className:`im-composer ${me||""} ${E?"im-composer--disabled":""}`,onContextMenu:i,children:z==="plain"?Xr():jr()})})});function ac({quote:e,onRemove:t,removeLabel:o="Remove quote"}){return jsxRuntime.jsxs("div",{className:"im-quote-bar",children:[jsxRuntime.jsxs("div",{className:"im-quote-bar__content",children:[jsxRuntime.jsx("span",{className:"im-quote-bar__title",children:e.title}),jsxRuntime.jsx("span",{className:"im-quote-bar__text",children:e.content})]}),jsxRuntime.jsx("button",{type:"button",className:"im-quote-bar__remove-btn",onClick:t,"aria-label":o,children:jsxRuntime.jsx(lc,{})})]})}function lc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}function pc(e){let t=e.state.doc;return Mt(t)}function Mt(e,t=0){let o=[];return e.forEach((n,r,i)=>{o.push(cc(n,t,i));}),o.join("")}function cc(e,t,o){switch(e.type.name){case "doc":return Mt(e,t);case "paragraph":let r=un(e);return o>0?`
7
+ `)),r=false),true)}),r&&(o+=" "),{plainText:o.trim(),mentions:t}}function yi(e){return e.length}function xi(e,t){for(let o of t){if(o.start<0||o.end>e.length||o.start>=o.end)return false;let n=e.slice(o.start,o.end),r=`@${o.userId}`;if(n!==r)return false}return true}function wi(e,t,o){let n=`@${e}`;return {userId:e,display:t,start:o,end:o+yi(n)}}function Rt(e){if(!e)return;let t=e.state.doc.firstChild;if(t?.type.name==="quote")return {title:t.attrs.title,content:t.attrs.content}}function Tt(e={}){let{placeholder:t="Type a message...",sendKeymap:o="enter",onSend:n,enableMention:r=true,mentionProvider:i,maxMentions:a,onMentionStateChange:s,onPasteFiles:l,isUploading:c=()=>false,disabled:d=false,onChange:p,onQuoteRemoved:m}=e,f=react$1.useRef(false),h=react$1.useRef(false),u=react$1.useRef(o),g=react$1.useRef(n);u.current=o,g.current=n;let v=react$1.useCallback(R=>{f.current=R.active,s?.(R);},[s]),b=react$1.useMemo(()=>{let R=[Pi__default.default,Ri__default.default,Ti__default.default,Ei__default.default,ki__default.default,Si__default.default.configure({placeholder:t}),fn.configure({}),hn.configure({onPasteFiles:l}),gn.configure({send:()=>u.current,onSend:()=>g.current?.(),isMentionListOpen:()=>f.current,isUploading:c,isComposing:()=>h.current}),yn.configure({onQuoteRemoved:m})];return r&&R.push(vn({mentionProvider:i,maxMentions:a,onMentionStateChange:v,isComposing:()=>h.current})),R},[t,r,i,a,v,l,c,m]),C=react.useEditor({extensions:b,editable:!d,onUpdate:()=>{p?.();},onCreate:({editor:R})=>{let H=R.view.dom;H.addEventListener("compositionstart",()=>{h.current=true;}),H.addEventListener("compositionend",()=>{h.current=false;});}}),w=react$1.useCallback(()=>h.current,[]),L=react$1.useCallback(()=>f.current,[]),T=react$1.useCallback(R=>{if(!C)return null;let{plainText:O,mentions:H}=nt(C),fe=Rt(C);return !O.trim()&&R.length===0?null:{type:"text",plainText:O,mentions:H,attachments:R,quote:fe}},[C]),E=react$1.useCallback(R=>{if(!C)return {mode:"plain"};let{plainText:O}=nt(C),H=Rt(C);return !O.trim()&&!H&&R.length===0?{mode:"plain"}:{mode:"plain",editorState:JSON.stringify(C.getJSON()),attachments:R,text:O,quote:H}},[C]),me=react$1.useCallback(R=>{if(C)try{if(R.json)C.commands.setContent(R.json);else if(R.editorState){let O=JSON.parse(R.editorState);C.commands.setContent(O);}}catch(O){console.error("Failed to restore draft:",O);}},[C]),Y=react$1.useCallback((R,O)=>{C&&C.chain().focus().insertContent([{type:"mention",attrs:{userId:R,display:O}},{type:"text",text:" "}]).run();},[C]),re=react$1.useCallback((R,O)=>{C&&queueMicrotask(()=>{C.commands.insertQuote(R,O);});},[C]),q=react$1.useCallback(()=>{C&&C.commands.removeQuote();},[C]),Ie=react$1.useCallback(()=>Rt(C),[C]),ie=react$1.useCallback(R=>{C&&C.commands.setContent({type:"doc",content:[{type:"paragraph",content:R?[{type:"text",text:R}]:[]}]});},[C]),z=react$1.useCallback(R=>{C&&C.commands.insertContent(R);},[C]),ye=react$1.useCallback(()=>{C&&C.commands.clearContent();},[C]),He=react$1.useCallback(()=>{C&&C.commands.focus();},[C]);return {editor:C,isComposing:w,isMentionListOpen:L,exportPayload:T,getDraft:E,setDraft:me,insertMention:Y,insertQuote:re,removeQuote:q,getQuote:Ie,setText:ie,insertText:z,clear:ye,focus:He}}function Ii(){return `att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function Et(e){let t=e.type.startsWith("image/");return {id:Ii(),file:e,name:e.name,size:e.size,mime:e.type,lastModified:e.lastModified,previewUrl:t?URL.createObjectURL(e):void 0}}function it(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl);}function Ne(e){e.forEach(it);}function Hi(e,t){if(t==="*/*"||t==="*")return true;if(t.endsWith("/*")){let o=t.slice(0,-2);return e.startsWith(o+"/")}return e===t}function Ai(e,t){return !t||t.length===0?true:t.some(o=>Hi(e,o))}function kt(e,t,o){return o.maxAttachments!==void 0&&t>=o.maxAttachments?"count":o.maxFileSize!==void 0&&e.size>o.maxFileSize?"size":Ai(e.type,o.allowedMimeTypes)?null:"mime"}function St(e){if(e===0)return "0 B";let t=1024,o=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return `${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${o[n]}`}function It(e={}){let{maxAttachments:t=10,maxFileSize:o,allowedMimeTypes:n,onLimitExceeded:r,onChange:i}=e,[a,s]=react$1.useState([]),l=react$1.useRef([]);react$1.useEffect(()=>{l.current=a;},[a]),react$1.useEffect(()=>()=>{Ne(l.current);},[]);let c=react$1.useCallback(h=>{let u=Array.from(h),g=l.current,v=[],b=g.length;for(let C of u){let w=kt(C,b,{maxAttachments:t,maxFileSize:o,allowedMimeTypes:n});if(w){r?.(w,C);continue}let L=Et(C);v.push(L),b++;}if(v.length>0){let C=[...g,...v];s(C),i?.(C);}},[t,o,n,r,i]),d=react$1.useCallback(h=>{let u=l.current.find(v=>v.id===h);u&&it(u);let g=l.current.filter(v=>v.id!==h);s(g),i?.(g);},[i]),p=react$1.useCallback(()=>{Ne(l.current),s([]),i?.([]);},[i]),m=react$1.useCallback(h=>{let u=new Set(h.map(b=>b.id)),g=l.current.filter(b=>!u.has(b.id));Ne(g);let v=h.map(b=>b.file&&b.mime.startsWith("image/")?{...b,previewUrl:URL.createObjectURL(b.file)}:b);s(v),i?.(v);},[i]),f=react$1.useCallback(()=>l.current,[]);return {attachments:a,addFiles:c,removeAttachment:d,clearAttachments:p,setAttachments:m,getAttachments:f}}function Ht({items:e,selectedIndex:t,loading:o,error:n,onSelect:r,onHover:i,renderItem:a,locale:s={}}){let{noResults:l="No results found",loading:c="Loading...",error:d="Failed to load"}=s,p=react$1.useRef(null),m=react$1.useRef([]);return react$1.useEffect(()=>{let f=m.current[t];f&&p.current&&typeof f.scrollIntoView=="function"&&f.scrollIntoView({block:"nearest",inline:"nearest"});},[t]),react$1.useEffect(()=>{m.current=m.current.slice(0,e.length);},[e.length]),o?jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:jsxRuntime.jsx("div",{className:"im-mention-list__status",children:c})}):n?jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:jsxRuntime.jsx("div",{className:"im-mention-list__status",children:d})}):e.length===0?null:jsxRuntime.jsx("div",{className:"im-mention-list",ref:p,children:e.map((f,h)=>{let u=h===t;return a?jsxRuntime.jsx("div",{ref:g=>{m.current[h]=g;},className:`im-mention-list__item ${u?"im-mention-list__item--selected":""}`,onClick:()=>r(f),onMouseEnter:()=>i(h),children:a({member:f,isSelected:u})},f.userId):jsxRuntime.jsxs("div",{ref:g=>{m.current[h]=g;},className:`im-mention-list__item ${u?"im-mention-list__item--selected":""}`,onClick:()=>r(f),onMouseEnter:()=>i(h),children:[f.avatarUrl&&jsxRuntime.jsx("img",{src:f.avatarUrl,alt:f.display,className:"im-mention-list__avatar"}),jsxRuntime.jsx("span",{className:"im-mention-list__display",children:f.display})]},f.userId)})})}function qi(e){if(!e||!e.view)return null;try{let{state:t}=e.view,{from:o}=t.selection,n=e.view.coordsAtPos(o);return new DOMRect(n.left,n.top,1,n.bottom-n.top)}catch{return null}}function Rn({mentionState:e,editor:t,placement:o="bottom",portalContainer:n,zIndex:r=9999,onSelect:i,onHover:a,renderItem:s,locale:l}){let[c,d]=react$1.useState(false),p=react$1.useRef(null),m=o==="top"?"top-start":"bottom-start",f=o==="top"?["bottom-start","top-end","bottom-end"]:["top-start","bottom-end","top-end"],h=react$1.useRef({getBoundingClientRect:()=>p.current||new DOMRect(0,0,0,0)}).current,{refs:u,floatingStyles:g,update:v}=react$2.useFloating({open:e.active&&c,placement:m,middleware:[react$2.offset(4),react$2.flip({fallbackPlacements:f}),react$2.shift({padding:8}),react$2.size({apply({availableHeight:b,elements:C}){Object.assign(C.floating.style,{maxHeight:`${Math.min(b-16,300)}px`});},padding:8})],whileElementsMounted:react$2.autoUpdate});return react$1.useEffect(()=>{u.setReference(h);},[u,h]),react$1.useLayoutEffect(()=>{if(e.active&&t){let b=requestAnimationFrame(()=>{let C=qi(t);C&&(p.current=C,d(true),v?.());});return ()=>cancelAnimationFrame(b)}else p.current=null,d(false);},[e.active,e.query,t,v]),react$1.useEffect(()=>{e.active&&c&&v&&v();},[e.items,e.loading,v,e.active,c]),!e.active||!c?null:jsxRuntime.jsx(react$2.FloatingPortal,{root:n,children:jsxRuntime.jsx("div",{ref:u.setFloating,style:{...g,zIndex:r},className:"im-mention-popover",children:jsxRuntime.jsx(Ht,{items:e.items,selectedIndex:e.selectedIndex,loading:e.loading,error:e.error,onSelect:i,onHover:a,renderItem:s,locale:l})})})}function at({attachments:e,onRemove:t,placement:o="bottom",removeLabel:n="Remove"}){return e.length===0?null:jsxRuntime.jsx("div",{className:`im-attachment-preview im-attachment-preview--${o}`,children:e.map(r=>jsxRuntime.jsxs("div",{className:"im-attachment-preview__item",children:[r.previewUrl?jsxRuntime.jsx("img",{src:r.previewUrl,alt:r.name,className:"im-attachment-preview__thumbnail"}):jsxRuntime.jsx("div",{className:"im-attachment-preview__file-icon",children:jsxRuntime.jsx($i,{})}),jsxRuntime.jsxs("div",{className:"im-attachment-preview__info",children:[jsxRuntime.jsx("span",{className:"im-attachment-preview__name",title:r.name,children:r.name}),jsxRuntime.jsx("span",{className:"im-attachment-preview__size",children:St(r.size)})]}),jsxRuntime.jsx("button",{type:"button",className:"im-attachment-preview__remove-btn",onClick:()=>t(r.id),"aria-label":n,children:jsxRuntime.jsx(Gi,{})})]},r.id))})}function $i(){return jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Gi(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}function Tn({orientation:e="horizontal",size:t,style:o={},...n}){let r={...o,...e==="horizontal"&&!t&&{flex:1},...t&&{width:e==="vertical"?"1px":t,height:e==="horizontal"?"1px":t}};return jsxRuntime.jsx("div",{...n,style:r})}var lt=5*1024*1024,Xi={mod:"\u2318",command:"\u2318",meta:"\u2318",ctrl:"\u2303",control:"\u2303",alt:"\u2325",option:"\u2325",shift:"\u21E7",backspace:"Del",delete:"\u2326",enter:"\u23CE",escape:"\u238B",capslock:"\u21EA"};function S(...e){return e.filter(Boolean).join(" ")}function ji(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}var es=(e,t,o=true)=>{if(t){let n=e.toLowerCase();return Xi[n]||(o?e.toUpperCase():e)}return o?e.charAt(0).toUpperCase()+e.slice(1):e},I=e=>{let{shortcutKeys:t,delimiter:o="+",capitalize:n=true}=e;return t?t.split(o).map(r=>r.trim()).map(r=>es(r,ji(),n)):[]},ae=(e,t)=>t?.schema?t.schema.spec.marks.get(e)!==void 0:false,_=(e,t)=>t?.schema?t.schema.spec.nodes.get(e)!==void 0:false;function pt(e){let{state:t,view:o}=e,{doc:n,selection:r}=t,i=state.Selection.findFrom(r.$to,1,true);if(i)return o.dispatch(t.tr.setSelection(i).scrollIntoView()),true;let a=t.schema.nodes.paragraph;if(!a)return console.warn("No paragraph node type found in schema."),false;let s=n.content.size,l=a.create(),c=t.tr.insert(s,l),d=c.doc.resolve(s+1);return c=c.setSelection(state.TextSelection.near(d)).scrollIntoView(),o.dispatch(c),true}function G(e){return typeof e=="number"&&e>=0}function J(e,t){if(!e)return false;let o=Array.isArray(t)?t:[t],n=o.some(r=>e.extensionManager.extensions.some(i=>i.name===r));return n||console.warn(`None of the extensions [${o.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),n}function ts(e,t){try{let o=e.state.doc.nodeAt(t);return o||(console.warn(`No node found at position ${t}`),null)}catch(o){return console.error(`Error getting node at position ${t}:`,o),null}}function le(e){let{editor:t,node:o,nodePos:n}=e;if(!t||!t.state?.doc)return null;let r=o!=null,i=G(n);if(!r&&!i)return null;if(r){let a=-1,s=null;if(t.state.doc.descendants((l,c)=>l===o?(a=c,s=l,false):true),a!==-1&&s!==null)return {pos:a,node:s}}if(i){let a=ts(t,n);if(a)return {pos:n,node:a}}return null}function D(e,t=[],o=false){if(!e||!e.state.selection)return false;let{selection:n}=e.state;if(n.empty)return false;if(n instanceof state.NodeSelection){let r=n.node;return r?t.includes(r.type.name):false}if(o){let{$from:r}=n;for(let i=r.depth;i>0;i--){let a=r.node(i);if(t.includes(a.type.name))return true}}return false}function pe(e,t=[]){if(!e||t.length===0)return false;let{state:o}=e,{selection:n}=o,r=new Set(t);if(n instanceof state.NodeSelection){let i=n.node?.type?.name;return !!i&&r.has(i)}if(n instanceof state.TextSelection||n instanceof state.AllSelection){let i=true;return o.doc.nodesBetween(n.from,n.to,a=>a.isTextblock&&!r.has(a.type.name)?(i=false,false):i),i}return false}var os=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ns(e,t){let o=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return !e||e.replace(os,"").match(new RegExp(`^(?:(?:${o.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function Sn(e,t,o){try{let n=new URL(e,t);if(ns(n.href,o))return n.href}catch{}return "#"}var he=react$1.forwardRef(({decorative:e,orientation:t="vertical",className:o,...n},r)=>{let a=e?{role:"none"}:{"aria-orientation":t==="vertical"?t:void 0,role:"separator"};return jsxRuntime.jsx("div",{className:S("tiptap-separator",o),"data-orientation":t,...a,...n,ref:r})});he.displayName="Separator";function ct({editor:e,containerRef:t,query:o,items:n,onSelect:r,onClose:i,orientation:a="vertical",autoSelectFirstItem:s=true}){let[l,c]=react$1.useState(s?0:-1);return react$1.useEffect(()=>{let d=m=>{if(!n.length)return false;let f=()=>c(u=>u===-1?0:(u+1)%n.length),h=()=>c(u=>u===-1?n.length-1:(u-1+n.length)%n.length);switch(m.key){case "ArrowUp":return a==="horizontal"?false:(m.preventDefault(),h(),true);case "ArrowDown":return a==="horizontal"?false:(m.preventDefault(),f(),true);case "ArrowLeft":return a==="vertical"?false:(m.preventDefault(),h(),true);case "ArrowRight":return a==="vertical"?false:(m.preventDefault(),f(),true);case "Tab":return m.preventDefault(),m.shiftKey?h():f(),true;case "Home":return m.preventDefault(),c(0),true;case "End":return m.preventDefault(),c(n.length-1),true;case "Enter":return m.isComposing?false:(m.preventDefault(),l!==-1&&n[l]&&r?.(n[l]),true);case "Escape":return m.preventDefault(),i?.(),true;default:return false}},p=null;if(e?p=e.view.dom:t?.current&&(p=t.current),p)return p.addEventListener("keydown",d,true),()=>{p?.removeEventListener("keydown",d,true);}},[e,t,n,l,r,i,a]),react$1.useEffect(()=>{o&&c(s?0:-1);},[o,s]),{selectedIndex:n.length?l:void 0,setSelectedIndex:c}}var Hn=(e,t)=>{typeof e=="function"?e(t):e&&typeof e=="object"&&"current"in e&&(e.current=t);},An=(e,t)=>{let o=react$1.useRef(null);return react$1.useCallback(n=>{e&&"current"in e&&(e.current=n),o.current&&Hn(o.current,null),o.current=t,t&&Hn(t,n);},[e,t])};var us=e=>{let[t,o]=react$1.useState([]),n=react$1.useCallback(()=>e.current?Array.from(e.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[e]);react$1.useEffect(()=>{let i=e.current;if(!i)return;let a=()=>o(n());a();let s=new MutationObserver(a);return s.observe(i,{childList:true,subtree:true}),()=>s.disconnect()},[n,e]);let{selectedIndex:r}=ct({containerRef:e,items:t,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:false});react$1.useEffect(()=>{let i=e.current;if(!i)return;let a=l=>{let c=l.target;i.contains(c)&&c.setAttribute("data-focus-visible","true");},s=l=>{let c=l.target;i.contains(c)&&c.removeAttribute("data-focus-visible");};return i.addEventListener("focus",a,true),i.addEventListener("blur",s,true),()=>{i.removeEventListener("focus",a,true),i.removeEventListener("blur",s,true);}},[e]),react$1.useEffect(()=>{r!==void 0&&t[r]&&t[r].focus();},[r,t]);},Ut=react$1.forwardRef(({children:e,className:t,variant:o="fixed",...n},r)=>{let i=react$1.useRef(null),a=An(i,r);return us(i),jsxRuntime.jsx("div",{ref:a,role:"toolbar","aria-label":"toolbar","data-variant":o,className:S("tiptap-toolbar",t),...n,children:e})});Ut.displayName="Toolbar";var ce=react$1.forwardRef(({children:e,className:t,...o},n)=>jsxRuntime.jsx("div",{ref:n,role:"group",className:S("tiptap-toolbar-group",t),...o,children:e}));ce.displayName="ToolbarGroup";var Ce=react$1.forwardRef(({...e},t)=>jsxRuntime.jsx(he,{ref:t,orientation:"vertical",decorative:true,...e}));Ce.displayName="ToolbarSeparator";function Is({initialOpen:e=false,placement:t="top",open:o,onOpenChange:n,delay:r=600,closeDelay:i=0}={}){let[a,s]=react$1.useState(e),l=o??a,c=n??s,d=react$2.useFloating({placement:t,open:l,onOpenChange:c,whileElementsMounted:react$2.autoUpdate,middleware:[react$2.offset(4),react$2.flip({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:4}),react$2.shift({padding:4})]}),p=d.context,m=react$2.useHover(p,{mouseOnly:true,move:false,restMs:r,enabled:o==null,delay:{close:i}}),f=react$2.useFocus(p,{enabled:o==null}),h=react$2.useDismiss(p),u=react$2.useRole(p,{role:"tooltip"}),g=react$2.useInteractions([m,f,h,u]);return react$1.useMemo(()=>({open:l,setOpen:c,...g,...d}),[l,c,g,d])}var Ot=react$1.createContext(null);function Dn(){let e=react$1.useContext(Ot);if(e==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return e}function Vt({children:e,...t}){let o=Is(t);return t.useDelayGroup?jsxRuntime.jsx(react$2.FloatingDelayGroup,{delay:{open:t.delay??0,close:t.closeDelay??0},timeoutMs:t.timeout,children:jsxRuntime.jsx(Ot.Provider,{value:o,children:e})}):jsxRuntime.jsx(Ot.Provider,{value:o,children:e})}var Ft=react$1.forwardRef(function({children:t,asChild:o=false,...n},r){let i=Dn(),a=react$1.isValidElement(t)?parseInt(react$1.version,10)>=19?t.props.ref:t.ref:void 0,s=react$2.useMergeRefs([i.refs.setReference,r,a]);if(o&&react$1.isValidElement(t)){let l={"data-tooltip-state":i.open?"open":"closed"};return react$1.cloneElement(t,i.getReferenceProps({ref:s,...n,...typeof t.props=="object"?t.props:{},...l}))}return jsxRuntime.jsx("button",{ref:s,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(n),children:t})}),Kt=react$1.forwardRef(function({style:t,children:o,portal:n=true,portalProps:r={},...i},a){let s=Dn(),l=react$2.useMergeRefs([s.refs.setFloating,a]);if(!s.open)return null;let c=jsxRuntime.jsx("div",{ref:l,style:{...s.floatingStyles,...t},...s.getFloatingProps(i),className:"tiptap-tooltip",children:o});return n?jsxRuntime.jsx(react$2.FloatingPortal,{...r,children:c}):c});Vt.displayName="Tooltip";Ft.displayName="TooltipTrigger";Kt.displayName="TooltipContent";var Ns=({shortcuts:e})=>e.length===0?null:jsxRuntime.jsx("div",{children:e.map((t,o)=>jsxRuntime.jsxs(react$1.Fragment,{children:[o>0&&jsxRuntime.jsx("kbd",{children:"+"}),jsxRuntime.jsx("kbd",{children:t})]},o))}),M=react$1.forwardRef(({className:e,children:t,tooltip:o,showTooltip:n=true,shortcutKeys:r,"aria-label":i,...a},s)=>{let l=react$1.useMemo(()=>I({shortcutKeys:r}),[r]);return !o||!n?jsxRuntime.jsx("button",{className:S("tiptap-button",e),ref:s,"aria-label":i,...a,children:t}):jsxRuntime.jsxs(Vt,{delay:200,children:[jsxRuntime.jsx(Ft,{className:S("tiptap-button",e),ref:s,"aria-label":i,...a,children:t}),jsxRuntime.jsxs(Kt,{children:[o,jsxRuntime.jsx(Ns,{shortcuts:l})]})]})});M.displayName="Button";var Q=react$1.forwardRef(({className:e,children:t,orientation:o="vertical",...n},r)=>jsxRuntime.jsx("div",{ref:r,className:S("tiptap-button-group",e),"data-orientation":o,role:"group",...n,children:t}));Q.displayName="ButtonGroup";var _t=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));_t.displayName="CloseIcon";function Os(e){let[t,o]=react$1.useState([]),n=async s=>{if(s.size>e.maxSize){let p=new Error(`File size exceeds maximum allowed (${e.maxSize/1024/1024}MB)`);return e.onError?.(p),null}let l=new AbortController,c=crypto.randomUUID(),d={id:c,file:s,progress:0,status:"uploading",abortController:l};o(p=>[...p,d]);try{if(!e.upload)throw new Error("Upload function is not defined");let p=await e.upload(s,({progress:m})=>{o(f=>f.map(h=>h.id===c?{...h,progress:Math.round(m)}:h));},l.signal);if(!p)throw new Error("Upload failed: No URL returned");return l.signal.aborted?null:(o(m=>m.map(f=>f.id===c?{...f,status:"success",url:p,progress:100}:f)),e.onSuccess?.(p),p)}catch(p){return l.signal.aborted||(o(m=>m.map(f=>f.id===c?{...f,status:"error",progress:0}:f)),e.onError?.(p instanceof Error?p:new Error("Upload failed"))),null}};return {fileItems:t,uploadFiles:async s=>{if(!s||s.length===0)return e.onError?.(new Error("No files to upload")),[];if(e.limit&&s.length>e.limit)return e.onError?.(new Error(`Maximum ${e.limit} file${e.limit===1?"":"s"} allowed`)),[];let l=s.map(d=>n(d));return (await Promise.all(l)).filter(d=>d!==null)},removeFileItem:s=>{o(l=>{let c=l.find(d=>d.id===s);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),l.filter(d=>d.id!==s)});},clearAllFiles:()=>{t.forEach(s=>{s.abortController&&s.abortController.abort(),s.url&&URL.revokeObjectURL(s.url);}),o([]);}}}var Fn=()=>jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Vs=()=>jsxRuntime.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),Fs=()=>jsxRuntime.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Ks=(e,t)=>!t||t==="*"||t==="*/*"?true:t.split(",").map(n=>n.trim()).some(n=>{if(n.endsWith("/*")){let r=n.slice(0,-2);return e.type.startsWith(r)}return n.startsWith(".")?e.name.toLowerCase().endsWith(n.toLowerCase()):e.type===n}),Ws=({onFile:e,accept:t="image/*",children:o})=>{let[n,r]=react$1.useState(false),[i,a]=react$1.useState(false);return jsxRuntime.jsx("div",{className:`tiptap-image-upload-drag-area ${i?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:p=>{p.preventDefault(),p.stopPropagation(),a(true);},onDragLeave:p=>{p.preventDefault(),p.stopPropagation(),p.currentTarget.contains(p.relatedTarget)||(a(false),r(false));},onDragOver:p=>{p.preventDefault(),p.stopPropagation(),r(true);},onDrop:p=>{p.preventDefault(),p.stopPropagation(),a(false),r(false);let m=Array.from(p.dataTransfer.files).filter(f=>Ks(f,t));m.length>0&&e(m);},children:o})},_s=({fileItem:e,onRemove:t})=>{let o=n=>{if(n===0)return "0 Bytes";let r=1024,i=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(n)/Math.log(r));return `${parseFloat((n/Math.pow(r,a)).toFixed(2))} ${i[a]}`};return jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview",children:[e.status==="uploading"&&jsxRuntime.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${e.progress}%`}}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-file-info",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-file-icon",children:jsxRuntime.jsx(Fn,{})}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-details",children:[jsxRuntime.jsx("span",{className:"tiptap-image-upload-text",children:e.file.name}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:o(e.file.size)})]})]}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-actions",children:[e.status==="uploading"&&jsxRuntime.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[e.progress,"%"]}),jsxRuntime.jsx(M,{type:"button","data-style":"ghost",onClick:n=>{n.stopPropagation(),t();},children:jsxRuntime.jsx(_t,{className:"tiptap-button-icon"})})]})]})]})},zs=({maxSize:e,limit:t,locale:o})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[jsxRuntime.jsx(Vs,{}),jsxRuntime.jsx(Fs,{}),jsxRuntime.jsx("div",{className:"tiptap-image-upload-icon-container",children:jsxRuntime.jsx(Fn,{})})]}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-content",children:[jsxRuntime.jsxs("span",{className:"tiptap-image-upload-text",children:[jsxRuntime.jsx("em",{children:o?.clickToUpload??"Click to upload"})," ",o?.orDragAndDrop??"or drag and drop"]}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:o?.maxFiles?o.maxFiles.replace("{limit}",String(t)).replace("{size}",String(e/1024/1024)):`Maximum ${t} file${t===1?"":"s"}, ${e/1024/1024}MB each.`})]})]}),Kn=e=>{let{accept:t,limit:o,maxSize:n}=e.node.attrs,r=react$1.useRef(null),i=e.extension,a=i.options.locale,s={maxSize:n,limit:o,accept:t,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:c,removeFileItem:d,clearAllFiles:p}=Os(s),m=async g=>{let v=await c(g);if(v.length>0){let b=e.getPos();if(G(b)){let C=v.map((w,L)=>{let T=g[L]?.name.replace(/\.[^/.]+$/,"")||"unknown";return {type:i.options.type,attrs:{...i.options,src:w,alt:T,title:T}}});e.editor.chain().focus().deleteRange({from:b,to:b+e.node.nodeSize}).insertContentAt(b,C).run(),pt(e.editor);}}},f=g=>{let v=g.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}m(Array.from(v));},h=()=>{r.current&&l.length===0&&(r.current.value="",r.current.click());},u=l.length>0;return jsxRuntime.jsxs(react.NodeViewWrapper,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!u&&jsxRuntime.jsx(Ws,{onFile:m,accept:t,children:jsxRuntime.jsx(zs,{maxSize:n,limit:o,locale:a})}),u&&jsxRuntime.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&jsxRuntime.jsxs("div",{className:"tiptap-image-upload-header",children:[jsxRuntime.jsxs("span",{children:[a?.uploading??"Uploading"," ",l.length," files"]}),jsxRuntime.jsx(M,{type:"button","data-style":"ghost",onClick:g=>{g.stopPropagation(),p();},children:a?.clearAll??"Clear All"})]}),l.map(g=>jsxRuntime.jsx(_s,{fileItem:g,onRemove:()=>d(g.id)},g.id))]}),jsxRuntime.jsx("input",{ref:r,name:"file",accept:t,type:"file",multiple:o>1,onChange:f,onClick:g=>g.stopPropagation()})]})};var Wn=react.Node.create({name:"imageUpload",group:"block",draggable:true,selectable:true,atom:true,addOptions(){return {type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{},locale:void 0}},addAttributes(){return {accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return [{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:e}){return ["div",react.mergeAttributes({"data-type":"image-upload"},e)]},addNodeView(){return react.ReactNodeViewRenderer(Kn)},addCommands(){return {setImageUploadNode:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return {Enter:({editor:e})=>{let{selection:t}=e.state,{nodeAfter:o}=t.$from;if(o&&o.type.name==="imageUpload"&&e.isActive("imageUpload")){let n=e.view.nodeDOM(t.$from.pos);if(n&&n instanceof HTMLElement){let r=n.firstChild;if(r&&r instanceof HTMLElement)return r.click(),true}}return false}}}});var _n=Ys__default.default.extend({renderHTML(){return ["div",react.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});var Ue=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));Ue.displayName="ChevronDownIcon";function y(e){let{editor:t}=react.useCurrentEditor(),o=react$1.useMemo(()=>e||t,[e,t]);return react.useEditorState({editor:o,selector(r){return r.editor?{editor:r.editor,editorState:r.editor.state,canCommand:r.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}var N=react$1.forwardRef(({variant:e,size:t="default",appearance:o="default",trimText:n=false,className:r,children:i,...a},s)=>jsxRuntime.jsx("div",{ref:s,className:`tiptap-badge ${r||""}`,"data-style":e,"data-size":t,"data-appearance":o,"data-text-trim":n?"on":"off",...a,children:i}));N.displayName="Badge";function ia({level:e,shortcutKeys:t=qt[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var Zt=react$1.forwardRef(({editor:e,level:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canToggle:m,isActive:f,handleToggle:h,label:u,Icon:g,shortcutKeys:v}=Zn({editor:d,level:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&h();},[h,a]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":u,"aria-pressed":f,tooltip:u,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(ia,{level:t,shortcutKeys:v})]})}):null});Zt.displayName="HeadingButton";var $t=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));$t.displayName="HeadingOneIcon";var Gt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Gt.displayName="HeadingTwoIcon";var Yt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));Yt.displayName="HeadingThreeIcon";var Jt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Jt.displayName="HeadingFourIcon";var Xt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Xt.displayName="HeadingFiveIcon";var jt=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));jt.displayName="HeadingSixIcon";var eo={1:$t,2:Gt,3:Yt,4:Jt,5:Xt,6:jt},qt={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Le(e,t,o=true){return !e||!e.isEditable||!_("heading",e)||D(e,["image"])?false:o?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?t?e.can().setNode("heading",{level:t})||e.can().clearNodes():e.can().setNode("heading")||e.can().clearNodes():false:t?e.can().setNode("heading",{level:t}):e.can().setNode("heading")}function dt(e,t){return !e||!e.isEditable?false:Array.isArray(t)?t.some(o=>e.isActive("heading",{level:o})):t?e.isActive("heading",{level:t}):e.isActive("heading")}function La(e,t){if(!e||!e.isEditable)return false;let o=Array.isArray(t)?t:[t],n=o.find(r=>Le(e,r));if(!n)return false;try{let r=e.view,i=r.state,a=i.tr;if(i.selection.empty||i.selection instanceof state.TextSelection){let p=le({editor:e,node:i.selection.$anchor.node(1)})?.pos;if(!G(p))return !1;a=a.setSelection(state.NodeSelection.create(i.doc,p)),r.dispatch(a),i=r.state;}let s=i.selection,l=e.chain().focus();if(s instanceof state.NodeSelection){let p=s.node.firstChild?.firstChild,m=s.node.lastChild?.lastChild,f=p?s.from+p.nodeSize:s.from+1,h=m?s.to-m.nodeSize:s.to-1,u=i.doc.resolve(f),g=i.doc.resolve(h);l=l.setTextSelection(state.TextSelection.between(u,g)).clearNodes();}return (o.some(p=>e.isActive("heading",{level:p}))?l.setNode("paragraph"):l.setNode("heading",{level:n})).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function to(e){let{editor:t,level:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!_("heading",t)?false:n&&!t.isActive("code")?Array.isArray(o)?o.some(r=>Le(t,r)):Le(t,o):true}function Zn(e){let{editor:t,level:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=Le(i,o),c=dt(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(to({editor:i,level:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=La(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleToggle:d,canToggle:l,label:`Heading ${o}`,shortcutKeys:qt[o],Icon:eo[o]}}function ut({...e}){return jsxRuntime.jsx(B__namespace.Root,{modal:false,...e})}function jn({...e}){return jsxRuntime.jsx(B__namespace.Portal,{...e})}var Oe=react$1.forwardRef(({...e},t)=>jsxRuntime.jsx(B__namespace.Trigger,{ref:t,...e}));Oe.displayName=B__namespace.Trigger.displayName;var mt=B__namespace.Item;var Ma=react$1.forwardRef(({className:e,portal:t=true,...o},n)=>{let r=jsxRuntime.jsx(B__namespace.SubContent,{ref:n,className:S("tiptap-dropdown-menu",e),...o});return t?jsxRuntime.jsx(jn,{...typeof t=="object"?t:{},children:r}):r});Ma.displayName=B__namespace.SubContent.displayName;var Ve=react$1.forwardRef(({className:e,sideOffset:t=4,portal:o=false,...n},r)=>{let i=jsxRuntime.jsx(B__namespace.Content,{ref:r,sideOffset:t,onCloseAutoFocus:a=>a.preventDefault(),className:S("tiptap-dropdown-menu",e),...n});return o?jsxRuntime.jsx(jn,{...typeof o=="object"?o:{},children:i}):i});Ve.displayName=B__namespace.Content.displayName;var X=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card",e),...t}));X.displayName="Card";var Pa=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-header",e),...t}));Pa.displayName="CardHeader";var j=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-body",e),...t}));j.displayName="CardBody";var Fe=react$1.forwardRef(({className:e,orientation:t="vertical",...o},n)=>jsxRuntime.jsx("div",{ref:n,"data-orientation":t,className:S("tiptap-card-item-group",e),...o}));Fe.displayName="CardItemGroup";var Ra=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-group-label",e),...t}));Ra.displayName="CardGroupLabel";var Ta=react$1.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx("div",{ref:o,className:S("tiptap-card-footer",e),...t}));Ta.displayName="CardFooter";var no=react$1.forwardRef(({editor:e,levels:t=[1,2,3,4,5,6],hideWhenUnavailable:o=false,portal:n=false,onOpenChange:r,labels:i,...a},s)=>{let{editor:l}=y(e),[c,d]=react$1.useState(false),{isVisible:p,isActive:m,canToggle:f,Icon:h}=tr({editor:l,levels:t,hideWhenUnavailable:o}),u=react$1.useCallback(g=>{!l||!f||(d(g),r?.(g));},[f,l,r]);return p?jsxRuntime.jsxs(ut,{modal:true,open:c,onOpenChange:u,children:[jsxRuntime.jsx(Oe,{asChild:true,children:jsxRuntime.jsxs(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":m,tooltip:"Heading",...a,ref:s,children:[jsxRuntime.jsx(h,{className:"tiptap-button-icon"}),jsxRuntime.jsx(Ue,{className:"tiptap-button-dropdown-small"})]})}),jsxRuntime.jsx(Ve,{align:"start",portal:n,children:jsxRuntime.jsx(X,{children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Q,{children:t.map(g=>jsxRuntime.jsx(mt,{asChild:true,children:jsxRuntime.jsx(Zt,{editor:l,level:g,text:i?.[`heading${g}`]??`Heading ${g}`,showTooltip:false})},`heading-${g}`))})})})})]}):null});no.displayName="HeadingDropdownMenu";var ro=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));ro.displayName="HeadingIcon";function Na(e,t=[1,2,3,4,5,6]){if(!(!e||!e.isEditable))return t.find(o=>dt(e,o))}function tr(e){let{editor:t,levels:o=[1,2,3,4,5,6],hideWhenUnavailable:n=false}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=Na(r,o),l=dt(r),c=Le(r);return react$1.useEffect(()=>{if(!r)return;let d=()=>{a(to({editor:r,hideWhenUnavailable:n,level:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,n,o]),{isVisible:i,activeLevel:s,isActive:l,canToggle:c,levels:o,label:"Heading",Icon:s?eo[s]:ro}}function Da({shortcutKeys:e=ft}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var io=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onInserted:n,showShortcut:r=false,onClick:i,icon:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canInsert:m,handleImage:f,label:h,isActive:u,shortcutKeys:g,Icon:v}=nr({editor:d,hideWhenUnavailable:o,onInserted:n}),b=react$1.useCallback(w=>{i?.(w),!w.defaultPrevented&&f();},[f,i]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":u?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":h,"aria-pressed":u,tooltip:h,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a??v,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Da,{shortcutKeys:g})]})}):null});io.displayName="ImageUploadButton";function de(e="max",t=768){let[o,n]=react$1.useState(void 0);return react$1.useEffect(()=>{let r=e==="min"?`(min-width: ${t}px)`:`(max-width: ${t-1}px)`,i=window.matchMedia(r),a=s=>n(s.matches);return n(i.matches),i.addEventListener("change",a),()=>i.removeEventListener("change",a)},[e,t]),!!o}var so=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));so.displayName="ImagePlusIcon";var ft="mod+shift+i";function ao(e){return !e||!e.isEditable||!J(e,"imageUpload")?false:e.can().insertContent({type:"imageUpload"})}function $a(e){return !e||!e.isEditable?false:e.isActive("imageUpload")}function Ga(e){if(!e||!e.isEditable||!ao(e))return false;try{return e.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return false}}function Qa(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!J(t,"imageUpload")?false:o&&!t.isActive("code")?ao(t):true}function nr(e){let{editor:t,hideWhenUnavailable:o=false,onInserted:n}=e||{},{editor:r}=y(t),i=de(),[a,s]=react$1.useState(true),l=ao(r),c=$a(r);react$1.useEffect(()=>{if(!r)return;let p=()=>{s(Qa({editor:r,hideWhenUnavailable:o}));};return p(),r.on("selectionUpdate",p),()=>{r.off("selectionUpdate",p);}},[r,o]);let d=react$1.useCallback(()=>{if(!r)return false;let p=Ga(r);return p&&n?.(),p},[r,n]);return reactHotkeysHook.useHotkeys(ft,p=>{p.preventDefault(),d();},{enabled:a&&l,enableOnContentEditable:!i,enableOnFormTags:true}),{isVisible:a,isActive:c,handleImage:d,canInsert:l,label:"Add image",shortcutKeys:ft,Icon:so}}function Xa({type:e,shortcutKeys:t=po[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var lo=react$1.forwardRef(({editor:e,type:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,canToggle:m,isActive:f,handleToggle:h,label:u,shortcutKeys:g,Icon:v}=ir({editor:d,type:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&h();},[h,a]);return p?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!m,"data-disabled":!m,"aria-label":u,"aria-pressed":f,tooltip:u,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(v,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(Xa,{type:t,shortcutKeys:g})]})}):null});lo.displayName="ListButton";var Te=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Te.displayName="ListIcon";var _e=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));_e.displayName="ListOrderedIcon";var Ze=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Ze.displayName="ListTodoIcon";var co={bulletList:Te,orderedList:_e,taskList:Ze},cl={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},po={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function qe(e,t,o=true){if(!e||!e.isEditable||!_(t,e)||D(e,["image"]))return false;if(!o)switch(t){case "bulletList":return e.can().toggleBulletList();case "orderedList":return e.can().toggleOrderedList();case "taskList":return e.can().toggleList("taskList","taskItem");default:return false}if(!pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"]))return false;switch(t){case "bulletList":return e.can().toggleBulletList()||e.can().clearNodes();case "orderedList":return e.can().toggleOrderedList()||e.can().clearNodes();case "taskList":return e.can().toggleList("taskList","taskItem")||e.can().clearNodes();default:return false}}function gt(e,t){if(!e||!e.isEditable)return false;switch(t){case "bulletList":return e.isActive("bulletList");case "orderedList":return e.isActive("orderedList");case "taskList":return e.isActive("taskList");default:return false}}function dl(e,t){if(!e||!e.isEditable||!qe(e,t))return false;try{let o=e.view,n=o.state,r=n.tr;if(n.selection.empty||n.selection instanceof state.TextSelection){let s=le({editor:e,node:n.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;r=r.setSelection(state.NodeSelection.create(n.doc,s)),o.dispatch(r),n=o.state;}let i=n.selection,a=e.chain().focus();if(i instanceof state.NodeSelection){let s=i.node.firstChild?.firstChild,l=i.node.lastChild?.lastChild,c=s?i.from+s.nodeSize:i.from+1,d=l?i.to-l.nodeSize:i.to-1,p=n.doc.resolve(c),m=n.doc.resolve(d);a=a.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}if(e.isActive(t))a.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else {let l={bulletList:()=>a.toggleBulletList(),orderedList:()=>a.toggleOrderedList(),taskList:()=>a.toggleList("taskList","taskItem")}[t];if(!l)return !1;l().run();}return e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function ul(e){let{editor:t,type:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!_(o,t)?false:n&&!t.isActive("code")?qe(t,o):true}function ir(e){let{editor:t,type:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=qe(i,o),c=gt(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(ul({editor:i,type:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=dl(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleToggle:d,canToggle:l,label:cl[o],shortcutKeys:po[o],Icon:co[o]}}var hl=[{label:"Bullet List",type:"bulletList",icon:Te},{label:"Ordered List",type:"orderedList",icon:_e},{label:"Task List",type:"taskList",icon:Ze}];function Cl(e,t){return !e||!e.isEditable?false:t.some(o=>qe(e,o))}function vl(e,t){return !e||!e.isEditable?false:t.some(o=>gt(e,o))}function bl(e){return hl.filter(t=>!t.type||e.includes(t.type))}function yl(e){let{editor:t,hideWhenUnavailable:o,listInSchema:n,canToggleAny:r}=e;return !n||!t?false:o&&!t.isActive("code")?r:true}function xl(e,t){if(!(!e||!e.isEditable))return t.find(o=>gt(e,o))}function lr(e){let{editor:t,types:o=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=false}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=o.some(f=>_(f,r)),l=react$1.useMemo(()=>bl(o),[o]),c=Cl(r,o),d=vl(r,o),p=xl(r,o),m=l.find(f=>f.type===p);return react$1.useEffect(()=>{if(!r)return;let f=()=>{a(yl({editor:r,hideWhenUnavailable:n,listInSchema:s,canToggleAny:c}));};return f(),r.on("selectionUpdate",f),()=>{r.off("selectionUpdate",f);}},[c,r,n,s,o]),{isVisible:i,activeType:p,isActive:d,canToggle:c,types:o,filteredLists:l,label:"List",Icon:m?co[m.type]:Te}}function cr({editor:e,types:t=["bulletList","orderedList","taskList"],hideWhenUnavailable:o=false,onOpenChange:n,portal:r=false,labels:i,...a}){let{editor:s}=y(e),[l,c]=react$1.useState(false),{filteredLists:d,canToggle:p,isActive:m,isVisible:f,Icon:h}=lr({editor:s,types:t,hideWhenUnavailable:o}),u=react$1.useCallback(g=>{c(g),n?.(g);},[n]);return f?jsxRuntime.jsxs(ut,{open:l,onOpenChange:u,children:[jsxRuntime.jsx(Oe,{asChild:true,children:jsxRuntime.jsxs(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":"List options",tooltip:"List",...a,children:[jsxRuntime.jsx(h,{className:"tiptap-button-icon"}),jsxRuntime.jsx(Ue,{className:"tiptap-button-dropdown-small"})]})}),jsxRuntime.jsx(Ve,{align:"start",portal:r,children:jsxRuntime.jsx(X,{children:jsxRuntime.jsx(j,{children:jsxRuntime.jsx(Q,{children:d.map(g=>jsxRuntime.jsx(mt,{asChild:true,children:jsxRuntime.jsx(lo,{editor:s,type:g.type,text:i?.[g.type]??g.label,showTooltip:false})},g.type))})})})})]}):null}function Rl({shortcutKeys:e=mo}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var uo=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onToggled:n,showShortcut:r=false,onClick:i,children:a,...s},l)=>{let{editor:c}=y(e),{isVisible:d,canToggle:p,isActive:m,handleToggle:f,label:h,shortcutKeys:u,Icon:g}=dr({editor:c,hideWhenUnavailable:o,onToggled:n}),v=react$1.useCallback(b=>{i?.(b),!b.defaultPrevented&&f();},[f,i]);return d?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",tabIndex:-1,disabled:!p,"data-disabled":!p,"aria-label":h,"aria-pressed":m,tooltip:"Blockquote",onClick:v,...s,ref:l,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Rl,{shortcutKeys:u})]})}):null});uo.displayName="BlockquoteButton";var fo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));fo.displayName="BlockquoteIcon";var mo="mod+shift+b";function go(e,t=true){return !e||!e.isEditable||!_("blockquote",e)||D(e,["image"])?false:t?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?e.can().toggleWrap("blockquote")||e.can().clearNodes():false:e.can().toggleWrap("blockquote")}function Nl(e){if(!e||!e.isEditable||!go(e))return false;try{let t=e.view,o=t.state,n=o.tr;if(o.selection.empty||o.selection instanceof state.TextSelection){let s=le({editor:e,node:o.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;n=n.setSelection(state.NodeSelection.create(o.doc,s)),t.dispatch(n),o=t.state;}let r=o.selection,i=e.chain().focus();if(r instanceof state.NodeSelection){let s=r.node.firstChild?.firstChild,l=r.node.lastChild?.lastChild,c=s?r.from+s.nodeSize:r.from+1,d=l?r.to-l.nodeSize:r.to-1,p=o.doc.resolve(c),m=o.doc.resolve(d);i=i.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}return (e.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function Bl(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!_("blockquote",t)?false:o&&!t.isActive("code")?go(t):true}function dr(e){let{editor:t,hideWhenUnavailable:o=false,onToggled:n}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=go(r),l=r?.isActive("blockquote")||false;react$1.useEffect(()=>{if(!r)return;let d=()=>{a(Bl({editor:r,hideWhenUnavailable:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,o]);let c=react$1.useCallback(()=>{if(!r)return false;let d=Nl(r);return d&&n?.(),d},[r,n]);return {isVisible:i,isActive:l,handleToggle:c,canToggle:s,label:"Blockquote",shortcutKeys:mo,Icon:fo}}function Ol({shortcutKeys:e=Co}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var ho=react$1.forwardRef(({editor:e,text:t,hideWhenUnavailable:o=false,onToggled:n,showShortcut:r=false,onClick:i,children:a,...s},l)=>{let{editor:c}=y(e),{isVisible:d,canToggle:p,isActive:m,handleToggle:f,label:h,shortcutKeys:u,Icon:g}=fr({editor:c,hideWhenUnavailable:o,onToggled:n}),v=react$1.useCallback(b=>{i?.(b),!b.defaultPrevented&&f();},[f,i]);return d?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":m?"on":"off",role:"button",disabled:!p,"data-disabled":!p,tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:"Code Block",onClick:v,...s,ref:l,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),t&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:t}),r&&jsxRuntime.jsx(Ol,{shortcutKeys:u})]})}):null});ho.displayName="CodeBlockButton";var bo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));bo.displayName="CodeBlockIcon";var Co="mod+alt+c";function yo(e,t=true){return !e||!e.isEditable||!_("codeBlock",e)||D(e,["image"])?false:t?pe(e,["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock"])?e.can().toggleNode("codeBlock","paragraph")||e.can().clearNodes():false:e.can().toggleNode("codeBlock","paragraph")}function ql(e){if(!e||!e.isEditable||!yo(e))return false;try{let t=e.view,o=t.state,n=o.tr;if(o.selection.empty||o.selection instanceof state.TextSelection){let s=le({editor:e,node:o.selection.$anchor.node(1)})?.pos;if(!G(s))return !1;n=n.setSelection(state.NodeSelection.create(o.doc,s)),t.dispatch(n),o=t.state;}let r=o.selection,i=e.chain().focus();if(r instanceof state.NodeSelection){let s=r.node.firstChild?.firstChild,l=r.node.lastChild?.lastChild,c=s?r.from+s.nodeSize:r.from+1,d=l?r.to-l.nodeSize:r.to-1,p=o.doc.resolve(c),m=o.doc.resolve(d);i=i.setTextSelection(state.TextSelection.between(p,m)).clearNodes();}return (e.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),e.chain().focus().selectTextblockEnd().run(),!0}catch{return false}}function $l(e){let{editor:t,hideWhenUnavailable:o}=e;return !t||!t.isEditable||!_("codeBlock",t)?false:o&&!t.isActive("code")?yo(t):true}function fr(e){let{editor:t,hideWhenUnavailable:o=false,onToggled:n}=e||{},{editor:r}=y(t),[i,a]=react$1.useState(true),s=yo(r),l=r?.isActive("codeBlock")||false;react$1.useEffect(()=>{if(!r)return;let d=()=>{a($l({editor:r,hideWhenUnavailable:o}));};return d(),r.on("selectionUpdate",d),()=>{r.off("selectionUpdate",d);}},[r,o]);let c=react$1.useCallback(()=>{if(!r)return false;let d=ql(r);return d&&n?.(),d},[r,n]);return {isVisible:i,isActive:l,handleToggle:c,canToggle:s,label:"Code Block",shortcutKeys:Co,Icon:bo}}var xo=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));xo.displayName="BanIcon";var Qe=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));Qe.displayName="HighlighterIcon";function vt({...e}){return jsxRuntime.jsx(ue__namespace.Root,{...e})}function bt({...e}){return jsxRuntime.jsx(ue__namespace.Trigger,{...e})}function yt({className:e,align:t="center",sideOffset:o=4,...n}){return jsxRuntime.jsx(ue__namespace.Portal,{children:jsxRuntime.jsx(ue__namespace.Content,{align:t,sideOffset:o,className:S("tiptap-popover",e),...n})})}function jl({shortcutKeys:e=xt}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:e})})}var wo=react$1.forwardRef(({editor:e,highlightColor:t,text:o,hideWhenUnavailable:n=false,mode:r="mark",onApplied:i,showShortcut:a=false,onClick:s,children:l,style:c,...d},p)=>{let{editor:m}=y(e),{isVisible:f,canColorHighlight:h,isActive:u,handleColorHighlight:g,label:v,shortcutKeys:b}=Je({editor:m,highlightColor:t,label:o||`Toggle highlight (${t})`,hideWhenUnavailable:n,mode:r,onApplied:i}),C=react$1.useCallback(L=>{s?.(L),!L.defaultPrevented&&g();},[g,s]),w=react$1.useMemo(()=>({...c,"--highlight-color":t}),[t,c]);return f?jsxRuntime.jsx(M,{type:"button","data-style":"ghost","data-active-state":u?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":u,tooltip:v,onClick:C,style:w,...d,ref:p,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":t}}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),a&&jsxRuntime.jsx(jl,{shortcutKeys:b})]})}):null});wo.displayName="ColorHighlightButton";var xt="mod+shift+h",i1=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Lo(e){let t=new Map(i1.map(o=>[o.value,o]));return e.map(o=>t.get(o)).filter(o=>!!o)}function Mo(e,t="mark"){if(!e||!e.isEditable)return false;if(t==="mark")return !ae("highlight",e)||D(e,["image"])?false:e.can().setMark("highlight");if(!J(e,["nodeBackground"]))return false;try{return e.can().toggleNodeBackgroundColor("test")}catch{return false}}function s1(e,t,o="mark"){if(!e||!e.isEditable)return false;if(o==="mark")return t?e.isActive("highlight",{color:t}):e.isActive("highlight");if(!t)return false;try{let{state:n}=e,{selection:r}=n,i=r.$anchor;for(let a=i.depth;a>=0;a--){let s=i.node(a);if(s&&s.attrs?.backgroundColor===t)return !0}return !1}catch{return false}}function a1(e,t="mark"){return !e||!e.isEditable||!Mo(e,t)?false:t==="mark"?e.chain().focus().unsetMark("highlight").run():e.chain().focus().unsetNodeBackgroundColor().run()}function l1(e){let{editor:t,hideWhenUnavailable:o,mode:n}=e;if(!t||!t.isEditable)return false;if(n==="mark"){if(!ae("highlight",t))return false}else if(!J(t,["nodeBackground"]))return false;return o&&!t.isActive("code")?Mo(t,n):true}function Je(e){let{editor:t,label:o,highlightColor:n,hideWhenUnavailable:r=false,mode:i="mark",onApplied:a}=e,{editor:s}=y(t),l=de(),[c,d]=react$1.useState(true),p=Mo(s,i),m=s1(s,n,i);react$1.useEffect(()=>{if(!s)return;let u=()=>{d(l1({editor:s,hideWhenUnavailable:r,mode:i}));};return u(),s.on("selectionUpdate",u),()=>{s.off("selectionUpdate",u);}},[s,r,i]);let f=react$1.useCallback(()=>{if(!s||!p||!n||!o)return false;if(i==="mark"){if(s.state.storedMarks){let u=s.schema.marks.highlight;u&&s.view.dispatch(s.state.tr.removeStoredMark(u));}return setTimeout(()=>{let u=s.chain().focus().toggleMark("highlight",{color:n}).run();return u&&a?.({color:n,label:o,mode:i}),u},0),true}else {let u=s.chain().focus().toggleNodeBackgroundColor(n).run();return u&&a?.({color:n,label:o,mode:i}),u}},[p,n,s,o,a,i]),h=react$1.useCallback(()=>{let u=a1(s,i);return u&&a?.({color:"",label:"Remove highlight",mode:i}),u},[s,a,i]);return reactHotkeysHook.useHotkeys(xt,u=>{u.preventDefault(),f();},{enabled:c&&p,enableOnContentEditable:!l,enableOnFormTags:true}),{isVisible:c,isActive:m,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:p,label:o||"Highlight",shortcutKeys:xt,Icon:Qe,mode:i}}var yr=react$1.forwardRef(({className:e,children:t,...o},n)=>jsxRuntime.jsx(M,{type:"button",className:e,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:n,...o,children:t??jsxRuntime.jsx(Qe,{className:"tiptap-button-icon"})}));yr.displayName="ColorHighlightPopoverButton";function m1({editor:e,colors:t=Lo(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),removeTooltip:o="Remove highlight"}){let{handleRemoveHighlight:n}=Je({editor:e}),r=de(),i=react$1.useRef(null),a=react$1.useMemo(()=>[...t,{label:o,value:"none"}],[t,o]),{selectedIndex:s}=ct({containerRef:i,items:a,orientation:"both",onSelect:l=>{if(!i.current)return false;let c=i.current.querySelector('[data-highlighted="true"]');return c&&c.click(),l.value==="none"&&n(),true},autoSelectFirstItem:false});return jsxRuntime.jsx(X,{ref:i,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:jsxRuntime.jsx(j,{style:r?{padding:0}:{},children:jsxRuntime.jsxs(Fe,{orientation:"horizontal",children:[jsxRuntime.jsx(Q,{orientation:"horizontal",children:t.map((l,c)=>jsxRuntime.jsx(wo,{editor:e,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:c===s?0:-1,"data-highlighted":s===c},l.value))}),jsxRuntime.jsx(he,{}),jsxRuntime.jsx(Q,{orientation:"horizontal",children:jsxRuntime.jsx(M,{onClick:n,"aria-label":o,tooltip:o,tabIndex:s===t.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===t.length,children:jsxRuntime.jsx(xo,{className:"tiptap-button-icon"})})})]})})})}function xr({editor:e,colors:t=Lo(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:o=false,onApplied:n,removeTooltip:r,...i}){let{editor:a}=y(e),[s,l]=react$1.useState(false),{isVisible:c,canColorHighlight:d,isActive:p,label:m,Icon:f}=Je({editor:a,hideWhenUnavailable:o,onApplied:n});return c?jsxRuntime.jsxs(vt,{open:s,onOpenChange:l,children:[jsxRuntime.jsx(bt,{asChild:true,children:jsxRuntime.jsx(yr,{disabled:!d,"data-active-state":p?"on":"off","data-disabled":!d,"aria-pressed":p,"aria-label":m,tooltip:m,...i,children:jsxRuntime.jsx(f,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(yt,{"aria-label":"Highlight colors",children:jsxRuntime.jsx(m1,{editor:a,colors:t,removeTooltip:r})})]}):null}var Po=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Po.displayName="CornerDownLeftIcon";var Ro=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));Ro.displayName="ExternalLinkIcon";var Xe=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));Xe.displayName="LinkIcon";var To=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));To.displayName="TrashIcon";function Tr({className:e,type:t,...o}){return jsxRuntime.jsx("input",{type:t,className:S("tiptap-input",e),...o})}function Er({className:e,children:t,...o}){return jsxRuntime.jsx("div",{className:S("tiptap-input-group",e),...o,children:t})}var Ir=react$1.forwardRef(({className:e,children:t,...o},n)=>jsxRuntime.jsx(M,{type:"button",className:e,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:n,...o,children:t||jsxRuntime.jsx(Xe,{className:"tiptap-button-icon"})}));Ir.displayName="LinkButton";var w1=({url:e,setUrl:t,setLink:o,removeLink:n,openLink:r,isActive:i,placeholder:a="Paste a link...",applyTooltip:s="Apply link",openTooltip:l="Open in new window",removeTooltip:c="Remove link"})=>{let d=de(),p=m=>{m.key==="Enter"&&(m.preventDefault(),o());};return jsxRuntime.jsx(X,{style:{...d?{boxShadow:"none",border:0}:{}},children:jsxRuntime.jsx(j,{style:{...d?{padding:0}:{}},children:jsxRuntime.jsxs(Fe,{orientation:"horizontal",children:[jsxRuntime.jsx(Er,{children:jsxRuntime.jsx(Tr,{type:"url",placeholder:a,value:e,onChange:m=>t(m.target.value),onKeyDown:p,autoFocus:true,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),jsxRuntime.jsx(Q,{orientation:"horizontal",children:jsxRuntime.jsx(M,{type:"button",onClick:o,title:s,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(Po,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(he,{}),jsxRuntime.jsxs(Q,{orientation:"horizontal",children:[jsxRuntime.jsx(M,{type:"button",onClick:r,title:l,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(Ro,{className:"tiptap-button-icon"})}),jsxRuntime.jsx(M,{type:"button",onClick:n,title:c,disabled:!e&&!i,"data-style":"ghost",children:jsxRuntime.jsx(To,{className:"tiptap-button-icon"})})]})]})})})};var So=react$1.forwardRef(({editor:e,hideWhenUnavailable:t=false,onSetLink:o,onOpenChange:n,autoOpenOnLinkActive:r=true,onClick:i,children:a,placeholder:s,applyTooltip:l,openTooltip:c,removeTooltip:d,...p},m)=>{let{editor:f}=y(e),[h,u]=react$1.useState(false),{isVisible:g,canSet:v,isActive:b,url:C,setUrl:w,setLink:L,removeLink:T,openLink:E,label:me,Icon:Y}=Hr({editor:f,hideWhenUnavailable:t,onSetLink:o}),re=react$1.useCallback(ie=>{u(ie),n?.(ie);},[n]),q=react$1.useCallback(()=>{L(),u(false);},[L]),Ie=react$1.useCallback(ie=>{i?.(ie),!ie.defaultPrevented&&u(!h);},[i,h]);return react$1.useEffect(()=>{r&&b&&u(true);},[r,b]),g?jsxRuntime.jsxs(vt,{open:h,onOpenChange:re,children:[jsxRuntime.jsx(bt,{asChild:true,children:jsxRuntime.jsx(Ir,{disabled:!v,"data-active-state":b?"on":"off","data-disabled":!v,"aria-label":me,"aria-pressed":b,onClick:Ie,...p,ref:m,children:a??jsxRuntime.jsx(Y,{className:"tiptap-button-icon"})})}),jsxRuntime.jsx(yt,{children:jsxRuntime.jsx(w1,{url:C,setUrl:w,setLink:q,removeLink:T,openLink:E,isActive:b,placeholder:s,applyTooltip:l,openTooltip:c,removeTooltip:d})})]}):null});So.displayName="LinkPopover";function Nr(e){return !e||!e.isEditable||D(e,["image"],true)?false:e.can().setMark("link")}function Br(e){return !e||!e.isEditable?false:e.isActive("link")}function L1(e){let{editor:t,hideWhenUnavailable:o}=e;return !ae("link",t)||!t?false:o&&!t.isActive("code")?Nr(t):true}function M1(e){let{editor:t,onSetLink:o}=e,[n,r]=react$1.useState(null);react$1.useEffect(()=>{if(!t)return;let{href:l}=t.getAttributes("link");Br(t)&&n===null&&r(l||"");},[t,n]),react$1.useEffect(()=>{if(!t)return;let l=()=>{let{href:c}=t.getAttributes("link");r(c||"");};return t.on("selectionUpdate",l),()=>{t.off("selectionUpdate",l);}},[t]);let i=react$1.useCallback(()=>{if(!n||!t)return;let{selection:l}=t.state,c=l.empty,d=t.chain().focus();d=d.extendMarkRange("link").setLink({href:n}),c&&(d=d.insertContent({type:"text",text:n})),d.run(),r(null),o?.();},[t,o,n]),a=react$1.useCallback(()=>{t&&(t.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",true).run(),r(""));},[t]),s=react$1.useCallback((l="_blank",c="noopener,noreferrer")=>{if(!n)return;let d=Sn(n,window.location.href);d!=="#"&&window.open(d,l,c);},[n]);return {url:n||"",setUrl:r,setLink:i,removeLink:a,openLink:s}}function P1(e){let{editor:t,hideWhenUnavailable:o=false}=e,n=Nr(t),r=Br(t),[i,a]=react$1.useState(true);return react$1.useEffect(()=>{if(!t)return;let s=()=>{a(L1({editor:t,hideWhenUnavailable:o}));};return s(),t.on("selectionUpdate",s),()=>{t.off("selectionUpdate",s);}},[t,o]),{isVisible:i,canSet:n,isActive:r}}function Hr(e){let{editor:t,hideWhenUnavailable:o=false,onSetLink:n}=e||{},{editor:r}=y(t),{isVisible:i,canSet:a,isActive:s}=P1({editor:r,hideWhenUnavailable:o}),l=M1({editor:r,onSetLink:n});return {isVisible:i,canSet:a,isActive:s,label:"Link",Icon:Xe,...l}}function E1({type:e,shortcutKeys:t=Ao[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var oe=react$1.forwardRef(({editor:e,type:t,text:o,hideWhenUnavailable:n=false,onToggled:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,handleMark:m,label:f,canToggle:h,isActive:u,Icon:g,shortcutKeys:v}=Ur({editor:d,type:t,hideWhenUnavailable:n,onToggled:r}),b=react$1.useCallback(C=>{a?.(C),!C.defaultPrevented&&m();},[m,a]);return p?jsxRuntime.jsx(M,{type:"button",disabled:!h,"data-style":"ghost","data-active-state":u?"on":"off","data-disabled":!h,role:"button",tabIndex:-1,"aria-label":f,"aria-pressed":u,tooltip:f,onClick:b,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(g,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(E1,{type:t,shortcutKeys:v})]})}):null});oe.displayName="MarkButton";var No=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));No.displayName="BoldIcon";var Uo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));Uo.displayName="Code2Icon";var Do=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));Do.displayName="ItalicIcon";var Oo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));Oo.displayName="StrikeIcon";var Fo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));Fo.displayName="SubscriptIcon";var Wo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));Wo.displayName="SuperscriptIcon";var _o=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));_o.displayName="UnderlineIcon";var Z1={bold:No,italic:Do,underline:_o,strike:Oo,code:Uo,superscript:Wo,subscript:Fo},Ao={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function zo(e,t){return !e||!e.isEditable||!ae(t,e)||D(e,["image"])?false:e.can().toggleMark(t)}function q1(e,t){return !e||!e.isEditable?false:e.isActive(t)}function $1(e,t){return !e||!e.isEditable||!zo(e,t)?false:e.chain().focus().toggleMark(t).run()}function G1(e){let{editor:t,type:o,hideWhenUnavailable:n}=e;return !t||!t.isEditable||!ae(o,t)?false:n&&!t.isActive("code")?zo(t,o):true}function Q1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ur(e){let{editor:t,type:o,hideWhenUnavailable:n=false,onToggled:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=zo(i,o),c=q1(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(G1({editor:i,type:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,o,n]);let d=react$1.useCallback(()=>{if(!i)return false;let p=$1(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleMark:d,canToggle:l,label:Q1(o),shortcutKeys:Ao[o],Icon:Z1[o]}}function X1({align:e,shortcutKeys:t=Zo[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var ke=react$1.forwardRef(({editor:e,align:t,text:o,hideWhenUnavailable:n=false,onAligned:r,showShortcut:i=false,onClick:a,icon:s,children:l,...c},d)=>{let{editor:p}=y(e),{isVisible:m,handleTextAlign:f,label:h,canAlign:u,isActive:g,Icon:v,shortcutKeys:b}=Kr({editor:p,align:t,hideWhenUnavailable:n,onAligned:r}),C=react$1.useCallback(L=>{a?.(L),!L.defaultPrevented&&f();},[f,a]);return m?jsxRuntime.jsx(M,{type:"button",disabled:!u,"data-style":"ghost","data-active-state":g?"on":"off","data-disabled":!u,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":g,tooltip:h,onClick:C,...c,ref:d,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(s??v,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(X1,{align:t,shortcutKeys:b})]})}):null});ke.displayName="TextAlignButton";var $o=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));$o.displayName="AlignCenterIcon";var Qo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Qo.displayName="AlignJustifyIcon";var Jo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));Jo.displayName="AlignLeftIcon";var jo=react$1.memo(({className:e,...t})=>jsxRuntime.jsxs("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));jo.displayName="AlignRightIcon";var Zo={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},up={left:Jo,center:$o,right:jo,justify:Qo},mp={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function en(e,t){return !e||!e.isEditable||!J(e,"textAlign")||D(e,["image","horizontalRule"])?false:e.can().setTextAlign(t)}function fp(e){return "setTextAlign"in e}function gp(e,t){return !e||!e.isEditable?false:e.isActive({textAlign:t})}function hp(e,t){if(!e||!e.isEditable||!en(e,t))return false;let o=e.chain().focus();return fp(o)?o.setTextAlign(t).run():false}function Cp(e){let{editor:t,hideWhenUnavailable:o,align:n}=e;return !t||!t.isEditable||!J(t,"textAlign")?false:o&&!t.isActive("code")?en(t,n):true}function Kr(e){let{editor:t,align:o,hideWhenUnavailable:n=false,onAligned:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=en(i,o),c=gp(i,o);react$1.useEffect(()=>{if(!i)return;let p=()=>{s(Cp({editor:i,align:o,hideWhenUnavailable:n}));};return p(),i.on("selectionUpdate",p),()=>{i.off("selectionUpdate",p);}},[i,n,o]);let d=react$1.useCallback(()=>{if(!i)return false;let p=hp(i,o);return p&&r?.(),p},[i,o,r]);return {isVisible:a,isActive:c,handleTextAlign:d,canAlign:l,label:mp[o],shortcutKeys:Zo[o],Icon:up[o]}}function yp({action:e,shortcutKeys:t=tn[e]}){return jsxRuntime.jsx(N,{children:I({shortcutKeys:t})})}var wt=react$1.forwardRef(({editor:e,action:t,text:o,hideWhenUnavailable:n=false,onExecuted:r,showShortcut:i=false,onClick:a,children:s,...l},c)=>{let{editor:d}=y(e),{isVisible:p,handleAction:m,label:f,canExecute:h,Icon:u,shortcutKeys:g}=Wr({editor:d,action:t,hideWhenUnavailable:n,onExecuted:r}),v=react$1.useCallback(b=>{a?.(b),!b.defaultPrevented&&m();},[m,a]);return p?jsxRuntime.jsx(M,{type:"button",disabled:!h,"data-style":"ghost","data-disabled":!h,role:"button",tabIndex:-1,"aria-label":f,tooltip:f,onClick:v,...l,ref:c,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(u,{className:"tiptap-button-icon"}),o&&jsxRuntime.jsx("span",{className:"tiptap-button-text",children:o}),i&&jsxRuntime.jsx(yp,{action:t,shortcutKeys:g})]})}):null});wt.displayName="UndoRedoButton";var on=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));on.displayName="Redo2Icon";var nn=react$1.memo(({className:e,...t})=>jsxRuntime.jsx("svg",{width:"24",height:"24",className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));nn.displayName="Undo2Icon";var tn={undo:"mod+z",redo:"mod+shift+z"},Ep={undo:"Undo",redo:"Redo"},kp={undo:nn,redo:on};function rn(e,t){return !e||!e.isEditable||D(e,["image"])?false:t==="undo"?e.can().undo():e.can().redo()}function Sp(e,t){if(!e||!e.isEditable||!rn(e,t))return false;let o=e.chain().focus();return t==="undo"?o.undo().run():o.redo().run()}function Ip(e){let{editor:t,hideWhenUnavailable:o,action:n}=e;return !t||!t.isEditable?false:o&&!t.isActive("code")?rn(t,n):true}function Wr(e){let{editor:t,action:o,hideWhenUnavailable:n=false,onExecuted:r}=e,{editor:i}=y(t),[a,s]=react$1.useState(true),l=rn(i,o);react$1.useEffect(()=>{if(!i)return;let d=()=>{s(Ip({editor:i,hideWhenUnavailable:n,action:o}));};return d(),i.on("transaction",d),()=>{i.off("transaction",d);}},[i,n,o]);let c=react$1.useCallback(()=>{if(!i)return false;let d=Sp(i,o);return d&&r?.(),d},[i,o,r]);return {isVisible:a,handleAction:c,canExecute:l,label:Ep[o],shortcutKeys:tn[o],Icon:kp[o]}}var Zr=react$1.createContext(xe);function sn({locale:e,children:t}){let o={...xe,...e};return jsxRuntime.jsx(Zr.Provider,{value:o,children:t})}function Lt(){return react$1.useContext(Zr)}function pn(e){let t=e.state.doc;return Mt(t)}function Mt(e,t=0){let o=[];return e.forEach((n,r,i)=>{o.push(Bp(n,t,i));}),o.join("")}function Bp(e,t,o){switch(e.type.name){case "doc":return Mt(e,t);case "paragraph":let r=ln(e);return o>0?`
8
8
 
9
- `+r:r;case "heading":{let i=e.attrs.level||1,a="#".repeat(i)+" ",s=un(e);return (o>0?`
9
+ `+r:r;case "heading":{let i=e.attrs.level||1,a="#".repeat(i)+" ",s=ln(e);return (o>0?`
10
10
 
11
11
  `:"")+a+s}case "bulletList":return (o>0?`
12
12
 
13
- `:"")+dn(e,"-",t);case "orderedList":return (o>0?`
13
+ `:"")+an(e,"-",t);case "orderedList":return (o>0?`
14
14
 
15
- `:"")+dn(e,"1.",t);case "listItem":return Mt(e,t);case "blockquote":{let a=Mt(e,t).split(`
15
+ `:"")+an(e,"1.",t);case "listItem":return Mt(e,t);case "blockquote":{let a=Mt(e,t).split(`
16
16
  `).map(s=>"> "+s);return (o>0?`
17
17
 
18
18
  `:"")+a.join(`
@@ -22,11 +22,11 @@
22
22
  `+a+"\n```"}case "horizontalRule":return (o>0?`
23
23
 
24
24
  `:"")+"---";case "hardBreak":return `
25
- `;case "image":{let{src:i,alt:a,title:s}=e.attrs,l=s?` "${s}"`:"";return `![${a||""}](${i}${l})`}default:return e.isText?qr(e):e.textContent||""}}function dn(e,t,o){let n=[],r=" ".repeat(o);return e.forEach((i,a,s)=>{let l=t==="1."?`${s+1}.`:t,c=un(i.firstChild);n.push(r+l+" "+c),i.forEach((d,p,m)=>{m>0&&(d.type.name==="bulletList"||d.type.name==="orderedList")&&n.push(dn(d,d.type.name==="bulletList"?"-":"1.",o+1));});}),n.join(`
26
- `)}function un(e){if(!e)return "";let t=[];return e.forEach(o=>{if(o.isText)t.push(qr(o));else if(o.type.name==="hardBreak")t.push(`
27
- `);else if(o.type.name==="image"){let{src:n,alt:r,title:i}=o.attrs,a=i?` "${i}"`:"";t.push(`![${r||""}](${n}${a})`);}else t.push(o.textContent||"");}),t.join("")}function qr(e){let t=e.text||"";if(!e.marks||e.marks.length===0)return dc(t);let o=[...e.marks].sort((n,r)=>{let i=["link","code","bold","italic","strike"];return i.indexOf(n.type.name)-i.indexOf(r.type.name)});for(let n of o)switch(n.type.name){case "bold":t=`**${t}**`;break;case "italic":t=`*${t}*`;break;case "strike":t=`~~${t}~~`;break;case "code":t=`\`${t}\``;break;case "link":let r=n.attrs.href||"";t=`[${t}](${r})`;break}return t}function dc(e){return e.replace(/([\\`*_{}[\]()#+\-.!])/g,"\\$1")}function uc(e){let t=e.split(`
25
+ `;case "image":{let{src:i,alt:a,title:s}=e.attrs,l=s?` "${s}"`:"";return `![${a||""}](${i}${l})`}default:return e.isText?qr(e):e.textContent||""}}function an(e,t,o){let n=[],r=" ".repeat(o);return e.forEach((i,a,s)=>{let l=t==="1."?`${s+1}.`:t,c=ln(i.firstChild);n.push(r+l+" "+c),i.forEach((d,p,m)=>{m>0&&(d.type.name==="bulletList"||d.type.name==="orderedList")&&n.push(an(d,d.type.name==="bulletList"?"-":"1.",o+1));});}),n.join(`
26
+ `)}function ln(e){if(!e)return "";let t=[];return e.forEach(o=>{if(o.isText)t.push(qr(o));else if(o.type.name==="hardBreak")t.push(`
27
+ `);else if(o.type.name==="image"){let{src:n,alt:r,title:i}=o.attrs,a=i?` "${i}"`:"";t.push(`![${r||""}](${n}${a})`);}else t.push(o.textContent||"");}),t.join("")}function qr(e){let t=e.text||"";if(!e.marks||e.marks.length===0)return Up(t);let o=[...e.marks].sort((n,r)=>{let i=["link","code","bold","italic","strike"];return i.indexOf(n.type.name)-i.indexOf(r.type.name)});for(let n of o)switch(n.type.name){case "bold":t=`**${t}**`;break;case "italic":t=`*${t}*`;break;case "strike":t=`~~${t}~~`;break;case "code":t=`\`${t}\``;break;case "link":let r=n.attrs.href||"";t=`[${t}](${r})`;break}return t}function Up(e){return e.replace(/([\\`*_{}[\]()#+\-.!])/g,"\\$1")}function Dp(e){let t=e.split(`
28
28
  `),o=[],n=0;for(;n<t.length;){let r=t[n];if(r.startsWith("```")){let s=r.slice(3).trim(),l=[];for(n++;n<t.length&&!t[n].startsWith("```");)l.push(t[n]),n++;o.push({type:"codeBlock",attrs:{language:s},content:[{type:"text",text:l.join(`
29
29
  `)}]}),n++;continue}let i=r.match(/^(#{1,6})\s+(.+)$/);if(i){o.push({type:"heading",attrs:{level:i[1].length},content:ot(i[2])}),n++;continue}if(r.startsWith("> ")){let s=[];for(;n<t.length&&t[n].startsWith("> ");)s.push(t[n].slice(2)),n++;o.push({type:"blockquote",content:[{type:"paragraph",content:ot(s.join(`
30
- `))}]});continue}if(r.match(/^(-{3,}|_{3,}|\*{3,})$/)){o.push({type:"horizontalRule"}),n++;continue}if(r.match(/^[-*+]\s+/)){let s=[];for(;n<t.length&&t[n].match(/^[-*+]\s+/);){let l=t[n].replace(/^[-*+]\s+/,"");s.push({type:"listItem",content:[{type:"paragraph",content:ot(l)}]}),n++;}o.push({type:"bulletList",content:s});continue}let a=r.match(/^(\d+)\.\s+/);if(a){let s=[];for(;n<t.length&&t[n].match(/^\d+\.\s+/);){let l=t[n].replace(/^\d+\.\s+/,"");s.push({type:"listItem",content:[{type:"paragraph",content:ot(l)}]}),n++;}o.push({type:"orderedList",attrs:{start:parseInt(a[1],10)},content:s});continue}if(r.trim()===""){n++;continue}o.push({type:"paragraph",content:ot(r)}),n++;}return {type:"doc",content:o.length>0?o:[{type:"paragraph"}]}}function ot(e){if(!e)return [];let t=[],o=e,n=[{regex:/!\[([^\]]*)\]\(([^)]+)\)/,type:"image"},{regex:/\[([^\]]+)\]\(([^)]+)\)/,type:"link"},{regex:/\*\*([^*]+)\*\*/,type:"bold"},{regex:/(?<!\*)\*([^*]+)\*(?!\*)/,type:"italic"},{regex:/~~([^~]+)~~/,type:"strike"},{regex:/`([^`]+)`/,type:"code"}];for(;o.length>0;){let r=null,i=1/0;for(let a of n){let s=a.regex.exec(o);s&&s.index<i&&(r={match:s,type:a.type},i=s.index);}if(r){i>0&&t.push({type:"text",text:o.slice(0,i)});let{match:a,type:s}=r;switch(s){case "image":t.push({type:"image",attrs:{alt:a[1],src:a[2]}});break;case "link":t.push({type:"text",text:a[1],marks:[{type:"link",attrs:{href:a[2]}}]});break;case "bold":t.push({type:"text",text:a[1],marks:[{type:"bold"}]});break;case "italic":t.push({type:"text",text:a[1],marks:[{type:"italic"}]});break;case "strike":t.push({type:"text",text:a[1],marks:[{type:"strike"}]});break;case "code":t.push({type:"text",text:a[1],marks:[{type:"code"}]});break}o=o.slice(i+a[0].length);}else {t.push({type:"text",text:o});break}}return t}var mc=["http:","https:","mailto:"],fc=["https:","http:","blob:","data:"];function $r(e){try{let t=new URL(e);return mc.includes(t.protocol)}catch{return true}}function Gr(e){try{let t=new URL(e);return fc.includes(t.protocol)}catch{return true}}function gc(e){if(!e)return null;let t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:")||(!e.includes("://")&&!e.startsWith("mailto:")&&(e="https://"+e),!$r(e))?null:e}function hc(e){return !e||!Gr(e)?null:e}
31
- exports.AttachmentPreview=at;exports.IMComposer=ic;exports.LocaleProvider=sn;exports.MentionList=Ht;exports.QuoteBar=ac;exports.RichEditor=an;exports.createAttachment=Et;exports.createMentionInfo=xi;exports.defaultLocale=xe;exports.editorToMarkdown=pc;exports.extractPlainTextWithMentions=nt;exports.formatFileSize=St;exports.isAllowedImageProtocol=Gr;exports.isAllowedLinkProtocol=$r;exports.markdownToEditorContent=uc;exports.revokeAllAttachmentUrls=Ne;exports.revokeAttachmentUrl=it;exports.sanitizeImageUrl=hc;exports.sanitizeLinkUrl=gc;exports.useAttachments=It;exports.useLocale=Lt;exports.usePlainEditor=Tt;exports.validateFile=kt;exports.validateMentionIndices=yi;//# sourceMappingURL=index.js.map
30
+ `))}]});continue}if(r.match(/^(-{3,}|_{3,}|\*{3,})$/)){o.push({type:"horizontalRule"}),n++;continue}if(r.match(/^[-*+]\s+/)){let s=[];for(;n<t.length&&t[n].match(/^[-*+]\s+/);){let l=t[n].replace(/^[-*+]\s+/,"");s.push({type:"listItem",content:[{type:"paragraph",content:ot(l)}]}),n++;}o.push({type:"bulletList",content:s});continue}let a=r.match(/^(\d+)\.\s+/);if(a){let s=[];for(;n<t.length&&t[n].match(/^\d+\.\s+/);){let l=t[n].replace(/^\d+\.\s+/,"");s.push({type:"listItem",content:[{type:"paragraph",content:ot(l)}]}),n++;}o.push({type:"orderedList",attrs:{start:parseInt(a[1],10)},content:s});continue}if(r.trim()===""){n++;continue}o.push({type:"paragraph",content:ot(r)}),n++;}return {type:"doc",content:o.length>0?o:[{type:"paragraph"}]}}function ot(e){if(!e)return [];let t=[],o=e,n=[{regex:/!\[([^\]]*)\]\(([^)]+)\)/,type:"image"},{regex:/\[([^\]]+)\]\(([^)]+)\)/,type:"link"},{regex:/\*\*([^*]+)\*\*/,type:"bold"},{regex:/(?<!\*)\*([^*]+)\*(?!\*)/,type:"italic"},{regex:/~~([^~]+)~~/,type:"strike"},{regex:/`([^`]+)`/,type:"code"}];for(;o.length>0;){let r=null,i=1/0;for(let a of n){let s=a.regex.exec(o);s&&s.index<i&&(r={match:s,type:a.type},i=s.index);}if(r){i>0&&t.push({type:"text",text:o.slice(0,i)});let{match:a,type:s}=r;switch(s){case "image":t.push({type:"image",attrs:{alt:a[1],src:a[2]}});break;case "link":t.push({type:"text",text:a[1],marks:[{type:"link",attrs:{href:a[2]}}]});break;case "bold":t.push({type:"text",text:a[1],marks:[{type:"bold"}]});break;case "italic":t.push({type:"text",text:a[1],marks:[{type:"italic"}]});break;case "strike":t.push({type:"text",text:a[1],marks:[{type:"strike"}]});break;case "code":t.push({type:"text",text:a[1],marks:[{type:"code"}]});break}o=o.slice(i+a[0].length);}else {t.push({type:"text",text:o});break}}return t}var rc=()=>{let e=Lt();return jsxRuntime.jsxs(Ut,{className:"im-rich-toolbar",children:[jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(wt,{action:"undo",tooltip:e.undo}),jsxRuntime.jsx(wt,{action:"redo",tooltip:e.redo})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(no,{levels:[1,2,3,4],tooltip:e.heading,labels:{heading1:e.heading1,heading2:e.heading2,heading3:e.heading3,heading4:e.heading4,paragraph:e.paragraph}}),jsxRuntime.jsx(cr,{types:["bulletList","orderedList","taskList"],tooltip:e.list,labels:{bulletList:e.bulletList,orderedList:e.orderedList,taskList:e.taskList}}),jsxRuntime.jsx(uo,{tooltip:e.blockquote}),jsxRuntime.jsx(ho,{tooltip:e.codeBlock})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(oe,{type:"bold",tooltip:e.bold}),jsxRuntime.jsx(oe,{type:"italic",tooltip:e.italic}),jsxRuntime.jsx(oe,{type:"strike",tooltip:e.strike}),jsxRuntime.jsx(oe,{type:"code",tooltip:e.code}),jsxRuntime.jsx(oe,{type:"underline",tooltip:e.underline}),jsxRuntime.jsx(xr,{tooltip:e.highlight,removeTooltip:e.removeHighlight}),jsxRuntime.jsx(So,{tooltip:e.link,placeholder:e.linkPlaceholder,applyTooltip:e.applyLink,openTooltip:e.openLink,removeTooltip:e.removeLink})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(oe,{type:"superscript",tooltip:e.superscript}),jsxRuntime.jsx(oe,{type:"subscript",tooltip:e.subscript})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsxs(ce,{children:[jsxRuntime.jsx(ke,{align:"left",tooltip:e.alignLeft}),jsxRuntime.jsx(ke,{align:"center",tooltip:e.alignCenter}),jsxRuntime.jsx(ke,{align:"right",tooltip:e.alignRight}),jsxRuntime.jsx(ke,{align:"justify",tooltip:e.alignJustify})]}),jsxRuntime.jsx(Ce,{}),jsxRuntime.jsx(ce,{children:jsxRuntime.jsx(io,{tooltip:e.insertImage})}),jsxRuntime.jsx(Tn,{})]})},cn=react$1.forwardRef(function({placeholder:t="Write something...",disabled:o=false,uploadImage:n,onUploadingChange:r,onSend:i,onChange:a,sendKeymap:s="enter"},l){let c=Lt(),d=react$1.useRef(0),[p,m]=react$1.useState(new Map),f=react$1.useCallback(async(u,g,v)=>{if(!n)throw new Error("No upload handler provided");if(u.size>lt)throw new Error(`File size exceeds maximum allowed (${lt/(1024*1024)}MB)`);d.current++,r?.(d.current);try{if(v?.aborted)throw new Error("Upload cancelled");let b=await n(u,C=>{g?.(C);});return g?.({progress:100}),b.url}finally{d.current--,r?.(d.current);}},[n,r]),h=react.useEditor({immediatelyRender:false,editable:!o,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",class:"im-rich-editor-content"},handleClick:(u,g,v)=>{let b=v.target,{state:C}=u;if(b.tagName==="IMG"){let{doc:w}=C,L=-1;if(w.descendants((T,E)=>T.type.name==="image"&&L===-1&&g>=E&&g<=E+T.nodeSize?(L=E,false):true),L>=0){let T=C.tr.setSelection(state.NodeSelection.create(w,L));return u.dispatch(T),true}}if(C.selection instanceof state.NodeSelection){let w=C.doc.resolve(g),L=C.tr.setSelection(state.TextSelection.near(w));return u.dispatch(L),u.focus(),true}return false},handlePaste:(u,g)=>{if(!n)return false;let v=g.clipboardData?.items;if(!v)return false;let b=[];for(let C=0;C<v.length;C++){let w=v[C];if(w.type.startsWith("image/")){let L=w.getAsFile();L&&b.push(L);}}return b.length===0?false:(g.preventDefault(),b.forEach(C=>{let w=crypto.randomUUID();m(T=>{let E=new Map(T);return E.set(w,{name:C.name,size:C.size,progress:0}),E}),(async()=>{try{let T=await f(C,E=>{m(me=>{let Y=new Map(me),re=Y.get(w);return re&&Y.set(w,{...re,progress:E.progress}),Y});});if(h){let E=h.state.selection.from;h.chain().focus().insertContentAt(E,{type:"image",attrs:{src:T}}).run(),pt(h);}}catch(T){console.error("Failed to upload pasted image:",T);}finally{m(T=>{let E=new Map(T);return E.delete(w),E});}})();}),true)},handleDrop:(u,g)=>{if(!n)return false;let v=g.dataTransfer?.files;if(!v||v.length===0)return false;let b=Array.from(v).filter(w=>w.type.startsWith("image/"));if(b.length===0)return false;g.preventDefault();let C=u.posAtCoords({left:g.clientX,top:g.clientY});return b.forEach(async w=>{try{let L=await f(w),T=u.state.schema.nodes.image.create({src:L}),E=u.state.tr.insert(C?.pos??u.state.selection.from,T);u.dispatch(E);}catch(L){console.error("Failed to upload dropped image:",L);}}),true},handleKeyDown:(u,g)=>{let v=g.metaKey||g.ctrlKey;return g.key==="Enter"&&!g.shiftKey&&(s==="enter"&&!v||s==="ctrlEnter"&&g.ctrlKey||s==="cmdEnter"&&g.metaKey)?(g.preventDefault(),i?.(),true):false}},extensions:[starterKit.StarterKit.configure({horizontalRule:false,link:{openOnClick:false,enableClickSelection:true}}),_n,extensionTextAlign.TextAlign.configure({types:["heading","paragraph"]}),extensionList.TaskList,extensionList.TaskItem.configure({nested:true}),extensionHighlight.Highlight.configure({multicolor:true}),extensionTypography.Typography,extensionSuperscript.Superscript,extensionSubscript.Subscript,extensions.Selection,Si.Placeholder.configure({placeholder:t}),extensionImage.Image,...n?[Wn.configure({accept:"image/*",maxSize:lt,limit:3,upload:f,onError:u=>console.error("Upload failed:",u),locale:{clickToUpload:c.clickToUpload,orDragAndDrop:c.orDragAndDrop,maxFiles:c.maxFiles,clearAll:c.clearAll,uploading:c.uploading}})]:[]],onUpdate:()=>{a?.();}});return react$1.useImperativeHandle(l,()=>({editor:h,focus:()=>{h?.commands.focus();},clear:()=>{h?.commands.clearContent();},exportPayload:()=>{if(!h||d.current>0)return null;let u=pn(h);return u.trim()?{type:"markdown",markdown:u}:null},importMarkdown:u=>{h&&h.commands.setContent(u);},getDraft:()=>({mode:"rich",json:h?.getJSON()}),setDraft:u=>{u.json&&h&&h.commands.setContent(u.json);},setText:u=>{h?.commands.setContent(u);},insertText:u=>{h?.commands.insertContent(u);},isUploading:()=>d.current>0}),[h]),jsxRuntime.jsx("div",{className:"im-rich-editor-wrapper",children:jsxRuntime.jsxs(react.EditorContext.Provider,{value:{editor:h},children:[jsxRuntime.jsx(rc,{}),jsxRuntime.jsx("div",{className:"im-rich-editor-container",children:jsxRuntime.jsx(react.EditorContent,{editor:h,role:"presentation"})}),p.size>0&&jsxRuntime.jsx("div",{className:"im-paste-upload-progress tiptap-image-upload",children:Array.from(p.entries()).map(([u,{name:g,size:v,progress:b}])=>jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${b}%`}}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[jsxRuntime.jsxs("div",{className:"tiptap-image-upload-file-info",children:[jsxRuntime.jsx("div",{className:"tiptap-image-upload-file-icon",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]})}),jsxRuntime.jsxs("div",{className:"tiptap-image-upload-details",children:[jsxRuntime.jsx("span",{className:"tiptap-image-upload-text",children:g}),jsxRuntime.jsx("span",{className:"tiptap-image-upload-subtext",children:v===0?"0 Bytes":(()=>{let w=["Bytes","KB","MB","GB"],L=Math.floor(Math.log(v)/Math.log(1024));return `${parseFloat((v/Math.pow(1024,L)).toFixed(2))} ${w[L]}`})()})]})]}),jsxRuntime.jsx("div",{className:"tiptap-image-upload-actions",children:jsxRuntime.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[b,"%"]})})]})]},u))})]})})});var pc=react$1.forwardRef(function({mode:t,defaultMode:o="plain",onSend:n,onChange:r,onContextMenu:i,onQuoteRemoved:a,enableMention:s=true,mentionProvider:l,maxMentions:c,renderMentionItem:d,mentionPlacement:p="bottom",enableAttachments:m=true,attachmentPreviewPlacement:f="bottom",maxAttachments:h=10,allowedMimeTypes:u,maxFileSize:g,onAttachmentLimitExceeded:v,onFilesChange:b,showAttachmentPreview:C=true,uploadImage:w,keymap:L,placeholder:T,disabled:E=false,className:me,locale:Y},re){let q={...xe,...Y},[Ie,ie]=react$1.useState(o),z=t??Ie,[ye,He]=react$1.useState({active:false,query:"",items:[],selectedIndex:0,loading:false,error:false,command:null}),[R,O]=react$1.useState(0),H=react$1.useRef(null),fe=()=>typeof T=="string"?T:T?z==="plain"?T.plain:T.rich:z==="plain"?q.placeholderPlain:q.placeholderRich,A=It({maxAttachments:h,maxFileSize:g,allowedMimeTypes:u,onLimitExceeded:v,onChange:b}),Yr=react$1.useCallback(()=>{if(E)return;let P=K.exportPayload(A.getAttachments());P&&n&&(n(P),K.clear(),A.clearAttachments());},[E,n]),Jr=react$1.useCallback(()=>{if(E||R>0)return;let P=H.current?.exportPayload();P&&n&&(n(P),H.current?.clear());},[E,n,R]),K=Tt({placeholder:fe(),sendKeymap:L?.send||"enter",onSend:Yr,enableMention:s,mentionProvider:l,maxMentions:c,onMentionStateChange:He,onPasteFiles:m?A.addFiles:void 0,isUploading:()=>false,disabled:E,onChange:r,onQuoteRemoved:a}),Xr=react$1.useCallback(P=>{ye.command&&ye.command(P),He(ge=>({...ge,active:false,command:null}));},[ye.command]);react$1.useImperativeHandle(re,()=>({focus:()=>{z==="plain"?K.focus():H.current?.focus();},clear:()=>{z==="plain"?(K.clear(),A.clearAttachments()):H.current?.clear();},exportPayload:()=>z==="plain"?K.exportPayload(A.getAttachments()):H.current?.exportPayload()||null,importMarkdown:P=>{H.current?.importMarkdown(P);},getAttachments:()=>A.getAttachments(),setAttachments:P=>A.setAttachments(P),addFiles:P=>A.addFiles(P),removeAttachment:P=>A.removeAttachment(P),clearAttachments:()=>A.clearAttachments(),insertQuote:(P,ge)=>{K.insertQuote(P,ge);},insertMention:(P,ge)=>{K.insertMention(P,ge);},getDraft:()=>z==="plain"?K.getDraft(A.getAttachments()):H.current?.getDraft()||{mode:"rich"},setDraft:P=>{z==="plain"?(K.setDraft(P),P.attachments&&A.setAttachments(P.attachments)):H.current?.setDraft(P);},setText:P=>{z==="plain"?K.setText(P):H.current?.setText(P);},insertText:P=>{z==="plain"?K.insertText(P):H.current?.insertText(P);}}),[z,K,A]);let jr=()=>jsxRuntime.jsxs("div",{className:"im-composer__plain-wrapper",children:[C&&f==="top"&&A.attachments.length>0&&jsxRuntime.jsx(at,{attachments:A.attachments,onRemove:A.removeAttachment,placement:"top",removeLabel:q.removeAttachment}),jsxRuntime.jsx("div",{className:"im-composer__editor-wrapper",children:jsxRuntime.jsx(react.EditorContent,{editor:K.editor,className:"im-composer__editor"})}),jsxRuntime.jsx(Rn,{mentionState:ye,editor:K.editor,placement:p,onSelect:Xr,onHover:P=>He(ge=>({...ge,selectedIndex:P})),renderItem:d,locale:{noResults:q.mentionNoResults,loading:q.mentionLoading,error:q.mentionError}}),C&&f==="bottom"&&A.attachments.length>0&&jsxRuntime.jsx(at,{attachments:A.attachments,onRemove:A.removeAttachment,placement:"bottom",removeLabel:q.removeAttachment})]}),ei=()=>jsxRuntime.jsx("div",{className:"im-composer__rich-wrapper",children:jsxRuntime.jsx(cn,{ref:H,placeholder:fe(),disabled:E,uploadImage:w,onUploadingChange:O,onSend:Jr,onChange:r,sendKeymap:L?.send})});return jsxRuntime.jsx(sn,{locale:q,children:jsxRuntime.jsx("div",{className:`im-composer ${me||""} ${E?"im-composer--disabled":""}`,onContextMenu:i,children:z==="plain"?jr():ei()})})});function dc({quote:e,onRemove:t,removeLabel:o="Remove quote"}){return jsxRuntime.jsxs("div",{className:"im-quote-bar",children:[jsxRuntime.jsxs("div",{className:"im-quote-bar__content",children:[jsxRuntime.jsx("span",{className:"im-quote-bar__title",children:e.title}),jsxRuntime.jsx("span",{className:"im-quote-bar__text",children:e.content})]}),jsxRuntime.jsx("button",{type:"button",className:"im-quote-bar__remove-btn",onClick:t,"aria-label":o,children:jsxRuntime.jsx(uc,{})})]})}function uc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}var mc=["http:","https:","mailto:"],fc=["https:","http:","blob:","data:"];function Gr(e){try{let t=new URL(e);return mc.includes(t.protocol)}catch{return true}}function Qr(e){try{let t=new URL(e);return fc.includes(t.protocol)}catch{return true}}function gc(e){if(!e)return null;let t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:")||(!e.includes("://")&&!e.startsWith("mailto:")&&(e="https://"+e),!Gr(e))?null:e}function hc(e){return !e||!Qr(e)?null:e}
31
+ exports.AttachmentPreview=at;exports.IMComposer=pc;exports.LocaleProvider=sn;exports.MentionList=Ht;exports.QuoteBar=dc;exports.RichEditor=cn;exports.createAttachment=Et;exports.createMentionInfo=wi;exports.defaultLocale=xe;exports.editorToMarkdown=pn;exports.extractPlainTextWithMentions=nt;exports.formatFileSize=St;exports.isAllowedImageProtocol=Qr;exports.isAllowedLinkProtocol=Gr;exports.markdownToEditorContent=Dp;exports.revokeAllAttachmentUrls=Ne;exports.revokeAttachmentUrl=it;exports.sanitizeImageUrl=hc;exports.sanitizeLinkUrl=gc;exports.useAttachments=It;exports.useLocale=Lt;exports.usePlainEditor=Tt;exports.validateFile=kt;exports.validateMentionIndices=xi;//# sourceMappingURL=index.js.map
32
32
  //# sourceMappingURL=index.js.map