@editora/plugins 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +27 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +447 -0
  11. package/dist/approval-workflow.esm.js +1111 -0
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +442 -0
  16. package/dist/blocks-library.esm.js +1384 -0
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +548 -0
  21. package/dist/citations.esm.js +1530 -0
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +626 -0
  31. package/dist/conditional-content.esm.js +1421 -0
  32. package/dist/content-rules.cjs.js +408 -0
  33. package/dist/content-rules.esm.js +1147 -0
  34. package/dist/data-binding.cjs.js +321 -0
  35. package/dist/data-binding.esm.js +953 -0
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +398 -0
  38. package/dist/doc-schema.esm.js +1378 -0
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -0
  49. package/dist/enterprise.esm.js +58 -0
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +124 -93
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +105 -0
  87. package/dist/mentions.esm.js +774 -0
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +67 -51
  92. package/dist/pii-redaction.cjs.js +436 -0
  93. package/dist/pii-redaction.esm.js +1447 -0
  94. package/dist/preview.cjs.js +3 -3
  95. package/dist/preview.esm.js +37 -32
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +20 -17
  98. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  99. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  100. package/dist/slash-commands.cjs.js +90 -0
  101. package/dist/slash-commands.esm.js +788 -0
  102. package/dist/smart-paste.cjs.js +398 -0
  103. package/dist/smart-paste.esm.js +1444 -0
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +69 -61
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +123 -97
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +19 -14
  110. package/dist/style.css +1 -0
  111. package/dist/table.cjs.js +4 -4
  112. package/dist/table.esm.js +225 -191
  113. package/dist/template.cjs.js +11 -11
  114. package/dist/template.esm.js +153 -124
  115. package/dist/text-alignment.cjs.js +1 -1
  116. package/dist/text-alignment.esm.js +27 -21
  117. package/dist/text-color.cjs.js +3 -3
  118. package/dist/text-color.esm.js +87 -70
  119. package/dist/track-changes.cjs.js +77 -0
  120. package/dist/track-changes.esm.js +817 -0
  121. package/dist/translation-workflow.cjs.js +626 -0
  122. package/dist/translation-workflow.esm.js +1794 -0
  123. package/dist/version-diff.cjs.js +362 -0
  124. package/dist/version-diff.esm.js +797 -0
  125. package/index.d.ts +798 -0
  126. package/package.json +114 -9
  127. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  128. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  129. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  130. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  131. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  132. package/dist/documentManager-Jf0RbSks.js +0 -17
  133. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  134. package/dist/index-CvJk4DKa.js +0 -221
  135. package/dist/index-D3CycEFU.mjs +0 -16543
  136. package/dist/index-tqLTHcO6.js +0 -1
  137. package/dist/index.es-CE_A4QSm.js +0 -5
  138. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  139. package/dist/jspdf.es.min-BoS80556.js +0 -77
  140. package/dist/plugins.css +0 -1
  141. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -28,7 +28,8 @@ const g = /* @__PURE__ */ new Set([
28
28
  if (n.getAttribute("contenteditable") === "true")
29
29
  return n;
30
30
  const t = n.closest('[contenteditable="true"]');
31
- if (t) return t;
31
+ if (t)
32
+ return t;
32
33
  }
33
34
  return document.querySelector('[contenteditable="true"]');
34
35
  }, u = (e) => {
@@ -36,8 +37,10 @@ const g = /* @__PURE__ */ new Set([
36
37
  for (; n && n !== document.body; ) {
37
38
  if (n.nodeType === Node.ELEMENT_NODE) {
38
39
  const t = n;
39
- if (l(t)) return t;
40
- if (t.getAttribute("contenteditable") === "true") break;
40
+ if (l(t))
41
+ return t;
42
+ if (t.getAttribute("contenteditable") === "true")
43
+ break;
41
44
  }
42
45
  n = n.parentNode;
43
46
  }
@@ -54,7 +57,8 @@ const g = /* @__PURE__ */ new Set([
54
57
  {
55
58
  acceptNode: (o) => {
56
59
  const d = o;
57
- if (!l(d)) return NodeFilter.FILTER_SKIP;
60
+ if (!l(d))
61
+ return NodeFilter.FILTER_SKIP;
58
62
  if (typeof e.intersectsNode == "function")
59
63
  return e.intersectsNode(d) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
60
64
  const a = document.createRange();
@@ -67,7 +71,8 @@ const g = /* @__PURE__ */ new Set([
67
71
  i(c), c = s.nextNode();
68
72
  return t.length === 0 && i(u(e.commonAncestorContainer)), t;
69
73
  }, T = (e, n) => {
70
- if (n === e.innerHTML) return;
74
+ if (n === e.innerHTML)
75
+ return;
71
76
  const t = window.execEditorCommand || window.executeEditorCommand;
72
77
  if (typeof t == "function")
73
78
  try {
@@ -76,13 +81,17 @@ const g = /* @__PURE__ */ new Set([
76
81
  }
77
82
  }, f = (e) => {
78
83
  const n = h();
79
- if (!n) return !1;
84
+ if (!n)
85
+ return !1;
80
86
  const t = window.getSelection();
81
- if (!t || t.rangeCount === 0) return !1;
87
+ if (!t || t.rangeCount === 0)
88
+ return !1;
82
89
  const r = t.getRangeAt(0);
83
- if (!n.contains(r.commonAncestorContainer)) return !1;
90
+ if (!n.contains(r.commonAncestorContainer))
91
+ return !1;
84
92
  const i = C(r, n);
85
- if (i.length === 0) return !1;
93
+ if (i.length === 0)
94
+ return !1;
86
95
  const s = n.innerHTML;
87
96
  return i.forEach((c) => {
88
97
  e === "rtl" ? c.setAttribute("dir", "rtl") : c.removeAttribute("dir");
@@ -0,0 +1,398 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=".rte-content, .editora-content",ie="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",fe="__editoraCommandEditorRoot",he="rte-doc-schema-styles",m="rte-doc-schema-panel",E="document-schema",M="doc-schema",R="docSchema",v=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Ie={panelTitle:"Document Schema",panelAriaLabel:"Document schema panel",schemaLabel:"Schema",schemaDescriptionPrefix:"Description",validateText:"Run Validation",insertMissingText:"Insert Missing Sections",realtimeOnText:"Realtime On",realtimeOffText:"Realtime Off",closeText:"Close",noIssuesText:"No schema violations detected.",summaryPrefix:"Schema",issueListLabel:"Schema issues",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+G (panel), Ctrl/Cmd+Alt+Shift+J (validate)",helperText:"Choose a schema, validate structure, then insert missing sections safely.",readonlyMessage:"Editor is read-only. Missing sections cannot be inserted.",defaultPlaceholderText:"Add section content.",missingSectionMessage:"Missing required section",duplicateSectionMessage:"Section appears too many times",outOfOrderMessage:"Section appears out of required order",unknownHeadingMessage:"Heading is not part of selected schema",insertedSummaryPrefix:"Inserted missing sections"},u=new WeakMap,X=new WeakMap,j=new WeakMap,p=new Map,F=new WeakMap,te=new WeakMap,ne=new Set;let W=0,Ae=0,ge=0,w=null,b=null,q=null,z=null,B=null,D=null,K=null;function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Le(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function P(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):t}function ye(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e,t){return t(e).toLowerCase().replace(/^[\s\-\u2022]*(?:[0-9]+(?:\.[0-9]+)*)[\)\.\-:\s]+/,"").replace(/^[\s\-\u2022]*(?:[ivxlcdm]+)[\)\.\-:\s]+/i,"").replace(/[::]+$/g,"").replace(/\s+/g," ").trim()}function be(){return[{id:"contract",label:"Contract",description:"Template for legal/commercial agreements with strict section ordering.",strictOrder:!0,allowUnknownHeadings:!1,sections:[{id:"summary",title:"Executive Summary",aliases:["Overview"]},{id:"scope",title:"Scope"},{id:"terms",title:"Terms and Conditions",aliases:["Terms"]},{id:"responsibilities",title:"Responsibilities"},{id:"sla",title:"Service Levels",aliases:["SLA","Service Level Agreement"]},{id:"termination",title:"Termination"}]},{id:"sop",label:"SOP",description:"Standard operating procedure with clear implementation and governance sections.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"purpose",title:"Purpose"},{id:"scope",title:"Scope"},{id:"procedure",title:"Procedure",maxOccurrences:10},{id:"roles",title:"Roles and Responsibilities",aliases:["Responsibilities"]},{id:"validation",title:"Validation"},{id:"revision-history",title:"Revision History",aliases:["Change History"]}]},{id:"policy",label:"Policy",description:"Policy document with control ownership, exception handling, and enforcement.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"statement",title:"Policy Statement"},{id:"applicability",title:"Applicability",aliases:["Scope"]},{id:"controls",title:"Controls"},{id:"exceptions",title:"Exceptions"},{id:"enforcement",title:"Enforcement"}]}]}function Oe(e,t,n){const r=n(e.title||"");if(!r)return null;const s=ye(n(e.id||r))||`section-${t+1}`,o=P(Number(e.minOccurrences??1),0,20),a=Math.max(1,o),l=P(Number(e.maxOccurrences??a),o,40),c=n(e.placeholder||""),i=Array.isArray(e.aliases)?e.aliases.map(x=>n(x)).filter(Boolean):[],d=[r,...i].map(x=>ce(x,n)).filter(Boolean);return{id:s,title:r,minOccurrences:o,maxOccurrences:l,placeholder:c,matchKeys:Array.from(new Set(d))}}function Se(e,t){const n=Array.isArray(e)&&e.length>0?e:be(),r=[],s=new Set;return n.forEach((o,a)=>{const l=t(o.label||"");if(!l)return;const c=ye(t(o.id||l))||`schema-${a+1}`;let i=c,d=1;for(;s.has(i);)i=`${c}-${d++}`;s.add(i);const x=Array.isArray(o.sections)?o.sections:[],f=[],k=new Set;if(x.forEach(($,h)=>{const y=Oe($,h,t);if(!y)return;let N=y.id,Te=1;for(;k.has(N);)N=`${y.id}-${Te++}`;k.add(N),f.push({...y,id:N})}),f.length===0)return;const O=new Map,A=new Map;f.forEach(($,h)=>{A.set($.id,h),$.matchKeys.forEach(y=>{O.has(y)||O.set(y,$)})}),r.push({id:i,label:l,description:t(o.description||""),strictOrder:o.strictOrder!==!1,allowUnknownHeadings:!!o.allowUnknownHeadings,sections:f,matchKeyToSection:O,orderBySectionId:A})}),r.length>0?r:Se(be(),t)}function Z(e={}){var o;const t=e.normalizeText||Le,n=Se(e.schemas,t),r=t(e.defaultSchemaId||""),s=n.some(a=>a.id===r)?r:((o=n[0])==null?void 0:o.id)||null;return{schemas:n,defaultSchemaId:s,enableRealtime:e.enableRealtime!==!1,debounceMs:P(Number(e.debounceMs??260),60,2e3),maxIssues:P(Number(e.maxIssues??80),5,500),labels:{...Ie,...e.labels||{}},normalizeText:t}}function Re(e){return{schemas:e.schemas.map(t=>({id:t.id,label:t.label,description:t.description||void 0,strictOrder:t.strictOrder,allowUnknownHeadings:t.allowUnknownHeadings,sections:t.sections.map(n=>({id:n.id,title:n.title,minOccurrences:n.minOccurrences,maxOccurrences:n.maxOccurrences,placeholder:n.placeholder||void 0}))})),defaultSchemaId:e.defaultSchemaId||void 0,enableRealtime:e.enableRealtime,debounceMs:e.debounceMs,maxIssues:e.maxIssues,labels:{...e.labels},normalizeText:e.normalizeText}}function le(e){return e.closest(ie)||e}function U(e){if(!e)return null;if(e.matches(S))return e;const t=e.querySelector(S);return t instanceof HTMLElement?t:null}function De(){if(typeof window>"u")return null;const e=window[fe];if(!(e instanceof HTMLElement))return null;window[fe]=null;const t=U(e);if(t)return t;const n=e.closest(ie);if(n){const s=U(n);if(s)return s}const r=e.closest(S);return r instanceof HTMLElement?r:null}function He(e){const t=e.closest("[data-editora-editor]");if(t&&U(t)===e)return t;let n=e;for(;n;){if(n.matches(ie)&&(n===e||U(n)===e))return n;n=n.parentElement}return le(e)}function xe(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Y(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Ne(e){const t=le(e);if(Y(t))return!0;const n=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Y(n)?!0:Y(document.documentElement)||Y(document.body)}function oe(e,t){e.classList.remove("rte-doc-schema-theme-dark"),Ne(t)&&e.classList.add("rte-doc-schema-theme-dark")}function Pe(e){var t,n,r,s;for(let o=0;o<e.length;o+=1){const a=e[o];if(!(a.type!=="childList"||a.removedNodes.length===0))for(let l=0;l<a.removedNodes.length;l+=1){const c=a.removedNodes[l];if(c.nodeType!==Node.ELEMENT_NODE)continue;const i=c;if((t=i.matches)!=null&&t.call(i,S)||(n=i.matches)!=null&&n.call(i,`.${m}`)||(r=i.querySelector)!=null&&r.call(i,S)||(s=i.querySelector)!=null&&s.call(i,`.${m}`))return!0}}return!1}function Q(){Array.from(ne).forEach(t=>{t.isConnected||ue(t)})}function T(e,t=!0,n=!0){var l;if(Q(),(e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const c=U(e.editorElement);if(c)return c}const r=De();if(r)return r;const s=window.getSelection();if(s&&s.rangeCount>0){const c=(l=xe(s.getRangeAt(0).startContainer))==null?void 0:l.closest(S);if(c)return c}const o=document.activeElement;if(o){if(o.matches(S))return o;const c=o.closest(S);if(c)return c}if(n&&b&&b.isConnected)return b;if(!t)return null;const a=document.querySelector(S);return a instanceof HTMLElement?a:null}function _e(e){const t=e.target;if(t){const r=t.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=t.closest(S);if(s)return s}const n=document.activeElement;if(n){const r=n.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=n.closest(S);if(s)return s}return null}function pe(e,t,n){const r=He(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",n),o.setAttribute("data-active",n?"true":"false"),o.setAttribute("aria-pressed",n?"true":"false")})}function de(e){const t=te.get(e);typeof t=="number"&&(window.clearTimeout(t),te.delete(e))}function L(e,t){return t&&e.schemas.find(n=>n.id===t)||null}function re(e){var t;return e.defaultSchemaId||((t=e.schemas[0])==null?void 0:t.id)||null}function g(e,t){u.has(e)||u.set(e,t);let n=j.get(e);return n||(n={activeSchemaId:re(t),realtimeEnabled:t.enableRealtime,issues:[],headingCount:0,recognizedHeadingCount:0,missingCount:0,lastRunAt:null,snapshot:""},j.set(e,n)),(!n.activeSchemaId||!L(t,n.activeSchemaId))&&(n.activeSchemaId=re(t)),ne.add(e),n}function ue(e){var t;de(e),(t=p.get(e))==null||t.remove(),p.delete(e),F.delete(e),u.delete(e),X.delete(e),j.delete(e),ne.delete(e),b===e&&(b=null)}function me(e){return F.get(e)===!0}function Ee(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function se(e,t){if(!t.classList.contains("show"))return;const n=le(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,440),s=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,n.right-r),s),a=Math.max(10,Math.min(window.innerHeight-10,n.top+12));t.style.width=`${r}px`,t.style.left=`${o}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ee(e,t){const n=e.querySelector(".rte-doc-schema-live");n&&(n.textContent=t)}function qe(e,t){const n=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),r=[];return n.forEach((s,o)=>{const a=t(s.textContent||"");if(!a)return;const l=Number(s.tagName.slice(1))||0,c=ce(a,t);r.push({text:a,key:c,index:o,level:l})}),r}function ve(e,t,n){const r=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),s=[];return r.forEach(o=>{const a=n(o.textContent||"");if(!a)return;const l=ce(a,n),c=l&&t.matchKeyToSection.get(l)||null,i=c?t.orderBySectionId.get(c.id)??null:null,d=P(Number(o.tagName.slice(1))||0,1,6);s.push({element:o,level:d,section:c,order:i})}),s}function ze(e,t=2){const n=e.filter(c=>c.section).map(c=>c.level),r=n.length>0?n:e.map(c=>c.level);if(r.length===0)return t;const s=new Map;r.forEach((c,i)=>{s.has(c)||s.set(c,{count:0,firstIndex:i});const d=s.get(c);d.count+=1});let o=t,a=-1,l=Number.MAX_SAFE_INTEGER;return s.forEach((c,i)=>{(c.count>a||c.count===a&&c.firstIndex<l||c.count===a&&c.firstIndex===l&&i<o)&&(o=i,a=c.count,l=c.firstIndex)}),P(o,1,6)}function Be(e){var o;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(((o=xe(n.startContainer))==null?void 0:o.closest(S))!==e)return null;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const a=n.startContainer,l=a.childNodes[n.startOffset]||null;return{parent:a,referenceNode:l}}const s=n.startContainer.parentNode;return s?{parent:s,referenceNode:n.startContainer.nextSibling||null}:null}function Ke(e,t,n,r){var c;const s=ve(e,n,r),o=n.orderBySectionId.get(t.id);if(typeof o!="number"||s.length===0)return{parent:e,referenceNode:null};const a=s.find(i=>typeof i.order=="number"&&i.order>o);if(a&&a.element.parentNode)return{parent:a.element.parentNode,referenceNode:a.element};let l=-1;for(let i=0;i<s.length;i+=1){const d=s[i];typeof d.order=="number"&&d.order<o&&(l=i)}if(l>=0){const i=((c=s[l+1])==null?void 0:c.element)||null;return{parent:(i==null?void 0:i.parentNode)||s[l].element.parentNode||e,referenceNode:i}}return{parent:e,referenceNode:null}}function Ve(e,t,n,r){const s=e.ownerDocument||document,o=`h${P(r,1,6)}`,a=s.createElement(o);a.setAttribute("data-doc-schema-section",t.id),a.textContent=t.title;const l=s.createElement("p");return l.textContent=t.placeholder||n.labels.defaultPlaceholderText,[a,l]}function V(e,t,n,r={}){return ge+=1,{id:`doc-schema-issue-${ge}`,type:e,severity:t,message:n,...r}}function J(e,t,n){return e.replace(/\{section\}/g,t||"").replace(/\{heading\}/g,n||"").trim()}function je(e,t,n){const r=qe(e,n.normalizeText),s=[],o=new Map,a=[];for(let c=0;c<r.length&&!(s.length>=n.maxIssues);c+=1){const i=r[c];if(!i.key)continue;const d=t.matchKeyToSection.get(i.key);if(d){o.set(d.id,(o.get(d.id)||0)+1),a.push({section:d,heading:i});continue}t.allowUnknownHeadings||s.push(V("unknown-heading","warning",J(n.labels.unknownHeadingMessage,null,i.text),{headingText:i.text,suggestion:"Map this heading to a schema alias or remove it from strict structure mode."}))}let l=0;for(let c=0;c<t.sections.length&&!(s.length>=n.maxIssues);c+=1){const i=t.sections[c],d=o.get(i.id)||0;d<i.minOccurrences&&(l+=1,s.push(V("missing-section","error",J(n.labels.missingSectionMessage,i.title,null),{sectionId:i.id,sectionTitle:i.title,suggestion:`Add heading "${i.title}" to satisfy schema requirements.`}))),d>i.maxOccurrences&&s.length<n.maxIssues&&s.push(V("duplicate-section","warning",J(n.labels.duplicateSectionMessage,i.title,null),{sectionId:i.id,sectionTitle:i.title,suggestion:`Keep at most ${i.maxOccurrences} instance(s) of "${i.title}".`}))}if(t.strictOrder&&s.length<n.maxIssues){let c=-1;for(let i=0;i<a.length&&!(s.length>=n.maxIssues);i+=1){const d=a[i],x=t.orderBySectionId.get(d.section.id)??i;x<c?s.push(V("out-of-order","warning",J(n.labels.outOfOrderMessage,d.section.title,d.heading.text),{sectionId:d.section.id,sectionTitle:d.section.title,headingText:d.heading.text,suggestion:`Move "${d.section.title}" after earlier required sections.`})):c=x}}return{issues:s,headingCount:r.length,recognizedHeadingCount:a.length,missingCount:l}}function we(e){const t=u.get(e)||w,n=j.get(e),r=t?L(t,(n==null?void 0:n.activeSchemaId)||null):null;return{activeSchemaId:(n==null?void 0:n.activeSchemaId)||null,activeSchemaLabel:(r==null?void 0:r.label)||null,realtimeEnabled:(n==null?void 0:n.realtimeEnabled)===!0,issues:n!=null&&n.issues?n.issues.map(s=>({...s})):[],headingCount:(n==null?void 0:n.headingCount)||0,recognizedHeadingCount:(n==null?void 0:n.recognizedHeadingCount)||0,missingCount:(n==null?void 0:n.missingCount)||0,lastRunAt:(n==null?void 0:n.lastRunAt)||null}}function H(e){const t=j.get(e);pe(e,"toggleDocSchemaPanel",me(e)),pe(e,"toggleDocSchemaRealtime",(t==null?void 0:t.realtimeEnabled)===!0)}function _(e){const t=p.get(e);if(!t)return;const n=u.get(e)||w;if(!n)return;const r=g(e,n),s=L(n,r.activeSchemaId),o=t.querySelector(".rte-doc-schema-label");o&&(o.textContent=n.labels.schemaLabel);const a=t.querySelector('[data-field="schema"]');a&&(a.innerHTML=n.schemas.map(h=>`<option value="${I(h.id)}">${I(h.label)}</option>`).join(""),a.value=r.activeSchemaId||"");const l=t.querySelector(".rte-doc-schema-description");if(l){const h=(s==null?void 0:s.description)||"";l.textContent=h?`${n.labels.schemaDescriptionPrefix}: ${h}`:"",l.hidden=!h}const c=t.querySelector(".rte-doc-schema-summary");if(c){const h=(s==null?void 0:s.label)||"N/A",y=r.issues.length;c.textContent=`${n.labels.summaryPrefix}: ${h} • ${y} issue${y===1?"":"s"}`}const i=t.querySelector(".rte-doc-schema-helper");i&&(i.textContent=n.labels.helperText);const d=t.querySelector(".rte-doc-schema-shortcut");d&&(d.textContent=n.labels.shortcutText);const x=t.querySelector('[data-action="run-validation"]');x&&(x.textContent=n.labels.validateText);const f=t.querySelector('[data-action="insert-missing"]');if(f){f.textContent=n.labels.insertMissingText;const h=r.issues.some(y=>y.type==="missing-section");f.disabled=!h||Ee(e)}const k=t.querySelector('[data-action="toggle-realtime"]');k&&(k.textContent=r.realtimeEnabled?n.labels.realtimeOnText:n.labels.realtimeOffText,k.setAttribute("aria-pressed",r.realtimeEnabled?"true":"false"));const O=t.querySelector('[data-action="close"]');O&&O.setAttribute("aria-label",n.labels.closeText);const A=t.querySelector(".rte-doc-schema-issues"),$=t.querySelector(".rte-doc-schema-empty");A&&(A.setAttribute("aria-label",n.labels.issueListLabel),r.issues.length===0?(A.innerHTML="",$&&($.hidden=!1,$.textContent=n.labels.noIssuesText)):($&&($.hidden=!0),A.innerHTML=r.issues.map(h=>{const y=h.severity==="error"?"error":h.severity==="warning"?"warning":"info",N=h.sectionTitle||h.headingText||"";return`
2
+ <li class="rte-doc-schema-issue ${y}" role="listitem">
3
+ <p class="rte-doc-schema-issue-message">${I(h.message)}${N?`: <strong>${I(N)}</strong>`:""}</p>
4
+ ${h.suggestion?`<p class="rte-doc-schema-issue-suggestion">${I(h.suggestion)}</p>`:""}
5
+ </li>
6
+ `}).join(""))),t.setAttribute("aria-label",n.labels.panelAriaLabel)}function G(e,t=!1){const n=p.get(e);n&&(n.classList.remove("show"),F.set(e,!1),H(e),t&&e.focus({preventScroll:!0}))}function ae(e){const t=Fe(e);p.forEach((r,s)=>{s!==e&&G(s,!1)}),t.classList.add("show"),F.set(e,!0),_(e),se(e,t),H(e);const n=t.querySelector('[data-field="schema"]');n==null||n.focus(),C(e,"panel-open",!1)}function ke(e,t){const n=me(e);return(typeof t=="boolean"?t:!n)?ae(e):G(e,!1),!0}function Ue(e,t){if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}}function Ge(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function C(e,t,n){const r=u.get(e)||w;if(!r)return[];const s=g(e,r),o=p.get(e),a=e.innerHTML;if(!n&&s.snapshot===a)return s.issues;const l=L(r,s.activeSchemaId);if(!l)return s.issues=[V("missing-section","error","No active schema is configured for this editor.",{suggestion:"Set `defaultSchemaId` or update schema options."})],s.headingCount=0,s.recognizedHeadingCount=0,s.missingCount=1,s.lastRunAt=new Date().toISOString(),s.snapshot=a,_(e),H(e),s.issues;const c=je(e,l,r);return s.issues=c.issues,s.headingCount=c.headingCount,s.recognizedHeadingCount=c.recognizedHeadingCount,s.missingCount=c.missingCount,s.lastRunAt=new Date().toISOString(),s.snapshot=a,_(e),H(e),e.dispatchEvent(new CustomEvent("editora:doc-schema-validation",{bubbles:!0,detail:{reason:t,state:we(e)}})),o&&ee(o,c.issues.length===0?r.labels.noIssuesText:`${c.issues.length} issue${c.issues.length===1?"":"s"} detected.`),s.issues}function $e(e){const t=u.get(e)||w;if(!t)return;de(e);const n=window.setTimeout(()=>{te.delete(e),C(e,"realtime",!1)},t.debounceMs);te.set(e,n)}function Ce(e,t){const n=u.get(e)||w;if(!n)return!1;const r=g(e,n),s=typeof t=="boolean"?t:!r.realtimeEnabled;return r.realtimeEnabled=s,s?$e(e):de(e),_(e),H(e),!0}function Me(e){const t=u.get(e)||w;if(!t)return!1;const n=g(e,t),r=p.get(e);if(Ee(e))return r&&ee(r,t.labels.readonlyMessage),!1;const s=L(t,n.activeSchemaId);if(!s)return!1;C(e,"insert-missing-pre",!0);const o=Array.from(new Set(n.issues.filter(f=>f.type==="missing-section"&&f.sectionId).map(f=>f.sectionId))),a=s.sections.filter(f=>o.includes(f.id));if(a.length===0)return r&&ee(r,t.labels.noIssuesText),!1;const l=e.innerHTML,c=ve(e,s,t.normalizeText),i=ze(c,2),d=Be(e);a.forEach(f=>{const k=s.strictOrder?Ke(e,f,s,t.normalizeText):d||{parent:e,referenceNode:null},[O,A]=Ve(e,f,t,i);k.parent.insertBefore(O,k.referenceNode),k.parent.insertBefore(A,k.referenceNode)}),Ue(e,l),Ge(e),C(e,"insert-missing-post",!0);const x=a.map(f=>f.title).join(", ");return e.dispatchEvent(new CustomEvent("editora:doc-schema-insert-missing",{bubbles:!0,detail:{schemaId:s.id,sectionIds:a.map(f=>f.id)}})),r&&ee(r,`${t.labels.insertedSummaryPrefix}: ${x}`),!0}function Fe(e){const t=p.get(e);if(t)return t;const n=u.get(e)||w||Z();g(e,n);const r=`rte-doc-schema-panel-${Ae++}`,s=`${r}-schema`,o=document.createElement("section");return o.className=m,o.id=r,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","false"),o.setAttribute("aria-label",n.labels.panelAriaLabel),o.innerHTML=`
7
+ <header class="rte-doc-schema-header">
8
+ <h2 class="rte-doc-schema-title">${I(n.labels.panelTitle)}</h2>
9
+ <button type="button" class="rte-doc-schema-icon-btn" data-action="close" aria-label="${I(n.labels.closeText)}">✕</button>
10
+ </header>
11
+ <div class="rte-doc-schema-body">
12
+ <label class="rte-doc-schema-label" for="${I(s)}"></label>
13
+ <select id="${I(s)}" class="rte-doc-schema-select" data-field="schema"></select>
14
+ <p class="rte-doc-schema-description" hidden></p>
15
+ <p class="rte-doc-schema-summary"></p>
16
+ <div class="rte-doc-schema-actions">
17
+ <button type="button" class="rte-doc-schema-btn rte-doc-schema-btn-primary" data-action="run-validation"></button>
18
+ <button type="button" class="rte-doc-schema-btn" data-action="insert-missing"></button>
19
+ <button type="button" class="rte-doc-schema-btn" data-action="toggle-realtime" aria-pressed="false"></button>
20
+ </div>
21
+ <p class="rte-doc-schema-helper"></p>
22
+ <p class="rte-doc-schema-shortcut"></p>
23
+ <div class="rte-doc-schema-issues-wrap">
24
+ <ul class="rte-doc-schema-issues" role="list" aria-label="${I(n.labels.issueListLabel)}"></ul>
25
+ <p class="rte-doc-schema-empty" hidden></p>
26
+ </div>
27
+ </div>
28
+ <div class="rte-doc-schema-live" aria-live="polite" aria-atomic="true"></div>
29
+ `,o.addEventListener("click",a=>{const l=a.target,c=l==null?void 0:l.closest("[data-action]");if(!c)return;const i=c.getAttribute("data-action");if(i==="close"){G(e,!0);return}if(i==="run-validation"){C(e,"panel-button",!0);return}if(i==="insert-missing"){Me(e);return}i==="toggle-realtime"&&Ce(e)}),o.addEventListener("change",a=>{const l=a.target;if(!(l instanceof HTMLSelectElement)||l.getAttribute("data-field")!=="schema")return;const c=u.get(e)||w;if(!c)return;const i=g(e,c),d=l.value;L(c,d)&&(i.activeSchemaId=d,i.snapshot="",C(e,"schema-change",!0))}),o.addEventListener("keydown",a=>{a.key==="Escape"&&(a.preventDefault(),G(e,!0))}),oe(o,e),document.body.appendChild(o),p.set(e,o),F.set(e,!1),_(e),o}function We(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="g"}function Ye(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="j"}function Je(e){w=e,q||(q=t=>{Q();const n=t.target,r=n==null?void 0:n.closest(S);if(!r)return;const s=u.get(r)||e;g(r,s),u.set(r,s),b=r,H(r);const o=p.get(r);o&&(oe(o,r),se(r,o),_(r))},document.addEventListener("focusin",q,!0)),z||(z=t=>{const n=t.target,r=n==null?void 0:n.closest(S);if(!r)return;const s=u.get(r)||w;!s||!g(r,s).realtimeEnabled||$e(r)},document.addEventListener("input",z,!0)),B||(B=t=>{if(t.defaultPrevented)return;const n=t.target;if(n!=null&&n.closest(`.${m}`)&&t.key!=="Escape")return;const r=_e(t);if(!r)return;const s=u.get(r)||w||e;if(g(r,s),u.set(r,s),b=r,t.key==="Escape"&&me(r)){t.preventDefault(),G(r,!0);return}if(We(t)){t.preventDefault(),t.stopPropagation(),ke(r);return}Ye(t)&&(t.preventDefault(),t.stopPropagation(),C(r,"shortcut",!0))},document.addEventListener("keydown",B,!0)),D||(D=()=>{Q(),p.forEach((t,n)=>{!n.isConnected||!t.isConnected||(oe(t,n),se(n,t))})},window.addEventListener("scroll",D,!0),window.addEventListener("resize",D)),!K&&typeof MutationObserver<"u"&&document.body&&(K=new MutationObserver(t=>{Pe(t)&&Q()}),K.observe(document.body,{childList:!0,subtree:!0}))}function Xe(){q&&(document.removeEventListener("focusin",q,!0),q=null),z&&(document.removeEventListener("input",z,!0),z=null),B&&(document.removeEventListener("keydown",B,!0),B=null),D&&(window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D),D=null),K&&(K.disconnect(),K=null),p.forEach(t=>t.remove()),p.clear(),Array.from(ne).forEach(t=>ue(t)),w=null,b=null}function Ze(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=`
30
+ .rte-toolbar-group-items.${E},
31
+ .editora-toolbar-group-items.${E},
32
+ .rte-toolbar-group-items.${M},
33
+ .editora-toolbar-group-items.${M},
34
+ .rte-toolbar-group-items.${R},
35
+ .editora-toolbar-group-items.${R} {
36
+ display: flex;
37
+ border: 1px solid #cbd5e1;
38
+ border-radius: 4px;
39
+ background: #ffffff;
40
+ }
41
+
42
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
43
+ .editora-toolbar-group-items.${E} .editora-toolbar-button,
44
+ .rte-toolbar-group-items.${M} .rte-toolbar-button,
45
+ .editora-toolbar-group-items.${M} .editora-toolbar-button,
46
+ .rte-toolbar-group-items.${R} .rte-toolbar-button,
47
+ .editora-toolbar-group-items.${R} .editora-toolbar-button {
48
+ border: none;
49
+ border-right: 1px solid #cbd5e1;
50
+ border-radius: 0;
51
+ }
52
+
53
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
54
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
55
+ .rte-toolbar-group-items.${M} .rte-toolbar-item:last-child .rte-toolbar-button,
56
+ .editora-toolbar-group-items.${M} .editora-toolbar-item:last-child .editora-toolbar-button,
57
+ .rte-toolbar-group-items.${R} .rte-toolbar-item:last-child .rte-toolbar-button,
58
+ .editora-toolbar-group-items.${R} .editora-toolbar-item:last-child .editora-toolbar-button {
59
+ border-right: none;
60
+ }
61
+
62
+ ${v} .rte-toolbar-group-items.${E},
63
+ ${v} .editora-toolbar-group-items.${E},
64
+ ${v} .rte-toolbar-group-items.${M},
65
+ ${v} .editora-toolbar-group-items.${M},
66
+ ${v} .rte-toolbar-group-items.${R},
67
+ ${v} .editora-toolbar-group-items.${R} {
68
+ border-color: #566275;
69
+ }
70
+ .rte-toolbar-button[data-command="toggleDocSchemaRealtime"].active,
71
+ .editora-toolbar-button[data-command="toggleDocSchemaRealtime"].active {
72
+ background-color: #ccc;
73
+ }
74
+ ${v} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
75
+ ${v} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
76
+ ${v} .rte-toolbar-group-items.${M} .rte-toolbar-button svg,
77
+ ${v} .editora-toolbar-group-items.${M} .editora-toolbar-button svg
78
+ {
79
+ fill: none;
80
+ }
81
+ ${v} .rte-toolbar-group-items.${E} .rte-toolbar-button,
82
+ ${v} .editora-toolbar-group-items.${E} .editora-toolbar-button
83
+ {
84
+ border-color: #566275;
85
+ }
86
+ .${m} {
87
+ position: fixed;
88
+ z-index: 12000;
89
+ display: none;
90
+ width: min(440px, calc(100vw - 20px));
91
+ max-height: calc(100vh - 20px);
92
+ border: 1px solid #d1d5db;
93
+ border-radius: 14px;
94
+ background: #ffffff;
95
+ color: #0f172a;
96
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
97
+ overflow: hidden;
98
+ }
99
+
100
+ .${m}.show {
101
+ display: flex;
102
+ flex-direction: column;
103
+ }
104
+
105
+ .${m}.rte-doc-schema-theme-dark {
106
+ border-color: #334155;
107
+ background: #0f172a;
108
+ color: #e2e8f0;
109
+ box-shadow: 0 24px 52px rgba(2, 6, 23, 0.68);
110
+ }
111
+
112
+ .rte-doc-schema-header {
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: space-between;
116
+ gap: 8px;
117
+ padding: 12px 14px;
118
+ border-bottom: 1px solid #e2e8f0;
119
+ background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
120
+ }
121
+
122
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-header {
123
+ border-color: #1e293b;
124
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
125
+ }
126
+
127
+ .rte-doc-schema-title {
128
+ margin: 0;
129
+ font-size: 15px;
130
+ line-height: 1.2;
131
+ font-weight: 700;
132
+ }
133
+
134
+ .rte-doc-schema-icon-btn {
135
+ border: 1px solid #cbd5e1;
136
+ border-radius: 6px;
137
+ min-height: 34px;
138
+ width: 34px;
139
+ background: #ffffff;
140
+ color: #0f172a;
141
+ font-size: 16px;
142
+ line-height: 1;
143
+ font-weight: 600;
144
+ padding: 0;
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ cursor: pointer;
149
+ }
150
+
151
+ .rte-doc-schema-icon-btn:hover,
152
+ .rte-doc-schema-icon-btn:focus-visible {
153
+ outline: none;
154
+ border-color: #3b82f6;
155
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
156
+ }
157
+
158
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-icon-btn {
159
+ border-color: #475569;
160
+ background: #0f172a;
161
+ color: #e2e8f0;
162
+ }
163
+
164
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-icon-btn:hover,
165
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-icon-btn:focus-visible {
166
+ border-color: #60a5fa;
167
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
168
+ }
169
+
170
+ .rte-doc-schema-body {
171
+ display: flex;
172
+ flex-direction: column;
173
+ gap: 8px;
174
+ padding: 12px;
175
+ overflow: auto;
176
+ }
177
+
178
+ .rte-doc-schema-label {
179
+ font-size: 12px;
180
+ line-height: 1.3;
181
+ font-weight: 700;
182
+ color: #334155;
183
+ }
184
+
185
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-label {
186
+ color: #cbd5e1;
187
+ }
188
+
189
+ .rte-doc-schema-select {
190
+ border: 1px solid #cbd5e1;
191
+ border-radius: 8px;
192
+ min-height: 34px;
193
+ padding: 0 10px;
194
+ font-size: 13px;
195
+ background: #ffffff;
196
+ color: inherit;
197
+ }
198
+
199
+ .rte-doc-schema-select:focus-visible {
200
+ border-color: #0f766e;
201
+ box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
202
+ outline: none;
203
+ }
204
+
205
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-select {
206
+ border-color: #334155;
207
+ background: #0b1220;
208
+ color: #e2e8f0;
209
+ }
210
+
211
+ .rte-doc-schema-description,
212
+ .rte-doc-schema-summary,
213
+ .rte-doc-schema-helper,
214
+ .rte-doc-schema-shortcut {
215
+ margin: 0;
216
+ font-size: 12px;
217
+ line-height: 1.35;
218
+ color: #475569;
219
+ }
220
+
221
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-description,
222
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-summary,
223
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-helper,
224
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-shortcut {
225
+ color: #94a3b8;
226
+ }
227
+
228
+ .rte-doc-schema-actions {
229
+ display: grid;
230
+ grid-template-columns: repeat(3, minmax(0, 1fr));
231
+ gap: 8px;
232
+ }
233
+
234
+ .rte-doc-schema-btn {
235
+ border: 1px solid #cbd5e1;
236
+ border-radius: 8px;
237
+ min-height: 34px;
238
+ padding: 0 8px;
239
+ background: #ffffff;
240
+ color: inherit;
241
+ font-size: 12px;
242
+ font-weight: 700;
243
+ cursor: pointer;
244
+ }
245
+
246
+ .rte-doc-schema-btn:disabled {
247
+ opacity: 0.6;
248
+ cursor: not-allowed;
249
+ }
250
+
251
+ .rte-doc-schema-btn-primary {
252
+ border-color: #0f766e;
253
+ background: #0f766e;
254
+ color: #f8fafc;
255
+ }
256
+
257
+ .rte-doc-schema-btn:hover,
258
+ .rte-doc-schema-btn:focus-visible {
259
+ border-color: #94a3b8;
260
+ outline: none;
261
+ }
262
+
263
+ .rte-doc-schema-btn-primary:hover,
264
+ .rte-doc-schema-btn-primary:focus-visible {
265
+ border-color: #115e59;
266
+ background: #115e59;
267
+ }
268
+
269
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-btn {
270
+ border-color: #334155;
271
+ background: #111827;
272
+ color: #e2e8f0;
273
+ }
274
+
275
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-btn-primary {
276
+ border-color: #14b8a6;
277
+ background: #0f766e;
278
+ color: #f0fdfa;
279
+ }
280
+
281
+ .rte-doc-schema-issues-wrap {
282
+ border: 1px solid #e2e8f0;
283
+ border-radius: 10px;
284
+ padding: 6px;
285
+ background: #f8fafc;
286
+ max-height: min(40vh, 320px);
287
+ overflow: auto;
288
+ }
289
+
290
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issues-wrap {
291
+ border-color: #334155;
292
+ background: #0b1220;
293
+ }
294
+
295
+ .rte-doc-schema-issues {
296
+ margin: 0;
297
+ padding: 0;
298
+ list-style: none;
299
+ display: grid;
300
+ gap: 6px;
301
+ }
302
+
303
+ .rte-doc-schema-issue {
304
+ border: 1px solid #cbd5e1;
305
+ border-radius: 8px;
306
+ background: #ffffff;
307
+ padding: 8px;
308
+ display: grid;
309
+ gap: 4px;
310
+ }
311
+
312
+ .rte-doc-schema-issue.error {
313
+ border-color: #ef4444;
314
+ background: #fef2f2;
315
+ }
316
+
317
+ .rte-doc-schema-issue.warning {
318
+ border-color: #f59e0b;
319
+ background: #fffbeb;
320
+ }
321
+
322
+ .rte-doc-schema-issue.info {
323
+ border-color: #0ea5e9;
324
+ background: #f0f9ff;
325
+ }
326
+
327
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue {
328
+ border-color: #334155;
329
+ background: #111827;
330
+ color: #e2e8f0;
331
+ }
332
+
333
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue.error {
334
+ border-color: rgba(239, 68, 68, 0.7);
335
+ background: rgba(127, 29, 29, 0.28);
336
+ }
337
+
338
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue.warning {
339
+ border-color: rgba(245, 158, 11, 0.72);
340
+ background: rgba(120, 53, 15, 0.28);
341
+ }
342
+
343
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue.info {
344
+ border-color: rgba(14, 165, 233, 0.7);
345
+ background: rgba(7, 89, 133, 0.28);
346
+ }
347
+
348
+ .rte-doc-schema-issue-message,
349
+ .rte-doc-schema-issue-suggestion {
350
+ margin: 0;
351
+ font-size: 12px;
352
+ line-height: 1.35;
353
+ color: #1f2937;
354
+ }
355
+
356
+ .rte-doc-schema-issue-suggestion {
357
+ color: #475569;
358
+ }
359
+
360
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue-message {
361
+ color: #e2e8f0;
362
+ }
363
+
364
+ .${m}.rte-doc-schema-theme-dark .rte-doc-schema-issue-suggestion {
365
+ color: #cbd5e1;
366
+ }
367
+
368
+ .rte-doc-schema-empty {
369
+ margin: 8px;
370
+ font-size: 12px;
371
+ color: #64748b;
372
+ }
373
+
374
+ .rte-doc-schema-live {
375
+ position: absolute;
376
+ width: 1px;
377
+ height: 1px;
378
+ margin: -1px;
379
+ padding: 0;
380
+ overflow: hidden;
381
+ clip: rect(0 0 0 0);
382
+ border: 0;
383
+ }
384
+
385
+ @media (max-width: 768px) {
386
+ .${m} {
387
+ left: 10px !important;
388
+ right: 10px;
389
+ top: 10px !important;
390
+ width: auto !important;
391
+ max-height: calc(100vh - 20px);
392
+ }
393
+
394
+ .rte-doc-schema-actions {
395
+ grid-template-columns: 1fr;
396
+ }
397
+ }
398
+ `,document.head.appendChild(e)}const Qe=(e={})=>{const t=Z(e),n=new Set;return Ze(),{name:"docSchema",toolbar:[{id:"docSchemaGroup",label:"Document Schema",type:"group",command:"docSchema",items:[{id:"toggleDocSchemaPanel",label:"Document Schema",command:"toggleDocSchemaPanel",shortcut:"Mod-Alt-Shift-g",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 4.5h12A1.5 1.5 0 0 1 19.5 6v12A1.5 1.5 0 0 1 18 19.5H6A1.5 1.5 0 0 1 4.5 18V6A1.5 1.5 0 0 1 6 4.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M8 8h8M8 12h8M8 16h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"runDocSchemaValidation",label:"Run Schema Validation",command:"runDocSchemaValidation",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3.5 4.5 6.5v5c0 4.8 3.1 8.9 7.5 10 4.4-1.1 7.5-5.2 7.5-10v-5L12 3.5Z" stroke="currentColor" stroke-width="1.6"/><path d="m9 12.5 2 2 4-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"toggleDocSchemaRealtime",label:"Toggle Schema Realtime",command:"toggleDocSchemaRealtime",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 12a7.5 7.5 0 1 1 7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M9.5 19.5H5.5v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>'}]}],commands:{docSchema:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},openDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},toggleDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ke(o,typeof r=="boolean"?r:void 0)},runDocSchemaValidation:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,C(o,"command",!0),!0},insertMissingDocSchemaSections:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Me(o)},toggleDocSchemaRealtime:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Ce(o,typeof r=="boolean"?r:void 0)},setDocSchemaMode:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t,l=g(o,a);u.set(o,a);const c=typeof r=="string"?r:(r==null?void 0:r.schemaId)||(r==null?void 0:r.id);return!c||!L(a,c)?!1:(l.activeSchemaId=c,l.snapshot="",C(o,"set-mode",!0),!0)},setDocSchemaOptions:(r,s)=>{const o=T(s,!1,!1);if(!o||!r||typeof r!="object")return!1;const a=u.get(o)||t,l=X.get(o)||Re(a),c={...l,...r,labels:{...l.labels||{},...r.labels||{}},schemas:Array.isArray(r.schemas)?r.schemas:l.schemas,normalizeText:r.normalizeText||a.normalizeText},i=Z(c);u.set(o,i),X.set(o,c);const d=g(o,i);return typeof r.enableRealtime=="boolean"&&(d.realtimeEnabled=r.enableRealtime),(!d.activeSchemaId||!L(i,d.activeSchemaId))&&(d.activeSchemaId=re(i)),typeof r.defaultSchemaId=="string"&&L(i,r.defaultSchemaId)&&(d.activeSchemaId=r.defaultSchemaId),d.snapshot="",C(o,"set-options",!0),_(o),H(o),!0},getDocSchemaState:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;g(o,a);const l=we(o);if(typeof r=="function")try{r(l)}catch{}return o.__docSchemaState=l,o.dispatchEvent(new CustomEvent("editora:doc-schema-state",{bubbles:!0,detail:l})),!0}},keymap:{"Mod-Alt-Shift-g":"toggleDocSchemaPanel","Mod-Alt-Shift-G":"toggleDocSchemaPanel","Mod-Alt-Shift-j":"runDocSchemaValidation","Mod-Alt-Shift-J":"runDocSchemaValidation"},init:function(s){W+=1;const o=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,a=Z(o);Je(a);const l=T(s!=null&&s.editorElement?{editorElement:s.editorElement}:void 0,!1,!1);l&&(b=l,n.add(l),g(l,a),u.set(l,a),X.set(l,o),H(l),C(l,"init",!0))},destroy:()=>{n.forEach(r=>ue(r)),n.clear(),W=Math.max(0,W-1),!(W>0)&&Xe()}}};exports.DocSchemaPlugin=Qe;