@editora/plugins 1.0.10 → 1.0.11

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 (138) hide show
  1. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  2. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  3. package/dist/a11y-checker.cjs.js +12 -12
  4. package/dist/a11y-checker.esm.js +80 -98
  5. package/dist/anchor.cjs.js +12 -12
  6. package/dist/anchor.esm.js +115 -128
  7. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  8. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  9. package/dist/approval-workflow.cjs.js +40 -40
  10. package/dist/approval-workflow.esm.js +208 -249
  11. package/dist/background-color.cjs.js +2 -2
  12. package/dist/background-color.esm.js +55 -68
  13. package/dist/blockquote.esm.js +1 -2
  14. package/dist/blocks-library.cjs.js +45 -45
  15. package/dist/blocks-library.esm.js +178 -245
  16. package/dist/capitalization.esm.js +1 -2
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +58 -82
  19. package/dist/citations.cjs.js +37 -37
  20. package/dist/citations.esm.js +439 -512
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +27 -33
  23. package/dist/code-sample.cjs.js +14 -14
  24. package/dist/code-sample.esm.js +82 -93
  25. package/dist/code.cjs.js +32 -32
  26. package/dist/code.esm.js +501 -506
  27. package/dist/comments.cjs.js +6 -6
  28. package/dist/comments.esm.js +116 -158
  29. package/dist/conditional-content.cjs.js +90 -90
  30. package/dist/conditional-content.esm.js +371 -432
  31. package/dist/content-rules.cjs.js +7 -7
  32. package/dist/content-rules.esm.js +105 -159
  33. package/dist/data-binding.cjs.js +46 -46
  34. package/dist/data-binding.esm.js +328 -368
  35. package/dist/direction.esm.js +9 -18
  36. package/dist/doc-schema.cjs.js +29 -29
  37. package/dist/doc-schema.esm.js +240 -308
  38. package/dist/document-manager.cjs.js +1 -1
  39. package/dist/document-manager.esm.js +4 -5
  40. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  41. package/dist/documentManager-Jf0RbSks.js +17 -0
  42. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  43. package/dist/embed-iframe.cjs.js +4 -4
  44. package/dist/embed-iframe.esm.js +73 -81
  45. package/dist/emojis.cjs.js +8 -8
  46. package/dist/emojis.esm.js +65 -77
  47. package/dist/enterprise.cjs.js +1 -1
  48. package/dist/enterprise.esm.js +54 -56
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +39 -47
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +37 -53
  53. package/dist/footnote.cjs.js +2 -2
  54. package/dist/footnote.esm.js +76 -117
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +70 -92
  57. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  58. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  59. package/dist/indent.cjs.js +1 -1
  60. package/dist/indent.esm.js +12 -24
  61. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  62. package/dist/index-CvJk4DKa.js +221 -0
  63. package/dist/index-D3CycEFU.mjs +16543 -0
  64. package/dist/index-tqLTHcO6.js +1 -0
  65. package/dist/index.cjs.js +1 -1
  66. package/dist/index.es-CE_A4QSm.js +5 -0
  67. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  68. package/dist/index.esm.js +125 -128
  69. package/dist/italic.cjs.js +1 -1
  70. package/dist/italic.esm.js +8 -9
  71. package/dist/jspdf.es.min-BoS80556.js +77 -0
  72. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  73. package/dist/line-height.cjs.js +1 -1
  74. package/dist/line-height.esm.js +11 -24
  75. package/dist/link.cjs.js +5 -5
  76. package/dist/link.esm.js +24 -30
  77. package/dist/list.cjs.js +1 -1
  78. package/dist/list.esm.js +20 -25
  79. package/dist/lite.cjs.js +1 -1
  80. package/dist/lite.esm.js +59 -61
  81. package/dist/math.cjs.js +21 -21
  82. package/dist/math.esm.js +139 -146
  83. package/dist/media-manager.cjs.js +31 -31
  84. package/dist/media-manager.esm.js +285 -300
  85. package/dist/mentions.cjs.js +9 -9
  86. package/dist/mentions.esm.js +238 -286
  87. package/dist/merge-tag.cjs.js +2 -2
  88. package/dist/merge-tag.esm.js +177 -216
  89. package/dist/page-break.cjs.js +2 -2
  90. package/dist/page-break.esm.js +33 -49
  91. package/dist/pii-redaction.cjs.js +19 -19
  92. package/dist/pii-redaction.esm.js +393 -463
  93. package/dist/plugins.css +1 -0
  94. package/dist/preview.esm.js +5 -10
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +17 -20
  97. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  98. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  99. package/dist/slash-commands.cjs.js +2 -2
  100. package/dist/slash-commands.esm.js +39 -75
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +280 -336
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +61 -69
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +97 -123
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +14 -19
  109. package/dist/table.cjs.js +4 -4
  110. package/dist/table.esm.js +191 -225
  111. package/dist/template.cjs.js +21 -20
  112. package/dist/template.esm.js +715 -196
  113. package/dist/text-alignment.cjs.js +1 -1
  114. package/dist/text-alignment.esm.js +21 -27
  115. package/dist/text-color.cjs.js +3 -3
  116. package/dist/text-color.esm.js +70 -87
  117. package/dist/track-changes.cjs.js +2 -2
  118. package/dist/track-changes.esm.js +100 -162
  119. package/dist/translation-workflow.cjs.js +74 -74
  120. package/dist/translation-workflow.esm.js +602 -678
  121. package/dist/version-diff.cjs.js +14 -14
  122. package/dist/version-diff.esm.js +128 -157
  123. package/package.json +1 -1
  124. package/dist/_commonjsHelpers-6763f629.js +0 -1
  125. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  126. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  127. package/dist/anchoredPopover-8151d535.js +0 -1
  128. package/dist/documentManager-25b6203c.mjs +0 -9122
  129. package/dist/documentManager-b69e7054.js +0 -17
  130. package/dist/html2canvas.esm-09133e29.js +0 -22
  131. package/dist/index-656d224b.js +0 -231
  132. package/dist/index-6a8c48bb.js +0 -1
  133. package/dist/index-d027b7e2.mjs +0 -16859
  134. package/dist/index.es-730f2d98.mjs +0 -5775
  135. package/dist/index.es-dd40173b.js +0 -18
  136. package/dist/jspdf.es.min-90db2c97.js +0 -243
  137. package/dist/style.css +0 -1
  138. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=".rte-content, .editora-content",q='.rte-conditional-block[data-conditional-content="true"]',b=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',f=':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)',h=":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)",g=":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)",Le="rte-conditional-content-styles",c="rte-conditional-dialog-overlay",s="rte-conditional-floating-toolbar",T=new WeakMap,$e=new WeakMap,x=new WeakMap,j=new Map,I=new Map;let ae=null,se=0,G=null,U=null,Y=null,J=null,X=null,Q=null,O=null,y=null,ee=null;const Re={dialogTitleInsert:"Insert Conditional Content",dialogTitleEdit:"Edit Conditional Content",conditionLabel:"Condition",conditionPlaceholder:'user.role == "admin"',audienceLabel:"Audience (comma separated)",audiencePlaceholder:"all",localeLabel:"Locale (comma separated)",localePlaceholder:"all",elseLabel:"Enable Else Block",saveText:"Save",cancelText:"Cancel",blockIfLabel:"IF",blockElseLabel:"ELSE",allAudiencesText:"all audiences",allLocalesText:"all locales"};function $(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function K(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function Ae(e){return!e||e.length===0?"":e.join(", ")}function te(e){return e?e.map(t=>t.trim()).filter(Boolean):[]}function qe(e){return{...Re,...e||{}}}function H(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function re(e){return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||e}function ue(e){if(!e)return!1;const t=e.getAttribute("data-theme")||e.getAttribute("theme");return t&&t.toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark")}function Ke(e){const t=re(e);if(ue(t))return!0;const o=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return ue(o)?!0:ue(document.documentElement)||ue(document.body)}function fe(e){if(!e)return!1;const t=e.getAttribute("data-theme")||e.getAttribute("theme");return t&&t.toLowerCase()==="acme"?!0:e.classList.contains("editora-theme-acme")||e.classList.contains("rte-theme-acme")}function _e(e){const t=re(e);if(fe(t))return!0;const o=t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");return fe(o)?!0:fe(document.documentElement)||fe(document.body)}function ze(e){return Ke(e)?"dark":_e(e)?"acme":"light"}function he(e,t){const o=ze(t);e.classList.remove("rte-conditional-theme-dark","rte-conditional-theme-acme"),o==="dark"?e.classList.add("rte-conditional-theme-dark"):o==="acme"&&e.classList.add("rte-conditional-theme-acme")}function S(e,t=!0){if((e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const n=e.editorElement;if(n.matches(w))return n;const a=n.querySelector(w);if(a instanceof HTMLElement)return a}const o=window.getSelection();if(o&&o.rangeCount>0){const n=o.getRangeAt(0).startContainer,a=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement,r=a==null?void 0:a.closest(w);if(r)return r}const i=document.activeElement;if(i){if(i.matches(w))return i;const n=i.closest(w);if(n)return n}return y&&y.isConnected?y:t?document.querySelector(w):null}function Se(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)?o.cloneRange():null}function xe(e,t){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(t),e.focus({preventScroll:!0}))}function Te(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function Be(e,t){if(t===e.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,e.innerHTML)}catch{}}function pe(e,t){const o=document.createRange();o.selectNodeContents(t),o.collapse(!1),xe(e,o)}function ye(e,t){if(t)return t.split(".").filter(Boolean).reduce((o,i)=>{if(o!=null&&typeof o=="object")return o[i]},e)}function Fe(e){const t=e.trim();if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;const o=Number(t);if(!Number.isNaN(o)&&t!=="")return o;if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{return t}return t}function je(e,t){const o=e.trim();if(!o)return!0;if(o.startsWith("!")){const E=o.slice(1).trim();return!ye(t,E)}const i=o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);if(!i)return!!ye(t,o);const[,n,a,r]=i,l=ye(t,n),d=Fe(r);switch(a){case"==":return l==d;case"!=":return l!=d;case">":return Number(l)>Number(d);case"<":return Number(l)<Number(d);case">=":return Number(l)>=Number(d);case"<=":return Number(l)<=Number(d);case"in":return Array.isArray(d)?d.some(E=>E==l):typeof d=="string"?d.split(",").map(E=>E.trim()).includes(String(l)):!1;case"contains":case"~=":return Array.isArray(l)?l.some(E=>String(E).toLowerCase()===String(d).toLowerCase()):typeof l=="string"?l.toLowerCase().includes(String(d).toLowerCase()):!1;default:return!1}}function Ie(){if(typeof document>"u"||document.getElementById(Le))return;const e=document.createElement("style");e.id=Le,e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=".rte-content, .editora-content",H='.rte-conditional-block[data-conditional-content="true"]',b=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',f=':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)',p=":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)",h=":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)",Ce="rte-conditional-content-styles",c="rte-conditional-dialog-overlay",u="rte-conditional-floating-toolbar",w=new WeakMap,$e=new WeakMap,x=new WeakMap,_=new Map,z=new Map;let le=null,se=0,G=null,U=null,Y=null,J=null,X=null,Q=null,N=null,g=null,ee=null;const Oe={dialogTitleInsert:"Insert Conditional Content",dialogTitleEdit:"Edit Conditional Content",conditionLabel:"Condition",conditionPlaceholder:'user.role == "admin"',audienceLabel:"Audience (comma separated)",audiencePlaceholder:"all",localeLabel:"Locale (comma separated)",localePlaceholder:"all",elseLabel:"Enable Else Block",saveText:"Save",cancelText:"Cancel",blockIfLabel:"IF",blockElseLabel:"ELSE",allAudiencesText:"all audiences",allLocalesText:"all locales"};function y(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function P(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function Le(e){return!e||e.length===0?"":e.join(", ")}function te(e){return e?e.map(t=>t.trim()).filter(Boolean):[]}function Re(e){return{...Oe,...e||{}}}function k(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function ce(e){return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||e}function ue(e){if(!e)return!1;const t=e.getAttribute("data-theme")||e.getAttribute("theme");return t&&t.toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark")}function qe(e){const t=ce(e);if(ue(t))return!0;const o=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return ue(o)?!0:ue(document.documentElement)||ue(document.body)}function fe(e){if(!e)return!1;const t=e.getAttribute("data-theme")||e.getAttribute("theme");return t&&t.toLowerCase()==="acme"?!0:e.classList.contains("editora-theme-acme")||e.classList.contains("rte-theme-acme")}function Ke(e){const t=ce(e);if(fe(t))return!0;const o=t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");return fe(o)?!0:fe(document.documentElement)||fe(document.body)}function Ie(e){return qe(e)?"dark":Ke(e)?"acme":"light"}function he(e,t){const o=Ie(t);e.classList.remove("rte-conditional-theme-dark","rte-conditional-theme-acme"),o==="dark"?e.classList.add("rte-conditional-theme-dark"):o==="acme"&&e.classList.add("rte-conditional-theme-acme")}function A(e,t=!0){if(e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const n=e.editorElement;if(n.matches(L))return n;const a=n.querySelector(L);if(a instanceof HTMLElement)return a}const o=window.getSelection();if(o&&o.rangeCount>0){const n=o.getRangeAt(0).startContainer,r=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(L);if(r)return r}const i=document.activeElement;if(i){if(i.matches(L))return i;const n=i.closest(L);if(n)return n}return g&&g.isConnected?g:t?document.querySelector(L):null}function ke(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)?o.cloneRange():null}function xe(e,t){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(t),e.focus({preventScroll:!0}))}function Se(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function Te(e,t){if(t===e.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,e.innerHTML)}catch{}}function pe(e,t){const o=document.createRange();o.selectNodeContents(t),o.collapse(!1),xe(e,o)}function ye(e,t){if(t)return t.split(".").filter(Boolean).reduce((o,i)=>{if(o!=null&&typeof o=="object")return o[i]},e)}function _e(e){const t=e.trim();if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;const o=Number(t);if(!Number.isNaN(o)&&t!=="")return o;if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{return t}return t}function ze(e,t){const o=e.trim();if(!o)return!0;if(o.startsWith("!")){const E=o.slice(1).trim();return!ye(t,E)}const i=o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);if(!i)return!!ye(t,o);const[,n,a,r]=i,l=ye(t,n),d=_e(r);switch(a){case"==":return l==d;case"!=":return l!=d;case">":return Number(l)>Number(d);case"<":return Number(l)<Number(d);case">=":return Number(l)>=Number(d);case"<=":return Number(l)<=Number(d);case"in":return Array.isArray(d)?d.some(E=>E==l):typeof d=="string"?d.split(",").map(E=>E.trim()).includes(String(l)):!1;case"contains":case"~=":return Array.isArray(l)?l.some(E=>String(E).toLowerCase()===String(d).toLowerCase()):typeof l=="string"?l.toLowerCase().includes(String(d).toLowerCase()):!1;default:return!1}}function Fe(){if(typeof document>"u"||document.getElementById(Ce))return;const e=document.createElement("style");e.id=Ce,e.textContent=`
2
2
  .rte-conditional-block {
3
3
  border: 1px solid #dbe3ec;
4
4
  border-radius: 8px;
@@ -234,7 +234,7 @@
234
234
  background: #1d4ed8;
235
235
  }
236
236
 
237
- .${s} {
237
+ .${u} {
238
238
  position: fixed;
239
239
  z-index: 2147483645;
240
240
  display: none;
@@ -248,11 +248,11 @@
248
248
  backdrop-filter: blur(6px);
249
249
  }
250
250
 
251
- .${s}.show {
251
+ .${u}.show {
252
252
  display: inline-flex;
253
253
  }
254
254
 
255
- .${s} .rte-conditional-float-btn {
255
+ .${u} .rte-conditional-float-btn {
256
256
  border: 1px solid #cbd5e1;
257
257
  border-radius: 6px;
258
258
  min-height: 30px;
@@ -269,27 +269,27 @@
269
269
  line-height: 1;
270
270
  }
271
271
 
272
- .${s} .rte-conditional-float-btn:hover {
272
+ .${u} .rte-conditional-float-btn:hover {
273
273
  background: #f8fafc;
274
274
  }
275
275
 
276
- .${s} .rte-conditional-float-btn[data-action="delete"] {
276
+ .${u} .rte-conditional-float-btn[data-action="delete"] {
277
277
  border-color: #fecaca;
278
278
  color: #991b1b;
279
279
  background: #fff5f5;
280
280
  }
281
281
 
282
- .rte-conditional-preview-on ${q} {
282
+ .rte-conditional-preview-on ${H} {
283
283
  border-width: 2px;
284
284
  }
285
285
 
286
- .rte-conditional-preview-on ${q} .rte-conditional-header {
286
+ .rte-conditional-preview-on ${H} .rte-conditional-header {
287
287
  background: #ecfeff;
288
288
  border-color: #bae6fd;
289
289
  }
290
290
 
291
291
  ${b} .rte-conditional-block,
292
- ${h} .rte-conditional-block,
292
+ ${p} .rte-conditional-block,
293
293
  .${c}.rte-conditional-theme-dark .rte-conditional-block {
294
294
  background: #111827;
295
295
  border-color: #334155;
@@ -297,8 +297,8 @@
297
297
 
298
298
  ${b} .rte-conditional-header,
299
299
  ${b} .rte-conditional-else-label,
300
- ${h} .rte-conditional-header,
301
- ${h} .rte-conditional-else-label,
300
+ ${p} .rte-conditional-header,
301
+ ${p} .rte-conditional-else-label,
302
302
  .${c}.rte-conditional-theme-dark .rte-conditional-header,
303
303
  .${c}.rte-conditional-theme-dark .rte-conditional-else-label {
304
304
  background: #0f172a;
@@ -306,19 +306,19 @@
306
306
  }
307
307
 
308
308
  ${b} .rte-conditional-summary,
309
- ${h} .rte-conditional-summary,
309
+ ${p} .rte-conditional-summary,
310
310
  .${c}.rte-conditional-theme-dark .rte-conditional-summary {
311
311
  color: #e2e8f0;
312
312
  }
313
313
 
314
314
  ${b} .rte-conditional-meta,
315
- ${h} .rte-conditional-meta,
315
+ ${p} .rte-conditional-meta,
316
316
  .${c}.rte-conditional-theme-dark .rte-conditional-meta {
317
317
  color: #94a3b8;
318
318
  }
319
319
 
320
320
  ${b} .rte-conditional-chip,
321
- ${h} .rte-conditional-chip,
321
+ ${p} .rte-conditional-chip,
322
322
  .${c}.rte-conditional-theme-dark .rte-conditional-chip {
323
323
  background: #1e3a8a;
324
324
  border-color: #3b82f6;
@@ -326,7 +326,7 @@
326
326
  }
327
327
 
328
328
  ${b} .rte-conditional-chip-else,
329
- ${h} .rte-conditional-chip-else,
329
+ ${p} .rte-conditional-chip-else,
330
330
  .${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
331
331
  background: #7f1d1d;
332
332
  border-color: #ef4444;
@@ -334,14 +334,14 @@
334
334
  }
335
335
 
336
336
  ${b} .rte-conditional-body,
337
- ${h} .rte-conditional-body,
337
+ ${p} .rte-conditional-body,
338
338
  .${c}.rte-conditional-theme-dark .rte-conditional-body {
339
339
  background: #1f2937;
340
340
  color: #e2e8f0;
341
341
  }
342
342
 
343
343
  ${b} .rte-conditional-dialog,
344
- ${h} .rte-conditional-dialog,
344
+ ${p} .rte-conditional-dialog,
345
345
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog {
346
346
  background: #1f2937;
347
347
  border-color: #334155;
@@ -349,8 +349,8 @@
349
349
 
350
350
  ${b} .rte-conditional-dialog-header,
351
351
  ${b} .rte-conditional-dialog-footer,
352
- ${h} .rte-conditional-dialog-header,
353
- ${h} .rte-conditional-dialog-footer,
352
+ ${p} .rte-conditional-dialog-header,
353
+ ${p} .rte-conditional-dialog-footer,
354
354
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
355
355
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
356
356
  background: #111827;
@@ -360,9 +360,9 @@
360
360
  ${b} .rte-conditional-dialog-title,
361
361
  ${b} .rte-conditional-field label,
362
362
  ${b} .rte-conditional-checkbox,
363
- ${h} .rte-conditional-dialog-title,
364
- ${h} .rte-conditional-field label,
365
- ${h} .rte-conditional-checkbox,
363
+ ${p} .rte-conditional-dialog-title,
364
+ ${p} .rte-conditional-field label,
365
+ ${p} .rte-conditional-checkbox,
366
366
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
367
367
  .${c}.rte-conditional-theme-dark .rte-conditional-field label,
368
368
  .${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
@@ -370,15 +370,15 @@
370
370
  }
371
371
 
372
372
  ${b} .rte-conditional-help,
373
- ${h} .rte-conditional-help,
373
+ ${p} .rte-conditional-help,
374
374
  .${c}.rte-conditional-theme-dark .rte-conditional-help {
375
375
  color: #94a3b8;
376
376
  }
377
377
 
378
378
  ${b} .rte-conditional-field input[type="text"],
379
379
  ${b} .rte-conditional-btn,
380
- ${h} .rte-conditional-field input[type="text"],
381
- ${h} .rte-conditional-btn,
380
+ ${p} .rte-conditional-field input[type="text"],
381
+ ${p} .rte-conditional-btn,
382
382
  .${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
383
383
  .${c}.rte-conditional-theme-dark .rte-conditional-btn {
384
384
  background: #0f172a;
@@ -387,7 +387,7 @@
387
387
  }
388
388
 
389
389
  ${b} .rte-conditional-btn-primary,
390
- ${h} .rte-conditional-btn-primary,
390
+ ${p} .rte-conditional-btn-primary,
391
391
  .${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
392
392
  border-color: #3b82f6;
393
393
  background: #2563eb;
@@ -396,43 +396,43 @@
396
396
 
397
397
  ${b} .rte-toolbar-group-items.conditional-content,
398
398
  .${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
399
- ${h} .rte-toolbar-group-items.conditional-content,
399
+ ${p} .rte-toolbar-group-items.conditional-content,
400
400
  ${b} .editora-toolbar-group-items.conditional-content {
401
401
  border-color: #566275;
402
402
  }
403
403
 
404
404
  ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
405
- ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
405
+ ${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
406
406
  ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
407
407
  border-right-color: #566275;
408
408
  }
409
409
 
410
- ${b} .${s},
411
- .${c}.rte-conditional-theme-dark .${s},
412
- .${s}.rte-conditional-theme-dark {
410
+ ${b} .${u},
411
+ .${c}.rte-conditional-theme-dark .${u},
412
+ .${u}.rte-conditional-theme-dark {
413
413
  background: rgba(17, 24, 39, 0.98);
414
414
  border-color: #334155;
415
415
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
416
416
  }
417
417
 
418
- ${b} .${s} .rte-conditional-float-btn,
419
- .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn,
420
- .${s}.rte-conditional-theme-dark .rte-conditional-float-btn {
418
+ ${b} .${u} .rte-conditional-float-btn,
419
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
420
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
421
421
  background: #0f172a;
422
422
  border-color: #475569;
423
423
  color: #e2e8f0;
424
424
  }
425
425
 
426
- ${b} .${s} .rte-conditional-float-btn[data-action="delete"],
427
- .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn[data-action="delete"],
428
- .${s}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
426
+ ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
427
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
428
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
429
429
  border-color: #ef4444;
430
430
  color: #fecaca;
431
431
  background: rgba(127, 29, 29, 0.45);
432
432
  }
433
433
 
434
434
  ${f} .rte-conditional-block,
435
- ${g} .rte-conditional-block,
435
+ ${h} .rte-conditional-block,
436
436
  .${c}.rte-conditional-theme-acme .rte-conditional-block {
437
437
  background: #f8fbff;
438
438
  border-color: #cbd8e8;
@@ -440,8 +440,8 @@
440
440
 
441
441
  ${f} .rte-conditional-header,
442
442
  ${f} .rte-conditional-else-label,
443
- ${g} .rte-conditional-header,
444
- ${g} .rte-conditional-else-label,
443
+ ${h} .rte-conditional-header,
444
+ ${h} .rte-conditional-else-label,
445
445
  .${c}.rte-conditional-theme-acme .rte-conditional-header,
446
446
  .${c}.rte-conditional-theme-acme .rte-conditional-else-label {
447
447
  background: linear-gradient(180deg, #eef4fb 0%, #e6eef8 100%);
@@ -449,19 +449,19 @@
449
449
  }
450
450
 
451
451
  ${f} .rte-conditional-summary,
452
- ${g} .rte-conditional-summary,
452
+ ${h} .rte-conditional-summary,
453
453
  .${c}.rte-conditional-theme-acme .rte-conditional-summary {
454
454
  color: #0f172a;
455
455
  }
456
456
 
457
457
  ${f} .rte-conditional-meta,
458
- ${g} .rte-conditional-meta,
458
+ ${h} .rte-conditional-meta,
459
459
  .${c}.rte-conditional-theme-acme .rte-conditional-meta {
460
460
  color: #587089;
461
461
  }
462
462
 
463
463
  ${f} .rte-conditional-chip,
464
- ${g} .rte-conditional-chip,
464
+ ${h} .rte-conditional-chip,
465
465
  .${c}.rte-conditional-theme-acme .rte-conditional-chip {
466
466
  background: #d9f5ee;
467
467
  border-color: #66c6b3;
@@ -469,7 +469,7 @@
469
469
  }
470
470
 
471
471
  ${f} .rte-conditional-chip-else,
472
- ${g} .rte-conditional-chip-else,
472
+ ${h} .rte-conditional-chip-else,
473
473
  .${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
474
474
  background: #fde8ea;
475
475
  border-color: #f1a7b2;
@@ -477,14 +477,14 @@
477
477
  }
478
478
 
479
479
  ${f} .rte-conditional-body,
480
- ${g} .rte-conditional-body,
480
+ ${h} .rte-conditional-body,
481
481
  .${c}.rte-conditional-theme-acme .rte-conditional-body {
482
482
  background: #fcfeff;
483
483
  color: #0f172a;
484
484
  }
485
485
 
486
486
  ${f} .rte-conditional-dialog,
487
- ${g} .rte-conditional-dialog,
487
+ ${h} .rte-conditional-dialog,
488
488
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog {
489
489
  background: #ffffff;
490
490
  border-color: #cbd8e8;
@@ -493,8 +493,8 @@
493
493
 
494
494
  ${f} .rte-conditional-dialog-header,
495
495
  ${f} .rte-conditional-dialog-footer,
496
- ${g} .rte-conditional-dialog-header,
497
- ${g} .rte-conditional-dialog-footer,
496
+ ${h} .rte-conditional-dialog-header,
497
+ ${h} .rte-conditional-dialog-footer,
498
498
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
499
499
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-footer {
500
500
  background: #f3f8fd;
@@ -504,9 +504,9 @@
504
504
  ${f} .rte-conditional-dialog-title,
505
505
  ${f} .rte-conditional-field label,
506
506
  ${f} .rte-conditional-checkbox,
507
- ${g} .rte-conditional-dialog-title,
508
- ${g} .rte-conditional-field label,
509
- ${g} .rte-conditional-checkbox,
507
+ ${h} .rte-conditional-dialog-title,
508
+ ${h} .rte-conditional-field label,
509
+ ${h} .rte-conditional-checkbox,
510
510
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-title,
511
511
  .${c}.rte-conditional-theme-acme .rte-conditional-field label,
512
512
  .${c}.rte-conditional-theme-acme .rte-conditional-checkbox {
@@ -514,15 +514,15 @@
514
514
  }
515
515
 
516
516
  ${f} .rte-conditional-help,
517
- ${g} .rte-conditional-help,
517
+ ${h} .rte-conditional-help,
518
518
  .${c}.rte-conditional-theme-acme .rte-conditional-help {
519
519
  color: #5f738d;
520
520
  }
521
521
 
522
522
  ${f} .rte-conditional-field input[type="text"],
523
523
  ${f} .rte-conditional-btn,
524
- ${g} .rte-conditional-field input[type="text"],
525
- ${g} .rte-conditional-btn,
524
+ ${h} .rte-conditional-field input[type="text"],
525
+ ${h} .rte-conditional-btn,
526
526
  .${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
527
527
  .${c}.rte-conditional-theme-acme .rte-conditional-btn {
528
528
  background: #ffffff;
@@ -531,7 +531,7 @@
531
531
  }
532
532
 
533
533
  ${f} .rte-conditional-btn-primary,
534
- ${g} .rte-conditional-btn-primary,
534
+ ${h} .rte-conditional-btn-primary,
535
535
  .${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
536
536
  border-color: #0f766e;
537
537
  background: #0f766e;
@@ -540,87 +540,87 @@
540
540
 
541
541
  ${f} .rte-toolbar-group-items.conditional-content,
542
542
  .${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
543
- ${g} .rte-toolbar-group-items.conditional-content,
543
+ ${h} .rte-toolbar-group-items.conditional-content,
544
544
  ${f} .editora-toolbar-group-items.conditional-content {
545
545
  border-color: #bfd0e2;
546
546
  }
547
547
 
548
548
  ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
549
- ${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
549
+ ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
550
550
  ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
551
551
  border-right-color: #bfd0e2;
552
552
  }
553
553
 
554
- ${f} .${s},
555
- .${c}.rte-conditional-theme-acme .${s},
556
- .${s}.rte-conditional-theme-acme {
554
+ ${f} .${u},
555
+ .${c}.rte-conditional-theme-acme .${u},
556
+ .${u}.rte-conditional-theme-acme {
557
557
  background: rgba(255, 255, 255, 0.98);
558
558
  border-color: #bfd0e2;
559
559
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
560
560
  }
561
561
 
562
- ${f} .${s} .rte-conditional-float-btn,
563
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn,
564
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn {
562
+ ${f} .${u} .rte-conditional-float-btn,
563
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
564
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
565
565
  background: #ffffff;
566
566
  border-color: #bfd0e2;
567
567
  color: #1f334a;
568
568
  }
569
569
 
570
- ${f} .${s} .rte-conditional-float-btn:hover,
571
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn:hover,
572
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
570
+ ${f} .${u} .rte-conditional-float-btn:hover,
571
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
572
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
573
573
  background: #eef7f5;
574
574
  color: #0f4f4a;
575
575
  }
576
576
 
577
- ${f} .${s} .rte-conditional-float-btn[data-action="delete"],
578
- .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn[data-action="delete"],
579
- .${s}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
577
+ ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
578
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
579
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
580
580
  border-color: #f1a7b2;
581
581
  color: #8b1f2f;
582
582
  background: #fff4f6;
583
583
  }
584
- `,document.head.appendChild(e)}function Ve(e){return{defaultCondition:e.defaultCondition||"",defaultAudience:te(e.defaultAudience||[]),defaultLocale:te(e.defaultLocale||[]),enableElseByDefault:e.enableElseByDefault===!0,labels:qe(e.labels),context:e.context,getContext:e.getContext,currentAudience:e.currentAudience,currentLocale:e.currentLocale,evaluateCondition:e.evaluateCondition||je}}function Me(){ae&&(ae.cleanup(),ae=null)}function We(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function oe(e,t){e.setAttribute("contenteditable","false"),e.setAttribute("spellcheck","false");const o=e.querySelector(".rte-conditional-header");o&&(o.setAttribute("contenteditable","false"),o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label","Edit conditional rule"));const i=e.querySelector(".rte-conditional-else-label");i&&i.setAttribute("contenteditable","false"),Ue(e,!t)}function Ze(e){const t=e.querySelector('.rte-conditional-body[data-slot="if"]');if(!t)return;const o=new Set,i=e.querySelector(".rte-conditional-header"),n=e.querySelector(".rte-conditional-else-label"),a=e.querySelector('.rte-conditional-body[data-slot="else"]');i&&o.add(i),o.add(t),n&&o.add(n),a&&o.add(a),Array.from(e.childNodes).forEach(l=>{if(!(l instanceof HTMLElement&&o.has(l))){if(l.nodeType===Node.TEXT_NODE&&!(l.textContent||"").trim()){l.remove();return}t.appendChild(l)}})}function W(e){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0).startContainer,a=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement,r=a==null?void 0:a.closest(q);if(r&&e.contains(r))return r}const o=document.activeElement,i=o==null?void 0:o.closest(q);return i&&e.contains(i)?i:null}function Ee(e,t){let o=e.querySelector(".rte-conditional-else-label"),i=e.querySelector('.rte-conditional-body[data-slot="else"]');o||(o=document.createElement("div"),o.className="rte-conditional-else-label",o.setAttribute("contenteditable","false"),o.innerHTML=`
585
- <span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
584
+ `,document.head.appendChild(e)}function je(e){return{defaultCondition:e.defaultCondition||"",defaultAudience:te(e.defaultAudience||[]),defaultLocale:te(e.defaultLocale||[]),enableElseByDefault:e.enableElseByDefault===!0,labels:Re(e.labels),context:e.context,getContext:e.getContext,currentAudience:e.currentAudience,currentLocale:e.currentLocale,evaluateCondition:e.evaluateCondition||ze}}function Be(){le&&(le.cleanup(),le=null)}function Ve(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function oe(e,t){e.setAttribute("contenteditable","false"),e.setAttribute("spellcheck","false");const o=e.querySelector(".rte-conditional-header");o&&(o.setAttribute("contenteditable","false"),o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label","Edit conditional rule"));const i=e.querySelector(".rte-conditional-else-label");i&&i.setAttribute("contenteditable","false"),Ge(e,!t)}function We(e){const t=e.querySelector('.rte-conditional-body[data-slot="if"]');if(!t)return;const o=new Set,i=e.querySelector(".rte-conditional-header"),n=e.querySelector(".rte-conditional-else-label"),a=e.querySelector('.rte-conditional-body[data-slot="else"]');i&&o.add(i),o.add(t),n&&o.add(n),a&&o.add(a),Array.from(e.childNodes).forEach(l=>{if(!(l instanceof HTMLElement&&o.has(l))){if(l.nodeType===Node.TEXT_NODE&&!(l.textContent||"").trim()){l.remove();return}t.appendChild(l)}})}function W(e){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0).startContainer,r=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(H);if(r&&e.contains(r))return r}const i=document.activeElement?.closest(H);return i&&e.contains(i)?i:null}function Ee(e,t){let o=e.querySelector(".rte-conditional-else-label"),i=e.querySelector('.rte-conditional-body[data-slot="else"]');o||(o=document.createElement("div"),o.className="rte-conditional-else-label",o.setAttribute("contenteditable","false"),o.innerHTML=`
585
+ <span class="rte-conditional-chip rte-conditional-chip-else">${y(t.blockElseLabel)}</span>
586
586
  <span class="rte-conditional-summary">Else branch</span>
587
- `,e.appendChild(o)),i||(i=document.createElement("div"),i.className="rte-conditional-body rte-conditional-else-body",i.setAttribute("data-slot","else"),i.innerHTML="<p><br></p>",e.appendChild(i))}function Ge(e,t){e.setAttribute("data-has-else",t?"true":"false");const o=e.querySelector(".rte-conditional-else-label"),i=e.querySelector('.rte-conditional-body[data-slot="else"]');o&&o.classList.toggle("rte-conditional-hidden",!t),i&&i.classList.toggle("rte-conditional-hidden",!t)}function Ue(e,t){Array.from(e.querySelectorAll(".rte-conditional-body")).forEach(i=>{i.setAttribute("contenteditable",t?"true":"false")}),e.setAttribute("contenteditable","false")}function ve(e,t){const o=e.getAttribute("data-condition")||"",i=K(e.getAttribute("data-audience")),n=K(e.getAttribute("data-locale"));let a=e.querySelector(".rte-conditional-header");a||(a=document.createElement("div"),a.className="rte-conditional-header",e.prepend(a)),a.setAttribute("contenteditable","false"),a.setAttribute("tabindex","0"),a.setAttribute("role","button"),a.setAttribute("aria-label","Edit conditional rule");const r=o||"(always true)",l=i.length>0?i.join(", "):t.allAudiencesText,d=n.length>0?n.join(", "):t.allLocalesText;if(a.innerHTML=`
588
- <span class="rte-conditional-chip">${$(t.blockIfLabel)}</span>
589
- <span class="rte-conditional-summary">${$(r)}</span>
590
- <span class="rte-conditional-meta">${$(l)} · ${$(d)}</span>
591
- `,!e.querySelector('.rte-conditional-body[data-slot="if"]')){const p=document.createElement("div");p.className="rte-conditional-body",p.setAttribute("data-slot","if"),p.innerHTML="<p><br></p>",e.insertBefore(p,e.children[1]||null)}const L=e.getAttribute("data-has-else")==="true";L&&Ee(e,t),Ze(e),Ge(e,L)}function Ne(e,t){const o=document.createElement("section");o.className="rte-conditional-block",o.setAttribute("data-conditional-content","true"),o.setAttribute("data-condition",(e.condition||"").trim()),o.setAttribute("data-audience",te(e.audience).join(",")),o.setAttribute("data-locale",te(e.locale).join(",")),o.setAttribute("data-has-else",e.hasElse?"true":"false"),o.setAttribute("role","group"),o.setAttribute("aria-label","Conditional content block"),o.setAttribute("contenteditable","false"),o.setAttribute("spellcheck","false");const i=document.createElement("div");i.className="rte-conditional-header",i.setAttribute("contenteditable","false");const n=document.createElement("div");return n.className="rte-conditional-body",n.setAttribute("data-slot","if"),n.innerHTML="<p><br></p>",o.appendChild(i),o.appendChild(n),e.hasElse&&Ee(o,t),ve(o,t),oe(o,!1),o}function Ye(e,t){if(t)try{if(!e.isConnected)return;const o=e.contains(t.startContainer),i=e.contains(t.endContainer);if(!o||!i)return;xe(e,t)}catch{}}function Je(e){return(e.textContent||"").replace(/\u200B/g,"").trim().length>0?!0:e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol")!==null}function De(e,t,o){let i=null;if(o)try{const r=o.cloneRange();e.contains(r.commonAncestorContainer)&&(i=r)}catch{i=null}i||(i=Se(e)),i||(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1));let n=null;i.collapsed||(n=i.extractContents()),i.insertNode(t);const a=t.querySelector('.rte-conditional-body[data-slot="if"]');a&&n&&Je(n)&&(a.innerHTML="",a.appendChild(n)),a?pe(e,a):pe(e,t),e.normalize()}function Xe(e){return{condition:e.getAttribute("data-condition")||"",audience:K(e.getAttribute("data-audience")),locale:K(e.getAttribute("data-locale")),hasElse:e.getAttribute("data-has-else")==="true"}}function Qe(e,t,o){e.setAttribute("data-condition",(t.condition||"").trim()),e.setAttribute("data-audience",te(t.audience).join(",")),e.setAttribute("data-locale",te(t.locale).join(",")),e.setAttribute("data-has-else",t.hasElse?"true":"false"),t.hasElse&&Ee(e,o),ve(e,o),oe(e,e.classList.contains("rte-conditional-preview"))}function ne(e,t){he(e,e);const o=Array.from(e.querySelectorAll(q)),i=T.get(e)===!0;return o.forEach(n=>{n.classList.add("rte-conditional-block"),n.setAttribute("data-conditional-content","true"),n.hasAttribute("data-condition")||n.setAttribute("data-condition",""),n.hasAttribute("data-audience")||n.setAttribute("data-audience",""),n.hasAttribute("data-locale")||n.setAttribute("data-locale",""),n.hasAttribute("data-has-else")||n.setAttribute("data-has-else","false"),n.setAttribute("role","group"),n.setAttribute("aria-label","Conditional content block"),n.setAttribute("contenteditable","false"),n.setAttribute("spellcheck","false"),ve(n,t),oe(n,i)}),o}async function et(e,t){const o=$e.get(e);if(o)return o;if(typeof t.getContext=="function")try{const i=re(e),n=await Promise.resolve(t.getContext({editor:e,editorRoot:i}));if(n&&typeof n=="object")return n}catch{return{}}if(typeof t.context=="function")try{const i=t.context();if(i&&typeof i=="object")return i}catch{return{}}return t.context&&typeof t.context=="object"?t.context:{}}function be(e){return Array.isArray(e)?e.map(t=>t.trim().toLowerCase()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function we(e,t){return e.length===0||e.includes("all")?!0:t.length===0?!1:e.some(o=>t.includes(o))}async function Z(e,t,o){var M,le;const i=t.labels,n=ne(e,i);if(T.set(e,o),He(e,o),re(e).classList.toggle("rte-conditional-preview-on",o),!o){n.forEach(m=>{m.classList.remove("rte-conditional-preview"),oe(m,!1);const N=m.querySelector('.rte-conditional-body[data-slot="if"]'),D=m.querySelector('.rte-conditional-body[data-slot="else"]'),P=m.querySelector(".rte-conditional-else-label"),C=m.getAttribute("data-has-else")==="true";N&&(N.classList.remove("rte-conditional-hidden"),N.removeAttribute("aria-hidden")),D&&(D.classList.toggle("rte-conditional-hidden",!C),D.setAttribute("aria-hidden",C?"false":"true")),P&&P.classList.toggle("rte-conditional-hidden",!C)});return}const r=await et(e,t),l=be(t.currentAudience),d=be(t.currentLocale),E=be(r.audience??((M=r.user)==null?void 0:M.audience)),L=be(r.locale??((le=r.user)==null?void 0:le.locale)),p=l.length>0?l:E,B=d.length>0?d:L;n.forEach(m=>{const N=m.getAttribute("data-condition")||"",D=K(m.getAttribute("data-audience")).map(v=>v.toLowerCase()),P=K(m.getAttribute("data-locale")).map(v=>v.toLowerCase()),C=m.getAttribute("data-has-else")==="true",ce=t.evaluateCondition(N,r),de=we(D,p),ge=we(P,B),_=ce&&de&&ge,V=m.querySelector('.rte-conditional-body[data-slot="if"]'),u=m.querySelector('.rte-conditional-body[data-slot="else"]'),k=m.querySelector(".rte-conditional-else-label");if(m.classList.add("rte-conditional-preview"),oe(m,!0),V&&(V.classList.toggle("rte-conditional-hidden",!_),V.setAttribute("aria-hidden",_?"false":"true")),u){const v=C&&!_;u.classList.toggle("rte-conditional-hidden",!v),u.setAttribute("aria-hidden",v?"false":"true")}if(k){const v=C&&!_;k.classList.toggle("rte-conditional-hidden",!v)}})}function He(e,t){const o=re(e);Array.from(o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')).forEach(n=>{n.setAttribute("data-active",t?"true":"false"),n.classList.toggle("active",t),n.setAttribute("aria-pressed",t?"true":"false")})}function tt(e){const t=j.get(e);if(t&&t.isConnected)return t;const o=document.createElement("div");return o.className=s,o.setAttribute("role","toolbar"),o.setAttribute("aria-label","Conditional block actions"),o.innerHTML=`
587
+ `,e.appendChild(o)),i||(i=document.createElement("div"),i.className="rte-conditional-body rte-conditional-else-body",i.setAttribute("data-slot","else"),i.innerHTML="<p><br></p>",e.appendChild(i))}function Ze(e,t){e.setAttribute("data-has-else",t?"true":"false");const o=e.querySelector(".rte-conditional-else-label"),i=e.querySelector('.rte-conditional-body[data-slot="else"]');o&&o.classList.toggle("rte-conditional-hidden",!t),i&&i.classList.toggle("rte-conditional-hidden",!t)}function Ge(e,t){Array.from(e.querySelectorAll(".rte-conditional-body")).forEach(i=>{i.setAttribute("contenteditable",t?"true":"false")}),e.setAttribute("contenteditable","false")}function ve(e,t){const o=e.getAttribute("data-condition")||"",i=P(e.getAttribute("data-audience")),n=P(e.getAttribute("data-locale"));let a=e.querySelector(".rte-conditional-header");a||(a=document.createElement("div"),a.className="rte-conditional-header",e.prepend(a)),a.setAttribute("contenteditable","false"),a.setAttribute("tabindex","0"),a.setAttribute("role","button"),a.setAttribute("aria-label","Edit conditional rule");const r=o||"(always true)",l=i.length>0?i.join(", "):t.allAudiencesText,d=n.length>0?n.join(", "):t.allLocalesText;if(a.innerHTML=`
588
+ <span class="rte-conditional-chip">${y(t.blockIfLabel)}</span>
589
+ <span class="rte-conditional-summary">${y(r)}</span>
590
+ <span class="rte-conditional-meta">${y(l)} · ${y(d)}</span>
591
+ `,!e.querySelector('.rte-conditional-body[data-slot="if"]')){const v=document.createElement("div");v.className="rte-conditional-body",v.setAttribute("data-slot","if"),v.innerHTML="<p><br></p>",e.insertBefore(v,e.children[1]||null)}const m=e.getAttribute("data-has-else")==="true";m&&Ee(e,t),We(e),Ze(e,m)}function Me(e,t){const o=document.createElement("section");o.className="rte-conditional-block",o.setAttribute("data-conditional-content","true"),o.setAttribute("data-condition",(e.condition||"").trim()),o.setAttribute("data-audience",te(e.audience).join(",")),o.setAttribute("data-locale",te(e.locale).join(",")),o.setAttribute("data-has-else",e.hasElse?"true":"false"),o.setAttribute("role","group"),o.setAttribute("aria-label","Conditional content block"),o.setAttribute("contenteditable","false"),o.setAttribute("spellcheck","false");const i=document.createElement("div");i.className="rte-conditional-header",i.setAttribute("contenteditable","false");const n=document.createElement("div");return n.className="rte-conditional-body",n.setAttribute("data-slot","if"),n.innerHTML="<p><br></p>",o.appendChild(i),o.appendChild(n),e.hasElse&&Ee(o,t),ve(o,t),oe(o,!1),o}function Ue(e,t){if(t)try{if(!e.isConnected)return;const o=e.contains(t.startContainer),i=e.contains(t.endContainer);if(!o||!i)return;xe(e,t)}catch{}}function Ye(e){return(e.textContent||"").replace(/\u200B/g,"").trim().length>0?!0:e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol")!==null}function Ne(e,t,o){let i=null;i||(i=ke(e)),i||(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1));let n=null;i.collapsed||(n=i.extractContents()),i.insertNode(t);const a=t.querySelector('.rte-conditional-body[data-slot="if"]');a&&n&&Ye(n)&&(a.innerHTML="",a.appendChild(n)),a?pe(e,a):pe(e,t),e.normalize()}function Je(e){return{condition:e.getAttribute("data-condition")||"",audience:P(e.getAttribute("data-audience")),locale:P(e.getAttribute("data-locale")),hasElse:e.getAttribute("data-has-else")==="true"}}function Xe(e,t,o){e.setAttribute("data-condition",(t.condition||"").trim()),e.setAttribute("data-audience",te(t.audience).join(",")),e.setAttribute("data-locale",te(t.locale).join(",")),e.setAttribute("data-has-else",t.hasElse?"true":"false"),t.hasElse&&Ee(e,o),ve(e,o),oe(e,e.classList.contains("rte-conditional-preview"))}function ne(e,t){he(e,e);const o=Array.from(e.querySelectorAll(H)),i=w.get(e)===!0;return o.forEach(n=>{n.classList.add("rte-conditional-block"),n.setAttribute("data-conditional-content","true"),n.hasAttribute("data-condition")||n.setAttribute("data-condition",""),n.hasAttribute("data-audience")||n.setAttribute("data-audience",""),n.hasAttribute("data-locale")||n.setAttribute("data-locale",""),n.hasAttribute("data-has-else")||n.setAttribute("data-has-else","false"),n.setAttribute("role","group"),n.setAttribute("aria-label","Conditional content block"),n.setAttribute("contenteditable","false"),n.setAttribute("spellcheck","false"),ve(n,t),oe(n,i)}),o}async function Qe(e,t){const o=$e.get(e);if(o)return o;if(typeof t.getContext=="function")try{const i=ce(e),n=await Promise.resolve(t.getContext({editor:e,editorRoot:i}));if(n&&typeof n=="object")return n}catch{return{}}if(typeof t.context=="function")try{const i=t.context();if(i&&typeof i=="object")return i}catch{return{}}return t.context&&typeof t.context=="object"?t.context:{}}function be(e){return Array.isArray(e)?e.map(t=>t.trim().toLowerCase()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function Ae(e,t){return e.length===0||e.includes("all")?!0:t.length===0?!1:e.some(o=>t.includes(o))}async function Z(e,t,o){const i=t.labels,n=ne(e,i);if(w.set(e,o),De(e,o),ce(e).classList.toggle("rte-conditional-preview-on",o),!o){n.forEach($=>{$.classList.remove("rte-conditional-preview"),oe($,!1);const O=$.querySelector('.rte-conditional-body[data-slot="if"]'),T=$.querySelector('.rte-conditional-body[data-slot="else"]'),F=$.querySelector(".rte-conditional-else-label"),B=$.getAttribute("data-has-else")==="true";O&&(O.classList.remove("rte-conditional-hidden"),O.removeAttribute("aria-hidden")),T&&(T.classList.toggle("rte-conditional-hidden",!B),T.setAttribute("aria-hidden",B?"false":"true")),F&&F.classList.toggle("rte-conditional-hidden",!B)});return}const r=await Qe(e,t),l=be(t.currentAudience),d=be(t.currentLocale),E=be(r.audience??r.user?.audience),m=be(r.locale??r.user?.locale),v=l.length>0?l:E,S=d.length>0?d:m;n.forEach($=>{const O=$.getAttribute("data-condition")||"",T=P($.getAttribute("data-audience")).map(s=>s.toLowerCase()),F=P($.getAttribute("data-locale")).map(s=>s.toLowerCase()),B=$.getAttribute("data-has-else")==="true",ge=t.evaluateCondition(O,r),M=Ae(T,v),de=Ae(F,S),R=ge&&M&&de,ie=$.querySelector('.rte-conditional-body[data-slot="if"]'),j=$.querySelector('.rte-conditional-body[data-slot="else"]'),ae=$.querySelector(".rte-conditional-else-label");if($.classList.add("rte-conditional-preview"),oe($,!0),ie&&(ie.classList.toggle("rte-conditional-hidden",!R),ie.setAttribute("aria-hidden",R?"false":"true")),j){const s=B&&!R;j.classList.toggle("rte-conditional-hidden",!s),j.setAttribute("aria-hidden",s?"false":"true")}if(ae){const s=B&&!R;ae.classList.toggle("rte-conditional-hidden",!s)}})}function De(e,t){const o=ce(e);Array.from(o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')).forEach(n=>{n.setAttribute("data-active",t?"true":"false"),n.classList.toggle("active",t),n.setAttribute("aria-pressed",t?"true":"false")})}function et(e){const t=_.get(e);if(t&&t.isConnected)return t;const o=document.createElement("div");return o.className=u,o.setAttribute("role","toolbar"),o.setAttribute("aria-label","Conditional block actions"),o.innerHTML=`
592
592
  <button type="button" class="rte-conditional-float-btn" data-action="edit" title="Edit Condition" aria-label="Edit Condition">
593
593
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 17.3V20h2.7l9.7-9.7-2.7-2.7L4 17.3Zm14.7-9.4a1 1 0 0 0 0-1.4l-1.2-1.2a1 1 0 0 0-1.4 0l-1.1 1.1 2.7 2.7 1-1.2Z" fill="currentColor"></path></svg>
594
594
  </button>
595
595
  <button type="button" class="rte-conditional-float-btn" data-action="delete" title="Delete Block" aria-label="Delete Block">
596
596
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 4h8l1 2h4v2H3V6h4l1-2Zm1 6h2v8H9v-8Zm4 0h2v8h-2v-8Z" fill="currentColor"></path></svg>
597
597
  </button>
598
- `,o.addEventListener("mousedown",i=>{i.preventDefault()}),o.addEventListener("click",i=>{var d;const n=i.target,a=(d=n==null?void 0:n.closest("[data-action]"))==null?void 0:d.getAttribute("data-action");if(!a)return;const r=x.get(e)||ee;if(!r)return;const l=I.get(e);if(!(!l||!e.contains(l))){if(a==="edit"){A(e,r,"edit",void 0,l);return}a==="delete"&&(Oe(e,l),I.set(e,null),F(e))}}),document.body.appendChild(o),j.set(e,o),o}function F(e){const t=j.get(e);t&&t.classList.remove("show")}function Pe(e,t){const o=t.getBoundingClientRect();e.style.left="0px",e.style.top="0px",e.classList.add("show");const i=e.getBoundingClientRect(),n=8,a=window.innerWidth,r=window.innerHeight;let l=o.top-i.height-n;l<n&&(l=o.bottom+n),l=Math.min(l,r-i.height-n);let d=o.right-i.width;d=Math.max(n,Math.min(d,a-i.width-n)),e.style.left=`${d}px`,e.style.top=`${l}px`}function me(e,t){const o=tt(e);he(o,e),I.set(e,t),Pe(o,t)}function R(e){const t=x.get(e)||ee;if(!t)return;const o=W(e);if(!o||!e.contains(o)||H(e)){I.set(e,null),F(e);return}ne(e,t.labels),me(e,o)}function ot(){j.forEach((e,t)=>{if(!t.isConnected||!e.isConnected){e.remove(),j.delete(t),I.delete(t);return}if(!e.classList.contains("show"))return;he(e,t);const o=I.get(t);if(!o||!t.contains(o)){F(t);return}Pe(e,o)})}function Oe(e,t){if(!e.contains(t))return!1;const o=e.innerHTML,i=t.parentNode,n=t.nextSibling;t.remove(),i===e&&e.innerHTML.trim()===""&&(e.innerHTML="<p><br></p>");const a=document.createRange();return n&&e.contains(n)?a.setStartBefore(n):(a.selectNodeContents(e),a.collapse(!1)),a.collapse(!0),xe(e,a),Te(e),Be(e,o),!0}function ke(e,t,o){const i=e.cloneRange(),n=document.createRange();return n.selectNodeContents(t),n.collapse(o==="start"),i.startContainer===n.startContainer&&i.startOffset===n.startOffset&&i.endContainer===n.endContainer&&i.endOffset===n.endOffset}function A(e,t,o,i,n){Me();const a=t.labels,r=o==="insert"?Se(e):null,l=document.createElement("div");l.className=c,he(l,e);const d=document.createElement("section");d.className="rte-conditional-dialog",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.setAttribute("aria-labelledby","rte-conditional-dialog-title");const E=n?Xe(n):void 0,L=i||E||{},p=L.condition??t.defaultCondition,B=L.audience??t.defaultAudience,M=L.locale??t.defaultLocale,le=L.hasElse??t.enableElseByDefault;d.innerHTML=`
598
+ `,o.addEventListener("mousedown",i=>{i.preventDefault()}),o.addEventListener("click",i=>{const a=i.target?.closest("[data-action]")?.getAttribute("data-action");if(!a)return;const r=x.get(e)||ee;if(!r)return;const l=z.get(e);if(!(!l||!e.contains(l))){if(a==="edit"){C(e,r,"edit",void 0,l);return}a==="delete"&&(Pe(e,l),z.set(e,null),I(e))}}),document.body.appendChild(o),_.set(e,o),o}function I(e){const t=_.get(e);t&&t.classList.remove("show")}function He(e,t){const o=t.getBoundingClientRect();e.style.left="0px",e.style.top="0px",e.classList.add("show");const i=e.getBoundingClientRect(),n=8,a=window.innerWidth,r=window.innerHeight;let l=o.top-i.height-n;l<n&&(l=o.bottom+n),l=Math.min(l,r-i.height-n);let d=o.right-i.width;d=Math.max(n,Math.min(d,a-i.width-n)),e.style.left=`${d}px`,e.style.top=`${l}px`}function me(e,t){const o=et(e);he(o,e),z.set(e,t),He(o,t)}function D(e){const t=x.get(e)||ee;if(!t)return;const o=W(e);if(!o||!e.contains(o)||k(e)){z.set(e,null),I(e);return}ne(e,t.labels),me(e,o)}function tt(){_.forEach((e,t)=>{if(!t.isConnected||!e.isConnected){e.remove(),_.delete(t),z.delete(t);return}if(!e.classList.contains("show"))return;he(e,t);const o=z.get(t);if(!o||!t.contains(o)){I(t);return}He(e,o)})}function Pe(e,t){if(!e.contains(t))return!1;const o=e.innerHTML,i=t.parentNode,n=t.nextSibling;t.remove(),i===e&&e.innerHTML.trim()===""&&(e.innerHTML="<p><br></p>");const a=document.createRange();return n&&e.contains(n)?a.setStartBefore(n):(a.selectNodeContents(e),a.collapse(!1)),a.collapse(!0),xe(e,a),Se(e),Te(e,o),!0}function we(e,t,o){const i=e.cloneRange(),n=document.createRange();return n.selectNodeContents(t),n.collapse(o==="start"),i.startContainer===n.startContainer&&i.startOffset===n.startOffset&&i.endContainer===n.endContainer&&i.endOffset===n.endOffset}function C(e,t,o,i,n){Be();const a=t.labels,r=o==="insert"?ke(e):null,l=document.createElement("div");l.className=c,he(l,e);const d=document.createElement("section");d.className="rte-conditional-dialog",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.setAttribute("aria-labelledby","rte-conditional-dialog-title");const E=n?Je(n):void 0,m=i||E||{},v=m.condition??t.defaultCondition,S=m.audience??t.defaultAudience,$=m.locale??t.defaultLocale,O=m.hasElse??t.enableElseByDefault;d.innerHTML=`
599
599
  <header class="rte-conditional-dialog-header">
600
- <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(o==="edit"?a.dialogTitleEdit:a.dialogTitleInsert)}</h2>
601
- <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(a.cancelText)}">✕</button>
600
+ <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${y(o==="edit"?a.dialogTitleEdit:a.dialogTitleInsert)}</h2>
601
+ <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${y(a.cancelText)}">✕</button>
602
602
  </header>
603
603
  <div class="rte-conditional-dialog-body">
604
604
  <div class="rte-conditional-field">
605
- <label for="rte-conditional-condition">${$(a.conditionLabel)}</label>
606
- <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(p||"")}" placeholder="${$(a.conditionPlaceholder)}" />
605
+ <label for="rte-conditional-condition">${y(a.conditionLabel)}</label>
606
+ <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${y(v||"")}" placeholder="${y(a.conditionPlaceholder)}" />
607
607
  </div>
608
608
  <div class="rte-conditional-field">
609
- <label for="rte-conditional-audience">${$(a.audienceLabel)}</label>
610
- <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(Ae(B))}" placeholder="${$(a.audiencePlaceholder)}" />
609
+ <label for="rte-conditional-audience">${y(a.audienceLabel)}</label>
610
+ <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${y(Le(S))}" placeholder="${y(a.audiencePlaceholder)}" />
611
611
  </div>
612
612
  <div class="rte-conditional-field">
613
- <label for="rte-conditional-locale">${$(a.localeLabel)}</label>
614
- <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(Ae(M))}" placeholder="${$(a.localePlaceholder)}" />
613
+ <label for="rte-conditional-locale">${y(a.localeLabel)}</label>
614
+ <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${y(Le($))}" placeholder="${y(a.localePlaceholder)}" />
615
615
  </div>
616
616
  <label class="rte-conditional-checkbox">
617
- <input class="rte-conditional-input-else" type="checkbox" ${le?"checked":""} />
618
- <span>${$(a.elseLabel)}</span>
617
+ <input class="rte-conditional-input-else" type="checkbox" ${O?"checked":""} />
618
+ <span>${y(a.elseLabel)}</span>
619
619
  </label>
620
620
  <p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
621
621
  </div>
622
622
  <footer class="rte-conditional-dialog-footer">
623
- <button type="button" class="rte-conditional-btn" data-action="cancel">${$(a.cancelText)}</button>
624
- <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(a.saveText)}</button>
623
+ <button type="button" class="rte-conditional-btn" data-action="cancel">${y(a.cancelText)}</button>
624
+ <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${y(a.saveText)}</button>
625
625
  </footer>
626
- `,l.appendChild(d),document.body.appendChild(l);const m=d.querySelector(".rte-conditional-input-condition"),N=d.querySelector(".rte-conditional-input-audience"),D=d.querySelector(".rte-conditional-input-locale"),P=d.querySelector(".rte-conditional-input-else"),C=()=>{l.removeEventListener("click",de),l.removeEventListener("keydown",V,!0),document.removeEventListener("keydown",ce,!0),l.parentNode&&l.parentNode.removeChild(l),ae=null,e.focus({preventScroll:!0}),R(e)},ce=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),C())},de=u=>{u.target===l&&C()},ge=u=>{if(u.key!=="Tab")return;const k=Array.from(d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(k.length===0)return;const v=k[0],ie=k[k.length-1],z=document.activeElement;if(u.shiftKey&&z===v){u.preventDefault(),ie.focus();return}!u.shiftKey&&z===ie&&(u.preventDefault(),v.focus())},_=async()=>{var ie;const u={condition:((ie=m==null?void 0:m.value)==null?void 0:ie.trim())||"",audience:K(N==null?void 0:N.value),locale:K(D==null?void 0:D.value),hasElse:(P==null?void 0:P.checked)||!1},k=e.innerHTML;if(n)Qe(n,u,a),oe(n,T.get(e)===!0);else{Ye(e,r);const z=Ne(u,a);try{De(e,z)}catch{e.appendChild(z);const Ce=z.querySelector('.rte-conditional-body[data-slot="if"]');Ce?pe(e,Ce):pe(e,z)}}T.get(e)===!0&&await Z(e,t,!0),Te(e),Be(e,k),R(e),C()},V=u=>{if(u.key==="Escape"){u.preventDefault(),C();return}ge(u),u.key==="Enter"&&!u.shiftKey&&u.target instanceof HTMLInputElement&&(u.preventDefault(),_())};d.addEventListener("click",u=>{const v=u.target.getAttribute("data-action");if(v==="cancel"){C();return}v==="save"&&_()}),l.addEventListener("click",de),l.addEventListener("keydown",V,!0),document.addEventListener("keydown",ce,!0),ae={cleanup:C},m==null||m.focus()}function nt(e){const t=e.metaKey||e.ctrlKey,i=(typeof e.key=="string"?e.key:"").toLowerCase(),n=typeof e.code=="string"?e.code.toLowerCase():"",a=t&&e.altKey&&e.shiftKey&&(i==="c"||n==="keyc"),r=!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(i==="f9"||n==="f9");return a||r}function it(e){const t=e.metaKey||e.ctrlKey,i=(typeof e.key=="string"?e.key:"").toLowerCase(),n=typeof e.code=="string"?e.code.toLowerCase():"",a=t&&e.altKey&&e.shiftKey&&(i==="p"||n==="keyp"),r=!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(i==="f10"||n==="f10");return a||r}function at(e){ee=e,U||(U=t=>{const o=t.target,i=o==null?void 0:o.closest(w);if(!i)return;y=i,x.has(i)||x.set(i,e);const n=x.get(i)||e;ne(i,n.labels),He(i,T.get(i)===!0),R(i)},document.addEventListener("focusin",U,!0)),G||(G=t=>{var L;if(document.querySelector(`.${c}`))return;const i=t.target;if(!!(i!=null&&i.closest("input, textarea, select")))return;const r=(i==null?void 0:i.closest(w))||S(void 0,!1)||y;if(!r||H(r))return;const l=x.get(r)||ee||e,d=document.activeElement,E=(i==null?void 0:i.closest(".rte-conditional-header"))||(d==null?void 0:d.closest(".rte-conditional-header"));if(E&&(t.key==="Enter"||t.key===" ")){const p=E.closest(q);if(p&&r.contains(p)){t.preventDefault(),t.stopPropagation(),A(r,l,"edit",void 0,p);return}}if(nt(t)){t.preventDefault(),t.stopPropagation();const p=W(r);p?A(r,l,"edit",void 0,p):A(r,l,"insert");return}if(it(t)){t.preventDefault(),t.stopPropagation();const p=T.get(r)!==!0;Z(r,l,p),R(r);return}if((t.key==="Backspace"||t.key==="Delete")&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const p=window.getSelection();if(!p||p.rangeCount===0)return;const B=p.getRangeAt(0);if(!B.collapsed||!r.contains(B.commonAncestorContainer))return;const M=(L=We(B.startContainer))==null?void 0:L.closest(".rte-conditional-body");if(!M||!r.contains(M))return;if(t.key==="Backspace"&&ke(B,M,"start")){t.preventDefault();return}if(t.key==="Delete"&&ke(B,M,"end")){t.preventDefault();return}}},document.addEventListener("keydown",G,!0)),J||(J=t=>{const o=t.target;if(!o||o.closest(`.${s}`))return;const i=o.closest(w);if(!i){y&&F(y);return}if(H(i))return;y=i,x.has(i)||x.set(i,e);const n=o.closest(q);if(!n){F(i);return}requestAnimationFrame(()=>{!i.isConnected||!i.contains(n)||me(i,n)})},document.addEventListener("mousedown",J,!0)),Y||(Y=t=>{const o=t.target;if(!o||o.closest(`.${s}`))return;const i=o.closest(w);if(!i){y&&F(y);return}if(H(i))return;y=i,x.has(i)||x.set(i,e);const n=x.get(i)||e,a=o.closest(q),r=!!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");if(a&&r){t.preventDefault(),t.stopPropagation(),A(i,n,"edit",void 0,a),me(i,a);return}a?me(i,a):F(i)},document.addEventListener("click",Y,!0)),X||(X=()=>{const t=S(void 0,!1)||y;t&&t.isConnected&&R(t)},document.addEventListener("selectionchange",X)),Q||(Q=t=>{const o=t.target,i=o==null?void 0:o.closest(w);if(!i)return;const n=x.get(i)||ee||e;ne(i,n.labels),R(i)},document.addEventListener("input",Q,!0)),O||(O=()=>{ot()},window.addEventListener("scroll",O,!0),window.addEventListener("resize",O))}function rt(){U&&(document.removeEventListener("focusin",U,!0),U=null),G&&(document.removeEventListener("keydown",G,!0),G=null),Y&&(document.removeEventListener("click",Y,!0),Y=null),J&&(document.removeEventListener("mousedown",J,!0),J=null),X&&(document.removeEventListener("selectionchange",X),X=null),Q&&(document.removeEventListener("input",Q,!0),Q=null),O&&(window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O),O=null),j.forEach(e=>{e.remove()}),j.clear(),I.clear(),ee=null,y=null}const lt=(e={})=>{const t=Ve(e);return Ie(),{name:"conditionalContent",toolbar:[{id:"conditionalContentGroup",label:"Conditional Content",type:"group",command:"conditionalContent",items:[{id:"conditionalContent",label:"Conditional Rule",command:"openConditionalDialog",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12a1 1 0 0 1 1 1v3h-2V7H7v3H5V6a1 1 0 0 1 1-1Zm-1 9h2v3h10v-3h2v4a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-4Zm3-2a1 1 0 0 1 1-1h2.6l1.8-2.4a1 1 0 1 1 1.6 1.2L13.8 11H15a1 1 0 1 1 0 2h-2.7l-1.9 2.5a1 1 0 1 1-1.6-1.2L10.1 13H9a1 1 0 0 1-1-1Z" fill="currentColor"></path></svg>',shortcut:"Mod-Alt-Shift-c"},{id:"conditionalPreview",label:"Conditional Preview",command:"toggleConditionalPreview",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 6h16a1 1 0 0 1 1 1v3h-2V8H5v8h14v-2h2v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm5 3h2v2H9V9Zm0 4h2v2H9v-2Zm4-4h6v2h-6V9Zm0 4h6v2h-6v-2Z" fill="currentColor"></path></svg>',shortcut:"Mod-Alt-Shift-p"}]}],commands:{conditionalContent:(o,i)=>{const n=S(i);if(!n||H(n))return!1;y=n,x.set(n,t),ne(n,t.labels);const a=o==null?void 0:o.target;if(a==="insert")return A(n,t,"insert",o),!0;const r=W(n);return a==="edit"||r?!r&&a==="edit"?!1:(A(n,t,"edit",o,r||void 0),!0):(A(n,t,"insert",o),!0)},openConditionalDialog:(o,i)=>{const n=S(i);if(!n||H(n))return!1;y=n,x.set(n,t),ne(n,t.labels);const a=o==null?void 0:o.target;if(a==="insert")return A(n,t,"insert",o),!0;const r=W(n);return a==="edit"||r?!r&&a==="edit"?!1:(A(n,t,"edit",o,r||void 0),!0):(A(n,t,"insert",o),!0)},conditionalPreview:async(o,i)=>{const n=S(i);if(!n)return!1;y=n,x.set(n,t);const a=typeof o=="boolean"?o:T.get(n)!==!0;return await Z(n,t,a),R(n),!0},editConditionalBlock:(o,i)=>{const n=S(i);if(!n||H(n))return!1;y=n,x.set(n,t);const a=W(n);return a?(A(n,t,"edit",o,a),!0):!1},deleteConditionalBlock:(o,i)=>{const n=S(i);if(!n||H(n))return!1;const a=W(n);if(!a)return!1;const r=Oe(n,a);return r&&R(n),r},insertConditionalBlock:(o,i)=>{const n=S(i);if(!n||H(n))return!1;y=n,x.set(n,t);const a={condition:(o==null?void 0:o.condition)??t.defaultCondition,audience:(o==null?void 0:o.audience)??t.defaultAudience,locale:(o==null?void 0:o.locale)??t.defaultLocale,hasElse:(o==null?void 0:o.hasElse)??t.enableElseByDefault},r=Ne(a,t.labels);return De(n,r),T.get(n)===!0&&Z(n,t,!0),!0},toggleConditionalPreview:async(o,i)=>{const n=S(i);if(!n)return!1;y=n,x.set(n,t);const a=typeof o=="boolean"?o:T.get(n)!==!0;return await Z(n,t,a),!0},setConditionalContext:(o,i)=>{const n=S(i);return n?(y=n,!o||typeof o!="object"?$e.delete(n):$e.set(n,o),T.get(n)===!0&&Z(n,t,!0),!0):!1}},keymap:{"Mod-Alt-Shift-c":"openConditionalDialog","Mod-Alt-Shift-C":"openConditionalDialog","Mod-Alt-Shift-p":"toggleConditionalPreview","Mod-Alt-Shift-P":"toggleConditionalPreview",F9:"openConditionalDialog",F10:"toggleConditionalPreview"},init:()=>{se+=1,at(t)},destroy:()=>{se=Math.max(0,se-1),se===0&&(Me(),rt())}}};exports.ConditionalContentPlugin=lt;
626
+ `,l.appendChild(d),document.body.appendChild(l);const T=d.querySelector(".rte-conditional-input-condition"),F=d.querySelector(".rte-conditional-input-audience"),B=d.querySelector(".rte-conditional-input-locale"),ge=d.querySelector(".rte-conditional-input-else"),M=()=>{l.removeEventListener("click",R),l.removeEventListener("keydown",ae,!0),document.removeEventListener("keydown",de,!0),l.parentNode&&l.parentNode.removeChild(l),le=null,e.focus({preventScroll:!0}),D(e)},de=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),M())},R=s=>{s.target===l&&M()},ie=s=>{if(s.key!=="Tab")return;const q=Array.from(d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(q.length===0)return;const V=q[0],K=q[q.length-1],re=document.activeElement;if(s.shiftKey&&re===V){s.preventDefault(),K.focus();return}!s.shiftKey&&re===K&&(s.preventDefault(),V.focus())},j=async()=>{const s={condition:T?.value?.trim()||"",audience:P(F?.value),locale:P(B?.value),hasElse:ge?.checked||!1},q=e.innerHTML;if(n)Xe(n,s,a),oe(n,w.get(e)===!0);else{Ue(e,r);const K=Me(s,a);try{Ne(e,K)}catch{e.appendChild(K);const re=K.querySelector('.rte-conditional-body[data-slot="if"]');re?pe(e,re):pe(e,K)}}w.get(e)===!0&&await Z(e,t,!0),Se(e),Te(e,q),D(e),M()},ae=s=>{if(s.key==="Escape"){s.preventDefault(),M();return}ie(s),s.key==="Enter"&&!s.shiftKey&&s.target instanceof HTMLInputElement&&(s.preventDefault(),j())};d.addEventListener("click",s=>{const V=s.target.getAttribute("data-action");if(V==="cancel"){M();return}V==="save"&&j()}),l.addEventListener("click",R),l.addEventListener("keydown",ae,!0),document.addEventListener("keydown",de,!0),le={cleanup:M},T?.focus()}function ot(e){const t=e.metaKey||e.ctrlKey,i=(typeof e.key=="string"?e.key:"").toLowerCase(),n=typeof e.code=="string"?e.code.toLowerCase():"",a=t&&e.altKey&&e.shiftKey&&(i==="c"||n==="keyc"),r=!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(i==="f9"||n==="f9");return a||r}function nt(e){const t=e.metaKey||e.ctrlKey,i=(typeof e.key=="string"?e.key:"").toLowerCase(),n=typeof e.code=="string"?e.code.toLowerCase():"",a=t&&e.altKey&&e.shiftKey&&(i==="p"||n==="keyp"),r=!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(i==="f10"||n==="f10");return a||r}function it(e){ee=e,U||(U=t=>{const i=t.target?.closest(L);if(!i)return;g=i,x.has(i)||x.set(i,e);const n=x.get(i)||e;ne(i,n.labels),De(i,w.get(i)===!0),D(i)},document.addEventListener("focusin",U,!0)),G||(G=t=>{if(document.querySelector(`.${c}`))return;const i=t.target;if(!!i?.closest("input, textarea, select"))return;const r=i?.closest(L)||A(void 0,!1)||g;if(!r||k(r))return;const l=x.get(r)||ee||e,d=document.activeElement,E=i?.closest(".rte-conditional-header")||d?.closest(".rte-conditional-header");if(E&&(t.key==="Enter"||t.key===" ")){const m=E.closest(H);if(m&&r.contains(m)){t.preventDefault(),t.stopPropagation(),C(r,l,"edit",void 0,m);return}}if(ot(t)){t.preventDefault(),t.stopPropagation();const m=W(r);m?C(r,l,"edit",void 0,m):C(r,l,"insert");return}if(nt(t)){t.preventDefault(),t.stopPropagation();const m=w.get(r)!==!0;Z(r,l,m),D(r);return}if((t.key==="Backspace"||t.key==="Delete")&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const m=window.getSelection();if(!m||m.rangeCount===0)return;const v=m.getRangeAt(0);if(!v.collapsed||!r.contains(v.commonAncestorContainer))return;const S=Ve(v.startContainer)?.closest(".rte-conditional-body");if(!S||!r.contains(S))return;if(t.key==="Backspace"&&we(v,S,"start")){t.preventDefault();return}if(t.key==="Delete"&&we(v,S,"end")){t.preventDefault();return}}},document.addEventListener("keydown",G,!0)),J||(J=t=>{const o=t.target;if(!o||o.closest(`.${u}`))return;const i=o.closest(L);if(!i){g&&I(g);return}if(k(i))return;g=i,x.has(i)||x.set(i,e);const n=o.closest(H);if(!n){I(i);return}requestAnimationFrame(()=>{!i.isConnected||!i.contains(n)||me(i,n)})},document.addEventListener("mousedown",J,!0)),Y||(Y=t=>{const o=t.target;if(!o||o.closest(`.${u}`))return;const i=o.closest(L);if(!i){g&&I(g);return}if(k(i))return;g=i,x.has(i)||x.set(i,e);const n=x.get(i)||e,a=o.closest(H),r=!!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");if(a&&r){t.preventDefault(),t.stopPropagation(),C(i,n,"edit",void 0,a),me(i,a);return}a?me(i,a):I(i)},document.addEventListener("click",Y,!0)),X||(X=()=>{const t=A(void 0,!1)||g;t&&t.isConnected&&D(t)},document.addEventListener("selectionchange",X)),Q||(Q=t=>{const i=t.target?.closest(L);if(!i)return;const n=x.get(i)||ee||e;ne(i,n.labels),D(i)},document.addEventListener("input",Q,!0)),N||(N=()=>{tt()},window.addEventListener("scroll",N,!0),window.addEventListener("resize",N))}function at(){U&&(document.removeEventListener("focusin",U,!0),U=null),G&&(document.removeEventListener("keydown",G,!0),G=null),Y&&(document.removeEventListener("click",Y,!0),Y=null),J&&(document.removeEventListener("mousedown",J,!0),J=null),X&&(document.removeEventListener("selectionchange",X),X=null),Q&&(document.removeEventListener("input",Q,!0),Q=null),N&&(window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N),N=null),_.forEach(e=>{e.remove()}),_.clear(),z.clear(),ee=null,g=null}const rt=(e={})=>{const t=je(e);return Fe(),{name:"conditionalContent",toolbar:[{id:"conditionalContentGroup",label:"Conditional Content",type:"group",command:"conditionalContent",items:[{id:"conditionalContent",label:"Conditional Rule",command:"openConditionalDialog",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12a1 1 0 0 1 1 1v3h-2V7H7v3H5V6a1 1 0 0 1 1-1Zm-1 9h2v3h10v-3h2v4a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-4Zm3-2a1 1 0 0 1 1-1h2.6l1.8-2.4a1 1 0 1 1 1.6 1.2L13.8 11H15a1 1 0 1 1 0 2h-2.7l-1.9 2.5a1 1 0 1 1-1.6-1.2L10.1 13H9a1 1 0 0 1-1-1Z" fill="currentColor"></path></svg>',shortcut:"Mod-Alt-Shift-c"},{id:"conditionalPreview",label:"Conditional Preview",command:"toggleConditionalPreview",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 6h16a1 1 0 0 1 1 1v3h-2V8H5v8h14v-2h2v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm5 3h2v2H9V9Zm0 4h2v2H9v-2Zm4-4h6v2h-6V9Zm0 4h6v2h-6v-2Z" fill="currentColor"></path></svg>',shortcut:"Mod-Alt-Shift-p"}]}],commands:{conditionalContent:(o,i)=>{const n=A(i);if(!n||k(n))return!1;g=n,x.set(n,t),ne(n,t.labels);const a=o?.target;if(a==="insert")return C(n,t,"insert",o),!0;const r=W(n);return a==="edit"||r?!r&&a==="edit"?!1:(C(n,t,"edit",o,r||void 0),!0):(C(n,t,"insert",o),!0)},openConditionalDialog:(o,i)=>{const n=A(i);if(!n||k(n))return!1;g=n,x.set(n,t),ne(n,t.labels);const a=o?.target;if(a==="insert")return C(n,t,"insert",o),!0;const r=W(n);return a==="edit"||r?!r&&a==="edit"?!1:(C(n,t,"edit",o,r||void 0),!0):(C(n,t,"insert",o),!0)},conditionalPreview:async(o,i)=>{const n=A(i);if(!n)return!1;g=n,x.set(n,t);const a=typeof o=="boolean"?o:w.get(n)!==!0;return await Z(n,t,a),D(n),!0},editConditionalBlock:(o,i)=>{const n=A(i);if(!n||k(n))return!1;g=n,x.set(n,t);const a=W(n);return a?(C(n,t,"edit",o,a),!0):!1},deleteConditionalBlock:(o,i)=>{const n=A(i);if(!n||k(n))return!1;const a=W(n);if(!a)return!1;const r=Pe(n,a);return r&&D(n),r},insertConditionalBlock:(o,i)=>{const n=A(i);if(!n||k(n))return!1;g=n,x.set(n,t);const a={condition:o?.condition??t.defaultCondition,audience:o?.audience??t.defaultAudience,locale:o?.locale??t.defaultLocale,hasElse:o?.hasElse??t.enableElseByDefault},r=Me(a,t.labels);return Ne(n,r),w.get(n)===!0&&Z(n,t,!0),!0},toggleConditionalPreview:async(o,i)=>{const n=A(i);if(!n)return!1;g=n,x.set(n,t);const a=typeof o=="boolean"?o:w.get(n)!==!0;return await Z(n,t,a),!0},setConditionalContext:(o,i)=>{const n=A(i);return n?(g=n,!o||typeof o!="object"?$e.delete(n):$e.set(n,o),w.get(n)===!0&&Z(n,t,!0),!0):!1}},keymap:{"Mod-Alt-Shift-c":"openConditionalDialog","Mod-Alt-Shift-C":"openConditionalDialog","Mod-Alt-Shift-p":"toggleConditionalPreview","Mod-Alt-Shift-P":"toggleConditionalPreview",F9:"openConditionalDialog",F10:"toggleConditionalPreview"},init:()=>{se+=1,it(t)},destroy:()=>{se=Math.max(0,se-1),se===0&&(Be(),at())}}};exports.ConditionalContentPlugin=rt;