@editora/core 1.0.33 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -9
- package/dist/editora.min.js +15 -15
- package/dist/editora.umd.js +15 -15
- package/dist/index-GWw_bIws.js +12 -0
- package/dist/{index-BlsTuyTe.mjs → index-aIPU3kLC.mjs} +857 -653
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/webcomponent-core.js +777 -573
- package/dist/webcomponent-core.min.js +58 -58
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +949 -748
- package/dist/webcomponent.min.js +209 -209
- package/package.json +1 -1
- package/dist/index-BahpGXyw.js +0 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";class It{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 It(o,{anchor:0,head:0},t)}apply(t,e){return new It(t,e||this.selection,this.schema)}}class Mo{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 Le{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 Mo(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 Sn(){return new Le}class Io{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 Do{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 Ro{constructor(t={}){this.listeners=new Map,this.isReadonly=!1,this.isDestroyed=!1,this.isReadonly=t.readonly||!1,this.pluginManager=new Le,t.plugins&&Array.isArray(t.plugins)&&t.plugins.forEach(o=>this.pluginManager.register(o));const e=this.pluginManager.buildSchema();this.state=It.create(e),this.commandRegistry=new Do(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}}const Oo={bold:"toggleBold",italic:"toggleItalic",underline:"toggleUnderline",strikethrough:"toggleStrikethrough",bullist:"toggleBulletList",numlist:"toggleOrderedList",checklist:"toggleChecklist",link:"openLinkDialog",image:"insertImage",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"};class Po{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(l=>l.trim()),i=this.getAvailableToolbarItems(),r=new Map;return i.forEach(l=>{l.command&&r.set(l.command,l),l.type==="group"&&l.label&&r.set(l.label,l)}),o.forEach(l=>{const c=[];l.split(/\s+/).filter(Boolean).forEach(h=>{if(h==="direction"){const k=r.get("setDirectionLTR"),w=r.get("setDirectionRTL");k&&c.push({id:"directionLTR",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options}),w&&c.push({id:"directionRTL",label:w.label,command:w.command,icon:w.icon,type:w.type||"button",options:w.options});return}if(h==="comments"){const k=r.get("addComment"),w=r.get("toggleComments");k&&c.push({id:"addComment",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options}),w&&c.push({id:"toggleComments",label:w.label,command:w.command,icon:w.icon,type:w.type||"button",options:w.options});return}const g=Oo[h]||h;let b=r.get(g);b||(b=r.get(h)),b&&c.push({id:h,label:b.label,command:b.command,icon:b.icon,type:b.type==="separator"?"separator":b.type||"button",options:b.options,items:b.items})}),c.length>0&&e.push(c)}),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(p=>{this.appendToolbarButton(c,p);const h=c.lastElementChild;h instanceof HTMLElement&&(this.overflowUnits.push(h),this.overflowUnitHomes.set(h,c))}),e.appendChild(c),l<i.length-1){const p=document.createElement("div");p.className="editora-toolbar-separator",e.appendChild(p)}}),t.appendChild(e),this.setupOverflow(t)}setupOverflow(t){const e=this.itemsContainer;if(!e||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(B=>{var D;B.parentElement===i&&((D=this.overflowUnitHomes.get(B))==null||D.appendChild(B))});const p=t.clientWidth,h=16,g=40,b=4,k=Math.max(0,p-h),w=Math.max(0,k-g-b),O=getComputedStyle(t).direction==="rtl",tt=e.getBoundingClientRect(),$=B=>{const D=B.getBoundingClientRect();return O?tt.right-D.left:D.right-tt.left};let z=0;if($(c[c.length-1])<=k)z=c.length;else for(const B of c)if($(B)<=w)z++;else break;z=Math.max(1,Math.min(z,c.length));const lt=z<c.length;o.style.display=lt?"":"none",o.classList.toggle("active",lt&&this.expandedOpen),!lt&&this.expandedOpen&&this.setExpandedOpen(!1),c.forEach((B,D)=>{D>=z&&i.appendChild(B)})},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(h=>{h.setAttribute("role","menuitem"),h.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 p=t._cleanupDropdown;t._cleanupDropdown=()=>{c.disconnect(),p==null||p()},e.addEventListener("click",h=>{var g;h.detail===0&&l()&&((g=r()[0])==null||g.focus())}),e.addEventListener("keydown",h=>{var b;if(h.key!=="ArrowDown"&&h.key!=="ArrowUp")return;h.preventDefault(),l()||e.click();const g=r();(b=h.key==="ArrowUp"?g[g.length-1]:g[0])==null||b.focus()}),o.addEventListener("keydown",h=>{const g=r();if(g.length===0)return;const b=g.indexOf(document.activeElement),k=w=>{h.preventDefault(),g[(w+g.length)%g.length].focus()};switch(h.key){case"ArrowDown":return k(b+1);case"ArrowUp":return k(b<0?g.length-1:b-1);case"Home":return k(0);case"End":return k(g.length-1);case"Escape":h.preventDefault(),h.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 p=document.createElement("button");p.className="editora-toolbar-dropdown-item",p.type="button",p.textContent=c.label,p.setAttribute("data-value",c.value),p.addEventListener("click",h=>{h.preventDefault(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),i.style.display="none"}),i.appendChild(p)}),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const p=i.style.display==="block";i.style.display=p?"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 p=document.createElement("button");p.className="editora-toolbar-dropdown-item",p.type="button",p.textContent=c.label,p.setAttribute("data-value",c.value),p.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),i.style.display="none"}),i.appendChild(p)}),o.addEventListener("click",c=>{var h;c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const p=(h=this.container)==null?void 0:h.querySelectorAll(".editora-toolbar-dropdown-menu");p==null||p.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 No{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 zo{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 p=document.createElement("span");p.className="editora-statusbar-separator",p.textContent="|",t.appendChild(p)}}),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 p=document.createElement("span");p.className="editora-statusbar-separator",p.textContent="|",e.appendChild(p)}}),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 Bo(a,t){const e=a.textContent||"",o=Fo(a,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 Fo(a,t,e){var l;let o=0;const i=document.createTreeWalker(a,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 Ho(a){var o,i;const t=a.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=(a.textContent||"").split(`
|
|
9
|
+
`).length;e=Math.max(1,l)}return e}function Uo(a){const t=a.trim()?a.trim().split(/\s+/).length:0,e=a.length;return{words:t,chars:e}}function jo(a,t){const e=a.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 lo(a,t){(t==null||t>a.length)&&(t=a.length);for(var e=0,o=Array(t);e<t;e++)o[e]=a[e];return o}function Ln(a){if(Array.isArray(a))return a}function _n(a,t){var e=a==null?null:typeof Symbol!="undefined"&&a[Symbol.iterator]||a["@@iterator"];if(e!=null){var o,i,r,l,c=[],p=!0,h=!1;try{if(r=(e=e.call(a)).next,t!==0)for(;!(p=(o=r.call(e)).done)&&(c.push(o.value),c.length!==t);p=!0);}catch(g){h=!0,i=g}finally{try{if(!p&&e.return!=null&&(l=e.return(),Object(l)!==l))return}finally{if(h)throw i}}return c}}function Mn(){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 In(a,t){return Ln(a)||_n(a,t)||Dn(a,t)||Mn()}function Dn(a,t){if(a){if(typeof a=="string")return lo(a,t);var e={}.toString.call(a).slice(8,-1);return e==="Object"&&a.constructor&&(e=a.constructor.name),e==="Map"||e==="Set"?Array.from(a):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?lo(a,t):void 0}}const Wo=Object.entries,co=Object.setPrototypeOf,Rn=Object.isFrozen,On=Object.getPrototypeOf,Pn=Object.getOwnPropertyDescriptor;let _=Object.freeze,M=Object.seal,Et=Object.create,$o=typeof Reflect!="undefined"&&Reflect,Ce=$o.apply,xe=$o.construct;_||(_=function(t){return t});M||(M=function(t){return t});Ce||(Ce=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)});xe||(xe=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 rt=L(Array.prototype.forEach),Nn=L(Array.prototype.lastIndexOf),uo=L(Array.prototype.pop),At=L(Array.prototype.push),zn=L(Array.prototype.splice),vt=Array.isArray,Mt=L(String.prototype.toLowerCase),me=L(String.prototype.toString),fo=L(String.prototype.match),St=L(String.prototype.replace),po=L(String.prototype.indexOf),Bn=L(String.prototype.trim),Fn=L(Number.prototype.toString),Hn=L(Boolean.prototype.toString),ho=typeof BigInt=="undefined"?null:L(BigInt.prototype.toString),mo=typeof Symbol=="undefined"?null:L(Symbol.prototype.toString),N=L(Object.prototype.hasOwnProperty),Lt=L(Object.prototype.toString),I=L(RegExp.prototype.test),Q=Un(TypeError);function L(a){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 Ce(a,t,o)}}function Un(a){return function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return xe(a,e)}}function v(a,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mt;if(co&&co(a,null),!vt(t))return a;let o=t.length;for(;o--;){let i=t[o];if(typeof i=="string"){const r=e(i);r!==i&&(Rn(t)||(t[o]=r),i=r)}a[i]=!0}return a}function jn(a){for(let t=0;t<a.length;t++)N(a,t)||(a[t]=null);return a}function U(a){const t=Et(null);for(const o of Wo(a)){var e=In(o,2);const i=e[0],r=e[1];N(a,i)&&(vt(r)?t[i]=jn(r):r&&typeof r=="object"&&r.constructor===Object?t[i]=U(r):t[i]=r)}return t}function Wn(a){switch(typeof a){case"string":return a;case"number":return Fn(a);case"boolean":return Hn(a);case"bigint":return ho?ho(a):"0";case"symbol":return mo?mo(a):"Symbol()";case"undefined":return Lt(a);case"function":case"object":{if(a===null)return Lt(a);const t=a,e=W(t,"toString");if(typeof e=="function"){const o=e(t);return typeof o=="string"?o:Lt(o)}return Lt(a)}default:return Lt(a)}}function W(a,t){for(;a!==null;){const o=Pn(a,t);if(o){if(o.get)return L(o.get);if(typeof o.value=="function")return L(o.value)}a=On(a)}function e(){return null}return e}function $n(a){try{return I(a,""),!0}catch(t){return!1}}const go=_(["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"]),ge=_(["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"]),be=_(["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"]),Gn=_(["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"]),ye=_(["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"]),Kn=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=_(["#text"]),yo=_(["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"]),Ee=_(["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"]),Eo=_(["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"]),Kt=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qn=M(/{{[\w\W]*|^[\w\W]*}}/g),Yn=M(/<%[\w\W]*|^[\w\W]*%>/g),Vn=M(/\${[\w\W]*/g),Xn=M(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qn=M(/^aria-[\-\w]+$/),vo=M(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zn=M(/^(?:\w+script|data):/i),Jn=M(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ti=M(/^html$/i),ei=M(/^[a-z][.\w]*(-[.\w]+)+$/i),ko=M(/<[/\w!]/g),wo=M(/<[/\w]/g),oi=M(/<\/no(script|embed|frames)/i),ni=M(/\/>/i),H={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Go=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],ii=_(v({},Go)),ri=(function(){const a={};return rt(Go,t=>{a[t]=M(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),_(a)})(),ai=function(){return typeof window=="undefined"?null:window},si=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 N(t,e)&&vt(t[e])?v(i.base?U(i.base):{},t[e],i.transform):o},ve=function(t,e,o){const i=N(t,e)?t[e]:void 0;return i&&typeof i=="object"?U(i):o()};function Ko(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ai();const t=u=>Ko(u);if(t.version="3.4.16",t.removed=[],!a||!a.document||a.document.nodeType!==H.document||!a.Element)return t.isSupported=!1,t;let e=a.document;const o=e,i=o.currentScript;a.DocumentFragment;const r=a.HTMLTemplateElement,l=a.Node,c=a.Element,p=a.NodeFilter;a.NamedNodeMap===void 0&&(a.NamedNodeMap||a.MozNamedAttrMap),a.HTMLFormElement;const h=a.DOMParser,g=a.trustedTypes,b=c.prototype,k=W(b,"cloneNode"),w=W(b,"remove"),O=W(b,"removeAttributeNode"),tt=W(b,"nextSibling"),$=W(b,"childNodes"),z=W(b,"parentNode"),lt=W(b,"shadowRoot"),B=W(b,"attributes"),D=l&&l.prototype?W(l.prototype,"nodeType"):null,ct=l&&l.prototype?W(l.prototype,"nodeName"):null,Dt=l&&l.prototype?W(l.prototype,"ownerDocument"):null,kt=function(n){return D?D(n):n.nodeType},Qt=function(n){return ct?ct(n):n.nodeName};if(typeof r=="function"){const u=e.createElement("template");u.content&&u.content.ownerDocument&&(e=u.content.ownerDocument)}let P,et="",Zt,Me=!1,wt=0;const Ie=function(){if(wt>0)throw Q('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.')},dt=function(n){Ie(),wt++;try{return P.createHTML(n)}finally{wt--}},Zo=function(n){Ie(),wt++;try{return P.createScriptURL(n)}finally{wt--}},Jo=function(){return Me||(Zt=si(g,i),Me=!0),Zt},Rt=e,Jt=Rt.implementation,De=Rt.createNodeIterator,tn=Rt.createDocumentFragment,en=Rt.getElementsByTagName,on=o.importNode;let T=To();t.isSupported=typeof Wo=="function"&&typeof z=="function"&&Jt&&Jt.createHTMLDocument!==void 0;const nn=qn,rn=Yn,an=Vn,sn=Xn,ln=Qn,cn=Zn,Re=Jn,dn=ei;let Oe=vo,C=null;const te=v({},[...go,...ge,...be,...ye,...bo]);let x=null;const ee=v({},[...yo,...Ee,...Eo,...Kt]);let G=Object.seal(Et(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}})),Tt=null,Pe=null;const Y=Object.seal(Et(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ne=!0,oe=!0,ze=!1,Be=!0,V=!1,ot=!0,nt=!1,ne=!1,Ot=null,Pt=null,ie=!1,ut=!1,Nt=!1,zt=!1,Fe=!0,He=!1;const Ue="user-content-";let re=!0,ae=!1,ft={},pt=null;const je=v({},["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 We=null;const $e=v({},["audio","video","img","source","image","track"]);let Ge=null;const Ke=v({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Bt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",K="http://www.w3.org/1999/xhtml";let ht=K,se=!1,le=null;const un=v({},[Bt,Ft,K],me),qe=_(["mi","mo","mn","ms","mtext"]);let ce=v({},qe);const Ye=_(["annotation-xml"]);let de=v({},Ye);const fn=v({},["title","style","font","a","script"]);let Ct=null;const pn=["application/xhtml+xml","text/html"],hn="text/html";let S=null,mt=null;const mn=e.createElement("form"),Ve=function(n){return n instanceof RegExp||n instanceof Function},ue=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===n)return;(!n||typeof n!="object")&&(n={}),n=U(n),Ct=pn.indexOf(n.PARSER_MEDIA_TYPE)===-1?hn:n.PARSER_MEDIA_TYPE,S=Ct==="application/xhtml+xml"?me:Mt,C=Z(n,"ALLOWED_TAGS",te,{transform:S}),x=Z(n,"ALLOWED_ATTR",ee,{transform:S}),le=Z(n,"ALLOWED_NAMESPACES",un,{transform:me}),Ge=Z(n,"ADD_URI_SAFE_ATTR",Ke,{transform:S,base:Ke}),We=Z(n,"ADD_DATA_URI_TAGS",$e,{transform:S,base:$e}),pt=Z(n,"FORBID_CONTENTS",je,{transform:S}),Tt=Z(n,"FORBID_TAGS",U({}),{transform:S}),Pe=Z(n,"FORBID_ATTR",U({}),{transform:S}),ft=N(n,"USE_PROFILES")?n.USE_PROFILES&&typeof n.USE_PROFILES=="object"?U(n.USE_PROFILES):n.USE_PROFILES:!1,Ne=n.ALLOW_ARIA_ATTR!==!1,oe=n.ALLOW_DATA_ATTR!==!1,ze=n.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=n.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=n.SAFE_FOR_TEMPLATES||!1,ot=n.SAFE_FOR_XML!==!1,nt=n.WHOLE_DOCUMENT||!1,ut=n.RETURN_DOM||!1,Nt=n.RETURN_DOM_FRAGMENT||!1,zt=n.RETURN_TRUSTED_TYPE||!1,ie=n.FORCE_BODY||!1,Fe=n.SANITIZE_DOM!==!1,He=n.SANITIZE_NAMED_PROPS||!1,re=n.KEEP_CONTENT!==!1,ae=n.IN_PLACE||!1,Oe=$n(n.ALLOWED_URI_REGEXP)?n.ALLOWED_URI_REGEXP:vo,ht=typeof n.NAMESPACE=="string"?n.NAMESPACE:K,ce=ve(n,"MATHML_TEXT_INTEGRATION_POINTS",()=>v({},qe)),de=ve(n,"HTML_INTEGRATION_POINTS",()=>v({},Ye));const s=ve(n,"CUSTOM_ELEMENT_HANDLING",()=>Et(null));if(G=Et(null),N(s,"tagNameCheck")&&Ve(s.tagNameCheck)&&(G.tagNameCheck=s.tagNameCheck),N(s,"attributeNameCheck")&&Ve(s.attributeNameCheck)&&(G.attributeNameCheck=s.attributeNameCheck),N(s,"allowCustomizedBuiltInElements")&&typeof s.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=s.allowCustomizedBuiltInElements),M(G),V&&(oe=!1),Nt&&(ut=!0),ft&&(C=v({},bo),x=Et(null),ft.html===!0&&(v(C,go),v(x,yo)),ft.svg===!0&&(v(C,ge),v(x,Ee),v(x,Kt)),ft.svgFilters===!0&&(v(C,be),v(x,Ee),v(x,Kt)),ft.mathMl===!0&&(v(C,ye),v(x,Eo),v(x,Kt))),Y.tagCheck=null,Y.attributeCheck=null,N(n,"ADD_TAGS")&&(typeof n.ADD_TAGS=="function"?Y.tagCheck=n.ADD_TAGS:vt(n.ADD_TAGS)&&(C===te&&(C=U(C)),v(C,n.ADD_TAGS,S))),N(n,"ADD_ATTR")&&(typeof n.ADD_ATTR=="function"?Y.attributeCheck=n.ADD_ATTR:vt(n.ADD_ATTR)&&(x===ee&&(x=U(x)),v(x,n.ADD_ATTR,S))),N(n,"ADD_FORBID_CONTENTS")&&vt(n.ADD_FORBID_CONTENTS)&&(pt===je&&(pt=U(pt)),v(pt,n.ADD_FORBID_CONTENTS,S)),re&&(C["#text"]=!0),nt&&v(C,["html","head","body"]),C.table&&(v(C,["tbody"]),delete Tt.tbody),n.TRUSTED_TYPES_POLICY){if(typeof n.TRUSTED_TYPES_POLICY.createHTML!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof n.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const d=P;P=n.TRUSTED_TYPES_POLICY;try{et=dt("")}catch(f){throw P=d,f}}else n.TRUSTED_TYPES_POLICY===null?(P=void 0,et=""):(P===void 0&&(P=Jo()),P&&typeof et=="string"&&(et=dt("")));_&&_(n),mt=n},Xe=v({},[...ge,...be,...Gn]),Qe=v({},[...ye,...Kn]),gn=function(n,s,d){return s.namespaceURI===K?n==="svg":s.namespaceURI===Bt?n==="svg"&&(d==="annotation-xml"||ce[d]):!!Xe[n]},bn=function(n,s,d){return s.namespaceURI===K?n==="math":s.namespaceURI===Ft?n==="math"&&de[d]:!!Qe[n]},yn=function(n,s,d){return s.namespaceURI===Ft&&!de[d]||s.namespaceURI===Bt&&!ce[d]?!1:!Qe[n]&&(fn[n]||!Xe[n])},En=function(n){let s=z(n);(!s||!s.tagName)&&(s={namespaceURI:ht,tagName:"template"});const d=Mt(n.tagName),f=Mt(s.tagName);return le[n.namespaceURI]?n.namespaceURI===Ft?gn(d,s,f):n.namespaceURI===Bt?bn(d,s,f):n.namespaceURI===K?yn(d,s,f):!!(Ct==="application/xhtml+xml"&&le[n.namespaceURI]):!1},X=function(n){At(t.removed,{element:n});try{z(n).removeChild(n)}catch(s){if(w(n),!z(n))throw Q("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,s,d){try{O(n,s)}catch(f){try{n.removeAttribute(d)}catch(m){}}},Ht=function(n){Ut(n);const s=$(n);if(s){const f=[];rt(s,m=>{At(f,m)}),rt(f,m=>{try{w(m)}catch(y){}})}const d=B(n);if(d)for(let f=d.length-1;f>=0;--f){const m=d[f],y=m&&m.name;typeof y=="string"&&Ze(n,m,y)}},it=function(n,s,d){if(!d)try{d=s.getAttributeNode(n)}catch(f){d=null}At(t.removed,{attribute:d||null,from:s});try{d?O(s,d):s.removeAttribute(n)}catch(f){try{s.removeAttribute(n)}catch(m){}}if(n==="is")if(ut||Nt)try{X(s)}catch(f){}else try{s.setAttribute(n,"")}catch(f){}},vn=function(n){const s=B(n);if(s)for(let d=s.length-1;d>=0;--d){const f=s[d],m=f&&f.name;typeof m!="string"||x[S(m)]||Ze(n,f,m)}},Ut=function(n){const s=[n];for(;s.length>0;){const d=s.pop();kt(d)===H.element&&vn(d);const f=$(d);if(f)for(let m=f.length-1;m>=0;--m)s.push(f[m])}},Je=function(n,s){return ot?n==="patchsrc"?!0:n==="for"&&s!=="label"&&s!=="output":!1},kn=function(n){if(!ot)return;const s=[n];for(;s.length>0;){const d=s.pop(),f=kt(d);if(f===H.processingInstruction||f===H.comment&&I(wo,d.data)){try{w(d)}catch(y){}continue}if(f===H.element){const y=d,E=S(Qt(d));try{y.hasAttribute&&y.hasAttribute("patchsrc")&&y.removeAttribute("patchsrc"),y.hasAttribute&&y.hasAttribute("for")&&Je("for",E)&&y.removeAttribute("for")}catch(A){}}const m=$(d);if(m)for(let y=m.length-1;y>=0;--y)s.push(m[y])}},to=function(n){let s=null,d=null;if(ie)n="<remove></remove>"+n;else{const y=fo(n,/^[\r\n\t ]+/);d=y&&y[0]}Ct==="application/xhtml+xml"&&ht===K&&(n='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+n+"</body></html>");const f=P?dt(n):n;if(ht===K)try{s=new h().parseFromString(f,Ct)}catch(y){}if(!s||!s.documentElement){s=Jt.createDocument(ht,"template",null);try{s.documentElement.innerHTML=se?et:f}catch(y){}}const m=s.body||s.documentElement;return n&&d&&m.insertBefore(e.createTextNode(d),m.childNodes[0]||null),ht===K?en.call(s,nt?"html":"body")[0]:nt?s.documentElement:m},eo=function(n){const s=Dt?Dt(n):n.ownerDocument;return De.call(s||n,n,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},jt=function(n){return n=St(n,nn," "),n=St(n,rn," "),n=St(n,an," "),n},fe=function(n){var s;n.normalize();const d=Dt?Dt(n):n.ownerDocument,f=De.call(d||n,n,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null);let m=f.nextNode();for(;m;)m.data=jt(m.data),m=f.nextNode();const y=(s=n.querySelectorAll)===null||s===void 0?void 0:s.call(n,"template");y&&rt(y,E=>{gt(E.content)&&fe(E.content)})},Wt=function(n){const s=ct?ct(n):null;return typeof s!="string"||S(s)!=="form"?!1:typeof n.nodeName!="string"||typeof n.textContent!="string"||typeof n.removeChild!="function"||n.attributes!==B(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!==D(n)||n.childNodes!==$(n)},gt=function(n){if(!D||typeof n!="object"||n===null)return!1;try{return D(n)===H.documentFragment}catch(s){return!1}},xt=function(n){if(!D||typeof n!="object"||n===null)return!1;try{return typeof D(n)=="number"}catch(s){return!1}};function q(u,n,s){u.length!==0&&rt(u,d=>{d.call(t,n,s,mt)})}const wn=function(n,s){return!!(ot&&n.hasChildNodes()&&!xt(n.firstElementChild)&&I(ko,n.textContent)&&I(ko,n.innerHTML)||ot&&n.namespaceURI===K&&ii[s]&&(xt(n.firstElementChild)||typeof n.textContent=="string"&&I(ri[s],n.textContent))||n.nodeType===H.processingInstruction||ot&&n.nodeType===H.comment&&I(wo,n.data))},$t=function(n,s){if(n instanceof RegExp)return I(n,s);if(n instanceof Function){for(var d=arguments.length,f=new Array(d>2?d-2:0),m=2;m<d;m++)f[m-2]=arguments[m];return!!n(s,...f)}return!1},Tn=function(n,s,d){if(!Tt[s]&&ro(s)&&$t(G.tagNameCheck,s))return!1;if(re&&!pt[s]){const f=z(n),m=$(n);if(m&&f){const y=m.length;for(let E=y-1;E>=0;--E){const A=n===d?k(m[E],!0):m[E];f.insertBefore(A,tt(n))}}}return X(n),!0},oo=function(n,s,d,f){return n.length===0?s:s===d||s===f?U(s):s},bt=function(n,s){return n===s||z(n)!==null?!1:(ae&&Ut(n),!0)},no=function(n,s){if(q(T.beforeSanitizeElements,n,null),bt(n,s))return!0;if(Wt(n))return X(n),!0;const d=S(Qt(n));if(C=oo(T.uponSanitizeElement,C,te,Ot),q(T.uponSanitizeElement,n,{tagName:d,allowedTags:C}),bt(n,s))return!0;if(wn(n,d))return X(n),!0;if(Tt[d]||!(Y.tagCheck instanceof Function&&Y.tagCheck(d))&&!C[d]){const f=Tn(n,d,s);return f===!1&&(q(T.afterSanitizeElements,n,null),bt(n,s))?!0:f}if(kt(n)===H.element&&!En(n)||(d==="noscript"||d==="noembed"||d==="noframes")&&I(oi,n.innerHTML))return X(n),!0;if(V&&n.nodeType===H.text){const f=jt(n.textContent);n.textContent!==f&&(At(t.removed,{element:n.cloneNode()}),n.textContent=f)}return q(T.afterSanitizeElements,n,null),bt(n,s)},io=function(n,s,d){if(Pe[s]||Je(s,n)||Fe&&(s==="id"||s==="name")&&(d in e||d in mn))return!1;const f=x[s]||Y.attributeCheck instanceof Function&&Y.attributeCheck(s,n);return oe&&I(sn,s)||Ne&&I(ln,s)?!0:f?Ge[s]||I(Oe,St(d,Re,""))||(s==="src"||s==="xlink:href"||s==="href")&&n!=="script"&&po(d,"data:")===0&&We[n]||ze&&!I(cn,St(d,Re,""))?!0:!d:ro(n)&&$t(G.tagNameCheck,n)&&$t(G.attributeNameCheck,s,n)||s==="is"&&G.allowCustomizedBuiltInElements&&$t(G.tagNameCheck,d)},Cn=v({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ro=function(n){return!Cn[Mt(n)]&&I(dn,n)},xn=function(n,s,d,f){if(P&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!d)switch(g.getAttributeType(n,s)){case"TrustedHTML":return dt(f);case"TrustedScriptURL":return Zo(f)}return f},An=function(n,s,d,f){try{return d?n.setAttributeNS(d,s,f):n.setAttribute(s,f),Wt(n)?(X(n),!1):!0}catch(m){return it(s,n),!1}},ao=function(n,s){if(q(T.beforeSanitizeAttributes,n,null),bt(n,s))return;const d=n.attributes;if(!d||Wt(n))return;x=oo(T.uponSanitizeAttribute,x,ee,Pt);const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:x,forceKeepAttr:void 0};let m=d.length;const y=S(n.nodeName);for(;m--;){const E=d[m],A=E.name,j=E.namespaceURI,F=E.value,yt=S(A),he=F;let R=A==="value"?he:Bn(he),so=!1;if(f.attrName=yt,f.attrValue=R,f.keepAttr=!0,f.forceKeepAttr=void 0,q(T.uponSanitizeAttribute,n,f),R=f.attrValue,He&&(yt==="id"||yt==="name")&&po(R,Ue)!==0&&(it(A,n,E),R=Ue+R,so=!0),ot&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,R)){it(A,n,E);continue}if(yt==="attributename"&&fo(R,"href")){it(A,n,E);continue}if(!f.forceKeepAttr){if(!f.keepAttr){it(A,n,E);continue}if(!Be&&I(ni,R)){it(A,n,E);continue}if(V&&(R=jt(R)),!io(y,yt,R)){it(A,n,E);continue}R=xn(y,yt,j,R),R!==he&&An(n,A,j,R)&&so&&uo(t.removed)}}q(T.afterSanitizeAttributes,n,null),bt(n,s)},Gt=function(n){let s=null;const d=eo(n);for(q(T.beforeSanitizeShadowDOM,n,null);s=d.nextNode();)if(q(T.uponSanitizeShadowNode,s,null),no(s,n),ao(s,n),gt(s.content)&&Gt(s.content),kt(s)===H.element){const f=lt(s);gt(f)&&(pe(f),Gt(f))}q(T.afterSanitizeShadowDOM,n,null)},pe=function(n){const s=[{node:n,shadow:null}];for(;s.length>0;){const d=s.pop();if(d.shadow){Gt(d.shadow);continue}const f=d.node,m=kt(f)===H.element,y=$(f);if(y)for(let E=y.length-1;E>=0;--E)s.push({node:y[E],shadow:null});if(m){const E=ct?ct(f):null;if(typeof E=="string"&&S(E)==="template"){const A=f.content;gt(A)&&s.push({node:A,shadow:null})}}if(m){const E=lt(f);gt(E)&&s.push({node:null,shadow:E},{node:E,shadow:null})}}};return t.sanitize=function(u){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=null,d=null,f=null,m=null;if(se=!u,se&&(u="<!-->"),typeof u!="string"&&!xt(u)&&(u=Wn(u),typeof u!="string"))throw Q("dirty is not a string, aborting");if(!t.isSupported)return u;ne?(C=Ot,x=Pt):ue(n),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(C=U(C)),T.uponSanitizeAttribute.length>0&&(x=U(x)),t.removed=[];const y=ae&&typeof u!="string"&&xt(u);if(y){kn(u);const j=Qt(u);if(typeof j=="string"){const F=S(j);if(!C[F]||Tt[F])throw Ht(u),Q("root node is forbidden and cannot be sanitized in-place")}if(Wt(u))throw Ht(u),Q("root node is clobbered and cannot be sanitized in-place");try{pe(u)}catch(F){throw Ht(u),F}}else if(xt(u))s=to("<!---->"),d=s.ownerDocument.importNode(u,!0),d.nodeType===H.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?s=d:s.appendChild(d),pe(s);else{if(!ut&&!V&&!nt&&u.indexOf("<")===-1)return P&&zt?dt(u):u;if(s=to(u),!s)return ut?null:zt?et:""}s&&ie&&X(s.firstChild);const E=y?u:s;try{const j=eo(E);for(;f=j.nextNode();)no(f,E),ao(f,E),gt(f.content)&&Gt(f.content)}catch(j){throw y&&(Ht(u),rt(t.removed,F=>{F.element&&Ut(F.element)})),j}if(y){let j=!1;if(rt(t.removed,F=>{F.element&&(F.element===u&&(j=!0),Ut(F.element))}),j)throw Q("a node selected for removal could not be safely returned; refusing to sanitize in place");return V&&fe(u),u}if(ut){if(V&&fe(s),Nt)for(m=tn.call(s.ownerDocument);s.firstChild;)m.appendChild(s.firstChild);else m=s;return(x.shadowroot||x.shadowrootmode)&&(m=on.call(o,m,!0)),m}let A=nt?s.outerHTML:s.innerHTML;return nt&&C["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&I(ti,s.ownerDocument.doctype.name)&&(A="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
|
|
11
|
+
`+A),V&&(A=jt(A)),P&&zt?dt(A):A},t.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ue(u),ne=!0,Ot=C,Pt=x},t.clearConfig=function(){mt=null,ne=!1,Ot=null,Pt=null,P=Zt,et=""},t.isValidAttribute=function(u,n,s){mt||ue({});const d=S(u),f=S(n);return io(d,f,s)},t.addHook=function(u,n){typeof n=="function"&&N(T,u)&&At(T[u],n)},t.removeHook=function(u,n){if(N(T,u)){if(n!==void 0){const s=Nn(T[u],n);return s===-1?void 0:zn(T[u],s,1)[0]}return uo(T[u])}},t.removeHooks=function(u){N(T,u)&&(T[u]=[])},t.removeAllHooks=function(){T=To()},t}var qt=Ko();const li=["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"],ci={"*":["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"]},di="data-editora-embed";function ui(a){if(!a||/\s/.test(a.trim()))return!1;try{const t=new URL(a.trim());return(t.protocol==="https:"||t.protocol==="http:")&&t.hostname.length>0}catch(t){return!1}}function qo(a,t,e,o){if((t==null?void 0:t.sanitize)===!1)return a;const i=t!=null&&t.allowedTags&&t.allowedTags.length>0?t.allowedTags:li,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:ci,p=new Set;for(const b of Object.values(c))for(const k of b)p.add(k);const h={ALLOWED_TAGS:r,ALLOWED_ATTR:Array.from(p)};if(!o)return qt.sanitize(a,h);const g=r.includes("iframe");qt.addHook("uponSanitizeElement",(b,k)=>{var O;if(k.tagName!=="iframe")return;const w=b;k.allowedTags.iframe=g||((O=w.getAttribute)==null?void 0:O.call(w,di))==="true"&&ui(w.getAttribute("src"))});try{return qt.sanitize(a,h)}finally{qt.removeHook("uponSanitizeElement")}}function Yo(a,t,e,o){return qo(a,t,o,!1)}function Vo(a,t,e){return(e==null?void 0:e.sanitizeOnPaste)===!1?a:Yo(a,t)}function Ae(a,t,e,o){return(e==null?void 0:e.sanitizeOnInput)===!1?a:qo(a,t,o,!0)}const fi=".resize-handle, .table-resize-handle, [data-rte-media-pending]",pi=/resize-handle|data-rte-media-pending|rte-media/;function _e(a){if(!a||!pi.test(a))return a;const t=document.createElement("template");t.innerHTML=a;const e=new Set;return t.content.querySelectorAll(fi).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 at(a){return a?_e(a.innerHTML):""}const Xt=class Xt{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}};Xt.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!1,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},Xt.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 Vt=Xt;class Xo{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=await this.create(t,e);return o&&this.loadedPlugins.set(t,o),o}async create(t,e){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),i}configure(t,e){this.applyPluginConfig(t,e)}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 Co=new Set;function hi(a,t){Co.has(a)||(Co.add(a),console.warn(`[Editora] The "${a}" option has no effect: ${t} It is still accepted so existing code keeps working, and will be removed in a future major release.`))}const mi=["bold","italic","underline","strikethrough","clearFormatting","heading","blockquote","list","link","table","history"],gi=new Set(["bold","italic","underline","strikethrough","clearFormatting","heading","blockquote","code","codeSample","list","checklist","textAlignment","indent","direction","textColor","backgroundColor","fontSize","fontFamily","formatPainter","format-painter","formatpainter","lineHeight","capitalization","history","link","table","trackChanges","versionDiff","version-diff","versiondiff","conditionalContent","conditional-content","conditionalcontent","dataBinding","data-binding","databinding","docSchema","doc-schema","docschema","translationWorkflow","translation-workflow","translationworkflow","contentRules","content-rules","contentrules","citations","citation","approvalWorkflow","approval-workflow","approvalworkflow","piiRedaction","pii-redaction","piiredaction","smartPaste","smart-paste","smartpaste","blocksLibrary","blocks-library","blockslibrary","mentions","mention","anchor","embedIframe","math","image","mergeTag","pageBreak","print","preview","specialCharacters","slashCommands","slash-commands","spellCheck","emojis","a11yChecker","comments","collaboration","document-manager","fullscreen","template","footnote"]),bi="all",xo={toggleBold:"bold",toggleItalic:"italic",toggleUnderline:"underline",toggleStrikethrough:"strikethrough",clearFormatting:"clearFormatting",setBlockType:"heading",toggleBlockquote:"blockquote",toggleSourceView:"code",insertCodeBlock:"codeSample",toggleBulletList:"list",toggleOrderedList:"list",toggleChecklist:"checklist",setTextAlignment:"textAlignment",increaseIndent:"indent",decreaseIndent:"indent",setDirectionLTR:"direction",setDirectionRTL:"direction",openTextColorPicker:"textColor",openBackgroundColorPicker:"backgroundColor",fontSize:"fontSize",setFontFamily:"fontFamily",toggleFormatPainter:"formatPainter",setLineHeight:"lineHeight",setCapitalization:"capitalization",undo:"history",redo:"history",openLinkDialog:"link",insertTable:"table",toggleTrackChanges:"trackChanges",openVersionDiff:"versionDiff",conditionalContent:"conditionalContent",openDataBindingDialog:"dataBinding",docSchema:"docSchema",translationWorkflow:"translationWorkflow",contentRules:"contentRules",citations:"citations",approvalWorkflow:"approvalWorkflow",piiRedaction:"piiRedaction",smartPaste:"smartPaste",blocksLibrary:"blocksLibrary",insertMention:"mentions",insertAnchor:"anchor",openEmbedIframeDialog:"embedIframe",insertMath:"math",insertImage:"image",insertVideo:"image",insertMergeTag:"mergeTag",insertPageBreak:"pageBreak",print:"print",togglePreview:"preview",insertSpecialCharacter:"specialCharacters",openSlashCommands:"slashCommands",toggleSpellCheck:"spellCheck",openEmojiDialog:"emojis",toggleA11yChecker:"a11yChecker",addComment:"comments",toggleComments:"comments",importWord:"document-manager",exportWord:"document-manager",exportPdf:"document-manager",toggleFullscreen:"fullscreen",insertTemplate:"template",insertFootnote:"footnote"};function yi(a,t){var o,i;if(!a)return[];const e=[];for(const r of a.split(/[\s|]+/)){if(!r)continue;const l=Oo[r]||r,c=(i=(o=xo[l])!=null?o:xo[r])!=null?i:t(r)?r:void 0;c&&!e.includes(c)&&e.push(c)}return e}const Ei='.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.editora-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}}editora-editor[data-loading]{display:block;position:relative;min-height:160px;border:1px solid var(--ui-color-border, #ddd);border-radius:var(--ui-radius, 4px);background:var(--ui-color-surface, #fff)}editora-editor[data-loading]:before{content:"";position:absolute;inset:0 0 auto;height:46px;border-bottom:1px solid var(--ui-color-border, #ddd);border-radius:var(--ui-radius, 4px) var(--ui-radius, 4px) 0 0;background:linear-gradient(90deg,var(--ui-color-surface-alt, #f5f5f5) 0%,color-mix(in srgb,var(--ui-color-surface-alt, #f5f5f5) 70%,var(--ui-color-border, #ddd)) 50%,var(--ui-color-surface-alt, #f5f5f5) 100%);background-size:220% 100%;animation:editora-loading-shimmer 1.2s linear infinite}editora-editor[data-loading]:after{content:"Loading editor…";position:absolute;top:62px;left:16px;font:14px/1.4 var(--ui-font-family, system-ui, sans-serif);color:var(--ui-color-muted, #6b7280)}editora-editor[data-loading]>*{visibility:hidden}@keyframes editora-loading-shimmer{to{background-position:-220% 0}}@media(prefers-reduced-motion:reduce){editora-editor[data-loading]:before{animation:none}}';let Yt;const vi="__editoraCommandEditorRoot",ki="__editoraLastCommandButton",Ao="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",So=".rte-content, .editora-content",wi="Rich text editor",Ti=new Set(["collaboration"]),ke="data-editora-disabled-by-host",Se=new Set;let J=null,Lo=!1,we=null,Te=null;function _o(a){if(!(a instanceof HTMLElement))return!1;const t=a;return typeof t.execCommand=="function"&&(t.tagName.toLowerCase()==="editora-editor"||t.classList.contains("editora-editor")||t.hasAttribute("data-editora-editor"))}function Ci(a){return a?a.nodeType===Node.ELEMENT_NODE?a:a.parentElement:null}function _t(a){if(!a)return null;if(_o(a))return a;const t=a.matches(Ao)?a:a.closest(Ao);return!t||!_o(t)?null:t}function xi(){var i;if(typeof window=="undefined")return null;const a=window[vi];if(a instanceof HTMLElement){const r=_t(a);if(r)return r;const l=a.matches(So)?a:a.querySelector(So);if(l){const c=_t(l);if(c)return c}}const t=window[ki];if(t instanceof HTMLElement){const r=_t(t);if(r)return r}const e=document.activeElement;if(e){const r=_t(e);if(r)return r}const o=(i=window.getSelection)==null?void 0:i.call(window);if(o&&o.rangeCount>0){const r=_t(Ci(o.getRangeAt(0).startContainer));if(r)return r}if(J&&J.isConnected)return J;for(const r of Se)if(r.isConnected)return r;return null}function Ai(){if(typeof window=="undefined"||Lo)return;we=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,Te=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const a=(t,...e)=>{const o=xi();return o?o.execCommand(t,...e):we?we(t,...e):Te?Te(t,...e):!1};window.executeEditorCommand=a,window.execEditorCommand=a,Lo=!0}function Si(){const a="editora-webcomponent-styles";if(!document.getElementById(a)){const t=document.createElement("style");t.id=a,t.textContent=Ei,document.head.appendChild(t)}}function Qo(){if(!Yt){const a=st.__globalPluginLoader;a?Yt=a:Yt=new Xo}return Yt}function Li(a){const t=Qo();Object.entries(a).forEach(([e,o])=>{t.register(e,o)})}const _i=typeof HTMLElement=="undefined"?class{}:HTMLElement;class st extends _i{constructor(){if(super(),this.pluginLoader=Qo(),this.config={},this.isInitialized=!1,this.buildGeneration=0,this.keyboardShortcutManager=new Io,this.lastAutosavedContent="",this.preservedContent=null,this.loadedPlugins=[],this.pluginInstances=new Map,this.lastBeforeInputType=null,this.pendingHistorySnapshot=null,this.hasConnected=!1,this.reinitializeQueued=!1,this.lastReportedContent=null,Si(),!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.hasConnected=!0,this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(st.__globalPluginLoader){this.pluginLoader=st.__globalPluginLoader;return}return new Promise(t=>{const e=()=>{st.__globalPluginLoader?(this.pluginLoader=st.__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(),this.adoptConfiguredContent(t),await this.waitForPluginLoader(),await this.initialize()):this.adoptConfiguredContent(t)}adoptConfiguredContent(t){typeof t.content=="string"&&(this.preservedContent=t.content)}applyThemeClass(t){Array.from(this.classList).forEach(e=>{e.startsWith("editora-theme-")&&this.classList.remove(e)}),t&&this.classList.add(`editora-theme-${t}`)}async initialize(){var r;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;const t=++this.buildGeneration;this.setAttribute("data-editora-editor","true"),Se.add(this),J||(J=this),Ai(),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.classList.toggle("editora-disabled",this.isEditorDisabled()),this.applyThemeClass(this.config.theme),this.isMenubarRequested()&&hi("menubar","<editora-editor> does not render a menu bar."),this.setAttribute("data-loading","true"),this.setAttribute("aria-busy","true");const e=await this.loadPlugins();if(t!==this.buildGeneration||!this.isConnected)return;if(this.loadedPlugins=e,e.forEach(l=>{if(l.init&&typeof l.init=="function")try{l.init({editorElement:this})}catch(c){console.error(`[RichTextEditor] Error initializing plugin ${l.name}:`,c)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const l=this.innerHTML.trim();l&&this.setAttribute("data-initial-content",l)}const o=this.preservedContent;this.preservedContent=null;const i=this.sanitizeLoadedContent((r=o!=null?o:this.restoreAutosavedContent())!=null?r:this.getAttribute("data-initial-content")||"");this.engine=new Ro({content:i,plugins:e,readonly:!!this.config.readonly||this.isEditorDisabled()}),this.createUI(e,i),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),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=this.config.plugins,e=typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t:[],o=this.getAccessibilityConfig().checker===!0;if(e.length===0){const r=this.resolveDefaultPluginNames();return o&&r.push("a11yChecker"),this.loadPluginsByName(r)}const i=[];for(const r of e)if(typeof r!="string")i.push(r);else if(r===bi)i.push(...await this.loadPluginsByName(this.resolveAllPluginNames()));else{const l=await this.loadPlugin(r,this.getPluginLoadConfig(r));l&&i.push(l)}if(o&&!i.some(r=>(r==null?void 0:r.name)==="a11yChecker")){const r=await this.loadPlugin("a11yChecker",this.getPluginLoadConfig("a11yChecker"));r&&i.push(r)}return this.withoutDuplicatePlugins(i)}resolveDefaultPluginNames(){const t=this.pluginLoader.getRegisteredPluginNames(),e=i=>t.includes(i),o=new Set([...mi,...yi(this.resolveToolbarItems(),e)]);for(const i of t)(!gi.has(i)||this.pluginLoader.isLoaded(i)||this.isPluginRequestedByConfig(i))&&o.add(i);return t.filter(i=>o.has(i))}resolveAllPluginNames(){return this.pluginLoader.getRegisteredPluginNames().filter(t=>!Ti.has(t)||this.getPluginLoadConfig(t))}async loadPluginsByName(t){const e=[];for(const o of t){const i=await this.loadPlugin(o,this.getPluginLoadConfig(o));i&&e.push(i)}return this.withoutDuplicatePlugins(e)}withoutDuplicatePlugins(t){const e=new Set;return t.filter(o=>o!=null&&o.name?e.has(o.name)?!1:(e.add(o.name),!0):!0)}isPluginRequestedByConfig(t){if(!this.getPluginLoadConfig(t))return!1;if(t!=="spellCheck")return!0;const o=this.config.pluginConfig;return!!(o&&typeof o=="object"&&(o.spellCheck||o.spellcheck))}async loadPlugin(t,e){const o=this.pluginInstances.get(t);if(o)return e&&this.pluginLoader.configure(o,e),o;const i=await this.pluginLoader.create(t,e);return i&&this.pluginInstances.set(t,i),i}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||this.isEditorDisabled()?"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||wi)}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&&!this.isEditorDisabled()?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 Ae(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(at(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 Po({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},t,this.pluginLoader),this.toolbar.setCommandHandler((r,l)=>{var c;if(this.isEditorDisabled())return!1;if(this.contentElement){this.contentElement.focus();const p=window.getSelection();if(!p||p.rangeCount===0||!this.contentElement.contains(p.anchorNode)){const h=document.createRange(),g=this.contentElement.lastChild||this.contentElement;g.nodeType===Node.TEXT_NODE?h.setStart(g,((c=g.textContent)==null?void 0:c.length)||0):g.nodeType===Node.ELEMENT_NODE?(h.selectNodeContents(g),h.collapse(!1)):h.setStart(this.contentElement,0),h.collapse(!0),p==null||p.removeAllRanges(),p==null||p.addRange(h)}}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||this.isEditorDisabled()?"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 p=c.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(p)}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 No({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 zo({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.setToolbarControlsDisabled(this.isEditorDisabled()),this.lastReportedContent=at(this.contentElement),this.config.autofocus&&!this.isEditorDisabled()&&setTimeout(()=>{var r;return(r=this.contentElement)==null?void 0:r.focus()},0)}isMenubarRequested(){var o;const t=(o=this.jsConfig)==null?void 0:o.menubar;if(t!==void 0)return t===!0||typeof t=="object"&&t!==null&&t.enabled!==!1;const e=this.getAttribute("menubar");return e!==null&&e!=="false"}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})}isEditorDisabled(){return this.config.disabled===!0}applyDisabledState(){var e,o;const t=this.isEditorDisabled();this.classList.toggle("editora-disabled",t),t&&((e=this.floatingToolbar)==null||e.hide()),this.contentElement&&(this.contentElement.contentEditable=t||this.config.readonly?"false":"true",this.applyAccessibilitySettings()),(o=this.engine)==null||o.setReadonly(t||!!this.config.readonly),this.setToolbarControlsDisabled(t)}setToolbarControlsDisabled(t){if(!this.toolbarElement)return;this.toolbarElement.querySelectorAll("button, input, select, textarea").forEach(o=>{t?o.disabled||(o.disabled=!0,o.setAttribute(ke,"")):o.hasAttribute(ke)&&(o.disabled=!1,o.removeAttribute(ke))})}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(),p=this.getSecurityConfig(),h=this.lastBeforeInputType;if(this.lastBeforeInputType=null,p.sanitizeOnInput!==!1&&c.sanitize!==!1&&!h){const w=Ae(i,c,p,r);if(w!==i){const O=window.getSelection(),tt=O&&O.rangeCount>0?O.getRangeAt(0):null;if(this.contentElement.innerHTML=w,tt&&O)try{O.removeAllRanges(),O.addRange(tt)}catch($){}i=w}}this.recordInputHistory(i),this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const b=()=>{this.emitContentChange(_e(i))};l.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(b,l.debounceInputMs):b(),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,b;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=((b=o.clipboardData)==null?void 0:b.getData("text/plain"))||"",c=this.getContentSanitizeConfig(),p=this.getSecurityConfig(),h=!!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&&h&&l){document.execCommand("insertText",!1,l);return}if(r){p.sanitizeOnPaste!==!1&&c.sanitize!==!1&&(r=Vo(r,c,p)),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",()=>{if(this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement){const o=at(this.contentElement);o!==this.lastReportedContent&&this.emitContentChange(o)}this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",o=>{!this.getAccessibilityConfig().keyboardNavigation||this.isEditorDisabled()||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)}emitContentChange(t){this.lastReportedContent=t,this.dispatchEvent(new CustomEvent("content-change",{detail:{html:t},bubbles:!0}))}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}=Uo(o),l=Ho(this.contentElement);let c,p;const h=this.getSelectionRangeInEditor();h&&(c=Bo(this.contentElement,h),h.collapsed||(p=jo(h,c),c=void 0)),this.statusBar.update({wordCount:i,charCount:r,lineCount:l,cursorPosition:c,selectionInfo:p})}isReadonlyAttribute(t){return t!==null&&t!=="false"}handleAttributeChange(t,e){switch(t){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(e)||this.isEditorDisabled()?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(e)||this.isEditorDisabled());break;case"disabled":this.applyDisabledState();break;case"theme":this.applyThemeClass(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.hasConnected&&this.scheduleReinitialize();break}}scheduleReinitialize(){this.reinitializeQueued||(this.reinitializeQueued=!0,queueMicrotask(()=>{this.reinitializeQueued=!1,this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(t=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",t)})}))}))}resolveConfig(){const t={};for(let e=0;e<this.attributes.length;e++){const o=this.attributes[e];t[o.name]=o.value}return Vt.resolve({jsConfig:this.jsConfig,attributes:t})}getAPI(){return{getContent:()=>at(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.buildGeneration+=1,this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&(this.preservedContent=at(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.lastReportedContent=null,this.isInitialized=!1,Se.delete(this),J===this&&(J=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){return at(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=Do;exports.ConfigResolver=Vt;exports.EditorEngine=Ro;exports.EditorState=It;exports.FloatingToolbar=No;exports.KeyboardShortcutManager=Io;exports.PluginLoader=Xo;exports.PluginManager=Le;exports.RichTextEditorElement=st;exports.Schema=Mo;exports.StatusBar=zo;exports.ToolbarRenderer=Po;exports.calculateTextStats=Uo;exports.countLines=Ho;exports.createPluginManager=Sn;exports.getCleanEditorHTML=at;exports.getCursorPosition=Bo;exports.getSelectionInfo=jo;exports.getTextOffset=Fo;exports.initWebComponent=Li;exports.sanitizeHTML=Yo;exports.sanitizeInputHTML=Ae;exports.sanitizePastedHTML=Vo;exports.stripEditorUiArtifacts=_e;
|
|
12
|
+
//# sourceMappingURL=index-GWw_bIws.js.map
|