@lyfie/luthor 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +228 -475
  2. package/dist/ExtensiveEditor-Cn84lsVT.d.ts +448 -0
  3. package/dist/index-BtdZVw3X.d.ts +17 -0
  4. package/dist/index-DFnca6tP.d.ts +30 -0
  5. package/dist/index.css +1 -1
  6. package/dist/index.d.ts +203 -53
  7. package/dist/index.js +3 -16
  8. package/dist/presets/chat-window/index.css +1 -0
  9. package/dist/presets/chat-window/index.d.ts +22 -0
  10. package/dist/presets/chat-window/index.js +3 -0
  11. package/dist/presets/email-compose/index.css +1 -0
  12. package/dist/presets/email-compose/index.d.ts +17 -0
  13. package/dist/presets/email-compose/index.js +3 -0
  14. package/dist/presets/extensive/index.css +1 -0
  15. package/dist/presets/extensive/index.d.ts +5 -0
  16. package/dist/presets/extensive/index.js +3 -0
  17. package/dist/presets/headless-editor/index.css +1 -0
  18. package/dist/presets/headless-editor/index.d.ts +13 -0
  19. package/dist/presets/headless-editor/index.js +1 -0
  20. package/dist/presets/md-text/index.css +1 -0
  21. package/dist/presets/md-text/index.d.ts +15 -0
  22. package/dist/presets/md-text/index.js +3 -0
  23. package/dist/presets/notes/index.css +1 -0
  24. package/dist/presets/notes/index.d.ts +21 -0
  25. package/dist/presets/notes/index.js +3 -0
  26. package/dist/presets/notion-like/index.css +1 -0
  27. package/dist/presets/notion-like/index.d.ts +17 -0
  28. package/dist/presets/notion-like/index.js +3 -0
  29. package/dist/presets/rich-text-box/index.css +1 -0
  30. package/dist/presets/rich-text-box/index.d.ts +17 -0
  31. package/dist/presets/rich-text-box/index.js +3 -0
  32. package/dist/presets/simple-text/index.css +1 -0
  33. package/dist/presets/simple-text/index.d.ts +15 -0
  34. package/dist/presets/simple-text/index.js +3 -0
  35. package/package.json +76 -20
@@ -0,0 +1,3 @@
1
+ import ri,{forwardRef,useState,useMemo,useEffect,useRef,useImperativeHandle,createElement,useLayoutEffect,useCallback}from'react';import {ImageExtension,TableExtension,IframeEmbedExtension,YouTubeEmbedExtension,ContextMenuExtension,CommandPaletteExtension,SlashCommandExtension,EmojiExtension,DraggableBlockExtension,LinkExtension,textColorExtension,textHighlightExtension,createCustomNodeExtension,createEditorSystem,mergeThemes,defaultLuthorTheme,createEditorThemeStyleVars,FloatingToolbarExtension,FontFamilyExtension,FontSizeExtension,LineHeightExtension,codeExtension,codeIntelligenceExtension,boldExtension,italicExtension,underlineExtension,strikethroughExtension,subscriptExtension,superscriptExtension,horizontalRuleExtension,listExtension,historyExtension,blockFormatExtension,codeFormatExtension,tabIndentExtension,enterKeyBehaviorExtension,RichText,clearLexicalSelection,resolveLinkNodeKeyFromAnchor}from'@lyfie/luthor-headless';import {AlignLeft,AlignCenter,AlignRight,Bold,Italic,Underline,Strikethrough,Code,Quote,Unlink,Link,List,ListOrdered,ListChecks,Search,Command,Sun,Moon,Redo2,Undo2,Image,FileCode,Smile,Upload,Type,Table,Minus,IndentDecrease,IndentIncrease,Code2,AlignJustify,Superscript,Subscript,X,ChevronDown,Highlighter,Palette}from'lucide-react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {createPortal}from'react-dom';var Te=["h1","h2","h3","h4","h5","h6"];var Lt={sections:[{items:["fontFamily","fontSize","lineHeight"]},{items:["bold","italic","underline","strikethrough","textColor","textHighlight"]},{items:["subscript","superscript","code","link"]},{items:["blockFormat","quote","alignLeft","alignCenter","alignRight","alignJustify"]},{items:["unorderedList","orderedList","checkList","indentList","outdentList"]},{items:["table","image","emoji","embed","horizontalRule"]},{items:["codeBlock"]},{items:["undo","redo"]},{items:["commandPalette","themeToggle"]}]};function Kn(e){if(!(e instanceof Element))return false;if(e.closest('[contenteditable="true"]'))return true;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function Un(e,t){return Kn(e.target)?vo(t):false}function vo(e){let t=e.key.toLowerCase();return !(!!e.ctrlKey||!!e.metaKey)||e.altKey?false:t==="b"||t==="i"||t==="u"||t==="k"||(t==="z"||t==="y")}function yo(e){return typeof e.setCodeLanguage=="function"&&typeof e.autoDetectCodeLanguage=="function"}function jn(e){return typeof e.toggleSubscript=="function"}function _n(e){return typeof e.toggleSuperscript=="function"}function Vn(e){return typeof e.insertIframeEmbed=="function"}function $n(e){return typeof e.insertYouTubeEmbed=="function"}function Jn(e){return typeof e.insertEmoji=="function"}function qn(e){return e.slice(1)}function Yn(e){switch(e){case "h1":return "Convert to large heading";case "h2":return "Convert to medium heading";case "h3":return "Convert to small heading";case "h4":return "Convert to heading level 4";case "h5":return "Convert to heading level 5";case "h6":return "Convert to heading level 6"}}function Gn(e){if(!e||e.length===0)return [...Te];let t=new Set,n=[];for(let o of e)!Te.includes(o)||t.has(o)||(t.add(o),n.push(o));return n.length>0?n:[...Te]}function Jt(e,t){return Zn(qt(t),t?.shortcutConfig).filter(o=>!o.condition||o.condition(e))}function K(e,t){return typeof e[t]=="function"}function It(e){if(!e||e.length===0)return new Set;let t=e.map(n=>n.trim()).filter(n=>n.length>0);return new Set(t)}function Wn(e){if(!e)return {allowlist:new Set,denylist:new Set};if(Array.isArray(e)){let n=[];for(let o of e)for(let[l,r]of Object.entries(o))r&&n.push(l);return {allowlist:It(n),denylist:new Set}}let t=e;return {allowlist:It(t.allowlist),denylist:It(t.denylist)}}function Co(e){let t=e.key.trim();return t?{key:t,ctrlKey:!!e.ctrlKey,metaKey:!!e.metaKey,shiftKey:!!e.shiftKey,altKey:!!e.altKey,preventDefault:e.preventDefault}:null}function Qn(e){if(e===false||e===null)return [];let t=Array.isArray(e)?e:[e],n=[];for(let o of t){let l=Co(o);l&&n.push(l);}return n}function Xn(e){return [e.key.toLowerCase(),e.ctrlKey?"ctrl":"",e.metaKey?"meta":"",e.shiftKey?"shift":"",e.altKey?"alt":""].join(":")}function Zn(e,t){if(!t)return [...e];let n=It(t.disabledCommandIds),o=t.bindings,l=t.preventNativeConflicts!==false,r=t.preventCollisions!==false,i=new Set;return e.filter(c=>!n.has(c.id)).map(c=>{let u=c.shortcuts?[...c.shortcuts]:void 0;if(!!o&&Object.prototype.hasOwnProperty.call(o,c.id)&&o){let m=o[c.id],h=m===void 0?[]:Qn(m);u=h.length>0?h:void 0;}if(u&&u.length>0){let m=[];for(let h of u){let g=Co(h);if(!g||l&&vo(g))continue;let p=Xn(g);r&&i.has(p)||(i.add(p),m.push(g));}u=m.length>0?m:void 0;}return {...c,shortcuts:u}})}function qt(e){let t=e?.isFeatureEnabled??(()=>true),n=Gn(e?.headingOptions),o=e?.paragraphLabel?.trim()||"Paragraph",l=n.map(r=>{let i=qn(r);return {id:`block.heading${i}`,label:`Heading ${i}`,description:Yn(r),category:"Block",action:a=>a.toggleHeading?.(r),shortcuts:[{key:i,ctrlKey:true,altKey:true}],keywords:["heading",r],condition:a=>t("blockFormat")&&K(a,"toggleHeading")}});return [{id:"format.bold",label:"Toggle Bold",description:"Make text bold or remove bold formatting",category:"Format",action:r=>r.toggleBold?.(),shortcuts:[{key:"b",ctrlKey:true}],keywords:["bold","strong","format"],condition:r=>t("bold")&&K(r,"toggleBold")},{id:"format.italic",label:"Toggle Italic",description:"Make text italic or remove italic formatting",category:"Format",action:r=>r.toggleItalic?.(),shortcuts:[{key:"i",ctrlKey:true}],keywords:["italic","emphasis","format"],condition:r=>t("italic")&&K(r,"toggleItalic")},{id:"format.underline",label:"Toggle Underline",description:"Add or remove underline formatting",category:"Format",action:r=>r.toggleUnderline?.(),shortcuts:[{key:"u",ctrlKey:true}],keywords:["underline","format"],condition:r=>t("underline")&&K(r,"toggleUnderline")},{id:"format.strikethrough",label:"Toggle Strikethrough",description:"Add or remove strikethrough formatting",category:"Format",action:r=>r.toggleStrikethrough?.(),keywords:["strikethrough","format"],condition:r=>t("strikethrough")&&K(r,"toggleStrikethrough")},{id:"format.subscript",label:"Toggle Subscript",description:"Format text as subscript",category:"Format",action:r=>r.toggleSubscript?.(),keywords:["subscript","format"],condition:r=>t("subscript")&&jn(r)},{id:"format.superscript",label:"Toggle Superscript",description:"Format text as superscript",category:"Format",action:r=>r.toggleSuperscript?.(),keywords:["superscript","format"],condition:r=>t("superscript")&&_n(r)},{id:"format.code",label:"Toggle Inline Code",description:"Format text as inline code",category:"Format",action:r=>r.formatText?.("code"),shortcuts:[{key:"`",ctrlKey:true}],keywords:["code","inline","format"],condition:r=>t("codeFormat")&&K(r,"formatText")},{id:"block.paragraph",label:o,description:"Convert to paragraph",category:"Block",action:r=>r.toggleParagraph?.(),shortcuts:[{key:"0",ctrlKey:true,altKey:true}],keywords:["paragraph","text"],condition:r=>t("blockFormat")&&K(r,"toggleParagraph")},...l,{id:"block.quote",label:"Quote",description:"Convert to blockquote",category:"Block",action:r=>r.toggleQuote?.(),keywords:["quote","blockquote"],condition:r=>t("blockFormat")&&K(r,"toggleQuote")},{id:"block.align-left",label:"Align Left",description:"Align selected blocks to the left",category:"Block",action:r=>r.setTextAlignment?.("left"),keywords:["align","left","text"],condition:r=>t("blockFormat")&&K(r,"setTextAlignment")},{id:"block.align-center",label:"Align Center",description:"Center-align selected blocks",category:"Block",action:r=>r.setTextAlignment?.("center"),keywords:["align","center","text"],condition:r=>t("blockFormat")&&K(r,"setTextAlignment")},{id:"block.align-right",label:"Align Right",description:"Align selected blocks to the right",category:"Block",action:r=>r.setTextAlignment?.("right"),keywords:["align","right","text"],condition:r=>t("blockFormat")&&K(r,"setTextAlignment")},{id:"block.align-justify",label:"Justify",description:"Justify selected blocks",category:"Block",action:r=>r.setTextAlignment?.("justify"),keywords:["align","justify","text"],condition:r=>t("blockFormat")&&K(r,"setTextAlignment")},{id:"block.codeblock",label:"Code Block",description:"Convert to code block",category:"Block",action:r=>r.toggleCodeBlock?.(),shortcuts:[{key:"`",ctrlKey:true,shiftKey:true}],keywords:["code","block"],condition:r=>t("code")&&K(r,"toggleCodeBlock")},{id:"block.code-language",label:"Set Code Language",description:"Set language for selected code block",category:"Block",action:r=>{if(!r.setCodeLanguage)return;let i=prompt("Code language (e.g. ts, css, python):")?.trim();i&&r.setCodeLanguage(i);},keywords:["code","language","syntax"],condition:r=>t("codeIntelligence")&&yo(r)},{id:"block.code-language.auto",label:"Auto-Detect Code Language",description:"Detect language from selected code block",category:"Block",action:r=>{r.autoDetectCodeLanguage?.();},keywords:["code","language","auto","detect"],condition:r=>t("codeIntelligence")&&yo(r)},{id:"list.bullet",label:"Bullet List",description:"Create or toggle bullet list",category:"List",action:r=>r.toggleUnorderedList?.(),shortcuts:[{key:"l",ctrlKey:true,shiftKey:true}],keywords:["list","bullet"],condition:r=>t("list")&&K(r,"toggleUnorderedList")},{id:"list.numbered",label:"Numbered List",description:"Create or toggle numbered list",category:"List",action:r=>r.toggleOrderedList?.(),shortcuts:[{key:"l",ctrlKey:true,altKey:true}],keywords:["list","numbered"],condition:r=>t("list")&&K(r,"toggleOrderedList")},{id:"list.check",label:"Checklist",description:"Create or toggle checklist",category:"List",action:r=>r.toggleCheckList?.(),shortcuts:[{key:"x",ctrlKey:true,shiftKey:true}],keywords:["list","check","todo","task"],condition:r=>t("list")&&K(r,"toggleCheckList")},{id:"link.insert",label:"Insert Link",description:"Insert or edit a link",category:"Insert",action:r=>r.insertLink?.(),shortcuts:[{key:"k",ctrlKey:true}],keywords:["link","url"],condition:r=>t("link")&&K(r,"insertLink")},{id:"link.remove",label:"Remove Link",description:"Remove link formatting",category:"Format",action:r=>r.removeLink?.(),shortcuts:[{key:"k",ctrlKey:true,shiftKey:true}],keywords:["unlink","remove","link"],condition:r=>t("link")&&K(r,"removeLink")},{id:"insert.horizontal-rule",label:"Insert Horizontal Rule",description:"Insert a horizontal line separator",category:"Insert",action:r=>r.insertHorizontalRule?.(),keywords:["horizontal","rule","hr","divider","separator"],condition:r=>t("horizontalRule")&&K(r,"insertHorizontalRule")},{id:"insert.image",label:"Insert Image",description:"Insert an image from URL",category:"Insert",action:r=>{let i=prompt("Enter image URL:");if(i){let a=prompt("Enter alt text:")||"";r.insertImage?.({src:i,alt:a});}},keywords:["image","photo"],condition:r=>t("image")&&K(r,"insertImage")},{id:"insert.gif",label:"Insert GIF",description:"Insert an animated GIF from URL",category:"Insert",action:r=>{let i=prompt("Enter GIF URL:");i&&r.insertImage?.({src:i,alt:"GIF"});},keywords:["gif","animated","image"],condition:r=>t("image")&&K(r,"insertImage")},{id:"insert.emoji",label:"Insert Emoji",description:"Insert an emoji character",category:"Insert",action:r=>{let i=prompt("Enter emoji or shortcode (example :sparkles:):")?.trim();if(!i||typeof r.insertEmoji!="function")return;let a=i.match(/^:([a-z0-9_+-]+):$/i);if(a){let c=a[1];if(!c)return;if(typeof r.resolveEmojiShortcode=="function"){let u=r.resolveEmojiShortcode(c);if(u?.emoji){r.insertEmoji(u.emoji);return}}else if(typeof r.getEmojiSuggestions=="function"){let[u]=r.getEmojiSuggestions(c);if(u?.emoji){r.insertEmoji(u.emoji);return}}}r.insertEmoji(i);},keywords:["emoji","reaction","symbol","smile"],condition:r=>t("emoji")&&Jn(r)},{id:"insert.table",label:"Insert Table",description:"Insert a 3x3 table",category:"Insert",action:r=>r.insertTable?.({rows:3,columns:3,includeHeaders:true}),keywords:["table","grid"],condition:r=>t("table")&&K(r,"insertTable")},{id:"insert.iframe",label:"Insert iframe",description:"Insert an iframe embed from URL",category:"Insert",action:r=>{if(typeof r.insertIframeEmbed!="function")return;let i=prompt("Enter iframe URL:");i&&r.insertIframeEmbed(i);},keywords:["iframe","embed","url"],condition:r=>t("iframeEmbed")&&Vn(r)},{id:"insert.youtube",label:"Insert YouTube Video",description:"Insert an embedded YouTube video",category:"Insert",action:r=>{if(typeof r.insertYouTubeEmbed!="function")return;let i=prompt("Enter YouTube URL:");i&&r.insertYouTubeEmbed(i);},keywords:["youtube","video","embed"],condition:r=>t("youTubeEmbed")&&$n(r)},{id:"edit.undo",label:"Undo",description:"Undo the last action",category:"Edit",action:r=>r.undo?.(),shortcuts:[{key:"z",ctrlKey:true}],keywords:["undo","revert"],condition:r=>t("history")&&K(r,"undo")},{id:"edit.redo",label:"Redo",description:"Redo the last undone action",category:"Edit",action:r=>r.redo?.(),shortcuts:[{key:"y",ctrlKey:true},{key:"z",ctrlKey:true,shiftKey:true}],keywords:["redo","repeat"],condition:r=>t("history")&&K(r,"redo")},{id:"palette.show",label:"Show Command Palette",description:"Open the command palette",category:"View",action:r=>r.showCommandPalette?.(),shortcuts:[{key:"p",ctrlKey:true,shiftKey:true}],keywords:["command","palette"],condition:r=>t("commandPalette")&&K(r,"showCommandPalette")}]}function ko(e,t){let n=t?.commandPaletteShortcutOnly===true;return Jt(e,t).filter(o=>!n||!!o.shortcuts&&o.shortcuts.length>0).map(o=>({id:o.id,label:o.label,description:o.description,category:o.category,action:()=>o.action(e),keywords:o.keywords,shortcut:o.shortcuts?.[0]?To(o.shortcuts[0]):void 0}))}function Eo(e,t){let n=new Set(["block.paragraph","block.quote","block.codeblock"]),o=a=>a.category==="Insert"||a.category==="List"?true:a.category==="Block"?a.id.startsWith("block.heading")?true:n.has(a.id):false,{allowlist:l,denylist:r}=Wn(t?.slashCommandVisibility),i=l.size>0;return Jt(e,t).filter(o).filter(a=>r.has(a.id)?false:i?l.has(a.id):true).map(a=>({id:a.id,label:a.label,description:a.description,category:a.category,action:()=>a.action(e),keywords:a.keywords,shortcut:a.shortcuts?.[0]?To(a.shortcuts[0]):void 0}))}function To(e){let t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),t.push(e.key.toUpperCase()),t.join("+")}function xo(e,t=document.body,n){let o=Jt(e,n),l=r=>{let i=typeof n?.scope=="function"?n.scope():n?.scope;if(!(i&&r.target instanceof Node&&!i.contains(r.target))){for(let a of o)if(a.shortcuts){for(let c of a.shortcuts)if(!(n?.shortcutConfig?.preventNativeConflicts!==false&&Un(r,c))&&r.key.toLowerCase()===c.key.toLowerCase()&&!!r.ctrlKey==!!c.ctrlKey&&!!r.metaKey==!!c.metaKey&&!!r.shiftKey==!!c.shiftKey&&!!r.altKey==!!c.altKey){c.preventDefault!==false&&r.preventDefault(),(!a.condition||a.condition(e))&&a.action(e);return}}}};return t.addEventListener("keydown",l),()=>t.removeEventListener("keydown",l)}var wt=Bold,Ft=Italic,Nt=Underline,Ot=Strikethrough,Ht=Code,So=Code2,it=Link,Ze=Unlink,Pt=List,zt=ListChecks,Rt=ListOrdered,Lo=Undo2,Io=Redo2,Yt=Image,lt=AlignLeft,et=AlignCenter,wo=AlignJustify,at=AlignRight,Gt=Upload,Fo=Minus,No=Table,Oo=FileCode;var Ho=Highlighter;var At=Command,Po=Palette,zo=Type,Bt=Quote,Ro=IndentIncrease,Ao=IndentDecrease,Bo=Sun,Mo=Moon,Do=Search,Wt=Smile,Ko=Subscript,Uo=Superscript,jo=ChevronDown,_o=X;function Jo({isOpen:e,onClose:t,commands:n}){let[o,l]=useState(""),[r,i]=useState(0),a=useRef(null),c=useRef(null),u=n.filter(h=>`${h.label} ${h.description||""} ${h.keywords?.join(" ")||""}`.toLowerCase().includes(o.toLowerCase())),y=u.reduce((h,g)=>{let p=g.category||"Other";return h[p]||(h[p]=[]),h[p].push(g),h},{}),m=u;return useEffect(()=>{i(0);},[o]),useEffect(()=>{e&&a.current&&(a.current.focus({preventScroll:true}),l(""),i(0));},[e]),useEffect(()=>{if(!e)return;let h=c.current;if(!h)return;h.querySelector(".luthor-command-palette-item.selected")?.scrollIntoView({block:"nearest"});},[e,r,o]),useEffect(()=>{let h=g=>{if(e)switch(g.key){case "Escape":g.preventDefault(),g.stopPropagation(),t();break;case "ArrowDown":g.preventDefault(),g.stopPropagation(),i(p=>Math.min(p+1,m.length-1));break;case "ArrowUp":g.preventDefault(),g.stopPropagation(),i(p=>Math.max(p-1,0));break;case "Enter":g.preventDefault(),g.stopPropagation(),m[r]&&(m[r].action(),t());break}};return document.addEventListener("keydown",h,true),()=>document.removeEventListener("keydown",h,true)},[e,r,m,t]),e?jsx("div",{className:"luthor-command-palette-overlay",onClick:t,children:jsxs("div",{className:"luthor-command-palette",role:"dialog","aria-modal":"true","aria-label":"Command Palette",onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"luthor-command-palette-header",children:[jsx(Do,{size:16,className:"luthor-command-palette-icon"}),jsx("input",{ref:a,type:"text",placeholder:"Type a command or search...",value:o,onChange:h=>l(h.target.value),className:"luthor-command-palette-input"}),jsx("kbd",{className:"luthor-command-palette-kbd",children:"ESC"})]}),jsx("div",{ref:c,className:"luthor-command-palette-list",children:Object.keys(y).length===0?jsx("div",{className:"luthor-command-palette-empty",children:"No commands found"}):Object.entries(y).map(([h,g])=>jsxs("div",{className:"luthor-command-palette-group",children:[jsx("div",{className:"luthor-command-palette-group-title",children:h}),g.map(p=>{let U=m.indexOf(p);return jsxs("div",{className:`luthor-command-palette-item ${U===r?"selected":""}`,onClick:()=>{p.action(),t();},onMouseEnter:()=>i(U),children:[jsxs("div",{className:"luthor-command-palette-item-content",children:[jsx("div",{className:"luthor-command-palette-item-title",children:p.label}),p.description&&jsx("div",{className:"luthor-command-palette-item-description",children:p.description})]}),p.shortcut&&jsx("kbd",{className:"luthor-command-palette-item-shortcut",children:p.shortcut})]},p.id)})]},h))}),jsx("div",{className:"luthor-command-palette-footer",children:jsxs("span",{className:"luthor-command-palette-hint",children:[jsx(At,{size:14}),jsx("span",{children:"Use arrow keys, Enter, ESC"})]})})]})}):null}var Br={"--luthor-bg":"#ffffff","--luthor-fg":"#0f172a","--luthor-border":"#e2e8f0","--luthor-border-hover":"#cbd5e1","--luthor-border-active":"#94a3b8","--luthor-accent":"#0f172a","--luthor-accent-hover":"#1e293b","--luthor-shadow":"rgba(0, 0, 0, 0.08)","--luthor-muted":"#f8fafc","--luthor-muted-fg":"#64748b","--luthor-theme-transition":"0.2s ease","--luthor-drag-gutter-width":"56px","--luthor-line-height-ratio":"1","--luthor-toolbar-bg":"#f8fafc","--luthor-toolbar-section-border":"#e2e8f0","--luthor-toolbar-button-fg":"#0f172a","--luthor-toolbar-button-hover-bg":"#f8fafc","--luthor-toolbar-button-hover-border":"#cbd5e1","--luthor-toolbar-button-hover-shadow":"0 4px 12px rgba(0, 0, 0, 0.15)","--luthor-toolbar-button-press-shadow":"0 2px 8px rgba(0, 0, 0, 0.1)","--luthor-toolbar-button-active-bg":"#0f172a","--luthor-toolbar-button-active-border":"#0f172a","--luthor-toolbar-button-active-fg":"#ffffff","--luthor-toolbar-button-active-shadow":"0 2px 8px rgba(0, 0, 0, 0.2)","--luthor-toolbar-button-overlay":"linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%)","--luthor-toolbar-button-active-overlay":"linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%)","--luthor-toolbar-color-indicator-border":"#e2e8f0","--luthor-toolbar-highlight-bg":"#f8fafc","--luthor-quote-bg":"#f8fafc","--luthor-quote-fg":"#0f172a","--luthor-quote-border":"#0f172a","--luthor-syntax-comment":"#64748b","--luthor-syntax-keyword":"#64748b","--luthor-syntax-string":"#64748b","--luthor-syntax-number":"#64748b","--luthor-syntax-function":"#64748b","--luthor-syntax-variable":"#64748b","--luthor-floating-bg":"#ffffff","--luthor-floating-fg":"#0f172a","--luthor-floating-border":"#e2e8f0","--luthor-floating-shadow":"rgba(0, 0, 0, 0.08)","--luthor-floating-muted":"#f8fafc","--luthor-floating-border-hover":"#cbd5e1","--luthor-floating-border-active":"#94a3b8","--luthor-floating-accent":"#0f172a","--luthor-floating-accent-fg":"#ffffff","--luthor-z-dropdown":"20","--luthor-z-popover":"24","--luthor-z-menu":"28","--luthor-z-overlay":"32","--luthor-z-modal":"36","--luthor-preset-bg":"#ffffff","--luthor-preset-fg":"#0f172a","--luthor-preset-border":"#dbe2ea","--luthor-preset-muted":"#f8fafc","--luthor-preset-muted-fg":"#64748b","--luthor-preset-accent":"#2563eb","--luthor-preset-radius":"10px","--luthor-preset-shadow":"0 1px 3px rgba(15, 23, 42, 0.08)","--luthor-preset-content-padding":"16px","--luthor-preset-content-min-height":"180px"};function Mr(e){return e?e.closest(".luthor-editor-wrapper"):null}function Dr(e){return e?Mr(e)??e:null}function Kr(e){if(typeof window>"u"||!e)return {};let t=window.getComputedStyle(e),n={};for(let[o,l]of Object.entries(Br)){let r=t.getPropertyValue(o).trim()||l;n[o]=r;}return n}function qe(e){return Kr(Dr(e))}function ut(){if(typeof window>"u")return {};let t=window.getSelection()?.anchorNode;if(!t)return {};let n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return qe(n)}function Yo({isOpen:e,query:t,position:n,suggestions:o,onClose:l,onExecute:r}){let[i,a]=useState(0);if(useEffect(()=>{a(0);},[t,e]),useEffect(()=>{if(!e)return;let u=y=>{let m=o.length>0;switch(y.key){case "Escape":y.preventDefault(),y.stopPropagation(),l();break;case "ArrowDown":if(!m)return;y.preventDefault(),y.stopPropagation(),a(h=>Math.min(h+1,Math.max(o.length-1,0)));break;case "ArrowUp":if(!m)return;y.preventDefault(),y.stopPropagation(),a(h=>Math.max(h-1,0));break;case "Enter":case "Tab":if(!m||!o[i])return;y.preventDefault(),y.stopPropagation(),r(o[i].emoji);break}};return document.addEventListener("keydown",u,true),()=>document.removeEventListener("keydown",u,true)},[e,l,r,i,o]),!e||!n)return null;let c=jsxs("div",{className:"luthor-emoji-menu",style:{left:n.x,top:n.y,...ut()},onPointerDown:u=>{u.stopPropagation();},onMouseDown:u=>{u.stopPropagation();},children:[jsxs("div",{className:"luthor-emoji-menu-header",children:[jsx("span",{className:"luthor-emoji-menu-title",children:"Emoji"}),jsxs("span",{className:"luthor-emoji-menu-query",children:[":",t]})]}),jsx("div",{className:"luthor-emoji-menu-list",children:o.length===0?jsx("div",{className:"luthor-emoji-menu-empty",children:"No matching emoji"}):o.map((u,y)=>{let m=y===i,h=u.shortcodes[0]?`:${u.shortcodes[0]}:`:"";return jsxs("button",{type:"button",className:`luthor-emoji-menu-item ${m?"selected":""}`,onMouseEnter:()=>a(y),onMouseDown:g=>{g.preventDefault(),g.stopPropagation();},onClick:g=>{g.preventDefault(),g.stopPropagation(),r(u.emoji);},children:[jsx("span",{className:"luthor-emoji-menu-item-symbol","aria-hidden":"true",children:u.emoji}),jsxs("span",{className:"luthor-emoji-menu-item-content",children:[jsx("span",{className:"luthor-emoji-menu-item-title",children:u.label}),h&&jsx("span",{className:"luthor-emoji-menu-item-shortcode",children:h})]})]},`${u.emoji}-${u.label}`)})})]});return typeof document>"u"?c:createPortal(c,document.body)}function Qo({isOpen:e,query:t,position:n,commands:o,onClose:l,onExecute:r}){let[i,a]=useState(0),c=useMemo(()=>{let m=t.trim().toLowerCase();return m?o.filter(h=>`${h.label} ${h.description||""} ${h.keywords?.join(" ")||""}`.toLowerCase().includes(m)):o},[o,t]),u=useMemo(()=>c.reduce((m,h)=>{let g=h.category||"Other";return m[g]||(m[g]=[]),m[g].push(h),m},{}),[c]);if(useEffect(()=>{a(0);},[t,e]),useEffect(()=>{if(!e)return;let m=h=>{let g=c.length>0;switch(h.key){case "Escape":h.preventDefault(),h.stopPropagation(),l();break;case "ArrowDown":if(!g)return;h.preventDefault(),h.stopPropagation(),a(p=>Math.min(p+1,Math.max(c.length-1,0)));break;case "ArrowUp":if(!g)return;h.preventDefault(),h.stopPropagation(),a(p=>Math.max(p-1,0));break;case "Enter":case "Tab":if(!g||!c[i])return;h.preventDefault(),h.stopPropagation(),r(c[i].id);break}};return document.addEventListener("keydown",m,true),()=>document.removeEventListener("keydown",m,true)},[c,e,l,r,i]),!e||!n)return null;let y=jsxs("div",{className:"luthor-slash-menu",style:{left:n.x,top:n.y,...ut()},onPointerDown:m=>{m.stopPropagation();},onMouseDown:m=>{m.stopPropagation();},children:[jsxs("div",{className:"luthor-slash-menu-header",children:[jsx("span",{className:"luthor-slash-menu-title",children:"Insert block"}),jsxs("span",{className:"luthor-slash-menu-query",children:["/",t]})]}),jsx("div",{className:"luthor-slash-menu-list",children:c.length===0?jsx("div",{className:"luthor-slash-menu-empty",children:"No matching commands"}):Object.entries(u).map(([m,h])=>jsxs("div",{className:"luthor-slash-menu-group",children:[jsx("div",{className:"luthor-slash-menu-group-title",children:m}),h.map(g=>{let p=c.indexOf(g);return jsxs("button",{type:"button",className:`luthor-slash-menu-item ${p===i?"selected":""}`,onMouseEnter:()=>a(p),onMouseDown:F=>{F.preventDefault(),F.stopPropagation();},onClick:F=>{F.preventDefault(),F.stopPropagation(),r(g.id);},children:[jsxs("span",{className:"luthor-slash-menu-item-content",children:[jsx("span",{className:"luthor-slash-menu-item-title",children:g.label}),g.description&&jsx("span",{className:"luthor-slash-menu-item-description",children:g.description})]}),g.shortcut&&jsx("kbd",{className:"luthor-slash-menu-item-shortcut",children:g.shortcut})]},g.id)})]},m))})]});return typeof document>"u"?y:createPortal(y,document.body)}function S({children:e,onClick:t,title:n,active:o,disabled:l,className:r,type:i="button"}){return jsx("button",{type:i,className:`luthor-toolbar-button${o?" active":""}${r?` ${r}`:""}`,onClick:t,title:n,disabled:l,children:e})}function Xt({children:e,onClick:t,variant:n="primary",type:o="button",className:l}){return jsx("button",{type:o,onClick:t,className:`${n==="primary"?"luthor-button-primary":"luthor-button-secondary"}${l?` ${l}`:""}`,children:e})}function bt({value:e,onValueChange:t,options:n,placeholder:o="Select..."}){let[l,r]=useState(false),[i,a]=useState(void 0),c=useRef(null),u=useRef(null);useEffect(()=>{if(!l)return;let m=()=>{let h=c.current?.querySelector(".luthor-select-trigger");if(!h)return;let g=h.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,left:g.left,width:g.width,...qe(h)});};return m(),window.addEventListener("resize",m),window.addEventListener("scroll",m,true),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m,true);}},[l]),useEffect(()=>{function m(h){let g=h.target;c.current?.contains(g)||u.current?.contains(g)||r(false);}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);let y=n.find(m=>m.value===e);return jsxs("div",{className:"luthor-select",ref:c,children:[jsxs("button",{className:`luthor-select-trigger ${l?"open":""}`,onClick:()=>r(!l),type:"button",children:[jsx("span",{children:y?.label||o}),jsx(jo,{size:14})]}),l&&typeof document<"u"&&createPortal(jsx("div",{ref:u,className:"luthor-select-dropdown",style:i,children:n.map(m=>jsx("button",{className:`luthor-select-option ${e===m.value?"selected":""}`,onClick:()=>{t(m.value),r(false);},type:"button",children:m.label},m.value))}),document.body)]})}function yt({trigger:e,children:t,isOpen:n,onOpenChange:o}){let l=useRef(null),r=useRef(null),i=useRef(null),[a,c]=useState(void 0);return useEffect(()=>{if(!n)return;let u=()=>{let y=r.current;if(!y)return;let m=y.getBoundingClientRect();c({position:"fixed",top:m.bottom+4,left:m.left,...qe(y)});};return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,true),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,true);}},[n]),useEffect(()=>{function u(y){let m=y.target;l.current?.contains(m)||i.current?.contains(m)||o(false);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),jsxs("div",{className:"luthor-dropdown",ref:l,children:[jsx("div",{ref:r,onClick:()=>o(!n),children:e}),n&&typeof document<"u"&&createPortal(jsx("div",{ref:i,className:"luthor-dropdown-content",style:a,children:t}),document.body)]})}function Zo({isOpen:e,onClose:t,title:n,children:o}){let l=useRef(null);return useEffect(()=>{function r(a){l.current&&!l.current.contains(a.target)&&t();}function i(a){a.key==="Escape"&&t();}return e&&(document.addEventListener("mousedown",r),document.addEventListener("keydown",i)),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",i);}},[e,t]),e?jsx("div",{className:"luthor-dialog-overlay",children:jsxs("div",{className:"luthor-dialog",ref:l,children:[jsxs("div",{className:"luthor-dialog-header",children:[jsx("h3",{className:"luthor-dialog-title",children:n}),jsx("button",{className:"luthor-dialog-close",onClick:t,type:"button",children:jsx(_o,{size:16})})]}),jsx("div",{className:"luthor-dialog-content",children:o})]})}):null}function en({isVisible:e,selectionRect:t,commands:n,activeStates:o,editorTheme:l="light",hide:r,isFeatureEnabled:i=()=>true}){let a=useRef(null),[c,u]=useState(""),[y,m]=useState(""),[h,g]=useState(""),[p,U]=useState(""),[F,P]=useState(""),[J,j]=useState(""),[C,Z]=useState(null),[re,V]=useState(null),[d,w]=useState(null),k=!!o.isIframeEmbedSelected,M=!!o.isYouTubeEmbedSelected,H=i("iframeEmbed"),Q=i("youTubeEmbed"),z=i("image"),me=H&&k||Q&&M;if(useEffect(()=>{if(!e)return;let I=L=>{let _=L.target;_&&(a.current?.contains(_)||r?.());};return document.addEventListener("mousedown",I,true),document.addEventListener("touchstart",I,true),()=>{document.removeEventListener("mousedown",I,true),document.removeEventListener("touchstart",I,true);}},[e,r]),useEffect(()=>{if(!e||!k)return;let I=false;return typeof n.getIframeEmbedCaption=="function"&&n.getIframeEmbedCaption().then(L=>{I||m(L??"");}),typeof n.getIframeEmbedUrl=="function"&&n.getIframeEmbedUrl().then(L=>{I||u(L??"");}),Z(null),()=>{I=true;}},[n,k,e]),useEffect(()=>{if(!e||!o.imageSelected)return;let I=false;return typeof n.getImageCaption=="function"&&n.getImageCaption().then(L=>{I||g(L??"");}),()=>{I=true;}},[o.imageSelected,n,e]),useEffect(()=>{if(!e||!M)return;let I=false;return typeof n.getYouTubeEmbedCaption=="function"&&n.getYouTubeEmbedCaption().then(L=>{I||U(L??"");}),typeof n.getYouTubeEmbedUrl=="function"&&n.getYouTubeEmbedUrl().then(L=>{I||P(L??"");}),V(null),()=>{I=true;}},[n,e,M]),useEffect(()=>{if(!e||!o.isLink)return;let I=false;return typeof n.getCurrentLink=="function"&&n.getCurrentLink().then(L=>{!I&&L&&j(L.url??"");}),w(null),()=>{I=true;}},[o.isLink,n,e]),!e||!t)return null;let te={...ut(),position:"absolute",top:t.y,left:t.positionFromRight?"auto":t.x,right:t.positionFromRight?10:"auto",zIndex:9999,pointerEvents:"auto"};if(me){let I=A=>{if(k){n.setIframeEmbedAlignment?.(A);return}M&&n.setYouTubeEmbedAlignment?.(A);},L=k?o.isIframeEmbedAlignedLeft:o.isYouTubeEmbedAlignedLeft,_=k?o.isIframeEmbedAlignedCenter:o.isYouTubeEmbedAlignedCenter,Qe=k?o.isIframeEmbedAlignedRight:o.isYouTubeEmbedAlignedRight,he=k?typeof n.setIframeEmbedCaption=="function":typeof n.setYouTubeEmbedCaption=="function",Ce=k?typeof n.updateIframeEmbedUrl=="function":typeof n.updateYouTubeEmbedUrl=="function",je=k?y:p,ke=k?m:U,ze=k?c:F,G=k?C:re,Ee=()=>{if(he){if(k){n.setIframeEmbedCaption?.(y);return}n.setYouTubeEmbedCaption?.(p);}},Oe=A=>{k?Z(A):V(A);},oe=A=>{k?u(A):P(A);},pe=()=>{if(!Ce)return;if(!(k?n.updateIframeEmbedUrl?.(c)??false:n.updateYouTubeEmbedUrl?.(F)??false)){Oe(k?"Enter a valid http(s) URL":"Enter a valid YouTube URL"),k&&typeof n.getIframeEmbedUrl=="function"?n.getIframeEmbedUrl().then(He=>u(He??"")):!k&&typeof n.getYouTubeEmbedUrl=="function"&&n.getYouTubeEmbedUrl().then(He=>P(He??""));return}Oe(null);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[jsx(S,{onClick:()=>I("left"),active:L,title:"Align Left",children:jsx(lt,{size:14})}),jsx(S,{onClick:()=>I("center"),active:_,title:"Align Center",children:jsx(et,{size:14})}),jsx(S,{onClick:()=>I("right"),active:Qe,title:"Align Right",children:jsx(at,{size:14})}),he||Ce?jsxs(Fragment,{children:[jsx("div",{className:"luthor-floating-toolbar-separator"}),jsxs("div",{className:"luthor-floating-toolbar-fields",children:[Ce?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"url",value:ze,className:`luthor-floating-toolbar-input${G?" is-error":""}`,placeholder:k?"https://example.com/embed":"https://youtube.com/watch?v=...","aria-label":k?"Iframe URL":"YouTube URL","aria-invalid":G?true:void 0,onChange:A=>{oe(A.target.value),G&&Oe(null);},onBlur:pe,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),pe());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-primary",onClick:pe,children:"Update URL"})]}):null,he?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"text",value:je,className:"luthor-floating-toolbar-input",placeholder:"Add caption","aria-label":k?"Iframe caption":"YouTube caption",onChange:A=>ke(A.target.value),onBlur:Ee,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),Ee());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:Ee,children:"Update Caption"})]}):null]})]}):null]})}if(z&&o.imageSelected){let I=typeof n.setImageCaption=="function",L=()=>{I&&n.setImageCaption(h);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[jsx(S,{onClick:()=>n.setImageAlignment("left"),active:o.isImageAlignedLeft,title:"Align Left",children:jsx(lt,{size:14})}),jsx(S,{onClick:()=>n.setImageAlignment("center"),active:o.isImageAlignedCenter,title:"Align Center",children:jsx(et,{size:14})}),jsx(S,{onClick:()=>n.setImageAlignment("right"),active:o.isImageAlignedRight,title:"Align Right",children:jsx(at,{size:14})}),I?jsxs(Fragment,{children:[jsx("div",{className:"luthor-floating-toolbar-separator"}),jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"text",value:h,className:"luthor-floating-toolbar-input",placeholder:"Add caption","aria-label":"Image caption",onChange:_=>g(_.target.value),onBlur:L,onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),L());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:L,children:"Update Caption"})]})]}):null]})}let xe=i("bold"),ie=i("italic"),Se=i("underline"),Le=i("strikethrough"),Ie=i("codeFormat"),se=i("blockFormat"),we=i("link"),Pe=i("list"),Fe=xe||ie||Se||Le,ue=Ie||se||we,Ne=Pe,fe=!!o.isLink&&typeof n.updateLink=="function"&&typeof n.removeLink=="function",ce=()=>{if(!fe)return;if(!(n.updateLink?.(J)??false)){w("Enter a valid URL"),typeof n.getCurrentLink=="function"&&n.getCurrentLink().then(L=>{j(L?.url??"");});return}w(null);};return !Fe&&!ue&&!Ne?null:jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[Fe?jsxs(Fragment,{children:[xe?jsx(S,{onClick:()=>n.toggleBold(),active:o.bold,title:"Bold",children:jsx(wt,{size:14})}):null,ie?jsx(S,{onClick:()=>n.toggleItalic(),active:o.italic,title:"Italic",children:jsx(Ft,{size:14})}):null,Se?jsx(S,{onClick:()=>n.toggleUnderline(),active:o.underline,title:"Underline",children:jsx(Nt,{size:14})}):null,Le?jsx(S,{onClick:()=>n.toggleStrikethrough(),active:o.strikethrough,title:"Strikethrough",children:jsx(Ot,{size:14})}):null]}):null,Fe&&ue?jsx("div",{className:"luthor-floating-toolbar-separator"}):null,ue?jsxs(Fragment,{children:[Ie?jsx(S,{onClick:()=>n.formatText("code"),active:o.code,title:"Inline Code",children:jsx(Ht,{size:14})}):null,se?jsx(S,{onClick:()=>n.toggleQuote(),active:o.isQuote,title:"Quote",children:jsx(Bt,{size:14})}):null,we?jsxs(Fragment,{children:[jsx(S,{onClick:()=>o.isLink?n.removeLink():n.insertLink(),active:o.isLink,title:o.isLink?"Remove Link":"Insert Link",children:o.isLink?jsx(Ze,{size:14}):jsx(it,{size:14})}),fe?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"url",value:J,className:`luthor-floating-toolbar-input${d?" is-error":""}`,placeholder:"https://example.com","aria-label":"Link URL","aria-invalid":d?true:void 0,onChange:I=>{j(I.target.value),d&&w(null);},onBlur:ce,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),ce());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-primary",onClick:ce,children:"Update Link"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-danger",onClick:()=>n.removeLink(),"aria-label":"Unlink",children:jsx(Ze,{size:13})})]}):null]}):null]}):null,(Fe||ue)&&Ne?jsx("div",{className:"luthor-floating-toolbar-separator"}):null,Ne?jsxs(Fragment,{children:[jsx(S,{onClick:()=>n.toggleUnorderedList(),active:o.unorderedList,title:"Bullet List",children:jsx(Pt,{size:14})}),jsx(S,{onClick:()=>n.toggleOrderedList(),active:o.orderedList,title:"Numbered List",children:jsx(Rt,{size:14})}),jsx(S,{onClick:()=>n.toggleCheckList(),active:o.checkList,title:"Checklist",children:jsx(zt,{size:14})})]}):null]})}var Ae={commands:{},activeStates:{},editorTheme:"light",isFeatureEnabled:()=>true};function Zt(e,t,n,o=()=>true){Ae.commands=e,Ae.activeStates=t,Ae.editorTheme=n,Ae.isFeatureEnabled=o;}function tn(){let e=en,t=new FloatingToolbarExtension;return t.config={...t.config,render:n=>createElement(e,{...n,commands:Ae.commands,activeStates:Ae.activeStates,editorTheme:Ae.editorTheme,isFeatureEnabled:Ae.isFeatureEnabled}),getCommands:()=>Ae.commands,getActiveStates:()=>Ae.activeStates},t}var Xr=120,Zr=58;function ei(e,t=Zr){return e.length<=t?e:`${e.slice(0,t-3)}...`}function nn(){let e=window.getSelection();return !e||e.rangeCount===0?false:!e.getRangeAt(0).collapsed}function rn(e,t){if(!(e instanceof Element))return null;let n=e.closest("a");return !(n instanceof HTMLAnchorElement)||!t.contains(n)?null:n}function sn({editor:e,commands:t,editorTheme:n="light",disabled:o=false}){let l=useRef(null),r=useRef(null),[i,a]=useState(null),[c,u]=useState(false),[y,m]=useState(""),[h,g]=useState(null),[p,U]=useState(null),F=useCallback(()=>{r.current!==null&&(window.clearTimeout(r.current),r.current=null);},[]),P=useCallback(()=>{F(),a(null),u(false),m(""),g(null),U(null);},[F]),J=useCallback(()=>{F(),r.current=window.setTimeout(()=>{P();},Xr);},[F,P]),j=useCallback(d=>{let w=d.getBoundingClientRect(),k=w.bottom+8,M=Math.max(10,Math.min(w.left,window.innerWidth-340));U({top:k,left:M});},[]),C=useCallback((d,w)=>{if(typeof t.getLinkByKey!="function"){a(k=>!k||k.nodeKey!==d?k:{...k,url:w});return}t.getLinkByKey(d).then(k=>{if(!k){P();return}a(M=>!M||M.nodeKey!==d?M:{...M,url:k.url});});},[t,P]);useEffect(()=>{if(!e||o||typeof window>"u"){P();return}let d=e.getRootElement();if(!d){P();return}let w=Q=>{let z=rn(Q.target,d);if(!z)return;if(nn()){P();return}F();let me=resolveLinkNodeKeyFromAnchor(e,z);if(!me)return;let te=z.getAttribute("href")??z.href;a({nodeKey:me,url:te,anchorEl:z}),j(z),g(null),c||m(te),C(me,te);},k=Q=>{if(!i)return;let z=Q.relatedTarget;z&&l.current?.contains(z)||rn(z,d)||J();},M=()=>{nn()&&P();},H=()=>{a(Q=>{if(!Q)return Q;let z=Q.anchorEl.isConnected&&d.contains(Q.anchorEl)?Q.anchorEl:d.querySelector(`a[data-lexical-node-key="${Q.nodeKey}"]`);return z?(j(z),{...Q,anchorEl:z,url:z.getAttribute("href")??z.href}):(P(),null)});};return d.addEventListener("mouseover",w),d.addEventListener("mouseout",k),document.addEventListener("selectionchange",M),window.addEventListener("scroll",H,true),window.addEventListener("resize",H),()=>{d.removeEventListener("mouseover",w),d.removeEventListener("mouseout",k),document.removeEventListener("selectionchange",M),window.removeEventListener("scroll",H,true),window.removeEventListener("resize",H),F();}},[t,o,e,i,c,P,J,C,j,F]);let Z=useMemo(()=>{if(!(!i||!p))return {...qe(i.anchorEl),position:"fixed",top:p.top,left:p.left,zIndex:10040}},[i,p]);if(!i||!p||typeof document>"u")return null;let re=()=>{(t.removeLinkByKey?.(i.nodeKey)??false)&&P();},V=()=>{let d=y.trim();if(!(t.updateLinkByKey?.(i.nodeKey,d)??false)){g("Enter a valid URL"),C(i.nodeKey,i.url);return}a(k=>!k||k.nodeKey!==i.nodeKey?k:{...k,url:d}),g(null),u(false),queueMicrotask(()=>{C(i.nodeKey,d);});};return createPortal(jsx("div",{ref:l,className:"luthor-floating-toolbar luthor-link-hover-bubble","data-theme":n,style:Z,onMouseEnter:F,onMouseLeave:J,children:c?jsxs(Fragment,{children:[jsx("input",{type:"url",value:y,className:`luthor-link-hover-bubble-input${h?" is-error":""}`,placeholder:"https://example.com","aria-label":"Edit link URL","aria-invalid":h?true:void 0,onChange:d=>{m(d.target.value),h&&g(null);},onKeyDown:d=>{if(d.key==="Enter"){d.preventDefault(),V();return}d.key==="Escape"&&(d.preventDefault(),u(false),m(i.url),g(null));}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button luthor-link-hover-bubble-button-primary",onClick:V,children:"Update"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{u(false),m(i.url),g(null);},children:"Cancel"})]}):jsxs(Fragment,{children:[jsx("span",{className:"luthor-link-hover-bubble-url",title:i.url,children:ei(i.url)}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{m(i.url),u(true),g(null);},children:"Edit"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button luthor-link-hover-bubble-button-danger",onClick:re,"aria-label":"Unlink",children:jsx(Ze,{size:13})})]})}),document.body)}function un({mode:e,onModeChange:t,labels:n,availableModes:o,isConverting:l}){let r=o??["visual","jsonb"],i={visual:n?.visual??"Visual",jsonb:n?.jsonb??"JSONB"};return jsxs("div",{className:"luthor-mode-tabs",children:[r.includes("visual")&&jsxs("button",{className:`luthor-mode-tab ${e==="visual"?"active":""}`,onClick:()=>t("visual"),children:[i.visual,l==="visual"&&jsx("span",{className:"luthor-tab-converting-spinner"})]}),r.includes("jsonb")&&jsxs("button",{className:`luthor-mode-tab ${e==="jsonb"?"active":""}`,onClick:()=>t("jsonb"),children:[i.jsonb,l==="jsonb"&&jsx("span",{className:"luthor-tab-converting-spinner"})]})]})}function cn({value:e,onChange:t,placeholder:n,className:o}){let l=useRef(null);return useLayoutEffect(()=>{let r=l.current;if(!r)return;r.style.height="auto";let i=Math.max(r.scrollHeight,280);r.style.height=`${i}px`;},[e]),jsx("textarea",{ref:l,className:`luthor-source-view${o?` ${o}`:""}`,value:e,onChange:r=>t(r.target.value),placeholder:n,spellCheck:false})}function dn(e,t){let n=`luthor-preset-${e}`;return {placeholder:t,classNames:{container:`luthor-preset ${n} ${n}__container`,contentEditable:`luthor-content-editable ${n}__content`,placeholder:`luthor-placeholder ${n}__placeholder`}}}function ni(e){return e.replace(/\r\n?/g,`
2
+ `)}function oo(e){let t=ni(e).trim();if(!t)return "";try{let n=JSON.parse(t);return JSON.stringify(n,null,2)}catch{return t}}var no=6,ai=["#ffffff","#f2f2f2","#d9d9d9","#bfbfbf","#808080","#404040","#000000","#fbe5d6","#f8cbad","#f4b183","#ed7d31","#c55a11","#fff2cc","#ffe699","#ffd966","#ffc000","#bf9000","#7f6000","#e2f0d9","#c6e0b4","#a9d18e","#70ad47","#548235","#375623","#ddebf7","#bdd7ee","#9dc3e6","#5b9bd5","#2f75b5","#1f4e78","#e4dfec","#d9c2e9","#b4a7d6","#8e7cc3","#674ea7","#351c75"];function Kt(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function si(e,t){let n=Kt(t);for(let o of e)if(Kt(o.value)===n)return o.color;return null}function ui(e,t,n){if(!e||e==="default")return n;let o=si(t,e);return o||e}function ci(e,t){let n=e.trim();return /^#([\da-f]{6})$/i.test(n)?n:/^#([\da-f]{3})$/i.test(n)?`#${n.slice(1).split("").map(l=>`${l}${l}`).join("")}`:t}function De(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function mn(e){let t=e.split(",")[0]??"";return De(t.replace(/["']/g,""))}function Ut(e){let t=e.trim().toLowerCase().match(/^(-?\d*\.?\d+)px$/);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function Dt(){if(typeof window>"u")return null;let t=window.getSelection()?.anchorNode;if(!t)return null;let n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n||!n.closest(".luthor-content-editable"))return null;let l=window.getComputedStyle(n);return {fontFamily:l.fontFamily,fontSize:l.fontSize,lineHeight:l.lineHeight}}function di(e,t){if(!e)return null;let n=mn(e);return n?t.find(l=>De(l.value)===n?true:mn(l.fontFamily)===n)?.value??null:null}function gi(e,t){if(!e)return null;let n=De(e),o=t.find(i=>De(String(i.value))===n?true:De(String(i.fontSize))===n);if(o)return String(o.value);let l=Ut(e);if(l==null)return null;let r=null;for(let i of t){let a=Ut(String(i.fontSize));if(a==null)continue;let c=Math.abs(a-l);(!r||c<r.distance)&&(r={value:String(i.value),distance:c});}return r?.value??null}function mi(e,t,n){if(!e)return null;let o=De(e),l=n.find(u=>De(u.value)===o?true:De(u.lineHeight)===o);if(l)return l.value;let r=t?Ut(t):null,i=Ut(e),a=null;if(i!=null&&r!=null&&r>0)a=i/r;else {let u=Number(e);Number.isFinite(u)&&(a=u);}if(a==null)return null;let c=null;for(let u of n){let y=Number(u.lineHeight);if(!Number.isFinite(y))continue;let m=Math.abs(y-a);(!c||m<c.distance)&&(c={value:u.value,distance:m});}return c?.value??null}function fn({title:e,value:t,options:n,recentColors:o,active:l,fallbackColor:r,highlight:i,onChange:a,onClear:c,onAddRecent:u}){let y=useRef(null),m=useRef(null),h=useRef(null),g=useRef(null),p=useRef(null),[U,F]=useState(false),[P,J]=useState(void 0),j=ui(t,n,r),C=useMemo(()=>ai,[]),Z=useMemo(()=>{let d=[...o].slice(0,no);for(;d.length<no;)d.push("");return d},[o]);useEffect(()=>()=>{g.current&&window.cancelAnimationFrame(g.current);},[]);let re=useCallback(d=>{p.current=d,!g.current&&(g.current=window.requestAnimationFrame(()=>{g.current=null,p.current&&(a(p.current),p.current=null);}));},[a]),V=useCallback(d=>{let w=y.current;if(!w)return;let k=w.getBoundingClientRect();J({position:"fixed",top:k.bottom+6,left:k.left,width:230,visibility:d?"visible":"hidden",...qe(w)});},[]);return useLayoutEffect(()=>{if(!U)return;V(false);let d=window.requestAnimationFrame(()=>{V(true);});return ()=>{window.cancelAnimationFrame(d);}},[U,V]),useEffect(()=>{if(!U)return;let d=M=>{let H=M.target;y.current?.contains(H)||m.current?.contains(H)||F(false);},w=M=>{M.key==="Escape"&&F(false);},k=()=>V(true);return window.addEventListener("resize",k),window.addEventListener("scroll",k,true),document.addEventListener("mousedown",d),document.addEventListener("keydown",w),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,true),document.removeEventListener("mousedown",d),document.removeEventListener("keydown",w);}},[U,V]),jsxs(Fragment,{children:[jsxs("button",{ref:y,type:"button",className:`luthor-toolbar-button luthor-color-button${l?" active":""}${i?" is-highlight":""}`,title:e,"aria-label":e,onClick:()=>F(d=>!d),children:[i?jsx(Ho,{size:15,className:"luthor-color-button-highlighter"}):jsx("span",{className:"luthor-color-button-letter",children:"A"}),jsx("span",{className:"luthor-color-button-indicator",style:{backgroundColor:j}})]}),U&&typeof document<"u"&&createPortal(jsxs("div",{ref:m,className:"luthor-color-picker",style:P,children:[jsx("div",{className:"luthor-color-picker-header",children:jsx("span",{className:"luthor-color-picker-title",children:e})}),jsxs("div",{className:"luthor-color-picker-section",children:[jsx("p",{className:"luthor-color-picker-label",children:"Colors"}),jsx("div",{className:"luthor-color-swatch-grid",children:C.map(d=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:d},"aria-label":`Use color ${d}`,onClick:()=>{a(d),u(d),F(false);}},d))})]}),jsxs("div",{className:"luthor-color-picker-section",children:[jsx("p",{className:"luthor-color-picker-label",children:"Recent colors"}),jsx("div",{className:"luthor-color-swatch-row",children:Z.map((d,w)=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:d||"transparent"},"aria-label":d?`Use recent color ${d}`:"Empty recent color slot",disabled:!d,onClick:()=>{d&&(a(d),u(d),F(false));}},`${d||"empty"}-${w}`))})]}),jsxs("div",{className:"luthor-color-picker-footer",children:[jsx("button",{type:"button",className:"luthor-color-picker-clear",onClick:()=>{c(),F(false);},children:"Reset to Default"}),jsxs("button",{type:"button",className:"luthor-color-picker-custom",onClick:()=>h.current?.click(),children:[jsx(Po,{size:14}),jsx("span",{children:"Custom Color"})]}),jsx("input",{ref:h,type:"color",className:"luthor-color-picker-native luthor-color-picker-native-hidden",value:ci(j,r),onInput:d=>{re(d.target.value);},onChange:d=>{let w=d.target.value;a(w),u(w);}})]})]}),document.body)]})}function fi(e,t){let n=useRef(null),o=useRef(null);return {handlers:useMemo(()=>({insertFromUrl:()=>{let r=prompt("Enter image URL:");if(!r)return;let i=prompt("Enter alt text:")||"",a=prompt("Enter caption (optional):")||void 0;e.insertImage({src:r,alt:i,caption:a});},insertFromFile:()=>n.current?.click(),insertGifFromUrl:()=>{let r=prompt("Enter GIF URL:");if(!r)return;let i=prompt("Enter alt text (optional):")||"GIF";e.insertImage({src:r,alt:i});},insertGifFromFile:()=>o.current?.click(),handleUpload:async r=>{let i=r.target.files?.[0];if(!i)return;let a;if(t)try{a=await t(i);}catch{alert("Failed to upload image");return}else a=URL.createObjectURL(i);e.insertImage({src:a,alt:i.name,file:i}),r.target.value="";},handleGifUpload:async r=>{let i=r.target.files?.[0];if(!i)return;if(!(i.type==="image/gif"||i.name.toLowerCase().endsWith(".gif"))){alert("Please select a GIF file."),r.target.value="";return}let c;if(t)try{c=await t(i);}catch{alert("Failed to upload GIF");return}else c=URL.createObjectURL(i);e.insertImage({src:c,alt:i.name||"GIF",file:i}),r.target.value="";},setAlignment:r=>{e.setImageAlignment(r);},setCaption:()=>{let r=prompt("Enter caption:")||"";e.setImageCaption(r);}}),[e,t]),fileInputRef:n,gifInputRef:o}}function hi(e){return useMemo(()=>({insertIframe:()=>{let t=prompt("Enter iframe URL:");t&&typeof e.insertIframeEmbed=="function"&&e.insertIframeEmbed(t);},insertYouTube:()=>{let t=prompt("Enter YouTube URL:");t&&typeof e.insertYouTubeEmbed=="function"&&e.insertYouTubeEmbed(t);}}),[e])}function pi(e,t){switch(e){case "fontFamily":return t("fontFamily");case "fontSize":return t("fontSize");case "lineHeight":return t("lineHeight");case "textColor":return t("textColor");case "textHighlight":return t("textHighlight");case "subscript":return t("subscript");case "superscript":return t("superscript");case "blockFormat":case "quote":case "alignLeft":case "alignCenter":case "alignRight":case "alignJustify":return t("blockFormat");case "codeBlock":return t("code");case "unorderedList":case "orderedList":case "checkList":case "indentList":case "outdentList":return t("list");case "horizontalRule":return t("horizontalRule");case "table":return t("table");case "image":return t("image");case "emoji":return t("emoji");case "embed":return t("iframeEmbed")||t("youtubeEmbed");case "undo":case "redo":return t("history");default:return true}}function bi(e,t,n){return pi(e,t)?n?.[e]!==false:false}function yi(e,t,n){return {sections:e.sections.map(o=>({...o,items:o.items.filter(l=>bi(l,t,n))})).filter(o=>o.items.length>0)}}function hn({commands:e,hasExtension:t,activeStates:n,isDark:o,toggleTheme:l,onCommandPaletteOpen:r,imageUploadHandler:i,classNames:a,toolbarStyleVars:c,layout:u,toolbarVisibility:y,headingOptions:m,paragraphLabel:h}){let{handlers:g,fileInputRef:p,gifInputRef:U}=fi(e,i),F=hi(e),P=t("iframeEmbed")||t("youtubeEmbed"),J=n.isIframeEmbedSelected||n.isYouTubeEmbedSelected,[j,C]=useState(false),[Z,re]=useState(false),[V,d]=useState(false),[w,k]=useState(false),[M,H]=useState(false),[Q,z]=useState("default"),[me,te]=useState([{value:"default",label:"Default"}]),[xe,ie]=useState("default"),[Se,Le]=useState([{value:"default",label:"Default"}]),[Ie,se]=useState("default"),[we,Pe]=useState([{value:"default",label:"Default"}]),[Fe,ue]=useState("default"),[Ne,fe]=useState([{value:"default",label:"Default",color:"inherit"}]),[ce,I]=useState([]),[L,_]=useState("default"),[Qe,he]=useState([{value:"default",label:"Default",color:"transparent"}]),[Ce,je]=useState([]),[ke,ze]=useState(0),[G,Ee]=useState({rows:3,columns:3,includeHeaders:false});useEffect(()=>{if(typeof document>"u")return;let f=()=>{Dt()&&ze(O=>O+1);};return document.addEventListener("selectionchange",f),()=>{document.removeEventListener("selectionchange",f);}},[]);let Oe=useMemo(()=>t("emoji")?typeof e.getEmojiSuggestions=="function"?e.getEmojiSuggestions(""):typeof e.getEmojiCatalog=="function"?e.getEmojiCatalog():[]:[],[e,t]);useEffect(()=>{if(!t("fontFamily")||typeof e.getFontFamilyOptions!="function")return;let f=e.getFontFamilyOptions().map(O=>({value:O.value,label:O.label})),b=f.length>0?f:[{value:"default",label:"Default"}];te(b),z(O=>b.some(R=>R.value===O)?O:"default");},[e,t]),useEffect(()=>{if(!t("fontFamily")||typeof e.getCurrentFontFamily!="function")return;let f=e.getFontFamilyOptions;if(typeof f!="function")return;let b=false;return e.getCurrentFontFamily().then(O=>{if(b)return;if(O&&O!=="default"){z(O);return}let R=Dt(),le=di(R?.fontFamily,f());z(le??"default");}),()=>{b=true;}},[n,e,t,ke]),useEffect(()=>{if(!t("fontSize")||typeof e.getFontSizeOptions!="function")return;let f=e.getFontSizeOptions().map(R=>({value:String(R.value).trim(),label:String(R.label).trim()})).filter(R=>R.value.length>0&&R.label.length>0),b=f.some(R=>De(R.value)==="default"),O=f.length===0?[{value:"default",label:"Default"}]:b?f:[{value:"default",label:"Default"},...f];Le(O),ie(R=>O.some(le=>le.value===R)?R:"default");},[e,t]),useEffect(()=>{if(!t("fontSize")||typeof e.getCurrentFontSize!="function")return;let f=e.getFontSizeOptions;if(typeof f!="function")return;let b=false;return e.getCurrentFontSize().then(O=>{if(b)return;if(O&&O!=="default"){ie(O);return}let R=Dt(),le=gi(R?.fontSize,f());ie(le??"default");}),()=>{b=true;}},[n,e,t,ke]),useEffect(()=>{if(!t("lineHeight")||typeof e.getLineHeightOptions!="function")return;let f=e.getLineHeightOptions().map(b=>({value:b.value,label:b.label}));f.length>0&&Pe(f);},[e,t]),useEffect(()=>{if(!t("lineHeight")||typeof e.getCurrentLineHeight!="function")return;let f=e.getLineHeightOptions;if(typeof f!="function")return;let b=false;return e.getCurrentLineHeight().then(O=>{if(b)return;if(O){se(O);return}let R=Dt(),le=mi(R?.lineHeight,R?.fontSize,f());se(le??"default");}),()=>{b=true;}},[n,e,t,ke]),useEffect(()=>{if(!t("textColor")||typeof e.getTextColorOptions!="function")return;let f=e.getTextColorOptions().map(b=>({value:b.value,label:b.label,color:b.color}));f.length>0&&fe(f);},[e,t]),useEffect(()=>{if(!t("textColor")||typeof e.getCurrentTextColor!="function")return;let f=false;return e.getCurrentTextColor().then(b=>{f||ue(b??"default");}),()=>{f=true;}},[n,e,t,ke]),useEffect(()=>{if(!t("textHighlight")||typeof e.getTextHighlightOptions!="function")return;let f=e.getTextHighlightOptions().map(b=>({value:b.value,label:b.label,color:b.backgroundColor}));f.length>0&&he(f);},[e,t]),useEffect(()=>{if(!t("textHighlight")||typeof e.getCurrentTextHighlight!="function")return;let f=false;return e.getCurrentTextHighlight().then(b=>{f||_(b??"default");}),()=>{f=true;}},[n,e,t,ke]);let oe=useMemo(()=>{if(!m||m.length===0)return [...Te];let f=new Set,b=[];for(let O of m)!Te.includes(O)||f.has(O)||(f.add(O),b.push(O));return b.length>0?b:[...Te]},[m]),pe=h?.trim()||"Paragraph",Re=useMemo(()=>{let f=oe.map(b=>({value:b,label:`Heading ${b.slice(1)}`}));return [{value:"p",label:pe},...f]},[oe,pe]),A=n.isH1?"h1":n.isH2?"h2":n.isH3?"h3":n.isH4?"h4":n.isH5?"h5":n.isH6?"h6":"p",He=Re.some(f=>f.value===A)?A:"p",Xe=f=>{f==="p"?e.toggleParagraph():f.startsWith("h")&&oe.includes(f)&&e.toggleHeading(f);},_e=f=>{f==="default"?e.clearFontFamily?.():e.setFontFamily?.(f),z(f);},Ve=f=>{f==="default"?e.clearFontSize?.():e.setFontSize?.(f),ie(f);},$e=f=>{e.setLineHeight?.(f),se(f);},v=(f,b)=>{f(O=>{let R=Kt(b),le=O.filter(ae=>Kt(ae)!==R);return [b,...le].slice(0,no)});},T=f=>{if(f==="default"){e.clearTextColor?.(),ue("default");return}e.setTextColor?.(f),ue(f);},D=f=>{if(f==="default"){e.clearTextHighlight?.(),_("default");return}e.setTextHighlight?.(f),_(f);},X=f=>{switch(f){case "fontFamily":return t("fontFamily")?jsx(bt,{value:Q,onValueChange:_e,options:me,placeholder:"Font"},"fontFamily"):null;case "fontSize":return t("fontSize")?jsx(bt,{value:xe,onValueChange:Ve,options:Se,placeholder:"Size"},"fontSize"):null;case "lineHeight":return t("lineHeight")?jsx(bt,{value:Ie,onValueChange:$e,options:we,placeholder:"Line"},"lineHeight"):null;case "textColor":return t("textColor")?jsx(fn,{title:"Text Color",value:Fe,options:Ne,recentColors:ce,active:n.hasCustomTextColor,fallbackColor:"#0f172a",onChange:T,onClear:()=>T("default"),onAddRecent:b=>v(I,b)},"textColor"):null;case "textHighlight":return t("textHighlight")?jsx(fn,{title:"Text Highlight",value:L,options:Qe,recentColors:Ce,active:n.hasTextHighlight,fallbackColor:"#fef08a",highlight:true,onChange:D,onClear:()=>D("default"),onAddRecent:b=>v(je,b)},"textHighlight"):null;case "bold":return jsx(S,{onClick:()=>e.toggleBold(),active:n.bold,title:"Bold (Ctrl+B)",children:jsx(wt,{size:16})},"bold");case "italic":return jsx(S,{onClick:()=>e.toggleItalic(),active:n.italic,title:"Italic (Ctrl+I)",children:jsx(Ft,{size:16})},"italic");case "underline":return jsx(S,{onClick:()=>e.toggleUnderline(),active:n.underline,title:"Underline (Ctrl+U)",children:jsx(Nt,{size:16})},"underline");case "strikethrough":return jsx(S,{onClick:()=>e.toggleStrikethrough(),active:n.strikethrough,title:"Strikethrough",children:jsx(Ot,{size:16})},"strikethrough");case "subscript":return t("subscript")?jsx(S,{onClick:()=>e.toggleSubscript?.(),active:n.subscript,title:"Subscript",children:jsx(Ko,{size:16})},"subscript"):null;case "superscript":return t("superscript")?jsx(S,{onClick:()=>e.toggleSuperscript?.(),active:n.superscript,title:"Superscript",children:jsx(Uo,{size:16})},"superscript"):null;case "code":return jsx(S,{onClick:()=>e.formatText("code"),active:n.code,title:"Inline Code",children:jsx(Ht,{size:16})},"code");case "link":return jsx(S,{onClick:()=>n.isLink?e.removeLink():e.insertLink(),active:n.isLink,title:n.isLink?"Remove Link":"Insert Link",children:n.isLink?jsx(Ze,{size:16}):jsx(it,{size:16})},"link");case "blockFormat":return t("blockFormat")?jsx(bt,{value:He,onValueChange:Xe,options:Re,placeholder:"Format"},"blockFormat"):null;case "quote":return t("blockFormat")?jsx(S,{onClick:()=>e.toggleQuote(),active:n.isQuote,title:"Quote",children:jsx(Bt,{size:16})},"quote"):null;case "alignLeft":return t("blockFormat")?jsx(S,{onClick:()=>e.setTextAlignment("left"),active:n.isTextAlignedLeft,title:"Align Left",children:jsx(lt,{size:16})},"alignLeft"):null;case "alignCenter":return t("blockFormat")?jsx(S,{onClick:()=>e.setTextAlignment("center"),active:n.isTextAlignedCenter,title:"Align Center",children:jsx(et,{size:16})},"alignCenter"):null;case "alignRight":return t("blockFormat")?jsx(S,{onClick:()=>e.setTextAlignment("right"),active:n.isTextAlignedRight,title:"Align Right",children:jsx(at,{size:16})},"alignRight"):null;case "alignJustify":return t("blockFormat")?jsx(S,{onClick:()=>e.setTextAlignment("justify"),active:n.isTextAlignedJustify,title:"Justify",children:jsx(wo,{size:16})},"alignJustify"):null;case "codeBlock":return t("code")?jsx(S,{onClick:()=>e.toggleCodeBlock(),active:n.isInCodeBlock,title:"Code Block",children:jsx(So,{size:16})},"codeBlock"):null;case "unorderedList":return t("list")?jsx(S,{onClick:()=>e.toggleUnorderedList(),active:n.unorderedList,title:"Bullet List",children:jsx(Pt,{size:16})},"unorderedList"):null;case "orderedList":return t("list")?jsx(S,{onClick:()=>e.toggleOrderedList(),active:n.orderedList,title:"Numbered List",children:jsx(Rt,{size:16})},"orderedList"):null;case "checkList":return t("list")?jsx(S,{onClick:()=>e.toggleCheckList(),active:n.checkList,title:"Checklist",children:jsx(zt,{size:16})},"checkList"):null;case "indentList":return t("list")?jsx(S,{onClick:()=>e.indentList(),title:"Indent List",disabled:n.checkList,children:jsx(Ro,{size:14})},"indentList"):null;case "outdentList":return t("list")?jsx(S,{onClick:()=>e.outdentList(),title:"Outdent List",disabled:n.checkList,children:jsx(Ao,{size:14})},"outdentList"):null;case "horizontalRule":return t("horizontalRule")?jsx(S,{onClick:()=>e.insertHorizontalRule(),title:"Insert Horizontal Rule",children:jsx(Fo,{size:16})},"horizontalRule"):null;case "table":return t("table")?jsx(S,{onClick:()=>H(true),title:"Insert Table",children:jsx(No,{size:16})},"table"):null;case "image":return t("image")?jsxs(Fragment,{children:[jsxs(yt,{trigger:jsx("button",{className:`luthor-toolbar-button ${n.imageSelected?"active":""}`,title:"Insert Image",children:jsx(Yt,{size:16})}),isOpen:j,onOpenChange:C,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.insertFromUrl(),C(false);},children:[jsx(it,{size:16}),jsx("span",{children:"From URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.insertFromFile(),C(false);},children:[jsx(Gt,{size:16}),jsx("span",{children:"Upload File"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.insertGifFromUrl(),C(false);},children:[jsx(Wt,{size:16}),jsx("span",{children:"Insert GIF URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.insertGifFromFile(),C(false);},children:[jsx(Gt,{size:16}),jsx("span",{children:"Upload GIF"})]})]},"image"),n.imageSelected&&jsxs(yt,{trigger:jsx("button",{className:"luthor-toolbar-button",title:"Align Image",children:jsx(et,{size:16})}),isOpen:V,onOpenChange:d,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.setAlignment("left"),d(false);},children:[jsx(lt,{size:16}),jsx("span",{children:"Align Left"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.setAlignment("center"),d(false);},children:[jsx(et,{size:16}),jsx("span",{children:"Align Center"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.setAlignment("right"),d(false);},children:[jsx(at,{size:16}),jsx("span",{children:"Align Right"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{g.setCaption(),d(false);},children:[jsx(zo,{size:16}),jsx("span",{children:"Set Caption"})]})]},"imageAlign")]}):null;case "emoji":return !t("emoji")||Oe.length===0?null:jsx(yt,{trigger:jsx("button",{className:"luthor-toolbar-button",title:"Insert Emoji",children:jsx(Wt,{size:16})}),isOpen:Z,onOpenChange:re,children:jsx("div",{className:"luthor-emoji-picker-grid",role:"listbox","aria-label":"Emoji picker",children:Oe.map(b=>jsx("button",{type:"button",className:"luthor-emoji-picker-item",title:b.shortcodes[0]?`${b.label} (:${b.shortcodes[0]}:)`:b.label,onClick:()=>{e.insertEmoji?.(b.emoji),re(false);},children:b.emoji},`${b.emoji}-${b.label}`))})},"emoji");case "embed":return P?jsxs(yt,{trigger:jsx("button",{className:`luthor-toolbar-button ${J?"active":""}`,title:"Insert Embed",children:jsx(Oo,{size:16})}),isOpen:w,onOpenChange:k,children:[t("iframeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{F.insertIframe(),k(false);},children:[jsx(it,{size:16}),jsx("span",{children:"Embed iframe"})]}):null,t("youtubeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{F.insertYouTube(),k(false);},children:[jsx(Yt,{size:16}),jsx("span",{children:"Embed YouTube Video"})]}):null]},"embed"):null;case "undo":return t("history")?jsx(S,{onClick:()=>e.undo(),disabled:!n.canUndo,title:"Undo (Ctrl+Z)",children:jsx(Lo,{size:16})},"undo"):null;case "redo":return t("history")?jsx(S,{onClick:()=>e.redo(),disabled:!n.canRedo,title:"Redo (Ctrl+Y)",children:jsx(Io,{size:16})},"redo"):null;case "commandPalette":return jsx(S,{onClick:()=>r?.(),title:"Command Palette (Ctrl+Shift+P)",children:jsx(At,{size:16})},"commandPalette");case "themeToggle":return jsx(S,{onClick:l,title:o?"Light Mode":"Dark Mode",children:o?jsx(Bo,{size:16}):jsx(Mo,{size:16})},"themeToggle");default:return null}},q=u??Lt,Je=useMemo(()=>yi(q,t,y),[q,t,y]);return jsxs(Fragment,{children:[jsx("div",{className:a?.toolbar??"luthor-toolbar",style:c,children:Je.sections.map((f,b)=>{let O=f.items.map((R,le)=>{let ae=X(R);return ae?Array.isArray(ae)?ae.map((W,St)=>W&&typeof W=="object"&&"key"in W&&W.key!=null?W:jsx("span",{children:W},`toolbar-item-${b}-${le}-${St}`)):ae.type===ri.Fragment?jsx("span",{children:ae},`toolbar-item-${b}-${le}`):ae&&typeof ae=="object"&&"key"in ae&&ae.key!=null?ae:jsx("span",{children:ae},`toolbar-item-${b}-${le}`):null}).flat().filter(R=>R!==null);return O.length===0?null:jsx("div",{className:a?.section??"luthor-toolbar-section",children:O},b)})}),jsx("input",{ref:p,type:"file",accept:"image/*",onChange:g.handleUpload,className:"luthor-file-input"}),jsx("input",{ref:U,type:"file",accept:"image/gif",onChange:g.handleGifUpload,className:"luthor-file-input"}),jsx(Zo,{isOpen:M,onClose:()=>H(false),title:"Insert Table",children:jsxs("div",{className:"luthor-table-dialog",children:[jsxs("div",{className:"luthor-form-group",children:[jsx("label",{htmlFor:"table-rows",children:"Rows:"}),jsx("input",{id:"table-rows",type:"number",min:"1",max:"20",value:G.rows,onChange:f=>Ee(b=>({...b,rows:parseInt(f.target.value)||1})),className:"luthor-input"})]}),jsxs("div",{className:"luthor-form-group",children:[jsx("label",{htmlFor:"table-columns",children:"Columns:"}),jsx("input",{id:"table-columns",type:"number",min:"1",max:"20",value:G.columns,onChange:f=>Ee(b=>({...b,columns:parseInt(f.target.value)||1})),className:"luthor-input"})]}),jsx("div",{className:"luthor-form-group",children:jsxs("label",{className:"luthor-checkbox-label",children:[jsx("input",{type:"checkbox",checked:G.includeHeaders||false,onChange:f=>Ee(b=>({...b,includeHeaders:f.target.checked})),className:"luthor-checkbox"}),"Include headers"]})}),jsxs("div",{className:"luthor-dialog-actions",children:[jsx(Xt,{variant:"secondary",onClick:()=>H(false),children:"Cancel"}),jsx(Xt,{variant:"primary",onClick:()=>{e.insertTable(G),H(false);},children:"Insert Table"})]})]})})]})}var go=["bold","italic","underline","strikethrough","fontFamily","fontSize","lineHeight","textColor","textHighlight","subscript","superscript","link","horizontalRule","table","list","history","image","blockFormat","code","codeIntelligence","codeFormat","tabIndent","enterKeyBehavior","iframeEmbed","youTubeEmbed","floatingToolbar","contextMenu","commandPalette","slashCommand","emoji","draggableBlock","customNode","themeToggle"],kn={bold:true,italic:true,underline:true,strikethrough:true,fontFamily:true,fontSize:true,lineHeight:true,textColor:true,textHighlight:true,subscript:true,superscript:true,link:true,horizontalRule:true,table:true,list:true,history:true,image:true,blockFormat:true,code:true,codeIntelligence:true,codeFormat:true,tabIndent:true,enterKeyBehavior:true,iframeEmbed:true,youTubeEmbed:true,floatingToolbar:true,contextMenu:true,commandPalette:true,slashCommand:true,emoji:true,draggableBlock:true,customNode:true,themeToggle:true};function Tt(e){let t={...kn};if(!e)return t;for(let n of go)typeof e[n]=="boolean"&&(t[n]=e[n]);return t}function En(e,t){return e[t]!==false}var yn=[{value:"default",label:"Default",fontFamily:"inherit"},{value:"inter",label:"Inter",fontFamily:"'Inter', 'Segoe UI', Arial, sans-serif",cssImportUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{value:"merriweather",label:"Merriweather",fontFamily:"'Merriweather', Georgia, 'Times New Roman', serif",cssImportUrl:"https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap"},{value:"jetbrains-mono",label:"JetBrains Mono",fontFamily:"'JetBrains Mono', 'Courier New', monospace",cssImportUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap"}],Yi={value:"default",label:"Default",fontFamily:"inherit"},vn=[{value:"default",label:"Default",fontSize:"inherit"},{value:"12",label:"12px",fontSize:"12px"},{value:"14",label:"14px",fontSize:"14px"},{value:"16",label:"16px",fontSize:"16px"},{value:"18",label:"18px",fontSize:"18px"},{value:"20",label:"20px",fontSize:"20px"},{value:"24",label:"24px",fontSize:"24px"},{value:"32",label:"32px",fontSize:"32px"}],Gi={value:"default",label:"Default",fontSize:"inherit"},Cn=[{value:"default",label:"Default",lineHeight:"1.5"},{value:"1",label:"1.0",lineHeight:"1"},{value:"1.15",label:"1.15",lineHeight:"1.15"},{value:"1.5",label:"1.5",lineHeight:"1.5"},{value:"1.75",label:"1.75",lineHeight:"1.75"},{value:"2",label:"2.0",lineHeight:"2"}],Wi={value:"default",label:"Default",lineHeight:"1.5"},Et="1.5",Qi=1;function nt(e){return e.trim().toLowerCase()}function Tn(e){return /^[a-z0-9][a-z0-9-]*$/i.test(e)}function Xi(e){return nt(e)==="default"?true:jt(e)!==null}function Zi(e){let t=e??yn,n=new Set,o=[];for(let r of t){let i=r.value.trim(),a=r.label.trim(),c=r.fontFamily.trim();if(!i||!a||!c||!Tn(i))continue;let u=nt(i);n.has(u)||(n.add(u),o.push({value:i,label:a,fontFamily:c,cssImportUrl:r.cssImportUrl?.trim()||void 0}));}return o.length===0?yn:o.some(r=>nt(r.value)==="default")?o:[Yi,...o]}function el(e){let t=e??vn,n=new Set,o=[];for(let r of t){let i=String(r.value).trim(),a=String(r.label).trim(),c=String(r.fontSize).trim();if(!i||!a||!c||!Tn(i))continue;let u=nt(i);n.has(u)||(n.add(u),o.push({value:i,label:a,fontSize:c}));}return o.length===0?vn:o.some(r=>nt(r.value)==="default")?o:[Gi,...o]}function jt(e){let t=e.trim();if(!/^\d*\.?\d+$/.test(t))return null;let n=Number(t);return !Number.isFinite(n)||n<Qi?null:n.toString()}function tl(e){return typeof e=="number"?Number.isFinite(e)?jt(e.toString())??Et:Et:typeof e=="string"?jt(e)??Et:Et}function ol(e,t=Et){let n=e??Cn,o=new Set,l=[];for(let i of n){let a=String(i.value).trim(),c=String(i.label).trim();if(!a||!c||!Xi(a))continue;let u=nt(a);if(o.has(u))continue;if(u==="default"){o.add(u),l.push({value:a,label:c,lineHeight:t});continue}let y=jt(String(i.lineHeight));y&&(o.add(u),l.push({value:a,label:c,lineHeight:y}));}return l.length===0?Cn:l.some(i=>nt(i.value)==="default")?l:[{...Wi,lineHeight:t},...l]}function We({children:e}){return jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var nl=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M10.5 14.5h3"}),jsx("path",{d:"M12 2.8v4.4"}),jsx("path",{d:"M9.8 5h4.4"})]}),rl=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M10.5 8.5h3"}),jsx("path",{d:"M12 16.8v4.4"}),jsx("path",{d:"M9.8 19h4.4"})]}),il=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M11.5 5v14"}),jsx("path",{d:"M7.5 10.5v3"}),jsx("path",{d:"M2.8 12h4.4"}),jsx("path",{d:"M5 9.8v4.4"})]}),ll=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M12.5 5v14"}),jsx("path",{d:"M16.5 10.5v3"}),jsx("path",{d:"M16.8 12h4.4"}),jsx("path",{d:"M19 9.8v4.4"})]}),al=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M9.8 14.8l4.4 4.4"}),jsx("path",{d:"M14.2 14.8l-4.4 4.4"})]}),sl=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M12 5v14"}),jsx("path",{d:"M14.8 9.8l4.4 4.4"}),jsx("path",{d:"M19.2 9.8l-4.4 4.4"})]}),ul=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 10.5h17"}),jsx("path",{d:"M10.5 5v14"}),jsx("path",{d:"M14.8 9.8l4.4 4.4"}),jsx("path",{d:"M19.2 9.8l-4.4 4.4"})]}),cl=()=>jsxs(We,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 10.5h17"}),jsx("path",{d:"M10.5 5v14"}),jsx("path",{d:"M3.5 8h17"})]}),_t=new ImageExtension;_t.config={..._t.config,uploadHandler:async e=>URL.createObjectURL(e),defaultAlignment:"center",resizable:true,pasteListener:{insert:true,replace:true},debug:false};var io=new TableExtension;io.config={...io.config,enableContextMenu:true,tableBubbleRenderer:({headersEnabled:e,setHeadersEnabled:t,actions:n})=>jsxs(Fragment,{children:[jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert row above","aria-label":"Insert row above",onClick:n.insertRowAbove,children:jsx(nl,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert row below","aria-label":"Insert row below",onClick:n.insertRowBelow,children:jsx(rl,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert column left","aria-label":"Insert column left",onClick:n.insertColumnLeft,children:jsx(il,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert column right","aria-label":"Insert column right",onClick:n.insertColumnRight,children:jsx(ll,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Delete selected row","aria-label":"Delete selected row",onClick:n.deleteSelectedRow,children:jsx(al,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Delete selected column","aria-label":"Delete selected column",onClick:n.deleteSelectedColumn,children:jsx(sl,{})}),jsx("label",{className:"luthor-table-bubble-checkbox",title:"Use first row as table headers",children:jsx("button",{type:"button",className:`luthor-table-bubble-button luthor-table-bubble-button-icon${e?" luthor-table-bubble-button-active":""}`,title:"Use first row as table headers","aria-label":"Use first row as table headers","aria-pressed":e,onClick:()=>t(!e),children:jsx(cl,{})})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon luthor-table-bubble-button-danger",title:"Delete table","aria-label":"Delete table",onClick:n.deleteTable,children:jsx(ul,{})})]})};var lo=new IframeEmbedExtension;lo.config={...lo.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center"};var ao=new YouTubeEmbedExtension;ao.config={...ao.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center",nocookie:true,controls:true,rel:1};var dl=tn(),so=new ContextMenuExtension;so.config={...so.config,preventDefault:true};var gl=new CommandPaletteExtension,ml=new SlashCommandExtension,fl=new EmojiExtension,uo=new DraggableBlockExtension;uo.config={...uo.config,buttonStackPosition:"left"};var co=new LinkExtension;co.config={...co.config,linkSelectedTextOnPaste:true,autoLinkText:true,autoLinkUrls:true};var hl=textColorExtension.configure({options:[{value:"default",label:"Default",color:"inherit"},{value:"slate",label:"Slate",color:"#334155"},{value:"red",label:"Red",color:"#dc2626"},{value:"orange",label:"Orange",color:"#ea580c"},{value:"green",label:"Green",color:"#16a34a"},{value:"blue",label:"Blue",color:"#2563eb"},{value:"purple",label:"Purple",color:"#7c3aed"}]}),pl=textHighlightExtension.configure({options:[{value:"default",label:"Default",backgroundColor:"transparent"},{value:"yellow",label:"Yellow",backgroundColor:"#fef08a"},{value:"green",label:"Green",backgroundColor:"#bbf7d0"},{value:"blue",label:"Blue",backgroundColor:"#bfdbfe"},{value:"pink",label:"Pink",backgroundColor:"#fbcfe8"},{value:"orange",label:"Orange",backgroundColor:"#fed7aa"}]}),{extension:bl}=createCustomNodeExtension({nodeType:"featureCard",defaultPayload:{title:"Headless Custom Node",description:"This block is rendered by createCustomNodeExtension from @lyfie/luthor-headless.",tag:"Custom"},render:({payload:e,isSelected:t})=>jsxs("aside",{className:`luthor-extensive-feature-card${t?" is-selected":""}`,children:[jsx("div",{className:"luthor-extensive-feature-card__tag",children:e.tag??"Custom"}),jsx("h4",{className:"luthor-extensive-feature-card__title",children:e.title??"Custom Node"}),jsx("p",{className:"luthor-extensive-feature-card__description",children:e.description??"Insert strongly typed custom content blocks."})]})});function xn({fontFamilyOptions:e,fontSizeOptions:t,lineHeightOptions:n,minimumDefaultLineHeight:o,featureFlags:l,isDraggableBoxEnabled:r,scaleByRatio:i,syntaxHighlighting:a,codeHighlightProvider:c,loadCodeHighlightProvider:u,maxAutoDetectCodeLength:y,isCopyAllowed:m,languageOptions:h}={}){let g=Tt(l),p=Z=>En(g,Z),U=(r??true)&&p("draggableBlock"),F=tl(o),P=new FontFamilyExtension().configure({options:Zi(e),cssLoadStrategy:"on-demand"}),J=new FontSizeExtension().configure({options:el(t)}),j=new LineHeightExtension().configure({options:ol(n,F),defaultLineHeight:F});_t.configure({scaleByRatio:i??false}),codeExtension.configure({syntaxHighlighting:a??"auto",provider:c??void 0,loadProvider:u}),codeIntelligenceExtension.configure({provider:c??void 0,loadProvider:u,maxAutoDetectLength:y,isCopyAllowed:m??true,languageOptions:h});let C=[];return p("bold")&&C.push(boldExtension),p("italic")&&C.push(italicExtension),p("underline")&&C.push(underlineExtension),p("strikethrough")&&C.push(strikethroughExtension),p("fontFamily")&&C.push(P),p("fontSize")&&C.push(J),p("lineHeight")&&C.push(j),p("textColor")&&C.push(hl),p("textHighlight")&&C.push(pl),p("subscript")&&C.push(subscriptExtension),p("superscript")&&C.push(superscriptExtension),p("link")&&C.push(co),p("horizontalRule")&&C.push(horizontalRuleExtension),p("table")&&C.push(io),p("list")&&C.push(listExtension),p("history")&&C.push(historyExtension),p("image")&&C.push(_t),p("blockFormat")&&C.push(blockFormatExtension),p("code")&&C.push(codeExtension),p("codeIntelligence")&&C.push(codeIntelligenceExtension),p("codeFormat")&&C.push(codeFormatExtension),p("tabIndent")&&C.push(tabIndentExtension),p("enterKeyBehavior")&&C.push(enterKeyBehaviorExtension),p("iframeEmbed")&&C.push(lo),p("youTubeEmbed")&&C.push(ao),p("floatingToolbar")&&C.push(dl),p("contextMenu")&&C.push(so),p("commandPalette")&&C.push(gl),p("slashCommand")&&C.push(ml),p("emoji")&&C.push(fl),U&&C.push(uo),p("customNode")&&C.push(bl),C}function xt(e){return xn(e)}xn();function Sn(e){if(!e)return "__default__";let t=Object.entries(e).filter(([,n])=>typeof n=="string"&&n.trim().length>0).sort(([n],[o])=>n.localeCompare(o));return t.length>0?JSON.stringify(t):"__default__"}function Ln(e){if(!e)return;let t={},n=(o,l)=>{typeof l=="string"&&l.trim().length>0&&(t[o]=l.trim());};return n("--luthor-fg",e.font?.color),n("--luthor-text-bold-color",e.font?.boldColor),n("--luthor-link-color",e.link?.color),n("--luthor-list-marker-color",e.list?.markerColor),n("--luthor-list-checkbox-color",e.list?.checkboxColor),n("--luthor-quote-bg",e.quote?.backgroundColor),n("--luthor-quote-fg",e.quote?.color),n("--luthor-quote-border",e.quote?.indicatorColor),n("--luthor-table-border-color",e.table?.borderColor),n("--luthor-table-header-bg",e.table?.headerBackgroundColor),n("--luthor-hr-color",e.hr?.color),n("--luthor-placeholder-color",e.placeholder?.color),n("--luthor-codeblock-bg",e.codeblock?.backgroundColor),n("--luthor-toolbar-bg",e.toolbar?.backgroundColor),Object.keys(t).length>0?t:void 0}function In(e){if(!(e instanceof Element))return false;if(e.closest('[contenteditable="true"]'))return true;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function wn(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return false;let n=e.ctrlKey||e.metaKey;return !(!!t.requiresPrimary!==n||!!t.shift!=!!e.shiftKey||!!t.alt!=!!e.altKey)}function Fn(e,t,n){let o={...e??{}};for(let[l,r]of Object.entries(n))(Array.isArray(r)?r:[r]).some(c=>t[c]!==false)||(o[l]=false);return o}function Nn(e,t,n){let o={...e},l=(r,i)=>{t[r]===false&&i();};return l("bold",()=>{o.toggleBold=()=>{};}),l("italic",()=>{o.toggleItalic=()=>{};}),l("underline",()=>{o.toggleUnderline=()=>{};}),l("strikethrough",()=>{o.toggleStrikethrough=()=>{};}),l("codeFormat",()=>{o.formatText=()=>{};}),l("fontFamily",()=>{o.setFontFamily=()=>{},o.clearFontFamily=()=>{};}),l("fontSize",()=>{o.setFontSize=()=>{},o.clearFontSize=()=>{};}),l("lineHeight",()=>{o.setLineHeight=()=>{},o.clearLineHeight=()=>{};}),l("textColor",()=>{o.setTextColor=()=>{},o.clearTextColor=()=>{};}),l("textHighlight",()=>{o.setTextHighlight=()=>{},o.clearTextHighlight=()=>{};}),l("subscript",()=>{o.toggleSubscript=()=>{};}),l("superscript",()=>{o.toggleSuperscript=()=>{};}),l("link",()=>{o.insertLink=()=>{},o.removeLink=()=>{},o.updateLink=()=>false,o.getCurrentLink=async()=>null,o.getLinkByKey=async()=>null,o.updateLinkByKey=()=>false,o.removeLinkByKey=()=>false;}),l("blockFormat",()=>{o.toggleParagraph=()=>{},o.toggleHeading=()=>{},o.toggleQuote=()=>{},o.setTextAlignment=()=>{};}),l("code",()=>{o.toggleCodeBlock=()=>{};}),l("codeIntelligence",()=>{o.setCodeLanguage=()=>{},o.autoDetectCodeLanguage=async()=>null,o.copySelectedCodeBlock=async()=>false;}),l("list",()=>{o.toggleUnorderedList=()=>{},o.toggleOrderedList=()=>{},o.toggleCheckList=()=>{},o.indentList=()=>{},o.outdentList=()=>{};}),l("horizontalRule",()=>{o.insertHorizontalRule=()=>{};}),l("table",()=>{o.insertTable=()=>{};}),l("image",()=>{o.insertImage=()=>{},o.setImageAlignment=()=>{},o.setImageCaption=()=>{},o.getImageCaption=async()=>"";}),l("emoji",()=>{o.insertEmoji=()=>{},o.executeEmojiSuggestion=()=>false,o.closeEmojiSuggestions=()=>{},o.getEmojiSuggestions=()=>[],o.getEmojiCatalog=()=>[],o.resolveEmojiShortcode=()=>null,o.setEmojiCatalog=()=>{},o.setEmojiCatalogAdapter=()=>{},o.getEmojiCatalogAdapter=()=>({search:()=>[],resolveShortcode:()=>null,getAll:()=>[]});}),l("iframeEmbed",()=>{o.insertIframeEmbed=()=>{},o.setIframeEmbedAlignment=()=>{},o.resizeIframeEmbed=()=>{},o.setIframeEmbedCaption=()=>{},o.getIframeEmbedCaption=async()=>"",o.updateIframeEmbedUrl=()=>false,o.getIframeEmbedUrl=async()=>"";}),l("youTubeEmbed",()=>{o.insertYouTubeEmbed=()=>{},o.setYouTubeEmbedAlignment=()=>{},o.resizeYouTubeEmbed=()=>{},o.setYouTubeEmbedCaption=()=>{},o.getYouTubeEmbedCaption=async()=>"",o.updateYouTubeEmbedUrl=()=>false,o.getYouTubeEmbedUrl=async()=>"";}),l("history",()=>{o.undo=()=>{},o.redo=()=>{};}),l("commandPalette",()=>{o.showCommandPalette=()=>{},o.hideCommandPalette=()=>{},o.registerCommand=()=>{},o.unregisterCommand=()=>{};}),l("slashCommand",()=>{o.registerSlashCommand=()=>{},o.unregisterSlashCommand=()=>{},o.setSlashCommands=()=>{},o.closeSlashMenu=()=>{},o.executeSlashCommand=()=>false;}),n&&(o.toggleBold=()=>{},o.toggleItalic=()=>{},o.toggleUnderline=()=>{},o.toggleStrikethrough=()=>{},o.formatText=()=>{},o.setFontFamily=()=>{},o.clearFontFamily=()=>{},o.setFontSize=()=>{},o.clearFontSize=()=>{},o.setLineHeight=()=>{},o.clearLineHeight=()=>{},o.setTextColor=()=>{},o.clearTextColor=()=>{},o.setTextHighlight=()=>{},o.clearTextHighlight=()=>{},o.toggleSubscript=()=>{},o.toggleSuperscript=()=>{},o.insertLink=()=>{},o.removeLink=()=>{},o.updateLink=()=>false,o.toggleParagraph=()=>{},o.toggleHeading=()=>{},o.toggleQuote=()=>{},o.setTextAlignment=()=>{},o.toggleUnorderedList=()=>{},o.toggleOrderedList=()=>{},o.toggleCheckList=()=>{},o.indentList=()=>{},o.outdentList=()=>{},o.insertHorizontalRule=()=>{},o.insertTable=()=>{},o.insertImage=()=>{},o.setImageAlignment=()=>{},o.setImageCaption=()=>{},o.insertIframeEmbed=()=>{},o.setIframeEmbedAlignment=()=>{},o.resizeIframeEmbed=()=>{},o.setIframeEmbedCaption=()=>{},o.updateIframeEmbedUrl=()=>false,o.insertYouTubeEmbed=()=>{},o.setYouTubeEmbedAlignment=()=>{},o.resizeYouTubeEmbed=()=>{},o.setYouTubeEmbedCaption=()=>{},o.updateYouTubeEmbedUrl=()=>false),o}function On(e){return new Set(e)}function Hn(e,t){e.clear();for(let n of t)e.add(n);}function Pn(e,t){return e.has(t)}function zn(e,t){e.add(t);}var N=(e,t=0,n="")=>({type:"text",version:1,text:e,detail:0,format:t,mode:"normal",style:n}),ge=(e,t="",n=0)=>({type:"paragraph",version:1,format:t,indent:n,direction:null,children:e}),mo={root:{type:"root",version:1,format:"",indent:0,direction:null,children:[{type:"heading",version:1,tag:"h1",format:"",indent:0,direction:null,children:[N("Extensive Preset: JSONB-First Feature Showcase")]},ge([N("This starter content is now a native "),N("JSONB",1),N(" document that demonstrates visual editing without Markdown conversion.")]),{type:"heading",version:1,tag:"h2",format:"",indent:0,direction:null,children:[N("Inline formatting + typography")]},ge([N("Bold",1),N(" \u2022 "),N("Italic",2),N(" \u2022 "),N("Underline",8),N(" \u2022 "),N("Strikethrough",4),N(" \u2022 "),N("Inline Code",16),N(" \u2022 "),N("Subscript",32),N(" \u2022 "),N("Superscript",64)]),ge([N("Font family + size + color + highlight + line-height can be combined in one sentence.",0,"font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 18px; line-height: 1.75; color: #2563eb; background-color: #bfdbfe;")]),{type:"paragraph",version:1,format:"center",indent:0,direction:null,children:[N("Centered paragraph with custom style",0,"font-size: 20px; color: #7c3aed;")]},{type:"paragraph",version:1,format:"right",indent:0,direction:null,children:[N("Right-aligned paragraph with highlight",128,"background-color: #fef08a;")]},{type:"quote",version:1,format:"",indent:0,direction:null,children:[N("\u201CEverything in this demo is persisted in JSONB and can round-trip via visual mode.\u201D")]},{type:"paragraph",version:1,format:"",indent:0,direction:null,children:[{type:"link",version:1,rel:"noreferrer",target:"_blank",title:"Luthor documentation",url:"https://github.com/facebook/lexical",format:"",indent:0,direction:null,children:[N("Example link node")]},N(" with regular sibling text and emoji support \u{1F389}\u{1F525}\u2705.")]},{type:"heading",version:1,tag:"h2",format:"",indent:0,direction:null,children:[N("Lists")]},{type:"list",version:1,listType:"bullet",start:1,tag:"ul",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,format:"",indent:0,direction:null,children:[ge([N("Bullet item with styled text",0,"color: #16a34a;")])]},{type:"listitem",version:1,value:2,format:"",indent:0,direction:null,children:[ge([N("Nested formatting in lists",1),N(" works great.")])]}]},{type:"list",version:1,listType:"number",start:1,tag:"ol",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,format:"",indent:0,direction:null,children:[ge([N("Numbered item 1")])]},{type:"listitem",version:1,value:2,format:"",indent:0,direction:null,children:[ge([N("Numbered item 2")])]}]},{type:"list",version:1,listType:"check",start:1,tag:"ul",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,checked:true,format:"",indent:0,direction:null,children:[ge([N("Checked task item")])]},{type:"listitem",version:1,value:2,checked:false,format:"",indent:0,direction:null,children:[ge([N("Unchecked task item")])]}]},{children:[{detail:0,format:0,mode:"normal",style:"",text:"const",type:"code-highlight",version:1,highlightType:"keyword"},{detail:0,format:0,mode:"normal",style:"",text:" content ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"=",type:"code-highlight",version:1,highlightType:"operator"},{detail:0,format:0,mode:"normal",style:"",text:" exportApi",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"toJSON",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"},{type:"linebreak",version:1},{detail:0,format:0,mode:"normal",style:"",text:"await",type:"code-highlight",version:1,highlightType:"keyword"},{detail:0,format:0,mode:"normal",style:"",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"saveToDatabase",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"{",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:" jsonb",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:":",type:"code-highlight",version:1,highlightType:"operator"},{detail:0,format:0,mode:"normal",style:"",text:" content ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"}",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"},{type:"linebreak",version:1},{detail:0,format:0,mode:"normal",style:"",text:"importApi",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"fromJSON",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"content",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript"},{type:"horizontalrule",version:1},{type:"featureCard",version:1,payload:{title:"Custom Node: Feature Card",description:"This block is rendered with createCustomNodeExtension and persists as structured payload.",tag:"Custom"},format:"",indent:0,direction:null,children:[]},{type:"image",version:1,src:"https://images.unsplash.com/photo-1461749280684-dccba630e2f6?auto=format&fit=crop&w=1200&q=80",alt:"Code editor on a laptop",caption:"Image node with caption, center alignment, and persisted dimensions.",alignment:"center",width:780,height:420},{type:"youtube-embed",version:1,src:"https://www.youtube.com/embed/dQw4w9WgXcQ",width:720,height:405,alignment:"center",start:0},{type:"iframe-embed",version:1,src:"https://example.com",width:720,height:405,alignment:"center",title:"Iframe embed example"},{type:"table",version:1,format:"",indent:0,direction:null,children:[{type:"tablerow",version:1,children:[{type:"tablecell",version:1,headerState:3,colSpan:1,rowSpan:1,width:240,backgroundColor:null,children:[ge([N("Feature")])]},{type:"tablecell",version:1,headerState:3,colSpan:1,rowSpan:1,width:320,backgroundColor:null,children:[ge([N("Status")])]}]},{type:"tablerow",version:1,children:[{type:"tablecell",version:1,headerState:0,colSpan:1,rowSpan:1,width:240,backgroundColor:null,children:[ge([N("Visual \u2194 JSONB switching")])]},{type:"tablecell",version:1,headerState:0,colSpan:1,rowSpan:1,width:320,backgroundColor:null,children:[ge([N("Round-trip ready \u2705")])]}]}]},ge([N("Use the toolbar, floating toolbar, slash commands (/), and command palette (Ctrl/Cmd+Shift+P) to explore the full preset.")])]}};JSON.stringify(mo);var{Provider:wl,useEditor:Fl}=createEditorSystem(),Rn="Write anything...",An="Enter JSONB document content...";function Nl(e){let n=e.replace(/\r\n?/g,`
3
+ `).trim().split(/\n{2,}/).map(l=>l.replace(/\s+/g," ").trim()).filter(l=>l.length>0);return {root:{type:"root",version:1,format:"",indent:0,direction:null,children:(n.length>0?n:[""]).map(l=>({type:"paragraph",version:1,format:"",indent:0,direction:null,children:[{type:"text",version:1,text:l,detail:0,format:0,mode:"normal",style:""}]}))}}}function Ol(e){try{let t=JSON.parse(e);return JSON.stringify(t)}catch{return JSON.stringify(Nl(e))}}function Hl(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:t.value.trim(),label:t.label.trim(),fontFamily:t.fontFamily.trim(),cssImportUrl:t.cssImportUrl?.trim()||""})))}function Pl(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:String(t.value).trim(),label:String(t.label).trim(),fontSize:String(t.fontSize).trim()})))}function zl(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:String(t.value).trim(),label:String(t.label).trim(),lineHeight:String(t.lineHeight).trim()})))}function Rl(e){if(typeof e=="number")return !Number.isFinite(e)||e<1?"1.5":e.toString();if(typeof e=="string"){let n=e.trim();if(n.length===0)return "1.5";let o=Number(n);return !Number.isFinite(o)||o<1?"1.5":o.toString()}return "1.5"}function fo(e){return Sn(e)}function Al(e){if(!e)return "__default__";if(Array.isArray(e))return JSON.stringify({mode:"append",values:e.map(o=>o.trim())});let t=e,n=Array.isArray(t.values)?t.values:[];return JSON.stringify({mode:t.mode??"append",values:n.map(o=>o.trim())})}function Bl(e){return Ln(e)}function Ml(e){let t=Tt(e);return JSON.stringify(go.map(n=>[n,t[n]]))}function Bn(e){return In(e)}var Dl=[{feature:"bold",key:"b",requiresPrimary:true},{feature:"italic",key:"i",requiresPrimary:true},{feature:"underline",key:"u",requiresPrimary:true},{feature:"link",key:"k",requiresPrimary:true},{feature:"history",key:"z",requiresPrimary:true},{feature:"history",key:"y",requiresPrimary:true},{feature:"history",key:"z",requiresPrimary:true,shift:true},{feature:"commandPalette",key:"p",requiresPrimary:true,shift:true},{feature:"codeFormat",key:"`",requiresPrimary:true},{feature:"code",key:"`",requiresPrimary:true,shift:true},{feature:"list",key:"l",requiresPrimary:true,shift:true},{feature:"list",key:"l",requiresPrimary:true,alt:true},{feature:"list",key:"x",requiresPrimary:true,shift:true},{feature:"blockFormat",key:"0",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"1",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"2",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"3",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"4",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"5",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"6",requiresPrimary:true,alt:true}];function Kl(e,t){return wn(e,t)}function Ul(e,t,n){return Nn(e,t,n)}var jl={fontFamily:"fontFamily",fontSize:"fontSize",lineHeight:"lineHeight",textColor:"textColor",textHighlight:"textHighlight",bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",subscript:"subscript",superscript:"superscript",code:"codeFormat",link:"link",blockFormat:"blockFormat",quote:"blockFormat",alignLeft:"blockFormat",alignCenter:"blockFormat",alignRight:"blockFormat",alignJustify:"blockFormat",codeBlock:"code",unorderedList:"list",orderedList:"list",checkList:"list",indentList:"list",outdentList:"list",horizontalRule:"horizontalRule",table:"table",image:"image",emoji:"emoji",embed:["iframeEmbed","youTubeEmbed"],undo:"history",redo:"history",commandPalette:"commandPalette",themeToggle:"themeToggle"};function _l(e,t){return Fn(e,t,jl)}function Vl(e){if(!e||e.length===0)return [...Te];let t=new Set,n=[];for(let o of e)!Te.includes(o)||t.has(o)||(t.add(o),n.push(o));return n.length>0?n:[...Te]}function $l(e){if(!e)return "__default__";if(Array.isArray(e)){let r=new Set,i=[];for(let a of e)for(let[c,u]of Object.entries(a)){let y=c.trim();!u||!y||r.has(y)||(r.add(y),i.push(y));}return i.length===0?"__default__":JSON.stringify({allowlist:i,denylist:[]})}let t=r=>{if(!r||r.length===0)return [];let i=new Set,a=[];for(let c of r){let u=c.trim();!u||i.has(u)||(i.add(u),a.push(u));}return a},n=e,o=t(n.allowlist),l=t(n.denylist);return o.length===0&&l.length===0?"__default__":JSON.stringify({allowlist:o,denylist:l})}function Jl(e){if(!e||e.length===0)return [];let t=new Set,n=[];for(let o of e){let l=o.trim();!l||t.has(l)||(t.add(l),n.push(l));}return n}function ql(e,t){return e.key.toLowerCase()===t.key.toLowerCase()&&!!e.ctrlKey==!!t.ctrlKey&&!!e.metaKey==!!t.metaKey&&!!e.shiftKey==!!t.shiftKey&&!!e.altKey==!!t.altKey}function Yl(e){if(!e)return "__default__";let t=Array.isArray(e.disabledCommandIds)?[...e.disabledCommandIds].map(o=>o.trim()).filter(o=>o.length>0).sort((o,l)=>o.localeCompare(l)):[],n=e.bindings?Object.entries(e.bindings).map(([o,l])=>{if(l===false||l===null)return [o,false];let i=(Array.isArray(l)?l:[l]).map(a=>({key:a.key.trim(),ctrlKey:!!a.ctrlKey,metaKey:!!a.metaKey,shiftKey:!!a.shiftKey,altKey:!!a.altKey,preventDefault:a.preventDefault})).filter(a=>a.key.length>0).sort((a,c)=>{let u=`${a.key}:${a.ctrlKey?1:0}:${a.metaKey?1:0}:${a.shiftKey?1:0}:${a.altKey?1:0}`,y=`${c.key}:${c.ctrlKey?1:0}:${c.metaKey?1:0}:${c.shiftKey?1:0}:${c.altKey?1:0}`;return u.localeCompare(y)});return i.length===0?[o,false]:[o,i]}).sort(([o],[l])=>o.localeCompare(l)):[];return JSON.stringify({disabledCommandIds:t,bindings:n,preventCollisions:e.preventCollisions!==false,preventNativeConflicts:e.preventNativeConflicts!==false})}function Gl({isDark:e,toggleTheme:t,visualPlaceholder:n,jsonbPlaceholder:o,initialMode:l,availableModes:r,onReady:i,toolbarLayout:a,toolbarVisibility:c,toolbarPosition:u,toolbarAlignment:y,toolbarClassName:m,toolbarStyleVars:h,isToolbarEnabled:g,headingOptions:p,paragraphLabel:U,syncHeadingOptionsWithCommands:F,slashCommandVisibility:P,shortcutConfig:J,commandPaletteShortcutOnly:j,featureFlags:C}){let{commands:Z,hasExtension:re,activeStates:V,lexical:d,extensions:w,export:k,import:M}=Fl(),[H,Q]=useState(l),[z,me]=useState({jsonb:""}),[te,xe]=useState(null),[ie,Se]=useState(null),[Le,Ie]=useState({isOpen:false,commands:[]}),[se,we]=useState({isOpen:false,query:"",position:null,commands:[]}),[Pe,Fe]=useState({isOpen:false,query:"",position:null,suggestions:[]}),ue=useRef(false),Ne=useMemo(()=>Vl(p),[p]),fe=F?Ne:void 0,ce=F?U:void 0,I=V.isInCodeBlock===true,L=useMemo(()=>Ul(Z,C,I),[Z,C,I]),_=useMemo(()=>v=>Object.prototype.hasOwnProperty.call(C,v)?C[v]!==false:true,[C]),Qe=useMemo(()=>_l(c,C),[c,C]),he=C.draggableBlock!==false,Ce=$l(P),je=useRef(P),ke=useRef(Ce),ze=Yl(J),G=useRef(J),Ee=useRef(ze),Oe=useMemo(()=>Jl(J?.disabledCommandIds),[J?.disabledCommandIds]),oe=useMemo(()=>new Set(Oe),[Oe]),pe=useMemo(()=>oe.size===0?[]:qt({headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:_}).filter(v=>oe.has(v.id)).flatMap(v=>v.shortcuts??[]),[oe,fe,ce,_]);ke.current!==Ce&&(ke.current=Ce,je.current=P),Ee.current!==ze&&(Ee.current=ze,G.current=J);let Re=useRef(On(["visual"])),A=useRef(0);useEffect(()=>{Zt(L,V,e?"dark":"light",_);},[L,V,e,_]);let He=useMemo(()=>({injectJSONB:v=>{setTimeout(()=>{try{let T=JSON.parse(v);M.fromJSON(T);}catch(T){console.error("Failed to inject JSONB:",T);return}},100);},getJSONB:()=>oo(JSON.stringify(k.toJSON()))}),[k,M]);useEffect(()=>{if(!d||!L)return;let v=L,T=ko(v,{headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:_,shortcutConfig:G.current,commandPaletteShortcutOnly:j});typeof v.registerCommand=="function"&&T.forEach(q=>v.registerCommand(q));let D=Eo(v,{headingOptions:fe,paragraphLabel:ce,slashCommandVisibility:je.current,isFeatureEnabled:_,shortcutConfig:G.current});typeof v.setSlashCommands=="function"?v.setSlashCommands(D):D.forEach(q=>v.registerSlashCommand?.(q));let X=xo(v,document.body,{headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:_,shortcutConfig:G.current,scope:()=>d.getRootElement()});return ue.current||(ue.current=true,i?.(He)),()=>{X(),typeof v.unregisterCommand=="function"&&T.forEach(q=>v.unregisterCommand(q.id)),typeof v.setSlashCommands=="function"?v.setSlashCommands([]):D.forEach(q=>v.unregisterSlashCommand?.(q.id));}},[d,L,He,i,fe,ce,Ce,ze,_,j]),useEffect(()=>{let v=()=>d?.getRootElement(),T=Dl.filter(X=>C[X.feature]===false);if(T.length===0)return;let D=X=>{let q=v();q&&X.target instanceof Node&&!q.contains(X.target)||!Bn(X.target)||!T.some(f=>Kl(X,f))||(X.preventDefault(),X.stopPropagation());};return document.addEventListener("keydown",D,true),()=>{document.removeEventListener("keydown",D,true);}},[d,C]),useEffect(()=>{let v=w.find(T=>T.name==="commandPalette");if(!(!v||!v.subscribe))return v.subscribe((T,D)=>{let X=D.filter(q=>oe.has(q.id)?false:j?typeof q.shortcut=="string"&&q.shortcut.trim().length>0:true);Ie({isOpen:T,commands:X});})},[w,oe,j]),useEffect(()=>{if(pe.length===0)return;let v=()=>d?.getRootElement(),T=D=>{let X=v();X&&D.target instanceof Node&&!X.contains(D.target)||!Bn(D.target)||!pe.some(Je=>ql(D,Je))||(D.preventDefault(),D.stopPropagation());};return document.addEventListener("keydown",T,true),()=>{document.removeEventListener("keydown",T,true);}},[d,pe]),useEffect(()=>{let v=w.find(T=>T.name==="slashCommand");if(!(!v||!v.subscribe))return v.subscribe(T=>{we({isOpen:T.isOpen,query:T.query,position:T.position,commands:T.commands});})},[w]),useEffect(()=>{let v=w.find(T=>T.name==="emoji");if(!(!v||!v.subscribe))return v.subscribe(T=>{Fe({isOpen:T.isOpen,query:T.query,position:T.position,suggestions:T.suggestions});})},[w]),useEffect(()=>!d||!k?void 0:d.registerUpdateListener(()=>{A.current+=1,Hn(Re.current,["visual"]);}),[d,k]);let Xe=async v=>{if(r.includes(v))try{if(Se(null),H==="jsonb"&&v!=="jsonb"){let T=JSON.parse(z.jsonb);M.fromJSON(T),await new Promise(D=>setTimeout(D,50));}if(H==="visual"&&v!=="visual"&&(d&&clearLexicalSelection(d),d?.getRootElement()?.blur()),Q(v),v==="jsonb"&&H!=="jsonb"&&!Pn(Re.current,"jsonb")){xe("jsonb"),await new Promise(T=>setTimeout(T,50));try{let T=oo(JSON.stringify(k.toJSON()));me(D=>({...D,jsonb:T})),zn(Re.current,"jsonb");}finally{xe(null);}}v==="visual"&&setTimeout(()=>d?.focus(),100);}catch(T){let D=T instanceof Error?T.message:"Invalid format - could not parse content";Se({mode:H,error:D});}},_e=g?jsx(hn,{commands:L,hasExtension:v=>re(v),activeStates:V,isDark:e,toggleTheme:t,onCommandPaletteOpen:()=>{C.commandPalette!==false&&L.showCommandPalette();},imageUploadHandler:v=>w.find(T=>T.name==="image")?.config?.uploadHandler?.(v)??Promise.resolve(URL.createObjectURL(v)),layout:a??Lt,toolbarVisibility:Qe,toolbarStyleVars:h,headingOptions:Ne,paragraphLabel:U,classNames:{toolbar:`luthor-toolbar luthor-toolbar--align-${y}${m?` ${m}`:""}`}}):null,Ve=H==="visual"&&g&&u==="top",$e=H==="visual"&&g&&u==="bottom";return jsxs(Fragment,{children:[jsxs("div",{className:"luthor-editor-header",children:[jsx(un,{mode:H,onModeChange:Xe,availableModes:r,isConverting:te}),Ve&&jsx("div",{className:"luthor-editor-toolbar-slot luthor-editor-toolbar-slot--top",children:_e})]}),jsxs("div",{className:`luthor-editor${he?"":" luthor-editor--draggable-disabled"}`,"data-mode":H,children:[jsxs("div",{className:`luthor-editor-visual-shell${H==="visual"?"":" is-hidden"}${he?"":" luthor-editor-visual-shell--no-gutter"}`,"aria-hidden":H!=="visual",children:[he&&jsx("div",{className:"luthor-editor-visual-gutter","aria-hidden":"true"}),jsx(RichText,{placeholder:n,classNames:{container:"luthor-richtext-container luthor-preset-extensive__container",contentEditable:"luthor-content-editable luthor-preset-extensive__content",placeholder:"luthor-placeholder luthor-preset-extensive__placeholder"}})]}),H!=="visual"&&jsxs("div",{className:"luthor-source-panel",children:[ie&&ie.mode===H&&jsxs("div",{className:"luthor-source-error",children:[jsx("div",{className:"luthor-source-error-icon",children:"\u26A0\uFE0F"}),jsxs("div",{className:"luthor-source-error-message",children:[jsx("strong",{children:"Invalid JSONB"}),jsx("p",{children:ie.error}),jsx("small",{children:"Fix the errors above and try switching modes again"})]})]}),H==="jsonb"&&jsx(cn,{value:z.jsonb,onChange:v=>me(T=>({...T,jsonb:v})),placeholder:o})]})]}),jsx(sn,{editor:d,commands:L,editorTheme:e?"dark":"light",disabled:H!=="visual"}),$e&&jsx("div",{className:"luthor-editor-toolbar-slot luthor-editor-toolbar-slot--bottom",children:_e}),jsx(Jo,{isOpen:Le.isOpen,onClose:()=>L.hideCommandPalette(),commands:Le.commands}),jsx(Qo,{isOpen:se.isOpen,query:se.query,position:se.position,commands:se.commands,onClose:()=>L.closeSlashMenu?.(),onExecute:v=>{L.executeSlashCommand?.(v);}}),jsx(Yo,{isOpen:Pe.isOpen,query:Pe.query,position:Pe.position,suggestions:Pe.suggestions,onClose:()=>L.closeEmojiSuggestions?.(),onExecute:v=>{L.executeEmojiSuggestion?.(v);}})]})}var Vt=forwardRef(({className:e,onReady:t,initialTheme:n="light",theme:o,defaultContent:l,showDefaultContent:r=true,placeholder:i=Rn,initialMode:a="visual",availableModes:c=["visual","jsonb"],variantClassName:u,toolbarLayout:y,toolbarVisibility:m,toolbarPosition:h="top",toolbarAlignment:g="left",toolbarClassName:p,toolbarStyleVars:U,quoteClassName:F,quoteStyleVars:P,defaultSettings:J,editorThemeOverrides:j,isToolbarEnabled:C=true,fontFamilyOptions:Z,fontSizeOptions:re,lineHeightOptions:V,minimumDefaultLineHeight:d=1.5,scaleByRatio:w=false,headingOptions:k,paragraphLabel:M,syncHeadingOptionsWithCommands:H=true,slashCommandVisibility:Q,shortcutConfig:z,commandPaletteShortcutOnly:me=false,isDraggableBoxEnabled:te,featureFlags:xe,syntaxHighlighting:ie,codeHighlightProvider:Se,loadCodeHighlightProvider:Le,maxAutoDetectCodeLength:Ie,isCopyAllowed:se=true,languageOptions:we},Pe)=>{let[Fe,ue]=useState(n),Ne=Fe==="dark",fe=c.includes(a)?a:c[0]??"visual",ce=()=>ue(Ne?"light":"dark"),I=useMemo(()=>typeof i=="string"?{visual:i,jsonb:An}:{visual:i.visual??Rn,jsonb:i.jsonb??An},[i]);useEffect(()=>{ue(n);},[n]);let L=useMemo(()=>Hl(Z),[Z]),_=useMemo(()=>Pl(re),[re]),Qe=useMemo(()=>zl(V),[V]),he=useMemo(()=>Rl(d),[d]),Ce=ie??"unset",je=typeof Ie=="number"?Ie.toString():"unset",ke=useMemo(()=>Al(we),[we]),ze=se?"copy-on":"copy-off",G=useMemo(()=>typeof te!="boolean"?xe:{...xe??{},draggableBlock:te},[xe,te]),Ee=useMemo(()=>Ml(G),[G]),Oe=useMemo(()=>Tt(G),[G]),oe=`${L}::${_}::${Qe}::${he}::${w?"ratio-on":"ratio-off"}::${Ce}::${je}::${ze}::${ke}::${Ee}`,pe=useRef(Z),Re=useRef(re),A=useRef(V),He=useRef(d),Xe=useRef(G),_e=useRef(we),Ve=useRef(Se),$e=useRef(Le),v=useRef(oe);(v.current!==oe||Ve.current!==Se||$e.current!==Le)&&(v.current=oe,pe.current=Z,Re.current=re,A.current=V,He.current=d,Xe.current=G,_e.current=we,Ve.current=Se,$e.current=Le);let T=useRef(null);if(!T.current||T.current.key!==oe){let W={fontFamilyOptions:pe.current,fontSizeOptions:Re.current,lineHeightOptions:A.current,minimumDefaultLineHeight:He.current,scaleByRatio:w,...ie!==void 0?{syntaxHighlighting:ie}:{},...Ve.current!==void 0?{codeHighlightProvider:Ve.current}:{},...$e.current!==void 0?{loadCodeHighlightProvider:$e.current}:{},...Ie!==void 0?{maxAutoDetectCodeLength:Ie}:{},isCopyAllowed:se,..._e.current!==void 0?{languageOptions:_e.current}:{},...typeof te=="boolean"?{isDraggableBoxEnabled:te}:{},...Xe.current?{featureFlags:Xe.current}:{}};T.current={key:oe,value:xt(W)};}let D=T.current.value,X=useMemo(()=>{let W=mergeThemes(defaultLuthorTheme,o??{});return F?{...W,quote:`${W.quote??""} ${F}`.trim()}:W},[o,F]),q=useMemo(()=>fo(j),[j]),Je=useMemo(()=>fo(P),[P]),f=useMemo(()=>Bl(J),[J]),b=useMemo(()=>fo(f),[f]),O=useMemo(()=>{let W=f,St=createEditorThemeStyleVars(j),po=P,bo={"--luthor-default-line-height":he};return !W&&!St&&!po?bo:{...W??{},...St,...po??{},...bo}},[he,f,j,P,b,q,Je]),[R,le]=useState(null);useImperativeHandle(Pe,()=>R,[R]);let ae=W=>{le(W),r&&l===void 0?W.injectJSONB(JSON.stringify(mo)):l&&W.injectJSONB(Ol(l)),t?.(W);};return jsx("div",{className:`luthor-preset luthor-preset-extensive luthor-editor-wrapper ${u||""} ${e||""}`.trim(),"data-editor-theme":Fe,style:O,children:jsx(wl,{extensions:D,config:{theme:X},children:jsx(Gl,{isDark:Ne,toggleTheme:ce,visualPlaceholder:I.visual,jsonbPlaceholder:I.jsonb,initialMode:fe,availableModes:c,onReady:ae,toolbarLayout:y,toolbarVisibility:m,toolbarPosition:h,toolbarAlignment:g,toolbarClassName:p,toolbarStyleVars:U,isToolbarEnabled:C,headingOptions:k,paragraphLabel:M,syncHeadingOptionsWithCommands:H,slashCommandVisibility:Q,shortcutConfig:z,commandPaletteShortcutOnly:me,featureFlags:Oe})})})});Vt.displayName="ExtensiveEditor";function ho({className:e,variantClassName:t,onSend:n,submitOnEnter:o=true,allowShiftEnter:l=true,showVoiceButton:r=false,showImageButton:i=true,showSendButton:a=true,...c}){let u=useRef(null),y=useCallback(()=>{n&&n({jsonb:u.current?.getJSONB()??""});},[n]),m=useCallback(h=>{!o||h.key!=="Enter"||h.nativeEvent.isComposing||h.shiftKey&&l||(h.preventDefault(),y());},[l,y,o]);return jsxs("div",{className:["luthor-preset-chat-window",e].filter(Boolean).join(" "),onKeyDownCapture:m,children:[jsx(Vt,{ref:u,...c,variantClassName:["luthor-preset-chat-window__variant",t].filter(Boolean).join(" "),isToolbarEnabled:false,availableModes:["visual"],initialMode:"visual",featureFlags:{bold:false,italic:false,underline:false,strikethrough:false,fontFamily:false,fontSize:false,lineHeight:false,textColor:false,textHighlight:false,subscript:false,superscript:false,link:true,horizontalRule:false,table:false,list:true,image:false,blockFormat:false,code:false,codeIntelligence:false,codeFormat:false,iframeEmbed:false,youTubeEmbed:false,floatingToolbar:false,contextMenu:false,commandPalette:false,slashCommand:false,emoji:true,draggableBlock:false,customNode:false,themeToggle:false}}),jsxs("div",{className:"luthor-chat-window-actions","data-testid":"chat-actions",children:[r&&jsx("button",{type:"button",className:"luthor-chat-window-action","data-testid":"chat-voice-button","aria-label":"Voice input",children:"Voice"}),i&&jsx("button",{type:"button",className:"luthor-chat-window-action","data-testid":"chat-image-button","aria-label":"Add image",children:"Image"}),a&&jsx("button",{type:"button",className:"luthor-chat-window-action luthor-chat-window-action-send","data-testid":"chat-send-button",onClick:y,"aria-label":"Send message",children:"Send"})]})]})}var Xl={id:"chat-window",label:"Chat Window",description:"Chat composer with action row and send controls.",extensions:xt({featureFlags:{bold:false,italic:false,underline:false,strikethrough:false,table:false,image:false,blockFormat:false,code:false,codeIntelligence:false,codeFormat:false,iframeEmbed:false,youTubeEmbed:false,commandPalette:false,slashCommand:false,draggableBlock:false,customNode:false}}),components:{Editor:ho},toolbar:[],config:dn("chat-window","Write a message..."),css:"chat-window/styles.css"};export{ho as ChatWindowEditor,Xl as chatWindowPreset};
@@ -0,0 +1 @@
1
+ .luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=light]{--luthor-bg: #ffffff;--luthor-fg: #0f172a;--luthor-border: #e2e8f0;--luthor-border-hover: #cbd5e1;--luthor-border-active: #94a3b8;--luthor-accent: #0f172a;--luthor-accent-hover: #1e293b;--luthor-shadow: rgba(0, 0, 0, .08);--luthor-muted: #f8fafc;--luthor-muted-fg: #64748b;--luthor-toolbar-bg: var(--luthor-muted);--luthor-toolbar-section-border: var(--luthor-border);--luthor-toolbar-button-fg: var(--luthor-fg);--luthor-toolbar-button-hover-bg: var(--luthor-muted);--luthor-toolbar-button-hover-border: var(--luthor-border-hover);--luthor-toolbar-button-hover-shadow: 0 4px 12px rgba(0, 0, 0, .15);--luthor-toolbar-button-press-shadow: 0 2px 8px rgba(0, 0, 0, .1);--luthor-toolbar-button-active-bg: var(--luthor-accent);--luthor-toolbar-button-active-border: var(--luthor-accent);--luthor-toolbar-button-active-fg: var(--luthor-bg);--luthor-toolbar-button-active-shadow: 0 2px 8px rgba(0, 0, 0, .2);--luthor-toolbar-button-overlay: linear-gradient(135deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .05) 100%);--luthor-toolbar-button-active-overlay: linear-gradient(135deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .1) 100%);--luthor-toolbar-color-indicator-border: var(--luthor-border);--luthor-toolbar-highlight-bg: var(--luthor-muted);--luthor-quote-bg: var(--luthor-muted);--luthor-quote-fg: var(--luthor-fg);--luthor-quote-border: var(--luthor-accent);--luthor-text-bold-color: var(--luthor-fg);--luthor-link-color: var(--luthor-accent);--luthor-list-marker-color: var(--luthor-fg);--luthor-list-checkbox-color: var(--luthor-accent);--luthor-table-border-color: var(--luthor-border);--luthor-table-header-bg: var(--luthor-muted);--luthor-hr-color: var(--luthor-border);--luthor-placeholder-color: var(--luthor-muted-fg);--luthor-codeblock-bg: var(--luthor-muted);--luthor-floating-bg: var(--luthor-bg);--luthor-floating-fg: var(--luthor-fg);--luthor-floating-border: var(--luthor-border);--luthor-floating-shadow: var(--luthor-shadow);--luthor-floating-muted: var(--luthor-muted);--luthor-floating-border-hover: var(--luthor-border-hover);--luthor-floating-border-active: var(--luthor-border-active);--luthor-floating-accent: var(--luthor-accent);--luthor-floating-accent-fg: var(--luthor-bg);--luthor-syntax-comment: #64748b;--luthor-syntax-keyword: #64748b;--luthor-syntax-string: #64748b;--luthor-syntax-number: #64748b;--luthor-syntax-function: #64748b;--luthor-syntax-variable: #64748b}.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark]{--luthor-bg: #0a0a0a;--luthor-fg: #ededed;--luthor-border: #262626;--luthor-border-hover: #404040;--luthor-border-active: #525252;--luthor-accent: #ededed;--luthor-accent-hover: #d4d4d8;--luthor-shadow: rgba(0, 0, 0, .5);--luthor-muted: #171717;--luthor-muted-fg: #a3a3a3;--luthor-toolbar-bg: var(--luthor-muted);--luthor-toolbar-section-border: var(--luthor-border);--luthor-toolbar-button-fg: var(--luthor-fg);--luthor-toolbar-button-hover-bg: var(--luthor-muted);--luthor-toolbar-button-hover-border: var(--luthor-border-hover);--luthor-toolbar-button-hover-shadow: 0 4px 12px rgba(0, 0, 0, .35);--luthor-toolbar-button-press-shadow: 0 2px 8px rgba(0, 0, 0, .3);--luthor-toolbar-button-active-bg: var(--luthor-accent);--luthor-toolbar-button-active-border: var(--luthor-accent);--luthor-toolbar-button-active-fg: var(--luthor-bg);--luthor-toolbar-button-active-shadow: 0 2px 8px rgba(0, 0, 0, .5);--luthor-toolbar-button-overlay: linear-gradient(135deg, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .03) 100%);--luthor-toolbar-button-active-overlay: linear-gradient(135deg, rgba(255, 255, 255, .14) 0%, rgba(255, 255, 255, .06) 100%);--luthor-toolbar-color-indicator-border: var(--luthor-border);--luthor-toolbar-highlight-bg: var(--luthor-muted);--luthor-quote-bg: color-mix(in srgb, var(--luthor-muted) 92%, #ffffff 8%);--luthor-quote-fg: var(--luthor-fg);--luthor-quote-border: color-mix(in srgb, var(--luthor-accent) 78%, #ffffff 22%);--luthor-text-bold-color: var(--luthor-fg);--luthor-link-color: var(--luthor-accent);--luthor-list-marker-color: var(--luthor-fg);--luthor-list-checkbox-color: var(--luthor-accent);--luthor-table-border-color: var(--luthor-border);--luthor-table-header-bg: var(--luthor-muted);--luthor-hr-color: var(--luthor-border);--luthor-placeholder-color: var(--luthor-muted-fg);--luthor-codeblock-bg: var(--luthor-muted);--luthor-floating-bg: var(--luthor-bg);--luthor-floating-fg: var(--luthor-fg);--luthor-floating-border: var(--luthor-border);--luthor-floating-shadow: var(--luthor-shadow);--luthor-floating-muted: var(--luthor-muted);--luthor-floating-border-hover: var(--luthor-border-hover);--luthor-floating-border-active: var(--luthor-border-active);--luthor-floating-accent: var(--luthor-accent);--luthor-floating-accent-fg: var(--luthor-bg);--luthor-syntax-comment: #8b949e;--luthor-syntax-keyword: #8b949e;--luthor-syntax-string: #8b949e;--luthor-syntax-number: #8b949e;--luthor-syntax-function: #8b949e;--luthor-syntax-variable: #8b949e}.luthor-preset-extensive.luthor-editor-wrapper{border:1px solid var(--luthor-border);border-radius:8px;background-color:var(--luthor-bg);overflow:hidden;display:flex;flex-direction:column;position:relative;--luthor-theme-transition: .2s ease;width:100%;max-width:100%;min-height:500px;height:auto;isolation:isolate;--luthor-z-dropdown: 20;--luthor-z-popover: 24;--luthor-z-menu: 28;--luthor-z-overlay: 32;--luthor-z-modal: 36;transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition),box-shadow var(--luthor-theme-transition)}.luthor-preset-extensive.luthor-editor-wrapper,.luthor-preset-extensive.luthor-editor-wrapper *,.luthor-preset-extensive.luthor-editor-wrapper *:before,.luthor-preset-extensive.luthor-editor-wrapper *:after{box-sizing:border-box}.luthor-editor-header{background-color:var(--luthor-muted);border-bottom:1px solid var(--luthor-border);transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-editor-toolbar-slot{background-color:var(--luthor-toolbar-bg, var(--luthor-muted));transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-editor-toolbar-slot--bottom{border-top:1px solid var(--luthor-border)}.luthor-mode-tabs{display:flex;border-bottom:1px solid var(--luthor-border);transition:border-color var(--luthor-theme-transition),background-color var(--luthor-theme-transition)}.luthor-mode-tab{padding:10px 20px;background:none;border:none;cursor:pointer;color:var(--luthor-muted-fg);font-size:14px;font-weight:500;transition:all .2s cubic-bezier(.4,0,.2,1);border-bottom:2px solid transparent;position:relative}.luthor-mode-tab:hover{color:var(--luthor-fg);background-color:var(--luthor-muted)}.luthor-mode-tab.active{color:var(--luthor-accent);border-bottom-color:var(--luthor-accent);background-color:#0f172a0d}.luthor-tab-converting-spinner{display:inline-block;width:12px;height:12px;margin-left:6px;border:2px solid var(--luthor-muted-fg);border-top-color:var(--luthor-accent);border-radius:50%;animation:luthor-spin .6s linear infinite;vertical-align:middle}@keyframes luthor-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.luthor-toolbar{display:flex;align-items:center;gap:4px;padding:8px;flex-wrap:wrap;overflow-x:hidden;overflow-y:visible;row-gap:6px;min-height:48px;transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-toolbar--align-left{justify-content:flex-start}.luthor-toolbar--align-center{justify-content:center}.luthor-toolbar--align-right{justify-content:flex-end}.luthor-toolbar-section{display:flex;align-items:center;flex-wrap:wrap;gap:2px;padding:0 4px;min-width:0}.luthor-toolbar-section:not(:last-child){border-right:1px solid var(--luthor-toolbar-section-border, var(--luthor-border));margin-right:8px;padding-right:8px;transition:border-color var(--luthor-theme-transition)}.luthor-toolbar-button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:1px solid transparent;border-radius:6px;background-color:transparent;color:var(--luthor-toolbar-button-fg, var(--luthor-fg));cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);font-size:16px;position:relative;overflow:hidden}.luthor-toolbar-button:before{content:"";position:absolute;inset:0;background:var(--luthor-toolbar-button-overlay);opacity:0;transition:opacity .2s ease}.luthor-toolbar-button:hover{background-color:var(--luthor-toolbar-button-hover-bg, var(--luthor-muted));border-color:var(--luthor-toolbar-button-hover-border, var(--luthor-border-hover));transform:translateY(-1px);box-shadow:var(--luthor-toolbar-button-hover-shadow)}.luthor-toolbar-button:hover:before{opacity:1}.luthor-toolbar-button:active{transform:translateY(0) scale(.98);box-shadow:var(--luthor-toolbar-button-press-shadow)}.luthor-toolbar-button.active{background-color:var(--luthor-toolbar-button-active-bg, var(--luthor-accent));border-color:var(--luthor-toolbar-button-active-border, var(--luthor-accent));color:var(--luthor-toolbar-button-active-fg, var(--luthor-bg));box-shadow:var(--luthor-toolbar-button-active-shadow)}.luthor-toolbar-button.active:before{background:var(--luthor-toolbar-button-active-overlay);opacity:1}.luthor-toolbar-button:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none}.luthor-toolbar-button:disabled:hover{background-color:transparent;border-color:transparent;transform:none;box-shadow:none}.luthor-toolbar-button:disabled:before{opacity:0}.luthor-color-button{padding-bottom:4px}.luthor-color-button-letter{font-size:14px;line-height:1;font-weight:700;position:relative;z-index:1}.luthor-color-button-indicator{position:absolute;left:7px;right:7px;bottom:5px;height:3px;border-radius:999px;border:1px solid var(--luthor-toolbar-color-indicator-border, var(--luthor-border));box-shadow:inset 0 0 0 1px #fff3;z-index:1}.luthor-color-button.is-highlight .luthor-color-button-letter{padding:0 2px;border-radius:3px;background-color:var(--luthor-toolbar-highlight-bg, var(--luthor-muted))}.luthor-color-button-highlighter{position:relative;z-index:1}.luthor-color-picker{z-index:var(--luthor-z-popover, 440);background-color:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:10px;box-shadow:0 12px 28px #0f172a2e;padding:10px;display:grid;gap:9px;max-width:90vw;width:248px;color:var(--luthor-fg, #0f172a)}.luthor-color-picker-header{display:flex;align-items:center;justify-content:space-between;gap:10px}.luthor-color-picker-title{font-size:12px;font-weight:600;color:var(--luthor-fg)}.luthor-color-picker-native-hidden{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.luthor-color-picker-clear{border:1px solid var(--luthor-border);border-radius:6px;background:var(--luthor-muted);color:var(--luthor-fg);font-size:12px;font-weight:500;padding:4px 8px;cursor:pointer}.luthor-color-picker-clear:hover{border-color:var(--luthor-border-hover)}.luthor-color-picker-section{display:grid;gap:6px}.luthor-color-picker-label{margin:0;font-size:11px;font-weight:600;color:var(--luthor-muted-fg);text-transform:uppercase;letter-spacing:.03em}.luthor-color-swatch-grid,.luthor-color-swatch-row{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}.luthor-color-swatch{width:100%;aspect-ratio:1;border:1px solid var(--luthor-border);border-radius:6px;background-clip:padding-box;cursor:pointer;transition:transform .15s ease,border-color .15s ease;box-shadow:inset 0 0 0 1px #0f172a14}.luthor-color-swatch:hover:enabled{border-color:var(--luthor-border-hover);transform:translateY(-1px)}.luthor-color-swatch:disabled{cursor:not-allowed;background-image:repeating-linear-gradient(45deg,transparent,transparent 4px,var(--luthor-muted) 4px,var(--luthor-muted) 8px);opacity:.7}.luthor-color-picker-footer{display:flex;justify-content:space-between;align-items:center;gap:8px;padding-top:2px}.luthor-color-picker-custom{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--luthor-border);border-radius:6px;background:var(--luthor-muted);color:var(--luthor-fg);font-size:12px;font-weight:500;padding:4px 8px;cursor:pointer}.luthor-color-picker-custom:hover{border-color:var(--luthor-border-hover)}.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark] .luthor-color-picker{box-shadow:0 14px 32px #0009}.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark] .luthor-color-swatch{box-shadow:inset 0 0 0 1px #ffffff14}.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark] .luthor-color-picker-clear,.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark] .luthor-color-picker-custom{background:#ffffff0a}.luthor-select{position:relative;display:inline-block}.luthor-select-trigger{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:8px 12px;border:1px solid var(--luthor-border);border-radius:6px;background-color:var(--luthor-bg);color:var(--luthor-fg);cursor:pointer;font-size:14px;min-width:120px;max-width:180px;height:36px;transition:all .2s cubic-bezier(.4,0,.2,1);box-shadow:0 1px 3px #0000001a}.luthor-select-trigger span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.luthor-select-trigger:hover{border-color:var(--luthor-border-hover);box-shadow:0 2px 8px #00000026}.luthor-select-trigger.open{border-color:var(--luthor-accent);box-shadow:0 0 0 3px #0f172a1a}.luthor-select-dropdown{position:fixed;z-index:var(--luthor-z-dropdown, 420);background-color:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:6px;box-shadow:0 8px 32px #0000001f;max-height:200px;overflow-y:auto}.luthor-select-option{display:block;width:100%;padding:10px 14px;border:none;background:none;color:var(--luthor-fg);cursor:pointer;font-size:14px;text-align:left;transition:all .15s ease}.luthor-select-option:hover{background-color:var(--luthor-muted)}.luthor-select-option.selected{background-color:var(--luthor-accent);color:var(--luthor-bg);font-weight:500}.luthor-dropdown{position:relative;display:inline-flex}.luthor-dropdown-content{position:fixed;z-index:var(--luthor-z-dropdown, 420);background-color:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:4px;box-shadow:0 4px 6px -1px var(--luthor-shadow);margin-top:2px;min-width:160px;padding:4px 0}.luthor-dropdown-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:none;color:var(--luthor-fg);cursor:pointer;font-size:14px;text-align:left;transition:background-color .15s}.luthor-dropdown-item:hover{background-color:var(--luthor-muted)}.luthor-file-input{display:none}.luthor-editor{flex:1;display:flex;flex-direction:column;min-height:400px;position:relative;--luthor-drag-gutter-width: 56px;background-color:var(--luthor-bg);transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-editor-visual-shell{display:grid;grid-template-columns:var(--luthor-drag-gutter-width) minmax(0,1fr);grid-template-rows:minmax(0,1fr);flex:1;min-height:0}.luthor-editor-visual-shell--no-gutter{grid-template-columns:minmax(0,1fr)}.luthor-editor-visual-shell.is-hidden{position:absolute;inset:0;visibility:hidden;pointer-events:none}.luthor-editor-visual-gutter{grid-column:1;grid-row:1;pointer-events:none;background-color:var(--luthor-bg);transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-editor--draggable-disabled{--luthor-drag-gutter-width: 0px}.luthor-editor--draggable-disabled .luthor-editor-visual-gutter{display:none}.luthor-richtext-container{position:relative;flex:1;--luthor-editor-content-padding-y: 20px;--luthor-editor-content-padding-x: 20px;--luthor-first-block-offset: calc(8px * var(--luthor-line-height-ratio, 1));background-color:var(--luthor-bg);transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-editor-visual-shell .luthor-richtext-container{grid-column:2;grid-row:1;min-width:0}.luthor-editor-visual-shell--no-gutter .luthor-richtext-container{grid-column:1}.luthor-content-editable{flex:1;padding:var(--luthor-editor-content-padding-y) var(--luthor-editor-content-padding-x);outline:none;color:var(--luthor-fg);line-height:1;font-size:16px;background-color:var(--luthor-bg);transition:background-color var(--luthor-theme-transition),color var(--luthor-theme-transition),border-color var(--luthor-theme-transition)}.luthor-content-editable:focus{outline:none;background-color:var(--luthor-bg)}.luthor-content-editable a,.luthor-content-editable a:hover,.luthor-content-editable a:focus-visible{cursor:pointer}.luthor-placeholder{color:var(--luthor-placeholder-color, var(--luthor-muted-fg));pointer-events:none;position:absolute;top:calc(var(--luthor-editor-content-padding-y) + var(--luthor-first-block-offset));left:var(--luthor-editor-content-padding-x);font-size:16px;line-height:var(--luthor-default-line-height, 1.5);z-index:1;transition:color var(--luthor-theme-transition),background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition)}.luthor-source-panel{padding:20px;flex:1;overflow-y:auto;background-color:var(--luthor-bg);transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-source-view{width:100%;min-height:280px;padding:12px;border:1px solid var(--luthor-border);font-family:SF Mono,Monaco,Inconsolata,Roboto Mono,Consolas,Courier New,monospace;font-size:14px;line-height:1.6;background-color:var(--luthor-bg);color:var(--luthor-fg);border-radius:0;resize:vertical;overflow-x:auto;overflow-y:auto;white-space:pre;tab-size:2;transition:background-color var(--luthor-theme-transition),color var(--luthor-theme-transition),border-color var(--luthor-theme-transition)}.luthor-source-error{display:flex;gap:12px;padding:12px;margin-bottom:12px;background-color:#dc26261a;border:1px solid rgba(220,38,38,.3);border-radius:6px;color:#dc2626;transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),color var(--luthor-theme-transition)}.luthor-preset-extensive.luthor-editor-wrapper[data-editor-theme=dark] .luthor-source-error{background-color:#ef444426;border-color:#ef444466;color:#fca5a5}.luthor-source-error-icon{flex-shrink:0;font-size:18px;line-height:1}.luthor-source-error-message{flex:1}.luthor-source-error-message strong{display:block;margin-bottom:4px;font-weight:600}.luthor-source-error-message p{margin:4px 0;font-size:13px;line-height:1.4;white-space:pre-wrap;word-break:break-word}.luthor-source-error-message small{display:block;margin-top:6px;font-size:12px;opacity:.7}.luthor-command-palette-overlay{position:absolute;inset:0;background:#00000080;display:flex;align-items:flex-start;justify-content:center;padding:min(20vh,120px) 16px 16px;z-index:var(--luthor-z-overlay, 480);overscroll-behavior:contain}.luthor-command-palette{background:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:12px;box-shadow:0 12px 48px #0000001f;width:min(640px,100%);max-width:100%;max-height:min(560px,calc(100% - min(20vh,120px) - 16px));display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:contain}.luthor-command-palette-header{display:flex;align-items:center;padding:16px 20px;border-bottom:1px solid var(--luthor-border);gap:12px}.luthor-command-palette-icon{color:var(--luthor-muted-fg);flex-shrink:0}.luthor-command-palette-input{flex:1;background:transparent;border:none;outline:none;font-size:16px;color:var(--luthor-fg);font-family:inherit}.luthor-command-palette-input::placeholder{color:var(--luthor-muted-fg)}.luthor-command-palette-kbd{background:var(--luthor-muted);border:1px solid var(--luthor-border);border-radius:4px;padding:2px 6px;font-size:11px;color:var(--luthor-muted-fg);font-family:monospace}.luthor-command-palette-list{flex:1;overflow-y:auto;padding:8px 0;overscroll-behavior:contain}.luthor-command-palette-group{margin-bottom:8px}.luthor-command-palette-group-title{padding:8px 20px 4px;font-size:11px;font-weight:600;color:var(--luthor-muted-fg);text-transform:uppercase;letter-spacing:.5px}.luthor-command-palette-item{display:flex;align-items:center;padding:12px 20px;cursor:pointer;border:none;background:none;width:100%;text-align:left;transition:background-color .1s}.luthor-command-palette-item:hover,.luthor-command-palette-item.selected{background:var(--luthor-muted)}.luthor-command-palette-item-content{flex:1;min-width:0}.luthor-command-palette-item-title{font-size:14px;color:var(--luthor-fg);font-weight:500;margin-bottom:2px}.luthor-command-palette-item-description{font-size:12px;color:var(--luthor-muted-fg);line-height:1.4}.luthor-command-palette-item-shortcut{background:var(--luthor-muted);border:1px solid var(--luthor-border);border-radius:4px;padding:2px 6px;font-size:10px;color:var(--luthor-muted-fg);font-family:monospace;margin-left:12px;flex-shrink:0}.luthor-command-palette-footer{padding:12px 20px;border-top:1px solid var(--luthor-border);background:var(--luthor-muted)}.luthor-command-palette-hint{font-size:11px;color:var(--luthor-muted-fg);display:flex;align-items:center;gap:8px}.luthor-command-palette-hint kbd{background:var(--luthor-bg);border:1px solid var(--luthor-border);border-radius:3px;padding:1px 4px;font-size:10px;font-family:monospace}.luthor-command-palette-empty{padding:40px 20px;text-align:center;color:var(--luthor-muted-fg);font-size:14px}.luthor-slash-menu{position:fixed;z-index:var(--luthor-z-menu, 460);background:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:10px;box-shadow:0 12px 36px #00000024;width:min(420px,calc(100vw - 24px));max-height:min(55vh,420px);overflow:hidden;display:flex;flex-direction:column}.luthor-slash-menu-header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid var(--luthor-border);background:var(--luthor-muted)}.luthor-slash-menu-title{font-size:12px;font-weight:600;color:var(--luthor-muted-fg);text-transform:uppercase;letter-spacing:.4px}.luthor-slash-menu-query{font-size:12px;font-family:monospace;color:var(--luthor-muted-fg);background:var(--luthor-bg);border:1px solid var(--luthor-border);padding:1px 6px;border-radius:4px}.luthor-slash-menu-list{overflow-y:auto;padding:8px 0}.luthor-slash-menu-group{margin-bottom:6px}.luthor-slash-menu-group-title{padding:6px 12px 4px;font-size:11px;font-weight:600;color:var(--luthor-muted-fg);text-transform:uppercase;letter-spacing:.5px}.luthor-slash-menu-item{width:100%;display:flex;align-items:center;gap:12px;padding:10px 12px;border:none;background:none;text-align:left;cursor:pointer;color:var(--luthor-fg);transition:background-color .12s}.luthor-slash-menu-item:hover,.luthor-slash-menu-item.selected{background:var(--luthor-muted)}.luthor-slash-menu-item-content{min-width:0;display:flex;flex-direction:column;gap:2px;flex:1}.luthor-slash-menu-item-title{font-size:14px;font-weight:500;color:var(--luthor-fg)}.luthor-slash-menu-item-description{font-size:12px;line-height:1.35;color:var(--luthor-muted-fg)}.luthor-slash-menu-item-shortcut{background:var(--luthor-muted);border:1px solid var(--luthor-border);border-radius:4px;padding:2px 6px;font-size:10px;font-family:monospace;color:var(--luthor-muted-fg);flex-shrink:0}.luthor-slash-menu-empty{padding:20px 12px;font-size:13px;color:var(--luthor-muted-fg);text-align:center}.luthor-emoji-picker-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;padding:8px;width:220px}.luthor-emoji-picker-item{display:inline-flex;align-items:center;justify-content:center;height:32px;border:1px solid transparent;border-radius:6px;background:transparent;cursor:pointer;font-size:18px;line-height:1}.luthor-emoji-picker-item:hover{background:var(--luthor-muted);border-color:var(--luthor-border)}.luthor-emoji-menu{position:fixed;z-index:var(--luthor-z-menu, 460);background:var(--luthor-bg, #ffffff);border:1px solid var(--luthor-border, #e2e8f0);border-radius:10px;box-shadow:0 12px 36px #00000024;width:min(320px,calc(100vw - 24px));max-height:min(45vh,320px);overflow:hidden;display:flex;flex-direction:column}.luthor-emoji-menu-header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid var(--luthor-border);background:var(--luthor-muted)}.luthor-emoji-menu-title{font-size:12px;font-weight:600;color:var(--luthor-muted-fg);text-transform:uppercase;letter-spacing:.4px}.luthor-emoji-menu-query{font-size:12px;font-family:monospace;color:var(--luthor-muted-fg);background:var(--luthor-bg);border:1px solid var(--luthor-border);padding:1px 6px;border-radius:4px}.luthor-emoji-menu-list{overflow-y:auto;padding:6px 0}.luthor-emoji-menu-item{width:100%;display:flex;align-items:center;gap:10px;padding:8px 10px;border:none;background:none;text-align:left;cursor:pointer;color:var(--luthor-fg);transition:background-color .12s}.luthor-emoji-menu-item:hover,.luthor-emoji-menu-item.selected{background:var(--luthor-muted)}.luthor-emoji-menu-item-symbol{font-size:20px;line-height:1;width:24px;text-align:center;flex-shrink:0}.luthor-emoji-menu-item-content{min-width:0;display:flex;flex-direction:column;gap:1px;flex:1}.luthor-emoji-menu-item-title{font-size:13px;font-weight:500;color:var(--luthor-fg)}.luthor-emoji-menu-item-shortcode{font-size:12px;line-height:1.25;color:var(--luthor-muted-fg);font-family:monospace}.luthor-emoji-menu-empty{padding:18px 12px;font-size:13px;color:var(--luthor-muted-fg);text-align:center}.luthor-dialog-overlay{position:fixed;inset:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:var(--luthor-z-modal, 500);overscroll-behavior:contain}.luthor-dialog{background-color:var(--luthor-bg);border-radius:10px;box-shadow:0 20px 30px var(--luthor-shadow);min-width:360px;max-width:520px;max-height:90vh;overflow:hidden}.luthor-dialog-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--luthor-border)}.luthor-dialog-title{margin:0;font-size:16px;font-weight:600;color:var(--luthor-fg)}.luthor-dialog-close{background:none;border:none;color:var(--luthor-muted-fg);cursor:pointer;padding:4px;border-radius:6px}.luthor-dialog-close:hover{background-color:var(--luthor-muted);color:var(--luthor-fg)}.luthor-dialog-content{padding:18px 20px}.luthor-table-dialog{display:flex;flex-direction:column;gap:14px}.luthor-form-group{display:flex;flex-direction:column;gap:6px}.luthor-form-group label{font-size:13px;font-weight:600;color:var(--luthor-fg)}.luthor-input{padding:8px 12px;border:1px solid var(--luthor-border);border-radius:6px;background-color:var(--luthor-bg);color:var(--luthor-fg);font-size:13px}.luthor-input:focus{outline:none;border-color:var(--luthor-accent);box-shadow:0 0 0 3px #3b82f61f}.luthor-checkbox-label{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--luthor-fg)}.luthor-checkbox{width:16px;height:16px;accent-color:var(--luthor-accent)}.luthor-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px}.luthor-button-primary,.luthor-button-secondary{padding:8px 14px;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;border:1px solid}.luthor-button-primary{background-color:var(--luthor-accent);border-color:var(--luthor-accent);color:var(--luthor-bg)}.luthor-button-primary:hover{background-color:var(--luthor-accent-hover);border-color:var(--luthor-accent-hover)}.luthor-button-secondary{background-color:transparent;border-color:var(--luthor-border);color:var(--luthor-fg)}.luthor-button-secondary:hover{background-color:var(--luthor-muted);border-color:var(--luthor-border-hover)}.luthor-text-bold{font-weight:700;color:var(--luthor-text-bold-color, var(--luthor-fg))}.luthor-text-italic{font-style:italic}.luthor-text-underline{text-decoration:underline}.luthor-text-strikethrough{text-decoration:line-through}.luthor-text-code,.luthor-content-editable code,.luthor-code-block{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;background-color:var(--luthor-codeblock-bg, var(--luthor-muted));border:1px solid var(--luthor-border);color:var(--luthor-syntax-string, var(--luthor-muted-fg));border-radius:4px}.luthor-content-editable .luthor-text-code,.luthor-content-editable code,.luthor-content-editable code.luthor-text-code,.luthor-preset .luthor-content-editable code,.luthor-preset-extensive .luthor-content-editable code{color:var(--luthor-syntax-string, var(--luthor-muted-fg));font-weight:500}.luthor-code-block{display:block;padding:12px;margin:12px 0;line-height:1.6;overflow-x:auto;max-width:min(100%,880px);width:100%;tab-size:2;white-space:pre-wrap;overflow-wrap:normal;word-break:normal}.luthor-code-block--interactive{position:relative;margin-top:40px;border-top-left-radius:0;border-top-right-radius:0;border-top:0}.luthor-codeblock-controls-layer{position:absolute;inset:0;pointer-events:none;z-index:25}.luthor-codeblock-controls{position:absolute;display:flex;align-items:center;justify-content:space-between;z-index:26;pointer-events:auto;margin:0;max-width:none;padding:8px 10px;border:1px solid var(--luthor-border);border-top-left-radius:8px;border-top-right-radius:8px;border-bottom:1px solid var(--luthor-border);background:var(--luthor-codeblock-bg, var(--luthor-muted))}.luthor-codeblock-controls-left,.luthor-codeblock-controls-right{display:inline-flex;align-items:center;gap:6px}.luthor-codeblock-language,.luthor-codeblock-copy{font-size:11px;line-height:1.2;height:24px;border-radius:6px;border:1px solid var(--luthor-border);background:var(--luthor-bg);color:var(--luthor-fg);padding:0 8px}.luthor-codeblock-language{min-width:88px;appearance:none}.luthor-codeblock-language option{background:var(--luthor-bg);color:var(--luthor-fg)}.luthor-codeblock-copy{cursor:pointer;font-weight:600;width:26px;height:24px;padding:0;display:inline-flex;align-items:center;justify-content:center;position:relative;background:var(--luthor-bg)}.luthor-codeblock-copy svg{width:14px;height:14px;fill:currentColor}.luthor-codeblock-copy:after{content:attr(data-tooltip);position:absolute;top:-28px;right:0;padding:2px 6px;font-size:10px;line-height:1.2;white-space:nowrap;border-radius:4px;border:1px solid var(--luthor-border);background:var(--luthor-bg);color:var(--luthor-fg);opacity:0;pointer-events:none;transform:translateY(4px);transition:opacity .15s ease,transform .15s ease}.luthor-codeblock-copy:hover:after,.luthor-codeblock-copy:focus-visible:after{opacity:1;transform:translateY(0)}.luthor-codeblock-copy:hover,.luthor-codeblock-language:hover,.luthor-codeblock-copy.is-copied{border-color:var(--luthor-border-hover);background:var(--luthor-codeblock-bg, var(--luthor-muted))}.luthor-codeblock-copy.is-copy-error{border-color:var(--luthor-syntax-variable);color:var(--luthor-syntax-variable)}.luthor-code-block[data-theme=plain]{--luthor-syntax-keyword: var(--luthor-muted-fg);--luthor-syntax-string: var(--luthor-muted-fg);--luthor-syntax-number: var(--luthor-muted-fg);--luthor-syntax-function: var(--luthor-muted-fg);--luthor-syntax-variable: var(--luthor-muted-fg)}:where(.luthor-code-comment),:where(.luthor-code-prolog),:where(.luthor-code-doctype),:where(.luthor-code-cdata),:where(.luthor-code-punctuation),:where(.luthor-code-operator),:where(.luthor-code-namespace),:where(.luthor-code-property),:where(.luthor-code-tag),:where(.luthor-code-constant),:where(.luthor-code-symbol),:where(.luthor-code-deleted),:where(.luthor-code-boolean),:where(.luthor-code-number),:where(.luthor-code-attr),:where(.luthor-code-selector),:where(.luthor-code-string),:where(.luthor-code-char),:where(.luthor-code-builtin),:where(.luthor-code-inserted),:where(.luthor-code-function),:where(.luthor-code-class),:where(.luthor-code-class-name),:where(.luthor-code-keyword),:where(.luthor-code-atrule),:where(.luthor-code-regex),:where(.luthor-code-variable),:where(.luthor-code-important){color:var(--luthor-syntax-string, var(--luthor-muted-fg));font-weight:inherit}.luthor-paragraph{margin:var(--luthor-first-block-offset) 0;line-height:var(--luthor-default-line-height, 1.5)}.luthor-heading-h1,.luthor-heading-h2,.luthor-heading-h3,.luthor-heading-h4,.luthor-heading-h5,.luthor-heading-h6{margin:calc(16px * var(--luthor-line-height-ratio, 1)) 0 calc(8px * var(--luthor-line-height-ratio, 1));line-height:var(--luthor-default-line-height, 1.5);font-weight:700}.luthor-heading-h1{font-size:28px}.luthor-heading-h2{font-size:24px}.luthor-heading-h3{font-size:20px}.luthor-heading-h4{font-size:18px}.luthor-heading-h5{font-size:16px}.luthor-heading-h6{font-size:14px}.luthor-list-ul,.luthor-list-ol{margin:10px 0 10px 20px}.luthor-list-li{margin:calc(4px * var(--luthor-line-height-ratio, 1)) 0;line-height:var(--luthor-default-line-height, 1.5)}.luthor-list-ul .luthor-list-li::marker,.luthor-list-ol .luthor-list-li::marker{color:var(--luthor-list-marker-color, var(--luthor-fg))}.luthor-list-item-unchecked,.luthor-list-item-checked{position:relative;list-style:none;margin-left:0;padding-left:28px;min-height:22px;cursor:pointer}.luthor-list-item-unchecked::marker,.luthor-list-item-checked::marker{content:""}.luthor-list-item-unchecked:before,.luthor-list-item-checked:before{content:"";position:absolute;left:0;top:.1em;width:16px;height:16px;border-radius:4px;border:1.5px solid var(--luthor-list-checkbox-color, var(--luthor-accent));background-color:var(--luthor-bg);box-sizing:border-box;transition:all .15s ease}.luthor-list-item-unchecked:hover:before{border-color:var(--luthor-list-checkbox-color, var(--luthor-accent))}.luthor-list-item-checked:before{content:"\2713";display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;line-height:1;color:var(--luthor-bg);border-color:var(--luthor-list-checkbox-color, var(--luthor-accent));background-color:var(--luthor-list-checkbox-color, var(--luthor-accent))}.luthor-list-item-checked{text-decoration:line-through;opacity:.85}.luthor-list-item-checked>ul,.luthor-list-item-checked>ol{text-decoration:none;opacity:1}.luthor-quote{border-left:4px solid var(--luthor-quote-border, var(--luthor-accent));background-color:var(--luthor-quote-bg, var(--luthor-muted));padding:10px 14px;margin:12px 0;color:var(--luthor-quote-fg, var(--luthor-fg));line-height:var(--luthor-default-line-height, 1.5)}.luthor-link{color:var(--luthor-link-color, var(--luthor-accent));text-decoration:underline}.luthor-link:hover{color:var(--luthor-accent-hover)}.luthor-hr{margin:16px 0;border:none;border-top:1px solid var(--luthor-hr-color, var(--luthor-border));height:1px}.luthor-preset-extensive .lexical-image{margin:1em 0;display:block;position:relative}.luthor-preset-extensive .lexical-image img{max-width:100%;height:auto;border-radius:6px;display:block}.luthor-preset-extensive .lexical-image.align-left{float:left;margin-right:1em;margin-bottom:1em}.luthor-preset-extensive .lexical-image.align-right{float:right;margin-left:1em;margin-bottom:1em}.luthor-preset-extensive .lexical-image.align-center{text-align:center;margin:1em auto}.luthor-preset-extensive .lexical-image.align-center img{margin:0 auto}.luthor-preset-extensive .lexical-image figcaption{margin-top:.5em;font-size:12px;color:var(--luthor-muted-fg);text-align:center;font-style:italic}.luthor-preset-extensive .lexical-image.selected{outline:none}.luthor-preset-extensive .resizer{position:absolute;width:8px;height:8px;background:var(--luthor-accent);border:1px solid white;border-radius:50%}.luthor-preset-extensive .resizer.ne{top:-4px;right:-4px;cursor:nesw-resize}.luthor-preset-extensive .resizer.nw{top:-4px;left:-4px;cursor:nwse-resize}.luthor-preset-extensive .resizer.se{bottom:-4px;right:-4px;cursor:nwse-resize}.luthor-preset-extensive .resizer.sw{bottom:-4px;left:-4px;cursor:nesw-resize}.luthor-table{border-collapse:collapse;width:100%;margin:16px 0;border:1px solid var(--luthor-table-border-color, var(--luthor-border))}.luthor-table-cell,.luthor-table-cell-header{border:1px solid var(--luthor-table-border-color, var(--luthor-border));padding:8px 12px;text-align:left;min-width:80px;background-color:var(--luthor-bg)}.luthor-table-cell-header{background-color:var(--luthor-table-header-bg, var(--luthor-muted));font-weight:600}.luthor-preset-extensive table[data-lexical-table-selection]{box-shadow:0 0 0 2px var(--luthor-accent)}.luthor-preset-extensive table td[data-lexical-table-cell-selection]{background-color:#3b82f61a}.luthor-table-bubble-menu{display:flex;align-items:center;gap:6px;padding:8px;border:1px solid var(--luthor-border);border-radius:10px;background:var(--luthor-bg);box-shadow:0 8px 24px var(--luthor-shadow);pointer-events:auto;white-space:nowrap}.luthor-table-bubble-button{height:30px;min-width:30px;padding:0 10px;display:inline-flex;align-items:center;justify-content:center;border-radius:6px;border:1px solid var(--luthor-border);background:var(--luthor-muted);color:var(--luthor-fg);font-size:12px;font-weight:600;line-height:1;cursor:pointer;transition:all .16s ease}.luthor-table-bubble-button svg{display:block}.luthor-table-bubble-button-icon{width:30px;padding:0}.luthor-table-bubble-button:hover{border-color:var(--luthor-border-hover);background:color-mix(in srgb,var(--luthor-muted) 58%,var(--luthor-accent) 42%);color:var(--luthor-bg)}.luthor-table-bubble-button-active{background:var(--luthor-accent);border-color:var(--luthor-accent);color:var(--luthor-bg)}.luthor-table-bubble-button-danger:hover{background:#dc2626;border-color:#dc2626;color:#fff}.luthor-table-bubble-checkbox{display:inline-flex;align-items:center;gap:6px;padding:0 6px;height:28px;font-size:12px;font-weight:600;color:var(--luthor-fg);user-select:none}.luthor-table-bubble-checkbox input{margin:0;accent-color:var(--luthor-accent)}.luthor-context-menu{position:fixed;background:var(--luthor-bg);border:1px solid var(--luthor-border);border-radius:8px;box-shadow:0 10px 30px var(--luthor-shadow);z-index:var(--luthor-z-menu, 460);min-width:160px;padding:6px 0;font-size:13px}.luthor-context-menu-item{padding:8px 14px;cursor:pointer;user-select:none}.luthor-context-menu-item:hover{background-color:var(--luthor-muted)}.luthor-context-menu-item-disabled{opacity:.5;cursor:not-allowed}.luthor-floating-toolbar{--luthor-floating-bg: #ffffff;--luthor-floating-fg: #0f172a;--luthor-floating-border: #e2e8f0;--luthor-floating-shadow: rgba(0, 0, 0, .08);--luthor-floating-muted: #f8fafc;--luthor-floating-border-hover: #cbd5e1;--luthor-floating-border-active: #94a3b8;--luthor-floating-accent: #0f172a;--luthor-floating-accent-fg: #ffffff;display:flex;align-items:center;gap:4px;padding:6px;background-color:var(--luthor-floating-bg);color:var(--luthor-floating-fg);border:1px solid var(--luthor-floating-border);border-radius:8px;box-shadow:0 8px 24px var(--luthor-floating-shadow)}.luthor-floating-toolbar[data-theme=dark]{--luthor-floating-bg: #0a0a0a;--luthor-floating-fg: #ededed;--luthor-floating-border: #262626;--luthor-floating-shadow: rgba(0, 0, 0, .5);--luthor-floating-muted: #171717;--luthor-floating-border-hover: #404040;--luthor-floating-border-active: #525252;--luthor-floating-accent: #ededed;--luthor-floating-accent-fg: #0a0a0a}.luthor-floating-toolbar .luthor-toolbar-button{color:var(--luthor-floating-fg);border-color:transparent}.luthor-floating-toolbar .luthor-toolbar-button:hover{background-color:var(--luthor-floating-muted);border-color:var(--luthor-floating-border-hover)}.luthor-floating-toolbar .luthor-toolbar-button.active{background-color:var(--luthor-floating-accent);border-color:var(--luthor-floating-accent);color:var(--luthor-floating-accent-fg)}.luthor-floating-toolbar-separator{width:1px;height:18px;background-color:var(--luthor-floating-border);margin:0 4px}.luthor-floating-toolbar-input{height:30px;min-width:140px;max-width:220px;padding:4px 8px;font-size:12px;color:var(--luthor-floating-fg);background-color:var(--luthor-floating-bg);border:1px solid var(--luthor-floating-border);border-radius:6px;outline:none}.luthor-floating-toolbar-fields{display:flex;flex-direction:column;gap:6px}.luthor-floating-toolbar-field-row{display:flex;align-items:center;gap:6px}.luthor-floating-toolbar-action{height:30px;min-width:30px;width:auto;padding:0 10px;font-size:12px;font-weight:600;border-color:var(--luthor-floating-border);background:var(--luthor-floating-muted);color:var(--luthor-floating-fg);transform:none;box-shadow:none}.luthor-floating-toolbar .luthor-floating-toolbar-action:hover{border-color:var(--luthor-floating-border-hover);background:var(--luthor-floating-muted);color:var(--luthor-floating-fg);transform:none;box-shadow:none}.luthor-floating-toolbar-action-primary,.luthor-floating-toolbar .luthor-floating-toolbar-action-primary:hover{border-color:var(--luthor-floating-accent);background:var(--luthor-floating-accent);color:var(--luthor-floating-accent-fg)}.luthor-floating-toolbar-action-danger:hover{border-color:#dc2626;background:#dc2626;color:#fff}.luthor-floating-toolbar-input:focus{border-color:var(--luthor-floating-border-active);box-shadow:0 0 0 2px color-mix(in srgb,var(--luthor-floating-accent) 18%,transparent)}.luthor-floating-toolbar-input.is-error{border-color:#dc2626}.luthor-link-hover-bubble{gap:6px;max-width:min(680px,calc(100vw - 20px));border-radius:10px;box-shadow:0 8px 24px var(--luthor-floating-shadow)}.luthor-link-hover-bubble-url{min-width:160px;max-width:360px;padding:0 4px;font-size:12px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.luthor-link-hover-bubble-button{height:30px;min-width:30px;padding:0 10px;width:auto;font-size:12px;font-weight:600;border-color:var(--luthor-floating-border);background:var(--luthor-floating-muted);transform:none;box-shadow:none}.luthor-link-hover-bubble .luthor-link-hover-bubble-button:hover{border-color:var(--luthor-floating-border-hover);background:var(--luthor-floating-muted);transform:none;box-shadow:none}.luthor-link-hover-bubble-button-primary,.luthor-link-hover-bubble .luthor-link-hover-bubble-button-primary:hover{border-color:var(--luthor-floating-accent);background:var(--luthor-floating-accent);color:var(--luthor-floating-accent-fg)}.luthor-link-hover-bubble-button-danger:hover{border-color:#dc2626;background:#dc2626;color:#fff}.luthor-link-hover-bubble-input{height:28px;min-width:220px;max-width:360px;padding:4px 8px;font-size:12px;border:1px solid var(--luthor-floating-border);border-radius:6px;color:var(--luthor-floating-fg);background:var(--luthor-floating-bg);outline:none}.luthor-link-hover-bubble-input:focus{border-color:var(--luthor-floating-border-active);box-shadow:0 0 0 2px color-mix(in srgb,var(--luthor-floating-accent) 18%,transparent)}.luthor-link-hover-bubble-input.is-error{border-color:#dc2626}.luthor-media-embed-shell{position:relative;border:2px solid var(--luthor-border);border-radius:12px;overflow:hidden;background:var(--luthor-bg);transition:border-color var(--luthor-theme-transition),box-shadow var(--luthor-theme-transition),background-color var(--luthor-theme-transition)}.luthor-media-embed-shell:hover{border-color:var(--luthor-border-active)}.luthor-media-embed-shell.is-selected{border-color:var(--luthor-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--luthor-accent) 28%,transparent)}.luthor-media-embed-shell.is-resizing{user-select:none}.luthor-media-embed-controls{position:absolute;top:8px;right:8px;display:inline-flex;gap:4px;padding:4px;border:1px solid var(--luthor-border-hover);border-radius:8px;background:color-mix(in srgb,var(--luthor-bg) 92%,black 8%);z-index:2}.luthor-media-embed-control{border:1px solid var(--luthor-border);background:var(--luthor-muted);color:var(--luthor-fg);border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4;cursor:pointer}.luthor-media-embed-control:hover{border-color:var(--luthor-border-hover)}.luthor-media-embed-control.is-active{background:var(--luthor-accent);border-color:var(--luthor-accent);color:var(--luthor-bg)}.luthor-media-embed-resize-handle-width,.luthor-media-embed-resize-handle-height{position:absolute;border:1px solid var(--luthor-accent);background:color-mix(in srgb,var(--luthor-muted) 85%,var(--luthor-bg) 15%);border-radius:999px;z-index:2;opacity:.95;transition:background-color var(--luthor-theme-transition),border-color var(--luthor-theme-transition),transform .12s ease}.luthor-media-embed-resize-handle-width{top:50%;right:-7px;transform:translateY(-50%);width:14px;height:30px;cursor:ew-resize;border-radius:999px}.luthor-media-embed-resize-handle-height{left:50%;bottom:-7px;transform:translate(-50%);width:30px;height:14px;cursor:ns-resize;border-radius:999px}.luthor-media-embed-resize-handle-width:hover,.luthor-media-embed-resize-handle-height:hover{transform:translateY(-50%) scale(1.06)}.luthor-media-embed-resize-handle-height:hover{transform:translate(-50%) scale(1.06)}.luthor-media-embed-shell.is-resizing .luthor-media-embed-resize-handle-width,.luthor-media-embed-shell.is-resizing .luthor-media-embed-resize-handle-height{background:color-mix(in srgb,var(--luthor-accent) 28%,var(--luthor-bg) 72%);border:1px solid var(--luthor-accent)}.luthor-draggable-handle,.luthor-draggable-add-button{width:24px;height:24px;border-radius:0;border:none;background:transparent;color:var(--luthor-muted-fg);fill:currentColor;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:color .16s ease,transform .16s ease;outline:none}.luthor-draggable-add-button{width:20px;height:20px;font-size:14px;line-height:1;font-weight:500;padding:0}.luthor-draggable-handle svg{width:14px;height:14px;stroke:currentColor;fill:none}.luthor-draggable-handle:hover,.luthor-draggable-add-button:hover{color:var(--luthor-fg);transform:scale(1.04)}.luthor-draggable-handle:active,.luthor-draggable-add-button:active,.luthor-draggable-handle-active{background:transparent;color:var(--luthor-accent);transform:scale(.96)}.luthor-draggable-button-stack{display:flex;flex-direction:column;gap:6px;align-items:center;padding:0;border:none;background:transparent}.luthor-draggable-drop-indicator{height:3px;background:var(--luthor-accent);border-radius:999px}.luthor-draggable-block-dragging,.luthor-draggable-block-is-dragging{opacity:.6}.luthor-editor--draggable-disabled .luthor-draggable-button-stack,.luthor-editor--draggable-disabled .luthor-draggable-handle,.luthor-editor--draggable-disabled .luthor-draggable-add-button,.luthor-editor--draggable-disabled .luthor-draggable-drop-indicator{display:none!important}@media(max-width:768px){.luthor-preset-extensive.luthor-editor-wrapper{min-height:400px}.luthor-toolbar{padding:6px}.luthor-toolbar--align-right{justify-content:flex-start}.luthor-toolbar-button{width:32px;height:32px;font-size:14px}.luthor-toolbar-section{padding:0 2px}.luthor-toolbar-section:not(:last-child){margin-right:6px;padding-right:6px}.luthor-richtext-container{--luthor-editor-content-padding-y: 16px;--luthor-editor-content-padding-x: 16px}.luthor-content-editable{font-size:16px}.luthor-select-trigger{min-width:100px;font-size:13px}.luthor-mode-tab{padding:8px 12px;font-size:13px}}.luthor-extensive-feature-card{border:1px solid var(--luthor-border-active);border-radius:12px;padding:12px;margin:10px 0;background-color:var(--luthor-muted)}.luthor-extensive-feature-card.is-selected{box-shadow:0 0 0 2px var(--luthor-accent)}.luthor-extensive-feature-card__tag{display:inline-flex;align-items:center;font-size:10px;letter-spacing:.04em;text-transform:uppercase;color:var(--luthor-accent);border:1px solid var(--luthor-border-active);background-color:var(--luthor-bg);border-radius:999px;padding:2px 8px;margin-bottom:8px}.luthor-extensive-feature-card__title{margin:0;font-size:14px;color:var(--luthor-fg);line-height:1.35}.luthor-extensive-feature-card__description{margin:6px 0 0;font-size:12px;line-height:1.45;color:var(--luthor-muted-fg)}.luthor-preset-email-compose{display:flex;flex-direction:column;gap:10px}.luthor-email-compose-shell{border:1px solid var(--luthor-border);border-radius:8px;overflow:hidden}.luthor-email-compose-row{display:grid;grid-template-columns:72px 1fr;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--luthor-border);background:var(--luthor-bg);color:var(--luthor-fg)}.luthor-email-compose-row:last-child{border-bottom:0}.luthor-email-compose-row input{border:0;outline:none;background:transparent}
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { o as ExtensiveEditorProps } from '../../ExtensiveEditor-Cn84lsVT.js';
3
+ import { E as EditorPreset } from '../../index-BtdZVw3X.js';
4
+ import 'react';
5
+ import '@lyfie/luthor-headless';
6
+
7
+ type EmailComposeEditorProps = Omit<ExtensiveEditorProps, "featureFlags"> & {
8
+ showTo?: boolean;
9
+ showCc?: boolean;
10
+ showBcc?: boolean;
11
+ showSubject?: boolean;
12
+ };
13
+ declare function EmailComposeEditor({ className, variantClassName, showTo, showCc, showBcc, showSubject, ...props }: EmailComposeEditorProps): react_jsx_runtime.JSX.Element;
14
+
15
+ declare const emailComposePreset: EditorPreset;
16
+
17
+ export { EmailComposeEditor, type EmailComposeEditorProps, emailComposePreset };