@editora/core 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodePlugin.native-BRBEIqY7.mjs → CodePlugin.native-CRpX2G93.mjs} +2 -2
- package/dist/{DocumentManagerPlugin.native-tZqIa9o5.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +4 -4
- package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
- package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
- package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
- package/dist/{documentManager-8gnG-uG_.mjs → documentManager-DHLCoWzw.mjs} +490 -509
- package/dist/editora.min.js +2 -2
- package/dist/editora.umd.js +2 -2
- package/dist/index-DHPPVQwx.js +12 -0
- package/dist/{index-BICrB5kg.mjs → index-gI4djib2.mjs} +11 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +2 -2
- package/dist/shared-config-DuA34Iii.mjs +26 -0
- package/dist/webcomponent-core.js +10 -1
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +2 -2
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +81 -72
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +2480 -1262
- package/package.json +1 -1
- package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +0 -1161
- package/dist/MediaManagerPlugin.native-CRi24Mrb.mjs +0 -1057
- package/dist/confirmDialog-BP8hZPpX.mjs +0 -112
- package/dist/index--wO0CZVN.js +0 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";class Lt{constructor(t,e,o){this.doc=t,this.selection=e,this.schema=o}static create(t,e){const o=e||t.node("doc",{},[t.node("paragraph")]);return new Lt(o,{anchor:0,head:0},t)}apply(t,e){return new Lt(t,e||this.selection,this.schema)}}class So{constructor(t,e){this.nodes=new Map(Object.entries(t)),this.marks=new Map(Object.entries(e))}node(t,e,o){return{type:t,attrs:e,content:o}}text(t,e){return{type:"text",text:t,marks:e}}}class Ce{constructor(){this.plugins=[],this.pluginConfigs=new Map}register(t,e){this.plugins.push(t),e&&this.pluginConfigs.set(t.name,e);const o=this.pluginConfigs.get(t.name)||t.config;if(t.initialize)try{t.initialize(o)}catch(i){console.error(`Failed to initialize plugin "${t.name}":`,i)}if(t.init&&t.init!==t.initialize)try{t.init(o)}catch(i){console.error(`Failed to run init hook for plugin "${t.name}":`,i)}}unregister(t){const e=this.plugins.findIndex(o=>o.name===t);if(e>-1){const o=this.plugins[e];o.destroy&&o.destroy(),this.plugins.splice(e,1),this.pluginConfigs.delete(t)}}getPlugin(t){return this.plugins.find(e=>e.name===t)}getPluginConfig(t){return this.pluginConfigs.get(t)}buildSchema(){const t={},e={};return this.plugins.forEach(o=>{o.nodes&&Object.assign(t,o.nodes),o.marks&&Object.assign(e,o.marks)}),new So(t,e)}getCommands(){const t={};return this.plugins.forEach(e=>{e.commands&&Object.assign(t,e.commands)}),t}getToolbarItems(){return this.plugins.flatMap(t=>t.toolbar||[])}async executePluginCommand(t,e,...o){const i=this.getPlugin(t);if(!i)throw new Error(`Plugin not found: ${t}`);const r=this.getPluginConfig(t)||i.config||{},l=r.mode||"local";try{switch(l){case"local":return i.executeLocal?i.executeLocal(e,...o):null;case"api":if(!i.executeAPI)throw new Error(`Plugin ${t} does not support API mode`);return await i.executeAPI(e,...o);case"hybrid":if(i.executeHybrid)return await i.executeHybrid(e,...o);try{if(i.executeAPI)return await i.executeAPI(e,...o)}catch(c){if(console.warn(`API execution failed for ${t}, falling back to local`,c),i.executeLocal&&r.fallbackToLocal!==!1)return i.executeLocal(e,...o);throw c}break;default:throw new Error(`Unknown plugin mode: ${l}`)}}catch(c){throw console.error(`Error executing command ${e} on plugin ${t}:`,c),c}}async destroyAll(){const t=this.plugins.filter(e=>e.destroy).map(e=>e.destroy());await Promise.all(t),this.plugins=[],this.pluginConfigs.clear()}}function kn(){return new Ce}class _o{constructor(t){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator!="undefined"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,(t==null?void 0:t.enabled)===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),t!=null&&t.shortcuts&&t.shortcuts.forEach(e=>this.registerShortcut(e)),t!=null&&t.customShortcuts&&Object.values(t.customShortcuts).forEach(e=>{this.registerShortcut(e)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let t=1;t<=6;t++)this.registerShortcut({key:String(t),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${t}`,description:`Heading ${t}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.set(e,t)}unregisterShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.delete(e)}getShortcutKey(t){const e=[];return t.ctrl&&e.push("ctrl"),t.alt&&e.push("alt"),t.shift&&e.push("shift"),t.meta&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}getEventKey(t){const e=[];return t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}handleKeyDown(t,e){if(!this.enabled)return!1;const o=this.getEventKey(t),i=this.shortcuts.get(o);return i?(i.preventDefault!==!1&&(t.preventDefault(),t.stopPropagation()),e(i.command,i.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(t){return Array.from(this.shortcuts.values()).find(e=>e.command===t)}getShortcutDescription(t){const e=[];this.isMac?(t.meta&&e.push("⌘"),t.ctrl&&e.push("⌃"),t.alt&&e.push("⌥"),t.shift&&e.push("⇧")):(t.ctrl&&e.push("Ctrl"),t.alt&&e.push("Alt"),t.shift&&e.push("Shift"));const o=t.key.length===1?t.key.toUpperCase():t.key;return e.push(o),e.join("+")}getShortcutsHelp(){const t=this.getAllShortcuts(),e=new Map;t.forEach(i=>{const r=this.getShortcutCategory(i.command);e.has(r)||e.set(r,[]),e.get(r).push(i)});let o=`# Keyboard Shortcuts
|
|
2
|
+
|
|
3
|
+
`;return e.forEach((i,r)=>{o+=`## ${r}
|
|
4
|
+
|
|
5
|
+
`,i.forEach(l=>{const c=this.getShortcutDescription(l);o+=`- **${c}**: ${l.description||l.command}
|
|
6
|
+
`}),o+=`
|
|
7
|
+
`}),o}getShortcutCategory(t){return t.includes("toggle")&&(t.includes("Bold")||t.includes("Italic")||t.includes("Underline")||t.includes("Strike")||t.includes("Code")||t.includes("Super")||t.includes("Sub"))?"Text Formatting":t.includes("Heading")||t.includes("Paragraph")?"Block Formatting":t.includes("List")||t.includes("Checklist")?"Lists":t.includes("Alignment")||t.includes("Indent")?"Alignment & Indentation":t.includes("undo")||t.includes("redo")?"History":t.includes("insert")?"Insert":t.includes("find")||t.includes("replace")?"Find & Replace":t.includes("Accessibility")||t.includes("spell")?"Tools":"Other"}}class Lo{constructor(t={}){this.commands=new Map,Object.entries(t).forEach(([e,o])=>{this.register(e,o)})}register(t,e){this.commands.has(t)&&console.warn(`Command ${t} is being overwritten`),this.commands.set(t,e)}unregister(t){this.commands.delete(t)}get(t){return this.commands.get(t)}has(t){return this.commands.has(t)}getCommandNames(){return Array.from(this.commands.keys())}clear(){this.commands.clear()}}class Mo{constructor(t={}){this.listeners=new Map,this.isReadonly=!1,this.isDestroyed=!1,this.isReadonly=t.readonly||!1,this.pluginManager=new Ce,t.plugins&&Array.isArray(t.plugins)&&t.plugins.forEach(o=>this.pluginManager.register(o));const e=this.pluginManager.buildSchema();this.state=Lt.create(e),this.commandRegistry=new Lo(this.pluginManager.getCommands())}execCommand(t,...e){if(this.isReadonly)return console.warn("Cannot execute commands in readonly mode"),!1;if(this.isDestroyed)return console.warn("Cannot execute commands on destroyed editor"),!1;const o=this.commandRegistry.get(t);if(!o)return console.warn(`Command not found: ${t}`),!1;let i;return e.length===0?i=o(this.state):e.length===1?i=o(this.state,e[0]):i=o(this.state,...e),i instanceof Promise?(i.then(r=>{r&&typeof r=="object"&&"doc"in r&&"selection"in r&&(this.setState(r),this.emit("change",this.state))}).catch(r=>{console.error(`Async command failed: ${t}`,r)}),!0):i&&typeof i=="object"&&"doc"in i&&"selection"in i?(this.setState(i),this.emit("change",this.state),!0):i!==!1&&i!=null}setState(t){this.isDestroyed||(this.state=t,this.emit("stateChange",t))}getState(){return this.state}setReadonly(t){this.isReadonly=t,this.emit("readonlyChange",t)}isReadOnly(){return this.isReadonly}on(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push(e),()=>{const o=this.listeners.get(t);if(o){const i=o.indexOf(e);i>-1&&o.splice(i,1)}}}emit(t,...e){const o=this.listeners.get(t);o&&o.forEach(i=>{try{i(...e)}catch(r){console.error(`Error in ${t} handler:`,r)}})}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.listeners.clear(),this.emit("destroy"))}isEditorDestroyed(){return this.isDestroyed}}class Io{constructor(t,e,o){this.overflowUnits=[],this.overflowUnitHomes=new WeakMap,this.expandedOpen=!1,this.onDocumentPointerDownForOverflow=i=>{var l,c;if(!this.expandedOpen)return;const r=i.target;r&&((l=this.moreButton)!=null&&l.contains(r)||(c=this.expandedRow)!=null&&c.contains(r))||this.setExpandedOpen(!1)},this.config=t,this.plugins=e,this.pluginLoader=o}setLastCommandTrigger(t,e){if(typeof window=="undefined"||!t)return;const o=e||t.getAttribute("data-command")||void 0;o&&(window.__editoraLastCommandButton=t,window.__editoraLastCommand=o)}setCommandHandler(t){this.commandHandler=t}parseToolbarString(t){const e=[],o=t.split("|").map(c=>c.trim()),i=this.getAvailableToolbarItems(),r=new Map;i.forEach(c=>{c.command&&r.set(c.command,c),c.type==="group"&&c.label&&r.set(c.label,c)});const l={bold:"toggleBold",italic:"toggleItalic",underline:"toggleUnderline",strikethrough:"toggleStrikethrough",bullist:"toggleBulletList",numlist:"toggleOrderedList",checklist:"toggleChecklist",link:"openLinkDialog",image:"openImageDialog",table:"insertTable",trackChanges:"toggleTrackChanges",acceptTrackChanges:"acceptAllTrackChanges",rejectTrackChanges:"rejectAllTrackChanges",anchor:"insertAnchor",code:"toggleSourceView",blockquote:"toggleBlockquote",undo:"undo",redo:"redo",textColor:"openTextColorPicker",backgroundColor:"openBackgroundColorPicker",fontSize:"fontSize",fontFamily:"setFontFamily",lineHeight:"setLineHeight",heading:"setBlockType",paragraph:"setParagraph",textAlignment:"setTextAlignment",direction:"setDirectionLTR",indent:"increaseIndent",outdent:"decreaseIndent",capitalization:"setCapitalization",math:"insertMath",specialCharacters:"insertSpecialCharacter",emojis:"openEmojiDialog",embedIframe:"openEmbedIframeDialog",fullscreen:"toggleFullscreen",preview:"togglePreview",print:"print",a11yChecker:"toggleA11yChecker",spellCheck:"toggleSpellCheck",comments:"addComment",showHideComments:"toggleComments",toggleComments:"toggleComments",footnote:"insertFootnote",mergeTags:"insertMergeTag",dataBinding:"openDataBindingDialog",dataBindingPreview:"openDataBindingDialog",contentRules:"toggleContentRulesPanel",contentRulesAudit:"runContentRulesAudit",contentRulesRealtime:"toggleContentRulesRealtime",mention:"insertMention",slash:"openSlashCommands",slashCommands:"openSlashCommands",pageBreak:"insertPageBreak",template:"insertTemplate",importWord:"importWord",exportWord:"exportWord",exportPdf:"exportPdf",insertImage:"insertImage",insertVideo:"insertVideo",insertAudio:"insertAudio",codeBlock:"insertCodeBlock"};return o.forEach(c=>{const f=[];c.split(/\s+/).filter(Boolean).forEach(g=>{if(g==="direction"){const w=r.get("setDirectionLTR"),v=r.get("setDirectionRTL");w&&f.push({id:"directionLTR",label:w.label,command:w.command,icon:w.icon,type:w.type||"button",options:w.options}),v&&f.push({id:"directionRTL",label:v.label,command:v.command,icon:v.icon,type:v.type||"button",options:v.options});return}if(g==="comments"){const w=r.get("addComment"),v=r.get("toggleComments");w&&f.push({id:"addComment",label:w.label,command:w.command,icon:w.icon,type:w.type||"button",options:w.options}),v&&f.push({id:"toggleComments",label:v.label,command:v.command,icon:v.icon,type:v.type||"button",options:v.options});return}const T=l[g]||g;let k=r.get(T);k||(k=r.get(g)),k&&f.push({id:g,label:k.label,command:k.command,icon:k.icon,type:k.type==="separator"?"separator":k.type||"button",options:k.options,items:k.items})}),f.length>0&&e.push(f)}),e}getAvailableToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}render(t){this.container=t,t.innerHTML="",t.className="editora-toolbar",this.config.sticky&&t.classList.add("editora-toolbar-sticky"),this.config.position&&t.classList.add(`editora-toolbar-${this.config.position}`);const e=document.createElement("div");e.className="editora-toolbar-items-container",this.itemsContainer=e,this.overflowUnits=[];const o=this.config.items||this.getDefaultToolbarString(),i=this.parseToolbarString(o);i.forEach((r,l)=>{const c=document.createElement("div");if(c.className="editora-toolbar-group",r.forEach(f=>{this.appendToolbarButton(c,f);const m=c.lastElementChild;m instanceof HTMLElement&&(this.overflowUnits.push(m),this.overflowUnitHomes.set(m,c))}),e.appendChild(c),l<i.length-1){const f=document.createElement("div");f.className="editora-toolbar-separator",e.appendChild(f)}}),t.appendChild(e),this.setupOverflow(t)}setupOverflow(t){if(!this.itemsContainer||typeof ResizeObserver=="undefined")return;const o=document.createElement("button");o.type="button",o.className="editora-toolbar-more-button",o.title="Show more options",o.setAttribute("aria-label","More toolbar options"),o.textContent="☰",o.style.display="none",o.addEventListener("click",c=>{c.preventDefault(),this.setExpandedOpen(!this.expandedOpen)}),this.moreButton=o,t.appendChild(o);const i=document.createElement("div");i.className="editora-toolbar-expanded-row",this.expandedRow=i,t.appendChild(i),document.addEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0);const r=()=>{const c=this.overflowUnits;if(c.length===0)return;c.forEach(D=>{var N;D.parentElement===i&&((N=this.overflowUnitHomes.get(D))==null||N.appendChild(D))});const f=t.clientWidth,m=16,g=40,T=4,k=Math.max(0,f-m-g-T);let w=0,v=0;for(const D of c){const N=D.getBoundingClientRect().width+T;if(w+N<=k)w+=N,v++;else break}v=Math.max(1,Math.min(v,c.length));const K=v<c.length;o.style.display=K?"":"none",o.classList.toggle("active",K&&this.expandedOpen),!K&&this.expandedOpen&&this.setExpandedOpen(!1),c.forEach((D,N)=>{N>=v&&i.appendChild(D)})},l=()=>{this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),this.overflowRafId=requestAnimationFrame(r)};this.resizeObserver=new ResizeObserver(()=>l()),this.resizeObserver.observe(t),l()}setExpandedOpen(t){var e,o;this.expandedOpen=t,(e=this.expandedRow)==null||e.classList.toggle("show",t),(o=this.moreButton)==null||o.classList.toggle("active",t)}appendToolbarButton(t,e){if(e.type==="separator"){const o=document.createElement("div");o.className="editora-toolbar-separator",t.appendChild(o)}else if(e.type==="dropdown"){const o=this.createDropdown(e);t.appendChild(o)}else if(e.type==="inline-menu"){const o=this.createInlineMenu(e);t.appendChild(o)}else if(e.type==="group"&&e.items&&e.items.length){const o=this.createGroupButton(e);t.appendChild(o)}else if(e.type==="input"){const o=this.createInput(e);t.appendChild(o)}else{const o=this.createButton(e);t.appendChild(o)}}createGroupButton(t){const e=document.createElement("div"),o=t.label.toLowerCase().replace(/\s+/g,"-");if(e.className=`editora-toolbar-group-button ${o}`,e.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const i=document.createElement("span");i.className="editora-toolbar-icon",i.innerHTML=t.icon,e.appendChild(i)}else e.innerHTML=t.icon;if(t.items&&t.items.length){const i=document.createElement("div");i.className=`editora-toolbar-group-items ${o}`,t.items.forEach(r=>{this.appendToolbarButton(i,r)}),e.appendChild(i)}return e}createInput(t){const e=document.createElement("input");return e.className=`editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g,"-")}`,e.type="text",e.title=t.label,e.setAttribute("aria-label",t.label),e.placeholder=t.placeholder||"",t.command&&e.setAttribute("data-command",t.command),t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.setLastCommandTrigger(e,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}createButton(t){const e=document.createElement("button");if(e.className="editora-toolbar-button",e.type="button",e.title=t.label,t.command&&e.setAttribute("data-command",t.command),t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const o=document.createElement("span");o.className="editora-toolbar-icon",o.innerHTML=t.icon,e.appendChild(o)}else e.innerHTML=t.icon;else e.textContent=t.label;return t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}makeMenuAccessible(t,e,o,i){e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false"),o.setAttribute("role","menu"),o.setAttribute("aria-label",i),o.querySelectorAll(".editora-toolbar-dropdown-item").forEach(m=>{m.setAttribute("role","menuitem"),m.tabIndex=-1});const r=()=>Array.from(o.querySelectorAll('[role="menuitem"]')),l=()=>o.style.display==="block",c=new MutationObserver(()=>{e.setAttribute("aria-expanded",l()?"true":"false")});c.observe(o,{attributes:!0,attributeFilter:["style"]});const f=t._cleanupDropdown;t._cleanupDropdown=()=>{c.disconnect(),f==null||f()},e.addEventListener("click",m=>{var g;m.detail===0&&l()&&((g=r()[0])==null||g.focus())}),e.addEventListener("keydown",m=>{var T;if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault(),l()||e.click();const g=r();(T=m.key==="ArrowUp"?g[g.length-1]:g[0])==null||T.focus()}),o.addEventListener("keydown",m=>{const g=r();if(g.length===0)return;const T=g.indexOf(document.activeElement),k=w=>{m.preventDefault(),g[(w+g.length)%g.length].focus()};switch(m.key){case"ArrowDown":return k(T+1);case"ArrowUp":return k(T<0?g.length-1:T-1);case"Home":return k(0);case"End":return k(g.length-1);case"Escape":m.preventDefault(),m.stopPropagation(),o.style.display="none",e.focus();return;case"Tab":o.style.display="none";return}})}createDropdown(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown";const o=document.createElement("button");o.className="editora-toolbar-button editora-toolbar-dropdown-trigger",o.type="button",o.textContent=t.label;const i=document.createElement("div");i.className="editora-toolbar-dropdown-menu",i.style.display="none",t.options&&t.options.forEach(c=>{const f=document.createElement("button");f.className="editora-toolbar-dropdown-item",f.type="button",f.textContent=c.label,f.setAttribute("data-value",c.value),f.addEventListener("click",m=>{m.preventDefault(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),i.style.display="none"}),i.appendChild(f)}),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const f=i.style.display==="block";i.style.display=f?"none":"block"});const r=c=>{e.contains(c.target)||(i.style.display="none")},l=c=>{c.key==="Escape"&&(i.style.display="none")};return document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l)},e.appendChild(o),e.appendChild(i),this.makeMenuAccessible(e,o,i,t.label),e}createInlineMenu(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown editora-toolbar-inline-menu";const o=document.createElement("button");if(o.className="editora-toolbar-button",o.type="button",o.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const c=document.createElement("span");c.className="editora-toolbar-icon",c.innerHTML=t.icon,o.appendChild(c)}else o.innerHTML=t.icon;else o.textContent=t.label;const i=document.createElement("div");i.className="editora-toolbar-dropdown-menu",i.style.display="none",t.options&&t.options.forEach(c=>{const f=document.createElement("button");f.className="editora-toolbar-dropdown-item",f.type="button",f.textContent=c.label,f.setAttribute("data-value",c.value),f.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),i.style.display="none"}),i.appendChild(f)}),o.addEventListener("click",c=>{var m;c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const f=(m=this.container)==null?void 0:m.querySelectorAll(".editora-toolbar-dropdown-menu");f==null||f.forEach(g=>{g!==i&&(g.style.display="none")}),i.style.display=i.style.display==="none"?"block":"none"});const r=c=>{e.contains(c.target)||(i.style.display="none")},l=c=>{c.key==="Escape"&&(i.style.display="none")};return document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",l),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",l)},e.appendChild(o),e.appendChild(i),this.makeMenuAccessible(e,o,i,t.label),e}getDefaultToolbarString(){return this.getAvailableToolbarItems().map(e=>e.command).join(" ")}updateButtonState(t,e){if(!this.container)return;const o=this.container.querySelector(`[data-command="${t}"]`);o&&(e.active!==void 0&&o.classList.toggle("active",e.active),e.disabled!==void 0&&(o.disabled=e.disabled))}destroy(){var t;this.container&&(this.container.querySelectorAll(".editora-toolbar-dropdown").forEach(o=>{const i=o._cleanupDropdown;i&&i()}),this.container.innerHTML=""),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=void 0,this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),document.removeEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0),this.itemsContainer=void 0,this.moreButton=void 0,this.expandedRow=void 0,this.commandHandler=void 0}}class Oo{constructor(t){this.visible=!1,this.config=t}create(t){const e=document.createElement("div");return e.className="editora-floating-toolbar",e.style.display="none",e.style.position="absolute",e.style.zIndex="1000",this.container=e,t.appendChild(e),e}show(t,e){this.container&&(this.container.style.display="block",this.container.style.left=`${t}px`,this.container.style.top=`${e}px`,this.visible=!0)}hide(){this.container&&(this.container.style.display="none",this.visible=!1)}updatePosition(t,e){!this.container||!this.visible||(this.container.style.left=`${t}px`,this.container.style.top=`${e}px`)}isVisible(){return this.visible}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0,this.visible=!1}}class Do{constructor(t={}){this.statusInfo={},this.config=t}create(t){const e=document.createElement("div");return e.className="editora-statusbar",this.config.position&&e.classList.add(`editora-statusbar-${this.config.position}`),this.container=e,t.appendChild(e),e}update(t){this.statusInfo={...this.statusInfo,...t},this.render()}render(){if(!this.container)return;this.container.innerHTML="";const t=document.createElement("div");t.className="editora-statusbar-left";const e=document.createElement("div");e.className="editora-statusbar-right";const o=[];if(this.statusInfo.selectionInfo){const r=this.statusInfo.selectionInfo;r.startLine===r.endLine&&r.startColumn===r.endColumn?o.push(`Ln ${r.startLine}, Col ${r.startColumn}`):(r.startLine===r.endLine?o.push(`Ln ${r.startLine}, Col ${r.startColumn}-${r.endColumn}`):o.push(`Ln ${r.startLine}:${r.startColumn} - ${r.endLine}:${r.endColumn}`),o.push(`${r.selectedChars} chars selected`))}else if(this.statusInfo.cursorPosition){const r=this.statusInfo.cursorPosition;o.push(`Ln ${r.line}, Col ${r.column}`)}this.statusInfo.language&&o.push(this.statusInfo.language);const i=[];this.statusInfo.wordCount!==void 0&&i.push(`${this.statusInfo.wordCount} words`),this.statusInfo.charCount!==void 0&&i.push(`${this.statusInfo.charCount} chars`),this.statusInfo.lineCount!==void 0&&i.push(`${this.statusInfo.lineCount} lines`),this.statusInfo.custom&&Object.entries(this.statusInfo.custom).forEach(([r,l])=>{i.push(`${r}: ${l}`)}),o.forEach((r,l)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=r,t.appendChild(c),l<o.length-1){const f=document.createElement("span");f.className="editora-statusbar-separator",f.textContent="|",t.appendChild(f)}}),i.forEach((r,l)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=r,e.appendChild(c),l<i.length-1){const f=document.createElement("span");f.className="editora-statusbar-separator",f.textContent="|",e.appendChild(f)}}),this.container.appendChild(t),this.container.appendChild(e)}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0}}function Ro(s,t){const e=s.textContent||"",o=No(s,t.startContainer,t.startOffset),r=e.substring(0,o).split(`
|
|
8
|
+
`),l=r.length,c=r[r.length-1].length+1;return{line:l,column:c}}function No(s,t,e){var l;let o=0;const i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,null);let r=i.firstChild();for(;r;){if(r===t){o+=e;break}else r.nodeType===Node.TEXT_NODE&&(o+=((l=r.textContent)==null?void 0:l.length)||0);r=i.nextNode()}return o}function Po(s){var o,i;const t=s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");let e=1;if(t.length>0){e=t.length;const r=t[t.length-1];(r.tagName==="BR"||((o=r.innerHTML)==null?void 0:o.trim())===""||((i=r.textContent)==null?void 0:i.trim())==="")&&e++}else{const l=(s.textContent||"").split(`
|
|
9
|
+
`).length;e=Math.max(1,l)}return e}function zo(s){const t=s.trim()?s.trim().split(/\s+/).length:0,e=s.length;return{words:t,chars:e}}function Ho(s,t){const e=s.toString();return{startLine:t.line,startColumn:t.column,endLine:t.line,endColumn:t.column+e.length,selectedChars:e.length,selectedWords:e.trim().split(/\s+/).filter(Boolean).length}}function so(s,t){(t==null||t>s.length)&&(t=s.length);for(var e=0,o=Array(t);e<t;e++)o[e]=s[e];return o}function xn(s){if(Array.isArray(s))return s}function An(s,t){var e=s==null?null:typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(e!=null){var o,i,r,l,c=[],f=!0,m=!1;try{if(r=(e=e.call(s)).next,t!==0)for(;!(f=(o=r.call(e)).done)&&(c.push(o.value),c.length!==t);f=!0);}catch(g){m=!0,i=g}finally{try{if(!f&&e.return!=null&&(l=e.return(),Object(l)!==l))return}finally{if(m)throw i}}return c}}function Cn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sn(s,t){return xn(s)||An(s,t)||_n(s,t)||Cn()}function _n(s,t){if(s){if(typeof s=="string")return so(s,t);var e={}.toString.call(s).slice(8,-1);return e==="Object"&&s.constructor&&(e=s.constructor.name),e==="Map"||e==="Set"?Array.from(s):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?so(s,t):void 0}}const Bo=Object.entries,lo=Object.setPrototypeOf,Ln=Object.isFrozen,Mn=Object.getPrototypeOf,In=Object.getOwnPropertyDescriptor;let M=Object.freeze,I=Object.seal,gt=Object.create,Fo=typeof Reflect!="undefined"&&Reflect,Te=Fo.apply,ke=Fo.construct;M||(M=function(t){return t});I||(I=function(t){return t});Te||(Te=function(t,e){for(var o=arguments.length,i=new Array(o>2?o-2:0),r=2;r<o;r++)i[r-2]=arguments[r];return t.apply(e,i)});ke||(ke=function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),i=1;i<e;i++)o[i-1]=arguments[i];return new t(...o)});const it=L(Array.prototype.forEach),On=L(Array.prototype.lastIndexOf),co=L(Array.prototype.pop),xt=L(Array.prototype.push),Dn=L(Array.prototype.splice),yt=Array.isArray,_t=L(String.prototype.toLowerCase),he=L(String.prototype.toString),uo=L(String.prototype.match),At=L(String.prototype.replace),po=L(String.prototype.indexOf),Rn=L(String.prototype.trim),Nn=L(Number.prototype.toString),Pn=L(Boolean.prototype.toString),fo=typeof BigInt=="undefined"?null:L(BigInt.prototype.toString),ho=typeof Symbol=="undefined"?null:L(Symbol.prototype.toString),z=L(Object.prototype.hasOwnProperty),Ct=L(Object.prototype.toString),O=L(RegExp.prototype.test),X=zn(TypeError);function L(s){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,o=new Array(e>1?e-1:0),i=1;i<e;i++)o[i-1]=arguments[i];return Te(s,t,o)}}function zn(s){return function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return ke(s,e)}}function E(s,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_t;if(lo&&lo(s,null),!yt(t))return s;let o=t.length;for(;o--;){let i=t[o];if(typeof i=="string"){const r=e(i);r!==i&&(Ln(t)||(t[o]=r),i=r)}s[i]=!0}return s}function Hn(s){for(let t=0;t<s.length;t++)z(s,t)||(s[t]=null);return s}function F(s){const t=gt(null);for(const o of Bo(s)){var e=Sn(o,2);const i=e[0],r=e[1];z(s,i)&&(yt(r)?t[i]=Hn(r):r&&typeof r=="object"&&r.constructor===Object?t[i]=F(r):t[i]=r)}return t}function Bn(s){switch(typeof s){case"string":return s;case"number":return Nn(s);case"boolean":return Pn(s);case"bigint":return fo?fo(s):"0";case"symbol":return ho?ho(s):"Symbol()";case"undefined":return Ct(s);case"function":case"object":{if(s===null)return Ct(s);const t=s,e=j(t,"toString");if(typeof e=="function"){const o=e(t);return typeof o=="string"?o:Ct(o)}return Ct(s)}default:return Ct(s)}}function j(s,t){for(;s!==null;){const o=In(s,t);if(o){if(o.get)return L(o.get);if(typeof o.value=="function")return L(o.value)}s=Mn(s)}function e(){return null}return e}function Fn(s){try{return O(s,""),!0}catch(t){return!1}}const mo=M(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),me=M(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ge=M(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Un=M(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),be=M(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jn=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),go=M(["#text"]),bo=M(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ye=M(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),yo=M(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),$t=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Wn=I(/{{[\w\W]*|^[\w\W]*}}/g),$n=I(/<%[\w\W]*|^[\w\W]*%>/g),Gn=I(/\${[\w\W]*/g),Kn=I(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yn=I(/^aria-[\-\w]+$/),Eo=I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qn=I(/^(?:\w+script|data):/i),Vn=I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xn=I(/^html$/i),Zn=I(/^[a-z][.\w]*(-[.\w]+)+$/i),vo=I(/<[/\w!]/g),wo=I(/<[/\w]/g),Jn=I(/<\/no(script|embed|frames)/i),Qn=I(/\/>/i),B={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Uo=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],ti=M(E({},Uo)),ei=(function(){const s={};return it(Uo,t=>{s[t]=I(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),M(s)})(),oi=function(){return typeof window=="undefined"?null:window},ni=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(o=e.getAttribute(i));const r="dompurify"+(o?"#"+o:"");try{return t.createPolicy(r,{createHTML(l){return l},createScriptURL(l){return l}})}catch(l){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Z=function(t,e,o,i){return z(t,e)&&yt(t[e])?E(i.base?F(i.base):{},t[e],i.transform):o},Ee=function(t,e,o){const i=z(t,e)?t[e]:void 0;return i&&typeof i=="object"?F(i):o()};function jo(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oi();const t=u=>jo(u);if(t.version="3.4.16",t.removed=[],!s||!s.document||s.document.nodeType!==B.document||!s.Element)return t.isSupported=!1,t;let e=s.document;const o=e,i=o.currentScript;s.DocumentFragment;const r=s.HTMLTemplateElement,l=s.Node,c=s.Element,f=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const m=s.DOMParser,g=s.trustedTypes,T=c.prototype,k=j(T,"cloneNode"),w=j(T,"remove"),v=j(T,"removeAttributeNode"),K=j(T,"nextSibling"),D=j(T,"childNodes"),N=j(T,"parentNode"),_e=j(T,"shadowRoot"),Vt=j(T,"attributes"),Q=l&&l.prototype?j(l.prototype,"nodeType"):null,at=l&&l.prototype?j(l.prototype,"nodeName"):null,Mt=l&&l.prototype?j(l.prototype,"ownerDocument"):null,Et=function(n){return Q?Q(n):n.nodeType},Xt=function(n){return at?at(n):n.nodeName};if(typeof r=="function"){const u=e.createElement("template");u.content&&u.content.ownerDocument&&(e=u.content.ownerDocument)}let P,tt="",Zt,Le=!1,vt=0;const Me=function(){if(vt>0)throw X('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},st=function(n){Me(),vt++;try{return P.createHTML(n)}finally{vt--}},qo=function(n){Me(),vt++;try{return P.createScriptURL(n)}finally{vt--}},Vo=function(){return Le||(Zt=ni(g,i),Le=!0),Zt},It=e,Jt=It.implementation,Ie=It.createNodeIterator,Xo=It.createDocumentFragment,Zo=It.getElementsByTagName,Jo=o.importNode;let x=To();t.isSupported=typeof Bo=="function"&&typeof N=="function"&&Jt&&Jt.createHTMLDocument!==void 0;const Qo=Wn,tn=$n,en=Gn,on=Kn,nn=Yn,rn=qn,Oe=Vn,an=Zn;let De=Eo,A=null;const Qt=E({},[...mo,...me,...ge,...be,...go]);let C=null;const te=E({},[...bo,...ye,...yo,...$t]);let W=Object.seal(gt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),wt=null,Re=null;const Y=Object.seal(gt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ne=!0,ee=!0,Pe=!1,ze=!0,q=!1,et=!0,ot=!1,oe=!1,Ot=null,Dt=null,ne=!1,lt=!1,Rt=!1,Nt=!1,He=!0,Be=!1;const Fe="user-content-";let ie=!0,re=!1,ct={},dt=null;const Ue=E({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let je=null;const We=E({},["audio","video","img","source","image","track"]);let $e=null;const Ge=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",zt="http://www.w3.org/2000/svg",$="http://www.w3.org/1999/xhtml";let ut=$,ae=!1,se=null;const sn=E({},[Pt,zt,$],he),Ke=M(["mi","mo","mn","ms","mtext"]);let le=E({},Ke);const Ye=M(["annotation-xml"]);let ce=E({},Ye);const ln=E({},["title","style","font","a","script"]);let Tt=null;const cn=["application/xhtml+xml","text/html"],dn="text/html";let _=null,pt=null;const un=e.createElement("form"),qe=function(n){return n instanceof RegExp||n instanceof Function},de=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pt&&pt===n)return;(!n||typeof n!="object")&&(n={}),n=F(n),Tt=cn.indexOf(n.PARSER_MEDIA_TYPE)===-1?dn:n.PARSER_MEDIA_TYPE,_=Tt==="application/xhtml+xml"?he:_t,A=Z(n,"ALLOWED_TAGS",Qt,{transform:_}),C=Z(n,"ALLOWED_ATTR",te,{transform:_}),se=Z(n,"ALLOWED_NAMESPACES",sn,{transform:he}),$e=Z(n,"ADD_URI_SAFE_ATTR",Ge,{transform:_,base:Ge}),je=Z(n,"ADD_DATA_URI_TAGS",We,{transform:_,base:We}),dt=Z(n,"FORBID_CONTENTS",Ue,{transform:_}),wt=Z(n,"FORBID_TAGS",F({}),{transform:_}),Re=Z(n,"FORBID_ATTR",F({}),{transform:_}),ct=z(n,"USE_PROFILES")?n.USE_PROFILES&&typeof n.USE_PROFILES=="object"?F(n.USE_PROFILES):n.USE_PROFILES:!1,Ne=n.ALLOW_ARIA_ATTR!==!1,ee=n.ALLOW_DATA_ATTR!==!1,Pe=n.ALLOW_UNKNOWN_PROTOCOLS||!1,ze=n.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=n.SAFE_FOR_TEMPLATES||!1,et=n.SAFE_FOR_XML!==!1,ot=n.WHOLE_DOCUMENT||!1,lt=n.RETURN_DOM||!1,Rt=n.RETURN_DOM_FRAGMENT||!1,Nt=n.RETURN_TRUSTED_TYPE||!1,ne=n.FORCE_BODY||!1,He=n.SANITIZE_DOM!==!1,Be=n.SANITIZE_NAMED_PROPS||!1,ie=n.KEEP_CONTENT!==!1,re=n.IN_PLACE||!1,De=Fn(n.ALLOWED_URI_REGEXP)?n.ALLOWED_URI_REGEXP:Eo,ut=typeof n.NAMESPACE=="string"?n.NAMESPACE:$,le=Ee(n,"MATHML_TEXT_INTEGRATION_POINTS",()=>E({},Ke)),ce=Ee(n,"HTML_INTEGRATION_POINTS",()=>E({},Ye));const a=Ee(n,"CUSTOM_ELEMENT_HANDLING",()=>gt(null));if(W=gt(null),z(a,"tagNameCheck")&&qe(a.tagNameCheck)&&(W.tagNameCheck=a.tagNameCheck),z(a,"attributeNameCheck")&&qe(a.attributeNameCheck)&&(W.attributeNameCheck=a.attributeNameCheck),z(a,"allowCustomizedBuiltInElements")&&typeof a.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=a.allowCustomizedBuiltInElements),I(W),q&&(ee=!1),Rt&&(lt=!0),ct&&(A=E({},go),C=gt(null),ct.html===!0&&(E(A,mo),E(C,bo)),ct.svg===!0&&(E(A,me),E(C,ye),E(C,$t)),ct.svgFilters===!0&&(E(A,ge),E(C,ye),E(C,$t)),ct.mathMl===!0&&(E(A,be),E(C,yo),E(C,$t))),Y.tagCheck=null,Y.attributeCheck=null,z(n,"ADD_TAGS")&&(typeof n.ADD_TAGS=="function"?Y.tagCheck=n.ADD_TAGS:yt(n.ADD_TAGS)&&(A===Qt&&(A=F(A)),E(A,n.ADD_TAGS,_))),z(n,"ADD_ATTR")&&(typeof n.ADD_ATTR=="function"?Y.attributeCheck=n.ADD_ATTR:yt(n.ADD_ATTR)&&(C===te&&(C=F(C)),E(C,n.ADD_ATTR,_))),z(n,"ADD_FORBID_CONTENTS")&&yt(n.ADD_FORBID_CONTENTS)&&(dt===Ue&&(dt=F(dt)),E(dt,n.ADD_FORBID_CONTENTS,_)),ie&&(A["#text"]=!0),ot&&E(A,["html","head","body"]),A.table&&(E(A,["tbody"]),delete wt.tbody),n.TRUSTED_TYPES_POLICY){if(typeof n.TRUSTED_TYPES_POLICY.createHTML!="function")throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof n.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const d=P;P=n.TRUSTED_TYPES_POLICY;try{tt=st("")}catch(p){throw P=d,p}}else n.TRUSTED_TYPES_POLICY===null?(P=void 0,tt=""):(P===void 0&&(P=Vo()),P&&typeof tt=="string"&&(tt=st("")));M&&M(n),pt=n},Ve=E({},[...me,...ge,...Un]),Xe=E({},[...be,...jn]),pn=function(n,a,d){return a.namespaceURI===$?n==="svg":a.namespaceURI===Pt?n==="svg"&&(d==="annotation-xml"||le[d]):!!Ve[n]},fn=function(n,a,d){return a.namespaceURI===$?n==="math":a.namespaceURI===zt?n==="math"&&ce[d]:!!Xe[n]},hn=function(n,a,d){return a.namespaceURI===zt&&!ce[d]||a.namespaceURI===Pt&&!le[d]?!1:!Xe[n]&&(ln[n]||!Ve[n])},mn=function(n){let a=N(n);(!a||!a.tagName)&&(a={namespaceURI:ut,tagName:"template"});const d=_t(n.tagName),p=_t(a.tagName);return se[n.namespaceURI]?n.namespaceURI===zt?pn(d,a,p):n.namespaceURI===Pt?fn(d,a,p):n.namespaceURI===$?hn(d,a,p):!!(Tt==="application/xhtml+xml"&&se[n.namespaceURI]):!1},V=function(n){xt(t.removed,{element:n});try{N(n).removeChild(n)}catch(a){if(w(n),!N(n))throw X("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ze=function(n,a,d){try{v(n,a)}catch(p){try{n.removeAttribute(d)}catch(h){}}},Ht=function(n){Bt(n);const a=D(n);if(a){const p=[];it(a,h=>{xt(p,h)}),it(p,h=>{try{w(h)}catch(b){}})}const d=Vt(n);if(d)for(let p=d.length-1;p>=0;--p){const h=d[p],b=h&&h.name;typeof b=="string"&&Ze(n,h,b)}},nt=function(n,a,d){if(!d)try{d=a.getAttributeNode(n)}catch(p){d=null}xt(t.removed,{attribute:d||null,from:a});try{d?v(a,d):a.removeAttribute(n)}catch(p){try{a.removeAttribute(n)}catch(h){}}if(n==="is")if(lt||Rt)try{V(a)}catch(p){}else try{a.setAttribute(n,"")}catch(p){}},gn=function(n){const a=Vt(n);if(a)for(let d=a.length-1;d>=0;--d){const p=a[d],h=p&&p.name;typeof h!="string"||C[_(h)]||Ze(n,p,h)}},Bt=function(n){const a=[n];for(;a.length>0;){const d=a.pop();Et(d)===B.element&&gn(d);const p=D(d);if(p)for(let h=p.length-1;h>=0;--h)a.push(p[h])}},Je=function(n,a){return et?n==="patchsrc"?!0:n==="for"&&a!=="label"&&a!=="output":!1},bn=function(n){if(!et)return;const a=[n];for(;a.length>0;){const d=a.pop(),p=Et(d);if(p===B.processingInstruction||p===B.comment&&O(wo,d.data)){try{w(d)}catch(b){}continue}if(p===B.element){const b=d,y=_(Xt(d));try{b.hasAttribute&&b.hasAttribute("patchsrc")&&b.removeAttribute("patchsrc"),b.hasAttribute&&b.hasAttribute("for")&&Je("for",y)&&b.removeAttribute("for")}catch(S){}}const h=D(d);if(h)for(let b=h.length-1;b>=0;--b)a.push(h[b])}},Qe=function(n){let a=null,d=null;if(ne)n="<remove></remove>"+n;else{const b=uo(n,/^[\r\n\t ]+/);d=b&&b[0]}Tt==="application/xhtml+xml"&&ut===$&&(n='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+n+"</body></html>");const p=P?st(n):n;if(ut===$)try{a=new m().parseFromString(p,Tt)}catch(b){}if(!a||!a.documentElement){a=Jt.createDocument(ut,"template",null);try{a.documentElement.innerHTML=ae?tt:p}catch(b){}}const h=a.body||a.documentElement;return n&&d&&h.insertBefore(e.createTextNode(d),h.childNodes[0]||null),ut===$?Zo.call(a,ot?"html":"body")[0]:ot?a.documentElement:h},to=function(n){const a=Mt?Mt(n):n.ownerDocument;return Ie.call(a||n,n,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Ft=function(n){return n=At(n,Qo," "),n=At(n,tn," "),n=At(n,en," "),n},ue=function(n){var a;n.normalize();const d=Mt?Mt(n):n.ownerDocument,p=Ie.call(d||n,n,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let h=p.nextNode();for(;h;)h.data=Ft(h.data),h=p.nextNode();const b=(a=n.querySelectorAll)===null||a===void 0?void 0:a.call(n,"template");b&&it(b,y=>{ft(y.content)&&ue(y.content)})},Ut=function(n){const a=at?at(n):null;return typeof a!="string"||_(a)!=="form"?!1:typeof n.nodeName!="string"||typeof n.textContent!="string"||typeof n.removeChild!="function"||n.attributes!==Vt(n)||typeof n.removeAttribute!="function"||typeof n.removeAttributeNode!="function"||typeof n.getAttributeNode!="function"||typeof n.setAttribute!="function"||typeof n.namespaceURI!="string"||typeof n.insertBefore!="function"||typeof n.hasChildNodes!="function"||n.nodeType!==Q(n)||n.childNodes!==D(n)},ft=function(n){if(!Q||typeof n!="object"||n===null)return!1;try{return Q(n)===B.documentFragment}catch(a){return!1}},kt=function(n){if(!Q||typeof n!="object"||n===null)return!1;try{return typeof Q(n)=="number"}catch(a){return!1}};function G(u,n,a){u.length!==0&&it(u,d=>{d.call(t,n,a,pt)})}const yn=function(n,a){return!!(et&&n.hasChildNodes()&&!kt(n.firstElementChild)&&O(vo,n.textContent)&&O(vo,n.innerHTML)||et&&n.namespaceURI===$&&ti[a]&&(kt(n.firstElementChild)||typeof n.textContent=="string"&&O(ei[a],n.textContent))||n.nodeType===B.processingInstruction||et&&n.nodeType===B.comment&&O(wo,n.data))},jt=function(n,a){if(n instanceof RegExp)return O(n,a);if(n instanceof Function){for(var d=arguments.length,p=new Array(d>2?d-2:0),h=2;h<d;h++)p[h-2]=arguments[h];return!!n(a,...p)}return!1},En=function(n,a,d){if(!wt[a]&&io(a)&&jt(W.tagNameCheck,a))return!1;if(ie&&!dt[a]){const p=N(n),h=D(n);if(h&&p){const b=h.length;for(let y=b-1;y>=0;--y){const S=n===d?k(h[y],!0):h[y];p.insertBefore(S,K(n))}}}return V(n),!0},eo=function(n,a,d,p){return n.length===0?a:a===d||a===p?F(a):a},ht=function(n,a){return n===a||N(n)!==null?!1:(re&&Bt(n),!0)},oo=function(n,a){if(G(x.beforeSanitizeElements,n,null),ht(n,a))return!0;if(Ut(n))return V(n),!0;const d=_(Xt(n));if(A=eo(x.uponSanitizeElement,A,Qt,Ot),G(x.uponSanitizeElement,n,{tagName:d,allowedTags:A}),ht(n,a))return!0;if(yn(n,d))return V(n),!0;if(wt[d]||!(Y.tagCheck instanceof Function&&Y.tagCheck(d))&&!A[d]){const p=En(n,d,a);return p===!1&&(G(x.afterSanitizeElements,n,null),ht(n,a))?!0:p}if(Et(n)===B.element&&!mn(n)||(d==="noscript"||d==="noembed"||d==="noframes")&&O(Jn,n.innerHTML))return V(n),!0;if(q&&n.nodeType===B.text){const p=Ft(n.textContent);n.textContent!==p&&(xt(t.removed,{element:n.cloneNode()}),n.textContent=p)}return G(x.afterSanitizeElements,n,null),ht(n,a)},no=function(n,a,d){if(Re[a]||Je(a,n)||He&&(a==="id"||a==="name")&&(d in e||d in un))return!1;const p=C[a]||Y.attributeCheck instanceof Function&&Y.attributeCheck(a,n);return ee&&O(on,a)||Ne&&O(nn,a)?!0:p?$e[a]||O(De,At(d,Oe,""))||(a==="src"||a==="xlink:href"||a==="href")&&n!=="script"&&po(d,"data:")===0&&je[n]||Pe&&!O(rn,At(d,Oe,""))?!0:!d:io(n)&&jt(W.tagNameCheck,n)&&jt(W.attributeNameCheck,a,n)||a==="is"&&W.allowCustomizedBuiltInElements&&jt(W.tagNameCheck,d)},vn=E({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),io=function(n){return!vn[_t(n)]&&O(an,n)},wn=function(n,a,d,p){if(P&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!d)switch(g.getAttributeType(n,a)){case"TrustedHTML":return st(p);case"TrustedScriptURL":return qo(p)}return p},Tn=function(n,a,d,p){try{return d?n.setAttributeNS(d,a,p):n.setAttribute(a,p),Ut(n)?(V(n),!1):!0}catch(h){return nt(a,n),!1}},ro=function(n,a){if(G(x.beforeSanitizeAttributes,n,null),ht(n,a))return;const d=n.attributes;if(!d||Ut(n))return;C=eo(x.uponSanitizeAttribute,C,te,Dt);const p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0};let h=d.length;const b=_(n.nodeName);for(;h--;){const y=d[h],S=y.name,U=y.namespaceURI,H=y.value,mt=_(S),fe=H;let R=S==="value"?fe:Rn(fe),ao=!1;if(p.attrName=mt,p.attrValue=R,p.keepAttr=!0,p.forceKeepAttr=void 0,G(x.uponSanitizeAttribute,n,p),R=p.attrValue,Be&&(mt==="id"||mt==="name")&&po(R,Fe)!==0&&(nt(S,n,y),R=Fe+R,ao=!0),et&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,R)){nt(S,n,y);continue}if(mt==="attributename"&&uo(R,"href")){nt(S,n,y);continue}if(!p.forceKeepAttr){if(!p.keepAttr){nt(S,n,y);continue}if(!ze&&O(Qn,R)){nt(S,n,y);continue}if(q&&(R=Ft(R)),!no(b,mt,R)){nt(S,n,y);continue}R=wn(b,mt,U,R),R!==fe&&Tn(n,S,U,R)&&ao&&co(t.removed)}}G(x.afterSanitizeAttributes,n,null),ht(n,a)},Wt=function(n){let a=null;const d=to(n);for(G(x.beforeSanitizeShadowDOM,n,null);a=d.nextNode();)if(G(x.uponSanitizeShadowNode,a,null),oo(a,n),ro(a,n),ft(a.content)&&Wt(a.content),Et(a)===B.element){const p=_e(a);ft(p)&&(pe(p),Wt(p))}G(x.afterSanitizeShadowDOM,n,null)},pe=function(n){const a=[{node:n,shadow:null}];for(;a.length>0;){const d=a.pop();if(d.shadow){Wt(d.shadow);continue}const p=d.node,h=Et(p)===B.element,b=D(p);if(b)for(let y=b.length-1;y>=0;--y)a.push({node:b[y],shadow:null});if(h){const y=at?at(p):null;if(typeof y=="string"&&_(y)==="template"){const S=p.content;ft(S)&&a.push({node:S,shadow:null})}}if(h){const y=_e(p);ft(y)&&a.push({node:null,shadow:y},{node:y,shadow:null})}}};return t.sanitize=function(u){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,d=null,p=null,h=null;if(ae=!u,ae&&(u="<!-->"),typeof u!="string"&&!kt(u)&&(u=Bn(u),typeof u!="string"))throw X("dirty is not a string, aborting");if(!t.isSupported)return u;oe?(A=Ot,C=Dt):de(n),(x.uponSanitizeElement.length>0||x.uponSanitizeAttribute.length>0)&&(A=F(A)),x.uponSanitizeAttribute.length>0&&(C=F(C)),t.removed=[];const b=re&&typeof u!="string"&&kt(u);if(b){bn(u);const U=Xt(u);if(typeof U=="string"){const H=_(U);if(!A[H]||wt[H])throw Ht(u),X("root node is forbidden and cannot be sanitized in-place")}if(Ut(u))throw Ht(u),X("root node is clobbered and cannot be sanitized in-place");try{pe(u)}catch(H){throw Ht(u),H}}else if(kt(u))a=Qe("<!---->"),d=a.ownerDocument.importNode(u,!0),d.nodeType===B.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?a=d:a.appendChild(d),pe(a);else{if(!lt&&!q&&!ot&&u.indexOf("<")===-1)return P&&Nt?st(u):u;if(a=Qe(u),!a)return lt?null:Nt?tt:""}a&&ne&&V(a.firstChild);const y=b?u:a;try{const U=to(y);for(;p=U.nextNode();)oo(p,y),ro(p,y),ft(p.content)&&Wt(p.content)}catch(U){throw b&&(Ht(u),it(t.removed,H=>{H.element&&Bt(H.element)})),U}if(b){let U=!1;if(it(t.removed,H=>{H.element&&(H.element===u&&(U=!0),Bt(H.element))}),U)throw X("a node selected for removal could not be safely returned; refusing to sanitize in place");return q&&ue(u),u}if(lt){if(q&&ue(a),Rt)for(h=Xo.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return(C.shadowroot||C.shadowrootmode)&&(h=Jo.call(o,h,!0)),h}let S=ot?a.outerHTML:a.innerHTML;return ot&&A["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&O(Xn,a.ownerDocument.doctype.name)&&(S="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
11
|
+
`+S),q&&(S=Ft(S)),P&&Nt?st(S):S},t.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};de(u),oe=!0,Ot=A,Dt=C},t.clearConfig=function(){pt=null,oe=!1,Ot=null,Dt=null,P=Zt,tt=""},t.isValidAttribute=function(u,n,a){pt||de({});const d=_(u),p=_(n);return no(d,p,a)},t.addHook=function(u,n){typeof n=="function"&&z(x,u)&&xt(x[u],n)},t.removeHook=function(u,n){if(z(x,u)){if(n!==void 0){const a=On(x[u],n);return a===-1?void 0:Dn(x[u],a,1)[0]}return co(x[u])}},t.removeHooks=function(u){z(x,u)&&(x[u]=[])},t.removeAllHooks=function(){x=To()},t}var Gt=jo();const ii=["p","br","strong","em","u","s","strike","del","b","i","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","video","audio","table","thead","tbody","tr","th","td","blockquote","pre","code","span","div","section","figure","figcaption","sup","sub","hr"],ri={"*":["class","style","id","data-*","role","aria-*","tabindex","contenteditable","spellcheck","dir","lang"],a:["href","target","rel","title"],img:["src","alt","width","height","loading"],video:["src","controls","width","height","autoplay","loop","muted"],audio:["src","controls","autoplay","loop","muted"],ol:["start","reversed"],table:["border","cellpadding","cellspacing"],td:["colspan","rowspan","align","valign"],th:["colspan","rowspan","align","valign"],iframe:["src","width","height","name","title","frameborder","scrolling","allowfullscreen","longdesc","allow"]},ai="data-editora-embed";function si(s){if(!s||/\s/.test(s.trim()))return!1;try{const t=new URL(s.trim());return(t.protocol==="https:"||t.protocol==="http:")&&t.hostname.length>0}catch(t){return!1}}function Wo(s,t,e,o){if((t==null?void 0:t.sanitize)===!1)return s;const i=t!=null&&t.allowedTags&&t.allowedTags.length>0?t.allowedTags:ii,r=e!=null&&e.length?Array.from(new Set([...i,...e])):i,c=!!(t!=null&&t.allowedAttributes)&&Object.keys(t.allowedAttributes).length>0?t.allowedAttributes:ri,f=new Set;for(const T of Object.values(c))for(const k of T)f.add(k);const m={ALLOWED_TAGS:r,ALLOWED_ATTR:Array.from(f)};if(!o)return Gt.sanitize(s,m);const g=r.includes("iframe");Gt.addHook("uponSanitizeElement",(T,k)=>{var v;if(k.tagName!=="iframe")return;const w=T;k.allowedTags.iframe=g||((v=w.getAttribute)==null?void 0:v.call(w,ai))==="true"&&si(w.getAttribute("src"))});try{return Gt.sanitize(s,m)}finally{Gt.removeHook("uponSanitizeElement")}}function $o(s,t,e,o){return Wo(s,t,o,!1)}function Go(s,t,e){return(e==null?void 0:e.sanitizeOnPaste)===!1?s:$o(s,t)}function xe(s,t,e,o){return(e==null?void 0:e.sanitizeOnInput)===!1?s:Wo(s,t,o,!0)}const li=".resize-handle, .table-resize-handle, [data-rte-media-pending]",ci=/resize-handle|data-rte-media-pending|rte-media/;function Se(s){if(!s||!ci.test(s))return s;const t=document.createElement("template");t.innerHTML=s;const e=new Set;return t.content.querySelectorAll(li).forEach(o=>{const i=o.parentElement;i&&(i.tagName==="TD"||i.tagName==="TH")&&e.add(i),o.remove()}),e.forEach(o=>{var i;o.style.position==="relative"&&(o.style.removeProperty("position"),(i=o.getAttribute("style"))!=null&&i.trim()||o.removeAttribute("style"))}),t.content.querySelectorAll("figure.rte-media").forEach(o=>{var r;o.removeAttribute("contenteditable");const i=o.querySelector(":scope > figcaption");i&&(i.removeAttribute("contenteditable"),!((r=i.textContent)!=null&&r.trim())&&!i.querySelector("img, video, a")&&i.remove())}),t.innerHTML}function bt(s){return s?Se(s.innerHTML):""}const qt=class qt{static resolve(t){const e={};if(Object.assign(e,this.EDITOR_DEFAULTS),t.pluginDefaults&&Object.assign(e,t.pluginDefaults),t.attributes){const o=this.parseAttributes(t.attributes);Object.assign(e,o)}return t.jsConfig&&Object.assign(e,t.jsConfig),this.normalizeConfig(e)}static normalizeConfig(t){const e={...t};if(e.toolbarFloating!==void 0||e.toolbarSticky!==void 0){const l=typeof e.toolbar=="object"&&e.toolbar?{...e.toolbar}:typeof e.toolbar=="string"?{items:e.toolbar}:{};e.toolbarFloating!==void 0&&(l.floating=!!e.toolbarFloating),e.toolbarSticky!==void 0&&(l.sticky=!!e.toolbarSticky),e.toolbar=l}if(e.toolbarItems!==void 0&&typeof e.toolbar=="object"&&e.toolbar&&(e.toolbar.items=e.toolbarItems),e.autosaveEnabled!==void 0||e.autosaveIntervalMs!==void 0||e.autosaveStorageKey!==void 0||e.autosaveProvider!==void 0||e.autosaveApiUrl!==void 0){const l=typeof e.autosave=="object"&&e.autosave?{...e.autosave}:{};e.autosaveEnabled!==void 0&&(l.enabled=!!e.autosaveEnabled),e.autosaveIntervalMs!==void 0&&(l.intervalMs=Number(e.autosaveIntervalMs)),e.autosaveStorageKey!==void 0&&(l.storageKey=e.autosaveStorageKey),e.autosaveProvider!==void 0&&(l.provider=e.autosaveProvider),e.autosaveApiUrl!==void 0&&(l.apiUrl=e.autosaveApiUrl),e.autosave=l}const o={enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage",apiUrl:""};if(typeof e.autosave=="boolean")e.autosave={...o,enabled:e.autosave};else if(typeof e.autosave=="object"&&e.autosave){const l={...o,...e.autosave};l.intervalMs===void 0&&l.interval!==void 0&&(l.intervalMs=Number(l.interval)),l.enabled===void 0&&(l.enabled=!0),(!Number.isFinite(l.intervalMs)||l.intervalMs<=0)&&(l.intervalMs=o.intervalMs),e.autosave=l}else e.autosave=o;if(e.languageLocale!==void 0||e.languageDirection!==void 0){const l=typeof e.language=="object"&&e.language?{...e.language}:{};e.languageLocale!==void 0&&(l.locale=e.languageLocale),e.languageDirection!==void 0&&(l.direction=e.languageDirection),e.language=l}const i={locale:"en",direction:"ltr"};if(typeof e.language=="string"?e.language={locale:e.language,direction:i.direction}:typeof e.language=="object"&&e.language?e.language={...i,...e.language}:e.language=i,e.spellcheckEnabled!==void 0||e.spellcheckProvider!==void 0||e.spellcheckApiUrl!==void 0){const l=typeof e.spellcheck=="object"&&e.spellcheck?{...e.spellcheck}:{};e.spellcheckEnabled!==void 0&&(l.enabled=!!e.spellcheckEnabled),e.spellcheckProvider!==void 0&&(l.provider=e.spellcheckProvider),e.spellcheckApiUrl!==void 0&&(l.apiUrl=e.spellcheckApiUrl),e.spellcheck=l}const r={enabled:!1,provider:"browser",apiUrl:""};if(typeof e.spellcheck=="boolean")e.spellcheck={...r,enabled:e.spellcheck};else if(typeof e.spellcheck=="object"&&e.spellcheck){const l={...r,...e.spellcheck};!l.provider&&l.mode&&(l.provider=l.mode==="local"?"browser":"api"),l.enabled===void 0&&(l.enabled=!!(l.mode||l.provider||l.apiUrl)),e.spellcheck=l}else e.spellcheck=r;return e.contextMenuEnabled!==void 0&&(e.contextMenu={enabled:!!e.contextMenuEnabled}),typeof e.contextMenu=="boolean"?e.contextMenu={enabled:e.contextMenu}:typeof e.contextMenu=="object"&&e.contextMenu?e.contextMenu={enabled:e.contextMenu.enabled!==!1}:e.contextMenu={enabled:!0},(e.pasteClean!==void 0||e.pasteKeepFormatting!==void 0||e.pasteConvertWord!==void 0)&&(e.paste={...e.paste||{},...e.pasteClean!==void 0?{clean:!!e.pasteClean}:{},...e.pasteKeepFormatting!==void 0?{keepFormatting:!!e.pasteKeepFormatting}:{},...e.pasteConvertWord!==void 0?{convertWord:!!e.pasteConvertWord}:{}}),e.paste={clean:!0,keepFormatting:!1,convertWord:!0,...e.paste||{}},e.contentConfig={allowedTags:[],allowedAttributes:{},sanitize:!0,...e.contentConfig||{}},(e.securitySanitizeOnPaste!==void 0||e.securitySanitizeOnInput!==void 0)&&(e.security={...e.security||{},...e.securitySanitizeOnPaste!==void 0?{sanitizeOnPaste:!!e.securitySanitizeOnPaste}:{},...e.securitySanitizeOnInput!==void 0?{sanitizeOnInput:!!e.securitySanitizeOnInput}:{}}),e.security={sanitizeOnPaste:!0,sanitizeOnInput:!0,...e.security||{}},(e.accessibilityEnableAria!==void 0||e.accessibilityKeyboardNavigation!==void 0||e.accessibilityChecker!==void 0)&&(e.accessibility={...e.accessibility||{},...e.accessibilityEnableAria!==void 0?{enableARIA:!!e.accessibilityEnableAria}:{},...e.accessibilityKeyboardNavigation!==void 0?{keyboardNavigation:!!e.accessibilityKeyboardNavigation}:{},...e.accessibilityChecker!==void 0?{checker:!!e.accessibilityChecker}:{}}),typeof e.accessibility=="boolean"&&(e.accessibility={enableARIA:e.accessibility,keyboardNavigation:e.accessibility,checker:!1}),e.accessibility={enableARIA:!0,keyboardNavigation:!0,checker:!1,...e.accessibility||{}},(e.performanceDebounceInputMs!==void 0||e.performanceViewportOnlyScan!==void 0)&&(e.performance={...e.performance||{},...e.performanceDebounceInputMs!==void 0?{debounceInputMs:Number(e.performanceDebounceInputMs)}:{},...e.performanceViewportOnlyScan!==void 0?{viewportOnlyScan:!!e.performanceViewportOnlyScan}:{}}),typeof e.performance=="boolean"&&(e.performance={debounceInputMs:100,viewportOnlyScan:e.performance}),e.performance={debounceInputMs:100,viewportOnlyScan:!0,...e.performance||{}},(typeof e.performance.debounceInputMs!="number"||!Number.isFinite(e.performance.debounceInputMs)||e.performance.debounceInputMs<0)&&(e.performance.debounceInputMs=100),e}static parseAttributes(t){const e={};for(const[o,i]of Object.entries(t)){const r=this.kebabToCamel(o);e[r]=this.BOOLEAN_ATTRIBUTES.has(o)&&(i===""||i===o)?!0:this.parseAttributeValue(i)}return e}static parseAttributeValue(t){if(t==="true")return!0;if(t==="false")return!1;if(/^\d+$/.test(t))return parseInt(t,10);if(/^\d+\.\d+$/.test(t))return parseFloat(t);if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(t)}catch(e){return t}return t}static kebabToCamel(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}static validate(t){const e=[];return t.height!==void 0&&typeof t.height=="number"&&t.height<0&&e.push("height must be a positive number"),t.width!==void 0&&typeof t.width=="number"&&t.width<0&&e.push("width must be a positive number"),t.plugins!==void 0&&!Array.isArray(t.plugins)&&typeof t.plugins!="string"&&e.push("plugins must be an array or string"),t.theme!==void 0&&typeof t.theme!="string"&&e.push("theme must be a string"),{valid:e.length===0,errors:e}}static getDefaults(){return{...this.EDITOR_DEFAULTS}}static merge(...t){const e={};for(const o of t)for(const[i,r]of Object.entries(o))r!=null&&(typeof r=="object"&&!Array.isArray(r)&&e[i]?e[i]=this.merge(e[i],r):e[i]=r);return e}};qt.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!0,toolbar:!0,plugins:[],theme:"light",content:"",placeholder:"Start typing...",autofocus:!1,autosave:!1,accessibility:{enableARIA:!0,keyboardNavigation:!0,checker:!1},performance:{debounceInputMs:100,viewportOnlyScan:!0},spellcheck:{enabled:!1,provider:"browser",apiUrl:""},language:{locale:"en",direction:"ltr"},contextMenu:{enabled:!0},contentConfig:{allowedTags:[],allowedAttributes:{},sanitize:!0},paste:{clean:!0,keepFormatting:!1,convertWord:!0},security:{sanitizeOnPaste:!0,sanitizeOnInput:!0},statusbar:!1},qt.BOOLEAN_ATTRIBUTES=new Set(["readonly","disabled","autofocus","statusbar","toolbar-floating","toolbar-sticky","autosave-enabled","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance-viewport-only-scan","spellcheck-enabled","context-menu-enabled","paste-clean","paste-keep-formatting","paste-convert-word","security-sanitize-on-paste","security-sanitize-on-input"]);let Yt=qt;class Ko{constructor(){this.loadedPlugins=new Map,this.pluginRegistry=new Map}register(t,e){this.pluginRegistry.set(t,e)}async load(t,e){if(this.loadedPlugins.has(t))return this.loadedPlugins.get(t);const o=this.pluginRegistry.get(t);if(!o)return console.warn(`Plugin not found: ${t}`),null;const i=await o();return e&&this.applyPluginConfig(i,e),this.loadedPlugins.set(t,i),i}async loadMultiple(t,e){return(await Promise.all(t.map(i=>this.load(i,e)))).filter(i=>i!==null)}async parsePluginString(t,e){const o=t.split(/\s+/).filter(Boolean);return this.loadMultiple(o,e)}applyPluginConfig(t,e){t.__pluginConfig=e}unload(t){this.loadedPlugins.delete(t)}clear(){this.loadedPlugins.clear()}getLoadedPlugins(){return Array.from(this.loadedPlugins.values())}getRegisteredPluginNames(){return Array.from(this.pluginRegistry.keys())}isLoaded(t){return this.loadedPlugins.has(t)}}const di='.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';let Kt;const ui="__editoraCommandEditorRoot",pi="__editoraLastCommandButton",ko="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",xo=".rte-content, .editora-content",fi="Rich text editor",Ae=new Set;let J=null,Ao=!1,ve=null,we=null;function Co(s){if(!(s instanceof HTMLElement))return!1;const t=s;return typeof t.execCommand=="function"&&(t.tagName.toLowerCase()==="editora-editor"||t.classList.contains("editora-editor")||t.hasAttribute("data-editora-editor"))}function hi(s){return s?s.nodeType===Node.ELEMENT_NODE?s:s.parentElement:null}function St(s){if(!s)return null;if(Co(s))return s;const t=s.matches(ko)?s:s.closest(ko);return!t||!Co(t)?null:t}function mi(){var i;if(typeof window=="undefined")return null;const s=window[ui];if(s instanceof HTMLElement){const r=St(s);if(r)return r;const l=s.matches(xo)?s:s.querySelector(xo);if(l){const c=St(l);if(c)return c}}const t=window[pi];if(t instanceof HTMLElement){const r=St(t);if(r)return r}const e=document.activeElement;if(e){const r=St(e);if(r)return r}const o=(i=window.getSelection)==null?void 0:i.call(window);if(o&&o.rangeCount>0){const r=St(hi(o.getRangeAt(0).startContainer));if(r)return r}if(J&&J.isConnected)return J;for(const r of Ae)if(r.isConnected)return r;return null}function gi(){if(typeof window=="undefined"||Ao)return;ve=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,we=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const s=(t,...e)=>{const o=mi();return o?o.execCommand(t,...e):ve?ve(t,...e):we?we(t,...e):!1};window.executeEditorCommand=s,window.execEditorCommand=s,Ao=!0}function bi(){const s="editora-webcomponent-styles";if(!document.getElementById(s)){const t=document.createElement("style");t.id=s,t.textContent=di,document.head.appendChild(t)}}function Yo(){if(!Kt){const s=rt.__globalPluginLoader;s?Kt=s:Kt=new Ko}return Kt}function yi(s){const t=Yo();Object.entries(s).forEach(([e,o])=>{t.register(e,o)})}class rt extends HTMLElement{constructor(){if(super(),this.pluginLoader=Yo(),this.config={},this.isInitialized=!1,this.keyboardShortcutManager=new _o,this.lastAutosavedContent="",this.preservedContent=null,this.loadedPlugins=[],this.lastBeforeInputType=null,this.pendingHistorySnapshot=null,bi(),!this.hasAttribute("data-initial-content")){const t=this.innerHTML.trim();t&&this.setAttribute("data-initial-content",t)}}static get observedAttributes(){return["height","width","menubar","plugins","toolbar","toolbar-items","toolbar-floating","toolbar-sticky","readonly","disabled","theme","placeholder","aria-label","autofocus","autosave","autosave-enabled","autosave-interval-ms","autosave-storage-key","autosave-provider","autosave-api-url","accessibility","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance","performance-debounce-input-ms","performance-viewport-only-scan","language","language-locale","language-direction","spellcheck","spellcheck-enabled","spellcheck-provider","context-menu","context-menu-enabled","paste","paste-clean","paste-keep-formatting","paste-convert-word","security","security-sanitize-on-paste","security-sanitize-on-input","statusbar"]}connectedCallback(){this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(rt.__globalPluginLoader){this.pluginLoader=rt.__globalPluginLoader;return}return new Promise(t=>{const e=()=>{rt.__globalPluginLoader?(this.pluginLoader=rt.__globalPluginLoader,t()):setTimeout(e,0)};e()})}disconnectedCallback(){this.destroy()}attributeChangedCallback(t,e,o){e!==o&&(this.config=this.resolveConfig(),this.handleAttributeChange(t,o))}async setConfig(t){this.jsConfig=t,this.config=this.resolveConfig(),this.isConnected&&(this.destroy(),await this.waitForPluginLoader(),await this.initialize())}async initialize(){var i;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;this.setAttribute("data-editora-editor","true"),Ae.add(this),J||(J=this),gi(),this.config.height&&(this.style.height=typeof this.config.height=="number"?`${this.config.height}px`:this.config.height),this.config.width&&(this.style.width=typeof this.config.width=="number"?`${this.config.width}px`:this.config.width),this.classList.add("editora-editor"),this.config.theme&&this.classList.add(`editora-theme-${this.config.theme}`);const t=await this.loadPlugins();if(this.loadedPlugins=t,t.forEach(r=>{if(r.init&&typeof r.init=="function")try{r.init({editorElement:this})}catch(l){console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`,l)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const r=this.innerHTML.trim();r&&this.setAttribute("data-initial-content",r)}const e=this.preservedContent;this.preservedContent=null;const o=this.sanitizeLoadedContent((i=e!=null?e:this.restoreAutosavedContent())!=null?i:this.getAttribute("data-initial-content")||"");this.engine=new Mo({content:o,plugins:t,readonly:this.config.readonly}),this.createUI(t,o),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.dispatchEvent(new CustomEvent("editor-ready",{detail:{api:this.getAPI()},bubbles:!0}))}getInitialContent(){if(this.config.content)return this.config.content;const t=this.querySelector("[slot]");return t?t.innerHTML:this.hasChildNodes()?Array.from(this.childNodes).map(o=>o.nodeType===Node.TEXT_NODE?o.textContent:o.nodeType===Node.ELEMENT_NODE?o.outerHTML:"").join("").trim():""}async loadPlugins(){this.pluginLoader||await this.waitForPluginLoader();const t=[],e=this.config.plugins&&(typeof this.config.plugins=="string"&&this.config.plugins.length>0||Array.isArray(this.config.plugins)&&this.config.plugins.length>0),i=this.getAccessibilityConfig().checker===!0;if(e){if(typeof this.config.plugins=="string"){const r=this.config.plugins.split(/\s+/).filter(Boolean);i&&!r.includes("a11yChecker")&&r.push("a11yChecker");for(const l of r){const c=await this.pluginLoader.load(l,this.getPluginLoadConfig(l));c&&t.push(c)}}else if(Array.isArray(this.config.plugins)){for(const r of this.config.plugins)if(typeof r=="string"){const l=await this.pluginLoader.load(r,this.getPluginLoadConfig(r));l&&t.push(l)}else t.push(r);if(i&&!t.some(r=>(r==null?void 0:r.name)==="a11yChecker")){const r=await this.pluginLoader.load("a11yChecker",this.getPluginLoadConfig("a11yChecker"));r&&t.push(r)}}}else{const r=this.pluginLoader.getRegisteredPluginNames();for(const l of r){const c=await this.pluginLoader.load(l,this.getPluginLoadConfig(l));c&&t.push(c)}}return t}resolveToolbarItems(){const t=this.config.toolbarItems;if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");const e=this.config.toolbar;if(typeof e=="string")return e;if(!e||typeof e!="object")return;const o=e.items;if(typeof o=="string")return o;if(Array.isArray(o))return o.join(" ")}isToolbarStickyEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.sticky}isToolbarFloatingEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.floating}isStatusbarEnabled(){const t=this.config.statusbar;return typeof t=="boolean"?t:t&&typeof t=="object"?t.enabled!==!1:!1}getStatusbarPosition(){const t=this.config.statusbar;return t&&typeof t=="object"&&t.position==="top"?"top":"bottom"}getLanguageConfig(){const t=this.config.language;return typeof t=="string"?{locale:t,direction:"ltr"}:t&&typeof t=="object"?{locale:t.locale||"en",direction:t.direction==="rtl"?"rtl":"ltr"}:{locale:"en",direction:"ltr"}}getAccessibilityConfig(){const t=this.config.accessibility;return typeof t=="boolean"?{enableARIA:t,keyboardNavigation:t,checker:!1}:t&&typeof t=="object"?{enableARIA:t.enableARIA!==!1,keyboardNavigation:t.keyboardNavigation!==!1,checker:!!t.checker}:{enableARIA:!0,keyboardNavigation:!0,checker:!1}}getPerformanceConfig(){var e;const t=this.config.performance;if(typeof t=="boolean")return{debounceInputMs:100,viewportOnlyScan:t};if(t&&typeof t=="object"){const o=Number((e=t.debounceInputMs)!=null?e:100);return{debounceInputMs:Number.isFinite(o)&&o>=0?o:100,viewportOnlyScan:t.viewportOnlyScan!==!1}}return{debounceInputMs:100,viewportOnlyScan:!0}}isEditorInViewport(){if(!this.contentElement||typeof window=="undefined")return!0;const t=this.contentElement.getBoundingClientRect();return t.bottom>=0&&t.top<=window.innerHeight}applyAccessibilitySettings(){var e;if(!this.contentElement)return;const t=this.getAccessibilityConfig();if(t.enableARIA){this.contentElement.setAttribute("role","textbox"),this.contentElement.setAttribute("aria-multiline","true"),this.contentElement.setAttribute("aria-disabled",this.config.readonly?"true":"false");const o=(e=this.getAttribute("aria-label"))==null?void 0:e.trim(),i=typeof this.config.placeholder=="string"?this.config.placeholder.trim():"";this.contentElement.setAttribute("aria-label",o||i||fi)}else this.contentElement.removeAttribute("role"),this.contentElement.removeAttribute("aria-multiline"),this.contentElement.removeAttribute("aria-disabled"),this.contentElement.removeAttribute("aria-label");this.contentElement.tabIndex=t.keyboardNavigation?0:-1}applyLanguageSettings(){if(!this.contentElement)return;const t=this.getLanguageConfig();this.contentElement.setAttribute("lang",t.locale),this.contentElement.setAttribute("dir",t.direction)}getSpellcheckConfig(){const t=this.config.spellcheck;if(typeof t=="boolean")return{enabled:t,provider:"browser"};if(t&&typeof t=="object"){const e=t.provider||"browser";return{enabled:!!t.enabled,provider:e,mode:t.mode}}return{enabled:!1,provider:"browser"}}applySpellcheckSettings(){if(!this.contentElement)return;const t=this.getSpellcheckConfig(),e=t.enabled&&t.provider==="browser";this.contentElement.spellcheck=e,this.contentElement.setAttribute("spellcheck",e?"true":"false")}executeCommand(t,...e){var r;typeof window!="undefined"&&(window.__editoraCommandEditorRoot=this);const o={editorElement:this,contentElement:this.contentElement,toolbarElement:this.toolbarElement},i=this.loadedPlugins.find(l=>l.commands&&l.commands[t]);if(i&&i.commands){const l=i.commands[t];if(typeof l=="function")try{return t==="toggleFullscreen"?l(this,o):l(...e,o),!0}catch(c){return console.error(`[RichTextEditor] Error executing native command ${t}:`,c),!1}}return((r=this.engine)==null?void 0:r.execCommand(t,...e))||!1}getPluginLoadConfig(t){const e=this.config.pluginConfig;if(e&&typeof e=="object"){const r=e[t];if(r&&typeof r=="object")return r}const o={spellCheck:["spellcheck","spellCheck"],trackChanges:["trackchanges","track-changes","trackChanges"],versionDiff:["versiondiff","version-diff","versionDiff"],"version-diff":["versiondiff","version-diff","versionDiff"],conditionalContent:["conditionalcontent","conditional-content","conditionalContent"],"conditional-content":["conditionalcontent","conditional-content","conditionalContent"],dataBinding:["databinding","data-binding","dataBinding"],"data-binding":["databinding","data-binding","dataBinding"],contentRules:["contentrules","content-rules","contentRules"],"content-rules":["contentrules","content-rules","contentRules"],mentions:["mention","mentions"],mention:["mention","mentions"],slashCommands:["slashcommands","slash-commands","slashCommands"],"slash-commands":["slashcommands","slash-commands","slashCommands"],formatPainter:["formatpainter","format-painter","formatPainter"],"format-painter":["formatpainter","format-painter","formatPainter"]},i=[t,t.toLowerCase(),...o[t]||[]];for(const r of i){const l=this.config[r];if(l&&typeof l=="object"&&!Array.isArray(l))return l}}getContentSanitizeConfig(){const t=this.config.contentConfig;return t&&typeof t=="object"?t:{sanitize:!0}}getSecurityConfig(){const t=this.config.security;return t&&typeof t=="object"?t:{sanitizeOnPaste:!0,sanitizeOnInput:!0}}sanitizeLoadedContent(t){return xe(t,this.getContentSanitizeConfig(),this.getSecurityConfig())}getAutosaveConfig(){var e,o;const t=this.config.autosave;if(typeof t=="boolean")return{enabled:t,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"};if(t&&typeof t=="object"){const i=Number((o=(e=t.intervalMs)!=null?e:t.interval)!=null?o:3e4);return{enabled:!!t.enabled,intervalMs:Number.isFinite(i)&&i>0?i:3e4,storageKey:String(t.storageKey||"rte-autosave"),provider:t.provider||"localStorage",apiUrl:t.apiUrl}}return{enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"}}persistAutosave(t){const e=this.getAutosaveConfig();if(e.enabled&&t!==this.lastAutosavedContent){if(this.lastAutosavedContent=t,e.provider==="localStorage"){try{localStorage.setItem(e.storageKey,t),localStorage.setItem(`${e.storageKey}-timestamp`,Date.now().toString())}catch(o){console.error("[RichTextEditor] Failed to save autosave content to localStorage:",o)}return}e.provider==="api"&&e.apiUrl&&fetch(e.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,timestamp:Date.now()})}).catch(o=>{console.error("[RichTextEditor] Failed to save autosave content to API:",o)})}}restoreAutosavedContent(){const t=this.getAutosaveConfig();if(!t.enabled||t.provider!=="localStorage")return null;try{const e=localStorage.getItem(t.storageKey);if(e)return this.lastAutosavedContent=e,e}catch(e){console.error("[RichTextEditor] Failed to restore autosaved content:",e)}return null}stopAutosave(){this.autosaveTimer&&(clearInterval(this.autosaveTimer),this.autosaveTimer=void 0)}startAutosave(){this.stopAutosave();const t=this.getAutosaveConfig();!t.enabled||!this.contentElement||(this.autosaveTimer=setInterval(()=>{this.persistAutosave(bt(this.contentElement))},t.intervalMs))}insertHTMLAtSelection(t){if(!this.contentElement)return;const e=window.getSelection();if(e&&e.rangeCount>0){const o=e.getRangeAt(0);o.deleteContents();const i=document.createElement("div");i.innerHTML=t;const r=document.createDocumentFragment();for(;i.firstChild;)r.appendChild(i.firstChild);o.insertNode(r),o.collapse(!1),e.removeAllRanges(),e.addRange(o)}else this.contentElement.focus(),document.execCommand("insertHTML",!1,t)}createUI(t,e){const o=this.querySelector('[slot="toolbar"]'),i=this.querySelector('[slot="statusbar"]');this.innerHTML="",this.config.toolbar!==!1&&!o?(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.appendChild(this.toolbarElement),this.toolbar=new Io({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},t,this.pluginLoader),this.toolbar.setCommandHandler((r,l)=>{var c;if(this.contentElement){this.contentElement.focus();const f=window.getSelection();if(!f||f.rangeCount===0||!this.contentElement.contains(f.anchorNode)){const m=document.createRange(),g=this.contentElement.lastChild||this.contentElement;g.nodeType===Node.TEXT_NODE?m.setStart(g,((c=g.textContent)==null?void 0:c.length)||0):g.nodeType===Node.ELEMENT_NODE?(m.selectNodeContents(g),m.collapse(!1)):m.setStart(this.contentElement,0),m.collapse(!0),f==null||f.removeAllRanges(),f==null||f.addRange(m)}}return this.executeCommand(r,l)}),this.toolbar.render(this.toolbarElement)):o&&this.appendChild(o),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content rte-content",this.contentElement.contentEditable=this.config.readonly?"false":"true",this.applyLanguageSettings(),this.applyAccessibilitySettings(),this.applySpellcheckSettings(),this.config.placeholder&&this.contentElement.setAttribute("data-placeholder",this.config.placeholder);try{document.execCommand("defaultParagraphSeparator",!1,"p")}catch(r){console.warn("defaultParagraphSeparator not supported:",r)}if(e){const r=document.createElement("div");r.innerHTML=e.trim(),!Array.from(r.childNodes).some(c=>{if(c.nodeType===Node.ELEMENT_NODE){const f=c.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(f)}return!1})&&e.trim()?this.contentElement.innerHTML=`<p>${e.trim()}</p>`:this.contentElement.innerHTML=e}else this.config.placeholder?this.contentElement.innerHTML="":this.contentElement.innerHTML="<p><br></p>";this.appendChild(this.contentElement),this.isToolbarFloatingEnabled()&&(this.floatingToolbar=new Oo({enabled:!0}),this.floatingToolbar.create(this)),i?this.appendChild(i):this.isStatusbarEnabled()&&(this.statusBarElement=document.createElement("div"),this.statusBarElement.className="editora-statusbar-container",this.appendChild(this.statusBarElement),this.statusBar=new Do({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.config.autofocus&&setTimeout(()=>{var r;return(r=this.contentElement)==null?void 0:r.focus()},0)}recordInputHistory(t){const e=this.pendingHistorySnapshot;if(this.pendingHistorySnapshot=null,!e||!this.contentElement||e.beforeHTML===t)return;const o=window.execEditorCommand;typeof o=="function"&&o("recordDomTransaction",this.contentElement,e.beforeHTML,t,{inputType:e.inputType,data:e.data,selectionCollapsed:e.selectionCollapsed})}setupEventListeners(){if(!this.contentElement||!this.engine)return;const t=this.keyboardShortcutManager;this.contentElement.addEventListener("beforeinput",o=>{var i,r;this.lastBeforeInputType=o.inputType||null,o.inputType==="historyUndo"||o.inputType==="historyRedo"?this.pendingHistorySnapshot=null:this.contentElement&&(this.pendingHistorySnapshot={beforeHTML:this.contentElement.innerHTML,inputType:o.inputType||null,data:typeof o.data=="string"?o.data:null,selectionCollapsed:(r=(i=window.getSelection())==null?void 0:i.isCollapsed)!=null?r:!0})}),this.contentElement.addEventListener("input",o=>{var k;if(!this.contentElement)return;let i=this.contentElement.innerHTML;const r=(k=o==null?void 0:o.detail)==null?void 0:k.allowedTags,l=this.getPerformanceConfig(),c=this.getContentSanitizeConfig(),f=this.getSecurityConfig(),m=this.lastBeforeInputType;if(this.lastBeforeInputType=null,f.sanitizeOnInput!==!1&&c.sanitize!==!1&&!m){const w=xe(i,c,f,r);if(w!==i){const v=window.getSelection(),K=v&&v.rangeCount>0?v.getRangeAt(0):null;if(this.contentElement.innerHTML=w,K&&v)try{v.removeAllRanges(),v.addRange(K)}catch(D){}i=w}}this.recordInputHistory(i),this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const T=()=>{this.dispatchEvent(new CustomEvent("content-change",{detail:{html:Se(i)},bubbles:!0}))};l.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(T,l.debounceInputMs):T(),this.updateStatusBar()}),this.contentElement.addEventListener("contextmenu",o=>{const i=this.config.contextMenu;(i===!1||typeof i=="object"&&i!==null&&i.enabled===!1)&&o.preventDefault()}),this.contentElement.addEventListener("paste",o=>{var g,T;if(o.__editoraSmartPasteHandled===!0||o.defaultPrevented)return;o.preventDefault();const i=this.config.paste||{};let r=((g=o.clipboardData)==null?void 0:g.getData("text/html"))||"";const l=((T=o.clipboardData)==null?void 0:T.getData("text/plain"))||"",c=this.getContentSanitizeConfig(),f=this.getSecurityConfig(),m=!!r&&/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);if((i.clean||!i.keepFormatting)&&l){document.execCommand("insertText",!1,l);return}if(i.convertWord===!1&&m&&l){document.execCommand("insertText",!1,l);return}if(r){f.sanitizeOnPaste!==!1&&c.sanitize!==!1&&(r=Go(r,c,f)),this.insertHTMLAtSelection(r);return}l&&document.execCommand("insertText",!1,l)}),this.contentElement.addEventListener("focus",()=>{J=this,this.dispatchEvent(new Event("editor-focus",{bubbles:!0})),this.updateStatusBar()}),this.contentElement.addEventListener("blur",()=>{this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.dispatchEvent(new CustomEvent("content-change",{detail:{html:bt(this.contentElement)},bubbles:!0})),this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",o=>{this.getAccessibilityConfig().keyboardNavigation&&t.handleKeyDown(o,(r,l)=>{this.executeCommand(r,l)})});const e=()=>{const o=this.getSelectionRangeInEditor(),i=document.activeElement,r=!!i&&!!this.contentElement&&(i===this.contentElement||this.contentElement.contains(i));this.getPerformanceConfig().viewportOnlyScan&&!this.isEditorInViewport()&&!r||!o&&!r||(this.updateFloatingToolbar(),this.updateStatusBar())};this.selectionChangeHandler=e,document.addEventListener("selectionchange",this.selectionChangeHandler)}getSelectionRangeInEditor(){if(!this.contentElement)return null;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0),o=e.commonAncestorContainer;return this.contentElement.contains(o)?e:null}isSelectionBackward(t){if(!t.anchorNode||!t.focusNode)return!1;try{const e=document.createRange();return e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset),e.collapsed}catch(e){return!1}}getSelectionAnchorRect(t,e){const o=Array.from(e.getClientRects()).filter(r=>r.width>0||r.height>0);return o.length===0?e.getBoundingClientRect():this.isSelectionBackward(t)?o[0]:o[o.length-1]}updateFloatingToolbar(){if(!this.floatingToolbar||!this.contentElement)return;if(this.config.readonly||this.contentElement.contentEditable==="false"||this.contentElement.getAttribute("data-readonly")==="true"||this.isReadonlyAttribute(this.getAttribute("readonly"))||this.getAttribute("data-readonly")==="true"){this.floatingToolbar.hide();return}const e=this.getPerformanceConfig(),o=document.activeElement===this.contentElement||!!this.contentElement&&this.contentElement.contains(document.activeElement);if(e.viewportOnlyScan&&!this.isEditorInViewport()&&!o){this.floatingToolbar.hide();return}const i=this.getSelectionRangeInEditor();if(!i){this.floatingToolbar.hide();return}if(i.collapsed){this.floatingToolbar.hide();return}const r=window.getSelection();if(!r){this.floatingToolbar.hide();return}const l=this.getSelectionAnchorRect(r,i);if(!l){this.floatingToolbar.hide();return}this.floatingToolbar.show(l.left,l.top-40)}updateStatusBar(){if(!this.statusBar||!this.contentElement)return;const t=this.getPerformanceConfig(),e=document.activeElement===this.contentElement||this.contentElement.contains(document.activeElement);if(t.viewportOnlyScan&&!this.isEditorInViewport()&&!e)return;const o=this.contentElement.textContent||"",{words:i,chars:r}=zo(o),l=Po(this.contentElement);let c,f;const m=this.getSelectionRangeInEditor();m&&(c=Ro(this.contentElement,m),m.collapsed||(f=Ho(m,c),c=void 0)),this.statusBar.update({wordCount:i,charCount:r,lineCount:l,cursorPosition:c,selectionInfo:f})}isReadonlyAttribute(t){return t!==null&&t!=="false"}handleAttributeChange(t,e){switch(t){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(e)?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(e));break;case"theme":this.classList.forEach(o=>{o.startsWith("editora-theme-")&&this.classList.remove(o)}),e&&this.classList.add(`editora-theme-${e}`);break;case"placeholder":this.contentElement&&(this.contentElement.setAttribute("data-placeholder",e),this.applyAccessibilitySettings());break;case"aria-label":case"accessibility":case"accessibility-enable-aria":case"accessibility-keyboard-navigation":case"accessibility-checker":this.applyAccessibilitySettings();break;case"performance":case"performance-debounce-input-ms":case"performance-viewport-only-scan":break;case"language":case"language-locale":case"language-direction":this.applyLanguageSettings();break;case"spellcheck":case"spellcheck-enabled":case"spellcheck-provider":this.applySpellcheckSettings();break;case"autosave":case"autosave-enabled":case"autosave-interval-ms":case"autosave-storage-key":case"autosave-provider":case"autosave-api-url":this.startAutosave();break;case"security":case"security-sanitize-on-paste":case"security-sanitize-on-input":case"paste":case"paste-clean":case"paste-keep-formatting":case"paste-convert-word":case"context-menu":case"context-menu-enabled":break;case"toolbar":case"toolbar-items":case"toolbar-floating":case"toolbar-sticky":case"plugins":case"statusbar":this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(o=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",o)})}));break}}resolveConfig(){const t={};for(let e=0;e<this.attributes.length;e++){const o=this.attributes[e];t[o.name]=o.value}return Yt.resolve({jsConfig:this.jsConfig,attributes:t})}getAPI(){return{getContent:()=>bt(this.contentElement),setContent:t=>{this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))},execCommand:(t,e)=>this.executeCommand(t,e),focus:()=>{var t;(t=this.contentElement)==null||t.focus()},blur:()=>{var t;(t=this.contentElement)==null||t.blur()},destroy:()=>{this.destroy()},on:(t,e)=>(this.addEventListener(t,e),()=>this.removeEventListener(t,e)),getConfig:()=>({...this.config}),setReadonly:t=>{this.setAttribute("readonly",t.toString())}}}destroy(){var t,e,o,i;this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&(this.preservedContent=bt(this.contentElement),this.persistAutosave(this.preservedContent)),this.stopAutosave(),this.selectionChangeHandler&&(document.removeEventListener("selectionchange",this.selectionChangeHandler),this.selectionChangeHandler=void 0),(t=this.engine)==null||t.destroy(),(e=this.toolbar)==null||e.destroy(),(o=this.floatingToolbar)==null||o.destroy(),(i=this.statusBar)==null||i.destroy(),this.innerHTML="",this.contentElement=void 0,this.toolbarElement=void 0,this.statusBarElement=void 0,this.loadedPlugins=[],this.isInitialized=!1,Ae.delete(this),J===this&&(J=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){return bt(this.contentElement)}setContent(t){this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))}execCommand(t,...e){return this.executeCommand(t,...e)}focus(){var t;(t=this.contentElement)==null||t.focus()}blur(){var t;(t=this.contentElement)==null||t.blur()}}exports.CommandRegistry=Lo;exports.ConfigResolver=Yt;exports.EditorEngine=Mo;exports.EditorState=Lt;exports.FloatingToolbar=Oo;exports.KeyboardShortcutManager=_o;exports.PluginLoader=Ko;exports.PluginManager=Ce;exports.RichTextEditorElement=rt;exports.Schema=So;exports.StatusBar=Do;exports.ToolbarRenderer=Io;exports.calculateTextStats=zo;exports.countLines=Po;exports.createPluginManager=kn;exports.getCleanEditorHTML=bt;exports.getCursorPosition=Ro;exports.getSelectionInfo=Ho;exports.getTextOffset=No;exports.initWebComponent=yi;exports.sanitizeHTML=$o;exports.sanitizeInputHTML=xe;exports.sanitizePastedHTML=Go;exports.stripEditorUiArtifacts=Se;
|
|
12
|
+
//# sourceMappingURL=index-DHPPVQwx.js.map
|
|
@@ -667,6 +667,7 @@ class pn {
|
|
|
667
667
|
exportPdf: "exportPdf",
|
|
668
668
|
insertImage: "insertImage",
|
|
669
669
|
insertVideo: "insertVideo",
|
|
670
|
+
insertAudio: "insertAudio",
|
|
670
671
|
codeBlock: "insertCodeBlock"
|
|
671
672
|
};
|
|
672
673
|
return o.forEach((c) => {
|
|
@@ -2674,6 +2675,9 @@ const ti = [
|
|
|
2674
2675
|
"span",
|
|
2675
2676
|
"div",
|
|
2676
2677
|
"section",
|
|
2678
|
+
// A captioned image or video (the media manager's output). Neither carries behaviour of its own.
|
|
2679
|
+
"figure",
|
|
2680
|
+
"figcaption",
|
|
2677
2681
|
"sup",
|
|
2678
2682
|
"sub",
|
|
2679
2683
|
"hr"
|
|
@@ -2748,7 +2752,7 @@ function ri(s, t, e) {
|
|
|
2748
2752
|
function vo(s, t, e, o) {
|
|
2749
2753
|
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : Mo(s, t, o, !0);
|
|
2750
2754
|
}
|
|
2751
|
-
const ai = ".resize-handle, .table-resize-handle", si = /resize-handle/;
|
|
2755
|
+
const ai = ".resize-handle, .table-resize-handle, [data-rte-media-pending]", si = /resize-handle|data-rte-media-pending|rte-media/;
|
|
2752
2756
|
function Io(s) {
|
|
2753
2757
|
if (!s || !si.test(s)) return s;
|
|
2754
2758
|
const t = document.createElement("template");
|
|
@@ -2760,6 +2764,11 @@ function Io(s) {
|
|
|
2760
2764
|
}), e.forEach((o) => {
|
|
2761
2765
|
var i;
|
|
2762
2766
|
o.style.position === "relative" && (o.style.removeProperty("position"), (i = o.getAttribute("style")) != null && i.trim() || o.removeAttribute("style"));
|
|
2767
|
+
}), t.content.querySelectorAll("figure.rte-media").forEach((o) => {
|
|
2768
|
+
var r;
|
|
2769
|
+
o.removeAttribute("contenteditable");
|
|
2770
|
+
const i = o.querySelector(":scope > figcaption");
|
|
2771
|
+
i && (i.removeAttribute("contenteditable"), !((r = i.textContent) != null && r.trim()) && !i.querySelector("img, video, a") && i.remove());
|
|
2763
2772
|
}), t.innerHTML;
|
|
2764
2773
|
}
|
|
2765
2774
|
function Ct(s) {
|
|
@@ -4016,4 +4025,4 @@ export {
|
|
|
4016
4025
|
yi as o,
|
|
4017
4026
|
ii as s
|
|
4018
4027
|
};
|
|
4019
|
-
//# sourceMappingURL=index-
|
|
4028
|
+
//# sourceMappingURL=index-gI4djib2.mjs.map
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./index
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./index-DHPPVQwx.js");class w{constructor(e){if(this.listeners=[],e instanceof l.PluginManager)this.pluginManager=e;else{const i=e;this.pluginManager=new l.PluginManager,i.plugins&&Array.isArray(i.plugins)&&i.plugins.forEach(n=>{this.pluginManager.register(n)}),i.element&&(this.domElement=i.element,this.setupDOMElement(i))}const t=this.pluginManager.buildSchema();this.state=l.EditorState.create(t),this.commands=this.pluginManager.getCommands()}setupDOMElement(e){this.domElement&&(e.enableToolbar!==!1&&e.toolbarElement?this.toolbarElement=e.toolbarElement:e.enableToolbar!==!1&&(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.domElement.appendChild(this.toolbarElement)),this.contentElement=document.createElement("div"),this.contentElement.contentEditable="true",this.contentElement.className="editora-content",this.contentElement.style.minHeight="200px",this.contentElement.style.outline="none",this.contentElement.style.padding="12px",e.content&&(this.contentElement.innerHTML=e.content),this.domElement.appendChild(this.contentElement),this.contentElement.addEventListener("input",()=>{this.listeners.forEach(t=>t(this.state))}))}setupKeyboardShortcuts(e){const t={};e.forEach(i=>{i.shortcut&&(t[i.shortcut.toLowerCase()]=i.command)}),document.addEventListener("keydown",i=>{if(this.contentElement!==document.activeElement&&!(document.activeElement instanceof HTMLElement&&document.activeElement.contentEditable==="true"))return;const n=[];(i.ctrlKey||i.metaKey)&&n.push("ctrl"),i.shiftKey&&n.push("shift"),i.altKey&&n.push("alt");const o=i.key.toLowerCase(),s=n.length>0?`${n.join("+")}+${o}`:o,a=t[s];a&&(i.preventDefault(),this.execCommand(a))})}handleToolbarCommand(e,t){const n=this.pluginManager.getToolbarItems().find(o=>o.id&&o.id===e||o.command===e);n!=null&&n.command&&(t!==void 0?this.execCommand(n.command,t):this.execCommand(n.command))}setState(e){this.state=e,this.listeners.forEach(t=>t(e))}onChange(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}on(e,t){return e==="change"||e==="input"?this.onChange(t):()=>{}}getElement(){return this.contentElement||this.domElement||null}execCommand(e,t){const i=this.commands[e];if(!i)return console.warn(`Command not found: ${e}`),!1;let n;return t!==void 0?n=i(this.state,t):n=i(this.state),n instanceof Promise?(n.then(o=>{o&&typeof o=="object"&&"doc"in o&&"selection"in o&&this.setState(o)}).catch(o=>{console.error(`Async command failed: ${e}`,o)}),!0):n&&typeof n=="object"&&"doc"in n&&"selection"in n?(this.setState(n),!0):n!==!1&&n!=null}setContent(e){typeof e=="string"?this.contentElement&&(this.contentElement.innerHTML=e):this.setState(this.state.apply(e))}getContent(){return this.contentElement?this.contentElement.innerHTML:this.state.doc}destroy(){this.listeners=[],this.contentElement&&this.contentElement.removeEventListener("input",()=>{})}}class f{constructor(e){this.initialized=!1,this.plugin=e}initialize(e){var t,i;if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=e,(t=this.plugin.context)!=null&&t.initialize&&this.plugin.context.initialize(),(i=this.plugin.context)!=null&&i.onEditorReady&&e.provider&&this.plugin.context.onEditorReady(e),this.initialized=!0,!0}catch(n){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,n),!1}}destroy(){var e;if(!this.initialized)return!1;try{return(e=this.plugin.context)!=null&&e.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(t){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,t),!1}}executeCommand(e,...t){var i;if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`),null;try{const n=(i=this.plugin.commands)==null?void 0:i[e];return n?n(...t):(console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`),null)}catch(n){return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`,n),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function x(r){return new f(r)}const b=new Set;function y(r,e){b.has(r)||(b.add(r),console.warn(`[Editora] ${r} from @editora/core is a deprecated, non-functional scaffold: its commands and toolbar buttons do nothing. It will be removed in a future major release - use ${e} instead.`))}function S(r={}){y("SpellcheckPlugin","`SpellCheckPlugin` from @editora/spell-check");const{enabled:e=!1,provider:t="browser",apiUrl:i="",apiHeaders:n={},language:o="en",customDictionary:s=[],ignoreAllCaps:a=!0,ignoreNumbers:c=!0}=r;return{name:"spellcheck",context:{initialize:()=>{if(e)switch(console.log("[Spellcheck Plugin] Initialized",{provider:t,language:o}),t){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":i?console.log("[Spellcheck] Using API:",i):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:h=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:h=>(console.log("[Spellcheck] Add to dictionary:",h),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:e?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function C(r={}){y("MediaPlugin","`MediaManagerPlugin` from @editora/media-manager");const{uploadUrl:e="",libraryUrl:t="",maxFileSize:i=10*1024*1024,allowedTypes:n=["image/jpeg","image/png","image/gif","image/webp"],headers:o={},withCredentials:s=!1,chunkSize:a=1024*1024,enableChunking:c=!0,onProgress:h,onError:u,onSuccess:D}=r;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:e,libraryUrl:t,maxFileSize:i,allowedTypes:n}),e||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:d=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async d=>{if(console.log("[Media] Insert image command (not implemented)",d),!d)return console.log("[Media] No file provided - should open picker"),null;if(!n.includes(d.type)){const g=new Error(`File type ${d.type} not allowed`);return u==null||u(g),null}if(d.size>i){const g=new Error(`File size ${d.size} exceeds max ${i}`);return u==null||u(g),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),t||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async d=>(console.log("[Media] Upload media (not implemented)",{name:d.name,size:d.size,type:d.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}class p{constructor(e,t={anchor:0,head:0}){this.doc=e,this.selection=t}getDocument(){return this.doc}setDocument(e){return new p(e,this.selection)}getSelection(){return{...this.selection}}setSelection(e){return new p(this.doc,e)}update(e,t){return new p(e||this.doc,t||this.selection)}getTextContent(){return""}isSelectionEmpty(){return this.selection.anchor===this.selection.head}}class m{constructor(e){this.config={closeOnEscape:!0,closeOnBackdrop:!0,...e},this.element=this.createElement(),this.attachEventListeners()}createElement(){const e=document.createElement("dialog");e.className="editora-dialog",this.config.width&&(e.style.width=this.config.width),this.config.height&&(e.style.height=this.config.height);const t=this.config.buttons&&this.config.buttons.length>0?this.config.buttons.map((i,n)=>`<button type="button" class="editora-btn ${i.type==="danger"?"editora-btn-danger":i.type==="primary"||i.primary?"editora-btn-primary":"editora-btn-cancel"}" data-dialog-button="${n}">${i.label}</button>`).join(""):`
|
|
2
2
|
<button type="button" class="editora-btn editora-btn-cancel" data-dialog-default="cancel">Cancel</button>
|
|
3
3
|
<button type="button" class="editora-btn editora-btn-primary" data-dialog-default="ok">OK</button>
|
|
4
4
|
`;if(e.innerHTML=`
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as g, E, a as f, T as y, R as w } from "./index-
|
|
2
|
-
import { C as V, b as K, F as B, K as W, c as X, S as _, d as Y, e as J, f as Q, g as Z, h as ee, i as te, j as ie, k as ne, s as oe, l as se, m as ae, n as le } from "./index-
|
|
1
|
+
import { P as g, E, a as f, T as y, R as w } from "./index-gI4djib2.mjs";
|
|
2
|
+
import { C as V, b as K, F as B, K as W, c as X, S as _, d as Y, e as J, f as Q, g as Z, h as ee, i as te, j as ie, k as ne, s as oe, l as se, m as ae, n as le } from "./index-gI4djib2.mjs";
|
|
3
3
|
class T {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
if (this.listeners = [], e instanceof g)
|
package/dist/plugin-loader.js
CHANGED
|
@@ -53,7 +53,7 @@ const r = {
|
|
|
53
53
|
anchor: () => import("./AnchorPlugin.native-Dk9R26cF.mjs").then((n) => n.AnchorPlugin()),
|
|
54
54
|
embedIframe: () => import("./EmbedIframePlugin.native-qHMf1Jtg.mjs").then((n) => n.EmbedIframePlugin()),
|
|
55
55
|
math: () => import("./MathPlugin.native-Cq9WQ7cq.mjs").then((n) => n.MathPlugin()),
|
|
56
|
-
image: () => import("./MediaManagerPlugin.native-
|
|
56
|
+
image: () => import("./MediaManagerPlugin.native-mXWWARRX.mjs").then((n) => n.MediaManagerPlugin()),
|
|
57
57
|
mergeTag: () => import("./MergeTagPlugin.native-BXkVPvCo.mjs").then((n) => n.MergeTagPlugin()),
|
|
58
58
|
pageBreak: () => import("./PageBreakPlugin.native-DijGuHJZ.mjs").then((n) => n.PageBreakPlugin()),
|
|
59
59
|
print: () => import("./PrintPlugin.native-7qt5v7L5.mjs").then((n) => n.PrintPlugin()),
|
|
@@ -66,7 +66,7 @@ const r = {
|
|
|
66
66
|
a11yChecker: () => import("./A11yCheckerPlugin.native-BBCsR5Ur.mjs").then((n) => n.A11yCheckerPlugin()),
|
|
67
67
|
comments: () => import("./CommentsPlugin.native-DHCDUm9f.mjs").then((n) => n.CommentsPlugin()),
|
|
68
68
|
collaboration: () => import("./CollaborationPlugin.native-Bl3R9CRI.mjs").then((n) => n.CollaborationPlugin()),
|
|
69
|
-
"document-manager": () => import("./DocumentManagerPlugin.native-
|
|
69
|
+
"document-manager": () => import("./DocumentManagerPlugin.native-CaBqCH-p.mjs").then((n) => n.DocumentManagerPlugin()),
|
|
70
70
|
fullscreen: () => import("./FullscreenPlugin.native-ChXyxeNw.mjs").then((n) => n.FullscreenPlugin()),
|
|
71
71
|
template: () => import("./TemplatePlugin.native-OD8Wc1R7.mjs").then((n) => n.TemplatePlugin()),
|
|
72
72
|
footnote: () => import("./FootnotePlugin.native-D730OGRm.mjs").then((n) => n.FootnotePlugin())
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
apiUrl: "",
|
|
3
|
+
headers: {
|
|
4
|
+
// Add default headers if needed (e.g., API key)
|
|
5
|
+
// 'Authorization': 'Bearer YOUR_API_KEY',
|
|
6
|
+
// 'X-API-Key': 'YOUR_API_KEY'
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
let o = { ...t };
|
|
10
|
+
function i() {
|
|
11
|
+
return { ...o };
|
|
12
|
+
}
|
|
13
|
+
function l() {
|
|
14
|
+
return i().headers || {};
|
|
15
|
+
}
|
|
16
|
+
function c(e, n) {
|
|
17
|
+
if (!e) return "";
|
|
18
|
+
const a = e.replace(/\/$/, ""), r = n.replace(/^\//, "");
|
|
19
|
+
return `${a}/${r}`;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
l as a,
|
|
23
|
+
c as b,
|
|
24
|
+
i as g
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=shared-config-DuA34Iii.mjs.map
|
|
@@ -403,6 +403,7 @@ class pn {
|
|
|
403
403
|
exportPdf: "exportPdf",
|
|
404
404
|
insertImage: "insertImage",
|
|
405
405
|
insertVideo: "insertVideo",
|
|
406
|
+
insertAudio: "insertAudio",
|
|
406
407
|
codeBlock: "insertCodeBlock"
|
|
407
408
|
};
|
|
408
409
|
return o.forEach((c) => {
|
|
@@ -2745,6 +2746,9 @@ const ei = [
|
|
|
2745
2746
|
"span",
|
|
2746
2747
|
"div",
|
|
2747
2748
|
"section",
|
|
2749
|
+
// A captioned image or video (the media manager's output). Neither carries behaviour of its own.
|
|
2750
|
+
"figure",
|
|
2751
|
+
"figcaption",
|
|
2748
2752
|
"sup",
|
|
2749
2753
|
"sub",
|
|
2750
2754
|
"hr"
|
|
@@ -2819,7 +2823,7 @@ function ai(a, t, e) {
|
|
|
2819
2823
|
function wo(a, t, e, o) {
|
|
2820
2824
|
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? a : Io(a, t, o, !0);
|
|
2821
2825
|
}
|
|
2822
|
-
const si = ".resize-handle, .table-resize-handle", li = /resize-handle/;
|
|
2826
|
+
const si = ".resize-handle, .table-resize-handle, [data-rte-media-pending]", li = /resize-handle|data-rte-media-pending|rte-media/;
|
|
2823
2827
|
function Do(a) {
|
|
2824
2828
|
if (!a || !li.test(a)) return a;
|
|
2825
2829
|
const t = document.createElement("template");
|
|
@@ -2831,6 +2835,11 @@ function Do(a) {
|
|
|
2831
2835
|
}), e.forEach((o) => {
|
|
2832
2836
|
var i;
|
|
2833
2837
|
o.style.position === "relative" && (o.style.removeProperty("position"), (i = o.getAttribute("style")) != null && i.trim() || o.removeAttribute("style"));
|
|
2838
|
+
}), t.content.querySelectorAll("figure.rte-media").forEach((o) => {
|
|
2839
|
+
var r;
|
|
2840
|
+
o.removeAttribute("contenteditable");
|
|
2841
|
+
const i = o.querySelector(":scope > figcaption");
|
|
2842
|
+
i && (i.removeAttribute("contenteditable"), !((r = i.textContent) != null && r.trim()) && !i.querySelector("img, video, a") && i.remove());
|
|
2834
2843
|
}), t.innerHTML;
|
|
2835
2844
|
}
|
|
2836
2845
|
function Ct(a) {
|