@lyfie/luthor 2.2.0 → 2.3.1

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 li,{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,jsonbToMarkdown,markdownToJSONB}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';function So(e){return e.replace(/\r\n?/g,`
2
+ `)}function Wt(e){let t=So(e).trim();if(!t)return "";try{let n=JSON.parse(t);return JSON.stringify(n,null,2)}catch{return t}}function Lo(e){return So(e).trim()}var xe=["h1","h2","h3","h4","h5","h6"];var wt={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 _n(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 Vn(e,t){return _n(e.target)?wo(t):false}function wo(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 Io(e){return typeof e.setCodeLanguage=="function"&&typeof e.autoDetectCodeLanguage=="function"}function $n(e){return typeof e.toggleSubscript=="function"}function Jn(e){return typeof e.toggleSuperscript=="function"}function qn(e){return typeof e.insertIframeEmbed=="function"}function Yn(e){return typeof e.insertYouTubeEmbed=="function"}function Gn(e){return typeof e.insertEmoji=="function"}function Qn(e){return e.slice(1)}function Wn(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 Xn(e){if(!e||e.length===0)return [...xe];let t=new Set,n=[];for(let o of e)!xe.includes(o)||t.has(o)||(t.add(o),n.push(o));return n.length>0?n:[...xe]}function Xt(e,t){return or(Zt(t),t?.shortcutConfig).filter(o=>!o.condition||o.condition(e))}function U(e,t){return typeof e[t]=="function"}function Ft(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 Zn(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:Ft(n),denylist:new Set}}let t=e;return {allowlist:Ft(t.allowlist),denylist:Ft(t.denylist)}}function Fo(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 er(e){if(e===false||e===null)return [];let t=Array.isArray(e)?e:[e],n=[];for(let o of t){let l=Fo(o);l&&n.push(l);}return n}function tr(e){return [e.key.toLowerCase(),e.ctrlKey?"ctrl":"",e.metaKey?"meta":"",e.shiftKey?"shift":"",e.altKey?"alt":""].join(":")}function or(e,t){if(!t)return [...e];let n=Ft(t.disabledCommandIds),o=t.bindings,l=t.preventNativeConflicts!==false,r=t.preventCollisions!==false,i=new Set;return e.filter(u=>!n.has(u.id)).map(u=>{let c=u.shortcuts?[...u.shortcuts]:void 0;if(!!o&&Object.prototype.hasOwnProperty.call(o,u.id)&&o){let m=o[u.id],p=m===void 0?[]:er(m);c=p.length>0?p:void 0;}if(c&&c.length>0){let m=[];for(let p of c){let d=Fo(p);if(!d||l&&wo(d))continue;let h=tr(d);r&&i.has(h)||(i.add(h),m.push(d));}c=m.length>0?m:void 0;}return {...u,shortcuts:c}})}function Zt(e){let t=e?.isFeatureEnabled??(()=>true),n=Xn(e?.headingOptions),o=e?.paragraphLabel?.trim()||"Paragraph",l=n.map(r=>{let i=Qn(r);return {id:`block.heading${i}`,label:`Heading ${i}`,description:Wn(r),category:"Block",action:a=>a.toggleHeading?.(r),shortcuts:[{key:i,ctrlKey:true,altKey:true}],keywords:["heading",r],condition:a=>t("blockFormat")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&$n(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")&&Jn(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&Io(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")&&Io(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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")&&U(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 u=a[1];if(!u)return;if(typeof r.resolveEmojiShortcode=="function"){let c=r.resolveEmojiShortcode(u);if(c?.emoji){r.insertEmoji(c.emoji);return}}else if(typeof r.getEmojiSuggestions=="function"){let[c]=r.getEmojiSuggestions(u);if(c?.emoji){r.insertEmoji(c.emoji);return}}}r.insertEmoji(i);},keywords:["emoji","reaction","symbol","smile"],condition:r=>t("emoji")&&Gn(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")&&U(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")&&qn(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")&&Yn(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")&&U(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")&&U(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")&&U(r,"showCommandPalette")}]}function No(e,t){let n=t?.commandPaletteShortcutOnly===true;return Xt(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]?Ho(o.shortcuts[0]):void 0}))}function Oo(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}=Zn(t?.slashCommandVisibility),i=l.size>0;return Xt(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]?Ho(a.shortcuts[0]):void 0}))}function Ho(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 zo(e,t=document.body,n){let o=Xt(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 u of a.shortcuts)if(!(n?.shortcutConfig?.preventNativeConflicts!==false&&Vn(r,u))&&r.key.toLowerCase()===u.key.toLowerCase()&&!!r.ctrlKey==!!u.ctrlKey&&!!r.metaKey==!!u.metaKey&&!!r.shiftKey==!!u.shiftKey&&!!r.altKey==!!u.altKey){u.preventDefault!==false&&r.preventDefault(),(!a.condition||a.condition(e))&&a.action(e);return}}}};return t.addEventListener("keydown",l),()=>t.removeEventListener("keydown",l)}var Nt=Bold,Ot=Italic,Ht=Underline,zt=Strikethrough,Pt=Code,Po=Code2,it=Link,Ze=Unlink,Rt=List,At=ListChecks,Mt=ListOrdered,Ro=Undo2,Ao=Redo2,eo=Image,lt=AlignLeft,et=AlignCenter,Mo=AlignJustify,at=AlignRight,to=Upload,Bo=Minus,Do=Table,Ko=FileCode;var Uo=Highlighter;var Bt=Command,jo=Palette,_o=Type,Dt=Quote,Vo=IndentIncrease,$o=IndentDecrease,Jo=Sun,qo=Moon,Yo=Search,oo=Smile,Go=Subscript,Qo=Superscript,Wo=ChevronDown,Xo=X;function tn({isOpen:e,onClose:t,commands:n}){let[o,l]=useState(""),[r,i]=useState(0),a=useRef(null),u=useRef(null),c=n.filter(p=>`${p.label} ${p.description||""} ${p.keywords?.join(" ")||""}`.toLowerCase().includes(o.toLowerCase())),v=c.reduce((p,d)=>{let h=d.category||"Other";return p[h]||(p[h]=[]),p[h].push(d),p},{}),m=c;return useEffect(()=>{i(0);},[o]),useEffect(()=>{e&&a.current&&(a.current.focus({preventScroll:true}),l(""),i(0));},[e]),useEffect(()=>{if(!e)return;let p=u.current;if(!p)return;p.querySelector(".luthor-command-palette-item.selected")?.scrollIntoView({block:"nearest"});},[e,r,o]),useEffect(()=>{let p=d=>{if(e)switch(d.key){case "Escape":d.preventDefault(),d.stopPropagation(),t();break;case "ArrowDown":d.preventDefault(),d.stopPropagation(),i(h=>Math.min(h+1,m.length-1));break;case "ArrowUp":d.preventDefault(),d.stopPropagation(),i(h=>Math.max(h-1,0));break;case "Enter":d.preventDefault(),d.stopPropagation(),m[r]&&(m[r].action(),t());break}};return document.addEventListener("keydown",p,true),()=>document.removeEventListener("keydown",p,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:p=>p.stopPropagation(),children:[jsxs("div",{className:"luthor-command-palette-header",children:[jsx(Yo,{size:16,className:"luthor-command-palette-icon"}),jsx("input",{ref:a,type:"text",placeholder:"Type a command or search...",value:o,onChange:p=>l(p.target.value),className:"luthor-command-palette-input"}),jsx("kbd",{className:"luthor-command-palette-kbd",children:"ESC"})]}),jsx("div",{ref:u,className:"luthor-command-palette-list",children:Object.keys(v).length===0?jsx("div",{className:"luthor-command-palette-empty",children:"No commands found"}):Object.entries(v).map(([p,d])=>jsxs("div",{className:"luthor-command-palette-group",children:[jsx("div",{className:"luthor-command-palette-group-title",children:p}),d.map(h=>{let H=m.indexOf(h);return jsxs("div",{className:`luthor-command-palette-item ${H===r?"selected":""}`,onClick:()=>{h.action(),t();},onMouseEnter:()=>i(H),children:[jsxs("div",{className:"luthor-command-palette-item-content",children:[jsx("div",{className:"luthor-command-palette-item-title",children:h.label}),h.description&&jsx("div",{className:"luthor-command-palette-item-description",children:h.description})]}),h.shortcut&&jsx("kbd",{className:"luthor-command-palette-item-shortcut",children:h.shortcut})]},h.id)})]},p))}),jsx("div",{className:"luthor-command-palette-footer",children:jsxs("span",{className:"luthor-command-palette-hint",children:[jsx(Bt,{size:14}),jsx("span",{children:"Use arrow keys, Enter, ESC"})]})})]})}):null}var Kr={"--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 Ur(e){return e?e.closest(".luthor-editor-wrapper"):null}function jr(e){return e?Ur(e)??e:null}function _r(e){if(typeof window>"u"||!e)return {};let t=window.getComputedStyle(e),n={};for(let[o,l]of Object.entries(Kr)){let r=t.getPropertyValue(o).trim()||l;n[o]=r;}return n}function qe(e){return _r(jr(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 nn({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 c=v=>{let m=o.length>0;switch(v.key){case "Escape":v.preventDefault(),v.stopPropagation(),l();break;case "ArrowDown":if(!m)return;v.preventDefault(),v.stopPropagation(),a(p=>Math.min(p+1,Math.max(o.length-1,0)));break;case "ArrowUp":if(!m)return;v.preventDefault(),v.stopPropagation(),a(p=>Math.max(p-1,0));break;case "Enter":case "Tab":if(!m||!o[i])return;v.preventDefault(),v.stopPropagation(),r(o[i].emoji);break}};return document.addEventListener("keydown",c,true),()=>document.removeEventListener("keydown",c,true)},[e,l,r,i,o]),!e||!n)return null;let u=jsxs("div",{className:"luthor-emoji-menu",style:{left:n.x,top:n.y,...ut()},onPointerDown:c=>{c.stopPropagation();},onMouseDown:c=>{c.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((c,v)=>{let m=v===i,p=c.shortcodes[0]?`:${c.shortcodes[0]}:`:"";return jsxs("button",{type:"button",className:`luthor-emoji-menu-item ${m?"selected":""}`,onMouseEnter:()=>a(v),onMouseDown:d=>{d.preventDefault(),d.stopPropagation();},onClick:d=>{d.preventDefault(),d.stopPropagation(),r(c.emoji);},children:[jsx("span",{className:"luthor-emoji-menu-item-symbol","aria-hidden":"true",children:c.emoji}),jsxs("span",{className:"luthor-emoji-menu-item-content",children:[jsx("span",{className:"luthor-emoji-menu-item-title",children:c.label}),p&&jsx("span",{className:"luthor-emoji-menu-item-shortcode",children:p})]})]},`${c.emoji}-${c.label}`)})})]});return typeof document>"u"?u:createPortal(u,document.body)}function an({isOpen:e,query:t,position:n,commands:o,onClose:l,onExecute:r}){let[i,a]=useState(0),u=useMemo(()=>{let m=t.trim().toLowerCase();return m?o.filter(p=>`${p.label} ${p.description||""} ${p.keywords?.join(" ")||""}`.toLowerCase().includes(m)):o},[o,t]),c=useMemo(()=>u.reduce((m,p)=>{let d=p.category||"Other";return m[d]||(m[d]=[]),m[d].push(p),m},{}),[u]);if(useEffect(()=>{a(0);},[t,e]),useEffect(()=>{if(!e)return;let m=p=>{let d=u.length>0;switch(p.key){case "Escape":p.preventDefault(),p.stopPropagation(),l();break;case "ArrowDown":if(!d)return;p.preventDefault(),p.stopPropagation(),a(h=>Math.min(h+1,Math.max(u.length-1,0)));break;case "ArrowUp":if(!d)return;p.preventDefault(),p.stopPropagation(),a(h=>Math.max(h-1,0));break;case "Enter":case "Tab":if(!d||!u[i])return;p.preventDefault(),p.stopPropagation(),r(u[i].id);break}};return document.addEventListener("keydown",m,true),()=>document.removeEventListener("keydown",m,true)},[u,e,l,r,i]),!e||!n)return null;let v=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:u.length===0?jsx("div",{className:"luthor-slash-menu-empty",children:"No matching commands"}):Object.entries(c).map(([m,p])=>jsxs("div",{className:"luthor-slash-menu-group",children:[jsx("div",{className:"luthor-slash-menu-group-title",children:m}),p.map(d=>{let h=u.indexOf(d);return jsxs("button",{type:"button",className:`luthor-slash-menu-item ${h===i?"selected":""}`,onMouseEnter:()=>a(h),onMouseDown:S=>{S.preventDefault(),S.stopPropagation();},onClick:S=>{S.preventDefault(),S.stopPropagation(),r(d.id);},children:[jsxs("span",{className:"luthor-slash-menu-item-content",children:[jsx("span",{className:"luthor-slash-menu-item-title",children:d.label}),d.description&&jsx("span",{className:"luthor-slash-menu-item-description",children:d.description})]}),d.shortcut&&jsx("kbd",{className:"luthor-slash-menu-item-shortcut",children:d.shortcut})]},d.id)})]},m))})]});return typeof document>"u"?v:createPortal(v,document.body)}function L({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 ro({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),u=useRef(null),c=useRef(null);useEffect(()=>{if(!l)return;let m=()=>{let p=u.current?.querySelector(".luthor-select-trigger");if(!p)return;let d=p.getBoundingClientRect();a({position:"fixed",top:d.bottom+4,left:d.left,width:d.width,...qe(p)});};return m(),window.addEventListener("resize",m),window.addEventListener("scroll",m,true),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m,true);}},[l]),useEffect(()=>{function m(p){let d=p.target;u.current?.contains(d)||c.current?.contains(d)||r(false);}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);let v=n.find(m=>m.value===e);return jsxs("div",{className:"luthor-select",ref:u,children:[jsxs("button",{className:`luthor-select-trigger ${l?"open":""}`,onClick:()=>r(!l),type:"button",children:[jsx("span",{children:v?.label||o}),jsx(Wo,{size:14})]}),l&&typeof document<"u"&&createPortal(jsx("div",{ref:c,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,u]=useState(void 0);return useEffect(()=>{if(!n)return;let c=()=>{let v=r.current;if(!v)return;let m=v.getBoundingClientRect();u({position:"fixed",top:m.bottom+4,left:m.left,...qe(v)});};return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,true),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,true);}},[n]),useEffect(()=>{function c(v){let m=v.target;l.current?.contains(m)||i.current?.contains(m)||o(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[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 un({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(Xo,{size:16})})]}),jsx("div",{className:"luthor-dialog-content",children:o})]})}):null}function cn({isVisible:e,selectionRect:t,commands:n,activeStates:o,editorTheme:l="light",hide:r,isFeatureEnabled:i=()=>true}){let a=useRef(null),[u,c]=useState(""),[v,m]=useState(""),[p,d]=useState(""),[h,H]=useState(""),[S,O]=useState(""),[j,_]=useState(""),[C,Z]=useState(null),[re,$]=useState(null),[g,F]=useState(null),k=!!o.isIframeEmbedSelected,D=!!o.isYouTubeEmbedSelected,P=i("iframeEmbed"),W=i("youTubeEmbed"),R=i("image"),me=P&&k||W&&D;if(useEffect(()=>{if(!e)return;let w=I=>{let V=I.target;V&&(a.current?.contains(V)||r?.());};return document.addEventListener("mousedown",w,true),document.addEventListener("touchstart",w,true),()=>{document.removeEventListener("mousedown",w,true),document.removeEventListener("touchstart",w,true);}},[e,r]),useEffect(()=>{if(!e||!k)return;let w=false;return typeof n.getIframeEmbedCaption=="function"&&n.getIframeEmbedCaption().then(I=>{w||m(I??"");}),typeof n.getIframeEmbedUrl=="function"&&n.getIframeEmbedUrl().then(I=>{w||c(I??"");}),Z(null),()=>{w=true;}},[n,k,e]),useEffect(()=>{if(!e||!o.imageSelected)return;let w=false;return typeof n.getImageCaption=="function"&&n.getImageCaption().then(I=>{w||d(I??"");}),()=>{w=true;}},[o.imageSelected,n,e]),useEffect(()=>{if(!e||!D)return;let w=false;return typeof n.getYouTubeEmbedCaption=="function"&&n.getYouTubeEmbedCaption().then(I=>{w||H(I??"");}),typeof n.getYouTubeEmbedUrl=="function"&&n.getYouTubeEmbedUrl().then(I=>{w||O(I??"");}),$(null),()=>{w=true;}},[n,e,D]),useEffect(()=>{if(!e||!o.isLink)return;let w=false;return typeof n.getCurrentLink=="function"&&n.getCurrentLink().then(I=>{!w&&I&&_(I.url??"");}),F(null),()=>{w=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 w=M=>{if(k){n.setIframeEmbedAlignment?.(M);return}D&&n.setYouTubeEmbedAlignment?.(M);},I=k?o.isIframeEmbedAlignedLeft:o.isYouTubeEmbedAlignedLeft,V=k?o.isIframeEmbedAlignedCenter:o.isYouTubeEmbedAlignedCenter,We=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?v:h,ke=k?m:H,Pe=k?u:S,G=k?C:re,Ee=()=>{if(he){if(k){n.setIframeEmbedCaption?.(v);return}n.setYouTubeEmbedCaption?.(h);}},Oe=M=>{k?Z(M):$(M);},oe=M=>{k?c(M):O(M);},pe=()=>{if(!Ce)return;if(!(k?n.updateIframeEmbedUrl?.(u)??false:n.updateYouTubeEmbedUrl?.(S)??false)){Oe(k?"Enter a valid http(s) URL":"Enter a valid YouTube URL"),k&&typeof n.getIframeEmbedUrl=="function"?n.getIframeEmbedUrl().then(He=>c(He??"")):!k&&typeof n.getYouTubeEmbedUrl=="function"&&n.getYouTubeEmbedUrl().then(He=>O(He??""));return}Oe(null);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[jsx(L,{onClick:()=>w("left"),active:I,title:"Align Left",children:jsx(lt,{size:14})}),jsx(L,{onClick:()=>w("center"),active:V,title:"Align Center",children:jsx(et,{size:14})}),jsx(L,{onClick:()=>w("right"),active:We,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:Pe,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:M=>{oe(M.target.value),G&&Oe(null);},onBlur:pe,onKeyDown:M=>{M.key==="Enter"&&(M.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:M=>ke(M.target.value),onBlur:Ee,onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),Ee());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:Ee,children:"Update Caption"})]}):null]})]}):null]})}if(R&&o.imageSelected){let w=typeof n.setImageCaption=="function",I=()=>{w&&n.setImageCaption(p);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[jsx(L,{onClick:()=>n.setImageAlignment("left"),active:o.isImageAlignedLeft,title:"Align Left",children:jsx(lt,{size:14})}),jsx(L,{onClick:()=>n.setImageAlignment("center"),active:o.isImageAlignedCenter,title:"Align Center",children:jsx(et,{size:14})}),jsx(L,{onClick:()=>n.setImageAlignment("right"),active:o.isImageAlignedRight,title:"Align Right",children:jsx(at,{size:14})}),w?jsxs(Fragment,{children:[jsx("div",{className:"luthor-floating-toolbar-separator"}),jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"text",value:p,className:"luthor-floating-toolbar-input",placeholder:"Add caption","aria-label":"Image caption",onChange:V=>d(V.target.value),onBlur:I,onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),I());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:I,children:"Update Caption"})]})]}):null]})}let Te=i("bold"),ie=i("italic"),Se=i("underline"),Le=i("strikethrough"),Ie=i("codeFormat"),se=i("blockFormat"),we=i("link"),ze=i("list"),Fe=Te||ie||Se||Le,ue=Ie||se||we,Ne=ze,fe=!!o.isLink&&typeof n.updateLink=="function"&&typeof n.removeLink=="function",ce=()=>{if(!fe)return;if(!(n.updateLink?.(j)??false)){F("Enter a valid URL"),typeof n.getCurrentLink=="function"&&n.getCurrentLink().then(I=>{_(I?.url??"");});return}F(null);};return !Fe&&!ue&&!Ne?null:jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:te,children:[Fe?jsxs(Fragment,{children:[Te?jsx(L,{onClick:()=>n.toggleBold(),active:o.bold,title:"Bold",children:jsx(Nt,{size:14})}):null,ie?jsx(L,{onClick:()=>n.toggleItalic(),active:o.italic,title:"Italic",children:jsx(Ot,{size:14})}):null,Se?jsx(L,{onClick:()=>n.toggleUnderline(),active:o.underline,title:"Underline",children:jsx(Ht,{size:14})}):null,Le?jsx(L,{onClick:()=>n.toggleStrikethrough(),active:o.strikethrough,title:"Strikethrough",children:jsx(zt,{size:14})}):null]}):null,Fe&&ue?jsx("div",{className:"luthor-floating-toolbar-separator"}):null,ue?jsxs(Fragment,{children:[Ie?jsx(L,{onClick:()=>n.formatText("code"),active:o.code,title:"Inline Code",children:jsx(Pt,{size:14})}):null,se?jsx(L,{onClick:()=>n.toggleQuote(),active:o.isQuote,title:"Quote",children:jsx(Dt,{size:14})}):null,we?jsxs(Fragment,{children:[jsx(L,{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${g?" is-error":""}`,placeholder:"https://example.com","aria-label":"Link URL","aria-invalid":g?true:void 0,onChange:w=>{_(w.target.value),g&&F(null);},onBlur:ce,onKeyDown:w=>{w.key==="Enter"&&(w.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(L,{onClick:()=>n.toggleUnorderedList(),active:o.unorderedList,title:"Bullet List",children:jsx(Rt,{size:14})}),jsx(L,{onClick:()=>n.toggleOrderedList(),active:o.orderedList,title:"Numbered List",children:jsx(Mt,{size:14})}),jsx(L,{onClick:()=>n.toggleCheckList(),active:o.checkList,title:"Checklist",children:jsx(At,{size:14})})]}):null]})}var Ae={commands:{},activeStates:{},editorTheme:"light",isFeatureEnabled:()=>true};function io(e,t,n,o=()=>true){Ae.commands=e,Ae.activeStates=t,Ae.editorTheme=n,Ae.isFeatureEnabled=o;}function dn(){let e=cn,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 ti=120,oi=58;function ni(e,t=oi){return e.length<=t?e:`${e.slice(0,t-3)}...`}function mn(){let e=window.getSelection();return !e||e.rangeCount===0?false:!e.getRangeAt(0).collapsed}function fn(e,t){if(!(e instanceof Element))return null;let n=e.closest("a");return !(n instanceof HTMLAnchorElement)||!t.contains(n)?null:n}function bn({editor:e,commands:t,editorTheme:n="light",disabled:o=false}){let l=useRef(null),r=useRef(null),[i,a]=useState(null),[u,c]=useState(false),[v,m]=useState(""),[p,d]=useState(null),[h,H]=useState(null),S=useCallback(()=>{r.current!==null&&(window.clearTimeout(r.current),r.current=null);},[]),O=useCallback(()=>{S(),a(null),c(false),m(""),d(null),H(null);},[S]),j=useCallback(()=>{S(),r.current=window.setTimeout(()=>{O();},ti);},[S,O]),_=useCallback(g=>{let F=g.getBoundingClientRect(),k=F.bottom+8,D=Math.max(10,Math.min(F.left,window.innerWidth-340));H({top:k,left:D});},[]),C=useCallback((g,F)=>{if(typeof t.getLinkByKey!="function"){a(k=>!k||k.nodeKey!==g?k:{...k,url:F});return}t.getLinkByKey(g).then(k=>{if(!k){O();return}a(D=>!D||D.nodeKey!==g?D:{...D,url:k.url});});},[t,O]);useEffect(()=>{if(!e||o||typeof window>"u"){O();return}let g=e.getRootElement();if(!g){O();return}let F=W=>{let R=fn(W.target,g);if(!R)return;if(mn()){O();return}S();let me=resolveLinkNodeKeyFromAnchor(e,R);if(!me)return;let te=R.getAttribute("href")??R.href;a({nodeKey:me,url:te,anchorEl:R}),_(R),d(null),u||m(te),C(me,te);},k=W=>{if(!i)return;let R=W.relatedTarget;R&&l.current?.contains(R)||fn(R,g)||j();},D=()=>{mn()&&O();},P=()=>{a(W=>{if(!W)return W;let R=W.anchorEl.isConnected&&g.contains(W.anchorEl)?W.anchorEl:g.querySelector(`a[data-lexical-node-key="${W.nodeKey}"]`);return R?(_(R),{...W,anchorEl:R,url:R.getAttribute("href")??R.href}):(O(),null)});};return g.addEventListener("mouseover",F),g.addEventListener("mouseout",k),document.addEventListener("selectionchange",D),window.addEventListener("scroll",P,true),window.addEventListener("resize",P),()=>{g.removeEventListener("mouseover",F),g.removeEventListener("mouseout",k),document.removeEventListener("selectionchange",D),window.removeEventListener("scroll",P,true),window.removeEventListener("resize",P),S();}},[t,o,e,i,u,O,j,C,_,S]);let Z=useMemo(()=>{if(!(!i||!h))return {...qe(i.anchorEl),position:"fixed",top:h.top,left:h.left,zIndex:10040}},[i,h]);if(!i||!h||typeof document>"u")return null;let re=()=>{(t.removeLinkByKey?.(i.nodeKey)??false)&&O();},$=()=>{let g=v.trim();if(!(t.updateLinkByKey?.(i.nodeKey,g)??false)){d("Enter a valid URL"),C(i.nodeKey,i.url);return}a(k=>!k||k.nodeKey!==i.nodeKey?k:{...k,url:g}),d(null),c(false),queueMicrotask(()=>{C(i.nodeKey,g);});};return createPortal(jsx("div",{ref:l,className:"luthor-floating-toolbar luthor-link-hover-bubble","data-theme":n,style:Z,onMouseEnter:S,onMouseLeave:j,children:u?jsxs(Fragment,{children:[jsx("input",{type:"url",value:v,className:`luthor-link-hover-bubble-input${p?" is-error":""}`,placeholder:"https://example.com","aria-label":"Edit link URL","aria-invalid":p?true:void 0,onChange:g=>{m(g.target.value),p&&d(null);},onKeyDown:g=>{if(g.key==="Enter"){g.preventDefault(),$();return}g.key==="Escape"&&(g.preventDefault(),c(false),m(i.url),d(null));}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button luthor-link-hover-bubble-button-primary",onClick:$,children:"Update"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{c(false),m(i.url),d(null);},children:"Cancel"})]}):jsxs(Fragment,{children:[jsx("span",{className:"luthor-link-hover-bubble-url",title:i.url,children:ni(i.url)}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{m(i.url),c(true),d(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 yn({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 vn({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 Cn(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`}}}var so=6,ui=["#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 jt(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function ci(e,t){let n=jt(t);for(let o of e)if(jt(o.value)===n)return o.color;return null}function di(e,t,n){if(!e||e==="default")return n;let o=ci(t,e);return o||e}function gi(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 En(e){let t=e.split(",")[0]??"";return De(t.replace(/["']/g,""))}function _t(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 Ut(){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 mi(e,t){if(!e)return null;let n=En(e);return n?t.find(l=>De(l.value)===n?true:En(l.fontFamily)===n)?.value??null:null}function fi(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=_t(e);if(l==null)return null;let r=null;for(let i of t){let a=_t(String(i.fontSize));if(a==null)continue;let u=Math.abs(a-l);(!r||u<r.distance)&&(r={value:String(i.value),distance:u});}return r?.value??null}function hi(e,t,n){if(!e)return null;let o=De(e),l=n.find(c=>De(c.value)===o?true:De(c.lineHeight)===o);if(l)return l.value;let r=t?_t(t):null,i=_t(e),a=null;if(i!=null&&r!=null&&r>0)a=i/r;else {let c=Number(e);Number.isFinite(c)&&(a=c);}if(a==null)return null;let u=null;for(let c of n){let v=Number(c.lineHeight);if(!Number.isFinite(v))continue;let m=Math.abs(v-a);(!u||m<u.distance)&&(u={value:c.value,distance:m});}return u?.value??null}function xn({title:e,value:t,options:n,recentColors:o,active:l,fallbackColor:r,highlight:i,onChange:a,onClear:u,onAddRecent:c}){let v=useRef(null),m=useRef(null),p=useRef(null),d=useRef(null),h=useRef(null),[H,S]=useState(false),[O,j]=useState(void 0),_=di(t,n,r),C=useMemo(()=>ui,[]),Z=useMemo(()=>{let g=[...o].slice(0,so);for(;g.length<so;)g.push("");return g},[o]);useEffect(()=>()=>{d.current&&window.cancelAnimationFrame(d.current);},[]);let re=useCallback(g=>{h.current=g,!d.current&&(d.current=window.requestAnimationFrame(()=>{d.current=null,h.current&&(a(h.current),h.current=null);}));},[a]),$=useCallback(g=>{let F=v.current;if(!F)return;let k=F.getBoundingClientRect();j({position:"fixed",top:k.bottom+6,left:k.left,width:230,visibility:g?"visible":"hidden",...qe(F)});},[]);return useLayoutEffect(()=>{if(!H)return;$(false);let g=window.requestAnimationFrame(()=>{$(true);});return ()=>{window.cancelAnimationFrame(g);}},[H,$]),useEffect(()=>{if(!H)return;let g=D=>{let P=D.target;v.current?.contains(P)||m.current?.contains(P)||S(false);},F=D=>{D.key==="Escape"&&S(false);},k=()=>$(true);return window.addEventListener("resize",k),window.addEventListener("scroll",k,true),document.addEventListener("mousedown",g),document.addEventListener("keydown",F),()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,true),document.removeEventListener("mousedown",g),document.removeEventListener("keydown",F);}},[H,$]),jsxs(Fragment,{children:[jsxs("button",{ref:v,type:"button",className:`luthor-toolbar-button luthor-color-button${l?" active":""}${i?" is-highlight":""}`,title:e,"aria-label":e,onClick:()=>S(g=>!g),children:[i?jsx(Uo,{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:_}})]}),H&&typeof document<"u"&&createPortal(jsxs("div",{ref:m,className:"luthor-color-picker",style:O,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(g=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:g},"aria-label":`Use color ${g}`,onClick:()=>{a(g),c(g),S(false);}},g))})]}),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((g,F)=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:g||"transparent"},"aria-label":g?`Use recent color ${g}`:"Empty recent color slot",disabled:!g,onClick:()=>{g&&(a(g),c(g),S(false));}},`${g||"empty"}-${F}`))})]}),jsxs("div",{className:"luthor-color-picker-footer",children:[jsx("button",{type:"button",className:"luthor-color-picker-clear",onClick:()=>{u(),S(false);},children:"Reset to Default"}),jsxs("button",{type:"button",className:"luthor-color-picker-custom",onClick:()=>p.current?.click(),children:[jsx(jo,{size:14}),jsx("span",{children:"Custom Color"})]}),jsx("input",{ref:p,type:"color",className:"luthor-color-picker-native luthor-color-picker-native-hidden",value:gi(_,r),onInput:g=>{re(g.target.value);},onChange:g=>{let F=g.target.value;a(F),c(F);}})]})]}),document.body)]})}function pi(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 u;if(t)try{u=await t(i);}catch{alert("Failed to upload GIF");return}else u=URL.createObjectURL(i);e.insertImage({src:u,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 bi(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 yi(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 vi(e,t,n){return yi(e,t)?n?.[e]!==false:false}function Ci(e,t,n){return {sections:e.sections.map(o=>({...o,items:o.items.filter(l=>vi(l,t,n))})).filter(o=>o.items.length>0)}}function Tn({commands:e,hasExtension:t,activeStates:n,isDark:o,toggleTheme:l,onCommandPaletteOpen:r,imageUploadHandler:i,classNames:a,toolbarStyleVars:u,layout:c,toolbarVisibility:v,headingOptions:m,paragraphLabel:p}){let{handlers:d,fileInputRef:h,gifInputRef:H}=pi(e,i),S=bi(e),O=t("iframeEmbed")||t("youtubeEmbed"),j=n.isIframeEmbedSelected||n.isYouTubeEmbedSelected,[_,C]=useState(false),[Z,re]=useState(false),[$,g]=useState(false),[F,k]=useState(false),[D,P]=useState(false),[W,R]=useState("default"),[me,te]=useState([{value:"default",label:"Default"}]),[Te,ie]=useState("default"),[Se,Le]=useState([{value:"default",label:"Default"}]),[Ie,se]=useState("default"),[we,ze]=useState([{value:"default",label:"Default"}]),[Fe,ue]=useState("default"),[Ne,fe]=useState([{value:"default",label:"Default",color:"inherit"}]),[ce,w]=useState([]),[I,V]=useState("default"),[We,he]=useState([{value:"default",label:"Default",color:"transparent"}]),[Ce,je]=useState([]),[ke,Pe]=useState(0),[G,Ee]=useState({rows:3,columns:3,includeHeaders:false});useEffect(()=>{if(typeof document>"u")return;let f=()=>{Ut()&&Pe(z=>z+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(z=>({value:z.value,label:z.label})),b=f.length>0?f:[{value:"default",label:"Default"}];te(b),R(z=>b.some(A=>A.value===z)?z:"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(z=>{if(b)return;if(z&&z!=="default"){R(z);return}let A=Ut(),le=mi(A?.fontFamily,f());R(le??"default");}),()=>{b=true;}},[n,e,t,ke]),useEffect(()=>{if(!t("fontSize")||typeof e.getFontSizeOptions!="function")return;let f=e.getFontSizeOptions().map(A=>({value:String(A.value).trim(),label:String(A.label).trim()})).filter(A=>A.value.length>0&&A.label.length>0),b=f.some(A=>De(A.value)==="default"),z=f.length===0?[{value:"default",label:"Default"}]:b?f:[{value:"default",label:"Default"},...f];Le(z),ie(A=>z.some(le=>le.value===A)?A:"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(z=>{if(b)return;if(z&&z!=="default"){ie(z);return}let A=Ut(),le=fi(A?.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&&ze(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(z=>{if(b)return;if(z){se(z);return}let A=Ut(),le=hi(A?.lineHeight,A?.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||V(b??"default");}),()=>{f=true;}},[n,e,t,ke]);let oe=useMemo(()=>{if(!m||m.length===0)return [...xe];let f=new Set,b=[];for(let z of m)!xe.includes(z)||f.has(z)||(f.add(z),b.push(z));return b.length>0?b:[...xe]},[m]),pe=p?.trim()||"Paragraph",Re=useMemo(()=>{let f=oe.map(b=>({value:b,label:`Heading ${b.slice(1)}`}));return [{value:"p",label:pe},...f]},[oe,pe]),M=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===M)?M:"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),R(f);},Ve=f=>{f==="default"?e.clearFontSize?.():e.setFontSize?.(f),ie(f);},$e=f=>{e.setLineHeight?.(f),se(f);},y=(f,b)=>{f(z=>{let A=jt(b),le=z.filter(ae=>jt(ae)!==A);return [b,...le].slice(0,so)});},x=f=>{if(f==="default"){e.clearTextColor?.(),ue("default");return}e.setTextColor?.(f),ue(f);},K=f=>{if(f==="default"){e.clearTextHighlight?.(),V("default");return}e.setTextHighlight?.(f),V(f);},X=f=>{switch(f){case "fontFamily":return t("fontFamily")?jsx(bt,{value:W,onValueChange:_e,options:me,placeholder:"Font"},"fontFamily"):null;case "fontSize":return t("fontSize")?jsx(bt,{value:Te,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(xn,{title:"Text Color",value:Fe,options:Ne,recentColors:ce,active:n.hasCustomTextColor,fallbackColor:"#0f172a",onChange:x,onClear:()=>x("default"),onAddRecent:b=>y(w,b)},"textColor"):null;case "textHighlight":return t("textHighlight")?jsx(xn,{title:"Text Highlight",value:I,options:We,recentColors:Ce,active:n.hasTextHighlight,fallbackColor:"#fef08a",highlight:true,onChange:K,onClear:()=>K("default"),onAddRecent:b=>y(je,b)},"textHighlight"):null;case "bold":return jsx(L,{onClick:()=>e.toggleBold(),active:n.bold,title:"Bold (Ctrl+B)",children:jsx(Nt,{size:16})},"bold");case "italic":return jsx(L,{onClick:()=>e.toggleItalic(),active:n.italic,title:"Italic (Ctrl+I)",children:jsx(Ot,{size:16})},"italic");case "underline":return jsx(L,{onClick:()=>e.toggleUnderline(),active:n.underline,title:"Underline (Ctrl+U)",children:jsx(Ht,{size:16})},"underline");case "strikethrough":return jsx(L,{onClick:()=>e.toggleStrikethrough(),active:n.strikethrough,title:"Strikethrough",children:jsx(zt,{size:16})},"strikethrough");case "subscript":return t("subscript")?jsx(L,{onClick:()=>e.toggleSubscript?.(),active:n.subscript,title:"Subscript",children:jsx(Go,{size:16})},"subscript"):null;case "superscript":return t("superscript")?jsx(L,{onClick:()=>e.toggleSuperscript?.(),active:n.superscript,title:"Superscript",children:jsx(Qo,{size:16})},"superscript"):null;case "code":return jsx(L,{onClick:()=>e.formatText("code"),active:n.code,title:"Inline Code",children:jsx(Pt,{size:16})},"code");case "link":return jsx(L,{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(L,{onClick:()=>e.toggleQuote(),active:n.isQuote,title:"Quote",children:jsx(Dt,{size:16})},"quote"):null;case "alignLeft":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("left"),active:n.isTextAlignedLeft,title:"Align Left",children:jsx(lt,{size:16})},"alignLeft"):null;case "alignCenter":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("center"),active:n.isTextAlignedCenter,title:"Align Center",children:jsx(et,{size:16})},"alignCenter"):null;case "alignRight":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("right"),active:n.isTextAlignedRight,title:"Align Right",children:jsx(at,{size:16})},"alignRight"):null;case "alignJustify":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("justify"),active:n.isTextAlignedJustify,title:"Justify",children:jsx(Mo,{size:16})},"alignJustify"):null;case "codeBlock":return t("code")?jsx(L,{onClick:()=>e.toggleCodeBlock(),active:n.isInCodeBlock,title:"Code Block",children:jsx(Po,{size:16})},"codeBlock"):null;case "unorderedList":return t("list")?jsx(L,{onClick:()=>e.toggleUnorderedList(),active:n.unorderedList,title:"Bullet List",children:jsx(Rt,{size:16})},"unorderedList"):null;case "orderedList":return t("list")?jsx(L,{onClick:()=>e.toggleOrderedList(),active:n.orderedList,title:"Numbered List",children:jsx(Mt,{size:16})},"orderedList"):null;case "checkList":return t("list")?jsx(L,{onClick:()=>e.toggleCheckList(),active:n.checkList,title:"Checklist",children:jsx(At,{size:16})},"checkList"):null;case "indentList":return t("list")?jsx(L,{onClick:()=>e.indentList(),title:"Indent List",disabled:n.checkList,children:jsx(Vo,{size:14})},"indentList"):null;case "outdentList":return t("list")?jsx(L,{onClick:()=>e.outdentList(),title:"Outdent List",disabled:n.checkList,children:jsx($o,{size:14})},"outdentList"):null;case "horizontalRule":return t("horizontalRule")?jsx(L,{onClick:()=>e.insertHorizontalRule(),title:"Insert Horizontal Rule",children:jsx(Bo,{size:16})},"horizontalRule"):null;case "table":return t("table")?jsx(L,{onClick:()=>P(true),title:"Insert Table",children:jsx(Do,{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(eo,{size:16})}),isOpen:_,onOpenChange:C,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.insertFromUrl(),C(false);},children:[jsx(it,{size:16}),jsx("span",{children:"From URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.insertFromFile(),C(false);},children:[jsx(to,{size:16}),jsx("span",{children:"Upload File"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.insertGifFromUrl(),C(false);},children:[jsx(oo,{size:16}),jsx("span",{children:"Insert GIF URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.insertGifFromFile(),C(false);},children:[jsx(to,{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:$,onOpenChange:g,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.setAlignment("left"),g(false);},children:[jsx(lt,{size:16}),jsx("span",{children:"Align Left"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.setAlignment("center"),g(false);},children:[jsx(et,{size:16}),jsx("span",{children:"Align Center"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.setAlignment("right"),g(false);},children:[jsx(at,{size:16}),jsx("span",{children:"Align Right"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{d.setCaption(),g(false);},children:[jsx(_o,{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(oo,{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 O?jsxs(yt,{trigger:jsx("button",{className:`luthor-toolbar-button ${j?"active":""}`,title:"Insert Embed",children:jsx(Ko,{size:16})}),isOpen:F,onOpenChange:k,children:[t("iframeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{S.insertIframe(),k(false);},children:[jsx(it,{size:16}),jsx("span",{children:"Embed iframe"})]}):null,t("youtubeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{S.insertYouTube(),k(false);},children:[jsx(eo,{size:16}),jsx("span",{children:"Embed YouTube Video"})]}):null]},"embed"):null;case "undo":return t("history")?jsx(L,{onClick:()=>e.undo(),disabled:!n.canUndo,title:"Undo (Ctrl+Z)",children:jsx(Ro,{size:16})},"undo"):null;case "redo":return t("history")?jsx(L,{onClick:()=>e.redo(),disabled:!n.canRedo,title:"Redo (Ctrl+Y)",children:jsx(Ao,{size:16})},"redo"):null;case "commandPalette":return jsx(L,{onClick:()=>r?.(),title:"Command Palette (Ctrl+Shift+P)",children:jsx(Bt,{size:16})},"commandPalette");case "themeToggle":return jsx(L,{onClick:l,title:o?"Light Mode":"Dark Mode",children:o?jsx(Jo,{size:16}):jsx(qo,{size:16})},"themeToggle");default:return null}},q=c??wt,Je=useMemo(()=>Ci(q,t,v),[q,t,v]);return jsxs(Fragment,{children:[jsx("div",{className:a?.toolbar??"luthor-toolbar",style:u,children:Je.sections.map((f,b)=>{let z=f.items.map((A,le)=>{let ae=X(A);return ae?Array.isArray(ae)?ae.map((Q,It)=>Q&&typeof Q=="object"&&"key"in Q&&Q.key!=null?Q:jsx("span",{children:Q},`toolbar-item-${b}-${le}-${It}`)):ae.type===li.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(A=>A!==null);return z.length===0?null:jsx("div",{className:a?.section??"luthor-toolbar-section",children:z},b)})}),jsx("input",{ref:h,type:"file",accept:"image/*",onChange:d.handleUpload,className:"luthor-file-input"}),jsx("input",{ref:H,type:"file",accept:"image/gif",onChange:d.handleGifUpload,className:"luthor-file-input"}),jsx(un,{isOpen:D,onClose:()=>P(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(ro,{variant:"secondary",onClick:()=>P(false),children:"Cancel"}),jsx(ro,{variant:"primary",onClick:()=>{e.insertTable(G),P(false);},children:"Insert Table"})]})]})})]})}var bo=["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"],Nn={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 xt(e){let t={...Nn};if(!e)return t;for(let n of bo)typeof e[n]=="boolean"&&(t[n]=e[n]);return t}function On(e,t){return e[t]!==false}var In=[{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"}],Qi={value:"default",label:"Default",fontFamily:"inherit"},wn=[{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"}],Wi={value:"default",label:"Default",fontSize:"inherit"},Fn=[{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"}],Xi={value:"default",label:"Default",lineHeight:"1.5"},Et="1.5",Zi=1;function nt(e){return e.trim().toLowerCase()}function Hn(e){return /^[a-z0-9][a-z0-9-]*$/i.test(e)}function el(e){return nt(e)==="default"?true:Vt(e)!==null}function tl(e){let t=e??In,n=new Set,o=[];for(let r of t){let i=r.value.trim(),a=r.label.trim(),u=r.fontFamily.trim();if(!i||!a||!u||!Hn(i))continue;let c=nt(i);n.has(c)||(n.add(c),o.push({value:i,label:a,fontFamily:u,cssImportUrl:r.cssImportUrl?.trim()||void 0}));}return o.length===0?In:o.some(r=>nt(r.value)==="default")?o:[Qi,...o]}function ol(e){let t=e??wn,n=new Set,o=[];for(let r of t){let i=String(r.value).trim(),a=String(r.label).trim(),u=String(r.fontSize).trim();if(!i||!a||!u||!Hn(i))continue;let c=nt(i);n.has(c)||(n.add(c),o.push({value:i,label:a,fontSize:u}));}return o.length===0?wn:o.some(r=>nt(r.value)==="default")?o:[Wi,...o]}function Vt(e){let t=e.trim();if(!/^\d*\.?\d+$/.test(t))return null;let n=Number(t);return !Number.isFinite(n)||n<Zi?null:n.toString()}function nl(e){return typeof e=="number"?Number.isFinite(e)?Vt(e.toString())??Et:Et:typeof e=="string"?Vt(e)??Et:Et}function rl(e,t=Et){let n=e??Fn,o=new Set,l=[];for(let i of n){let a=String(i.value).trim(),u=String(i.label).trim();if(!a||!u||!el(a))continue;let c=nt(a);if(o.has(c))continue;if(c==="default"){o.add(c),l.push({value:a,label:u,lineHeight:t});continue}let v=Vt(String(i.lineHeight));v&&(o.add(c),l.push({value:a,label:u,lineHeight:v}));}return l.length===0?Fn:l.some(i=>nt(i.value)==="default")?l:[{...Xi,lineHeight:t},...l]}function Qe({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 il=()=>jsxs(Qe,{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"})]}),ll=()=>jsxs(Qe,{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"})]}),al=()=>jsxs(Qe,{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"})]}),sl=()=>jsxs(Qe,{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"})]}),ul=()=>jsxs(Qe,{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"})]}),cl=()=>jsxs(Qe,{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"})]}),dl=()=>jsxs(Qe,{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"})]}),gl=()=>jsxs(Qe,{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 co=new TableExtension;co.config={...co.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(il,{})}),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(ll,{})}),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(al,{})}),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(sl,{})}),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(ul,{})}),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(cl,{})}),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(gl,{})})}),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(dl,{})})]})};var go=new IframeEmbedExtension;go.config={...go.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center"};var mo=new YouTubeEmbedExtension;mo.config={...mo.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center",nocookie:true,controls:true,rel:1};var ml=dn(),fo=new ContextMenuExtension;fo.config={...fo.config,preventDefault:true};var fl=new CommandPaletteExtension,hl=new SlashCommandExtension,pl=new EmojiExtension,ho=new DraggableBlockExtension;ho.config={...ho.config,buttonStackPosition:"left"};var po=new LinkExtension;po.config={...po.config,linkSelectedTextOnPaste:true,autoLinkText:true,autoLinkUrls:true};var bl=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"}]}),yl=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:vl}=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 zn({fontFamilyOptions:e,fontSizeOptions:t,lineHeightOptions:n,minimumDefaultLineHeight:o,featureFlags:l,isDraggableBoxEnabled:r,scaleByRatio:i,syntaxHighlighting:a,codeHighlightProvider:u,loadCodeHighlightProvider:c,maxAutoDetectCodeLength:v,isCopyAllowed:m,languageOptions:p}={}){let d=xt(l),h=Z=>On(d,Z),H=(r??true)&&h("draggableBlock"),S=nl(o),O=new FontFamilyExtension().configure({options:tl(e),cssLoadStrategy:"on-demand"}),j=new FontSizeExtension().configure({options:ol(t)}),_=new LineHeightExtension().configure({options:rl(n,S),defaultLineHeight:S});$t.configure({scaleByRatio:i??false}),codeExtension.configure({syntaxHighlighting:a??"auto",provider:u??void 0,loadProvider:c}),codeIntelligenceExtension.configure({provider:u??void 0,loadProvider:c,maxAutoDetectLength:v,isCopyAllowed:m??true,languageOptions:p});let C=[];return h("bold")&&C.push(boldExtension),h("italic")&&C.push(italicExtension),h("underline")&&C.push(underlineExtension),h("strikethrough")&&C.push(strikethroughExtension),h("fontFamily")&&C.push(O),h("fontSize")&&C.push(j),h("lineHeight")&&C.push(_),h("textColor")&&C.push(bl),h("textHighlight")&&C.push(yl),h("subscript")&&C.push(subscriptExtension),h("superscript")&&C.push(superscriptExtension),h("link")&&C.push(po),h("horizontalRule")&&C.push(horizontalRuleExtension),h("table")&&C.push(co),h("list")&&C.push(listExtension),h("history")&&C.push(historyExtension),h("image")&&C.push($t),h("blockFormat")&&C.push(blockFormatExtension),h("code")&&C.push(codeExtension),h("codeIntelligence")&&C.push(codeIntelligenceExtension),h("codeFormat")&&C.push(codeFormatExtension),h("tabIndent")&&C.push(tabIndentExtension),h("enterKeyBehavior")&&C.push(enterKeyBehaviorExtension),h("iframeEmbed")&&C.push(go),h("youTubeEmbed")&&C.push(mo),h("floatingToolbar")&&C.push(ml),h("contextMenu")&&C.push(fo),h("commandPalette")&&C.push(fl),h("slashCommand")&&C.push(hl),h("emoji")&&C.push(pl),H&&C.push(ho),h("customNode")&&C.push(vl),C}function Tt(e){return zn(e)}zn();function Pn(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 Rn(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 An(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 Mn(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 Bn(e,t,n){let o={...e??{}};for(let[l,r]of Object.entries(n))(Array.isArray(r)?r:[r]).some(u=>t[u]!==false)||(o[l]=false);return o}function Dn(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 Jt(e){return new Set(e)}function qt(e,t){e.clear();for(let n of t)e.add(n);}function Yt(e,t){return e.has(t)}function St(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}),yo={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(yo);var{Provider:Nl,useEditor:Ol}=createEditorSystem(),Kn="Write anything...",Un="Enter JSONB document content...";function Hl(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 zl(e){try{let t=JSON.parse(e);return JSON.stringify(t)}catch{return JSON.stringify(Hl(e))}}function Pl(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 Rl(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 Al(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 Ml(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 vo(e){return Pn(e)}function Bl(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 Dl(e){return Rn(e)}function Kl(e){let t=xt(e);return JSON.stringify(bo.map(n=>[n,t[n]]))}function jn(e){return An(e)}var Ul=[{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 jl(e,t){return Mn(e,t)}function _l(e,t,n){return Dn(e,t,n)}var Vl={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 Bn(e,t,Vl)}function Jl(e){if(!e||e.length===0)return [...xe];let t=new Set,n=[];for(let o of e)!xe.includes(o)||t.has(o)||(t.add(o),n.push(o));return n.length>0?n:[...xe]}function ql(e){if(!e)return "__default__";if(Array.isArray(e)){let r=new Set,i=[];for(let a of e)for(let[u,c]of Object.entries(a)){let v=u.trim();!c||!v||r.has(v)||(r.add(v),i.push(v));}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 u of r){let c=u.trim();!c||i.has(c)||(i.add(c),a.push(c));}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 Yl(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 Gl(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 Ql(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,u)=>{let c=`${a.key}:${a.ctrlKey?1:0}:${a.metaKey?1:0}:${a.shiftKey?1:0}:${a.altKey?1:0}`,v=`${u.key}:${u.ctrlKey?1:0}:${u.metaKey?1:0}:${u.shiftKey?1:0}:${u.altKey?1:0}`;return c.localeCompare(v)});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 Wl({isDark:e,toggleTheme:t,visualPlaceholder:n,jsonbPlaceholder:o,initialMode:l,availableModes:r,onReady:i,toolbarLayout:a,toolbarVisibility:u,toolbarPosition:c,toolbarAlignment:v,toolbarClassName:m,toolbarStyleVars:p,isToolbarEnabled:d,headingOptions:h,paragraphLabel:H,syncHeadingOptionsWithCommands:S,slashCommandVisibility:O,shortcutConfig:j,commandPaletteShortcutOnly:_,featureFlags:C}){let{commands:Z,hasExtension:re,activeStates:$,lexical:g,extensions:F,export:k,import:D}=Ol(),[P,W]=useState(l),[R,me]=useState({jsonb:""}),[te,Te]=useState(null),[ie,Se]=useState(null),[Le,Ie]=useState({isOpen:false,commands:[]}),[se,we]=useState({isOpen:false,query:"",position:null,commands:[]}),[ze,Fe]=useState({isOpen:false,query:"",position:null,suggestions:[]}),ue=useRef(false),Ne=useMemo(()=>Jl(h),[h]),fe=S?Ne:void 0,ce=S?H:void 0,w=$.isInCodeBlock===true,I=useMemo(()=>_l(Z,C,w),[Z,C,w]),V=useMemo(()=>y=>Object.prototype.hasOwnProperty.call(C,y)?C[y]!==false:true,[C]),We=useMemo(()=>$l(u,C),[u,C]),he=C.draggableBlock!==false,Ce=ql(O),je=useRef(O),ke=useRef(Ce),Pe=Ql(j),G=useRef(j),Ee=useRef(Pe),Oe=useMemo(()=>Yl(j?.disabledCommandIds),[j?.disabledCommandIds]),oe=useMemo(()=>new Set(Oe),[Oe]),pe=useMemo(()=>oe.size===0?[]:Zt({headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:V}).filter(y=>oe.has(y.id)).flatMap(y=>y.shortcuts??[]),[oe,fe,ce,V]);ke.current!==Ce&&(ke.current=Ce,je.current=O),Ee.current!==Pe&&(Ee.current=Pe,G.current=j);let Re=useRef(Jt(["visual"])),M=useRef(0);useEffect(()=>{io(I,$,e?"dark":"light",V);},[I,$,e,V]);let He=useMemo(()=>({injectJSONB:y=>{setTimeout(()=>{try{let x=JSON.parse(y);D.fromJSON(x);}catch(x){console.error("Failed to inject JSONB:",x);return}},100);},getJSONB:()=>Wt(JSON.stringify(k.toJSON()))}),[k,D]);useEffect(()=>{if(!g||!I)return;let y=I,x=No(y,{headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:V,shortcutConfig:G.current,commandPaletteShortcutOnly:_});typeof y.registerCommand=="function"&&x.forEach(q=>y.registerCommand(q));let K=Oo(y,{headingOptions:fe,paragraphLabel:ce,slashCommandVisibility:je.current,isFeatureEnabled:V,shortcutConfig:G.current});typeof y.setSlashCommands=="function"?y.setSlashCommands(K):K.forEach(q=>y.registerSlashCommand?.(q));let X=zo(y,document.body,{headingOptions:fe,paragraphLabel:ce,isFeatureEnabled:V,shortcutConfig:G.current,scope:()=>g.getRootElement()});return ue.current||(ue.current=true,i?.(He)),()=>{X(),typeof y.unregisterCommand=="function"&&x.forEach(q=>y.unregisterCommand(q.id)),typeof y.setSlashCommands=="function"?y.setSlashCommands([]):K.forEach(q=>y.unregisterSlashCommand?.(q.id));}},[g,I,He,i,fe,ce,Ce,Pe,V,_]),useEffect(()=>{let y=()=>g?.getRootElement(),x=Ul.filter(X=>C[X.feature]===false);if(x.length===0)return;let K=X=>{let q=y();q&&X.target instanceof Node&&!q.contains(X.target)||!jn(X.target)||!x.some(f=>jl(X,f))||(X.preventDefault(),X.stopPropagation());};return document.addEventListener("keydown",K,true),()=>{document.removeEventListener("keydown",K,true);}},[g,C]),useEffect(()=>{let y=F.find(x=>x.name==="commandPalette");if(!(!y||!y.subscribe))return y.subscribe((x,K)=>{let X=K.filter(q=>oe.has(q.id)?false:_?typeof q.shortcut=="string"&&q.shortcut.trim().length>0:true);Ie({isOpen:x,commands:X});})},[F,oe,_]),useEffect(()=>{if(pe.length===0)return;let y=()=>g?.getRootElement(),x=K=>{let X=y();X&&K.target instanceof Node&&!X.contains(K.target)||!jn(K.target)||!pe.some(Je=>Gl(K,Je))||(K.preventDefault(),K.stopPropagation());};return document.addEventListener("keydown",x,true),()=>{document.removeEventListener("keydown",x,true);}},[g,pe]),useEffect(()=>{let y=F.find(x=>x.name==="slashCommand");if(!(!y||!y.subscribe))return y.subscribe(x=>{we({isOpen:x.isOpen,query:x.query,position:x.position,commands:x.commands});})},[F]),useEffect(()=>{let y=F.find(x=>x.name==="emoji");if(!(!y||!y.subscribe))return y.subscribe(x=>{Fe({isOpen:x.isOpen,query:x.query,position:x.position,suggestions:x.suggestions});})},[F]),useEffect(()=>!g||!k?void 0:g.registerUpdateListener(()=>{M.current+=1,qt(Re.current,["visual"]);}),[g,k]);let Xe=async y=>{if(r.includes(y))try{if(Se(null),P==="jsonb"&&y!=="jsonb"){let x=JSON.parse(R.jsonb);D.fromJSON(x),await new Promise(K=>setTimeout(K,50));}if(P==="visual"&&y!=="visual"&&(g&&clearLexicalSelection(g),g?.getRootElement()?.blur()),W(y),y==="jsonb"&&P!=="jsonb"&&!Yt(Re.current,"jsonb")){Te("jsonb"),await new Promise(x=>setTimeout(x,50));try{let x=Wt(JSON.stringify(k.toJSON()));me(K=>({...K,jsonb:x})),St(Re.current,"jsonb");}finally{Te(null);}}y==="visual"&&setTimeout(()=>g?.focus(),100);}catch(x){let K=x instanceof Error?x.message:"Invalid format - could not parse content";Se({mode:P,error:K});}},_e=d?jsx(Tn,{commands:I,hasExtension:y=>re(y),activeStates:$,isDark:e,toggleTheme:t,onCommandPaletteOpen:()=>{C.commandPalette!==false&&I.showCommandPalette();},imageUploadHandler:y=>F.find(x=>x.name==="image")?.config?.uploadHandler?.(y)??Promise.resolve(URL.createObjectURL(y)),layout:a??wt,toolbarVisibility:We,toolbarStyleVars:p,headingOptions:Ne,paragraphLabel:H,classNames:{toolbar:`luthor-toolbar luthor-toolbar--align-${v}${m?` ${m}`:""}`}}):null,Ve=P==="visual"&&d&&c==="top",$e=P==="visual"&&d&&c==="bottom";return jsxs(Fragment,{children:[jsxs("div",{className:"luthor-editor-header",children:[jsx(yn,{mode:P,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":P,children:[jsxs("div",{className:`luthor-editor-visual-shell${P==="visual"?"":" is-hidden"}${he?"":" luthor-editor-visual-shell--no-gutter"}`,"aria-hidden":P!=="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"}})]}),P!=="visual"&&jsxs("div",{className:"luthor-source-panel",children:[ie&&ie.mode===P&&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"})]})]}),P==="jsonb"&&jsx(vn,{value:R.jsonb,onChange:y=>me(x=>({...x,jsonb:y})),placeholder:o})]})]}),jsx(bn,{editor:g,commands:I,editorTheme:e?"dark":"light",disabled:P!=="visual"}),$e&&jsx("div",{className:"luthor-editor-toolbar-slot luthor-editor-toolbar-slot--bottom",children:_e}),jsx(tn,{isOpen:Le.isOpen,onClose:()=>I.hideCommandPalette(),commands:Le.commands}),jsx(an,{isOpen:se.isOpen,query:se.query,position:se.position,commands:se.commands,onClose:()=>I.closeSlashMenu?.(),onExecute:y=>{I.executeSlashCommand?.(y);}}),jsx(nn,{isOpen:ze.isOpen,query:ze.query,position:ze.position,suggestions:ze.suggestions,onClose:()=>I.closeEmojiSuggestions?.(),onExecute:y=>{I.executeEmojiSuggestion?.(y);}})]})}var Gt=forwardRef(({className:e,onReady:t,initialTheme:n="light",theme:o,defaultContent:l,showDefaultContent:r=true,placeholder:i=Kn,initialMode:a="visual",availableModes:u=["visual","jsonb"],variantClassName:c,toolbarLayout:v,toolbarVisibility:m,toolbarPosition:p="top",toolbarAlignment:d="left",toolbarClassName:h,toolbarStyleVars:H,quoteClassName:S,quoteStyleVars:O,defaultSettings:j,editorThemeOverrides:_,isToolbarEnabled:C=true,fontFamilyOptions:Z,fontSizeOptions:re,lineHeightOptions:$,minimumDefaultLineHeight:g=1.5,scaleByRatio:F=false,headingOptions:k,paragraphLabel:D,syncHeadingOptionsWithCommands:P=true,slashCommandVisibility:W,shortcutConfig:R,commandPaletteShortcutOnly:me=false,isDraggableBoxEnabled:te,featureFlags:Te,syntaxHighlighting:ie,codeHighlightProvider:Se,loadCodeHighlightProvider:Le,maxAutoDetectCodeLength:Ie,isCopyAllowed:se=true,languageOptions:we},ze)=>{let[Fe,ue]=useState(n),Ne=Fe==="dark",fe=u.includes(a)?a:u[0]??"visual",ce=()=>ue(Ne?"light":"dark"),w=useMemo(()=>typeof i=="string"?{visual:i,jsonb:Un}:{visual:i.visual??Kn,jsonb:i.jsonb??Un},[i]);useEffect(()=>{ue(n);},[n]);let I=useMemo(()=>Pl(Z),[Z]),V=useMemo(()=>Rl(re),[re]),We=useMemo(()=>Al($),[$]),he=useMemo(()=>Ml(g),[g]),Ce=ie??"unset",je=typeof Ie=="number"?Ie.toString():"unset",ke=useMemo(()=>Bl(we),[we]),Pe=se?"copy-on":"copy-off",G=useMemo(()=>typeof te!="boolean"?Te:{...Te??{},draggableBlock:te},[Te,te]),Ee=useMemo(()=>Kl(G),[G]),Oe=useMemo(()=>xt(G),[G]),oe=`${I}::${V}::${We}::${he}::${F?"ratio-on":"ratio-off"}::${Ce}::${je}::${Pe}::${ke}::${Ee}`,pe=useRef(Z),Re=useRef(re),M=useRef($),He=useRef(g),Xe=useRef(G),_e=useRef(we),Ve=useRef(Se),$e=useRef(Le),y=useRef(oe);(y.current!==oe||Ve.current!==Se||$e.current!==Le)&&(y.current=oe,pe.current=Z,Re.current=re,M.current=$,He.current=g,Xe.current=G,_e.current=we,Ve.current=Se,$e.current=Le);let x=useRef(null);if(!x.current||x.current.key!==oe){let Q={fontFamilyOptions:pe.current,fontSizeOptions:Re.current,lineHeightOptions:M.current,minimumDefaultLineHeight:He.current,scaleByRatio:F,...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}:{}};x.current={key:oe,value:Tt(Q)};}let K=x.current.value,X=useMemo(()=>{let Q=mergeThemes(defaultLuthorTheme,o??{});return S?{...Q,quote:`${Q.quote??""} ${S}`.trim()}:Q},[o,S]),q=useMemo(()=>vo(_),[_]),Je=useMemo(()=>vo(O),[O]),f=useMemo(()=>Dl(j),[j]),b=useMemo(()=>vo(f),[f]),z=useMemo(()=>{let Q=f,It=createEditorThemeStyleVars(_),xo=O,To={"--luthor-default-line-height":he};return !Q&&!It&&!xo?To:{...Q??{},...It,...xo??{},...To}},[he,f,_,O,b,q,Je]),[A,le]=useState(null);useImperativeHandle(ze,()=>A,[A]);let ae=Q=>{le(Q),r&&l===void 0?Q.injectJSONB(JSON.stringify(yo)):l&&Q.injectJSONB(zl(l)),t?.(Q);};return jsx("div",{className:`luthor-preset luthor-preset-extensive luthor-editor-wrapper ${c||""} ${e||""}`.trim(),"data-editor-theme":Fe,style:z,children:jsx(Nl,{extensions:K,config:{theme:X},children:jsx(Wl,{isDark:Ne,toggleTheme:ce,visualPlaceholder:w.visual,jsonbPlaceholder:w.jsonb,initialMode:fe,availableModes:u,onReady:ae,toolbarLayout:v,toolbarVisibility:m,toolbarPosition:p,toolbarAlignment:d,toolbarClassName:h,toolbarStyleVars:H,isToolbarEnabled:C,headingOptions:k,paragraphLabel:D,syncHeadingOptionsWithCommands:P,slashCommandVisibility:W,shortcutConfig:R,commandPaletteShortcutOnly:me,featureFlags:Oe})})})});Gt.displayName="ExtensiveEditor";function Eo({className:e,variantClassName:t,initialMode:n="visual",...o}){let l=useRef(null),r=useRef(Jt(["visual"])),i=useRef(""),a=useRef(null),[u,c]=useState(n),[v,m]=useState(""),[p,d]=useState(null),h=H=>{if(H!==u)try{if(d(null),H==="markdown")if(Yt(r.current,"markdown"))m(i.current);else {let S=l.current?.getJSONB()??"",O=S?JSON.parse(S):void 0,j=Lo(jsonbToMarkdown(O));i.current=j,m(j),St(r.current,"markdown");}if(H==="visual"){let S=markdownToJSONB(v);a.current=JSON.stringify(S);}c(H),H==="visual"&&setTimeout(()=>{a.current&&(l.current?.injectJSONB(a.current),a.current=null);},0);}catch(S){let O=S instanceof Error?S.message:"Failed to parse markdown";d(O);}};return jsxs("div",{className:["luthor-preset-md-text",e].filter(Boolean).join(" "),onInputCapture:()=>{u==="visual"&&qt(r.current,["visual"]);},children:[jsxs("div",{className:"luthor-md-text-tabs",children:[jsx("button",{type:"button",className:u==="visual"?"active":"",onClick:()=>h("visual"),children:"Visual"}),jsx("button",{type:"button",className:u==="markdown"?"active":"",onClick:()=>h("markdown"),children:"Markdown"})]}),u==="visual"&&jsx(Gt,{ref:l,...o,className:"luthor-preset-md-text__editor",variantClassName:["luthor-preset-md-text__variant",t].filter(Boolean).join(" "),availableModes:["visual"],initialMode:"visual",featureFlags:{table:false,image:false,iframeEmbed:false,youTubeEmbed:false,customNode:false}}),u==="markdown"&&jsxs("div",{className:"luthor-md-text-source-shell",children:[jsx("textarea",{className:"luthor-md-text-source",value:v,onChange:H=>{m(H.target.value),i.current=H.target.value,St(r.current,"markdown");},placeholder:"Write markdown..."}),p&&jsx("p",{className:"luthor-md-text-error",children:p})]})]})}var ta={id:"md-text",label:"MD Text",description:"Visual and markdown editing with conversion bridge.",extensions:Tt({featureFlags:{table:false,image:false,iframeEmbed:false,youTubeEmbed:false,customNode:false}}),components:{Editor:Eo},toolbar:["bold","italic","underline","strikethrough","link","unorderedList","orderedList"],config:Cn("md-text","Write markdown..."),css:"md-text/styles.css"};export{Eo as MDTextEditor,ta as mdTextPreset};
@@ -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-notes{border:1px solid var(--luthor-border);border-radius:10px;padding:10px;display:grid;gap:10px;background:var(--luthor-bg)}.luthor-notes-title{border:0;outline:none;font-size:16px;font-weight:600;background:transparent;color:var(--luthor-fg)}.luthor-notes-actions{display:flex;gap:8px}.luthor-notes-actions button,.luthor-notes-actions select{border:1px solid var(--luthor-border);border-radius:6px;height:30px;padding:0 10px;background:var(--luthor-muted);color:var(--luthor-fg)}
@@ -0,0 +1,21 @@
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 NotesEditorProps = Omit<ExtensiveEditorProps, "featureFlags"> & {
8
+ showTitle?: boolean;
9
+ title?: string;
10
+ onTitleChange?: (value: string) => void;
11
+ showActions?: boolean;
12
+ onPin?: () => void;
13
+ onArchive?: () => void;
14
+ onColorChange?: (color: string) => void;
15
+ colorOptions?: readonly string[];
16
+ };
17
+ declare function NotesEditor({ className, variantClassName, showTitle, title, onTitleChange, showActions, onPin, onArchive, onColorChange, colorOptions, ...props }: NotesEditorProps): react_jsx_runtime.JSX.Element;
18
+
19
+ declare const notesPreset: EditorPreset;
20
+
21
+ export { NotesEditor, type NotesEditorProps, notesPreset };