@richscripts/richtexteditor 2.4.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 +360 -0
- package/admin/index.d.ts +100 -0
- package/admin/index.js +94 -0
- package/angular/component.ts +284 -0
- package/angular/index.d.ts +80 -0
- package/angular/index.ts +24 -0
- package/headless/index.d.ts +65 -0
- package/headless/index.js +272 -0
- package/index.d.ts +1412 -0
- package/integrations/shared.d.ts +138 -0
- package/integrations/shared.js +5182 -0
- package/package.json +130 -0
- package/react/index.d.ts +104 -0
- package/react/index.js +310 -0
- package/richtexteditor/CHANGELOG.md +1876 -0
- package/richtexteditor/all_plugins.js +31125 -0
- package/richtexteditor/all_plugins.min.js +78 -0
- package/richtexteditor/lang/rte-lang-af.js +193 -0
- package/richtexteditor/lang/rte-lang-ar.js +193 -0
- package/richtexteditor/lang/rte-lang-bg.js +193 -0
- package/richtexteditor/lang/rte-lang-bn.js +193 -0
- package/richtexteditor/lang/rte-lang-bs.js +193 -0
- package/richtexteditor/lang/rte-lang-ca.js +193 -0
- package/richtexteditor/lang/rte-lang-cs.js +193 -0
- package/richtexteditor/lang/rte-lang-cy.js +193 -0
- package/richtexteditor/lang/rte-lang-da.js +193 -0
- package/richtexteditor/lang/rte-lang-de.js +193 -0
- package/richtexteditor/lang/rte-lang-el.js +193 -0
- package/richtexteditor/lang/rte-lang-en.js +6 -0
- package/richtexteditor/lang/rte-lang-es.js +193 -0
- package/richtexteditor/lang/rte-lang-et.js +193 -0
- package/richtexteditor/lang/rte-lang-fa.js +193 -0
- package/richtexteditor/lang/rte-lang-fi.js +193 -0
- package/richtexteditor/lang/rte-lang-fil.js +193 -0
- package/richtexteditor/lang/rte-lang-fj.js +193 -0
- package/richtexteditor/lang/rte-lang-fr.js +193 -0
- package/richtexteditor/lang/rte-lang-ga.js +193 -0
- package/richtexteditor/lang/rte-lang-gu.js +193 -0
- package/richtexteditor/lang/rte-lang-he.js +193 -0
- package/richtexteditor/lang/rte-lang-hi.js +193 -0
- package/richtexteditor/lang/rte-lang-hr.js +193 -0
- package/richtexteditor/lang/rte-lang-ht.js +193 -0
- package/richtexteditor/lang/rte-lang-hu.js +193 -0
- package/richtexteditor/lang/rte-lang-id.js +193 -0
- package/richtexteditor/lang/rte-lang-is.js +193 -0
- package/richtexteditor/lang/rte-lang-it.js +193 -0
- package/richtexteditor/lang/rte-lang-ja.js +193 -0
- package/richtexteditor/lang/rte-lang-kn.js +193 -0
- package/richtexteditor/lang/rte-lang-ko.js +193 -0
- package/richtexteditor/lang/rte-lang-lt.js +193 -0
- package/richtexteditor/lang/rte-lang-lv.js +193 -0
- package/richtexteditor/lang/rte-lang-mg.js +193 -0
- package/richtexteditor/lang/rte-lang-mi.js +193 -0
- package/richtexteditor/lang/rte-lang-ml.js +193 -0
- package/richtexteditor/lang/rte-lang-mr.js +193 -0
- package/richtexteditor/lang/rte-lang-ms.js +193 -0
- package/richtexteditor/lang/rte-lang-mt.js +193 -0
- package/richtexteditor/lang/rte-lang-mww.js +193 -0
- package/richtexteditor/lang/rte-lang-nb.js +193 -0
- package/richtexteditor/lang/rte-lang-nl.js +193 -0
- package/richtexteditor/lang/rte-lang-otq.js +193 -0
- package/richtexteditor/lang/rte-lang-pa.js +193 -0
- package/richtexteditor/lang/rte-lang-pl.js +193 -0
- package/richtexteditor/lang/rte-lang-pt-pt.js +193 -0
- package/richtexteditor/lang/rte-lang-pt.js +193 -0
- package/richtexteditor/lang/rte-lang-ro.js +193 -0
- package/richtexteditor/lang/rte-lang-ru.js +193 -0
- package/richtexteditor/lang/rte-lang-sk.js +193 -0
- package/richtexteditor/lang/rte-lang-sl.js +193 -0
- package/richtexteditor/lang/rte-lang-sm.js +193 -0
- package/richtexteditor/lang/rte-lang-sr-Cyrl.js +193 -0
- package/richtexteditor/lang/rte-lang-sr-Latn.js +193 -0
- package/richtexteditor/lang/rte-lang-sv.js +193 -0
- package/richtexteditor/lang/rte-lang-sw.js +193 -0
- package/richtexteditor/lang/rte-lang-ta.js +193 -0
- package/richtexteditor/lang/rte-lang-te.js +193 -0
- package/richtexteditor/lang/rte-lang-th.js +193 -0
- package/richtexteditor/lang/rte-lang-tlh-Latn.js +193 -0
- package/richtexteditor/lang/rte-lang-tlh-Piqd.js +193 -0
- package/richtexteditor/lang/rte-lang-to.js +193 -0
- package/richtexteditor/lang/rte-lang-tr.js +193 -0
- package/richtexteditor/lang/rte-lang-ty.js +193 -0
- package/richtexteditor/lang/rte-lang-uk.js +193 -0
- package/richtexteditor/lang/rte-lang-ur.js +193 -0
- package/richtexteditor/lang/rte-lang-vi.js +193 -0
- package/richtexteditor/lang/rte-lang-yua.js +193 -0
- package/richtexteditor/lang/rte-lang-zh-Hans.js +193 -0
- package/richtexteditor/lang/rte-lang-zh-Hant.js +193 -0
- package/richtexteditor/lang/rte-lang.js +1 -0
- package/richtexteditor/plugins/-combine-plugin.txt +2 -0
- package/richtexteditor/plugins/-combine-plugins.bat +20 -0
- package/richtexteditor/plugins/a11yenhance.js +90 -0
- package/richtexteditor/plugins/accessibilitychecker.js +579 -0
- package/richtexteditor/plugins/aitoolkit.css +15830 -0
- package/richtexteditor/plugins/aitoolkit.js +19171 -0
- package/richtexteditor/plugins/all_plugins.js +31125 -0
- package/richtexteditor/plugins/all_plugins.min.js +78 -0
- package/richtexteditor/plugins/autoembed.js +174 -0
- package/richtexteditor/plugins/blocktypes.js +175 -0
- package/richtexteditor/plugins/bookmarkcard.js +226 -0
- package/richtexteditor/plugins/charlimit.js +195 -0
- package/richtexteditor/plugins/comments.js +672 -0
- package/richtexteditor/plugins/contentminimap.js +369 -0
- package/richtexteditor/plugins/crdt-engine.js +8905 -0
- package/richtexteditor/plugins/crdt-engine.min.js +5 -0
- package/richtexteditor/plugins/dialoga11y.js +174 -0
- package/richtexteditor/plugins/dictation.js +268 -0
- package/richtexteditor/plugins/documentimport.js +369 -0
- package/richtexteditor/plugins/documentoutline.js +341 -0
- package/richtexteditor/plugins/emailtoolkit.js +165 -0
- package/richtexteditor/plugins/emojiautocomplete.js +241 -0
- package/richtexteditor/plugins/foldheadings.js +181 -0
- package/richtexteditor/plugins/ghostcomplete.js +297 -0
- package/richtexteditor/plugins/html2pdf.js +158 -0
- package/richtexteditor/plugins/imageeditor.js +159 -0
- package/richtexteditor/plugins/insertcode.js +319 -0
- package/richtexteditor/plugins/insertemoji.js +229 -0
- package/richtexteditor/plugins/insertgallery.js +362 -0
- package/richtexteditor/plugins/inserttemplate.js +261 -0
- package/richtexteditor/plugins/localdraft.js +213 -0
- package/richtexteditor/plugins/markdownexport.js +110 -0
- package/richtexteditor/plugins/mathdialog.js +153 -0
- package/richtexteditor/plugins/mentionplugin.js +534 -0
- package/richtexteditor/plugins/mermaiddiagram.js +294 -0
- package/richtexteditor/plugins/readabilitystats.js +148 -0
- package/richtexteditor/plugins/readaloud.js +243 -0
- package/richtexteditor/plugins/restrictedediting.js +208 -0
- package/richtexteditor/plugins/revisionhistory.js +670 -0
- package/richtexteditor/plugins/samples/insertcode_v1.js +76 -0
- package/richtexteditor/plugins/slashcommand.js +705 -0
- package/richtexteditor/plugins/smartchips.js +250 -0
- package/richtexteditor/plugins/spellcheck.js +181 -0
- package/richtexteditor/plugins/todolist.js +137 -0
- package/richtexteditor/plugins/trackedchanges.js +658 -0
- package/richtexteditor/plugins/tui.image-editor/fabric.min.js +8 -0
- package/richtexteditor/plugins/tui.image-editor/note.txt +5 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-a.svg +235 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-b.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-c.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-d.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/tui-code-snippet.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.css +6 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.css +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.js +15 -0
- package/richtexteditor/plugins/typewriter.js +203 -0
- package/richtexteditor/plugins/wordexport.js +0 -0
- package/richtexteditor/plugins/yjscollab.js +693 -0
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.js +335 -0
- package/richtexteditor/rte-config.js +933 -0
- package/richtexteditor/rte.js +943 -0
- package/richtexteditor/rte_mobile.css +234 -0
- package/richtexteditor/rte_theme_default.css +4819 -0
- package/richtexteditor/runtime/colorpicker_more_ns.htm +2613 -0
- package/richtexteditor/runtime/help.htm +162 -0
- package/richtexteditor/runtime/images/1x1.gif +0 -0
- package/richtexteditor/runtime/images/cpie_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpie_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpie_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpie_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace1.png +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace2.png +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical1.png +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical2.png +0 -0
- package/richtexteditor/runtime/images/cpns_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpns_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpns_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_hue2.png +0 -0
- package/richtexteditor/runtime/images/formbn.gif +0 -0
- package/richtexteditor/runtime/images/multiclavier.gif +0 -0
- package/richtexteditor/runtime/richtexteditor_content.css +362 -0
- package/richtexteditor/runtime/richtexteditor_preview.css +302 -0
- package/richtexteditor/runtime/richtexteditor_preview.js +1 -0
- package/server/index.d.ts +21 -0
- package/server/index.js +23 -0
- package/svelte/index.d.ts +19 -0
- package/svelte/index.js +59 -0
- package/vue/index.d.ts +94 -0
- package/vue/index.js +291 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_a11yenhance=RTE_Plugin_A11yEnhance,typeof RTE_DefaultConfig.a11yEnhance>"u"&&(RTE_DefaultConfig.a11yEnhance=!0);function RTE_Plugin_A11yEnhance(){var S=this,c,i;S.PluginName="A11yEnhance",S.InitConfig=function(E){c=E},S.InitEditor=function(E){if(i=E,c.a11yEnhance!==!1){A();try{i.attachEvent("ready",A)}catch{}try{i.attachEvent("aftersethtml",A)}catch{}setTimeout(A,0),setTimeout(A,200),i.applyAccessibilityMetadata=A}};function f(){return c.contentAriaLabel||c.contentLabel||"Rich text editor. Editing area."}function N(){if(c.contentLang)return c.contentLang;try{var E=c.container&&c.container.ownerDocument&&c.container.ownerDocument.documentElement.getAttribute("lang");if(E)return E}catch{}try{var C=typeof document<"u"&&document.documentElement.getAttribute("lang");if(C)return C}catch{}return"en"}function A(){var E=i.getDocument();if(E){try{var C=N();C&&E.documentElement&&E.documentElement.getAttribute("lang")!==C&&E.documentElement.setAttribute("lang",C)}catch{}try{var o=E.defaultView&&E.defaultView.frameElement;o&&!o.getAttribute("title")&&o.setAttribute("title",f())}catch{}try{var v=i.getEditable();v&&v.nodeType===1&&(v.getAttribute("role")||v.setAttribute("role","textbox"),v.getAttribute("aria-multiline")||v.setAttribute("aria-multiline","true"),!v.getAttribute("aria-label")&&!v.getAttribute("aria-labelledby")&&v.setAttribute("aria-label",f()))}catch{}}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_accessibilitychecker=RTE_Plugin_AccessibilityChecker;function RTE_Plugin_AccessibilityChecker(){var S=this,c,i,f=null,N=null,A=null,E=null,C=null,o=0,v=null,w=-1;S.PluginName="AccessibilityChecker",S.InitConfig=function(p){c=p,c.accessibilityCheckerEnabled!==!1&&(typeof c.accessibilityCheckerAutoOpen!="boolean"&&(c.accessibilityCheckerAutoOpen=!1),c.accessibilityCheckerTitle=c.accessibilityCheckerTitle||"Accessibility",c.accessibilityCheckerHint=c.accessibilityCheckerHint||"Review heading structure, image alt text, and table headers without leaving the editor.",c.accessibilityCheckerEmptyText=c.accessibilityCheckerEmptyText||"No accessibility issues found in the current document.",q("toolbar_default","#{accessibilitychecker}"),q("toolbar_full","#{accessibilitychecker}"))},S.InitEditor=function(p){i=p,c.accessibilityCheckerEnabled!==!1&&(i.accessibilityChecker={close:function(){D()},getIssues:function(){return v?v.issues.slice():[]},open:function(){b()},refresh:function(){return I()},repair:function(k,h){return u(k,h)},run:function(){return I()},toggle:function(){g()}},B(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.accessibilitychecker=function(k){return i.createToolbarButton(k)},i.attachEvent("exec_command_accessibilitychecker",function(k){k.returnValue=!0,k.stopBubble=!0,g()}),i.attachEvent("change",function(){L()}),H(),I(),c.accessibilityCheckerAutoOpen&&b())};function q(p,k){c[p]&&c[p].indexOf(k)===-1&&(c[p]=c[p]+k)}function B(){var p=c.container.ownerDocument;if(!p.getElementById("rte-accessibility-checker-style")){var k=p.createElement("style");k.id="rte-accessibility-checker-style",k.innerHTML=[".rte-a11y-shell{display:flex;align-items:stretch;gap:10px;}",".rte-a11y-shell>.rte-a11y-host{flex:1 1 auto;min-width:0;}",".rte-a11y-panel{display:none;flex:0 0 310px;min-width:270px;max-width:min(360px,32vw);border:1px solid rgba(148,163,184,.22);border-radius:16px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));box-shadow:0 18px 42px rgba(29,78,216,.12),0 2px 8px rgba(15,23,42,.06);overflow:hidden;color:#172033;font-family:Aptos,'Segoe UI',sans-serif;}",".rte-a11y-shell.is-open>.rte-a11y-panel{display:flex;flex-direction:column;}",".rte-a11y-header{padding:12px 12px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.72);}",".rte-a11y-kicker{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-a11y-title{margin-top:3px;font-size:15px;line-height:1.2;font-weight:850;color:#172033;}",".rte-a11y-copy{margin-top:5px;font-size:12px;line-height:1.42;color:#52657e;}",".rte-a11y-toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 8px 14px;border-bottom:1px solid rgba(148,163,184,.16);gap:10px;background:rgba(255,255,255,.52);}",".rte-a11y-count{min-width:0;font-size:12px;font-weight:750;color:#52657e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}",".rte-a11y-actions{display:flex;align-items:center;gap:6px;}",".rte-a11y-link{appearance:none;border:1px solid rgba(100,116,139,.18);background:#fff;color:#315277;cursor:pointer;font-size:12px;font-weight:750;padding:6px 9px;border-radius:999px;line-height:1;}",".rte-a11y-link:hover,.rte-a11y-link:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28);}",".rte-a11y-body{padding:6px;overflow:auto;min-height:160px;max-height:560px;display:flex;flex-direction:column;gap:8px;scrollbar-width:thin;}",".rte-a11y-list{display:flex;flex-direction:column;gap:6px;}",".rte-a11y-item{appearance:none;width:100%;text-align:left;border:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.84);cursor:pointer;border-radius:14px;padding:10px;box-shadow:0 8px 18px rgba(15,23,42,.04);transition:background 160ms ease,box-shadow 160ms ease,transform 160ms ease;}",".rte-a11y-item:hover,.rte-a11y-item:focus-visible{background:#f8fbff;border-color:rgba(37,99,235,.24);}",".rte-a11y-item.is-active{border-color:rgba(37,99,235,.36);background:#eef4ff;box-shadow:0 12px 28px rgba(37,99,235,.14);transform:translateY(-1px);}",".rte-a11y-item-top{display:flex;align-items:center;justify-content:space-between;gap:10px;}",".rte-a11y-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:10px;line-height:1;font-weight:850;letter-spacing:.08em;text-transform:uppercase;}",".rte-a11y-badge-warning{background:#fff8e8;color:#92400e;border:1px solid rgba(245,158,11,.18);}",".rte-a11y-badge-error{background:#fff1f2;color:#9f1239;border:1px solid rgba(159,18,57,.18);}",".rte-a11y-code{font-size:11px;color:#64748b;font-family:Consolas,'Cascadia Mono',monospace;}",".rte-a11y-message{margin-top:7px;font-size:13px;line-height:1.42;color:#172033;}",".rte-a11y-detail{border:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.86);border-radius:14px;padding:11px;display:flex;flex-direction:column;gap:9px;box-shadow:0 8px 18px rgba(15,23,42,.04);}",".rte-a11y-detail-title{font-size:13px;font-weight:850;color:#172033;}",".rte-a11y-detail-copy{font-size:12px;line-height:1.45;color:#52657e;}",".rte-a11y-field{display:flex;flex-direction:column;gap:6px;}",".rte-a11y-label{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-a11y-input{width:100%;border:1px solid rgba(148,163,184,.24);border-radius:12px;padding:9px 10px;font-size:13px;line-height:1.4;box-sizing:border-box;background:#fff;}",".rte-a11y-input:focus{outline:2px solid rgba(37,99,235,.18);border-color:rgba(37,99,235,.38);}",".rte-a11y-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}",".rte-a11y-button{appearance:none;border:1px solid #1d67ba;border-radius:999px;background:#1d67ba;color:#fff;padding:8px 12px;font-size:12px;font-weight:750;cursor:pointer;box-shadow:0 8px 16px rgba(29,103,186,.18);}",".rte-a11y-button-secondary{background:#fff;color:#315277;border-color:rgba(100,116,139,.18);box-shadow:none;}",".rte-a11y-button:hover,.rte-a11y-button:focus-visible{transform:translateY(-1px);}",".rte-a11y-empty{padding:14px;border-radius:14px;background:#fff;color:#52657e;font-size:13px;font-weight:700;line-height:1.55;border:1px dashed rgba(148,163,184,.34);}","@media (max-width: 1420px){.rte-a11y-shell{display:block;}.rte-a11y-panel{margin-top:12px;max-width:none;width:100%;}.rte-a11y-body{max-height:360px;}}"].join(""),p.head.appendChild(k)}}function H(){if(f)return f;var p=c.container,k=p.ownerDocument;f=k.createElement("div"),f.className="rte-a11y-shell";var h=k.createElement("div");h.className="rte-a11y-host";var x=p.parentNode;x.insertBefore(f,p),f.appendChild(h),h.appendChild(p),N=k.createElement("aside"),N.className="rte-a11y-panel",N.setAttribute("aria-label",c.accessibilityCheckerTitle),N.setAttribute("role","complementary");var z=k.createElement("div");z.className="rte-a11y-header",z.innerHTML='<div class="rte-a11y-kicker">Accessibility</div><div class="rte-a11y-title"></div><div class="rte-a11y-copy"></div>',z.querySelector(".rte-a11y-title").innerText=c.accessibilityCheckerTitle,z.querySelector(".rte-a11y-copy").innerText=c.accessibilityCheckerHint;var J=k.createElement("div");J.className="rte-a11y-toolbar",J.innerHTML='<div class="rte-a11y-count" data-rte-a11y-count="1"></div><div class="rte-a11y-actions"><button type="button" class="rte-a11y-link" data-rte-a11y-refresh="1">Refresh</button><button type="button" class="rte-a11y-link" data-rte-a11y-close="1" aria-label="Hide accessibility checker">Hide</button></div>',J.querySelector("[data-rte-a11y-refresh]").onclick=function(){I()},J.querySelector("[data-rte-a11y-close]").onclick=function(){D()};var ee=k.createElement("div");return ee.className="rte-a11y-body",A=k.createElement("div"),A.className="rte-a11y-list",E=k.createElement("div"),E.className="rte-a11y-empty",E.innerText=c.accessibilityCheckerEmptyText,C=k.createElement("div"),C.className="rte-a11y-detail",ee.appendChild(A),ee.appendChild(E),ee.appendChild(C),N.appendChild(z),N.appendChild(J),N.appendChild(ee),f.appendChild(N),f}function g(){f&&f.classList.contains("is-open")?D():b()}function b(){H(),f.classList.add("is-open"),X(),P()}function D(){f&&(f.classList.remove("is-open"),P())}function P(){var p=function(){try{i&&typeof i.fireEvent=="function"&&i.fireEvent("resize")}catch{}try{i&&typeof i.updateLayout=="function"&&i.updateLayout()}catch{}try{var h=c.container.ownerDocument,x=h.defaultView||window;x.dispatchEvent(new x.Event("resize"))}catch{}};p();var k=typeof requestAnimationFrame=="function"?requestAnimationFrame:function(h){return setTimeout(h,16)};k(p)}function L(){clearTimeout(o),o=setTimeout(function(){I()},120)}function I(){H();var p=window.RichTextEditor,k=i.getJSON?i.getJSON():null;return v=p&&typeof p.auditAccessibility=="function"?p.auditAccessibility(k):O(),v.issues.length?(w<0||w>=v.issues.length)&&(w=0):w=-1,X(),v}function u(p,k){if(!v||!v.issues||!v.issues[p])return I();var h=window.RichTextEditor;if(!h||typeof h.repairAccessibilityIssue!="function")return K(v.issues[p],k||{});var x=h.repairAccessibilityIssue(i.getJSON(),v.issues[p],k||{});return i.setJSON(x),w=p,I()}function y(p){if(p){if(p._target&&typeof p._target.scrollIntoView=="function"){p._target.scrollIntoView({behavior:"smooth",block:"center"}),i.focus();return}var k=i.getEditable?i.getEditable():null;if(k){var h=/^content\[(\d+)\]/.exec(p.path||"");if(h){for(var x=parseInt(h[1],10),z=[],J=0;J<k.childNodes.length;J++)k.childNodes[J]&&k.childNodes[J].nodeType===1&&z.push(k.childNodes[J]);var ee=z[x];ee&&typeof ee.scrollIntoView=="function"&&ee.scrollIntoView({behavior:"smooth",block:"center"}),i.focus()}}}}function O(){var p=i.getEditable?i.getEditable():null,k=[];if(!p)return{document:null,issues:k,valid:!0,source:"dom"};for(var h=[],x=0;x<p.childNodes.length;x++){var z=p.childNodes[x];!z||z.nodeType!==1||h.push(z)}for(var J=0,ee=0;ee<h.length;ee++){var ue=h[ee],ve=String(ue.nodeName||"").toLowerCase(),re="content["+ee+"]";if(/^h[1-6]$/.test(ve)){var U=parseInt(ve.substring(1),10),F=M(ue);F||k.push({code:"heading-empty",severity:"warning",message:"Heading is empty. Add a concise label or remove the heading.",path:re,_target:ue}),J&&U>J+1&&k.push({code:"heading-level-skip",severity:"warning",message:"Heading jumps from H"+J+" to H"+U+". Use the next heading level for a clearer outline.",path:re+".attrs.level",_target:ue}),F&&(J=U)}for(var $=ue.querySelectorAll?ue.querySelectorAll("img"):[],ne=0;ne<$.length;ne++){var pe=$[ne];String(pe.getAttribute("alt")||"").replace(/^\s+|\s+$/g,"")||k.push({code:"image-missing-alt",severity:"error",message:"Image is missing alt text. Describe the image or mark it decorative in your content workflow.",path:re+".image["+ne+"]",_target:pe})}for(var Ae=ve==="table"?[ue]:ue.querySelectorAll?ue.querySelectorAll("table"):[],He=0;He<Ae.length;He++){var Ze=Ae[He];Ze.querySelector("th")||k.push({code:"table-missing-header",severity:"warning",message:"Table has no header cells. Promote the first row to headers when it describes the columns.",path:re+".table["+He+"]",_target:Ze})}}return{document:null,issues:k,valid:!k.length,source:"dom"}}function K(p,k){if(!p||!p._target)return I();var h=p._target;if(p.code==="image-missing-alt")h.setAttribute("alt",String(k.altText||"").replace(/^\s+|\s+$/g,""));else if(p.code==="heading-empty")h.textContent=String(k.headingText||"").replace(/^\s+|\s+$/g,"");else if(p.code==="heading-level-skip"){for(var x=Math.max(1,Math.min(6,parseInt(k.targetLevel,10)||2)),z=h.ownerDocument.createElement("h"+x);h.firstChild;)z.appendChild(h.firstChild);V(h,z),h.parentNode.replaceChild(z,h)}else p.code==="table-missing-header"&&T(h);return w=0,Z(),I()}function T(p){var k=p&&p.rows&&p.rows.length?p.rows[0]:null;if(k)for(var h=p.ownerDocument,x=0;x<k.cells.length;x++){var z=k.cells[x];if(!(!z||String(z.nodeName||"").toLowerCase()==="th")){for(var J=h.createElement("th");z.firstChild;)J.appendChild(z.firstChild);V(z,J),J.setAttribute("scope","col"),k.replaceChild(J,z)}}}function V(p,k){if(!(!p||!k||!p.attributes))for(var h=0;h<p.attributes.length;h++){var x=p.attributes[h];!x||!x.name||k.setAttribute(x.name,x.value)}}function Z(){try{i&&typeof i.fireEvent=="function"&&i.fireEvent("change")}catch{}try{i&&typeof i.fireEvent=="function"&&i.fireEvent("contentchange")}catch{}}function M(p){return String(p&&(p.innerText||p.textContent)||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}function X(){H();for(var p=v&&v.issues?v.issues:[];A.firstChild;)A.removeChild(A.firstChild);var k=N.querySelector("[data-rte-a11y-count]");k&&(k.innerText=p.length?p.length+" issue"+(p.length===1?"":"s")+" to review":"Ready to publish"),E.style.display=p.length?"none":"block";for(var h=0;h<p.length;h++)(function(x,z){var J=N.ownerDocument.createElement("button");J.type="button",J.className="rte-a11y-item"+(z===w?" is-active":""),J.setAttribute("aria-selected",z===w?"true":"false"),J.innerHTML='<div class="rte-a11y-item-top"><span class="rte-a11y-badge rte-a11y-badge-'+x.severity+'">'+x.severity+'</span><span class="rte-a11y-code">'+x.code+'</span></div><div class="rte-a11y-message"></div>',J.querySelector(".rte-a11y-message").innerText=x.message,J.onclick=function(){w=z,y(x),X()},A.appendChild(J)})(p[h],h);G()}function G(){for(;C.firstChild;)C.removeChild(C.firstChild);var p=v&&v.issues?v.issues:[];if(!p.length||w<0||!p[w]){C.innerHTML='<div class="rte-a11y-detail-title">No fixes pending</div><div class="rte-a11y-detail-copy">Run the checker again after major content changes to keep headings, image descriptions, and tables in shape.</div>';return}var k=p[w],h=C.ownerDocument.createElement("div");h.className="rte-a11y-detail-title",h.innerText=k.code;var x=C.ownerDocument.createElement("div");if(x.className="rte-a11y-detail-copy",x.innerText=k.message,C.appendChild(h),C.appendChild(x),k.code==="image-missing-alt"){Y("Alt text","Describe the image for screen-reader users.",function(F){u(w,{altText:F})});return}if(k.code==="heading-empty"){Y("Heading text","Add a concise heading label before publishing.",function(F){u(w,{headingText:F})});return}if(k.code==="heading-level-skip"){var z=j(k),J=C.ownerDocument.createElement("div");J.className="rte-a11y-row";var ee=C.ownerDocument.createElement("button");ee.type="button",ee.className="rte-a11y-button",ee.innerText="Normalize to H"+z,ee.onclick=function(){u(w,{targetLevel:z})};var ue=C.ownerDocument.createElement("button");ue.type="button",ue.className="rte-a11y-button rte-a11y-button-secondary",ue.innerText="Focus issue",ue.onclick=function(){y(k)},J.appendChild(ee),J.appendChild(ue),C.appendChild(J);return}if(k.code==="table-missing-header"){var ve=C.ownerDocument.createElement("div");ve.className="rte-a11y-row";var re=C.ownerDocument.createElement("button");re.type="button",re.className="rte-a11y-button",re.innerText="Promote first row to headers",re.onclick=function(){u(w,{})};var U=C.ownerDocument.createElement("button");U.type="button",U.className="rte-a11y-button rte-a11y-button-secondary",U.innerText="Focus issue",U.onclick=function(){y(k)},ve.appendChild(re),ve.appendChild(U),C.appendChild(ve);return}C.innerHTML+='<div class="rte-a11y-detail-copy">This issue is visible here, but does not have an automatic repair action yet.</div>'}function Y(p,k,h){var x=C.ownerDocument.createElement("div");x.className="rte-a11y-field";var z=C.ownerDocument.createElement("div");z.className="rte-a11y-label",z.innerText=p;var J=C.ownerDocument.createElement("input");J.type="text",J.className="rte-a11y-input",J.placeholder=k;var ee=C.ownerDocument.createElement("div");ee.className="rte-a11y-row";var ue=C.ownerDocument.createElement("button");ue.type="button",ue.className="rte-a11y-button",ue.innerText="Apply fix",ue.onclick=function(){var re=String(J.value||"").replace(/^\s+|\s+$/g,"");re&&h(re)};var ve=C.ownerDocument.createElement("button");ve.type="button",ve.className="rte-a11y-button rte-a11y-button-secondary",ve.innerText="Focus issue",ve.onclick=function(){var re=v&&v.issues?v.issues:[];re[w]&&y(re[w])},ee.appendChild(ue),ee.appendChild(ve),x.appendChild(z),x.appendChild(J),C.appendChild(x),C.appendChild(ee)}function j(p){var k=(p&&p.path?p.path:"").replace(/\.attrs\.level$/,""),h=i.getJSON?i.getJSON():null;if(!h||!h.content)return 2;var x=0;function z(ee,ue){if(!ee||typeof ee.type!="string")return!1;if(ue===k)return!0;if(ee.type==="heading"&&ee.attrs&&typeof ee.attrs.level=="number"&&(x=ee.attrs.level),!ee.content||!ee.content.length)return!1;for(var ve=0;ve<ee.content.length;ve++)if(z(ee.content[ve],ue+".content["+ve+"]"))return!0;return!1}for(var J=0;J<h.content.length&&!z(h.content[J],"content["+J+"]");J++);return Math.max(1,Math.min(6,(x||1)+(x?1:0)))}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),(function(){if(!(typeof document>"u")&&!(window.RTE_DefaultConfig&&window.RTE_DefaultConfig.aitoolkit_skip_auto_css)){for(var c=document.querySelectorAll("link[rel=stylesheet]"),i=0;i<c.length;i++){var f=c[i].getAttribute("href")||"";if(/(?:^|\/)aitoolkit\.css(?:\?.*)?$/i.test(f))return}for(var N=null,A=document.getElementsByTagName("script"),E=A.length-1;E>=0;E--){var C=A[E].getAttribute("src")||"";if(/(?:^|\/)(?:aitoolkit|all_plugins)\.js(?:\?.*)?$/i.test(C)){N=A[E];break}}var o=N?N.getAttribute("src"):"",v=o?o.replace(/[^/]+$/,"aitoolkit.css"):(window.RTE_DefaultConfig&&window.RTE_DefaultConfig.url_base||"/richtexteditor")+"/plugins/aitoolkit.css";v.indexOf("?")<0&&(v+="?v=20260703a");var w=document.createElement("link");w.rel="stylesheet",w.href=v,w.setAttribute("data-rte-auto-injected","aitoolkit"),(document.head||document.documentElement).appendChild(w)}})(),RTE_DefaultConfig.svgCode_aiassist||(RTE_DefaultConfig.svgCode_aiassist='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" aria-hidden="true"><defs><linearGradient id="rte-ai-robot-shell" x1="5" y1="6" x2="19" y2="18" gradientUnits="userSpaceOnUse"><stop stop-color="#1fb6ff"/><stop offset=".52" stop-color="#2563eb"/><stop offset="1" stop-color="#7c3aed"/></linearGradient><linearGradient id="rte-ai-robot-glow" x1="8" y1="10" x2="16" y2="15" gradientUnits="userSpaceOnUse"><stop stop-color="#fef9c3"/><stop offset="1" stop-color="#fde68a"/></linearGradient></defs><path d="M12 2.4v2.4" stroke="#f59e0b" stroke-width="1.7" stroke-linecap="round"/><circle cx="12" cy="2.4" r="1" fill="#fbbf24"/><rect x="5.1" y="6.1" width="13.8" height="11.2" rx="3.4" fill="url(#rte-ai-robot-shell)" stroke="#1e40af" stroke-width="1.2"/><path d="M8.2 6.1V5.8A1.8 1.8 0 0110 4h4a1.8 1.8 0 011.8 1.8v.3" stroke="#93c5fd" stroke-width="1.2" stroke-linecap="round"/><rect x="7.7" y="9.2" width="8.6" height="4.8" rx="2.4" fill="#0f172a" opacity=".26"/><circle cx="10" cy="11.6" r="1.15" fill="url(#rte-ai-robot-glow)"/><circle cx="14" cy="11.6" r="1.15" fill="url(#rte-ai-robot-glow)"/><path d="M9.4 14.9c.8.55 1.66.83 2.6.83s1.8-.28 2.6-.83" stroke="#ffffff" stroke-width="1.45" stroke-linecap="round"/><path d="M8.1 19.2l1-2.1M15.9 19.2l-1-2.1" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round"/><path d="M18.8 6.4l.55-1.25.55 1.25 1.25.55-1.25.55-.55 1.25-.55-1.25-1.25-.55z" fill="#fef08a"/></svg>',RTE_DefaultConfig.svgCode_aiassist='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" aria-hidden="true"><defs><linearGradient id="rte-ai-bot-v4-shell" x1="4.2" y1="5.8" x2="19.8" y2="18.4" gradientUnits="userSpaceOnUse"><stop stop-color="#22d3ee"/><stop offset=".52" stop-color="#2563eb"/><stop offset="1" stop-color="#4338ca"/></linearGradient><linearGradient id="rte-ai-bot-v4-visor" x1="7.8" y1="9" x2="16.2" y2="13.8" gradientUnits="userSpaceOnUse"><stop stop-color="#f8fafc"/><stop offset="1" stop-color="#bfdbfe"/></linearGradient></defs><path d="M12 2.6v2.3" stroke="#f59e0b" stroke-width="1.7" stroke-linecap="round"/><circle cx="12" cy="2.6" r=".9" fill="#fbbf24"/><path d="M4.9 12.2h-1a1.4 1.4 0 010-2.8h1M19.1 9.4h1a1.4 1.4 0 010 2.8h-1" stroke="#2563eb" stroke-width="1.25" stroke-linecap="round"/><rect x="5.2" y="5.9" width="13.6" height="12.2" rx="4" fill="url(#rte-ai-bot-v4-shell)" stroke="#1e40af" stroke-width="1.15"/><rect x="7.6" y="8.8" width="8.8" height="5.2" rx="2.6" fill="url(#rte-ai-bot-v4-visor)" opacity=".98"/><circle cx="10.2" cy="11.4" r=".9" fill="#0f172a"/><circle cx="13.8" cy="11.4" r=".9" fill="#0f172a"/><path d="M9.5 15.3c.78.52 1.6.78 2.5.78s1.72-.26 2.5-.78" stroke="#eff6ff" stroke-width="1.35" stroke-linecap="round"/><path d="M7.7 20.2l1.15-2.15M16.3 20.2l-1.15-2.15" stroke="#2563eb" stroke-width="1.45" stroke-linecap="round"/><path d="M18.6 5.1l.45-.95.45.95.95.45-.95.45-.45.95-.45-.95-.95-.45z" fill="#fde68a"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_open_dialog||(RTE_DefaultConfig.svgCode_aiassist_open_dialog=RTE_DefaultConfig.svgCode_aiassist),RTE_DefaultConfig.svgCode_aiassist_review||(RTE_DefaultConfig.svgCode_aiassist_review='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5.5 6.5h13"/><path d="M5.5 11.5h8"/><path d="M5.5 16.5h6"/><path d="M16.5 14.2l1.8 1.8 3.2-4.2"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_chat||(RTE_DefaultConfig.svgCode_aiassist_chat=RTE_DefaultConfig.svgCode_aiassist),RTE_DefaultConfig.svgCode_aiassist_proofread||(RTE_DefaultConfig.svgCode_aiassist_proofread='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="4.5"/><path d="M14 14l5 5"/><path d="M8.8 10.5l1.2 1.3 2.3-2.5"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_rewrite||(RTE_DefaultConfig.svgCode_aiassist_rewrite='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h11"/><path d="M4 12h8"/><path d="M4 17h11"/><path d="M16 5l4 4-6.5 6.5H9.5v-4z"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_translate||(RTE_DefaultConfig.svgCode_aiassist_translate='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 6.5h10"/><path d="M8 4v2.5"/><path d="M11 6.5c-.6 2.9-2.2 5.3-4.7 7.1"/><path d="M6.5 10.5c1.2.9 2.5 1.6 3.9 2.1"/><path d="M14.5 9.5h5"/><path d="M17 7v2.5"/><path d="M15 19l2-4.5 2 4.5"/><path d="M15.8 17.2h2.4"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_comment||(RTE_DefaultConfig.svgCode_aiassist_comment='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 7.5A3.5 3.5 0 019.5 4h8A3.5 3.5 0 0121 7.5v5a3.5 3.5 0 01-3.5 3.5H12l-4.5 3v-3H6A3.5 3.5 0 012.5 12.5v-5A3.5 3.5 0 016 4"/><path d="M8 9h8"/><path d="M8 12h5"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_paragraph||(RTE_DefaultConfig.svgCode_aiassist_paragraph='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7h8"/><path d="M5 12h14"/><path d="M5 17h10"/><path d="M18 5v6"/><path d="M15 8h6"/></svg>'),RTE_DefaultConfig.svgCode_aiassist_justify||(RTE_DefaultConfig.svgCode_aiassist_justify='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7h14"/><path d="M5 11h14"/><path d="M5 15h9"/><path d="M16 14l2 2 3-4"/></svg>'),RTE_DefaultConfig.plugin_aitoolkit=RTE_Plugin_AIToolkit;function RTE_Plugin_AIToolkit(){var S=this,c,i;S.PluginName="AIToolkit",S.InitConfig=function(e){c=e,c.aiToolkitEnabled!==!1&&(c.text_aiassist=c.text_aiassist||"Ask AI",c.text_aireview=c.text_aireview||"AI Review",c.text_aichat=c.text_aichat||"AI Chat",c.aiToolkitTranslateLanguages=c.aiToolkitTranslateLanguages||[{value:"spanish",label:"Spanish"},{value:"french",label:"French"},{value:"german",label:"German"},{value:"italian",label:"Italian"},{value:"portuguese",label:"Portuguese"},{value:"japanese",label:"Japanese"}],c.aiToolkitActions=c.aiToolkitActions||[{id:"chat-panel",section:"Start",icon:"chat",title:"Chat",description:"Ask follow-up questions about this document.",target:"chat-panel"},{id:"open-dialog",section:"Start",icon:"open_dialog",title:"Draft",description:"Generate, rewrite, translate, or summarize before applying.",target:"dialog"},{id:"review-panel",section:"Start",icon:"review",title:"Review",description:"Accept or reject prepared AI edits.",target:"review-panel"},{id:"proofread",section:"Quick edit",icon:"proofread",title:"Proofread",description:"Check grammar, spacing, and clarity.",resolverMode:"proofread",target:"selection-preview"},{id:"rewrite",section:"Quick edit",icon:"rewrite",title:"Rewrite",description:"Improve clarity without changing intent.",resolverMode:"rewrite",target:"selection-preview"},{id:"translate",section:"Quick edit",icon:"translate",title:"Translate",description:"Choose a language and preview the result.",resolverMode:"translate",target:"dialog",autoRun:!1},{id:"justify",section:"Quick edit",icon:"justify",title:"Explain",description:"Rewrite and show why it changed.",resolverMode:"justify",target:"dialog",autoRun:!1},{id:"comment",section:"Insert",icon:"comment",title:"Add note",description:"Insert a short comment near the selection.",resolverMode:"comment",target:"comment"},{id:"paragraph",section:"Insert",icon:"paragraph",title:"Add paragraph",description:"Draft a supporting paragraph below.",resolverMode:"paragraph",target:"insert"}],c.aiToolkitChatPrompts=c.aiToolkitChatPrompts||[{id:"summarize",label:"Summarize",prompt:"Summarize the current content and suggest the clearest next edit."},{id:"proofread",label:"Proofread",prompt:"Proofread the current content and prepare a cleaner version I can review."},{id:"translate",label:"Translate",prompt:"Translate the current content into Spanish and prepare a reviewable version."},{id:"headings",label:"Headings",prompt:"Suggest better section titles and subheadings for this content."},{id:"expand",label:"Expand",prompt:"Add a short supporting paragraph that strengthens this content."}],c.aiToolkitDialogModes=c.aiToolkitDialogModes||[{id:"proofread",title:"Proofread",description:"Fix grammar & clarity."},{id:"rewrite",title:"Rewrite",description:"Rewrite for clarity."},{id:"translate",title:"Translate",description:"Translate to a language."},{id:"justify",title:"Explain rewrite",description:"Rewrite and explain why."},{id:"shorten",title:"Shorten",description:"Compress to be shorter."},{id:"expand",title:"Expand",description:"Add supporting detail."},{id:"summarize",title:"Summarize",description:"Summarize the source."}],c.aiToolkitResolver=c.aiToolkitResolver||null,c.aiToolkitOperationHandlers=c.aiToolkitOperationHandlers||{},c.aiToolkitPersistenceKey=c.aiToolkitPersistenceKey||"",c.aiToolkitReviewSyncInterval=c.aiToolkitReviewSyncInterval||15e3,c.aiToolkitSuggestionLedgerUrl=c.aiToolkitSuggestionLedgerUrl||"",c.aiToolkitReviewLogUrl=c.aiToolkitReviewLogUrl||"",c.aiToolkitAutoToolbarButtons=c.aiToolkitAutoToolbarButtons!==!1,c.aiToolkitUiVersion=c.aiToolkitUiVersion||"v20260520k",E("toolbar_default","#{aiassist}"),E("toolbar_basic","#{aiassist}"),E("toolbar_full","#{aiassist}"),E("toolbar_mobile","#{aiassist}"),C("controltoolbar_TEXT","|{aiassist}"),c.toolbarfactory_aiassist=function(t,r,n){var a=this;return a.createToolbarItemDropDownPanel(t,function(s){wu(s)})})},S.InitEditor=function(e){i=e,i.aiToolkit={normalizeText:u,ensureSentence:y,buildDemoResult:J,getTranslateLanguages:O,getTranslateLanguageLabel:T,getOperationContract:Nt,getActionDefinitions:ne,registerAction:Ze,removeAction:_t,getDialogModes:pe,registerDialogMode:Vt,removeDialogMode:It,resolveAction:function(l,d){return Ue(l,d)},loadSelectionText:function(){var l=Le();return l.text||l.wholeText},loadDocumentText:function(){return u(i.getText?i.getText():"")},textToHtml:function(l){return ir(l)},previewInlineSuggestion:function(l,d){return as(l,d)},applyResult:function(l,d){return ao(l,d)},executeOperations:function(l,d){return xa(l,d)},executeResolvedAction:function(l,d){return wn(l,d)},registerOperationHandler:$t,unregisterOperationHandler:lr,getSuggestions:function(){return Ft().slice()},clearSuggestions:function(){return Zc()},getReviewLogEntries:function(){return zi().slice()},setResolver:function(l){c.aiToolkitResolver=typeof l=="function"?l:null},openChatPanel:function(l){ea(l)},closeChatPanel:function(){Zi({restoreFocus:!0})},toggleChatPanel:function(l){Yu(l)},getChatSessions:function(l){return Bu(l)},loadChatSession:function(l,d){return zu(l,d)},clearChatSessions:function(l){return Fu(l)},openReviewPanel:function(l){_o(l)},closeReviewPanel:function(){ei()},toggleReviewPanel:function(l){sf(l)},saveSuggestionLedger:function(){return Sr()},loadSuggestionLedger:function(){return jl()},loadRemoteSuggestionLedger:function(l,d){return ql(l,d)},loadReviewLogEntries:function(l,d){return Rl(l,d)},refreshRemoteReviewState:function(l,d){return ui(l,d)},openDialog:function(l){la(l)},runQuickAction:function(l,d){return os(l,d)},setAgent:function(l){c.aiToolkitAgent=typeof l=="function"?l:null},runAgent:function(l,d){return xu(l,d)},streamRequest:function(l){return D(l)},exportDocx:function(l){return L(l)},importDocx:function(l){return I(l)}},nc(),i.reviewLedger={add:function(l){var d=jc(l);if(!d)return null;for(var m=Ft(),R=0;R<m.length;R++)if(m[R].id===d.id){m[R]=d;break}return R===m.length&&m.push(d),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),d},update:function(l,d){for(var m=Ft(),R=0;R<m.length;R++)if(m[R].id===l){for(var Q in d)Object.prototype.hasOwnProperty.call(d,Q)&&(m[R][Q]=d[Q]);return Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),m[R]}return null},remove:function(l){for(var d=Ft(),m=0;m<d.length;m++)if(d[m].id===l)return d.splice(m,1),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),!0;return!1},get:function(l){for(var d=Ft(),m=0;m<d.length;m++)if(d[m].id===l)return d[m];return null},list:function(l){var d=Ft().slice();return l?d.filter(function(m){return!(l.author&&m.author&&m.author.id!==l.author||l.status&&m.status!==l.status||l.changeType&&m.changeType!==l.changeType)}):d},refreshPanel:function(){i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1)}},i.attachEvent("exec_command_aiassist",function(l){l.returnValue=!0,l.stopBubble=!0,la()}),i.attachEvent("exec_command_aichat",function(l){l.returnValue=!0,l.stopBubble=!0,ea({focusComposer:!0})});var t=i.getEditable(),r=t&&t.ownerDocument?t.ownerDocument:document;function n(l){if(!l.__rteAiInlinePreviewClickHandled){var d=l.target&&l.target.closest?l.target.closest("[data-rte-ai-suggestion-id]"):null;if(d){var m=d.getAttribute("data-rte-ai-suggestion-id");if(!(!m||!pt(m))){l.__rteAiInlinePreviewClickHandled=!0;var R=l.target&&l.target.closest?l.target.closest("[data-rte-ai-action]"):null;if(!R){var Q=Ie(),ie=d.ownerDocument?d.ownerDocument.activeElement:null;if(ie&&ie.getAttribute&&i.getEditable().contains(ie)&&(Q=ie.getAttribute("data-rte-ai-action")||Q),i.__aiReviewEmptyPreviewSuggestionId&&m===i.__aiReviewEmptyPreviewSuggestionId){Ar(m,{focusPanel:!0,focusAction:Q||Ie(),openedQueue:!0});return}if(Zt(m),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),ro(m,Q))return;ga(d);return}l.preventDefault(),l.stopPropagation();var ae=R.getAttribute("data-rte-ai-action"),oe="",te=i.__aiActiveSuggestionId===m;(ae==="accept"||ae==="reject")&&te&&(oe=ia(m)),ae==="accept"?Ca(m)&&(oe?Ur(oe,{focusInlineAction:ae}):te&&Ot(oo("Accepted",m))):ae==="reject"?ka(m)&&(oe?Ur(oe,{focusInlineAction:ae}):te&&Ot(oo("Rejected",m))):ae==="review"?Ar(m,{focusPanel:!0}):ae==="previous"?lc(m,{focusInlineAction:ae})||Ot(ln(m,"previous")):ae==="next"?sc(m,{focusInlineAction:ae})||Ot(ln(m,"next")):ae==="shared-seen"?(Io(),Ki(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),Ot("Shared AI review updates cleared for the current item."),ga(d)):ae==="undo"?Hn({focusInlineAction:"undo"}):ae==="redo"&&Qn({focusInlineAction:"redo"})}}}}function a(){t=i.getEditable?i.getEditable():null,r=t&&t.ownerDocument?t.ownerDocument:document,t&&i.__aiInlinePreviewEventEditable!==t&&(t.addEventListener("click",n),t.addEventListener("keydown",s),i.__aiInlinePreviewEventEditable=t),r&&i.__aiInlinePreviewEventDocument!==r&&(r.addEventListener("click",n,!0),r.addEventListener("keydown",s,!0),i.__aiInlinePreviewEventDocument=r)}function s(l){if(!l.__rteAiInlinePreviewKeydownHandled){var d=l.target&&l.target.closest?l.target.closest(".rte-ai-inline-preview"):l.target&&l.target.classList&&l.target.classList.contains("rte-ai-inline-preview")?l.target:null;if(d){var m=l.target&&l.target.closest?l.target.closest("[data-rte-ai-action]"):null,R=d.getAttribute("data-rte-ai-suggestion-id");if(!(!R||!pt(R)||l.ctrlKey||l.metaKey||l.altKey)){l.__rteAiInlinePreviewKeydownHandled=!0;var Q=(l.key||"").toLowerCase(),ie=m&&m.getAttribute&&m.getAttribute("data-rte-ai-action")||"",ae=ie||Uo(pt(R)),oe=!!(i.__aiReviewEmptyPreviewSuggestionId&&R===i.__aiReviewEmptyPreviewSuggestionId);if(oe){(Q==="enter"||Q===" ")&&(l.preventDefault(),Ar(R,{focusPanel:!0,focusAction:ie||Ie(),openedQueue:!0}));return}if(Q==="arrowleft"||Q==="k")l.preventDefault(),lc(R,{focusInlineAction:ie})||Ot(ln(R,"previous"));else if(Q==="arrowright"||Q==="j")l.preventDefault(),sc(R,{focusInlineAction:ie})||Ot(ln(R,"next"));else if(Q==="home")l.preventDefault(),Ud(R,{focusInlineAction:ie})||Ot(ln(R,"first"));else if(Q==="end")l.preventDefault(),Bd(R,{focusInlineAction:ie})||Ot(ln(R,"last"));else if(Q==="a"){l.preventDefault();var te=ia(R);Ca(R)&&(te?Ur(te,{focusInlineAction:ie}):Ot(oo("Accepted",R)))}else if(Q==="r"){l.preventDefault();var se=ia(R);ka(R)&&(se?Ur(se,{focusInlineAction:ie}):Ot(oo("Rejected",R)))}else if(Q==="u"&&!l.shiftKey&&un())l.preventDefault(),Hn({focusInlineAction:ae||"accept"});else if(Q==="u"&&l.shiftKey){var ce=Nn();ce&&ce.suggestion&&ce.suggestion.id===R&&(l.preventDefault(),Qn({focusInlineAction:ae||"accept"}))}else if(Q==="g")Yr(R)&&(l.preventDefault(),Io(),Ki(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),Ot("Shared AI review updates cleared for the current item."),ga(d));else if(Q==="enter"||Q===" "){if(m)return;l.preventDefault(),ro(R,ie||Ie())}}}}}i.__aiBindInlinePreviewEventHandlers=a,a(),jl(),ui(!1),Yc(),Xc()};var f={toolbar_default:"{bold,italic,underline,forecolor,backcolor}|{justifyleft,justifycenter,justifyright,justifyfull}|{insertorderedlist,insertunorderedlist,indent,outdent,insertblockquote,insertemoji}|{aiassist}#{toggleborder,fullscreenenter,fullscreenexit,undo,redo,togglemore}",toolbar_mobile:"{bold,italic,underline|fontname:toggle,fontsize:toggle,menu_paragraphop|forecolor,backcolor}{insertlink,insertemoji,inserttable,insertimage,removeformat}|{aiassist}#{toggleborder,fullscreenenter,fullscreenexit,undo,redo,togglemore}",toolbar_basic:"{bold,italic,underline}|{fontname,fontsize}|{insertlink,insertemoji,insertimage,insertvideo}|removeformat|code#{toggleborder,fullscreenenter,fullscreenexit,undo,redo,togglemore}",toolbar_full:"{bold,italic,underline,forecolor,backcolor}|{justifyleft,justifycenter,justifyright,justifyfull}|{insertorderedlist,insertunorderedlist,indent,outdent}{superscript,subscript}|{insertlink,insertimage,insertvideo,inserttable,insertemoji,find,code,html2pdf}|{aiassist_chat,aiassist_review}|{insertcomment,trackchanges}#{insertmergefield,insertfootnote,inserttoc,insertpagebreak,revisionhistory,newdoc,save,toggleborder,fullscreenenter,fullscreenexit,undo,redo,togglemore}",controltoolbar_TEXT:"removeformat | {bold,italic,underline,forecolor,backcolor}|{fontname:toggle,fontsize:toggle}|{insertlink}"};function N(e){return String(e||"").replace(/\s+/g,"")}function A(e){if(c.aiToolkitAutoToolbarButtons===!1)return!1;var t=c[e];if(!t)return!0;var r=f[e];return r?N(t)===N(r):!0}function E(e,t){var r=c[e]||"";r.indexOf("aiassist")===-1&&A(e)&&(c[e]=r?r+" "+t:t)}function C(e,t){var r=c[e]||"";r.indexOf("aiassist")===-1&&A(e)&&(c[e]=r?r+t:t)}function o(e,t,r,n,a){var s=e.ownerDocument.createElement(t);return r&&(s.style.cssText=r),n&&(s.className=n),typeof a<"u"&&(s.innerText=a),e.appendChild(s),s}function v(e,t,r){var n=o(e,"div","",t,r);return n.setAttribute("aria-hidden","true"),n}function w(){return"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 240" role="img" aria-label="Editorial workspace photo"><defs><linearGradient id="ai-photo-sky" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#e0f2fe"/><stop offset="52%" stop-color="#bfdbfe"/><stop offset="100%" stop-color="#ddd6fe"/></linearGradient><linearGradient id="ai-photo-desk" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#fef3c7"/><stop offset="100%" stop-color="#fdba74"/></linearGradient><filter id="ai-photo-blur" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="14"/></filter></defs><rect width="320" height="240" rx="28" fill="url(#ai-photo-sky)"/><circle cx="248" cy="52" r="40" fill="#ffffff" opacity=".55"/><circle cx="76" cy="44" r="34" fill="#fdf2f8" opacity=".65"/><path d="M0 174C37 155 68 151 99 162c24 9 47 23 75 17 20-4 31-17 51-23 28-7 54 6 95 18v66H0z" fill="#86efac" opacity=".92"/><path d="M0 188c34-24 66-27 100-15 32 12 63 26 95 17 23-6 44-24 66-26 22-2 39 7 59 18v48H0z" fill="#60a5fa" opacity=".3"/><g filter="url(#ai-photo-blur)" opacity=".34"><circle cx="248" cy="154" r="54" fill="#1d4ed8"/><circle cx="92" cy="134" r="48" fill="#7c3aed"/></g><rect x="74" y="72" width="172" height="110" rx="14" fill="#f8fafc" opacity=".95"/><rect x="88" y="86" width="144" height="14" rx="7" fill="#cbd5e1"/><rect x="88" y="110" width="118" height="10" rx="5" fill="#dbeafe"/><rect x="88" y="128" width="128" height="10" rx="5" fill="#dbeafe"/><rect x="88" y="146" width="82" height="10" rx="5" fill="#e9d5ff"/><rect x="198" y="138" width="34" height="28" rx="10" fill="url(#ai-photo-desk)"/><rect x="54" y="183" width="212" height="32" rx="16" fill="#ffffff" opacity=".68"/></svg>')}function q(){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 140" role="img" aria-hidden="true" focusable="false"><defs><linearGradient id="ai-illus-doc" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#ffffff"/><stop offset="100%" stop-color="#f1f5fb"/></linearGradient><linearGradient id="ai-illus-bubble" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#3b82f6"/><stop offset="100%" stop-color="#6366f1"/></linearGradient><linearGradient id="ai-illus-sparkle" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#fbbf24"/><stop offset="100%" stop-color="#f59e0b"/></linearGradient></defs><ellipse cx="100" cy="118" rx="68" ry="8" fill="#0f172a" opacity="0.08"/><rect x="44" y="34" width="92" height="78" rx="10" fill="#cbd5e1" opacity="0.45" transform="translate(2,3)"/><rect x="44" y="34" width="92" height="78" rx="10" fill="url(#ai-illus-doc)" stroke="#cbd5e1" stroke-width="1"/><rect x="56" y="54" width="60" height="6" rx="3" fill="#dbeafe"/><rect x="56" y="66" width="68" height="5" rx="2.5" fill="#e2e8f0"/><rect x="56" y="76" width="52" height="5" rx="2.5" fill="#e2e8f0"/><rect x="56" y="90" width="44" height="5" rx="2.5" fill="#ede9fe"/><g><path d="M118 22 H162 a10 10 0 0 1 10 10 v22 a10 10 0 0 1 -10 10 H140 l-9 8 v-8 H118 a10 10 0 0 1 -10 -10 V32 a10 10 0 0 1 10 -10 z" fill="url(#ai-illus-bubble)"/><circle cx="128" cy="42" r="2.6" fill="#ffffff"/><circle cx="140" cy="42" r="2.6" fill="#ffffff"/><circle cx="152" cy="42" r="2.6" fill="#ffffff"/></g><g fill="url(#ai-illus-sparkle)"><path d="M36 28 l2 6 6 2 -6 2 -2 6 -2 -6 -6 -2 6 -2 z"/><path d="M168 88 l1.6 4.8 4.8 1.6 -4.8 1.6 -1.6 4.8 -1.6 -4.8 -4.8 -1.6 4.8 -1.6 z"/><path d="M30 92 l1.2 3.6 3.6 1.2 -3.6 1.2 -1.2 3.6 -1.2 -3.6 -3.6 -1.2 3.6 -1.2 z"/></g></svg>'}function B(e,t){var r=o(e,"div","","rte-ai-hero"+(t?" is-"+t:"")),n=o(r,"div","","rte-ai-hero-media"),a=o(n,"img","","rte-ai-hero-image");a.alt="Styled editorial workspace preview",a.src=w(),a.loading="eager",a.decoding="async";var s=o(r,"div","","rte-ai-hero-body");return o(s,"div","","rte-ai-hero-kicker",t==="dialog"?"Guided AI flow":"Beautiful drafting"),o(s,"div","","rte-ai-hero-title",t==="dialog"?"Review the change before it lands":"Shape the document with a calmer AI workspace"),o(s,"div","","rte-ai-hero-copy",t==="dialog"?"Load source text, compare the result, and apply only the version that improves the draft.":"Keep context visible, ask for help in smaller steps, and make each suggestion feel intentional."),r}function H(e,t,r){var n=o(e,"div","",t);return r&&n.setAttribute("data-rte-ai-review-group-label",r),o(n,"div","","rte-ai-review-control-group-body")}function g(e,t,r){var n=o(e,"div","",t);return r&&o(n,"div","","rte-ai-review-header-group-label",r),o(n,"div","","rte-ai-review-header-group-body")}function b(e){if(!e)return c.svgCode_aiassist||"";var t=e.icon||e.id||"open_dialog";return c["svgCode_aiassist_"+t]||c.svgCode_aiassist||""}function D(e){e=e||{};var t=e.url||"/richtextbox/ai/stream",r=e.body||{},n=typeof AbortController<"u"?new AbortController:null,a="",s=(function(){return typeof fetch!="function"||typeof ReadableStream>"u"?P(t,r,e):fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(r),signal:n?n.signal:void 0,credentials:"same-origin"}).then(function(l){if(!l.ok)throw new Error("AI stream failed: HTTP "+l.status);if(!l.body||typeof l.body.getReader!="function")return l.text().then(function(ae){return e.onDelta&&e.onDelta(ae),a=ae,e.onDone&&e.onDone(a),a});var d=l.body.getReader(),m=new TextDecoder("utf-8"),R="";function Q(){return d.read().then(function(ae){if(ae.done)return e.onDone&&e.onDone(a),a;R+=m.decode(ae.value,{stream:!0});for(var oe;(oe=R.indexOf(`
|
|
2
|
+
|
|
3
|
+
`))>=0;){var te=R.slice(0,oe);R=R.slice(oe+2),ie(te)}return Q()})}function ie(ae){for(var oe="message",te=[],se=ae.split(`
|
|
4
|
+
`),ce=0;ce<se.length;ce++){var Ne=se[ce];Ne.indexOf("event:")===0?oe=Ne.slice(6).trim():Ne.indexOf("data:")===0&&te.push(Ne.slice(5).trim())}if(te.length!==0){var de=te.join(`
|
|
5
|
+
`),_e;try{_e=JSON.parse(de)}catch{_e=de}if(oe==="message"){var ke=typeof _e=="string"?_e:"";ke&&(a+=ke,e.onDelta&&e.onDelta(ke,a))}else oe==="response"?e.onResponse&&e.onResponse(_e):oe==="error"&&e.onError&&e.onError(_e)}}return Q()}).catch(function(l){if(l&&l.name==="AbortError")return a;throw e.onError&&e.onError(l),l})})();return{promise:s,abort:function(){n&&n.abort()}}}function P(e,t,r){var n=r&&r.fallbackUrl||e.replace(/\/stream$/,"");return new Promise(function(a,s){var l=new XMLHttpRequest;l.open("POST",n,!0),l.setRequestHeader("Content-Type","application/json"),l.onload=function(){if(l.status>=200&&l.status<300){var d;try{d=JSON.parse(l.responseText)}catch{d=l.responseText}var m="";d&&d.operations&&d.operations.length?m=d.operations[0].text||"":d&&d.message&&(m=d.message),r&&r.onDelta&&m&&r.onDelta(m,m),r&&r.onResponse&&d&&typeof d=="object"&&r.onResponse(d),r&&r.onDone&&r.onDone(m),a(m)}else{var R=new Error("AI request failed: HTTP "+l.status);r&&r.onError&&r.onError(R),s(R)}},l.onerror=function(){var d=new Error("AI request network error");r&&r.onError&&r.onError(d),s(d)},l.send(JSON.stringify(t))})}function L(e){e=e||{};var t=e.url||"/richtextbox/export/docx",r=typeof e.html=="string"?e.html:i&&i.getHTMLCode?i.getHTMLCode():"",n=e.title||(typeof document<"u"?document.title:"")||"document",a=e.fileName||(String(n).replace(/[\\\/\:\*\?"<>\|]/g,"").trim()||"document")+".docx";if(!r){var s=new Error("exportDocx: editor content is empty.");return e.onError&&e.onError(s),Promise.reject(s)}if(typeof fetch!="function"){var l=new Error("exportDocx requires fetch + Blob support.");return e.onError&&e.onError(l),Promise.reject(l)}return fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},body:JSON.stringify({html:r,title:n,fileName:a}),credentials:"same-origin"}).then(function(d){if(!d.ok)throw new Error("exportDocx failed: HTTP "+d.status);return d.blob()}).then(function(d){if(typeof window<"u"&&window.navigator&&window.navigator.msSaveOrOpenBlob)return window.navigator.msSaveOrOpenBlob(d,a),a;var m=URL.createObjectURL(d),R=document.createElement("a");return R.href=m,R.download=a,document.body.appendChild(R),R.click(),document.body.removeChild(R),setTimeout(function(){try{URL.revokeObjectURL(m)}catch{}},4e3),a}).catch(function(d){throw e.onError&&e.onError(d),d})}function I(e){e=e||{};var t=e.url||"/richtextbox/import/docx",r=e.mode==="insert"?"insert":"replace";function n(s){return s&&(s.html||s.content)||""}function a(s){if(typeof fetch!="function"||typeof FormData!="function"){var l=new Error("importDocx requires fetch + FormData support.");return e.onError&&e.onError(l),Promise.reject(l)}var d=new FormData;return d.append("file",s,s.name||"document.docx"),d.append("mode",r),fetch(t,{method:"POST",body:d,credentials:"same-origin"}).then(function(m){if(!m.ok)throw new Error("importDocx failed: HTTP "+m.status);return m.json().then(n)}).then(function(m){if(m)return r==="insert"&&i&&i.insertHTML?i.insertHTML(m):i&&i.setHTMLCode&&i.setHTMLCode(m),m}).catch(function(m){throw e.onError&&e.onError(m),m})}return e.file?a(e.file):new Promise(function(s,l){if(typeof document>"u")return l(new Error("importDocx: no document"));var d=document.createElement("input");d.type="file",d.accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",d.style.display="none",d.onchange=function(){var m=d.files&&d.files[0];if(document.body.removeChild(d),!m)return s(void 0);a(m).then(s,l)},document.body.appendChild(d),d.click()})}function u(e){return(e||"").replace(/\r\n/g,`
|
|
6
|
+
`).replace(/[ \t]+\n/g,`
|
|
7
|
+
`).replace(/\n{3,}/g,`
|
|
8
|
+
|
|
9
|
+
`).trim()}function y(e){var t=u(e);return t&&(t=t.charAt(0).toUpperCase()+t.substring(1),/[.!?]$/.test(t)||(t+="."),t)}function O(){return(c.aiToolkitTranslateLanguages||[]).slice()}function K(e){return u(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"")}function T(e){for(var t=K(e),r=O(),n=0;n<r.length;n++)if(K(r[n].value)===t||K(r[n].label)===t)return r[n].label||r[n].value;return e?y(String(e)).replace(/[.!?]$/,""):"Spanish"}function V(e){for(var t=K(e),r=O(),n=0;n<r.length;n++)if(K(r[n].value)===t||K(r[n].label)===t)return r[n].value||r[n].label;return t||"spanish"}function Z(e){var t=u(e||"").toLowerCase();return t||"other"}function M(e){switch(Z(e)){case"proofread":return"Proofread";case"rewrite":return"Rewrite";case"translate":return"Translate";case"justify":return"Justify";case"summarize":return"Summarize";case"shorten":return"Shorten";case"expand":return"Expand";case"comment":return"Comment";case"paragraph":return"Paragraph";case"chat":return"Chat";default:return"Other"}}function X(e){if(!e)return"";if(e.snapshot&&e.snapshot.hasSelection||e.scope==="selection")return"Selection";if(e.sourceLabel){if(/selection/i.test(e.sourceLabel))return"Selection";if(/document/i.test(e.sourceLabel))return"Document"}return"Document"}function G(e){var t=p(e),r=t===1?"1 pending":t+" pending",n=e&&e.suggestionType?M(e.suggestionType):"AI";return!n||n==="Other"?"Open queue ("+r+")":"Open "+n+" queue ("+r+")"}function Y(e){var t=p(e),r=t===1?"1 pending item":t+" pending items",n=e&&e.suggestionType?M(e.suggestionType):"AI",a=qt(e,Ie());return!n||n==="Other"?"Click or press Enter to open this AI review queue"+(a?" and focus "+a:"")+". "+r+".":"Click or press Enter to open the "+n+" AI review queue"+(a?" and focus "+a:"")+". "+r+"."}function j(e){var t=p(e),r=t===1?"1 pending":t+" pending",n=e&&e.suggestionType?M(e.suggestionType):"AI",a=qt(e,Ie());return!n||n==="Other"?"Click or Enter opens queue ("+r+")"+(a?", focus "+a:""):"Click or Enter opens "+n+" queue ("+r+")"+(a?", focus "+a:"")}function p(e){if(!e)return 0;var t=Z(e.suggestionType||""),r=t==="other"?"all":t;return Xt(r).length}function k(e){var t=p(e),r=t===1?"1 pending item":t+" pending items",n=e&&e.suggestionType?M(e.suggestionType):"AI",a=qt(e,Ie());return!n||n==="Other"?"Opens AI review queue."+(a?" Focuses "+a+".":"")+" "+r:"Opens "+n+" AI review queue."+(a?" Focuses "+a+".":"")+" "+r}function h(e,t){t=t||{};var r=["AI suggestion preview"],n=!0;t.isPreviewTarget?(r.push("Next review queue target"),r.push(k(e)),n=!1):t.isCurrent&&r.push("Current review item"),t.queueOpened&&r.push("Queue opened"),n&&e&&e.suggestionType&&Z(e.suggestionType)!=="other"&&r.push(M(e.suggestionType)),e&&e.language&&r.push(T(e.language));var a=X(e);if(a&&r.push(a),t.glanceLabels&&t.glanceLabels.length)for(var s=0;s<t.glanceLabels.length;s++)t.glanceLabels[s]&&r.push(t.glanceLabels[s]);return t.glanceDetail&&r.push(t.glanceDetail),t.compareLabel&&r.push(t.compareLabel),t.reasonText&&r.push("Why this suggestion: "+t.reasonText),t.queueRoleLabel&&!t.isPreviewTarget&&r.push(t.queueRoleLabel),t.queueRoleDetail&&!t.isPreviewTarget&&r.push(t.queueRoleDetail),t.focusLabel&&!t.isPreviewTarget&&r.push("Enter focuses "+t.focusLabel),t.positionLabel&&r.push(t.positionLabel),t.transitionLabel&&r.push(t.transitionLabel),t.followupLabel&&r.push(t.followupLabel),t.remoteUpdateCount&&r.push(t.remoteUpdateCount>1?t.remoteUpdateCount+" shared updates":"Shared update"),t.undoLabel&&r.push(t.undoLabel),t.undoNextLabel&&r.push(t.undoNextLabel),t.redoLabel&&r.push(t.redoLabel),t.redoNextLabel&&r.push(t.redoNextLabel),r.join(". ")}function x(e,t,r,n){var a=n==="selection"?"Selection":n==="document"?"Document":t&&t.hasSelection?"Selection":"Document",s=M(e);return Z(e)==="translate"&&r?s+" - "+a+" - "+T(r):s+" - "+a}function z(e,t){var r=u(e);if(!r)return"";var n=V(t),a=T(n),s={spanish:"Version en espa\xF1ol",french:"Version fran\xE7aise",german:"Deutsche Fassung",italian:"Versione italiana",portuguese:"Vers\xE3o em portugu\xEAs",japanese:"Japanese draft"},l=s[n]||a+" version";return y(l+": "+r)}function J(e,t,r){r=r||{};var n=u(t);if(!n)return"";var a=n.split(/\s+/);switch(e){case"proofread":var s=n.replace(/\s{2,}/g," ").replace(/\s+([,.;:!?])/g,"$1").replace(/([,.;:!?])([^\s"'\)\]])/g,"$1 $2").replace(/\.{2,}(?!\.)/g,".").replace(/^(.)/,function(l){return l.toUpperCase()});return y(s);case"rewrite":return y(n.replace(/\bvery\s+/gi,"").replace(/\breally\s+/gi,"").replace(/\bjust\s+/gi,"").replace(/\bin order to\b/gi,"to").replace(/\bdue to the fact that\b/gi,"because").replace(/\s{2,}/g," "));case"translate":return z(n,r.language);case"shorten":return y(a.slice(0,Math.max(8,Math.ceil(a.length*.6))).join(" "));case"expand":return y(n)+`
|
|
10
|
+
|
|
11
|
+
To add context: this extended version unpacks the idea with an additional sentence so readers can follow the reasoning without extra background.`;case"summarize":return`Summary:
|
|
12
|
+
- `+y(a.slice(0,Math.max(10,Math.ceil(a.length*.45))).join(" "));default:return y(n)}}function ee(e){var t=u(e);return t?y('AI note: Consider clarifying this passage and tightening the wording around "'+t.split(/\s+/).slice(0,6).join(" ")+'"'):"AI note: Consider tightening this wording for clarity and reader confidence."}function ue(e){var t=u(e);return t?y("Additional paragraph: This section adds a concise supporting explanation that reinforces "+t.split(/\s+/).slice(0,10).join(" ")+" for the reader."):"Additional paragraph: This section adds a concise supporting explanation so the reader gets more context without losing momentum."}function ve(e,t){var r=u(e);return!r||r.length<=t?r:r.substring(0,Math.max(0,t-3)).replace(/\s+\S*$/,"").trim()+"..."}function re(e,t){var r=ve(t,160)||"the current document";return/\b(headings?|titles?)\b/.test(e)?"You could tighten the structure by using shorter headings that mirror the main claims in "+r+". Ask me to draft heading options and I can turn them into reviewable suggestions.":/\b(translate|translation)\b/.test(e)?"I can translate the current selection or whole document into Spanish, French, German, Italian, Portuguese, or Japanese and keep it reviewable in the editor before you accept it.":/\bwhy\b|\bhow\b|\bwhat\b|\?/.test(e)?"Based on "+r+", I would focus on clarity, stronger section framing, and cleaner transitions. If you want, ask me to rewrite or summarize a specific passage and I can prepare an in-editor suggestion.":"I reviewed "+r+". Ask me to rewrite, summarize, proofread, translate, comment on, or expand the current content and I can prepare editor-ready changes."}function U(e){var t=u(e).toLowerCase();if(!t)return"";for(var r=O(),n=0;n<r.length;n++){var a=(r[n].label||"").toLowerCase(),s=(r[n].value||"").toLowerCase();if(a&&t.indexOf(a)>=0||s&&t.indexOf(s)>=0)return r[n].value||r[n].label}return""}function F(e){var t=u(e.prompt||""),r=u(e.source||e.selectionText||e.documentText||""),n=t.toLowerCase(),a=e.language||U(t),s=e.scope==="selection",l=s?"selection-preview":"document",d="",m="",R=l;if(!t)return{message:"Ask a question, request a rewrite, or tell the AI to summarize, proofread, translate, or expand the current content.",operations:[]};if(/\b(translate|translation|localize|localise)\b/.test(n)){var Q=T(a||"spanish");return m=J("translate",r,{language:a}),d="This prepares a translated "+Q+" draft while keeping the original text nearby until you review and accept the change.",{message:"I prepared a "+Q+" translation you can review before applying.",result:m,reason:d,operations:[it(l,m,{reason:d},e,e.action)]}}return/\b(comment|note|feedback)\b/.test(n)?(m=ee(r),d="This AI note highlights a place that could use clarification or stronger editorial guidance.",{message:"I prepared an AI comment you can add next to the current content.",result:m,reason:d,operations:[{type:"add-comment",text:m,reason:d}]}):/\b(expand|add|insert|paragraph|develop)\b/.test(n)?(m=J("expand",r),d="This adds supporting detail without changing the original point, so it works well as an inserted follow-up paragraph.",R="insert",{message:"I drafted a supporting paragraph you can insert below the current content.",result:m,reason:d,operations:[it(R,m,{reason:d},e,e.action)]}):/\b(summarize|summary|recap)\b|\bexecutive summary\b/.test(n)?(m=J("summarize",r),d="This compresses the current content into a shorter, clearer version that is easier to scan or reuse.",R=s?"selection-preview":"document",{message:"I prepared a condensed version of the current content for review.",result:m,reason:d,operations:[it(R,m,{reason:d},e,e.action)]}):/\b(proofread|grammar|fix|correct)\b|\bclean up\b/.test(n)?(m=J("proofread",r),d="This pass improves grammar, punctuation, and readability while keeping the original meaning intact.",{message:"I prepared a proofread version you can preview inline and accept if it looks right.",result:m,reason:d,operations:[it(l,m,{reason:d},e,e.action)]}):/\b(rewrite|adjust|clarify|improve|polish|tone)\b/.test(n)?(m=J("rewrite",r),d="This rewrite removes filler language and tightens the wording so the idea is easier to review and accept.",{message:"I drafted a clearer rewrite of the current content.",result:m,reason:d,operations:[it(l,m,{reason:d},e,e.action)]}):{message:re(n,r),operations:[]}}function $(e){for(var t=ne(),r=0;r<t.length;r++)if(t[r].id===e)return t[r];return null}function ne(){return(c.aiToolkitActions||[]).slice()}function pe(){return(c.aiToolkitDialogModes||[]).slice()}function Ae(e,t){if(!t||!t.id)return!1;for(var r=0;r<e.length;r++)if(e[r].id===t.id)return e[r]=t,!0;return e.push(t),!0}function He(e,t){for(var r=e.length-1;r>=0;r--)if(e[r].id===t)return e.splice(r,1),!0;return!1}function Ze(e){return c.aiToolkitActions=c.aiToolkitActions||[],Ae(c.aiToolkitActions,e),e}function _t(e){return c.aiToolkitActions=c.aiToolkitActions||[],He(c.aiToolkitActions,e)}function Vt(e){return c.aiToolkitDialogModes=c.aiToolkitDialogModes||[],Ae(c.aiToolkitDialogModes,e),e}function It(e){return c.aiToolkitDialogModes=c.aiToolkitDialogModes||[],He(c.aiToolkitDialogModes,e)}function $t(e,t){return e?typeof t=="function"?(c.aiToolkitOperationHandlers[e]=t,!0):(delete c.aiToolkitOperationHandlers[e],!1):!1}function lr(e){return e&&c.aiToolkitOperationHandlers&&c.aiToolkitOperationHandlers[e]?(delete c.aiToolkitOperationHandlers[e],!0):!1}function Nt(){return{version:"2026-04-18",operations:[{type:"open-chat-panel",description:"Open the docked AI chat panel."},{type:"open-review-panel",description:"Open the persistent AI review drawer."},{type:"open-dialog",description:"Open the Ask AI review dialog."},{type:"preview-suggestion",description:"Preview a reviewable inline suggestion for the current selection.",requiresText:!0,requiresSelection:!0},{type:"replace-selection",description:"Replace the current selection with new text.",requiresText:!0,requiresSelection:!0},{type:"replace-document",description:"Replace the whole editor document with new text.",requiresText:!0},{type:"insert-below",description:"Insert new text below the current selection or caret.",requiresText:!0},{type:"add-comment",description:"Insert an AI comment marker near the current selection or caret.",requiresText:!0}]}}function it(e,t,r,n,a){var s=e||a&&a.target||"document",l={mode:n&&n.mode?n.mode:a&&a.resolverMode?a.resolverMode:"",language:n&&n.language?n.language:"",sourceLabel:x(n&&n.mode?n.mode:a&&a.resolverMode?a.resolverMode:"",n&&n.snapshot?n.snapshot:null,n&&n.language?n.language:"",n&&n.scope?n.scope:"")};switch(s){case"chat-panel":return{type:"open-chat-panel"};case"review-panel":return{type:"open-review-panel"};case"dialog":return{type:"open-dialog",presetMode:r&&r.presetMode?r.presetMode:n&&n.mode?n.mode:"",useDocument:r&&typeof r.useDocument=="boolean"?r.useDocument:!1,autoRun:r&&typeof r.autoRun=="boolean"?r.autoRun:a&&typeof a.autoRun=="boolean"?a.autoRun:!1};case"selection-preview":case"preview":return{type:"preview-suggestion",text:t,meta:l};case"comment":return{type:"add-comment",text:t,meta:l};case"insert":return{type:"insert-below",text:t,meta:l};case"selection":return{type:"replace-selection",text:t,meta:l};default:return{type:"replace-document",text:t,meta:l}}}function sr(e,t,r,n,a){if(e==null)return null;if(typeof e=="string")return it(t,e,r,n,a);var s=e.type||e.op||e.name||"";return s?{type:s,text:u(e.text||e.result||e.content||e.note||""),html:e.html||"",reason:e.reason||r&&r.reason||"",presetMode:e.presetMode||r&&r.presetMode||n&&n.mode||"",useDocument:typeof e.useDocument=="boolean"?e.useDocument:r&&typeof r.useDocument=="boolean"?r.useDocument:!1,autoRun:typeof e.autoRun=="boolean"?e.autoRun:r&&typeof r.autoRun=="boolean"?r.autoRun:a&&typeof a.autoRun=="boolean"?a.autoRun:!1,target:e.target||t||"",meta:e.meta||null}:it(e.target||t,e.text||e.result||e.content||e.note||"",e,n,a)}function Gr(e,t,r,n){var a=[];e&&e.operations?a=e.operations:e&&e.operation?a=[e.operation]:a=[it(t,e&&(e.result||e.text||""),e,r,n)];for(var s=[],l=0;l<a.length;l++){var d=sr(a[l],t,e,r,n);d&&s.push(d)}return s}function nr(e){if(!e)return"";if(e.result)return u(e.result);for(var t=e.operations||[],r=0;r<t.length;r++)if(t[r]&&t[r].text)return u(t[r].text);return""}function Vr(e){if(!e)return"";if(e.reason)return u(e.reason);for(var t=e.operations||[],r=0;r<t.length;r++)if(t[r]&&t[r].reason)return u(t[r].reason);return""}function Lt(e){if(!e||!e.type)return{title:"Unknown step",copy:"This AI step does not expose a known editor action yet."};switch(e.type){case"open-chat-panel":return{title:"Open AI chat",copy:"Opens the docked AI chat panel for multi-turn document help."};case"open-review-panel":return{title:"Open AI review",copy:"Opens the persistent AI suggestion queue for the current editor."};case"open-dialog":return{title:"Open review dialog",copy:"Launches the Ask AI review dialog for a guided follow-up."};case"preview-suggestion":return{title:"Preview inline suggestion",copy:"Shows a reviewable inline diff in the editor before anything is committed."};case"replace-selection":return{title:"Replace selection",copy:"Updates the current selection with the generated text."};case"replace-document":return{title:"Replace document",copy:"Swaps the full editor content with the generated text."};case"insert-below":return{title:"Insert below",copy:"Adds generated content beneath the current selection or caret."};case"add-comment":return{title:"Add AI comment",copy:"Drops a non-destructive AI comment marker into the document."};default:return{title:e.type,copy:"Custom AI operation returned by the current resolver."}}}function Ir(e){var t=e&&e.operations?e.operations:[];if(!t.length)return"Apply";if(t.length>1)return"Apply "+t.length+" steps";switch(t[0].type){case"preview-suggestion":return"Preview";case"open-review-panel":return"Open AI review";case"replace-selection":return"Replace selection";case"replace-document":return"Replace document";case"insert-below":return"Insert below";case"add-comment":return"Add AI comment";case"open-chat-panel":return"Open AI chat";case"open-dialog":return"Open review dialog";default:return"Apply"}}function Ai(e){return Ir({operations:[e]})}function ci(e){var t=e||[];if(!t.length)return"Select text to continue";if(t.length>1)return"Select text to apply plan";switch(t[0].type){case"preview-suggestion":return"Select text to preview";case"replace-selection":return"Select text to apply to selection";default:return"Select text to continue"}}function Ei(e,t){if(!e||!e.type)return"Run this prepared AI step in the editor.";switch(e.type){case"preview-suggestion":return t&&t.hasSelection?"Show the prepared inline diff in the editor before deciding it.":"Select text to preview this prepared inline diff in the editor.";case"replace-selection":return t&&t.hasSelection?"Replace the current selection with this prepared draft.":"Select text before replacing it with this prepared draft.";case"replace-document":return"Replace the full document with this prepared draft.";case"insert-below":return t&&t.hasSelection?"Insert this prepared draft below the current selection.":"Insert this prepared draft below the current content.";case"add-comment":return"Add this prepared AI comment without rewriting the document body.";default:return"Run this prepared AI step in the editor."}}function Mn(e,t,r,n){if(e){var a=[t||"Action"];r&&a.push(r),n&&a.push(n),e.setAttribute("aria-label",a.join(". ")),e.title=r?(t||"Action")+" - "+r+(n?" "+n:""):(t||"Action")+(n?" - "+n:"")}}function Xr(e,t,r,n,a){return he({operations:[it(t,e,r,n,a)],presetMode:r&&r.presetMode?r.presetMode:n&&n.mode?n.mode:"",useDocument:r&&typeof r.useDocument=="boolean"?r.useDocument:!1,autoRun:r&&typeof r.autoRun=="boolean"?r.autoRun:!1},a,n)}function we(e){switch(e.mode){case"proofread":var t="Normalizes spacing, punctuation, and capitalization while keeping the original meaning intact.";return{operations:[it(e.action&&e.action.target?e.action.target:"selection-preview",J("proofread",e.source),{reason:t},e,e.action)],reason:t};case"rewrite":var r="Tightens the wording by removing filler phrases so the point comes through faster.";return{operations:[it(e.action&&e.action.target?e.action.target:"selection-preview",J("rewrite",e.source),{reason:r},e,e.action)],reason:r};case"translate":var n=e.action&&e.action.target&&e.action.target!=="dialog"?e.action.target:e.scope==="selection"?"selection-preview":"document";return{operations:[it(n,J("translate",e.source,{language:e.language}),{reason:"This prepares a translated "+T(e.language||"spanish")+" draft while keeping the original text available for review."},e,e.action)],reason:"This prepares a translated "+T(e.language||"spanish")+" draft while keeping the original text available for review."};case"justify":return{operations:[{type:"preview-suggestion",text:J("rewrite",e.source),reason:"This rewrite reduces filler language, clarifies the main point, and makes the sentence easier to review before accepting."}],reason:"This rewrite reduces filler language, clarifies the main point, and makes the sentence easier to review before accepting."};case"shorten":var a="Trims the passage to its core idea while keeping the original phrasing.";return{operations:[it(e.action&&e.action.target?e.action.target:"document",J("shorten",e.source),{reason:a},e,e.action)],reason:a};case"expand":var s="Adds a supporting sentence that reinforces the original point without changing its direction.",l=e.action&&e.action.target&&e.action.id!==e.mode?e.action.target:"insert";return{operations:[it(l,J("expand",e.source),{reason:s},e,e.action)],reason:s};case"summarize":var d="Condenses the content into a scannable summary that works as a recap or abstract.";return{operations:[it(e.action&&e.action.target?e.action.target:"document",J("summarize",e.source),{reason:d},e,e.action)],reason:d};case"comment":return{operations:[{type:"add-comment",text:ee(e.source)}]};case"paragraph":return{operations:[{type:"insert-below",text:ue(e.source)}]};case"chat":return F(e);default:return{operations:[it(e.action&&e.action.target?e.action.target:"document",J(e.mode||"rewrite",e.source),null,e,e.action)]}}}function he(e,t,r){var n=t&&t.target?t.target:"document";if(e==null)return{result:"",target:n,operations:[],message:"",action:t,request:r};typeof e=="string"&&(e={operations:[it(n,e,null,r,t)]});var a=Gr(e,e.target||e.mode||n,r,t),s=a.length?a[0].target||e.target||e.mode||n:e.target||e.mode||n;return{result:u(e.result||e.text||nr({operations:a})||""),target:s,operations:a,message:u(e.message||e.reply||""),reason:u(e.reason||Vr({operations:a})||""),autoRun:typeof e.autoRun=="boolean"?e.autoRun:t&&typeof t.autoRun=="boolean"?t.autoRun:!1,useDocument:typeof e.useDocument=="boolean"?e.useDocument:!1,presetMode:e.presetMode||r.mode||"",action:t,request:r}}function Ue(e,t){t=t||{};var r=$(e)||{id:e,title:e,target:"document"},n=t.snapshot||Le(),a={actionId:e,action:r,mode:t.mode||r.resolverMode||e,source:t.source||n.text||n.wholeText,prompt:t.prompt||"",language:t.language||"",scope:t.scope||(n.hasSelection?"selection":"document"),selectionText:n.text||"",documentText:n.wholeText||"",snapshot:n,editor:i,contract:Nt()};if(typeof c.aiToolkitResolver=="function")try{return Promise.resolve(c.aiToolkitResolver.call(i,a)).then(function(s){return(s===null||typeof s>"u")&&(s=we(a)),he(s,r,a)})}catch(s){return Promise.reject(s)}return Promise.resolve(he(we(a),r,a))}function Le(){var e=i.getSelection?i.getSelection():null,t={text:u(i.getSelectedText?i.getSelectedText():""),html:i.getSelectedHTML?i.getSelectedHTML():"",wholeText:u(i.getText?i.getText():""),range:null};if(t.hasSelection=!!t.text,e&&e.rangeCount)try{t.range=e.getRangeAt(0).cloneRange()}catch{t.range=null}return t}function ct(e){if(!e||!e.startContainer||!e.endContainer)return!1;var t=i.getEditable?i.getEditable():null;if(!t)return!1;var r=e.startContainer.nodeType===3?e.startContainer.parentNode:e.startContainer,n=e.endContainer.nodeType===3?e.endContainer.parentNode:e.endContainer;return!!(r&&n&&t.contains(r)&&t.contains(n))}function Ht(e,t){if(!e&&!t)return!0;if(!ct(e)||!ct(t))return!1;try{return e.compareBoundaryPoints(e.START_TO_START,t)===0&&e.compareBoundaryPoints(e.END_TO_END,t)===0}catch{return!1}}function zt(e,t){if(!e||!e.range||!ct(e.range))return!1;var r=e.range.cloneRange();t&&r.collapse(!1),i.focus();var n=i.getSelection?i.getSelection():null;return n?(n.removeAllRanges?n.removeAllRanges():n.empty&&n.empty(),n.addRange(r),!0):!1}function ir(e){var t=u(e);if(!t)return"";for(var r=t.split(/\n{2,}/),n=[],a=0;a<r.length;a++)n.push("<p>"+i.htmlEncode(r[a]).replace(/\n/g,"<br/>")+"</p>");return n.join("")}function _r(e){var t=u(e);return t?i.htmlEncode(t).replace(/\n/g,"<br/>"):""}function et(e){return i.htmlEncode(e||"")}function bn(e){return i.htmlEncode(e||"").replace(/\n/g," ")}function Li(e){return/<(p|div|h1|h2|h3|h4|h5|h6|ul|ol|li|table|thead|tbody|tr|td|th|blockquote|pre|section|article)\b/i.test(e||"")}function Ft(){return i.__aiSuggestions||(i.__aiSuggestions=[]),i.__aiSuggestions}function zi(){return i.__aiReviewLogEntries||(i.__aiReviewLogEntries=[]),i.__aiReviewLogEntries}function Wa(){return c.aiToolkitPersistenceKey?"RTE.AIToolkit."+c.aiToolkitPersistenceKey:""}function Ja(){return c.aiToolkitPersistenceKey||""}function El(e){return e?{id:e.id||"log-"+new Date().getTime()+"-"+Math.floor(Math.random()*1e3),documentKey:e.documentKey||Ja(),eventType:e.eventType||"suggestion-updated",suggestionId:e.suggestionId||"",status:e.status||"",suggestionType:Z(e.suggestionType||""),language:e.language||"",sourceLabel:e.sourceLabel||"",originalText:u(e.originalText||""),resultText:u(e.resultText||""),reason:u(e.reason||""),timestamp:e.timestamp||new Date().getTime()}:null}function Ll(e){switch(e.eventType){case"suggestion-created":return"Created";case"suggestion-accepted":return"Accepted";case"suggestion-rejected":return"Rejected";case"suggestion-reopened":return"Reopened";case"suggestion-stale":return"Marked stale";default:return"Updated"}}function Ic(e){if(!e)return"updated";switch(e.eventType){case"suggestion-created":return"created";case"suggestion-accepted":return"accepted";case"suggestion-rejected":return"rejected";case"suggestion-reopened":return"reopened";case"suggestion-stale":return"stale";default:return"updated"}}function Nc(e){return e?Ll(e)+" - "+(e.sourceLabel||"AI review"):""}function Hc(e,t){return El({id:"log-"+t.id+"-"+e+"-"+new Date().getTime(),documentKey:Ja(),eventType:e,suggestionId:t.id,status:t.status||"",suggestionType:t.suggestionType||"",language:t.language||"",sourceLabel:t.sourceLabel||(t.snapshot&&t.snapshot.hasSelection?"Selection suggestion":"Document suggestion"),originalText:t.originalText||"",resultText:t.resultText||"",reason:t.reason||"",timestamp:new Date().getTime()})}function Oc(e){if(e){var t=zi();t.unshift(e),t.length>30&&(t.length=30)}}function Qa(e,t,r,n){if(!t||!window.XMLHttpRequest)return typeof n=="function"&&n(null),!1;try{var a=new XMLHttpRequest;return a.open(e,t,!0),a.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&a.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.onreadystatechange=function(){a.readyState===4&&typeof n=="function"&&n(a)},a.send(r||null),!0}catch{return typeof n=="function"&&n(null),!1}}function Fi(e,t){var r=c.aiToolkitReviewLogUrl||"";if(!r||!t||!Ja())return!1;var n=Hc(e,t);return Oc(n),Qa("POST",r,JSON.stringify(n),function(a){(!a||a.status<200||a.status>=300)&&console.warn("AI review log request failed")}),!0}function Rl(e,t){var r=c.aiToolkitReviewLogUrl||"",n=Ja();return!r||!n?(typeof t=="function"&&t(zi().slice(),!1),!1):!e&&i.__aiReviewLogLoaded?(typeof t=="function"&&t(zi().slice(),!0),!0):(Qa("GET",r+"?key="+encodeURIComponent(n),null,function(a){var s=[],l=!!(a&&a.status>=200&&a.status<300);if(l)try{for(var d=JSON.parse(a.responseText||"{}"),m=d&&d.entries?d.entries:[],R=0;R<m.length;R++){var Q=El(m[R]);Q&&s.push(Q)}}catch{}i.__aiReviewLogEntries=s,i.__aiReviewLogLoaded=l,typeof t=="function"&&t(s.slice(),l)}),!0)}function qc(e){return{id:e.id,changeType:e.changeType||"ai-preview",author:e.author?{id:e.author.id||"ai",name:e.author.name||"AI",color:e.author.color||"#8b5cf6"}:{id:"ai",name:"AI",color:"#8b5cf6"},originalHtml:e.originalHtml||"",originalText:e.originalText||"",resultText:e.resultText||"",resultHtml:e.resultHtml||"",reason:e.reason||"",suggestionType:e.suggestionType||"",language:e.language||"",isBlock:!!e.isBlock,status:e.status||"pending",createdAt:e.createdAt||new Date().getTime(),decidedAt:e.decidedAt||0,sourceLabel:e.sourceLabel||"",scope:e.snapshot&&e.snapshot.hasSelection?"selection":"document",text:e.text||"",blockPath:e.blockPath||"",replies:Array.isArray(e.replies)?e.replies:[]}}function jc(e){if(!e||!e.id)return null;var t=e.changeType||"ai-preview",r=e.author&&typeof e.author=="object"?e.author:null;return r||(r=t==="ai-preview"?{id:"ai",name:"AI",color:"#8b5cf6"}:{id:"user",name:"User",color:"#2563eb"}),{id:e.id,changeType:t,author:{id:r.id||"user",name:r.name||r.id||"User",color:r.color||"#2563eb"},originalHtml:e.originalHtml||"",originalText:e.originalText||"",resultText:e.resultText||"",resultHtml:e.resultHtml||"",reason:e.reason||"",suggestionType:e.suggestionType||"",language:e.language||"",isBlock:!!e.isBlock,status:e.status||"pending",createdAt:e.createdAt||new Date().getTime(),decidedAt:e.decidedAt||0,sourceLabel:e.sourceLabel||"",snapshot:e.snapshot||{hasSelection:e.scope==="selection"},text:e.text||"",blockPath:e.blockPath||"",replies:Array.isArray(e.replies)?e.replies:[]}}function Dl(e){if(!e||!e.id)return null;var t=e.changeType||"ai-preview",r=e.author&&typeof e.author=="object"?e.author:null;return r||(r=t==="ai-preview"?{id:"ai",name:"AI",color:"#8b5cf6"}:{id:"user",name:"User",color:"#2563eb"}),{id:e.id,changeType:t,author:{id:r.id||"user",name:r.name||r.id||"User",color:r.color||"#2563eb"},originalHtml:e.originalHtml||_r(e.originalText||""),originalText:u(e.originalText||""),resultText:u(e.resultText||""),resultHtml:e.resultHtml||_r(e.resultText||""),reason:u(e.reason||""),suggestionType:Z(e.suggestionType||""),language:e.language||"",isBlock:!!e.isBlock,status:e.status==="accepted"||e.status==="rejected"||e.status==="stale"?e.status:"stale",createdAt:e.createdAt||new Date().getTime(),decidedAt:e.decidedAt||0,sourceLabel:e.sourceLabel||(e.scope==="selection"?"Selection suggestion":"Document suggestion"),snapshot:{hasSelection:e.scope==="selection"},text:e.text||"",blockPath:e.blockPath||"",replies:Array.isArray(e.replies)?e.replies:[]}}function Po(){return c.aiToolkitPersistenceKey||""}function Uc(){return{version:"2026-04-18",documentKey:Po(),savedAt:new Date().getTime(),suggestions:Ft().map(qc)}}function Pl(e){switch(e){case"pending":return 4;case"accepted":return 3;case"rejected":return 2;case"stale":return 1;default:return 0}}function Gi(e){return Math.max(e&&e.decidedAt||0,e&&e.createdAt||0)}function Mo(e){return e?{id:e.id,originalHtml:e.originalHtml||"",originalText:e.originalText||"",resultText:e.resultText||"",resultHtml:e.resultHtml||"",reason:e.reason||"",suggestionType:e.suggestionType||"",language:e.language||"",isBlock:!!e.isBlock,status:e.status||"stale",createdAt:e.createdAt||0,decidedAt:e.decidedAt||0,sourceLabel:e.sourceLabel||"",snapshot:{hasSelection:!!(e.snapshot&&e.snapshot.hasSelection)}}:null}function Bc(e,t){if(!e)return Mo(t);if(!t)return e;var r=Gi(e),n=Gi(t);return n>r?Mo(t):n<r?e:Pl(t.status)>Pl(e.status)?Mo(t):e}function zc(e,t){var r={},n=[],a;function s(d){!d||!d.id||(r[d.id]||n.push(d.id),r[d.id]=Bc(r[d.id],d))}for(a=0;a<e.length;a++)s(e[a]);for(a=0;a<t.length;a++)s(t[a]);var l=[];for(a=0;a<n.length;a++)r[n[a]]&&l.push(r[n[a]]);return l.sort(function(d,m){return Gi(m)-Gi(d)}),l}function Fc(){var e=Wa(),t="";if(e&&window.localStorage)try{t=window.localStorage.getItem(e)||""}catch{}if(!t){var r=Di();r&&r.getAttribute&&(t=r.getAttribute("data-rte-ai-ledger")||"")}return t}function Ml(e,t){var r=c.aiToolkitSuggestionLedgerUrl||"";return!r||!e||!e.documentKey?(typeof t=="function"&&t(null),!1):Qa("POST",r,JSON.stringify(e),t)}function Gc(){var e=parseInt(c.aiToolkitReviewSyncInterval,10);return e>=5e3?e:15e3}function Vc(){return i.__aiReviewLastSyncedAt||0}function Kc(e){i.__aiReviewLastSyncedAt=e||new Date().getTime()}function Il(){return i.__aiReviewSyncState||(i.__aiReviewSyncState={phase:Ri()?"idle":"local",message:""}),i.__aiReviewSyncState}function Nl(){if(!Ri())return{subtitle:"Queued AI suggestions for this session.",badge:"Local",badgeClass:"is-local",buttonText:"Sync now",buttonDisabled:!0,syncing:!1};var e=Il();if(e.phase==="syncing")return{subtitle:e.message||"Syncing shared AI review...",badge:"Syncing",badgeClass:"is-syncing",buttonText:"Syncing...",buttonDisabled:!0,syncing:!0};if(e.phase==="error")return{subtitle:e.message||"Shared AI review sync failed. Try again.",badge:"Retry",badgeClass:"is-error",buttonText:"Retry sync",buttonDisabled:!1,syncing:!1};var t=Vc();if(!t)return{subtitle:"Shared AI review sync is ready.",badge:"Shared",badgeClass:"is-shared",buttonText:"Sync now",buttonDisabled:!1,syncing:!1};var r=Math.max(0,Math.round((new Date().getTime()-t)/1e3));return r<5?{subtitle:"Shared AI review synced just now.",badge:"Live",badgeClass:"is-live",buttonText:"Sync now",buttonDisabled:!1,syncing:!1}:r<60?{subtitle:"Shared AI review synced "+r+"s ago.",badge:"Live",badgeClass:"is-live",buttonText:"Sync now",buttonDisabled:!1,syncing:!1}:{subtitle:"Shared AI review synced "+Math.round(r/60)+"m ago.",badge:"Live",badgeClass:"is-live",buttonText:"Sync now",buttonDisabled:!1,syncing:!1}}function $a(e,t){var r=Il();r.phase=e||(Ri()?"idle":"local"),r.message=t||"",Hl()}function Ri(){return!!(c.aiToolkitSuggestionLedgerUrl||c.aiToolkitReviewLogUrl)}function Wc(){return Nl().subtitle}function Hl(){if(!i.__aiReviewPanel||!i.__aiReviewPanel.isConnected)return!1;var e=Nl();return i.__aiReviewSubtitleNode&&(i.__aiReviewSubtitleNode.textContent=e.subtitle),i.__aiReviewSyncBadgeNode&&(i.__aiReviewSyncBadgeNode.className="rte-ai-review-sync-badge "+e.badgeClass,i.__aiReviewSyncBadgeNode.textContent=e.badge),i.__aiReviewSyncButton&&(i.__aiReviewSyncButton.textContent=e.buttonText,i.__aiReviewSyncButton.disabled=!!e.buttonDisabled,e.syncing?i.__aiReviewSyncButton.setAttribute("aria-busy","true"):i.__aiReviewSyncButton.removeAttribute("aria-busy")),!0}function Jc(e,t){var r={},n=[],a;for(a=0;a<e.length;a++)e[a]&&e[a].id&&(r[e[a].id]=!0);for(a=0;a<t.length;a++)t[a]&&t[a].id&&!r[t[a].id]&&n.push(t[a]);return n}function Qc(e){if(!e||!e.length)return!1;var t=jr();t.unseenRemoteActivityCount+=e.length,t.latestRemoteActivity=e[0],t.latestRemoteSuggestionId=e[0]&&e[0].suggestionId?e[0].suggestionId:t.latestRemoteSuggestionId;for(var r=0;r<e.length;r++)e[r]&&e[r].suggestionId&&eu(e[r].suggestionId);return!0}function Ol(e){return(e||[]).slice().sort(function(t,r){var n=Yr(t.id),a=Yr(r.id);if(n!==a)return a-n;if(i.__aiActiveSuggestionId){if(t.id===i.__aiActiveSuggestionId)return-1;if(r.id===i.__aiActiveSuggestionId)return 1}return Gi(r)-Gi(t)})}function $c(){for(var e=Ft().slice(),t=!1,r=0;r<e.length;r++){var n=e[r],a=In(n.id),s=No(n.id);if(n.status==="pending"){s&&(s.outerHTML=Xo(n),t=!0);continue}if(n.status==="accepted"||n.status==="rejected"||n.status==="stale"){var l=Xa(n,n.status);a?(a.outerHTML=l,t=!0):s&&((s.getAttribute("data-rte-ai-resolved-status")||"")!==n.status||s.innerHTML!==(n.status==="accepted"?n.resultHtml||_r(n.resultText||""):n.originalHtml||_r(n.originalText||"")))&&(s.outerHTML=l,t=!0)}}return yn(),t}function ui(e,t){if(!Ri())return typeof t=="function"&&t(Ft().slice()),!1;if(i.__aiReviewSyncInFlight)return typeof t=="function"&&(i.__aiReviewSyncCallbacks||(i.__aiReviewSyncCallbacks=[]),i.__aiReviewSyncCallbacks.push(t)),e&&(i.__aiReviewSyncPending=!0),$a("syncing","Syncing shared AI review..."),!0;i.__aiReviewSyncInFlight=!0,i.__aiReviewSyncPending=!1,i.__aiReviewSyncCallbacks=typeof t=="function"?[t]:[],$a("syncing","Syncing shared AI review...");var r=0,n=Ft().slice(),a=!1,s=zi().slice(),l=!!i.__aiReviewLogLoaded;function d(){if(r--,!(r>0)){i.__aiReviewSyncInFlight=!1,a?$a("error","Shared AI review sync failed. Showing the last known state."):(Kc(new Date().getTime()),$a("idle")),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1);var m=i.__aiReviewSyncCallbacks?i.__aiReviewSyncCallbacks.slice():[];i.__aiReviewSyncCallbacks=[];for(var R=0;R<m.length;R++)m[R](n.slice());i.__aiReviewSyncPending&&(i.__aiReviewSyncPending=!1,ui(!0))}}return c.aiToolkitSuggestionLedgerUrl&&(r++,ql(e,function(m,R){n=m||Ft().slice(),R||(a=!0),$c(),d()})),c.aiToolkitReviewLogUrl&&(r++,Rl(e,function(m,R){R?l&&Qc(Jc(s,m||[])):a=!0,d()})),r>0}function ql(e,t){var r=c.aiToolkitSuggestionLedgerUrl||"",n=Po();return!r||!n?(typeof t=="function"&&t(Ft().slice(),!1),!1):!e&&i.__aiSuggestionLedgerLoaded?(typeof t=="function"&&t(Ft().slice(),!0),!0):(Qa("GET",r+"?key="+encodeURIComponent(n),null,function(a){var s=[],l=!!(a&&a.status>=200&&a.status<300);if(l)try{for(var d=JSON.parse(a.responseText||"{}"),m=d&&d.suggestions?d.suggestions:[],R=0;R<m.length;R++){var Q=Dl(m[R]);Q&&s.push(Q)}}catch{}var ie=zc(Ft(),s);i.__aiSuggestions=ie,i.__aiSuggestionLedgerLoaded=l,Sr({skipRemote:!0}),typeof t=="function"&&t(ie.slice(),l)}),!0)}function mf(){i.__aiReviewSyncTimer&&(window.clearInterval(i.__aiReviewSyncTimer),i.__aiReviewSyncTimer=null)}function Xc(){return!Ri()||i.__aiReviewSyncTimer||!window.setInterval?!1:(i.__aiReviewSyncTimer=window.setInterval(function(){document&&document.hidden||ui(!0)},Gc()),!0)}function Yc(){i.__aiReviewSyncEventsBound||(i.__aiReviewSyncEventsBound=!0,document&&document.addEventListener&&document.addEventListener("visibilitychange",function(){document.hidden||ui(!0)}),window&&window.addEventListener&&window.addEventListener("focus",function(){ui(!0)}))}function Sr(e){e=e||{};var t=Uc(),r=JSON.stringify(t),n=Di();n&&n.setAttribute&&n.setAttribute("data-rte-ai-ledger",r);var a=Wa();if(a&&window.localStorage)try{window.localStorage.setItem(a,r)}catch{}return e.skipRemote||Ml(t,function(s){(!s||s.status<200||s.status>=300)&&console.warn("AI suggestion ledger request failed")}),r}function jl(){var e=Fc();if(!e)return i.__aiSuggestions=[],Za(),Zt(null),[];try{for(var t=JSON.parse(e),r=t&&t.suggestions?t.suggestions:[],n=[],a=0;a<r.length;a++){var s=Dl(r[a]);s&&n.push(s)}return i.__aiSuggestions=n,nu(),Zt(null),n.slice()}catch{return i.__aiSuggestions=[],Za(),Zt(null),[]}}function Zc(){i.__aiSuggestions=[],Za(),Zt(null);var e=Di();e&&e.removeAttribute&&e.removeAttribute("data-rte-ai-ledger");var t=Wa();if(t&&window.localStorage)try{window.localStorage.removeItem(t)}catch{}return i.__aiSuggestionLedgerLoaded=!1,Ml({version:"2026-04-18",documentKey:Po(),savedAt:new Date().getTime(),suggestions:[]},function(){}),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),!0}function jr(){return i.__aiReviewState||(i.__aiReviewState={showResolved:!1,typeFilter:"all",unseenRemoteActivityCount:0,latestRemoteActivity:null,latestRemoteSuggestionId:"",remoteSuggestionIds:{}}),i.__aiReviewState}function Io(){var e=jr();e.unseenRemoteActivityCount=0,e.latestRemoteActivity=null,e.latestRemoteSuggestionId="",e.remoteSuggestionIds={}}function eu(e){if(!e)return!1;var t=jr();return t.remoteSuggestionIds[e]=(t.remoteSuggestionIds[e]||0)+1,!0}function va(e){var t=jr();return e&&t.remoteSuggestionIds[e]?(delete t.remoteSuggestionIds[e],!0):!1}function Yr(e){var t=jr();return e&&t.remoteSuggestionIds[e]||0}function tu(){return jr().latestRemoteSuggestionId||""}function ru(){var e=jr();if(!e.unseenRemoteActivityCount)return null;var t=e.latestRemoteActivity,r=e.unseenRemoteActivityCount;return{count:r,title:r===1?"1 shared review update just arrived.":r+" shared review updates just arrived.",detail:t?Nc(t):"Shared AI review activity is newer than your local view."}}function pt(e){for(var t=Ft(),r=0;r<t.length;r++)if(t[r].id===e)return t[r];return null}function In(e){var t=i.getEditable?i.getEditable():null;return t?t.querySelector('[data-rte-ai-suggestion-id="'+e+'"]'):null}function No(e){var t=i.getEditable?i.getEditable():null;return t?t.querySelector('[data-rte-ai-resolved-id="'+e+'"]'):null}function Xa(e,t){if(!e)return"";var r=t||e.status||"accepted",n=e.isBlock?"div":"span",a=r==="accepted"?e.resultHtml||_r(e.resultText||""):e.originalHtml||_r(e.originalText||"");return"<"+n+' class="rte-ai-resolved-suggestion is-'+bn(r)+(e.isBlock?" is-block":" is-inline")+'" data-rte-ai-resolved-id="'+bn(e.id)+'" data-rte-ai-resolved-status="'+bn(r)+'">'+a+"</"+n+">"}function Vi(){return i.__aiReviewDecisionHistory||(i.__aiReviewDecisionHistory=[]),i.__aiReviewDecisionHistory}function nu(){for(var e=Vi(),t=e.length-1;t>=0;t--){var r=e[t],n=r&&r.suggestionId?pt(r.suggestionId):null;(!n||n.status!==r.status)&&e.splice(t,1)}return e}function bf(){var e=Vi();return e.length?e[e.length-1]:null}function Ho(e,t,r){if(r=r||{},!e||!e.id||!t)return Za(),null;r.clearRedo!==!1&&zl();var n=Vi();return n.push({suggestionId:e.id,status:t,timestamp:new Date().getTime()}),n.length>12&&n.splice(0,n.length-12),n[n.length-1]}function Ul(){var e=Vi();return e.length?e.pop():null}function Ya(){return i.__aiReviewRedoHistory||(i.__aiReviewRedoHistory=[]),i.__aiReviewRedoHistory}function iu(e,t){if(!e||!e.id||!t)return null;var r=Ya();return r.push({suggestionId:e.id,status:t,timestamp:new Date().getTime()}),r.length>12&&r.splice(0,r.length-12),r[r.length-1]}function Bl(){var e=Ya();return e.length?e.pop():null}function zl(){i.__aiReviewRedoHistory=[]}function Za(){i.__aiReviewDecisionHistory=[],zl()}function di(){for(var e=Vi();e.length;){var t=e[e.length-1];if(!t||!t.suggestionId){e.pop();continue}var r=pt(t.suggestionId),n=No(t.suggestionId);if(!r||!n||r.status!==t.status){e.pop();continue}return{suggestion:r,wrapper:n,status:t.status,timestamp:t.timestamp||0,historyCount:e.length,remainingCount:e.length-1}}return null}function Nn(){for(var e=Ya();e.length;){var t=e[e.length-1];if(!t||!t.suggestionId){e.pop();continue}var r=pt(t.suggestionId),n=In(t.suggestionId);if(!r||!n||r.status!=="pending"){e.pop();continue}return{suggestion:r,wrapper:n,status:t.status,timestamp:t.timestamp||0,historyCount:e.length,remainingCount:e.length-1}}return null}function Nr(e){if(e=e||di(),!e||!e.suggestion)return{actionLabel:"Undo last",shortcutLabel:"undo last",decisionLabel:"last",typeLabel:"",detailLabel:"last suggestion",summaryText:""};var t=e.suggestion,r=e.status==="rejected"?"rejected":e.status==="accepted"?"accepted":"resolved",n=t.suggestionType&&t.suggestionType!=="other"?M(t.suggestionType).toLowerCase():"";return{actionLabel:"Undo "+r+(n?" "+n:"")+(e.remainingCount?" ("+e.remainingCount+" more)":""),shortcutLabel:"undo "+r,decisionLabel:r,typeLabel:n,detailLabel:r+" "+(n?n+" ":"")+"suggestion",summaryText:er(t.originalText||t.resultText||"suggestion",72),remainingCount:e.remainingCount||0}}function ha(e){var t=Nr(e);return!e||!e.suggestion?"":"Undo target: "+t.detailLabel+(t.summaryText?" - "+t.summaryText:"")+(t.remainingCount?". "+t.remainingCount+" earlier undo"+(t.remainingCount===1?" remains.":"s remain."):"")}function eo(e){var t=Hr(e);return!e||!e.suggestion?"":"Redo target: "+t.detailLabel+(t.summaryText?" - "+t.summaryText:"")+(t.remainingCount?". "+t.remainingCount+" earlier redo"+(t.remainingCount===1?" remains.":"s remain."):"")}function Hr(e){if(e=e||Nn(),!e||!e.suggestion)return{actionLabel:"Redo last",shortcutLabel:"redo last",decisionLabel:"last",detailLabel:"last suggestion",summaryText:"",remainingCount:0};var t=e.suggestion,r=e.status==="rejected"?"rejected":e.status==="accepted"?"accepted":"resolved",n=t.suggestionType&&t.suggestionType!=="other"?M(t.suggestionType).toLowerCase():"";return{actionLabel:"Redo "+r+(n?" "+n:"")+(e.remainingCount?" ("+e.remainingCount+" more)":""),shortcutLabel:"redo "+r,decisionLabel:r,detailLabel:r+" "+(n?n+" ":"")+"suggestion",summaryText:er(t.originalText||t.resultText||"suggestion",72),remainingCount:e.remainingCount||0}}function Oo(e){for(var t=Vi(),r=[],n=typeof e=="number"?e:3,a=t.length-2;a>=0&&r.length<n;a--){var s=t[a];if(!(!s||!s.suggestionId)){var l=pt(s.suggestionId),d=No(s.suggestionId);if(!(!l||!d||l.status!==s.status)){var m={suggestion:l,wrapper:d,status:s.status,timestamp:s.timestamp||0,historyCount:a+1,remainingCount:a},R=Nr(m);r.push({label:R.actionLabel,detail:ha(m)})}}}return r}function qo(e){for(var t=Ya(),r=[],n=typeof e=="number"?e:3,a=t.length-2;a>=0&&r.length<n;a--){var s=t[a];if(!(!s||!s.suggestionId)){var l=pt(s.suggestionId),d=In(s.suggestionId);if(!(!l||!d||l.status!=="pending")){var m={suggestion:l,wrapper:d,status:s.status,timestamp:s.timestamp||0,historyCount:a+1,remainingCount:a},R=Hr(m);r.push({label:R.actionLabel,detail:R.detailLabel+(R.summaryText?" - "+R.summaryText:"")})}}}return r}function Fl(e,t,r){if(!e||!t||!t.length)return null;var n=o(e,"div","","rte-ai-review-item-history"+(r?" is-"+r:""));o(n,"div","","rte-ai-review-item-history-title","Then");for(var a=0;a<t.length;a++){var s=t[a],l=o(n,"div","","rte-ai-review-item-history-item");o(l,"div","","rte-ai-review-item-history-label",s.label),o(l,"div","","rte-ai-review-item-history-detail",s.detail)}return n}function to(e,t,r){if(!e||!e.setAttribute)return"";if(e.id)return e.id;var n=String(r||"item").replace(/[^A-Za-z0-9\-_:.]/g,"-");return e.id="rte-ai-review-"+t+"-"+n,e.id}function ga(e){if(!e||!e.focus)return!1;try{return e.focus({preventScroll:!0}),!0}catch{try{return e.focus(),!0}catch{return!1}}}function jo(e,t){if(!e||!t||!e.querySelector)return!1;var r=e.querySelector('[data-rte-ai-action="'+t+'"]');if(r&&!r.disabled&&r.focus)try{return r.focus({preventScroll:!0}),!0}catch{try{return r.focus(),!0}catch{}}return!1}function au(e,t){if(!e)return!1;var r=In(e);return r?jo(r,t)?!0:ga(r):!1}function Uo(e){if(!e)return"";var t=Nn();return e.status==="pending"&&t&&t.suggestion&&t.suggestion.id===e.id?"redo":e.status==="pending"?"accept":"review"}function ro(e,t){var r=pt(e);if(!r)return!1;var n=In(e),a=Uo(r),s=t||a;if(n&&(jo(n,s)||a&&a!==s&&jo(n,a)))return!0;var l=a&&a!==s?a:s;return xi(e,{focusPanel:!0,focusAction:l==="review"?"":l})}function Gl(e,t,r,n){if(!e)return null;if(!r)return t&&t.parentNode&&t.parentNode.removeChild(t),null;t||(t=document.createElement("span"),t.className="rte-ai-inline-preview-remote"),t.textContent=r>1?r+" shared updates":"Shared update",t.setAttribute("aria-label","Shared AI review updates");var a=n&&n.parentNode===e?n:e.querySelector?e.querySelector(".rte-ai-inline-preview-actions"):null;return a&&a.parentNode===e?a.nextSibling!==t&&(a.nextSibling?e.insertBefore(t,a.nextSibling):e.appendChild(t)):t.parentNode!==e&&e.appendChild(t),t}function Ki(){i.__aiBindInlinePreviewEventHandlers&&i.__aiBindInlinePreviewEventHandlers();var e=i.getEditable?i.getEditable():null;if(!e||!e.querySelectorAll)return!1;for(var t=e.querySelectorAll("[data-rte-ai-suggestion-id]"),r=di(),n=Nn(),a=0;a<t.length;a++){var s=t[a].getAttribute("data-rte-ai-suggestion-id")||"",l=pt(s),d=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-current"):null,m=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-opened"):null,R=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-type"):null,Q=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-language"):null,ie=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-scope"):null,ae=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-remote"):null,oe=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-queue"):null,te=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-transition"):null,se=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-followup"):null,ce=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-glance"):null,Ne=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-reason"):null,de=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-plan"):null,_e=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-undo"):null,ke=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-undo-next"):null,Ce=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-redo"):null,me=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-redo-next"):null,Re=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-shortcuts"):null,Be=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-launch"):null,xe=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-focus"):null,Fe=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="review"]'):null,ut=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="previous"]'):null,Ge=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="next"]'):null,Se=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="accept"]'):null,nt=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="reject"]'):null,Je=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="undo"]'):null,at=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="redo"]'):null,Ve=t[a].querySelector?t[a].querySelector('[data-rte-ai-action="shared-seen"]'):null,Ee=Yr(s),Pe=!!(i.__aiReviewEmptyPreviewSuggestionId&&s===i.__aiReviewEmptyPreviewSuggestionId),xt=!!(!Pe&&i.__aiRecentlyOpenedQueueSuggestionId&&s===i.__aiRecentlyOpenedQueueSuggestionId),lt=!Pe&&r?Nr(r):null,Ke=!Pe&&r?ha(r):"",jt=Pe?[]:Oo(1),St=jt.length?jt[0]:null,mt=!!(!Pe&&n&&n.suggestion&&n.suggestion.id===s&&l&&l.status==="pending"),Tt=mt?Hr(n):null,tr=mt?eo(n):"",yr=mt?qo(1):[],Dt=yr.length?yr[0]:null,Kt=Pe?qt(l,Ie()):"",vt=qt(l,Ie())||qt(l,""),je=Pe?"Open this AI review queue"+(vt?" and focus "+vt:""):"Open this AI suggestion in review"+(vt?" and focus "+vt:""),qe=Wr(s),Pt=Pe?{index:0,total:0}:yo(qe,s),rr=Pe?[]:Xt(qe),ze=Pe?null:_a(rr,i.__aiActiveSuggestionId,l),Me=Pe?null:mi(rr,i.__aiActiveSuggestionId,l),tt=Pe?null:$i(l),bt=Pe?null:wa(tt),ye=bi(l),ht=Pe?"":oc(s),Oe=Pe?"":ia(s),Qe=ht?"Previous AI review item":"No previous AI review item in the current queue",yt=Oe?"Next AI review item":"No next AI review item in the current queue";if(i.__aiActiveSuggestionId&&s===i.__aiActiveSuggestionId){t[a].classList.add("is-review-active"),t[a].classList.toggle("is-review-preview",Pe),t[a].classList.toggle("is-queue-opened",xt),Pe?(t[a].setAttribute("role","button"),t[a].removeAttribute("aria-current"),t[a].setAttribute("aria-keyshortcuts","Enter Space"),t[a].setAttribute("tabindex","0"),t[a].title=Y(l)):(t[a].setAttribute("role","group"),t[a].setAttribute("aria-current","step"),t[a].setAttribute("aria-keyshortcuts",(Ee?"ArrowLeft ArrowRight Home End J K A R G Enter Space":"ArrowLeft ArrowRight Home End J K A R Enter Space")+(lt?" U":"")+(mt?" Shift+U":"")),t[a].setAttribute("tabindex","0"),t[a].title=su({suggestion:l,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt}));var wt=wi(l,"accept",qe)||{text:"Accept",label:"Accept this AI change"},Ct=wi(l,"reject",qe)||{text:"Reject",label:"Reject this AI change"},Ut=wt.label,ot=Ct.label,Lr=Ke||"Undo the last AI review decision",Wt=tr||"Redo the last AI review decision",Rr={isPreviewTarget:Pe,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt};Jn(Fe,Pe?"Open queue":"Review",je),ma(ut,!ht,Qe),ma(Ge,!Oe,yt),Jn(Se,wt.text,Ut),Jn(nt,Ct.text,ot),vi(Fe,je,Rr),vi(ut,Qe,Rr),vi(Ge,yt,Rr),vi(Se,Ut,Rr),vi(nt,ot,Rr);var cr=Fo(t[a],"recovery");if(lt?(Je||(Je=document.createElement("button"),Je.type="button",Je.className="rte-ai-inline-preview-button is-undo",Je.setAttribute("data-rte-ai-action","undo"),cr&&cr.appendChild(Je)),Jn(Je,lt.actionLabel,Lr),vi(Je,Lr,Rr)):Je&&Je.parentNode&&(Je.parentNode.removeChild(Je),Je=null),mt&&Tt?(at||(at=document.createElement("button"),at.type="button",at.className="rte-ai-inline-preview-button is-redo",at.setAttribute("data-rte-ai-action","redo"),cr&&cr.appendChild(at)),Jn(at,Tt.actionLabel,Wt),vi(at,Wt,Rr)):at&&at.parentNode&&(at.parentNode.removeChild(at),at=null),!d){d=document.createElement("span"),d.className="rte-ai-inline-preview-current";var Cn=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-actions"):null;Cn&&Cn.nextSibling?t[a].insertBefore(d,Cn.nextSibling):t[a].appendChild(d)}if(d.classList.toggle("is-preview-target",Pe),d.textContent=Pe?"Next queue":"Current",d.setAttribute("aria-label",Pe?"Next AI review queue target":"Current AI review item"),xt?(m||(m=document.createElement("span"),m.className="rte-ai-inline-preview-opened",d&&d.nextSibling?t[a].insertBefore(m,d.nextSibling):t[a].appendChild(m)),m.textContent="Queue opened",m.setAttribute("aria-label","AI review queue opened")):m&&m.parentNode&&m.parentNode.removeChild(m),Pe)if(Be||(Be=document.createElement("span"),Be.className="rte-ai-inline-preview-launch",d&&d.nextSibling?t[a].insertBefore(Be,d.nextSibling):t[a].appendChild(Be)),Be.textContent=G(l),Be.setAttribute("aria-hidden","true"),Kt){if(!xe){xe=document.createElement("span"),xe.className="rte-ai-inline-preview-focus";var fn=Be||d;fn&&fn.nextSibling?t[a].insertBefore(xe,fn.nextSibling):t[a].appendChild(xe)}xe.textContent="Focus "+Kt,xe.setAttribute("aria-label","Queue opens on "+Kt)}else xe&&xe.parentNode&&xe.parentNode.removeChild(xe);else Be&&Be.parentNode&&Be.parentNode.removeChild(Be),xe&&xe.parentNode&&xe.parentNode.removeChild(xe);if(l&&l.suggestionType&&Z(l.suggestionType)!=="other"?(R||(R=document.createElement("span"),R.className="rte-ai-inline-preview-type",d&&d.nextSibling?t[a].insertBefore(R,d.nextSibling):t[a].appendChild(R)),R.textContent=M(l.suggestionType),R.setAttribute("aria-label","AI suggestion type")):R&&R.parentNode&&R.parentNode.removeChild(R),l&&l.language){if(!Q){Q=document.createElement("span"),Q.className="rte-ai-inline-preview-language";var wr=R||d;wr&&wr.nextSibling?t[a].insertBefore(Q,wr.nextSibling):t[a].appendChild(Q)}Q.textContent=T(l.language),Q.setAttribute("aria-label","AI suggestion language")}else Q&&Q.parentNode&&Q.parentNode.removeChild(Q);var At=X(l);if(At){if(!ie){ie=document.createElement("span"),ie.className="rte-ai-inline-preview-scope";var Et=Q||R||d;Et&&Et.nextSibling?t[a].insertBefore(ie,Et.nextSibling):t[a].appendChild(ie)}ie.textContent=At,ie.setAttribute("aria-label","AI suggestion scope")}else ie&&ie.parentNode&&ie.parentNode.removeChild(ie);ae=Gl(t[a],ae,Ee,ie||Q||R||d||(t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-actions"):null));var Zr=Fo(t[a],"recovery");if(Ee?(Ve||(Ve=document.createElement("button"),Ve.type="button",Ve.className="rte-ai-inline-preview-button is-shared",Ve.setAttribute("data-rte-ai-action","shared-seen"),Zr&&Zr.appendChild(Ve)),Ve.textContent="Got it",Ve.setAttribute("aria-label","Clear shared AI review update notice"),Ve.title="Clear shared AI review update notice",vi(Ve,"Clear shared AI review update notice",Rr)):Ve&&Ve.parentNode&&(Ve.parentNode.removeChild(Ve),Ve=null),Wl(t[a],"recovery",!!(lt||mt&&Tt||Ee)),Vo(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt,queueTransitionData:Me,undoInlineSummaryText:Ke,redoInlineSummaryText:tr}),Ko(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt,queueTransitionData:Me,undoInlineSummaryText:Ke,redoInlineSummaryText:tr}),Yl(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt}),Pt.total&&Pt.index){if(!oe){oe=document.createElement("span"),oe.className="rte-ai-inline-preview-queue";var xr=ae||ie||Q||R||d||(t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-current"):null);if(xr&&xr.nextSibling)t[a].insertBefore(oe,xr.nextSibling);else if(xr)t[a].appendChild(oe);else{var Cr=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-actions"):null;Cr&&Cr.nextSibling?t[a].insertBefore(oe,Cr.nextSibling):t[a].appendChild(oe)}}oe.textContent="Item "+Pt.index+" of "+Pt.total,oe.setAttribute("aria-label","Current AI review queue position")}else oe&&oe.parentNode&&oe.parentNode.removeChild(oe);if(Me){if(!te){te=document.createElement("span"),te.className="rte-ai-inline-preview-transition";var qi=oe||ae||ie||Q||R||d;qi&&qi.nextSibling?t[a].insertBefore(te,qi.nextSibling):t[a].appendChild(te)}if(te.textContent=Me.statusLabel+" - "+Me.queueLabel,te.setAttribute("aria-label",Me.title+". "+Me.detail+" "+Xn(Me)),Me.followupTitle){if(!se){se=document.createElement("span"),se.className="rte-ai-inline-preview-followup";var pn=te||oe||ae||ie||Q||R||d;pn&&pn.nextSibling?t[a].insertBefore(se,pn.nextSibling):t[a].appendChild(se)}se.textContent=Me.followupTitle,se.setAttribute("aria-label",Me.followupTitle+". "+Me.followupDetail)}else se&&se.parentNode&&se.parentNode.removeChild(se)}else te&&te.parentNode&&te.parentNode.removeChild(te),se&&se.parentNode&&se.parentNode.removeChild(se);if(lt){if(!_e){_e=document.createElement("span"),_e.className="rte-ai-inline-preview-undo";var ti=se||te||oe||ae||ie||Q||R||d;ti&&ti.nextSibling?t[a].insertBefore(_e,ti.nextSibling):t[a].appendChild(_e)}_e.textContent=lt.actionLabel,_e.setAttribute("aria-label",Ke)}else _e&&_e.parentNode&&_e.parentNode.removeChild(_e);if(St){if(!ke){ke=document.createElement("span"),ke.className="rte-ai-inline-preview-undo-next";var Gt=_e||oe||ae||ie||Q||R||d;Gt&&Gt.nextSibling?t[a].insertBefore(ke,Gt.nextSibling):t[a].appendChild(ke)}ke.textContent="Then "+St.label,ke.setAttribute("aria-label","Undo after this: "+St.detail)}else ke&&ke.parentNode&&ke.parentNode.removeChild(ke);if(mt&&Tt){if(!Ce){Ce=document.createElement("span"),Ce.className="rte-ai-inline-preview-redo";var qn=ke||_e||oe||ae||ie||Q||R||d;qn&&qn.nextSibling?t[a].insertBefore(Ce,qn.nextSibling):t[a].appendChild(Ce)}Ce.textContent=Tt.actionLabel,Ce.setAttribute("aria-label",tr)}else Ce&&Ce.parentNode&&Ce.parentNode.removeChild(Ce);if(Dt){if(!me){me=document.createElement("span"),me.className="rte-ai-inline-preview-redo-next";var en=Ce||ke||_e||oe||ae||ie||Q||R||d;en&&en.nextSibling?t[a].insertBefore(me,en.nextSibling):t[a].appendChild(me)}me.textContent="Then "+Dt.label,me.setAttribute("aria-label","Redo after this: "+Dt.detail)}else me&&me.parentNode&&me.parentNode.removeChild(me);if(Pe){if(!Re){Re=document.createElement("span"),Re.className="rte-ai-inline-preview-shortcuts";var vn=me||Ce||ke||_e||oe||ae||ie||Q||R||d;vn&&vn.nextSibling?t[a].insertBefore(Re,vn.nextSibling):t[a].appendChild(Re)}Re.textContent=j(l),Re.setAttribute("aria-label","Inline queue preview shortcut")}else if(!Re){Re=document.createElement("span"),Re.className="rte-ai-inline-preview-shortcuts";var ri=me||Ce||ke||_e||oe||ae||ie||Q||R||d;ri&&ri.nextSibling?t[a].insertBefore(Re,ri.nextSibling):t[a].appendChild(Re)}var ur={isPreviewTarget:Pe,sharedUpdateCount:Ee,undoInlineContext:lt,redoInlineContext:Tt,suggestion:l},Br=Wi(ur);Re.id=du(t[a]),Ji(Re,Pe?"preview":"wrapper",ur),fu(t[a],Re,ur),fi(Fe,t[a],Re,"review",ur),fi(ut,t[a],Re,"previous",ur),fi(Ge,t[a],Re,"next",ur),fi(Se,t[a],Re,"accept",ur),fi(nt,t[a],Re,"reject",ur),fi(Je,t[a],Re,"undo",ur),fi(at,t[a],Re,"redo",ur),fi(Ve,t[a],Re,"shared-seen",ur);var kn=t[a].ownerDocument?t[a].ownerDocument.activeElement:null,Ci=kn&&t[a].contains(kn)&&kn.getAttribute&&kn.getAttribute("data-rte-ai-action")||"";Ji(Re,Pe?"preview":Ci||"wrapper",ur),rs(t[a],l),Qo(t[a],l),$o(t[a],bt),Ne=Wo(t[a],Ne,l),de=Zl(t[a],de,l),Re=Jo(t[a],Re),t[a].setAttribute("aria-label",h(l,{isCurrent:!Pe,isPreviewTarget:Pe,queueOpened:xt,glanceLabels:tt?tt.pills.map(function(En){return En.text}):[],glanceDetail:tt?tt.detail:"",compareLabel:"Proposed edit. Current and suggested text.",reasonText:ye,focusLabel:Br,positionLabel:Pt.total&&Pt.index?"Item "+Pt.index+" of "+Pt.total:"",transitionLabel:Me?Me.statusLabel+". "+Me.queueLabel+". "+Xn(Me):"",followupLabel:Me&&Me.followupTitle?Me.followupTitle+". "+Me.followupDetail:"",remoteUpdateCount:Ee,undoLabel:Ke,undoNextLabel:St?"Undo after this: "+St.detail:"",redoLabel:tr,redoNextLabel:Dt?"Redo after this: "+Dt.detail:""}))}else{t[a].classList.remove("is-review-active"),t[a].classList.remove("is-review-preview"),t[a].classList.remove("is-queue-opened"),t[a].setAttribute("role","group"),t[a].removeAttribute("aria-current"),t[a].removeAttribute("aria-keyshortcuts"),t[a].setAttribute("tabindex","-1"),t[a].removeAttribute("title"),t[a].onfocus=null,t[a].onfocusout=null,Kl(t[a]),Qo(t[a],l),$o(t[a],bt),Ne=Wo(t[a],Ne,l),de=Zl(t[a],de,l),t[a].setAttribute("aria-label",h(l,{remoteUpdateCount:Ee,glanceLabels:tt?tt.pills.map(function(En){return En.text}):[],glanceDetail:tt?tt.detail:"",compareLabel:"Proposed edit. Current and suggested text.",reasonText:ye,focusLabel:vt,queueRoleLabel:ze?ze.roleLabel:"",queueRoleDetail:ze?ze.detail:"",transitionLabel:Me?Me.title+". "+Me.statusLabel+". "+Me.queueLabel+". "+Xn(Me):"",followupLabel:Me&&Me.followupTitle?Me.followupTitle+". "+Me.followupDetail:""}));var _n=Wr(s),qr=wi(l,"accept",_n)||{text:"Accept",label:"Accept this AI change"},ni=wi(l,"reject",_n)||{text:"Reject",label:"Reject this AI change"};if(Jn(Fe,"Review",je),ma(ut,!ht,Qe),ma(Ge,!Oe,yt),Me&&/queue state/i.test(Me.previewLabel||"")&&ma(Ge,!0,"No next AI review item in the current queue"),Jn(Se,qr.text,qr.label),Jn(nt,ni.text,ni.label),hi(Fe),hi(ut),hi(Ge),hi(Se),hi(nt),hi(Je),hi(at),hi(Ve),pi(Fe),pi(ut),pi(Ge),pi(Se),pi(nt),pi(Je),pi(at),pi(Ve),Je&&Je.parentNode&&Je.parentNode.removeChild(Je),at&&at.parentNode&&at.parentNode.removeChild(at),Ve&&Ve.parentNode&&Ve.parentNode.removeChild(Ve),Wl(t[a],"recovery",!1),Vo(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee,queueTransitionData:Me}),Ko(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee,queueTransitionData:Me}),Yl(t[a],{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee}),d&&d.parentNode&&d.parentNode.removeChild(d),m&&m.parentNode&&m.parentNode.removeChild(m),Be&&Be.parentNode&&Be.parentNode.removeChild(Be),R&&R.parentNode&&R.parentNode.removeChild(R),Q&&Q.parentNode&&Q.parentNode.removeChild(Q),ie&&ie.parentNode&&ie.parentNode.removeChild(ie),ae=Gl(t[a],ae,Ee,t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-actions"):null),!Pe&&vt){if(!xe){xe=document.createElement("span"),xe.className="rte-ai-inline-preview-focus";var jn=ae||ie||Q||R||d;jn&&jn.nextSibling?t[a].insertBefore(xe,jn.nextSibling):t[a].appendChild(xe)}xe.textContent="Focus "+vt,xe.setAttribute("aria-label","Review opens on "+vt)}else xe&&xe.parentNode&&(xe.parentNode.removeChild(xe),xe=null);if(!Pe&&tt&&tt.pills&&tt.pills.length){if(!ce){ce=document.createElement("span"),ce.className="rte-ai-inline-preview-glance";var Un=ie||R||d;Un&&Un.nextSibling?t[a].insertBefore(ce,Un.nextSibling):t[a].appendChild(ce)}for(;ce.firstChild;)ce.removeChild(ce.firstChild);for(var zr=0;zr<tt.pills.length;zr++){var vr=tt.pills[zr];!vr||!vr.text||vr.kind==="scope"||o(ce,"span","","rte-ai-review-item-glance-pill is-"+vr.kind,vr.text)}!ce.childNodes.length&&ce.parentNode&&(ce.parentNode.removeChild(ce),ce=null)}else ce&&ce.parentNode&&(ce.parentNode.removeChild(ce),ce=null);if(!Pe&&ze&&ze.role!=="current"){if(!oe){oe=document.createElement("span"),oe.className="rte-ai-inline-preview-queue";var tn=xe||ae||ce||ie||Q||R||d;tn&&tn.nextSibling?t[a].insertBefore(oe,tn.nextSibling):t[a].appendChild(oe)}oe.textContent=ze.roleLabel+" - "+ze.queueLabel,oe.setAttribute("aria-label",ze.detail)}else oe&&oe.parentNode&&(oe.parentNode.removeChild(oe),oe=null);if(!Pe&&Me){if(!te){te=document.createElement("span"),te.className="rte-ai-inline-preview-transition";var ii=oe||xe||ae||ce||ie||Q||R||d;ii&&ii.nextSibling?t[a].insertBefore(te,ii.nextSibling):t[a].appendChild(te)}if(te.textContent=Me.statusLabel,te.setAttribute("aria-label",Me.title+". "+Me.detail+" "+Xn(Me)),Me.followupTitle){if(!se){se=document.createElement("span"),se.className="rte-ai-inline-preview-followup";var hn=te||oe||xe||ae||ie||Q||R||d;hn&&hn.nextSibling?t[a].insertBefore(se,hn.nextSibling):t[a].appendChild(se)}se.textContent=Me.followupTitle,se.setAttribute("aria-label",Me.followupTitle+". "+Me.followupDetail)}else se&&se.parentNode&&(se.parentNode.removeChild(se),se=null)}else te&&te.parentNode&&(te.parentNode.removeChild(te),te=null),se&&se.parentNode&&(se.parentNode.removeChild(se),se=null);_e&&_e.parentNode&&_e.parentNode.removeChild(_e),ke&&ke.parentNode&&ke.parentNode.removeChild(ke),Ce&&Ce.parentNode&&Ce.parentNode.removeChild(Ce),me&&me.parentNode&&me.parentNode.removeChild(me),Re&&Re.parentNode&&Re.parentNode.removeChild(Re)}i.__aiActiveSuggestionId!==s&&!Pe&&((!Re||!Re.parentNode)&&(Re=document.createElement("span"),Re.className="rte-ai-inline-preview-shortcuts",t[a].appendChild(Re)),Ji(Re,"wrapper",{suggestion:l,isPreviewTarget:Pe,sharedUpdateCount:Ee}),Re=Jo(t[a],Re));var hr=!0,Sn=[R,ie,oe,te,se,ce,xe,ae];Pe&&Sn.push(d,m,Be);for(var Bn=0;Bn<Sn.length;Bn++)Sn[Bn]&&Sn[Bn].style&&(Sn[Bn].style.display=hr?"none":"");var Tn=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-compare"):null,An=t[a].querySelector?t[a].querySelector(".rte-ai-inline-preview-actions"):null;t[a].style&&(t[a].style.display=hr?"flex":"",t[a].style.flexDirection=hr?"column":"",t[a].style.cursor=Pe?"pointer":""),Tn&&Tn.style&&(Tn.style.order=hr?"1":""),An&&An.style&&(An.style.order=hr?"2":"",An.style.display=Pe?"none":"")}return!0}function Jn(e,t,r){return e?(typeof t=="string"&&t.length&&(e.textContent=t),r&&(e.setAttribute("aria-label",r),e.title=r),!0):!1}function ou(e,t){if(t=t||{},t.isPreviewTarget)return"Enter Space";switch(e){case"previous":return"Enter Space K ArrowLeft";case"next":return"Enter Space J ArrowRight";case"accept":return"Enter Space A";case"reject":return"Enter Space R";case"undo":return t.undoInlineContext?"Enter Space U":"Enter Space";case"redo":return t.redoInlineContext?"Enter Space Shift+U":"Enter Space";case"shared-seen":return t.sharedUpdateCount?"Enter Space G":"Enter Space";default:return"Enter Space"}}function lu(e,t,r){r=r||{};var n=t||"";if(!n)return n;if(n=n.replace(/\.$/,""),r.isPreviewTarget)return n+". Enter or Space activates this action.";var a=Jr(r.suggestion);switch(n+=". Enter or Space activates this action.",e){case"previous":n+=" K or Left moves to the previous review item.";break;case"next":n+=" J or Right moves to the next review item.";break;case"accept":n+=" A uses "+a.acceptLabel+".";break;case"reject":n+=" R uses "+a.rejectLabel+".";break;case"undo":r.undoInlineContext&&(n+=" U "+r.undoInlineContext.shortcutLabel+".");break;case"redo":r.redoInlineContext&&(n+=" Shift+U "+r.redoInlineContext.shortcutLabel+".");break;case"shared-seen":r.sharedUpdateCount&&(n+=" G clears shared.");break}return n}function Vl(e){if(e=e||{},e.isPreviewTarget)return j(e.suggestion);var t=Jr(e.suggestion),r=Wi(e),n="Enter focus "+r+" - A "+t.acceptHint+" - R "+t.rejectHint+" - J/K move - Home/End jump";return e.sharedUpdateCount&&(n+=" - G clear shared"),e.undoInlineContext&&(n+=" - U "+e.undoInlineContext.shortcutLabel),e.redoInlineContext&&(n+=" - Shift+U "+e.redoInlineContext.shortcutLabel),n}function su(e){if(e=e||{},e.isPreviewTarget)return Y(e.suggestion);var t=Jr(e.suggestion),r=Wi(e),n="Shortcuts: J or Right next, K or Left previous, Home/End jump, Enter focus "+r+", A "+t.acceptHint+", R "+t.rejectHint;return e.sharedUpdateCount&&(n+=", G clear shared"),e.undoInlineContext&&(n+=", U "+e.undoInlineContext.shortcutLabel),e.redoInlineContext&&(n+=", Shift+U "+e.redoInlineContext.shortcutLabel),n}function Bo(e){if(e=e||{},e.isPreviewTarget)return"review";var t=e.suggestion;if(!t)return"";var r=e.preferredAction||Ie();if((r==="accept"||r==="reject")&&t.status==="pending")return r;if(r==="undo"&&e.undoInlineContext)return"undo";if(r==="redo"&&e.redoInlineContext)return"redo";if(r==="review")return"review";if(r==="shared-seen"&&e.sharedUpdateCount)return"shared-seen";var n=e.defaultActionName||Uo(t);return n==="redo"&&e.redoInlineContext?"redo":n==="accept"?"accept":"review"}function cu(e){switch(e){case"accept":case"reject":return"decision";case"undo":case"redo":case"shared-seen":return"recovery";case"review":return"review";default:return""}}function Wi(e){e=e||{};var t=e.suggestion;if(!t)return"Review";if(e.isPreviewTarget)return"Open queue";var r=Jr(t),n=Bo(e);return n==="accept"?r.acceptLabel:n==="reject"?r.rejectLabel:n==="undo"&&e.undoInlineContext?e.undoInlineContext.actionLabel||"Undo":n==="redo"&&e.redoInlineContext?e.redoInlineContext.actionLabel||"Redo":n==="review"?"Review":n==="shared-seen"&&e.sharedUpdateCount?"Clear shared":"Review"}function uu(e,t){if(t=t||{},t.isPreviewTarget)return j(t.suggestion);var r="",n=Jr(t.suggestion),a=n.acceptLabel,s=n.rejectLabel,l=t.reviewFocusLabel||qt(t.suggestion,Ie())||qt(t.suggestion,"");switch(e){case"review":r="Enter focus "+(l||"Review")+" - J/K move - Home/End jump - A "+n.acceptHint+" - R "+n.rejectHint;break;case"previous":r="Enter previous - J/K move - Home/End jump - A "+n.acceptHint+" - R "+n.rejectHint;break;case"next":r="Enter next - J/K move - Home/End jump - A "+n.acceptHint+" - R "+n.rejectHint;break;case"accept":r="Enter "+a+" - R "+n.rejectHint+" - J/K move - Home/End jump";break;case"reject":r="Enter "+s+" - A "+n.acceptHint+" - J/K move - Home/End jump";break;case"undo":r="Enter undo - A "+n.acceptHint+" - R "+n.rejectHint+" - J/K move - Home/End jump";break;case"redo":r="Enter redo - A "+n.acceptHint+" - R "+n.rejectHint+" - J/K move - Home/End jump";break;case"shared-seen":r="Enter clear shared - A "+n.acceptHint+" - R "+n.rejectHint+" - J/K move - Home/End jump";break;default:return Vl(t)}return t.undoInlineContext&&(r+=" - U "+t.undoInlineContext.shortcutLabel),t.sharedUpdateCount&&e!=="shared-seen"&&(r+=" - G clear shared"),t.redoInlineContext&&(r+=" - Shift+U "+t.redoInlineContext.shortcutLabel),r}function du(e){return e?(e.__rteAiInlineShortcutDisplayId||(e.__rteAiInlineShortcutDisplayId="rte-ai-inline-shortcuts-"+String(Math.floor(Math.random()*1e9))),e.__rteAiInlineShortcutDisplayId):""}function no(e,t){if(!e||!e.setAttribute||!t)return!1;var r=t.id||"";return r?(e.setAttribute("aria-describedby",r),!0):!1}function Kl(e){return!e||!e.removeAttribute?!1:(e.removeAttribute("aria-describedby"),!0)}function zo(e,t,r){if(!e)return!1;for(;e.firstChild;)e.removeChild(e.firstChild);if(!t&&!r)return!0;var n=e.ownerDocument||document;if(t){var a=n.createElement("span");a.className="rte-ai-inline-preview-shortcuts-title",a.innerText=t,e.appendChild(a)}if(!r)return!0;var s=n.createElement("span");s.className="rte-ai-inline-preview-shortcuts-body",e.appendChild(s);for(var l=String(r||"").split(/(\s+·\s+|\s+-\s+)/),d=0;d<l.length;d++){var m=l[d];if(m){if(/^\s+[·-]\s+$/.test(m)){var R=n.createElement("span");R.className="rte-ai-inline-preview-shortcuts-separator",R.innerText=m.replace(/^\s+|\s+$/g,""),s.appendChild(R);continue}var Q=n.createElement("span");Q.className="rte-ai-inline-preview-shortcuts-segment";var ie=m.replace(/^\s+|\s+$/g,""),ae=ie.indexOf(" ");if(ae>0){var oe=n.createElement("span");oe.className="rte-ai-inline-preview-shortcuts-key",oe.innerText=ie.substring(0,ae),Q.appendChild(oe),Q.appendChild(n.createTextNode(" "));var te=n.createElement("span");te.className="rte-ai-inline-preview-shortcuts-copy",te.innerText=ie.substring(ae+1),Q.appendChild(te)}else Q.innerText=ie;s.appendChild(Q)}}return!0}function Ji(e,t,r){return e?(r=r||{},e.classList.remove("is-action"),e.classList.toggle("is-preview",t==="preview"),t==="preview"?(zo(e,"Queue shortcut",j(r.suggestion)),e.setAttribute("aria-label","Inline queue preview shortcut"),!0):t&&t!=="wrapper"?(e.classList.add("is-action"),zo(e,"Keyboard guide",uu(t,r)),e.setAttribute("aria-label","Inline AI review action shortcuts"),!0):(zo(e,"Keyboard guide",Vl(r)),e.setAttribute("aria-label","Inline AI review shortcuts"),!0)):!1}function fu(e,t,r){return e?(no(e,t),e.onfocus=function(){no(e,t),Ji(t,r&&r.isPreviewTarget?"preview":"wrapper",r)},e.onfocusout=function(){var n=e,a=t,s=r||{};window.setTimeout(function(){var l=n.ownerDocument||document;n.contains(l.activeElement)||Ji(a,s.isPreviewTarget?"preview":"wrapper",s)},0)},!0):!1}function fi(e,t,r,n,a){return e?(no(e,r),e.onfocus=function(){no(e,r),Ji(r,n,a)},!0):!1}function pi(e){return e?(e.onfocus=null,Kl(e),!0):!1}function vi(e,t,r){if(!e)return!1;var n=e.getAttribute&&e.getAttribute("data-rte-ai-action")||"";return e.setAttribute("aria-keyshortcuts",ou(n,r)),e.title=lu(n,t,r),!0}function hi(e){return e?(e.removeAttribute("aria-keyshortcuts"),!0):!1}function ma(e,t,r){return e?(e.disabled=!!t,e.setAttribute("aria-disabled",t?"true":"false"),r&&(e.setAttribute("aria-label",r),e.title=r),t?e.classList.add("is-disabled"):e.classList.remove("is-disabled"),!0):!1}function Zt(e,t){t=t||{},i.__aiActiveSuggestionId=e||null,i.__aiPreviewState=e?pt(e):null,t.preserveEmptyPreview?i.__aiReviewEmptyPreviewSuggestionId=i.__aiActiveSuggestionId:i.__aiReviewEmptyPreviewSuggestionId=null,Ki()}function gi(){return i.__aiActiveSuggestionId?pt(i.__aiActiveSuggestionId):i.__aiPreviewState||null}function ba(){for(var e=Ft(),t=!1,r=!1,n=0;n<e.length;n++)e[n].status==="pending"&&!In(e[n].id)&&(e[n].status="stale",e[n].decidedAt=e[n].decidedAt||new Date().getTime(),Fi("suggestion-stale",e[n]),r=!0),i.__aiActiveSuggestionId&&e[n].id===i.__aiActiveSuggestionId&&e[n].status==="pending"&&(t=!0);t||Zt(null),r&&Sr()}function yn(){ba()}function er(e,t){var r=u(e),n=t||90;return r.length<=n?r:r.substring(0,Math.max(0,n-3)).replace(/\s+\S*$/,"")+"..."}function ya(e){switch(e){case"accepted":return"Accepted";case"rejected":return"Rejected";case"stale":return"Needs refresh";default:return"Pending"}}function io(e,t,r){var n=!r&&e==="recovery"?' style="display:none"':"";return'<span class="rte-ai-inline-preview-action-group is-'+e+'" data-rte-ai-inline-action-group="'+e+'" data-rte-ai-inline-action-group-label="'+et(t)+'" data-rte-ai-inline-action-group-current="false"'+n+' role="group" aria-label="'+et(t)+' actions"><span class="rte-ai-inline-preview-action-group-header"><span class="rte-ai-inline-preview-action-group-title">'+et(t)+'</span><span class="rte-ai-inline-preview-action-group-badge" style="display:none"></span></span><span class="rte-ai-inline-preview-action-group-detail"></span><span class="rte-ai-inline-preview-action-group-body">'+(r||"")+"</span></span>"}function Fo(e,t){if(!e||!e.querySelector)return null;if(t){var r=e.querySelector(".rte-ai-inline-preview-action-group.is-"+t+" .rte-ai-inline-preview-action-group-body");if(r)return r}return e.querySelector(".rte-ai-inline-preview-actions")}function Wl(e,t,r){if(!(!e||!e.querySelector||!t)){var n=e.querySelector(".rte-ai-inline-preview-action-group.is-"+t);n&&(n.style.display=r?"":"none")}}function Jl(e){if(e=e||{},e.isPreviewTarget)return"review";var t=e.suggestion;return t?cu(Bo(e)):""}function pu(e){switch(e){case"review":return"Open";case"move":return"Move";case"decision":return"Decide";case"recovery":return"Recover";default:return""}}function Ql(e,t){var r=["review","move","decision","recovery"],n=r.indexOf(e);if(n===-1)return r.length+1;var a=r.indexOf(t);if(a===-1)return n+1;if(e===t)return 1;for(var s=2,l=0;l<r.length;l++)if(r[l]!==t){if(r[l]===e)return s;s++}return n+1}function $l(e,t,r){var n;switch(e){case"review":n=["review"];break;case"move":n=["previous","next"];break;case"decision":n=["accept","reject"];break;case"recovery":n=["shared-seen","undo","redo"];break;default:n=[];break}var a=n.indexOf(t);if(a===-1)return n.length+1;if(!r)return a+1;var s=n.indexOf(r);if(s===-1)return a+1;if(t===r)return 1;for(var l=2,d=0;d<n.length;d++)if(n[d]!==r){if(n[d]===t)return l;l++}return a+1}function vu(e,t){if(t=t||{},t.isPreviewTarget)return e==="review"?"Open the next review queue from this handoff surface.":"";var r=t.suggestion;if(!r)return"";var n=t.queueTransitionData||null;if(!n&&r){var a=Wr(r.id);n=mi(Xt(a),i.__aiActiveSuggestionId,r)}switch(e){case"review":return"Reopen this suggestion in the current review lane.";case"move":return"Jump earlier or later in this queue before deciding.";case"decision":return n&&n.detail?n.detail:"Apply or dismiss this AI change.";case"recovery":return t.redoInlineContext&&t.redoInlineSummaryText?t.redoInlineSummaryText:t.undoInlineContext&&t.undoInlineSummaryText?t.undoInlineSummaryText:t.sharedUpdateCount?"Clear collaboration updates and keep reviewing this suggestion.":"";default:return""}}function Xl(e){if(e=e||{},e.isPreviewTarget)return null;var t=e.suggestion;if(!t)return null;var r=Jl(e),n=Wi(e),a=pu(r);if(!r||!n||!a)return null;var s=e.queueTransitionData||null;if(!s&&t.id){var l=Wr(t.id),d=Xt(l);s=mi(d,i.__aiActiveSuggestionId,t)}var m="";return r==="decision"&&s?m=s.statusLabel+". "+s.detail:r==="recovery"?e.preferredAction==="undo"&&e.undoInlineSummaryText?m=e.undoInlineSummaryText:e.preferredAction==="redo"&&e.redoInlineSummaryText?m=e.redoInlineSummaryText:e.sharedUpdateCount?m="Clear the shared update notice and continue reviewing this suggestion.":m="Recover from a recent AI review action without leaving this suggestion.":r==="review"?m="Open this suggestion in review and keep the current inline lane ready.":r==="move"&&(m="Move through the current queue before choosing a decision."),{title:"Action handoff",pills:[a+" lane","Enter focuses "+n],detail:m}}function Go(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.pills&&e.pills.length)for(var r=0;r<e.pills.length;r++)e.pills[r]&&t.push(e.pills[r]);return e.detail&&t.push(e.detail),t.join(". ")}function hu(e){var t=Xl({suggestion:e});if(!t)return"";var r='<span class="rte-ai-inline-preview-action-summary" aria-label="'+et(Go(t))+'"><span class="rte-ai-inline-preview-action-summary-title">'+et(t.title)+"</span>";if(t.pills&&t.pills.length){r+='<span class="rte-ai-inline-preview-action-summary-pills">';for(var n=0;n<t.pills.length;n++)t.pills[n]&&(r+='<span class="rte-ai-inline-preview-action-summary-pill">'+et(t.pills[n])+"</span>");r+="</span>"}return t.detail&&(r+='<span class="rte-ai-inline-preview-action-summary-detail">'+et(t.detail)+"</span>"),r+="</span>",r}function Vo(e,t){if(!e||!e.querySelector)return null;var r=e.querySelector(".rte-ai-inline-preview-actions"),n=Xl(t),a=r&&r.querySelector?r.querySelector(".rte-ai-inline-preview-action-summary"):null;if(!r||!n)return a&&a.parentNode&&a.parentNode.removeChild(a),r&&r.setAttribute("aria-label","AI suggestion actions"),null;var s=r.ownerDocument||document;for(a?r.firstChild!==a&&r.insertBefore(a,r.firstChild):(a=s.createElement("span"),a.className="rte-ai-inline-preview-action-summary",r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a));a.firstChild;)a.removeChild(a.firstChild);if(a.setAttribute("aria-label",Go(n)),o(a,"span","","rte-ai-inline-preview-action-summary-title",n.title),n.pills&&n.pills.length)for(var l=o(a,"span","","rte-ai-inline-preview-action-summary-pills"),d=0;d<n.pills.length;d++)n.pills[d]&&o(l,"span","","rte-ai-inline-preview-action-summary-pill",n.pills[d]);return n.detail&&o(a,"span","","rte-ai-inline-preview-action-summary-detail",n.detail),r.setAttribute("aria-label","AI suggestion actions. "+Go(n)),a}function Ko(e,t){if(!e||!e.querySelectorAll)return!1;t=t||{};for(var r=e.ownerDocument||document,n=e.querySelector?e.querySelector(".rte-ai-inline-preview-actions"):null,a=Jl(t),s=t.isPreviewTarget?"Open queue":Wi(t),l=s?"Enter: "+s:"",d=e.querySelectorAll(".rte-ai-inline-preview-action-group"),m=[],R=0;R<d.length;R++){var Q=d[R];if(Q){m.push(Q);var ie=Q.getAttribute("data-rte-ai-inline-action-group")||"",ae=Q.getAttribute("data-rte-ai-inline-action-group-label")||"",oe=Q.querySelector?Q.querySelector(".rte-ai-inline-preview-action-group-header"):null;oe||(oe=r.createElement("span"),oe.className="rte-ai-inline-preview-action-group-header",Q.firstChild?Q.insertBefore(oe,Q.firstChild):Q.appendChild(oe));var te=oe.querySelector?oe.querySelector(".rte-ai-inline-preview-action-group-title"):null;te||(te=r.createElement("span"),te.className="rte-ai-inline-preview-action-group-title",oe.appendChild(te)),te.textContent=ae;var se=oe.querySelector?oe.querySelector(".rte-ai-inline-preview-action-group-badge"):null;se||(se=r.createElement("span"),se.className="rte-ai-inline-preview-action-group-badge",oe.appendChild(se));var ce=Q.querySelector?Q.querySelector(".rte-ai-inline-preview-action-group-detail"):null;if(!ce){ce=r.createElement("span"),ce.className="rte-ai-inline-preview-action-group-detail";var Ne=Q.querySelector?Q.querySelector(".rte-ai-inline-preview-action-group-body"):null;Ne?Q.insertBefore(ce,Ne):Q.appendChild(ce)}var de=!!l&&!!a&&a===ie,_e=vu(ie,t);Q.style.removeProperty("order"),Q.setAttribute("data-rte-ai-inline-action-group-current",de?"true":"false"),Q.classList.toggle("is-current-lane",de),de?(se.textContent=l,se.style.display="",se.setAttribute("aria-label","Current action lane. "+l)):(se.textContent="",se.style.display="none",se.removeAttribute("aria-label")),_e?(ce.textContent=_e,ce.style.display=""):(ce.textContent="",ce.style.display="none");var ke=ae?ae+" actions":"AI suggestion actions";_e&&(ke+=". "+_e),de&&l&&(ke+=". Current lane. "+l),Q.setAttribute("aria-label",ke)}}if(n&&m.length){m.sort(function(me,Re){var Be=me.getAttribute("data-rte-ai-inline-action-group")||"",xe=Re.getAttribute("data-rte-ai-inline-action-group")||"";return Ql(Be,a)-Ql(xe,a)});for(var Ce=0;Ce<m.length;Ce++)n.appendChild(m[Ce])}return!0}function Yl(e,t){if(!e||!e.querySelectorAll)return!1;t=t||{};for(var r=Bo(t),n={},a=e.querySelectorAll(".rte-ai-inline-preview-button[data-rte-ai-action]"),s=0;s<a.length;s++){var l=a[s];if(!(!l||!l.getAttribute)){var d=l.getAttribute("data-rte-ai-action")||"",m=l.closest?l.closest(".rte-ai-inline-preview-action-group"):null,R=m&&m.getAttribute&&m.getAttribute("data-rte-ai-inline-action-group")||"";R&&(n[R]||(n[R]=[]),n[R].push(l));var Q=!!r&&d===r&&!l.disabled,ie=(l.getAttribute("aria-label")||l.textContent||"").replace(/\.\s*Current Enter target\.$/i,""),ae=(l.getAttribute("title")||ie).replace(/\.\s*Current Enter target\.$/i,"");if(l.setAttribute("data-rte-ai-enter-target",Q?"true":"false"),l.classList.toggle("is-enter-target",Q),Q){var oe=d==="accept"?"A":d==="reject"?"R":"";l.setAttribute("aria-keyshortcuts",oe?"Enter Space "+oe:"Enter Space"),l.setAttribute("data-rte-ai-enter-target-label","Enter"),ie&&!/current enter target/i.test(ie)&&l.setAttribute("aria-label",ie+". Current Enter target."),ae&&!/enter or space activates this action/i.test(ae)&&(ae+=". Enter or Space activates this action",oe&&(ae+=". "+oe+" uses "+(l.textContent||d)+".")),ae&&!/current enter target/i.test(ae)&&(l.title=ae+". Current Enter target.")}else l.removeAttribute("data-rte-ai-enter-target-label"),ie&&l.setAttribute("aria-label",ie),ae&&(l.title=ae)}}for(var R in n)if(n.hasOwnProperty(R)){var te=Fo(e,R),se=n[R];if(!(!te||!se||!se.length)){se.sort(function(de,_e){var ke=de.getAttribute("data-rte-ai-action")||"",Ce=_e.getAttribute("data-rte-ai-action")||"";return $l(R,ke,r)-$l(R,Ce,r)});for(var ce=0;ce<se.length;ce++)te.appendChild(se[ce])}}return!0}function Wo(e,t,r){if(!e)return null;var n=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null,a=bi(r);if(!n||!a)return t&&t.parentNode&&t.parentNode.removeChild(t),null;if(!t||t.parentNode!==n){t&&t.parentNode&&t.parentNode.removeChild(t),t=document.createElement("span"),t.className="rte-ai-inline-preview-reason";var s=n.querySelector?n.querySelector(".rte-ai-inline-preview-old"):null,l=!s&&n.querySelector?n.querySelector(".rte-ai-inline-preview-new"):null,d=s||l;d?n.insertBefore(t,d):n.appendChild(t)}var m=t.querySelector?t.querySelector(".rte-ai-inline-preview-reason-label"):null,R=t.querySelector?t.querySelector(".rte-ai-inline-preview-reason-copy"):null;if(!m||!R){for(;t.firstChild;)t.removeChild(t.firstChild);m=null,R=null}return m||(m=document.createElement("span"),m.className="rte-ai-inline-preview-reason-label",t.appendChild(m)),m.textContent="Why",R||(R=document.createElement("span"),R.className="rte-ai-inline-preview-reason-copy",t.appendChild(R)),R.textContent=a,t.setAttribute("aria-label","Why this suggestion: "+a),t.title=a,t}function Zl(e,t,r){if(!e)return null;var n=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null,a=is(r);if(!n||!a)return t&&t.parentNode&&t.parentNode.removeChild(t),null;for((!t||t.parentNode!==n)&&(t&&t.parentNode&&t.parentNode.removeChild(t),t=document.createElement("span"),t.className="rte-ai-inline-preview-plan",n.appendChild(t));t.firstChild;)t.removeChild(t.firstChild);o(t,"span","","rte-ai-inline-preview-plan-title",a.title);for(var s=o(t,"span","","rte-ai-inline-preview-plan-items"),l=0;l<a.items.length;l++)a.items[l]&&o(s,"span","","rte-ai-inline-preview-plan-item",a.items[l]);if(a.detail&&o(t,"span","","rte-ai-inline-preview-plan-detail",a.detail),gu(t,a),a.followupTitle||a.followupDetail){var d=o(t,"span","","rte-ai-inline-preview-plan-followup");a.followupTitle&&o(d,"span","","rte-ai-inline-preview-plan-followup-title",a.followupTitle),a.followupDetail&&o(d,"span","","rte-ai-inline-preview-plan-followup-detail",a.followupDetail)}return t}function Jo(e,t){if(!e||!t)return t;var r=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null;if(!r)return t;var n=r.querySelector?r.querySelector(".rte-ai-inline-preview-plan"):null;return n&&n.parentNode===r?(n.nextSibling!==t&&(n.nextSibling?r.insertBefore(t,n.nextSibling):r.appendChild(t)),t):(r.lastChild!==t&&r.appendChild(t),t)}function Qo(e,t){if(!e)return null;var r=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null;if(!r)return null;var n=ns(t),a=r.querySelector?r.querySelector(".rte-ai-inline-preview-compare-meta"):null;if(!n)return a&&a.parentNode&&a.parentNode.removeChild(a),null;if(!a){a=document.createElement("span"),a.className="rte-ai-inline-preview-compare-meta";var s=r.querySelector?r.querySelector(".rte-ai-inline-preview-compare-header"):null;s&&s.nextSibling?r.insertBefore(a,s.nextSibling):r.appendChild(a)}for(;a.firstChild;)a.removeChild(a.firstChild);return o(a,"span","","rte-ai-inline-preview-compare-pill is-status",n.statusLabel),n.openedLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-opened",n.openedLabel),n.remoteLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-remote",n.remoteLabel),n.entryLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-entry",n.entryLabel),n.queueRoleLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-queue",n.queueRoleLabel),n.queueLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-position",n.queueLabel),n.typeLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-type",n.typeLabel),n.languageLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-language",n.languageLabel),o(a,"span","","rte-ai-inline-preview-compare-pill is-scope",n.scopeLabel),o(a,"span","","rte-ai-inline-preview-compare-pill is-steps",n.stepLabel),n.targetLabel&&o(a,"span","","rte-ai-inline-preview-compare-pill is-target",n.targetLabel),a}function wa(e){var t=e&&e.pills?e:$i(e);if(!t)return null;var r=[];if(t.pills&&t.pills.length)for(var n=0;n<t.pills.length;n++){var a=t.pills[n];!a||!a.text||a.kind==="scope"||r.push(a)}return!r.length&&!t.detail?null:{title:t.title||"Change at a glance",pills:r,detail:t.detail||""}}function $o(e,t){if(!e)return null;var r=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null,n=wa(t),a=r&&r.querySelector?r.querySelector(".rte-ai-inline-preview-compare-glance"):null;if(!r||!n)return a&&a.parentNode&&a.parentNode.removeChild(a),null;if(!a){a=document.createElement("span"),a.className="rte-ai-inline-preview-compare-glance";var s=r.querySelector?r.querySelector(".rte-ai-inline-preview-old"):null;s?r.insertBefore(a,s):r.appendChild(a)}for(;a.firstChild;)a.removeChild(a.firstChild);if(o(a,"span","","rte-ai-inline-preview-compare-glance-title",n.title),n.pills&&n.pills.length)for(var l=o(a,"span","","rte-ai-inline-preview-compare-glance-pills"),d=0;d<n.pills.length;d++){var m=n.pills[d];!m||!m.text||o(l,"span","","rte-ai-review-item-glance-pill is-"+(m.kind||"other"),m.text)}return n.detail&&o(a,"span","","rte-ai-inline-preview-compare-glance-detail",n.detail),a}function es(e,t,r,n){var a=e||"span";return"<"+a+' class="'+t+'" aria-label="'+et(r)+' text"><span class="rte-ai-inline-preview-compare-label">'+et(r)+"</span><"+a+' class="rte-ai-inline-preview-compare-text">'+n+"</"+a+"></"+a+">"}function ts(e){var t=!!(e&&e.id&&i.__aiReviewEmptyPreviewSuggestionId===e.id);return t?{title:"Queue handoff",detail:"Open the next review queue"}:{title:"Proposed edit",detail:"Current and suggested text"}}function rs(e,t){if(!e)return null;var r=e.querySelector?e.querySelector(".rte-ai-inline-preview-compare"):null;if(!r)return null;var n=ts(t),a=r.querySelector?r.querySelector(".rte-ai-inline-preview-compare-header"):null;a||(a=document.createElement("span"),a.className="rte-ai-inline-preview-compare-header",r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a));var s=a.querySelector?a.querySelector(".rte-ai-inline-preview-compare-title"):null,l=a.querySelector?a.querySelector(".rte-ai-inline-preview-compare-detail"):null;return s||(s=document.createElement("span"),s.className="rte-ai-inline-preview-compare-title",a.appendChild(s)),l||(l=document.createElement("span"),l.className="rte-ai-inline-preview-compare-detail",a.appendChild(l)),s.textContent=n.title,l.textContent=n.detail,r.setAttribute("aria-label",n.title+". "+n.detail),a}function ns(e){if(!e)return null;var t=!!(e.id&&i.__aiReviewEmptyPreviewSuggestionId===e.id),r=e.id?Wr(e.id):"",n=e.id?Xt(r):[],a=e.id?_a(n,i.__aiActiveSuggestionId,e):null,s=e.id?Yr(e.id):0,l=t?qt(e,Ie())||qt(e,""):Wi({suggestion:e}),d=e.suggestionType&&Z(e.suggestionType)!=="other"?M(e.suggestionType):"",m=e.language?T(e.language):"";return{statusLabel:t?"Queue handoff":"Ready to review",openedLabel:i.__aiRecentlyOpenedQueueSuggestionId===e.id?"Queue opened":"",remoteLabel:s>1?s+" shared updates":s?"Shared update":"",queueRoleLabel:t?"Next queue":a?a.roleLabel:"",queueLabel:!t&&a?a.queueLabel:"",typeLabel:d,languageLabel:m,scopeLabel:(X(e)||"Selection")+" draft",stepLabel:"1 step",entryLabel:t?G(e):"",targetLabel:l?"Focus "+l:""}}function is(e){if(!e||!e.id)return null;var t=Wr(e.id),r=Xt(t),n=mi(r,i.__aiActiveSuggestionId,e);if(!n)return null;var a=[n.statusLabel,n.queueLabel];return n.followupStatusLabel&&a.push(n.followupStatusLabel),{title:"What happens next",items:a,detail:n.detail||"",previewLabel:n.previewLabel||"",previewText:n.previewText||"",preview:Xn(n),followupTitle:n.followupTitle||"",followupDetail:n.followupDetail||""}}function gu(e,t){if(!e||!t||!t.preview&&!t.previewLabel&&!t.previewText)return null;var r=o(e,"span","","rte-ai-inline-preview-plan-preview");return t.previewLabel&&o(r,"span","","rte-ai-inline-preview-plan-preview-label",t.previewLabel+":"),t.previewText&&o(r,"span","","rte-ai-inline-preview-plan-preview-text",t.previewText),!t.previewLabel&&!t.previewText&&t.preview&&(r.textContent=t.preview),r}function mu(e){if(!e||!e.preview&&!e.previewLabel&&!e.previewText)return"";var t='<span class="rte-ai-inline-preview-plan-preview">';return e.previewLabel&&(t+='<span class="rte-ai-inline-preview-plan-preview-label">'+et(e.previewLabel)+":</span>"),e.previewText&&(t+='<span class="rte-ai-inline-preview-plan-preview-text">'+et(e.previewText)+"</span>"),!e.previewLabel&&!e.previewText&&e.preview&&(t+=et(e.preview)),t+="</span>",t}function bu(e,t,r,n){var a=e||"span",s=ts(n),l=ns(n),d=wa(n),m=bi(n),R=is(n),Q=l?'<span class="rte-ai-inline-preview-compare-meta"><span class="rte-ai-inline-preview-compare-pill is-status">'+et(l.statusLabel)+"</span>"+(l.openedLabel?'<span class="rte-ai-inline-preview-compare-pill is-opened">'+et(l.openedLabel)+"</span>":"")+(l.remoteLabel?'<span class="rte-ai-inline-preview-compare-pill is-remote">'+et(l.remoteLabel)+"</span>":"")+(l.entryLabel?'<span class="rte-ai-inline-preview-compare-pill is-entry">'+et(l.entryLabel)+"</span>":"")+(l.queueRoleLabel?'<span class="rte-ai-inline-preview-compare-pill is-queue">'+et(l.queueRoleLabel)+"</span>":"")+(l.queueLabel?'<span class="rte-ai-inline-preview-compare-pill is-position">'+et(l.queueLabel)+"</span>":"")+(l.typeLabel?'<span class="rte-ai-inline-preview-compare-pill is-type">'+et(l.typeLabel)+"</span>":"")+(l.languageLabel?'<span class="rte-ai-inline-preview-compare-pill is-language">'+et(l.languageLabel)+"</span>":"")+'<span class="rte-ai-inline-preview-compare-pill is-scope">'+et(l.scopeLabel)+'</span><span class="rte-ai-inline-preview-compare-pill is-steps">'+et(l.stepLabel)+"</span>"+(l.targetLabel?'<span class="rte-ai-inline-preview-compare-pill is-target">'+et(l.targetLabel)+"</span>":"")+"</span>":"",ie="";if(d){if(ie='<span class="rte-ai-inline-preview-compare-glance"><span class="rte-ai-inline-preview-compare-glance-title">'+et(d.title)+"</span>",d.pills&&d.pills.length){ie+='<span class="rte-ai-inline-preview-compare-glance-pills">';for(var ae=0;ae<d.pills.length;ae++){var oe=d.pills[ae];!oe||!oe.text||(ie+='<span class="rte-ai-review-item-glance-pill is-'+et(oe.kind||"other")+'">'+et(oe.text)+"</span>")}ie+="</span>"}d.detail&&(ie+='<span class="rte-ai-inline-preview-compare-glance-detail">'+et(d.detail)+"</span>"),ie+="</span>"}var te=m?'<span class="rte-ai-inline-preview-reason" aria-label="Why this suggestion: '+et(m)+'" title="'+et(m)+'"><span class="rte-ai-inline-preview-reason-label">Why</span><span class="rte-ai-inline-preview-reason-copy">'+et(m)+"</span></span>":"",se="";if(R){se='<span class="rte-ai-inline-preview-plan"><span class="rte-ai-inline-preview-plan-title">'+et(R.title)+'</span><span class="rte-ai-inline-preview-plan-items">';for(var ce=0;ce<R.items.length;ce++)R.items[ce]&&(se+='<span class="rte-ai-inline-preview-plan-item">'+et(R.items[ce])+"</span>");se+="</span>",R.detail&&(se+='<span class="rte-ai-inline-preview-plan-detail">'+et(R.detail)+"</span>"),se+=mu(R),(R.followupTitle||R.followupDetail)&&(se+='<span class="rte-ai-inline-preview-plan-followup">',R.followupTitle&&(se+='<span class="rte-ai-inline-preview-plan-followup-title">'+et(R.followupTitle)+"</span>"),R.followupDetail&&(se+='<span class="rte-ai-inline-preview-plan-followup-detail">'+et(R.followupDetail)+"</span>"),se+="</span>"),se+="</span>"}return"<"+a+' class="rte-ai-inline-preview-compare" aria-label="'+et(s.title+". "+s.detail)+'"><span class="rte-ai-inline-preview-compare-header"><span class="rte-ai-inline-preview-compare-title">'+et(s.title)+'</span><span class="rte-ai-inline-preview-compare-detail">'+et(s.detail)+"</span></span>"+Q+ie+te+es(a,"rte-ai-inline-preview-old","Current",t)+es(a,"rte-ai-inline-preview-new","Suggested",r)+se+"</"+a+">"}function Xo(e){var t=!!e.isBlock,r=t?"div":"span",n=t?"div":"span",a=e.originalHtml||_r(e.originalText||""),s=e.resultHtml||_r(e.resultText||""),l=io("review","Open",'<button type="button" class="rte-ai-inline-preview-button is-review" data-rte-ai-action="review">Review</button>'),d=io("move","Move",'<button type="button" class="rte-ai-inline-preview-button is-previous" data-rte-ai-action="previous">Previous</button><button type="button" class="rte-ai-inline-preview-button is-next" data-rte-ai-action="next">Next</button>'),m=io("decision","Decide",'<button type="button" class="rte-ai-inline-preview-button is-accept" data-rte-ai-action="accept">Accept</button><button type="button" class="rte-ai-inline-preview-button is-reject" data-rte-ai-action="reject">Reject</button>'),R=io("recovery","Recover",""),Q=hu(e);return"<"+r+' class="rte-ai-inline-preview is-review-surface'+(t?" is-block":" is-inline")+'" contenteditable="false" tabindex="-1" role="group" aria-label="AI suggestion preview" data-rte-ai-preview-id="'+e.id+'" data-rte-ai-suggestion-id="'+e.id+'">'+bu(n,a,s,e)+'<span class="rte-ai-inline-preview-actions" role="group" aria-label="AI suggestion actions">'+Q+l+d+m+R+"</span></"+r+">"}function as(e,t){var r=u(e);if(!r)return!1;t=t||{};var n=t.snapshot||Le();if(!n||!n.hasSelection)return!1;yn();var a=Li(n.html),s={id:"ai-preview-"+new Date().getTime(),snapshot:n,originalHtml:n.html,originalText:n.text,resultText:r,resultHtml:a?ir(r):_r(r),reason:t.reason||"",suggestionType:Z(t.suggestionType||""),language:t.language||"",isBlock:a,status:"pending",createdAt:new Date().getTime(),sourceLabel:t.sourceLabel||x(t.suggestionType||"",n,t.language||"")};if(Ft().push(s),Zt(s.id),!zt(n,!1)){var l=Ft();return l.splice(l.length-1,1),Zt(null),!1}return i.__aiBindInlinePreviewEventHandlers&&i.__aiBindInlinePreviewEventHandlers(),i.insertHTML(Xo(s)),Sr(),Fi("suggestion-created",s),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0}function yu(e,t){var r=u(e);if(!r)return!1;t=t||{};var n=t.snapshot||Le();return yn(),zt(n,!0)||i.focus(),i.insertHTML('<span class="rte-comment-marker" data-comment="'+bn(r)+'" data-rte-comment="'+bn(r)+'" contenteditable="false" style="background:#fff9c4;border:1px solid #f9a825;border-radius:3px;padding:1px 6px;font-size:11px;color:#f57f17;cursor:pointer;" title="'+bn(r)+'" aria-label="'+bn(r)+'">💬 AI Comment</span>'),ba(),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0}function wu(e){e.classList.add("rte-panel-aiassist-menu");var t=document.createElement("div");t.className="rte-ai-menu-info is-minimal is-detached";var r=o(t,"div","","rte-ai-menu-title-row"),n=o(r,"span","","rte-ai-menu-title-icon");n.innerHTML=c.svgCode_aiassist||"",o(r,"div","","rte-ai-menu-title",c.text_aiassist||"Ask AI");var a=o(e,"div","","rte-ai-menu-search-row"),s=o(a,"span","","rte-ai-menu-search-icon");s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6"/><path d="M19 19l-3.4-3.4"/></svg>';var l=e.ownerDocument.createElement("input");l.type="text",l.className="rte-ai-menu-search-input",l.placeholder="Filter actions\u2026",l.setAttribute("aria-label","Filter AI actions"),l.setAttribute("autocomplete","off"),l.setAttribute("spellcheck","false"),a.appendChild(l);for(var d=ne(),m="",R=[],Q=0;Q<d.length;Q++)(function(te){if(te.section&&te.section!==m){var se=document.createElement("div");se.className="rte-ai-menu-section is-detached",se.textContent=te.section,m=te.section}var ce=o(e,"button","","rte-ai-menu-item");ce.type="button",te.section&&ce.setAttribute("data-section",te.section),te.description&&(ce.title=te.description,ce.setAttribute("aria-label",(te.title||te.id)+" \u2014 "+te.description));var Ne=o(ce,"span","","rte-ai-menu-item-icon");Ne.innerHTML=b(te);var de=o(ce,"span","","rte-ai-menu-item-body");o(de,"span","","rte-ai-menu-item-title",te.title||te.id),o(de,"span","","rte-ai-menu-item-copy",te.description||""),ce.onclick=function(_e){_e&&_e.preventDefault&&_e.preventDefault(),_e&&_e.stopPropagation&&_e.stopPropagation(),i.closeCurrentPopup&&i.closeCurrentPopup(),os(te.id)},ce.addEventListener("mouseenter",function(){ie(ce)}),R.push({button:ce,action:te})})(d[Q]);function ie(te){for(var se=0;se<R.length;se++){var ce=R[se],Ne=ce.button===te;Ne?ce.button.classList.add("is-active"):ce.button.classList.remove("is-active")}if(te&&typeof te.scrollIntoView=="function")try{te.scrollIntoView({block:"nearest"})}catch{te.scrollIntoView()}}function ae(){for(var te=[],se=0;se<R.length;se++)R[se].button.hidden||te.push(R[se].button);return te}function oe(te){for(var se=(te||"").trim().toLowerCase(),ce=null,Ne=0;Ne<R.length;Ne++){var de=R[Ne],_e=((de.action.title||"")+" "+(de.action.description||"")+" "+(de.action.id||"")).toLowerCase(),ke=!se||_e.indexOf(se)!==-1;de.button.hidden=!ke,ke&&!ce&&(ce=de.button)}if(ce)a.__aiEmptyHint&&(a.__aiEmptyHint.hidden=!0);else{if(!a.__aiEmptyHint){var Ce=e.ownerDocument.createElement("div");Ce.className="rte-ai-menu-empty-hint",Ce.textContent="No actions match.",e.appendChild(Ce),a.__aiEmptyHint=Ce}a.__aiEmptyHint.hidden=!1}ie(ce)}l.addEventListener("input",function(){oe(l.value)}),l.addEventListener("keydown",function(te){if(te.key==="ArrowDown"||te.key==="ArrowUp"){te.preventDefault();var se=ae();if(!se.length)return;for(var ce=-1,Ne=0;Ne<se.length;Ne++)if(se[Ne].classList.contains("is-active")){ce=Ne;break}var de;te.key==="ArrowDown"?de=ce<0?0:(ce+1)%se.length:de=ce<=0?se.length-1:ce-1,ie(se[de])}else if(te.key==="Enter"){te.preventDefault();for(var _e=ae(),ke=null,Ce=0;Ce<_e.length;Ce++)if(_e[Ce].classList.contains("is-active")){ke=_e[Ce];break}ke||(ke=_e[0]),ke&&ke.click()}else te.key==="Escape"&&l.value&&(te.preventDefault(),l.value="",oe(""))}),oe(""),setTimeout(function(){if(l&&typeof l.focus=="function"&&l.isConnected!==!1)try{l.focus({preventScroll:!0})}catch{try{l.focus()}catch{}}},30)}function xu(e,t){t=t||{};var r=t.agent||c.aiToolkitAgent;if(typeof r!="function"){var n=new Error("AI Toolkit: no agent registered. Call editor.aiToolkit.setAgent(fn) first.");return console.warn(n.message),Promise.reject(n)}var a=Math.max(1,t.maxSteps|0||6),s=t.tools||{},l=t.snapshot||Le(),d=[],m=[];function R(Q,ie){if(Q>=a)return Promise.resolve({done:!0,reason:"maxSteps",transcript:d,executedOps:m,lastResult:ie});var ae={step:Q,prompt:e,snapshot:l,tools:Object.keys(s),transcript:d.slice(),lastResult:ie},oe;try{oe=r(e,ae)}catch(te){return Promise.reject(te)}return Promise.resolve(oe).then(function(te){if(d.push({step:Q,result:te}),!te||te.done===!0)return{done:!0,reason:"agent",transcript:d,executedOps:m,lastResult:te};var se=Promise.resolve(te);return te.toolCalls&&te.toolCalls.length&&(se=Promise.all(te.toolCalls.map(function(ce){var Ne=s[ce&&ce.name];if(typeof Ne!="function")return{name:ce&&ce.name,error:"unknown tool"};try{return Promise.resolve(Ne(ce.args||{},{snapshot:l})).then(function(de){return{name:ce.name,output:de}})}catch(de){return{name:ce.name,error:String(de&&de.message||de)}}})).then(function(ce){return te.toolResults=ce,d[d.length-1].toolResults=ce,te})),se.then(function(ce){if(ce.operations&&ce.operations.length){var Ne=xa(ce.operations,{snapshot:l,resolved:ce});m.push({step:Q,handled:Ne,count:ce.operations.length})}return ce.done===!0?{done:!0,reason:"agent",transcript:d,executedOps:m,lastResult:ce}:R(Q+1,ce)})})}return R(0,null)}function os(e,t){t=t||{};var r=t.snapshot||Le(),n=$(e)||{id:e,target:"document"};return n.target==="chat-panel"&&!t.forceResolve?(ea({focusComposer:!0}),Promise.resolve(!0)):n.target==="review-panel"&&!t.forceResolve?(_o({focusPanel:!0}),Promise.resolve(!0)):n.target==="dialog"&&!t.forceResolve?(la({presetMode:n.resolverMode||"",useDocument:t.useDocument===!0||!r.hasSelection,autoRun:!!n.autoRun}),Promise.resolve(!0)):Ue(e,{snapshot:r,source:t.source,prompt:t.prompt,scope:t.scope}).then(function(a){return wn(a,{snapshot:r,fallbackAction:n})}).catch(function(a){return console.error("AI Toolkit action failed",a),!1})}function wn(e,t){t=t||{};var r=t.snapshot||Le();return e&&e.operations&&e.operations.length?xa(e.operations,{snapshot:r,resolved:e}):xa([it(e&&e.target?e.target:"document",e&&e.result?e.result:"",e,e?e.request:null,e?e.action:null)],{snapshot:r,resolved:e})}function xa(e,t){t=t||{};for(var r=t.snapshot||Le(),n=t.resolved||null,a=!1,s=e||[],l=0;l<s.length;l++)Cu(s[l],{snapshot:r,resolved:n})&&(a=!0);return a}function Cu(e,t){if(!e||!e.type)return!1;t=t||{};var r=t.snapshot||Le(),n=t.resolved||{},a=c.aiToolkitOperationHandlers&&c.aiToolkitOperationHandlers[e.type];if(typeof a=="function")return!!a.call(i,e,{snapshot:r,resolved:n,request:n.request||null,action:n.action||null,editor:i});switch(e.type){case"open-chat-panel":return ea({focusComposer:!0}),!0;case"open-review-panel":return _o({focusPanel:!0}),!0;case"open-dialog":return la({presetMode:e.presetMode||n.presetMode||(n.request?n.request.mode:""),useDocument:e.useDocument===!0||n.useDocument===!0||!r.hasSelection,autoRun:!!(e.autoRun||n.autoRun)}),!0;case"preview-suggestion":return r.hasSelection?as(e.text,{snapshot:r,reason:e.reason||n&&n.reason||"",sourceLabel:e.meta&&e.meta.sourceLabel?e.meta.sourceLabel:"",suggestionType:e.meta&&e.meta.mode?e.meta.mode:n&&n.request?n.request.mode:"",language:e.meta&&e.meta.language?e.meta.language:n&&n.request?n.request.language:""}):(la({presetMode:e.presetMode||n.presetMode||(n.request?n.request.mode:""),useDocument:!0,autoRun:!0}),!0);case"add-comment":return yu(e.text,{snapshot:r});case"insert-below":return ao(e.text,{mode:"insert",snapshot:r});case"replace-selection":return ao(e.text,{mode:"selection",snapshot:r});case"replace-document":return ao(e.text,{mode:"document",snapshot:r});default:return!1}}function Ca(){yn();var e=arguments.length?pt(arguments[0]):gi();if(!e)return!1;var t=In(e.id);return t?(t.outerHTML=Xa(e,"accepted"),e.status="accepted",e.decidedAt=new Date().getTime(),Ho(e,"accepted"),va(e.id),i.__aiRecentlyOpenedQueueSuggestionId===e.id&&Qi({skipUpdate:!0,skipRender:!0}),Zt(null),Ot($n(e,"Accepted")),Sr(),Fi("suggestion-accepted",e),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0):(e.status="stale",e.decidedAt=e.decidedAt||new Date().getTime(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),Zt(null),Sr(),!1)}function ka(){yn();var e=arguments.length?pt(arguments[0]):gi();if(!e)return!1;var t=In(e.id);return t?(t.outerHTML=Xa(e,"rejected"),e.status="rejected",e.decidedAt=new Date().getTime(),Ho(e,"rejected"),va(e.id),i.__aiRecentlyOpenedQueueSuggestionId===e.id&&Qi({skipUpdate:!0,skipRender:!0}),Zt(null),Ot($n(e,"Rejected")),Sr(),Fi("suggestion-rejected",e),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0):(e.status="stale",e.decidedAt=e.decidedAt||new Date().getTime(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),Zt(null),Sr(),!1)}function Hn(e){e=e||{},yn();var t=di();if(!t)return!1;var r=t.suggestion,n=t.wrapper;if(!n||!n.parentNode)return Ul(),!1;r.status="pending",r.decidedAt=0,n.outerHTML=Xo(r),jr().showResolved=!1,iu(r,t.status),Ul(),Zt(r.id),Ot($n(r,"Reopened")),Sr(),Fi("suggestion-reopened",r),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!!e.focusPanel,{focusAction:e.focusAction||""});var a=!1;return e.focusInlineAction&&(a=ro(r.id,e.focusInlineAction)),!e.focusPanel&&!a&&i.focus(),!0}function Qn(e){e=e||{},yn();var t=Nn();if(!t)return!1;var r=t.suggestion,n=t.wrapper,a=i.__aiActiveSuggestionId===r.id?ia(r.id):"";if(!n||!n.parentNode)return Bl(),!1;if(n.outerHTML=Xa(r,t.status),r.status=t.status,r.decidedAt=new Date().getTime(),jr().showResolved=!1,Bl(),Ho(r,t.status,{clearRedo:!1}),va(r.id),i.__aiRecentlyOpenedQueueSuggestionId===r.id&&Qi({skipUpdate:!0,skipRender:!0}),Zt(null),Ot($n(r,t.status==="accepted"?"Accepted again":"Rejected again")),Sr(),Fi(t.status==="accepted"?"suggestion-accepted":"suggestion-rejected",r),a){var s=xi(a,{focusPanel:!!e.focusPanel,focusAction:e.focusAction||"accept"});return s&&e.focusInlineAction&&ro(a,e.focusInlineAction),s}return i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!!e.focusPanel,{focusAction:e.focusAction||"accept"}),e.focusPanel||i.focus(),!0}function ao(e,t){var r=u(e);if(!r)return!1;yn(),t=t||{};var n=t.mode||"document",a=t.snapshot||Le();return n==="document"?(i.setHTMLCode(ir(r)),ba(),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0):n==="selection"?(zt(a,!1)||i.focus(),i.insertText(r),ba(),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0):(zt(a,!0)||i.focus(),i.insertHTML("<p><br/></p>"+ir(r)),ba(),Sr(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),i.focus(),!0)}function Yo(e){for(;e;){if(e.nodeType===1){var t=typeof e.className=="string"?e.className:"";if(t.indexOf("richtexteditor")!==-1)return e}e=e.parentNode}return null}function Di(){var e=i.getEditable?i.getEditable():null,t=Yo(e);if(t)return t;var r=e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.frameElement:null;if(t=Yo(r),t)return t;if(i.iframe){if(t=Yo(i.iframe),t)return t;if(i.iframe.parentNode)return i.iframe.parentNode}return e&&e.parentNode?e.parentNode:null}function ku(){var e=Di();if(!e)return null;if(i.__aiReviewStatusNode&&i.__aiReviewStatusNode.isConnected)return i.__aiReviewStatusNode;var t=e.querySelector?e.querySelector(".rte-ai-review-live-region"):null;if(t)return i.__aiReviewStatusNode=t,t;var r=o(e,"div","","rte-ai-review-live-region");return r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),i.__aiReviewStatusNode=r,r}function $n(e,t,r){if(!e)return t||"";r=r||{};var n=[],a=Z(e.suggestionType||"")!=="other"?M(e.suggestionType):"AI suggestion";n.push(a);var s=X(e);s&&n.push(s),e.language&&n.push(T(e.language));var l=t?t+" "+n.join(", "):n.join(", ");return r.positionLabel?l+=". "+r.positionLabel+".":l+=".",r.remoteUpdateCount&&(l+=" "+(r.remoteUpdateCount>1?r.remoteUpdateCount+" shared updates.":"Shared update.")),l}function ls(e,t){if(!e)return"Opened AI review queue.";t=t||{};var r=p(e),n=r===1?"1 pending item":r+" pending items",a=Z(e.suggestionType||"")!=="other"?M(e.suggestionType):"AI",s=qt(e,t.focusAction||Ie()),l=a&&a!=="AI"?"Opened "+a+" AI review queue. "+n+".":"Opened AI review queue. "+n+".";return s&&(l+=" Focus "+s+"."),l+" "+$n(e,"Reviewing",t)}function _u(e,t){if(!e)return"AI review item";t=t||{};var r=[];t.isCurrent&&r.push("Current review item"),t.queueOpened&&r.push("Queue opened"),t.queueRoleLabel&&r.push(t.queueRoleLabel),t.queuePositionLabel&&r.push(t.queuePositionLabel),t.transitionLabel&&r.push(t.transitionLabel),t.changeSummary&&r.push(t.changeSummary),r.push(ya(e.status)),e.suggestionType&&Z(e.suggestionType)!=="other"?r.push(M(e.suggestionType)):r.push("AI suggestion");var n=X(e);n&&r.push(n),e.language&&r.push(T(e.language)),t.remoteUpdateCount&&r.push(t.remoteUpdateCount>1?t.remoteUpdateCount+" shared updates":"Shared update");var a=er(e.originalText||e.resultText||"AI suggestion",80);return a&&r.push("Preview: "+a),t.undoLabel&&r.push(t.undoLabel),t.undoNextLabel&&r.push(t.undoNextLabel),t.redoLabel&&r.push(t.redoLabel),t.redoNextLabel&&r.push(t.redoNextLabel),r.join(". ")}function _a(e,t,r){if(!r||r.status!=="pending"||!e||!e.length)return null;for(var n=[],a=0;a<e.length;a++)e[a]&&e[a].status==="pending"&&n.push(e[a]);if(!n.length)return null;for(var s=-1,l=-1,d=0;d<n.length;d++)n[d].id===r.id&&(s=d),n[d].id===t&&(l=d);if(s===-1)return null;l===-1&&(l=0);var m="later";s===l?m="current":s===l+1?m="next":s<l&&(m="earlier");var R="Queue "+(s+1)+" of "+n.length,Q="",ie="";return m==="current"?(ie="Current focus",Q="Review this item now. It is "+R.toLowerCase()+" in this view."):m==="next"?(ie="Up next",Q="This follows after the current decision. It is "+R.toLowerCase()+" in this view."):m==="earlier"?(ie="Earlier item",Q="You moved past this item. Use Previous or K to return. It is "+R.toLowerCase()+" in this view."):(ie="Later in queue",Q="This comes later in the current review run. It is "+R.toLowerCase()+" in this view."),{role:m,roleLabel:ie,queueLabel:R,detail:Q}}function Su(e,t,r,n){if(!r||!e||!e.length)return null;if(r.status!=="pending"){for(var a=0,s=0;s<e.length;s++)e[s]&&e[s].status!=="pending"&&a++;return a?{key:"resolved",label:"Resolved items",detail:"Accepted, rejected, or stale suggestions from this review run.",countLabel:Tr(a,"item")}:null}for(var l=[],d=0;d<e.length;d++)e[d]&&e[d].status==="pending"&&l.push(e[d]);if(!l.length)return null;for(var m=-1,R=0;R<l.length;R++)if(l[R].id===t){m=R;break}m===-1&&(m=0);var Q=n&&n.role?n.role:"";return Q==="current"?{key:"current",label:"Current focus",detail:"Review this suggestion now.",countLabel:"1 item"}:Q==="next"?{key:"next",label:"Up next",detail:"Becomes current after this decision.",countLabel:"1 item"}:Q==="later"?{key:"later",label:"Later in queue",detail:"Pending suggestions after the immediate next step.",countLabel:Tr(Math.max(1,l.length-m-2),"item")}:Q==="earlier"?{key:"earlier",label:"Earlier in queue",detail:"Pending suggestions before the current focus.",countLabel:Tr(Math.max(1,m),"item")}:{key:"pending",label:"Pending items",detail:"Remaining AI suggestions in this queue.",countLabel:Tr(l.length,"item")}}function mi(e,t,r){if(!r||r.status!=="pending"||!e||!e.length)return null;for(var n=[],a=0;a<e.length;a++)e[a]&&e[a].status==="pending"&&n.push(e[a]);if(!n.length)return null;for(var s=-1,l=-1,d=0;d<n.length;d++)n[d].id===t&&(s=d),n[d].id===r.id&&(l=d);if(l===-1)return null;var m=l===n.length-1;if(!m&&r.id!==t)return null;if(m)return{title:"After this decision",statusLabel:"Queue complete",queueLabel:"Queue "+(l+1)+" of "+n.length,typeLabel:"",scopeLabel:"",detail:"Accepting or rejecting this final pending item finishes the current review run.",previewLabel:"Queue state",previewText:"No later pending items remain in this queue.",followupTitle:"Then recovery and next queues appear",followupStatusLabel:"Recovery ready",followupDetail:"Undo the last decision or open another queue."};if(s===-1||s>=n.length-1)return null;var R=n[s+1];return R?{title:"After this decision",statusLabel:"Up next becomes current",queueLabel:"Queue "+(s+2)+" of "+n.length,typeLabel:R.suggestionType&&Z(R.suggestionType)!=="other"?M(R.suggestionType):"",scopeLabel:X(R),detail:"Accepting or rejecting this item moves review straight to the next pending suggestion.",previewLabel:"Next item",previewText:er(R.originalText||R.resultText||"Next review item",84),followupTitle:s+1===n.length-1?"Then queue complete":"",followupStatusLabel:s+1===n.length-1?"Queue complete":"",followupDetail:s+1===n.length-1?"After reviewing the final pending item, recovery and next queues appear.":""}:null}function Xn(e){if(!e)return"";var t=e.previewLabel||"",r=e.previewText||"";return t&&r?t+": "+r:r||t}function ss(e,t,r){if(!e||!t||!r)return null;var n=Xn(r);if(!n)return null;var a=o(e,"div","",t);return r.previewLabel&&o(a,"span","",t+"-label",r.previewLabel+":"),r.previewText&&o(a,"span","",t+"-text"," "+r.previewText),!r.previewLabel&&!r.previewText&&(a.textContent=n),a}function cs(e){return i.__aiQueueOpenedTimer&&(clearTimeout(i.__aiQueueOpenedTimer),i.__aiQueueOpenedTimer=null),i.__aiRecentlyOpenedQueueSuggestionId=e||null,Ki(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),e?(i.__aiQueueOpenedTimer=setTimeout(function(){i.__aiRecentlyOpenedQueueSuggestionId===e&&(i.__aiRecentlyOpenedQueueSuggestionId=null,Ki(),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1)),i.__aiQueueOpenedTimer=null},1800),!0):!1}function Qi(e){e=e||{};var t=!!i.__aiRecentlyOpenedQueueSuggestionId;return i.__aiQueueOpenedTimer&&(clearTimeout(i.__aiQueueOpenedTimer),i.__aiQueueOpenedTimer=null),i.__aiRecentlyOpenedQueueSuggestionId=null,t?(e.skipUpdate||Ki(),!e.skipRender&&i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),!0):!1}function ln(e,t){var r=pt(e),n=Wr(e),a=n&&n!=="all"?M(n)+" review queue":"AI review queue",s=t==="previous"||t==="first"?"Already at the first pending item in the "+a+".":"Already at the last pending item in the "+a+".";return r?s+" "+$n(r,"Still reviewing"):s}function oo(e,t){var r=pt(t),n=r?$n(r,e):(e||"Updated")+" AI suggestion.";return n+" Review queue complete."}function bi(e){return!e||!e.reason?"":er(e.reason,110)}function Tu(e){if(!e)return"";var t=er(e.resultText||"",96),r=er(e.originalText||"",96);return!t||t===r?"":t}function us(e){if(!e)return"";switch(Z(e.suggestionType)){case"proofread":return"Surface edit";case"rewrite":return"Text rewrite";case"translate":return"Language change";case"summarize":case"shorten":return"Condensed draft";case"expand":return"Expanded draft"}var t=u(e.originalText||"").toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g," ").trim(),r=u(e.resultText||"").toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g," ").trim();return t&&r&&t===r?"Surface edit":"Text change"}function ds(e){if(!e)return"";var t=Z(e.suggestionType),r=u(e.originalText||"").toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g," ").trim(),n=u(e.resultText||"").toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g," ").trim();if(!r||!n)return"";if(r===n||t==="proofread")return"Low impact";if(t==="translate"||t==="summarize"||t==="shorten"||t==="expand")return"High impact";if(t==="rewrite"||r.indexOf(n)>=0||n.indexOf(r)>=0)return"Medium impact";for(var a=r.split(/\s+/),s=n.split(/\s+/),l={},d=0,m=0;m<a.length;m++)l[a[m]]=(l[a[m]]||0)+1;for(var R=0;R<s.length;R++){var Q=s[R];l[Q]&&(l[Q]--,d++)}var ie=d/Math.max(a.length,s.length,1);return ie>=.45?"Medium impact":"High impact"}function fs(e){var t=u(e||"");return t?t.split(/\s+/).length:0}function ps(e){var t=u(e||"");if(!t)return 0;var r=t.match(/[^.!?]+[.!?]+|[^.!?]+$/g);return r&&r.length?r.length:1}function Tr(e,t){return e+" "+t+(e===1?"":"s")}function $i(e){if(!e)return null;var t=[],r=us(e),n=ds(e),a=X(e);r&&t.push({kind:"change",text:r}),n&&t.push({kind:"impact",text:n}),a&&t.push({kind:"scope",text:a});var s=fs(e.originalText||""),l=fs(e.resultText||""),d=ps(e.originalText||""),m=ps(e.resultText||""),R="";return s&&l&&d&&m?s===l&&d===m?R="Keeps "+Tr(l,"word")+" across "+Tr(m,"sentence")+".":d===m?R="Moves from "+Tr(s,"word")+" to "+Tr(l,"word")+" across "+Tr(m,"sentence")+".":R="Moves from "+Tr(s,"word")+" across "+Tr(d,"sentence")+" to "+Tr(l,"word")+" across "+Tr(m,"sentence")+".":s&&l?R="Moves from "+Tr(s,"word")+" to "+Tr(l,"word")+".":d&&m&&(R="Moves from "+Tr(d,"sentence")+" to "+Tr(m,"sentence")+"."),!t.length&&!R?null:{title:"Change at a glance",pills:t,detail:R}}function lo(e,t){var r=u(e||""),n=u(t||"");if(!r||!n||r===n)return null;for(var a=0,s=Math.min(r.length,n.length);a<s&&r.charAt(a)===n.charAt(a);)a++;for(var l=0,d=r.length-a,m=n.length-a;l<d&&l<m&&r.charAt(r.length-1-l)===n.charAt(n.length-1-l);)l++;return{currentLead:r.substring(0,a),currentChange:r.substring(a,r.length-l),currentTrail:l?r.substring(r.length-l):"",resultLead:n.substring(0,a),resultChange:n.substring(a,n.length-l),resultTrail:l?n.substring(n.length-l):""}}function vs(e,t,r,n){var a=t==="result"?"Suggested":"Current",s=o(e,"div","","rte-ai-review-empty-preview-line is-"+t);o(s,"span","","rte-ai-review-empty-preview-line-label",a+":");var l=o(s,"span","","rte-ai-review-empty-preview-line-text");if(!r)return s;if(!n)return l.innerText=r,s;var d=t==="result"?n.resultLead:n.currentLead,m=t==="result"?n.resultChange:n.currentChange,R=t==="result"?n.resultTrail:n.currentTrail;return d&&o(l,"span","","rte-ai-review-empty-preview-segment",d),m&&o(l,"span","","rte-ai-review-empty-preview-delta is-"+t,m),R&&o(l,"span","","rte-ai-review-empty-preview-segment",R),!d&&!m&&!R&&(l.innerText=r),s}function so(e,t,r,n){var a=o(e,"div","","rte-ai-review-item-compare-text"),s=r||"";if(!s)return a.innerText=t==="result"?"Suggested text unavailable.":"Original selection unavailable.",a;if(!n)return a.innerText=s,a;var l=t==="result"?n.resultLead:n.currentLead,d=t==="result"?n.resultChange:n.currentChange,m=t==="result"?n.resultTrail:n.currentTrail;return l&&o(a,"span","","rte-ai-review-item-compare-segment",l),d&&o(a,"span","","rte-ai-review-item-compare-delta is-"+t,d),m&&o(a,"span","","rte-ai-review-item-compare-segment",m),!l&&!d&&!m&&(a.innerText=s),a}function co(e,t,r){if(!(!e||!t)){var n=e.closest?e.closest(".rte-ai-review-item"):null,a=e.querySelector(".rte-ai-review-item-condensed-open-pill"),s=e.querySelector(".rte-ai-review-item-condensed-entry-detail");if(a){var l=qt(t,Ie(r))||qt(t,"")||"Locate";a.innerText=l,s&&(s.innerText="Press Enter to reopen this suggestion and land on "+l+"."),n&&n.setAttribute&&n.setAttribute("data-rte-ai-review-open-action-label",l)}}}function hs(e,t,r){if(!(!e||!t)){var n=e.querySelector?e.querySelector(".rte-ai-review-item-condensed-shortcuts"):null,a=fc(t,Ie(r));if(!a){n&&n.parentNode&&n.parentNode.removeChild(n);return}n||(n=o(e,"div","","rte-ai-review-item-condensed-shortcuts"));var s=n.querySelector?n.querySelector(".rte-ai-review-item-condensed-shortcuts-title"):null;s||(s=o(n,"span","","rte-ai-review-item-condensed-shortcuts-title")),s.textContent="More keys";var l=n.querySelector?n.querySelector(".rte-ai-review-item-condensed-shortcuts-body"):null;l||(l=o(n,"div","","rte-ai-review-shortcuts rte-ai-review-item-condensed-shortcuts-body")),pl(l,a),vl(l,"card"),n.setAttribute("aria-label","More keys. "+(l.textContent||""))}}function Au(e,t){if(!e||!t)return null;var r=o(e,"div","","rte-ai-review-item-condensed-queue is-"+(t.role||""));o(r,"div","","rte-ai-review-item-condensed-queue-title",t.roleLabel);var n=o(r,"div","","rte-ai-review-item-condensed-queue-meta");return o(n,"span","","rte-ai-review-item-queue-pill is-role",t.roleLabel),o(n,"span","","rte-ai-review-item-queue-pill is-position",t.queueLabel),o(r,"div","","rte-ai-review-item-condensed-queue-detail",t.detail),r}function Eu(e,t){if(!e||!t)return null;var r=o(e,"div","","rte-ai-review-item-condensed-transition");o(r,"div","","rte-ai-review-item-condensed-transition-title",t.title);var n=o(r,"div","","rte-ai-review-item-condensed-transition-meta");if(o(n,"span","","rte-ai-review-item-transition-pill is-status",t.statusLabel),o(n,"span","","rte-ai-review-item-transition-pill is-position",t.queueLabel),t.typeLabel&&o(n,"span","","rte-ai-review-item-transition-pill is-type",t.typeLabel),t.scopeLabel&&o(n,"span","","rte-ai-review-item-transition-pill is-scope",t.scopeLabel),o(r,"div","","rte-ai-review-item-condensed-transition-detail",t.detail),ss(r,"rte-ai-review-item-condensed-transition-preview",t),t.followupTitle){var a=o(r,"div","","rte-ai-review-item-condensed-transition-followup");o(a,"div","","rte-ai-review-item-condensed-transition-followup-title",t.followupTitle);var s=o(a,"div","","rte-ai-review-item-condensed-transition-followup-meta");t.followupStatusLabel&&o(s,"span","","rte-ai-review-item-transition-pill is-followup",t.followupStatusLabel),o(a,"div","","rte-ai-review-item-condensed-transition-followup-detail",t.followupDetail)}return r}function Zo(e,t){if(!e)return[];t=t||{};var r=t.sharedUpdateCount||0,n=[];n.push({kind:"status",text:e.status==="pending"?"Ready to review":ya(e.status)}),r&&n.push({kind:"remote",text:r>1?r+" shared updates":"Shared update"}),e.suggestionType&&Z(e.suggestionType)!=="other"&&n.push({kind:"type",text:M(e.suggestionType)}),e.language&&n.push({kind:"language",text:T(e.language)});var a=X(e);return a&&n.push({kind:"scope",text:e.status==="pending"?a+" draft":a}),e.status==="pending"&&n.push({kind:"steps",text:"1 step"}),n}function Lu(e,t){if(!e)return"";t=t||{};var r=["Proposed edit","Current and suggested text"],n=t.originalText||er(e.originalText||"",72)||"Original selection unavailable.",a=t.resultText||er(e.resultText||"",72)||"Suggested text unavailable.",s=t.previewMetaData||Zo(e,t);if(s&&s.length)for(var l=0;l<s.length;l++)s[l]&&s[l].text&&r.push(s[l].text);r.push("Current"),r.push(n),r.push("Suggested"),r.push(a);var d=t.reasonText||bi(e);if(d&&(r.push("Why"),r.push(d)),t.changeGlance){if(r.push(t.changeGlance.title),t.changeGlance.pills&&t.changeGlance.pills.length)for(var m=0;m<t.changeGlance.pills.length;m++)t.changeGlance.pills[m]&&t.changeGlance.pills[m].text&&r.push(t.changeGlance.pills[m].text);t.changeGlance.detail&&r.push(t.changeGlance.detail)}t.queuePositionData&&(r.push(t.queuePositionData.roleLabel),r.push(t.queuePositionData.queueLabel),r.push(t.queuePositionData.detail)),r.push("Review handoff");var R=qt(e,t.preferredAction||Ie(t.panel))||qt(e,"")||"Locate";r.push("Enter target "+R),r.push("Press Enter to reopen this suggestion and land on "+R);var Q=fc(e,t.preferredAction||Ie(t.panel));return Q&&(r.push("More keys"),r.push(Q)),t.queueTransitionData&&(r.push(t.queueTransitionData.title),r.push(t.queueTransitionData.statusLabel),r.push(t.queueTransitionData.queueLabel),t.queueTransitionData.typeLabel&&r.push(t.queueTransitionData.typeLabel),t.queueTransitionData.scopeLabel&&r.push(t.queueTransitionData.scopeLabel),r.push(t.queueTransitionData.detail),r.push(Xn(t.queueTransitionData)),t.queueTransitionData.followupTitle&&r.push(t.queueTransitionData.followupTitle),t.queueTransitionData.followupDetail&&r.push(t.queueTransitionData.followupDetail)),r.join(". ")}function gs(e,t,r){if(!(!e||!t||!e.setAttribute)){var n=Ie(r),a=dl(t),s=Xt(a);!s.length&&a!=="all"&&(s=Xt("all"));var l=_a(s,i.__aiActiveSuggestionId,t),d=mi(s,i.__aiActiveSuggestionId,t),m=$i(t),R=Yr(t.id),Q=er(t.originalText||"",72)||"Original selection unavailable.",ie=er(t.resultText||"",72)||"Suggested text unavailable.",ae=Lu(t,{panel:r,preferredAction:n,previewMetaData:Zo(t,{sharedUpdateCount:R}),queuePositionData:l,queueTransitionData:d,changeGlance:m,originalText:Q,resultText:ie,reasonText:bi(t)});e.setAttribute("data-rte-ai-review-base-aria-label",ae),e.setAttribute("aria-label",ae)}}function uo(e){var t=e&&e.isConnected?e:i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null;if(t)for(var r=Ie(t),n=t.querySelectorAll(".rte-ai-review-item.is-condensed"),a=0;a<n.length;a++){var s=n[a],l=s.getAttribute("data-rte-ai-review-id")||"";if(l){var d=pt(l);gs(s,d,t),co(s,d,t),hs(s,d,t),s.title=fl(d,r)}}}function fo(){var e=i.getEditable?i.getEditable():null;if(!(!e||!e.querySelectorAll))for(var t=e.querySelectorAll(".rte-ai-inline-preview"),r=0;r<t.length;r++){var n=t[r];if(!(!n||n.classList.contains("is-review-active"))){var a=n.getAttribute("data-rte-ai-suggestion-id")||"";if(!(!a||i.__aiReviewEmptyPreviewSuggestionId&&a===i.__aiReviewEmptyPreviewSuggestionId)){var s=pt(a);if(s){var l=Wr(a),d=Xt(l),m=_a(d,i.__aiActiveSuggestionId,s),R=mi(d,i.__aiActiveSuggestionId,s),Q=qt(s,Ie())||qt(s,""),ie="Open this AI suggestion in review"+(Q?" and focus "+Q:""),ae=bi(s),oe=n.querySelector?n.querySelector('[data-rte-ai-action="review"]'):null;oe&&Jn(oe,"Review",ie);var te=$i(s),se=wa(te),ce=n.querySelector?n.querySelector(".rte-ai-inline-preview-focus"):null,Ne=n.querySelector?n.querySelector(".rte-ai-inline-preview-current"):null,de=n.querySelector?n.querySelector(".rte-ai-inline-preview-type"):null,_e=n.querySelector?n.querySelector(".rte-ai-inline-preview-language"):null,ke=n.querySelector?n.querySelector(".rte-ai-inline-preview-scope"):null,Ce=n.querySelector?n.querySelector(".rte-ai-inline-preview-remote"):null,me=n.querySelector?n.querySelector(".rte-ai-inline-preview-glance"):null,Re=n.querySelector?n.querySelector(".rte-ai-inline-preview-reason"):null,Be=n.querySelector?n.querySelector(".rte-ai-inline-preview-shortcuts"):null;if(Q){if(!ce){ce=document.createElement("span"),ce.className="rte-ai-inline-preview-focus";var xe=Ce||ke||_e||de||Ne;xe&&xe.nextSibling?n.insertBefore(ce,xe.nextSibling):n.appendChild(ce)}ce.textContent="Focus "+Q,ce.setAttribute("aria-label","Review opens on "+Q)}else ce&&ce.parentNode&&ce.parentNode.removeChild(ce);if(te&&te.pills&&te.pills.length){if(!me){me=document.createElement("span"),me.className="rte-ai-inline-preview-glance";var Fe=ke||de||Ne;Fe&&Fe.nextSibling?n.insertBefore(me,Fe.nextSibling):n.appendChild(me)}for(;me.firstChild;)me.removeChild(me.firstChild);for(var ut=0;ut<te.pills.length;ut++){var Ge=te.pills[ut];!Ge||!Ge.text||Ge.kind==="scope"||o(me,"span","","rte-ai-review-item-glance-pill is-"+Ge.kind,Ge.text)}!me.childNodes.length&&me.parentNode&&(me.parentNode.removeChild(me),me=null)}else me&&me.parentNode&&me.parentNode.removeChild(me);rs(n,s),Qo(n,s),$o(n,se),Re=Wo(n,Re,s),Be=Jo(n,Be),Vo(n,{suggestion:s,sharedUpdateCount:Yr(a),queueTransitionData:R}),Ko(n,{suggestion:s,sharedUpdateCount:Yr(a)}),n.setAttribute("aria-label",h(s,{remoteUpdateCount:Yr(a),glanceLabels:te?te.pills.map(function(Se){return Se.text}):[],glanceDetail:te?te.detail:"",compareLabel:"Proposed edit. Current and suggested text.",reasonText:ae,focusLabel:Q,queueRoleLabel:m?m.roleLabel:"",queueRoleDetail:m?m.detail:"",transitionLabel:R?R.title+". "+R.statusLabel+". "+R.queueLabel+". "+Xn(R):"",followupLabel:R&&R.followupTitle?R.followupTitle+". "+R.followupDetail:""}))}}}}}function Ru(e,t,r,n){if(!e||!t)return null;n=n||{};var a=n.queuePositionData||null,s=n.queueTransitionData||null,l=Zo(t,n),d=$i(t),m=er(t.originalText||"",72)||"Original selection unavailable.",R=er(t.resultText||"",72)||"Suggested text unavailable.",Q=bi(t),ie=lo(m,R),ae=o(e,"div","","rte-ai-review-item-condensed-preview"),oe=o(ae,"div","","rte-ai-review-item-condensed-preview-header");if(o(oe,"div","","rte-ai-review-item-condensed-preview-title","Proposed edit"),o(oe,"div","","rte-ai-review-item-condensed-preview-detail","Current and suggested text"),l&&l.length)for(var te=o(ae,"div","","rte-ai-review-item-condensed-preview-meta"),se=0;se<l.length;se++){var ce=l[se];!ce||!ce.text||o(te,"span","","rte-ai-review-item-condensed-preview-pill is-"+(ce.kind||"other"),ce.text)}var Ne=o(ae,"div","","rte-ai-review-item-condensed-preview-line is-current");o(Ne,"span","","rte-ai-review-item-condensed-preview-label","Current"),so(Ne,"current",m,ie);var de=o(ae,"div","","rte-ai-review-item-condensed-preview-line is-result");if(o(de,"span","","rte-ai-review-item-condensed-preview-label","Suggested"),so(de,"result",R,ie),Q){var _e=o(ae,"div","","rte-ai-review-item-condensed-reason");o(_e,"span","","rte-ai-review-item-condensed-reason-label","Why"),o(_e,"div","","rte-ai-review-item-condensed-reason-copy",Q)}if(d&&d.pills&&d.pills.length){var ke=o(ae,"div","","rte-ai-review-item-condensed-glance");o(ke,"div","","rte-ai-review-item-condensed-glance-title","Change at a glance");for(var Ce=o(ke,"div","","rte-ai-review-item-condensed-glance-meta"),me=0;me<d.pills.length;me++){var Re=d.pills[me];o(Ce,"span","","rte-ai-review-item-glance-pill is-"+Re.kind,Re.text)}d.detail&&o(ke,"div","","rte-ai-review-item-condensed-glance-detail",d.detail)}Au(ae,a);var Be=o(ae,"div","","rte-ai-review-item-condensed-entry");o(Be,"div","","rte-ai-review-item-condensed-entry-title","Review handoff");var xe=o(Be,"div","","rte-ai-review-item-condensed-open");return o(xe,"span","","rte-ai-review-item-condensed-open-label","Enter target"),o(xe,"span","","rte-ai-review-item-condensed-open-pill"),o(Be,"div","","rte-ai-review-item-condensed-entry-detail"),co(Be,t,r),hs(Be,t,r),Eu(ae,s),ae}function Du(e,t,r,n,a,s,l){var d=!!(e.accepted||e.rejected||e.stale),m=Ie(),R=di(),Q=Nr(R),ie=R?{id:"undo-last",label:Q.actionLabel,focusActionLabel:Xd(R,m)}:null;if(r!=="all"&&!t){for(var ae=[],oe=[],te=[],se=l||[],ce=s||{},Ne=0;Ne<se.length;Ne++){var de=se[Ne];if(!(!de||de.value==="all"||de.value===r)){var _e=ce[de.value]||0;if(_e){var ke=cn(de.value,""),Ce=ke?pt(ke):null,me=Ce?er(Ce.originalText||Ce.resultText||"",84):"",Re=Tu(Ce),Be=us(Ce),xe=ds(Ce),Fe=Ce?X(Ce):"",ut=Ce&&Ce.language?T(Ce.language):"",Ge=bi(Ce);te.push(de.label+" ("+_e+")"),ae.push({id:"go-type",label:"Go to "+de.label+" ("+_e+")",typeValue:de.value,suggestionId:ke,focusAction:m,focusActionLabel:qt(Ce,m)}),me&&oe.push({label:de.label+" next",text:me,typeValue:de.value,suggestionId:ke,actionLabel:"Go to "+de.label+" ("+_e+")",focusAction:m,pendingCountLabel:_e+" pending",changeLabel:Be,impactLabel:xe,focusActionLabel:qt(Ce,m),scopeLabel:Fe,languageLabel:ut,resultText:Re,reasonText:Ge})}}}var Se=M(r);return{title:Se+" queue complete",detail:e.pending?"No pending "+Se.toLowerCase()+" suggestions remain. Continue into another AI queue, switch back to all types, or review resolved items.":"No pending "+Se.toLowerCase()+" suggestions remain, and the overall AI review queue is complete.",announceMessage:e.pending?te.length===1?Se+" queue complete. Next queue: "+te[0]+".":te.length>1?Se+" queue complete. Next queues available: "+te.join(", ")+".":Se+" queue complete. Pending AI review remains in other queues.":Se+" queue complete. Overall AI review queue complete.",previewItems:oe,actions:ae.concat([e.pending&&a?{id:"next-overall",label:"Next pending overall",suggestionId:a,focusAction:m,focusActionLabel:qt(pt(a),m)}:null,ie,{id:"all-types",label:"All types"},d&&!n?{id:"show-resolved",label:"Show resolved"}:null,{id:"open-chat",label:"AI Chat"}])}}return e.pending?{title:"No suggestions in this view",detail:"Suggestions from Ask AI or the chat panel stay here until you accept or reject them.",announceMessage:"",actions:[ie,r!=="all"?{id:"all-types",label:"All types"}:null,d&&!n?{id:"show-resolved",label:"Show resolved"}:null,{id:"open-chat",label:"AI Chat"}]}:{title:"Review queue complete",detail:d?"All AI suggestions have been reviewed. You can inspect resolved items or open AI Chat to generate more suggestions.":"There are no pending AI suggestions right now. Open AI Chat to create a new review pass.",announceMessage:d?"Review queue complete. All AI suggestions have been reviewed.":"Review queue complete. No pending AI suggestions remain.",actions:[ie,d&&!n?{id:"show-resolved",label:"Show resolved"}:null,{id:"open-chat",label:"AI Chat"}]}}function ms(e,t,r){return!e||!e.total?"No suggestions":r!=="all"&&t>0?M(r)+" queue":e.pending>0?"Reviewing":e.stale>0?"Needs refresh":"Queue complete"}function Pu(e,t,r,n){return!e||!e.total?"Ask AI to create a review queue.":n&&n.total&&n.index?"Item "+n.index+" of "+n.total+" is active now.":r!=="all"&&t>0?t+" "+M(r).toLowerCase()+" item"+(t===1?"":"s")+" ready to review.":e.pending>0?e.pending+" pending item"+(e.pending===1?"":"s")+" ready for review.":"Everything in this queue has been reviewed for now."}function Mu(e,t,r,n){if(!e||!e.total)return"Use Ask AI, AI Chat, or inline review actions to generate reviewable changes.";var a=[];return r!=="all"?a.push("Showing only "+M(r).toLowerCase()+" suggestions."):a.push("Showing every AI suggestion in this editor."),n&&n.count?a.push(n.count+" shared update"+(n.count===1?"":"s")+" waiting."):e.stale>0?a.push(e.stale+" suggestion"+(e.stale===1?"":"s")+" may need refresh."):e.pending>0&&r!=="all"&&t!==e.pending&&a.push(e.pending+" total pending across all queues."),a.join(" ")}function Iu(e,t,r){return e?e.status==="pending"&&r?"Opened from queue switcher":e.status==="pending"&&t?"Ready to review now":e.status==="accepted"?"Accepted change":e.status==="rejected"?"Rejected change":e.status==="stale"?"Needs refresh":ya(e.status):"AI suggestion"}function Nu(e,t,r,n){if(!e)return"";var a=[];e.status==="pending"&&t?a.push("This is the active item in the current queue."):e.status==="pending"&&r?a.push("This item was opened from the queue-complete handoff."):e.status==="stale"?a.push("Review the latest editor text before deciding."):(e.status==="accepted"||e.status==="rejected")&&a.push("This decision stays in history until you reopen it.");var s=e.sourceLabel||(e.snapshot&&e.snapshot.hasSelection?"Selection suggestion":"Document suggestion");return s&&a.push(s+"."),n&&a.push(n>1?n+" shared updates are waiting.":"A shared update is waiting."),a.join(" ")}function Hu(e,t){var r="";e?r=t?"Press Enter to "+e+". J/K or Left/Right switch queues. Home/End jump queues. Tab for more actions.":"Press Enter to "+e+". Tab for more actions.":r="Press Tab for available actions.";var n=Nr(),a=Hr();return un()?r.replace(/\.$/,"")+". Press U to "+n.shortcutLabel+"."+(dn()?" Press Shift+U to "+a.shortcutLabel+".":""):dn()?r.replace(/\.$/,"")+". Press Shift+U to "+a.shortcutLabel+".":r}function Ou(e,t){t=t||{};var r=Nr(),n=Hr();if(!e){var a=[];return un()&&a.push("U "+r.shortcutLabel),dn()&&a.push("Shift+U "+n.shortcutLabel),a.push("Esc close"),"Shortcuts: "+a.join(", ")}var s=["Enter "+e];return t.queueSwitcher&&(s.push("J/K or Left/Right switch queues"),s.push("Home/End jump queues")),un()&&s.push("U "+r.shortcutLabel),dn()&&s.push("Shift+U "+n.shortcutLabel),s.push("Tab more actions"),s.push("Esc close"),"Shortcuts: "+s.join(", ")}function bs(e,t){t=t||{};var r=["Enter activates "+(e||"this action")+(t.focusLabel?" and focuses "+t.focusLabel:"")+"."];t.queueSwitcher&&r.push("J/K or Left/Right switch queues. Home/End jump queues."),r.push("Tab moves to more actions.");var n=Nr(),a=Hr(),s=r.join(" ");return un()&&(s=s.replace(/\.$/,"")+" U undoes "+n.decisionLabel+" decision."),dn()&&(s=s.replace(/\.$/,"")+" Shift+U redoes "+a.decisionLabel+" decision."),s}function ys(e){e=e||{};var t=e.queueSwitcher?"Enter Space J K ArrowLeft ArrowRight Home End":"Enter Space";return Co(t)}function Ot(e){var t=ku(),r=u(e||"");return!t||!r?!1:(i.__aiReviewStatusTimer&&clearTimeout(i.__aiReviewStatusTimer),t.textContent="",i.__aiReviewStatusTimer=setTimeout(function(){t&&(t.textContent=r)},30),!0)}function el(){return"chat-"+new Date().getTime().toString(36)+"-"+Math.random().toString(36).slice(2,8)}function tl(){var e=Wa();return e?e+".ChatSessions":""}function qu(e){if(!e)return null;var t={role:e.role||"assistant",text:u(e.text||""),scope:e.scope==="selection"?"selection":"document",timestamp:e.timestamp||0,isError:!!e.isError};if(e.snapshot&&(t.snapshot={hasSelection:!!e.snapshot.hasSelection}),e.resolved)try{t.resolved=JSON.parse(JSON.stringify(e.resolved))}catch{}return t}function ju(e){return e?{role:e.role||"assistant",text:u(e.text||""),scope:e.scope==="selection"?"selection":"document",resolved:e.resolved||null,snapshot:e.snapshot?{hasSelection:!!e.snapshot.hasSelection}:null,timestamp:e.timestamp||0,isError:!!e.isError}:null}function ws(e){for(var t=[],r=e||[],n=Math.max(0,r.length-24),a=n;a<r.length;a++){var s=qu(r[a]);s&&t.push(s)}return t}function xs(e){for(var t=[],r=e||[],n=0;n<r.length;n++){var a=ju(r[n]);a&&t.push(a)}return t}function Uu(e){for(var t=e||[],r=0;r<t.length;r++)if(t[r]&&t[r].role==="user"&&u(t[r].text||""))return ve(u(t[r].text||""),34);for(var n=0;n<t.length;n++)if(t[n]&&u(t[n].text||""))return ve(u(t[n].text||""),34);return"New chat"}function rl(e){return!e||!e.id?null:{id:e.id,title:u(e.title||""),scope:e.scope==="selection"?"selection":"document",updatedAt:e.updatedAt||0,messageCount:e.messageCount||0,exchangeCount:e.exchangeCount||0,messages:ws(e.messages||[])}}function Cs(e){return!e||!e.sessionId||!e.messages||!e.messages.length?null:{id:e.sessionId,title:Uu(e.messages),scope:e.scope==="selection"?"selection":"document",updatedAt:new Date().getTime(),messageCount:e.messages.length,exchangeCount:Ii(e.messages),messages:ws(e.messages)}}function nl(e){for(var t={version:"2026-05-31",activeSessionId:e&&e.activeSessionId?e.activeSessionId:"",sessions:[]},r=e&&e.sessions?e.sessions:[],n=0;n<r.length;n++){var a=rl(r[n]);a&&t.sessions.push(a)}return t.sessions.sort(function(s,l){return(l.updatedAt||0)-(s.updatedAt||0)}),t.sessions.length>6&&(t.sessions=t.sessions.slice(0,6)),t}function Xi(){if(!i.__aiChatSessionStore){var e=null,t=tl();if(t&&window.localStorage)try{e=JSON.parse(window.localStorage.getItem(t)||"null")}catch{}i.__aiChatSessionStore=nl(e||{})}return i.__aiChatSessionStore}function ks(){var e=tl();if(i.__aiChatSessionStore=nl(Xi()),e&&window.localStorage)try{window.localStorage.setItem(e,JSON.stringify(i.__aiChatSessionStore))}catch{}return i.__aiChatSessionStore}function Yi(e){if(!e)return!1;var t=Xi(),r=[],n=Cs(e);n&&r.push(n);for(var a=0;a<t.sessions.length;a++){var s=t.sessions[a];!s||s.id===e.sessionId||r.push(s)}return t.activeSessionId=e.sessionId||t.activeSessionId||"",t.sessions=r,ks(),!0}function Bu(e){e=e||{};for(var t=parseInt(e.maxCount,10),r=_s(sn(),t>0?t:6),n=[],a=0;a<r.length;a++){var s=rl(r[a]);s&&(s.active=s.id===sn().sessionId,e.includeMessages!==!0&&delete s.messages,n.push(s))}return n}function zu(e,t){t=t||{};var r=Ss(sn(),e,t.statusText||"Loaded a recent AI chat.");return r&&Ta()&&Or(t.focusComposer!==!1),r}function Fu(e){e=e||{};var t=tl();if(i.__aiChatSessionStore=nl({}),t&&window.localStorage)try{window.localStorage.removeItem(t)}catch{}var r=sn();return r.messages=[],r.draft="",r.busy=!1,r.status=e.statusText||"Cleared AI chat history.",r.sessionVersion=(r.sessionVersion||0)+1,r.sessionId=el(),Xi().activeSessionId=r.sessionId,ks(),Ta()&&Or(e.focusComposer===!0),!0}function _s(e,t){var r=Xi(),n=r.sessions.slice(),a=Cs(e),s={},l=[],d=t||4;a&&(l.push(a),s[a.id]=!0);for(var m=0;m<n.length&&l.length<d;m++)!n[m]||s[n[m].id]||(l.push(rl(n[m])),s[n[m].id]=!0);return l}function Ss(e,t,r){if(!e||!t)return!1;for(var n=Xi(),a=null,s=0;s<n.sessions.length;s++)if(n.sessions[s]&&n.sessions[s].id===t){a=n.sessions[s];break}return a?(e.sessionId=a.id,e.messages=xs(a.messages||[]),e.draft="",e.scope=a.scope==="selection"?"selection":"document",e.busy=!1,e.status=r||"Loaded a recent AI chat.",e.sessionVersion=(e.sessionVersion||0)+1,Yi(e),!0):!1}function sn(){if(!i.__aiChatState){for(var e=Le(),t=Xi(),r=null,n=0;n<t.sessions.length;n++)if(t.sessions[n]&&t.sessions[n].id===t.activeSessionId){r=t.sessions[n];break}!r&&t.activeSessionId?i.__aiChatState={messages:[],draft:"",scope:e.hasSelection?"selection":"document",busy:!1,status:"",sessionVersion:0,sessionId:t.activeSessionId}:!r&&t.sessions.length&&(r=t.sessions[0]),i.__aiChatState||(i.__aiChatState=r?{messages:xs(r.messages||[]),draft:"",scope:r.scope==="selection"?"selection":"document",busy:!1,status:"",sessionVersion:0,sessionId:r.id}:{messages:[],draft:"",scope:e.hasSelection?"selection":"document",busy:!1,status:"",sessionVersion:0,sessionId:el()})}return i.__aiChatState}function Gu(e,t){e&&(e.messages=[],e.draft="",e.busy=!1,e.status=t||"",e.sessionVersion=(e.sessionVersion||0)+1,e.sessionId=el(),Yi(e))}function Sa(){var e=sn(),t=Le(),r=e.scope==="selection"&&t.hasSelection?"selection":"document",n=r==="selection"&&t.text||t.wholeText;return{scope:r,snapshot:t,source:n,summary:ve(n,180)||"The document is currently empty."}}function Vu(){var e=document.activeElement;!e||e===document.body||e===document.documentElement||i.__aiChatPanel&&i.__aiChatPanel.contains&&i.__aiChatPanel.contains(e)||typeof e.focus=="function"&&(i.__aiChatReturnFocusNode=e)}function Ku(e){if(e&&e.isConnected!==!1&&typeof e.focus=="function"&&!e.disabled){try{e.focus({preventScroll:!0})}catch{try{e.focus()}catch{}}if(document.activeElement===e)return!0}if(i&&typeof i.focus=="function")try{return i.focus(),!0}catch{}return!1}function Zi(e){e=e||{};var t=i.__aiChatReturnFocusNode||null;i.__aiChatPanel&&i.__aiChatPanel.parentNode&&i.__aiChatPanel.parentNode.removeChild(i.__aiChatPanel),i.__aiChatShell&&i.__aiChatShell.classList&&i.__aiChatShell.classList.remove("rte-ai-chat-host"),i.__aiChatShell&&i.__aiChatShell.style&&(i.__aiChatShell.style.minHeight=typeof i.__aiChatOriginalMinHeight=="string"?i.__aiChatOriginalMinHeight:""),i.__aiChatPanel=null,i.__aiChatShell=null,i.__aiChatOriginalMinHeight=null,e.preserveReturnFocus||(i.__aiChatReturnFocusNode=null),e.restoreFocus&&Ku(t)}function Wu(e){if(!e||!e.contains||!document.activeElement||!e.contains(document.activeElement))return null;var t=document.activeElement;if(t.classList&&t.classList.contains("rte-ai-chat-input"))return{kind:"composer"};var r=t.getAttribute("data-rte-ai-chat-header-action");if(r)return{kind:"header-action",value:r};var n=t.getAttribute("data-rte-ai-chat-scope-target");if(n)return{kind:"scope",value:n};var a=t.getAttribute("data-rte-ai-chat-prompt-id");if(a)return{kind:"quick",value:a};var s=t.getAttribute("data-rte-ai-chat-session-id");if(s)return{kind:"session",value:s};var l=t.getAttribute("data-rte-ai-chat-action");if(l){if(t.closest&&t.closest(".rte-ai-chat-composer-actions"))return{kind:"composer-action",value:l};var d=t.closest?t.closest(".rte-ai-chat-message"):null;if(d)return{kind:"message-action",value:l,exchangeIndex:d.getAttribute("data-rte-ai-chat-exchange-index")||"",threadRole:d.getAttribute("data-rte-ai-chat-thread-role")||""}}return t===e?{kind:"panel"}:null}function Ju(e,t){if(!e||!t||!t.kind)return null;var r=0,n;switch(t.kind){case"composer":return e.querySelector(".rte-ai-chat-input");case"panel":return e;case"header-action":for(n=e.querySelectorAll("[data-rte-ai-chat-header-action]"),r=0;r<n.length;r++)if((n[r].getAttribute("data-rte-ai-chat-header-action")||"")===t.value)return n[r];return null;case"scope":for(n=e.querySelectorAll("[data-rte-ai-chat-scope-target]"),r=0;r<n.length;r++)if((n[r].getAttribute("data-rte-ai-chat-scope-target")||"")===t.value)return n[r];return null;case"quick":for(n=e.querySelectorAll("[data-rte-ai-chat-prompt-id]"),r=0;r<n.length;r++)if((n[r].getAttribute("data-rte-ai-chat-prompt-id")||"")===t.value)return n[r];return null;case"session":for(n=e.querySelectorAll("[data-rte-ai-chat-session-id]"),r=0;r<n.length;r++)if((n[r].getAttribute("data-rte-ai-chat-session-id")||"")===t.value)return n[r];return null;case"composer-action":for(n=e.querySelectorAll(".rte-ai-chat-composer-actions [data-rte-ai-chat-action]"),r=0;r<n.length;r++)if((n[r].getAttribute("data-rte-ai-chat-action")||"")===t.value)return n[r];return null;case"message-action":for(n=e.querySelectorAll(".rte-ai-chat-message [data-rte-ai-chat-action]"),r=0;r<n.length;r++){var a=n[r].closest?n[r].closest(".rte-ai-chat-message"):null;if(a&&(n[r].getAttribute("data-rte-ai-chat-action")||"")===t.value&&(a.getAttribute("data-rte-ai-chat-exchange-index")||"")===(t.exchangeIndex||"")&&(a.getAttribute("data-rte-ai-chat-thread-role")||"")===(t.threadRole||""))return n[r]}return null;default:return null}}function Qu(e,t){var r=Ju(e,t);if(!r||r.disabled)return!1;try{r.focus({preventScroll:!0})}catch{try{r.focus()}catch{return!1}}return document.activeElement===r}function $u(e){if(!e||!e.querySelector)return null;var t=e.querySelector(".rte-ai-chat-feed");if(!t||typeof t.scrollTop>"u")return null;var r=Math.max(0,(t.scrollHeight||0)-(t.clientHeight||0)),n=Math.max(0,t.scrollTop||0);return{scrollTop:n,stickToBottom:r<=0||r-n<=24}}function Xu(e,t){if(!e||!t||typeof e.scrollTop>"u")return!1;if(t.stickToBottom)return e.scrollTop=e.scrollHeight,!0;var r=Math.max(0,(e.scrollHeight||0)-(e.clientHeight||0));return e.scrollTop=Math.max(0,Math.min(t.scrollTop||0,r)),!0}function Ta(){return!!(i.__aiChatPanel&&i.__aiChatPanel.isConnected)}function ea(e){return e=e||{},ei(),Ta()||Vu(),Or(!!e.focusComposer)}function Yu(e){return i.__aiChatPanel&&i.__aiChatPanel.isConnected?(Zi({restoreFocus:!0}),!1):ea(e)}function il(e){var t=sn(),r=u(e||t.draft);if(!r||t.busy)return!1;var n=Sa();t.scope=n.scope,t.draft="",t.busy=!0,t.status=n.scope==="selection"?"Thinking about the current selection...":"Thinking about the current document...";var a=t.sessionVersion||0;return t.messages.push({role:"user",text:r,scope:n.scope,snapshot:n.snapshot,timestamp:new Date().getTime()}),Yi(t),Or(!1),Ue("chat-panel",{snapshot:n.snapshot,source:n.source,prompt:r,mode:"chat",scope:n.scope}).then(function(s){(t.sessionVersion||0)===a&&(t.busy=!1,t.status=s&&s.operations&&s.operations.length?"AI response ready. Preview or apply the suggested change from the chat.":"AI response ready.",t.messages.push({role:"assistant",text:s&&(s.message||s.result)?s.message||s.result:"No response returned.",scope:n.scope,resolved:s,snapshot:n.snapshot,timestamp:new Date().getTime()}),Yi(t),Ta()&&Or(!1))}).catch(function(s){console.error("AI chat failed",s),(t.sessionVersion||0)===a&&(t.busy=!1,t.status="AI chat failed.",t.messages.push({role:"assistant",text:"I could not finish that request. Try again or shorten the prompt.",scope:n.scope,isError:!0,timestamp:new Date().getTime()}),Yi(t),Ta()&&Or(!1))}),!0}function Aa(e,t){if(!e||!e.resolved)return!1;var r=Le(),n=e.resolved,a=nr(n),s=!1,l={preview:!0,selection:!0};if(l[t]&&!r.hasSelection)return sn().status=t==="preview"?"Select text before previewing this chat suggestion inline.":"Select text before replacing selection from chat.",Or(!1),!1;if(t==="plan"&&n&&n.operations&&n.operations.length)for(var d=0;d<n.operations.length;d++){var m=n.operations[d];if(m&&(m.type==="preview-suggestion"||m.type==="replace-selection")&&!r.hasSelection)return sn().status="Select text before applying this selection-based chat suggestion.",Or(!1),!1}if(t==="plan")s=wn(n,{snapshot:r});else if(a)if(t==="preview"){var R=Xr(a,"selection-preview",n,n.request||null,n.action||null);R&&R.operations&&R.operations[0]&&!R.operations[0].reason&&(R.operations[0].reason=Vr(n)),s=wn(R,{snapshot:r})}else t==="selection"?s=wn(Xr(a,"selection",n,n.request||null,n.action||null),{snapshot:r}):t==="insert"?s=wn(Xr(a,"insert",n,n.request||null,n.action||null),{snapshot:r}):t==="document"&&(s=wn(Xr(a,"document",n,n.request||null,n.action||null),{snapshot:r}));return s&&(sn().status=t==="preview"?"Previewed the AI suggestion inline from chat.":"Applied the AI chat suggestion.",Or(!1)),s}function Ts(e){var t=u(e||"");return t?navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then(function(){return!0}).catch(function(){return As(t)}):Promise.resolve(As(t)):Promise.resolve(!1)}function As(e){if(!document||!document.body||!document.createElement)return!1;var t=document.activeElement&&document.activeElement!==document.body?document.activeElement:null,r=null,n=null;t&&typeof t.selectionStart=="number"&&typeof t.selectionEnd=="number"&&(r=t.selectionStart,n=t.selectionEnd);var a=document.createElement("textarea");a.value=e,a.setAttribute("readonly","readonly"),a.style.position="fixed",a.style.opacity="0",a.style.pointerEvents="none",a.style.left="-9999px",a.style.top="0",document.body.appendChild(a),a.focus(),a.select();var s=!1;try{s=!!document.execCommand("copy")}catch{s=!1}if(document.body.removeChild(a),t&&t.focus&&t.isConnected!==!1){try{t.focus({preventScroll:!0})}catch{try{t.focus()}catch{}}if(r!==null&&n!==null&&t.setSelectionRange)try{t.setSelectionRange(r,n)}catch{}}return s}function Zu(e){return Ts(e&&e.text?e.text:"").then(function(t){var r=sn();return r.status=t?"Copied the AI response.":"Could not copy the AI response.",Or(!1),t})}function Es(e){return e&&e.isError?"Issue":e&&e.role==="user"?"You":"AI"}function ed(e){return e==="request"?"Request":e==="response"?"Response":""}function Pi(e){return e&&e.scope==="selection"?"Selection":"Document"}function td(e){if(!e)return"";if(e.isError)return"Needs retry";if(e.role==="user")return"Prompt";var t=e.resolved||null,r=t&&t.operations?t.operations:[],n=t?nr(t):"";return r.length?"Reviewable change":n?"Draft":"Answer"}function yf(e){if(!e)return"";var t=Pi(e).toLowerCase();if(e.isError)return"This request hit an issue. Try again or adjust the prompt.";if(e.role==="user")return"Sent with "+t+" context.";var r=e.resolved||null,n=r&&r.operations?r.operations:[],a=r?nr(r):"";return n.length?"Ready for preview, apply, or insert from the "+t+" context.":a?"Drafted from the "+t+" context.":"Response grounded in the "+t+" context."}function rd(e){if(!e||e.isError||!e.snapshot)return null;var t=e.scope==="selection"?e.snapshot.text||e.snapshot.wholeText||"":e.snapshot.wholeText||"";if(t=u(t||""),!t)return null;var r=Os(t);return{title:e.scope==="selection"?"Using current selection":"Using current document",scopeLabel:e.scope==="selection"?"Selection context":"Document context",wordLabel:mo(t)+" words",paragraphLabel:r>1?r+" paragraphs":"",copy:er(t,180)}}function wf(e){if(!e)return"";var t=[];return e.title&&t.push(e.title),e.scopeLabel&&t.push(e.scopeLabel),e.wordLabel&&t.push(e.wordLabel),e.paragraphLabel&&t.push(e.paragraphLabel),e.copy&&t.push(e.copy),t.join(". ")}function Ls(e){if(!e)return"";if(e.isError)return"Reply needs retry";if(e.role==="user")return"Prompt sent";var t=e.resolved||null,r=t&&t.operations?t.operations:[],n=t?nr(t):"";return r.length?"Reviewable change prepared":n?"Draft prepared":"Answer ready"}function al(e){if(!e)return"";var t=Pi(e).toLowerCase();if(e.isError)return"This "+t+" request hit an issue. Adjust the prompt or try again.";if(e.role==="user")return"Waiting on AI for the current "+t+" context.";var r=e.resolved||null,n=r&&r.operations?r.operations:[],a=r?nr(r):"";return n.length?"Preview, replace, or insert this "+t+" change from the latest reply.":a?"Reuse or adapt this drafted "+t+" response.":"Read the answer grounded in the current "+t+" context."}function ta(e,t){for(var r=e&&e.resolved?e.resolved:null,n=r&&r.operations?r.operations:[],a=r?nr(r):"",s=t&&typeof t.hasSelection=="boolean"?!!t.hasSelection:!!(e&&e.snapshot&&e.snapshot.hasSelection),l=!1,d=0;d<n.length;d++){var m=n[d];if(m&&(m.type==="preview-suggestion"||m.type==="replace-selection")){l=!0;break}}return{operations:n,resultText:a,hasSelection:s,selectionDependentPlan:l,canApplyPlan:!!n.length&&(!l||s),canPreview:!!a&&s,canReplaceSelection:!!a&&s,canInsert:!!a,canReplaceDocument:!!a&&!s}}function Ea(e,t){if(!e||!e.resolved)return null;var r=ta(e,t);return r.operations.length&&r.canPreview?{title:"Best next step: Preview",detail:"Check the inline diff first, then replace the selection or apply the prepared plan if it looks right."}:r.operations.length&&r.canApplyPlan?{title:"Best next step: Apply the prepared plan",detail:"Run the structured change directly or use the insert and document actions below if you want a different handoff."}:r.operations.length&&r.canInsert?{title:"Best next step: Insert below",detail:"Select text to preview or replace this change inline, or insert the prepared draft below the current content."}:r.resultText&&r.canReplaceSelection?{title:"Best next step: Replace or preview",detail:"Use the prepared draft to preview inline, replace the selection, or insert a follow-up below."}:r.resultText?{title:"Best next step: Reuse this draft",detail:"Insert the draft below or replace the full document, depending on how broad the change should be."}:null}function ra(e,t){if(!e||!e.resolved)return"";var r=ta(e,t);return r.operations.length&&r.canPreview?"preview":r.operations.length&&r.canApplyPlan?"apply":r.operations.length&&r.canInsert?"insert":r.resultText&&r.canReplaceSelection?"selection":r.resultText&&r.canInsert?"insert":""}function Yn(e){return e==="preview"?"Preview":e==="apply"?"Apply":e==="selection"?"Replace selection":e==="insert"?"Insert below":e==="document"?"Replace document":""}function nd(e){return e==="copy"?"Copy text":Yn(e)}function Rs(e,t,r){var n=ta(t,r);return e==="copy"?"Copy this prepared AI reply without changing the document.":e==="apply"?"Run the prepared plan directly in the editor.":e==="preview"?n.hasSelection?"Show this change inline in the editor before deciding it.":"Select text to preview this change inline in the editor.":e==="selection"?n.hasSelection?"Replace the current selection with this prepared draft.":"Select text before replacing selection with this prepared draft.":e==="insert"?n.hasSelection?"Insert this prepared draft below the current selection.":"Insert this prepared draft below the current content.":e==="document"?"Replace the full document with this prepared draft.":""}function na(e,t,r,n,a){if(e){var s=nd(t)||(e.innerText||e.textContent||"").replace(/\s+/g," ").trim()||"Action",l=Rs(t,r,a),d=!!(t&&n&&t===n),m=[s];l&&m.push(l),d&&m.push("Recommended next step."),e.setAttribute("aria-label",m.join(". ")),e.title=l?s+" - "+l+(d?" Recommended next step.":""):s+(d?" - Recommended next step.":"")}}function po(e){return e==="apply"||e==="preview"||e==="selection"?"primary":e==="insert"||e==="document"?"secondary":""}function id(e,t,r,n){if(e==="utility")return"Copy this prepared reply without changing the document.";if(!t||!t.resolved)return"";var a=ta(t,n);if(e==="primary")return r==="preview"?"Check the inline diff first, then apply or replace the selection from this group.":r==="apply"?"Run the prepared plan directly, or switch to the document handoff actions below if you want a different outcome.":r==="selection"?"Replace the selection first, or preview the inline diff before writing this change back.":a.operations.length?"Run the prepared plan directly from this group.":a.resultText&&a.hasSelection?"Preview the draft or write it back into the current selection from this group.":"Use this group to preview or apply the prepared change.";if(e==="secondary"){if(a.resultText&&a.hasSelection)return"Insert this prepared draft below the selection when you want a follow-up instead of a replacement.";if(r==="insert")return"Insert this draft below first, or replace the full document if the whole page should change.";if(r==="document")return"Replace the full document, or insert this draft below if you want a lighter handoff.";if(a.resultText)return"Insert this prepared draft below or replace the full document without opening inline review."}return""}function ad(e,t,r){var n=po(r);if(n&&e===n)return"Recommended next step";if(e==="utility")return"Copy only";if(!t||!t.resolved)return e==="primary"?"Preview and apply":e==="secondary"?"Other ways to use":"";var a=t.resolved||null,s=a&&a.operations?a.operations:[],l=a?nr(a):"";if(e==="primary")return s.length?"Apply in editor":l?"Use this draft":"Preview and apply";if(e==="secondary"){if(s.length)return"Other ways to apply";if(l)return"Other ways to use this draft"}return""}function vo(e,t,r,n){var a={title:"",badge:"",recommended:!1,detail:""};a.title=ad(e,r,t);var s=po(t);return s&&e===s&&(a.badge=Yn(t),a.recommended=!!a.badge),a.detail=id(e,r,t,n),a}function ol(e,t,r){if(!e||!t||!e.getElementsByTagName("button").length)return null;e.setAttribute("data-rte-ai-chat-group-key",r||""),t.recommended&&e.setAttribute("data-rte-ai-chat-group-recommended","true");var n="rte-ai-chat-message-action-group-header";t.recommended&&(n+=" is-recommended");var a=o(e,"div","",n);if(o(a,"div","","rte-ai-chat-message-action-group-title",t.title||""),t.badge&&o(a,"span","","rte-ai-chat-message-action-group-badge",t.badge),e.firstChild!==a&&e.insertBefore(a,e.firstChild),t.detail){var s=o(e,"div","","rte-ai-chat-message-action-group-detail",t.detail);a.nextSibling!==s&&e.insertBefore(s,a.nextSibling)}return a}function od(e,t){if(!(!e||!e.querySelectorAll)){var r=po(t),n=e.querySelectorAll(".rte-ai-chat-message-action-group");if(!(!n||!n.length)){for(var a={},s=0;s<n.length;s++){var l=n[s],d=l.getAttribute("data-rte-ai-chat-group-key")||"";d&&(a[d]=l)}var m=[];r&&m.push(r);for(var R=["primary","secondary","utility"],Q=0;Q<R.length;Q++)m.indexOf(R[Q])===-1&&m.push(R[Q]);for(var ie=0;ie<m.length;ie++)a[m[ie]]&&e.appendChild(a[m[ie]])}}}function ld(e,t){if(!(!e||!t||!e.querySelector)){var r=po(t);if(r){var n=e.querySelector('.rte-ai-chat-message-action-group[data-rte-ai-chat-group-key="'+r+'"]');if(!(!n||!n.querySelector)){var a=n.querySelector('.rte-ai-chat-action-button[data-rte-ai-chat-action="'+t+'"]');if(a){var s=n.querySelector(".rte-ai-chat-message-action-group-header"),l=n.querySelector(".rte-ai-chat-action-button");if(!(!l||l===a)){if(s&&s.nextSibling){n.insertBefore(a,s.nextSibling);return}n.insertBefore(a,l)}}}}}}function sd(e,t){if(!e)return"";var r=[];t&&t.title&&r.push(t.title+" group"),t&&t.recommended&&t.badge&&r.push(t.badge+" recommended"),t&&t.detail&&r.push(t.detail);for(var n=e.querySelectorAll?e.querySelectorAll(".rte-ai-chat-action-button"):[],a=[],s=0;s<n.length;s++){var l=(n[s].innerText||n[s].textContent||"").replace(/\s+/g," ").trim();l&&a.push(l)}return a.length&&r.push("Actions: "+a.join(", ")),r.join(". ")}function cd(e,t,r,n){if(!(!e||!e.querySelectorAll)){var a=Yn(t);e.setAttribute("role","group"),e.setAttribute("aria-label",a?"AI chat actions. Recommended next step: "+a+".":"AI chat actions");for(var s=e.querySelectorAll(".rte-ai-chat-message-action-group"),l=0;l<s.length;l++){var d=s[l],m=d.getAttribute("data-rte-ai-chat-group-key")||"",R=d.querySelector?d.querySelector(".rte-ai-chat-action-button"):null,Q=vo(m,t,r,n);if(!R){d.removeAttribute("role"),d.removeAttribute("aria-label");continue}d.setAttribute("role","group");var ie=sd(d,Q);ie?d.setAttribute("aria-label",ie):d.removeAttribute("aria-label")}}}function Ds(e){return!e||!e.snapshot?"":e.scope==="selection"?e.snapshot.text||e.snapshot.wholeText||"":e.snapshot.wholeText||""}function ud(e){return er(Ds(e),120)}function La(e){if(!e||!e.resolved)return null;var t=e.resolved.request&&e.resolved.request.mode?Z(e.resolved.request.mode):"";return wa({originalText:Ds(e),resultText:nr(e.resolved),suggestionType:t,snapshot:e.snapshot||null,scope:e.scope||""})}function dd(e,t){if(!e||!e.resolved)return null;var r=er(nr(e.resolved),120);if(!r)return null;var n=ud(e),a=e.resolved.operations||[],s=a.length?Lt(a[0]):null,l=a.length,d=s&&s.title?s.title:e.scope==="selection"?"Selection draft":"Document draft",m=ra(e,t),R=Ea(e,t),Q=vd(e,m,t),ie=La(e);return{title:s&&s.title?s.title:"Prepared draft",sourceText:n,resultText:r,reasonText:er(Vr(e.resolved),110),statusLabel:l?"Ready to review":"Draft ready",scopeLabel:e.scope==="selection"?"Selection draft":"Document draft",stepLabel:(l||1)+" step"+((l||1)===1?"":"s"),targetLabel:d,diffParts:n&&n!==r?lo(n,r):null,changeGlance:ie,planLeadTitle:R?"Best next step":"",planLeadLabel:m?Yn(m):"",planLeadDetail:R?R.detail:"",planItems:Q.slice(0,3),planFollowupTitle:fd(e,Q),hiddenPlanCount:Math.max(0,Q.length-3)}}function fd(e,t){if(!t||!t.length)return"";var r=e&&e.resolved?e.resolved:null,n=r&&r.operations?r.operations:[];return n.length?"Other ways to apply this change":"Other ways to use this draft"}function pd(e,t,r){if(!t)return null;var n=Yn(t);return n?{label:n,detail:Rs(t,e,r)}:null}function xf(e){if(!e)return"";var t=[];return e.label&&t.push(e.label),e.detail&&t.push(e.detail),t.join(". ")}function vd(e,t,r){if(!e||!e.resolved)return[];var n=ta(e,r),a=[];n.canApplyPlan&&a.push("apply"),n.canPreview&&a.push("preview"),n.canReplaceSelection&&a.push("selection"),n.canInsert&&a.push("insert"),n.canReplaceDocument&&a.push("document");for(var s=[],l=0;l<a.length;l++){var d=a[l];if(!(!d||d===t)){var m=pd(e,d,r);if(!(!m||!m.label)){for(var R=!1,Q=0;Q<s.length;Q++)if(s[Q]&&s[Q].label===m.label){R=!0;break}R||s.push(m)}}}return s}function Cf(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.statusLabel&&t.push(e.statusLabel),e.scopeLabel&&t.push(e.scopeLabel),e.stepLabel&&t.push(e.stepLabel),e.targetLabel&&t.push(e.targetLabel),t.push("Proposed edit"),t.push("Current and suggested text"),e.sourceText&&e.sourceText!==e.resultText&&(t.push("Current"),t.push(e.sourceText)),t.push("Suggested"),t.push(e.resultText),e.reasonText&&(t.push("Why this change"),t.push(e.reasonText)),e.changeGlance){if(e.changeGlance.title&&t.push(e.changeGlance.title),e.changeGlance.pills&&e.changeGlance.pills.length)for(var r=0;r<e.changeGlance.pills.length;r++)e.changeGlance.pills[r]&&e.changeGlance.pills[r].text&&t.push(e.changeGlance.pills[r].text);e.changeGlance.detail&&t.push(e.changeGlance.detail)}if(e.planLeadTitle||e.planLeadLabel||e.planLeadDetail||e.planItems&&e.planItems.length){if(t.push("What happens next"),e.planLeadTitle&&t.push(e.planLeadTitle),e.planLeadLabel&&t.push(e.planLeadLabel),e.planLeadDetail&&t.push(e.planLeadDetail),e.planFollowupTitle&&t.push(e.planFollowupTitle),e.planItems&&e.planItems.length)for(var n=0;n<e.planItems.length;n++){var a=e.planItems[n];a&&(a.label&&t.push(a.label),a.detail&&t.push(a.detail))}e.hiddenPlanCount&&t.push("+"+e.hiddenPlanCount+" more")}return t.join(". ")}function ho(e){var t=u(e||"");return t?t.length<=92?t:t.substring(0,89).replace(/\s+\S*$/,"")+"...":""}function ll(e){var t=e&&e.id?String(e.id).toLowerCase():"",r=e&&e.label?String(e.label).toLowerCase():"",n=e&&e.prompt?String(e.prompt).toLowerCase():"",a=t+" "+r+" "+n;return/translate|spanish|french|german|italian|portuguese|japanese/.test(a)?"Language":/proofread|review|cleaner|grammar/.test(a)?"Review":/heading|title|subheading|structure/.test(a)?"Structure":/expand|supporting paragraph|detail/.test(a)?"Expand":/summarize|summary/.test(a)?"Summary":"Starter"}function hd(e){var t=ll(e).toLowerCase().replace(/[^a-z0-9]+/g,"-");return t||"starter"}function Ps(e){if(!e||!e.text)return"Custom";var t=ll({prompt:e.text||""});return t==="Starter"?"Custom":t}function Ms(e){return Ps(e)+" request"}function gd(e,t){if(!e||!e.length||typeof t!="number")return null;for(var r=t-1;r>=0;r--)if(e[r]&&e[r].role==="user"&&!e[r].isError)return e[r];return null}function md(e,t){var r=gd(e,t);return r?{title:"Responding to "+Ms(r),scopeLabel:Pi(r),detail:"Latest user turn",promptText:r.text||""}:null}function kf(e,t,r){if(!e||e.isError||e.role!=="user")return"";var n=["What you asked"],a=Ms(e);a&&n.push(a);var s=Pi(e);s&&n.push(s);var l=Da(t,r);return l&&n.push(l),e.text&&n.push(e.text),n.join(". ")}function _f(e,t){if(!e)return"";var r=[];return e.title&&r.push(e.title),e.scopeLabel&&r.push(e.scopeLabel),e.detail&&r.push(e.detail),t&&r.push(t),e.promptText&&r.push(e.promptText),r.join(". ")}function bd(e,t,r){if(!e||typeof t!="number"||!e[t])return"";var n=e[t],a=[],s=Es(n),l=ed(Mi(e,t)),d=Pi(n),m=td(n),R=Da(e,t),Q=Ls(n),ie=al(n);if(s&&a.push(s),a.push("Turn "+(t+1)),l&&a.push(l),d&&a.push(d),m&&a.push(m),R&&a.push(R),go(e,t)&&a.push("Current exchange"),Q&&a.push(Q),ie&&a.push(ie),n.role==="user"&&!n.isError){a.push("What you asked"),n.text&&a.push(ho(n.text)||n.text);var ae=rd(n);ae&&(ae.title&&a.push(ae.title),ae.wordLabel&&a.push(ae.wordLabel),ae.paragraphLabel&&a.push(ae.paragraphLabel))}else if(n.role==="assistant"&&!n.isError){var oe=md(e,t);oe&&oe.title&&a.push(oe.title),oe&&oe.promptText&&a.push(ho(oe.promptText)||oe.promptText);var te=Ea(n,r);te&&te.title&&a.push(te.title)}return a.join(". ")}function Sf(e){if(!e)return"";var t=[],r=e.isError?"Conversation issue":e.role==="user"?"User prompt":"Assistant response",n=Ls(e),a=al(e);return r&&t.push(r),n&&t.push(n),a&&t.push(a),t.join(". ")}function Mi(e,t){if(!e||typeof t!="number"||!e[t])return"";var r=e[t];if(r.isError)return"";if(r.role==="user"){var n=e[t+1];if(n&&n.role==="assistant"&&!n.isError)return"request"}if(r.role==="assistant"){var a=e[t-1];if(a&&a.role==="user"&&!a.isError)return"response"}return""}function Ra(e,t){if(!e||typeof t!="number"||t<0)return 0;for(var r=0,n=0;n<=t;n++)e[n]&&e[n].role==="user"&&!e[n].isError&&r++;return r}function Da(e,t){var r=Ra(e,t);return r?"Exchange "+r:""}function go(e,t){var r=Ra(e,t),n=Ii(e);return!!r&&r===n}function Is(e,t){if(!e||!e.length||typeof t!="number"||!e[t])return-1;var r=e[t];if(r.isError||r.role!=="user"||Mi(e,t)!=="request")return-1;for(var n=Ra(e,t),a=t+1;a<e.length;a++)if(!(!e[a]||e[a].isError)){if(e[a].role==="user")break;if(e[a].role==="assistant"&&Mi(e,a)==="response"&&Ra(e,a)===n)return a}return-1}function Ns(e,t,r){if(!e||typeof t!="number"||!e[t])return null;var n=e[t];if(n.isError||n.role!=="user"||Mi(e,t)!=="request")return null;var a=Is(e,t),s=a>=0?e[a]:null,l=Ps(n),d="",m=null,R=[];if(s&&s.role==="assistant"&&!s.isError){var Q=ra(s,r);d=Yn(Q),m=La(s),d&&R.push(d+" is the recommended next step."),m&&m.detail&&R.push(m.detail)}return{title:(l==="Custom"?"Custom":l)+" exchange",exchangeLabel:Da(e,t),scopeLabel:Pi(n),statusLabel:s&&s.role==="assistant"&&!s.isError?"Reply linked":"Waiting on reply",actionLabel:d,changeGlance:m,detail:R.join(" "),isCurrent:go(e,t)}}function Tf(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.exchangeLabel&&t.push(e.exchangeLabel),e.scopeLabel&&t.push(e.scopeLabel),e.statusLabel&&t.push(e.statusLabel),e.actionLabel&&(t.push("Best next step"),t.push(e.actionLabel)),e.changeGlance){if(t.push(e.changeGlance.title||"Change at a glance"),e.changeGlance.pills&&e.changeGlance.pills.length)for(var r=0;r<e.changeGlance.pills.length;r++)e.changeGlance.pills[r]&&e.changeGlance.pills[r].text&&t.push(e.changeGlance.pills[r].text);e.changeGlance.detail&&t.push(e.changeGlance.detail)}return e.isCurrent&&t.push("Current exchange"),e.detail&&t.push(e.detail),t.join(". ")}function yd(e,t,r){if(!e||typeof t!="number"||!e[t])return"";var n=e[t];if(n.isError||n.role!=="user"||Mi(e,t)!=="request")return"";var a=Ns(e,t,r),s=Is(e,t),l=s>=0?Hs(e,s,r):null,d=["AI chat exchange"];if(a&&a.exchangeLabel&&d.push(a.exchangeLabel),a&&a.title&&d.push(a.title),a&&a.scopeLabel&&d.push(a.scopeLabel+" thread"),n.text&&(d.push("Request"),d.push(ho(n.text))),l){if(l.statusLabel&&d.push(l.statusLabel),l.actionLabel&&(d.push("Best next step"),d.push(l.actionLabel)),l.changeGlance){if(d.push(l.changeGlance.title||"Change at a glance"),l.changeGlance.pills&&l.changeGlance.pills.length)for(var m=0;m<l.changeGlance.pills.length;m++)l.changeGlance.pills[m]&&l.changeGlance.pills[m].text&&d.push(l.changeGlance.pills[m].text);l.changeGlance.detail&&d.push(l.changeGlance.detail)}}else a&&a.statusLabel&&d.push(a.statusLabel);return a&&a.isCurrent&&d.push("Current exchange"),d.join(". ")}function Hs(e,t,r){if(!e||typeof t!="number"||!e[t])return null;var n=e[t];if(n.isError||n.role!=="assistant"||Mi(e,t)!=="response")return null;var a=n.resolved||null,s=a&&a.operations?a.operations:[],l=a?nr(a):"",d=ra(n,r),m=s.length?s.length:l?1:0,R=La(n),Q=[];R&&R.detail&&Q.push(R.detail);var ie=(Ea(n,r)||{}).detail||al(n);ie&&Q.push(ie);var ae="Reply ready";return s.length?ae="Ready to review":l&&(ae="Draft ready"),{title:"Exchange outcome",detail:Q.join(" "),exchangeLabel:Da(e,t),scopeLabel:Pi(n),statusLabel:ae,stepLabel:m?m+" step"+(m===1?"":"s"):"",actionLabel:Yn(d),changeGlance:R,isCurrent:go(e,t)}}function Af(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.exchangeLabel&&t.push(e.exchangeLabel),e.statusLabel&&t.push(e.statusLabel),e.scopeLabel&&t.push(e.scopeLabel),e.stepLabel&&t.push(e.stepLabel),e.actionLabel&&t.push(e.actionLabel),e.changeGlance&&(t.push(e.changeGlance.title||"Change at a glance"),e.changeGlance.pills&&e.changeGlance.pills.length))for(var r=0;r<e.changeGlance.pills.length;r++)e.changeGlance.pills[r]&&e.changeGlance.pills[r].text&&t.push(e.changeGlance.pills[r].text);return e.isCurrent&&t.push("Current exchange"),e.detail&&t.push(e.detail),t.join(". ")}function mo(e){var t=u(e||"");return t?t.split(/\s+/).length:0}function Os(e){var t=u(e||"");return t?t.split(/\n+/).filter(function(r){return!!r}).length:0}function wd(e){return e&&e.scope==="selection"?"Selected passage":"Document snapshot"}function sl(e,t){var r=u(e&&e.draft?e.draft:"");if(!r||!t||!t.length)return null;for(var n=0;n<t.length;n++){var a=t[n];if(a&&u(a.prompt||"")===r)return a}return null}function qs(e,t){var r=u(e&&e.status?e.status:"");if(!r)return"";var n=t&&t.scope==="selection"?"selection":"document";return/^select text first to use selection scope\.?$/i.test(r)?n==="selection"?"Chat will use the current selection.":"Select text to switch AI Chat back to selection scope.":/^chat will use the current selection\.?$/i.test(r)?n==="selection"?"Chat will use the current selection.":"Selection scope is unavailable right now. Chat will use the whole document until you select text again.":/^chat will use the whole document\.?$/i.test(r)?"Chat will use the whole document.":e.status}function js(e,t){if(e&&e.busy)return"busy";var r=u(qs(e,t)).toLowerCase();return r?/could not|issue|error|select text first/.test(r)?"error":/started|loaded|ready|will use|copied|previewed|applied/.test(r)?"ready":"idle":"idle"}function xd(e,t,r){if(e&&e.busy)return"Thinking through the current "+(t&&t.scope==="selection"?"selection":"document")+"...";var n=qs(e,t);if(n)return n;var a=t&&t.scope==="selection"?"selection":"document";return r&&r.label?"Ready to run the "+r.label+" starter on the current "+a+".":u(e&&e.draft?e.draft:"")?"Custom prompt ready for the current "+a+".":"Ready to ask about the current "+a+"."}function Cd(e,t,r){var n=[],a=Ii(e&&e.messages?e.messages:[]),s=e&&e.messages?e.messages.length:0;return Kr(n,t&&t.scope==="selection"?"Selection context":"Document context","is-scope"),Kr(n,a+" exchange"+(a===1?"":"s"),"is-exchanges"),Kr(n,s+" message"+(s===1?"":"s"),"is-messages"),Kr(n,"Enter sends","is-send"),r?Kr(n,"Starter: "+(r.label||r.id||"Prompt"),"is-starter"):u(e&&e.draft?e.draft:"")?Kr(n,"Custom prompt","is-custom"):Kr(n,"Ready for a new ask","is-prompt"),Kr(n,String(u(e&&e.draft?e.draft:"").length)+" chars","is-count"),n}function Us(e,t,r){var n=js(e,t);return{title:"Compose",statusTone:n,statusLabel:n==="busy"?"Working":n==="error"?"Needs attention":n==="ready"?"Ready":"Compose",statusText:xd(e,t,r),metaPills:Cd(e,t,r)}}function Bs(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.statusLabel&&t.push(e.statusLabel),e.statusText&&t.push(e.statusText),e.metaPills&&e.metaPills.length)for(var r=0;r<e.metaPills.length;r++)e.metaPills[r]&&e.metaPills[r].text&&t.push(e.metaPills[r].text);return t.join(". ")}function cl(e,t,r){var n=t&&t.scope==="selection"?"selection":"document",a=!!u(e&&e.draft?e.draft:"");return e&&e.busy?{text:"Thinking...",disabled:!0,ariaLabel:"Send disabled while AI Chat is thinking about the current "+n+".",title:"AI Chat is thinking about the current "+n+"."}:r&&r.label?{text:"Send starter",disabled:!1,ariaLabel:"Send starter. Send the "+r.label+" starter for the current "+n+".",title:"Send the "+r.label+" starter for the current "+n+"."}:a?{text:"Send prompt",disabled:!1,ariaLabel:"Send prompt. Send the custom prompt for the current "+n+".",title:"Send the custom prompt for the current "+n+"."}:{text:"Send",disabled:!0,ariaLabel:"Send disabled. Type a prompt or load a starter for the current "+n+" first.",title:"Type a prompt or load a starter for the current "+n+" first."}}function zs(e){return"Compose actions. Open Ask AI. "+(e&&e.ariaLabel?e.ariaLabel:"Send.")}function kd(e){return!e||!e.messages||!e.messages.length?null:e.messages[e.messages.length-1]||null}function Ii(e){if(!e||!e.length)return 0;for(var t=0,r=0;r<e.length;r++)e[r]&&e[r].role==="user"&&!e[r].isError&&t++;return t}function Fs(e,t,r){if(!(!e||!t)){for(var n=0;n<e.length;n++)if(e[n]&&e[n].text===t)return;e.push({text:t,className:r||""})}}function _d(e){if(!e)return"";for(var t=e.pills||[],r="",n="",a=0;a<t.length;a++){var s=t[a];!s||!s.text||(!r&&s.kind==="change"?r=s.text:!n&&s.kind==="impact"&&(n=s.text))}var l=[];return r&&n?l.push("This is a "+n.toLowerCase()+" "+r.toLowerCase()+"."):r?l.push("This is a "+r.toLowerCase()+"."):n&&l.push("This is "+n.toLowerCase()+"."),e.detail&&l.push(e.detail),l.join(" ")}function Pa(e,t){var r=kd(e);if(!r)return null;var n=t&&t.snapshot?t.snapshot:null,a=t&&t.scope==="selection"?"selection":"document",s=a==="selection"?"Selection thread":"Document thread",l=e&&e.messages?e.messages.length:0,d=Ii(e&&e.messages?e.messages:[]),m=d+" exchange"+(d===1?"":"s"),R=l+" message"+(l===1?"":"s"),Q=d?m+", "+R:R,ie="Prompt sent to AI",ae="Conversation live",oe=[],te=[];if(e&&e.busy)ie="Working on your latest request",ae="Working",oe.push(Q+" in this "+a+" thread."),oe.push("The assistant is preparing the next reply.");else if(r.isError)ie="Latest reply needs attention",ae="Needs attention",oe.push(Q+" in this "+a+" thread."),oe.push("Adjust the prompt or try again.");else if(r.role==="assistant"){var se=r.resolved||null,ce=se&&se.operations?se.operations:[],Ne=se?nr(se):"",de=ra(r,n),_e=Yn(de),ke=La(r),Ce=_d(ke),me=Ea(r,n);if(oe.push(Q+" in this "+a+" thread."),ce.length?(ie="Latest review exchange is ready",ae="Ready to review"):Ne?(ie="Latest draft exchange is ready",ae="Draft ready"):(ie="Latest reply is ready",ae="Reply ready"),_e&&(oe.push(_e+" is the recommended next step."),Fs(te,_e,"is-action")),ke&&ke.pills&&ke.pills.length)for(var Re=0;Re<ke.pills.length;Re++){var Be=ke.pills[Re];!Be||!Be.text||Fs(te,Be.text,Be.kind?"is-"+Be.kind:"")}Ce?oe.push(Ce):me&&me.detail&&oe.push(me.detail)}else oe.push(Q+" in this "+a+" thread.");return te.unshift({text:R,className:"is-count"}),te.unshift({text:m,className:"is-exchanges"}),te.unshift({text:s,className:"is-scope"}),te.unshift({text:ae,className:"is-status"}),{title:ie,detail:oe.join(" "),statusLabel:ae,scopeLabel:s,exchangeLabel:m,messageLabel:R,actionLabel:r.role==="assistant"?Yn(ra(r,n)):"",changeGlance:r.role==="assistant"?La(r):null,pills:te}}function Ef(e){if(!e)return"";var t=["AI chat feed summary"];if(e.title&&t.push(e.title),e.statusLabel&&t.push(e.statusLabel),e.scopeLabel&&t.push(e.scopeLabel),e.exchangeLabel&&t.push(e.exchangeLabel),e.messageLabel&&t.push(e.messageLabel),e.actionLabel&&(t.push("Best next step"),t.push(e.actionLabel)),e.changeGlance){t.push(e.changeGlance.title||"Change at a glance");for(var r=e.changeGlance.pills||[],n=0;n<r.length;n++)r[n]&&r[n].text&&t.push(r[n].text);e.changeGlance.detail&&t.push(e.changeGlance.detail)}return t.join(". ")}function Gs(e,t,r){var n=t&&t.scope==="selection"?"selection":"document",a=Ii(e&&e.messages?e.messages:[]),s=e&&e.messages?e.messages.length:0,l=!!u(e&&e.draft?e.draft:""),d="Your first answer, draft, or reviewable change for the current "+n+" will appear here.",m=[{text:"Waiting for first ask",className:"is-status"}];return r&&r.label?(m[0]={text:"Starter ready",className:"is-status"},m.push({text:r.label+" starter",className:"is-starter"}),d="Press Enter to send the "+r.label+" starter for the current "+n+", or edit it in Compose first."):l&&(m[0]={text:"Draft ready",className:"is-status"},m.push({text:"Custom prompt",className:"is-custom"}),d="Press Enter to send your custom prompt for the current "+n+", or keep editing it in Compose."),m.push({text:a+" exchange"+(a===1?"":"s"),className:"is-exchanges"},{text:s+" message"+(s===1?"":"s"),className:"is-count"}),{title:"First exchange",detail:d,metaPills:m}}function Sd(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.metaPills&&e.metaPills.length)for(var r=0;r<e.metaPills.length;r++)e.metaPills[r]&&e.metaPills[r].text&&t.push(e.metaPills[r].text);return e.detail&&t.push(e.detail),t.join(". ")}function Vs(e,t,r){var n=["Conversation"];if(e&&e.messages&&e.messages.length){var a=Pa(e,t);return a&&a.title&&n.push(a.title),a&&a.statusLabel&&n.push(a.statusLabel),a&&a.scopeLabel&&n.push(a.scopeLabel),a&&a.exchangeLabel&&n.push(a.exchangeLabel),a&&a.messageLabel&&n.push(a.messageLabel),a&&a.actionLabel&&(n.push("Best next step"),n.push(a.actionLabel)),a&&a.detail&&n.push(a.detail),n.join(". ")}var s=Gs(e,t,r);if(s.title&&n.push(s.title),s.metaPills&&s.metaPills.length)for(var l=0;l<s.metaPills.length;l++)s.metaPills[l]&&s.metaPills[l].text&&n.push(s.metaPills[l].text);return s.detail&&n.push(s.detail),n.join(". ")}function Td(e,t){var r=Pa(e,t);return r?r.title:""}function Lf(e,t){var r=Pa(e,t);return r?r.detail:""}function Rf(e,t){var r=Pa(e,t);return r?r.statusLabel:""}function Ad(e,t){var r=js(e,t);return r==="busy"?"Working":r==="error"?"Needs attention":"Ready"}function Ed(e,t,r){var n=t&&t.scope==="selection"?"selection":"document",a=e&&e.messages?e.messages.length:0,s=Ii(e&&e.messages?e.messages:[]),l=s?s+" exchange"+(s===1?"":"s")+", "+a+" message"+(a===1?"":"s"):a+" message"+(a===1?"":"s");return e&&e.busy?a?l+" in this conversation for the current "+n+". Preparing the next reply.":"Preparing help for the current "+n+".":r&&r.label?r.label+" starter is loaded for the current "+n+".":!a&&u(e&&e.draft?e.draft:"")?"Custom prompt is ready for the current "+n+".":a?l+" in this conversation for the current "+n+". "+Td(e)+".":"Ask, rewrite, or review the current "+n+" in place."}function Kr(e,t,r){if(!(!e||!t)){for(var n=0;n<e.length;n++)if(e[n]&&e[n].text===t)return;e.push({text:t,className:r||""})}}function Ld(e,t,r){var n=[],a=t&&t.scope==="selection"?"Selection thread":"Document thread",s=e&&e.messages?e.messages.length:0,l=Ii(e&&e.messages?e.messages:[]),d=Pa(e,t);return Kr(n,a,"is-scope"),Kr(n,l+" exchange"+(l===1?"":"s"),"is-exchanges"),Kr(n,s+" message"+(s===1?"":"s"),"is-messages"),Kr(n,mo(t&&t.source?t.source:"")+" words","is-words"),d&&d.actionLabel?Kr(n,d.actionLabel,"is-action"):Kr(n,r&&r.label?r.label+" starter":u(e&&e.draft?e.draft:"")?"Custom draft":"Ready for a new ask","is-prompt"),n}function Ks(e,t,r){return{statusLabel:Ad(e,t),scopeFocusLabel:t&&t.scope==="selection"?"Selection focus":"Document focus",subtitle:Ed(e,t,r),metaPills:Ld(e,t,r)}}function Ws(e,t){var r=[];if(e&&r.push(e),!t)return r.join(". ");if(t.statusLabel&&r.push(t.statusLabel),t.scopeFocusLabel&&r.push(t.scopeFocusLabel),t.subtitle&&r.push(t.subtitle),t.metaPills&&t.metaPills.length)for(var n=0;n<t.metaPills.length;n++)t.metaPills[n]&&t.metaPills[n].text&&r.push(t.metaPills[n].text);return r.join(". ")}function Js(e){var t=e&&e.scope==="selection",r=!!(e&&e.snapshot&&e.snapshot.hasSelection),n=e&&e.source?e.source:"",a=[{text:mo(n)+" words",className:"is-words"},{text:u(n).length+" chars",className:"is-chars"}],s=Os(n);return s>1&&a.push({text:s+" paragraphs",className:"is-paragraphs"}),{title:"Context",detail:t?"Using the selected passage as the active source. Switch to document to widen the ask.":r?"Using the whole document as the active source. Switch to selection to narrow the ask.":"Using the whole document as the active source. Select text any time to narrow the ask.",summaryPills:[{text:t?"Selection active":"Document active",className:t?"is-selection":"is-document"},{text:r?"Selection available":"No current selection",className:r?"is-available":"is-empty"}],previewTitle:wd(e),previewMetaPills:a,previewSummary:e&&e.summary?e.summary:"The document is currently empty.",scopeIsSelection:t,hasSelection:r}}function Qs(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.summaryPills&&e.summaryPills.length)for(var r=0;r<e.summaryPills.length;r++)e.summaryPills[r]&&e.summaryPills[r].text&&t.push(e.summaryPills[r].text);if(e.detail&&t.push(e.detail),e.previewTitle&&t.push(e.previewTitle),e.previewMetaPills&&e.previewMetaPills.length)for(var n=0;n<e.previewMetaPills.length;n++)e.previewMetaPills[n]&&e.previewMetaPills[n].text&&t.push(e.previewMetaPills[n].text);return e.previewSummary&&t.push(e.previewSummary),t.join(". ")}function $s(e){if(!e)return"";var t=["Context scope switch"];if(e.summaryPills&&e.summaryPills.length)for(var r=0;r<e.summaryPills.length;r++)e.summaryPills[r]&&e.summaryPills[r].text&&t.push(e.summaryPills[r].text);return t.join(". ")}function bo(e,t){var r=e==="selection";return r?!t||!t.hasSelection?"Use selection. Unavailable until text is selected.":t.scopeIsSelection?"Use selection. Active scope. AI Chat is using the current selection.":"Use selection. Available scope. Switch AI Chat to the current selection.":t&&t.scopeIsSelection?"Use document. Available scope. Switch AI Chat to the whole document.":"Use document. Active scope. AI Chat is using the whole document."}function Rd(e){if(!e)return"";var t=[];if(e.previewTitle&&t.push(e.previewTitle),e.previewMetaPills&&e.previewMetaPills.length)for(var r=0;r<e.previewMetaPills.length;r++)e.previewMetaPills[r]&&e.previewMetaPills[r].text&&t.push(e.previewMetaPills[r].text);return e.previewSummary&&t.push(e.previewSummary),t.join(". ")}function Xs(e,t,r,n){var a=t&&t.length?t.length:0,s=!!u(e&&e.draft?e.draft:""),l=n&&n.scope==="selection"?"selection":"document",d=r?(r.label||r.id||"Prompt")+" starter":s?"Custom prompt":"Ready to choose",m=r?"Press Enter in Compose to send the loaded starter for the current "+l+", or edit it first.":s?"Keep writing your prompt for the current "+l+", or switch to a starter before you send.":"Choose a starter for the current "+l+" or keep typing your own prompt in Compose.";return{title:"Quick starts",detail:m,metaPills:[{text:l==="selection"?"Selection context":"Document context",className:"is-scope"},{text:a+" starters",className:"is-count"},{text:d,className:r?"is-active":s?"is-custom":"is-ready"}]}}function Ys(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.metaPills&&e.metaPills.length)for(var r=0;r<e.metaPills.length;r++)e.metaPills[r]&&e.metaPills[r].text&&t.push(e.metaPills[r].text);return e.detail&&t.push(e.detail),t.join(". ")}function Zs(e,t,r){var n=[],a=e&&(e.label||e.id)?e.label||e.id:"Prompt",s=r&&r.scope==="selection"?"selection":"document";n.push(a);var l=ll(e);l&&n.push(l+" starter");var d=ho(e&&e.prompt?e.prompt:"");return d&&n.push(d),n.push(t?"Current starter loaded in Compose for the current "+s:"Loads this starter into Compose for the current "+s),n.join(". ")}function ec(e){return"Starter buttons for the current "+(e&&e.scope==="selection"?"selection":"document")}function tc(e,t){var r=[{title:"Ask and explore",copy:"Get answers, summaries, headings, or rewrite direction grounded in the current context."},{title:"Prepare reviewable edits",copy:"Preview inline changes, apply structured plans, or turn responses into review-ready suggestions."},{title:"Use starters or type your own",copy:"Choose one of the curated quick starts above or write a custom prompt in the composer below."}];return{title:"Start with AI Chat",detail:e.scope==="selection"?"Ask anything about the current selection.":"Ask anything about the current document.",metaPills:[{text:e.scope==="selection"?"Selection context":"Document context",className:"is-scope"},{text:(t&&t.length?t.length:0)+" starters",className:"is-prompts"},{text:mo(e.source)+" words in scope",className:"is-size"}],capabilityCards:r}}function Dd(e){if(!e)return"";var t=[];return e.title&&t.push(e.title),e.copy&&t.push(e.copy),t.join(". ")}function rc(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.detail&&t.push(e.detail),e.metaPills&&e.metaPills.length)for(var r=0;r<e.metaPills.length;r++)e.metaPills[r]&&e.metaPills[r].text&&t.push(e.metaPills[r].text);if(e.capabilityCards&&e.capabilityCards.length)for(var n=0;n<e.capabilityCards.length;n++)t.push(Dd(e.capabilityCards[n]));return t.join(". ")}function Pd(e){if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}function Ni(e,t,r){if(e){Pd(e);for(var n=t||[],a=0;a<n.length;a++)!n[a]||!n[a].text||o(e,"span","",r+(n[a].className?" "+n[a].className:""),n[a].text)}}function ul(e,t,r,n){if(e){var a=sl(t,n),s=Js(r),l=Ks(t,r,a),d=t.messages.length?null:tc(r,n),m=Us(t,r,a),R=Xs(t,n,a,r),Q=t.messages.length?null:Gs(t,r,a),ie=cl(t,r,a),ae=e.querySelector(".rte-ai-chat-header");ae&&ae.setAttribute("aria-label",Ws(c.text_aichat||"AI Chat",l));var oe=e.querySelector(".rte-ai-chat-header-status.is-status");oe&&(oe.innerHTML="",oe.innerText=l.statusLabel);var te=e.querySelector(".rte-ai-chat-header-status.is-scope");te&&(te.innerHTML="",te.innerText=l.scopeFocusLabel);var se=e.querySelector(".rte-ai-chat-subtitle");se&&(se.innerHTML="",se.innerText=l.subtitle),Ni(e.querySelector(".rte-ai-chat-header-meta"),l.metaPills,"rte-ai-chat-header-meta-pill");var ce=e.querySelector(".rte-ai-chat-context-shell");ce&&(ce.setAttribute("aria-label",Qs(s)),ce.classList.toggle("is-no-selection-actionable",!s.hasSelection));var Ne=e.querySelector(".rte-ai-chat-context-bar");Ne&&Ne.setAttribute("aria-label",$s(s));var de=e.querySelectorAll(".rte-ai-chat-scope-button");de.length>0&&(de[0].disabled=!s.hasSelection,de[0].setAttribute("aria-label",bo("selection",s)),s.scopeIsSelection?de[0].classList.add("is-active"):de[0].classList.remove("is-active")),de.length>1&&(de[1].setAttribute("aria-label",bo("document",s)),s.scopeIsSelection?de[1].classList.remove("is-active"):de[1].classList.add("is-active")),Ni(e.querySelector(".rte-ai-chat-context-summary-meta"),s.summaryPills,"rte-ai-chat-context-summary-pill");var _e=e.querySelector(".rte-ai-chat-context-summary-text");_e&&(_e.innerHTML="",_e.innerText=s.detail);var ke=e.querySelector(".rte-ai-chat-context-preview");ke&&(ke.className="rte-ai-chat-context-preview is-"+(r&&r.scope==="selection"?"selection":"document"),ke.setAttribute("aria-label",Rd(s)));var Ce=e.querySelector(".rte-ai-chat-context-preview-title");Ce&&(Ce.innerHTML="",Ce.innerText=s.previewTitle),Ni(e.querySelector(".rte-ai-chat-context-preview-meta"),s.previewMetaPills,"rte-ai-chat-context-preview-pill");var me=e.querySelector(".rte-ai-chat-context-preview-copy");me&&(me.innerHTML="",me.innerText=s.previewSummary);var Re=e.querySelector(".rte-ai-chat-quick-shell");Re&&Re.setAttribute("aria-label",Ys(R));var Be=e.querySelector(".rte-ai-chat-quick-row");Be&&Be.setAttribute("aria-label",ec(r));for(var xe=e.querySelectorAll(".rte-ai-chat-quick-button"),Fe=0;Fe<xe.length&&Fe<n.length;Fe++){var ut=n[Fe],Ge=!!(t.draft&&ut&&ut.prompt&&u(t.draft)===u(ut.prompt));Ge?xe[Fe].classList.add("is-active"):xe[Fe].classList.remove("is-active"),xe[Fe].setAttribute("aria-label",Zs(ut,Ge,r))}Ni(e.querySelector(".rte-ai-chat-quick-summary-meta"),R.metaPills,"rte-ai-chat-quick-summary-pill");var Se=e.querySelector(".rte-ai-chat-quick-summary-text");Se&&(Se.innerHTML="",Se.innerText=R.detail);var nt=e.querySelector(".rte-ai-chat-compose-shell");nt&&nt.setAttribute("aria-label",Bs(m));var Je=e.querySelector(".rte-ai-chat-input");Je&&Je.setAttribute("aria-label","Compose next AI request for the current "+(r&&r.scope==="selection"?"selection":"document"));var at=e.querySelector(".rte-ai-chat-composer-meta");at&&at.setAttribute("aria-label",(m.metaPills||[]).map(function(Dt){return Dt&&Dt.text?Dt.text:""}).filter(function(Dt){return!!Dt}).join(". ")),Ni(at,m.metaPills,"rte-ai-chat-composer-pill");var Ve=e.querySelector(".rte-ai-chat-status");Ve&&(Ve.className="rte-ai-chat-status is-"+m.statusTone,Ve.setAttribute("aria-label",m.statusLabel+". "+m.statusText));var Ee=e.querySelector(".rte-ai-chat-status-pill");Ee&&(Ee.className="rte-ai-chat-status-pill is-"+m.statusTone,Ee.innerHTML="",Ee.innerText=m.statusLabel);var Pe=e.querySelector(".rte-ai-chat-status-text");Pe&&(Pe.innerHTML="",Pe.innerText=m.statusText);var xt=e.querySelector(".rte-ai-chat-composer-actions");xt&&xt.setAttribute("aria-label",zs(ie));var lt=e.querySelector(".rte-ai-chat-send-button");if(lt&&(lt.disabled=!!ie.disabled,lt.setAttribute("aria-label",ie.ariaLabel),lt.title=ie.title,lt.classList.toggle("is-busy",!!t.busy),dt(lt,t.busy?"spinner":"send",ie.text)),!t.messages.length&&Q){var Ke=e.querySelector(".rte-ai-chat-feed-shell");Ke&&Ke.setAttribute("aria-label",Vs(t,r,a));var jt=e.querySelector(".rte-ai-chat-feed-intro");jt&&jt.setAttribute("aria-label",Sd(Q));var St=e.querySelector(".rte-ai-chat-feed-intro-title");St&&(St.innerHTML="",St.innerText=Q.title);var mt=e.querySelector(".rte-ai-chat-feed-intro-detail");mt&&(mt.innerHTML="",mt.innerText=Q.detail),Ni(e.querySelector(".rte-ai-chat-feed-intro-meta"),Q.metaPills,"rte-ai-chat-feed-intro-pill");var Tt=e.querySelector(".rte-ai-chat-empty");Tt&&d&&Tt.setAttribute("aria-label",rc(d));var tr=e.querySelector(".rte-ai-chat-empty-title");tr&&d&&(tr.innerHTML="",tr.innerText=d.title);var yr=e.querySelector(".rte-ai-chat-empty-detail");yr&&d&&(yr.innerHTML="",yr.innerText=d.detail),Ni(e.querySelector(".rte-ai-chat-empty-meta"),d?d.metaPills:[],"rte-ai-chat-empty-pill")}}}function Md(){if(!(!i||!i.__aiChatPanel||!i.__aiChatPanel.isConnected)){var e=sn();if(e&&e.messages&&e.messages.length){Or(!1);return}ul(i.__aiChatPanel,e,Sa(),c.aiToolkitChatPrompts||[])}}function Id(){i&&(i.__aiChatSyncTimer&&clearTimeout(i.__aiChatSyncTimer),i.__aiChatSyncTimer=setTimeout(function(){i.__aiChatSyncTimer=0,Md()},0))}function nc(){if(!(!i||!i.getEditable)){var e=i.getEditable?i.getEditable():null,t=i.__aiToolkitLiveSyncHandler||(i.__aiToolkitLiveSyncHandler=function(){Id(),Hd()});e&&e.addEventListener&&i.__aiToolkitLiveSyncEditable!==e&&(e.addEventListener("input",t),e.addEventListener("keyup",t),e.addEventListener("mouseup",t),e.addEventListener("focus",t),i.__aiToolkitLiveSyncEditable=e);var r=e&&e.ownerDocument?e.ownerDocument:null;r&&r.addEventListener&&i.__aiToolkitLiveSyncDocument!==r&&(r.addEventListener("selectionchange",t),i.__aiToolkitLiveSyncDocument=r)}}function Nd(){!i||!i.__aiDialog||!i.__aiDialog.isConnected||typeof i.__aiDialog.__aiSyncFromEditor!="function"||i.__aiDialog.__aiSyncFromEditor()}function Hd(){i&&(i.__aiDialogSyncTimer&&clearTimeout(i.__aiDialogSyncTimer),i.__aiDialogSyncTimer=setTimeout(function(){i.__aiDialogSyncTimer=0,Nd()},0))}function Or(e){var t=Di();if(!t)return!1;var r=e?null:Wu(i.__aiChatPanel),n=e?null:$u(i.__aiChatPanel),a=sn(),s=Sa(),l=c.aiToolkitChatPrompts||[],d=sl(a,l);if(Zi({preserveReturnFocus:!0}),i.__aiChatOriginalMinHeight=t.style&&t.style.minHeight||"",t.classList.add("rte-ai-chat-host"),t.style){var m=window.innerWidth<=900?260:280;t.style.minHeight=Math.max(t.offsetHeight||0,m)+"px"}i.__aiChatShell=t;var R=o(t,"div","","rte-ai-chat-panel");R.setAttribute("role","complementary"),R.setAttribute("aria-label",c.text_aichat||"AI Chat"),R.tabIndex=-1,i.__aiChatPanel=R,R.onkeydown=function(ye){ye.key==="Escape"&&(ye.preventDefault(),Zi({restoreFocus:!0}))};var Q=Ks(a,s,d),ie=c.text_aichat||"AI Chat",ae=o(R,"div","","rte-ai-chat-header is-minimal");ae.setAttribute("role","group"),ae.setAttribute("aria-label",Ws(ie,Q));var oe=o(ae,"div","","rte-ai-chat-header-copy"),te=o(oe,"div","","rte-ai-chat-title-row"),se=o(te,"span","","rte-ai-chat-title-icon");se.innerHTML=c.svgCode_aiassist_chat||c.svgCode_aiassist||"",o(te,"div","","rte-ai-chat-title",ie);var ce=o(ae,"div","","rte-ai-chat-header-actions"),Ne=o(ce,"button","","secondary rte-ai-chat-header-button is-icon-only");Ne.type="button",Ne.setAttribute("data-rte-ai-chat-header-action","new-chat"),Ne.title="Start a fresh chat",Ne.setAttribute("aria-label","Start a fresh chat"),dt(Ne,"refresh",""),Ne.onclick=function(){Gu(a,"Started a fresh AI chat."),Or(!0)};var de=o(ce,"button","","rte-ai-panel-close-button");de.type="button",de.setAttribute("data-rte-ai-chat-header-action","close"),de.setAttribute("aria-label","Close AI chat"),de.title="Close",de.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12"/><path d="M18 6L6 18"/></svg>',de.onclick=function(){Zi({restoreFocus:!0})};var _e=Js(s),ke=o(R,"div","","rte-ai-chat-stack rte-ai-chat-context-shell is-minimal"+(s.snapshot.hasSelection?"":" is-no-selection-actionable"));ke.setAttribute("role","group"),ke.setAttribute("aria-label",Qs(_e));var Ce=o(ke,"div","","rte-ai-chat-context-bar");Ce.setAttribute("role","group"),Ce.setAttribute("aria-label",$s(_e));var me=o(Ce,"button","","rte-ai-chat-scope-button is-icon-only"+(_e.scopeIsSelection?" is-active":""));me.type="button",me.disabled=!s.snapshot.hasSelection,me.setAttribute("data-rte-ai-chat-scope-target","selection"),me.setAttribute("aria-label",bo("selection",_e)),me.title="Use selection",dt(me,"cursorText",""),me.onclick=function(){var ye=Le();a.scope="selection",a.status=ye.hasSelection?"Chat will use the current selection.":"Select text first to use selection scope.",Or(!0)};var Re=o(Ce,"button","","rte-ai-chat-scope-button is-icon-only"+(_e.scopeIsSelection?"":" is-active"));Re.type="button",Re.setAttribute("data-rte-ai-chat-scope-target","document"),Re.setAttribute("aria-label",bo("document",_e)),Re.title="Use document",dt(Re,"document",""),Re.onclick=function(){a.scope="document",a.status="Chat will use the whole document.",Or(!0)};var Be=Xs(a,l,d,s),xe=o(R,"div","","rte-ai-chat-stack rte-ai-chat-quick-shell is-minimal"+(a.messages.length?" is-conversation":""));xe.setAttribute("role","group"),xe.setAttribute("aria-label",Ys(Be));var Fe=o(xe,"div","","rte-ai-chat-quick-row");Fe.setAttribute("role","group"),Fe.setAttribute("aria-label",ec(s));for(var ut=0;ut<l.length;ut++)(function(ye){var ht=!!(a.draft&&ye.prompt&&u(a.draft)===u(ye.prompt)),Oe=o(Fe,"button","","rte-ai-chat-quick-button is-chip"+(ht?" is-active":""));Oe.type="button",Oe.setAttribute("data-rte-ai-chat-prompt-tone",hd(ye)),Oe.setAttribute("data-rte-ai-chat-prompt-id",ye.id||ye.label||String(ut)),Oe.title=ye.prompt||"",Oe.setAttribute("aria-label",Zs(ye,ht,s)),dt(Oe,cf(ye),ye.label||ye.id||"Prompt"),Oe.onclick=function(){a.draft=ye.prompt||"",a.status="Loaded the "+(ye.label||ye.id||"starter prompt")+" quick start.",Or(!0)}})(l[ut]);var Ge=_s(a,4);if(Ge.length>1){var Se=o(R,"div","","rte-ai-chat-stack rte-ai-chat-history-shell is-minimal");Se.setAttribute("role","group"),Se.setAttribute("aria-label","Recent AI chats");for(var nt=o(Se,"div","","rte-ai-chat-quick-row rte-ai-chat-history-row"),Je=0;Je<Ge.length;Je++)(function(ye,ht){var Oe=ye.id===a.sessionId,Qe=o(nt,"button","","rte-ai-chat-quick-button is-chip"+(Oe?" is-active":""));Qe.type="button",Qe.setAttribute("data-rte-ai-chat-session-id",ye.id),Qe.title=(ye.title||"Recent chat")+" - "+(ye.exchangeCount||0)+" exchange"+((ye.exchangeCount||0)===1?"":"s"),Qe.setAttribute("aria-label",(Oe?"Current chat. ":"Open recent chat. ")+(ye.title||"Recent chat")+". "+(ye.messageCount||0)+" message"+((ye.messageCount||0)===1?"":"s")+"."),dt(Qe,Oe?"history":"chat",(ht===0&&Oe?"Current":"Recent")+": "+(ye.title||"Chat")),Qe.onclick=function(){Oe||Ss(a,ye.id,"Loaded a recent AI chat.")&&Or(!0)}})(Ge[Je],Je)}var at=o(R,"div","","rte-ai-chat-stack rte-ai-chat-feed-shell is-minimal");at.setAttribute("role","group"),at.setAttribute("aria-label",Vs(a,s,d));var Ve=o(at,"div","","rte-ai-chat-feed");if(!a.messages.length){var Ee=tc(s,l),Pe=o(Ve,"div","","rte-ai-chat-empty is-minimal is-flat");Pe.setAttribute("role","group"),Pe.setAttribute("aria-label",rc(Ee));var xt=document.createElement("div");xt.className="rte-ai-chat-empty-art is-detached",xt.setAttribute("aria-hidden","true");var lt=!!(l&&l.length),Ke=s.scope==="selection"?"Ask anything about the current selection":"Ask anything about the current document";o(Pe,"div","","rte-ai-chat-empty-detail",lt?Ke+" \u2014 or tap a quick start above.":Ke+".")}for(var jt=null,St=0,mt=0;mt<a.messages.length;mt++){if(0){var Tt,tr,yr,Dt;for(var Kt;Kt<Dt.length;Kt++)var vt}(function(ye,ht){var Oe=Mi(a.messages,ht),Qe=Ra(a.messages,ht),yt=Da(a.messages,ht),wt=go(a.messages,ht),Ct=Ve;Oe==="request"?(jt=o(Ve,"div","","rte-ai-chat-exchange-group"),yt&&jt.setAttribute("data-rte-ai-chat-exchange-index",yt),wt&&jt.setAttribute("data-rte-ai-chat-current-exchange","true"),jt.setAttribute("role","group"),jt.setAttribute("aria-label",yd(a.messages,ht,s.snapshot)),St=Qe,Ct=jt):Oe==="response"&&jt&&St===Qe?Ct=jt:(jt=null,St=0);var Ut=Ns(a.messages,ht,s.snapshot);if(0){var ot,Lr;if(Ut.changeGlance&&Ut.changeGlance.pills&&Ut.changeGlance.pills.length)for(var Wt;Wt<Ut.changeGlance.pills.length;Wt++)var Rr}var cr=o(Ct,"div","","rte-ai-chat-message is-"+ye.role+" is-minimal"+(ye.isError?" is-error":""));cr.setAttribute("role","group"),cr.setAttribute("aria-label",bd(a.messages,ht,s.snapshot)),Oe&&(cr.setAttribute("data-rte-ai-chat-thread-role",Oe),cr.setAttribute("data-rte-ai-chat-exchange-index",String(Qe)),wt&&cr.setAttribute("data-rte-ai-chat-current-exchange","true"));var Cn=o(cr,"div","","rte-ai-chat-message-header is-minimal"),fn=ye.isError?"error":ye.role,wr=o(Cn,"span","","rte-ai-chat-message-avatar is-"+fn);if(wr.setAttribute("aria-hidden","true"),wr.innerHTML=fn==="user"?'<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><circle cx="8" cy="5.5" r="2.8"/><path d="M8 9.4c-2.8 0-5.2 1.5-5.2 3.4 0 .4.3.7.7.7h9c.4 0 .7-.3.7-.7 0-1.9-2.4-3.4-5.2-3.4z"/></svg>':fn==="error"?'<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6.5"/><path d="M8 5v3.5M8 11.2v.1"/></svg>':'<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="3" y="5" width="10" height="8" rx="2"/><circle cx="8" cy="3" r="0.9"/><line x1="8" y1="3.9" x2="8" y2="5" stroke="currentColor" stroke-width="1"/><circle cx="6" cy="9" r="1.1" fill="#ffffff"/><circle cx="10" cy="9" r="1.1" fill="#ffffff"/></svg>',o(Cn,"span","","rte-ai-chat-message-role is-"+(ye.isError?"error":ye.role),Es(ye)),o(cr,"div","","rte-ai-chat-message-text",ye.text||""),ye.role==="assistant"&&!ye.isError&&ye.text){var At=o(cr,"div","","rte-ai-chat-message-actions-row"),Et=o(At,"button","","rte-ai-chat-message-action is-copy");Et.type="button",Et.title="Copy message text",dt(Et,"checkAll","Copy"),Et.onclick=(function(De,ar){return function(kt){kt&&kt.stopPropagation&&kt.stopPropagation();var Pr=window.navigator,Fr=!1;try{Pr&&Pr.clipboard&&Pr.clipboard.writeText&&(Pr.clipboard.writeText(De),Fr=!0)}catch{}if(!Fr){var nn=document.createElement("textarea");nn.value=De,nn.style.position="fixed",nn.style.left="-9999px",document.body.appendChild(nn),nn.select();try{document.execCommand("copy"),Fr=!0}catch{}document.body.removeChild(nn)}Fr&&(ar.classList.add("is-just-copied"),dt(ar,"check","Copied"),setTimeout(function(){ar.classList.remove("is-just-copied"),dt(ar,"checkAll","Copy")},1400))}})(ye.text||"",Et);for(var Zr="",xr=ht-1;xr>=0;xr--)if(a.messages[xr]&&a.messages[xr].role==="user"&&!a.messages[xr].isError){Zr=a.messages[xr].text||"";break}if(Zr){var Cr=o(At,"button","","rte-ai-chat-message-action is-regen");Cr.type="button",Cr.title="Regenerate response",dt(Cr,"refresh","Regenerate"),Cr.onclick=(function(De){return function(ar){ar&&ar.stopPropagation&&ar.stopPropagation(),a.draft=De,il(De)}})(Zr)}}if(0){var qi;if(qi)var pn,ti,Gt}if(0){var qn;if(qn)var en,vn,ri,ur}if(ye.role==="assistant"&&ye.resolved){var Br=dd(ye,s.snapshot);if(0){var kn,Ci,_n,qr,ni;if(Br.reasonText)var jn;if(Br.changeGlance){var Un;if(Br.changeGlance.pills&&Br.changeGlance.pills.length){var zr;for(var vr;vr<Br.changeGlance.pills.length;vr++)var tn}}if(Br.planLeadTitle||Br.planLeadLabel||Br.planLeadDetail||Br.planItems&&Br.planItems.length){var ii;if(Br.planLeadTitle||Br.planLeadLabel||Br.planLeadDetail){var hn;if(Br.planLeadLabel)var hr}if(Br.planItems&&Br.planItems.length){var Sn;for(var Bn;Bn<Br.planItems.length;Bn++)var Tn,An,En}}}var Ln=o(cr,"div","","rte-ai-chat-message-actions"),qa=Ea(ye,s.snapshot),zn=Br&&(Br.planLeadTitle||Br.planLeadLabel||Br.planLeadDetail||Br.planItems&&Br.planItems.length);if(0)var Jt;var Yt=ra(ye,s.snapshot),ai=o(Ln,"div","","rte-ai-chat-message-action-group is-utility"),Qt=o(Ln,"div","","rte-ai-chat-message-action-group is-primary"),Fn=o(Ln,"div","","rte-ai-chat-message-action-group is-secondary"),Dr=ta(ye,s.snapshot),Rn=function(De,ar){!De||!ar||ar!==Yt||(De.className+=" is-recommended",De.setAttribute("data-rte-ai-chat-recommended","true"))},Qr=o(ai,"button","","secondary rte-ai-chat-action-button is-copy","Copy text");if(Qr.type="button",Qr.setAttribute("data-rte-ai-chat-action","copy"),Qr.onclick=function(){Zu(ye)},na(Qr,"copy",ye,Yt,s.snapshot),Dr.canApplyPlan){var Gn=o(Qt,"button","","secondary rte-ai-chat-action-button is-apply","Apply");Gn.type="button",Gn.setAttribute("data-rte-ai-chat-action","apply"),Gn.onclick=function(){Aa(ye,"plan")},Rn(Gn,"apply"),na(Gn,"apply",ye,Yt,s.snapshot)}if(Dr.canPreview){var dr=o(Qt,"button","","secondary rte-ai-chat-action-button is-preview","Preview");dr.type="button",dr.setAttribute("data-rte-ai-chat-action","preview"),dr.onclick=function(){Aa(ye,"preview")},Rn(dr,"preview"),na(dr,"preview",ye,Yt,s.snapshot)}if(Dr.canReplaceSelection){var fr=o(Qt,"button","","secondary rte-ai-chat-action-button is-selection","Replace selection");fr.type="button",fr.setAttribute("data-rte-ai-chat-action","selection"),fr.onclick=function(){Aa(ye,"selection")},Rn(fr,"selection"),na(fr,"selection",ye,Yt,s.snapshot)}if(Dr.canInsert){var $r=o(Fn,"button","","secondary rte-ai-chat-action-button is-insert","Insert below");if($r.type="button",$r.setAttribute("data-rte-ai-chat-action","insert"),$r.onclick=function(){Aa(ye,"insert")},Rn($r,"insert"),na($r,"insert",ye,Yt,s.snapshot),Dr.canReplaceDocument){var Dn=o(Fn,"button","","secondary rte-ai-chat-action-button is-document","Replace document");Dn.type="button",Dn.setAttribute("data-rte-ai-chat-action","document"),Dn.onclick=function(){Aa(ye,"document")},Rn(Dn,"document"),na(Dn,"document",ye,Yt,s.snapshot)}}ol(ai,vo("utility",Yt,ye,s.snapshot),"utility"),ol(Qt,vo("primary",Yt,ye,s.snapshot),"primary"),ol(Fn,vo("secondary",Yt,ye,s.snapshot),"secondary"),od(Ln,Yt),ld(Ln,Yt),cd(Ln,Yt,ye,s.snapshot);var Vn=!!(Dr.canPreview||Dr.canInsert||Dr.canReplaceDocument);if(Vn){var ki=Qt.children.length?Qt:Fn.children.length?Fn:ai,rn=o(ki,"button","","secondary rte-ai-chat-action-button rte-ai-chat-message-action-toggle-more");rn.type="button",rn.setAttribute("data-rte-ai-chat-action","more"),rn.setAttribute("aria-expanded","false"),rn.title="More apply options",dt(rn,"more","More"),rn.onclick=(function(De){return function(ar){ar&&ar.stopPropagation&&ar.stopPropagation();var kt=De.classList.toggle("is-show-more");rn.setAttribute("aria-expanded",kt?"true":"false")}})(cr)}}if(ye.role==="assistant"&&!ye.isError){var So=Hs(a.messages,ht,s.snapshot);if(0){var ja,sa,ji;if(So.changeGlance&&So.changeGlance.pills&&So.changeGlance.pills.length)for(var Wt;Wt<So.changeGlance.pills.length;Wt++)var Rr}}})(a.messages[mt],mt)}var je=Us(a,s,d),qe=cl(a,s,d),Pt=o(R,"div","","rte-ai-chat-stack rte-ai-chat-compose-shell");Pt.setAttribute("role","group"),Pt.setAttribute("aria-label",Bs(je));var rr=o(Pt,"div","","rte-ai-chat-composer"),ze=o(rr,"textarea","","rte-ai-chat-input");ze.rows=1,ze.placeholder="Ask anything\u2026",ze.setAttribute("aria-label","Compose next AI request for the current "+(s.scope==="selection"?"selection":"document")),ze.value=a.draft||"",ze.disabled=!!a.busy,ze.oninput=function(){a.draft=ze.value,a.busy||(a.status=""),ul(R,a,Sa(),l)},ze.onkeydown=function(ye){if(ye.key==="Enter"&&!ye.shiftKey){ye.preventDefault();var ht=Sa(),Oe=sl(a,l),Qe=cl(a,ht,Oe);if(Qe.disabled){a.status=Qe.title,ul(R,a,ht,l);return}il(ze.value)}};var Me=o(rr,"div","","rte-ai-chat-composer-actions");Me.setAttribute("role","group"),Me.setAttribute("aria-label",zs(qe));var tt=document.createElement("button");tt.type="button",tt.className="secondary rte-ai-chat-action-button is-open-dialog is-detached",tt.setAttribute("data-rte-ai-chat-action","open-dialog"),dt(tt,"external","Open Ask AI"),tt.onclick=function(){la({useDocument:a.scope!=="selection",presetMode:"rewrite"})};var bt=o(Me,"button","","rte-ai-chat-send-button"+(a.busy?" is-busy":""));if(bt.type="button",bt.setAttribute("data-rte-ai-chat-action","send"),bt.disabled=!!qe.disabled,bt.setAttribute("aria-label",qe.ariaLabel),bt.title=qe.title,dt(bt,a.busy?"spinner":"send",qe.text),bt.onclick=function(){il(ze.value)},e&&setTimeout(function(){if(ze&&ze.focus){ze.focus();try{ze.selectionStart=ze.selectionEnd=ze.value.length}catch{}}},0),Yi(a),Ve&&typeof Ve.scrollTop<"u"&&(!n||!Xu(Ve,n))&&(Ve.scrollTop=Ve.scrollHeight),!e&&r&&!Qu(R,r)&&R&&R.focus)try{R.focus({preventScroll:!0})}catch{try{R.focus()}catch{}}return!0}function ic(){for(var e={total:0,pending:0,accepted:0,rejected:0,stale:0},t=Ft(),r=0;r<t.length;r++)e.total++,e.hasOwnProperty(t[r].status)&&e[t[r].status]++;return e}function On(e,t){return!t||t==="all"?!0:Z(e&&e.suggestionType||"")===t}function ac(e){for(var t={all:"All types"},r=0;r<e.length;r++){var n=Z(e[r]&&e[r].suggestionType||"");t[n]||(t[n]=M(n))}var a=[{value:"all",label:t.all}],s=[];for(var l in t)t.hasOwnProperty(l)&&l!=="all"&&s.push(l);s.sort();for(var d=0;d<s.length;d++)a.push({value:s[d],label:t[s[d]]});return a}function Od(e){for(var t={all:0},r=0;r<e.length;r++)if(e[r].status==="pending"){t.all++;var n=Z(e[r].suggestionType||"");t[n]=(t[n]||0)+1}return t}function Xt(e){for(var t=Ft().slice(),r=[],n=0;n<t.length;n++)t[n].status==="pending"&&On(t[n],e)&&r.push(t[n]);return Ol(r)}function cn(e,t){var r=Xt(e);if(!r.length)return"";if(!t)return r[0].id;for(var n=0;n<r.length;n++)if(r[n].id===t)return r[n+1]?r[n+1].id:r.length>1?r[0].id:"";return r[0].id}function yi(e,t){var r=Xt(e);if(!r.length)return"";if(!t)return r[0].id;for(var n=0;n<r.length;n++)if(r[n].id===t)return r[n-1]?r[n-1].id:r.length>1?r[r.length-1].id:"";return r[0].id}function Df(e,t){var r=cn(e,t);return r?Ur(r):!1}function Pf(e,t){var r=yi(e,t);return r?Ur(r):!1}function Mf(e,t,r){var n=cn(e,t);return n?xi(n,r||{}):!1}function If(e,t,r){var n=yi(e,t);return n?xi(n,r||{}):!1}function Wr(e){var t=jr(),r=t.typeFilter||"all",n=pt(e);return n&&r!=="all"&&!On(n,r)&&(r=Z(n.suggestionType||"")),r||"all"}function ia(e){var t=Wr(e),r=cn(t,e);return!r&&t!=="all"&&(r=cn("all",e)),r}function oc(e){var t=Wr(e),r=yi(t,e);return!r&&t!=="all"&&(r=yi("all",e)),r}function qd(e){var t=Wr(e),r=Xt(t);return!r.length&&t!=="all"&&(r=Xt("all")),r.length?r[0].id:""}function jd(e){var t=Wr(e),r=Xt(t);return!r.length&&t!=="all"&&(r=Xt("all")),r.length?r[r.length-1].id:""}function lc(e,t){var r=oc(e);return r?Ur(r,t):!1}function sc(e,t){var r=ia(e);return r?Ur(r,t):!1}function Ud(e,t){var r=qd(e);return r?Ur(r,t):!1}function Bd(e,t){var r=jd(e);return r?Ur(r,t):!1}function xn(e){var t=gi();return t&&t.status==="pending"&&On(t,e)?t.id:cn(e,"")}function yo(e,t){var r=Xt(e),n={id:t||"",index:0,total:r.length};if(!t||!r.length)return n;for(var a=0;a<r.length;a++)if(r[a].id===t)return n.index=a+1,n;return n}function dl(e){var t=jr(),r=t.typeFilter||"all";return e&&r!=="all"&&!On(e,r)&&(r=Z(e.suggestionType||"")),r||"all"}function wi(e,t,r){if(!e||e.status!=="pending"||t!=="accept"&&t!=="reject")return null;r=r||dl(e);var n=Xt(r);!n.length&&r!=="all"&&(n=Xt("all"));for(var a=-1,s=0;s<n.length;s++)if(n[s]&&n[s].id===e.id){a=s;break}var l=t==="accept"?"Accept":"Reject";return a===-1||!n.length?{text:l,label:l+" this AI change"}:a===n.length-1?{text:l+" & finish",label:l+" & finish this AI change and finish the current review queue"}:{text:l+" & next",label:l+" & next this AI change and move to the next review item"}}function Jr(e){var t=qt(e,"accept")||"Accept",r=qt(e,"reject")||"Reject";return{acceptLabel:t,rejectLabel:r,acceptHint:t.replace(/^([A-Z])/,function(n){return n.toLowerCase()}),rejectHint:r.replace(/^([A-Z])/,function(n){return n.toLowerCase()})}}function Hi(e,t,r){if(r=r||{},!e)return!1;var n=!1;return t==="accept"?n=Ca(e):t==="reject"&&(n=ka(e)),n&&ft(!0,{focusAction:r.focusAction||""}),n}function wo(e,t,r){var n=xn(e);return n?Hi(n,t,r):!1}function zd(){for(var e=Ft().slice(),t=!1,r=0;r<e.length;r++)e[r].status==="pending"&&Ca(e[r].id)&&(t=!0);return t}function cc(e){if(!e||e==="all")return zd();for(var t=Ft().slice(),r=!1,n=0;n<t.length;n++)t[n].status==="pending"&&On(t[n],e)&&Ca(t[n].id)&&(r=!0);return r}function Fd(){for(var e=Ft().slice(),t=!1,r=0;r<e.length;r++)e[r].status==="pending"&&ka(e[r].id)&&(t=!0);return t}function uc(e){if(!e||e==="all")return Fd();for(var t=Ft().slice(),r=!1,n=0;n<t.length;n++)t[n].status==="pending"&&On(t[n],e)&&ka(t[n].id)&&(r=!0);return r}function Ur(e,t){t=t||{},yn();var r=pt(e),n=r?In(r.id):null;if(!r||!n)return r&&r.status==="pending"&&(r.status="stale",r.decidedAt=r.decidedAt||new Date().getTime()),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),!1;!t.openedQueue&&i.__aiRecentlyOpenedQueueSuggestionId&&i.__aiRecentlyOpenedQueueSuggestionId!==r.id&&Qi({skipUpdate:!0,skipRender:!0}),Zt(r.id),va(r.id),t.openedQueue&&cs(r.id);var a=yo(Wr(r.id),r.id),s={positionLabel:a.total?"Item "+a.index+" of "+a.total:"",remoteUpdateCount:Yr(r.id)};Ot(t.openedQueue?ls(r,s):$n(r,"Reviewing",s)),n.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"}),n.classList.add("is-focused"),setTimeout(function(){n&&n.classList&&n.classList.remove("is-focused")},1400),i.focus();var l=!!(t.focusInlineAction&&au(r.id,t.focusInlineAction));return l||ga(n),i.__aiReviewPanel&&i.__aiReviewPanel.isConnected&&ft(!1),!0}function xi(e,t){t=t||{};var r=pt(e);if(!r)return!1;if(!t.openedQueue&&i.__aiRecentlyOpenedQueueSuggestionId&&i.__aiRecentlyOpenedQueueSuggestionId!==r.id&&Qi({skipUpdate:!0,skipRender:!0}),Zt(r.id),va(r.id),t.openedQueue&&cs(r.id),t.locate)return Ur(r.id,{openedQueue:!!t.openedQueue});var n=yo(Wr(r.id),r.id),a={positionLabel:n.total?"Item "+n.index+" of "+n.total:"",remoteUpdateCount:Yr(r.id)};return Ot(t.openedQueue?ls(r,a):$n(r,"Reviewing",a)),ft(!!t.focusPanel,{focusAction:t.focusAction||""}),!0}function Gd(e,t,r){if(!e||!i.__aiActiveSuggestionId||!e.querySelector)return null;var n=e.querySelector('[data-rte-ai-review-id="'+i.__aiActiveSuggestionId+'"]');if(!n||!n.scrollIntoView)return null;if(n.scrollIntoView({block:"nearest",inline:"nearest"}),t){var a=n;if(r&&n.querySelector){var s=n.querySelector('[data-rte-ai-review-action="'+r+'"]');(!s||s.disabled||!s.focus)&&(s=n.querySelector(".rte-ai-review-action-button.is-primary:not([disabled])")||n.querySelector('[data-rte-ai-review-action="locate"]:not([disabled])')||n.querySelector("[data-rte-ai-review-action]:not([disabled])")),s&&!s.disabled&&s.focus&&(a=s)}a&&a.focus&&a.focus()}return n}function Vd(e,t){var r=i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null;if(!r||!r.querySelector||!e)return!1;var n=r.querySelector('[data-rte-ai-review-id="'+e+'"]');if(!n)return!1;var a=pt(e),s=[];t?s.push(t):s.push(ko(a)),a&&a.status==="pending"&&(s.push("accept"),s.push("reject")),s.push("locate");for(var l={},d=0;d<s.length;d++){var m=s[d];if(!(!m||l[m])){l[m]=!0;var R=n.querySelector('[data-rte-ai-review-action="'+m+'"]');if(R&&!R.disabled&&R.focus)return R.focus(),!0}}return n.focus?(n.focus(),!0):!1}function dc(e,t){var r=pt(e);if(!r)return!1;var n=t||ko(r);return i.__aiActiveSuggestionId===r.id&&Vd(r.id,n)?!0:xi(r.id,{focusPanel:!0,focusAction:n||""})}function Ie(e){var t=e&&e.isConnected?e:i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null,r=document.activeElement;return t&&r&&r.getAttribute&&t.contains(r)?r.getAttribute("data-rte-ai-review-action")||"":i.__aiLastReviewActionFocus||""}function Ar(e,t){t=t||{};var r=pt(e);if(!r)return!1;var n=t.focusAction||Ie();return xi(r.id,{focusPanel:!!t.focusPanel,focusAction:n||ko(r),openedQueue:!!t.openedQueue,locate:!!t.locate})}function xo(e,t,r,n){var a="";if(n==="next")a=cn(e,t);else if(n==="previous")a=yi(e,t);else if(n==="first")a=xn(e);else if(n==="last"){var s=Xt(e);a=s.length?s[s.length-1].id:""}return a?xi(a,{focusPanel:!0,focusAction:r||""}):!1}function un(){return!!di()}function dn(){return!!Nn()}function Zn(e){var t=Nr(),r=Hr(),n=e;return un()&&(n=n.replace(/\.$/,"")+". U undoes "+t.decisionLabel+" decision."),dn()&&(n=n.replace(/\.$/,"")+". Shift+U redoes "+r.decisionLabel+" decision."),n}function Er(e){var t=Nr(),r=e;return un()&&(r+=" | U "+t.shortcutLabel),dn()&&(r+=" | Shift+U "+Hr().shortcutLabel),r}function Co(e){var t=e;return un()&&(t+=" U"),dn()&&(t+=" Shift+U"),t}function Kd(e){switch(e){case"accept":return"Enter Space A";case"reject":return"Enter Space R";case"undo":return"Enter Space U";case"redo":return"Enter Space Shift+U";case"locate":return"Enter Space";default:return"Enter Space"}}function Wd(e,t,r){var n=Nr(),a=Hr(),s=Jr(t),l=(r||"").replace(/\.$/,"");return l||(l=e==="locate"?"Locate":"Review action"),e==="accept"?l+". Enter or Space activates this action. A uses "+s.acceptLabel+".":e==="reject"?l+". Enter or Space activates this action. R uses "+s.rejectLabel+".":e==="undo"?l+". Enter or Space activates this action."+(n?" U "+n.shortcutLabel+".":""):e==="redo"?l+". Enter or Space activates this action."+(a?" Shift+U "+a.shortcutLabel+".":""):l+". Enter or Space activates this action."}function Jd(e,t){var r=Nr(),n=Hr(),a=Jr(t);return Er(e==="accept"?"Shortcuts: Enter "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="reject"?"Shortcuts: Enter "+a.rejectHint+" | A "+a.acceptHint+" | J/K move | Home/End jump":e==="undo"?"Shortcuts: Enter "+r.shortcutLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="redo"?"Shortcuts: Enter "+n.shortcutLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="locate"?"Shortcuts: Enter locate | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":"Shortcuts: J/K move | Enter focus action | A "+a.acceptHint+" | R "+a.rejectHint+" | Home/End jump")}function fl(e,t){var r=Jr(e);if(!e||e.status!=="pending")return Zn("Enter focuses Locate. J/K move items. Home/End jump.");var n=qt(e,t)||r.acceptLabel;return Zn("Enter focuses "+n+". A uses "+r.acceptLabel+". R uses "+r.rejectLabel+". J/K move items. Home/End jump.")}function Qd(e,t){var r=Jr(e);if(!e||e.status!=="pending")return Er("Shortcuts: Enter focus Locate | J/K move | Home/End jump");var n=qt(e,t)||r.acceptLabel;return Er("Shortcuts: Enter focus "+n+" | A "+r.acceptHint+" | R "+r.rejectHint+" | J/K move | Home/End jump")}function fc(e,t){var r=Jr(e);return!e||e.status!=="pending"?Er("Shortcuts: J/K move | Home/End jump"):Er("Shortcuts: A "+r.acceptHint+" | R "+r.rejectHint+" | J/K move | Home/End jump")}function Ma(e,t){if(!e)return"";var r=Nn(),n=di(),a=[];t&&a.push(t),a.push(ko(e)),e.status==="pending"&&(a.push("accept"),a.push("reject"),n&&a.push("undo"),r&&r.suggestion&&r.suggestion.id===e.id&&a.push("redo")),a.push("locate");for(var s={},l=0;l<a.length;l++){var d=a[l];if(!(!d||s[d])&&(s[d]=!0,(d==="accept"||d==="reject")&&e.status==="pending"||d==="undo"&&e.status==="pending"&&n||d==="redo"&&e.status==="pending"&&r&&r.suggestion&&r.suggestion.id===e.id||d==="locate"&&(e.status==="pending"||e.status==="stale")))return d}return""}function qt(e,t){var r=Ma(e,t);return r==="undo"?Nr().actionLabel||"Undo":r==="redo"?Hr().actionLabel||"Redo":r==="reject"?(wi(e,"reject")||{}).text||"Reject":r==="accept"?(wi(e,"accept")||{}).text||"Accept":r==="locate"?"Locate":""}function pc(e){switch(e){case"accept":case"reject":return"decision";case"undo":case"redo":return"recovery";case"locate":return"locate";default:return""}}function vc(e,t,r){var n;switch(e){case"locate":n=["locate"];break;case"decision":n=["accept","reject"];break;case"recovery":n=["undo","redo"];break;default:n=[];break}var a=n.indexOf(t);if(a===-1)return n.length+1;if(!r)return a+1;var s=n.indexOf(r);if(s===-1)return a+1;if(t===r)return 1;for(var l=2,d=0;d<n.length;d++)if(n[d]!==r){if(n[d]===t)return l;l++}return a+1}function hc(e){switch(e){case"locate":return"Locate";case"decision":return"Decide";case"recovery":return"Recover";default:return""}}function gc(e,t){var r=["locate","decision","recovery"],n=r.indexOf(e);if(n===-1)return r.length+1;if(!t)return n+1;var a=r.indexOf(t);if(a===-1)return n+1;if(e===t)return 1;for(var s=2,l=0;l<r.length;l++)if(r[l]!==t){if(r[l]===e)return s;s++}return n+1}function mc(e,t){t=t||{};var r=t.queueTransitionData||null;return e==="decision"?r?r.statusLabel+". "+r.detail:"Accept or reject this AI change from the current review queue.":e==="locate"?"Find this suggestion in the editor without deciding it yet.":e==="recovery"?t.targetActionName==="undo"&&t.undoSummaryText?t.undoSummaryText:t.targetActionName==="redo"&&t.redoSummaryText?t.redoSummaryText:t.undoSummaryText||t.redoSummaryText?"Undo or redo a recent AI review decision without leaving this card.":"Recover from a recent AI review action without leaving this card.":""}function $d(e){e=e||{};var t=e.suggestion||null;if(!t)return null;var r=e.targetActionName||"",n=pc(r),a=qt(t,r),s=hc(n);return!n||!a||!s?null:{title:"Action handoff",pills:[s+" lane","Enter focuses "+a],detail:mc(n,e)}}function bc(e){if(!e)return"";var t=[];if(e.title&&t.push(e.title),e.pills&&e.pills.length)for(var r=0;r<e.pills.length;r++)e.pills[r]&&t.push(e.pills[r]);return e.detail&&t.push(e.detail),t.join(". ")}function Ia(e){var t=i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null;if(!t||!t.querySelector)return!1;var r=t.querySelector(".rte-ai-review-item.is-active"),n=gi(),a=r&&r.querySelector?r.querySelector(".rte-ai-review-item-actions"):null;if(!r||!n||!a)return!1;var s=Ma(n,e||Ie(t)),l=pc(s),d=dl(n),m=Xt(d);!m.length&&d!=="all"&&(m=Xt("all"));var R=mi(m,i.__aiActiveSuggestionId,n),Q=n.status==="pending"?di():null,ie=Nn(),ae=!!(ie&&ie.suggestion&&ie.suggestion.id===n.id&&n.status==="pending"),oe={suggestion:n,targetActionName:s,queueTransitionData:R,undoSummaryText:Q?ha(Q):"",redoSummaryText:ae?eo(ie):""},te=$d(oe),se=a.querySelector?a.querySelector(".rte-ai-review-item-action-summary"):null;if(te){for(se||(se=document.createElement("span"),se.className="rte-ai-review-item-action-summary");se.firstChild;)se.removeChild(se.firstChild);if(se.setAttribute("aria-label",bc(te)),o(se,"span","","rte-ai-review-item-action-summary-title",te.title),te.pills&&te.pills.length)for(var ce=o(se,"span","","rte-ai-review-item-action-summary-pills"),Ne=0;Ne<te.pills.length;Ne++)te.pills[Ne]&&o(ce,"span","","rte-ai-review-item-action-summary-pill",te.pills[Ne]);te.detail&&o(se,"span","","rte-ai-review-item-action-summary-detail",te.detail),a.firstChild!==se&&a.insertBefore(se,a.firstChild),a.setAttribute("aria-label","AI review actions. "+bc(te))}else se&&se.parentNode&&se.parentNode.removeChild(se),a.setAttribute("aria-label","AI review actions");for(var de=qt(n,s),_e=a.querySelectorAll(".rte-ai-review-item-action-group"),ke=[],Ce=0;Ce<_e.length;Ce++){var me=_e[Ce];if(me){var Re=me.getAttribute("data-rte-ai-review-action-group")||(me.classList.contains("is-decision")?"decision":me.classList.contains("is-recovery")?"recovery":me.classList.contains("is-locate")?"locate":"");if(Re){var Be=me.querySelector?me.querySelector(".rte-ai-review-action-button"):null;if(!Be){var xe=me.querySelector?me.querySelector(".rte-ai-review-item-action-group-header"):null,Fe=me.querySelector?me.querySelector(".rte-ai-review-item-action-group-detail"):null;xe&&xe.parentNode&&xe.parentNode.removeChild(xe),Fe&&Fe.parentNode&&Fe.parentNode.removeChild(Fe),me.setAttribute("data-rte-ai-review-action-group-current","false"),me.classList.remove("is-current-lane"),me.removeAttribute("aria-label");continue}ke.push(me);var ut=hc(Re),Ge=me.querySelector?me.querySelector(".rte-ai-review-item-action-group-header"):null;Ge||(Ge=document.createElement("span"),Ge.className="rte-ai-review-item-action-group-header",me.firstChild?me.insertBefore(Ge,me.firstChild):me.appendChild(Ge));var Se=Ge.querySelector?Ge.querySelector(".rte-ai-review-item-action-group-title"):null;Se||(Se=document.createElement("span"),Se.className="rte-ai-review-item-action-group-title",Ge.appendChild(Se)),Se.textContent=ut;var nt=Ge.querySelector?Ge.querySelector(".rte-ai-review-item-action-group-badge"):null;nt||(nt=document.createElement("span"),nt.className="rte-ai-review-item-action-group-badge",Ge.appendChild(nt));var Je=me.querySelector?me.querySelector(".rte-ai-review-item-action-group-detail"):null;Je||(Je=document.createElement("span"),Je.className="rte-ai-review-item-action-group-detail",Be?me.insertBefore(Je,Be):me.appendChild(Je));var at=!!l&&Re===l,Ve=mc(Re,oe);if(me.style.removeProperty("order"),me.setAttribute("data-rte-ai-review-action-group-current",at?"true":"false"),me.classList.toggle("is-current-lane",at),at&&de){var Ee="Enter: "+de;nt.textContent=Ee,nt.style.display="",nt.setAttribute("aria-label","Current action lane. "+Ee)}else nt.textContent="",nt.style.display="none",nt.removeAttribute("aria-label");Ve?(Je.textContent=Ve,Je.style.display=""):(Je.textContent="",Je.style.display="none");var Pe=ut?ut+" lane":"";at&&de&&(Pe+=(Pe?". ":"")+"Current action lane. Enter focuses "+de),Ve&&(Pe+=(Pe?". ":"")+Ve),Pe?me.setAttribute("aria-label",Pe):me.removeAttribute("aria-label")}}}ke.sort(function(lt,Ke){var jt=lt.getAttribute("data-rte-ai-review-action-group")||(lt.classList.contains("is-decision")?"decision":lt.classList.contains("is-recovery")?"recovery":lt.classList.contains("is-locate")?"locate":""),St=Ke.getAttribute("data-rte-ai-review-action-group")||(Ke.classList.contains("is-decision")?"decision":Ke.classList.contains("is-recovery")?"recovery":Ke.classList.contains("is-locate")?"locate":"");return gc(jt,l)-gc(St,l)});for(var xt=0;xt<ke.length;xt++)a.appendChild(ke[xt]);return!0}function Na(e){var t=i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null;if(!t||!t.querySelectorAll)return!1;for(var r=t.querySelector(".rte-ai-review-item.is-active"),n=gi(),a=Ma(n,e||Ie(t)),s={},l=t.querySelectorAll(".rte-ai-review-action-button[data-rte-ai-review-action]"),d=0;d<l.length;d++){var m=l[d];if(!(!m||!m.getAttribute)){var R=m.getAttribute("data-rte-ai-review-action")||"",Q=!!r&&r.contains(m)&&!!a&&R===a&&!m.disabled,ie=m.closest?m.closest(".rte-ai-review-item-action-group"):null,ae=ie&&ie.classList?ie.classList.contains("is-decision")?"decision":ie.classList.contains("is-recovery")?"recovery":ie.classList.contains("is-locate")?"locate":"":"";Q&&ie&&ae?(s[ae]||(s[ae]=[]),s[ae].push(m)):ie&&ae&&r&&r.contains(m)&&(s[ae]||(s[ae]=[]),s[ae].push(m));var oe=(m.getAttribute("aria-label")||m.textContent||"").replace(/\.\s*Current Enter target\.$/i,""),te=(m.getAttribute("title")||oe).replace(/\.\s*Current Enter target\.$/i,"");m.setAttribute("data-rte-ai-review-enter-target",Q?"true":"false"),m.classList.toggle("is-enter-target",Q),Q?(m.setAttribute("data-rte-ai-review-enter-target-label","Enter"),oe&&!/current enter target/i.test(oe)&&m.setAttribute("aria-label",oe+". Current Enter target."),te&&!/current enter target/i.test(te)&&(m.title=te+". Current Enter target.")):(m.removeAttribute("data-rte-ai-review-enter-target-label"),oe&&m.setAttribute("aria-label",oe),te&&(m.title=te))}}if(!r)return!1;for(var ae in s)if(s.hasOwnProperty(ae)){var ie=r.querySelector(".rte-ai-review-item-action-group.is-"+ae),se=s[ae];if(!(!ie||!se||!se.length)){se.sort(function(_e,ke){var Ce=_e.getAttribute("data-rte-ai-review-action")||"",me=ke.getAttribute("data-rte-ai-review-action")||"";return vc(ae,Ce,a)-vc(ae,me,a)});for(var ce=0;ce<se.length;ce++)ie.appendChild(se[ce])}}return!0}function Xd(e,t){if(!e||!e.suggestion)return"";var r={};for(var n in e.suggestion)Object.prototype.hasOwnProperty.call(e.suggestion,n)&&(r[n]=e.suggestion[n]);return r.status="pending",qt(r,t)}function Yd(e,t){var r=Nr(),n=Hr(),a=Jr(t);return Er(e==="accept"?"Shortcuts: Enter focus "+a.acceptLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="reject"?"Shortcuts: Enter focus "+a.rejectLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="undo"?"Shortcuts: Enter focus "+r.actionLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="redo"?"Shortcuts: Enter focus "+n.actionLabel+" | A "+a.acceptHint+" | R "+a.rejectHint+" | J/K move | Home/End jump":e==="locate"?"Shortcuts: Enter focus Locate | J/K move | Home/End jump":"Shortcuts: J/K move | Enter focus action | A "+a.acceptHint+" | R "+a.rejectHint+" | Home/End jump")}function Zd(e,t){var r=Nr(),n=Hr(),a=Jr(t);return Zn(e==="accept"?"Enter focuses "+a.acceptLabel+". A uses "+a.acceptLabel+". R uses "+a.rejectLabel+". J/K move items. Home/End jump.":e==="reject"?"Enter focuses "+a.rejectLabel+". A uses "+a.acceptLabel+". R uses "+a.rejectLabel+". J/K move items. Home/End jump.":e==="undo"?"Enter focuses "+r.actionLabel+". A uses "+a.acceptLabel+". R uses "+a.rejectLabel+". J/K move items. Home/End jump.":e==="redo"?"Enter focuses "+n.actionLabel+". A uses "+a.acceptLabel+". R uses "+a.rejectLabel+". J/K move items. Home/End jump.":e==="locate"?"Enter focuses Locate. J/K move items. Home/End jump.":"Enter focuses action. A uses "+a.acceptLabel+". R uses "+a.rejectLabel+". J/K move items. Home/End jump.")}function ef(e,t){return Yd(Ma(e,t),e)}function yc(e,t){return Zd(Ma(e,t),e)}function wc(e){if(!e||!e.getAttribute)return"this control";var t=e.getAttribute("data-rte-ai-review-shortcut-label")||e.getAttribute("aria-label")||e.innerText||e.textContent||e.title||e.getAttribute("data-rte-ai-review-focus-key")||"this control";return String(t||"this control").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")||"this control"}function tf(e){var t=Jr(gi());return Zn("Enter activates "+wc(e)+". A uses "+t.acceptLabel+". R uses "+t.rejectLabel+". J/K move items. Home/End jump.")}function rf(e){var t=Jr(gi());return Er("Shortcuts: Enter "+wc(e)+" | A "+t.acceptHint+" | R "+t.rejectHint+" | J/K move | Home/End jump")}function ko(e){if(!e)return"";var t=Nn();return e.status==="pending"&&t&&t.suggestion&&t.suggestion.id===e.id?"redo":e.status==="pending"?"accept":"locate"}function pl(e,t){if(e){for(;e.firstChild;)e.removeChild(e.firstChild);if(t){var r=String(t||""),n=r.match(/^Shortcuts:\s*/i),a=e.ownerDocument||document,s=n?r.substring(n[0].length):r;if(n){var l=a.createElement("span");l.className="rte-ai-review-shortcuts-label",l.innerText="Shortcuts:",e.appendChild(l),e.appendChild(a.createTextNode(" "))}for(var d=s.split(/(\s+\|\s+|\s+-\s+)/),m=0;m<d.length;m++){var R=d[m];if(R){if(/^\s+[\|\-]\s+$/.test(R)){var Q=a.createElement("span");Q.className="rte-ai-review-shortcuts-separator",Q.innerText=R.replace(/^\s+|\s+$/g,""),e.appendChild(Q);continue}var ie=a.createElement("span");ie.className="rte-ai-review-shortcuts-segment";var ae=R.replace(/^\s+|\s+$/g,""),oe=ae.indexOf(" ");if(oe>0){var te=a.createElement("span");te.className="rte-ai-review-shortcuts-key",te.innerText=ae.substring(0,oe),ie.appendChild(te),ie.appendChild(a.createTextNode(" "));var se=a.createElement("span");se.className="rte-ai-review-shortcuts-copy",se.innerText=ae.substring(oe+1),ie.appendChild(se)}else ie.innerText=ae;e.appendChild(ie)}}}}}function vl(e,t){if(e){var r=t||"";r?e.setAttribute("data-rte-ai-review-shortcut-action",r):e.removeAttribute("data-rte-ai-review-shortcut-action"),e.classList.remove("is-action-focused"),e.classList.remove("is-card-focused"),e.classList.remove("is-panel-focused"),e.classList.remove("is-control-focused"),r==="card"?e.classList.add("is-card-focused"):r==="panel"?e.classList.add("is-panel-focused"):r==="control"?e.classList.add("is-control-focused"):r&&e.classList.add("is-action-focused")}}function nf(e,t){var r=i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null;if(!r||!r.querySelector)return!1;var n=r.querySelector(".rte-ai-review-item.is-active"),a=n&&n.querySelector?n.querySelector(".rte-ai-review-item-actions"):null,s=a&&a.querySelector?a.querySelector(".rte-ai-review-item-shortcuts"):null;if(!n||!a||!e)return s&&s.parentNode&&s.parentNode.removeChild(s),!1;s||(s=document.createElement("div"),s.className="rte-ai-review-item-shortcuts");var l=s.querySelector?s.querySelector(".rte-ai-review-item-shortcuts-title"):null;l||(l=document.createElement("span"),l.className="rte-ai-review-item-shortcuts-title",s.appendChild(l)),l.textContent="Keyboard guide";var d=s.querySelector?s.querySelector(".rte-ai-review-item-shortcuts-body"):null;d||(d=document.createElement("div"),d.className="rte-ai-review-shortcuts rte-ai-review-item-shortcuts-body",s.appendChild(d)),pl(d,e||""),vl(d,t);var m=String(e||"").replace(/^Shortcuts:\s*/i,"");s.setAttribute("aria-label",m?"Keyboard guide. "+m:"Keyboard guide");var R=a.querySelector?a.querySelector(".rte-ai-review-item-action-summary"):null;return R&&R.parentNode===a?R.nextSibling!==s&&(R.nextSibling?a.insertBefore(s,R.nextSibling):a.appendChild(s)):a.firstChild!==s&&(a.firstChild?a.insertBefore(s,a.firstChild):a.appendChild(s)),!0}function Ha(e,t){var r=i.__aiReviewShortcutDisplayNode;r&&(pl(r,e||""),vl(r,t),nf(e||"",t))}function xc(e){var t=e||"";Ha(Jd(t,gi()),t),Ia(t),Na(t),uo(),fo()}function Cc(e){var t=Ie();Ha(Qd(e,t),"card"),Ia(t),Na(t),uo(),fo()}function hl(e,t){var r=t||Ie();Ha(ef(e,r),"panel"),Ia(r),Na(r),uo(),fo()}function af(e){Ha(rf(e),"control"),Ia(Ie()),Na(Ie()),uo(),fo()}function kc(){return i.__aiReviewShortcutDisplayId||(i.__aiReviewShortcutDisplayId="rte-ai-review-shortcuts-"+String(Math.floor(Math.random()*1e9))),i.__aiReviewShortcutDisplayId}function aa(e){if(!(!e||!e.setAttribute)){var t=[kc()],r=e.getAttribute("data-rte-ai-review-extra-describedby")||"";if(r)for(var n=r.split(/\s+/),a=0;a<n.length;a++)n[a]&&t.indexOf(n[a])<0&&t.push(n[a]);e.setAttribute("aria-describedby",t.join(" "))}}function of(e,t){if(e){var r=e.tagName?e.tagName.toUpperCase():"",n=r==="BUTTON"||e.getAttribute("role")==="button";n&&(e.setAttribute("aria-keyshortcuts",Co("Enter Space A R J K Home End")),e.title=tf(e));var a=e.onfocus;e.onfocus=function(s){aa(e),n?af(e):hl(),a&&a.call(this,s)},n&&(e.onkeydown=function(s){var l=(s.key||"").toLowerCase(),d=!1,m="";if(l==="a")d=wo(t,"accept",{focusAction:Ie()});else if(l==="r")d=wo(t,"reject",{focusAction:Ie()});else if(l==="u"&&s.shiftKey&&dn())d=Qn({focusPanel:!0,focusAction:Ie()});else if(l==="u"&&un())d=Hn({focusPanel:!0,focusAction:Ie()});else if(s.key==="ArrowDown"||l==="j"){m="next";var R=cn(t,i.__aiActiveSuggestionId);d=!!(R&&Ar(R,{focusPanel:!0,focusAction:Ie()}))}else if(s.key==="ArrowUp"||l==="k"){m="previous";var Q=yi(t,i.__aiActiveSuggestionId);d=!!(Q&&Ar(Q,{focusPanel:!0,focusAction:Ie()}))}else if(s.key==="Home"){m="first";var ie=xn(t);d=!!(ie&&Ar(ie,{focusPanel:!0,focusAction:Ie()}))}else if(s.key==="End"){m="last";var ae=Xt(t),oe=ae.length?ae[ae.length-1].id:"";d=!!(oe&&Ar(oe,{focusPanel:!0,focusAction:Ie()}))}(d||m)&&(s.preventDefault(),s.stopPropagation()),!d&&m&&Ot(ln(i.__aiActiveSuggestionId,m))})}}function Oa(e,t,r,n){e&&(e.setAttribute("aria-keyshortcuts",Kd(n)),e.title=Wd(n,pt(r),e.getAttribute("aria-label")||e.textContent||""),e.onfocus=function(){i.__aiLastReviewActionFocus=n||"",aa(e),xc(n)},e.onkeydown=function(a){var s=(a.key||"").toLowerCase(),l=!1,d="";s==="a"?l=Hi(r,"accept",{focusAction:Ie()}):s==="r"?l=Hi(r,"reject",{focusAction:Ie()}):s==="u"&&a.shiftKey&&dn()?l=Qn({focusPanel:!0,focusAction:Ie()}):s==="u"&&un()?l=Hn({focusPanel:!0,focusAction:Ie()}):a.key==="ArrowDown"||s==="j"?(d="next",l=xo(t,r,n,"next")):a.key==="ArrowUp"||s==="k"?(d="previous",l=xo(t,r,n,"previous")):a.key==="Home"?(d="first",l=xo(t,r,n,"first")):a.key==="End"&&(d="last",l=xo(t,r,n,"last")),(l||d)&&(a.preventDefault(),a.stopPropagation()),!l&&d&&Ot(ln(r,d))})}function _c(e){yn();var t=e?pt(e):null,r=t?In(t.id):null;return!t||t.status!=="pending"||!r?!1:(Zt(t.id,{preserveEmptyPreview:!0}),r.scrollIntoView&&r.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"}),r.classList.add("is-focused"),i.__aiReviewEmptyPreviewTimer&&clearTimeout(i.__aiReviewEmptyPreviewTimer),i.__aiReviewEmptyPreviewTimer=setTimeout(function(){r&&r.classList&&r.classList.remove("is-focused")},1200),!0)}function lf(e){if(!document||!document.querySelectorAll||!window)return 0;var t;try{t=document.querySelectorAll("header, nav, [data-rte-ai-sticky-offset], [data-rte-sticky-offset], .topbar, .topnav, .site-header, .navbar, [class*='SiteHeader'], [class*='site-header']")}catch{return 0}for(var r=Math.min(window.innerHeight||900,320),n=0,a=0;a<t.length;a++){var s=t[a];if(!(!s||s===e||e&&e.contains&&e.contains(s))){var l=s.getBoundingClientRect?s.getBoundingClientRect():null;if(!(!l||l.height<8||l.width<80)&&!(l.top>24||l.bottom<=0||l.bottom>r)){var d=window.getComputedStyle?window.getComputedStyle(s):null;d&&(d.display==="none"||d.visibility==="hidden"||parseFloat(d.opacity||"1")<=.01)||(n=Math.max(n,l.bottom))}}}return Math.max(0,Math.ceil(n))}function Sc(e){if(!(!e||!e.style)){var t=lf(e);t>0?e.style.setProperty("--rte-ai-detected-top-chrome",t+"px"):e.style.removeProperty("--rte-ai-detected-top-chrome")}}function ei(){i.__aiReviewPanel&&i.__aiReviewPanel.parentNode&&i.__aiReviewPanel.parentNode.removeChild(i.__aiReviewPanel),i.__aiReviewShell&&i.__aiReviewShell.classList&&i.__aiReviewShell.classList.remove("rte-ai-review-host"),i.__aiReviewShell&&i.__aiReviewShell.style&&(i.__aiReviewShell.style.minHeight=typeof i.__aiReviewOriginalMinHeight=="string"?i.__aiReviewOriginalMinHeight:"",i.__aiReviewShell.style.removeProperty("--rte-ai-detected-top-chrome")),i.__aiReviewPanel=null,i.__aiReviewSubtitleNode=null,i.__aiReviewSyncBadgeNode=null,i.__aiReviewSyncButton=null,i.__aiLastReviewActionFocus="",i.__aiReviewShell=null,i.__aiReviewOriginalMinHeight=null,i.__aiLastReviewEmptyAnnouncement="",i.__aiReviewEmptyPreviewTimer&&(clearTimeout(i.__aiReviewEmptyPreviewTimer),i.__aiReviewEmptyPreviewTimer=null),Qi({skipUpdate:!0,skipRender:!0}),i.__aiReviewEmptyPreviewSuggestionId&&Zt(null),i.__aiReviewPrimaryEmptyAction=null,i.__aiReviewMoveEmptyPreviewFocus=null}function _o(e){return e=e||{},Zi(),ui(!0),ft(!!e.focusPanel)}function sf(e){return i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?(ei(),!1):_o(e)}var oa={eyeOn:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/></svg>',eyeOff:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" y1="2" x2="22" y2="22"/></svg>',checkAll:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 13l4 4L14 8"/><path d="M10 13l4 4L22 8"/></svg>',check:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 12 10 18 20 6"/></svg>',x:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="6" y1="6" x2="18" y2="18"/><line x1="6" y1="18" x2="18" y2="6"/></svg>',target:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/></svg>',bulb:'<svg viewBox="0 0 24 24" width="11" height="11" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18h6"/><path d="M10 22h4"/><path d="M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.2 1 2v.3h6v-.3c0-.8.4-1.5 1-2A7 7 0 0 0 12 2z"/></svg>',arrowRight:'<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="13 6 19 12 13 18"/></svg>',send:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2" fill="currentColor"/></svg>',sparkles:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1"/><path d="M12 8 13.4 10.6 16 12l-2.6 1.4L12 16l-1.4-2.6L8 12l2.6-1.4L12 8z" fill="currentColor"/></svg>',refresh:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="1 4 1 10 7 10"/><path d="M3.5 15a9 9 0 1 0 2.1-9.4L1 10"/></svg>',external:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',trash:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6"/><path d="M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></svg>',cursorText:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 4h2a3 3 0 0 1 3 3v0a3 3 0 0 0 3 3h0M9 20h2a3 3 0 0 0 3-3v0a3 3 0 0 1 3-3h0"/><line x1="11" y1="4" x2="11" y2="20"/></svg>',document:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/></svg>',inbox:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>',history:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><polyline points="3 3 3 8 8 8"/><polyline points="12 7 12 12 15 14"/></svg>',filter:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>',bot:'<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="8" width="16" height="12" rx="3"/><circle cx="9" cy="14" r="1.3" fill="currentColor"/><circle cx="15" cy="14" r="1.3" fill="currentColor"/><line x1="12" y1="4" x2="12" y2="8"/><circle cx="12" cy="3" r="1.2" fill="currentColor"/><line x1="4" y1="13" x2="2" y2="13"/><line x1="22" y1="13" x2="20" y2="13"/></svg>',chat:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>',wand:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 4V2M15 14v-2M8 9h2M20 9h2M17.8 11.8L19 13M15 9h0M17.8 6.2L19 5M3 21l9-9M12.2 6.2L11 5"/></svg>',list:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>',globe:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',heading:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 4v16M18 4v16M6 12h12"/></svg>',plus:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',pencil:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>',spinner:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" class="rte-ai-spinner-svg"><path d="M12 3a9 9 0 1 0 9 9" /></svg>',more:'<svg viewBox="0 0 24 24" width="13" height="13" fill="currentColor" aria-hidden="true"><circle cx="6" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="18" cy="12" r="1.6"/></svg>',clipboard:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="3" width="8" height="3" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>',shrink:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" y1="10" x2="21" y2="3"/><line x1="3" y1="21" x2="10" y2="14"/></svg>',expand:'<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>',info:'<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><circle cx="12" cy="8" r="1" fill="currentColor"/></svg>'};function cf(e){if(!e)return"wand";var t=(e.tone||e.intent||e.id||"").toLowerCase();return t.indexOf("summar")!==-1?"list":t.indexOf("proofread")!==-1||t.indexOf("review")!==-1?"pencil":t.indexOf("translate")!==-1||t.indexOf("language")!==-1?"globe":t.indexOf("heading")!==-1||t.indexOf("structure")!==-1||t.indexOf("outline")!==-1?"heading":t.indexOf("expand")!==-1||t.indexOf("support")!==-1||t.indexOf("add")!==-1?"plus":"wand"}function dt(e,t,r){if(e){if(e.textContent="",t&&oa[t]){var n=e.ownerDocument.createElement("span");n.className="rte-ai-review-v2-action-icon",n.setAttribute("aria-hidden","true"),n.innerHTML=oa[t],e.appendChild(n)}if(r){var a=e.ownerDocument.createElement("span");a.className="rte-ai-review-v2-action-label",a.textContent=r,e.appendChild(a)}}}function Oi(e){var t=Di();if(!t)return!1;for(var r=jr(),n=Ft().slice(),a=ic(),s=ac(n),l=r.typeFilter||"all",d=!1,m=0;m<s.length;m++)if(s[m].value===l){d=!0;break}d||(l="all",r.typeFilter="all");var R=a.pending>0||a.stale>0,Q=r.activeTab||"pending";Q!=="pending"&&Q!=="resolved"&&Q!=="all"&&(Q="pending"),Q==="pending"&&!R&&a.total>0&&(Q="resolved",r.activeTab="resolved");var ie=a.pending+a.stale,ae=a.accepted+a.rejected;if(ei(),i.__aiReviewOriginalMinHeight=t.style&&t.style.minHeight||"",t.classList.add("rte-ai-review-host"),Sc(t),t.style){var oe=window.innerWidth<=900?460:520;t.style.minHeight=Math.max(t.offsetHeight||0,oe)+"px"}i.__aiReviewShell=t;var te=o(t,"div","","rte-ai-review-panel rte-ai-review-v2");te.setAttribute("role","complementary"),te.setAttribute("aria-label",c.text_aireview||"AI Review"),te.tabIndex=-1,i.__aiReviewPanel=te,te.onkeydown=function(je){je.key==="Escape"&&(je.preventDefault(),ei(),i.focus())};var se=o(te,"div","","rte-ai-review-v2-header"),ce=o(se,"span","","rte-ai-review-v2-icon");ce.innerHTML=c.svgCode_aiassist_review||c.svgCode_aiassist||"",o(se,"div","","rte-ai-review-v2-title",c.text_aireview||"AI Review");var Ne=o(se,"button","","rte-ai-review-v2-close");Ne.type="button",Ne.setAttribute("aria-label","Close AI review"),Ne.title="Close",Ne.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12"/><path d="M18 6L6 18"/></svg>',Ne.onclick=function(){ei(),i.focus()};var de=o(te,"div","","rte-ai-review-v2-tabs");de.setAttribute("role","tablist");function _e(je,qe,Pt,rr){var ze=o(de,"button","","rte-ai-review-v2-tab"+(Q===je?" is-active":""));if(ze.type="button",ze.setAttribute("role","tab"),ze.setAttribute("aria-selected",Q===je?"true":"false"),ze.setAttribute("data-rte-ai-review-tab",je),qe&&oa[qe]){var Me=ze.ownerDocument.createElement("span");Me.className="rte-ai-review-v2-tab-icon",Me.setAttribute("aria-hidden","true"),Me.innerHTML=oa[qe],ze.appendChild(Me)}var tt=ze.ownerDocument.createElement("span");if(tt.className="rte-ai-review-v2-tab-label",tt.textContent=Pt,ze.appendChild(tt),typeof rr=="number"){var bt=ze.ownerDocument.createElement("span");bt.className="rte-ai-review-v2-tab-count"+(rr>0?" is-active":""),bt.textContent=String(rr),ze.appendChild(bt)}return ze.onclick=function(){Q!==je&&(jr().activeTab=je,Oi(!0))},ze}_e("pending","inbox","To review",ie),_e("resolved","history","History",ae),_e("all","filter","All",a.total);var ke=o(te,"div","","rte-ai-review-v2-toolbar");if(s.length>1){for(var Ce=o(ke,"select","","rte-ai-review-v2-select"),me=0;me<s.length;me++){var Re=o(Ce,"option","","",s[me].label);Re.value=s[me].value}Ce.value=l,Ce.onchange=function(){jr().typeFilter=Ce.value||"all",Oi(!0)}}for(var Be=0,xe=0;xe<n.length;xe++)n[xe].status==="pending"&&On(n[xe],l)&&Be++;if(Q==="pending"){o(ke,"div","","rte-ai-review-v2-toolbar-spacer");var Fe=o(ke,"button","","rte-ai-review-v2-batch is-accept");Fe.type="button",Fe.disabled=!Be,dt(Fe,"checkAll","Accept all"),Fe.onclick=function(){cc(l)&&Oi(!0)};var ut=o(ke,"button","","rte-ai-review-v2-batch is-reject");ut.type="button",ut.disabled=!Be,dt(ut,"x","Reject all"),ut.onclick=function(){uc(l)&&Oi(!0)}}for(var Ge=o(te,"div","","rte-ai-review-v2-body"),Se=[],nt=0;nt<n.length;nt++)if(!(n[nt].changeType&&n[nt].changeType!=="ai-preview")&&On(n[nt],l)){var Je=n[nt].status,at=Je==="pending"||Je==="stale";Q==="pending"&&!at||Q==="resolved"&&at||Se.push(n[nt])}Se.sort(function(je,qe){var Pt=je.status==="pending"||je.status==="stale",rr=qe.status==="pending"||qe.status==="stale";return Pt!==rr?Pt?-1:1:(qe.timestamp||0)-(je.timestamp||0)});for(var Ve=i.__aiActiveSuggestionId||"",Ee=!1,Pe=0;Pe<Se.length;Pe++)if(Se[Pe].id===Ve){Ee=!0;break}if(!Ee){for(var xt=0;xt<Se.length;xt++)if(Se[xt].status==="pending"||Se[xt].status==="stale"){Zt(Se[xt].id),Ve=Se[xt].id;break}}var lt=pt(Ve),Ke=a.total?Math.max(0,Math.min(100,Math.round(ae/a.total*100))):0,jt=l==="all"?"All types":M(l),St=o(te,"div","","rte-ai-review-v2-center");te.insertBefore(St,Ge),St.setAttribute("role","group"),St.setAttribute("aria-label","AI review summary");function mt(je,qe,Pt,rr){var ze=o(St,"div","","rte-ai-review-v2-center-tile "+je);return o(ze,"span","","rte-ai-review-v2-center-label",qe),o(ze,"span","","rte-ai-review-v2-center-value",Pt),o(ze,"span","","rte-ai-review-v2-center-detail",rr),ze}mt("is-queue","Queue",Be+" pending",jt+(Q==="pending"?" to review":" filter")),mt("is-progress","Progress",Ke+"% done",ae+" resolved of "+a.total);var Tt=lt?lt.status==="pending"||lt.status==="stale"?"Review current":"Inspect item":Be?"Pick an item":a.total?"All caught up":"Start with Ask AI",tr=lt?er(lt.originalText||lt.resultText||"AI suggestion",72):Be?"Select a card below to compare the change.":a.total?"History keeps accepted and rejected changes.":"AI suggestions will appear here.",yr=mt("is-next","Next step",Tt,tr);if(lt){var Dt=o(yr,"button","","rte-ai-review-v2-center-action","Focus");Dt.type="button",Dt.setAttribute("aria-label","Focus the current AI review item"),Dt.onclick=function(){Zt(Ve),Oi(!0)}}if(Se.length)for(var vt=0;vt<Se.length;vt++)(function(je){var qe=o(Ge,"div","","rte-ai-review-v2-item is-"+je.status+(je.id===Ve?" is-active":""));qe.setAttribute("data-rte-ai-review-id",je.id),qe.setAttribute("role","group");var Pt=o(qe,"div","","rte-ai-review-v2-item-head");o(Pt,"span","","rte-ai-review-v2-item-status is-"+je.status,ya(je.status)),je.suggestionType&&je.suggestionType!=="other"&&o(Pt,"span","","rte-ai-review-v2-item-type",M(je.suggestionType)),je.snapshot&&je.snapshot.hasSelection?o(Pt,"span","","rte-ai-review-v2-item-scope","Selection"):o(Pt,"span","","rte-ai-review-v2-item-scope","Document");var rr=er(je.originalText||je.resultText||"AI suggestion",120);if(o(qe,"div","","rte-ai-review-v2-item-title",rr),je.id===Ve){if(je.originalText&&je.resultText&&u(je.originalText)!==u(je.resultText)){var ze=o(qe,"div","","rte-ai-review-v2-compare"),Me=o(ze,"div","","rte-ai-review-v2-before");o(Me,"span","","rte-ai-review-v2-compare-label","Current"),o(Me,"div","","rte-ai-review-v2-compare-text",u(je.originalText));var tt=o(ze,"span","","rte-ai-review-v2-compare-arrow");tt.setAttribute("aria-hidden","true"),tt.innerHTML=oa.arrowRight;var bt=o(ze,"div","","rte-ai-review-v2-after");o(bt,"span","","rte-ai-review-v2-compare-label","Suggested"),o(bt,"div","","rte-ai-review-v2-compare-text",u(je.resultText))}if(je.reason){var ye=o(qe,"div","","rte-ai-review-v2-reason"),ht=o(ye,"span","","rte-ai-review-v2-reason-label"),Oe=ye.ownerDocument.createElement("span");Oe.className="rte-ai-review-v2-reason-icon",Oe.setAttribute("aria-hidden","true"),Oe.innerHTML=oa.bulb,ht.appendChild(Oe);var Qe=ye.ownerDocument.createElement("span");Qe.textContent="Why",ht.appendChild(Qe),o(ye,"span","","rte-ai-review-v2-reason-text",je.reason)}var yt=o(qe,"div","","rte-ai-review-v2-actions"),wt=o(yt,"button","","rte-ai-review-v2-action is-locate");if(wt.type="button",dt(wt,"target","Locate"),wt.onclick=function(ot){ot&&ot.stopPropagation&&ot.stopPropagation(),Ur(je.id)},je.status==="pending"||je.status==="stale"){var Ct=o(yt,"button","","rte-ai-review-v2-action is-accept");Ct.type="button",dt(Ct,"check","Accept"),Ct.onclick=function(ot){ot&&ot.stopPropagation&&ot.stopPropagation(),Hi(je.id,"accept",{focusAction:"accept"})};var Ut=o(yt,"button","","rte-ai-review-v2-action is-reject");Ut.type="button",dt(Ut,"x","Reject"),Ut.onclick=function(ot){ot&&ot.stopPropagation&&ot.stopPropagation(),Hi(je.id,"reject",{focusAction:"reject"})}}}qe.onclick=function(ot){ot&&ot.target&&ot.target.closest&&ot.target.closest(".rte-ai-review-v2-action")||je.id!==Ve&&(Zt(je.id),Oi(!0))}})(Se[vt]);else{var Kt=o(Ge,"div","","rte-ai-review-v2-empty");a.total===0?(o(Kt,"div","","rte-ai-review-v2-empty-art is-prompt"),o(Kt,"div","","rte-ai-review-v2-empty-title","No AI suggestions yet"),o(Kt,"div","","rte-ai-review-v2-empty-detail","Ask AI or AI Chat will drop suggestions here for you to accept or reject.")):Q==="pending"?(o(Kt,"div","","rte-ai-review-v2-empty-art is-clear"),o(Kt,"div","","rte-ai-review-v2-empty-title","Nothing to review"),o(Kt,"div","","rte-ai-review-v2-empty-detail","You're all caught up. Switch to History to see past decisions.")):Q==="resolved"?(o(Kt,"div","","rte-ai-review-v2-empty-title","No history yet"),o(Kt,"div","","rte-ai-review-v2-empty-detail","Decisions you make on the To review tab will show up here.")):(o(Kt,"div","","rte-ai-review-v2-empty-title","No suggestions match this filter"),o(Kt,"div","","rte-ai-review-v2-empty-detail","Try a different type, or pick a different tab."))}if(e)try{te.focus({preventScroll:!0})}catch{try{te.focus()}catch{}}return!0}function ft(e,t){if(c.aiToolkitReviewLegacyLayout!==!0)return Oi(e);t=t||{},yn();var r=Di();if(!r)return!1;for(var n=i.__aiReviewPanel&&i.__aiReviewPanel.isConnected?i.__aiReviewPanel:null,a=document.activeElement,s=n&&a&&a.closest?a.closest("[data-rte-ai-review-id]"):null,l=!e&&n&&a&&a.getAttribute&&a.getAttribute("data-rte-ai-review-focus-key")&&n.contains(a)&&a.getAttribute("data-rte-ai-review-focus-key")||"",d=!!(!e&&n&&s&&s.getAttribute&&s.getAttribute("data-rte-ai-review-id")===i.__aiActiveSuggestionId&&n.contains(a)),m=d&&a&&a!==s&&a.getAttribute&&a.getAttribute("data-rte-ai-review-action")||"",R=t.focusAction||"",Q=jr(),ie=Ft().slice(),ae=ic(),oe=ru(),te=ae.pending>0||ae.stale>0,se=Q.showResolved||!te&&ae.total>0||!!oe,ce=ac(ie),Ne=Od(ie),de=Q.typeFilter||"all",_e=!1,ke=0;ke<ce.length;ke++)if(ce[ke].value===de){_e=!0;break}_e||(de="all",Q.typeFilter="all");for(var Ce=[],me=0;me<ie.length;me++)if(!(ie[me].changeType&&ie[me].changeType!=="ai-preview")){var Re=se||ie[me].status==="pending"||ie[me].status==="stale",Be=Yr(ie[me].id)>0;Re&&(On(ie[me],de)||Be)&&Ce.push(ie[me])}Ce=Ol(Ce);for(var xe=0,Fe=0;Fe<Ce.length;Fe++)Ce[Fe].status==="pending"&&On(Ce[Fe],de)&&xe++;var ut=cn("all",""),Ge=xn(de),Se=di(),nt=Nn();Zt(Ge||null);var Je=yo(de,Ge),at=cn(de,Ge);if(ei(),i.__aiReviewOriginalMinHeight=r.style&&r.style.minHeight||"",r.classList.add("rte-ai-review-host"),Sc(r),r.style){var Ve=window.innerWidth<=900?460:520;r.style.minHeight=Math.max(r.offsetHeight||0,Ve)+"px"}i.__aiReviewShell=r;var Ee=o(r,"div","","rte-ai-review-panel");Ee.setAttribute("role","complementary"),Ee.setAttribute("aria-label",c.text_aireview||"AI Review"),Ee.setAttribute("aria-keyshortcuts",Co("Enter Space A R J K Home End")),Ee.tabIndex=-1,i.__aiReviewPanel=Ee,i.__aiReviewPrimaryEmptyAction=null,Ee.onkeydown=function(ge){var $e=(ge.key||"").toLowerCase(),Rt=ge.target&&ge.target.tagName?ge.target.tagName.toUpperCase():"";if(ge.key==="Escape"){ge.preventDefault(),ei(),i.focus();return}if(!(ge.ctrlKey||ge.metaKey||ge.altKey||Rt==="INPUT"||Rt==="TEXTAREA"||Rt==="SELECT"||Rt==="BUTTON"))if(!xn(de)&&i.__aiReviewMoveEmptyPreviewFocus&&($e==="arrowdown"||$e==="j"||$e==="arrowup"||$e==="k"||$e==="arrowright"||$e==="arrowleft"||$e==="home"||$e==="end"))ge.preventDefault(),$e==="arrowdown"||$e==="j"||$e==="arrowright"?i.__aiReviewMoveEmptyPreviewFocus("next"):$e==="arrowup"||$e==="k"||$e==="arrowleft"?i.__aiReviewMoveEmptyPreviewFocus("previous"):$e==="home"?i.__aiReviewMoveEmptyPreviewFocus("first"):$e==="end"&&i.__aiReviewMoveEmptyPreviewFocus("last");else if($e==="arrowdown"||$e==="j"){ge.preventDefault();var or=cn(de,i.__aiActiveSuggestionId);or?Ar(or,{focusPanel:!0,focusAction:Ie(Ee)}):i.__aiActiveSuggestionId&&Ot(ln(i.__aiActiveSuggestionId,"next"))}else if($e==="arrowup"||$e==="k"){ge.preventDefault();var br=yi(de,i.__aiActiveSuggestionId);br?Ar(br,{focusPanel:!0,focusAction:Ie(Ee)}):i.__aiActiveSuggestionId&&Ot(ln(i.__aiActiveSuggestionId,"previous"))}else if($e==="home"){ge.preventDefault();var kr=xn(de);kr&&kr!==i.__aiActiveSuggestionId?Ar(kr,{focusPanel:!0,focusAction:Ie(Ee)}):i.__aiActiveSuggestionId&&Ot(ln(i.__aiActiveSuggestionId,"first"))}else if($e==="end"){ge.preventDefault();var an=Xt(de),fe=an.length?an[an.length-1].id:"";fe&&fe!==i.__aiActiveSuggestionId?Ar(fe,{focusPanel:!0,focusAction:Ie(Ee)}):i.__aiActiveSuggestionId&&Ot(ln(i.__aiActiveSuggestionId,"last"))}else if($e==="enter"||$e===" "){ge.preventDefault();var Xe=xn(de);Xe?dc(Xe,Ie(Ee)):i.__aiReviewPrimaryEmptyAction&&i.__aiReviewPrimaryEmptyAction.isConnected&&!i.__aiReviewPrimaryEmptyAction.disabled&&i.__aiReviewPrimaryEmptyAction.click()}else $e==="a"?(ge.preventDefault(),wo(de,"accept",{focusAction:Ie(Ee)})):$e==="r"?(ge.preventDefault(),wo(de,"reject",{focusAction:Ie(Ee)})):$e==="u"&&ge.shiftKey&&nt?(ge.preventDefault(),Qn({focusPanel:!0,focusAction:Ie(Ee)})):$e==="u"&&Se&&(ge.preventDefault(),Hn({focusPanel:!0,focusAction:Ie(Ee)}))};var Pe=o(Ee,"div","","rte-ai-review-header"),xt=o(Pe,"div","","rte-ai-review-header-copy"),lt=o(xt,"div","","rte-ai-review-header-eyebrow");o(lt,"span","","rte-ai-review-header-kicker","Review workspace"),o(lt,"span","","rte-ai-review-header-status is-status",ms(ae,xe,de)),de!=="all"&&o(lt,"span","","rte-ai-review-header-status is-filter",M(de)+" queue"),oe&&oe.count&&o(lt,"span","","rte-ai-review-header-status is-remote",oe.count+" shared");var Ke=o(xt,"div","","rte-ai-review-title-row"),jt=o(Ke,"span","","rte-ai-review-title-icon");jt.innerHTML=c.svgCode_aiassist_review||c.svgCode_aiassist||"",o(Ke,"div","","rte-ai-review-title",c.text_aireview||"AI Review"),Ri()&&(i.__aiReviewSyncBadgeNode=o(Ke,"span","","rte-ai-review-sync-badge","")),i.__aiReviewSubtitleNode=o(xt,"div","","rte-ai-review-subtitle",Wc());var St=o(xt,"div","","rte-ai-review-header-meta");Je.total&&Je.index&&o(St,"span","","rte-ai-review-header-meta-pill is-current","Item "+Je.index+" of "+Je.total),ae.pending>0?o(St,"span","","rte-ai-review-header-meta-pill is-pending",(de!=="all"?xe:ae.pending)+(de!=="all"?" in this view":" pending now")):ae.stale>0?o(St,"span","","rte-ai-review-header-meta-pill is-stale",ae.stale+" need refresh"):o(St,"span","","rte-ai-review-header-meta-pill is-complete","Queue complete"),de!=="all"&&ae.pending>0&&xe!==ae.pending&&o(St,"span","","rte-ai-review-header-meta-pill is-total",ae.pending+" total pending");var mt=o(Pe,"div","","rte-ai-review-header-actions"),Tt=null,tr=null,yr=null,Dt=o(mt,"div","","rte-ai-review-header-utility");if(Ri()){Tt=Tt||g(mt,"rte-ai-review-header-group is-context","Context");var Kt=o(Tt,"button","","secondary rte-ai-review-header-button is-sync","Sync now");Kt.type="button",Kt.setAttribute("data-rte-ai-review-focus-key","sync-now"),Kt.onclick=function(){ui(!0)},i.__aiReviewSyncButton=Kt}var vt=tu();if(vt&&pt(vt)){Tt=Tt||g(mt,"rte-ai-review-header-group is-context","Context");var je=o(Tt,"button","","secondary rte-ai-review-header-button is-shared","Newest shared");je.type="button",je.setAttribute("data-rte-ai-review-focus-key","newest-shared"),je.setAttribute("aria-label","Jump to the newest shared AI review update"),je.onclick=function(){Ur(vt)}}if(Ge){Tt=Tt||g(mt,"rte-ai-review-header-group is-context","Context");var qe=o(Tt,"button","","secondary rte-ai-review-header-button is-locate-current","Locate current");qe.type="button",qe.setAttribute("data-rte-ai-review-focus-key","locate-current"),qe.setAttribute("aria-label","Locate the current active AI review item in the editor"),qe.onclick=function(){Ur(Ge)}}var Pt=yi(de,Ge);if(Pt){tr=tr||g(mt,"rte-ai-review-header-group is-move","Navigate");var rr=o(tr,"button","","secondary rte-ai-review-header-button is-nav","Previous");rr.type="button",rr.setAttribute("data-rte-ai-review-focus-key","previous-pending"),rr.setAttribute("aria-label","Jump to the previous pending AI review item in the current filter"),rr.onclick=function(){Ar(Pt,{focusPanel:!0})}}if(at){tr=tr||g(mt,"rte-ai-review-header-group is-move","Navigate");var ze=o(tr,"button","","secondary rte-ai-review-header-button is-nav","Next pending");ze.type="button",ze.setAttribute("data-rte-ai-review-focus-key","next-pending"),ze.setAttribute("aria-label","Jump to the next pending AI review item in the current filter"),ze.onclick=function(){Ar(at,{focusPanel:!0})}}if(Se){var Me=Nr(Se);yr=yr||g(mt,"rte-ai-review-header-group is-recover","Recover");var tt=o(yr,"button","","secondary rte-ai-review-header-button is-undo",Me.actionLabel);tt.type="button",tt.setAttribute("data-rte-ai-review-focus-key","undo-last"),tt.setAttribute("data-rte-ai-review-shortcut-label",Me.shortcutLabel),tt.setAttribute("aria-label","Undo the "+Me.detailLabel+(Me.summaryText?' for "'+Me.summaryText+'"':"")+" and reopen it in AI Review"),tt.onclick=function(){Hn({focusPanel:!0,focusAction:Ie()})}}if(nt){var bt=Hr(nt);yr=yr||g(mt,"rte-ai-review-header-group is-recover","Recover");var ye=o(yr,"button","","secondary rte-ai-review-header-button is-redo",bt.actionLabel);ye.type="button",ye.setAttribute("data-rte-ai-review-focus-key","redo-last"),ye.setAttribute("data-rte-ai-review-shortcut-label",bt.shortcutLabel),ye.setAttribute("aria-label","Redo the "+bt.detailLabel+(bt.summaryText?' for "'+bt.summaryText+'"':"")+" in AI Review"),ye.onclick=function(){Qn({focusPanel:!0,focusAction:Ie()})}}var ht=o(Dt,"button","","rte-ai-panel-close-button is-review-close");ht.type="button",ht.setAttribute("data-rte-ai-review-focus-key","close-review"),ht.setAttribute("aria-label","Close AI review"),ht.title="Close",ht.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12"/><path d="M18 6L6 18"/></svg>',ht.onclick=function(){ei()},Hl();var Oe=o(Ee,"div","","rte-ai-review-stack rte-ai-review-overview");v(Oe,"rte-ai-review-section-label is-overview","Queue overview");var Qe=ae.accepted+ae.rejected+ae.stale,yt=ae.total?Math.max(0,Math.min(100,Math.round(Qe/ae.total*100))):0,wt=o(Oe,"div","","rte-ai-review-overview-hero"),Ct=o(wt,"div","","rte-ai-review-overview-status-row");o(Ct,"span","","rte-ai-review-overview-pill is-status",ms(ae,xe,de)),o(Ct,"span","","rte-ai-review-overview-pill is-progress",Qe+" of "+ae.total+" reviewed"),de!=="all"&&o(Ct,"span","","rte-ai-review-overview-pill is-filter",M(de)+" focus"),oe&&oe.count&&o(Ct,"span","","rte-ai-review-overview-pill is-remote",oe.count+" shared"),o(wt,"div","","rte-ai-review-overview-title",Pu(ae,xe,de,Je)),o(wt,"div","","rte-ai-review-overview-detail",Mu(ae,xe,de,oe));var Ut=o(wt,"div","","rte-ai-review-overview-progress"),ot=o(Ut,"div","","rte-ai-review-overview-progress-bar"),Lr=o(ot,"span","","rte-ai-review-overview-progress-fill");Lr.style.width=yt+"%",o(Ut,"span","","rte-ai-review-overview-progress-label",yt+"% complete");var Wt=o(Oe,"div","","rte-ai-review-summary");o(Wt,"span","","rte-ai-review-summary-pill is-pending",ae.pending+" pending"),o(Wt,"span","","rte-ai-review-summary-pill is-accepted",ae.accepted+" accepted"),o(Wt,"span","","rte-ai-review-summary-pill is-rejected",ae.rejected+" rejected"),ae.stale&&o(Wt,"span","","rte-ai-review-summary-pill is-stale",ae.stale+" stale"),Je.total&&Je.index&&o(Wt,"span","","rte-ai-review-summary-pill is-current","Item "+Je.index+" of "+Je.total),de!=="all"&&o(Wt,"span","","rte-ai-review-summary-pill is-filtered",M(de)+" filter - "+xe+" pending"),oe&&o(Wt,"span","","rte-ai-review-summary-pill is-remote",oe.count+" new shared");var Rr=pt(Ge),cr=de==="all"?"All queues":M(de),Cn=de==="all"?ae.pending:xe,fn=Rr?qt(Rr,Ie(Ee))||"Review item":ut?"Open next queue":ae.pending?"Choose queue":"All clear",wr=Rr?Je&&Je.total&&Je.index?"Item "+Je.index+" of "+Je.total+" in "+cr.toLowerCase()+".":"Current suggestion is ready.":ut?"There are pending suggestions outside this filter.":ae.pending?"Pick a queue filter to continue.":"No pending AI suggestions remain.",At=o(Oe,"div","","rte-ai-review-center");At.setAttribute("role","group"),At.setAttribute("aria-label","AI review center summary");function Et(ge,$e,Rt,or){var br=o(At,"div","","rte-ai-review-center-tile "+ge);return o(br,"div","","rte-ai-review-center-label",$e),o(br,"div","","rte-ai-review-center-value",Rt),o(br,"div","","rte-ai-review-center-detail",or),br}Et("is-queue","Queue",Cn+" pending",cr+(de!=="all"&&ae.pending!==xe?" - "+ae.pending+" total pending":"")),Et("is-progress","Progress",yt+"% done",Qe+" reviewed of "+ae.total+" total");var Zr=Et("is-next","Next step",fn,wr);if(Ge||ut){var xr=o(Zr,"button","","rte-ai-review-center-action",Ge?"Focus":"Open");xr.type="button",xr.setAttribute("data-rte-ai-review-focus-key",Ge?"center-focus-current":"center-open-next"),xr.setAttribute("aria-label",Ge?"Focus the current AI review item":"Open the next pending AI review queue"),xr.onclick=function(){Ge?Ar(Ge,{focusPanel:!0,focusAction:Ie()}):ut&&(Q.typeFilter="all",Ar(ut,{focusPanel:!0,focusAction:Ie(),openedQueue:!0}))}}var Cr=eo(nt);if(Cr){var qi=Hr(nt);o(Oe,"div","","rte-ai-review-summary-detail is-redo",Cr+" Press Shift+U to "+qi.shortcutLabel+".");var pn=qo(2);if(pn.length){var ti=o(Oe,"div","","rte-ai-review-summary-history is-redo");o(ti,"div","","rte-ai-review-summary-history-title","Then");for(var Gt=0;Gt<pn.length;Gt++){var qn=pn[Gt],en=o(ti,"div","","rte-ai-review-summary-history-item");o(en,"div","","rte-ai-review-summary-history-label",qn.label),o(en,"div","","rte-ai-review-summary-history-detail",qn.detail)}}}if(oe){var vn=o(Oe,"div","","rte-ai-review-activity-card"),ri=o(vn,"div","","rte-ai-review-activity-copy");o(ri,"div","","rte-ai-review-activity-title",oe.title),o(ri,"div","","rte-ai-review-activity-detail",oe.detail);var ur=o(vn,"button","","secondary rte-ai-review-activity-button","Got it");ur.type="button",ur.setAttribute("data-rte-ai-review-focus-key","dismiss-activity"),ur.setAttribute("aria-label","Dismiss shared AI review update notice"),ur.onclick=function(){Io(),ft(!0)}}var Br=o(Ee,"div","","rte-ai-review-stack rte-ai-review-navigation");v(Br,"rte-ai-review-section-label is-controls","Filter and batch");var kn=o(Br,"div","","rte-ai-review-controls"),Ci=null;if(ce.length>1){Ci=H(kn,"rte-ai-review-control-group is-scope","Queue scope");var _n=o(Ci,"select","","rte-ai-review-filter-select");_n.setAttribute("data-rte-ai-review-focus-key","type-filter");for(var qr=0;qr<ce.length;qr++){var ni=o(_n,"option","","",ce[qr].label);ni.value=ce[qr].value}_n.value=de,_n.onchange=function(){Q.typeFilter=_n.value||"all",ft(!0)}}var jn=H(kn,"rte-ai-review-control-group is-visibility","Visibility"),Un=o(jn,"button","","secondary rte-ai-review-control-button is-toggle-resolved",se?"Pending only":"Show resolved");Un.type="button",Un.setAttribute("data-rte-ai-review-focus-key","toggle-resolved"),Un.onclick=function(){Q.showResolved=!se,ft(!0)};var zr=H(kn,"rte-ai-review-control-group is-batch","Batch review"),vr=o(zr,"button","","secondary rte-ai-review-control-button is-accept-batch","Accept all");vr.type="button",vr.setAttribute("data-rte-ai-review-focus-key","accept-all"),vr.disabled=de==="all"?!ae.pending:!xe,de!=="all"&&(vr.innerText="Accept filtered"),vr.onclick=function(){cc(de)&&ft(!0)};var tn=o(zr,"button","","secondary rte-ai-review-control-button is-reject-batch","Reject all");if(tn.type="button",tn.setAttribute("data-rte-ai-review-focus-key","reject-all"),tn.disabled=de==="all"?!ae.pending:!xe,de!=="all"&&(tn.innerText="Reject filtered"),tn.onclick=function(){uc(de)&&ft(!0)},ce.length>1)for(var ii=o(Ci||kn,"div","","rte-ai-review-type-chips"),hn=0;hn<ce.length;hn++){var hr=ce[hn],Sn=Ne[hr.value]||0;if(!(hr.value!=="all"&&Sn===0&&hr.value!==de)){var Bn=hr.label+" ("+Sn+")",Tn=o(ii,"button","","rte-ai-review-type-chip"+(hr.value===de?" is-active":""),Bn);Tn.type="button",Tn.setAttribute("data-rte-ai-review-focus-key","type-chip-"+hr.value),Tn.setAttribute("aria-pressed",hr.value===de?"true":"false"),Tn.onclick=(function(ge){return function(){Q.typeFilter=ge,ft(!0)}})(hr.value)}}v(Br,"rte-ai-review-section-label is-shortcuts","Keyboard lane");var An=o(Br,"div","","rte-ai-review-shortcuts","");if(An.id=kc(),i.__aiReviewShortcutDisplayNode=An,Ee.onfocus=function(){aa(Ee),Ee.title=yc(pt(xn(de)),Ie(Ee)),hl(pt(xn(de)),Ie(Ee))},Ee.querySelectorAll)for(var En=Ee.querySelectorAll("[data-rte-ai-review-focus-key]"),Ln=0;Ln<En.length;Ln++)of(En[Ln],de);R||m?xc(R||m):Ge?Cc(pt(Ge)):(Ee.title=yc(pt(xn(de)),Ie(Ee)),hl(pt(xn(de)),Ie(Ee)));var qa=o(Ee,"div","","rte-ai-review-stack rte-ai-review-content");v(qa,"rte-ai-review-section-label is-feed",Ce.length?"Review items":"Recovery and next queues");var zn=o(qa,"div","","rte-ai-review-feed");if(Ce.length)i.__aiLastReviewEmptyAnnouncement="",i.__aiReviewPrimaryEmptyAction=null,i.__aiReviewMoveEmptyPreviewFocus=null;else{let ge=function(fe,Xe){var Mt=[Xe||""];if(fe&&fe.getAttribute){var We=fe.getAttribute("data-rte-ai-empty-focus-label")||"",gt=fe.getAttribute("data-rte-ai-preview-change-label")||"",Wn=fe.getAttribute("data-rte-ai-preview-impact-label")||"";We&&Mt.push("focus "+We),gt&&Mt.push(gt),Wn&&Mt.push(Wn)}return Mt.filter(function(si){return!!si}).join(", ")},$e=function(fe){var Xe=Qt.length;if(!fe||!Xe)return{index:0,total:Xe};for(var Mt=0;Mt<Xe;Mt++)if(Qt[Mt]===fe)return{index:Mt+1,total:Xe};return{index:0,total:Xe}},Rt=function(fe){var Xe=Qt.length>1;ai&&(ai.innerText=Hu(fe,Xe)),Ha(Ou(fe,{queueSwitcher:Xe}),"")},or=function(fe){var Xe=fe&&fe.id?fe.id:"";return Xe==="go-type"||Xe==="next-overall"||Xe==="all-types"?{key:"queue",label:"Next queues"}:Xe==="undo-last"?{key:"recovery",label:"Recover"}:{key:"utility",label:"More"}},br=function(fe,Xe,Mt){Mt=Mt||{};for(var We=0;We<Qt.length;We++){var gt=Qt[We];gt.removeAttribute("data-rte-ai-primary-empty"),gt.removeAttribute("aria-current"),gt.setAttribute("aria-pressed","false"),gt.tabIndex=-1,gt.classList&>.classList.contains("is-primary-target")&>.classList.remove("is-primary-target"),gt.__aiCurrentBadge&>.__aiCurrentBadge.parentNode&>.__aiCurrentBadge.parentNode.removeChild(gt.__aiCurrentBadge),gt.__aiCurrentBadge=null,gt.__aiQueueBadge&>.__aiQueueBadge.parentNode&>.__aiQueueBadge.parentNode.removeChild(gt.__aiQueueBadge),gt.__aiQueueBadge=null}if(i.__aiReviewPrimaryEmptyAction&&i.__aiReviewPrimaryEmptyAction!==fe&&(i.__aiReviewPrimaryEmptyAction.removeAttribute("data-rte-ai-primary-empty"),i.__aiReviewPrimaryEmptyAction.classList&&i.__aiReviewPrimaryEmptyAction.classList.contains("is-primary-target")&&i.__aiReviewPrimaryEmptyAction.classList.remove("is-primary-target")),i.__aiReviewPrimaryEmptyAction=fe||null,fe&&(fe.setAttribute("data-rte-ai-primary-empty","true"),fe.setAttribute("aria-pressed","true"),fe.tabIndex=0,fe.classList&&fe.classList.contains("rte-ai-review-empty-preview"))){fe.classList.add("is-primary-target"),fe.setAttribute("aria-current","true");var Wn=fe.__aiPreviewMetaNode||(fe.querySelector?fe.querySelector(".rte-ai-review-empty-preview-meta"):null);if(Wn){fe.__aiCurrentBadge=o(Wn,"span","","rte-ai-review-empty-preview-pill is-current","Current");var si=$e(fe);si.total>1&&(fe.__aiQueueBadge=o(Wn,"span","","rte-ai-review-empty-preview-pill is-queue","Queue "+si.index+" of "+si.total))}}var To=Yt;Yt=ge(fe,Xe||""),fe&&fe.getAttribute&&_c(fe.getAttribute("data-rte-ai-preview-suggestion-id")||""),Rt(Yt),Mt.announce&&Yt&&Yt!==To&&Ot("Completion handoff moved to "+Yt+".")},kr=function(fe){if(Qt.length<2)return!1;for(var Xe=0,Mt=0;Mt<Qt.length;Mt++)if(Qt[Mt]===document.activeElement||Qt[Mt]===i.__aiReviewPrimaryEmptyAction){Xe=Mt;break}var We=Xe;return fe==="next"?We=Math.min(Qt.length-1,Xe+1):fe==="previous"?We=Math.max(0,Xe-1):fe==="first"?We=0:fe==="last"&&(We=Qt.length-1),We===Xe||!Qt[We]?(fe==="next"||fe==="last"?Ot("Already at the last available completion queue."):(fe==="previous"||fe==="first")&&Ot("Already at the first available completion queue."),!1):(Qt[We].focus(),!0)},an=function(fe){if(fe)if(fe.id==="show-resolved")Q.showResolved=!0,ft(!0);else if(fe.id==="go-type"){Q.typeFilter=fe.typeValue||"all";var Xe=fe.suggestionId||cn(Q.typeFilter,"");Xe?Ar(Xe,{focusPanel:!0,focusAction:fe.focusAction||Ie(),openedQueue:!0}):ft(!0)}else fe.id==="next-overall"?(Q.typeFilter="all",fe.suggestionId?Ar(fe.suggestionId,{focusPanel:!0,focusAction:fe.focusAction||Ie(),openedQueue:!0}):ft(!0)):fe.id==="all-types"?(Q.typeFilter="all",ft(!0)):fe.id==="undo-last"?Hn({focusPanel:!0,focusAction:Ie()}):fe.id==="open-chat"&&ea({focusComposer:!0})};var Pn=ge,mr=$e,oi=Rt,Ti=or,Mr=br,Kn=kr,li=an,Jt=Du(ae,xe,de,se,ut,Ne,ce),Yt="",ai=null,Qt=[];i.__aiReviewMoveEmptyPreviewFocus=kr;var Fn=Jt.title+"|"+Jt.detail+"|"+Jt.actions.map(function(fe){return fe?fe.label:""}).join("|");Jt.announceMessage&&i.__aiLastReviewEmptyAnnouncement!==Fn&&(Ot(Jt.announceMessage),i.__aiLastReviewEmptyAnnouncement=Fn);var Dr=o(zn,"div","","rte-ai-review-empty"),Rn=ha(Se),Qr=!!(Jt.previewItems&&Jt.previewItems.length),Gn=!!Rn;Dr.classList.toggle("is-queue-complete",Qr),Dr.classList.toggle("is-recoverable",Gn);var dr=o(Dr,"div","","rte-ai-review-empty-hero"),fr=o(dr,"div","","rte-ai-review-empty-status-row");if(o(fr,"span","","rte-ai-review-empty-status-pill "+(Qr?"is-ready":Gn?"is-recovery":"is-clear"),Qr?"Queue complete":Gn?"Recovery available":"All clear"),Qr&&o(fr,"span","","rte-ai-review-empty-status-pill is-count",Jt.previewItems.length===1?"1 next queue":Jt.previewItems.length+" next queues"),o(dr,"div","","rte-ai-review-empty-title",Jt.title),o(dr,"div","","rte-ai-review-empty-detail",Jt.detail),ai=o(dr,"div","","rte-ai-review-empty-hint",""),Rn){var $r=o(Dr,"div","","rte-ai-review-empty-zone is-recovery");v($r,"rte-ai-review-section-label is-recovery","Recovery"),o($r,"div","","rte-ai-review-empty-detail rte-ai-review-empty-undo-detail",Rn);var Dn=Oo(3);if(Dn.length){var Vn=o($r,"div","","rte-ai-review-empty-undo-history");o(Vn,"div","","rte-ai-review-empty-undo-history-title","Then");for(var ki=0;ki<Dn.length;ki++){var rn=Dn[ki],So=o(Vn,"div","","rte-ai-review-empty-undo-history-item");o(So,"div","","rte-ai-review-empty-undo-history-label",rn.label),o(So,"div","","rte-ai-review-empty-undo-history-detail",rn.detail)}}}if(Jt.previewItems&&Jt.previewItems.length){var ja=o(Dr,"div","","rte-ai-review-empty-zone is-next");v(ja,"rte-ai-review-section-label is-feed",Jt.previewItems.length>1?"Next queues":"Next queue");var sa=o(ja,"div","","rte-ai-review-empty-previews");sa.setAttribute("role","toolbar"),sa.setAttribute("aria-label","Next review queues");for(var ji=0;ji<Jt.previewItems.length;ji++){var De=Jt.previewItems[ji],ar=De.typeValue?"button":"div",kt=o(sa,ar,"","rte-ai-review-empty-preview"+(De.typeValue?" is-actionable":""));if(ar==="button"){kt.type="button",kt.tabIndex=-1,kt.setAttribute("aria-pressed","false"),kt.setAttribute("aria-setsize",String(Jt.previewItems.length)),kt.setAttribute("aria-posinset",String(ji+1)),kt.setAttribute("aria-keyshortcuts",ys({queueSwitcher:Jt.previewItems.length>1})),kt.title=bs(De.actionLabel||De.label||"Open next queue",{focusLabel:De.focusActionLabel,queueSwitcher:Jt.previewItems.length>1});var Pr=[De.actionLabel||De.label||"Open next queue"];De.focusActionLabel&&Pr.push("Focus "+De.focusActionLabel),De.pendingCountLabel&&Pr.push(De.pendingCountLabel),De.changeLabel&&Pr.push(De.changeLabel),De.impactLabel&&Pr.push(De.impactLabel),De.scopeLabel&&Pr.push(De.scopeLabel),De.languageLabel&&Pr.push(De.languageLabel),De.text&&Pr.push("Current: "+De.text),De.resultText&&Pr.push("Suggested: "+De.resultText),De.reasonText&&Pr.push("Why this next: "+De.reasonText),kt.setAttribute("aria-label",Pr.join(". ")),kt.setAttribute("data-rte-ai-primary-label",De.actionLabel||De.label||"Open next queue"),De.focusActionLabel&&kt.setAttribute("data-rte-ai-empty-focus-label",De.focusActionLabel),De.changeLabel&&kt.setAttribute("data-rte-ai-preview-change-label",De.changeLabel),De.impactLabel&&kt.setAttribute("data-rte-ai-preview-impact-label",De.impactLabel),De.suggestionId&&kt.setAttribute("data-rte-ai-preview-suggestion-id",De.suggestionId),kt.onclick=(function(fe){return function(){an({id:"go-type",typeValue:fe.typeValue,suggestionId:fe.suggestionId,focusAction:fe.focusAction||""})}})(De),kt.onfocus=function(){aa(this),br(this,this.getAttribute("data-rte-ai-primary-label")||this.innerText||"",{announce:Qt.length>1})},kt.onkeydown=function(fe){var Xe=(fe.key||"").toLowerCase();Xe==="u"&&fe.shiftKey&&dn()?(fe.preventDefault(),fe.stopPropagation(),Qn({focusPanel:!0,focusAction:Ie()})):Xe==="u"&&un()?(fe.preventDefault(),fe.stopPropagation(),Hn({focusPanel:!0,focusAction:Ie()})):fe.key==="ArrowRight"||fe.key==="ArrowDown"||Xe==="j"?(fe.preventDefault(),kr("next")):fe.key==="ArrowLeft"||fe.key==="ArrowUp"||Xe==="k"?(fe.preventDefault(),kr("previous")):fe.key==="Home"?(fe.preventDefault(),kr("first")):fe.key==="End"&&(fe.preventDefault(),kr("last"))},Qt.push(kt),i.__aiReviewPrimaryEmptyAction||br(kt,De.actionLabel||De.label||"")}o(kt,"div","","rte-ai-review-empty-preview-label",De.label||"Next queue");var Fr=o(kt,"div","","rte-ai-review-empty-preview-meta");kt.__aiPreviewMetaNode=Fr,De.pendingCountLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill",De.pendingCountLabel),De.focusActionLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill is-focus","Focus "+De.focusActionLabel),De.changeLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill is-change",De.changeLabel),De.impactLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill is-impact",De.impactLabel),De.scopeLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill",De.scopeLabel),De.languageLabel&&o(Fr,"span","","rte-ai-review-empty-preview-pill",De.languageLabel);var nn=lo(De.text,De.resultText);vs(kt,"current",De.text||"",nn),De.resultText&&vs(kt,"result",De.resultText,nn),De.reasonText&&o(kt,"div","","rte-ai-review-empty-preview-reason","Why this next: "+De.reasonText)}}for(var gn=[],_i=0;_i<Jt.actions.length;_i++)Jt.actions[_i]&&gn.push(Jt.actions[_i]);if(gn.length){var mn=o(Dr,"div","","rte-ai-review-empty-zone is-actions");v(mn,"rte-ai-review-section-label is-controls","Actions");for(var gl=o(mn,"div","","rte-ai-review-empty-actions"),Si={},Ui=0;Ui<gn.length;Ui++)(function(fe){var Xe=or(fe);Si[Xe.key]||(Si[Xe.key]=o(gl,"div","","rte-ai-review-empty-action-group is-"+Xe.key),Si[Xe.key].setAttribute("data-rte-ai-empty-group-label",Xe.label));var Mt=Ui===0,We=o(Si[Xe.key],"button","",Mt&&!i.__aiReviewPrimaryEmptyAction?"rte-ai-review-control-button is-primary":"secondary rte-ai-review-control-button","");o(We,"span","","rte-ai-review-empty-action-label",fe.label),fe.focusActionLabel&&o(We,"span","","rte-ai-review-empty-action-pill is-focus","Focus "+fe.focusActionLabel),We.type="button",fe.id&&We.setAttribute("data-rte-ai-empty-action-id",fe.id),We.setAttribute("aria-keyshortcuts",ys()),We.title=bs(fe.label||"",{focusLabel:fe.focusActionLabel}),fe.focusActionLabel&&We.setAttribute("data-rte-ai-empty-focus-label",fe.focusActionLabel),fe.suggestionId&&We.setAttribute("data-rte-ai-preview-suggestion-id",fe.suggestionId),Mt&&We.setAttribute("data-rte-ai-primary-button","true"),Mt&&!i.__aiReviewPrimaryEmptyAction&&br(We,fe.label||""),We.onfocus=function(){aa(We),(fe.id==="go-type"||fe.id==="next-overall")&&_c(fe.suggestionId||""),Rt(ge(We,fe.label||""))},We.onkeydown=function(gt){(gt.key||"").toLowerCase()==="u"&>.shiftKey&&dn()?(gt.preventDefault(),gt.stopPropagation(),Qn({focusPanel:!0,focusAction:Ie()})):(gt.key||"").toLowerCase()==="u"&&un()&&(gt.preventDefault(),gt.stopPropagation(),Hn({focusPanel:!0,focusAction:Ie()}))},We.onclick=function(){an(fe)}})(gn[Ui])}var Ua=Yt||(gn[0]?gn[0].label:"");Rt(Ua)}for(var _="",W=0;W<Ce.length;W++)(function(ge){var $e=i.__aiRecentlyOpenedQueueSuggestionId===ge.id,Rt=_a(Ce,i.__aiActiveSuggestionId,ge),or=Su(Ce,i.__aiActiveSuggestionId,ge,Rt);if(or&&or.key!==_){var br=o(zn,"div","","rte-ai-review-feed-section is-"+or.key),kr=o(br,"div","","rte-ai-review-feed-section-meta"),an=o(kr,"div","","rte-ai-review-feed-section-title",or.label);an.setAttribute("role","heading"),an.setAttribute("aria-level","3"),or.countLabel&&o(kr,"span","","rte-ai-review-feed-section-pill",or.countLabel),or.detail&&o(br,"div","","rte-ai-review-feed-section-detail",or.detail),_=or.key}var fe=mi(Ce,i.__aiActiveSuggestionId,ge),Xe=i.__aiActiveSuggestionId===ge.id,Mt=!Xe&&!$e,We=o(zn,"div","","rte-ai-review-item is-"+ge.status+(Xe?" is-active":"")+($e?" is-opened":"")+(Mt?" is-condensed":""));We.setAttribute("data-rte-ai-review-id",ge.id),We.setAttribute("data-rte-ai-review-density",Mt?"condensed":"expanded"),Rt&&Rt.role&&We.setAttribute("data-rte-ai-review-queue-role",Rt.role),We.setAttribute("role","button"),We.tabIndex=i.__aiActiveSuggestionId===ge.id?0:-1,We.setAttribute("aria-keyshortcuts",Co(ge.status==="pending"?"Enter Space A R J K Home End":"Enter Space J K Home End")),We.title=fl(ge,Ie(Ee));var gt=Yr(ge.id);i.__aiActiveSuggestionId===ge.id&&We.setAttribute("aria-current","true"),We.onclick=function(pa){if(!(pa&&pa.target&&pa.target.closest&&pa.target.closest(".rte-ai-review-item-actions"))){var Al=Ie(Ee),Do=document.activeElement;Do&&Do.getAttribute&&Ee.contains(Do)&&(Al=Do.getAttribute("data-rte-ai-review-action")||Al),!dc(ge.id,Al)&&xi(ge.id,{focusPanel:!0})}},We.onfocus=function(){aa(We),We.title=fl(ge,Ie(Ee)),Cc(ge),Mt&&co(We,ge,Ee)};var Wn=o(We,"div","","rte-ai-review-item-state is-"+ge.status+(Xe?" is-current":"")+($e?" is-opened":""));if(o(Wn,"div","","rte-ai-review-item-state-kicker",ge.status==="pending"?"Review item":"Review history"),o(Wn,"div","","rte-ai-review-item-state-title",Iu(ge,Xe,$e)),o(Wn,"div","","rte-ai-review-item-state-detail",Nu(ge,Xe,$e,gt)),Rt){var si=o(We,"div","","rte-ai-review-item-queue-card is-"+Rt.role);o(si,"div","","rte-ai-review-item-queue-title",Rt.roleLabel);var To=o(si,"div","","rte-ai-review-item-queue-meta");o(To,"span","","rte-ai-review-item-queue-pill is-role",Rt.roleLabel),o(To,"span","","rte-ai-review-item-queue-pill is-position",Rt.queueLabel),o(si,"div","","rte-ai-review-item-queue-detail",Rt.detail)}if(fe){var Ba=o(We,"div","","rte-ai-review-item-transition-card");o(Ba,"div","","rte-ai-review-item-transition-title",fe.title);var Ao=o(Ba,"div","","rte-ai-review-item-transition-meta");if(o(Ao,"span","","rte-ai-review-item-transition-pill is-status",fe.statusLabel),o(Ao,"span","","rte-ai-review-item-transition-pill is-position",fe.queueLabel),fe.typeLabel&&o(Ao,"span","","rte-ai-review-item-transition-pill is-type",fe.typeLabel),fe.scopeLabel&&o(Ao,"span","","rte-ai-review-item-transition-pill is-scope",fe.scopeLabel),o(Ba,"div","","rte-ai-review-item-transition-detail",fe.detail),ss(Ba,"rte-ai-review-item-transition-preview",fe),fe.followupTitle){var ml=o(Ba,"div","","rte-ai-review-item-transition-followup");o(ml,"div","","rte-ai-review-item-transition-followup-title",fe.followupTitle);var uf=o(ml,"div","","rte-ai-review-item-transition-followup-meta");fe.followupStatusLabel&&o(uf,"span","","rte-ai-review-item-transition-pill is-followup",fe.followupStatusLabel),o(ml,"div","","rte-ai-review-item-transition-followup-detail",fe.followupDetail)}}var Bi=o(We,"div","","rte-ai-review-item-meta");o(Bi,"span","","rte-ai-review-item-status is-"+ge.status,ya(ge.status)),o(Bi,"span","","rte-ai-review-item-stamp",ge.sourceLabel||(ge.snapshot&&ge.snapshot.hasSelection?"Selection suggestion":"Document suggestion")),Xe&&o(Bi,"span","","rte-ai-review-item-stamp is-current","Current"),$e&&o(Bi,"span","","rte-ai-review-item-stamp is-opened","Queue opened"),ge.suggestionType&&ge.suggestionType!=="other"&&o(Bi,"span","","rte-ai-review-item-stamp is-type",M(ge.suggestionType)),ge.language&&o(Bi,"span","","rte-ai-review-item-stamp is-language",T(ge.language)),gt&&o(Bi,"span","","rte-ai-review-item-stamp is-remote",gt>1?gt+" shared updates":"Shared update");var Eo=o(We,"div","","rte-ai-review-item-summary");o(Eo,"div","","rte-ai-review-item-title",er(ge.originalText||ge.resultText||"AI suggestion",80)),Mt&&Ru(Eo,ge,Ee,{queuePositionData:Rt,queueTransitionData:fe,sharedUpdateCount:gt});var on=$i(ge);if(on){var bl=o(Eo,"div","","rte-ai-review-item-glance-card");if(o(bl,"div","","rte-ai-review-item-glance-title",on.title),on.pills&&on.pills.length)for(var df=o(bl,"div","","rte-ai-review-item-glance-meta"),yl=0;yl<on.pills.length;yl++){var Tc=on.pills[yl];o(df,"span","","rte-ai-review-item-glance-pill is-"+Tc.kind,Tc.text)}on.detail&&o(bl,"div","","rte-ai-review-item-glance-detail",on.detail)}if(ge.reason){var Ac=o(Eo,"div","","rte-ai-review-item-reason-card");o(Ac,"div","","rte-ai-review-item-reason-label","Why AI suggested this"),o(Ac,"div","","rte-ai-review-item-reason",ge.reason)}var wl=o(We,"div","","rte-ai-review-item-compare"),Ec=o(wl,"div","","rte-ai-review-item-compare-header");o(Ec,"div","","rte-ai-review-item-compare-title","Compare change"),o(Ec,"div","","rte-ai-review-item-compare-detail","Original and suggested text");var Lc=lo(ge.originalText||"",ge.resultText||""),ff=o(wl,"div","","rte-ai-review-item-before");so(ff,"current",u(ge.originalText||""),Lc);var pf=o(wl,"div","","rte-ai-review-item-after");so(pf,"result",u(ge.resultText||""),Lc);var ca=Xe&&ge.status==="pending"&&Se?Nr(Se):null,Rc=ca?ha(Se):"",Lo=ca?Oo(1):[];if(ca)var vf=o(We,"div","","rte-ai-review-item-undo-note",Rc+" Press U to "+ca.shortcutLabel+"."),Dc=to(vf,"undo-note",ge.id);var za=null;Lo.length&&(za=Fl(We,Lo,"undo"),to(za,"undo-history",ge.id));var hf=!!(nt&&nt.suggestion&&nt.suggestion.id===ge.id&&ge.status==="pending"),ua=hf?Hr(nt):null,Pc=ua?eo(nt):"",xl="";if(ua){var gf=o(We,"div","","rte-ai-review-item-redo-note",Pc+" Press Shift+U to "+ua.shortcutLabel+".");xl=to(gf,"redo-note",ge.id)}var Fa=null,Ro=ua?qo(1):[];Ro.length&&(Fa=Fl(We,Ro,"redo"),to(Fa,"redo-history",ge.id)),We.setAttribute("aria-label",_u(ge,{isCurrent:i.__aiActiveSuggestionId===ge.id,queueOpened:$e,queueRoleLabel:Rt?Rt.roleLabel:"",queuePositionLabel:Rt?Rt.queueLabel:"",transitionLabel:fe?fe.title+". "+fe.statusLabel+". "+fe.queueLabel+". "+Xn(fe)+(fe.followupTitle?". "+fe.followupTitle+". "+fe.followupDetail:""):"",changeSummary:on?on.title+". "+(on.pills||[]).map(function(pa){return pa.text}).join(". ")+(on.detail?". "+on.detail:""):"",remoteUpdateCount:gt,undoLabel:Rc,undoNextLabel:Lo.length?"Undo after this: "+Lo[0].detail:"",redoLabel:Pc,redoNextLabel:Ro.length?"Redo after this: "+Ro[0].detail:""})),We.setAttribute("data-rte-ai-review-base-aria-label",We.getAttribute("aria-label")||""),Mt&&(gs(We,ge,Ee),co(We,ge,Ee));var Cl=o(We,"div","","rte-ai-review-item-actions"),Mc=o(Cl,"div","","rte-ai-review-item-action-group is-locate");Mc.setAttribute("data-rte-ai-review-action-group","locate");var kl=o(Cl,"div","","rte-ai-review-item-action-group is-decision");kl.setAttribute("data-rte-ai-review-action-group","decision");var _l=o(Cl,"div","","rte-ai-review-item-action-group is-recovery");_l.setAttribute("data-rte-ai-review-action-group","recovery");var Ga=o(Mc,"button","","secondary rte-ai-review-action-button is-locate","Locate");if(Ga.type="button",Ga.setAttribute("data-rte-ai-review-action","locate"),Ga.disabled=ge.status!=="pending"&&ge.status!=="stale",Ga.onclick=function(){Ur(ge.id)},Oa(Ga,de,ge.id,"locate"),ge.status==="pending"){var Sl=wi(ge,"accept",de)||{text:"Accept",label:"Accept this AI change"},da=o(kl,"button","","rte-ai-review-action-button is-primary is-accept",Sl.text);da.type="button",da.setAttribute("data-rte-ai-review-action","accept"),da.setAttribute("aria-label",Sl.label),da.title=Sl.label,da.onclick=function(){Hi(ge.id,"accept",{focusAction:"accept"})},Oa(da,de,ge.id,"accept");var Tl=wi(ge,"reject",de)||{text:"Reject",label:"Reject this AI change"},fa=o(kl,"button","","secondary rte-ai-review-action-button is-reject",Tl.text);if(fa.type="button",fa.setAttribute("data-rte-ai-review-action","reject"),fa.setAttribute("aria-label",Tl.label),fa.title=Tl.label,fa.onclick=function(){Hi(ge.id,"reject",{focusAction:"reject"})},Oa(fa,de,ge.id,"reject"),ca){var Va=o(_l,"button","","secondary rte-ai-review-action-button is-undo",ca.actionLabel);Va.type="button",Va.setAttribute("data-rte-ai-review-action","undo"),Dc&&Va.setAttribute("data-rte-ai-review-extra-describedby",Dc+(za&&za.id?" "+za.id:"")),Va.onclick=function(){Hn({focusPanel:!0,focusAction:"undo"})},Oa(Va,de,ge.id,"undo")}if(ua){var Ka=o(_l,"button","","secondary rte-ai-review-action-button is-redo",ua.actionLabel);Ka.type="button",Ka.setAttribute("data-rte-ai-review-action","redo"),xl&&Ka.setAttribute("data-rte-ai-review-extra-describedby",xl+(Fa&&Fa.id?" "+Fa.id:"")),Ka.onclick=function(){Qn({focusPanel:!0,focusAction:"redo"})},Oa(Ka,de,ge.id,"redo")}}})(Ce[W]);var le=!!e||d||!!R,be=Gd(zn,le,R||m);Ia(R||m||Ie(Ee)),Na(R||m||Ie(Ee));var Te=zi().slice(0,6);if(Te.length){o(zn,"div","","rte-ai-review-history-title","Recent activity");for(var rt=0;rt<Te.length;rt++){var st=Te[rt],Ye=Ic(st),Bt=o(zn,"div","","rte-ai-review-history-entry is-"+Ye);Bt.setAttribute("data-rte-ai-review-event",st.eventType||"suggestion-updated");var pr=o(Bt,"div","","rte-ai-review-history-header");o(pr,"span","","rte-ai-review-history-event is-"+Ye,Ll(st));var gr=[];st.sourceLabel&&gr.push(st.sourceLabel),st.suggestionType&&st.suggestionType!=="other"&&gr.push(M(st.suggestionType)),st.language&&gr.push(T(st.language)),o(pr,"div","","rte-ai-review-history-meta",gr.join(" - ")||"AI review"),o(Bt,"div","","rte-ai-review-history-text",er(st.resultText||st.originalText||"AI review event",120))}}return le&&setTimeout(function(){var ge=null;l&&Ee&&Ee.querySelector&&(ge=Ee.querySelector('[data-rte-ai-review-focus-key="'+l+'"]'),ge&&ge.disabled&&(ge=null),ge&&ge.focus&&ge.focus()),!ge&&i.__aiReviewPrimaryEmptyAction&&i.__aiReviewPrimaryEmptyAction.isConnected&&!i.__aiReviewPrimaryEmptyAction.disabled&&i.__aiReviewPrimaryEmptyAction.focus?i.__aiReviewPrimaryEmptyAction.focus():!ge&&!be&&Ee&&Ee.focus&&Ee.focus()},0),!0}function la(e){e=e||{},i.__aiDialog&&i.__aiDialog.isConnected&&i.__aiDialog.close();var t=Le(),r=i.createDialog(c.text_aiassist||"Ask AI","rte-panel-aiassist");r.__aiSnapshot=t,i.__aiDialog=r,r.__aiOperationStates={},r.__aiPlanStale=!1,r.__aiPlanStaleReason="",r.__aiPlanStaleAction="",r._onclose=function(){i.__aiDialog===r&&(i.__aiDialog=null)};var n=document.createElement("span");n.className="rte-ai-dialog-mode-chip is-detached",n.setAttribute("aria-hidden","true");var a=o(r,"div","","demo-ai-dialog-grid"),s=String(Date.now())+"-"+String(Math.floor(Math.random()*1e6)),l="rte-ai-mode-help-"+s,d="rte-ai-source-help-"+s,m="rte-ai-result-help-"+s,R="rte-ai-apply-guidance-"+s,Q="rte-ai-dialog-status-"+s;a.setAttribute("role","form"),a.setAttribute("aria-label","Ask AI controls");var ie=o(a,"div","","demo-ai-compact-controls");ie.setAttribute("role","group"),ie.setAttribute("aria-label","Ask AI setup");var ae=o(ie,"div","","demo-ai-field demo-ai-action-field"),oe=o(ae,"select");oe.setAttribute("aria-label","AI action");var te=document.createElement("div");te.className="demo-ai-mode-caption is-detached",te.id=l;var se=o(ie,"div","","demo-ai-field demo-ai-language-field"),ce=o(se,"select");if(ce.setAttribute("aria-label","Translation target language"),ri(),e.presetMode){for(var Ne=!1,de=0;de<oe.options.length;de++)if(oe.options[de].value===e.presetMode){Ne=!0;break}Ne&&(oe.value=e.presetMode)}oe.options.length&&oe.selectedIndex<0&&(oe.selectedIndex=0),qr(),oe.setAttribute("aria-describedby",l);var _e=o(ie,"div","","demo-ai-field demo-ai-scope-field"),ke=o(_e,"select","","demo-ai-scope-select");ke.setAttribute("aria-label","Source for Ask AI"),ke.setAttribute("data-rte-ai-dialog-action","scope");var Ce=o(ke,"option","","","Selection");Ce.value="selection";var me=o(ke,"option","","","Document");me.value="document";var Re=o(_e,"span","","demo-ai-scope-caption");Re.setAttribute("aria-hidden","true");var Be=_e.ownerDocument.createElement("div");Be.className="demo-actions-row demo-ai-scope-row is-detached",Be.setAttribute("role","group"),Be.setAttribute("aria-label","Source scope");var xe=_e.ownerDocument.createElement("button");xe.type="button",xe.className="is-icon-only",xe.setAttribute("data-rte-ai-dialog-action","load-selection"),xe.title="Use selection",xe.setAttribute("aria-label","Use selection"),dt(xe,"cursorText",""),Be.appendChild(xe);var Fe=_e.ownerDocument.createElement("button");Fe.type="button",Fe.className="secondary is-icon-only",Fe.setAttribute("data-rte-ai-dialog-action","load-document"),Fe.title="Use document",Fe.setAttribute("aria-label","Use document"),dt(Fe,"document",""),Be.appendChild(Fe),_e.appendChild(Be);var ut=o(ie,"div","","demo-ai-field demo-ai-run-field"),Ge=o(ut,"div","","demo-actions-row demo-ai-run-row");Ge.setAttribute("role","group"),Ge.setAttribute("aria-label","Ask AI run actions");var Se=o(Ge,"button","","is-primary");Se.type="button",Se.setAttribute("data-rte-ai-dialog-action","run"),dt(Se,"sparkles","Generate"),Se.title="Generate AI suggestion (Ctrl+Enter)",Se.setAttribute("aria-keyshortcuts","Control+Enter");var nt=/Mac|iPad|iPhone|iPod/i.test((navigator.platform||"")+" "+(navigator.userAgent||"")),Je=nt?"\u2318\u23CE":"Ctrl \u23CE";function at(){if(Se){var _=Se.querySelector(".demo-ai-kbd-hint");_&&_.parentNode.removeChild(_);var W=Se.ownerDocument.createElement("span");W.className="demo-ai-kbd-hint",W.setAttribute("aria-hidden","true"),W.textContent=Je,Se.appendChild(W)}}at();var Ve=o(Ge,"button","","secondary is-icon-only");Ve.type="button",Ve.title="Copy result into source",Ve.setAttribute("aria-label","Copy result into source"),Ve.setAttribute("data-rte-ai-dialog-action","copy-to-source"),dt(Ve,"checkAll","");var Ee=document.createElement("span");a.appendChild(te);var Pe=o(a,"div","","demo-ai-text-grid");Pe.setAttribute("role","group"),Pe.setAttribute("aria-label","Ask AI source and result");var xt=o(Pe,"div","","demo-ai-field demo-ai-source-field");o(xt,"span","","demo-ai-text-label-inline is-detached","Source");var lt=o(xt,"span","","demo-ai-field-help is-detached","Edit the source text or prompt that Ask AI will use.");lt.id=d;var Ke=o(xt,"textarea");Ke.setAttribute("aria-label","Source text for Ask AI"),Ke.setAttribute("aria-describedby",d+" "+l),xt.appendChild(Ge),Ke.rows=1,Ke.placeholder="Type or paste text\u2026";var jt=o(xt,"span","","demo-ai-source-counter");jt.setAttribute("aria-hidden","true");function St(){if(jt){var _=Ke.value||"",W=_.length;if(!W){jt.textContent="",jt.classList.remove("is-visible");return}var le=W>999?Math.round(W/100)/10+"K chars":W+(W===1?" char":" chars");jt.textContent=le,jt.classList.add("is-visible")}}xt.style.order="2";var mt=o(Pe,"div","","demo-ai-field demo-ai-result-field");mt.style.order="1";var Tt=o(mt,"div","","demo-ai-result-head"),tr=document.createElement("span");tr.className="demo-ai-text-label-inline is-detached",tr.innerText="Result";var yr=o(mt,"span","","demo-ai-field-help is-detached","Review the generated AI suggestion before applying it.");yr.id=m;var Dt=o(Tt,"button","","demo-ai-clipboard-toggle");Dt.type="button",Dt.setAttribute("data-rte-ai-dialog-action","copy-clipboard"),Dt.title="Copy AI output to clipboard",Dt.setAttribute("aria-label","Copy AI output to clipboard"),dt(Dt,"clipboard","Copy");var Kt=null;Dt.onclick=function(_){_&&_.stopPropagation&&_.stopPropagation(),u(qe.value)&&Ts(qe.value).then(function(W){W&&(Dt.classList.add("is-copied"),dt(Dt,"check","Copied"),Kt&&clearTimeout(Kt),Kt=setTimeout(function(){Dt.classList.remove("is-copied"),dt(Dt,"clipboard","Copy"),Kt=null},1400))})};var vt=o(Tt,"button","","demo-ai-clipboard-toggle demo-ai-why-toggle");vt.type="button",vt.setAttribute("data-rte-ai-dialog-action","why"),vt.title="Why this AI suggestion?",vt.setAttribute("aria-label","Show why this AI suggestion was generated"),vt.setAttribute("aria-expanded","false"),dt(vt,"info","");var je=o(Tt,"button","","demo-ai-source-toggle");je.type="button",je.setAttribute("aria-expanded","false"),je.setAttribute("aria-controls","rte-ai-source-"+Date.now()),je.title="Edit the prompt and retry",je.setAttribute("aria-label","Edit the prompt and retry"),je.innerText="Edit",xt.id=je.getAttribute("aria-controls"),je.onclick=function(_){_&&_.stopPropagation&&_.stopPropagation();var W=a.classList.toggle("is-source-expanded");je.setAttribute("aria-expanded",W?"true":"false"),W&&Ke.focus()};var qe=o(mt,"textarea");qe.readOnly=!0,qe.setAttribute("aria-label","AI suggestion result"),qe.setAttribute("aria-describedby",m+" "+Q),qe.rows=1,qe.placeholder="Output appears here.";var Pt=document.createElement("pre"),rr=document.createElement("pre"),ze=document.createElement("div");ze.className="demo-ai-refine-row is-detached",ze.setAttribute("role","group"),ze.setAttribute("aria-label","Refine AI suggestion"),a.appendChild(ze);var Me=o(ze,"button","","secondary demo-ai-refine-chip");Me.type="button",Me.title="Re-run with the same prompt",Me.setAttribute("data-rte-ai-dialog-action","refine-retry"),dt(Me,"refresh","Try again");var tt=o(ze,"button","","secondary demo-ai-refine-chip");tt.type="button",tt.title="Make the suggestion shorter",tt.setAttribute("data-rte-ai-dialog-action","refine-shorter"),dt(tt,"shrink","Shorter");var bt=o(ze,"button","","secondary demo-ai-refine-chip");bt.type="button",bt.title="Expand the suggestion with more detail",bt.setAttribute("data-rte-ai-dialog-action","refine-longer"),dt(bt,"expand","Longer");var ye=document.createElement("button");ye.type="button",ye.className="secondary demo-ai-refine-chip demo-ai-refine-why-chip is-detached",ye.innerText="Why",ye.title="Show why this AI suggestion was generated",ye.setAttribute("data-rte-ai-dialog-action","refine-why"),ye.setAttribute("aria-expanded","false");function ht(_){u(qe.value)&&(Ke.value=_+`
|
|
13
|
+
|
|
14
|
+
`+qe.value,Si(),Se&&!Se.disabled&&Se.onclick&&Se.onclick())}Me.onclick=function(){Se&&!Se.disabled&&Se.onclick&&Se.onclick()},tt.onclick=function(){ht("Rewrite to be noticeably shorter and more concise while keeping the meaning intact.")},bt.onclick=function(){ht("Expand with more supporting detail, examples, and depth while keeping the same voice.")},ye.onclick=function(_){_&&_.stopPropagation&&_.stopPropagation();var W=Et.classList.toggle("is-collapsed"),le=!W;ye.setAttribute("aria-expanded",le?"true":"false"),vt&&vt.setAttribute&&(vt.setAttribute("aria-expanded",le?"true":"false"),vt.classList.toggle("is-active",le)),At&&At.setAttribute&&At.setAttribute("aria-expanded",le?"true":"false")},vt.onclick=function(_){_&&_.stopPropagation&&_.stopPropagation();var W=Et.classList.toggle("is-collapsed"),le=!W;vt.setAttribute("aria-expanded",le?"true":"false"),vt.classList.toggle("is-active",le),ye&&ye.setAttribute&&ye.setAttribute("aria-expanded",le?"true":"false"),At&&At.setAttribute&&At.setAttribute("aria-expanded",le?"true":"false")};var Oe=o(a,"div","","demo-actions-row demo-ai-apply-row");Oe.setAttribute("role","group"),Oe.setAttribute("aria-label","Ask AI apply actions");var Qe=o(Oe,"button","","is-primary");Qe.type="button",Qe.disabled=!0,Qe.setAttribute("data-rte-ai-dialog-action","apply"),Qe.title="Apply AI suggestion (Ctrl+Enter)",Qe.setAttribute("aria-keyshortcuts","Control+Enter"),dt(Qe,"check","Apply");var yt=o(Oe,"button","","");yt.type="button",yt.disabled=!t.hasSelection,yt.setAttribute("data-rte-ai-dialog-action","selection"),dt(yt,"check","Replace selection");var wt=o(Oe,"button","","secondary");wt.type="button",wt.disabled=!t.hasSelection,wt.setAttribute("data-rte-ai-dialog-action","preview"),dt(wt,"eyeOn","Preview");var Ct=o(Oe,"button","","secondary");Ct.type="button",Ct.setAttribute("data-rte-ai-dialog-action","insert"),dt(Ct,"arrowRight","Insert below");var Ut=o(Oe,"button","","secondary");Ut.type="button",Ut.setAttribute("data-rte-ai-dialog-action","document"),dt(Ut,"checkAll","Replace document");var ot=o(Oe,"button","","secondary demo-ai-apply-more-toggle is-icon-only");ot.type="button",ot.setAttribute("data-rte-ai-dialog-action","more"),ot.setAttribute("aria-expanded","false"),ot.title="More apply options",ot.setAttribute("aria-label","More apply options"),dt(ot,"more",""),ot.onclick=function(_){_&&_.stopPropagation&&_.stopPropagation();var W=Oe.classList.toggle("is-show-more");ot.setAttribute("aria-expanded",W?"true":"false")},Oe.insertBefore(Me,ot),Oe.insertBefore(tt,ot),Oe.insertBefore(bt,ot);var Lr=document.createElement("button");Lr.type="button",Lr.className="secondary is-detached",Lr.setAttribute("data-rte-ai-dialog-action","reject"),dt(Lr,"trash","Discard");var Wt=document.createElement("div");Wt.id=R,Wt.className="demo-ai-apply-guidance",Wt.style.display="none",Wt.setAttribute("role","group"),Wt.setAttribute("aria-label","Best next step");var Rr=o(Wt,"div","","demo-ai-apply-guidance-header"),cr=o(Rr,"span","","demo-ai-apply-guidance-title","Next"),Cn=o(Rr,"span","","demo-ai-apply-guidance-badge"),fn=o(Wt,"div","","demo-ai-apply-guidance-detail");a.appendChild(Wt);var wr=o(a,"div","","demo-ai-dialog-status");wr.id=Q,wr.setAttribute("role","status"),wr.setAttribute("aria-live","polite"),wr.setAttribute("aria-atomic","true");var At=o(a,"button","","demo-ai-details-toggle","Details");At.type="button",At.setAttribute("aria-expanded","false"),At.setAttribute("aria-controls","rte-ai-details-"+s),At.title="Show why and the operation plan";var Et=o(a,"div","","demo-ai-insight-grid is-collapsed");Et.id=At.getAttribute("aria-controls"),ye&&ye.setAttribute&&ye.setAttribute("aria-controls",Et.id),vt&&vt.setAttribute&&vt.setAttribute("aria-controls",Et.id),a.insertBefore(At,Oe),a.insertBefore(Et,Oe),At.onclick=function(){var _=Et.classList.toggle("is-collapsed");At.setAttribute("aria-expanded",_?"false":"true")};var Zr=o(Et,"div","","demo-ai-reason-panel");Zr.setAttribute("role","group"),Zr.setAttribute("aria-label","AI rationale"),o(Zr,"label","","","Why");var xr=o(Zr,"div","","demo-ai-reason-copy","The reason will appear here once a suggestion is generated."),Cr=o(Et,"div","","demo-ai-plan-panel");Cr.setAttribute("role","group"),Cr.setAttribute("aria-label","AI operation plan"),o(Cr,"label","","","Plan");var qi=document.createElement("div"),pn=o(Cr,"div","","demo-ai-plan-status"),ti=o(pn,"span","","demo-ai-plan-status-message"),Gt=o(pn,"button","","secondary demo-ai-plan-status-action","Re-run");Gt.type="button",Gt.style.display="none",Gt.setAttribute("data-rte-ai-dialog-action","rerun");var qn=o(Cr,"div","","demo-ai-plan-summary"),en=o(Cr,"ul","","demo-ai-plan-list");function vn(_){var W=r.__aiResolved;return W&&W.operations&&W.operations.length?W:Xr(qe.value,_,W||null,W?W.request:null,W?W.action:null)}function ri(){var _=pe();oe.innerHTML="";for(var W={proofread:"Edit text",rewrite:"Edit text",shorten:"Edit text",expand:"Edit text",translate:"Transform",summarize:"Transform",justify:"Transform"},le=["Edit text","Transform"],be={},Te=[],rt=0;rt<_.length;rt++){var st=_[rt],Ye=st.group||W[st.id]||"";if(!Ye){Te.push(st);continue}be[Ye]||(be[Ye]=[],le.indexOf(Ye)===-1&&le.push(Ye)),be[Ye].push(st)}function Bt(Ti,Mr){var Kn=o(Ti,"option","","",Mr.title||Mr.id);Kn.value=Mr.id,Mr.description&&(Kn.title=Mr.description)}for(var pr=0;pr<le.length;pr++){var gr=be[le[pr]];if(!(!gr||!gr.length)){var Pn=o(oe,"optgroup");Pn.label=le[pr];for(var mr=0;mr<gr.length;mr++)Bt(Pn,gr[mr])}}for(var oi=0;oi<Te.length;oi++)Bt(oe,Te[oi]);oe.options.length&&oe.selectedIndex<0&&(oe.selectedIndex=0),ur(),qr()}function ur(){var _=O();ce.innerHTML="";for(var W=0;W<_.length;W++){var le=o(ce,"option","","",_[W].label||_[W].value);le.value=_[W].value||_[W].label}e.presetLanguage&&(ce.value=e.presetLanguage),!ce.value&&_.length&&(ce.value=_[0].value||_[0].label)}function Br(){var _=oe.value==="translate";se.style.display=_?"":"none",ie&&ie.classList&&ie.classList.toggle("is-no-language",!_)}function kn(){if(!Ke)return"";var _=r.__aiSourceScope==="selection"?"selection":"document",W=r.__aiSnapshot,le=Ke.value||"",be=_,Te=0;if(le)Te=le.length,r.__aiSourceLinkedToEditor||(be="typed");else if(W){var rt=_==="selection"?W.text||"":W.wholeText||"";Te=rt.length,_==="selection"&&!W.hasSelection&&(be="document",Te=(W.wholeText||"").length)}if(!Te)return"";var st=Te>999?Math.round(Te/100)/10+"K":String(Te),Ye;return be==="typed"?Ye="Typed prompt":be==="selection"?Ye="Selection":Ye="Document",Ye+" \xB7 "+st+" chars"}function Ci(){if(!r||!r.querySelector)return null;var _=r.querySelector("rte-dialog-header");if(!_)return null;var W=_.querySelector(".rte-ai-dialog-header-caption");if(W)return W;W=r.ownerDocument.createElement("span"),W.className="rte-ai-dialog-header-caption",W.setAttribute("aria-hidden","true");var le=_.querySelector("rte-dialog-header-text");return le&&le.parentNode===_?(le.style&&(le.style.flex="0 0 auto",le.style.whiteSpace="nowrap"),le.nextSibling?_.insertBefore(W,le.nextSibling):_.appendChild(W)):_.appendChild(W),W}function _n(_){if(!(!r||!r.querySelector)){var W=r.querySelector("rte-dialog-header rte-dialog-header-text")||r.querySelector("rte-dialog-header-text");if(W){var le=c.text_aiassist||"Ask AI",be=_||"";be&&oe.value==="translate"&&(be=be+" ("+T(ce.value||"spanish")+")"),W.innerText=be||le,r.setAttribute&&r.setAttribute("aria-label",be?le+" \xB7 "+be:le)}}}function qr(){for(var _=pe(),W="Run this AI mode against the current source text.",le="",be=0;be<_.length;be++)if(_[be].id===oe.value){le=_[be].title||_[be].id,_[be].id==="translate"?W=(_[be].description||"Prepare a translated draft in the selected language.")+" Current target: "+T(ce.value||"spanish")+".":W=_[be].description||"Run this AI mode against the current source text.";break}te.innerText=W,oe&&oe.setAttribute&&oe.setAttribute("title",W);var Te=Ci();if(Te&&(Te.innerText=W||""),_n(le),Ke&&!Ke.value){var rt=oe.value||"",st={proofread:"Paste text to proofread\u2026",rewrite:"Paste text to rewrite\u2026",shorten:"Paste text to shorten\u2026",expand:"Paste text to expand\u2026",summarize:"Paste text to summarize\u2026",translate:"Paste text to translate\u2026",justify:"Paste text to rewrite + explain\u2026",explain:"Paste text to explain\u2026"};Ke.placeholder=st[rt]||"Type or paste text\u2026"}if(n){var Ye=le||"";le&&oe.value==="translate"&&(Ye=le+" \xB7 "+T(ce.value||"spanish")),n.innerText=Ye,n.style.display=Ye?"":"none"}Br()}function ni(_){return r.__aiOperationStates&&r.__aiOperationStates["step-"+_]?r.__aiOperationStates["step-"+_]:""}function jn(_,W){r.__aiOperationStates=r.__aiOperationStates||{},r.__aiOperationStates["step-"+_]=W||""}function Un(){Et&&Et.classList&&Et.classList.contains("is-collapsed")&&(Et.classList.remove("is-collapsed"),At&&At.setAttribute&&At.setAttribute("aria-expanded","true"))}function zr(_,W){r.__aiPlanStale=!0,r.__aiPlanStaleReason=_||"Editor changed. Re-run to refresh.",r.__aiPlanStaleAction=W==="source"?"source":"editor",wr.innerText=r.__aiPlanStaleReason,nn(r.__aiResolved),mn(),Un()}function vr(_,W){return _?W==="selection"?_.text||_.wholeText||"":_.wholeText||"":""}function tn(_,W){return W==="selection"&&(!_||!_.hasSelection)&&!r.__aiSourceLinkedToEditor&&!!u(Ke.value)}function ii(_,W){return W==="selection"?_&&_.hasSelection?"Selection ready":tn(_,W)?"Selection source loaded - select text to apply inline":"No selection - using whole document":_&&_.hasSelection?"Whole document loaded - selection available":"Whole document loaded"}function hn(_,W){return W==="selection"&&_&&_.hasSelection?"selection":"document"}function hr(_){return!!_&&(_.type==="preview-suggestion"||_.type==="replace-selection")}function Sn(_,W){var le=W&&W.length?W:null;if(!le){for(var be=0;be<_.length;be++)if(hr(_[be]))return!0;return!1}for(var Te=0;Te<le.length;Te++)if(hr(_[le[Te]]))return!0;return!1}function Bn(_){var W=r.__aiSourceScope==="selection"?"selection":"document";return r.__aiSourceLinkedToEditor?hn(_,W):W}function Tn(_,W,le){return r.__aiPlanStale?r.__aiSourceLinkedToEditor?le:W:_&&_.request?_.request.scope==="selection"?"selection":"document":r.__aiSourceLinkedToEditor?le:W}function An(_,W,le,be){var Te=_==="selection";return Te?be?"Use selection. Active scope. Ask AI is keeping the current selection-based source. Select text to apply or reload it again.":!W||!W.hasSelection?"Use selection. Unavailable until text is selected.":le==="selection"?"Use selection. Active scope. Ask AI is using the current selection.":"Use selection. Available scope. Switch Ask AI to the current selection.":le==="selection"?"Use document. Available scope. Switch Ask AI to the whole document.":"Use document. Active scope. Ask AI is using the whole document."}function En(){var _=r.__aiSourceScope==="selection"?"selection":"document",W=hn(r.__aiSnapshot,_),le=tn(r.__aiSnapshot,_),be=le?"selection":W;if(Ee&&(Ee.innerText=ii(r.__aiSnapshot,_)),xe&&(xe.disabled=!r.__aiSnapshot||!r.__aiSnapshot.hasSelection),xe&&xe.setAttribute&&(xe.setAttribute("aria-pressed",be==="selection"?"true":"false"),xe.setAttribute("aria-label",An("selection",r.__aiSnapshot,be,le))),Fe&&Fe.setAttribute&&(Fe.setAttribute("aria-pressed",be==="document"?"true":"false"),Fe.setAttribute("aria-label",An("document",r.__aiSnapshot,be,le))),ke){var Te=r.__aiSnapshot,rt=!!(Te&&Te.hasSelection),st=Te?(Te.wholeText||"").length:0;Ce.disabled=!rt,Ce.text=rt?"Selection":"Selection (none)",me.text="Document",ke.value=be==="selection"?"selection":"document",ke.setAttribute("title",ii(Te,_)),Re&&(Re.innerText="Document"),ie&&ie.classList&&(rt?ie.classList.remove("is-scope-implicit"):ie.classList.add("is-scope-implicit"))}}function Ln(_){return _?_>999?Math.round(_/100)/10+"K chars":_+" chars":"0"}function qa(){r.__aiSourceLinkedToEditor=!1}function zn(_,W){return u(_&&_.text?_.text:"")!==u(W&&W.text?W.text:"")}function Jt(_,W,le){return _==="selection"?le&&le.hasSelection&&W&&!W.hasSelection?"Selection cleared. Re-run to refresh.":le&&W&&le.hasSelection&&W.hasSelection&&Ht(le.range,W.range)&&zn(le,W)?"Selection text changed. Re-run to refresh.":"Selection changed. Re-run to refresh.":"Document changed. Re-run to refresh."}function Yt(_){return u(_)?"Source changed. Re-run to refresh.":"Source cleared. Reload from the editor or type source text before re-running."}function ai(){return"Mode changed. Re-run to refresh."}function Qt(_){return"Language \u2192 "+T(_||"spanish")+". Re-run to refresh."}function Fn(_){return"Scope \u2192 "+(_==="selection"?"selection":"document")+". Re-run to refresh."}function Dr(_){return"Reloaded from "+(_==="selection"?"selection":"document")+". Re-run to refresh."}function Rn(_,W,le){return _==="selection"?le&&le.hasSelection&&W&&!W.hasSelection?"Selection cleared. Re-run to refresh.":le&&W&&le.hasSelection&&W.hasSelection&&Ht(le.range,W.range)&&zn(le,W)?"Selection text changed. Re-run to refresh.":"Selection changed. Re-run to refresh.":"Document changed. Re-run to refresh."}function Qr(_){for(var W=[],le=0;le<_.length;le++)ni(le)!=="done"&&ni(le)!=="skipped"&&W.push(le);return W}function Gn(){var _=r.__aiResolved&&r.__aiResolved.operations?r.__aiResolved.operations:[],W=Qr(_);if(W.length!==1)return"";var le=_[W[0]];return le&&le.type?le.type:""}function dr(){var _=r.__aiResolved||null,W=_&&_.operations?_.operations:[],le=Qr(W),be=r.__aiSourceScope==="selection"?"selection":"document",Te=hn(r.__aiSnapshot,be),rt=!!(r.__aiSnapshot&&r.__aiSnapshot.hasSelection),st=!!u(qe.value),Ye=Tn(_,be,Te),Bt=Sn(W,le);return{hasSource:!!u(Ke.value),hasResult:st,hasSelection:rt,isStale:!!r.__aiPlanStale,requestedScope:be,scope:Te,actionScope:Ye,staleAction:r.__aiPlanStaleAction==="source"?"source":"editor",operations:W,pendingIndexes:le,pendingSelectionDependent:Bt,canApplyPlan:!!le.length&&(!Bt||rt),canPreview:st&&Ye==="selection"&&rt,canReplaceSelection:st&&Ye==="selection"&&rt,canInsert:st,canReplaceDocument:st&&Ye==="document",pendingOperationType:le.length===1&&W[le[0]]&&W[le[0]].type?W[le[0]].type:""}}function fr(_,W){if(W=W||dr(),_==="load-selection")return W.hasSelection?"Reload the current editor selection into Ask AI.":"Select text in the editor, then reload it into Ask AI.";if(_==="load-document")return"Reload the current editor document into Ask AI.";if(_==="run")return W.hasSource?"Generate a new AI suggestion from the current source text using the selected mode.":"Load or type source text, then run Ask AI to generate a suggestion.";if(_==="rerun")return W.staleAction==="source"?"Refresh this suggestion from the current dialog source before applying it.":"Refresh this suggestion from the current editor state before applying it.";if(_==="copy-to-source")return W.hasResult?"Copy the current AI result back into the source field before rerunning it.":"Run Ask AI first, then copy the generated result back into the source field.";if(_==="apply"){if(W.pendingIndexes.length>1)return W.pendingSelectionDependent&&!W.hasSelection?"Select text before applying this selection-based AI plan.":"Run the remaining "+W.pendingIndexes.length+"-step AI plan directly in the editor.";switch(W.pendingOperationType){case"preview-suggestion":return W.hasSelection?"Show the prepared inline diff in the editor before deciding it.":"Select text before previewing this prepared inline diff in the editor.";case"replace-selection":return W.hasSelection?"Replace the current selection with this prepared draft.":"Select text before replacing it with this prepared draft.";case"replace-document":return"Replace the full document with this prepared draft.";case"insert-below":return W.hasSelection?"Insert this prepared draft below the current selection.":"Insert this prepared draft below the current content.";case"add-comment":return"Add this prepared AI comment without rewriting the document body.";default:return"Run the prepared AI plan directly in the editor."}}return _==="selection"?W.hasSelection?"Replace the current selection with this prepared draft.":"Select text before replacing it with this prepared draft.":_==="preview"?W.hasSelection?"Show this change inline in the editor before deciding it.":"Select text to preview this change inline in the editor.":_==="insert"?W.hasSelection?"Insert this prepared draft below the current selection.":"Insert this prepared draft below the current content.":_==="document"?"Replace the full document with this prepared draft.":_==="reject"?"Dismiss this prepared suggestion without changing the document.":""}function $r(_,W){return W=W||dr(),_==="load-selection"?"Use selection":_==="load-document"?"Whole document":_==="selection"?W.hasSelection?"Replace selection":"Select text to replace":_==="preview"?W.hasSelection?"Preview":"Select text to preview":""}function Dn(_,W){var le={};if(!W||!W.actionId)return le;if(W.actionId==="apply"){switch(_.pendingOperationType){case"preview-suggestion":le.preview=!0;break;case"replace-selection":le.selection=!0;break;case"replace-document":le.document=!0;break;case"insert-below":le.insert=!0;break}return le}return le[W.actionId]=!0,le}function Vn(_,W,le,be){if(!(!be||W[le])){for(var Te=0;Te<_.length;Te++)if((_[Te]||"").toLowerCase()===be.toLowerCase())return;_.push(be)}}function ki(_){return!_||!_.length?"":_.length===1?_[0]:_.length===2?_[0]+" or "+_[1]:_.slice(0,_.length-1).join(", ")+", or "+_[_.length-1]}function rn(_,W){if(_=_||dr(),!_.hasResult||_.isStale)return[];if(_.actionScope==="selection"&&!_.hasSelection)return["select text to apply inline"];var le=[],be=Dn(_,W),Te=_.pendingOperationType||"";return _.actionScope==="selection"?(_.hasSelection&&Te!=="preview-suggestion"&&Vn(le,be,"preview","preview inline"),_.hasSelection&&Te!=="replace-selection"&&Vn(le,be,"selection","replace the selection"),_.canInsert&&Te!=="insert-below"&&Vn(le,be,"insert","insert below"),le):(_.actionScope==="document"&&(_.canReplaceDocument&&Te!=="replace-document"&&Vn(le,be,"document","replace the document"),_.canInsert&&Te!=="insert-below"&&Vn(le,be,"insert","insert below")),le)}function So(_){_=_||dr();var W=De(_),le=W&&W.label?(W.label||"").replace(/\s+/g," ").trim():"";return le?"Ready \xB7 "+le:_.actionScope==="selection"&&!_.hasSelection?"Ready \xB7 Insert below":"Ready"}function ja(_,W){_=_||dr(),W=W||De(_);var le=W&&W.detail?(W.detail||"").replace(/\s+/g," ").trim():"",be=ki(rn(_,W));return be&&(le+=(le?" ":"")+"Other available actions: "+be+"."),le}function sa(_){if(!(!Oe||!Oe.appendChild)){var W=[Qe,yt,wt,Ct,Ut,Me,tt,bt,ye,ot,Lr];if(_&&_.button&&_.button.parentNode===Oe){W=[_.button];for(var le=[Qe,yt,wt,Ct,Ut,Me,tt,bt,ye,ot,Lr],be=0;be<le.length;be++)le[be]!==_.button&&W.push(le[be])}for(var Te=0;Te<W.length;Te++)W[Te]&&W[Te].parentNode===Oe&&Oe.appendChild(W[Te])}}function ji(_,W,le,be){if(_){var Te=(_.innerText||_.textContent||"").replace(/\s+/g," ").trim()||$r(W,le)||"Action",rt=fr(W,le),st=be?{actionId:W,label:Te,detail:rt}:null,Ye=st?ki(rn(le,st)):"",Bt=[Te];rt&&Bt.push(rt),Ye&&Bt.push("Other available actions: "+Ye+"."),be?(Bt.push("Recommended next step."),_.setAttribute("data-rte-ai-dialog-recommended","true")):_.removeAttribute("data-rte-ai-dialog-recommended"),_.setAttribute("aria-label",Bt.join(". "));var pr=[Te];rt&&pr.push(rt),Ye&&pr.push("Other available actions: "+Ye+"."),be&&pr.push("Recommended next step.");var gr=_.getAttribute&&_.getAttribute("aria-keyshortcuts");if(gr){var Pn=gr.replace(/Control\+/gi,"Ctrl+").replace(/Meta\+/gi,"Cmd+");pr.push("("+Pn+")")}_.title=pr.join(" - ")}}function De(_){_=_||dr();var W=!!u(vr(r.__aiSnapshot,"selection"))&&!!(r.__aiSnapshot&&r.__aiSnapshot.hasSelection),le=!!u(vr(r.__aiSnapshot,"document"));if(!_.hasSource){var be=_.scope==="selection"?xe:Fe,Te=_.scope==="selection"?"load-selection":"load-document",rt=Te==="load-selection"?W:le;if(rt&&be&&!be.disabled)return{actionId:Te,button:be,label:$r(Te,_)||"Load source",detail:fr(Te,_)};if(le&&Fe&&!Fe.disabled)return{actionId:"load-document",button:Fe,label:(Fe.innerText||Fe.textContent||"").replace(/\s+/g," ").trim()||"Whole document",detail:fr("load-document",_)};if(W&&xe&&!xe.disabled)return{actionId:"load-selection",button:xe,label:(xe.innerText||xe.textContent||"").replace(/\s+/g," ").trim()||"Use selection",detail:fr("load-selection",_)}}return _.isStale&&Gt&&Gt.style.display!=="none"&&!Gt.disabled?{actionId:"rerun",button:Gt,label:(Gt.innerText||Gt.textContent||"").replace(/\s+/g," ").trim()||(_.staleAction==="source"?"Re-run from source":"Re-run from editor"),detail:fr("rerun",_)}:!_.hasResult&&Se&&!Se.disabled&&u(Ke.value)?{actionId:"run",button:Se,label:"Ask AI",detail:fr("run",_)}:_.pendingIndexes.length&&Qe&&!Qe.disabled?{actionId:"apply",button:Qe,label:(Qe.innerText||Qe.textContent||"").replace(/\s+/g," ").trim()||"Apply",detail:fr("apply",_)}:wt&&wt.style.display!=="none"&&!wt.disabled?{actionId:"preview",button:wt,label:(wt.innerText||wt.textContent||"").replace(/\s+/g," ").trim()||"Preview",detail:fr("preview",_)}:yt&&yt.style.display!=="none"&&!yt.disabled?{actionId:"selection",button:yt,label:(yt.innerText||yt.textContent||"").replace(/\s+/g," ").trim()||"Replace selection",detail:fr("selection",_)}:Ut&&Ut.style.display!=="none"&&!Ut.disabled?{actionId:"document",button:Ut,label:(Ut.innerText||Ut.textContent||"").replace(/\s+/g," ").trim()||"Replace document",detail:fr("document",_)}:Ct&&Ct.style.display!=="none"&&!Ct.disabled?{actionId:"insert",button:Ct,label:(Ct.innerText||Ct.textContent||"").replace(/\s+/g," ").trim()||"Insert below",detail:fr("insert",_)}:null}function ar(_){_=_||dr();var W=De(_);sa(W);for(var le=[xe,Fe,Se,Ve,Gt,Qe,yt,wt,Ct,Ut,Lr],be=0;be<le.length;be++){var Te=le[be],rt=Te&&Te.getAttribute?Te.getAttribute("data-rte-ai-dialog-action")||(Te===Gt?"rerun":""):"";ji(Te,rt,_,!!(W&&Te===W.button))}if(Oe&&Oe.classList){var st=!!(W&&W.actionId&&W.actionId!=="apply"&&W.button&&W.button.parentNode===Oe&&Qe&&Qe.disabled);Oe.classList.toggle("is-alt-recommended",st)}if(!W){Wt.style.display="none",Cn.innerText="",fn.innerText="",Wt.setAttribute("aria-label","No recommended Ask AI follow-up action yet.");return}Wt.style.display="",cr.innerText="Best next step",Cn.innerText=W.label||"";var Ye=ja(_,W);fn.innerText=Ye||"",Wt.setAttribute("aria-label","Best next step: "+(W.label||"Action")+"."+(Ye?" "+Ye:""))}function kt(){var _=r.__aiSourceScope||(r.__aiSnapshot&&r.__aiSnapshot.hasSelection?"selection":"document");_i(_),Se.onclick()}function Pr(){Se.onclick()}function Fr(_,W){if(!_||!_.length)return!1;var le=xa(_,{snapshot:r.__aiSnapshot,resolved:r.__aiResolved});return le&&(wr.innerText=W||"Applied the selected AI step."),le}function nn(_){var W=_&&_.operations?_.operations:[],le=dr();en.innerHTML="",ti.innerText=r.__aiPlanStale?r.__aiPlanStaleReason||"Editor changed. Re-run to refresh.":"";var be=r.__aiPlanStaleAction==="source"&&!u(Ke.value);if(Gt.innerText=r.__aiPlanStaleAction==="source"?"Re-run from source":"Re-run from editor",Gt.style.display=r.__aiPlanStale&&!be?"":"none",Gt.disabled=be,pn.className=r.__aiPlanStale?"demo-ai-plan-status is-stale":"demo-ai-plan-status",!W.length){var Te=o(en,"li","","demo-ai-plan-item is-empty");o(Te,"span","","demo-ai-plan-type","No plan yet"),o(Te,"span","","demo-ai-plan-copy","Run Ask AI to see the steps the editor will apply."),qn.innerText="",Gt.style.display="none",Qe.disabled=!0,Qe.innerText="Apply";return}for(var rt=0,st=0,Ye=0;Ye<W.length;Ye++){var Bt=W[Ye],pr=Lt(Bt),gr=o(en,"li","","demo-ai-plan-item"),Pn=o(gr,"div","","demo-ai-plan-header");o(Pn,"span","","demo-ai-plan-type",pr.title);var mr=ni(Ye);mr&&(o(Pn,"span","","demo-ai-plan-state is-"+mr,mr==="done"?"Applied":"Skipped"),mr==="done"?rt++:mr==="skipped"&&st++);var oi=pr.copy;Bt.reason&&(oi+=" Reason: "+Bt.reason),o(gr,"span","","demo-ai-plan-copy",oi);var Ti=o(gr,"div","","demo-ai-plan-actions");if(mr!=="done"){var Mr=hr(Bt)&&!le.hasSelection,Kn=Mr?ci([Bt]):Ai(Bt),li=o(Ti,"button","","secondary demo-ai-plan-button",Kn);li.type="button",li.disabled=!!r.__aiPlanStale||Mr,Mn(li,Kn,Ei(Bt,le),r.__aiPlanStale?"Currently unavailable until Ask AI is rerun.":Mr?"Currently unavailable until text is selected in the editor.":""),li.onclick=(function(br,kr,an){return function(){Fr([kr],'Applied "'+an+'".')&&(jn(br,"done"),zr('Applied "'+an+'". Re-run to refresh the remaining plan.',"editor"))}})(Ye,Bt,pr.title)}if(mr!=="done"){var ge=o(Ti,"button","","secondary demo-ai-plan-button",mr==="skipped"?"Include step":"Skip step");ge.type="button",ge.disabled=!!r.__aiPlanStale,Mn(ge,ge.innerText||ge.textContent||"Skip step",mr==="skipped"?"Add this step back into the pending AI plan.":"Skip this step from the pending AI plan.",r.__aiPlanStale?"Currently unavailable until Ask AI is rerun.":""),ge.onclick=(function(br,kr){return function(){jn(br,kr?"":"skipped"),wr.innerText=kr?"Included the step back into the pending AI plan.":"Skipped this step from the pending AI plan.",nn(r.__aiResolved)}})(Ye,mr==="skipped")}}for(var $e=Qr(W),Rt=[],or=0;or<$e.length;or++)Rt.push(W[$e[or]]);qn.innerText=$e.length+" pending \u2022 "+rt+" applied \u2022 "+st+" skipped",Qe.disabled=!$e.length||!!r.__aiPlanStale||!le.canApplyPlan,r.__aiPlanStale?Qe.innerText="Re-run to refresh plan":$e.length?le.pendingSelectionDependent&&!le.hasSelection?Qe.innerText=ci(Rt):$e.length===W.length?Qe.innerText=Ir(_):Qe.innerText="Apply "+$e.length+" pending steps":Qe.innerText="No pending steps"}function gn(_,W){var le=W||"";Se.disabled=!!_||!u(Ke.value),Ve.disabled=!!_||!u(qe.value),xe.disabled=!!_||!r.__aiSnapshot||!r.__aiSnapshot.hasSelection,Fe.disabled=!!_,ke&&(ke.disabled=!!_),oe.disabled=!!_,Ke.readOnly=!!_,Gt.disabled=!!_,Qe.disabled=!!_||Qe.disabled,yt.disabled=!!_||yt.disabled,wt.disabled=!!_||wt.disabled,Ct.disabled=!!_||Ct.disabled,Ut.disabled=!!_||Ut.disabled,Lr.disabled=!!_||Lr.disabled;for(var be=en.querySelectorAll?en.querySelectorAll(".demo-ai-plan-button"):[],Te=0;Te<be.length;Te++)be[Te].disabled=!!_;Me&&(Me.disabled=!!_||!u(qe.value)),tt&&(tt.disabled=!!_||!u(qe.value)),bt&&(bt.disabled=!!_||!u(qe.value)),ye&&(ye.disabled=!!_),vt&&(vt.disabled=!!_),_?(Se.classList.add("is-busy"),dt(Se,"spinner","Thinking...")):Se.classList.remove("is-busy"),wr.innerText=le,ar()}function _i(_){r.__aiSourceScope=_==="selection"?"selection":"document",r.__aiSourceLinkedToEditor=!0,r.__aiSnapshot=Le(),Ke.value=vr(r.__aiSnapshot,r.__aiSourceScope),r.__aiLastLinkedSourceText=Ke.value,St(),En(),mn(),qr()}function mn(){var _=dr(),W=_.hasResult,le=_.hasSource,be=_.isStale;a&&a.classList&&(W||be?a.classList.remove("is-pre-result"):a.classList.add("is-pre-result"));var Te=r&&r.parentNode;Te&&Te.classList&&(W||be?Te.classList.remove("is-pre-result"):Te.classList.add("is-pre-result"));var rt=_.pendingOperationType,st=W||be?_.actionScope:_.scope,Ye=st==="selection"&&rt!=="replace-selection",Bt=st==="selection"&&rt!=="preview-suggestion",pr=_.canInsert&&rt!=="insert-below",gr=_.canReplaceDocument&&rt!=="replace-document";Pt.innerText=u(Ke.value)||"Load text from the editor to start a preview.",rr.innerText=W?qe.value:"Run Ask AI to generate a suggestion preview.";var Pn=Vr(r.__aiResolved)||"";if(xr.innerText=Pn||"This suggestion does not include an explicit AI rationale yet.",nn(r.__aiResolved),At&&At.style){var mr=r.__aiResolved,oi=mr&&mr.operations?mr.operations.length:0,Ti=!!Pn||oi>1;At.style.display=W&&Ti?"":"none",!Ti&&Et&&Et.classList&&!Et.classList.contains("is-collapsed")&&(Et.classList.add("is-collapsed"),At.setAttribute("aria-expanded","false"))}if(yt.innerText=$r("selection",_)||"Replace selection",wt.innerText=$r("preview",_)||"Preview",yt.style.display=Ye?"":"none",wt.style.display=Bt?"":"none",Ct.style.display=pr?"":"none",Ut.style.display=gr?"":"none",ot){var Mr=[];Ye&&Mr.push("Replace selection"),Bt&&Mr.push("Preview"),pr&&Mr.push("Insert below"),gr&&Mr.push("Replace document");var Kn=Mr.length,li=Kn>0;if(ot.style.display=li?"":"none",li){var ge="More apply options ("+Kn+"): "+Mr.join(", ");ot.title=ge,ot.setAttribute("aria-label",ge),ot.setAttribute("data-rte-ai-more-count",String(Kn))}!li&&Oe.classList.contains("is-show-more")&&(Oe.classList.remove("is-show-more"),ot.setAttribute("aria-expanded","false"))}yt.disabled=be||!_.canReplaceSelection,wt.disabled=be||!_.canPreview,Ct.disabled=be||!_.canInsert,Ut.disabled=be||!_.canReplaceDocument,Se.disabled=!le,Ve.disabled=!W,Lr.disabled=!W;var $e=W||be?"Regenerate":"Generate";dt(Se,"sparkles",$e),at(),ar(_)}function gl(){if(!(!r.isConnected||i.__aiDialog!==r)){var _=r.__aiSourceScope==="selection"?"selection":"document",W=!!r.__aiSourceLinkedToEditor,le=r.__aiSnapshot||Le(),be=Le(),Te=vr(le,_),rt=vr(be,_),st=_==="selection"&&(!!le.hasSelection!=!!be.hasSelection||!Ht(le.range,be.range)||Te!==rt),Ye=_==="document"?(le.wholeText||"")!==(be.wholeText||""):st,Bt=Ye||!!le.hasSelection!=!!be.hasSelection;if(r.__aiSnapshot=be,W&&(r.__aiLastLinkedSourceText=rt),!!Bt){if(En(),W){if(Ke.value=rt,St(),Ye&&u(qe.value)&&!r.__aiPlanStale){zr(Jt(_,be,le),"editor");return}}else if(Ye&&u(qe.value)&&!r.__aiPlanStale){zr(Rn(_,be,le),"source");return}mn(),qr()}}}function Si(){if(qa(),St(),u(qe.value)){zr(Yt(Ke.value),"source");return}mn(),qr()}function Ui(_){if(u(qe.value)){zr(_,"source");return}mn()}function Ua(_){var W=_==="selection"?"selection":"document",le=r.__aiSourceScope==="selection"?"selection":"document",be=u(Ke.value),Te=!!r.__aiSourceLinkedToEditor;if(_i(W),!!u(qe.value)){var rt=u(Ke.value);if(le!==W){zr(Fn(W),"editor");return}(!Te||be!==rt)&&zr(Dr(W),"editor")}}xe.onclick=function(){Ua("selection")},Fe.onclick=function(){Ua("document")},ke&&(ke.onchange=function(){Ua(ke.value)}),Gt.onclick=function(){if(r.__aiPlanStaleAction==="source"){Pr();return}kt()},oe.onchange=function(){qr(),Ui(ai())},ce.onchange=function(){qr(),Ui(Qt(ce.value))},Se.onclick=function(){var _=Le();if(r.__aiSnapshot=_,r.__aiSourceLinkedToEditor&&(Ke.value=vr(_,r.__aiSourceScope),r.__aiLastLinkedSourceText=Ke.value,St()),En(),!u(Ke.value)){wr.innerText="Load or type source text before running Ask AI.",mn();return}gn(!0,""),Ue(oe.value,{snapshot:_,source:Ke.value,scope:Bn(_),mode:oe.value,language:ce.value}).then(function(W){r.__aiResolved=W,r.__aiOperationStates={},r.__aiPlanStale=!1,r.__aiPlanStaleReason="",r.__aiPlanStaleAction="",qe.value=nr(W)||"",mn(),gn(!1,qe.value?"":"No suggestion returned.")}).catch(function(W){console.error("AI Toolkit dialog run failed",W),r.__aiResolved=null,r.__aiOperationStates={},r.__aiPlanStale=!1,r.__aiPlanStaleReason="",r.__aiPlanStaleAction="",qe.value="",mn(),gn(!1,"AI suggestion failed.")})},Ve.onclick=function(){u(qe.value)&&(Ke.value=qe.value,Si())},Ke.oninput=function(){Si()},Ke.onkeydown=function(_){_&&(_.ctrlKey||_.metaKey)&&_.keyCode===13&&(_.preventDefault(),Se&&!Se.disabled&&Se.onclick&&Se.onclick())},Qe.onclick=function(){for(var _=r.__aiResolved&&r.__aiResolved.operations?r.__aiResolved.operations:[],W=Qr(_),le=[],be=0;be<W.length;be++)le.push(_[W[be]]);if(le.length&&Fr(le,"Applied the pending AI plan.")){for(var Te=0;Te<W.length;Te++)jn(W[Te],"done");r.close()}},yt.onclick=function(){wn(Xr(qe.value,"selection",vn("selection"),r.__aiResolved?r.__aiResolved.request:null,r.__aiResolved?r.__aiResolved.action:null),{snapshot:r.__aiSnapshot})&&r.close()},wt.onclick=function(){var _=Xr(qe.value,"selection-preview",vn("selection-preview"),r.__aiResolved?r.__aiResolved.request:null,r.__aiResolved?r.__aiResolved.action:null);_&&_.operations&&_.operations[0]&&!_.operations[0].reason&&(_.operations[0].reason=Vr(r.__aiResolved)),wn(_,{snapshot:r.__aiSnapshot})&&r.close()},Ct.onclick=function(){wn(Xr(qe.value,"insert",vn("insert"),r.__aiResolved?r.__aiResolved.request:null,r.__aiResolved?r.__aiResolved.action:null),{snapshot:r.__aiSnapshot})&&r.close()},Ut.onclick=function(){wn(Xr(qe.value,"document",vn("document"),r.__aiResolved?r.__aiResolved.request:null,r.__aiResolved?r.__aiResolved.action:null),{snapshot:r.__aiSnapshot})&&r.close()},Lr.onclick=function(){r.close()},r.addEventListener("keydown",function(_){if(_&&(_.ctrlKey||_.metaKey)&&_.keyCode===13){var W=_.target;if(W!==Ke){var le=null;if(Qe&&!Qe.disabled&&Qe.offsetParent!==null)le=Qe;else if(Oe&&Oe.classList&&Oe.classList.contains("is-alt-recommended")){var be=Oe.querySelector('[data-rte-ai-dialog-recommended="true"]:not([disabled])');be&&be.offsetParent!==null&&(le=be)}le&&typeof le.onclick=="function"&&(_.preventDefault(),le.onclick())}}}),r.__aiSourceLinkedToEditor=!0,r.__aiLastLinkedSourceText="",r.__aiSyncFromEditor=gl,nc(),_i(e.useDocument?"document":t.hasSelection?"selection":"document"),mn(),e.autoRun&&Se.onclick();try{setTimeout(function(){try{u(Ke.value)&&Se&&!Se.disabled&&Se.focus?Se.focus():Ke&&Ke.focus?Ke.focus():oe&&oe.focus&&oe.focus()}catch{}},0)}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_autoembed=RTE_Plugin_AutoEmbed,RTE_DefaultConfig.autoEmbedEnabled=typeof RTE_DefaultConfig.autoEmbedEnabled>"u"?!0:RTE_DefaultConfig.autoEmbedEnabled,RTE_DefaultConfig.autoEmbedResolver=RTE_DefaultConfig.autoEmbedResolver||null;function RTE_Plugin_AutoEmbed(){var S=this,c,i,f;S.PluginName="AutoEmbed",S.InitConfig=function(g){c=g};var N=null;function A(){try{var g=i.getDocument();if(!g||g===N)return;g.addEventListener("paste",v,!0),N=g}catch{}}S.InitEditor=function(g){i=g,A();try{i.attachEvent("ready",A)}catch{}try{i.attachEvent("aftersethtml",A)}catch{}setTimeout(A,0),setTimeout(A,200),i.embedUrl=function(b){var D=C(String(b||"").trim());return D?(H(D),!0):!1}};function E(g){var b;return b=/^https?:\/\/(?:www\.)?youtube\.com\/watch\?(?:[^#]*&)?v=([A-Za-z0-9_-]{6,20})/i.exec(g),b||(b=/^https?:\/\/youtu\.be\/([A-Za-z0-9_-]{6,20})/i.exec(g),b)||(b=/^https?:\/\/(?:www\.)?youtube\.com\/shorts\/([A-Za-z0-9_-]{6,20})/i.exec(g),b)?"https://www.youtube.com/embed/"+b[1]:(b=/^https?:\/\/(?:www\.)?vimeo\.com\/(\d{6,12})(?:[/?#]|$)/i.exec(g),b||(b=/^https?:\/\/player\.vimeo\.com\/video\/(\d{6,12})/i.exec(g),b)?"https://player.vimeo.com/video/"+b[1]:null)}function C(g){var b=E(g);if(b)return b;if(typeof c.autoEmbedResolver=="function")try{var D=c.autoEmbedResolver(g);if(typeof D=="string"&&/^https:\/\//i.test(D))return D}catch{}return null}function o(){try{var g=i.getSelection();return g&&g.rangeCount>0&&g.isCollapsed}catch{return!1}}function v(g){if(!(!c.autoEmbedEnabled||!o())){var b=g.clipboardData||window.clipboardData;if(b){var D;try{D=b.getData("text/plain")}catch{return}if(D&&(D=D.trim(),!(/\s/.test(D)||!/^https?:\/\/\S+$/i.test(D)))){var P=C(D);if(P){var L=0;(function I(){w(D,P)||++L<12&&setTimeout(I,25)})()}}}}}function w(g,b){try{var D=i.getEditable();if(!D)return!1;for(var P=D.querySelectorAll("p,div,li,h1,h2,h3,h4,h5,h6"),L=P.length-1;L>=0;L--){var I=P[L];if(!(I.classList&&I.classList.contains("rte-embed"))&&!(I.querySelector&&(I.querySelector(".rte-embed")||I.querySelector("ul,ol,table")))&&(I.textContent||"").trim()===g){var u=i.getDocument();B(u);var y=u.createElement("div");y.innerHTML=q(b)+"<p><br></p>";var O=I.parentNode;if(!O)return;for(var K=y.firstChild,T=y.lastChild;y.firstChild;)O.insertBefore(y.firstChild,I);O.removeChild(I);try{var V=u.createRange();V.setStart(T,0),V.collapse(!0);var Z=i.getSelection();Z&&(Z.removeAllRanges(),Z.addRange(V))}catch{}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}return!0}}}catch{}return!1}function q(g){var b=String(g).replace(/"/g,""");return'<div class="rte-embed" contenteditable="false" data-embed="'+b+'" style="display:block;margin:12px 0;max-width:720px;"><div class="rte-embed-frame" style="position:relative;width:100%;height:0;padding-bottom:56.25%;overflow:hidden;border-radius:10px;background:#000;"><iframe src="'+b+'" loading="lazy" allowfullscreen referrerpolicy="strict-origin-when-cross-origin" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0;"></iframe></div></div>'}function B(g){if(!(!g||g.getElementById("rte-autoembed-styles"))){var b=".rte-embed{display:block;margin:12px 0;max-width:720px;}.rte-embed .rte-embed-frame{position:relative;width:100%;height:0;padding-bottom:56.25%;overflow:hidden;border-radius:10px;background:#000;}.rte-embed .rte-embed-frame iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0;}",D=g.createElement("style");D.id="rte-autoembed-styles",D.appendChild(g.createTextNode(b)),(g.head||g.getElementsByTagName("head")[0]||g.documentElement).appendChild(D)}}function H(g){B(i.getDocument());try{i.insertHTML(q(g)+"<p><br></p>")}catch{}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_blocktypes=RTE_Plugin_BlockTypes,RTE_DefaultConfig.calloutTypes=RTE_DefaultConfig.calloutTypes||[{id:"info",label:"Info",icon:"\u2139\uFE0F"},{id:"success",label:"Success",icon:"\u2705"},{id:"warning",label:"Warning",icon:"\u26A0\uFE0F"},{id:"danger",label:"Danger",icon:"\u26D4"},{id:"note",label:"Note",icon:"\u{1F4DD}"}],RTE_DefaultConfig.calloutDefaultType=RTE_DefaultConfig.calloutDefaultType||"info",RTE_DefaultConfig.columnsDefaultCount=RTE_DefaultConfig.columnsDefaultCount||2;function RTE_Plugin_BlockTypes(){var S=this,c,i;S.PluginName="BlockTypes",S.InitConfig=function(C){c=C},S.InitEditor=function(C){i=C,i.attachEvent("exec_command_insertcallout",function(o,v,w){o.returnValue=!0,S.InsertCallout(w)}),i.attachEvent("exec_command_insertcolumns",function(o,v,w){o.returnValue=!0,S.InsertColumns(w)}),i.attachEvent("exec_command_inserttoggle",function(o){o.returnValue=!0,S.InsertToggle()}),E()};function f(C){return String(C).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function N(C){for(var o=c.calloutTypes||[],v=0;v<o.length;v++)if(o[v].id===C)return o[v];return o[0]||{id:"info",label:"Info",icon:"\u2139\uFE0F"}}S.InsertCallout=function(C){var o=N(C||c.calloutDefaultType),v=i.getLangText&&i.getLangText("calloutplaceholder")||"Callout text",w='<div class="rte-callout rte-callout-'+f(o.id)+'" data-rte-block="callout" data-rte-callout-type="'+f(o.id)+'"><div class="rte-callout-icon" contenteditable="false" data-rte-callout-icon="1">'+o.icon+'</div><div class="rte-callout-body"><p>'+f(v)+"</p></div></div><p><br></p>";A(w,"rte-callout-body")},S.InsertColumns=function(C){C=parseInt(C,10)||c.columnsDefaultCount||2,C<2&&(C=2),C>4&&(C=4);for(var o="",v=i.getLangText&&i.getLangText("columnplaceholder")||"Column",w=0;w<C;w++)o+='<div class="rte-column"><p>'+f(v)+" "+(w+1)+"</p></div>";var q='<div class="rte-columns rte-columns-'+C+'" data-rte-block="columns" data-rte-columns="'+C+'">'+o+"</div><p><br></p>";A(q,"rte-column")},S.InsertToggle=function(){var C=i.getLangText&&i.getLangText("toggleplaceholder")||"Toggle title",o=i.getLangText&&i.getLangText("togglebodyplaceholder")||"Hidden content",v='<details class="rte-toggle" data-rte-block="toggle" open><summary class="rte-toggle-summary">'+f(C)+'</summary><div class="rte-toggle-body"><p>'+f(o)+"</p></div></details><p><br></p>";A(v,"rte-toggle-summary")};function A(C,o){E(),i.insertHTML(C);try{var v=i.getDocument(),w=i.getEditable(),q=w.getElementsByClassName(o);if(q&&q.length){var B=q[q.length-1],H=B.querySelector("p")||B,g=v.createRange();g.selectNodeContents(H),g.collapse(!0);var b=i.getSelection();b.removeAllRanges(),b.addRange(g)}}catch{}i.focus()}function E(){var C=[".rte-callout{display:flex;gap:10px;align-items:flex-start;margin:12px 0;padding:12px 14px;border-radius:8px;border:1px solid rgba(15,23,42,.12);border-left-width:4px;background:#f8fafc}",".rte-callout-icon{flex:0 0 auto;font-size:18px;line-height:1.4;user-select:none}",".rte-callout-body{flex:1;min-width:0}",".rte-callout-body > :first-child{margin-top:0}",".rte-callout-body > :last-child{margin-bottom:0}",".rte-callout-info{border-left-color:#2563eb;background:#eff6ff}",".rte-callout-success{border-left-color:#16a34a;background:#f0fdf4}",".rte-callout-warning{border-left-color:#d97706;background:#fffbeb}",".rte-callout-danger{border-left-color:#dc2626;background:#fef2f2}",".rte-callout-note{border-left-color:#7c3aed;background:#faf5ff}",".rte-columns{display:flex;gap:16px;margin:12px 0;align-items:stretch}",".rte-column{flex:1 1 0;min-width:0;padding:8px 10px;border:1px dashed rgba(15,23,42,.15);border-radius:6px}",".rte-column > :first-child{margin-top:0}",".rte-column > :last-child{margin-bottom:0}",".rte-toggle{margin:12px 0;border:1px solid rgba(15,23,42,.12);border-radius:8px;padding:6px 12px;background:#fafbff}",".rte-toggle > summary{cursor:pointer;font-weight:600;outline:none;list-style:revert;padding:4px 0}",".rte-toggle-body{padding:4px 0 4px 16px}",".rte-toggle-body > :first-child{margin-top:0}",".rte-toggle-body > :last-child{margin-bottom:0}","@media (max-width:640px){.rte-columns{flex-direction:column}}"].join(`
|
|
15
|
+
`);try{var o=i.getDocument();if(!o)return;var v=o.head||o.getElementsByTagName&&o.getElementsByTagName("head")[0]||o.documentElement;if(v&&!o.querySelector("style[data-rte-blocktypes]")){var w=o.createElement("style");w.setAttribute("data-rte-blocktypes","1"),w.textContent=C,v.appendChild(w)}}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_bookmarkcard=RTE_Plugin_BookmarkCard,RTE_DefaultConfig.bookmarkResolver=RTE_DefaultConfig.bookmarkResolver||null,RTE_DefaultConfig.bookmarkFaviconService=typeof RTE_DefaultConfig.bookmarkFaviconService>"u"?"https://www.google.com/s2/favicons?sz=64&domain=":RTE_DefaultConfig.bookmarkFaviconService;function RTE_Plugin_BookmarkCard(){var S=this,c,i;S.PluginName="BookmarkCard",S.InitConfig=function(g){c=g},S.InitEditor=function(g){i=g,i.attachEvent("exec_command_insertbookmark",function(D){D.returnValue=!0,S.OpenBookmarkDialog()});try{var b=i.getEditable();b&&(b.addEventListener("click",v,!0),b.addEventListener("keydown",w,!0))}catch{}H()};function f(g,b,D,P){var L=g.ownerDocument.createElement(b);return D&&(L.style.cssText=D),P&&(L.className=P),g.appendChild(L),L}function N(g){return String(g??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function A(g){var b=String(g||"").trim();if(!b||/^(javascript|data|vbscript|file):/i.test(b))return null;if(!/^https?:\/\//i.test(b))if(/^[a-z0-9.-]+\.[a-z]{2,}([\/?#].*)?$/i.test(b))b="https://"+b;else return null;try{if(typeof URL=="function"){var D=new URL(b);return D.protocol!=="http:"&&D.protocol!=="https:"?null:D.href}}catch{return null}return b}function E(g){try{return new URL(g).hostname.replace(/^www\./,"")}catch{return g.replace(/^https?:\/\//i,"").split("/")[0].replace(/^www\./,"")}}function C(g,b){for(;g&&g!==b;){if(g.nodeType===1&&g.classList&&g.classList.contains("rte-bookmark-card"))return g;g=g.parentNode}return null}function o(g){if(!(!g||!g.parentNode)){g.parentNode.removeChild(g);try{typeof i.fireChange=="function"&&i.fireChange()}catch{}try{i.focus()}catch{}}}function v(g){for(var b=g.target,D=i.getEditable();b&&b!==D;){if(b.nodeType===1&&b.getAttribute&&b.getAttribute("data-rte-bookmark-remove")==="1"){g.preventDefault(),g.stopPropagation(),o(C(b,D));return}b=b.parentNode}}function w(g){if((g.key==="Enter"||g.key===" ")&&g.target&&g.target.getAttribute&&g.target.getAttribute("data-rte-bookmark-remove")==="1"){g.preventDefault(),g.stopPropagation(),o(C(g.target,i.getEditable()));return}if(!(g.key!=="Delete"&&g.key!=="Backspace")){var b=null;try{var D=i.getSelection();D&&D.rangeCount&&(b=C(D.getRangeAt(0).startContainer,i.getEditable()))}catch{b=null}b&&(g.preventDefault(),o(b))}}function q(g){var b=g.url,D=E(b),P=g.title||D,L=g.description||"",I=g.favicon||(c.bookmarkFaviconService?c.bookmarkFaviconService+encodeURIComponent(D):""),u=g.image||"",y='<a class="rte-bookmark-card" data-rte-block="bookmark" href="'+N(b)+'" target="_blank" rel="noopener noreferrer" contenteditable="false">';return y+='<span class="rte-bookmark-remove" data-rte-bookmark-remove="1" role="button" tabindex="0" aria-label="Remove bookmark" title="Remove bookmark">x</span>',y+='<span class="rte-bookmark-main">',y+='<span class="rte-bookmark-title">'+N(P)+"</span>",L&&(y+='<span class="rte-bookmark-desc">'+N(L)+"</span>"),y+='<span class="rte-bookmark-url">',I&&(y+='<img class="rte-bookmark-favicon" src="'+N(I)+'" alt="" width="16" height="16">'),y+="<span>"+N(D)+"</span></span>",y+="</span>",u&&(y+=`<span class="rte-bookmark-thumb" style="background-image:url('`+N(u).replace(/'/g,"%27")+`')"></span>`),y+="</a><p><br></p>",y}function B(g){H(),i.insertHTML(q(g)),i.focus()}S.OpenBookmarkDialog=function(){var g=i.createDialog(i.getLangText&&i.getLangText("insertbookmarktitle")||"Insert bookmark","rte-dialog-bookmark"),b=typeof g.close=="function"?function(){g.close()}:function(){i.closeCurrentPopup()},D=f(g,"div","padding:14px;min-width:420px;font:13px -apple-system,Segoe UI,sans-serif");f(D,"div","font-weight:600;margin-bottom:4px").innerText=i.getLangText&&i.getLangText("insertbookmarklabel")||"Link URL";var P=f(D,"input","width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;font:13px ui-monospace,monospace");P.type="url",P.placeholder="https://example.com/article";var L=f(D,"div","font-size:11px;color:#94a3b8;margin-top:6px;min-height:14px");c.bookmarkResolver||(L.innerText="No metadata resolver configured \u2014 a basic card (favicon + domain) will be inserted. Wire config.bookmarkResolver for rich previews.");var I=f(D,"div","display:flex;justify-content:flex-end;gap:8px;margin-top:14px"),u=f(I,"button","padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer");u.type="button",u.textContent="Cancel",u.onclick=b;var y=f(I,"button","padding:6px 14px;border:1px solid #1d67ba;border-radius:8px;background:#1d67ba;color:#fff;cursor:pointer");y.type="button",y.textContent="Insert",setTimeout(function(){P.focus()},0),P.onkeydown=function(O){O.key==="Enter"&&(O.preventDefault(),y.click())},y.onclick=function(){var O=A(P.value);if(!O){L.style.color="#dc2626",L.innerText="Enter a valid http(s) URL.";return}if(c.bookmarkResolver&&typeof c.bookmarkResolver=="function"){let Z=function(M){K||(K=!0,M=M||{},M.url=O,b(),B(M))};var V=Z;y.disabled=!0,L.style.color="#94a3b8",L.innerText="Fetching preview\u2026";var K=!1;try{var T=c.bookmarkResolver(O);T&&typeof T.then=="function"?(T.then(function(M){Z(M||{})},function(){Z({})}),setTimeout(function(){Z({})},8e3)):Z(T||{})}catch{Z({})}}else b(),B({url:O})}};function H(){var g=[".rte-bookmark-card{position:relative;display:flex;align-items:stretch;justify-content:space-between;gap:12px;margin:12px 0;border:1px solid rgba(15,23,42,.14);border-radius:10px;overflow:hidden;text-decoration:none;color:inherit;background:#fff;max-width:640px;transition:box-shadow 160ms,border-color 160ms}",".rte-bookmark-card:hover{border-color:rgba(37,99,235,.5);box-shadow:0 6px 18px rgba(15,23,42,.10)}",".rte-bookmark-remove{position:absolute;top:7px;right:7px;width:22px;height:22px;border:1px solid rgba(15,23,42,.14);border-radius:999px;background:rgba(255,255,255,.96);color:#334155;display:flex;align-items:center;justify-content:center;font:700 13px/1 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;box-shadow:0 4px 12px rgba(15,23,42,.12);opacity:0;transition:opacity 120ms,border-color 120ms,color 120ms;z-index:2}",".rte-bookmark-card:hover .rte-bookmark-remove,.rte-bookmark-card:focus .rte-bookmark-remove{opacity:1}",".rte-bookmark-remove:hover{border-color:rgba(220,38,38,.38);color:#b91c1c}",".rte-bookmark-main{flex:1;min-width:0;padding:12px 14px;display:flex;flex-direction:column;gap:4px}",".rte-bookmark-title{font-weight:600;font-size:14px;line-height:1.3;color:#0f172a;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}",".rte-bookmark-desc{font-size:12px;color:#64748b;line-height:1.4;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}",".rte-bookmark-url{display:flex;align-items:center;gap:6px;font-size:11px;color:#94a3b8;margin-top:2px}",".rte-bookmark-favicon{width:16px;height:16px;border-radius:3px;flex:0 0 16px}",".rte-bookmark-thumb{flex:0 0 120px;background-size:cover;background-position:center;background-color:#f1f5f9}","@media (max-width:480px){.rte-bookmark-thumb{display:none}}"].join(`
|
|
16
|
+
`);try{var b=i.getDocument();if(!b)return;var D=b.head||b.getElementsByTagName&&b.getElementsByTagName("head")[0]||b.documentElement;if(D&&!b.querySelector("style[data-rte-bookmarkcard]")){var P=b.createElement("style");P.setAttribute("data-rte-bookmarkcard","1"),P.textContent=g,D.appendChild(P)}}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_charlimit=RTE_Plugin_CharLimit;function RTE_Plugin_CharLimit(){var S=this,c,i,f=null;S.PluginName="CharLimit",S.InitConfig=function(u){c=u},S.InitEditor=function(u){if(i=u,i.getCharCount=function(){return o()},i.getWordCount=function(){return v()},i.getRemainingChars=function(){return A()?Math.max(0,A()-o()):null},i.isOverLimit=function(){return A()&&o()>A()||E()&&v()>E()},!(!A()&&!E())){N();try{i.attachEvent("created",N)}catch{}try{i.attachEvent("ready",N)}catch{}try{i.attachEvent("aftersethtml",function(){N(),L()})}catch{}typeof setTimeout=="function"&&(setTimeout(N,0),setTimeout(N,300))}};function N(){var u=i.getDocument&&i.getDocument();if(!u||u.__rteCharLimitBound){b(),L();return}u.__rteCharLimitBound=!0,c.charLimitEnforce!==!1&&(u.addEventListener("beforeinput",w,!0),u.addEventListener("paste",q,!0)),u.addEventListener("input",function(){L()},!0),b(),L()}function A(){var u=parseInt(c.maxLength,10);return u>0?u:0}function E(){var u=parseInt(c.maxWords,10);return u>0?u:0}function C(){try{var u=i.getEditable();return u&&(u.innerText||u.textContent)||""}catch{return""}}function o(){return C().replace(/\r\n/g,`
|
|
17
|
+
`).length}function v(){var u=C().trim();return u?u.split(/\s+/).length:0}function w(u){var y=u.inputType||"",O=y==="insertText"||y==="insertReplacementText"||y==="insertCompositionText"||y==="insertParagraph"||y==="insertLineBreak";if(O){var K=y==="insertParagraph"||y==="insertLineBreak"?1:(u.data||"").length||0;if(A()){var T=o();if((T>=A()||T+K>A())&&(!B()||T+K>A()+H())){u.preventDefault(),I();return}}if(E()&&y!=="insertParagraph"&&v()>=E()&&/\s$/.test(u.data||" ")&&v()>=E()){u.preventDefault(),I();return}}}function q(u){if(A()){var y=A()-o()+H();if(y<=0){u.preventDefault(),I();return}var O=u.clipboardData||window.clipboardData;if(O){var K="";try{K=O.getData("text/plain")||""}catch{return}if(K.length>y){u.preventDefault();var T=K.slice(0,y);try{typeof i.insertHTML=="function"&&i.insertHTML(g(T).replace(/\n/g,"<br>"))}catch{}I()}}}}function B(){try{var u=i.getSelection();return u&&u.rangeCount>0&&!u.isCollapsed}catch{return!1}}function H(){try{var u=i.getSelection();return u&&!u.isCollapsed?(u.toString()||"").length:0}catch{return 0}}function g(u){return String(u).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function b(){if(c.charLimitShowCounter!==!1&&!(f&&f.parentNode)){var u=D();u&&(P(u.ownerDocument),f=u.ownerDocument.createElement("div"),f.className="rte-charlimit-counter",f.setAttribute("aria-live","polite"),u.appendChild(f))}}function D(){try{var u=i.iframe||i.getDocument&&i.getDocument().defaultView&&i.getDocument().defaultView.frameElement;if(u){for(var y=u.parentNode;y&&y.nodeType===1;){var O=(y.ownerDocument.defaultView||window).getComputedStyle(y);if(O&&O.position!=="static")return y;if(y.className&&typeof y.className=="string"&&/rte[_-](outer|container|wrapper)/i.test(y.className)){try{O&&O.position==="static"&&(y.style.position="relative")}catch{}return y}y=y.parentNode}if(u.parentNode){try{u.parentNode.style.position=u.parentNode.style.position||"relative"}catch{}return u.parentNode}}return null}catch{return null}}function P(u){if(!u.querySelector("style[data-rte-charlimit]")){var y=u.createElement("style");y.setAttribute("data-rte-charlimit","1"),y.textContent=".rte-charlimit-counter{position:absolute;right:10px;bottom:6px;z-index:5;font:11px -apple-system,Segoe UI,sans-serif;color:#64748b;background:rgba(255,255,255,.85);padding:1px 7px;border-radius:9px;pointer-events:none}.rte-charlimit-counter.is-near{color:#b45309}.rte-charlimit-counter.is-over{color:#dc2626;font-weight:600}",(u.head||u.documentElement).appendChild(y)}}function L(){var u=o(),y=v(),O=A()?Math.max(0,u-A()):0,K=E()?Math.max(0,y-E()):0;if(f){var T="";A()?T=u+" / "+A():E()&&(T=y+" / "+E()+" words"),f.textContent=T,f.classList.remove("is-near","is-over"),A()&&u>A()||E()&&y>E()?f.classList.add("is-over"):(A()&&u>=A()*.9||E()&&y>=E()*.9)&&f.classList.add("is-near")}try{typeof i.fireEvent=="function"&&i.fireEvent("charlimit",{chars:u,words:y,overChars:O,overWords:K})}catch{}}function I(){if(f){f.classList.add("is-over");try{f.animate([{transform:"translateX(0)"},{transform:"translateX(-3px)"},{transform:"translateX(3px)"},{transform:"translateX(0)"}],{duration:160})}catch{}}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.svgCode_commentadd||(RTE_DefaultConfig.svgCode_commentadd='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5h14a2 2 0 012 2v8a2 2 0 01-2 2h-7l-4 4v-4H4a2 2 0 01-2-2V7a2 2 0 012-2z"/><path d="M8 9h8"/><path d="M8 12h5"/></svg>'),RTE_DefaultConfig.plugin_comments=RTE_Plugin_Comments;function RTE_Plugin_Comments(){var S=this,c,i,f=null,N=null;S.PluginName="Comments",S.InitConfig=function(h){c=h,c.commentsEnabled!==!1&&(c.text_commentadd=c.text_commentadd||"Comment",c.commentHighlightBg=c.commentHighlightBg||"#fff9c4",c.commentHighlightBorder=c.commentHighlightBorder||"#f9a825",A("toolbar_default","#{commentadd}"),A("toolbar_full","#{commentadd}"),A("toolbar_mobile","#{commentadd}"),(c.controltoolbar_TEXT||"").indexOf("commentadd")===-1&&(c.controltoolbar_TEXT=(c.controltoolbar_TEXT||"")+"|{commentadd}"))},S.InitEditor=function(h){i=h,c.commentsEnabled!==!1&&(i.comments={add:function(x){return b(x)},reply:function(x,z){return D(x,z)},resolve:function(x){return P(x)},delete:function(x){return L(x)},list:function(x){return o(x)},openSidebar:function(){O()},closeSidebar:function(){K()},toggleSidebar:function(){f&&f.isConnected?K():O()},focusComment:function(x){I(x)}},j(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.commentadd=function(x){return i.createToolbarButton(x)},i.attachEvent("exec_command_commentadd",function(x){x.returnValue=!0,x.stopBubble=!0,w()}),i.getEditable().addEventListener("click",function(x){var z=x.target&&x.target.closest?x.target.closest(".rte-comment"):null;if(z){var J=z.getAttribute("data-comment-id");J&&I(J)}}),v())};function A(h,x){c[h]&&c[h].indexOf(x)===-1&&(c[h]=c[h]+x)}function E(){return c.currentUser&&c.currentUser.id?c.currentUser:{id:"user",name:"User",color:"#2563eb"}}function C(){try{var h=i.container||i.getEditable&&i.getEditable().closest&&i.getEditable().closest(".richtexteditor");return!!(h&&h.classList&&h.classList.contains("rte-dark"))}catch{return!1}}function o(h){return i.reviewLedger?i.reviewLedger.list().filter(function(x){return!(x.changeType!=="comment"||h&&h.status&&x.status!==h.status||h&&h.author&&x.author.id!==h.author)}):[]}function v(){for(var h=i.getEditable(),x=o(),z=0;z<x.length;z++){var J=x[z].id;h.querySelector('[data-comment-id="'+y(J)+'"]')||i.reviewLedger&&x[z].status==="pending"&&i.reviewLedger.update(J,{status:"stale"})}}function w(){var h=i.getSelection();if(!h||h.rangeCount===0||h.isCollapsed){var x=h&&h.rangeCount?q(h.getRangeAt(0)):null;B({anchor:x,allowEmpty:!0});return}var z=h.getRangeAt(0);B({anchor:q(z),range:z})}function q(h){return h?{startContainer:h.startContainer,startOffset:h.startOffset,endContainer:h.endContainer,endOffset:h.endOffset,text:h.toString()}:null}function B(h){g(),h=h||{};var x=i.iframe.ownerDocument;N=x.createElement("div"),N.className="rte-comment-composer"+(C()?" rte-comment-dark":""),N.setAttribute("role","dialog"),N.setAttribute("aria-label","Add comment");var z=x.createElement("div");z.className="rte-comment-composer-header",z.textContent="Add comment",N.appendChild(z);var J=x.createElement("textarea");J.className="rte-comment-composer-textarea",J.placeholder="Type your comment...",J.rows=3,N.appendChild(J);var ee=x.createElement("div");ee.className="rte-comment-composer-actions";var ue=x.createElement("button");ue.type="button",ue.className="rte-comment-btn rte-comment-btn-ghost",ue.textContent="Cancel",ue.addEventListener("mousedown",function(U){U.preventDefault(),g()});var ve=x.createElement("button");ve.type="button",ve.className="rte-comment-btn rte-comment-btn-primary",ve.textContent="Comment",ve.addEventListener("mousedown",function(U){U.preventDefault();var F=J.value.replace(/^\s+|\s+$/g,"");F&&(b({anchor:h.anchor,text:F}),g())}),ee.appendChild(ue),ee.appendChild(ve),N.appendChild(ee),x.body.appendChild(N),H(h.anchor),setTimeout(function(){J.focus()},0);var re=function(U){(U.key==="Escape"||U.key==="Esc")&&g()};N.addEventListener("keydown",re)}function H(h){if(N){N.style.position="absolute";var x=i.iframe,z=x.getBoundingClientRect(),J=z.left+window.pageXOffset+12,ee=z.top+window.pageYOffset+12;if(h&&h.startContainer)try{var ue=i.getDocument().createRange();ue.setStart(h.startContainer,h.startOffset),ue.setEnd(h.endContainer,h.endOffset);var ve=ue.getClientRects(),re=ve&&ve.length?ve[ve.length-1]:ue.getBoundingClientRect();J=z.left+(re.left||0)+window.pageXOffset,ee=z.top+(re.bottom||re.top||0)+window.pageYOffset+6}catch{}N.style.left=J+"px",N.style.top=ee+"px"}}function g(){N&&N.parentNode&&N.parentNode.removeChild(N),N=null}function b(h){if(h=h||{},!i.reviewLedger)return null;var x=(h.text||"").replace(/^\s+|\s+$/g,"");if(!x)return null;var z="cmt-"+Date.now()+"-"+Math.floor(Math.random()*1e4),J=E(),ee=h.anchor,ue="";if(ee&&ee.startContainer&&ee.endContainer&&ee.text){var ve=i.getDocument();try{var re=ve.createRange();re.setStart(ee.startContainer,ee.startOffset),re.setEnd(ee.endContainer,ee.endOffset);var U=ve.createElement("span");U.className="rte-comment",U.setAttribute("data-comment-id",z),U.setAttribute("data-comment-author",J.id);var F=re.extractContents();U.appendChild(F),re.insertNode(U),ue=U.textContent;var $=ve.createRange();$.setStartAfter(U),$.collapse(!0);var ne=i.getSelection();ne.removeAllRanges(),ne.addRange($)}catch(pe){console.warn("comments: range wrap failed:",pe)}}i.reviewLedger.add({id:z,changeType:"comment",author:J,text:x,originalText:ue||ee&&ee.text||"",status:"pending",sourceLabel:"Comment",createdAt:Date.now(),replies:[]}),f&&f.isConnected?V():O(),I(z);try{typeof i.fireEvent=="function"&&i.fireEvent("comment_added",{id:z,text:x,author:J})}catch{}return z}function D(h,x){if(!i.reviewLedger)return!1;var z=i.reviewLedger.get(h);if(!z)return!1;var J=Array.isArray(z.replies)?z.replies.slice():[];return J.push({id:"rpl-"+Date.now()+"-"+Math.floor(Math.random()*1e4),author:E(),text:x,createdAt:Date.now()}),i.reviewLedger.update(h,{replies:J}),f&&f.isConnected&&V(),!0}function P(h){if(!i.reviewLedger)return!1;var x=i.getEditable().querySelector('[data-comment-id="'+y(h)+'"]');x&&u(x),i.reviewLedger.update(h,{status:"resolved",decidedAt:Date.now()}),f&&f.isConnected&&V();try{typeof i.fireEvent=="function"&&i.fireEvent("comment_resolved",{id:h})}catch{}return!0}function L(h){if(!i.reviewLedger)return!1;var x=i.getEditable().querySelector('[data-comment-id="'+y(h)+'"]');return x&&u(x),i.reviewLedger.remove(h),f&&f.isConnected&&V(),!0}function I(h){(!f||!f.isConnected)&&O(),setTimeout(function(){if(f){var x=f.querySelector('[data-comment-ref="'+y(h)+'"]');x&&(x.scrollIntoView({block:"nearest"}),x.classList.add("rte-comment-item-active"),setTimeout(function(){x.classList.remove("rte-comment-item-active")},1400))}},30)}function u(h){var x=h.parentNode;if(x){for(;h.firstChild;)x.insertBefore(h.firstChild,h);x.removeChild(h)}}function y(h){var x=String(h);if(typeof CSS<"u"&&typeof CSS.escape=="function")try{return CSS.escape(x)}catch{}return x.replace(/["\\\]\[\(\)\{\}'#:;,<>=`~!@$%^&*+/?\s\x00-\x1F]/g,function(z){return"\\"+z})}function O(){if(f&&f.isConnected){V();return}var h=i.iframe.ownerDocument;f=h.createElement("div"),f.className="rte-comment-sidebar"+(C()?" rte-comment-dark":""),f.setAttribute("role","complementary"),f.setAttribute("aria-label","Comments");var x=T();x?(x.parentNode.insertBefore(f,x.nextSibling),x.classList.add("rte-comment-sidebar-host")):h.body.appendChild(f),V()}function K(){f&&f.parentNode&&f.parentNode.removeChild(f),f=null;var h=T();h&&h.classList.remove("rte-comment-sidebar-host")}function T(){for(var h=i.iframe;h&&h!==document.body;){if(h.classList&&h.classList.contains("richtexteditor"))return h;h=h.parentNode}return null}function V(){if(f){var h=f.ownerDocument;f.innerHTML="";var x=h.createElement("div");x.className="rte-comment-sidebar-header";var z=h.createElement("div");z.className="rte-comment-sidebar-title",z.textContent="Comments",x.appendChild(z);var J=h.createElement("button");J.type="button",J.className="rte-comment-sidebar-close",J.setAttribute("aria-label","Close"),J.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6l12 12"/><path d="M18 6L6 18"/></svg>',J.addEventListener("mousedown",function(U){U.preventDefault(),K()}),x.appendChild(J),f.appendChild(x);var ee=h.createElement("div");ee.className="rte-comment-list",f.appendChild(ee);var ue=o({status:"pending"});if(!ue.length){var ve=h.createElement("div");ve.className="rte-comment-empty",ve.textContent="No open comments. Select text and click the Comment button to start.",ee.appendChild(ve);return}ue.sort(function(U,F){return(F.createdAt||0)-(U.createdAt||0)});for(var re=0;re<ue.length;re++)ee.appendChild(Z(ue[re],h))}}function Z(h,x){var z=x.createElement("div");z.className="rte-comment-item",z.setAttribute("data-comment-ref",h.id),z.setAttribute("role","article");var J=x.createElement("div");J.className="rte-comment-item-top";var ee=x.createElement("span");ee.className="rte-comment-avatar",ee.style.background=h.author.color||"#2563eb",ee.textContent=X(h.author.name||h.author.id||"?");var ue=x.createElement("div");ue.className="rte-comment-namewrap";var ve=x.createElement("div");ve.className="rte-comment-name",ve.textContent=h.author.name||h.author.id||"";var re=x.createElement("div");re.className="rte-comment-when",re.textContent=G(h.createdAt),ue.appendChild(ve),ue.appendChild(re),J.appendChild(ee),J.appendChild(ue);var U=x.createElement("div");U.className="rte-comment-actions";var F=x.createElement("button");F.type="button",F.className="rte-comment-action rte-comment-resolve",F.textContent="Resolve",F.setAttribute("aria-label","Resolve comment"),F.addEventListener("mousedown",function(sr){sr.preventDefault(),P(h.id)});var $=x.createElement("button");if($.type="button",$.className="rte-comment-action rte-comment-delete",$.textContent="Delete",$.setAttribute("aria-label","Delete comment"),$.addEventListener("mousedown",function(sr){sr.preventDefault(),L(h.id)}),U.appendChild(F),U.appendChild($),J.appendChild(U),z.appendChild(J),h.originalText){var ne=x.createElement("div");ne.className="rte-comment-quote",ne.textContent=Y(h.originalText,140),ne.addEventListener("click",function(){M(h.id)}),z.appendChild(ne)}var pe=x.createElement("div");pe.className="rte-comment-body",pe.textContent=h.text,z.appendChild(pe);for(var Ae=Array.isArray(h.replies)?h.replies:[],He=0;He<Ae.length;He++){var Ze=Ae[He],_t=x.createElement("div");_t.className="rte-comment-reply";var Vt=x.createElement("span");Vt.className="rte-comment-reply-avatar",Vt.style.background=Ze.author&&Ze.author.color||"#64748b",Vt.textContent=X(Ze.author&&Ze.author.name||"?");var It=x.createElement("div");It.className="rte-comment-reply-body";var $t=x.createElement("div");$t.className="rte-comment-reply-name",$t.textContent=(Ze.author&&Ze.author.name||"User")+" \xB7 "+G(Ze.createdAt);var lr=x.createElement("div");lr.className="rte-comment-reply-text",lr.textContent=Ze.text,It.appendChild($t),It.appendChild(lr),_t.appendChild(Vt),_t.appendChild(It),z.appendChild(_t)}var Nt=x.createElement("div");Nt.className="rte-comment-reply-composer";var it=x.createElement("input");return it.type="text",it.className="rte-comment-reply-input",it.placeholder="Reply...",it.setAttribute("aria-label","Reply to comment"),it.addEventListener("keydown",function(sr){if(sr.key==="Enter"&&!sr.shiftKey){sr.preventDefault();var Gr=it.value.replace(/^\s+|\s+$/g,"");Gr&&D(h.id,Gr),it.value=""}}),Nt.appendChild(it),z.appendChild(Nt),z}function M(h){var x=i.getEditable().querySelector('[data-comment-id="'+y(h)+'"]');x&&(x.scrollIntoView({block:"center",behavior:"smooth"}),x.classList.add("rte-comment-flash"),setTimeout(function(){x.classList.remove("rte-comment-flash")},1200))}function X(h){var x=String(h).trim().split(/\s+/);return x[0]?x.length===1?x[0].charAt(0).toUpperCase():(x[0].charAt(0)+x[x.length-1].charAt(0)).toUpperCase():"?"}function G(h){if(!h)return"";var x=Math.floor((Date.now()-h)/1e3);return x<60?"just now":x<3600?Math.floor(x/60)+"m ago":x<86400?Math.floor(x/3600)+"h ago":Math.floor(x/86400)+"d ago"}function Y(h,x){return h.length<=x?h:h.slice(0,x-1)+"\u2026"}function j(){var h=i&&i.iframe&&i.iframe.ownerDocument||document;if(!h.querySelector("style[data-rte-comments]")){var x=h.createElement("style");x.setAttribute("data-rte-comments","1"),x.textContent=[".rte-comment-sidebar-host{display:flex!important;align-items:stretch}",".rte-comment-sidebar{width:310px;min-width:270px;max-width:min(360px,32vw);margin-left:12px;padding:0;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));border:1px solid rgba(148,163,184,.22);border-radius:16px;font-family:Aptos,'Segoe UI',sans-serif;font-size:13px;color:#172033;display:flex;flex-direction:column;max-height:calc(100vh - 120px);overflow:hidden;box-shadow:0 18px 42px rgba(29,78,216,.12),0 2px 8px rgba(15,23,42,.06)}",".rte-comment-sidebar-header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 10px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);font-weight:750;background:rgba(255,255,255,.72)}",".rte-comment-sidebar-title{font-size:13px;font-weight:850;letter-spacing:.02em}",".rte-comment-sidebar-close{width:28px;height:28px;border:1px solid rgba(100,116,139,.18);background:#fff;cursor:pointer;color:#64748b;padding:0;border-radius:999px;display:inline-flex;align-items:center;justify-content:center}",".rte-comment-sidebar-close:hover,.rte-comment-sidebar-close:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28)}",".rte-comment-list{flex:1;min-height:0;overflow-y:auto;padding:6px;scrollbar-width:thin}",".rte-comment-empty{margin:6px;padding:14px;color:#52657e;font-size:12px;font-weight:700;line-height:1.45;text-align:center;background:#fff;border:1px dashed rgba(148,163,184,.28);border-radius:13px}",".rte-comment-item{padding:10px;border:1px solid rgba(148,163,184,.14);border-radius:14px;background:rgba(255,255,255,.82);box-shadow:0 8px 18px rgba(15,23,42,.04);transition:background 200ms ease,box-shadow 200ms ease,transform 200ms ease}",".rte-comment-item+.rte-comment-item{margin-top:7px}",".rte-comment-item-active{background:#eef4ff;box-shadow:0 12px 28px rgba(37,99,235,.14);transform:translateY(-1px)}",".rte-comment-item-top{display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:8px}",".rte-comment-avatar{width:30px;height:30px;border-radius:11px;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:11px;font-weight:800;flex:0 0 30px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.28)}",".rte-comment-namewrap{flex:1;min-width:0}",".rte-comment-name{font-weight:800;font-size:12px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-comment-when{font-size:11px;color:#64748b}",".rte-comment-actions{display:flex;gap:4px;align-items:center}",".rte-comment-action{font-size:11px;font-weight:750;padding:4px 8px;border-radius:999px;border:1px solid rgba(100,116,139,.16);background:#fff;cursor:pointer}",".rte-comment-action:hover,.rte-comment-action:focus-visible{transform:translateY(-1px)}",".rte-comment-resolve{color:#0f3f9f;border-color:rgba(37,99,235,.2);background:#eef4ff}",".rte-comment-delete{color:#9f1239;border-color:rgba(159,18,57,.18);background:#fff1f2}",".rte-comment-quote{margin:8px 0 0;padding:7px 9px;background:#fff8e8;border:1px solid rgba(245,158,11,.18);border-left:3px solid #f59e0b;border-radius:11px;font-size:11px;color:#67430a;cursor:pointer;line-height:1.35}",".rte-comment-quote:hover{background:#fff3cf}",".rte-comment-body{margin-top:8px;font-size:13px;line-height:1.45;color:#172033;white-space:pre-wrap}",".rte-comment-reply{display:flex;gap:8px;margin-top:10px;padding-top:9px;border-top:1px dashed rgba(148,163,184,.22)}",".rte-comment-reply-avatar{width:24px;height:24px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:10px;font-weight:800;flex:0 0 24px}",".rte-comment-reply-body{flex:1;min-width:0}",".rte-comment-reply-name{font-size:11px;color:#64748b}",".rte-comment-reply-text{font-size:12px;color:#172033;line-height:1.45;white-space:pre-wrap;margin-top:2px}",".rte-comment-reply-composer{margin-top:8px;display:flex}",".rte-comment-reply-input{flex:1;min-width:0;padding:7px 10px;border-radius:999px;border:1px solid rgba(148,163,184,.24);font:inherit;font-size:12px;background:#fff}",".rte-comment-reply-input:focus,.rte-comment-composer-textarea:focus{outline:2px solid rgba(37,99,235,.18);border-color:rgba(37,99,235,.38)}",".rte-comment-composer{position:absolute;z-index:2147483000;width:min(320px,calc(100vw - 24px));background:linear-gradient(180deg,#fff,#f8fbff);border:1px solid rgba(148,163,184,.22);box-shadow:0 18px 42px rgba(29,78,216,.16),0 2px 8px rgba(15,23,42,.08);border-radius:16px;padding:12px;font-family:Aptos,'Segoe UI',sans-serif;color:#172033}",".rte-comment-composer-header{font-weight:850;font-size:13px;margin-bottom:8px;color:#172033}",".rte-comment-composer-textarea{width:100%;box-sizing:border-box;padding:9px 10px;border-radius:12px;border:1px solid rgba(148,163,184,.24);font:inherit;font-size:13px;resize:vertical;min-height:70px;background:#fff}",".rte-comment-composer-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:9px}",".rte-comment-btn{min-height:30px;padding:0 13px;border-radius:999px;border:1px solid rgba(100,116,139,.18);font:750 12px/1 Aptos,'Segoe UI',sans-serif;cursor:pointer}",".rte-comment-btn-ghost{background:#fff;color:#52657e}",".rte-comment-btn-primary{background:#1d67ba;color:#fff;border-color:#1d67ba;box-shadow:0 8px 16px rgba(29,103,186,.18)}","@media (prefers-color-scheme:dark){"," .rte-comment-sidebar,.rte-comment-composer{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0}"," .rte-comment-sidebar-header{background:rgba(30,41,59,.72);border-color:#334155}"," .rte-comment-item{background:rgba(30,41,59,.85);border-color:#334155}"," .rte-comment-item-active{background:#1e3a8a}"," .rte-comment-empty{background:#0f172a;color:#94a3b8;border-color:#334155}"," .rte-comment-when,.rte-comment-reply-name{color:#94a3b8}"," .rte-comment-body,.rte-comment-reply-text,.rte-comment-composer-header{color:#e2e8f0}"," .rte-comment-reply-input,.rte-comment-composer-textarea{background:#0f172a;color:#e2e8f0;border-color:#334155}"," .rte-comment-action,.rte-comment-btn-ghost,.rte-comment-sidebar-close{background:#0f172a;color:#cbd5e1;border-color:#334155}"," .rte-comment-quote{background:rgba(245,158,11,.12);color:#fcd34d}","}",".rte-comment-dark.rte-comment-sidebar,.rte-comment-dark.rte-comment-composer{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0}",".rte-comment-dark .rte-comment-sidebar-header{background:rgba(30,41,59,.72);border-color:#334155}",".rte-comment-dark .rte-comment-item{background:rgba(30,41,59,.85);border-color:#334155}",".rte-comment-dark .rte-comment-item-active{background:#1e3a8a}",".rte-comment-dark .rte-comment-empty{background:#0f172a;color:#94a3b8;border-color:#334155}",".rte-comment-dark .rte-comment-when,.rte-comment-dark .rte-comment-reply-name{color:#94a3b8}",".rte-comment-dark .rte-comment-body,.rte-comment-dark .rte-comment-reply-text,.rte-comment-dark .rte-comment-composer-header{color:#e2e8f0}",".rte-comment-dark .rte-comment-reply-input,.rte-comment-dark .rte-comment-composer-textarea{background:#0f172a;color:#e2e8f0;border-color:#334155}",".rte-comment-dark .rte-comment-action,.rte-comment-dark .rte-comment-btn-ghost,.rte-comment-dark .rte-comment-sidebar-close{background:#0f172a;color:#cbd5e1;border-color:#334155}",".rte-comment-dark .rte-comment-quote{background:rgba(245,158,11,.12);color:#fcd34d}"].join(`
|
|
18
|
+
`),h.head.appendChild(x)}var z=i.getDocument();if(z&&z.head&&!z.querySelector("style[data-rte-comments-inline]")){var J=z.createElement("style");J.setAttribute("data-rte-comments-inline","1"),J.textContent=[".rte-comment{background:"+c.commentHighlightBg+";border-bottom:2px solid "+c.commentHighlightBorder+";cursor:pointer;padding:0 1px;border-radius:2px}",".rte-comment:hover{background:rgba(253,230,138,.6)}",".rte-comment-flash{animation:rte-comment-flash 1.2s ease}","@keyframes rte-comment-flash{0%{background:rgba(251,191,36,.9)}100%{background:"+c.commentHighlightBg+"}}"].join(`
|
|
19
|
+
`),z.head.appendChild(J)}}function p(h,x){if(!h)return null;var z=h.commonAncestorContainer,J=z&&z.nodeType===1?z:z&&z.parentNode;if(!J)return null;var ee=J.closest&&J.closest("img,table,figure,video,audio,iframe,embed,object,hr,svg");return!ee&&J.querySelector&&(ee=J.querySelector("img,table,figure,video,audio,iframe,embed,object,hr,svg")),ee?(ee.setAttribute("data-rte-comment-anchor","element"),{kind:"element",element:ee}):{kind:"range",range:h}}function k(h){return!h||h.nodeType!==1||!h.getAttribute?!1:h.getAttribute("data-rte-comment-anchor")==="element"}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_contentminimap=RTE_Plugin_ContentMinimap;function RTE_Plugin_ContentMinimap(){var S=this,c,i,f=null,N=null,A=null,E=null,C=null,o=0,v=null;S.PluginName="ContentMinimap",S.InitConfig=function(j){c=j,c.contentMinimapEnabled!==!1&&(typeof c.contentMinimapAutoOpen!="boolean"&&(c.contentMinimapAutoOpen=!1),typeof c.contentMinimapWidth!="number"&&(c.contentMinimapWidth=168),typeof c.contentMinimapScale!="number"&&(c.contentMinimapScale=.14),c.contentMinimapTitle=c.contentMinimapTitle||"Minimap",c.contentMinimapHint=c.contentMinimapHint||"Keep your place in long documents and jump by clicking the miniature preview.",c.contentMinimapEmptyText=c.contentMinimapEmptyText||"Start typing to build the document preview.",w("toolbar_default","#{contentminimap}"),w("toolbar_full","#{contentminimap}"))},S.InitEditor=function(j){i=j,c.contentMinimapEnabled!==!1&&(i.contentMinimap={close:function(){P()},isOpen:function(){return!!(f&&f.classList.contains("is-open"))},open:function(){D()},refresh:function(){K(),T()},toggle:function(){b()}},q(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.contentminimap=function(p){return i.createToolbarButton(p)},i.attachEvent("exec_command_contentminimap",function(p){p.returnValue=!0,p.stopBubble=!0,b()}),i.attachEvent("change",function(){I()}),B(),H(),g(),K(),T(),c.contentMinimapAutoOpen&&D())};function w(j,p){c[j]&&c[j].indexOf(p)===-1&&(c[j]=c[j]+p)}function q(){var j=c.container.ownerDocument;if(!j.getElementById("rte-content-minimap-style")){var p=j.createElement("style");p.id="rte-content-minimap-style",p.innerHTML=[".rte-content-minimap-shell{display:flex;align-items:stretch;gap:10px;}",".rte-content-minimap-shell>.rte-content-minimap-host{flex:1 1 auto;min-width:0;}",".rte-content-minimap-panel{display:none;flex:0 0 var(--rte-content-minimap-width,168px);min-width:148px;max-width:220px;border:1px solid rgba(148,163,184,.22);border-radius:16px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));box-shadow:0 18px 42px rgba(29,78,216,.12),0 2px 8px rgba(15,23,42,.06);overflow:hidden;color:#172033;font-family:Aptos,'Segoe UI',sans-serif;}",".rte-content-minimap-shell.is-open>.rte-content-minimap-panel{display:flex;flex-direction:column;}",".rte-content-minimap-header{padding:12px 12px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.72);}",".rte-content-minimap-kicker{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-content-minimap-title{margin-top:3px;font-size:15px;line-height:1.2;font-weight:850;color:#172033;}",".rte-content-minimap-copy{margin-top:5px;font-size:12px;line-height:1.42;color:#52657e;}",".rte-content-minimap-toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 8px 14px;border-bottom:1px solid rgba(148,163,184,.16);gap:8px;background:rgba(255,255,255,.52);}",".rte-content-minimap-meta{min-width:0;font-size:12px;font-weight:750;color:#52657e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}",".rte-content-minimap-close{appearance:none;border:1px solid rgba(100,116,139,.18);background:#fff;color:#315277;cursor:pointer;font-size:12px;font-weight:750;padding:6px 9px;border-radius:999px;line-height:1;}",".rte-content-minimap-close:hover,.rte-content-minimap-close:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28);}",".rte-content-minimap-body{padding:6px;overflow:auto;min-height:140px;max-height:520px;scrollbar-width:thin;}",".rte-content-minimap-canvas{position:relative;border-radius:14px;background:#fff;border:1px solid rgba(148,163,184,.18);overflow:hidden;min-height:120px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.7);}",".rte-content-minimap-preview{position:relative;transform-origin:top left;pointer-events:none;color:#172033;background:#fff;}",".rte-content-minimap-preview>*{max-width:100%;}",".rte-content-minimap-preview img,.rte-content-minimap-preview table,.rte-content-minimap-preview iframe,.rte-content-minimap-preview video{max-width:100% !important;}",".rte-content-minimap-preview [contenteditable]{pointer-events:none;}",".rte-content-minimap-viewport{position:absolute;left:0;right:0;border:1px solid rgba(37,99,235,.62);background:linear-gradient(180deg,rgba(37,99,235,.18) 0%,rgba(14,165,233,.12) 100%);box-shadow:inset 0 0 0 1px rgba(255,255,255,.48),0 8px 18px rgba(37,99,235,.16);border-radius:10px;cursor:grab;}",".rte-content-minimap-viewport.is-dragging{cursor:grabbing;}",".rte-content-minimap-empty{position:absolute;inset:auto 8px 8px 8px;padding:10px;border-radius:12px;background:rgba(255,255,255,.94);color:#52657e;font-size:12px;font-weight:700;line-height:1.45;border:1px dashed rgba(148,163,184,.32);}","@media (max-width: 1100px){.rte-content-minimap-shell{display:block;}.rte-content-minimap-panel{margin-top:12px;max-width:none;width:100%;}.rte-content-minimap-body{max-height:280px;}}"].join(""),j.head.appendChild(p)}}function B(){if(f)return f;var j=c.container,p=j.ownerDocument;f=p.createElement("div"),f.className="rte-content-minimap-shell";var k=p.createElement("div");k.className="rte-content-minimap-host";var h=j.parentNode;h.insertBefore(f,j),f.appendChild(k),k.appendChild(j),N=p.createElement("aside"),N.className="rte-content-minimap-panel",N.style.setProperty("--rte-content-minimap-width",String(Math.max(148,c.contentMinimapWidth||168))+"px"),N.setAttribute("aria-label",c.contentMinimapTitle),N.setAttribute("role","complementary");var x=p.createElement("div");x.className="rte-content-minimap-header";var z=p.createElement("div");z.className="rte-content-minimap-kicker",z.innerText="Document";var J=p.createElement("div");J.className="rte-content-minimap-title",J.innerText=c.contentMinimapTitle;var ee=p.createElement("div");ee.className="rte-content-minimap-copy",ee.innerText=c.contentMinimapHint,x.appendChild(z),x.appendChild(J),x.appendChild(ee);var ue=p.createElement("div");ue.className="rte-content-minimap-toolbar";var ve=p.createElement("div");ve.className="rte-content-minimap-meta",ve.setAttribute("data-rte-content-minimap-meta","1");var re=p.createElement("button");re.type="button",re.className="rte-content-minimap-close",re.innerText="Hide",re.setAttribute("aria-label","Hide content minimap"),re.onclick=function(){P()},ue.appendChild(ve),ue.appendChild(re);var U=p.createElement("div");U.className="rte-content-minimap-body";var F=p.createElement("div");return F.className="rte-content-minimap-canvas",F.addEventListener("click",V,!1),A=p.createElement("div"),A.className="rte-content-minimap-preview",E=p.createElement("div"),E.className="rte-content-minimap-viewport",E.setAttribute("role","presentation"),E.addEventListener("mousedown",Z,!1),C=p.createElement("div"),C.className="rte-content-minimap-empty",C.innerText=c.contentMinimapEmptyText,F.appendChild(A),F.appendChild(E),F.appendChild(C),U.appendChild(F),N.appendChild(x),N.appendChild(ue),N.appendChild(U),f.appendChild(N),f}function H(){var j=i.getDocument?i.getDocument():null;!j||j.__rteContentMinimapBound||(j.__rteContentMinimapBound=!0,j.addEventListener("scroll",function(){T()},!0))}function g(){var j=c.container.ownerDocument.defaultView;!j||j.__rteContentMinimapBound||(j.__rteContentMinimapBound=!0,j.addEventListener("resize",function(){I()}))}function b(){f&&f.classList.contains("is-open")?P():D()}function D(){B(),f.classList.add("is-open"),K(),T(),L()}function P(){f&&(f.classList.remove("is-open"),L())}function L(){var j=function(){try{i&&typeof i.fireEvent=="function"&&i.fireEvent("resize")}catch{}try{i&&typeof i.updateLayout=="function"&&i.updateLayout()}catch{}try{var k=c.container.ownerDocument,h=k.defaultView||window;h.dispatchEvent(new h.Event("resize"))}catch{}};j();var p=typeof requestAnimationFrame=="function"?requestAnimationFrame:function(k){return setTimeout(k,16)};p(j)}function I(){clearTimeout(o),o=setTimeout(function(){K(),T()},80)}function u(){return i.getEditable?i.getEditable():null}function y(){var j=i.getDocument?i.getDocument():null;return j?j.scrollingElement||j.documentElement||j.body||u():null}function O(){var j=c.contentMinimapScale||.14;return j<.06&&(j=.06),j>.22&&(j=.22),j}function K(){B();var j=u();if(!(!j||!A)){var p=j.innerHTML||"";A.innerHTML=p;var k=O(),h=Math.max(j.scrollWidth||j.clientWidth||600,320),x=Math.max(j.scrollHeight||j.clientHeight||0,0),z=Math.max(120,Math.round(h*k)),J=Math.max(120,Math.round(x*k));A.style.width=h+"px",A.style.transform="scale("+k+")",A.parentNode.style.height=J+"px",A.parentNode.style.width=z+"px",C.style.display=p.replace(/<[^>]+>/g,"").replace(/\s+/g,"")?"none":"block";var ee=N.querySelector("[data-rte-content-minimap-meta]");ee&&(ee.innerText=Math.max(1,Math.round(x/Math.max(j.clientHeight||1,1)))+" screens")}}function T(){if(!(!E||!A)){var j=u(),p=y();if(!(!j||!p)){var k=O(),h=Math.max(j.scrollHeight||p.scrollHeight||j.clientHeight||1,1),x=Math.max(p.scrollHeight||h,h),z=Math.max(p.clientHeight||j.clientHeight||1,1),J=Math.max(0,x-z),ee=Math.max(120,Math.round(h*k)),ue=Math.max(18,Math.round(z*k));ue>ee&&(ue=ee);var ve=J?Math.round(p.scrollTop/J*Math.max(0,ee-ue)):0;E.style.height=ue+"px",E.style.top=ve+"px",E.style.display=ee>0?"block":"none"}}}function V(j){j.target!==E&&G(j.clientY)}function Z(j){j.preventDefault(),v={startY:j.clientY,startTop:parseFloat(E.style.top||"0")||0},E.classList.add("is-dragging");var p=c.container.ownerDocument;p.addEventListener("mousemove",M,!0),p.addEventListener("mouseup",X,!0)}function M(j){if(v){j.preventDefault();var p=j.clientY-v.startY;Y(v.startTop+p)}}function X(){if(v){v=null,E.classList.remove("is-dragging");var j=c.container.ownerDocument;j.removeEventListener("mousemove",M,!0),j.removeEventListener("mouseup",X,!0)}}function G(j){var p=A.parentNode.getBoundingClientRect(),k=j-p.top-(parseFloat(E.style.height||"0")||0)/2;Y(k)}function Y(j){var p=u(),k=y();if(!(!p||!k||!A)){var h=O(),x=Math.max(p.scrollHeight||k.scrollHeight||p.clientHeight||1,1),z=Math.max(120,Math.round(x*h)),J=Math.max(18,parseFloat(E.style.height||"0")||18),ee=Math.max(0,z-J),ue=Math.max(0,Math.min(ee,j)),ve=Math.max(0,(k.scrollHeight||x)-(k.clientHeight||p.clientHeight||1));k.scrollTop=ee?Math.round(ue/ee*ve):0,T()}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_dialoga11y=RTE_Plugin_DialogA11y,typeof RTE_DefaultConfig.dialogA11y>"u"&&(RTE_DefaultConfig.dialogA11y=!0);function RTE_Plugin_DialogA11y(){var S=this,c,i,f=null,N=null,A=null,E=[];S.PluginName="DialogA11y";var C={URL:"URL",SRC:"Source URL",HREF:"URL",LINK:"URL",TEXT:"Text",TITLE:"Title",NAME:"Name",CAPTION:"Caption",TARGET:"Open in a new window",ALT:"Alternative text",WIDTH:"Width",HEIGHT:"Height",SIZE:"Size",CLASS:"CSS class",STYLE:"Style",LANG:"Language",ROWS:"Rows",COLS:"Columns",COLUMNS:"Columns",BORDER:"Border"};S.InitConfig=function(L){c=L},S.InitEditor=function(L){if(i=L,c.dialogA11y!==!1){v();try{i.attachEvent("ready",v)}catch{}setTimeout(v,0),setTimeout(v,300),i.applyDialogAccessibility=function(){H(o())}}};function o(){try{if(c.container&&c.container.ownerDocument)return c.container.ownerDocument}catch{}return typeof document<"u"?document:null}function v(){var L=o();if(L&&(H(L),!(L===f||N))){f=L;try{var I=L.defaultView&&L.defaultView.MutationObserver||window.MutationObserver;N=new I(w),N.observe(L.body||L.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","hidden"]})}catch{}}}function w(L){for(var I=0;I<L.length;I++){var u=L[I];if(u.type==="attributes"&&q(u.target)&&B(u.target),u.addedNodes)for(var y=0;y<u.addedNodes.length;y++){var O=u.addedNodes[y];if(O.nodeType===1&&(q(O)&&B(O),O.querySelectorAll))for(var K=O.querySelectorAll("rte-dropdown-panel,[class*='rte-panel-general']"),T=0;T<K.length;T++)B(K[T])}}}function q(L){return L&&L.nodeType===1&&(L.tagName==="RTE-DROPDOWN-PANEL"||/rte-panel-general/.test(L.className||""))}function B(L){E.indexOf(L)<0&&E.push(L),!A&&(A=setTimeout(function(){A=null;var I=E.slice();E.length=0;for(var u=0;u<I.length;u++)g(I[u]),(function(y){setTimeout(function(){g(y)},60)})(I[u])},0))}function H(L){if(!(!L||!L.querySelectorAll))for(var I=L.querySelectorAll("rte-dropdown-panel,[class*='rte-panel-general']"),u=0;u<I.length;u++)g(I[u])}function g(L){if(!(!L||L.nodeType!==1||!L.querySelector)){var I=L.querySelector("rte-dialog-header");if(I){var u=(I.textContent||"").trim().replace(/\s*\((?:Ctrl|Cmd|Alt|Shift|⌘|⇧|⌥)[^)]*\)\s*$/i,"").trim(),y=L.getAttribute("role");(!y||y==="menu")&&L.setAttribute("role","dialog"),u&&!L.getAttribute("aria-label")&&!L.getAttribute("aria-labelledby")&&L.setAttribute("aria-label",u);for(var O=L.querySelectorAll("input,select,textarea"),K=0;K<O.length;K++){var T=O[K];if(T.type!=="hidden"&&!(T.getAttribute("aria-label")||T.getAttribute("aria-labelledby"))&&!(T.labels&&T.labels.length)){var V=b(T,u);V&&T.setAttribute("aria-label",V)}}}}}function b(L,I){for(var u=L.parentElement,y=0;y<8&&u;y++){var O=/^RTE-DIALOG-LINE-(.+)$/.exec(u.tagName||"");if(O){var K=O[1].toUpperCase().replace(/-/g," ").trim(),T=K.split(" ")[0];return C[K]?C[K]:C[T]?C[T]:P(K)}u=u.parentElement}var V=L.getAttribute("placeholder");if(V)return V;var Z=D(L);return Z||I||null}function D(L){var I=L.previousElementSibling;if(I&&I.textContent&&I.textContent.trim()&&I.textContent.trim().length<30)return I.textContent.trim();var u=L.parentElement;if(u)for(var y=0;y<u.childNodes.length;y++){var O=u.childNodes[y];if(O.nodeType===3&&O.textContent.trim())return O.textContent.trim().slice(0,40)}return""}function P(L){return L.toLowerCase().replace(/\b\w/g,function(I){return I.toUpperCase()})}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_dictation=RTE_Plugin_Dictation,RTE_DefaultConfig.svgCode_dictation||(RTE_DefaultConfig.svgCode_dictation='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/><path d="M8 21h8"/></svg>');function RTE_Plugin_Dictation(){var S=this,c,i,f=null,N=!1,A=null,E=null;S.PluginName="Dictation",S.InitConfig=function(K){c=K,c.dictationEnabled===!0&&C()&&(typeof c.dictationContinuous!="boolean"&&(c.dictationContinuous=!0),typeof c.dictationInterimResults!="boolean"&&(c.dictationInterimResults=!0),typeof c.dictationAutoPunctuation!="boolean"&&(c.dictationAutoPunctuation=!0),c.dictationLang=c.dictationLang||(typeof navigator<"u"?navigator.language:"en-US"),o("toolbar_default","#{dictation}"),o("toolbar_full","#{dictation}"))},S.InitEditor=function(K){i=K,c.dictationEnabled===!0&&C()&&(i.dictation={start:q,stop:B,toggle:H,isListening:function(){return N},isSupported:function(){return!0}},i.toolbarFactoryMap.dictation=v,i.attachEvent("exec_command_dictation",function(){H()}),i.attachEvent("destroy",function(){if(f)try{f.abort()}catch{}}))};function C(){return typeof window<"u"&&(typeof window.SpeechRecognition=="function"||typeof window.webkitSpeechRecognition=="function")}function o(K,T){var V=c[K]||"";V.indexOf(T)===-1&&(c[K]=V?V+" "+T:T)}function v(K){return A=i.createToolbarButton(K,{tooltip:"Dictate (click to start/stop)",svgcode:c.svgCode_dictation}),A}function w(){var K=window.SpeechRecognition||window.webkitSpeechRecognition,T=new K;return T.continuous=!!c.dictationContinuous,T.interimResults=!!c.dictationInterimResults,T.lang=c.dictationLang,T.onresult=function(V){for(var Z="",M="",X=V.resultIndex;X<V.results.length;X++){var G=V.results[X];G.isFinal?Z+=G[0].transcript:M+=G[0].transcript}Z&&g(Z),M?b(M):Z&&D()},T.onend=function(){if(N)try{T.start();return}catch{}N=!1,P(),D()},T.onerror=function(V){N=!1,P(),D(),V&&V.error==="not-allowed"?O("Microphone permission denied. Enable it in your browser site settings to dictate."):V&&V.error==="no-speech"||V&&V.error&&O("Dictation error: "+V.error)},T}function q(){if(!(!C()||N)){f||(f=w());try{f.start()}catch{try{f.abort()}catch{}f=w();try{f.start()}catch{return}}N=!0,P()}}function B(){if(!(!f||!N)){N=!1;try{f.stop()}catch{}P(),D()}}function H(){N?B():q()}function g(K){if(K){var T=u(K,!0);if(T)try{i.insertText?i.insertText(T):i.insertHTML&&i.insertHTML(y(T))}catch{}}}function b(K){if(!(!K||!c.dictationInterimResults)){var T=u(K,!1);if(!E){var V=i.getDocument?i.getDocument():document;E=V.createElement("span"),E.setAttribute("data-rte-dictation-interim","true"),E.style.cssText="opacity:.55;color:#0f8b8d;font-style:italic;pointer-events:none;user-select:none;";try{var Z=i.getSelection();if(Z&&Z.rangeCount>0){var M=Z.getRangeAt(0);M.collapse(!0),M.insertNode(E)}}catch{}}E&&(E.textContent=" "+T)}}function D(){E&&E.parentNode&&E.parentNode.removeChild(E),E=null}function P(){A&&(A.classList.toggle("rte-dictation-on",N),A.setAttribute("aria-pressed",N?"true":"false"),A.setAttribute("title",N?"Dictating\u2026 (click to stop)":"Dictate (click to start/stop)"),I())}var L=!1;function I(){if(!L){L=!0;var K=".rte-dictation-on { position: relative; background: linear-gradient(180deg,#fee2e2,#fecaca); box-shadow: inset 0 0 0 1px #f87171; }.rte-dictation-on::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 0 rgba(220,38,38,.6); animation: rte-dictation-pulse 1.4s infinite; }@@keyframes rte-dictation-pulse { 0%{box-shadow:0 0 0 0 rgba(220,38,38,.6);} 70%{box-shadow:0 0 0 6px rgba(220,38,38,0);} 100%{box-shadow:0 0 0 0 rgba(220,38,38,0);} }";K=K.replace(/@@keyframes/g,"@keyframes");var T=document.createElement("style");T.setAttribute("data-rte-dictation","1"),T.appendChild(document.createTextNode(K)),document.head.appendChild(T)}}function u(K,T){if(!K)return"";var V=K.replace(/\s+/g," ");return T?(V=V.replace(/^\s+/,""),c.dictationAutoPunctuation?(V.length>0&&/[a-z]/.test(V[0])&&(V=V[0].toUpperCase()+V.substring(1)),/[.!?,;:]$/.test(V)||(V+="."),V+=" "):/\s$/.test(V)||(V+=" "),V):V.trim()}function y(K){return String(K).replace(/[&<>"']/g,function(T){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[T]})}function O(K){try{if(i&&i.showAlert){i.showAlert(K);return}}catch{}typeof window<"u"&&window.console&&window.console.warn("[dictation]",K)}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_documentimport=RTE_Plugin_DocumentImport,typeof RTE_DefaultConfig.documentImport>"u"&&(RTE_DefaultConfig.documentImport=!0);function RTE_Plugin_DocumentImport(){var S=this,c,i;S.PluginName="DocumentImport",S.InitConfig=function(P){c=P},S.InitEditor=function(P){if(i=P,c.documentImport!==!1&&(i.htmlFromImportText=function(L,I){return E(String(L??""),I)},i.importFile=function(L,I){return o(L,I||{})},i.openImportDialog=function(L){return v(L||{})},i.attachEvent("exec_command_importdocument",function(L){L.returnValue=!0,L.stopBubble=!0,v({})}),i.slashCommands&&typeof i.slashCommands.register=="function"))try{i.slashCommands.register({id:"import-document",title:"Import document",description:"Open a Markdown, HTML, text, or Word (.doc) file into the editor",keywords:["import","open","file","word","markdown","upload"],action:function(){v({})}})}catch{}};function f(P){var L=String(P||"").toLowerCase();return/\.(md|markdown|mdown|mkd)$/.test(L)?"md":/\.html?$/.test(L)?"html":/\.doc$/.test(L)?"doc":/\.docx$/.test(L)?"docx":(/\.txt$/.test(L),"txt")}function N(P){return String(P??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function A(P){var L=String(P||""),I=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(L);return I&&(L=I[1]),L=L.replace(/<!--\[if[\s\S]*?\[endif\]-->/gi,""),L=L.replace(/<!--[\s\S]*?-->/g,""),L=L.replace(/<\/?(o:p|o:|w:|xml|style|meta|link|title|head)[^>]*>/gi,""),L=L.replace(/<\\?\?xml[^>]*>/gi,""),L=L.replace(/\sstyle="[^"]*"/gi,function(u){var y=u.replace(/mso-[^;"]*;?/gi,"").replace(/style="\s*;*\s*"/i,"");return/style="\s*"/.test(y)||y===' style=""'?"":y}),L=L.replace(/\sclass="Mso[^"]*"/gi,""),L=L.replace(/\s(lang|xmlns(:\w+)?)="[^"]*"/gi,""),L}function E(P,L){switch(L){case"md":return i&&typeof i.fromMarkdown=="function"?i.fromMarkdown(P,{apply:!1}):"<p>"+N(P).replace(/\n{2,}/g,"</p><p>").replace(/\n/g,"<br>")+"</p>";case"html":return P;case"doc":return A(P);default:var I=String(P).replace(/\r\n?/g,`
|
|
20
|
+
`).split(/\n{2,}/);return I.map(function(u){return"<p>"+N(u).replace(/\n/g,"<br>")+"</p>"}).join("")}}function C(P,L){return P==null?!1:L==="insert"&&typeof i.insertHTML=="function"?(i.insertHTML(P),!0):typeof i.setHTMLCode=="function"?(i.setHTMLCode(P),!0):!1}function o(P,L){var I=L.mode||c.documentImportMode||"replace";return new Promise(function(u){if(!P){u(!1);return}var y=f(P.name);if(typeof c.documentImportResolver=="function")try{var O=c.documentImportResolver(P);Promise.resolve(O).then(function(T){typeof T=="string"?u(C(T,I)):K()},function(){K()});return}catch{K();return}K();function K(){if(y==="docx"){if(!w()){D("This browser can't unpack .docx (no DecompressionStream). Save as .doc/.html/.md, or wire config.documentImportResolver."),u(!1);return}g(P).then(function(V){V!=null?u(C(V,I)):(D("Could not read this .docx file."),u(!1))},function(){D("Could not read this .docx file."),u(!1)});return}if(typeof FileReader>"u"){u(!1);return}var T=new FileReader;T.onload=function(){var V=E(T.result,y);u(C(V,I))},T.onerror=function(){u(!1)},T.readAsText(P)}})}function v(P){try{var L=document.createElement("input");return L.type="file",L.accept=P.accept||c.documentImportAccept||".md,.markdown,.html,.htm,.txt,.doc,.docx",L.style.position="fixed",L.style.left="-9999px",L.addEventListener("change",function(){var I=L.files&&L.files[0];I&&o(I,P),setTimeout(function(){try{document.body.removeChild(L)}catch{}},0)}),document.body.appendChild(L),L.click(),!0}catch(I){return window.console&&console.error("documentimport: openPicker failed",I),!1}}function w(){return typeof DecompressionStream=="function"&&typeof DOMParser=="function"&&(typeof Response=="function"||typeof Blob=="function")}function q(P,L){for(var I=new DataView(P.buffer,P.byteOffset,P.byteLength),u=-1,y=P.length-22;y>=0&&y>=P.length-22-65536;y--)if(I.getUint32(y,!0)===101010256){u=y;break}if(u<0)return null;for(var O=I.getUint32(u+16,!0),K=I.getUint16(u+10,!0),T=O,V=0;V<K&&I.getUint32(T,!0)===33639248;V++){var Z=I.getUint16(T+10,!0),M=I.getUint32(T+20,!0),X=I.getUint16(T+28,!0),G=I.getUint16(T+30,!0),Y=I.getUint16(T+32,!0),j=I.getUint32(T+42,!0),p=B(P.subarray(T+46,T+46+X)).replace(/\\/g,"/");if(p===L){var k=new DataView(P.buffer,P.byteOffset+j,30),h=k.getUint16(26,!0),x=k.getUint16(28,!0),z=j+30+h+x;return{method:Z,data:P.subarray(z,z+M)}}T+=46+X+G+Y}return null}function B(P){try{return new TextDecoder("utf-8").decode(P)}catch{for(var L="",I=0;I<P.length;I++)L+=String.fromCharCode(P[I]);return L}}function H(P){var L=new DecompressionStream("deflate-raw"),I=new Blob([P]);return new Response(I.stream().pipeThrough(L)).arrayBuffer().then(function(u){return new Uint8Array(u)})}function g(P){var L=P.arrayBuffer?P.arrayBuffer():new Promise(function(I,u){var y=new FileReader;y.onload=function(){I(y.result)},y.onerror=u,y.readAsArrayBuffer(P)});return L.then(function(I){var u=new Uint8Array(I),y=q(u,"word/document.xml");if(!y)return null;var O=y.method===0?Promise.resolve(y.data):H(y.data);return O.then(function(K){return b(B(K))})})}function b(P){var L=new DOMParser().parseFromString(P,"application/xml"),I="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function u(x,z){return x.getElementsByTagNameNS(I,z)}function y(x,z){for(var J=0;J<x.childNodes.length;J++){var ee=x.childNodes[J];if(ee.nodeType===1&&ee.localName===z&&ee.namespaceURI===I)return ee}return null}function O(x){for(var z="",J=x.childNodes,ee=0;ee<J.length;ee++){var ue=J[ee];ue.nodeType===1&&(ue.localName==="t"?z+=ue.textContent||"":ue.localName==="tab"?z+=" ":(ue.localName==="br"||ue.localName==="cr")&&(z+=`
|
|
21
|
+
`))}return z}function K(x){var z=N(O(x));if(!z)return"";z=z.replace(/\n/g,"<br>");var J=y(x,"rPr");return J&&(y(J,"b")&&(z="<strong>"+z+"</strong>"),y(J,"i")&&(z="<em>"+z+"</em>"),y(J,"u")&&(z="<u>"+z+"</u>"),y(J,"strike")&&(z="<s>"+z+"</s>")),z}function T(x){for(var z="",J=x.childNodes,ee=0;ee<J.length;ee++){var ue=J[ee];if(ue.nodeType===1&&ue.localName==="r"&&ue.namespaceURI===I)z+=K(ue);else if(ue.nodeType===1&&ue.localName==="hyperlink")for(var ve=0;ve<ue.childNodes.length;ve++)ue.childNodes[ve].localName==="r"&&(z+=K(ue.childNodes[ve]))}return z}function V(x){var z=y(x,"pPr");if(!z)return{};var J={},ee=y(z,"pStyle");if(ee){var ue=ee.getAttributeNS(I,"val")||ee.getAttribute("w:val")||"",ve=/heading(\d)/i.exec(ue);ve&&(J.heading=Math.min(6,parseInt(ve[1],10)))}return y(z,"numPr")&&(J.list=!0),J}var Z=u(L,"body")[0];if(!Z)return"";var M=[],X=!1;function G(){X&&(M.push("</ul>"),X=!1)}for(var Y=0;Y<Z.childNodes.length;Y++){var j=Z.childNodes[Y];if(!(j.nodeType!==1||j.namespaceURI!==I))if(j.localName==="p"){var p=V(j),k=T(j);if(p.list){X||(M.push("<ul>"),X=!0),M.push("<li>"+(k||"")+"</li>");continue}G(),p.heading?M.push("<h"+p.heading+">"+(k||"")+"</h"+p.heading+">"):M.push("<p>"+(k||"<br>")+"</p>")}else j.localName==="tbl"&&(G(),M.push(h(j)))}return G(),M.join(`
|
|
22
|
+
`);function h(x){for(var z=[],J=x.childNodes,ee=0;ee<J.length;ee++){var ue=J[ee];if(!(ue.nodeType!==1||ue.localName!=="tr")){for(var ve=[],re=0;re<ue.childNodes.length;re++){var U=ue.childNodes[re];if(!(U.nodeType!==1||U.localName!=="tc")){for(var F="",$=0;$<U.childNodes.length;$++)U.childNodes[$].localName==="p"&&(F+="<p>"+(T(U.childNodes[$])||"<br>")+"</p>");ve.push("<td>"+F+"</td>")}}z.push("<tr>"+ve.join("")+"</tr>")}}return"<table>"+z.join("")+"</table>"}}function D(P){try{if(i&&typeof i.createDialog=="function"){var L=i.createDialog(i.getLangText&&i.getLangText("importtitle")||"Import document","rte-dialog-import"),I=L.ownerDocument.createElement("div");I.style.cssText="padding:16px;max-width:420px;font:13px -apple-system,Segoe UI,sans-serif;line-height:1.5",I.textContent=P,L.appendChild(I);return}}catch{}window.console&&console.warn("documentimport:",P)}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_documentoutline=RTE_Plugin_DocumentOutline;function RTE_Plugin_DocumentOutline(){var S=this,c,i,f=null,N=null,A=null,E=null,C=0,o="";S.PluginName="DocumentOutline",S.InitConfig=function(T){c=T,c.documentOutlineEnabled!==!1&&(c.documentOutlineTitle=c.documentOutlineTitle||"Outline",c.documentOutlineHint=c.documentOutlineHint||"Browse headings and jump through long documents without leaving the editor.",c.documentOutlineEmptyText=c.documentOutlineEmptyText||"Add headings to build the document outline.",typeof c.documentOutlineAutoOpen!="boolean"&&(c.documentOutlineAutoOpen=!1),typeof c.documentOutlineMinLevel!="number"&&(c.documentOutlineMinLevel=1),typeof c.documentOutlineMaxLevel!="number"&&(c.documentOutlineMaxLevel=6),v("toolbar_default","#{documentoutline}"),v("toolbar_full","#{documentoutline}"))},S.InitEditor=function(T){i=T,c.documentOutlineEnabled!==!1&&(i.documentOutline={close:function(){g()},list:function(){return P()},open:function(){H()},refresh:function(){K()},toggle:function(){B()}},w(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.documentoutline=function(V){return i.createToolbarButton(V)},i.attachEvent("exec_command_documentoutline",function(V){V.returnValue=!0,V.stopBubble=!0,B()}),i.attachEvent("change",function(){b()}),i.attachEvent("selectionchange",function(){O()}),q(),K(),c.documentOutlineAutoOpen&&H())};function v(T,V){c[T]&&c[T].indexOf(V)===-1&&(c[T]=c[T]+V)}function w(){var T=c.container.ownerDocument;if(!T.getElementById("rte-document-outline-style")){var V=T.createElement("style");V.id="rte-document-outline-style",V.innerHTML=[".rte-document-outline-shell{display:flex;align-items:stretch;gap:10px;}",".rte-document-outline-shell>.rte-document-outline-host{flex:1 1 auto;min-width:0;}",".rte-document-outline-panel{display:none;flex:0 0 286px;min-width:248px;max-width:min(330px,30vw);border:1px solid rgba(148,163,184,.22);border-radius:16px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));box-shadow:0 18px 42px rgba(29,78,216,.12),0 2px 8px rgba(15,23,42,.06);overflow:hidden;color:#172033;font-family:Aptos,'Segoe UI',sans-serif;}",".rte-document-outline-shell.is-open>.rte-document-outline-panel{display:flex;flex-direction:column;}",".rte-document-outline-header{padding:12px 12px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.72);}",".rte-document-outline-kicker{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-document-outline-title{margin-top:3px;font-size:15px;line-height:1.2;font-weight:850;color:#172033;}",".rte-document-outline-copy{margin-top:5px;font-size:12px;line-height:1.42;color:#52657e;}",".rte-document-outline-toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 8px 14px;border-bottom:1px solid rgba(148,163,184,.16);gap:10px;background:rgba(255,255,255,.52);}",".rte-document-outline-count{min-width:0;font-size:12px;font-weight:750;color:#52657e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}",".rte-document-outline-close{appearance:none;border:1px solid rgba(100,116,139,.18);background:#fff;color:#315277;cursor:pointer;font-size:12px;font-weight:750;padding:6px 9px;border-radius:999px;line-height:1;}",".rte-document-outline-close:hover,.rte-document-outline-close:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28);}",".rte-document-outline-body{padding:6px;overflow:auto;min-height:140px;max-height:520px;scrollbar-width:thin;}",".rte-document-outline-list{display:flex;flex-direction:column;gap:5px;}",".rte-document-outline-item{appearance:none;width:100%;text-align:left;border:1px solid transparent;background:transparent;color:#172033;cursor:pointer;border-radius:12px;padding:8px 10px 8px calc(10px + (var(--rte-outline-level,1) - 1) * 12px);font-size:13px;line-height:1.35;font-weight:650;}",".rte-document-outline-item:hover,.rte-document-outline-item:focus-visible{background:#f8fbff;border-color:rgba(37,99,235,.18);}",".rte-document-outline-item.is-active{background:#eef4ff;border-color:rgba(37,99,235,.26);color:#0f3f9f;box-shadow:0 8px 18px rgba(37,99,235,.1);}",".rte-document-outline-item-level{display:inline-flex;margin:0 0 3px;padding:2px 6px;border-radius:999px;background:#fff;color:#64748b;font-size:10px;line-height:1.1;letter-spacing:.08em;text-transform:uppercase;font-weight:850;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18);}",".rte-document-outline-empty{margin:6px;padding:14px;color:#52657e;font-size:13px;font-weight:700;line-height:1.55;background:#fff;border:1px dashed rgba(148,163,184,.34);border-radius:14px;}","@media (max-width: 1100px){.rte-document-outline-shell{display:block;}.rte-document-outline-panel{margin-top:12px;max-width:none;width:100%;}.rte-document-outline-body{max-height:320px;}}"].join(""),T.head.appendChild(V)}}function q(){if(f)return f;var T=c.container,V=T.ownerDocument;f=V.createElement("div"),f.className="rte-document-outline-shell";var Z=V.createElement("div");Z.className="rte-document-outline-host";var M=T.parentNode;M.insertBefore(f,T),f.appendChild(Z),Z.appendChild(T),N=V.createElement("aside"),N.className="rte-document-outline-panel",N.setAttribute("aria-label",c.documentOutlineTitle),N.setAttribute("role","complementary");var X=V.createElement("div");X.className="rte-document-outline-header";var G=V.createElement("div");G.className="rte-document-outline-kicker",G.innerText="Document";var Y=V.createElement("div");Y.className="rte-document-outline-title",Y.innerText=c.documentOutlineTitle;var j=V.createElement("div");j.className="rte-document-outline-copy",j.innerText=c.documentOutlineHint,X.appendChild(G),X.appendChild(Y),X.appendChild(j);var p=V.createElement("div");p.className="rte-document-outline-toolbar";var k=V.createElement("div");k.className="rte-document-outline-count",k.setAttribute("data-rte-outline-count","1");var h=V.createElement("button");h.type="button",h.className="rte-document-outline-close",h.innerText="Hide",h.setAttribute("aria-label","Hide document outline"),h.onclick=function(){g()},p.appendChild(k),p.appendChild(h);var x=V.createElement("div");return x.className="rte-document-outline-body",A=V.createElement("div"),A.className="rte-document-outline-list",E=V.createElement("div"),E.className="rte-document-outline-empty",E.innerText=c.documentOutlineEmptyText,x.appendChild(A),x.appendChild(E),N.appendChild(X),N.appendChild(p),N.appendChild(x),f.appendChild(N),f}function B(){f&&f.classList.contains("is-open")?g():H()}function H(){q(),f.classList.add("is-open"),K()}function g(){f&&f.classList.remove("is-open")}function b(){clearTimeout(C),C=setTimeout(function(){K()},80)}function D(T){var V=String(T||"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");return V||"section"}function P(){var T=i.getEditable();if(!T)return[];var V=Math.max(1,Math.min(6,c.documentOutlineMinLevel||1)),Z=Math.max(V,Math.min(6,c.documentOutlineMaxLevel||6)),M=T.querySelectorAll("h1,h2,h3,h4,h5,h6"),X={},G=[],Y;for(Y=0;Y<M.length;Y++){var j=M[Y],p=parseInt(j.nodeName.substring(1),10);if(!(p<V||p>Z)){var k=(j.innerText||j.textContent||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,""),h=j.id||D(k);X[h]=(X[h]||0)+1;var x=j.id||(X[h]===1?h:h+"-"+X[h]);j.id||(j.id=x),G.push({id:j.id,level:p,text:k||"Heading "+(G.length+1),element:j})}}return G}function L(){var T=i.getSelection?i.getSelection():null;if(!T||T.rangeCount===0)return null;try{var V=T.getRangeAt(0).cloneRange();return V.collapse(!0),V}catch{return null}}function I(T){var V=L();if(!V||!T.length)return"";var Z=V.startContainer.ownerDocument||i.getEditable().ownerDocument,M=Z.createRange(),X="";try{M.setStart(V.startContainer,V.startOffset),M.collapse(!0);for(var G=0;G<T.length;G++){var Y=Z.createRange();Y.selectNodeContents(T[G].element),Y.collapse(!0),Y.compareBoundaryPoints(Range.START_TO_START,M)<=0&&(X=T[G].id)}}catch{return o}return X}function u(T){if(!(!T||!T.element)){T.element.scrollIntoView({behavior:"smooth",block:"center"});try{var V=i.getSelection?i.getSelection():null,Z=T.element.ownerDocument.createRange();Z.selectNodeContents(T.element),Z.collapse(!0),V&&(V.removeAllRanges(),V.addRange(Z))}catch{}i.focus(),o=T.id,y()}}function y(){if(A)for(var T=A.querySelectorAll(".rte-document-outline-item"),V=0;V<T.length;V++){var Z=T[V],M=Z.getAttribute("data-rte-outline-id")===o;Z.classList.toggle("is-active",M),Z.setAttribute("aria-current",M?"true":"false")}}function O(){var T=P(),V=I(T);if(V===o&&A&&A.childNodes.length){y();return}o=V,K(T)}function K(T){q();var V=T||P();for(o=I(V)||o;A.firstChild;)A.removeChild(A.firstChild);var Z=N.querySelector("[data-rte-outline-count]");Z&&(Z.innerText=V.length+" heading"+(V.length===1?"":"s")),E.style.display=V.length?"none":"block";for(var M=0;M<V.length;M++)(function(X){var G=N.ownerDocument.createElement("button");G.type="button",G.className="rte-document-outline-item",G.style.setProperty("--rte-outline-level",String(X.level)),G.setAttribute("data-rte-outline-id",X.id),G.setAttribute("aria-current","false");var Y=N.ownerDocument.createElement("span");Y.className="rte-document-outline-item-level",Y.innerText="H"+X.level;var j=N.ownerDocument.createElement("span");j.innerText=X.text,G.appendChild(Y),G.appendChild(j),G.onclick=function(){u(X)},A.appendChild(G)})(V[M]);y()}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_emailtoolkit=RTE_Plugin_EmailToolkit,RTE_DefaultConfig.emailInlineProperties=RTE_DefaultConfig.emailInlineProperties||["color","background-color","font-family","font-size","font-weight","font-style","text-decoration","text-align","line-height","margin-top","margin-bottom","margin-left","margin-right","padding-top","padding-bottom","padding-left","padding-right","border","border-radius","vertical-align","list-style-type","width"],RTE_DefaultConfig.emailWrapWidth=RTE_DefaultConfig.emailWrapWidth||640;function RTE_Plugin_EmailToolkit(){var S=this,c,i;S.PluginName="EmailToolkit",S.InitConfig=function(v){c=v},S.InitEditor=function(v){i=v,i.getEmailHTML=function(w){return S.BuildEmailHTML(w||{})},i.attachEvent("exec_command_emailexport",function(w){w.returnValue=!0,S.OpenEmailExport()})};function f(v,w,q,B){var H=v.ownerDocument.createElement(w);return q&&(H.style.cssText=q),B&&(H.className=B),v.appendChild(H),H}function N(v,w){if(!w)return!0;var q=w.trim().toLowerCase();return q==="normal"||q==="auto"||q==="none"||q==="0px"||q==="0"?!(v==="list-style-type"&&q==="none"):v==="background-color"&&(q==="rgba(0, 0, 0, 0)"||q==="transparent")?!0:v==="color"&&q==="rgb(0, 0, 0)"?!1:v==="text-decoration"&&q.indexOf("none")===0||v==="border"&&(q.indexOf("0px")===0||q.indexOf("none")!==-1&&q.indexOf("0px")!==-1)||v==="vertical-align"&&q==="baseline"||v==="font-weight"&&q==="400"||v==="font-style"&&q==="normal"||v==="text-align"&&(q==="start"||q==="left")}var A={UL:1,OL:1,LI:1};function E(v,w){for(var q=w.getComputedStyle(v),B=c.emailInlineProperties||[],H=[],g=0;g<B.length;g++){var b=B[g],D;try{D=q.getPropertyValue(b)}catch{D=""}D==null||D===""||N(b,D)||b==="width"&&v.nodeName!=="TABLE"&&v.nodeName!=="IMG"&&v.nodeName!=="TD"&&v.nodeName!=="TH"||b==="list-style-type"&&!A[v.nodeName]||H.push(b+":"+D)}return H.join(";")}var C={SCRIPT:1,STYLE:1,LINK:1,META:1};function o(v,w){if(v.nodeType===3)return v.ownerDocument.createTextNode(v.data);if(v.nodeType!==1||C[v.nodeName])return null;for(var q=v.ownerDocument,B=q.createElement(v.nodeName),H=0;H<v.attributes.length;H++){var g=v.attributes[H],b=g.name.toLowerCase();b==="class"||b==="id"||b==="contenteditable"||b==="style"||b.indexOf("data-rte-")===0||B.setAttribute(g.name,g.value)}var D=E(v,w);D&&B.setAttribute("style",D);for(var P=0;P<v.childNodes.length;P++){var L=o(v.childNodes[P],w);L&&B.appendChild(L)}return B}S.BuildEmailHTML=function(v){for(var w=i.getEditable(),q=i.getDocument(),B=q&&q.defaultView||window,H=q.createElement("div"),g=0;g<w.childNodes.length;g++){var b=o(w.childNodes[g],B);b&&H.appendChild(b)}var D=H.innerHTML,P=v.wrap!==!1;if(!P)return D;var L=v.width||c.emailWrapWidth||640;return'<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse"><tr><td align="center" style="padding:0"><table role="presentation" width="'+L+'" cellpadding="0" cellspacing="0" style="border-collapse:collapse;max-width:'+L+'px;width:100%"><tr><td style="padding:16px;font-family:Arial,Helvetica,sans-serif">'+D+"</td></tr></table></td></tr></table>"},S.OpenEmailExport=function(){var v=S.BuildEmailHTML({}),w=i.createDialog(i.getLangText&&i.getLangText("emailexporttitle")||"Export email HTML","rte-dialog-email"),q=typeof w.close=="function"?function(){w.close()}:function(){i.closeCurrentPopup()},B=f(w,"div","","rte-email-export");f(B,"div","","rte-email-export-copy").innerText="Inline-styled HTML for email clients (class/style blocks resolved to inline styles). Copy and paste into your email tool.";var H=f(B,"textarea","","rte-email-export-code");H.value=v,H.readOnly=!0,H.setAttribute("aria-label","Inline-styled email HTML");var g=f(B,"div","","rte-email-export-status");g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.textContent="Ready to copy "+v.length+" characters.";var b=f(B,"div","","rte-email-export-footer"),D=f(b,"button","","rte-email-export-button rte-email-export-button-primary");D.type="button",D.textContent="Copy",D.onclick=function(){H.select();try{navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(H.value):w.ownerDocument.execCommand("copy"),D.textContent="Copied",g.textContent="Copied email HTML to the clipboard.",setTimeout(function(){D.textContent="Copy",g.textContent="Ready to copy "+v.length+" characters."},1400)}catch{}};var P=f(b,"button","","rte-email-export-button");P.type="button",P.textContent="Close",P.onclick=q,setTimeout(function(){H.focus()},0)}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_emojiautocomplete=RTE_Plugin_EmojiAutocomplete,RTE_DefaultConfig.emojiAutocompleteEnabled=typeof RTE_DefaultConfig.emojiAutocompleteEnabled>"u"?!0:RTE_DefaultConfig.emojiAutocompleteEnabled,RTE_DefaultConfig.emojiShortcodes=RTE_DefaultConfig.emojiShortcodes||{smile:"\u{1F604}",smiley:"\u{1F603}",grin:"\u{1F601}",laughing:"\u{1F606}",satisfied:"\u{1F606}",joy:"\u{1F602}",rofl:"\u{1F923}",sweat_smile:"\u{1F605}",wink:"\u{1F609}",blush:"\u{1F60A}",innocent:"\u{1F607}",heart_eyes:"\u{1F60D}",star_struck:"\u{1F929}",kissing_heart:"\u{1F618}",yum:"\u{1F60B}",stuck_out_tongue:"\u{1F61B}",zany:"\u{1F92A}",thinking:"\u{1F914}",shush:"\u{1F92B}",neutral_face:"\u{1F610}",expressionless:"\u{1F611}",no_mouth:"\u{1F636}",smirk:"\u{1F60F}",unamused:"\u{1F612}",roll_eyes:"\u{1F644}",grimacing:"\u{1F62C}",relieved:"\u{1F60C}",pensive:"\u{1F614}",sleepy:"\u{1F62A}",sleeping:"\u{1F634}",mask:"\u{1F637}",face_with_thermometer:"\u{1F912}",nauseated_face:"\u{1F922}",sneezing_face:"\u{1F927}",dizzy_face:"\u{1F635}",exploding_head:"\u{1F92F}",cowboy:"\u{1F920}",sunglasses:"\u{1F60E}",nerd:"\u{1F913}",monocle:"\u{1F9D0}",confused:"\u{1F615}",worried:"\u{1F61F}",slightly_frowning_face:"\u{1F641}",open_mouth:"\u{1F62E}",astonished:"\u{1F632}",flushed:"\u{1F633}",fearful:"\u{1F628}",cold_sweat:"\u{1F630}",cry:"\u{1F622}",sob:"\u{1F62D}",scream:"\u{1F631}",confounded:"\u{1F616}",persevere:"\u{1F623}",disappointed:"\u{1F61E}",sweat:"\u{1F613}",weary:"\u{1F629}",tired_face:"\u{1F62B}",triumph:"\u{1F624}",rage:"\u{1F621}",angry:"\u{1F620}",cursing_face:"\u{1F92C}",smiling_imp:"\u{1F608}",imp:"\u{1F47F}",skull:"\u{1F480}",poop:"\u{1F4A9}",hankey:"\u{1F4A9}",clown:"\u{1F921}",ghost:"\u{1F47B}",alien:"\u{1F47D}",robot:"\u{1F916}",heart_eyes_cat:"\u{1F63B}",see_no_evil:"\u{1F648}",hear_no_evil:"\u{1F649}",speak_no_evil:"\u{1F64A}",heart:"\u2764\uFE0F",orange_heart:"\u{1F9E1}",yellow_heart:"\u{1F49B}",green_heart:"\u{1F49A}",blue_heart:"\u{1F499}",purple_heart:"\u{1F49C}",black_heart:"\u{1F5A4}",broken_heart:"\u{1F494}",two_hearts:"\u{1F495}",sparkling_heart:"\u{1F496}",heartpulse:"\u{1F497}",cupid:"\u{1F498}",gift_heart:"\u{1F49D}",revolving_hearts:"\u{1F49E}",kiss:"\u{1F48B}","+1":"\u{1F44D}",thumbsup:"\u{1F44D}","-1":"\u{1F44E}",thumbsdown:"\u{1F44E}",ok_hand:"\u{1F44C}",punch:"\u{1F44A}",fist:"\u270A",facepunch:"\u{1F44A}",wave:"\u{1F44B}",raised_hand:"\u270B",raised_hands:"\u{1F64C}",pray:"\u{1F64F}",clap:"\u{1F44F}",muscle:"\u{1F4AA}",point_up:"\u261D\uFE0F",point_down:"\u{1F447}",point_left:"\u{1F448}",point_right:"\u{1F449}",v:"\u270C\uFE0F",crossed_fingers:"\u{1F91E}",handshake:"\u{1F91D}",writing_hand:"\u270D\uFE0F",selfie:"\u{1F933}",nail_care:"\u{1F485}",eyes:"\u{1F440}",fire:"\u{1F525}",star:"\u2B50",star2:"\u{1F31F}",sparkles:"\u2728",zap:"\u26A1",boom:"\u{1F4A5}",collision:"\u{1F4A5}",dizzy:"\u{1F4AB}",sweat_drops:"\u{1F4A6}",droplet:"\u{1F4A7}",snowflake:"\u2744\uFE0F",sunny:"\u2600\uFE0F",cloud:"\u2601\uFE0F",rainbow:"\u{1F308}",umbrella:"\u2614",ocean:"\u{1F30A}",sun_with_face:"\u{1F31E}",full_moon:"\u{1F315}",crescent_moon:"\u{1F319}",tada:"\u{1F389}",confetti_ball:"\u{1F38A}",balloon:"\u{1F388}",gift:"\u{1F381}",trophy:"\u{1F3C6}",medal:"\u{1F3C5}",crown:"\u{1F451}",gem:"\u{1F48E}",rocket:"\u{1F680}",airplane:"\u2708\uFE0F",car:"\u{1F697}",rotating_light:"\u{1F6A8}",100:"\u{1F4AF}",white_check_mark:"\u2705",heavy_check_mark:"\u2714\uFE0F",ballot_box_with_check:"\u2611\uFE0F",x:"\u274C",warning:"\u26A0\uFE0F",no_entry:"\u26D4",question:"\u2753",exclamation:"\u2757",bulb:"\u{1F4A1}",lock:"\u{1F512}",key:"\u{1F511}",mag:"\u{1F50D}",bell:"\u{1F514}",recycle:"\u267B\uFE0F",heavy_plus_sign:"\u2795",heavy_minus_sign:"\u2796",coffee:"\u2615",tea:"\u{1F375}",beer:"\u{1F37A}",beers:"\u{1F37B}",wine_glass:"\u{1F377}",cocktail:"\u{1F378}",pizza:"\u{1F355}",hamburger:"\u{1F354}",fries:"\u{1F35F}",taco:"\u{1F32E}",cake:"\u{1F382}",birthday:"\u{1F382}",cookie:"\u{1F36A}",doughnut:"\u{1F369}",apple:"\u{1F34E}",banana:"\u{1F34C}",strawberry:"\u{1F353}",avocado:"\u{1F951}",bread:"\u{1F35E}",cheese:"\u{1F9C0}",dog:"\u{1F436}",cat:"\u{1F431}",mouse:"\u{1F42D}",rabbit:"\u{1F430}",bear:"\u{1F43B}",panda_face:"\u{1F43C}",koala:"\u{1F428}",tiger:"\u{1F42F}",lion:"\u{1F981}",cow:"\u{1F42E}",pig:"\u{1F437}",frog:"\u{1F438}",monkey_face:"\u{1F435}",chicken:"\u{1F414}",penguin:"\u{1F427}",bird:"\u{1F426}",unicorn:"\u{1F984}",bee:"\u{1F41D}",bug:"\u{1F41B}",butterfly:"\u{1F98B}",snail:"\u{1F40C}",book:"\u{1F4D6}",books:"\u{1F4DA}",memo:"\u{1F4DD}",pencil:"\u{1F4DD}",email:"\u2709\uFE0F",envelope:"\u2709\uFE0F",calendar:"\u{1F4C5}",chart:"\u{1F4CA}",bar_chart:"\u{1F4CA}",chart_with_upwards_trend:"\u{1F4C8}",clipboard:"\u{1F4CB}",pushpin:"\u{1F4CC}",paperclip:"\u{1F4CE}",scissors:"\u2702\uFE0F",hammer:"\u{1F528}",wrench:"\u{1F527}",gear:"\u2699\uFE0F",nut_and_bolt:"\u{1F529}",bomb:"\u{1F4A3}",hourglass:"\u231B",watch:"\u231A",alarm_clock:"\u23F0",moneybag:"\u{1F4B0}",dollar:"\u{1F4B5}",credit_card:"\u{1F4B3}",chart_increasing:"\u{1F4C8}",link:"\u{1F517}",mag_right:"\u{1F50E}",telescope:"\u{1F52D}",microscope:"\u{1F52C}",syringe:"\u{1F489}",pill:"\u{1F48A}",phone:"\u{1F4DE}",telephone:"\u{1F4DE}",iphone:"\u{1F4F1}",computer:"\u{1F4BB}",keyboard:"\u2328\uFE0F",printer:"\u{1F5A8}\uFE0F",camera:"\u{1F4F7}",movie_camera:"\u{1F3A5}",tv:"\u{1F4FA}",seedling:"\u{1F331}",evergreen_tree:"\u{1F332}",deciduous_tree:"\u{1F333}",palm_tree:"\u{1F334}",cactus:"\u{1F335}",four_leaf_clover:"\u{1F340}",rose:"\u{1F339}",sunflower:"\u{1F33B}",tulip:"\u{1F337}",blossom:"\u{1F33C}",herb:"\u{1F33F}",musical_note:"\u{1F3B5}",notes:"\u{1F3B6}",microphone:"\u{1F3A4}",headphones:"\u{1F3A7}",guitar:"\u{1F3B8}",trumpet:"\u{1F3BA}",soccer:"\u26BD",basketball:"\u{1F3C0}",football:"\u{1F3C8}",baseball:"\u26BE",tennis:"\u{1F3BE}","8ball":"\u{1F3B1}",dart:"\u{1F3AF}",video_game:"\u{1F3AE}",game_die:"\u{1F3B2}",trophy2:"\u{1F3C6}",sos:"\u{1F198}",new:"\u{1F195}",ok:"\u{1F197}",up:"\u{1F199}",cool:"\u{1F192}",free:"\u{1F193}",arrow_up:"\u2B06\uFE0F",arrow_down:"\u2B07\uFE0F",arrow_left:"\u2B05\uFE0F",arrow_right:"\u27A1\uFE0F",arrow_forward:"\u25B6\uFE0F",bangbang:"\u203C\uFE0F",interrobang:"\u2049\uFE0F",grey_question:"\u2754",grey_exclamation:"\u2755"};function RTE_Plugin_EmojiAutocomplete(){var S=this,c,i,f,N,A=null,E=[],C=0,o=-1,v=null;S.PluginName="EmojiAutocomplete",S.InitConfig=function(u){c=u},S.InitEditor=function(u){i=u,f=i.getEditable(),N=i.getDocument(),!(!f||!N)&&(N.addEventListener("input",B,!1),N.addEventListener("keydown",D,!0),N.addEventListener("blur",function(){setTimeout(I,150)},!0))};function w(){return c.emojiShortcodes||{}}function q(){var u=i.getSelection();if(!u||u.rangeCount===0||!u.isCollapsed)return null;var y=u.getRangeAt(0);if(y.startContainer.nodeType!==3)return null;for(var O=y.startContainer.parentNode;O&&O!==f;){if(O.nodeName==="CODE"||O.nodeName==="PRE")return null;O=O.parentNode}return y}function B(){if(c.emojiAutocompleteEnabled){var u=q();if(!u){I();return}var y=u.startContainer,O=u.startOffset,K=y.data.slice(0,O),T=/(^|[^a-z0-9_])(:[a-z0-9_+\-]{1,30}:)$/i.exec(K);if(T){var V=T[2].slice(1,-1).toLowerCase(),Z=w()[V];if(Z){L(y,O-T[2].length,O,Z),I();return}}var M=/(^|[^a-z0-9_])(:)([a-z0-9_+\-]{1,30})$/i.exec(K);if(M){var X=M[3].toLowerCase();v=y,o=O-X.length-1,H(X,u)}else I()}}function H(u,y){for(var O=w(),K=Object.keys(O),T=[],V=[],Z=0;Z<K.length;Z++){var M=K[Z];M.indexOf(u)===0?T.push(M):M.indexOf(u)!==-1&&V.push(M)}for(var X=T.concat(V),G={},Y=[],j=0;j<X.length&&Y.length<8;j++){var p=O[X[j]];G[p]||(G[p]=1,Y.push({code:X[j],emo:p}))}if(!Y.length){I();return}E=Y,C=0,g(y)}function g(u){var y=document;A||(A=y.createElement("div"),A.className="rte-emoji-pop",A.setAttribute("role","listbox"),A.setAttribute("aria-label","Emoji suggestions"),A.style.cssText="position:fixed;z-index:2147483600;",y.body.appendChild(A)),A.innerHTML="",E.forEach(function(X,G){var Y=y.createElement("div");Y.className="rte-emoji-pop-row"+(G===C?" is-active":""),Y.setAttribute("role","option"),Y.setAttribute("aria-selected",G===C?"true":"false");var j=y.createElement("span");j.className="rte-emoji-pop-glyph",j.textContent=X.emo;var p=y.createElement("span");p.className="rte-emoji-pop-code",p.textContent=":"+X.code+":",Y.appendChild(j),Y.appendChild(p),Y.onmousedown=function(k){k.preventDefault(),C=G,P()},Y.onmouseenter=function(){C=G,b()},A.appendChild(Y)});try{var O=u.getBoundingClientRect(),K=N.defaultView&&N.defaultView.frameElement?N.defaultView.frameElement.getBoundingClientRect():{left:0,top:0},T=K.left+O.left,V=K.top+O.bottom+4,Z=y.documentElement.clientWidth,M=y.documentElement.clientHeight;A.style.left=Math.max(4,Math.min(T,Z-290))+"px",A.style.top=Math.max(4,Math.min(V,M-20))+"px",A.style.display="block"}catch{}}function b(){if(A)for(var u=A.childNodes,y=0;y<u.length;y++)u[y].classList.toggle("is-active",y===C),u[y].setAttribute("aria-selected",y===C?"true":"false")}function D(u){if(!(!A||A.style.display==="none"||!E.length))switch(u.key){case"ArrowDown":u.preventDefault(),u.stopPropagation(),C=(C+1)%E.length,b();break;case"ArrowUp":u.preventDefault(),u.stopPropagation(),C=(C-1+E.length)%E.length,b();break;case"Enter":case"Tab":u.preventDefault(),u.stopPropagation(),P();break;case"Escape":u.preventDefault(),u.stopPropagation(),I();break}}function P(){if(!E.length||!v||o<0){I();return}var u=E[C]||E[0],y=q();if(!y||y.startContainer!==v){I();return}L(v,o,y.startOffset,u.emo),I()}function L(u,y,O,K){try{var T=u.data,V=T.slice(0,y),Z=T.slice(O),M=u.parentNode;if(!M)return;var X=N.createDocumentFragment();V&&X.appendChild(N.createTextNode(V));var G=N.createTextNode(K);X.appendChild(G);var Y=Z?N.createTextNode(Z):null;Y&&X.appendChild(Y),M.replaceChild(X,u);var j=N.createRange();Y?j.setStart(Y,0):j.setStartAfter(G),j.collapse(!0);var p=i.getSelection();if(p&&(p.removeAllRanges(),p.addRange(j)),typeof i.fireChange=="function")try{i.fireChange()}catch{}}catch{}}function I(){A&&(A.style.display="none"),E=[],C=0,o=-1,v=null}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_foldheadings=RTE_Plugin_FoldHeadings,RTE_DefaultConfig.foldHeadingsEnabled=typeof RTE_DefaultConfig.foldHeadingsEnabled>"u"?!0:RTE_DefaultConfig.foldHeadingsEnabled;function RTE_Plugin_FoldHeadings(){var S=this,c,i,f=!1,N=null;S.PluginName="FoldHeadings",S.InitConfig=function(I){c=I},S.InitEditor=function(I){i=I,A();try{i.attachEvent("ready",A)}catch{}try{i.attachEvent("aftersethtml",A)}catch{}setTimeout(A,0),setTimeout(A,200),i.toggleHeadingFold=function(u){E(u)&&q(u)},i.unfoldAll=function(){var u=i.getEditable();u&&o(u.querySelectorAll(".rte-fold-collapsed,.rte-fold-hidden"))},i.foldAtCaret=function(){var u=w();return u&&q(u),!!u}};function A(){var I=i.getDocument();I&&(D(I),I!==N&&(I.addEventListener("click",g,!0),N=I)),L()}function E(I){return I&&I.nodeType===1&&/^H[1-6]$/.test(I.nodeName)}function C(I){return E(I)?+I.nodeName.charAt(1):0}function o(I){for(var u=0;u<I.length;u++)I[u].classList.remove("rte-fold-collapsed"),I[u].classList.remove("rte-fold-hidden")}function v(I){for(var u=C(I),y=[],O=I.nextElementSibling;O&&!(E(O)&&C(O)<=u);)y.push(O),O=O.nextElementSibling;return y}function w(){try{var I=i.getSelection();if(!I||I.rangeCount===0)return null;for(var u=i.getEditable(),y=I.getRangeAt(0).startContainer;y&&y!==u;){if(E(y))return y;y=y.parentNode}for(var O=I.getRangeAt(0).startContainer;O&&O.parentNode!==u&&O!==u;)O=O.parentNode;for(;O&&O!==u;){if(E(O))return O;O=O.previousElementSibling}}catch{}return null}function q(I){I.classList.contains("rte-fold-collapsed")?H(I):B(I)}function B(I){var u=v(I);if(u.length){try{var y=i.getSelection();if(y&&y.rangeCount){for(var O=y.getRangeAt(0).startContainer,K=O.nodeType===1?O:O.parentNode,T=0;T<u.length;T++)if(u[T]===K||u[T].contains(K)){var V=i.getDocument(),Z=V.createRange();Z.selectNodeContents(I),Z.collapse(!1),y.removeAllRanges(),y.addRange(Z);break}}}catch{}I.classList.add("rte-fold-collapsed");for(var M=0;M<u.length;M++)u[M].classList.add("rte-fold-hidden");b()}}function H(I){I.classList.remove("rte-fold-collapsed");for(var u=v(I),y=0;y<u.length;y++)u[y].classList.remove("rte-fold-hidden");b()}function g(I){if(c.foldHeadingsEnabled){var u=I.target;if(E(u)){var y=u.getBoundingClientRect(),O=I.clientX-y.left;O>2||O<-40||(I.preventDefault(),q(u))}}}function b(){try{typeof i.fireChange=="function"&&i.fireChange()}catch{}}function D(I){if(!(!I||I.getElementById("rte-foldheadings-styles"))){var u=".rte-fold-hidden{display:none !important;}h1,h2,h3,h4,h5,h6{position:relative;}h1::before,h2::before,h3::before,h4::before,h5::before,h6::before{content:'\\25BE';position:absolute;left:-0.95em;top:0;width:0.8em;text-align:center;color:#cbd5e1;cursor:pointer;opacity:0;transition:opacity .12s,transform .12s;font-size:.9em;}h1:hover::before,h2:hover::before,h3:hover::before,h4:hover::before,h5:hover::before,h6:hover::before{opacity:1;}h1.rte-fold-collapsed::before,h2.rte-fold-collapsed::before,h3.rte-fold-collapsed::before,h4.rte-fold-collapsed::before,h5.rte-fold-collapsed::before,h6.rte-fold-collapsed::before{content:'\\25B8';opacity:1;color:#1d67ba;}@media (prefers-reduced-motion: reduce){h1::before,h2::before,h3::before,h4::before,h5::before,h6::before{transition:none !important;}}@media (hover: none),(pointer: coarse){h1::before,h2::before,h3::before,h4::before,h5::before,h6::before{opacity:.5;}}",y=I.createElement("style");y.id="rte-foldheadings-styles",y.appendChild(I.createTextNode(u)),(I.head||I.getElementsByTagName("head")[0]||I.documentElement).appendChild(y)}}function P(){var I=i.getEditable();if(!I)return function(){};var u=I.querySelectorAll(".rte-fold-collapsed"),y=I.querySelectorAll(".rte-fold-hidden"),O;for(O=0;O<u.length;O++)u[O].classList.remove("rte-fold-collapsed");for(O=0;O<y.length;O++)y[O].classList.remove("rte-fold-hidden");return function(){for(var T=0;T<u.length;T++)u[T].classList.add("rte-fold-collapsed");for(var V=0;V<y.length;V++)y[V].classList.add("rte-fold-hidden")}}function L(){if(!f){for(var I=["getHTMLCode","getJSON","getHTMLContent"],u=!1,y=0;y<I.length;y++)(function(O){var K=i[O];if(!(typeof K!="function"||K.__rteFoldWrapped)){var T=function(){var V=P();try{return K.apply(i,arguments)}finally{V()}};T.__rteFoldWrapped=!0,i[O]=T,u=!0}})(I[y]);u&&(f=!0)}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_ghostcomplete=RTE_Plugin_GhostComplete,typeof RTE_DefaultConfig.ghostText>"u"&&(RTE_DefaultConfig.ghostText=!1),typeof RTE_DefaultConfig.ghostTextResolver>"u"&&(RTE_DefaultConfig.ghostTextResolver=null);function RTE_Plugin_GhostComplete(){var S=this,c,i,f=null,N=null,A=!1,E=null,C=0,o=!1,v=null,w="";S.PluginName="GhostComplete",S.InitConfig=function(p){c=p},S.InitEditor=function(p){i=p,f=typeof c.ghostText=="object"&&c.ghostText?c.ghostText:{},B();try{i.attachEvent("ready",B)}catch{}try{i.attachEvent("aftersethtml",B)}catch{}setTimeout(B,0),setTimeout(B,200),i.setGhostTextResolver=function(k){c.ghostTextResolver=typeof k=="function"?k:null},i.requestGhostText=function(){if(typeof c.ghostTextResolver!="function"){X();return}I(0)},i.acceptGhostText=function(){return M()},i.dismissGhostText=function(){Z()},i.hasGhostText=function(){return!!v}};function q(){return!!c.ghostText&&typeof c.ghostTextResolver=="function"}function B(){var p=i.getDocument();p&&(G(p),p!==N&&(p.addEventListener("keydown",P,!0),p.addEventListener("input",D,!0),p.addEventListener("mousedown",L,!0),p.addEventListener("touchstart",L,!0),N=p),j())}function H(){var p=f&&+f.delayMs;return p&&p>=0?p:600}function g(){var p=f&&+f.minChars;return p&&p>0?p:3}function b(){var p=f&&+f.maxContext;return p&&p>0?p:2e3}function D(){o||(Z(),q()&&I(H()))}function P(p){if(v){if(p.key==="Tab"){p.preventDefault(),p.stopPropagation(),M();return}if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),Z();return}/^Arrow|^Home$|^End$|^PageUp$|^PageDown$/.test(p.key)&&Z()}}function L(p){if(v){var k=p.target;k===v||v.contains&&v.contains(k)?(p.preventDefault(),p.stopPropagation(),M()):Z()}}function I(p){E&&(clearTimeout(E),E=null),q()&&(E=setTimeout(u,p))}function u(){if(E=null,!(!q()||v)){var p=y();if(!(!p||p.before.replace(/\s/g,"").length<g())){var k=++C,h;try{h=c.ghostTextResolver({before:p.before,after:p.after,full:p.full})}catch{return}Promise.resolve(h).then(function(x){k===C&&(v||typeof x=="string"&&(x=x.replace(/\r/g,""),x&&V(x)))},function(){})}}}function y(){try{var p=i.getSelection();if(!p||p.rangeCount===0||!p.isCollapsed)return null;var k=i.getEditable();if(!k)return null;var h=p.getRangeAt(0),x=T(h.startContainer,k)||k,z=h.cloneRange();z.setStart(x,0);var J=h.cloneRange();J.setEnd(x,x.childNodes.length);var ee=K(z),ue=K(J);return ee.length>b()&&(ee=ee.slice(ee.length-b())),{before:ee,after:ue,full:K(O(k))}}catch{return null}}function O(p){var k=i.getDocument(),h=k.createRange();return h.selectNodeContents(p),h}function K(p){try{for(var k=p.cloneContents(),h=k.querySelectorAll?k.querySelectorAll(".rte-ghost"):[],x=0;x<h.length;x++)h[x].parentNode.removeChild(h[x]);var z=i.getDocument().createElement("div");return z.appendChild(k),z.textContent||""}catch{return""}}function T(p,k){for(var h=p&&p.nodeType===3?p.parentNode:p;h&&h!==k;){if(h.nodeType===1&&/^(P|H[1-6]|LI|BLOCKQUOTE|PRE|TD|TH|DIV|FIGCAPTION)$/.test(h.nodeName))return h;h=h.parentNode}return null}function V(p){var k=i.getDocument(),h=i.getSelection();if(!(!k||!h||h.rangeCount===0||!h.isCollapsed)){o=!0;try{var x=h.getRangeAt(0),z=k.createElement("span");z.className="rte-ghost",z.setAttribute("contenteditable","false"),z.setAttribute("data-rte-ghost","1"),z.setAttribute("aria-hidden","true"),z.textContent=p,x.insertNode(z),v=z,w=p;var J=k.createRange();J.setStartBefore(z),J.collapse(!0),h.removeAllRanges(),h.addRange(J)}catch{v=null,w=""}finally{o=!1}}}function Z(){if(v){o=!0;try{var p=i.getSelection(),k=null;if(p&&p.rangeCount){var h=p.getRangeAt(0);k={n:h.startContainer,o:h.startOffset}}v.parentNode&&v.parentNode.removeChild(v);try{if(k&&k.n){var x=i.getDocument(),z=x.createRange();z.setStart(k.n,Math.min(k.o,k.n.length!=null?k.n.length:k.o)),z.collapse(!0),p.removeAllRanges(),p.addRange(z)}}catch{}}catch{}finally{v=null,w="",o=!1}}}function M(){if(!v)return!1;var p=w,k=i.getDocument(),h=i.getSelection();o=!0;try{v.parentNode&&v.parentNode.removeChild(v),v=null,w="";var x=!1;try{x=k.execCommand("insertText",!1,p)}catch{x=!1}if(!x&&h&&h.rangeCount){var z=h.getRangeAt(0),J=k.createTextNode(p);z.insertNode(J);var ee=k.createRange();ee.setStartAfter(J),ee.collapse(!0),h.removeAllRanges(),h.addRange(ee)}}catch{}finally{o=!1}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}return!0}function X(){try{var p=i.iframe||i.getDocument&&i.getDocument().defaultView&&i.getDocument().defaultView.frameElement,k=p&&p.parentNode?p.parentNode:document.body;if(k.querySelector&&k.querySelector(".rte-ghost-hint"))return;var h=(k.ownerDocument||document).createElement("div");h.className="rte-ghost-hint",h.setAttribute("role","status"),h.textContent="AI completion isn't configured \u2014 supply config.ghostTextResolver (or editor.setGhostTextResolver) to enable inline suggestions.",h.style.cssText="position:absolute;left:50%;bottom:12px;transform:translateX(-50%);z-index:20;max-width:90%;padding:7px 14px;border-radius:8px;background:#1f2937;color:#f9fafb;font:12px/1.5 -apple-system,Segoe UI,sans-serif;box-shadow:0 4px 14px rgba(0,0,0,.25);pointer-events:none";try{k!==document.body&&(k.ownerDocument.defaultView||window).getComputedStyle(k).position==="static"&&(k.style.position="relative")}catch{}k.appendChild(h),setTimeout(function(){try{h.parentNode&&h.parentNode.removeChild(h)}catch{}},4500)}catch{}}function G(p){if(!(!p||p.getElementById("rte-ghost-styles"))){var k=".rte-ghost{color:#9aa3b2;opacity:.85;font-style:normal;user-select:none;-webkit-user-select:none;cursor:pointer;white-space:pre-wrap;}",h=p.createElement("style");h.id="rte-ghost-styles",h.appendChild(p.createTextNode(k)),(p.head||p.getElementsByTagName("head")[0]||p.documentElement).appendChild(h)}}function Y(){var p=i.getEditable();if(!p)return function(){};for(var k=p.querySelectorAll(".rte-ghost"),h=[],x=0;x<k.length;x++)h.push([k[x],k[x].nextSibling,k[x].parentNode]),k[x].parentNode.removeChild(k[x]);return function(){for(var J=0;J<h.length;J++){var ee=h[J][0],ue=h[J][1],ve=h[J][2];if(ve)try{ve.insertBefore(ee,ue)}catch{}}}}function j(){if(!A){for(var p=["getHTMLCode","getJSON","getHTMLContent"],k=!1,h=0;h<p.length;h++)(function(x){var z=i[x];if(!(typeof z!="function"||z.__rteGhostWrapped)){var J=function(){var ee=Y();try{return z.apply(i,arguments)}finally{ee()}};J.__rteGhostWrapped=!0,i[x]=J,k=!0}})(p[h]);k&&(A=!0)}}}RTE_DefaultConfig.svgCode_html2pdf||(RTE_DefaultConfig.svgCode_html2pdf='<svg viewBox="-2 -2 36 36" fill="#5F6368"><polygon points="30 11 30 9 22 9 22 23 24 23 24 17 29 17 29 15 24 15 24 11 30 11"></polygon><path d="M8,9H2V23H4V18H8a2,2,0,0,0,2-2V11A2,2,0,0,0,8,9Zm0,7H4V11H8Z"></path><path d="M16,23H12V9h4a4,4,0,0,1,4,4v6A4,4,0,0,1,16,23Zm-2-2h2a2,2,0,0,0,2-2V13a2,2,0,0,0-2-2H14Z"></path><title>PDF</title></svg>'),RTE_DefaultConfig.plugin_html2pdf=RTE_Plugin_Html2PDF;function RTE_Plugin_Html2PDF(){var S="https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js",c=this,i,f;c.PluginName="Html2PDF",c.InitConfig=function(E){i=E},c.InitEditor=function(E){f=E,f.attachEvent("exec_command_html2pdf",function(C,o,v){c.DoHtml2PDF(),C.returnValue=!0}),f.toolbarFactoryMap.html2pdf=function(C){var o=f.createToolbarButton(C);return o.style.backgroundColor="",o}};function N(E,C,o,v){var w=E.ownerDocument.createElement(C);return o&&(w.style.cssText=o),v&&(w.className=v),E.appendChild(w),w}function A(E){for(var C=E.split(","),o=C[0].match(/:(.*?);/)[1],v=atob(C[1]),w=v.length,q=new Uint8Array(w);w--;)q[w]=v.charCodeAt(w);return new Blob([q],{type:o})}c.DoHtml2PDF=function(){var E=f.createDialog("Html2PDF","rte-dialog-html2pdf"),C=N(E,"div","position:relative;text-align:center;");C.innerHTML="Loading...";var o=N(E,"div","position:relative;text-align:center;");window.html2pdf_callback=function(w){if(!w.html2pdf){C.innerHTML="Failed to load script.";return}C.innerHTML="Exporting...";var q={margin:.5,filename:"myfile.pdf",image:{type:"jpeg",quality:.98},html2canvas:{scale:2},jsPDF:{unit:"in",format:"letter",orientation:"portrait"}},B=w.html2pdf().set(q).from(w.document.body).outputImg();B.then(function(H){var g=H.getAttribute("src");if(g.indexOf("base64")==-1){C.innerHTML="Error, no data.";return}var b=A(g),D=URL.createObjectURL(b);H.setAttribute("src",D);var P=w.html2pdf().set(q).from(w.document.body).outputPdf();P.then(function(L){for(var I=new Array(L.length),u=0;u<L.length;u++)I[u]=L.charCodeAt(u);var y=new Blob([new Uint8Array(I)],{type:"application/pdf"}),O=URL.createObjectURL(y);C.innerHTML=Math.ceil(L.length/1024)+"KB Exported<br/><a href='"+O+"' target=_blank>Download PDF</a>";var K=C.querySelector("a"),T=new Date,V=String(T.getFullYear()*1e4+(T.getMonth()+1)*100+T.getDate()).substring(2),Z=String(1e6+T.getHours()*1e4+T.getMinutes()*100+T.getSeconds()).substring(1);K.download="Export-"+V+"-"+Z+".pdf",K.click(),H.style.cssText="max-width:300px;max-height:200px;margin:5px;padding:10px;border:solid 1px #eee;box-shadow:2px 2px 6px #eee",o.appendChild(H),N(o,"br");var M=N(o,"a");M.setAttribute("href",D),M.setAttribute("target","_blank"),M.download="Export-"+V+"-"+Z+".jpg",M.innerText="Download Img"}).catch(function(L){console.error(L)})}).catch(function(H){console.error(H)})};var v=N(E,"div","position:relative;text-align:center;");iframe=N(v,"iframe","align-self:center;flex:99;width:100%;height:0px;border:0px;","rte-editable"),iframe.contentDocument.open("text/html"),iframe.contentDocument.write("<html><head><link id='url-css-preview' rel='stylesheet' href='"+f.htmlEncode(i.previewCssUrl)+"'/><script src='"+f.htmlEncode(S)+"'><\/script></head><body style='padding:10px;margin:0px'>"+f.getHTMLCode()+"</body><script>window.onload=function(){setTimeout(function(){parent.html2pdf_callback(window)},100)}<\/script></html>"),iframe.contentDocument.close()}}RTE_DefaultConfig.svgCode_imageeditor||(RTE_DefaultConfig.svgCode_imageeditor='<svg viewBox="-2 -2 20 20" fill="#5F6368"><style>.st0{fill:#f6f6f6}.st1{fill:#424242}.st2{fill:none}.st3{fill:#f0eff1}</style><path class="st0" d="M1 0v6H0v10h10v-1h6V0z" id="outline"/><g id="icon_x5F_bg"><path class="st1" d="M2 5h1v1H2zM2 3h1v1H2zM2 1h1v1H2zM4 1h1.001v1H4zM6 1h1v1H6zM8 1h1v1H8zM10 1h1v1h-1zM12 1h1v1h-1zM14 1h1v1h-1zM14 3h1v1h-1zM14 5h1v1h-1zM14 7h1v1h-1zM14 9h1v1h-1zM14 10.999h1V12h-1zM14 13h1v1h-1zM12 13h1v1h-1zM11 11V5H5v1H4V4h8v7z"/><circle class="st1" cx="6.192" cy="9.807" r=".807"/><path class="st1" d="M1 7v8h8V7H1zm1 7.001v-.28l2.537-1.463L7.554 14l.001.001H2zm6-.93l-3.463-1.982L2 12.491v-4.49h6v5.07zM10 13h1v1h-1z"/></g><g id="icon_x5F_fg"><path class="st2" d="M2 14h5.554v.001H2z"/><path class="st3" d="M11 5v6h-1V6H5V5z"/><path class="st3" d="M2 12.491l2.537-1.402L8 13.071v-5.07H2v4.49zM6.192 9a.807.807 0 1 1 .001 1.615A.807.807 0 0 1 6.192 9z"/><path class="st3" d="M2 13.721V14h5.554l-3.017-1.742z"/></g></svg>'),RTE_DefaultConfig.plugin_imageeditor=RTE_Plugin_ImageEditor;function RTE_Plugin_ImageEditor(){var S=this,c,i;S.PluginName="ImageEditor",S.InitConfig=function(A){c=A},S.InitEditor=function(A){i=A,i.attachEvent("exec_command_imageeditor",function(E,C,o){S.DoImageEditor(),E.returnValue=!0}),i.toolbarFactoryMap.imageeditor=function(E){var C=i.createToolbarButton(E);return C.style.backgroundColor="",C}};function f(A,E,C,o){var v=A.ownerDocument.createElement(E);return C&&(v.style.cssText=C),o&&(v.className=o),A.appendChild(v),v}function N(A){for(var E=A.split(","),C=E[0].match(/:(.*?);/)[1],o=atob(E[1]),v=o.length,w=new Uint8Array(v);v--;)w[v]=o.charCodeAt(v);return new Blob([w],{type:C})}S.DoImageEditor=function(){var A=i.getSelectedControl();if(A){var E=i.createDialog("ImageEditor","rte-dialog-imageeditor");E.style.width="90%",E.style.height="90%";var C=c.url_base+"/plugins/tui.image-editor/";window.rte_image_editor_callback=function(o){var v={includeUI:{loadImage:{path:A.src,name:"RteImage"},theme:{"menu.normalIcon.path":C+"svg/icon-d.svg","menu.activeIcon.path":C+"svg/icon-b.svg","menu.disabledIcon.path":C+"svg/icon-a.svg","menu.hoverIcon.path":C+"svg/icon-c.svg","submenu.normalIcon.path":C+"svg/icon-d.svg","submenu.normalIcon.name":"icon-d","submenu.activeIcon.path":C+"svg/icon-c.svg","submenu.activeIcon.name":"icon-c"},menuBarPosition:"bottom"},cssMaxWidth:700,cssMaxHeight:500,selectionStyle:{cornerSize:20,rotatingPointOffset:70}},w=new o.tui.ImageEditor(o.document.querySelector("#tui-image-editor"),v),q=o.document.querySelector(".tui-image-editor-header-buttons");q.innerHTML="";var B=f(q,"button","");B.innerText="Save",B.onclick=function(){var H=w.toDataURL();if(!c.file_upload_handler){A.src=H,i.notifySelectionChange(),E.close();return}var g=N(H);c.file_upload_handler(g,function(b,D){if(b){A.src=b,i.notifySelectionChange(),E.close();return}alert(D?"upload failed , TODO:show retry dialog or cancel":"Developer warning : ")})}},iframe=f(E,"iframe","align-self:center;flex:99;width:100%;height:100%px;border:0px;","rte-editable"),iframe.contentDocument.open("text/html"),iframe.contentDocument.write("<html><head><base href='"+i.htmlEncode(location.href)+"'/><link id='url-css-preview' rel='stylesheet' href='"+i.htmlEncode(C+"tui-color-picker.min.css")+"'/><link id='url-css-preview' rel='stylesheet' href='"+i.htmlEncode(C+"tui-image-editor.min.css")+"'/><script src='"+i.htmlEncode(C+"fabric.min.js")+"'><\/script><script src='"+i.htmlEncode(C+"tui-color-picker.min.js")+"'><\/script><script src='"+i.htmlEncode(C+"tui-code-snippet.min.js")+"'><\/script><script src='"+i.htmlEncode(C+"tui-image-editor.min.js")+"'><\/script></head><body style='padding:10px;margin:0px'><div id='tui-image-editor'></div></body><script>window.onload=function(){setTimeout(function(){parent.rte_image_editor_callback(window)},100)}<\/script></html>"),iframe.contentDocument.close()}}}RTE_DefaultConfig.svgCode_insertcode||(RTE_DefaultConfig.svgCode_insertcode='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><polyline points="8 7 3 12 8 17"/><polyline points="16 7 21 12 16 17"/><line x1="14" y1="5" x2="10" y2="19"/></svg>'),RTE_DefaultConfig.plugin_insertcode=RTE_Plugin_InsertCode;function RTE_Plugin_InsertCode(){var S={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Version:"1.5.1"}};S.InsertCode=S.sh,S.sh.Utils.CopyStyles=function(A,E){for(var C=E.getElementsByTagName("link"),o=0;o<C.length;o++)C[o].rel.toLowerCase()=="stylesheet"&&A.write('<link type="text/css" rel="stylesheet" href="'+C[o].href+'"></link>')},S.sh.Utils.FixForBlogger=function(A){return S.sh.isBloggerMode==!0?A.replace(/<br\s*\/?>|<br\s*\/?>/gi,`
|
|
23
|
+
`):A},S.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"',"g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'","g")},S.sh.Match=function(A,E,C){this.value=A,this.index=E,this.length=A.length,this.css=C},S.sh.Highlighter=function(){this.noGutter=!1,this.addControls=!0,this.collapse=!1,this.tabsToSpaces=!0,this.wrapColumn=80,this.showColumns=!0},S.sh.Highlighter.SortCallback=function(A,E){return A.index<E.index?-1:A.index>E.index?1:A.length<E.length?-1:A.length>E.length?1:0},S.sh.Highlighter.prototype.CreateElement=function(A){var E=document.createElement(A);return E.highlighter=this,E},S.sh.Highlighter.prototype.GetMatches=function(A,E){for(var C=0,o=null;(o=A.exec(this.code))!=null;)this.matches[this.matches.length]=new S.sh.Match(o[0],o.index,E)},S.sh.Highlighter.prototype.AddBit=function(A,E){if(!(A==null||A.length==0)){var C=this.CreateElement("SPAN");if(A=A.replace(/ /g," "),A=A.replace(/</g,"<"),A=A.replace(/\n/gm," <br>"),E!=null)if(/br/gi.test(A))for(var o=A.split(" <br>"),v=0;v<o.length;v++)C=this.CreateElement("SPAN"),C.className=E,C.innerHTML=o[v],this.div.appendChild(C),v+1<o.length&&this.div.appendChild(this.CreateElement("BR"));else C.className=E,C.innerHTML=A,this.div.appendChild(C);else C.innerHTML=A,this.div.appendChild(C)}},S.sh.Highlighter.prototype.IsInside=function(A){if(A==null||A.length==0)return!1;for(var E=0;E<this.matches.length;E++){var C=this.matches[E];if(C!=null&&A.index>C.index&&A.index<C.index+C.length)return!0}return!1},S.sh.Highlighter.prototype.ProcessRegexList=function(){for(var A=0;A<this.regexList.length;A++)this.GetMatches(this.regexList[A].regex,this.regexList[A].css)},S.sh.Highlighter.prototype.ProcessSmartTabs=function(A){var E=A.split(`
|
|
24
|
+
`),C="",o=4,v=" ";function w(H,g,b){for(var D=H.substr(0,g),P=H.substr(g+1,H.length),L="",I=0;I<b;I++)L+=" ";return D+L+P}function q(H,g){if(H.indexOf(v)==-1)return H;for(var b=0;(b=H.indexOf(v))!=-1;){var D=g-b%g;H=w(H,b,D)}return H}for(var B=0;B<E.length;B++)C+=q(E[B],o)+`
|
|
25
|
+
`;return C},S.sh.Highlighter.prototype.SwitchToList=function(){var A=this.div.innerHTML.replace(/<(br)\/?>/gi,`
|
|
26
|
+
`),E=A.split(`
|
|
27
|
+
`);if(this.addControls==!0&&this.bar.appendChild(S.sh.Toolbar.Create(this)),this.showColumns){for(var C=this.CreateElement("div"),o=this.CreateElement("div"),v=10,w=1;w<=150;)w%v==0?(C.innerHTML+=w,w+=(w+"").length):(C.innerHTML+="·",w++);o.className="columns",o.appendChild(C),this.bar.appendChild(o)}for(var w=0,q=this.firstLine;w<E.length-1;w++,q++){var B=this.CreateElement("LI"),H=this.CreateElement("SPAN");B.className=w%2==0?"alt":"",H.innerHTML=E[w]+" ",B.appendChild(H),this.ol.appendChild(B)}this.div.innerHTML=""},S.sh.Highlighter.prototype.Highlight=function(A){function E(H){return H.replace(/^\s*(.*?)[\s\n]*$/g,"$1")}function C(H){return H.replace(/\n*$/,"").replace(/^\n*/,"")}function o(H){for(var g=S.sh.Utils.FixForBlogger(H).split(`
|
|
28
|
+
`),b=new Array,D=new RegExp("^\\s*","g"),P=1e3,L=0;L<g.length&&P>0;L++)if(E(g[L]).length!=0){var I=D.exec(g[L]);I!=null&&I.length>0&&(P=Math.min(I[0].length,P))}if(P>0)for(var L=0;L<g.length;L++)g[L]=g[L].substr(P);return g.join(`
|
|
29
|
+
`)}function v(H,g,b){return H.substr(g,b-g)}var w=0;if(A==null&&(A=""),this.originalCode=A,this.code=C(o(A)),this.div=this.CreateElement("DIV"),this.bar=this.CreateElement("DIV"),this.ol=this.CreateElement("OL"),this.matches=new Array,this.div.className="dp-highlighter",this.div.highlighter=this,this.bar.className="bar",this.ol.start=this.firstLine,this.CssClass!=null&&(this.ol.className=this.CssClass),this.collapse&&(this.div.className+=" collapsed"),this.noGutter&&(this.div.className+=" nogutter"),this.tabsToSpaces==!0&&(this.code=this.ProcessSmartTabs(this.code)),this.ProcessRegexList(),this.matches.length==0){this.AddBit(this.code,null),this.SwitchToList(),this.div.appendChild(this.bar),this.div.appendChild(this.ol);return}this.matches=this.matches.sort(S.sh.Highlighter.SortCallback);for(var q=0;q<this.matches.length;q++)this.IsInside(this.matches[q])&&(this.matches[q]=null);for(var q=0;q<this.matches.length;q++){var B=this.matches[q];B==null||B.length==0||(this.AddBit(v(this.code,w,B.index),null),this.AddBit(B.value,B.css),w=B.index+B.length)}this.AddBit(this.code.substr(w),null),this.SwitchToList(),this.div.appendChild(this.bar),this.div.appendChild(this.ol)},S.sh.Highlighter.prototype.GetKeywords=function(A){return"\\b"+A.replace(/ /g,"\\b|\\b")+"\\b"},S.sh.BloggerMode=function(){S.sh.isBloggerMode=!0},S.sh.HighlightAll=function(A,E,C,o,v,w){function q(){for(var M=arguments,X=0;X<M.length;X++)if(M[X]!=null){if(typeof M[X]=="string"&&M[X]!="")return M[X]+"";if(typeof M[X]=="object"&&M[X].value!="")return M[X].value+""}return null}function B(M,X){for(var G=0;G<X.length;G++)if(X[G]==M)return!0;return!1}function H(M,X,G){for(var Y=new RegExp("^"+M+"\\[(\\w+)\\]$","gi"),j=null,p=0;p<X.length;p++)if((j=Y.exec(X[p]))!=null)return j[1];return G}function g(M,X,G){for(var Y=document.getElementsByTagName(G),j=0;j<Y.length;j++)Y[j].getAttribute("name")==X&&M.push(Y[j])}var b=[A],D=null,P={},L="innerHTML";for(var I in S.sh.Brushes){var u=S.sh.Brushes[I].Aliases;if(u!=null)for(var y=0;y<u.length;y++)P[u[y]]=I}for(var y=0;y<b.length;y++){var A=b[y],O=q(A.attributes.class,A.className,A.attributes.language,A.language),K="";if(O!=null&&(O=O.split(":"),K=O[0].toLowerCase(),P[K]!=null)){D=new S.sh.Brushes[P[K]],A.style.display="none",D.noGutter=E==null?B("nogutter",O):!E,D.addControls=C??!B("nocontrols",O),D.collapse=o??B("collapse",O),D.showColumns=w??B("showcolumns",O);var T=document.getElementsByTagName("head")[0];if(D.Style&&T){var V=document.createElement("style");if(V.setAttribute("type","text/css"),V.styleSheet)V.styleSheet.cssText=D.Style;else{var Z=document.createTextNode(D.Style);V.appendChild(Z)}T.appendChild(V)}D.firstLine=v??parseInt(H("firstline",O,1)),D.Highlight(A[L]),D.source=A,A.parentNode.insertBefore(D.div,A)}}},S.sh.Brushes.JScript=function(){var A="abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends false final finally float for function goto if implements import in instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with";this.regexList=[{regex:S.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"}],this.CssClass="dp-c"},S.sh.Brushes.JScript.prototype=new S.sh.Highlighter,S.sh.Brushes.JScript.Aliases=["js","jscript","javascript"],S.sh.Brushes.Java=function(){var A="abstract assert boolean break byte case catch char class const continue default do double else enum extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws true transient try void volatile while";this.regexList=[{regex:S.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b","gi"),css:"number"},{regex:new RegExp("(?!\\@interface\\b)\\@[\\$\\w]+\\b","g"),css:"annotation"},{regex:new RegExp("\\@interface\\b","g"),css:"keyword"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"}],this.CssClass="dp-j",this.Style=".dp-j .annotation { color: #646464; }.dp-j .number { color: #C00000; }"},S.sh.Brushes.Java.prototype=new S.sh.Highlighter,S.sh.Brushes.Java.Aliases=["java"],S.sh.Brushes.Cpp=function(){var A="ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t __wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler sig_atomic_t size_t _stat __stat64 _stati64 terminate_function time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf va_list wchar_t wctrans_t wctype_t wint_t signed",E="break case catch class const __finally __exception __try const_cast continue private public protected __declspec default delete deprecated dllexport dllimport do dynamic_cast else enum explicit extern if for friend goto inline mutable naked namespace new noinline noreturn nothrow register reinterpret_cast return selectany sizeof static static_cast struct switch template this thread throw true false try typedef typeid typename union using uuid virtual void volatile whcar_t while";this.regexList=[{regex:S.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^ *#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"datatypes"},{regex:new RegExp(this.GetKeywords(E),"gm"),css:"keyword"}],this.CssClass="dp-cpp",this.Style=".dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }"},S.sh.Brushes.Cpp.prototype=new S.sh.Highlighter,S.sh.Brushes.Cpp.Aliases=["cpp","c","c++"],S.sh.Brushes.CSharp=function(){var A="abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach get goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed set short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void while";this.regexList=[{regex:S.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"}],this.CssClass="dp-c",this.Style=".dp-c .vars { color: #d00; }"},S.sh.Brushes.CSharp.prototype=new S.sh.Highlighter,S.sh.Brushes.CSharp.Aliases=["c#","c-sharp","csharp"],S.sh.Brushes.CSS=function(){var A="ascent azimuth background-attachment background-color background-image background-position background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width border cap-height caption-side centerline clear clip color content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index",E="above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow",C="[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif";this.regexList=[{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\#[a-zA-Z0-9]{3,6}","g"),css:"value"},{regex:new RegExp("(-?\\d+)(.\\d+)?(px|em|pt|:|%|)","g"),css:"value"},{regex:new RegExp("!important","g"),css:"important"},{regex:new RegExp(this.GetKeywordsCSS(A),"gm"),css:"keyword"},{regex:new RegExp(this.GetValuesCSS(E),"g"),css:"value"},{regex:new RegExp(this.GetValuesCSS(C),"g"),css:"value"}],this.CssClass="dp-css",this.Style=".dp-css .value { color: black; }.dp-css .important { color: red; }"},S.sh.Highlighter.prototype.GetKeywordsCSS=function(A){return"\\b([a-z_]|)"+A.replace(/ /g,"(?=:)\\b|\\b([a-z_\\*]|\\*|)")+"(?=:)\\b"},S.sh.Highlighter.prototype.GetValuesCSS=function(A){return"\\b"+A.replace(/ /g,"(?!-)(?!:)\\b|\\b()")+":\\b"},S.sh.Brushes.CSS.prototype=new S.sh.Highlighter,S.sh.Brushes.CSS.Aliases=["css"],S.sh.Brushes.Php=function(){var A="abs acos acosh addcslashes addslashes array_change_key_case array_chunk array_combine array_count_values array_diff array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill array_filter array_flip array_intersect array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map array_merge array_merge_recursive array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff array_udiff_assoc array_udiff_uassoc array_uintersect array_uintersect_assoc array_uintersect_uassoc array_unique array_unshift array_values array_walk array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists closedir closelog copy cos cosh count count_chars date decbin dechex decoct deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime strtoupper strtr strval substr substr_compare",E="and or xor __FILE__ __LINE__ array as break case cfunction class const continue declare default die do else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends for foreach function include include_once global if new old_function return static switch use require require_once var while __FUNCTION__ __CLASS__ __METHOD__ abstract interface public implements extends private protected throw";this.regexList=[{regex:S.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:S.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\$\\w+","g"),css:"vars"},{regex:new RegExp(this.GetKeywords(A),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords(E),"gm"),css:"keyword"}],this.CssClass="dp-c"},S.sh.Brushes.Php.prototype=new S.sh.Highlighter,S.sh.Brushes.Php.Aliases=["php"],S.sh.Brushes.Python=function(){var A="and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try yield while",E="None True False self cls class_";this.regexList=[{regex:S.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:new RegExp("^\\s*@\\w+","gm"),css:"decorator"},{regex:new RegExp(`(['"]{3})([^\\1])*?\\1`,"gm"),css:"comment"},{regex:new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"',"gm"),css:"string"},{regex:new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'","gm"),css:"string"},{regex:new RegExp("\\b\\d+\\.?\\w*","g"),css:"number"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(E),"gm"),css:"special"}],this.CssClass="dp-py",this.Style=".dp-py .builtins { color: #ff1493; }.dp-py .magicmethods { color: #808080; }.dp-py .exceptions { color: brown; }.dp-py .types { color: brown; font-style: italic; }.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }"},S.sh.Brushes.Python.prototype=new S.sh.Highlighter,S.sh.Brushes.Python.Aliases=["py","python"],S.sh.Brushes.Xml=function(){this.CssClass="dp-xml",this.Style=".dp-xml .cdata { color: #ff1493; }.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }.dp-xml .attribute { color: red; }.dp-xml .attribute-value { color: blue; }"},S.sh.Brushes.Xml.prototype=new S.sh.Highlighter,S.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"],S.sh.Brushes.Xml.prototype.ProcessRegexList=function(){function A(v,w){v[v.length]=w}var E=0,C=null,o=null;for(this.GetMatches(new RegExp("(<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](>|>)","gm"),"cdata"),this.GetMatches(new RegExp("(<|<)!--\\s*.*?\\s*--(>|>)","gm"),"comments"),o=new RegExp(`([:\\w-.]+)\\s*=\\s*(".*?"|'.*?'|\\w+)*|(\\w+)`,"gm");(C=o.exec(this.code))!=null;)C[1]!=null&&(A(this.matches,new S.sh.Match(C[1],C.index,"attribute")),C[2]!=null&&A(this.matches,new S.sh.Match(C[2],C.index+C[0].indexOf(C[2]),"attribute-value")));for(this.GetMatches(new RegExp("(<|<)/*\\?*(?!\\!)|/*\\?*(>|>)","gm"),"tag"),o=new RegExp("(?:<|<)/*\\?*\\s*([:\\w-.]+)","gm");(C=o.exec(this.code))!=null;)A(this.matches,new S.sh.Match(C[1],C.index+C[0].indexOf(C[1]),"tag-name"))},S.sh.Brushes.Vb=function(){var A="AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType Date Decimal Declare Default Delegate Dim DirectCast Do Double Each Else ElseIf End Enum Erase Error Event Exit False Finally For Friend Function Get GetType GoSub GoTo Handles If Implements Imports In Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing NotInheritable NotOverridable Object On Option Optional Or OrElse Overloads Overridable Overrides ParamArray Preserve Private Property Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume Return Select Set Shadows Shared Short Single Static Step Stop String Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until Variant When While With WithEvents WriteOnly Xor";this.regexList=[{regex:new RegExp("'.*$","gm"),css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"}],this.CssClass="dp-vb"},S.sh.Brushes.Vb.prototype=new S.sh.Highlighter,S.sh.Brushes.Vb.Aliases=["vb","vb.net"],S.sh.Brushes.Ruby=function(){var A="alias and BEGIN begin break case class def define_method defined do each else elsif END end ensure false for if in module new next nil not or raise redo rescue retry return self super then throw true undef unless until when while yield",E="Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ThreadGroup Thread Time TrueClass";this.regexList=[{regex:S.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(":[a-z][A-Za-z0-9_]*","g"),css:"symbol"},{regex:new RegExp("(\\$|@@|@)\\w+","g"),css:"variable"},{regex:new RegExp(this.GetKeywords(A),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(E),"gm"),css:"builtin"}],this.CssClass="dp-rb",this.Style=".dp-rb .symbol { color: #a70; }.dp-rb .variable { color: #a70; font-weight: bold; }"},S.sh.Brushes.Ruby.prototype=new S.sh.Highlighter,S.sh.Brushes.Ruby.Aliases=["ruby","rails","ror"],S.sh.Brushes.Sql=function(){var A="abs avg case cast coalesce convert count current_timestamp current_user day isnull left lower month nullif replace right session_user space substring sum system_user upper user year",E="absolute action add after alter as asc at authorization begin bigint binary bit by cascade char character check checkpoint close collate column commit committed connect connection constraint contains continue create cube current current_date current_time cursor database date deallocate dec decimal declare default delete desc distinct double drop dynamic else end end-exec escape except exec execute false fetch first float for force foreign forward free from full function global goto grant group grouping having hour ignore index inner insensitive insert instead int integer intersect into is isolation key last level load local max min minute modify move name national nchar next no numeric of off on only open option order out output partial password precision prepare primary prior privileges procedure public read real references relative repeatable restrict return returns revoke rollback rollup rows rule schema scroll second section select sequence serializable set size smallint static statistics table temp temporary then time timestamp to top transaction translation trigger true truncate uncommitted union unique update values varchar varying view when where with work",C="all and any between cross in join like not null or outer some";this.regexList=[{regex:new RegExp("--(.*)$","gm"),css:"comment"},{regex:S.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:S.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(this.GetKeywords(A),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords(C),"gmi"),css:"op"},{regex:new RegExp(this.GetKeywords(E),"gmi"),css:"keyword"}],this.CssClass="dp-sql",this.Style=".dp-sql .func { color: #ff1493; }.dp-sql .op { color: #808080; }"},S.sh.Brushes.Sql.prototype=new S.sh.Highlighter,S.sh.Brushes.Sql.Aliases=["sql"];var c=this,i,f;c.PluginName="InsertCode",c.InitConfig=function(A){i=A},c.InitEditor=function(A){f=A,f.attachEvent("exec_command_insertcode",function(E,C,o){c.DoShowDialog(),E.returnValue=!0}),f.toolbarFactoryMap.insertcode=function(E){var C=f.createToolbarButton(E);return C.style.backgroundColor="",C}};function N(A,E,C,o){var v=A.ownerDocument.createElement(E);return C&&(v.style.cssText=C),o&&(v.className=o),A.appendChild(v),v}c.DoShowDialog=function(){var A=f.createDialog(f.getLangText("insertcode"),"rte-dialog-insertcode"),E=N(A,"div","position:relative;text-align:center;");N(E,"label").innerText=f.getLangText("language")+":";var C=N(E,"select","width:200px;");C.options.add(new Option("Plain Text",""));for(var o in S.sh.Brushes){var v=S.sh.Brushes[o].Aliases;if(v!=null){C.options.add(new Option(v,o));var w=sessionStorage.getItem("rte-insertcode-lang");w&&(C.value=w)}}var q=N(A,"div","position:relative;text-align:center;"),B=N(q,"textarea","width:100%;min-width:300px;height:200px"),H=N(A,"rte-dialog-footer",null,"rte-dialog-footer-center"),g=N(H,"rte-dialog-button");g.innerText="Insert",setTimeout(function(){B.focus()},300),g.onclick=function(){if(A.close(),sessionStorage.setItem("rte-insertcode-lang",C.value),C.value!=""){var b=S.sh.Brushes[C.value];B.language=b.Aliases[0]+":nocontrols",B.name="rteinsertcode"+new Date().getTime(),B.textContent=B.value,S.sh.HighlightAll(B);var D=B.previousSibling,P=f.insertRootParagraph();P.innerHTML='<div class="dp-highlighter">'+D.innerHTML+"</div>"}else{var P=f.insertRootParagraph();P.innerText=B.value}f.focus()}}}RTE_DefaultConfig.plugin_insertemoji=RTE_Plugin_InsertEmoji;function RTE_Plugin_InsertEmoji(){function S(v){if(v.length>2)return v;if(v.length==1||v.charCodeAt(1)==65039||v.charCodeAt(1)==65039)return"&#"+v.charCodeAt(0)+";";var w=v.charCodeAt(0)-55356;if(w<0&&w>3)return v;var q=v.charCodeAt(1)-56324,B=w*1024+q+126980;return"&#x"+B.toString(16)+";"}var c=["smileys","people","animals","food","travel","activities","objects","symbols"],i=["\u{1F600}#grinning face|\u{1F603}#grinning face with big eyes|\u{1F604}#grinning face with smiling eyes|\u{1F601}#beaming face with smiling eyes|\u{1F606}#grinning squinting face|\u{1F605}#grinning face with sweat|\u{1F923}#rolling on the floor laughing|\u{1F602}#face with tears of joy|\u{1F642}#slightly smiling face|\u{1F643}#upside-down face|\u{1F609}#winking face|\u{1F60A}#smiling face with smiling eyes|\u{1F607}#smiling face with halo|\u{1F60D}#smiling face with heart-eyes|\u{1F929}#star-struck|\u{1F618}#face blowing a kiss|\u{1F617}#kissing face|\u{1F61A}#kissing face with closed eyes|\u{1F619}#kissing face with smiling eyes|\u{1F60B}#face savoring food|\u{1F61B}#face with tongue|\u{1F61C}#winking face with tongue|\u{1F92A}#zany face|\u{1F61D}#squinting face with tongue|\u{1F911}#money-mouth face|\u{1F917}#hugging face|\u{1F92D}#face with hand over mouth|\u{1F92B}#shushing face|\u{1F914}#thinking face|\u{1F910}#zipper-mouth face|\u{1F928}#face with raised eyebrow|\u{1F610}#neutral face|\u{1F611}#expressionless face|\u{1F636}#face without mouth|\u{1F60F}#smirking face|\u{1F612}#unamused face|\u{1F644}#face with rolling eyes|\u{1F62C}#grimacing face|\u{1F925}#lying face|\u{1F60C}#relieved face|\u{1F614}#pensive face|\u{1F62A}#sleepy face|\u{1F924}#drooling face|\u{1F634}#sleeping face|\u{1F637}#face with medical mask|\u{1F912}#face with thermometer|\u{1F915}#face with head-bandage|\u{1F922}#nauseated face|\u{1F92E}#face vomiting|\u{1F927}#sneezing face|\u{1F635}#dizzy face|\u{1F92F}#exploding head|\u{1F920}#cowboy hat face|\u{1F60E}#smiling face with sunglasses|\u{1F913}#nerd face|\u{1F9D0}#face with monocle|\u{1F615}#confused face|\u{1F61F}#worried face|\u{1F641}#slightly frowning face|\u2639\uFE0F#frowning face|\u{1F62E}#face with open mouth|\u{1F62F}#hushed face|\u{1F632}#astonished face|\u{1F633}#flushed face|\u{1F626}#frowning face with open mouth|\u{1F627}#anguished face|\u{1F628}#fearful face|\u{1F630}#anxious face with sweat|\u{1F625}#sad but relieved face|\u{1F622}#crying face|\u{1F62D}#loudly crying face|\u{1F631}#face screaming in fear|\u{1F616}#confounded face|\u{1F623}#persevering face|\u{1F61E}#disappointed face|\u{1F613}#downcast face with sweat|\u{1F629}#weary face|\u{1F62B}#tired face|\u{1F624}#face with steam from nose|\u{1F621}#pouting face|\u{1F620}#angry face|\u{1F92C}#face with symbols on mouth|\u{1F608}#smiling face with horns|\u{1F47F}#angry face with horns|\u{1F480}#skull|\u2620\uFE0F#skull and crossbones|\u{1F4A9}#pile of poo|\u{1F921}#clown face|\u{1F479}#ogre|\u{1F47A}#goblin|\u{1F47B}#ghost|\u{1F47D}#alien|\u{1F47E}#alien monster|\u{1F916}#robot|\u{1F63A}#grinning cat|\u{1F638}#grinning cat with smiling eyes|\u{1F639}#cat with tears of joy|\u{1F63B}#smiling cat with heart-eyes|\u{1F63C}#cat with wry smile|\u{1F63D}#kissing cat|\u{1F640}#weary cat|\u{1F63F}#crying cat|\u{1F63E}#pouting cat|\u{1F648}#see-no-evil monkey|\u{1F649}#hear-no-evil monkey|\u{1F64A}#speak-no-evil monkey|\u{1F48B}#kiss mark|\u{1F48C}#love letter|\u{1F498}#heart with arrow|\u{1F49D}#heart with ribbon|\u{1F496}#sparkling heart|\u{1F497}#growing heart|\u{1F493}#beating heart|\u{1F49E}#revolving hearts|\u{1F495}#two hearts|\u{1F49F}#heart decoration|\u2763\uFE0F#heart exclamation|\u{1F494}#broken heart|\u2764\uFE0F#red heart|\u{1F9E1}#orange heart|\u{1F49B}#yellow heart|\u{1F49A}#green heart|\u{1F499}#blue heart|\u{1F49C}#purple heart|\u{1F5A4}#black heart|\u{1F4AF}#hundred points|\u{1F4A2}#anger symbol|\u{1F4A5}#collision|\u{1F4AB}#dizzy|\u{1F4A6}#sweat droplets|\u{1F4A8}#dashing away|\u{1F4A3}#bomb|\u{1F4AC}#speech balloon|\u{1F4AD}#thought balloon|\u{1F4A4}#zzz","\u{1F44B}#waving hand|\u{1F91A}#raised back of hand|\u270B#raised hand|\u{1F596}#vulcan salute|\u{1F44C}#OK hand|\u270C\uFE0F#victory hand|\u{1F91E}#crossed fingers|\u{1F91F}#love-you gesture|\u{1F918}#sign of the horns|\u{1F919}#call me hand|\u{1F448}#backhand index pointing left|\u{1F449}#backhand index pointing right|\u{1F446}#backhand index pointing up|\u{1F595}#middle finger|\u{1F447}#backhand index pointing down|\u261D\uFE0F#index pointing up|\u{1F44D}#thumbs up|\u{1F44E}#thumbs down|\u270A#raised fist|\u{1F44A}#oncoming fist|\u{1F91B}#left-facing fist|\u{1F91C}#right-facing fist|\u{1F44F}#clapping hands|\u{1F64C}#raising hands|\u{1F450}#open hands|\u{1F932}#palms up together|\u{1F91D}#handshake|\u{1F64F}#folded hands|\u270D\uFE0F#writing hand|\u{1F485}#nail polish|\u{1F933}#selfie|\u{1F4AA}#flexed biceps|\u{1F442}#ear|\u{1F443}#nose|\u{1F9E0}#brain|\u{1F440}#eyes|\u{1F445}#tongue|\u{1F444}#mouth|\u{1F476}#baby|\u{1F9D2}#child|\u{1F466}#boy|\u{1F467}#girl|\u{1F9D1}#person|\u{1F471}#person with blond hair|\u{1F468}#man|\u{1F9D4}#man with beard|\u{1F469}#woman|\u{1F9D3}#older person|\u{1F474}#old man|\u{1F475}#old woman|\u{1F64D}#person frowning|\u{1F64E}#person pouting|\u{1F645}#person gesturing NO|\u{1F646}#person gesturing OK|\u{1F481}#person tipping hand|\u{1F64B}#person raising hand|\u{1F647}#person bowing|\u{1F926}#person facepalming|\u{1F937}#person shrugging|\u{1F46E}#police officer|\u{1F482}#guard|\u{1F477}#construction worker|\u{1F934}#prince|\u{1F478}#princess|\u{1F473}#person wearing turban|\u{1F472}#person with skullcap|\u{1F9D5}#woman with headscarf|\u{1F935}#person in tuxedo|\u{1F470}#person with veil|\u{1F930}#pregnant woman|\u{1F931}#breast-feeding|\u{1F47C}#baby angel|\u{1F385}#Santa Claus|\u{1F936}#Mrs. Claus|\u{1F9D9}#mage|\u{1F9DA}#fairy|\u{1F9DB}#vampire|\u{1F9DC}#merperson|\u{1F9DD}#elf|\u{1F9DE}#genie|\u{1F9DF}#zombie|\u{1F486}#person getting massage|\u{1F487}#person getting haircut|\u{1F6B6}#person walking|\u{1F3C3}#person running|\u{1F483}#woman dancing|\u{1F57A}#man dancing|\u{1F46F}#people with bunny ears|\u{1F9D6}#person in steamy room|\u{1F9D7}#person climbing|\u{1F93A}#person fencing|\u{1F3C7}#horse racing|\u26F7\uFE0F#skier|\u{1F3C2}#snowboarder|\u{1F3C4}#person surfing|\u{1F6A3}#person rowing boat|\u{1F3CA}#person swimming|\u26F9\uFE0F#person bouncing ball|\u{1F6B4}#person biking|\u{1F6B5}#person mountain biking|\u{1F938}#person cartwheeling|\u{1F93C}#people wrestling|\u{1F93D}#person playing water polo|\u{1F93E}#person playing handball|\u{1F939}#person juggling|\u{1F9D8}#person in lotus position|\u{1F6C0}#person taking bath|\u{1F6CC}#person in bed|\u{1F46D}#women holding hands|\u{1F46B}#woman and man holding hands|\u{1F46C}#men holding hands|\u{1F48F}#kiss|\u{1F491}#couple with heart|\u{1F46A}#family|\u{1F464}#bust in silhouette|\u{1F465}#busts in silhouette|\u{1F463}#footprints","\u{1F435}#monkey face|\u{1F412}#monkey|\u{1F98D}#gorilla|\u{1F436}#dog face|\u{1F415}#dog|\u{1F429}#poodle|\u{1F43A}#wolf|\u{1F98A}#fox|\u{1F431}#cat face|\u{1F408}#cat|\u{1F981}#lion|\u{1F42F}#tiger face|\u{1F405}#tiger|\u{1F406}#leopard|\u{1F434}#horse face|\u{1F40E}#horse|\u{1F984}#unicorn|\u{1F993}#zebra|\u{1F98C}#deer|\u{1F42E}#cow face|\u{1F402}#ox|\u{1F403}#water buffalo|\u{1F404}#cow|\u{1F437}#pig face|\u{1F416}#pig|\u{1F417}#boar|\u{1F43D}#pig nose|\u{1F40F}#ram|\u{1F411}#ewe|\u{1F410}#goat|\u{1F42A}#camel|\u{1F42B}#two-hump camel|\u{1F992}#giraffe|\u{1F418}#elephant|\u{1F98F}#rhinoceros|\u{1F42D}#mouse face|\u{1F401}#mouse|\u{1F400}#rat|\u{1F439}#hamster|\u{1F430}#rabbit face|\u{1F407}#rabbit|\u{1F994}#hedgehog|\u{1F987}#bat|\u{1F43B}#bear|\u{1F428}#koala|\u{1F43C}#panda|\u{1F43E}#paw prints|\u{1F983}#turkey|\u{1F414}#chicken|\u{1F413}#rooster|\u{1F423}#hatching chick|\u{1F424}#baby chick|\u{1F425}#front-facing baby chick|\u{1F426}#bird|\u{1F427}#penguin|\u{1F985}#eagle|\u{1F986}#duck|\u{1F989}#owl|\u{1F438}#frog|\u{1F40A}#crocodile|\u{1F422}#turtle|\u{1F98E}#lizard|\u{1F40D}#snake|\u{1F432}#dragon face|\u{1F409}#dragon|\u{1F995}#sauropod|\u{1F996}#T-Rex|\u{1F433}#spouting whale|\u{1F40B}#whale|\u{1F42C}#dolphin|\u{1F41F}#fish|\u{1F420}#tropical fish|\u{1F421}#blowfish|\u{1F988}#shark|\u{1F419}#octopus|\u{1F41A}#spiral shell|\u{1F40C}#snail|\u{1F98B}#butterfly|\u{1F41B}#bug|\u{1F41C}#ant|\u{1F41D}#honeybee|\u{1F41E}#lady beetle|\u{1F997}#cricket|\u{1F982}#scorpion|\u{1F490}#bouquet|\u{1F338}#cherry blossom|\u{1F4AE}#white flower|\u{1F339}#rose|\u{1F940}#wilted flower|\u{1F33A}#hibiscus|\u{1F33B}#sunflower|\u{1F33C}#blossom|\u{1F337}#tulip|\u{1F331}#seedling|\u{1F332}#evergreen tree|\u{1F333}#deciduous tree|\u{1F334}#palm tree|\u{1F335}#cactus|\u{1F33E}#sheaf of rice|\u{1F33F}#herb|\u2618\uFE0F#shamrock|\u{1F340}#four leaf clover|\u{1F341}#maple leaf|\u{1F342}#fallen leaf|\u{1F343}#leaf fluttering in wind","\u{1F347}#grapes|\u{1F348}#melon|\u{1F349}#watermelon|\u{1F34A}#tangerine|\u{1F34B}#lemon|\u{1F34C}#banana|\u{1F34D}#pineapple|\u{1F34E}#red apple|\u{1F34F}#green apple|\u{1F350}#pear|\u{1F351}#peach|\u{1F352}#cherries|\u{1F353}#strawberry|\u{1F95D}#kiwi fruit|\u{1F345}#tomato|\u{1F965}#coconut|\u{1F951}#avocado|\u{1F346}#eggplant|\u{1F954}#potato|\u{1F955}#carrot|\u{1F33D}#ear of corn|\u{1F952}#cucumber|\u{1F966}#broccoli|\u{1F344}#mushroom|\u{1F95C}#peanuts|\u{1F330}#chestnut|\u{1F35E}#bread|\u{1F950}#croissant|\u{1F956}#baguette bread|\u{1F968}#pretzel|\u{1F95E}#pancakes|\u{1F9C0}#cheese wedge|\u{1F356}#meat on bone|\u{1F357}#poultry leg|\u{1F969}#cut of meat|\u{1F953}#bacon|\u{1F354}#hamburger|\u{1F35F}#french fries|\u{1F355}#pizza|\u{1F32D}#hot dog|\u{1F96A}#sandwich|\u{1F32E}#taco|\u{1F32F}#burrito|\u{1F959}#stuffed flatbread|\u{1F95A}#egg|\u{1F373}#cooking|\u{1F958}#shallow pan of food|\u{1F372}#pot of food|\u{1F963}#bowl with spoon|\u{1F957}#green salad|\u{1F37F}#popcorn|\u{1F96B}#canned food|\u{1F371}#bento box|\u{1F358}#rice cracker|\u{1F359}#rice ball|\u{1F35A}#cooked rice|\u{1F35B}#curry rice|\u{1F35C}#steaming bowl|\u{1F35D}#spaghetti|\u{1F360}#roasted sweet potato|\u{1F362}#oden|\u{1F363}#sushi|\u{1F364}#fried shrimp|\u{1F365}#fish cake with swirl|\u{1F361}#dango|\u{1F95F}#dumpling|\u{1F960}#fortune cookie|\u{1F961}#takeout box|\u{1F980}#crab|\u{1F990}#shrimp|\u{1F991}#squid|\u{1F366}#soft ice cream|\u{1F367}#shaved ice|\u{1F368}#ice cream|\u{1F369}#doughnut|\u{1F36A}#cookie|\u{1F382}#birthday cake|\u{1F370}#shortcake|\u{1F967}#pie|\u{1F36B}#chocolate bar|\u{1F36C}#candy|\u{1F36D}#lollipop|\u{1F36E}#custard|\u{1F36F}#honey pot|\u{1F37C}#baby bottle|\u{1F95B}#glass of milk|\u2615#hot beverage|\u{1F375}#teacup without handle|\u{1F376}#sake|\u{1F37E}#bottle with popping cork|\u{1F377}#wine glass|\u{1F378}#cocktail glass|\u{1F379}#tropical drink|\u{1F37A}#beer mug|\u{1F37B}#clinking beer mugs|\u{1F942}#clinking glasses|\u{1F943}#tumbler glass|\u{1F964}#cup with straw|\u{1F962}#chopsticks|\u{1F374}#fork and knife|\u{1F944}#spoon|\u{1F52A}#kitchen knife|\u{1F3FA}#amphora","\u{1F30D}#globe showing Europe-Africa|\u{1F30E}#globe showing Americas|\u{1F30F}#globe showing Asia-Australia|\u{1F310}#globe with meridians|\u{1F5FE}#map of Japan|\u26F0\uFE0F#mountain|\u{1F30B}#volcano|\u{1F5FB}#mount fuji|\u{1F3E0}#house|\u{1F3E1}#house with garden|\u{1F3E2}#office building|\u{1F3E3}#Japanese post office|\u{1F3E4}#post office|\u{1F3E5}#hospital|\u{1F3E6}#bank|\u{1F3E8}#hotel|\u{1F3E9}#love hotel|\u{1F3EA}#convenience store|\u{1F3EB}#school|\u{1F3EC}#department store|\u{1F3ED}#factory|\u{1F3EF}#Japanese castle|\u{1F3F0}#castle|\u{1F492}#wedding|\u{1F5FC}#Tokyo tower|\u{1F5FD}#Statue of Liberty|\u26EA#church|\u{1F54C}#mosque|\u{1F54D}#synagogue|\u26E9\uFE0F#shinto shrine|\u{1F54B}#kaaba|\u26F2#fountain|\u26FA#tent|\u{1F301}#foggy|\u{1F303}#night with stars|\u{1F304}#sunrise over mountains|\u{1F305}#sunrise|\u{1F306}#cityscape at dusk|\u{1F307}#sunset|\u{1F309}#bridge at night|\u2668\uFE0F#hot springs|\u{1F3A0}#carousel horse|\u{1F3A1}#ferris wheel|\u{1F3A2}#roller coaster|\u{1F488}#barber pole|\u{1F3AA}#circus tent|\u{1F682}#locomotive|\u{1F683}#railway car|\u{1F684}#high-speed train|\u{1F685}#bullet train|\u{1F686}#train|\u{1F687}#metro|\u{1F688}#light rail|\u{1F689}#station|\u{1F68A}#tram|\u{1F69D}#monorail|\u{1F69E}#mountain railway|\u{1F68B}#tram car|\u{1F68C}#bus|\u{1F68D}#oncoming bus|\u{1F68E}#trolleybus|\u{1F690}#minibus|\u{1F691}#ambulance|\u{1F692}#fire engine|\u{1F693}#police car|\u{1F694}#oncoming police car|\u{1F695}#taxi|\u{1F696}#oncoming taxi|\u{1F697}#automobile|\u{1F698}#oncoming automobile|\u{1F699}#sport utility vehicle|\u{1F69A}#delivery truck|\u{1F69B}#articulated lorry|\u{1F69C}#tractor|\u{1F6F5}#motor scooter|\u{1F6B2}#bicycle|\u{1F6F4}#kick scooter|\u{1F68F}#bus stop|\u26FD#fuel pump|\u{1F6A8}#police car light|\u{1F6A5}#horizontal traffic light|\u{1F6A6}#vertical traffic light|\u{1F6D1}#stop sign|\u{1F6A7}#construction|\u2693#anchor|\u26F5#sailboat|\u{1F6F6}#canoe|\u{1F6A4}#speedboat|\u26F4\uFE0F#ferry|\u{1F6A2}#ship|\u2708\uFE0F#airplane|\u{1F6EB}#airplane departure|\u{1F6EC}#airplane arrival|\u{1F4BA}#seat|\u{1F681}#helicopter|\u{1F69F}#suspension railway|\u{1F6A0}#mountain cableway|\u{1F6A1}#aerial tramway|\u{1F680}#rocket|\u{1F6F8}#flying saucer|\u231B#hourglass done|\u23F3#hourglass not done|\u231A#watch|\u23F0#alarm clock|\u23F1\uFE0F#stopwatch|\u23F2\uFE0F#timer clock|\u{1F55B}#twelve o\u2019clock|\u{1F567}#twelve-thirty|\u{1F550}#one o\u2019clock|\u{1F55C}#one-thirty|\u{1F551}#two o\u2019clock|\u{1F55D}#two-thirty|\u{1F552}#three o\u2019clock|\u{1F55E}#three-thirty|\u{1F553}#four o\u2019clock|\u{1F55F}#four-thirty|\u{1F554}#five o\u2019clock|\u{1F560}#five-thirty|\u{1F555}#six o\u2019clock|\u{1F561}#six-thirty|\u{1F556}#seven o\u2019clock|\u{1F562}#seven-thirty|\u{1F557}#eight o\u2019clock|\u{1F563}#eight-thirty|\u{1F558}#nine o\u2019clock|\u{1F564}#nine-thirty|\u{1F559}#ten o\u2019clock|\u{1F565}#ten-thirty|\u{1F55A}#eleven o\u2019clock|\u{1F566}#eleven-thirty|\u{1F311}#new moon|\u{1F312}#waxing crescent moon|\u{1F313}#first quarter moon|\u{1F314}#waxing gibbous moon|\u{1F315}#full moon|\u{1F316}#waning gibbous moon|\u{1F317}#last quarter moon|\u{1F318}#waning crescent moon|\u{1F319}#crescent moon|\u{1F31A}#new moon face|\u{1F31B}#first quarter moon face|\u{1F31C}#last quarter moon face|\u2600\uFE0F#sun|\u{1F31D}#full moon face|\u{1F31E}#sun with face|\u2B50#star|\u{1F31F}#glowing star|\u{1F320}#shooting star|\u{1F30C}#milky way|\u2601\uFE0F#cloud|\u26C5#sun behind cloud|\u26C8\uFE0F#cloud with lightning and rain|\u{1F300}#cyclone|\u{1F308}#rainbow|\u{1F302}#closed umbrella|\u2602\uFE0F#umbrella|\u2614#umbrella with rain drops|\u26F1\uFE0F#umbrella on ground|\u26A1#high voltage|\u2744\uFE0F#snowflake|\u2603\uFE0F#snowman|\u26C4#snowman without snow|\u2604\uFE0F#comet|\u{1F525}#fire|\u{1F4A7}#droplet|\u{1F30A}#water wave","\u{1F383}#jack-o-lantern|\u{1F384}#Christmas tree|\u{1F386}#fireworks|\u{1F387}#sparkler|\u2728#sparkles|\u{1F388}#balloon|\u{1F389}#party popper|\u{1F38A}#confetti ball|\u{1F38B}#tanabata tree|\u{1F38D}#pine decoration|\u{1F38E}#Japanese dolls|\u{1F38F}#carp streamer|\u{1F390}#wind chime|\u{1F391}#moon viewing ceremony|\u{1F380}#ribbon|\u{1F381}#wrapped gift|\u{1F3AB}#ticket|\u{1F3C6}#trophy|\u{1F3C5}#sports medal|\u{1F947}#1st place medal|\u{1F948}#2nd place medal|\u{1F949}#3rd place medal|\u26BD#soccer ball|\u26BE#baseball|\u{1F3C0}#basketball|\u{1F3D0}#volleyball|\u{1F3C8}#american football|\u{1F3C9}#rugby football|\u{1F3BE}#tennis|\u{1F3B3}#bowling|\u{1F3CF}#cricket game|\u{1F3D1}#field hockey|\u{1F3D2}#ice hockey|\u{1F3D3}#ping pong|\u{1F3F8}#badminton|\u{1F94A}#boxing glove|\u{1F94B}#martial arts uniform|\u{1F945}#goal net|\u26F3#flag in hole|\u26F8\uFE0F#ice skate|\u{1F3A3}#fishing pole|\u{1F3BD}#running shirt|\u{1F3BF}#skis|\u{1F6F7}#sled|\u{1F94C}#curling stone|\u{1F3AF}#direct hit|\u{1F3B1}#pool 8 ball|\u{1F52E}#crystal ball|\u{1F3AE}#video game|\u{1F3B0}#slot machine|\u{1F3B2}#game die|\u2660\uFE0F#spade suit|\u2665\uFE0F#heart suit|\u2666\uFE0F#diamond suit|\u2663\uFE0F#club suit|\u{1F0CF}#joker|\u{1F004}#mahjong red dragon|\u{1F3B4}#flower playing cards|\u{1F3AD}#performing arts|\u{1F3A8}#artist palette","\u{1F453}#glasses|\u{1F454}#necktie|\u{1F455}#t-shirt|\u{1F456}#jeans|\u{1F9E3}#scarf|\u{1F9E4}#gloves|\u{1F9E5}#coat|\u{1F9E6}#socks|\u{1F457}#dress|\u{1F458}#kimono|\u{1F459}#bikini|\u{1F45A}#woman\u2019s clothes|\u{1F45B}#purse|\u{1F45C}#handbag|\u{1F45D}#clutch bag|\u{1F392}#backpack|\u{1F45E}#man\u2019s shoe|\u{1F45F}#running shoe|\u{1F460}#high-heeled shoe|\u{1F461}#woman\u2019s sandal|\u{1F462}#woman\u2019s boot|\u{1F451}#crown|\u{1F452}#woman\u2019s hat|\u{1F3A9}#top hat|\u{1F393}#graduation cap|\u{1F9E2}#billed cap|\u26D1\uFE0F#rescue worker\u2019s helmet|\u{1F4FF}#prayer beads|\u{1F484}#lipstick|\u{1F48D}#ring|\u{1F48E}#gem stone|\u{1F507}#muted speaker|\u{1F508}#speaker low volume|\u{1F509}#speaker medium volume|\u{1F50A}#speaker high volume|\u{1F4E2}#loudspeaker|\u{1F4E3}#megaphone|\u{1F4EF}#postal horn|\u{1F514}#bell|\u{1F515}#bell with slash|\u{1F3BC}#musical score|\u{1F3B5}#musical note|\u{1F3B6}#musical notes|\u{1F3A4}#microphone|\u{1F3A7}#headphone|\u{1F4FB}#radio|\u{1F3B7}#saxophone|\u{1F3B8}#guitar|\u{1F3B9}#musical keyboard|\u{1F3BA}#trumpet|\u{1F3BB}#violin|\u{1F941}#drum|\u{1F4F1}#mobile phone|\u{1F4F2}#mobile phone with arrow|\u260E\uFE0F#telephone|\u{1F4DE}#telephone receiver|\u{1F4DF}#pager|\u{1F4E0}#fax machine|\u{1F50B}#battery|\u{1F50C}#electric plug|\u{1F4BB}#laptop|\u2328\uFE0F#keyboard|\u{1F4BD}#computer disk|\u{1F4BE}#floppy disk|\u{1F4BF}#optical disk|\u{1F4C0}#dvd|\u{1F3A5}#movie camera|\u{1F3AC}#clapper board|\u{1F4FA}#television|\u{1F4F7}#camera|\u{1F4F8}#camera with flash|\u{1F4F9}#video camera|\u{1F4FC}#videocassette|\u{1F50D}#magnifying glass tilted left|\u{1F50E}#magnifying glass tilted right|\u{1F4A1}#light bulb|\u{1F526}#flashlight|\u{1F3EE}#red paper lantern|\u{1F4D4}#notebook with decorative cover|\u{1F4D5}#closed book|\u{1F4D6}#open book|\u{1F4D7}#green book|\u{1F4D8}#blue book|\u{1F4D9}#orange book|\u{1F4DA}#books|\u{1F4D3}#notebook|\u{1F4D2}#ledger|\u{1F4C3}#page with curl|\u{1F4DC}#scroll|\u{1F4C4}#page facing up|\u{1F4F0}#newspaper|\u{1F4D1}#bookmark tabs|\u{1F516}#bookmark|\u{1F4B0}#money bag|\u{1F4B4}#yen banknote|\u{1F4B5}#dollar banknote|\u{1F4B6}#euro banknote|\u{1F4B7}#pound banknote|\u{1F4B8}#money with wings|\u{1F4B3}#credit card|\u{1F4B9}#chart increasing with yen|\u2709\uFE0F#envelope|\u{1F4E7}#e-mail|\u{1F4E8}#incoming envelope|\u{1F4E9}#envelope with arrow|\u{1F4E4}#outbox tray|\u{1F4E5}#inbox tray|\u{1F4E6}#package|\u{1F4EB}#closed mailbox with raised flag|\u{1F4EA}#closed mailbox with lowered flag|\u{1F4EC}#open mailbox with raised flag|\u{1F4ED}#open mailbox with lowered flag|\u{1F4EE}#postbox|\u270F\uFE0F#pencil|\u2712\uFE0F#black nib|\u{1F4DD}#memo|\u{1F4BC}#briefcase|\u{1F4C1}#file folder|\u{1F4C2}#open file folder|\u{1F4C5}#calendar|\u{1F4C6}#tear-off calendar|\u{1F4C7}#card index|\u{1F4C8}#chart increasing|\u{1F4C9}#chart decreasing|\u{1F4CA}#bar chart|\u{1F4CB}#clipboard|\u{1F4CC}#pushpin|\u{1F4CD}#round pushpin|\u{1F4CE}#paperclip|\u{1F4CF}#straight ruler|\u{1F4D0}#triangular ruler|\u2702\uFE0F#scissors|\u{1F512}#locked|\u{1F513}#unlocked|\u{1F50F}#locked with pen|\u{1F510}#locked with key|\u{1F511}#key|\u{1F528}#hammer|\u26CF\uFE0F#pick|\u2692\uFE0F#hammer and pick|\u2694\uFE0F#crossed swords|\u{1F52B}#pistol|\u{1F3F9}#bow and arrow|\u{1F527}#wrench|\u{1F529}#nut and bolt|\u2699\uFE0F#gear|\u2696\uFE0F#balance scale|\u{1F517}#link|\u26D3\uFE0F#chains|\u2697\uFE0F#alembic|\u{1F52C}#microscope|\u{1F52D}#telescope|\u{1F4E1}#satellite antenna|\u{1F489}#syringe|\u{1F48A}#pill|\u{1F6AA}#door|\u{1F6BD}#toilet|\u{1F6BF}#shower|\u{1F6C1}#bathtub|\u{1F6D2}#shopping cart|\u{1F6AC}#cigarette|\u26B0\uFE0F#coffin|\u26B1\uFE0F#funeral urn|\u{1F5FF}#moai","\u{1F3E7}#ATM sign|\u{1F6AE}#litter in bin sign|\u{1F6B0}#potable water|\u267F#wheelchair symbol|\u{1F6B9}#men\u2019s room|\u{1F6BA}#women\u2019s room|\u{1F6BB}#restroom|\u{1F6BC}#baby symbol|\u{1F6BE}#water closet|\u{1F6C2}#passport control|\u{1F6C3}#customs|\u{1F6C4}#baggage claim|\u{1F6C5}#left luggage|\u26A0\uFE0F#warning|\u{1F6B8}#children crossing|\u26D4#no entry|\u{1F6AB}#prohibited|\u{1F6B3}#no bicycles|\u{1F6AD}#no smoking|\u{1F6AF}#no littering|\u{1F6B1}#non-potable water|\u{1F6B7}#no pedestrians|\u{1F4F5}#no mobile phones|\u{1F51E}#no one under eighteen|\u2622\uFE0F#radioactive|\u2623\uFE0F#biohazard|\u2B06\uFE0F#up arrow|\u2197\uFE0F#up-right arrow|\u27A1\uFE0F#right arrow|\u2198\uFE0F#down-right arrow|\u2B07\uFE0F#down arrow|\u2199\uFE0F#down-left arrow|\u2B05\uFE0F#left arrow|\u2196\uFE0F#up-left arrow|\u2195\uFE0F#up-down arrow|\u2194\uFE0F#left-right arrow|\u21A9\uFE0F#right arrow curving left|\u21AA\uFE0F#left arrow curving right|\u2934\uFE0F#right arrow curving up|\u2935\uFE0F#right arrow curving down|\u{1F503}#clockwise vertical arrows|\u{1F504}#counterclockwise arrows button|\u{1F519}#BACK arrow|\u{1F51A}#END arrow|\u{1F51B}#ON! arrow|\u{1F51C}#SOON arrow|\u{1F51D}#TOP arrow|\u{1F6D0}#place of worship|\u269B\uFE0F#atom symbol|\u2721\uFE0F#star of David|\u2638\uFE0F#wheel of dharma|\u262F\uFE0F#yin yang|\u271D\uFE0F#latin cross|\u2626\uFE0F#orthodox cross|\u262A\uFE0F#star and crescent|\u262E\uFE0F#peace symbol|\u{1F54E}#menorah|\u{1F52F}#dotted six-pointed star|\u2648#Aries|\u2649#Taurus|\u264A#Gemini|\u264B#Cancer|\u264C#Leo|\u264D#Virgo|\u264E#Libra|\u264F#Scorpio|\u2650#Sagittarius|\u2651#Capricorn|\u2652#Aquarius|\u2653#Pisces|\u26CE#Ophiuchus|\u{1F500}#shuffle tracks button|\u{1F501}#repeat button|\u{1F502}#repeat single button|\u25B6\uFE0F#play button|\u23E9#fast-forward button|\u23ED\uFE0F#next track button|\u23EF\uFE0F#play or pause button|\u25C0\uFE0F#reverse button|\u23EA#fast reverse button|\u23EE\uFE0F#last track button|\u{1F53C}#upwards button|\u23EB#fast up button|\u{1F53D}#downwards button|\u23EC#fast down button|\u23F8\uFE0F#pause button|\u23F9\uFE0F#stop button|\u23FA\uFE0F#record button|\u23CF\uFE0F#eject button|\u{1F3A6}#cinema|\u{1F505}#dim button|\u{1F506}#bright button|\u{1F4F6}#antenna bars|\u{1F4F3}#vibration mode|\u{1F4F4}#mobile phone off|\u2640\uFE0F#female sign|\u2642\uFE0F#male sign|\u2716\uFE0F#multiply|\u2795#plus|\u2796#minus|\u2797#divide|\u203C\uFE0F#double exclamation mark|\u2049\uFE0F#exclamation question mark|\u2753#question mark|\u2754#white question mark|\u2755#white exclamation mark|\u2757#exclamation mark|\u3030\uFE0F#wavy dash|\u{1F4B1}#currency exchange|\u{1F4B2}#heavy dollar sign|\u2695\uFE0F#medical symbol|\u267B\uFE0F#recycling symbol|\u269C\uFE0F#fleur-de-lis|\u{1F531}#trident emblem|\u{1F4DB}#name badge|\u{1F530}#Japanese symbol for beginner|\u2B55#hollow red circle|\u2705#check mark button|\u2611\uFE0F#check box with check|\u2714\uFE0F#check mark|\u274C#cross mark|\u274E#cross mark button|\u27B0#curly loop|\u27BF#double curly loop|\u303D\uFE0F#part alternation mark|\u2733\uFE0F#eight-spoked asterisk|\u2734\uFE0F#eight-pointed star|\u2747\uFE0F#sparkle|\xA9\uFE0F#copyright|\xAE\uFE0F#registered|\u2122\uFE0F#trade mark|\u{1F51F}#keycap: 10|\u{1F520}#input latin uppercase|\u{1F521}#input latin lowercase|\u{1F522}#input numbers|\u{1F523}#input symbols|\u{1F524}#input latin letters|\u{1F18E}#AB button (blood type)|\u{1F191}#CL button|\u{1F192}#COOL button|\u{1F193}#FREE button|\u2139\uFE0F#information|\u{1F194}#ID button|\u24C2\uFE0F#circled M|\u{1F195}#NEW button|\u{1F196}#NG button|\u{1F197}#OK button|\u{1F198}#SOS button|\u{1F199}#UP! button|\u{1F19A}#VS button|\u{1F201}#Japanese \u201Chere\u201D button|\u{1F236}#Japanese \u201Cnot free of charge\u201D button|\u{1F22F}#Japanese \u201Creserved\u201D button|\u{1F250}#Japanese \u201Cbargain\u201D button|\u{1F239}#Japanese \u201Cdiscount\u201D button|\u{1F21A}#Japanese \u201Cfree of charge\u201D button|\u{1F232}#Japanese \u201Cprohibited\u201D button|\u{1F251}#Japanese \u201Cacceptable\u201D button|\u{1F238}#Japanese \u201Capplication\u201D button|\u{1F234}#Japanese \u201Cpassing grade\u201D button|\u{1F233}#Japanese \u201Cvacancy\u201D button|\u3297\uFE0F#Japanese \u201Ccongratulations\u201D button|\u3299\uFE0F#Japanese \u201Csecret\u201D button|\u{1F23A}#Japanese \u201Copen for business\u201D button|\u{1F235}#Japanese \u201Cno vacancy\u201D button|\u{1F534}#red circle|\u{1F535}#blue circle|\u26AB#black circle|\u26AA#white circle|\u2B1B#black large square|\u2B1C#white large square|\u25FC\uFE0F#black medium square|\u25FB\uFE0F#white medium square|\u25FE#black medium-small square|\u25FD#white medium-small square|\u25AA\uFE0F#black small square|\u25AB\uFE0F#white small square|\u{1F536}#large orange diamond|\u{1F537}#large blue diamond|\u{1F538}#small orange diamond|\u{1F539}#small blue diamond|\u{1F53A}#red triangle pointed up|\u{1F53B}#red triangle pointed down|\u{1F4A0}#diamond with a dot|\u{1F518}#radio button|\u{1F533}#white square button|\u{1F532}#black square button"],f=null;function N(){if(!f){f=[];for(var v=0;v<c.length;v++){for(var w=[],q={index:v,name:c[v],items:w},B=i[v].split("|"),H=0;H<B.length;H++){var g=B[H],b=g.split("#");w.push({emoji:b[0],keyword:b[1]})}f.push(q)}}}var A=this,E,C;A.PluginName="InsertEmoji",A.InitConfig=function(v){E=v},A.InitEditor=function(v){C=v,C.toolbarFactoryMap.insertemoji=function(w){return C.createToolbarItemDropDownPanel(w,function(q){N(),q.style.width="360px",q.style.height="420px",q.style.display="flex",q.style.flexDirection="column",q.onclick=function(j){if(j.target.nodeName=="GSPAN"){C.closeCurrentPopup();var p=j.target.getAttribute("htmlcode");C.insertHTML(p),C.collapse(!1),C.focus()}};var B=null,H=null;function g(){B!=null&&(B.style.backgroundColor="",B=null)}function b(){g(),B=H,B.style.backgroundColor="#e6e6e6",H=null}var D=0;q.onmouseover=function(j){for(var p=j.target;p!=q;p=p.parentNode)if(p.nodeName=="GITEM"){if(p==H)return;H=p,clearTimeout(D),D=setTimeout(b,10);return}},q.onmouseout=function(){clearTimeout(D),D=setTimeout(g,10)};var P=o(q,"label","margin:5px;position:relative;");P.setAttribute("id","emojis_searchbar");var L=o(P,"input","width:100%;padding:5px 20px;border:solid 1px #ccc;border-radius:5px;");L.setAttribute("placeholder",C.getLangText("searchemojis"));var I=0;L.onchange=L.onkeyup=L.onkeypress=L.onpaste=function(){clearTimeout(I),I=setTimeout(y,100)};function u(j){var p=[];p.push('<div style="padding:3px;margin-top:5px;color:darkblue;">'+j.name[0].toUpperCase()+j.name.substring(1)+"</div>"),p.push('<div style="display:flex;flex-direction:row;flex-wrap:wrap;">');for(var k=0;k<j.items.length;k++){var h=j.items[k],x=S(h.emoji);p.push('<gitem class="rte-flex-column-center" style="width:32px;height:32px;margin:2px"><gspan htmlcode="'+x+'" title="'+h.emoji+" "+(h.keyword||"").replace(/"/g,"")+'">'+x+"</gspan></gitem>")}return p.push("</div>"),p.join("")}function y(){var j=L.value.trim().toLowerCase();if(!j){O.style.display=T.style.display="",K.style.display="none";return}O.style.display=T.style.display="none",K.style.display="flex";for(var p=[],k=0,h=0;h<f.length;h++)for(var x=f[h],z=0;z<x.items.length;z++){var J=x.items[z];if(!(!J.keyword||J.keyword.indexOf(j)==-1)){k++;var ee=S(J.emoji);p.push('<gitem class="rte-flex-column-center" style="width:32px;height:32px;margin:2px"><gspan htmlcode="'+ee+'" title="'+J.emoji+" "+(J.keyword||"").replace(/"/g,"")+'">'+ee+"</gspan></gitem>")}}K.innerHTML='<div style="width:100%;padding:3px;margin-top:5px;color:darkblue;text-align:center;">'+k+" items</div>"+p.join("")}q.setAttribute("id","emoji-picker");var O=o(q,"div"),K=o(q,"div","display:none;flex-direction:row;flex-wrap:wrap;overflow-y:scroll;padding-bottom:55px"),T=o(q,"div","overflow-y:scroll;padding-bottom:55px;flex:999"),V=0;function Z(j){V=j,T.innerHTML=u(f[j]),T.scrollTop=0;for(var p=0;p<G.length;p++)G[p].className=p===j?"rte-ui-active":""}var M=o(O,"rte-tabui");M.setAttribute("id","emoji-picker");for(var X=o(M,"rte-tabui-toolbar"),G=[],Y=0;Y<f.length;Y++)(function(j){var p=o(X,"rte-tabui-toolbar-button","width:32px;text-align:center;margin:4px");p.setAttribute("title",j.name),p.innerHTML=j.items[0].emoji,p.onclick=function(){Z(j.index)},G.push(p)})(f[Y]);Z(0),L.focus()})}};function o(v,w,q,B){var H=v.ownerDocument.createElement(w);return q&&(H.style.cssText=q),B&&(H.className=B),v.appendChild(H),H}}RTE_DefaultConfig.plugin_insertgallery=RTE_Plugin_InsertGallery;function RTE_Plugin_InsertGallery(){var S=this,c,i;S.PluginName="InsertGallery",S.InitConfig=function(v){c=v,c.galleryImages||(c.galleryImages=[])},S.InitEditor=function(v){i=v,i.attachEvent("exec_command_insertgallery",function(w){w.returnValue=!0,S.DoInsertGallery()})};function f(v,w,q,B){var H=v.ownerDocument.createElement(w);return q&&(H.style.cssText=q),B&&(H.className=B),v.appendChild(H),H}function N(v){for(;v.firstChild;)v.removeChild(v.firstChild)}function A(v){var w=String(v||"").split("#")[0].split("?")[0],q=w.lastIndexOf("/"),B=q>=0?w.substring(q+1):w;try{B=decodeURIComponent(B)}catch{}return B||"Image"}function E(v){return v.meta?v.meta:v.alt?v.alt:v.url}function C(v){var w=null;if(typeof v=="string")w={url:v,thumbnail:v,name:A(v)};else if(v instanceof Array)w={url:v[0],thumbnail:v[0],name:v[1]||A(v[0]),meta:v[2]||""};else if(v&&typeof v=="object"){var q=v.url||v.src||v.href;if(!q)return null;w={url:q,thumbnail:v.thumbnail||v.thumb||v.preview||q,name:v.name||v.text||v.title||A(q),meta:v.meta||v.description||v.alt||""}}return!w||!w.url?null:(w.thumbnail||(w.thumbnail=w.url),w.name||(w.name=A(w.url)),w)}function o(v,w,q,B){var H=[],g=window.rte_file_upload_handler,b;for(b=0;b<v.length;b++)H.push(v[b]);if(!H.length){q();return}if(typeof g!="function"){B&&B("Upload handler is not configured."),q();return}var D=0;function P(){if(D>=H.length){q();return}var L=H[D];g(L,function(I,u){I?w(I,L,D,H):B&&B(u||"Upload failed for "+L.name,L),D++,P()},D,H)}P()}S.DoInsertGallery=function(){var v=i.createDialog(i.getLangText("insertgallerytitle")||"Image gallery","rte-dialog-insertgallery"),w=typeof v.close=="function"?function(){v.close()}:function(){i.closeCurrentPopup()},q=f(v,"div","","rte-gallery-browser"),B=f(q,"div","","rte-dialog-browser-header"),H=f(B,"div","","rte-dialog-browser-copy");H.innerText="Browse uploaded assets, filter by name, and insert the selected image into the editor.";var g=f(q,"div","","rte-gallery-browser-toolbar"),b=f(g,"div","","rte-gallery-browser-path");b.innerText="/";var D=f(g,"div","","rte-gallery-browser-type");D.innerText="Image Files";var P=f(g,"button","","rte-gallery-browser-button");P.type="button",P.innerText="Upload";var L=f(g,"button","","rte-gallery-browser-button");L.type="button",L.innerText="Refresh";var I=f(g,"input","","rte-gallery-browser-search");I.type="search",I.placeholder="Search images",I.setAttribute("aria-label","Search images");var u=f(g,"input","display:none;");u.type="file",u.accept="image/*,.jpg,.jpeg,.png,.gif,.bmp,.webp,.svg",u.multiple=!0;var y=f(q,"div","","rte-gallery-browser-status");y.setAttribute("role","status"),y.setAttribute("aria-live","polite");var O=f(q,"div","","rte-gallery-browser-surface"),K=f(O,"div","","rte-gallery-browser-grid");K.setAttribute("role","listbox"),K.setAttribute("aria-label","Available images");var T=f(O,"div","","rte-gallery-browser-empty");T.innerText="No images match this search. Upload a file or adjust the filter.";var V=f(q,"div","","rte-gallery-browser-footer"),Z=f(V,"div","","rte-gallery-browser-footer-text");Z.innerText="Choose an image to enable insert.";var M=f(V,"button","","rte-gallery-browser-button");M.type="button",M.innerText="Cancel";var X=f(V,"button","","rte-gallery-browser-button rte-gallery-browser-button-primary");X.type="button",X.innerText="Insert",X.disabled=!0;var G="";function Y(){var x=[],z=c.galleryImages||[],J;for(J=0;J<z.length;J++){var ee=C(z[J]);ee&&x.push(ee)}return x}function j(){var x=I.value.replace(/^\s+|\s+$/g,"").toLowerCase(),z=Y();return x?z.filter(function(J){return J.name&&J.name.toLowerCase().indexOf(x)>=0||J.meta&&J.meta.toLowerCase().indexOf(x)>=0||J.url&&J.url.toLowerCase().indexOf(x)>=0}):z}function p(x){var z="",J;for(J=0;J<x.length;J++)if(x[J].url===G){z=x[J].name;break}y.innerText=x.length+" item"+(x.length===1?"":"s")+" available."+(z?" "+z+" selected.":" No image selected."),Z.innerText=z?"Ready to insert "+z+".":"Choose an image to enable insert.",X.disabled=!z}function k(){G&&(i.insertImageByUrl(G),w(),i.focus())}function h(){N(K);var x=j(),z;for(T.style.display=x.length?"none":"block",z=0;z<x.length;z++)(function(ee){var ue=f(K,"button","","rte-gallery-browser-card");ue.type="button",ue.setAttribute("role","option"),ue.setAttribute("aria-selected",ee.url===G?"true":"false"),ee.url===G&&ue.classList.add("is-selected");var ve=f(ue,"div","","rte-gallery-browser-selection");ve.innerText=ee.url===G?"Selected":"";var re=f(ue,"div","","rte-gallery-browser-thumbnail"),U=f(re,"img","","rte-gallery-browser-thumbnail-image");U.src=ee.thumbnail,U.alt=ee.name;var F=f(ue,"div","","rte-gallery-browser-name");F.innerText=ee.name;var $=f(ue,"div","","rte-gallery-browser-meta");$.innerText=E(ee),ue.onclick=function(){G=ee.url,h()},ue.ondblclick=function(){G=ee.url,k()}})(x[z]);if(G){var J=!1;for(z=0;z<x.length;z++)if(x[z].url===G){J=!0;break}J||(G="")}p(x)}P.onclick=function(){u.click()},u.onchange=function(){var x="";y.innerText="Uploading images...",o(u.files,function(z){x=z,c.galleryImages.unshift(z)},function(){x&&(G=x),u.value="",h()},function(z){y.innerText=z||"Upload failed."})},L.onclick=h,I.oninput=h,M.onclick=w,X.onclick=k,h(),I.focus()}}RTE_DefaultConfig.plugin_inserttemplate=RTE_Plugin_InsertTemplate;function RTE_Plugin_InsertTemplate(){var S=this,c,i;S.PluginName="InsertTemplate",S.InitConfig=function(o){c=o,c.htmlTemplates||(c.htmlTemplates=[])},S.InitEditor=function(o){i=o,i.attachEvent("exec_command_inserttemplate",function(v){v.returnValue=!0,S.DoInsertTemplate()})};function f(o,v,w,q){var B=o.ownerDocument.createElement(v);return w&&(B.style.cssText=w),q&&(B.className=q),o.appendChild(B),B}function N(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function A(o){var v=document.createElement("div");return v.innerHTML=o||"",v.innerText||v.textContent||""}function E(o,v){return o instanceof Array?{id:"template-"+v,title:o[0]||"Template "+(v+1),html:o[1]||"",meta:o[2]||""}:o&&typeof o=="object"?{id:o.id||"template-"+v,title:o.title||o.name||o.text||"Template "+(v+1),html:o.html||o.content||"",meta:o.meta||o.description||""}:typeof o=="string"?{id:"template-"+v,title:"Template "+(v+1),html:o,meta:""}:null}function C(o,v){var w=206,q=166,B=Math.max(v.scrollWidth,1),H=Math.max(v.scrollHeight,1),g=Math.min(1,w/B,q/H);v.style.transformOrigin="top left",v.style.transform="scale("+g+")",v.style.width=B+"px",v.style.height=H+"px"}S.DoInsertTemplate=function(){var o=i.createDialog(i.getLangText("inserttemplatetitle")||"Insert template","rte-dialog-inserttemplate"),v=typeof o.close=="function"?function(){o.close()}:function(){i.closeCurrentPopup()},w=f(o,"div","","rte-dialog-browser"),q=f(w,"div","","rte-dialog-browser-header"),B=f(q,"div","","rte-dialog-browser-copy");B.innerText="Preview reusable layouts, search by name, and replace the current editor content with a selected template.";var H=f(w,"div","","rte-dialog-browser-toolbar"),g=f(H,"input","","rte-dialog-browser-search");g.type="search",g.placeholder="Search templates",g.setAttribute("aria-label","Search templates");var b=f(H,"div","","rte-dialog-browser-count");b.setAttribute("role","status"),b.setAttribute("aria-live","polite");var D=f(w,"div","","rte-dialog-browser-scrollpanel"),P=f(D,"div","","rte-dialog-browser-grid rte-template-grid");P.setAttribute("role","listbox"),P.setAttribute("aria-label","Available templates");var L=f(D,"div","","rte-dialog-browser-empty");L.innerText="No templates match the current filter.";var I=f(w,"div","","rte-gallery-browser-footer"),u=f(I,"div","","rte-gallery-browser-footer-text");u.innerText="Select a template to replace the current content.";var y=f(I,"button","","rte-gallery-browser-button");y.type="button",y.innerText="Cancel";var O=f(I,"button","","rte-gallery-browser-button rte-gallery-browser-button-primary");O.type="button",O.innerText="Replace Content",O.disabled=!0;var K="";function T(){var G=[],Y=c.htmlTemplates||[],j;for(j=0;j<Y.length;j++){var p=E(Y[j],j);p&&p.html&&G.push(p)}return G}function V(){var G=g.value.replace(/^\s+|\s+$/g,"").toLowerCase(),Y=T();return G?Y.filter(function(j){var p=A(j.html).toLowerCase();return j.title.toLowerCase().indexOf(G)>=0||p.indexOf(G)>=0||j.meta&&j.meta.toLowerCase().indexOf(G)>=0}):Y}function Z(G){var Y=null,j;for(j=0;j<G.length;j++)if(G[j].id===K){Y=G[j];break}b.innerText=G.length+" template"+(G.length===1?"":"s"),u.innerText=Y?"Ready to replace the editor content with "+Y.title+".":"Select a template to replace the current content.",O.disabled=!Y}function M(){var G=T(),Y;for(Y=0;Y<G.length;Y++)if(G[Y].id===K){i.setHTMLCode(G[Y].html),v(),i.focus();return}}function X(){N(P);var G=V(),Y;for(L.style.display=G.length?"none":"block",Y=0;Y<G.length;Y++)(function(p){var k=f(P,"button","","rte-dialog-browser-card");k.type="button",k.setAttribute("role","option"),k.setAttribute("aria-selected",p.id===K?"true":"false"),p.id===K&&k.classList.add("is-selected");var h=f(k,"div","","rte-template-card-preview"),x=f(h,"div","","rte-template-card-preview-body"),z=f(x,"div","","rte-template-card-preview-canvas");z.innerHTML=p.html,C(x,z);var J=f(k,"div","","rte-template-card-footer"),ee=f(J,"div","","rte-template-card-title");ee.innerText=p.title;var ue=f(J,"div","","rte-template-card-meta");ue.innerText=p.meta||A(p.html).substring(0,80)||"Reusable template",k.onclick=function(){K=p.id,X()},k.ondblclick=function(){K=p.id,M()}})(G[Y]);if(K){var j=!1;for(Y=0;Y<G.length;Y++)if(G[Y].id===K){j=!0;break}j||(K="")}Z(G)}g.oninput=X,y.onclick=v,O.onclick=M,X(),g.focus()}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_localdraft=RTE_Plugin_LocalDraft,typeof RTE_DefaultConfig.localDraft>"u"&&(RTE_DefaultConfig.localDraft=!1);function RTE_Plugin_LocalDraft(){var S=this,c,i,f=null,N=null,A=null,E="",C=null,o=!1,v=null;S.PluginName="LocalDraft",S.InitConfig=function(G){c=G},S.InitEditor=function(G){if(i=G,i.saveLocalDraft=function(){return I(!0)},i.hasLocalDraft=function(){return!!u()},i.getLocalDraft=function(){return u()},i.clearLocalDraft=function(){try{D().removeItem(b())}catch{}return Z(),!0},i.restoreLocalDraft=function(){var j=u();if(!j)return!1;try{i.setHTMLCode(j.html)}catch{return!1}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}return Z(),!0},!!c.localDraft){f=typeof c.localDraft=="object"?c.localDraft:{},N=b();var Y=function(){o||(E=L(),K(),B())};try{i.attachEvent("ready",Y)}catch{}try{i.attachEvent("ready",q)}catch{}try{i.attachEvent("aftersethtml",q)}catch{}setTimeout(Y,0)}};var w=function(){P()};function q(){if(!(!c||!c.localDraft)){var G=i.getDocument();if(G&&G!==v){try{G.addEventListener("input",w,!0)}catch{}v=G}}}function B(){if(!o){o=!0;try{i.attachEvent("change",w)}catch{}try{i.attachEvent("keyup",w)}catch{}q();try{window.addEventListener("beforeunload",function(){I(!1)},!1),window.addEventListener("pagehide",function(){I(!1)},!1)}catch{}}}function H(){var G=f&&+f.intervalMs;return G&&G>250?G:2500}function g(){var G=f&&+f.ttlMs;return G&&G>0?G:336*60*60*1e3}function b(){if(f&&f.key)return"rte-draft:"+f.key;var G="";try{var Y=i.getEditable();G=Y&&(Y.id||Y.getAttribute&&Y.getAttribute("data-rte-id"))||""}catch{}if(!G)try{G=location.pathname}catch{G="default"}return"rte-draft:"+G}function D(){return window.localStorage}function P(){A||(A=setTimeout(function(){A=null,I(!1)},H()))}function L(){try{return i.getHTMLCode()||""}catch{return""}}function I(G){if(!c||!c.localDraft)return!1;var Y=L();if(!G&&(Y===E||y(Y)))return!1;var j={html:Y,t:O()};try{return D().setItem(b(),JSON.stringify(j)),!0}catch{return!1}}function u(){try{var G=D().getItem(b());if(!G)return null;var Y=JSON.parse(G);if(!Y||typeof Y.html!="string")return null;if(Y.t&&O()-Y.t>g()){try{D().removeItem(b())}catch{}return null}return Y}catch{return null}}function y(G){if(!G)return!0;var Y=G.replace(/<[^>]*>/g,"").replace(/ /gi," ").replace(/\s+/g,"");return Y.length===0}function O(){try{return Date.now()}catch{return 0}}function K(){if(!(f&&f.promptRestore===!1)){var G=u();G&&(G.html===E||y(G.html)||T(G))}}function T(G){Z();var Y=M();if(!(!Y||!Y.parentNode)){var j=X(G.t);C=document.createElement("div"),C.className="rte-localdraft-bar",C.setAttribute("data-rte-localdraft","1"),C.setAttribute("role","status"),C.setAttribute("aria-live","polite");var p=document.createElement("span");p.className="rte-localdraft-message",p.textContent="An unsaved draft"+(j?" from "+j:"")+" was found.";var k=V("Restore","primary"),h=V("Discard","secondary");k.onclick=function(){i.restoreLocalDraft()},h.onclick=function(){i.clearLocalDraft()},C.appendChild(p),C.appendChild(k),C.appendChild(h),Y.parentNode.insertBefore(C,Y)}}function V(G,Y){var j=document.createElement("button");return j.type="button",j.textContent=G,j.className="rte-localdraft-button is-"+Y,j}function Z(){C&&C.parentNode&&C.parentNode.removeChild(C),C=null}function M(){try{var G=i.getDocument(),Y=G&&G.defaultView&&G.defaultView.frameElement;if(Y){for(var j=Y,p=0;p<4&&j.parentNode;p++){if(j.parentNode&&/rte[_-](outer|container|wrapper)/i.test(j.parentNode.className||""))return j.parentNode;j=j.parentNode}return Y}}catch{}try{return i.getEditable()}catch{return null}}function X(G){if(!G)return"";try{var Y=new Date(G),j=(O()-G)/1e3;return j<60?"just now":j<3600?Math.round(j/60)+" min ago":j<86400?Math.round(j/3600)+" hr ago":Y.toLocaleString()}catch{return""}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_markdownexport=RTE_Plugin_MarkdownExport,typeof RTE_DefaultConfig.markdownExportEnabled>"u"&&(RTE_DefaultConfig.markdownExportEnabled=!0);function RTE_Plugin_MarkdownExport(){var S=this,c,i;S.PluginName="MarkdownExport",S.InitConfig=function(o){c=o},S.InitEditor=function(o){i=o,i.getMarkdown=function(){if(typeof i.toMarkdown=="function")return i.toMarkdown();var v=i.getEditable();return v&&(v.innerText||v.textContent)||""},i.copyAsMarkdown=function(){var v=i.getMarkdown();return A(v)},i.downloadMarkdown=function(v){var w=i.getMarkdown(),q=N(v),B=q?q+".md":f();return C(w,B)}};function f(){try{var o=i.getEditable();if(o){var v=o.querySelector("h1,h2,h3"),w=v?v.textContent:o.textContent||"";w=(w||"").trim().split(`
|
|
30
|
+
`)[0].slice(0,60);var q=N(w);if(q)return q+".md"}}catch{}return"document.md"}function N(o){return o?(o=String(o).replace(/\.md$/i,""),o=o.replace(/[\\/:*?"<>|\u0000-\u001f]+/g," ").replace(/\s+/g," ").trim(),o=o.replace(/[ .]+$/,""),o):""}function A(o){try{if(navigator.clipboard&&navigator.clipboard.writeText)return navigator.clipboard.writeText(o).then(function(){return!0},function(){return E(o)})}catch{}return Promise.resolve(E(o))}function E(o){try{var v=document,w=v.createElement("textarea");w.value=o,w.style.position="fixed",w.style.top="-1000px",w.style.opacity="0",v.body.appendChild(w),w.focus(),w.select();var q=!1;try{q=v.execCommand("copy")}catch{q=!1}return v.body.removeChild(w),q}catch{return!1}}function C(o,v){try{var w=new Blob([o],{type:"text/markdown;charset=utf-8"}),q=(window.URL||window.webkitURL).createObjectURL(w),B=document.createElement("a");return B.href=q,B.download=v,B.style.display="none",document.body.appendChild(B),B.click(),setTimeout(function(){try{document.body.removeChild(B)}catch{}try{(window.URL||window.webkitURL).revokeObjectURL(q)}catch{}},0),!0}catch{return!1}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_mathdialog=RTE_Plugin_MathDialog,RTE_DefaultConfig.mathDialogSamples=RTE_DefaultConfig.mathDialogSamples||["x^2 + y^2 = z^2","\\frac{a}{b}","\\sqrt{x}","\\sum_{i=1}^{n} i","\\int_0^1 x\\,dx","\\alpha\\beta\\gamma"];function RTE_Plugin_MathDialog(){var S=this,c,i;S.PluginName="MathDialog",S.InitConfig=function(E){c=E},S.InitEditor=function(E){i=E,i.attachEvent("exec_command_insertmath",function(C){C.returnValue=!0,S.OpenMathDialog()})};function f(E,C,o,v){var w=E.ownerDocument.createElement(C);return o&&(w.style.cssText=o),v&&(w.className=v),E.appendChild(w),w}function N(){try{var E=i.getSelection();if(!E||E.rangeCount===0)return null;for(var C=E.getRangeAt(0).startContainer,o=i.getEditable();C&&C!==o;){if(C.nodeType===1&&C.classList&&C.classList.contains("rte-math-inline"))return C;C=C.parentNode}}catch{}return null}function A(E){var C=E.katex||E.parent&&E.parent.katex;if(C&&typeof C.render=="function")return{kind:"katex",katex:C};var o=E.MathJax||E.parent&&E.parent.MathJax;return o&&o.typesetPromise?{kind:"mathjax",MathJax:o}:null}S.OpenMathDialog=function(){var E=N(),C=E&&E.getAttribute("data-tex")||"",o=i.createDialog(i.getLangText&&i.getLangText("insertmathtitle")||"Insert / edit equation","rte-dialog-math"),v=typeof o.close=="function"?function(){o.close()}:function(){i.closeCurrentPopup()},w=o.ownerDocument.defaultView||window,q=f(o,"div","padding:14px;min-width:420px;font:13px -apple-system,Segoe UI,sans-serif");f(q,"div","font-weight:600;margin-bottom:4px","").innerText=i.getLangText&&i.getLangText("insertmathlabel")||"TeX / LaTeX";var B=f(q,"textarea","width:100%;box-sizing:border-box;min-height:72px;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;font:13px ui-monospace,Consolas,monospace;resize:vertical");B.value=C,B.placeholder="e.g. x^2 + y^2 = z^2";var H=f(q,"div","display:flex;flex-wrap:wrap;gap:6px;margin:8px 0");(c.mathDialogSamples||[]).forEach(function(y){var O=f(H,"button","font:11px ui-monospace,monospace;padding:3px 8px;border:1px solid #e2e8f0;border-radius:6px;background:#f8fafc;cursor:pointer","");O.type="button",O.textContent=y,O.onclick=function(){B.value=y,P(),B.focus()}}),f(q,"div","font-weight:600;margin:10px 0 4px","").innerText=i.getLangText&&i.getLangText("insertmathpreview")||"Preview";var g=f(q,"div","min-height:48px;padding:10px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#fff;overflow:auto;text-align:center"),b=f(q,"div","font-size:11px;color:#94a3b8;margin-top:4px",""),D=A(w);D||(b.innerText="No KaTeX/MathJax detected on the page \u2014 the equation is stored as markup and will render wherever a math renderer is loaded.");function P(){var y=B.value;if(!y.trim()){g.textContent="";return}if(D&&D.kind==="katex")try{D.katex.render(y,g,{throwOnError:!1,displayMode:!1})}catch(O){g.textContent="\u26A0 "+(O&&O.message?O.message:"render error")}else if(D&&D.kind==="mathjax"){g.textContent="\\("+y+"\\)";try{D.MathJax.typesetPromise([g])}catch{}}else g.textContent="$"+y+"$"}B.oninput=P,setTimeout(function(){B.focus(),P()},0);var L=f(q,"div","display:flex;justify-content:flex-end;gap:8px;margin-top:14px"),I=f(L,"button","padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer","");I.type="button",I.textContent="Cancel",I.onclick=v;var u=f(L,"button","padding:6px 14px;border:1px solid #1d67ba;border-radius:8px;background:#1d67ba;color:#fff;cursor:pointer","");u.type="button",u.textContent=E?"Update":"Insert",u.onclick=function(){var y=B.value.trim();if(!y){v();return}if(E){E.setAttribute("data-tex",y),E.textContent="$"+y+"$",v(),i.renderMath&&i.renderMath(),i.focus();return}var O=String(y).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),K=("$"+y+"$").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");i.insertHTML('<span class="rte-math-inline" data-tex="'+O+'">'+K+"</span>\u200B"),v(),i.renderMath&&i.renderMath(),i.focus()}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_mention=RTE_Plugin_Mention;function RTE_Plugin_Mention(){var S=this,c,i,f=null,N=null,A=null,E=[],C=null,o=null,v=[],w=0,q=!1,B=0,H=null;S.PluginName="Mention",S.InitConfig=function(re){c=re,c.mentionEnabled!==!1&&(c.mentionTrigger=c.mentionTrigger||"@",c.mentionDebounceMs=c.mentionDebounceMs==null?150:c.mentionDebounceMs,c.mentionMaxItems=c.mentionMaxItems||8,c.mentionStaticList=c.mentionStaticList||null,c.mentionSource=c.mentionSource||null,c.mentionInsertClass=c.mentionInsertClass||"rte-mention",c.mentionTriggers=c.mentionTriggers||null)},S.InitEditor=function(re){if(i=re,c.mentionEnabled!==!1){if(i.mentions={register:g,remove:b,list:function(){return E.slice()},close:T,isOpen:function(){return!!N}},(c.mentionSource||c.mentionStaticList)&&g({trigger:c.mentionTrigger,source:c.mentionSource||function($){return I(c.mentionStaticList,$)}}),Array.isArray(c.mentionTriggers))for(var U=0;U<c.mentionTriggers.length;U++)g(c.mentionTriggers[U]);ve();var F=i.getDocument();F.addEventListener("keydown",u,!0),F.addEventListener("input",y,!0),F.addEventListener("compositionstart",function(){q=!0}),F.addEventListener("compositionend",function(){q=!1}),F.addEventListener("mousedown",function($){$.target&&$.target.closest&&$.target.closest("."+c.mentionInsertClass)||T()},!0),F.addEventListener("blur",function(){setTimeout(T,150)},!0),window.addEventListener("scroll",ue,!0),window.addEventListener("resize",ue,!0)}};function g(re){if(!(!re||!re.trigger||typeof re.source!="function")){var U=D(re.trigger),F={trigger:re.trigger,source:re.source,renderItem:re.renderItem||null,renderInsert:re.renderInsert||null,insertClass:re.insertClass||c.mentionInsertClass,label:re.label||"mentions "+re.trigger};U>=0?E[U]=F:E.push(F)}}function b(re){var U=D(re);U>=0&&E.splice(U,1)}function D(re){for(var U=0;U<E.length;U++)if(E[U].trigger===re)return U;return-1}function P(re){return re&&(re.label||re.name||re.id)||""}function L(re){return re&&(re.subtitle||re.email)||""}function I(re,U){if(!Array.isArray(re))return[];if(!U)return re.slice(0,50);var F=U.toLowerCase();return re.filter(function($){var ne=(P($)+" "+L($)+" "+($.id||"")).toLowerCase();return ne.indexOf(F)!==-1})}function u(re){if(!q){if(N)switch(re.key){case"ArrowDown":re.preventDefault(),re.stopPropagation(),h(1);return;case"ArrowUp":re.preventDefault(),re.stopPropagation(),h(-1);return;case"Enter":case"Tab":if(v.length){re.preventDefault(),re.stopPropagation(),x();return}T();return;case"Escape":case"Esc":re.preventDefault(),re.stopPropagation(),T();return}if(!re.ctrlKey&&!re.metaKey&&!re.altKey){var U=D(re.key);if(U>=0&&O()){var F=E[U];setTimeout(function(){K(F)},0)}}}}function y(){N&&V()}function O(){var re=i.getSelection();if(!re||re.rangeCount===0||!re.isCollapsed)return!1;for(var U=re.getRangeAt(0),F=U.startContainer,$=U.startOffset,ne=i.getEditable(),pe=F.nodeType===1?F:F.parentNode;pe&&pe!==ne;){var Ae=pe.nodeName;if(Ae==="CODE"||Ae==="PRE"||pe.classList&&pe.classList.contains(c.mentionInsertClass))return!1;pe=pe.parentNode}if(F.nodeType===3){if($===0)return!0;var He=F.nodeValue.charAt($-1);return/\s/.test(He)}return!0}function K(re){T();var U=i.getSelection();if(!(!U||U.rangeCount===0)){var F=U.getRangeAt(0).cloneRange();C=re,o={range:F,startNode:F.startContainer,startOffset:F.startOffset,triggerCharCount:1,query:""},M(),ee(),Z("")}}function T(){H&&(clearTimeout(H),H=null),N&&N.parentNode&&N.parentNode.removeChild(N),N=null,A=null,C=null,o=null,v=[],w=0}function V(){if(o){var re=i.getSelection();if(!re||re.rangeCount===0||!re.isCollapsed){T();return}var U=re.getRangeAt(0),F=U.startContainer;if(F!==o.startNode){T();return}var $=U.startOffset;if($<o.startOffset){T();return}var ne=(F.nodeType===3?F.nodeValue:"")||"",pe=ne.substring(o.startOffset,$);if(/\s/.test(pe)){T();return}o.query=pe,Z(pe),ee()}}function Z(re){if(!C)return;var U=++B;H&&(clearTimeout(H),H=null);var F=re.length===0?0:c.mentionDebounceMs;function $(){X();var ne;try{ne=C.source(re,{trigger:C.trigger})}catch(pe){console.warn("Mention source threw:",pe),ne=[]}Promise.resolve(ne).then(function(pe){U!==B||!N||(v=Array.isArray(pe)?pe.slice(0,c.mentionMaxItems):[],w=0,G())},function(pe){U!==B||!N||(console.warn("Mention source failed:",pe),v=[],G())})}F>0?H=setTimeout($,F):$()}function M(){f=i.iframe.ownerDocument,N=f.createElement("div"),N.className="rte-mention-popup",N.setAttribute("role","listbox"),N.setAttribute("aria-label",C.label),f.body.appendChild(N)}function X(){if(N){N.innerHTML="";var re=f.createElement("div");re.className="rte-mention-loading",re.textContent="Searching\u2026",N.appendChild(re),A=re}}function G(){if(N){if(N.innerHTML="",A=null,!v.length){var re=f.createElement("div");re.className="rte-mention-empty",re.textContent="No matches",N.appendChild(re);return}for(var U=0;U<v.length;U++)(function(F,$){var ne=f.createElement("button");ne.type="button",ne.className="rte-mention-item"+($===w?" rte-mention-item-active":""),ne.setAttribute("role","option"),ne.setAttribute("aria-selected",$===w?"true":"false"),ne.setAttribute("data-index",$),C.renderItem?C.renderItem(ne,F):Y(ne,F),ne.addEventListener("mousedown",function(pe){pe.preventDefault(),pe.stopPropagation(),w=$,x()}),ne.addEventListener("click",function(pe){N&&(pe.preventDefault(),pe.stopPropagation(),w=$,x())}),ne.addEventListener("mouseenter",function(){w!==$&&(w=$,p())}),N.appendChild(ne)})(v[U],U)}}function Y(re,U){var F=f.createElement("span");if(F.className="rte-mention-avatar",U.avatarUrl){var $=f.createElement("img");$.src=U.avatarUrl,$.alt="",F.appendChild($)}else F.textContent=j(P(U)||"?");re.appendChild(F);var ne=f.createElement("span");ne.className="rte-mention-body";var pe=f.createElement("span");pe.className="rte-mention-label",pe.textContent=P(U),ne.appendChild(pe);var Ae=L(U);if(Ae){var He=f.createElement("span");He.className="rte-mention-subtitle",He.textContent=Ae,ne.appendChild(He)}re.appendChild(ne)}function j(re){var U=String(re).trim().split(/\s+/);return U[0]?U.length===1?U[0].charAt(0).toUpperCase():(U[0].charAt(0)+U[U.length-1].charAt(0)).toUpperCase():"?"}function p(){if(N){for(var re=N.querySelectorAll(".rte-mention-item"),U=0;U<re.length;U++){var F=+re[U].getAttribute("data-index"),$=F===w;re[U].classList.toggle("rte-mention-item-active",$),re[U].setAttribute("aria-selected",$?"true":"false")}k()}}function k(){if(N){var re=N.querySelector(".rte-mention-item-active");if(re){var U=re.offsetTop,F=U+re.offsetHeight;U<N.scrollTop?N.scrollTop=U:F>N.scrollTop+N.clientHeight&&(N.scrollTop=F-N.clientHeight)}}}function h(re){v.length&&(w=(w+re+v.length)%v.length,p())}function x(){if(!v.length){T();return}var re=v[w],U=o,F=C;T(),!(!re||!U||!F)&&(z(U),J(F,re))}function z(re){var U=re.startNode;if(U){var F=re.startOffset-(re.triggerCharCount||0);F<0&&(F=0);var $=i.getSelection();if(!(!$||$.rangeCount===0)){var ne=$.getRangeAt(0),pe=ne.startContainer,Ae=ne.startOffset,He=i.getDocument().createRange();He.setStart(U,F),He.setEnd(pe,Ae);try{He.deleteContents()}catch{return}$.removeAllRanges(),$.addRange(He)}}}function J(re,U){var F=i.getDocument(),$;if(re.renderInsert?$=re.renderInsert(F,U):($=F.createElement("span"),$.className=re.insertClass,$.setAttribute("contenteditable","false"),$.setAttribute("data-rte-mention-id",U.id!=null?U.id:""),$.setAttribute("data-rte-mention-trigger",re.trigger),$.textContent=re.trigger+P(U)),!!$){var ne=i.getSelection();if(!(!ne||ne.rangeCount===0)){var pe=ne.getRangeAt(0);pe.insertNode($);var Ae=F.createTextNode("\xA0");$.parentNode.insertBefore(Ae,$.nextSibling);var He=F.createRange();He.setStartAfter(Ae),He.collapse(!0),ne.removeAllRanges(),ne.addRange(He)}}}function ee(){if(!(!N||!o)){var re=i.iframe,U=re.getBoundingClientRect(),F=o.range.getClientRects(),$=F&&F.length?F[F.length-1]:null;$||($=o.range.getBoundingClientRect());var ne=U.left+($.left||0)+window.pageXOffset,pe=U.top+($.bottom||$.top||0)+window.pageYOffset+4;N.style.position="absolute",N.style.left=ne+"px",N.style.top=pe+"px";var Ae=window.innerHeight||document.documentElement.clientHeight,He=N.getBoundingClientRect();He.bottom>Ae-8&&U.top+($.top||0)>He.height+16&&(N.style.top=U.top+($.top||0)+window.pageYOffset-He.height-4+"px")}}function ue(){N&&ee()}function ve(){var re=i&&i.iframe&&i.iframe.ownerDocument||document;if(!re.querySelector("style[data-rte-mention]")){var U=re.createElement("style");U.setAttribute("data-rte-mention","1"),U.textContent=[".rte-mention-popup{position:absolute;z-index:2147483000;min-width:240px;max-width:min(340px,calc(100vw - 24px));max-height:min(320px,60vh);overflow-y:auto;padding:5px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));border:1px solid rgba(148,163,184,.22);box-shadow:0 18px 42px rgba(29,78,216,.16),0 2px 8px rgba(15,23,42,.08);border-radius:14px;font-family:Aptos,'Segoe UI',sans-serif;font-size:13px;color:#172033;scrollbar-width:thin}",".rte-mention-item{display:flex;align-items:center;gap:9px;width:100%;min-height:40px;padding:6px 8px;border:0;background:transparent;text-align:left;cursor:pointer;color:inherit;font:inherit;border-radius:11px}",".rte-mention-item:hover,.rte-mention-item-active{background:#eef4ff;color:#0f3f9f}",".rte-mention-avatar{flex:0 0 30px;width:30px;height:30px;border-radius:11px;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:#e7eefb;color:#315277;font-size:11px;font-weight:800;letter-spacing:.02em;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18)}",".rte-mention-avatar img{width:100%;height:100%;object-fit:cover}",".rte-mention-item-active .rte-mention-avatar{background:#ffffff;color:#0f3f9f}",".rte-mention-body{display:flex;flex-direction:column;min-width:0;flex:1}",".rte-mention-label{font-weight:750;font-size:13px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-mention-subtitle{font-size:11px;color:#64748b;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}",".rte-mention-item-active .rte-mention-subtitle{color:#315277}",".rte-mention-loading,.rte-mention-empty{padding:14px 16px;color:#52657e;font-size:12px;font-weight:700;text-align:center}",".rte-mention{display:inline-block;padding:1px 7px;border-radius:999px;background:#eef4ff;color:#0f3f9f;font-weight:650;cursor:default;border:1px solid rgba(37,99,235,.16)}",".rte-mention:hover{background:#e4edff}"].join(`
|
|
31
|
+
`),re.head.appendChild(U);var F=i.getDocument();if(F&&F.head&&!F.querySelector("style[data-rte-mention-inline]")){var $=F.createElement("style");$.setAttribute("data-rte-mention-inline","1"),$.textContent=[".rte-mention{display:inline-block;padding:1px 7px;border-radius:999px;background:#eef4ff;color:#0f3f9f;font-weight:650;cursor:default;border:1px solid rgba(37,99,235,.16);user-select:all}",".rte-mention:hover{background:#e4edff}"].join(`
|
|
32
|
+
`),F.head.appendChild($)}}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_mermaiddiagram=RTE_Plugin_MermaidDiagram,RTE_DefaultConfig.diagramResolver=RTE_DefaultConfig.diagramResolver||null,RTE_DefaultConfig.diagramSamples=RTE_DefaultConfig.diagramSamples||[`graph TD
|
|
33
|
+
A[Start] --> B{Decision}
|
|
34
|
+
B -->|Yes| C[Do it]
|
|
35
|
+
B -->|No| D[Skip]`,`sequenceDiagram
|
|
36
|
+
Alice->>Bob: Hello Bob
|
|
37
|
+
Bob-->>Alice: Hi Alice`,`pie title Pets
|
|
38
|
+
"Dogs" : 386
|
|
39
|
+
"Cats" : 85
|
|
40
|
+
"Birds" : 24`,`gantt
|
|
41
|
+
title Schedule
|
|
42
|
+
dateFormat YYYY-MM-DD
|
|
43
|
+
section Phase 1
|
|
44
|
+
Spec :a1, 2026-01-01, 20d
|
|
45
|
+
Build :after a1, 30d`];var RTE_MermaidSeq=0;function RTE_Plugin_MermaidDiagram(){var S=this,c,i;S.PluginName="MermaidDiagram",S.InitConfig=function(b){c=b},S.InitEditor=function(b){i=b,i.renderDiagrams=function(){return S.RenderAll()},i.attachEvent("exec_command_insertdiagram",function(P){P.returnValue=!0,S.OpenDiagramDialog()});try{var D=i.getEditable();D&&D.addEventListener("dblclick",function(P){var L=C(P.target,D);L&&(P.preventDefault(),S.OpenDiagramDialog(L))}),D&&D.addEventListener("click",function(P){for(var L=P.target;L&&L!==D;){if(L.nodeType===1&&L.getAttribute&&L.getAttribute("data-rte-mermaid-remove")==="1"){var I=C(L,D);I&&(P.preventDefault(),P.stopPropagation(),v(I));return}L=L.parentNode}},!0),D&&D.addEventListener("keydown",function(P){if(!(P.key!=="Delete"&&P.key!=="Backspace")){var L=o();L&&(P.preventDefault(),v(L))}},!0)}catch{}};function f(b,D,P,L){var I=b.ownerDocument.createElement(D);return P&&(I.style.cssText=P),L&&(I.className=L),b.appendChild(I),I}function N(b){return String(b).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function A(b){return String(b).replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function E(b){return String(b).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function C(b,D){for(;b&&b!==D;){if(b.nodeType===1&&b.classList&&b.classList.contains("rte-mermaid"))return b;b=b.parentNode}return null}function o(){try{var b=i.getSelection();return!b||b.rangeCount===0?null:C(b.getRangeAt(0).startContainer,i.getEditable())}catch{return null}}function v(b){if(!(!b||!b.parentNode)){b.parentNode.removeChild(b);try{typeof i.fireChange=="function"&&i.fireChange()}catch{}try{i.focus()}catch{}}}function w(b){if(!(!b||b.getElementById("rte-mermaid-styles"))){var D=".rte-mermaid{position:relative;display:block;margin:12px 0;padding:12px;border:1px solid #e2e8f0;border-radius:10px;background:#fff;text-align:center;overflow:auto;}.rte-mermaid-remove{position:absolute;top:7px;right:7px;width:24px;height:24px;border:1px solid rgba(15,23,42,.14);border-radius:999px;background:rgba(255,255,255,.96);color:#334155;font:700 13px/1 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;box-shadow:0 4px 12px rgba(15,23,42,.12);opacity:0;cursor:pointer;transition:opacity 120ms,border-color 120ms,color 120ms;}.rte-mermaid:hover .rte-mermaid-remove,.rte-mermaid-remove:focus{opacity:1;}.rte-mermaid-remove:hover{border-color:rgba(220,38,38,.38);color:#b91c1c;}.rte-mermaid svg{max-width:100%;height:auto;}.rte-mermaid .rte-mermaid-src{display:block;text-align:left;white-space:pre;overflow:auto;font:12px ui-monospace,Consolas,monospace;color:#334155;background:#f8fafc;border-radius:6px;padding:10px;margin:0;}.rte-mermaid .rte-mermaid-err{color:#b91c1c;font:12px ui-monospace,monospace;text-align:left;}",P=b.createElement("style");P.id="rte-mermaid-styles",P.appendChild(b.createTextNode(D)),(b.head||b.getElementsByTagName("head")[0]||b.documentElement).appendChild(P)}}function q(b){try{return b.mermaid||b.parent&&b.parent.mermaid||null}catch{return null}}function B(b,D,P){return new Promise(function(L,I){try{var u=b.render(D,P);u&&typeof u.then=="function"?u.then(function(y){L(y&&y.svg?y.svg:y)},I):typeof u=="string"?L(u):I(new Error("Unsupported Mermaid API"))}catch(y){I(y)}})}function H(b,D){var P=b.ownerDocument,L=P.defaultView||window;function I(O){b.innerHTML="";var K=P.createElement("pre");if(K.className="rte-mermaid-src",K.textContent=D,b.appendChild(K),O){var T=P.createElement("div");T.className="rte-mermaid-err",T.textContent=O,b.appendChild(T)}}if(typeof c.diagramResolver=="function")return Promise.resolve().then(function(){return c.diagramResolver(D)}).then(function(O){if(O&&O.svg)b.innerHTML=O.svg;else if(O&&O.imageUrl){b.innerHTML="";var K=P.createElement("img");K.src=O.imageUrl,K.alt="diagram",K.style.maxWidth="100%",b.appendChild(K)}else I("")}).catch(function(O){I(O&&O.message?O.message:"resolver error")});var u=q(L);if(u&&typeof u.render=="function"){var y="rtemmd"+ ++RTE_MermaidSeq;return B(u,y,D).then(function(O){b.innerHTML=O}).catch(function(O){I(O&&O.message?O.message:"render error")})}return I(""),Promise.resolve()}S.RenderAll=function(){var b=i.getEditable();if(!b)return 0;w(i.getDocument());for(var D=b.querySelectorAll(".rte-mermaid[data-diagram]"),P=0;P<D.length;P++){var L=D[P],I=L.querySelector(".rte-mermaid-render");I||(I=L.ownerDocument.createElement("div"),I.className="rte-mermaid-render",L.appendChild(I)),H(I,A(L.getAttribute("data-diagram")||""))}return D.length};function g(b,D){var P=N(b);return'<div class="rte-mermaid" data-rte-diagram="1" data-diagram="'+P+'" contenteditable="false"'+(D?' id="'+D+'"':"")+'><button type="button" class="rte-mermaid-remove" data-rte-mermaid-remove="1" aria-label="Remove diagram" title="Remove diagram">x</button><div class="rte-mermaid-render"><pre class="rte-mermaid-src">'+E(b)+"</pre></div></div>"}S.OpenDiagramDialog=function(b){b||(b=o());var D=b?A(b.getAttribute("data-diagram")||""):"",P=i.createDialog(i.getLangText&&i.getLangText("insertdiagramtitle")||"Insert / edit diagram","rte-dialog-diagram"),L=typeof P.close=="function"?function(){P.close()}:function(){i.closeCurrentPopup()},I=P.ownerDocument.defaultView||window,u=f(P,"div","padding:14px;min-width:480px;font:13px -apple-system,Segoe UI,sans-serif");f(u,"div","font-weight:600;margin-bottom:4px").innerText=i.getLangText&&i.getLangText("insertdiagramlabel")||"Mermaid";var y=f(u,"textarea","width:100%;box-sizing:border-box;min-height:120px;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;font:12px ui-monospace,Consolas,monospace;resize:vertical");y.value=D,y.placeholder=`graph TD
|
|
46
|
+
A --> B`;var O=f(u,"div","display:flex;flex-wrap:wrap;gap:6px;margin:8px 0");(c.diagramSamples||[]).forEach(function(Y){var j=f(O,"button","font:11px ui-monospace,monospace;padding:3px 8px;border:1px solid #e2e8f0;border-radius:6px;background:#f8fafc;cursor:pointer");j.type="button",j.textContent=(Y.split(`
|
|
47
|
+
`)[0]||"sample").slice(0,22),j.title=Y,j.onclick=function(){y.value=Y,Z(),y.focus()}}),f(u,"div","font-weight:600;margin:10px 0 4px").innerText=i.getLangText&&i.getLangText("insertdiagrampreview")||"Preview";var K=f(u,"div","min-height:80px;padding:10px 12px;border:1px solid #e2e8f0;border-radius:8px;background:#fff;overflow:auto;text-align:center"),T=f(u,"div","font-size:11px;color:#94a3b8;margin-top:4px");typeof c.diagramResolver!="function"&&!q(I)&&(T.innerText="No Mermaid renderer detected on the page \u2014 the diagram is stored as source and will render wherever Mermaid (or config.diagramResolver) is available.");var V=null;function Z(){var Y=y.value.trim();if(!Y){K.textContent="";return}V&&clearTimeout(V),V=setTimeout(function(){var j=K.ownerDocument.createElement("div");j.className="rte-mermaid-render",K.innerHTML="",K.appendChild(j),H(j,Y)},250)}y.oninput=Z,setTimeout(function(){y.focus(),Z()},0);var M=f(u,"div","display:flex;justify-content:flex-end;gap:8px;margin-top:14px"),X=f(M,"button","padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer");X.type="button",X.textContent="Cancel",X.onclick=L;var G=f(M,"button","padding:6px 14px;border:1px solid #1d67ba;border-radius:8px;background:#1d67ba;color:#fff;cursor:pointer");G.type="button",G.textContent=b?"Update":"Insert",G.onclick=function(){var Y=y.value.trim();if(!Y){L();return}if(w(i.getDocument()),b){b.setAttribute("data-diagram",N(Y));var j=b.querySelector(".rte-mermaid-render");j||(j=b.ownerDocument.createElement("div"),j.className="rte-mermaid-render",b.appendChild(j)),H(j,Y),L(),i.focus();return}var p="rtemmd-pending-"+ ++RTE_MermaidSeq;i.insertHTML(g(Y,p)),L();try{var k=i.getDocument(),h=k.getElementById(p);if(h){h.removeAttribute("id");var j=h.querySelector(".rte-mermaid-render");H(j,Y)}}catch{}i.focus()}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_readabilitystats=RTE_Plugin_ReadabilityStats,typeof RTE_DefaultConfig.readabilityStats>"u"&&(RTE_DefaultConfig.readabilityStats=!0);function RTE_Plugin_ReadabilityStats(){var S=this,c,i;S.PluginName="ReadabilityStats",S.InitConfig=function(o){c=o},S.InitEditor=function(o){if(i=o,c.readabilityStats!==!1&&(i.countSyllables=function(v){return N(v)},i.getReadabilityStats=function(v){return A(v!=null?String(v):f())},i.attachEvent("exec_command_readability",function(v){v.returnValue=!0,v.stopBubble=!0,C()}),i.slashCommands&&typeof i.slashCommands.register=="function"))try{i.slashCommands.register({id:"readability-stats",title:"Readability statistics",description:"Flesch reading ease, grade level, and reading time",keywords:["readability","flesch","grade","reading","stats","score"],action:function(){C()}})}catch{}};function f(){try{var o=i.getEditable&&i.getEditable();if(o)return o.innerText||o.textContent||""}catch{}return""}function N(o){if(o=String(o||"").toLowerCase().replace(/[^a-z]/g,""),!o)return 0;if(o.length<=3)return 1;o=o.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"").replace(/^y/,"");var v=o.match(/[aeiouy]{1,2}/g);return v?v.length:1}function A(o){o=String(o||"").replace(/\s+/g," ").trim();var v=o?o.split(/\s+/):[],w=v.length,q=o.match(/[^.!?]+[.!?]+/g),B=q?q.length:w?1:0;w&&B===0&&(B=1);for(var H=0,g=0;g<v.length;g++)H+=N(v[g]);var b=o.replace(/\s/g,"").length,D=B?w/B:0,P=w?H/w:0,L=w?206.835-1.015*D-84.6*P:0,I=w?.39*D+11.8*P-15.59:0;L=Math.round(L*10)/10,I=Math.round(I*10)/10;var u=parseInt(c.readabilityWordsPerMinute,10)||200,y=w/u,O=y<1?Math.max(1,Math.round(y*60))+" sec":Math.round(y)+" min";return{words:w,sentences:B,syllables:H,characters:b,avgWordsPerSentence:Math.round(D*10)/10,avgSyllablesPerWord:Math.round(P*100)/100,fleschReadingEase:L,fleschKincaidGrade:Math.max(0,I),readingTimeMinutes:Math.round(y*10)/10,readingTimeText:O,easeLabel:E(L)}}function E(o){return o>=90?"Very easy (5th grade)":o>=80?"Easy (6th grade)":o>=70?"Fairly easy (7th grade)":o>=60?"Standard (8\u20139th grade)":o>=50?"Fairly difficult (10\u201312th grade)":o>=30?"Difficult (college)":"Very difficult (college graduate)"}function C(){var o=A(f());try{var v=i.createDialog(i.getLangText&&i.getLangText("readabilitytitle")||"Readability statistics","rte-dialog-readability"),w=v.ownerDocument,q=w.createElement("div");q.style.cssText="padding:14px 18px;min-width:340px;font:13px -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;color:#0f172a";for(var B=[["Flesch Reading Ease",o.fleschReadingEase+" \u2014 "+o.easeLabel,!0],["Flesch\u2013Kincaid Grade",String(o.fleschKincaidGrade),!1],["Reading time",o.readingTimeText,!1],["Words",String(o.words),!1],["Sentences",String(o.sentences),!1],["Avg words / sentence",String(o.avgWordsPerSentence),!1],["Avg syllables / word",String(o.avgSyllablesPerWord),!1],["Characters (no spaces)",String(o.characters),!1]],H=0;H<B.length;H++){var g=w.createElement("div");g.style.cssText="display:flex;justify-content:space-between;gap:24px;padding:6px 0;border-bottom:1px solid #eef2f7"+(B[H][2]?";font-weight:600;font-size:14px":"");var b=w.createElement("span");b.textContent=B[H][0],b.style.color="#475569";var D=w.createElement("span");D.textContent=B[H][1],D.style.textAlign="right",g.appendChild(b),g.appendChild(D),q.appendChild(g)}v.appendChild(q)}catch{window.console&&console.warn("readabilitystats:",o)}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_readaloud=RTE_Plugin_ReadAloud,RTE_DefaultConfig.readAloudRate=RTE_DefaultConfig.readAloudRate||1,RTE_DefaultConfig.readAloudHighlight=typeof RTE_DefaultConfig.readAloudHighlight>"u"?!0:RTE_DefaultConfig.readAloudHighlight;function RTE_Plugin_ReadAloud(){var S=this,c,i,f=null,N,A,E,C,o=[],v=0,w=!1,q=!1,B=null;S.PluginName="ReadAloud";function H(){return window.speechSynthesis||null}function g(){return!!H()&&typeof window.SpeechSynthesisUtterance=="function"}S.InitConfig=function(T){c=T},S.InitEditor=function(T){i=T,i.readAloud=function(V){S.Start(V||{})},i.stopReadAloud=function(){S.Stop()},i.attachEvent("exec_command_readaloud",function(V){if(V.returnValue=!0,!g()){S.NotifyUnsupported();return}f?S.CloseBar():S.OpenBar()});try{window.addEventListener("pagehide",function(){S.Stop()}),document.addEventListener("visibilitychange",function(){document.hidden&&S.Pause()})}catch{}},S.NotifyUnsupported=function(){try{var T=i.createDialog(i.getLangText&&i.getLangText("readaloudtitle")||"Read aloud","rte-dialog-readaloud"),V=T.ownerDocument.createElement("div");V.style.cssText="padding:16px;min-width:320px;font:13px -apple-system,Segoe UI,sans-serif",V.textContent="This browser does not provide a speech synthesizer (Web Speech API). Read-aloud is unavailable here.",T.appendChild(V)}catch{}};function b(){for(var T=i.getEditable(),V=T.ownerDocument,Z=V.createTreeWalker(T,NodeFilter.SHOW_TEXT,{acceptNode:function(p){for(var k=p.parentNode;k&&k!==T;){var h=k.nodeName;if(h==="SCRIPT"||h==="STYLE"||h==="NOSCRIPT")return NodeFilter.FILTER_REJECT;k=k.parentNode}return p.data&&p.data.length?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),M=[],X="",G;G=Z.nextNode();)M.push({node:G,start:X.length,len:G.data.length}),X+=G.data;function Y(p){for(var k=0;k<M.length;k++){var h=M[k];if(p<=h.start+h.len)return{node:h.node,offset:Math.max(0,p-h.start)}}var x=M[M.length-1];return x?{node:x.node,offset:x.len}:null}function j(p,k){for(var h=0;h<M.length;h++)if(M[h].node===p)return M[h].start+k;return-1}return{full:X,locate:Y,globalOffset:j,hasNodes:M.length>0}}function D(T,V){for(var Z=[],M=/[^.!?\n。!?]*[.!?\n。!?]+|\S[^.!?\n]*$/g,X;(X=M.exec(T))!==null;)X[0]&&/\S/.test(X[0])&&Z.push({text:X[0],start:V+X.index,end:V+X.index+X[0].length}),X.index===M.lastIndex&&M.lastIndex++;return!Z.length&&/\S/.test(T)&&Z.push({text:T,start:V,end:V+T.length}),Z}S.Start=function(T){if(!g()){S.NotifyUnsupported();return}S.Stop();var V=b();if(!V.hasNodes){K("Nothing to read");return}var Z=i.getSelection?i.getSelection():null,M=0,X=V.full.length;try{if(Z&&Z.rangeCount&&!Z.isCollapsed){var G=Z.getRangeAt(0),Y=V.globalOffset(G.startContainer,G.startOffset),j=V.globalOffset(G.endContainer,G.endOffset);Y>=0&&j>=0&&j>Y&&(M=Y,X=j)}}catch{}B=Z&&Z.rangeCount?Z.getRangeAt(0).cloneRange():null;var p=V.full.substring(M,X);if(o=D(p,M),!o.length){K("Nothing to read");return}v=0,w=!0,q=!1,S._map=V,S._opts=T||{},O(),P()};function P(){var T=H();if(!T||v>=o.length){S.Stop();return}var V=o[v],Z=new SpeechSynthesisUtterance(V.text),M=S._opts&&S._opts.rate||C&&parseFloat(C.value)||c.readAloudRate||1;Z.rate=Math.min(2,Math.max(.5,M));var X=u();X&&(Z.voice=X),Z.onstart=function(){c.readAloudHighlight!==!1&&L(V),K("Reading\u2026 ("+(v+1)+"/"+o.length+")")},Z.onend=function(){w&&(v++,P())},Z.onerror=function(){w&&(v++,P())};try{T.speak(Z)}catch{v++,P()}}function L(T){try{var V=S._map;if(!V)return;var Z=V.locate(T.start),M=V.locate(T.end);if(!Z||!M)return;var X=i.getDocument(),G=X.createRange();G.setStart(Z.node,Z.offset),G.setEnd(M.node,M.offset);var Y=i.getSelection();Y&&(Y.removeAllRanges(),Y.addRange(G))}catch{}}S.Pause=function(){var T=H();if(!(!T||!w)&&!q){try{T.pause()}catch{}q=!0,O(),K("Paused")}},S.Resume=function(){var T=H();if(!(!T||!w)&&q){try{T.resume()}catch{}q=!1,O(),K("Reading\u2026")}},S.Stop=function(){var T=H();if(w=!1,q=!1,o=[],v=0,T)try{T.cancel()}catch{}try{if(B){var V=i.getSelection();V&&(V.removeAllRanges(),V.addRange(B))}}catch{}B=null,O(),K("")};function I(){var T=H();if(!(!T||!E)){var V=T.getVoices()||[];if(V.length){var Z=E.value;E.innerHTML="",V.forEach(function(M,X){var G=E.ownerDocument.createElement("option");G.value=M.name,G.textContent=M.name+" ("+M.lang+")",M.default&&(G.textContent+=" (default)"),E.appendChild(G)}),Z&&(E.value=Z)}}}function u(){var T=H();if(!T)return null;var V=T.getVoices()||[];if(S._opts&&S._opts.voice){for(var Z=0;Z<V.length;Z++)if(V[Z].name===S._opts.voice)return V[Z]}if(E&&E.value){for(var M=0;M<V.length;M++)if(V[M].name===E.value)return V[M]}return null}function y(T,V,Z){var M=T.ownerDocument.createElement("button");return M.type="button",M.textContent=V,Z&&(M.title=Z),M.className="rte-readaloud-button",T.appendChild(M),M}S.OpenBar=function(){if(!f){var T=document;f=T.createElement("div"),f.className="rte-readaloud-bar";var V=T.createElement("span");V.className="rte-readaloud-title",V.textContent="Read",f.appendChild(V),N=y(f,"Play","Play / Pause");var Z=y(f,"Stop","Stop");E=T.createElement("select"),E.className="rte-readaloud-voice",E.title="Voice",f.appendChild(E),C=T.createElement("select"),C.className="rte-readaloud-rate",C.title="Speed",["0.75","1","1.25","1.5","2"].forEach(function(G){var Y=T.createElement("option");Y.value=G,Y.textContent=G+"x",G==="1"&&(Y.selected=!0),C.appendChild(Y)}),f.appendChild(C),A=T.createElement("span"),A.className="rte-readaloud-status",f.appendChild(A);var M=y(f,"Close","Close");M.className+=" is-close",T.body.appendChild(f),I();var X=H();X&&typeof X.addEventListener=="function"&&X.addEventListener("voiceschanged",I),N.onclick=function(){w?q?S.Resume():S.Pause():S.Start({})},Z.onclick=function(){S.Stop()},M.onclick=function(){S.CloseBar()},S.Start({})}},S.CloseBar=function(){S.Stop(),f&&f.parentNode&&f.parentNode.removeChild(f),f=null,N=A=E=C=null};function O(){N&&(N.textContent=w&&!q?"Pause":"Play")}function K(T){A&&(A.textContent=T)}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.svgCode_restrictedediting||(RTE_DefaultConfig.svgCode_restrictedediting='<svg viewBox="0 0 24 24" fill="none" stroke="#5F6368" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="11" width="14" height="9" rx="1.5"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>'),RTE_DefaultConfig.plugin_restrictedediting=RTE_Plugin_RestrictedEditing;function RTE_Plugin_RestrictedEditing(){var S=this,c,i,f=!1,N="data-rte-editable";S.PluginName="RestrictedEditing",S.InitConfig=function(H){c=H,c.text_restrictedediting=c.text_restrictedediting||"Restricted editing",c.text_restrictedediting_mark=c.text_restrictedediting_mark||"Mark as editable",c.text_restrictedediting_next=c.text_restrictedediting_next||"Next editable region",c.text_restrictedediting_hint=c.text_restrictedediting_hint||"Lock the document; only marked regions accept input."},S.InitEditor=function(H){i=H,f=!!c.restrictedEditingMode,i.restrictedEditing={isEnabled:function(){return f},enable:C,disable:o,toggle:function(){return f?o():C()},markSelection:v,unmark:w,list:q,goToNext:function(){return B(1)},goToPrev:function(){return B(-1)}},i.attachEvent("exec_command_restrictedediting",function(g){g.returnValue=!0,g.stopBubble=!0,i.restrictedEditing.toggle()}),f&&C(),i.attachEvent("change",E),E()};function A(){return i.getEditable?i.getEditable():null}function E(){var H=A();if(H){var g=H.ownerDocument;if(!(!g||g.getElementById("__rte_restrictedediting_styles"))){var b=g.createElement("style");b.id="__rte_restrictedediting_styles",b.textContent=["["+N+"='true']{background:rgba(34,197,94,.10);outline:1px dashed rgba(34,197,94,.55);outline-offset:1px;border-radius:2px;padding:1px 2px}","body.rte-restricted [contenteditable='false']{cursor:not-allowed}","body.rte-restricted ["+N+"='true']{background:rgba(34,197,94,.16)}"].join(`
|
|
48
|
+
`),(g.head||g.getElementsByTagName("head")[0]).appendChild(b)}}}function C(){var H=A();if(!H)return!1;f=!0,H.classList.add("rte-restricted");for(var g=0;g<H.children.length;g++){var b=H.children[g];b.querySelector("["+N+"='true']")?(b.setAttribute("contenteditable","true"),b.setAttribute(N+"-wrapper","true")):b.setAttribute("contenteditable","false")}return H.setAttribute("contenteditable","false"),E(),!0}function o(){var H=A();if(!H)return!1;f=!1,H.classList.remove("rte-restricted");for(var g=H.querySelectorAll("[contenteditable]"),b=0;b<g.length;b++)g[b].removeAttribute("contenteditable"),g[b].removeAttribute(N+"-wrapper");return H.setAttribute("contenteditable","true"),!0}function v(H){H=H||{};var g=A();if(!g)return null;var b=g.ownerDocument,D=b.getSelection();if(!D||D.rangeCount===0)return null;var P=D.getRangeAt(0);if(P.collapsed)return null;var L=b.createElement("span");L.setAttribute(N,"true"),H.label&&L.setAttribute("aria-label",H.label);try{P.surroundContents(L)}catch{var I=P.extractContents();L.appendChild(I),P.insertNode(L)}var u=b.createRange();return u.selectNodeContents(L),D.removeAllRanges(),D.addRange(u),E(),f&&C(),L}function w(H){if(H=H||(function(){var b=A(),D=b&&b.ownerDocument.getSelection();if(!D||D.rangeCount===0)return null;for(var P=D.anchorNode;P&&P!==b;){if(P.nodeType===1&&P.getAttribute&&P.getAttribute(N)==="true")return P;P=P.parentNode}return null})(),!H)return!1;for(var g=H.parentNode;H.firstChild;)g.insertBefore(H.firstChild,H);return g.removeChild(H),f&&C(),!0}function q(){var H=A();return H?Array.prototype.slice.call(H.querySelectorAll("["+N+"='true']")):[]}function B(H){var g=q();if(g.length===0)return null;var b=A(),D=b&&b.ownerDocument.getSelection(),P=null;if(D&&D.anchorNode)for(var L=D.anchorNode;L&&L!==b;){if(L.nodeType===1&&L.getAttribute&&L.getAttribute(N)==="true"){P=L;break}L=L.parentNode}var I=P?g.indexOf(P):-1,u=g[(I+H+g.length)%g.length];if(!u)return null;var y=b.ownerDocument.createRange();return y.selectNodeContents(u),y.collapse(!1),D.removeAllRanges(),D.addRange(y),u.scrollIntoView({block:"center",behavior:"smooth"}),u}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.svgCode_revisionhistory||(RTE_DefaultConfig.svgCode_revisionhistory='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7"/><path d="M3 4v5h5"/><path d="M12 8v4l3 2"/></svg>'),RTE_DefaultConfig.plugin_revisionhistory=RTE_Plugin_RevisionHistory;function RTE_Plugin_RevisionHistory(){var S=this,c,i,f=null,N=null,A="";S.PluginName="RevisionHistory",S.InitConfig=function(p){c=p,c.revisionHistoryEnabled!==!1&&(c.revisionHistoryMaxEntries=c.revisionHistoryMaxEntries||50,c.revisionHistoryAutoSnapshotMs=c.revisionHistoryAutoSnapshotMs||0,c.revisionHistoryUrl=c.revisionHistoryUrl||"",c.text_revisionhistory=c.text_revisionhistory||"Revision history",E("toolbar_default","#{revisionhistory}"),E("toolbar_full","#{revisionhistory}"),E("toolbar_mobile","#{revisionhistory}"),(c.controltoolbar_TEXT||"").indexOf("revisionhistory")===-1&&(c.controltoolbar_TEXT=(c.controltoolbar_TEXT||"")+"|{revisionhistory}"))},S.InitEditor=function(p){i=p,c.revisionHistoryEnabled!==!1&&(i.revisionHistory={snapshot:function(k,h){return g(k,h)},promptAndSnapshot:function(k){return b(k)},rename:function(k,h){return D(k,h)},list:function(){return v().slice().sort(function(k,h){return(h.createdAt||0)-(k.createdAt||0)})},listNamed:function(){return v().slice().filter(function(k){return k.isNamed===!0}).sort(function(k,h){return(h.createdAt||0)-(k.createdAt||0)})},get:function(k){return w(k)},restore:function(k,h){return I(k,h||{})},delete:function(k){return u(k)},clear:function(){return y()},diff:function(k,h){return P(k,h)},openBrowser:function(){V()},closeBrowser:function(){Z()}},i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.revisionhistory=function(k){return i.createToolbarButton(k)},i.attachEvent("exec_command_revisionhistory",function(k){k.returnValue=!0,k.stopBubble=!0,V()}),j(),H(),A=i.getHTML?i.getHTML():"",c.revisionHistoryAutoSnapshotMs>0&&i.getDocument().addEventListener("input",function(){N&&clearTimeout(N),N=setTimeout(function(){var k=i.getHTML();k!==A&&g("Auto",{auto:!0})},c.revisionHistoryAutoSnapshotMs)},!0),i.getDocument().addEventListener("keydown",function(k){(k.ctrlKey||k.metaKey)&&k.shiftKey&&(k.key==="H"||k.key==="h")&&(k.preventDefault(),V())},!0))};function E(p,k){c[p]&&c[p].indexOf(k)===-1&&(c[p]=c[p]+k)}function C(){return c.currentUser&&c.currentUser.id?c.currentUser:{id:"user",name:"User",color:"#64748b"}}function o(){var p=c.aiToolkitPersistenceKey||"default";return"RTE.Revisions."+p}function v(){return i.__revisions||(i.__revisions=[]),i.__revisions}function w(p){for(var k=v(),h=0;h<k.length;h++)if(k[h].id===p)return k[h];return null}function q(){for(var p=v();p.length>c.revisionHistoryMaxEntries;)p.shift();try{window.localStorage&&window.localStorage.setItem(o(),JSON.stringify(p))}catch(k){console.warn("revisionhistory: localStorage quota or access issue:",k&&k.message)}c.revisionHistoryUrl&&B(p)}function B(p){try{var k=new XMLHttpRequest;k.open("POST",c.revisionHistoryUrl,!0),k.setRequestHeader("Content-Type","application/json"),k.send(JSON.stringify({documentKey:c.aiToolkitPersistenceKey||"",savedAt:Date.now(),revisions:p}))}catch(h){console.warn("revisionhistory: remote POST failed:",h)}}function H(){try{if(!window.localStorage)return;var p=window.localStorage.getItem(o());if(!p)return;var k=JSON.parse(p);Array.isArray(k)&&(i.__revisions=k)}catch{}}function g(p,k){var h=i.getHTML?i.getHTML():i.getHTMLCode?i.getHTMLCode():"",x=C(),z=(p||"").toString().slice(0,120),J=z.length>0&&(!k||k.auto!==!0),ee={id:"rev-"+Date.now()+"-"+Math.floor(Math.random()*1e4),html:h,text:i.getText?i.getText():T(h),label:z||L(),isNamed:J,author:{id:x.id,name:x.name,color:x.color},createdAt:Date.now(),metadata:k||{}};v().push(ee),A=h,q(),f&&f.isConnected&&G();try{typeof i.fireEvent=="function"&&i.fireEvent("revision_snapshot",{id:ee.id,label:ee.label,isNamed:ee.isNamed,createdAt:ee.createdAt})}catch{}return ee}function b(p){var k=i.iframe?i.iframe.ownerDocument:document,h=k.defaultView||window,x=h.prompt('Name this version (e.g. "Draft sent to legal"):',p||"");if(x===null)return null;var z=(x||"").trim();return z?g(z,{user:!0}):null}function D(p,k){var h=w(p);if(!h)return!1;var x=(k||"").toString().trim().slice(0,120);return x?(h.label=x,h.isNamed=!0,q(),f&&f.isConnected&&G(),!0):!1}function P(p,k){var h=w(p),x=w(k);if(!h||!x)return null;var z=h.text||T(h.html),J=x.text||T(x.html);return{oldEntry:h,newEntry:x,oldText:z,newText:J,lines:O(z,J)}}function L(){var p=new Date;function k(h){return h<10?"0"+h:""+h}return k(p.getHours())+":"+k(p.getMinutes())+":"+k(p.getSeconds())}function I(p,k){var h=w(p);if(!h)return!1;if(!k.skipConfirm){var x=i.iframe?i.iframe.ownerDocument:document;if(!x.defaultView.confirm("Restore this version? Your current content will be replaced (this itself is not auto-snapshotted)."))return!1}return i.setHTMLCode?i.setHTMLCode(h.html):i.setHTML&&i.setHTML(h.html),A=h.html,f&&f.isConnected&&Z(),!0}function u(p){for(var k=v(),h=0;h<k.length;h++)if(k[h].id===p)return k.splice(h,1),q(),f&&f.isConnected&&G(),!0;return!1}function y(){i.__revisions=[],q(),f&&f.isConnected&&G()}function O(p,k){for(var h=String(p||"").split(/\r?\n/),x=String(k||"").split(/\r?\n/),z=[],J=K(h,x),ee=0,ue=0,ve=0;ee<h.length&&ue<x.length;)ve<J.length&&h[ee]===J[ve]&&x[ue]===J[ve]?(z.push({type:"eq",text:h[ee]}),ee++,ue++,ve++):ve<J.length&&h[ee]!==J[ve]?(z.push({type:"del",text:h[ee]}),ee++):ve<J.length&&x[ue]!==J[ve]?(z.push({type:"add",text:x[ue]}),ue++):ee<h.length?(z.push({type:"del",text:h[ee]}),ee++):ue<x.length&&(z.push({type:"add",text:x[ue]}),ue++);for(;ee<h.length;)z.push({type:"del",text:h[ee]}),ee++;for(;ue<x.length;)z.push({type:"add",text:x[ue]}),ue++;return z}function K(p,k){for(var h=p.length,x=k.length,z=new Array(x+1).fill(0),J=new Array(x+1).fill(0),ee=[],ve=0;ve<=h;ve++)ee.push(new Array(x+1).fill(0));for(var ve=1;ve<=h;ve++)for(var re=1;re<=x;re++)p[ve-1]===k[re-1]?ee[ve][re]=ee[ve-1][re-1]+1:ee[ve][re]=Math.max(ee[ve-1][re],ee[ve][re-1]);for(var ue=[],ve=h,re=x;ve>0&&re>0;)p[ve-1]===k[re-1]?(ue.unshift(p[ve-1]),ve--,re--):ee[ve-1][re]>=ee[ve][re-1]?ve--:re--;return ue}function T(p){var k=document.createElement("div");return k.innerHTML=p||"",k.innerText||k.textContent||""}function V(){if(!(f&&f.isConnected)&&!(!i||!i.iframe||!i.iframe.ownerDocument)){f&&!f.isConnected&&(f=null);var p=i.iframe.ownerDocument;if(!(!p||!p.body)){f=p.createElement("div");var k=!1;try{var h=i.container||i.getEditable&&i.getEditable().closest&&i.getEditable().closest(".richtexteditor");k=!!(h&&h.classList&&h.classList.contains("rte-dark"))}catch{}f.className="rte-rev-dialog"+(k?" rte-rev-dark":""),f.setAttribute("role","dialog"),f.setAttribute("aria-modal","true"),f.setAttribute("aria-labelledby","rte-rev-dialog-title");var x=p.createElement("div");x.className="rte-rev-backdrop",x.addEventListener("mousedown",function(J){J.target===x&&Z()});var z=p.createElement("div");z.className="rte-rev-panel",x.appendChild(z),f.appendChild(x),p.body.appendChild(f),G()}}}function Z(){f&&f.parentNode&&f.parentNode.removeChild(f),f=null}var M=null,X="preview";function G(){if(f){var p=f.ownerDocument,k=f.querySelector(".rte-rev-panel");if(!k){Z();return}k.innerHTML="";var h=p.createElement("div");h.className="rte-rev-header";var x=p.createElement("div");x.id="rte-rev-dialog-title",x.className="rte-rev-title",x.textContent="Revision history",h.appendChild(x);var z=p.createElement("div");z.className="rte-rev-header-actions";var J=p.createElement("button");J.type="button",J.className="rte-rev-btn rte-rev-btn-ghost",J.textContent="Save version now",J.addEventListener("mousedown",function(Lt){Lt.preventDefault();var Ir=p.defaultView.prompt("Label this version (optional):","");Ir!==null&&g(Ir||"")}),z.appendChild(J);var ee=p.createElement("button");ee.type="button",ee.className="rte-rev-btn rte-rev-btn-ghost",ee.textContent="Close",ee.setAttribute("aria-label","Close revision history"),ee.addEventListener("mousedown",function(Lt){Lt.preventDefault(),Z()}),z.appendChild(ee),h.appendChild(z),k.appendChild(h);var ue=p.createElement("div");ue.className="rte-rev-body";var ve=p.createElement("div");ve.className="rte-rev-list",ve.setAttribute("role","listbox"),ve.setAttribute("aria-label","Saved revisions");var re=i.revisionHistory.list();if(re.length){(!M||!w(M))&&(M=re[0].id);for(var F=0;F<re.length;F++)(function(Lt){var Ir=p.createElement("button");Ir.type="button",Ir.className="rte-rev-row"+(Lt.id===M?" rte-rev-row-active":""),Ir.setAttribute("role","option"),Ir.setAttribute("aria-selected",Lt.id===M?"true":"false");var Ai=p.createElement("span");Ai.className="rte-rev-dot",Ai.style.background=Lt.author&&Lt.author.color||"#64748b";var ci=p.createElement("div");ci.className="rte-rev-row-who",ci.textContent=Lt.author&&Lt.author.name||"User";var Ei=p.createElement("div");Ei.className="rte-rev-row-when",Ei.textContent=Y(Lt.createdAt)+" \xB7 "+(Lt.label||"");var Mn=p.createElement("div");Mn.className="rte-rev-row-col",Mn.appendChild(ci),Mn.appendChild(Ei),Ir.appendChild(Ai),Ir.appendChild(Mn),Ir.addEventListener("mousedown",function(Xr){Xr.preventDefault(),M=Lt.id,G()}),ve.appendChild(Ir)})(re[F])}else{var U=p.createElement("div");U.className="rte-rev-empty",U.textContent='No revisions yet. Click "Save version now" to capture the current document.',ve.appendChild(U)}ue.appendChild(ve);var $=p.createElement("div");if($.className="rte-rev-pane",re.length){var ne=w(M)||re[0],pe=p.createElement("div");pe.className="rte-rev-tabs",pe.setAttribute("role","tablist"),pe.setAttribute("aria-label","Revision view");var Ae=p.createElement("button");Ae.type="button",Ae.className="rte-rev-tab"+(X==="preview"?" rte-rev-tab-active":""),Ae.setAttribute("role","tab"),Ae.setAttribute("aria-selected",X==="preview"?"true":"false"),Ae.textContent="Preview",Ae.addEventListener("mousedown",function(Lt){Lt.preventDefault(),X="preview",G()});var He=p.createElement("button");He.type="button",He.className="rte-rev-tab"+(X==="diff"?" rte-rev-tab-active":""),He.setAttribute("role","tab"),He.setAttribute("aria-selected",X==="diff"?"true":"false"),He.textContent="Diff vs current",He.addEventListener("mousedown",function(Lt){Lt.preventDefault(),X="diff",G()}),pe.appendChild(Ae),pe.appendChild(He),$.appendChild(pe);var Ze=p.createElement("div");if(Ze.className="rte-rev-content",X==="preview"){var _t=p.createElement("iframe");_t.className="rte-rev-preview-frame",_t.setAttribute("title","Revision preview"),_t.setAttribute("sandbox","allow-same-origin"),Ze.appendChild(_t),setTimeout(function(){try{_t.contentDocument.open(),_t.contentDocument.write('<!DOCTYPE html><html><head><meta charset="utf-8"><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;padding:16px;color:#0f172a;line-height:1.6}img{max-width:100%}</style></head><body>'+(ne.html||"")+"</body></html>"),_t.contentDocument.close()}catch{}},0)}else{var Vt=i.getText?i.getText():T(i.getHTML()),It=O(ne.text||T(ne.html),Vt),$t=p.createElement("pre");$t.className="rte-rev-diff";for(var lr=0;lr<It.length;lr++){var Nt=p.createElement("span");Nt.className="rte-rev-diff-line rte-rev-diff-"+It[lr].type,Nt.textContent=(It[lr].type==="add"?"+ ":It[lr].type==="del"?"- ":" ")+It[lr].text+`
|
|
49
|
+
`,$t.appendChild(Nt)}Ze.appendChild($t)}$.appendChild(Ze);var it=p.createElement("div");it.className="rte-rev-footer";var sr=p.createElement("div");sr.className="rte-rev-footer-info",sr.textContent=ne.label?"Label: "+ne.label:"";var Gr=p.createElement("div");Gr.className="rte-rev-footer-btns";var nr=p.createElement("button");nr.type="button",nr.className="rte-rev-btn rte-rev-btn-danger",nr.textContent="Delete",nr.addEventListener("mousedown",function(Lt){Lt.preventDefault(),u(ne.id)});var Vr=p.createElement("button");Vr.type="button",Vr.className="rte-rev-btn rte-rev-btn-primary",Vr.textContent="Restore this version",Vr.addEventListener("mousedown",function(Lt){Lt.preventDefault()}),Vr.addEventListener("click",function(Lt){Lt.preventDefault(),I(ne.id)}),Gr.appendChild(nr),Gr.appendChild(Vr),it.appendChild(sr),it.appendChild(Gr),$.appendChild(it)}ue.appendChild($),k.appendChild(ue)}}function Y(p){if(!p)return"";var k=new Date(p),h=new Date;function x(J){return J<10?"0"+J:""+J}var z=x(k.getHours())+":"+x(k.getMinutes());return k.toDateString()===h.toDateString()?"Today "+z:k.getFullYear()+"-"+x(k.getMonth()+1)+"-"+x(k.getDate())+" "+z}function j(){var p=i&&i.iframe&&i.iframe.ownerDocument||document;if(!p.querySelector("style[data-rte-revisionhistory]")){var k=p.createElement("style");k.setAttribute("data-rte-revisionhistory","1"),k.textContent=[".rte-rev-dialog{position:fixed;inset:0;z-index:2147483600;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;font-size:13px;color:#172033}",".rte-rev-backdrop{position:absolute;inset:0;background:linear-gradient(135deg,rgba(12,18,32,.44),rgba(40,54,77,.26));display:flex;align-items:center;justify-content:center;padding:18px}",".rte-rev-panel{background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);border:1px solid rgba(117,137,163,.28);border-radius:20px;width:min(960px,calc(100vw - 28px));max-height:min(82vh,740px);display:flex;flex-direction:column;box-shadow:0 24px 60px rgba(35,48,72,.26);overflow:hidden}",".rte-rev-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid rgba(117,137,163,.18);background:rgba(255,255,255,.72)}",".rte-rev-title{font-size:16px;font-weight:760;letter-spacing:-.01em;color:#172033}",".rte-rev-header-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",".rte-rev-btn{padding:8px 12px;border-radius:999px;border:1px solid rgba(116,135,162,.25);font:inherit;font-size:12px;font-weight:680;line-height:1;cursor:pointer;background:#fff;color:#223652;box-shadow:0 1px 2px rgba(32,45,66,.06);transition:background .14s ease,border-color .14s ease,box-shadow .14s ease,transform .14s ease}",".rte-rev-btn:hover{background:#f5f8fc;border-color:rgba(81,111,151,.42);box-shadow:0 5px 14px rgba(32,45,66,.09);transform:translateY(-1px)}",".rte-rev-btn:focus-visible{outline:2px solid rgba(56,122,255,.34);outline-offset:2px}",".rte-rev-btn-ghost{background:#fff;color:#34506f}",".rte-rev-btn-primary{background:linear-gradient(135deg,#2563eb,#1d67ba);color:#fff;border-color:rgba(29,103,186,.85);box-shadow:0 8px 18px rgba(37,99,235,.22)}",".rte-rev-btn-primary:hover{background:linear-gradient(135deg,#1d4ed8,#195fad);color:#fff;border-color:rgba(29,78,216,.9);box-shadow:0 9px 20px rgba(37,99,235,.28)}",".rte-rev-btn-danger{background:#fff5f5;color:#9f1d1d;border-color:rgba(190,45,45,.22)}",".rte-rev-body{display:flex;flex:1;min-height:0;background:linear-gradient(90deg,#f8fbff 0%,#fff 42%)}",".rte-rev-list{width:258px;flex:0 0 258px;border-right:1px solid rgba(117,137,163,.18);overflow-y:auto;background:rgba(244,248,253,.78);padding:10px}",".rte-rev-empty{padding:16px;border:1px dashed rgba(99,118,145,.28);border-radius:14px;background:#fff;color:#5b6c81;font-size:12px;line-height:1.5}",".rte-rev-row{display:flex;align-items:center;gap:10px;width:100%;padding:10px;border:1px solid transparent;border-radius:14px;background:transparent;text-align:left;cursor:pointer;font:inherit;color:inherit}",".rte-rev-row:hover{background:#fff;border-color:rgba(93,122,161,.24);box-shadow:0 8px 18px rgba(33,48,70,.08)}",".rte-rev-row-active{background:#eef6ff;border-color:rgba(37,99,235,.28);box-shadow:0 8px 22px rgba(37,99,235,.12)}",".rte-rev-dot{width:9px;height:9px;border-radius:50%;flex:0 0 9px;box-shadow:0 0 0 3px rgba(255,255,255,.95),0 0 0 4px rgba(96,116,140,.18)}",".rte-rev-row-col{flex:1;min-width:0}",".rte-rev-row-who{font-weight:720;font-size:12px;line-height:1.25;color:#172033}",".rte-rev-row-when{margin-top:2px;font-size:11px;color:#637487;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-rev-pane{flex:1;display:flex;flex-direction:column;min-width:0;padding:10px}",".rte-rev-tabs{display:flex;align-self:flex-start;gap:3px;padding:3px;margin:0 0 10px;border:1px solid rgba(117,137,163,.2);border-radius:999px;background:#eef3f8}",".rte-rev-tab{padding:7px 12px;border:0;border-radius:999px;background:transparent;font:inherit;font-size:12px;font-weight:680;color:#637487;cursor:pointer}",".rte-rev-tab:hover{color:#1d3557;background:rgba(255,255,255,.58)}",".rte-rev-tab:focus-visible{outline:2px solid rgba(56,122,255,.34);outline-offset:2px}",".rte-rev-tab-active{color:#163966;background:#fff;box-shadow:0 2px 7px rgba(35,48,72,.08)}",".rte-rev-content{flex:1;overflow:auto;padding:0;border:1px solid rgba(117,137,163,.18);border-radius:16px;background:#fff;min-height:300px}",".rte-rev-preview-frame{width:100%;height:100%;min-height:330px;border:0;display:block;background:#fff}",".rte-rev-diff{margin:0;padding:14px 16px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.55;white-space:pre-wrap;color:#172033;background:#fbfdff;min-height:100%}",".rte-rev-diff-line{display:block}",".rte-rev-diff-add{background:#e8f8ef;color:#17633f}",".rte-rev-diff-del{background:#fff0f0;color:#9f1d1d}",".rte-rev-diff-eq{color:#556575}",".rte-rev-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 0 0;background:transparent}",".rte-rev-footer-info{font-size:12px;color:#637487;min-height:18px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",".rte-rev-footer-btns{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}","@media(max-width:720px){.rte-rev-backdrop{padding:10px;align-items:flex-start}.rte-rev-panel{width:calc(100vw - 20px);max-height:calc(100vh - 20px);border-radius:16px}.rte-rev-header{align-items:flex-start;flex-direction:column}.rte-rev-body{flex-direction:column}.rte-rev-list{width:auto;flex:0 0 auto;max-height:178px;border-right:0;border-bottom:1px solid rgba(117,137,163,.18)}.rte-rev-pane{min-height:360px}.rte-rev-footer{align-items:stretch;flex-direction:column}.rte-rev-footer-info{white-space:normal}.rte-rev-footer-btns{justify-content:stretch}.rte-rev-footer-btns .rte-rev-btn{flex:1}}","@media (prefers-color-scheme:dark){"," .rte-rev-dialog{color:#e2e8f0}"," .rte-rev-panel{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155}"," .rte-rev-header{background:rgba(30,41,59,.72);border-color:#334155}"," .rte-rev-title,.rte-rev-row-who{color:#e2e8f0}"," .rte-rev-btn,.rte-rev-btn-ghost{background:#0f172a;color:#cbd5e1;border-color:#334155}"," .rte-rev-btn:hover{background:#334155}"," .rte-rev-btn-primary,.rte-rev-btn-primary:hover{background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;border-color:#3b82f6}"," .rte-rev-body{background:#0f172a}"," .rte-rev-list{background:rgba(15,23,42,.6);border-color:#334155}"," .rte-rev-empty{background:#1e293b;color:#94a3b8;border-color:#334155}"," .rte-rev-row:hover{background:#1e293b;border-color:#334155}"," .rte-rev-row-active{background:#1e3a8a;border-color:#3b82f6}"," .rte-rev-row-when,.rte-rev-footer-info{color:#94a3b8}"," .rte-rev-tabs{background:#1e293b;border-color:#334155}"," .rte-rev-tab{color:#94a3b8}.rte-rev-tab-active{color:#fff;background:#1d4ed8}"," .rte-rev-diff{background:#0f172a;color:#cbd5e1}.rte-rev-diff-eq{color:#94a3b8}"," .rte-rev-diff-add{background:rgba(16,185,129,.16);color:#6ee7b7}"," .rte-rev-diff-del{background:rgba(244,63,94,.16);color:#fda4af}","}",".rte-rev-dark{color:#e2e8f0}",".rte-rev-dark .rte-rev-panel{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155}",".rte-rev-dark .rte-rev-header{background:rgba(30,41,59,.72);border-color:#334155}",".rte-rev-dark .rte-rev-title,.rte-rev-dark .rte-rev-row-who{color:#e2e8f0}",".rte-rev-dark .rte-rev-btn,.rte-rev-dark .rte-rev-btn-ghost{background:#0f172a;color:#cbd5e1;border-color:#334155}",".rte-rev-dark .rte-rev-btn:hover{background:#334155}",".rte-rev-dark .rte-rev-btn-primary,.rte-rev-dark .rte-rev-btn-primary:hover{background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;border-color:#3b82f6}",".rte-rev-dark .rte-rev-body{background:#0f172a}",".rte-rev-dark .rte-rev-list{background:rgba(15,23,42,.6);border-color:#334155}",".rte-rev-dark .rte-rev-empty{background:#1e293b;color:#94a3b8;border-color:#334155}",".rte-rev-dark .rte-rev-row:hover{background:#1e293b;border-color:#334155}",".rte-rev-dark .rte-rev-row-active{background:#1e3a8a;border-color:#3b82f6}",".rte-rev-dark .rte-rev-row-when,.rte-rev-dark .rte-rev-footer-info{color:#94a3b8}",".rte-rev-dark .rte-rev-tabs{background:#1e293b;border-color:#334155}",".rte-rev-dark .rte-rev-tab{color:#94a3b8}.rte-rev-dark .rte-rev-tab-active{color:#fff;background:#1d4ed8}",".rte-rev-dark .rte-rev-diff{background:#0f172a;color:#cbd5e1}.rte-rev-dark .rte-rev-diff-eq{color:#94a3b8}",".rte-rev-dark .rte-rev-diff-add{background:rgba(16,185,129,.16);color:#6ee7b7}",".rte-rev-dark .rte-rev-diff-del{background:rgba(244,63,94,.16);color:#fda4af}"].join(`
|
|
50
|
+
`),p.head.appendChild(k)}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_slashcommand=RTE_Plugin_SlashCommand;function RTE_Plugin_SlashCommand(){var S=this,c,i,f=null,N=null,A=null,E=[],C=[],o=0,v=!1,w=!1;S.PluginName="SlashCommand",S.InitConfig=function(we){c=we,c.slashCommandEnabled!==!1&&(c.slashCommandTrigger=c.slashCommandTrigger||"/",c.slashCommandMaxItems=c.slashCommandMaxItems||40,c.slashCommandIncludeAi=c.slashCommandIncludeAi!==!1,c.slashCommands=c.slashCommands||null)},S.InitEditor=function(we){if(i=we,c.slashCommandEnabled!==!1){if(i.slashCommands={register:q,remove:B,list:function(){return E.slice()},open:function(){O(!0)},close:K,isOpen:function(){return!!N}},E=L(),Array.isArray(c.slashCommands))for(var he=0;he<c.slashCommands.length;he++)q(c.slashCommands[he]);x();var Ue=i.getDocument();Ue.addEventListener("keydown",I,!0),Ue.addEventListener("input",u,!0),Ue.addEventListener("compositionstart",function(){v=!0}),Ue.addEventListener("compositionend",function(){v=!1}),Ue.addEventListener("mousedown",function(){K()},!0),Ue.addEventListener("blur",function(){setTimeout(K,150)},!0),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h,!0)}};function q(we){if(!(!we||!we.id)){var he=H(we.id);he>=0?E[he]=g(we):E.push(g(we))}}function B(we){var he=H(we);he>=0&&E.splice(he,1)}function H(we){for(var he=0;he<E.length;he++)if(E[he].id===we)return he;return-1}function g(we){return{id:we.id,section:we.section||"Blocks",title:we.title||we.id,description:we.description||"",keywords:(we.keywords||[]).slice(),icon:we.icon||"",iconSvg:we.iconSvg||"",run:we.run||we.action}}var b={P:1,DIV:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,BLOCKQUOTE:1,PRE:1,LI:1};function D(){var we=i.getSelection();if(!we||we.rangeCount===0)return null;for(var he=we.getRangeAt(0).startContainer,Ue=i.getEditable();he&&he!==Ue;){if(he.nodeType===1&&b[he.nodeName])return he;he=he.parentNode}return null}function P(we){var he=D();if(we=we.toUpperCase(),he&&!he.textContent.trim()){var Ue=i.getDocument(),Le=Ue.createElement(we);Le.appendChild(Ue.createElement("br")),he.parentNode.replaceChild(Le,he);var ct=Ue.createRange();ct.setStart(Le,0),ct.setEnd(Le,0);var Ht=i.getSelection();Ht.removeAllRanges(),Ht.addRange(ct);return}i.execCommand("formatblock",we)}function L(){var we=[];function he(Le,ct,Ht,zt,ir,_r,et){we.push(g({id:ct,section:Le,title:Ht,description:zt,keywords:ir,iconSvg:_r,run:et}))}if(he("Blocks","heading1","Heading 1","Large section heading",["h1","title"],z("1"),function(){P("H1")}),he("Blocks","heading2","Heading 2","Medium section heading",["h2","subtitle"],z("2"),function(){P("H2")}),he("Blocks","heading3","Heading 3","Small section heading",["h3"],z("3"),function(){P("H3")}),he("Blocks","paragraph","Paragraph","Plain body text",["p","text","body"],J(),function(){P("P")}),he("Blocks","bulletlist","Bulleted list","Unordered list",["ul","bullets","list"],ee(),function(){i.execCommand("insertunorderedlist")}),he("Blocks","numberlist","Numbered list","Ordered list",["ol","numbered"],ue(),function(){i.execCommand("insertorderedlist")}),he("Blocks","quote","Quote","Block quotation",["blockquote"],ve(),function(){i.execCommand("insertblockquote")}),he("Blocks","code","Code block","Monospaced code block",["pre","snippet"],re(),function(){i.isCommandEnabled&&i.isCommandEnabled("insertcode")?i.execCommand("insertcode"):i.execCommand("formatblock","PRE")}),he("Blocks","divider","Divider","Horizontal rule",["hr","line","separator"],U(),function(){i.execCommand("inserthorizontalrule")}),(!i.isCommandEnabled||i.isCommandEnabled("insertcallout"))&&he("Blocks","callout","Callout","Highlighted info / warning box",["admonition","info","warning","note","tip"],_t(),function(){i.execCommand("insertcallout")}),(!i.isCommandEnabled||i.isCommandEnabled("insertcolumns"))&&he("Blocks","columns","Columns","Multi-column layout",["layout","grid","column"],Vt(),function(){i.execCommand("insertcolumns")}),(!i.isCommandEnabled||i.isCommandEnabled("inserttoggle"))&&he("Blocks","toggle","Toggle list","Collapsible toggle block",["collapse","details","accordion","expand"],It(),function(){i.execCommand("inserttoggle")}),(!i.isCommandEnabled||i.isCommandEnabled("insertmath"))&&he("Insert","equation","Equation","Insert a math equation (TeX)",["math","latex","tex","formula","katex"],$t(),function(){i.execCommand("insertmath")}),(!i.isCommandEnabled||i.isCommandEnabled("inserttodolist"))&&he("Blocks","todolist","To-do list","Checklist with clickable checkboxes",["task","todo","checklist","checkbox","check"],Vr(),function(){i.execCommand("inserttodolist")}),(!i.isCommandEnabled||i.isCommandEnabled("insertdiagram"))&&he("Insert","diagram","Diagram","Insert a Mermaid diagram",["mermaid","flowchart","sequence","gantt","graph","uml"],Gr(),function(){i.execCommand("insertdiagram")}),(!i.isCommandEnabled||i.isCommandEnabled("insertbookmark"))&&he("Insert","bookmark","Bookmark","Insert a link preview card",["link","url","embed","preview","card"],lr(),function(){i.execCommand("insertbookmark")}),(!i.isCommandEnabled||i.isCommandEnabled("spellcheck"))&&he("Tools","spellcheck","Spell check","Check spelling",["spelling","grammar","proofread","typo"],Nt(),function(){i.execCommand("spellcheck")}),(!i.isCommandEnabled||i.isCommandEnabled("insertdatechip"))&&he("Insert","datechip","Date chip","Insert an interactive date chip",["date","calendar","chip","today"],it(),function(){i.execCommand("insertdatechip")}),(!i.isCommandEnabled||i.isCommandEnabled("insertchip"))&&he("Insert","chip","Smart chip","Insert a date / person / link chip",["chip","person","mention","link","pill"],it(),function(){i.execCommand("insertchip")}),(!i.isCommandEnabled||i.isCommandEnabled("emailexport"))&&he("Tools","emailexport","Export email HTML","Inline-styled HTML for email",["email","inline","mail","newsletter","html"],sr(),function(){i.execCommand("emailexport")}),typeof i.openFindDialog=="function"&&he("Tools","findreplace","Find & replace","Search the document and replace text",["find","replace","search","query","substitute"],Ai(),function(){i.openFindDialog()}),typeof i.showShortcuts=="function"&&he("Tools","shortcuts","Keyboard shortcuts","Show the keyboard shortcut cheat sheet (Ctrl+/)",["keyboard","shortcuts","hotkeys","keys","help","cheat"],Ir(),function(){i.showShortcuts()}),typeof i.foldAtCaret=="function"&&(he("Tools","foldsection","Fold section","Collapse the section under the current heading",["fold","collapse","heading","outline","section"],Lt(),function(){i.foldAtCaret()}),he("Tools","unfoldall","Unfold all","Expand every collapsed heading section",["unfold","expand","headings","collapse"],Lt(),function(){i.unfoldAll&&i.unfoldAll()})),(!i.isCommandEnabled||i.isCommandEnabled("readaloud"))&&he("Tools","readaloud","Read aloud","Speak the selection or document (text-to-speech)",["tts","speak","speech","voice","accessibility","narrate"],nr(),function(){i.execCommand("readaloud")}),typeof i.requestGhostText=="function"&&he("Tools","aicomplete","AI complete","Suggest an inline AI completion of the current sentence",["ai","complete","autocomplete","ghost","suggest","continue","copilot"],Xr(),function(){i.requestGhostText()}),typeof i.copyAsMarkdown=="function"&&(he("Tools","copymarkdown","Copy as Markdown","Copy the whole document to the clipboard as Markdown",["markdown","md","copy","clipboard","export"],Mn(),function(){i.copyAsMarkdown()}),he("Tools","downloadmarkdown","Download as Markdown","Save the document as a .md file",["markdown","md","download","export","save","file"],Mn(),function(){i.downloadMarkdown()})),typeof i.toggleTypewriterMode=="function"&&(he("Tools","typewriter","Typewriter mode","Keep the caret line centred as you type",["typewriter","center","scroll","focus","distraction","zen"],ci(),function(){i.toggleTypewriterMode()}),he("Tools","focusmode","Focus mode","Dim everything except the current paragraph",["focus","dim","highlight","distraction","zen","concentrate"],Ei(),function(){i.toggleFocusMode()})),he("Insert","table","Table","Insert a table",["grid","rows","columns"],F(),function(){i.execCommand("inserttable")}),he("Insert","image","Image","Upload or embed an image",["picture","photo","img"],$(),function(){i.execCommand("imageupload")}),he("Insert","link","Link","Insert a hyperlink",["url","anchor"],ne(),function(){i.execCommand("insertlink")}),he("Insert","emoji","Emoji","Insert an emoji",["smiley","icon"],pe(),function(){i.execCommand("insertemoji")}),he("Insert","template","Template","Insert from template gallery",["snippet"],Ae(),function(){i.execCommand("inserttemplate")}),he("Insert","date","Today's date","Insert the current date",["time","now"],He(),function(){i.execCommand("insertdate")}),c.slashCommandIncludeAi&&Array.isArray(c.aiToolkitActions))for(var Ue=0;Ue<c.aiToolkitActions.length;Ue++)(function(Le){we.push(g({id:"ai-"+Le.id,section:"AI",title:Le.title||Le.id,description:Le.description||"",keywords:["ai",Le.id],iconSvg:c["svgCode_aiassist_"+(Le.icon||Le.id)]||c.svgCode_aiassist||"",run:function(){var ct=i.aiToolkit;if(ct){if(Le.id==="chat-panel"&&typeof ct.openChatPanel=="function"){ct.openChatPanel();return}if(Le.id==="review-panel"&&typeof ct.openReviewPanel=="function"){ct.openReviewPanel();return}if(Le.id==="open-dialog"&&typeof ct.openDialog=="function"){ct.openDialog();return}if(typeof ct.runQuickAction=="function"){ct.runQuickAction(Le.id);return}typeof ct.resolveAction=="function"&&ct.resolveAction(Le.id)}}}))})(c.aiToolkitActions[Ue]);return we}function I(we){if(!v){if(N)switch(we.key){case"ArrowDown":we.preventDefault(),we.stopPropagation(),Y(1);return;case"ArrowUp":we.preventDefault(),we.stopPropagation(),Y(-1);return;case"Enter":case"Tab":if(C.length){we.preventDefault(),we.stopPropagation(),j();return}K();return;case"Escape":case"Esc":we.preventDefault(),we.stopPropagation(),K();return}if(we.key===c.slashCommandTrigger&&!we.ctrlKey&&!we.metaKey&&!we.altKey){if(!y())return;w=!1,setTimeout(function(){w||O(!1)},0)}}}function u(){N&&T()}function y(){var we=i.getSelection();if(!we||we.rangeCount===0||!we.isCollapsed)return!1;for(var he=we.getRangeAt(0),Ue=he.startContainer,Le=he.startOffset,ct=i.getEditable(),Ht=Ue.nodeType===1?Ue:Ue.parentNode;Ht&&Ht!==ct;){var zt=Ht.nodeName;if(zt==="CODE"||zt==="PRE")return!1;Ht=Ht.parentNode}if(Ue.nodeType===3){if(Le===0)return!0;var ir=Ue.nodeValue.charAt(Le-1);return/\s/.test(ir)}return!0}function O(we){K();var he=i.getSelection();if(!(!he||he.rangeCount===0)){var Ue=he.getRangeAt(0).cloneRange();A={range:Ue,startNode:Ue.startContainer,startOffset:Ue.startOffset,triggerCharCount:we?0:1,query:""},Z(),k(),V("")}}function K(){N&&N.parentNode&&N.parentNode.removeChild(N),N=null,A=null,C=[],o=0}function T(){if(A){var we=i.getSelection();if(!we||we.rangeCount===0||!we.isCollapsed){K();return}var he=we.getRangeAt(0),Ue=he.startContainer;if(Ue!==A.startNode){K();return}var Le=he.startOffset;if(Le<A.startOffset){K();return}var ct=(Ue.nodeType===3?Ue.nodeValue:"")||"",Ht=ct.substring(A.startOffset,Le);if(/\s/.test(Ht)){K();return}A.query=Ht,V(Ht),k()}}function V(we){var he=(we||"").toLowerCase();C=E.filter(function(Ue){if(!he||Ue.title.toLowerCase().indexOf(he)!==-1||Ue.description&&Ue.description.toLowerCase().indexOf(he)!==-1)return!0;for(var Le=0;Le<Ue.keywords.length;Le++)if(String(Ue.keywords[Le]).toLowerCase().indexOf(he)!==-1)return!0;return!1}).slice(0,c.slashCommandMaxItems),o=0,M()}function Z(){f=i.iframe.ownerDocument,N=f.createElement("div"),N.className="rte-slash-popup";try{var we=i.container||i.getEditable&&i.getEditable().closest&&i.getEditable().closest(".richtexteditor");we&&we.classList&&we.classList.contains("rte-dark")&&(N.className+=" rte-slash-popup-dark")}catch{}N.setAttribute("role","listbox"),N.setAttribute("aria-label","Slash commands"),f.body.appendChild(N)}function M(){if(N){if(N.innerHTML="",!C.length){var we=f.createElement("div");we.className="rte-slash-empty",we.textContent="No matching commands",N.appendChild(we);return}for(var he="",Ue=0;Ue<C.length;Ue++)(function(Le,ct){if(Le.section!==he){var Ht=f.createElement("div");Ht.className="rte-slash-section",Ht.textContent=Le.section,N.appendChild(Ht),he=Le.section}var zt=f.createElement("button");zt.type="button",zt.className="rte-slash-item"+(ct===o?" rte-slash-item-active":""),zt.setAttribute("role","option"),zt.setAttribute("aria-selected",ct===o?"true":"false"),zt.setAttribute("data-index",ct);var ir=f.createElement("span");ir.className="rte-slash-item-icon",ir.innerHTML=Le.iconSvg||Ze(),zt.appendChild(ir);var _r=f.createElement("span");_r.className="rte-slash-item-body";var et=f.createElement("span");if(et.className="rte-slash-item-title",et.textContent=Le.title,_r.appendChild(et),Le.description){var bn=f.createElement("span");bn.className="rte-slash-item-desc",bn.textContent=Le.description,_r.appendChild(bn)}zt.appendChild(_r),zt.addEventListener("mousedown",function(Li){Li.preventDefault(),Li.stopPropagation(),o=ct,j()}),zt.addEventListener("click",function(Li){N&&(Li.preventDefault(),Li.stopPropagation(),o=ct,j())}),zt.addEventListener("mouseenter",function(){o!==ct&&(o=ct,X())}),N.appendChild(zt)})(C[Ue],Ue)}}function X(){if(N){for(var we=N.querySelectorAll(".rte-slash-item"),he=0;he<we.length;he++){var Ue=+we[he].getAttribute("data-index"),Le=Ue===o;we[he].classList.toggle("rte-slash-item-active",Le),we[he].setAttribute("aria-selected",Le?"true":"false")}G()}}function G(){if(N){var we=N.querySelector(".rte-slash-item-active");if(we){var he=we.offsetTop,Ue=he+we.offsetHeight;he<N.scrollTop?N.scrollTop=he:Ue>N.scrollTop+N.clientHeight&&(N.scrollTop=Ue-N.clientHeight)}}}function Y(we){C.length&&(o=(o+we+C.length)%C.length,X())}function j(){if(!C.length){K();return}var we=C[o],he=A;if(K(),!(!we||!he)){p(he);var Ue=i.getDocument();Ue.activeElement!==i.getEditable()&&!Ue.hasFocus()&&i.focus();try{we.run(i)}catch(Le){console.warn("Slash command failed:",Le)}}}function p(we){var he=we.startNode;if(he){var Ue=we.startOffset-(we.triggerCharCount||0);Ue<0&&(Ue=0);var Le=i.getSelection();if(!(!Le||Le.rangeCount===0)){var ct=Le.getRangeAt(0),Ht,zt;he.nodeType===3&&ct.startContainer===he?(Ht=he,zt=ct.startOffset):(Ht=ct.startContainer,zt=ct.startOffset);var ir=i.getDocument().createRange();ir.setStart(he,Ue),ir.setEnd(Ht,zt);try{ir.deleteContents()}catch{return}Le.removeAllRanges(),Le.addRange(ir)}}}function k(){if(!(!N||!A)){var we=i.iframe,he=we.getBoundingClientRect(),Ue=A.range.getClientRects(),Le=Ue&&Ue.length?Ue[Ue.length-1]:null;Le||(Le=A.range.getBoundingClientRect());var ct=he.left+(Le.left||0)+window.pageXOffset,Ht=he.top+(Le.bottom||Le.top||0)+window.pageYOffset+4;N.style.position="absolute",N.style.left=ct+"px",N.style.top=Ht+"px";var zt=window.innerHeight||document.documentElement.clientHeight,ir=N.getBoundingClientRect();ir.bottom>zt-8&&he.top+(Le.top||0)>ir.height+16&&(N.style.top=he.top+(Le.top||0)+window.pageYOffset-ir.height-4+"px")}}function h(){N&&k()}function x(){var we=i&&i.iframe&&i.iframe.ownerDocument||document;if(!we.querySelector("style[data-rte-slashcommand]")){var he=we.createElement("style");he.setAttribute("data-rte-slashcommand","1"),he.textContent=["/* 2026-07-03 slash command polish */",".rte-slash-popup{position:absolute;z-index:2147483000;min-width:280px;max-width:min(390px,calc(100vw - 24px));max-height:min(360px,64vh);overflow-y:auto;overscroll-behavior:contain;padding:6px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));background-clip:padding-box;border:1px solid rgba(148,163,184,.22);box-shadow:0 16px 36px rgba(29,78,216,.14),0 2px 8px rgba(15,23,42,.08);border-radius:8px;font-family:Aptos,'Segoe UI',sans-serif;font-size:13px;color:#172033;scrollbar-width:thin}",".rte-slash-section{position:sticky;top:0;z-index:1;margin:4px 0 2px;padding:6px 8px 4px;background:linear-gradient(180deg,rgba(248,251,255,.98),rgba(248,251,255,.86));color:#52657e;font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}",".rte-slash-item{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:8px;width:100%;min-height:40px;padding:6px 8px;border:0;background:transparent;text-align:left;cursor:pointer;color:inherit;font:inherit;border-radius:8px}",".rte-slash-item:hover,.rte-slash-item-active{background:#eef4ff;color:#1559d6}",".rte-slash-item:focus-visible{outline:2px solid rgba(37,99,235,.22);outline-offset:2px}",".rte-slash-item-icon{flex:0 0 28px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;color:#315277;background:#ffffff;border-radius:8px;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18)}",".rte-slash-item-active .rte-slash-item-icon{color:#1559d6;background:#ffffff}",".rte-slash-item-icon svg{display:block;width:16px;height:16px;pointer-events:none}",".rte-slash-item-body{display:flex;flex-direction:column;min-width:0;flex:1}",".rte-slash-item-title{font-weight:780;font-size:13px;line-height:1.24;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-desc{font-size:11px;color:#64748b;line-height:1.24;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-active .rte-slash-item-desc{color:#315277}",".rte-slash-empty{padding:16px;color:#52657e;font-size:12px;font-weight:700;text-align:center}","@media (prefers-color-scheme:dark){"," .rte-slash-popup{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0;box-shadow:0 20px 46px rgba(0,0,0,.5),0 2px 8px rgba(0,0,0,.4)}"," .rte-slash-section{background:linear-gradient(180deg,rgba(30,41,59,.98),rgba(30,41,59,.86));color:#94a3b8}"," .rte-slash-item:hover,.rte-slash-item-active{background:#1d4ed8;color:#fff}"," .rte-slash-item-icon{color:#cbd5e1;background:#0f172a;box-shadow:inset 0 0 0 1px rgba(148,163,184,.25)}"," .rte-slash-item-active .rte-slash-item-icon{color:#fff;background:#1e3a8a}"," .rte-slash-item-desc{color:#94a3b8}"," .rte-slash-item-active .rte-slash-item-desc{color:#dbeafe}"," .rte-slash-empty{color:#94a3b8}","}",".rte-slash-popup-dark{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0;box-shadow:0 20px 46px rgba(0,0,0,.5),0 2px 8px rgba(0,0,0,.4)}",".rte-slash-popup-dark .rte-slash-section{background:linear-gradient(180deg,rgba(30,41,59,.98),rgba(30,41,59,.86));color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item:hover,.rte-slash-popup-dark .rte-slash-item-active{background:#1d4ed8;color:#fff}",".rte-slash-popup-dark .rte-slash-item-icon{color:#cbd5e1;background:#0f172a;box-shadow:inset 0 0 0 1px rgba(148,163,184,.25)}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-icon{color:#fff;background:#1e3a8a}",".rte-slash-popup-dark .rte-slash-item-desc{color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-desc{color:#dbeafe}",".rte-slash-popup-dark .rte-slash-empty{color:#94a3b8}"].join(`
|
|
51
|
+
`),we.head.appendChild(he)}}function z(we){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4v16"/><path d="M14 4v16"/><path d="M6 12h8"/><text x="16" y="18" font-size="9" font-weight="700" fill="currentColor" stroke="none" font-family="-apple-system,Segoe UI,sans-serif">'+we+"</text></svg>"}function J(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4h5"/><path d="M13 4v16"/><path d="M17 4v16"/><path d="M13 4a4 4 0 000 8h0"/></svg>'}function ee(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="7" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="5" cy="17" r="1"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function ue(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h1v3"/><path d="M4 9h2"/><path d="M4 14h2a1 1 0 010 2H4v1h2"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function ve(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/><path d="M16 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/></svg>'}function re(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 8l-4 4 4 4"/><path d="M15 8l4 4-4 4"/></svg>'}function U(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h16"/><path d="M4 6h10"/><path d="M4 18h10"/></svg>'}function F(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="5" width="16" height="14" rx="1"/><path d="M4 10h16"/><path d="M4 15h16"/><path d="M10 5v14"/><path d="M16 5v14"/></svg>'}function $(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="9" cy="10" r="1.5"/><path d="M21 16l-5-5-8 8"/></svg>'}function ne(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a4 4 0 005.7 0l3-3a4 4 0 10-5.7-5.7L11 7"/><path d="M14 10a4 4 0 00-5.7 0l-3 3a4 4 0 105.7 5.7L13 17"/></svg>'}function pe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M8 14c1 1.5 2.5 2 4 2s3-.5 4-2"/><circle cx="9" cy="10" r=".8"/><circle cx="15" cy="10" r=".8"/></svg>'}function Ae(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9h16"/><path d="M9 9v11"/></svg>'}function He(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16"/><path d="M9 3v4"/><path d="M15 3v4"/></svg>'}function Ze(){return'<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="3"/></svg>'}function _t(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M12 9v4"/><path d="M12 16h.01"/></svg>'}function Vt(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="16" rx="1"/><rect x="14" y="4" width="7" height="16" rx="1"/></svg>'}function It(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6-6 6"/></svg>'}function $t(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5h9l-5 14"/><path d="M14 11h6"/><path d="M14 16h6"/></svg>'}function lr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18"/><circle cx="7" cy="7.5" r=".6" fill="currentColor"/></svg>'}function Nt(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17l4-10 4 10"/><path d="M5.5 13.5h5"/><path d="M14 14a2.5 2.5 0 105 0v-3"/><path d="M14 20l2 2 4-4"/></svg>'}function it(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="10" rx="5"/><circle cx="8" cy="12" r="1.6"/><path d="M12 12h6"/></svg>'}function sr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 7l8 6 8-6"/></svg>'}function Gr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="6" height="5" rx="1"/><rect x="15" y="3" width="6" height="5" rx="1"/><rect x="9" y="16" width="6" height="5" rx="1"/><path d="M6 8v3h12V8M12 11v5"/></svg>'}function nr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9v6h4l5 4V5L8 9H4z"/><path d="M16 8.5a4 4 0 010 7"/><path d="M19 6a7 7 0 010 12"/></svg>'}function Vr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="7" rx="1.5"/><path d="M4.5 7.5 6 9l2.5-3"/><line x1="13" y1="6" x2="21" y2="6"/><line x1="13" y1="13" x2="21" y2="13"/><line x1="3" y1="17" x2="21" y2="17"/><line x1="3" y1="20.5" x2="14" y2="20.5"/></svg>'}function Lt(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l3 3 3-3"/><path d="M9 18l3-3 3 3"/><line x1="4" y1="12" x2="20" y2="12"/></svg>'}function Ir(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M6 14h.01M18 14h.01M9 14h6"/></svg>'}function Ai(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><line x1="15.5" y1="15.5" x2="21" y2="21"/></svg>'}function ci(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="9" width="18" height="7" rx="1"/><path d="M7 9V5h10v4"/><line x1="7" y1="20" x2="17" y2="20"/></svg>'}function Ei(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M3 12h3M18 12h3M12 3v3M12 18v3"/></svg>'}function Mn(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="M6 15V9l3 3 3-3v6"/><path d="M17 9v6M14.5 12.5L17 15l2.5-2.5"/></svg>'}function Xr(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 21V9a7 7 0 0114 0v12l-3-2-2 2-2-2-2 2-3-2z"/><circle cx="9.5" cy="10" r="1" fill="currentColor"/><circle cx="14.5" cy="10" r="1" fill="currentColor"/></svg>'}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_smartchips=RTE_Plugin_SmartChips,RTE_DefaultConfig.chipResolver=RTE_DefaultConfig.chipResolver||null,RTE_DefaultConfig.chipDateFormat=RTE_DefaultConfig.chipDateFormat||null;function RTE_Plugin_SmartChips(){var S=this,c,i;S.PluginName="SmartChips",S.InitConfig=function(B){c=B},S.InitEditor=function(B){i=B,i.attachEvent("exec_command_insertdatechip",function(H){H.returnValue=!0,S.OpenDateChip()}),i.attachEvent("exec_command_insertchip",function(H){H.returnValue=!0,S.OpenChipMenu()}),q()};function f(B,H,g,b){var D=B.ownerDocument.createElement(H);return g&&(D.style.cssText=g),b&&(D.className=b),B.appendChild(D),D}function N(B){return String(B??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(B){if(c.chipDateFormat&&typeof c.chipDateFormat=="function")try{return String(c.chipDateFormat(B))}catch{}return A[B.getMonth()]+" "+B.getDate()+", "+B.getFullYear()}function C(B){function H(g){return(g<10?"0":"")+g}return B.getFullYear()+"-"+H(B.getMonth()+1)+"-"+H(B.getDate())}var o={date:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><rect x="2" y="3" width="12" height="11" rx="1.5"/><path d="M2 6.5h12"/><path d="M5 1.5v3"/><path d="M11 1.5v3"/></svg>',person:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="8" cy="5" r="2.6"/><path d="M3 13.5c0-2.5 2.2-4 5-4s5 1.5 5 4"/></svg>',link:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M6.5 9.5a3 3 0 004.2 0l2-2a3 3 0 10-4.2-4.2L7.4 4.3"/><path d="M9.5 6.5a3 3 0 00-4.2 0l-2 2a3 3 0 104.2 4.2l1-1"/></svg>'};function v(B,H,g,b){var D=o[B]||"",P='class="rte-chip rte-chip-'+N(B)+'" data-rte-chip="'+N(B)+'" data-rte-chip-value="'+N(g||H)+'" contenteditable="false"',L='<span class="rte-chip-icon">'+D+'</span><span class="rte-chip-label">'+N(H)+"</span>";if(B==="link"&&b){var I=/^(javascript|data|vbscript):/i.test(b)?"#":b;return"<a "+P+' href="'+N(I)+'" target="_blank" rel="noopener noreferrer">'+L+"</a>"}return"<span "+P+">"+L+"</span>"}function w(B,H,g,b){q(),i.insertHTML(v(B,H,g,b)+"\u200B"),i.focus()}S.OpenDateChip=function(){var B=i.createDialog(i.getLangText&&i.getLangText("insertdatechiptitle")||"Date","rte-dialog-datechip"),H=typeof B.close=="function"?function(){B.close()}:function(){i.closeCurrentPopup()},g=f(B,"div","","rte-chip-dialog rte-chip-date-dialog");f(g,"div","","rte-chip-dialog-copy").textContent="Choose a quick date or insert a custom date chip.";function b(y,O){var K=f(g,"button","","rte-chip-quick");return K.type="button",K.textContent=y+" \u2014 "+E(O),K.onmouseover=function(){K.style.background="#eef2ff"},K.onmouseout=function(){K.style.background="transparent"},K.textContent="",f(K,"span","","rte-chip-quick-label").textContent=y,f(K,"span","","rte-chip-quick-value").textContent=E(O),K.onmouseover=null,K.onmouseout=null,K.setAttribute("aria-label","Insert "+y+", "+E(O)),K.onclick=function(){H(),w("date",E(O),C(O))},K}var D=new Date(i.__chipNow||Date.now());function P(y,O){var K=new Date(y.getTime());return K.setDate(K.getDate()+O),K}b("Today",D),b("Tomorrow",P(D,1)),b("Yesterday",P(D,-1)),b("Next week",P(D,7));var L=f(g,"div","","rte-chip-pick-row"),I=f(L,"input","","rte-chip-input");I.type="date",I.value=C(D),I.setAttribute("aria-label","Custom date");var u=f(L,"button","","rte-chip-action rte-chip-action-primary");u.type="button",u.textContent="Insert",u.onclick=function(){var y=(I.value||"").split("-");if(y.length===3){var O=new Date(parseInt(y[0],10),parseInt(y[1],10)-1,parseInt(y[2],10));H(),w("date",E(O),I.value)}else H()},setTimeout(function(){I.focus()},0)},S.OpenChipMenu=function(){var B=i.createDialog(i.getLangText&&i.getLangText("insertchiptitle")||"Insert chip","rte-dialog-chip"),H=typeof B.close=="function"?function(){B.close()}:function(){i.closeCurrentPopup()},g=f(B,"div","","rte-chip-dialog rte-chip-menu-dialog");f(g,"div","","rte-chip-dialog-copy").textContent="Insert a date, person, or link chip into the document.";var b=f(g,"div","","rte-chip-type-tabs");b.setAttribute("role","tablist"),b.setAttribute("aria-label","Chip type");var D=[["date","Date"],["person","Person"],["link","Link"]],P="date",L=f(g,"div","","rte-chip-dialog-body"),I={};D.forEach(function(K){var T=f(b,"button","","rte-chip-type-tab");T.type="button",T.textContent=K[1],T.setAttribute("role","tab"),T.setAttribute("aria-selected",K[0]===P?"true":"false"),I[K[0]]=T,T.onclick=function(){P=K[0],u(),y()}});function u(){D.forEach(function(K){var T=K[0]===P;I[K[0]].classList.toggle("is-selected",T),I[K[0]].setAttribute("aria-selected",T?"true":"false")})}function y(){if(L.innerHTML="",P==="date"){var K=f(L,"div","","rte-chip-field-label");K.textContent="Insert a date chip:";var T=f(L,"input","","rte-chip-input");T.type="date",T.value=C(new Date(i.__chipNow||Date.now())),T.setAttribute("aria-label","Date chip value"),O(function(){var X=(T.value||"").split("-");if(X.length===3){var G=new Date(+X[0],+X[1]-1,+X[2]);H(),w("date",E(G),T.value)}})}else{var V=f(L,"div","","rte-chip-field-label");V.textContent=P==="person"?"Name (or search):":"URL:";var Z=f(L,"input","","rte-chip-input");Z.type=P==="link"?"url":"text",Z.placeholder=P==="person"?"Jane Doe":"https://example.com",Z.setAttribute("aria-label",P==="person"?"Person chip name":"Link chip URL");var M=f(L,"div","","rte-chip-results");M.setAttribute("role","listbox"),M.setAttribute("aria-label","Chip suggestions"),c.chipResolver&&typeof c.chipResolver=="function"&&(Z.oninput=function(){var X=Z.value.trim();if(M.innerHTML="",!!X)try{var G=c.chipResolver(X,P);G&&G.then&&G.then(function(Y){M.innerHTML="",(Y||[]).slice(0,6).forEach(function(j){var p=f(M,"button","","rte-chip-suggestion");p.type="button",p.textContent=j.label||j.value,p.setAttribute("role","option"),p.onclick=function(){H(),w(P,j.label||j.value,j.value||j.label,j.href)}})})}catch{}}),O(function(){var X=Z.value.trim();if(!X){H();return}if(P==="link"){if(/^(javascript|data|vbscript|file):/i.test(X)){Z.style.borderColor="#dc2626",Z.placeholder="Enter a valid http(s) URL",Z.value="";return}if(!/^https?:\/\//i.test(X))if(/^[a-z0-9.-]+\.[a-z]{2,}([\/?#].*)?$/i.test(X))X="https://"+X;else{Z.style.borderColor="#dc2626",Z.placeholder="Enter a valid http(s) URL",Z.value="";return}H(),w("link",X.replace(/^https?:\/\//i,"").replace(/\/$/,""),X,X)}else H(),w("person",X,X)}),setTimeout(function(){Z.focus()},0)}}function O(K){var T=f(L,"div","","rte-chip-dialog-footer"),V=f(T,"button","","rte-chip-action rte-chip-action-primary");V.type="button",V.textContent="Insert",V.onclick=K}u(),y()};function q(){var B=[".rte-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px 2px 6px;margin:0 1px;border:1px solid rgba(100,116,139,.16);border-radius:999px;background:linear-gradient(180deg,#f8fbff,#eef4ff);color:#315277;font-size:.92em;line-height:1.45;white-space:nowrap;text-decoration:none;vertical-align:baseline;cursor:default;user-select:none;box-shadow:0 1px 2px rgba(15,23,42,.06)}",".rte-chip-icon{display:inline-flex;align-items:center;opacity:.9}",".rte-chip-date{background:linear-gradient(180deg,#f0fdff,#e6f8fb);color:#0e7490;border-color:rgba(14,116,144,.18)}",".rte-chip-person{background:linear-gradient(180deg,#f6f7ff,#eef2ff);color:#3730a3;border-color:rgba(55,48,163,.18)}",".rte-chip-link{background:linear-gradient(180deg,#f5fff8,#ecfdf4);color:#15803d;border-color:rgba(21,128,61,.18);cursor:pointer}",".rte-chip-link:hover{text-decoration:underline}"].join(`
|
|
52
|
+
`);try{var H=i.getDocument();if(!H)return;var g=H.head||H.getElementsByTagName&&H.getElementsByTagName("head")[0]||H.documentElement;if(g&&!H.querySelector("style[data-rte-smartchips]")){var b=H.createElement("style");b.setAttribute("data-rte-smartchips","1"),b.textContent=B,g.appendChild(b)}}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_spellcheck=RTE_Plugin_SpellCheck,RTE_DefaultConfig.spellCheckResolver=RTE_DefaultConfig.spellCheckResolver||null,typeof RTE_DefaultConfig.spellCheckEnabled>"u"&&(RTE_DefaultConfig.spellCheckEnabled=!0);function RTE_Plugin_SpellCheck(){var S=this,c,i;S.PluginName="SpellCheck",S.InitConfig=function(o){c=o},S.InitEditor=function(o){i=o;try{var v=i.getEditable&&i.getEditable();v&&v.setAttribute("spellcheck",c.spellCheckEnabled===!1?"false":"true")}catch{}i.attachEvent("exec_command_spellcheck",function(w){w.returnValue=!0,S.RunSpellCheck()}),C()};function f(o,v,w,q){var B=o.ownerDocument.createElement(v);return w&&(B.style.cssText=w),q&&(B.className=q),o.appendChild(B),B}function N(o){return String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function A(o){try{!i.InvokeEventHook||i.InvokeEventHook("customdialog","spellcheck",o)}catch{}try{var v=i.getEditable(),w=v.ownerDocument,q=w.createElement("div");q.className="rte-spell-toast",q.textContent=o,w.body.appendChild(q),setTimeout(function(){q.parentNode&&q.parentNode.removeChild(q)},2600)}catch{}}function E(o,v){try{for(var w=i.getEditable(),q=i.getDocument(),B=q.createTreeWalker(w,NodeFilter.SHOW_TEXT,null),H,g=new RegExp("\\b"+o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b");H=B.nextNode();){var b=H.parentNode;if(!(b&&(b.nodeName==="CODE"||b.nodeName==="PRE"))){var D=H.data.search(g);if(D>=0)return H.data=H.data.substring(0,D)+v+H.data.substring(D+o.length),!0}}}catch{}return!1}S.RunSpellCheck=function(){if(!c.spellCheckResolver||typeof c.spellCheckResolver!="function"){try{var o=i.getEditable();o.setAttribute("spellcheck","true"),o.focus()}catch{}A(i.getLangText&&i.getLangText("spellchecknative")||"Browser spell-check is on \u2014 misspellings are underlined as you type.");return}var v;try{v=i.getEditable().innerText||""}catch{v=""}if(!v.trim()){A("Nothing to check.");return}var w=i.createDialog(i.getLangText&&i.getLangText("spellchecktitle")||"Spelling","rte-dialog-spell"),q=typeof w.close=="function"?function(){w.close()}:function(){i.closeCurrentPopup()},B=f(w,"div","padding:14px;min-width:420px;max-height:60vh;overflow:auto;font:13px -apple-system,Segoe UI,sans-serif"),H=f(B,"div","color:#64748b;margin-bottom:8px");H.innerText="Checking\u2026";var g=f(B,"div","");function b(y){if(g.innerHTML="",!y||!y.length){H.innerText=i.getLangText&&i.getLangText("spellcheckclean")||"No spelling issues found.";return}H.innerText=y.length+" issue"+(y.length===1?"":"s")+" found.",y.forEach(function(O){if(!(!O||!O.word)){var K=f(g,"div","padding:8px 0;border-bottom:1px solid rgba(15,23,42,.08)","rte-spell-row"),T=f(K,"div","font-weight:600;color:#b91c1c;margin-bottom:4px");T.textContent=O.word;var V=f(K,"div","display:flex;flex-wrap:wrap;gap:6px"),Z=(O.suggestions||[]).slice(0,6);Z.length||(f(V,"span","font-size:12px;color:#94a3b8").textContent="(no suggestions)"),Z.forEach(function(M){var X=f(V,"button","font-size:12px;padding:3px 10px;border:1px solid #cbd5e1;border-radius:14px;background:#f8fafc;cursor:pointer");X.type="button",X.textContent=M,X.onclick=function(){E(O.word,M)&&(K.style.opacity="0.45",T.innerHTML=N(O.word)+' → <span style="color:#16a34a">'+N(M)+"</span>",V.innerHTML="")}})}})}var D=!1;function P(y){D||(D=!0,b(y))}try{var L=c.spellCheckResolver(v);L&&typeof L.then=="function"?(L.then(function(y){P(y||[])},function(){H.innerText="Spell-check service error."}),setTimeout(function(){D||(H.innerText="Spell-check timed out.",D=!0)},12e3)):P(L||[])}catch{H.innerText="Spell-check error."}var I=f(B,"div","display:flex;justify-content:flex-end;margin-top:12px"),u=f(I,"button","padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer");u.type="button",u.textContent="Done",u.onclick=function(){q(),i.focus()}};function C(){var o=[".rte-spell-toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);background:#0f172a;color:#fff;padding:8px 16px;border-radius:8px;font:13px -apple-system,Segoe UI,sans-serif;z-index:2147483600;box-shadow:0 8px 24px rgba(15,23,42,.28)}",".rte-spell-row:last-child{border-bottom:0}"].join(`
|
|
53
|
+
`);try{var v=i&&i.iframe&&i.iframe.ownerDocument||document;if(!v.querySelector("style[data-rte-spellcheck]")){var w=v.createElement("style");w.setAttribute("data-rte-spellcheck","1"),w.textContent=o,(v.head||v.documentElement).appendChild(w)}}catch{}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_todolist=RTE_Plugin_TodoList;function RTE_Plugin_TodoList(){var S=this,c,i,f,N;S.PluginName="TodoList",S.InitConfig=function(w){c=w},S.InitEditor=function(w){i=w,f=i.getEditable(),N=i.getDocument(),i.attachEvent("exec_command_inserttodolist",function(q){q.returnValue=!0,S.InsertTaskList()}),f&&(f.addEventListener("click",function(q){var B=A(q.target,"rte-task-checkbox",f);if(B){var H=B.parentNode;if(!(!H||!H.classList||!H.classList.contains("rte-task-item"))){var g=H.getAttribute("data-checked")==="true";H.setAttribute("data-checked",g?"false":"true"),q.preventDefault(),E()}}}),f.addEventListener("keyup",function(q){if(q.key==="Enter"&&!q.shiftKey){S.Normalize();var B=C();B&&B.setAttribute("data-checked","false")}}),setTimeout(function(){o(N)},0))};function A(w,q,B){for(;w&&w!==B;){if(w.nodeType===1&&w.classList&&w.classList.contains(q))return w;w=w.parentNode}return null}function E(){if(typeof i.fireChange=="function")try{i.fireChange()}catch{}}function C(){try{var w=i.getSelection();if(!w||w.rangeCount===0)return null;var q=w.getRangeAt(0).startContainer;return A(q,"rte-task-item",f)}catch{return null}}function o(w){if(!(!w||w.getElementById("rte-todolist-styles"))){var q="ul.rte-task-list{list-style:none;margin:.4em 0;padding-left:0;}ul.rte-task-list li.rte-task-item{position:relative;padding-left:28px;margin:3px 0;min-height:20px;}li.rte-task-item>.rte-task-checkbox{position:absolute;left:0;top:1px;width:18px;height:18px;border:2px solid #94a3b8;border-radius:5px;box-sizing:border-box;cursor:pointer;user-select:none;transition:background .12s,border-color .12s;}li.rte-task-item>.rte-task-checkbox:hover{border-color:#1d67ba;}li.rte-task-item[data-checked='true']>.rte-task-checkbox{background:#1d67ba;border-color:#1d67ba;}li.rte-task-item[data-checked='true']>.rte-task-checkbox::after{content:'';position:absolute;left:4px;top:0px;width:6px;height:11px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);}li.rte-task-item[data-checked='true']{color:#94a3b8;text-decoration:line-through;}",B=w.createElement("style");B.id="rte-todolist-styles",B.appendChild(w.createTextNode(q)),(w.head||w.getElementsByTagName("head")[0]||w.documentElement).appendChild(B)}}function v(){var w=N.createElement("span");return w.className="rte-task-checkbox",w.setAttribute("contenteditable","false"),w}S.Normalize=function(){if(f)for(var w=f.querySelectorAll("ul.rte-task-list"),q=0;q<w.length;q++)for(var B=w[q].children,H=0;H<B.length;H++){var g=B[H];if(g.nodeName==="LI"){g.classList.add("rte-task-item"),g.getAttribute("data-checked")!=="true"&&g.getAttribute("data-checked")!=="false"&&g.setAttribute("data-checked","false");var b=g.firstChild;b&&b.nodeType===1&&b.classList&&b.classList.contains("rte-task-checkbox")||g.insertBefore(v(),g.firstChild)}}},S.InsertTaskList=function(){o(N);var w="rte-todo-pending",q='<ul class="rte-task-list"><li class="rte-task-item" data-checked="false" id="'+w+'"><span class="rte-task-checkbox" contenteditable="false"></span>​</li></ul>';i.insertHTML(q);try{var B=N.getElementById(w);if(B){B.removeAttribute("id");var H=N.createRange(),g=B.lastChild;g&&g.nodeType===3?H.setStart(g,g.length):H.setStart(B,B.childNodes.length),H.collapse(!0);var b=i.getSelection();b&&(b.removeAllRanges(),b.addRange(H))}}catch{}i.focus(),E()}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.svgCode_trackchanges||(RTE_DefaultConfig.svgCode_trackchanges='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 17l4-1 10-10-3-3L5 13l-1 4z"/><path d="M14 4l3 3"/><path d="M4 21h10"/></svg>'),RTE_DefaultConfig.plugin_trackedchanges=RTE_Plugin_TrackedChanges;function RTE_Plugin_TrackedChanges(){var S=this,c,i,f=!1;S.PluginName="TrackedChanges",S.InitConfig=function(U){c=U,c.trackChangesEnabled!==!1&&(c.currentUser=c.currentUser||null,c.trackChangesInsertClass=c.trackChangesInsertClass||"rte-tc rte-tc-insert",c.trackChangesDeleteClass=c.trackChangesDeleteClass||"rte-tc rte-tc-delete",c.text_trackchanges=c.text_trackchanges||"Suggesting mode",N("toolbar_default","#{trackchanges}"),N("toolbar_full","#{trackchanges}"),N("toolbar_mobile","#{trackchanges}"),(c.controltoolbar_TEXT||"").indexOf("trackchanges")===-1&&(c.controltoolbar_TEXT=(c.controltoolbar_TEXT||"")+"|{trackchanges}"))},S.InitEditor=function(U){i=U,c.trackChangesEnabled!==!1&&(i.trackedChanges={enable:function(F){A(F)},disable:function(){E()},isEnabled:function(){return f},acceptAll:function(F){return J(F)},rejectAll:function(F){return ee(F)},accept:function(F){return x(F)},reject:function(F){return z(F)},list:function(F){if(!i.reviewLedger)return[];var $=F&&F.all===!0;return i.reviewLedger.list().filter(function(ne){return ne.changeType!=="insert"&&ne.changeType!=="delete"?!1:$||ne.status==="pending"})}},re(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.trackchanges=function(F){var $=i.createToolbarButton(F);return $.__tcSync=function(){f?$.classList.add("rte-ui-active"):$.classList.remove("rte-ui-active"),$.setAttribute("aria-pressed",f?"true":"false"),$.setAttribute("title",f?"Suggesting mode is on":"Turn on suggesting mode")},$.__tcSync(),$},i.attachEvent("exec_command_trackchanges",function(F){F.returnValue=!0,F.stopBubble=!0,f?E():A()}),i.getEditable().addEventListener("beforeinput",o,!0))};function N(U,F){c[U]&&c[U].indexOf(F)===-1&&(c[U]=c[U]+F)}function A(U){U&&(c.currentUser=U),c.currentUser||(c.currentUser={id:"user",name:"User",color:"#2563eb"},console.warn("trackedchanges: no config.currentUser configured; defaulting to generic user.")),f=!0,C()}function E(){f=!1,C()}function C(){for(var U=i.iframe&&i.iframe.ownerDocument||document,F=U.querySelectorAll(".rte_command_trackchanges"),$=0;$<F.length;$++)F[$].__tcSync&&F[$].__tcSync()}function o(U){if(f&&i.reviewLedger){var F=U.inputType;if(F){if(F==="insertText"||F==="insertReplacementText"){U.preventDefault(),v(U.data||"");return}if(F==="deleteContentBackward"||F==="deleteContentForward"||F==="deleteByCut"){U.preventDefault(),b(F);return}}}}function v(U){if(U){var F=i.getSelection();if(!(!F||F.rangeCount===0)){var $=F.getRangeAt(0);if(!$.collapsed){if(!M($))return;$=F.getRangeAt(0),H(U,$);return}var ne=w($);ne?B(ne,U):H(U,$)}}}function w(U){var F=U.startContainer;if(F.nodeType===3&&F.parentNode&&q(F.parentNode))return F.parentNode;if(F.nodeType===1&&U.startOffset>0){var $=F.childNodes[U.startOffset-1];if($&&$.nodeType===1&&q($))return $}return F.nodeType===3&&F.previousSibling&&q(F.previousSibling)&&U.startOffset===0?F.previousSibling:null}function q(U){return!U||U.nodeType!==1||!U.classList||!U.classList.contains("rte-tc-insert")?!1:U.getAttribute("data-tc-author")===c.currentUser.id}function B(U,F){var $=i.getDocument(),ne=U.lastChild,pe;ne&&ne.nodeType===3?(ne.nodeValue=ne.nodeValue+F,pe=ne):(pe=$.createTextNode(F),U.appendChild(pe)),h(pe),g(U)}function H(U,F){var $=i.getDocument(),ne=$.createElement("span");ne.className=c.trackChangesInsertClass;var pe=c.currentUser,Ae="tc-"+Date.now()+"-"+Math.floor(Math.random()*1e4);ne.setAttribute("data-tc-id",Ae),ne.setAttribute("data-tc-author",pe.id),ne.setAttribute("data-tc-at",new Date().toISOString()),ne.style.color=pe.color,ne.style.textDecoration="underline",ne.appendChild($.createTextNode(U)),F.insertNode(ne),h(ne.firstChild),i.reviewLedger.add({id:Ae,changeType:"insert",author:pe,text:U,status:"pending",sourceLabel:"Suggested insert",createdAt:Date.now()})}function g(U){var F=U.getAttribute("data-tc-id");F&&i.reviewLedger.update(F,{text:U.textContent})}function b(U){var F=i.getSelection();if(!(!F||F.rangeCount===0)){var $=F.getRangeAt(0);if(!$.collapsed){M($);return}var ne=i.getDocument().createRange();if(U==="deleteContentBackward"){var pe=L($.startContainer,$.startOffset);if(!pe)return;ne.setStart(pe.node,pe.offset),ne.setEnd(pe.node,pe.offset+1)}else{var Ae=I($.startContainer,$.startOffset);if(!Ae)return;ne.setStart(Ae.node,Ae.offset-1),ne.setEnd(Ae.node,Ae.offset)}if(Z(ne)){ne.deleteContents();var He=i.getSelection();He.removeAllRanges(),He.addRange(ne),k();return}M(ne)}}function D(U){for(var F=U.nodeType===1?U:U.parentNode;F&&F!==i.getEditable();){if(F.classList&&F.classList.contains("rte-tc-delete"))return!0;F=F.parentNode}return!1}function P(){for(var U=i.getEditable(),F=i.getDocument().createTreeWalker(U,NodeFilter.SHOW_TEXT,{acceptNode:function(pe){return D(pe)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),$=[],ne;ne=F.nextNode();)$.push(ne);return $}function L(U,F){var $=P();if(!$.length)return null;var ne=u(U,F,$);return ne<=0?null:y(ne-1,$)}function I(U,F){var $=P();if(!$.length)return null;for(var ne=0,pe=0;pe<$.length;pe++)ne+=$[pe].nodeValue.length;var Ae=u(U,F,$);return Ae>=ne?null:y(Ae+1,$)}function u(U,F,$){var ne=i.getDocument().createRange();ne.setStart(U,F),ne.collapse(!0);for(var pe=0,Ae=0;Ae<$.length;Ae++){var He=$[Ae],Ze=ne.comparePoint(He,He.nodeValue.length);if(Ze<=0){pe+=He.nodeValue.length;continue}var _t=ne.comparePoint(He,0);if(_t>=0)break;for(var Vt=0,It=He.nodeValue.length;Vt<It;){var $t=Vt+It>>1;ne.comparePoint(He,$t)<0?Vt=$t+1:It=$t}pe+=Vt;break}return pe}function y(U,F){for(var $=U,ne=0;ne<F.length;ne++){if($<=F[ne].nodeValue.length)return{node:F[ne],offset:$};$-=F[ne].nodeValue.length}return null}function O(U){if(!U)return null;if(U.nodeType===3)return U;var F=i.getDocument().createTreeWalker(U,NodeFilter.SHOW_TEXT);return F.nextNode()}function K(U){if(!U)return null;if(U.nodeType===3)return U;for(var F=i.getDocument().createTreeWalker(U,NodeFilter.SHOW_TEXT),$=null,ne;ne=F.nextNode();)$=ne;return $}function T(U){for(var F=i.getEditable(),$=i.getDocument().createTreeWalker(F,NodeFilter.SHOW_TEXT),ne=null,pe;pe=$.nextNode();){if(pe===U)return ne;ne=pe}return null}function V(U){for(var F=i.getEditable(),$=i.getDocument().createTreeWalker(F,NodeFilter.SHOW_TEXT),ne=!1,pe;pe=$.nextNode();){if(ne)return pe;pe===U&&(ne=!0)}return null}function Z(U){for(var F=U.startContainer.parentNode;F&&F!==i.getEditable();){if(q(F))return U.endContainer.parentNode===F||F.contains(U.endContainer);F=F.parentNode}return!1}function M(U){if(U.collapsed)return!1;var F=i.getDocument(),$=U.cloneContents();if(!p($))return!1;var ne=c.currentUser,pe=X(U,"before",ne),Ae=X(U,"after",ne);if(U.deleteContents(),pe){if(Y(pe,$),Ae&&Ae!==pe){for(;Ae.firstChild;)pe.appendChild(Ae.firstChild);var He=Ae.getAttribute("data-tc-id");Ae.remove(),He&&i.reviewLedger&&i.reviewLedger.remove(He)}var Ze=F.createRange();Ze.setStartAfter(pe),Ze.collapse(!0);var _t=i.getSelection();_t.removeAllRanges(),_t.addRange(Ze);var Vt=pe.getAttribute("data-tc-id");return Vt&&i.reviewLedger&&i.reviewLedger.update(Vt,{text:pe.textContent}),!0}if(Ae){j(Ae,$);var It=F.createRange();It.setStartBefore(Ae),It.collapse(!0);var $t=i.getSelection();$t.removeAllRanges(),$t.addRange(It);var lr=Ae.getAttribute("data-tc-id");return lr&&i.reviewLedger&&i.reviewLedger.update(lr,{text:Ae.textContent}),!0}var Nt=F.createElement("span");Nt.className=c.trackChangesDeleteClass;var it="tc-"+Date.now()+"-"+Math.floor(Math.random()*1e4);Nt.setAttribute("data-tc-id",it),Nt.setAttribute("data-tc-author",ne.id),Nt.setAttribute("data-tc-at",new Date().toISOString()),Nt.style.color=ne.color,Nt.style.textDecoration="line-through",Nt.appendChild($),U.insertNode(Nt);var sr=F.createRange();sr.setStartAfter(Nt),sr.collapse(!0);var Gr=i.getSelection();return Gr.removeAllRanges(),Gr.addRange(sr),i.reviewLedger.add({id:it,changeType:"delete",author:ne,text:Nt.textContent,originalHtml:Nt.innerHTML,status:"pending",sourceLabel:"Suggested delete",createdAt:Date.now()}),!0}function X(U,F,$){var ne=F==="before"?U.startContainer:U.endContainer,pe=F==="before"?U.startOffset:U.endOffset;if(ne.nodeType===3){if(F==="before"&&pe===0){var Ae=ne.previousSibling;if(Ae&&G(Ae,$))return Ae}if(F==="after"&&pe===ne.nodeValue.length){var He=ne.nextSibling;if(He&&G(He,$))return He}return null}if(F==="before"&&pe>0){var Ze=ne.childNodes[pe-1];if(Ze&&G(Ze,$))return Ze}if(F==="after"&&pe<ne.childNodes.length){var _t=ne.childNodes[pe];if(_t&&G(_t,$))return _t}return null}function G(U,F){return!U||U.nodeType!==1||!U.classList||!U.classList.contains("rte-tc-delete")?!1:U.getAttribute("data-tc-author")===F.id}function Y(U,F){for(;F.firstChild;)U.appendChild(F.firstChild)}function j(U,F){for(var $=U.firstChild;F.firstChild;)U.insertBefore(F.firstChild,$)}function p(U){var F=(U.textContent||"").replace(/\s+/g,"");return!!F}function k(){for(var U=i.getEditable().querySelectorAll(".rte-tc-insert"),F=0;F<U.length;F++){var $=U[F];if(!$.textContent||!$.textContent.length){var ne=$.getAttribute("data-tc-id");ne&&i.reviewLedger&&i.reviewLedger.remove(ne),$.remove()}else g($)}}function h(U){if(U){var F=i.getDocument(),$=F.createRange();U.nodeType===3?$.setStart(U,U.nodeValue.length):$.setStart(U,U.childNodes.length),$.collapse(!0);var ne=i.getSelection();ne.removeAllRanges(),ne.addRange($)}}function x(U){var F=i.reviewLedger.get(U);if(!F)return!1;var $=i.getEditable().querySelector('[data-tc-id="'+ve(U)+'"]');return F.changeType==="insert"?$&&ue($):F.changeType==="delete"&&$&&$.remove(),i.reviewLedger.update(U,{status:"accepted",decidedAt:Date.now()}),!0}function z(U){var F=i.reviewLedger.get(U);if(!F)return!1;var $=i.getEditable().querySelector('[data-tc-id="'+ve(U)+'"]');return F.changeType==="insert"?$&&$.remove():F.changeType==="delete"&&$&&ue($),i.reviewLedger.update(U,{status:"rejected",decidedAt:Date.now()}),!0}function J(U){for(var F=i.reviewLedger.list(U).filter(function(ne){return(ne.changeType==="insert"||ne.changeType==="delete")&&ne.status==="pending"}),$=0;$<F.length;$++)x(F[$].id);return F.length}function ee(U){for(var F=i.reviewLedger.list(U).filter(function(ne){return(ne.changeType==="insert"||ne.changeType==="delete")&&ne.status==="pending"}),$=0;$<F.length;$++)z(F[$].id);return F.length}function ue(U){var F=U.parentNode;if(F){for(;U.firstChild;)F.insertBefore(U.firstChild,U);F.removeChild(U)}}function ve(U){var F=String(U);if(typeof CSS<"u"&&typeof CSS.escape=="function")try{return CSS.escape(F)}catch{}return F.replace(/["\\\]\[\(\)\{\}'#:;,<>=`~!@$%^&*+/?\s\x00-\x1F]/g,function($){return"\\"+$})}function re(){var U=i&&i.iframe&&i.iframe.ownerDocument||document;if(!U.querySelector("style[data-rte-trackchanges]")){var F=U.createElement("style");F.setAttribute("data-rte-trackchanges","1"),F.textContent=[".richtexteditor rte-toolbar-button.rte_command_trackchanges{position:relative;border-radius:8px;transition:background .14s ease,color .14s ease,box-shadow .14s ease}",".richtexteditor rte-toolbar-button.rte_command_trackchanges.rte-ui-active{background:linear-gradient(135deg,#e9f7ef,#eef5ff);color:#17633f;box-shadow:inset 0 0 0 1px rgba(34,132,82,.28),0 6px 14px rgba(34,132,82,.12)}",".richtexteditor rte-toolbar-button.rte_command_trackchanges.rte-ui-active:after{content:'';position:absolute;right:5px;top:5px;width:6px;height:6px;border-radius:50%;background:#22a66a;box-shadow:0 0 0 2px #fff}",".rte-tc{border-radius:4px;padding:0 2px;box-decoration-break:clone;-webkit-box-decoration-break:clone}",".rte-tc-insert{background:linear-gradient(180deg,rgba(232,248,239,.78),rgba(232,248,239,.38));color:#125b39;text-decoration:underline;text-decoration-color:#22a66a;text-decoration-thickness:2px;text-underline-offset:3px}",".rte-tc-delete{background:linear-gradient(180deg,rgba(255,240,240,.82),rgba(255,240,240,.42));color:#9f1d1d;text-decoration:line-through;text-decoration-color:#dc4c4c;text-decoration-thickness:2px;opacity:.92}"].join(`
|
|
54
|
+
`),U.head.appendChild(F)}var $=i.getDocument();if($&&$.head&&!$.querySelector("style[data-rte-trackchanges-inline]")){var ne=$.createElement("style");ne.setAttribute("data-rte-trackchanges-inline","1"),ne.textContent=[".rte-tc{border-radius:4px;padding:0 2px;box-decoration-break:clone;-webkit-box-decoration-break:clone}",".rte-tc-insert{background:linear-gradient(180deg,rgba(232,248,239,.78),rgba(232,248,239,.38));color:#125b39;text-decoration:underline;text-decoration-color:#22a66a;text-decoration-thickness:2px;text-underline-offset:3px}",".rte-tc-delete{background:linear-gradient(180deg,rgba(255,240,240,.82),rgba(255,240,240,.42));color:#9f1d1d;text-decoration:line-through;text-decoration-color:#dc4c4c;text-decoration-thickness:2px;opacity:.92}"].join(`
|
|
55
|
+
`),$.head.appendChild(ne)}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_typewriter=RTE_Plugin_Typewriter,typeof RTE_DefaultConfig.typewriterModeEnabled>"u"&&(RTE_DefaultConfig.typewriterModeEnabled=!1),typeof RTE_DefaultConfig.focusModeEnabled>"u"&&(RTE_DefaultConfig.focusModeEnabled=!1),typeof RTE_DefaultConfig.typewriterAnchor>"u"&&(RTE_DefaultConfig.typewriterAnchor=.5);function RTE_Plugin_Typewriter(){var S=this,c,i,f=!1,N=!1,A=null,E=!1,C=0;S.PluginName="Typewriter",S.InitConfig=function(u){c=u,f=!!c.typewriterModeEnabled,N=!!c.focusModeEnabled},S.InitEditor=function(u){i=u,o();try{i.attachEvent("ready",o)}catch{}try{i.attachEvent("aftersethtml",o)}catch{}setTimeout(o,0),setTimeout(o,200),i.setTypewriterMode=function(y){return f=!!y,D(),f},i.setFocusMode=function(y){return N=!!y,D(),N},i.toggleTypewriterMode=function(){return f=!f,D(),f},i.toggleFocusMode=function(){return N=!N,D(),N},i.isTypewriterMode=function(){return f},i.isFocusMode=function(){return N}};function o(){var u=i.getDocument();u&&(P(u),u!==A&&(u.addEventListener("keyup",B,!0),u.addEventListener("mouseup",B,!0),u.addEventListener("input",B,!0),A=u)),I(),D()}function v(u){return u&&u.nodeType===1&&/^(P|H[1-6]|LI|BLOCKQUOTE|PRE|DIV|TD|TH|FIGCAPTION)$/.test(u.nodeName)}function w(){try{var u=i.getSelection();if(!u||u.rangeCount===0)return null;var y=i.getEditable(),O=u.getRangeAt(0).startContainer;O&&O.nodeType===3&&(O=O.parentNode);for(var K=null;O&&O!==y;)v(O)&&(K=O),O=O.parentNode;return K}catch{return null}}function q(){try{var u=i.getSelection();if(!u||u.rangeCount===0)return null;var y=u.getRangeAt(0).cloneRange(),O=y.getBoundingClientRect();if(O&&(O.top||O.bottom||O.height))return O;var K=w();return K?K.getBoundingClientRect():null}catch{return null}}function B(){if(!(!f&&!N)&&!C){var u=typeof requestAnimationFrame=="function"?requestAnimationFrame:function(y){return setTimeout(y,16)};C=u(function(){C=0,N&&H(),f&&g()})}}function H(){var u=i.getEditable();if(u){for(var y=u.querySelectorAll(".rte-focus-current"),O=0;O<y.length;O++)y[O].classList.remove("rte-focus-current");var K=w();K&&K.classList.add("rte-focus-current")}}function g(){var u=i.getDocument();if(u){var y=q();if(y){var O=u.defaultView||u.parentWindow;if(O){var K=O.innerHeight||u.documentElement.clientHeight;if(K){var T=K*b(c.typewriterAnchor,.15,.85),V=y.top+y.height/2,Z=V-T;if(!(Math.abs(Z)<2)){var M=u.scrollingElement||u.documentElement||u.body;if(M&&M.scrollHeight-M.clientHeight<=4){var X=i.getEditable();X&&X.scrollHeight-X.clientHeight>4&&(M=X)}M&&(M.scrollTop+=Z)}}}}}}function b(u,y,O){return u=typeof u=="number"&&!isNaN(u)?u:.5,u<y?y:u>O?O:u}function D(){var u=i.getEditable();if(u){if(N)u.classList.add("rte-focus-active"),H();else{u.classList.remove("rte-focus-active");for(var y=u.querySelectorAll(".rte-focus-current"),O=0;O<y.length;O++)y[O].classList.remove("rte-focus-current")}f?(u.classList.add("rte-typewriter-active"),g()):u.classList.remove("rte-typewriter-active")}}function P(u){if(!(!u||u.getElementById("rte-typewriter-styles"))){var y=".rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2,.rte-focus-active h3,.rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li,.rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{opacity:.28;transition:opacity .18s ease;}.rte-focus-active .rte-focus-current,.rte-focus-active .rte-focus-current *{opacity:1 !important;}.rte-typewriter-active{padding-bottom:45vh !important;}@media (prefers-reduced-motion: reduce){.rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2,.rte-focus-active h3,.rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li,.rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{transition:none !important;}}",O=u.createElement("style");O.id="rte-typewriter-styles",O.appendChild(u.createTextNode(y)),(u.head||u.getElementsByTagName("head")[0]||u.documentElement).appendChild(O)}}function L(){var u=i.getEditable();if(!u)return function(){};for(var y=u.querySelectorAll(".rte-focus-current"),O=0;O<y.length;O++)y[O].classList.remove("rte-focus-current");return function(){for(var T=0;T<y.length;T++)y[T].classList.add("rte-focus-current")}}function I(){if(!E){for(var u=["getHTMLCode","getJSON","getHTMLContent"],y=!1,O=0;O<u.length;O++)(function(K){var T=i[K];if(!(typeof T!="function"||T.__rteTwWrapped)){var V=function(){var Z=L();try{return T.apply(i,arguments)}finally{Z()}};V.__rteTwWrapped=!0,i[K]=V,y=!0}})(u[O]);y&&(E=!0)}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_wordexport=RTE_Plugin_WordExport,typeof RTE_DefaultConfig.wordExport>"u"&&(RTE_DefaultConfig.wordExport=!0);function RTE_Plugin_WordExport(){var S=this,c,i;S.PluginName="WordExport",S.InitConfig=function(w){c=w},S.InitEditor=function(w){if(i=w,c.wordExport!==!1&&(i.getWordDocument=function(q){return A(q||{})},i.exportToWord=function(q,B){var H=A(B||{}),g=o(q)||o(c.wordExportFileName)||C();return v(H,g+".doc")},i.downloadWord=i.exportToWord,i.attachEvent("exec_command_exportword",function(q){q.returnValue=!0,q.stopBubble=!0;try{i.exportToWord()}catch(B){window.console&&console.error("wordexport:",B)}}),i.slashCommands&&typeof i.slashCommands.register=="function"))try{i.slashCommands.register({id:"export-word",title:"Export to Word",description:"Download the document as a .doc Word file",keywords:["word","doc","docx","export","download"],run:function(){i.exportToWord()}})}catch{}};function f(w){return String(w??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function N(){if(i&&typeof i.getHTMLCode=="function"){var w=i.getHTMLCode();if(w!=null)return w}var q=i&&i.getEditable?i.getEditable():null;return q?q.innerHTML:""}function A(w){var q=w.fontFamily||c.wordExportFontFamily||"Calibri, 'Segoe UI', Arial, sans-serif",B=w.fontSize||c.wordExportFontSize||"11pt",H=w.pageSize||c.wordExportPageSize||"8.5in 11in",g=w.margin||c.wordExportMargin||"1in",b=typeof w.landscape<"u"?w.landscape:c.wordExportLandscape,D=f(w.title||E()||"Document"),P="Print",L=b?"landscape":"portrait";return`<!DOCTYPE html>\r
|
|
56
|
+
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">\r
|
|
57
|
+
<head>\r
|
|
58
|
+
<meta charset="utf-8">\r
|
|
59
|
+
<meta name="ProgId" content="Word.Document">\r
|
|
60
|
+
<title>`+D+`</title>\r
|
|
61
|
+
<!--[if gte mso 9]><xml>\r
|
|
62
|
+
<w:WordDocument><w:View>`+P+`</w:View><w:Zoom>100</w:Zoom><w:DoNotOptimizeForBrowser/></w:WordDocument>\r
|
|
63
|
+
</xml><![endif]-->\r
|
|
64
|
+
<style>\r
|
|
65
|
+
@page { size: `+f(H)+" "+L+"; margin: "+f(g)+`; }\r
|
|
66
|
+
body { font-family: `+f(q)+"; font-size: "+f(B)+`; color: #000; }\r
|
|
67
|
+
table { border-collapse: collapse; }\r
|
|
68
|
+
td, th { border: 1px solid #999; padding: 4px 8px; }\r
|
|
69
|
+
img { max-width: 100%; height: auto; }\r
|
|
70
|
+
blockquote { border-left: 3px solid #ccc; margin-left: 0; padding-left: 12px; color: #444; }\r
|
|
71
|
+
pre { font-family: Consolas, 'Courier New', monospace; background: #f4f4f4; padding: 8px; }\r
|
|
72
|
+
</style>\r
|
|
73
|
+
</head>\r
|
|
74
|
+
<body>\r
|
|
75
|
+
`+N()+`\r
|
|
76
|
+
</body>\r
|
|
77
|
+
</html>`}function E(){try{var w=i.getEditable();if(w){var q=w.querySelector("h1,h2,h3");if(q&&q.textContent)return q.textContent.trim().slice(0,80)}}catch{}return""}function C(){var w=E(),q=o(w);return q||"document"}function o(w){return w?String(w).replace(/[\\/:*?"<>|-]+/g," ").replace(/\s+/g," ").trim().slice(0,80):""}function v(w,q){try{var B=new Blob(["\uFEFF",w],{type:"application/msword;charset=utf-8"}),H=URL.createObjectURL(B),g=document.createElement("a");return g.href=H,g.download=q,g.style.display="none",document.body.appendChild(g),g.click(),setTimeout(function(){try{document.body.removeChild(g)}catch{}try{URL.revokeObjectURL(H)}catch{}},0),!0}catch(b){return window.console&&console.error("wordexport download failed:",b),!1}}}window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_yjscollab=RTE_Plugin_YjsCollab;function RTE_Plugin_YjsCollab(){var S=this,c,i,f=null,N={},A=!1,E=null,C=null;S.PluginName="YjsCollab",S.InitConfig=function(M){c=M,c.collabEnabled!==!1&&(c.collabLedgerMapName=c.collabLedgerMapName||"reviewLedger",c.collabShowPresence=c.collabShowPresence!==!1,c.collabShowRemoteCursors=c.collabShowRemoteCursors!==!1)},S.InitEditor=function(M){i=M,c.collabEnabled!==!1&&(i.collab={attach:function(X){return o(X)},detach:function(){return v()},isAttached:function(){return!!f},getSession:function(){return f},peers:function(){return f?b():[]},setUser:function(X){f&&w(X)}},Z())};function o(M){f&&v(),M=M||{};var X=M.doc,G=M.provider;if(!X||typeof X.getMap!="function")return console.warn("yjscollab: attach() requires a Y.Doc via options.doc"),null;if(!G||!G.awareness)return console.warn("yjscollab: attach() requires a provider with an awareness field"),null;var Y=M.user||c.currentUser||{id:"user",name:"User",color:"#2563eb"},j=X.getMap(c.collabLedgerMapName),p=M.textSync;p===void 0&&(p=c.collabTextSync==="crdt"?"crdt":c.collabTextSync===!0);var k,h=null,x=null;if(p==="crdt"){var z=typeof window<"u"?window.RichTextEditorCrdt:null;z&&typeof z.attachCrdtBinding=="function"?k="crdt":(console.warn('yjscollab: textSync "crdt" requested but richtexteditor/plugins/crdt-engine.js is not loaded \u2014 falling back to legacy snapshot mode.'),k="legacy",h=X.getText(c.collabTextName||"richtextbox.body"))}else p===!0?(k="legacy",h=X.getText(c.collabTextName||"richtextbox.body")):k="off";if(f={doc:X,provider:G,awareness:G.awareness,ledgerMap:j,textMap:h,textSyncEnabled:k!=="off",textSyncMode:k,crdtBinding:x,user:Y,cleanup:[]},f.awareness.setLocalStateField("user",{id:Y.id,name:Y.name,color:Y.color}),q(),g(),i.reviewLedger&&(P(),L()),f.textSyncMode==="crdt")try{f.crdtBinding=window.RichTextEditorCrdt.attachCrdtBinding({editable:i.getEditable(),ydoc:X,provider:G,awareness:G.awareness,fragmentName:M.fragmentName||"default",Y:M.Y||(typeof window<"u"?window.Y:null)}),f.cleanup.push(function(){try{f.crdtBinding&&f.crdtBinding.dispose()}catch{}})}catch(J){console.warn("yjscollab: CRDT engine attach failed; falling back to legacy mode.",J),f.textSyncMode="legacy",f.textMap=X.getText(c.collabTextName||"richtextbox.body"),D()}else f.textSyncMode==="legacy"&&f.textMap&&D();return c.collabShowRemoteCursors&&u(),c.collabShowPresence&&O(),K(),y(),f}function v(){if(f){for(var M=0;M<f.cleanup.length;M++)try{f.cleanup[M]()}catch{}try{f.awareness.setLocalState(null)}catch{}E&&E.parentNode&&E.parentNode.removeChild(E),E=null,C&&C.parentNode&&C.parentNode.removeChild(C),C=null,f=null}}function w(M){f&&(f.user=M,f.awareness.setLocalStateField("user",{id:M.id,name:M.name,color:M.color}))}function q(){var M=i.getDocument(),X=function(){if(f){var G=i.getSelection();if(!G||G.rangeCount===0){f.awareness.setLocalStateField("caret",null);return}var Y=G.getRangeAt(0),j=B(Y);f.awareness.setLocalStateField("caret",j)}};M.addEventListener("selectionchange",X),M.addEventListener("input",X),f.cleanup.push(function(){M.removeEventListener("selectionchange",X),M.removeEventListener("input",X)})}function B(M){for(var X=i.getEditable(),G=M.startContainer;G&&G.parentNode!==X;){if(!G.parentNode)return null;G=G.parentNode}if(!G)return null;var Y=Array.prototype.slice.call(X.children),j=Y.indexOf(G);if(j<0)return null;for(var p=0,k=i.getDocument().createTreeWalker(G,NodeFilter.SHOW_TEXT),h;h=k.nextNode();){if(h===M.startContainer)return p+=M.startOffset,{blockIndex:j,offset:p,collapsed:M.collapsed};p+=h.nodeValue.length}return{blockIndex:j,offset:0,collapsed:M.collapsed}}function H(M){if(!M)return null;var X=i.getEditable(),G=X.children[M.blockIndex];if(!G)return null;for(var Y=M.offset,j=i.getDocument().createTreeWalker(G,NodeFilter.SHOW_TEXT),p;p=j.nextNode();){if(Y<=p.nodeValue.length){var k=i.getDocument().createRange();return k.setStart(p,Y),k.collapse(!0),k}Y-=p.nodeValue.length}var h=i.getDocument().createRange();return h.selectNodeContents(G),h.collapse(!1),h}function g(){var M=function(){y(),K()};f.awareness.on("change",M),f.cleanup.push(function(){f.awareness.off("change",M)})}function b(){var M=f.awareness.getStates(),X=f.awareness.clientID,G=[];return M.forEach(function(Y,j){j===X||!Y||!Y.user||G.push({clientId:j,user:Y.user,caret:Y.caret||null})}),G}function D(){var M=!1,X=!1,G=null,Y=null;function j(){return i&&i.getHTMLCode?i.getHTMLCode():""}function p(){try{var $=i.getDocument&&i.getDocument(),ne=$&&$.body;if(!ne)return null;var pe=$.getSelection?$.getSelection():null;if(!pe||pe.rangeCount===0)return null;var Ae=pe.getRangeAt(0);if(!ne.contains(Ae.startContainer))return null;var He=$.createRange();return He.selectNodeContents(ne),He.setEnd(Ae.startContainer,Ae.startOffset),He.toString().length}catch{return null}}function k($){if($!=null)try{var ne=i.getDocument&&i.getDocument(),pe=ne&&ne.body;if(!pe)return;for(var Ae=ne.createTreeWalker(pe,NodeFilter.SHOW_TEXT,null),He=$,Ze=null,_t=0;Ae.nextNode();){var Vt=Ae.currentNode,It=Vt.nodeValue?Vt.nodeValue.length:0;if(He<=It){Ze=Vt,_t=He;break}He-=It}if(!Ze){for(var $t=null,lr=ne.createTreeWalker(pe,NodeFilter.SHOW_TEXT,null);lr.nextNode();)$t=lr.currentNode;if(!$t)return;Ze=$t,_t=$t.nodeValue.length}var Nt=ne.getSelection?ne.getSelection():null;if(!Nt)return;var it=ne.createRange();it.setStart(Ze,_t),it.collapse(!0),Nt.removeAllRanges(),Nt.addRange(it)}catch{}}function h($){if(!(!i||!i.setHTMLCode)){var ne=p();M=!0;try{i.setHTMLCode($)}finally{M=!1}setTimeout(function(){k(ne)},0)}}var x=f.textMap.toString();if(x&&x.length>0)h(x),Y=x;else{var z=j();z&&f.textMap.insert(0,z),Y=z}var J=function($,ne){if(!X&&!(ne&&ne.local)){var pe=f.textMap.toString();pe!==Y&&(h(pe),Y=pe,U())}};f.textMap.observe(J),f.cleanup.push(function(){f.textMap.unobserve(J)});var ee=function(){M||G||(U(),G=setTimeout(function(){if(G=null,!(!f||!f.textMap)){var $=j();if($!==Y){for(var ne=Y||"",pe=$,Ae=0,He=Math.min(ne.length,pe.length);Ae<He&&ne.charCodeAt(Ae)===pe.charCodeAt(Ae);)Ae++;for(var Ze=0,_t=Math.min(ne.length-Ae,pe.length-Ae);Ze<_t&&ne.charCodeAt(ne.length-1-Ze)===pe.charCodeAt(pe.length-1-Ze);)Ze++;var Vt=ne.length-Ae-Ze,It=pe.substring(Ae,pe.length-Ze);X=!0;try{f.doc.transact(function(){Vt>0&&f.textMap.delete(Ae,Vt),It.length>0&&f.textMap.insert(Ae,It)},f.user&&f.user.id)}finally{X=!1,Y=pe}}}},250))},ue=null,ve=null;function re(){var $=i.getDocument&&i.getDocument(),ne=$&&$.body;if(!(!ne||typeof MutationObserver!="function")&&!(ue&&ve===ne)){if(ue){try{ue.disconnect()}catch{}ue=null}ue=new MutationObserver(ee),ue.observe(ne,{childList:!0,characterData:!0,subtree:!0,attributes:!0}),ve=ne}}re();function U(){re()}var F=function(){ee()};i.attachEvent&&i.attachEvent("blur",F),f.cleanup.push(function(){if(G&&(clearTimeout(G),G=null),ue&&(ue.disconnect(),ue=null),i.detachEvent)try{i.detachEvent("blur",F)}catch{}})}function P(){var M=i.reviewLedger,X=M.add,G=M.update,Y=M.remove;M.add=function(p){var k=X.call(M,p);return k&&!A&&f.ledgerMap.set(k.id,I(k)),k},M.update=function(p,k){var h=G.call(M,p,k);return h&&!A&&f.ledgerMap.set(h.id,I(h)),h},M.remove=function(p){var k=Y.call(M,p);return k&&!A&&f.ledgerMap.delete(p),k};var j=function(p){A=!0;try{p.keysChanged.forEach(function(k){var h=p.changes.keys.get(k);if(h)if(h.action==="delete")Y.call(M,k);else{var x=f.ledgerMap.get(k);if(!x)return;Y.call(M,k),X.call(M,x)}})}finally{A=!1}M.refreshPanel&&M.refreshPanel()};f.ledgerMap.observe(j),f.cleanup.push(function(){f.ledgerMap.unobserve(j),M.add=X,M.update=G,M.remove=Y})}function L(){if(!(!i.reviewLedger||!f.ledgerMap)){A=!0;try{f.ledgerMap.forEach(function(M,X){i.reviewLedger.get(X)||i.reviewLedger.add(M)})}finally{A=!1}}}function I(M){try{return JSON.parse(JSON.stringify(M))}catch{return M}}function u(){if(!(E&&E.parentNode)){E=document.createElement("div"),E.className="rte-collab-overlay",E.setAttribute("aria-hidden","true"),document.body.appendChild(E);var M=function(){y()};window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),f.cleanup.push(function(){window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)})}}function y(){if(!(!f||!E)){E.innerHTML="";for(var M=b(),X=i.iframe,G=X.getBoundingClientRect(),Y=0;Y<M.length;Y++){var j=M[Y];if(j.caret){var p=null;try{p=H(j.caret)}catch{}if(p){var k=p.getClientRects(),h=k&&k.length?k[0]:p.getBoundingClientRect();if(!(!h||!h.top&&!h.left)){var x=document.createElement("div");x.className="rte-collab-caret",x.style.left=G.left+h.left+"px",x.style.top=G.top+h.top+"px",x.style.height=(h.height||18)+"px",x.style.background=j.user.color;var z=document.createElement("div");z.className="rte-collab-caret-label",z.textContent=j.user.name,z.style.background=j.user.color,x.appendChild(z),E.appendChild(x)}}}}}}function O(){if(!(C&&C.parentNode)){C=document.createElement("div"),C.className="rte-collab-presence";var M=T();M&&M.parentNode?M.parentNode.insertBefore(C,M):document.body.appendChild(C)}}function K(){if(!(!f||!C)){C.innerHTML="";var M=[{user:f.user,self:!0}].concat(b().map(function(p){return{user:p.user,self:!1}})),X=document.createElement("span");X.className="rte-collab-presence-title",X.textContent="Online ("+M.length+")",C.appendChild(X);for(var G=0;G<M.length;G++){var Y=M[G].user,j=document.createElement("span");j.className="rte-collab-presence-chip"+(M[G].self?" is-self":""),j.style.background=Y.color,j.title=Y.name+(M[G].self?" (you)":""),j.textContent=V(Y.name||Y.id||"?"),C.appendChild(j)}}}function T(){for(var M=i.iframe;M&&M!==document.body;){if(M.classList&&M.classList.contains("richtexteditor"))return M;M=M.parentNode}return null}function V(M){var X=String(M).trim().split(/\s+/);return X[0]?X.length===1?X[0].charAt(0).toUpperCase():(X[0].charAt(0)+X[X.length-1].charAt(0)).toUpperCase():"?"}function Z(){if(!document.querySelector("style[data-rte-collab]")){var M=document.createElement("style");M.setAttribute("data-rte-collab","1"),M.textContent=[".rte-collab-overlay{position:fixed;top:0;left:0;pointer-events:none;z-index:2147482900}",".rte-collab-caret{position:absolute;width:2px;pointer-events:none}",".rte-collab-caret-label{position:absolute;top:-18px;left:0;padding:1px 6px;border-radius:4px;color:#fff;font:10px/1.3 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;white-space:nowrap;font-weight:600;letter-spacing:.01em;box-shadow:0 1px 2px rgba(15,23,42,.15)}",".rte-collab-presence{display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:10px 10px 0 0;background:#f4f7ff;border:1px solid rgba(71,85,155,.15);border-bottom:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;font-size:12px;color:#33506f;margin:0}",".rte-collab-presence-title{font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#475569}",".rte-collab-presence-chip{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:50%;color:#fff;font-size:10px;font-weight:700;box-shadow:0 0 0 2px #fff;letter-spacing:.02em}",".rte-collab-presence-chip.is-self{outline:2px solid rgba(15,23,42,.25);outline-offset:1px}"].join(`
|
|
78
|
+
`),document.head.appendChild(M)}}}RTE_DefaultConfig.plugin_zz_richtextbox_dialog_style=RTE_Plugin_RichTextBoxDialogStyle;function RTE_Plugin_RichTextBoxDialogStyle(){var S=this;S.PluginName="RichTextBoxDialogStyle",S.InitConfig=function(g){g.imageItems||(g.imageItems=[]),g.galleryImages||(g.galleryImages=[]),g.htmlTemplates||(g.htmlTemplates=[]),g.documentItems||(g.documentItems=[])},S.InitEditor=function(){};function c(g,b,D,P){var L=g.ownerDocument.createElement(b);return D&&(L.style.cssText=D),P&&(L.className=P),g.appendChild(L),L}function i(g){return g&&g.value?g.value.replace(/^\s+|\s+$/g,""):""}function f(g){try{return new URL(g,window.location.href).hostname||""}catch{return""}}function N(g){var b=String(g||"").split("#")[0].split("?")[0],D=b.lastIndexOf("/"),P=D>=0?b.substring(D+1):b;try{P=decodeURIComponent(P)}catch{}return P||""}function A(g){var b=N(g),D=b.lastIndexOf(".");return D<0?"LINK":b.substring(D+1).toUpperCase().substring(0,4)}function E(g,b,D){if(!(!g||g.querySelector("."+b))){var P=c(g,"div","",b);P.innerText=D}}function C(g,b,D){return g[D]?!1:(g.addEventListener?g.addEventListener("input",b):(g.onkeyup=b,g.onchange=b,g.onpaste=b),g[D]=!0,!0)}function o(g,b){if(!g||!b)return;var D=b.querySelector("input[type='text']");if(!D)return;D.placeholder||(D.placeholder="https://example.com/image.jpg");var P=g.querySelector(".rte-insertimage-preview");if(!P){P=c(g,"div","","rte-insertimage-preview is-empty");var L=c(P,"img","","rte-insertimage-preview-image");L.alt="Image preview",c(P,"div","","rte-insertimage-preview-caption")}if(D.__rteRichTextBoxImagePreviewBound)return;var I=P.querySelector(".rte-insertimage-preview-image"),u=P.querySelector(".rte-insertimage-preview-caption");function y(){var O=i(D);if(!O){P.classList.add("is-empty"),P.classList.remove("is-error"),I.removeAttribute("src"),u.innerText="Enter an image URL to preview it here.";return}P.classList.remove("is-empty"),P.classList.remove("is-error"),u.innerText="Loading preview...",I.src=O}I.onload=function(){P.classList.remove("is-empty"),P.classList.remove("is-error"),u.innerText="Ready to insert this image."},I.onerror=function(){P.classList.remove("is-empty"),P.classList.add("is-error"),u.innerText="Preview unavailable for this URL."},C(D,y,"__rteRichTextBoxImagePreviewBound"),y()}function v(g,b){if(!g||!b)return;var D=b.querySelector("input[type='text']");if(!D)return;D.placeholder||(D.placeholder="https://example.com/files/proposal.pdf");var P=g.querySelector(".rte-insertdocument-preview");if(!P){P=c(g,"div","","rte-insertdocument-preview is-empty");var L=c(P,"div","","rte-insertdocument-preview-icon");c(L,"div","","rte-insertdocument-preview-ext");var I=c(P,"div","","rte-insertdocument-preview-body");c(I,"div","","rte-insertdocument-preview-title"),c(I,"div","","rte-insertdocument-preview-meta")}if(D.__rteRichTextBoxDocumentPreviewBound)return;var u=P.querySelector(".rte-insertdocument-preview-ext"),y=P.querySelector(".rte-insertdocument-preview-title"),O=P.querySelector(".rte-insertdocument-preview-meta");function K(){var T=i(D);if(!T){P.classList.add("is-empty"),u.innerText="DOC",y.innerText="No document selected",O.innerText="Enter a document URL to preview the inserted link.";return}P.classList.remove("is-empty"),u.innerText=A(T),y.innerText=N(T)||T;var V=f(T);O.innerText=V?"Source: "+V+" | The editor inserts a clickable link.":"The editor inserts a clickable link at the current cursor position."}C(D,K,"__rteRichTextBoxDocumentPreviewBound"),K()}function w(g){var b=[],D;if(g.classList&&g.classList.contains("rte-panel-insertimage")&&b.push(g),g.querySelectorAll){var P=g.querySelectorAll(".rte-panel-insertimage");for(D=0;D<P.length;D++)b.push(P[D])}for(D=0;D<b.length;D++){var L=b[D];L.classList.add("rte-richtextbox-dialog");var I=L.querySelector(".fileuploader-dragdrop");I&&E(I,"rte-insertimage-intro","Drop an image here or click anywhere in this panel to browse.");var u=L.querySelector(".rte_insertimage_byurl");u&&(E(u,"rte-insertimage-intro","Paste a hosted image URL and verify the preview before inserting."),o(u,u.querySelector(".rte-dialog-line-url")));var y=L.querySelector(".rte-dialog-line-action .rte-dialog-button");y&&y.innerText==="Insert"&&(y.innerText="Insert image")}}function q(g){var b=[],D;if(g.classList&&g.classList.contains("rte-panel-insertdocument")&&b.push(g),g.querySelectorAll){var P=g.querySelectorAll(".rte-panel-insertdocument");for(D=0;D<P.length;D++)b.push(P[D])}for(D=0;D<b.length;D++){var L=b[D];L.classList.add("rte-richtextbox-dialog");var I=L.querySelector(".fileuploader-dragdrop");I&&E(I,"rte-insertdocument-intro","Upload a local file or drag it into the dialog to create a document link.");var u=L.querySelector(".rte_insertdocument_byurl");u&&(E(u,"rte-insertdocument-intro","Paste a hosted file URL and review the link details before inserting."),v(u,u.querySelector(".rte-dialog-line-url")));var y=L.querySelector(".rte-dialog-line-action");y&&y.classList.add("rte-insertdocument-actions");var O=L.querySelector(".rte-dialog-line-action .rte-dialog-button");O&&O.innerText==="Insert"&&(O.innerText="Insert document"),O&&O.innerText==="Update"&&(O.innerText="Update document")}}function B(g){!g||g.nodeType!==1||(w(g),q(g))}function H(){if(B(document.documentElement),!!window.MutationObserver){var g=new MutationObserver(function(b){var D,P;for(D=0;D<b.length;D++)for(P=0;P<b[D].addedNodes.length;P++)B(b[D].addedNodes[P])});g.observe(document.documentElement,{childList:!0,subtree:!0})}}document.readyState==="loading"?document.addEventListener?document.addEventListener("DOMContentLoaded",H):window.attachEvent("onload",H):H()}
|