@vonage/vivid 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/accordion-item/definition.cjs +1 -1
  2. package/accordion-item/definition.js +1 -1
  3. package/avatar/definition.cjs +1 -1
  4. package/avatar/definition.js +1 -1
  5. package/avatar/index.cjs +1 -1
  6. package/avatar/index.js +4 -4
  7. package/breadcrumb-item/definition.cjs +1 -1
  8. package/breadcrumb-item/definition.js +1 -1
  9. package/breadcrumb-item/index.cjs +4 -4
  10. package/breadcrumb-item/index.js +4 -4
  11. package/bundled/calendar-picker.template.cjs +1 -1
  12. package/bundled/calendar-picker.template.js +1 -1
  13. package/bundled/definition.cjs +1 -1
  14. package/bundled/definition.js +21 -21
  15. package/bundled/definition12.cjs +3 -3
  16. package/bundled/definition12.js +1 -1
  17. package/bundled/definition13.cjs +1 -1
  18. package/bundled/definition13.js +1 -1
  19. package/bundled/definition18.cjs +1 -1
  20. package/bundled/definition18.js +5 -5
  21. package/bundled/definition19.cjs +3 -4
  22. package/bundled/definition19.js +72 -89
  23. package/bundled/definition20.cjs +1 -1
  24. package/bundled/definition20.js +4 -4
  25. package/bundled/definition22.cjs +1 -1
  26. package/bundled/definition22.js +1 -1
  27. package/bundled/definition3.cjs +2 -2
  28. package/bundled/definition3.js +1 -1
  29. package/bundled/definition5.cjs +1 -1
  30. package/bundled/definition5.js +1 -1
  31. package/bundled/definition6.cjs +2 -2
  32. package/bundled/definition6.js +1 -1
  33. package/bundled/definition7.cjs +1 -1
  34. package/bundled/definition7.js +1 -1
  35. package/bundled/definition8.cjs +1 -1
  36. package/bundled/definition8.js +5 -5
  37. package/bundled/listbox.cjs +1 -1
  38. package/bundled/listbox.js +49 -22
  39. package/bundled/localized.cjs +1 -1
  40. package/bundled/localized.js +8 -9
  41. package/bundled/text-field.cjs +1 -1
  42. package/bundled/text-field.js +1 -1
  43. package/bundled/time-selection-picker.template.cjs +11 -11
  44. package/bundled/time-selection-picker.template.js +1 -1
  45. package/bundled/vivid-element.cjs +1 -1
  46. package/bundled/vivid-element.js +1 -1
  47. package/calendar-event/definition.cjs +1 -1
  48. package/calendar-event/definition.js +1 -1
  49. package/calendar-event/index.cjs +2 -2
  50. package/calendar-event/index.js +5 -5
  51. package/card/definition.cjs +1 -1
  52. package/card/definition.js +1 -1
  53. package/card/index.cjs +1 -1
  54. package/card/index.js +1 -1
  55. package/checkbox/definition.cjs +1 -1
  56. package/checkbox/definition.js +1 -1
  57. package/color-picker/definition.cjs +1 -1
  58. package/color-picker/definition.js +1 -1
  59. package/color-picker/index.cjs +1 -1
  60. package/color-picker/index.js +1 -1
  61. package/combobox/definition.cjs +1 -1
  62. package/combobox/definition.js +1 -1
  63. package/combobox/index.cjs +2 -2
  64. package/combobox/index.js +30 -30
  65. package/contextual-help/definition.cjs +2 -1
  66. package/contextual-help/definition.js +2 -2
  67. package/custom-elements.json +217 -251
  68. package/data-grid/definition.cjs +1 -1
  69. package/data-grid/definition.js +1 -1
  70. package/data-grid/index.cjs +1 -1
  71. package/data-grid/index.js +1 -1
  72. package/dial-pad/definition.cjs +1 -1
  73. package/dial-pad/definition.js +1 -1
  74. package/dial-pad/index.cjs +1 -1
  75. package/dial-pad/index.js +1 -1
  76. package/dialog/definition.cjs +1 -1
  77. package/dialog/definition.js +1 -1
  78. package/dialog/index.cjs +1 -1
  79. package/dialog/index.js +1 -1
  80. package/fab/definition.cjs +1 -1
  81. package/fab/definition.js +1 -1
  82. package/fab/index.cjs +1 -1
  83. package/fab/index.js +5 -5
  84. package/file-picker/definition.cjs +1 -1
  85. package/file-picker/definition.js +1 -1
  86. package/file-picker/index.cjs +1 -1
  87. package/file-picker/index.js +1 -1
  88. package/index.cjs +4 -0
  89. package/index.js +1 -0
  90. package/lib/components.d.ts +1 -0
  91. package/lib/contextual-help/definition.d.ts +2 -0
  92. package/lib/rich-text-editor/locale.d.ts +0 -1
  93. package/lib/tag-name-map.d.ts +2 -1
  94. package/locales/de-DE.cjs +0 -1
  95. package/locales/de-DE.js +0 -1
  96. package/locales/en-GB.cjs +0 -1
  97. package/locales/en-GB.js +0 -1
  98. package/locales/en-US.cjs +0 -1
  99. package/locales/en-US.js +0 -1
  100. package/locales/ja-JP.cjs +0 -1
  101. package/locales/ja-JP.js +0 -1
  102. package/locales/zh-CN.cjs +0 -1
  103. package/locales/zh-CN.js +0 -1
  104. package/menu/definition.cjs +1 -1
  105. package/menu/definition.js +1 -1
  106. package/nav-disclosure/definition.cjs +1 -1
  107. package/nav-disclosure/definition.js +1 -1
  108. package/nav-disclosure/index.cjs +1 -1
  109. package/nav-disclosure/index.js +1 -1
  110. package/nav-item/definition.cjs +1 -1
  111. package/nav-item/definition.js +1 -1
  112. package/nav-item/index.cjs +1 -1
  113. package/nav-item/index.js +5 -5
  114. package/number-field/definition.cjs +1 -1
  115. package/number-field/definition.js +1 -1
  116. package/number-field/index.cjs +1 -1
  117. package/number-field/index.js +4 -4
  118. package/package.json +4 -8
  119. package/radio/definition.cjs +1 -1
  120. package/radio/definition.js +1 -1
  121. package/range-slider/definition.cjs +1 -1
  122. package/range-slider/definition.js +1 -1
  123. package/range-slider/index.cjs +1 -1
  124. package/range-slider/index.js +1 -1
  125. package/rich-text-editor/definition.cjs +2 -2
  126. package/rich-text-editor/definition.js +2 -2
  127. package/rich-text-editor/index.cjs +2 -2
  128. package/rich-text-editor/index.js +2 -2
  129. package/searchable-select/definition.cjs +2 -2
  130. package/searchable-select/definition.js +2 -2
  131. package/searchable-select/index.cjs +5 -5
  132. package/searchable-select/index.js +1 -1
  133. package/select/definition.cjs +28 -16
  134. package/select/definition.js +28 -16
  135. package/selectable-box/definition.cjs +1 -1
  136. package/selectable-box/definition.js +1 -1
  137. package/selectable-box/index.cjs +3 -3
  138. package/selectable-box/index.js +1 -1
  139. package/shared/foundation/listbox/listbox.d.ts +0 -1
  140. package/simple-color-picker/definition.cjs +1 -1
  141. package/simple-color-picker/definition.js +1 -1
  142. package/simple-color-picker/index.cjs +3 -3
  143. package/simple-color-picker/index.js +1 -1
  144. package/slider/definition.cjs +1 -1
  145. package/slider/definition.js +1 -1
  146. package/split-button/definition.cjs +1 -1
  147. package/split-button/definition.js +1 -1
  148. package/split-button/index.cjs +1 -1
  149. package/split-button/index.js +1 -1
  150. package/styles/core/all.css +2 -2
  151. package/styles/core/theme.css +2 -2
  152. package/styles/core/typography.css +1 -1
  153. package/styles/tokens/theme-dark.css +4 -4
  154. package/styles/tokens/theme-light.css +4 -4
  155. package/styles/tokens/vivid-2-compat.css +1 -1
  156. package/switch/definition.cjs +1 -1
  157. package/switch/definition.js +1 -1
  158. package/switch/index.cjs +2 -2
  159. package/switch/index.js +10 -10
  160. package/tab/definition.cjs +1 -1
  161. package/tab/definition.js +1 -1
  162. package/tag/definition.cjs +1 -1
  163. package/tag/definition.js +1 -1
  164. package/tag/index.cjs +1 -1
  165. package/tag/index.js +1 -1
  166. package/text-area/definition.cjs +1 -1
  167. package/text-area/definition.js +1 -1
  168. package/text-area/index.cjs +1 -1
  169. package/text-area/index.js +1 -1
  170. package/unbundled/calendar-picker.template.cjs +1 -1
  171. package/unbundled/calendar-picker.template.js +1 -1
  172. package/unbundled/definition.cjs +1 -1
  173. package/unbundled/definition.js +1 -1
  174. package/unbundled/definition2.cjs +1 -1
  175. package/unbundled/definition2.js +1 -1
  176. package/unbundled/definition3.cjs +1 -1
  177. package/unbundled/definition3.js +1 -1
  178. package/unbundled/definition4.cjs +1 -1
  179. package/unbundled/definition4.js +1 -1
  180. package/unbundled/listbox.cjs +29 -2
  181. package/unbundled/listbox.js +29 -2
  182. package/unbundled/text-field.cjs +1 -1
  183. package/unbundled/text-field.js +1 -1
  184. package/unbundled/time-selection-picker.template.cjs +1 -1
  185. package/unbundled/time-selection-picker.template.js +1 -1
  186. package/unbundled/vivid-element.cjs +1 -1
  187. package/unbundled/vivid-element.js +1 -1
  188. package/video-player/definition.cjs +1 -1
  189. package/video-player/definition.js +1 -1
  190. package/video-player/index.cjs +1 -1
  191. package/video-player/index.js +1 -1
  192. package/vivid.api.json +104 -0
@@ -7,7 +7,7 @@
7
7
 
8
8
  `);return{dom:a,text:f,slice:e}}function vl(r,e,t,n,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(n||s||!t);if(a){if(r.someProp("transformPastedText",f=>{e=f(e,s||n,r)}),s)return l=new S(b.from(r.state.schema.text(e.replace(/\r\n?/g,`
9
9
  `))),0,0),r.someProp("transformPasted",f=>{l=f(l,r,!0)}),l;let u=r.someProp("clipboardTextParser",f=>f(e,i,n,r));if(u)l=u;else{let f=i.marks(),{schema:p}=r.state,d=kt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(d.serializeNode(p.text(g,f)))})}}else r.someProp("transformPastedHTML",u=>{t=u(t,r)}),o=Fh(t),gn&&Lh(o);let c=o&&o.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let u=+h[3];u>0;u--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(r.someProp("clipboardParser")||r.someProp("domParser")||Lt.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||h),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ih.test(f.parentNode.nodeName)?{ignore:!0}:null}})),h)l=zh(js(l,+h[1],+h[2]),h[4]);else if(l=S.maxOpen(Rh(l.content,i),!0),l.openStart||l.openEnd){let u=0,f=0;for(let p=l.content.firstChild;u<l.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=js(l,u,f)}return r.someProp("transformPasted",u=>{l=u(l,r,a)}),l}const Ih=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Rh(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Rl(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Pl(o[o.length-1],s.length));let h=Il(l,a);o.push(h),i=i.matchType(h.type),s=a}}),o)return b.from(o)}return r}function Il(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,b.from(r));return r}function Rl(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=Rl(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(b.from(Il(t,r,i+1))))}}function Pl(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Pl(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(b.empty,!0);return r.copy(t.append(n))}function li(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,l=o.content;return r.childCount>1&&(s=0),i<n-1&&(l=li(l,e,t,n,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(l))}function js(r,e,t){return e<r.openStart&&(r=new S(li(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new S(li(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Fl={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ys=null;function Ll(){return Ys||(Ys=document.implementation.createHTMLDocument("title"))}let Ar=null;function Ph(r){let e=window.trustedTypes;return e?(Ar||(Ar=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ar.createHTML(r)):r}function Fh(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Ll().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Fl[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Ph(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Lh(r){let e=r.querySelectorAll(re?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function zh(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let l=n.length-2;l>=0;l-=2){let a=t.nodes[n[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(n[l+1],i)),s++,o++}return new S(i,s,o)}const ue={},fe={},Bh={touchstart:!0,touchmove:!0};class _h{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Vh(r){for(let e in ue){let t=ue[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Wh(r,n)&&!Oi(r,n)&&(r.editable||!(n.type in fe))&&t(r,n)},Bh[e]?{passive:!0}:void 0)}he&&r.dom.addEventListener("input",()=>null),ai(r)}function Qe(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Hh(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function ai(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>Oi(r,n))})}function Oi(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Wh(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Uh(r,e){!Oi(r,e)&&ue[e.type]&&(r.editable||!(e.type in fe))&&ue[e.type](r,e)}fe.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Bl(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(Ue&&re&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),_t&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,lt(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||vh(r,t)?t.preventDefault():Qe(r,"key")};fe.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};fe.keypress=(r,e)=>{let t=e;if(Bl(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||ke&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof O)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function nr(r){return{left:r.clientX,top:r.clientY}}function qh(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Ei(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,l=>o>s.depth?l(r,t,s.nodeAfter,s.before(o),i,!0):l(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Pt(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function Jh(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&w.isSelectable(n)?(Pt(r,new w(t)),!0):!1}function $h(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof w&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(w.isSelectable(l)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Pt(r,w.create(r.state.doc,i)),!0):!1}function Kh(r,e,t,n,i){return Ei(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?$h(r,t):Jh(r,t))}function Gh(r,e,t,n){return Ei(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function jh(r,e,t,n){return Ei(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||Yh(r,t,n)}function Yh(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Pt(r,O.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Pt(r,O.create(n,l+1,l+1+o.content.size));else if(w.isSelectable(o))Pt(r,w.create(n,l));else continue;return!0}}function Ni(r){return $n(r)}const zl=ke?"metaKey":"ctrlKey";ue.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Ni(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&qh(t,r.input.lastClick)&&!t[zl]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(nr(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new Xh(r,o,t,!!n)):(s=="doubleClick"?Gh:jh)(r,o.pos,o.inside,t)?t.preventDefault():Qe(r,"pointer"))};class Xh{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[zl],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let h=e.state.doc.resolve(t.pos);s=h.parent,o=h.depth?h.before():0}const l=i?null:n.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof w&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Te&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Qe(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>qe(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nr(e))),this.updateAllowDefault(e),this.allowDefault||!t?Qe(this.view,"pointer"):Kh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||he&&this.mightDrag&&!this.mightDrag.node.isAtom||re&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Pt(this.view,N.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Qe(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qe(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ue.touchstart=r=>{r.input.lastTouch=Date.now(),Ni(r),Qe(r,"pointer")};ue.touchmove=r=>{r.input.lastTouch=Date.now(),Qe(r,"pointer")};ue.contextmenu=r=>Ni(r);function Bl(r,e){return r.composing?!0:he&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const Zh=Ue?5e3:-1;fe.compositionstart=fe.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof O&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),$n(r,!0),r.markCursor=null;else if($n(r,!e.selection.empty),Te&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=r.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}_l(r,Zh)};fe.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,_l(r,20))};function _l(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>$n(r),e))}function Vl(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=eu());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function Qh(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Jc(e.focusNode,e.focusOffset),n=$c(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function eu(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function $n(r,e=!1){if(!(Ue&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Vl(r),e||r.docView&&r.docView.dirty){let t=Ci(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function tu(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const fn=ye&&et<15||_t&&Xc<604;ue.copy=fe.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=fn?null:t.clipboardData,o=n.content(),{dom:l,text:a}=Mi(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):tu(r,l),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nu(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function ru(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?dn(r,n.value,null,i,e):dn(r,n.textContent,n.innerHTML,i,e)},50)}function dn(r,e,t,n,i){let s=vl(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",a=>a(r,i,s||S.empty)))return!0;if(!s)return!1;let o=nu(s),l=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hl(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}fe.paste=(r,e)=>{let t=e;if(r.composing&&!Ue)return;let n=fn?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&dn(r,Hl(n),n.getData("text/html"),i,t)?t.preventDefault():ru(r,t)};class Wl{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const iu=ke?"altKey":"ctrlKey";function Ul(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[iu]}ue.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(nr(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof w?i.to-1:i.to))){if(n&&n.mightDrag)o=w.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=r.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=r.docView&&(o=w.create(r.state.doc,u.posBefore))}}let l=(o||r.state.selection).content(),{dom:a,text:c,slice:h}=Mi(r,l);(!t.dataTransfer.files.length||!re||ml>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(fn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",fn||t.dataTransfer.setData("text/plain",c),r.dragging=new Wl(h,Ul(r,t),o)};ue.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};fe.dragover=fe.dragenter=(r,e)=>e.preventDefault();fe.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(nr(t));if(!i)return;let s=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",d=>{o=d(o,r,!1)}):o=vl(r,Hl(t.dataTransfer),fn?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(n&&Ul(r,t));if(r.someProp("handleDrop",d=>d(r,t,o||S.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?ki(r.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=r.state.tr;if(l){let{node:d}=n;d?d.replace(c):c.deleteSelection()}let h=c.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(h,h,o.content.firstChild):c.replaceRange(h,h,o),c.doc.eq(f))return;let p=c.doc.resolve(h);if(u&&w.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new w(p));else{let d=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,y,C,L)=>d=L),c.setSelection(wi(r,p,c.doc.resolve(d)))}r.focus(),r.dispatch(c.setMeta("uiEvent","drop"))};ue.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&qe(r)},20))};ue.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};ue.beforeinput=(r,e)=>{if(re&&Ue&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,lt(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in fe)ue[r]=fe[r];function pn(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Kn{constructor(e,t){this.toDOM=e,this.spec=t||ft,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new ie(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Kn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class nt{constructor(e,t){this.attrs=e,this.spec=t||ft}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new ie(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof nt&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}static is(e){return e.type instanceof nt}destroy(){}}class Di{constructor(e,t){this.attrs=e,this.spec=t||ft}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ie(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Di&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}destroy(){}}class ie{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new ie(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new ie(e,e,new Kn(t,n))}static inline(e,t,n,i){return new ie(e,t,new nt(n,i))}static node(e,t,n,i){return new ie(e,t,new Di(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof nt}get widget(){return this.type instanceof Kn}}const vt=[],ft={};class P{constructor(e,t){this.local=e.length?e:vt,this.children=t.length?t:vt}static create(e,t){return t.length?Gn(t,e,0,ft):te}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&n.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,n,i+l,s)}}map(e,t,n){return this==te||e.maps.length==0?this:this.mapInner(e,t,0,0,n||ft)}mapInner(e,t,n,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,n,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?su(this.children,o||[],e,t,n,i,s):o?new P(o.sort(dt),vt):te}add(e,t){return t.length?this==te?P.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((l,a)=>{let c=a+n,h;if(h=Jl(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,h,c+1):i.splice(s,0,a,a+l.nodeSize,Gn(h,l,c+1,ft)),s+=3}});let o=ql(s?$l(t):t,-n);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new P(o.length?this.local.concat(o).sort(dt):this.local,i||this.children)}remove(e){return e.length==0||this==te?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,l=n[s]+t,a=n[s+1]+t;for(let h=0,u;h<e.length;h++)(u=e[h])&&u.from>l&&u.to<a&&(e[h]=null,(o||(o=[])).push(u));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,l+1);c!=te?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new P(i,n):te}forChild(e,t){if(this==te)return this;if(t.isLeaf)return P.empty;let n,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(n=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof nt){let c=Math.max(s,a.from)-s,h=Math.min(o,a.to)-s;c<h&&(i||(i=[])).push(a.copy(c,h))}}if(i){let l=new P(i.sort(dt),vt);return n?new Ye([l,n]):l}return n||te}eq(e){if(this==e)return!0;if(!(e instanceof P)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ai(this.localsInner(e))}localsInner(e){if(this==te)return vt;if(e.inlineContent||!this.local.some(nt.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof nt||t.push(this.local[n]);return t}forEachSet(e){e(this)}}P.empty=new P([],[]);P.removeOverlap=Ai;const te=P.empty;class Ye{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,ft));return Ye.from(n)}forChild(e,t){if(t.isLeaf)return P.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=te&&(s instanceof Ye?n=n.concat(s.members):n.push(s))}return Ye.from(n)}eq(e){if(!(e instanceof Ye)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Ai(n?t:t.sort(dt)):vt}static from(e){switch(e.length){case 0:return te;case 1:return e[0];default:return new Ye(e.every(t=>t instanceof P)?e:e.reduce((t,n)=>t.concat(n instanceof P?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function su(r,e,t,n,i,s,o){let l=r.slice();for(let c=0,h=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((f,p,d,g)=>{let y=g-d-(p-f);for(let C=0;C<l.length;C+=3){let L=l[C+1];if(L<0||f>L+h-u)continue;let I=l[C]+h-u;p>=I?l[C+1]=f<=I?-2:-1:f>=h&&y&&(l[C]+=y,l[C+1]+=y)}u+=y}),h=t.maps[c].map(h,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let h=t.map(r[c]+s),u=h-i;if(u<0||u>=n.content.size){a=!0;continue}let f=t.map(r[c+1]+s,-1),p=f-i,{index:d,offset:g}=n.content.findIndex(u),y=n.maybeChild(d);if(y&&g==u&&g+y.nodeSize==p){let C=l[c+2].mapInner(t,y,h+1,r[c]+s+1,o);C!=te?(l[c]=u,l[c+1]=p,l[c+2]=C):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ou(l,r,e,t,i,s,o),h=Gn(c,n,0,o);e=h.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,f=0;u<h.children.length;u+=3){let p=h.children[u];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,h.children[u],h.children[u+1],h.children[u+2])}}return new P(e.sort(dt),l)}function ql(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new ie(i.from+e,i.to+e,i.type))}return t}function ou(r,e,t,n,i,s,o){function l(a,c){for(let h=0;h<a.local.length;h++){let u=a.local[h].map(n,i,c);u?t.push(u):o.onRemove&&o.onRemove(a.local[h].spec)}for(let h=0;h<a.children.length;h+=3)l(a.children[h+2],a.children[h]+c+1)}for(let a=0;a<r.length;a+=3)r[a+1]==-1&&l(r[a+2],e[a]+s+1);return t}function Jl(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function $l(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Gn(r,e,t,n){let i=[],s=!1;e.forEach((l,a)=>{let c=Jl(r,l,a+t);if(c){s=!0;let h=Gn(c,l,t+a+1,n);h!=te&&i.push(a,a+l.nodeSize,h)}});let o=ql(s?$l(r):r,-t).sort(dt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(n.onRemove&&n.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new P(o,i):te}function dt(r,e){return r.from-e.from||r.to-e.to}function Ai(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Xs(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Xs(e,i,n.copy(s.from,n.to)));break}}}return e}function Xs(r,e,t){for(;e<r.length&&dt(t,r[e])>0;)e++;r.splice(e,0,t)}function vr(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=te&&e.push(n)}),r.cursorWrapper&&e.push(P.create(r.state.doc,[r.cursorWrapper.deco])),Ye.from(e)}const lu={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},au=ye&&et<=11;class cu{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class hu{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cu,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);ye&&et<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),au&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,lu)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Us(this.view)){if(this.suppressingSelectionUpdates)return qe(this.view);if(ye&&et<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Bt(s))t.add(s);for(let s=e.anchorNode;s;s=Bt(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Us(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let h=0;h<t.length;h++){let u=this.registerMutation(t[h],a);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(l=!0))}if(Te&&a.length){let h=a.filter(u=>u.nodeName=="BR");if(h.length==2){let[u,f]=h;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of h){let p=f.parentNode;p&&p.nodeName=="LI"&&(!u||du(e,u)!=p)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&er(n)&&(c=Ci(e))&&c.eq(N.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qe(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),uu(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||qe(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let h=0;h<e.addedNodes.length;h++){let u=e.addedNodes[h];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ye&&et<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:u,nextSibling:f}=e.addedNodes[h];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Y(i)+1:0,l=n.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?Y(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Zs=new WeakMap,Qs=!1;function uu(r){if(!Zs.has(r)&&(Zs.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Te,Qs)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Qs=!0}}function eo(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return yt(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function fu(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return eo(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?eo(r,t):null}function du(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function pu(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:l}=r.docView.parseRange(e,t),a=r.domSelectionRange(),c,h=a.anchorNode;if(h&&r.dom.contains(h.nodeType==1?h:h.parentNode)&&(c=[{node:h,offset:a.anchorOffset}],er(a)||c.push({node:a.focusNode,offset:a.focusOffset})),re&&r.input.lastKeyCode===8)for(let y=s;y>i;y--){let C=n.childNodes[y-1],L=C.pmViewDesc;if(C.nodeName=="BR"&&!L){s=y;break}if(!L||L.size)break}let u=r.state.doc,f=r.someProp("domParser")||Lt.fromSchema(r.state.schema),p=u.resolve(o),d=null,g=f.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:mu,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,C=c[1]&&c[1].pos;C==null&&(C=y),d={anchor:y+o,head:C+o}}return{doc:g,sel:d,from:o,to:l}}function mu(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(he&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||he&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const gu=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yu(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let E=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,B=Ci(r,E);if(B&&!r.state.selection.eq(B)){if(re&&Ue&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",sr=>sr(r,lt(13,"Enter"))))return;let Q=r.state.tr.setSelection(B);E=="pointer"?Q.setMeta("pointer",!0):E=="key"&&Q.scrollIntoView(),s&&Q.setMeta("composition",s),r.dispatch(Q)}return}let o=r.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=r.state.doc.resolve(t).after(l+1);let a=r.state.selection,c=pu(r,e,t),h=r.state.doc,u=h.slice(c.from,c.to),f,p;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(f=r.state.selection.to,p="end"):(f=r.state.selection.from,p="start"),r.input.lastKeyCode=null;let d=Su(u.content,c.doc.content,c.from,f,p);if(d&&r.input.domChangeCount++,(_t&&r.input.lastIOSEnter>Date.now()-225||Ue)&&i.some(E=>E.nodeType==1&&!gu.test(E.nodeName))&&(!d||d.endA>=d.endB)&&r.someProp("handleKeyDown",E=>E(r,lt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!d)if(n&&a instanceof O&&!a.empty&&a.$head.sameParent(a.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))d={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let E=to(r,r.state.doc,c.sel);if(E&&!E.eq(r.state.selection)){let B=r.state.tr.setSelection(E);s&&B.setMeta("composition",s),r.dispatch(B)}}return}r.state.selection.from<r.state.selection.to&&d.start==d.endB&&r.state.selection instanceof O&&(d.start>r.state.selection.from&&d.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?d.start=r.state.selection.from:d.endA<r.state.selection.to&&d.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(d.endB+=r.state.selection.to-d.endA,d.endA=r.state.selection.to)),ye&&et<=11&&d.endB==d.start+1&&d.endA==d.start&&d.start>c.from&&c.doc.textBetween(d.start-c.from-1,d.start-c.from+1)=="  "&&(d.start--,d.endA--,d.endB--);let g=c.doc.resolveNoCache(d.start-c.from),y=c.doc.resolveNoCache(d.endB-c.from),C=h.resolve(d.start),L=g.sameParent(y)&&g.parent.inlineContent&&C.end()>=d.endA;if((_t&&r.input.lastIOSEnter>Date.now()-225&&(!L||i.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!L&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&r.someProp("handleKeyDown",E=>E(r,lt(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>d.start&&ku(h,d.start,d.endA,g,y)&&r.someProp("handleKeyDown",E=>E(r,lt(8,"Backspace")))){Ue&&re&&r.domObserver.suppressSelectionUpdates();return}re&&d.endB==d.start&&(r.input.lastChromeDelete=Date.now()),Ue&&!L&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==d.endA&&(d.endB-=2,y=c.doc.resolveNoCache(d.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(E){return E(r,lt(13,"Enter"))})},20));let I=d.start,R=d.endA,Oe=E=>{let B=E||r.state.tr.replace(I,R,c.doc.slice(d.start-c.from,d.endB-c.from));if(c.sel){let Q=to(r,B.doc,c.sel);Q&&!(re&&r.composing&&Q.empty&&(d.start!=d.endB||r.input.lastChromeDelete<Date.now()-100)&&(Q.head==I||Q.head==B.mapping.map(R)-1)||ye&&Q.empty&&Q.head==I)&&B.setSelection(Q)}return s&&B.setMeta("composition",s),B.scrollIntoView()},$e;if(L)if(g.pos==y.pos){ye&&et<=11&&g.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>qe(r),20));let E=Oe(r.state.tr.delete(I,R)),B=h.resolve(d.start).marksAcross(h.resolve(d.endA));B&&E.ensureMarks(B),r.dispatch(E)}else if(d.endA==d.endB&&($e=bu(g.parent.content.cut(g.parentOffset,y.parentOffset),C.parent.content.cut(C.parentOffset,d.endA-C.start())))){let E=Oe(r.state.tr);$e.type=="add"?E.addMark(I,R,$e.mark):E.removeMark(I,R,$e.mark),r.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),B=()=>Oe(r.state.tr.insertText(E,I,R));r.someProp("handleTextInput",Q=>Q(r,I,R,E,B))||r.dispatch(B())}else r.dispatch(Oe());else r.dispatch(Oe())}function to(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:wi(r,e.resolve(t.anchor),e.resolve(t.head))}function bu(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,l,a;for(let h=0;h<n.length;h++)i=n[h].removeFromSet(i);for(let h=0;h<t.length;h++)s=t[h].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=h=>h.mark(l.addToSet(h.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=h=>h.mark(l.removeFromSet(h.marks));else return null;let c=[];for(let h=0;h<e.childCount;h++)c.push(a(e.child(h)));if(b.from(c).eq(r))return{mark:l,type:o}}function ku(r,e,t,n,i){if(t-e<=i.pos-n.pos||Ir(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(Ir(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Ir(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Ir(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Su(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o<s&&r.size<e.size){let a=n<=s&&n>=o?s-n:0;s-=a,s&&s<e.size&&no(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=n<=s&&n>=l?s-n:0;s-=a,s&&s<r.size&&no(r.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function no(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Kl{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _h,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(lo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=so(this),io(this),this.nodeViews=oo(this),this.docView=zs(this.state.doc,ro(this),vr(this),this.dom,this),this.domObserver=new hu(this,(n,i,s,o)=>yu(this,n,i,s,o)),this.domObserver.start(),Vh(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ai(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Vl(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=oo(this);Tu(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ai(this),this.editable=so(this),io(this);let a=vr(this),c=ro(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(i.selection))&&(o=!0);let f=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&eh(this);if(o){this.domObserver.stop();let p=u&&(ye||re)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&xu(i.selection,e.selection);if(u){let d=re?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qh(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=zs(e.doc,c,a,this.dom,this)),d&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wh(this))?qe(this,p):(Nl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():f&&th(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof w){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&vs(this,t.getBoundingClientRect(),e)}else vs(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Wl(e.slice,e.move,i<0?void 0:w.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(ye){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&nh(this.dom),qe(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return lh(this,e)}coordsAtPos(e,t=1){return Sl(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return fh(this,t||this.state,e)}pasteHTML(e,t){return dn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return dn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Mi(this,e)}destroy(){this.docView&&(Hh(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Uc())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uh(this,e)}domSelectionRange(){let e=this.domSelection();return e?he&&this.root.nodeType===11&&Gc(this.dom.ownerDocument)==this.dom&&fu(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Kl.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function ro(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[ie.node(0,r.state.doc.content.size,e)]}function io(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:ie.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function so(r){return!r.someProp("editable",e=>e(r.state)===!1)}function xu(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function oo(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function Tu(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function lo(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}class Cu{constructor(e){this.specs=e,this.attrs={};for(const t of e)this.attrs[t.name]={default:t.default}}fromDOM(e){return Object.assign({},...this.specs.map(t=>({[t.name]:t.fromDOM(e)})))}getStyle(e){return this.specs.flatMap(t=>t.toStyles(e)).join("; ")}getDOMAttrsProperties(e){return this.specs.length?{style:this.getStyle(e)}:{}}getDOMAttrs(e){return this.specs.length?[this.getDOMAttrsProperties(e)]:[]}extractFromNode(e){return Object.assign({},...Object.keys(this.attrs).map(t=>({[t]:e.attrs[t]})))}}const A=Symbol("rte-internal-impl");class wu{constructor(e){this.specs=e}getAllowedMarksForNode(e){return this.specs.filter(t=>!t.onNodeName||t.onNodeName===e).map(t=>t.markName)}getReferencedNodeNames(){return new Set(this.specs.map(e=>e.onNodeName).filter(Boolean))}}const Ft=r=>r.sort((e,t)=>{const n=e.priority-t.priority;return n!==0?n:e.featureName===t.featureName?0:e.featureName>t.featureName?1:-1}).map(e=>e.value),vi={high:-10,default:0};class Mu{}class ${contribution(e,t){return{featureName:this.name,priority:t??vi.default,value:e}}getStyles(){return[]}getSchema(e,t){return[]}getTextblockAttrs(){return[]}getTextblockMarks(){return[]}getPlugins(e){return[]}getToolbarItems(e){return[]}getFeatures(){return[this]}}const H=r=>{var e;class t extends(e=Mu,e){constructor(...i){super(),this[A]=new r(...i)}}return t};var rt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ou=typeof navigator<"u"&&/Mac/.test(navigator.platform),Eu=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var X=0;X<10;X++)rt[48+X]=rt[96+X]=String(X);for(var X=1;X<=24;X++)rt[X+111]="F"+X;for(var X=65;X<=90;X++)rt[X]=String.fromCharCode(X+32),jn[X]=String.fromCharCode(X);for(var Rr in rt)jn.hasOwnProperty(Rr)||(jn[Rr]=rt[Rr]);function Nu(r){var e=Ou&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||Eu&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?jn:rt)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Du=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Au=typeof navigator<"u"&&/Win/.test(navigator.platform);function vu(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Du?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Iu(r){let e=Object.create(null);for(let t in r)e[vu(t)]=r[t];return e}function Pr(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function Me(r){return new ce({props:{handleKeyDown:Gl(r)}})}function Gl(r){let e=Iu(r);return function(t,n){let i=Nu(n),s,o=e[Pr(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let l=e[Pr(i,n,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Au&&n.ctrlKey&&n.altKey)&&(s=rt[n.keyCode])&&s!=i){let l=e[Pr(s,n)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const jl=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Ru(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Pu=(r,e,t)=>{let n=Ru(r,t);if(!n)return!1;let i=Yl(n);if(!i){let o=n.blockRange(),l=o&&yi(o);return l==null?!1:(e&&e(r.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(na(r,i,e,-1))return!0;if(n.parent.content.size==0&&(Vt(s,"end")||w.isSelectable(s)))for(let o=n.depth;;o--){let l=Si(r.doc,n.before(o),n.after(o),S.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=r.tr.step(l);a.setSelection(Vt(s,"end")?N.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):w.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1};function Vt(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Fu=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=Yl(n)}let o=s&&s.nodeBefore;return!o||!w.isSelectable(o)?!1:(e&&e(r.tr.setSelection(w.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Yl(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Lu(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const zu=(r,e,t)=>{let n=Lu(r,t);if(!n)return!1;let i=Xl(n);if(!i)return!1;let s=i.nodeAfter;if(na(r,i,e,1))return!0;if(n.parent.content.size==0&&(Vt(s,"start")||w.isSelectable(s))){let o=Si(r.doc,n.before(),n.after(),S.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=r.tr.step(o);l.setSelection(Vt(s,"start")?N.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):w.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Bu=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=Xl(n)}let o=s&&s.nodeAfter;return!o||!w.isSelectable(o)?!1:(e&&e(r.tr.setSelection(w.create(r.doc,s.pos)).scrollIntoView()),!0)};function Xl(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const Zl=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
10
- `).scrollIntoView()),!0)};function Ii(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const _u=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Ii(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=r.tr.replaceWith(l,l,o.createAndFill());a.setSelection(N.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ql=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Z||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ii(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,l=r.tr.insert(o,s.createAndFill());l.setSelection(O.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},ea=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ln(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&yi(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function ta(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof w&&e.selection.node.isBlock)return!n.parentOffset||!Ln(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){a=n.end(p)==n.pos+(n.depth-p),c=n.start(p)==n.pos-(n.depth-p),l=Ii(n.node(p-1).contentMatchAt(n.indexAfter(p-1)));let g=r&&r(i.parent,a,n);s.unshift(g||(a&&l?{type:l}:null)),o=p;break}else{if(p==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof O||e.selection instanceof Z)&&h.deleteSelection();let u=h.mapping.map(n.pos),f=Ln(h.doc,u,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Ln(h.doc,u,s.length,s)),!f)return!1;if(h.split(u,s.length,s),!a&&c&&n.node(o).type!=l){let p=h.mapping.map(n.before(o)),d=h.doc.resolve(p);l&&n.node(o-1).canReplaceWith(d.index(),d.index()+1,l)&&h.setNodeMarkup(h.mapping.map(n.before(o)),l)}return t&&t(h.scrollIntoView()),!0}}const Vu=ta(),Hu=(r,e)=>(e&&e(r.tr.setSelection(new Z(r.doc))),!0);function Wu(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||bi(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function na(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Wu(r,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,d=b.empty;for(let C=o.length-1;C>=0;C--)d=b.from(o[C].create(null,d));d=b.from(i.copy(d));let g=r.tr.step(new se(e.pos-1,p,e.pos,p,new S(d,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&bi(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let h=s.type.spec.isolating||n>0&&a?null:N.findFrom(e,1),u=h&&h.$from.blockRange(h.$to),f=u&&yi(u);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(u,f).scrollIntoView()),!0;if(c&&Vt(s,"start",!0)&&Vt(i,"end")){let p=i,d=[];for(;d.push(p),!p.isTextblock;)p=p.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let C=b.empty;for(let I=d.length-1;I>=0;I--)C=b.from(d[I].copy(C));let L=r.tr.step(new se(e.pos-d.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new S(C,d.length,0),0,!0));t(L.scrollIntoView())}return!0}}return!1}function ra(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(O.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Uu=ra(-1),qu=ra(1);function Ju(r,e,t,n){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],l=s.depth==0?r.inlineContent&&r.type.allowsMarkType(t):!1;if(r.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function Je(r,e=null,t){return function(n,i){let{empty:s,$cursor:o,ranges:l}=n.selection;if(s&&!o||!Ju(n.doc,l,r))return!1;if(i)if(o)r.isInSet(n.storedMarks||o.marks())?i(n.tr.removeStoredMark(r)):i(n.tr.addStoredMark(r.create(e)));else{let a,c=n.tr;a=!l.some(h=>n.doc.rangeHasMark(h.$from.pos,h.$to.pos,r));for(let h=0;h<l.length;h++){let{$from:u,$to:f}=l[h];if(!a)c.removeMark(u.pos,f.pos,r);else{let p=u.pos,d=f.pos,g=u.nodeAfter,y=f.nodeBefore,C=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,L=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;p+C<d&&(p+=C,d-=L),c.addMark(p,d,r.create(e))}}i(c.scrollIntoView())}return!0}}function $u(r,e){return t=>{if(!t.isGeneric)return r(t);let n=[];for(let s=0;s<t.mapping.maps.length;s++){let o=t.mapping.maps[s];for(let l=0;l<n.length;l++)n[l]=o.map(n[l]);o.forEach((l,a,c,h)=>n.push(c,h))}let i=[];for(let s=0;s<n.length;s+=2){let o=n[s],l=n[s+1],a=t.doc.resolve(o),c=a.sharedDepth(l),h=a.node(c);for(let u=a.indexAfter(c),f=a.after(c+1);f<=l;++u){let p=h.maybeChild(u);if(!p)break;if(u&&i.indexOf(f)==-1){let d=h.child(u-1);d.type==p.type&&e(d,p)&&i.push(f)}f+=p.nodeSize}}i.sort((s,o)=>s-o);for(let s=i.length-1;s>=0;s--)bi(t.doc,i[s])&&t.join(i[s]);r(t)}}function Ku(r,e){let t=Array.isArray(e)?n=>e.indexOf(n.type.name)>-1:e;return(n,i,s)=>r(n,i&&$u(i,t),s)}function rr(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}let Fr=rr(jl,Pu,Fu),ao=rr(jl,zu,Bu);const We={Enter:rr(Zl,Ql,ea,Vu),"Mod-Enter":_u,Backspace:Fr,"Mod-Backspace":Fr,"Shift-Backspace":Fr,Delete:ao,"Mod-Delete":ao,"Mod-a":Hu},ia={"Ctrl-h":We.Backspace,"Alt-Backspace":We["Mod-Backspace"],"Ctrl-d":We.Delete,"Ctrl-Alt-Backspace":We["Mod-Delete"],"Alt-Delete":We["Mod-Delete"],"Alt-d":We["Mod-Delete"],"Ctrl-a":Uu,"Ctrl-e":qu};for(let r in We)ia[r]=We[r];const Gu=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ju=Gu?ia:We,Yu='.ProseMirror{position:relative}.ProseMirror{word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.ProseMirror pre{white-space:pre-wrap}.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}';function Xu(r={}){return new ce({view(e){return new Zu(e,r)}})}class Zu{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let d=p.getBoundingClientRect(),g=u?d.bottom:d.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;n={left:d.left,right:d.right,top:g-y,bottom:g+y}}}}if(!n){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;n={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,h;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,h=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,p=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,h=u.top-a.scrollTop*p}this.element.style.left=(n.left-c)/o+"px",this.element.style.top=(n.top-h)/l+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ki(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class F extends N{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return F.valid(n)?new F(n):N.near(n)}content(){return S.empty}eq(e){return e instanceof F&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(e.resolve(t.pos))}getBookmark(){return new Ri(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Qu(e)||!ef(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&F.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(F.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!w.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(F.valid(l))return l}return null}}}F.prototype.visible=!1;F.findFrom=F.findGapCursorFrom;N.jsonID("gapcursor",F);class Ri{constructor(e){this.pos=e}map(e){return new Ri(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return F.valid(t)?new F(t):N.near(t)}}function sa(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function Qu(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||sa(i.type))return!0;if(i.inlineContent)return!1}}return!0}function ef(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||sa(i.type))return!0;if(i.inlineContent)return!1}}return!0}function tf(){return new ce({props:{decorations:of,createSelectionBetween(r,e,t){return e.pos==t.pos&&F.valid(t)?new F(t):null},handleClick:rf,handleKeyDown:nf,handleDOMEvents:{beforeinput:sf}}})}const nf=Gl({ArrowLeft:An("horiz",-1),ArrowRight:An("horiz",1),ArrowUp:An("vert",-1),ArrowDown:An("vert",1)});function An(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof O){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let c=F.findGapCursorFrom(l,e,a);return c?(i&&i(n.tr.setSelection(new F(c))),!0):!1}}function rf(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!F.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&w.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new F(n))),!0)}function sf(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof F))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=b.empty;for(let o=n.length-1;o>=0;o--)i=b.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new S(i,0,0));return s.setSelection(O.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function of(r){if(!(r.selection instanceof F))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",P.create(r.doc,[ie.widget(r.selection.head,e,{key:"gapcursor"})])}function oa(r){for(let e=0;e<r.edgeCount;e++){const{type:t}=r.edge(e);/* v8 ignore if -- @preserve It's currently not possible to exercise this code in our RTE */if(t.isTextblock&&!t.hasRequiredAttrs())return t}/* v8 ignore next 1 -- @preserve*/throw new Error("No default textblock found.")}const lf="[data-class=ui-select]{min-inline-size:120px}.ui-divider{block-size:20px}.ui-button-group{display:flex;gap:4px}.ui-tooltip,.ui-menu{display:contents;--_popup-display: contents}.ui-tooltip-wrapper{display:contents}",af='.ProseMirror{flex:1;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none}.ProseMirror-selectednode{--focus-stroke-gap-color: transparent;--focus-border-radius: 2px;position:relative;outline:none}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:var(--focus-border-radius, inherit);block-size:calc(100% + var(--focus-block-size-addition, 4px));content:"";inline-size:calc(100% + var(--focus-block-size-addition, 4px));inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}';var Yn=200,J=function(){};J.prototype.append=function(e){return e.length?(e=J.from(e),!this.length&&e||e.length<Yn&&this.leafAppend(e)||this.length<Yn&&e.leafPrepend(this)||this.appendInner(e)):this};J.prototype.prepend=function(e){return e.length?J.from(e).append(this):this};J.prototype.appendInner=function(e){return new cf(this,e)};J.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?J.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};J.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};J.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};J.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};J.from=function(e){return e instanceof J?e:e&&e.length?new la(e):J.empty};var la=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Yn)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Yn)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(J);J.empty=new la([]);var cf=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(J);const hf=500;class De{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],h=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,h.push(u);return}if(i){h.push(new ve(u.map));let p=u.step.map(i.slice(s)),d;p&&o.maybeStep(p).doc&&(d=o.mapping.maps[o.mapping.maps.length-1],c.push(new ve(d,void 0,void 0,c.length+h.length))),s--,d&&i.appendMap(d,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new De(this.items.slice(0,n).append(h.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let h=0;h<e.steps.length;h++){let u=e.steps[h].invert(e.docs[h]),f=new ve(e.mapping.maps[h],u,t),p;(p=a&&a.merge(f))&&(f=p,h?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-n.depth;return c>ff&&(l=uf(l,c),o-=c),new De(l.append(s),o)}remapping(e,t){let n=new hn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new De(this.items.append(e.map(t=>new ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let p=s.getMirror(--a);if(p==null)return;o=Math.min(o,p);let d=s.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(s.slice(a+1,p));y&&l++,n.push(new ve(d,g,y))}else n.push(new ve(d))},i);let c=[];for(let f=t;f<o;f++)c.push(new ve(s.maps[f]));let h=this.items.slice(0,i).append(c).append(n),u=new De(h,l);return u.emptyItemCount()>hf&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let h=o.selection&&o.selection.map(t.slice(n));h&&s++;let u=new ve(c.invert(),a,h),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u)}}else o.map&&n--},this.items.length,0),new De(J.from(i.reverse()),s)}}De.empty=new De(J.empty,0);function uf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class ve{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ve(t.getMap().invert(),t,this.selection)}}}class je{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const ff=20;function df(r,e,t,n){let i=t.getMeta(pt),s;if(i)return i.historyState;t.getMeta(gf)&&(r=new je(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(pt))return o.getMeta(pt).redo?new je(r.done.addTransform(t,void 0,n,zn(e)),r.undone,co(t.mapping.maps),r.prevTime,r.prevComposition):new je(r.done,r.undone.addTransform(t,void 0,n,zn(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!pf(t,r.prevRanges)),c=o?Lr(r.prevRanges,t.mapping):co(t.mapping.maps);return new je(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,zn(e)),De.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new je(r.done.rebased(t,s),r.undone.rebased(t,s),Lr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new je(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Lr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function pf(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function co(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Lr(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function mf(r,e,t){let n=zn(e),i=pt.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new je(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(pt,{redo:t,historyState:a})}let zr=!1,ho=null;function zn(r){let e=r.plugins;if(ho!=e){zr=!1,ho=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){zr=!0;break}}return zr}const pt=new dl("history"),gf=new dl("closeHistory");function yf(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new ce({key:pt,state:{init(){return new je(De.empty,De.empty,null,0,-1)},apply(e,t,n){return df(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Bn:n=="historyRedo"?tn:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function aa(r,e){return(t,n)=>{let i=pt.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=mf(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const Bn=aa(!1,!0),tn=aa(!0,!0),uo=r=>typeof r=="function",ir=(r,e,t)=>[r,e,t];class Pi{constructor(e,t,n){this.view=e,this.rte=t,this.props=n,this.bindings=[]}evalProp(e){return uo(e)?e(this):e}bindProp(e,t){if(e!==void 0)if(uo(e)){const n=()=>t(e(this));this.bindings.push(n),n()}else t(e)}updateBindings(){for(const e of this.bindings)e()}bindToEl(e,t={},n=[],i=[]){for(const s in t)this.bindProp(t[s],o=>{e[s]=o});for(const[s,o,l]of n)o&&e.addEventListener(s,l(o));for(const s of i)e.appendChild(s)}}const Ne=(r,e)=>{const t=document.createElement("div");return r.bindToEl(t,{className:e.className,slot:e.slot},[],e.children),t},bf=(r,e)=>{const t=document.createElement("a");return r.bindToEl(t,{href:e.href,target:e.target,rel:e.rel,className:e.className},[],e.children),t},ca=new WeakMap,ha=(r,e)=>{const t=r.rte.createComponent(vo.Tooltip);t.setAttribute("exportparts","vvd-theme-alternate"),r.bindToEl(t,{className:"ui-tooltip",text:e.label,placement:r.props.popupPlacement}),r.bindProp(e.enabled,i=>{i||(t.open=!1),t.anchor=i?e.anchor:void 0});const n=Ne(r,{className:"ui-tooltip-wrapper",slot:e.slot,children:[e.anchor,t]});return ca.set(n,e.anchor),n},q=(r,e)=>{const t=()=>r.evalProp(e.variant)??"toolbar",n=()=>t()==="toolbar"?"super-condensed":"condensed",i=()=>t()==="popover-primary"?"outlined":"ghost-light",s=()=>r.evalProp(e.active)?"filled":i(),o=r.rte.createComponent(Ao.Button);return r.bindToEl(o,{size:n,appearance:s,disabled:e.disabled,icon:e.icon,autofocus:e.autofocus,connotation:e.connotation,[e.icon?"ariaLabel":"label"]:e.label},[ir("click",e.onClick,l=>()=>{l()||r.view.focus()})]),ha(r,{enabled:()=>!!(r.evalProp(e.icon)&&!r.evalProp(e.noTooltip)&&!r.evalProp(e.disabled)),label:e.label,anchor:o,slot:e.slot})},Fi=(r,e)=>{const t=r.rte.createComponent(Io.Menu);r.bindToEl(t,{className:"ui-menu",autoDismiss:!0,ariaLabel:e.label,anchor:ca.get(e.trigger)??e.trigger,placement:r.props.popupPlacement},[],e.children);const n=document.createDocumentFragment();return n.appendChild(e.trigger),n.appendChild(t),n},kf=(r,e)=>{const t=r.rte.createComponent(Ro.MenuItem);return r.bindToEl(t,{text:e.text,checked:e.checked,disabled:e.disabled,controlType:"radio",checkedAppearance:"tick-only"},[ir("change",e.onSelect,n=>()=>{t.checked&&!t.disabled&&r.evalProp(e.checked)!==t.checked&&(n(),r.view.focus())})]),t},Sf=(r,e)=>Ne(r,{className:"ui-button-group",children:e.children});function xf(r,e){const{from:t,$from:n,to:i,empty:s}=r.selection;return s?!!e.isInSet(r.storedMarks||n.marks()):r.doc.rangeHasMark(t,i,e)}const bn=(r,e)=>q(r,{label:e.label,icon:e.icon,active:()=>xf(r.view.state,e.markType),disabled:()=>!Je(e.markType)(r.view.state),onClick:()=>{Je(e.markType)(r.view.state,r.view.dispatch)}}),Tf=(r,e)=>{const t=r.rte.createComponent(Do.ListboxOption);return r.bindToEl(t,{value:e.value,text:e.text,disabled:e.disabled}),t},Cf=(r,e)=>{const t=r.rte.createComponent(No.Select);t.setAttribute("data-class","ui-select"),r.bindToEl(t,{placeholder:" ",ariaLabel:e.label,scale:"condensed",appearance:"ghost"},[ir("change",e.onSelect,i=>()=>{const s=t.value;s&&(i(s),r.view.focus())})],e.children),queueMicrotask(()=>{r.bindProp(e.value,i=>t.value=i)});let n=!1;return t.addEventListener("vwc-popup:open",()=>{n=!0,r.updateBindings()}),t.addEventListener("vwc-popup:close",()=>{n=!1,r.updateBindings()}),ha(r,{enabled:()=>!n,label:e.label,anchor:t})},ci=r=>{const e=r.rte.createComponent(Ja.Divider);return r.bindToEl(e,{className:"ui-divider",orientation:"vertical"}),e},fo=(r,e)=>{const t=r.rte.createComponent(Po.TextField);return r.bindToEl(t,{label:e.label,value:e.value,placeholder:e.placeholder,slot:e.slot,autofocus:e.autofocus,type:e.type},[ir("input",e.onInput,n=>()=>{n(t.value)})]),t},po=(r,e)=>{const t=document.createTextNode("");return r.bindToEl(t,{textContent:e.text}),t},wf=(r,e)=>{const t=document.createElement("slot");t.name=e.name;let n=null;const i=[];function s(){for(const{el:a,type:c,handler:h}of i)a.removeEventListener(c,h);i.length=0,n=null}for(const[a,c]of Object.entries(e.assignedProps))r.bindProp(c,h=>{n&&(n[a]=h)});function o(a){for(const[c,h]of Object.entries(e.assignedProps))a[c]=r.evalProp(h);for(const[c,h]of Object.entries(e.assignedEvents)){const u=f=>{h(f),r.view.focus()};a.addEventListener(c,u),i.push({el:a,type:c,handler:u})}}const l=()=>{const c=t.assignedElements({flatten:!0})[0];c!==n&&(s(),c&&(n=c,o(c)))};return t.addEventListener("slotchange",l),queueMicrotask(l),t};class Mf extends ${constructor(){super(...arguments),this.name="RteHistoryFeature"}getPlugins(){return[this.contribution(yf()),this.contribution(Me({"Mod-z":Bn,"Ctrl-y":tn,"Cmd-Z":tn}))]}getToolbarItems(){return[this.contribution({section:"history",render:e=>q(e,{label:t=>t.rte.getLocale().richTextEditor.undo,icon:"undo-line",disabled:t=>!Bn(t.view.state),onClick:()=>{const{state:t,dispatch:n}=e.view;Bn(t,n)}})},1),this.contribution({section:"history",render:e=>q(e,{label:t=>t.rte.getLocale().richTextEditor.redo,icon:"redo-line",disabled:t=>!tn(t.view.state),onClick:()=>{const{state:t,dispatch:n}=e.view;tn(t,n)}})},2)]}}class Of extends ${constructor(){super(...arguments),this.name="RteForeignHtmlFeature"}getPlugins(e){return[this.contribution(new ce({props:{transformPastedHTML:t=>e.foreignHtmlParser[A].transform(t),clipboardParser:e.foreignHtmlParser[A].parser,clipboardSerializer:e.foreignHtmlSerializer[A].serializer}}))]}}const ln=new ce({state:{init(){return null},apply(r,e){const t=r.getMeta(ln);return t||e}}});class ua extends ${constructor(){super(...arguments),this.name="RteCore"}getStyles(){return[this.contribution(Yu),this.contribution(af),this.contribution(lf)]}getPlugins(e){return[this.contribution(Me({...ju,Enter:rr(Zl,Ql,ea,ta((t,n,i)=>n?{type:oa(i.node(i.depth-1).contentMatchAt(i.indexAfter(i.depth-1))),attrs:e.textblockAttrs.extractFromNode(t)}:{type:t.type,attrs:t.attrs}))})),this.contribution(Xu()),this.contribution(tf()),this.contribution(ln)]}getFeatures(){return[this,new Mf,new Of]}}H(ua);const Ef="h1,h2,h3,p{all:unset;display:block}h1:first-child,h2:first-child,h3:first-child,p:first-child{margin-block-start:0}h1:last-child,h2:last-child,h3:last-child,p:last-child{margin-block-end:0}p{font:var(--vvd-typography-base);line-height:20px;margin-block:16px}.heading-step-1{font:var(--vvd-typography-heading-4);line-height:28px;margin-block:24px 12px}.heading-step-2{font:var(--vvd-typography-heading-3);line-height:36px;margin-block:24px 12px}.heading-step-3{font:var(--vvd-typography-heading-2);line-height:42px;margin-block:32px 16px}";class fa extends ${constructor(e){super(),this.enabledBlocks=e,this.name="RteBasicTextBlocks"}getStyles(){return[this.contribution(Ef)]}getSchema(e,t){const n={};this.enabledBlocks.paragraph&&(n.paragraph={group:"block",content:"inline*",attrs:{...e.attrs},parseDOM:[{tag:"p",getAttrs:s=>e.fromDOM(s)}],marks:t.getAllowedMarksForNode("paragraph").join(" "),toDOM(s){return["p",{part:"node--paragraph",...e.getDOMAttrsProperties(s)},0]},serializeToDOM(s){return["p",...e.getDOMAttrs(s),0]}});let i=0;for(const s of[3,2,1]){const o=`heading${s}`,l=`h${s}`;if(!this.enabledBlocks[o])continue;i++;const a=i;n[o]={group:"block",content:"inline*",attrs:{...e.attrs},parseDOM:[{tag:l,getAttrs:c=>e.fromDOM(c)}],marks:t.getAllowedMarksForNode(o).join(" "),defining:!0,toDOM(c){return[l,{class:`heading-step-${a}`,part:`node--${o}`,...e.getDOMAttrsProperties(c)},0]},serializeToDOM(c){return[l,...e.getDOMAttrs(c),0]}}}return[this.contribution({nodes:n})]}getPlugins(e){const t={};this.enabledBlocks.paragraph&&(t["Mod-Alt-0"]=this.setBlockType(e,"paragraph"));for(const n of[1,2,3]){const i=`heading${n}`;this.enabledBlocks[i]&&(t[`Mod-Alt-${n}`]=this.setBlockType(e,i))}return[this.contribution(Me(t))]}getCurrentBlockType(e){const{$from:t,$to:n}=e.selection,i=t.depth===0?e.doc.childAfter(t.pos).node:t.node(1),s=n.depth===0?e.doc.childBefore(n.pos).node:n.node(1);return i!==s||!(i.type.name in this.enabledBlocks)?null:i.type.name}setBlockType(e,t){return(n,i)=>{const{from:s,to:o}=n.selection,l=n.tr;let a=!1;return n.doc.nodesBetween(s,o,(c,h)=>(c.type.name in this.enabledBlocks&&(a=!0,l.setBlockType(h,h+c.nodeSize,n.schema.nodes[t],u=>e.textblockAttrs.extractFromNode(u))),!1)),a?(i?.(l),!0):!1}}}class da extends ${constructor(e){super(),this.config=e,this.name="RteBase"}getSchema(){return[this.contribution({nodes:{doc:{content:"block+"},text:{group:"inline"}}})]}getFeatures(){return[this,new ua,new fa({heading1:this.config?.heading1??!1,heading2:this.config?.heading2??!1,heading3:this.config?.heading3??!1,paragraph:this.config?.paragraph??!0})]}}const Nf=H(da);var Df=Object.defineProperty,Af=Object.getOwnPropertyDescriptor,Wt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Af(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Df(e,t,i),i};const vf=r=>{const e=r.tagFor(Gr.Popup);return me.html`<${e}
10
+ `).scrollIntoView()),!0)};function Ii(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const _u=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Ii(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=r.tr.replaceWith(l,l,o.createAndFill());a.setSelection(N.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ql=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Z||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ii(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,l=r.tr.insert(o,s.createAndFill());l.setSelection(O.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},ea=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ln(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&yi(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function ta(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof w&&e.selection.node.isBlock)return!n.parentOffset||!Ln(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){a=n.end(p)==n.pos+(n.depth-p),c=n.start(p)==n.pos-(n.depth-p),l=Ii(n.node(p-1).contentMatchAt(n.indexAfter(p-1)));let g=r&&r(i.parent,a,n);s.unshift(g||(a&&l?{type:l}:null)),o=p;break}else{if(p==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof O||e.selection instanceof Z)&&h.deleteSelection();let u=h.mapping.map(n.pos),f=Ln(h.doc,u,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Ln(h.doc,u,s.length,s)),!f)return!1;if(h.split(u,s.length,s),!a&&c&&n.node(o).type!=l){let p=h.mapping.map(n.before(o)),d=h.doc.resolve(p);l&&n.node(o-1).canReplaceWith(d.index(),d.index()+1,l)&&h.setNodeMarkup(h.mapping.map(n.before(o)),l)}return t&&t(h.scrollIntoView()),!0}}const Vu=ta(),Hu=(r,e)=>(e&&e(r.tr.setSelection(new Z(r.doc))),!0);function Wu(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||bi(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function na(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Wu(r,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,d=b.empty;for(let C=o.length-1;C>=0;C--)d=b.from(o[C].create(null,d));d=b.from(i.copy(d));let g=r.tr.step(new se(e.pos-1,p,e.pos,p,new S(d,1,0),o.length,!0)),y=g.doc.resolve(p+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&bi(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let h=s.type.spec.isolating||n>0&&a?null:N.findFrom(e,1),u=h&&h.$from.blockRange(h.$to),f=u&&yi(u);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(u,f).scrollIntoView()),!0;if(c&&Vt(s,"start",!0)&&Vt(i,"end")){let p=i,d=[];for(;d.push(p),!p.isTextblock;)p=p.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let C=b.empty;for(let I=d.length-1;I>=0;I--)C=b.from(d[I].copy(C));let L=r.tr.step(new se(e.pos-d.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new S(C,d.length,0),0,!0));t(L.scrollIntoView())}return!0}}return!1}function ra(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(O.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Uu=ra(-1),qu=ra(1);function Ju(r,e,t,n){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],l=s.depth==0?r.inlineContent&&r.type.allowsMarkType(t):!1;if(r.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function Je(r,e=null,t){return function(n,i){let{empty:s,$cursor:o,ranges:l}=n.selection;if(s&&!o||!Ju(n.doc,l,r))return!1;if(i)if(o)r.isInSet(n.storedMarks||o.marks())?i(n.tr.removeStoredMark(r)):i(n.tr.addStoredMark(r.create(e)));else{let a,c=n.tr;a=!l.some(h=>n.doc.rangeHasMark(h.$from.pos,h.$to.pos,r));for(let h=0;h<l.length;h++){let{$from:u,$to:f}=l[h];if(!a)c.removeMark(u.pos,f.pos,r);else{let p=u.pos,d=f.pos,g=u.nodeAfter,y=f.nodeBefore,C=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,L=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;p+C<d&&(p+=C,d-=L),c.addMark(p,d,r.create(e))}}i(c.scrollIntoView())}return!0}}function $u(r,e){return t=>{if(!t.isGeneric)return r(t);let n=[];for(let s=0;s<t.mapping.maps.length;s++){let o=t.mapping.maps[s];for(let l=0;l<n.length;l++)n[l]=o.map(n[l]);o.forEach((l,a,c,h)=>n.push(c,h))}let i=[];for(let s=0;s<n.length;s+=2){let o=n[s],l=n[s+1],a=t.doc.resolve(o),c=a.sharedDepth(l),h=a.node(c);for(let u=a.indexAfter(c),f=a.after(c+1);f<=l;++u){let p=h.maybeChild(u);if(!p)break;if(u&&i.indexOf(f)==-1){let d=h.child(u-1);d.type==p.type&&e(d,p)&&i.push(f)}f+=p.nodeSize}}i.sort((s,o)=>s-o);for(let s=i.length-1;s>=0;s--)bi(t.doc,i[s])&&t.join(i[s]);r(t)}}function Ku(r,e){let t=Array.isArray(e)?n=>e.indexOf(n.type.name)>-1:e;return(n,i,s)=>r(n,i&&$u(i,t),s)}function rr(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}let Fr=rr(jl,Pu,Fu),ao=rr(jl,zu,Bu);const We={Enter:rr(Zl,Ql,ea,Vu),"Mod-Enter":_u,Backspace:Fr,"Mod-Backspace":Fr,"Shift-Backspace":Fr,Delete:ao,"Mod-Delete":ao,"Mod-a":Hu},ia={"Ctrl-h":We.Backspace,"Alt-Backspace":We["Mod-Backspace"],"Ctrl-d":We.Delete,"Ctrl-Alt-Backspace":We["Mod-Delete"],"Alt-Delete":We["Mod-Delete"],"Alt-d":We["Mod-Delete"],"Ctrl-a":Uu,"Ctrl-e":qu};for(let r in We)ia[r]=We[r];const Gu=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ju=Gu?ia:We,Yu='.ProseMirror{position:relative}.ProseMirror{word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.ProseMirror pre{white-space:pre-wrap}.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}';function Xu(r={}){return new ce({view(e){return new Zu(e,r)}})}class Zu{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let d=p.getBoundingClientRect(),g=u?d.bottom:d.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;n={left:d.left,right:d.right,top:g-y,bottom:g+y}}}}if(!n){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;n={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,h;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,h=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,p=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,h=u.top-a.scrollTop*p}this.element.style.left=(n.left-c)/o+"px",this.element.style.top=(n.top-h)/l+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ki(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class F extends N{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return F.valid(n)?new F(n):N.near(n)}content(){return S.empty}eq(e){return e instanceof F&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(e.resolve(t.pos))}getBookmark(){return new Ri(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Qu(e)||!ef(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&F.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(F.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!w.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(F.valid(l))return l}return null}}}F.prototype.visible=!1;F.findFrom=F.findGapCursorFrom;N.jsonID("gapcursor",F);class Ri{constructor(e){this.pos=e}map(e){return new Ri(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return F.valid(t)?new F(t):N.near(t)}}function sa(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function Qu(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||sa(i.type))return!0;if(i.inlineContent)return!1}}return!0}function ef(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||sa(i.type))return!0;if(i.inlineContent)return!1}}return!0}function tf(){return new ce({props:{decorations:of,createSelectionBetween(r,e,t){return e.pos==t.pos&&F.valid(t)?new F(t):null},handleClick:rf,handleKeyDown:nf,handleDOMEvents:{beforeinput:sf}}})}const nf=Gl({ArrowLeft:An("horiz",-1),ArrowRight:An("horiz",1),ArrowUp:An("vert",-1),ArrowDown:An("vert",1)});function An(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof O){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let c=F.findGapCursorFrom(l,e,a);return c?(i&&i(n.tr.setSelection(new F(c))),!0):!1}}function rf(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!F.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&w.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new F(n))),!0)}function sf(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof F))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=b.empty;for(let o=n.length-1;o>=0;o--)i=b.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new S(i,0,0));return s.setSelection(O.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function of(r){if(!(r.selection instanceof F))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",P.create(r.doc,[ie.widget(r.selection.head,e,{key:"gapcursor"})])}function oa(r){for(let e=0;e<r.edgeCount;e++){const{type:t}=r.edge(e);/* v8 ignore if -- @preserve It's currently not possible to exercise this code in our RTE */if(t.isTextblock&&!t.hasRequiredAttrs())return t}/* v8 ignore next 1 -- @preserve*/throw new Error("No default textblock found.")}const lf="[data-class=ui-select]{min-inline-size:120px}.ui-divider{block-size:20px}.ui-button-group{display:flex;gap:4px}.ui-tooltip,.ui-menu{display:contents;--_popup-display: contents}.ui-tooltip-wrapper{display:contents}",af='.ProseMirror{flex:1;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none}.ProseMirror-selectednode{--focus-stroke-gap-color: transparent;--focus-border-radius: 2px;position:relative;outline:none}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:var(--focus-border-radius, inherit);block-size:calc(100% + var(--focus-block-size-addition, 4px));content:"";inline-size:calc(100% + var(--focus-block-size-addition, 4px));inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}';var Yn=200,J=function(){};J.prototype.append=function(e){return e.length?(e=J.from(e),!this.length&&e||e.length<Yn&&this.leafAppend(e)||this.length<Yn&&e.leafPrepend(this)||this.appendInner(e)):this};J.prototype.prepend=function(e){return e.length?J.from(e).append(this):this};J.prototype.appendInner=function(e){return new cf(this,e)};J.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?J.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};J.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};J.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};J.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};J.from=function(e){return e instanceof J?e:e&&e.length?new la(e):J.empty};var la=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Yn)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Yn)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(J);J.empty=new la([]);var cf=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(J);const hf=500;class De{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],h=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,h.push(u);return}if(i){h.push(new ve(u.map));let p=u.step.map(i.slice(s)),d;p&&o.maybeStep(p).doc&&(d=o.mapping.maps[o.mapping.maps.length-1],c.push(new ve(d,void 0,void 0,c.length+h.length))),s--,d&&i.appendMap(d,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new De(this.items.slice(0,n).append(h.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let h=0;h<e.steps.length;h++){let u=e.steps[h].invert(e.docs[h]),f=new ve(e.mapping.maps[h],u,t),p;(p=a&&a.merge(f))&&(f=p,h?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-n.depth;return c>ff&&(l=uf(l,c),o-=c),new De(l.append(s),o)}remapping(e,t){let n=new hn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new De(this.items.append(e.map(t=>new ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let p=s.getMirror(--a);if(p==null)return;o=Math.min(o,p);let d=s.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(s.slice(a+1,p));y&&l++,n.push(new ve(d,g,y))}else n.push(new ve(d))},i);let c=[];for(let f=t;f<o;f++)c.push(new ve(s.maps[f]));let h=this.items.slice(0,i).append(c).append(n),u=new De(h,l);return u.emptyItemCount()>hf&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let h=o.selection&&o.selection.map(t.slice(n));h&&s++;let u=new ve(c.invert(),a,h),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u)}}else o.map&&n--},this.items.length,0),new De(J.from(i.reverse()),s)}}De.empty=new De(J.empty,0);function uf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class ve{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ve(t.getMap().invert(),t,this.selection)}}}class je{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const ff=20;function df(r,e,t,n){let i=t.getMeta(pt),s;if(i)return i.historyState;t.getMeta(gf)&&(r=new je(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(pt))return o.getMeta(pt).redo?new je(r.done.addTransform(t,void 0,n,zn(e)),r.undone,co(t.mapping.maps),r.prevTime,r.prevComposition):new je(r.done,r.undone.addTransform(t,void 0,n,zn(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!pf(t,r.prevRanges)),c=o?Lr(r.prevRanges,t.mapping):co(t.mapping.maps);return new je(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,zn(e)),De.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new je(r.done.rebased(t,s),r.undone.rebased(t,s),Lr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new je(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Lr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function pf(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function co(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Lr(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function mf(r,e,t){let n=zn(e),i=pt.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new je(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(pt,{redo:t,historyState:a})}let zr=!1,ho=null;function zn(r){let e=r.plugins;if(ho!=e){zr=!1,ho=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){zr=!0;break}}return zr}const pt=new dl("history"),gf=new dl("closeHistory");function yf(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new ce({key:pt,state:{init(){return new je(De.empty,De.empty,null,0,-1)},apply(e,t,n){return df(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Bn:n=="historyRedo"?tn:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function aa(r,e){return(t,n)=>{let i=pt.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=mf(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const Bn=aa(!1,!0),tn=aa(!0,!0),uo=r=>typeof r=="function",ir=(r,e,t)=>[r,e,t];class Pi{constructor(e,t,n){this.view=e,this.rte=t,this.props=n,this.bindings=[]}evalProp(e){return uo(e)?e(this):e}bindProp(e,t){if(e!==void 0)if(uo(e)){const n=()=>t(e(this));this.bindings.push(n),n()}else t(e)}updateBindings(){for(const e of this.bindings)e()}bindToEl(e,t={},n=[],i=[]){for(const s in t)this.bindProp(t[s],o=>{e[s]=o});for(const[s,o,l]of n)o&&e.addEventListener(s,l(o));for(const s of i)e.appendChild(s)}}const Ne=(r,e)=>{const t=document.createElement("div");return r.bindToEl(t,{className:e.className,slot:e.slot},[],e.children),t},bf=(r,e)=>{const t=document.createElement("a");return r.bindToEl(t,{href:e.href,target:e.target,rel:e.rel,className:e.className},[],e.children),t},ca=new WeakMap,ha=(r,e)=>{const t=r.rte.createComponent(vo.Tooltip);t.setAttribute("exportparts","vvd-theme-alternate"),r.bindToEl(t,{className:"ui-tooltip",text:e.label,placement:r.props.popupPlacement}),r.bindProp(e.enabled,i=>{i||(t.open=!1),t.anchor=i?e.anchor:void 0});const n=Ne(r,{className:"ui-tooltip-wrapper",slot:e.slot,children:[e.anchor,t]});return ca.set(n,e.anchor),n},q=(r,e)=>{const t=()=>r.evalProp(e.variant)??"toolbar",n=()=>t()==="toolbar"?"super-condensed":"condensed",i=()=>t()==="popover-primary"?"outlined":"ghost-light",s=()=>r.evalProp(e.active)?"filled":i(),o=r.rte.createComponent(Ao.Button);return r.bindToEl(o,{size:n,appearance:s,disabled:e.disabled,icon:e.icon,autofocus:e.autofocus,connotation:e.connotation,[e.icon?"ariaLabel":"label"]:e.label},[ir("click",e.onClick,l=>()=>{l()||r.view.focus()})]),ha(r,{enabled:()=>!!(r.evalProp(e.icon)&&!r.evalProp(e.noTooltip)&&!r.evalProp(e.disabled)),label:e.label,anchor:o,slot:e.slot})},Fi=(r,e)=>{const t=r.rte.createComponent(Io.Menu);r.bindToEl(t,{className:"ui-menu",autoDismiss:!0,ariaLabel:e.label,anchor:ca.get(e.trigger)??e.trigger,placement:r.props.popupPlacement},[],e.children);const n=document.createDocumentFragment();return n.appendChild(e.trigger),n.appendChild(t),n},kf=(r,e)=>{const t=r.rte.createComponent(Ro.MenuItem);return r.bindToEl(t,{text:e.text,checked:e.checked,disabled:e.disabled,controlType:"radio",checkedAppearance:"tick-only"},[ir("change",e.onSelect,n=>()=>{t.checked&&!t.disabled&&r.evalProp(e.checked)!==t.checked&&(n(),r.view.focus())})]),t},Sf=(r,e)=>Ne(r,{className:"ui-button-group",children:e.children});function xf(r,e){const{from:t,$from:n,to:i,empty:s}=r.selection;return s?!!e.isInSet(r.storedMarks||n.marks()):r.doc.rangeHasMark(t,i,e)}const bn=(r,e)=>q(r,{label:e.label,icon:e.icon,active:()=>xf(r.view.state,e.markType),disabled:()=>!Je(e.markType)(r.view.state),onClick:()=>{Je(e.markType)(r.view.state,r.view.dispatch)}}),Tf=(r,e)=>{const t=r.rte.createComponent(Do.ListboxOption);return r.bindToEl(t,{value:e.value,text:e.text,disabled:e.disabled}),t},Cf=(r,e)=>{const t=r.rte.createComponent(No.Select);t.setAttribute("data-class","ui-select"),r.bindToEl(t,{placeholder:" ",ariaLabel:e.label,scale:"condensed",appearance:"ghost"},[ir("change",e.onSelect,i=>()=>{const s=t.value;s&&(i(s),r.view.focus())})],e.children),queueMicrotask(()=>{r.bindProp(e.value,i=>t.value=i)});let n=!1;return t.addEventListener("vwc-popup:open",()=>{n=!0,r.updateBindings()}),t.addEventListener("vwc-popup:close",()=>{n=!1,r.updateBindings()}),ha(r,{enabled:()=>!n,label:e.label,anchor:t})},ci=r=>{const e=r.rte.createComponent(Ja.Divider);return r.bindToEl(e,{className:"ui-divider",orientation:"vertical"}),e},fo=(r,e)=>{const t=r.rte.createComponent(Po.TextField);return r.bindToEl(t,{label:e.label,value:e.value,placeholder:e.placeholder,slot:e.slot,autofocus:e.autofocus,type:e.type},[ir("input",e.onInput,n=>()=>{n(t.value)})]),t},po=(r,e)=>{const t=document.createTextNode("");return r.bindToEl(t,{textContent:e.text}),t},wf=(r,e)=>{const t=document.createElement("slot");t.name=e.name;let n=null;const i=[];function s(){for(const{el:a,type:c,handler:h}of i)a.removeEventListener(c,h);i.length=0,n=null}for(const[a,c]of Object.entries(e.assignedProps))r.bindProp(c,h=>{n&&(n[a]=h)});function o(a){for(const[c,h]of Object.entries(e.assignedProps))a[c]=r.evalProp(h);for(const[c,h]of Object.entries(e.assignedEvents)){const u=f=>{h(f),r.view.focus()};a.addEventListener(c,u),i.push({el:a,type:c,handler:u})}}const l=()=>{const c=t.assignedElements({flatten:!0})[0];c!==n&&(s(),c&&(n=c,o(c)))};return t.addEventListener("slotchange",l),queueMicrotask(l),t};class Mf extends ${constructor(){super(...arguments),this.name="RteHistoryFeature"}getPlugins(){return[this.contribution(yf()),this.contribution(Me({"Mod-z":Bn,"Ctrl-y":tn,"Cmd-Z":tn}))]}getToolbarItems(){return[this.contribution({section:"history",render:e=>q(e,{label:t=>t.rte.getLocale().richTextEditor.undo,icon:"undo-line",disabled:t=>!Bn(t.view.state),onClick:()=>{const{state:t,dispatch:n}=e.view;Bn(t,n)}})},1),this.contribution({section:"history",render:e=>q(e,{label:t=>t.rte.getLocale().richTextEditor.redo,icon:"redo-line",disabled:t=>!tn(t.view.state),onClick:()=>{const{state:t,dispatch:n}=e.view;tn(t,n)}})},2)]}}class Of extends ${constructor(){super(...arguments),this.name="RteForeignHtmlFeature"}getPlugins(e){return[this.contribution(new ce({props:{transformPastedHTML:t=>e.foreignHtmlParser[A].transform(t),clipboardParser:e.foreignHtmlParser[A].parser,clipboardSerializer:e.foreignHtmlSerializer[A].serializer}}))]}}const ln=new ce({state:{init(){return null},apply(r,e){const t=r.getMeta(ln);return t||e}}});class ua extends ${constructor(){super(...arguments),this.name="RteCore"}getStyles(){return[this.contribution(Yu),this.contribution(af),this.contribution(lf)]}getPlugins(e){return[this.contribution(Me({...ju,Enter:rr(Zl,Ql,ea,ta((t,n,i)=>n?{type:oa(i.node(i.depth-1).contentMatchAt(i.indexAfter(i.depth-1))),attrs:e.textblockAttrs.extractFromNode(t)}:{type:t.type,attrs:t.attrs}))})),this.contribution(Xu()),this.contribution(tf()),this.contribution(ln)]}getFeatures(){return[this,new Mf,new Of]}}H(ua);const Ef="h1,h2,h3,p{all:unset;display:block}h1:first-child,h2:first-child,h3:first-child,p:first-child{margin-block-start:0}h1:last-child,h2:last-child,h3:last-child,p:last-child{margin-block-end:0}p{font:var(--vvd-typography-base);line-height:20px;margin-block:16px}.heading-step-1{font:var(--vvd-typography-heading-4);line-height:28px;margin-block:24px 12px}.heading-step-2{font:var(--vvd-typography-heading-3);line-height:36px;margin-block:24px 12px}.heading-step-3{font:var(--vvd-typography-heading-2);line-height:42px;margin-block:32px 16px}";class fa extends ${constructor(e){super(),this.enabledBlocks=e,this.name="RteBasicTextBlocks"}getStyles(){return[this.contribution(Ef)]}getSchema(e,t){const n={};this.enabledBlocks.paragraph&&(n.paragraph={group:"block",content:"inline*",attrs:{...e.attrs},parseDOM:[{tag:"p",getAttrs:s=>e.fromDOM(s)}],marks:t.getAllowedMarksForNode("paragraph").join(" "),toDOM(s){return["p",{part:"node--paragraph",...e.getDOMAttrsProperties(s)},0]},serializeToDOM(s){return["p",...e.getDOMAttrs(s),0]}});let i=0;for(const s of[3,2,1]){const o=`heading${s}`,l=`h${s}`;if(!this.enabledBlocks[o])continue;i++;const a=i;n[o]={group:"block",content:"inline*",attrs:{...e.attrs},parseDOM:[{tag:l,getAttrs:c=>e.fromDOM(c)}],marks:t.getAllowedMarksForNode(o).join(" "),defining:!0,toDOM(c){return[l,{class:`heading-step-${a}`,part:`node--${o}`,...e.getDOMAttrsProperties(c)},0]},serializeToDOM(c){return[l,...e.getDOMAttrs(c),0]}}}return[this.contribution({nodes:n})]}getPlugins(e){const t={};this.enabledBlocks.paragraph&&(t["Mod-Alt-0"]=this.setBlockType(e,"paragraph"));for(const n of[1,2,3]){const i=`heading${n}`;this.enabledBlocks[i]&&(t[`Mod-Alt-${n}`]=this.setBlockType(e,i))}return[this.contribution(Me(t))]}getCurrentBlockType(e){const{$from:t,$to:n}=e.selection,i=t.depth===0?e.doc.childAfter(t.pos).node:t.node(1),s=n.depth===0?e.doc.childBefore(n.pos).node:n.node(1);return i!==s||!(i.type.name in this.enabledBlocks)?null:i.type.name}setBlockType(e,t){return(n,i)=>{const{from:s,to:o}=n.selection,l=n.tr;let a=!1;return n.doc.nodesBetween(s,o,(c,h)=>(c.type.name in this.enabledBlocks&&(a=!0,l.setBlockType(h,h+c.nodeSize,n.schema.nodes[t],u=>e.textblockAttrs.extractFromNode(u))),!1)),a?(i?.(l),!0):!1}}}class da extends ${constructor(e){super(),this.config=e,this.name="RteBase"}getSchema(){return[this.contribution({nodes:{doc:{content:"block+"},text:{group:"inline"}}})]}getFeatures(){return[this,new ua,new fa({heading1:this.config?.heading1??!1,heading2:this.config?.heading2??!1,heading3:this.config?.heading3??!1,paragraph:this.config?.paragraph??!0})]}}const Nf=H(da);var Df=Object.defineProperty,Af=Object.getOwnPropertyDescriptor,Wt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Af(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Df(e,t,i),i};const vf=r=>{const e=r.tagFor(Gr.Popup);return me.html`<${e}
11
11
  :anchor="${t=>t.anchorEl}"
12
12
  :placementStrategy="${()=>Gr.PlacementStrategy.AutoPlacementHorizontal}"
13
13
  :open="${t=>t.open}"
@@ -16,7 +16,7 @@
16
16
  exportparts="vvd-theme-alternate"
17
17
  >
18
18
  <slot></slot>
19
- </${e}>`};class Fe extends me.VividElement{constructor(){super(...arguments),this.anchorBlocksPopover=!1,this.onAnchorBlockPopoverChanged=()=>{this.anchorBlocksPopover=this.anchorEl?.dataset.blockPopover==="true"||!1},this.requestedOpenState=!1}static setBlockPopover(e,t){e.dataset.blockPopover=t?"true":"false";const n=new CustomEvent("block-popover-changed",{bubbles:!1,composed:!1});e.dispatchEvent(n)}anchorElChanged(e,t){e?.removeEventListener("block-popover-changed",this.onAnchorBlockPopoverChanged),t?.addEventListener("block-popover-changed",this.onAnchorBlockPopoverChanged),this.onAnchorBlockPopoverChanged()}anchorIdChanged(){this.updateAnchor()}updateAnchor(){this.anchorId&&this.isConnected?this.anchorEl=this.getRootNode().getElementById(this.anchorId)||void 0:this.anchorEl=void 0}requestOpenState(e){this.requestedOpenState=e}get open(){return this.requestedOpenState&&!!this.anchorEl&&!this.anchorBlocksPopover}#e;connectedCallback(){super.connectedCallback(),this.updateAnchor(),this.#e=new MutationObserver(e=>{e.some(t=>Array.from(t.addedNodes).some(n=>n instanceof HTMLElement&&n.id===this.anchorId))&&this.updateAnchor()}),this.#e.observe(this.getRootNode(),{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}}Wt([me.observable],Fe.prototype,"offset",2);Wt([me.observable],Fe.prototype,"anchorBlocksPopover",2);Wt([me.observable],Fe.prototype,"anchorEl",2);Wt([me.observable],Fe.prototype,"anchorId",2);Wt([me.observable],Fe.prototype,"requestedOpenState",2);Wt([me.volatile],Fe.prototype,"open",1);const If=me.defineVividComponent("popover",Fe,vf,[Gr.popupDefinition],{}),Rf=".link-popover{display:flex;flex-direction:column;padding:16px;gap:8px;inline-size:450px}.link-popover-header{display:flex;align-items:center;justify-content:space-between}.link-popover-label{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.link-popover-content{display:flex;flex-direction:column;gap:16px}.link,.editor a[href],.link:visited,.editor a[href]:visited{color:var(--vvd-color-cta-600)}.link:hover,.editor a[href]:hover{color:var(--vvd-color-cta-500)}.link:active,.editor a[href]:active{color:var(--vvd-color-cta-400)}.link-action-bar{display:flex;justify-content:end;gap:8px}.link-toolbar-menu{display:flex;flex-direction:column;padding:8px;gap:16px;inline-size:368px}";class pa extends ${constructor(){super(...arguments),this.name="RteLinkFeature",this.removeLink=(e,t)=>{const n=e.tr,i=this.getCurrentLink(e);return n.removeMark(i.start,i.end,e.schema.marks.link),t?.(n.scrollIntoView()),!0}}getStyles(){return[this.contribution(Rf)]}getSchema(){return[this.contribution({marks:{link:{attrs:{href:{validate:"string"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(e){return{href:e.getAttribute("href")}}}],toDOM(e){const{href:t}=e.attrs;return["a",{href:t},0]}}}})]}getTextblockMarks(){return[this.contribution({markName:"link"})]}getPlugins(e){return[this.contribution(new ce({props:{decorations:t=>{const n=this.getCurrentLink(t);if(n){const i=ie.inline(n.start,n.end,{id:"current-link"});return P.create(t.doc,[i])}return null}},view:t=>{const n=new Pi(t,e,{popupPlacement:"bottom"}),i=e.createComponent(Fe);i.anchorId="current-link";const s=Ne(n,{className:"link-popover",children:[Ne(n,{className:"link-popover-header",children:[Ne(n,{className:"link-popover-label",children:[po(n,{text:()=>n.rte.getLocale().richTextEditor.clickHere})]}),q(n,{icon:"close-line",label:()=>n.rte.getLocale().richTextEditor.close,noTooltip:!0,onClick:()=>{i.requestOpenState(!1)}})]}),Ne(n,{className:"link-popover-content",children:[bf(n,{className:"link",href:()=>this.getCurrentLink(n.view.state)?.href||"",target:"_blank",rel:"noopener",children:[po(n,{text:()=>this.getCurrentLink(n.view.state)?.href||""})]}),Ne(n,{className:"link-action-bar",children:[q(n,{icon:"delete-line",label:()=>n.rte.getLocale().richTextEditor.delete,connotation:"alert",variant:"popover",noTooltip:!0,onClick:()=>{const{state:o,dispatch:l}=n.view;this.removeLink(o,l)}}),q(n,{icon:"edit-line",label:()=>n.rte.getLocale().richTextEditor.edit,variant:"popover",noTooltip:!0,onClick:()=>(this.toolbarMenu.open=!0,i.requestOpenState(!1),!0)})]})]})]});return i.appendChild(s),t.dom.getRootNode().querySelector(".popovers").appendChild(i),{update:o=>{const l=o.state;n.updateBindings();const a=this.getCurrentLink(l);i.requestOpenState(!!a)},destroy:()=>{i.remove()}}}}))]}getToolbarItems(e){const t=i=>{const{from:s,to:o}=i.selection;return s===o?"":i.doc.textBetween(s,o," ")},n=i=>{try{return new URL(i),!0}catch{return!1}};return[this.contribution({section:"insert",render:i=>{const s=fo(i,{label:()=>i.rte.getLocale().richTextEditor.linkText,placeholder:()=>i.rte.getLocale().richTextEditor.linkTextPlaceholder,slot:"header",autofocus:!0,value:()=>this.getCurrentLink(i.view.state)?.text||t(i.view.state)||"",onInput:()=>{a()}}),o=fo(i,{label:()=>i.rte.getLocale().richTextEditor.linkUrl,type:"url",placeholder:()=>i.rte.getLocale().richTextEditor.linkUrlPlaceholder,slot:"header",value:()=>this.getCurrentLink(i.view.state)?.href||"",onInput:()=>{a()}}),l=q(i,{label:()=>i.rte.getLocale().richTextEditor.apply,variant:"popover-primary",disabled:()=>{const h=this.getCurrentLink(i.view.state);return!(h&&h.text.length&&n(h.href))},onClick:()=>{const{state:h,dispatch:u}=i.view;this.insertLink(e,o.value,s.value)(h,u)}}),a=()=>{l.querySelector('[data-vvd-component="button"]').disabled=!(s.value.length&&n(o.value))},c=Fi(i,{label:()=>i.rte.getLocale().richTextEditor.hyperlink,trigger:q(i,{label:()=>i.rte.getLocale().richTextEditor.hyperlink,icon:"link-line"}),children:[Ne(i,{className:"link-toolbar-menu",slot:"header",children:[s,o,Ne(i,{className:"link-action-bar",slot:"header",children:[q(i,{label:()=>i.rte.getLocale().richTextEditor.cancel,variant:"popover",onClick:()=>{this.toolbarMenu.open=!1}}),l]})]})]});return this.toolbarMenu=c.lastElementChild,c}},1)]}getCurrentLink(e){const t=e.selection;if(!(t instanceof O&&t.empty))return null;const{$from:n}=t,s=e.schema.marks.link.isInSet(n.marks());if(!s)return null;const o=n.parent.childAfter(n.parentOffset),l=n.pos-n.parentOffset+o.offset,a=l+o.node.nodeSize;return{text:o.node.text,href:s.attrs.href,start:l,end:a}}insertLink(e,t,n){return(i,s)=>{let{from:o,to:l}=i.selection;const a=i.tr,c=this.getCurrentLink(i);return c&&(o=c.start,l=c.end),a.insertText(n,o,l),a.addMark(o,o+n.length,e.schema.marks.link.create({href:t})),s?.(a.scrollIntoView()),!0}}}const Pf=H(pa),Ff=".toolbar{display:flex;flex-wrap:wrap;align-items:center;padding:4px;background-color:var(--vvd-color-neutral-50);gap:8px}";class ma extends ${constructor(e){super(),this.config=e,this.name="RteToolbarFeature"}getStyles(){return[this.contribution(Ff)]}getPlugins(e){const t=["history","font","text-style","textblock","insert"],n=new Map(t.map(i=>[i,[]]));for(const i of Ft(e.features.flatMap(s=>s.getToolbarItems(e))))n.get(i.section).push(i);return[this.contribution(new ce({view:i=>{const s=new Pi(i,e,{popupPlacement:this.config?.popupDirection==="outward"?"bottom":"top"}),o=i.dom.getRootNode().querySelector(".toolbar");let l=!1;for(const a of t){const c=n.get(a);c.length&&l&&(o.appendChild(ci(s)),l=!1);for(const h of c)o.appendChild(h.render(s)),l=!0}return{update(){s.updateBindings()},destroy(){o.innerHTML=""}}}}))]}}const Lf=H(ma);class zf{constructor(e){this[A]=new Bf(e)}instantiateEditor(e){return new cd(this,e)}}class Bf{constructor(e){const t=s=>s.flatMap(o=>o.getFeatures().flatMap(l=>l===o?o:t([l])));this.features=t(e.map(s=>s[A])),this.featureMap=new Map;for(const s of this.features){const o=s.constructor;if(this.featureMap.has(o))throw new Error(`Duplicate feature: ${o.name}`);this.featureMap.set(o,s)}if(!this.featureMap.has(da))throw new Error("RteBase feature is required");if(this.featureMap.has(pa)&&!this.featureMap.has(ma))throw new Error("RteToolbarFeature is required for RteLinkFeature");this.textblockAttrs=new Cu(Ft(this.features.flatMap(s=>s.getTextblockAttrs()))),this.textblockMarks=new wu(Ft(this.features.flatMap(s=>s.getTextblockMarks())));const n=Ft(this.features.flatMap(s=>s.getSchema(this.textblockAttrs,this.textblockMarks))),i={nodes:{},marks:{}};for(const s of n)Object.assign(i.nodes,s.nodes??{}),Object.assign(i.marks,s.marks??{});for(const s of this.textblockMarks.getReferencedNodeNames())if(!(s in i.nodes))throw new Error(`Unknown node "${s}"`);this.schema=new Xo(i)}}/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:ga,setPrototypeOf:mo,isFrozen:_f,getPrototypeOf:Vf,getOwnPropertyDescriptor:Hf}=Object;let{freeze:de,seal:we,create:hi}=Object,{apply:ui,construct:fi}=typeof Reflect<"u"&&Reflect;de||(de=function(e){return e});we||(we=function(e){return e});ui||(ui=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});fi||(fi=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const vn=pe(Array.prototype.forEach),Wf=pe(Array.prototype.lastIndexOf),go=pe(Array.prototype.pop),Kt=pe(Array.prototype.push),Uf=pe(Array.prototype.splice),_n=pe(String.prototype.toLowerCase),Br=pe(String.prototype.toString),_r=pe(String.prototype.match),Gt=pe(String.prototype.replace),qf=pe(String.prototype.indexOf),Jf=pe(String.prototype.trim),Ee=pe(Object.prototype.hasOwnProperty),ae=pe(RegExp.prototype.test),jt=$f(TypeError);function pe(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ui(r,e,n)}}function $f(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return fi(r,t)}}function M(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_n;mo&&mo(r,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=t(i);s!==i&&(_f(e)||(e[n]=s),i=s)}r[i]=!0}return r}function Kf(r){for(let e=0;e<r.length;e++)Ee(r,e)||(r[e]=null);return r}function Ve(r){const e=hi(null);for(const[t,n]of ga(r))Ee(r,t)&&(Array.isArray(n)?e[t]=Kf(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Ve(n):e[t]=n);return e}function Yt(r,e){for(;r!==null;){const n=Hf(r,e);if(n){if(n.get)return pe(n.get);if(typeof n.value=="function")return pe(n.value)}r=Vf(r)}function t(){return null}return t}const yo=de(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Vr=de(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hr=de(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Gf=de(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wr=de(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jf=de(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=de(["#text"]),ko=de(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ur=de(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),So=de(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),In=de(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yf=we(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xf=we(/<%[\w\W]*|[\w\W]*%>/gm),Zf=we(/\$\{[\w\W]*/gm),Qf=we(/^data-[\-\w.\u00B7-\uFFFF]+$/),ed=we(/^aria-[\-\w]+$/),ya=we(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),td=we(/^(?:\w+script|data):/i),nd=we(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ba=we(/^html$/i),rd=we(/^[a-z][.\w]*(-[.\w]+)+$/i);var xo=Object.freeze({__proto__:null,ARIA_ATTR:ed,ATTR_WHITESPACE:nd,CUSTOM_ELEMENT:rd,DATA_ATTR:Qf,DOCTYPE_NAME:ba,ERB_EXPR:Xf,IS_ALLOWED_URI:ya,IS_SCRIPT_OR_DATA:td,MUSTACHE_EXPR:Yf,TMPLIT_EXPR:Zf});const Xt={element:1,text:3,progressingInstruction:7,comment:8,document:9},id=function(){return typeof window>"u"?null:window},sd=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ka(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:id();const e=T=>ka(T);if(e.version="3.3.0",e.removed=[],!r||!r.document||r.document.nodeType!==Xt.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:a,NodeFilter:c,NamedNodeMap:h=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:p}=r,d=a.prototype,g=Yt(d,"cloneNode"),y=Yt(d,"remove"),C=Yt(d,"nextSibling"),L=Yt(d,"childNodes"),I=Yt(d,"parentNode");if(typeof o=="function"){const T=t.createElement("template");T.content&&T.content.ownerDocument&&(t=T.content.ownerDocument)}let R,Oe="";const{implementation:$e,createNodeIterator:E,createDocumentFragment:B,getElementsByTagName:Q}=t,{importNode:sr}=n;let le=To();e.isSupported=typeof ga=="function"&&typeof I=="function"&&$e&&$e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:or,ERB_EXPR:lr,TMPLIT_EXPR:ar,DATA_ATTR:va,ARIA_ATTR:Ia,IS_SCRIPT_OR_DATA:Ra,ATTR_WHITESPACE:Bi,CUSTOM_ELEMENT:Pa}=xo;let{IS_ALLOWED_URI:_i}=xo,W=null;const Vi=M({},[...yo,...Vr,...Hr,...Wr,...bo]);let K=null;const Hi=M({},[...ko,...Ur,...So,...In]);let z=Object.seal(hi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ut=null,cr=null;const St=Object.seal(hi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Wi=!0,hr=!0,Ui=!1,qi=!0,xt=!1,Sn=!0,st=!1,ur=!1,fr=!1,Tt=!1,xn=!1,Tn=!1,Ji=!0,$i=!1;const Fa="user-content-";let dr=!0,qt=!1,Ct={},wt=null;const Ki=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Gi=null;const ji=M({},["audio","video","img","source","image","track"]);let pr=null;const Yi=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cn="http://www.w3.org/1998/Math/MathML",wn="http://www.w3.org/2000/svg",Le="http://www.w3.org/1999/xhtml";let Mt=Le,mr=!1,gr=null;const La=M({},[Cn,wn,Le],Br);let Mn=M({},["mi","mo","mn","ms","mtext"]),On=M({},["annotation-xml"]);const za=M({},["title","style","font","a","script"]);let Jt=null;const Ba=["application/xhtml+xml","text/html"],_a="text/html";let U=null,Ot=null;const Va=t.createElement("form"),Xi=function(m){return m instanceof RegExp||m instanceof Function},yr=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===m)){if((!m||typeof m!="object")&&(m={}),m=Ve(m),Jt=Ba.indexOf(m.PARSER_MEDIA_TYPE)===-1?_a:m.PARSER_MEDIA_TYPE,U=Jt==="application/xhtml+xml"?Br:_n,W=Ee(m,"ALLOWED_TAGS")?M({},m.ALLOWED_TAGS,U):Vi,K=Ee(m,"ALLOWED_ATTR")?M({},m.ALLOWED_ATTR,U):Hi,gr=Ee(m,"ALLOWED_NAMESPACES")?M({},m.ALLOWED_NAMESPACES,Br):La,pr=Ee(m,"ADD_URI_SAFE_ATTR")?M(Ve(Yi),m.ADD_URI_SAFE_ATTR,U):Yi,Gi=Ee(m,"ADD_DATA_URI_TAGS")?M(Ve(ji),m.ADD_DATA_URI_TAGS,U):ji,wt=Ee(m,"FORBID_CONTENTS")?M({},m.FORBID_CONTENTS,U):Ki,Ut=Ee(m,"FORBID_TAGS")?M({},m.FORBID_TAGS,U):Ve({}),cr=Ee(m,"FORBID_ATTR")?M({},m.FORBID_ATTR,U):Ve({}),Ct=Ee(m,"USE_PROFILES")?m.USE_PROFILES:!1,Wi=m.ALLOW_ARIA_ATTR!==!1,hr=m.ALLOW_DATA_ATTR!==!1,Ui=m.ALLOW_UNKNOWN_PROTOCOLS||!1,qi=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=m.SAFE_FOR_TEMPLATES||!1,Sn=m.SAFE_FOR_XML!==!1,st=m.WHOLE_DOCUMENT||!1,Tt=m.RETURN_DOM||!1,xn=m.RETURN_DOM_FRAGMENT||!1,Tn=m.RETURN_TRUSTED_TYPE||!1,fr=m.FORCE_BODY||!1,Ji=m.SANITIZE_DOM!==!1,$i=m.SANITIZE_NAMED_PROPS||!1,dr=m.KEEP_CONTENT!==!1,qt=m.IN_PLACE||!1,_i=m.ALLOWED_URI_REGEXP||ya,Mt=m.NAMESPACE||Le,Mn=m.MATHML_TEXT_INTEGRATION_POINTS||Mn,On=m.HTML_INTEGRATION_POINTS||On,z=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&Xi(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&Xi(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xt&&(hr=!1),xn&&(Tt=!0),Ct&&(W=M({},bo),K=[],Ct.html===!0&&(M(W,yo),M(K,ko)),Ct.svg===!0&&(M(W,Vr),M(K,Ur),M(K,In)),Ct.svgFilters===!0&&(M(W,Hr),M(K,Ur),M(K,In)),Ct.mathMl===!0&&(M(W,Wr),M(K,So),M(K,In))),m.ADD_TAGS&&(typeof m.ADD_TAGS=="function"?St.tagCheck=m.ADD_TAGS:(W===Vi&&(W=Ve(W)),M(W,m.ADD_TAGS,U))),m.ADD_ATTR&&(typeof m.ADD_ATTR=="function"?St.attributeCheck=m.ADD_ATTR:(K===Hi&&(K=Ve(K)),M(K,m.ADD_ATTR,U))),m.ADD_URI_SAFE_ATTR&&M(pr,m.ADD_URI_SAFE_ATTR,U),m.FORBID_CONTENTS&&(wt===Ki&&(wt=Ve(wt)),M(wt,m.FORBID_CONTENTS,U)),dr&&(W["#text"]=!0),st&&M(W,["html","head","body"]),W.table&&(M(W,["tbody"]),delete Ut.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=m.TRUSTED_TYPES_POLICY,Oe=R.createHTML("")}else R===void 0&&(R=sd(p,i)),R!==null&&typeof Oe=="string"&&(Oe=R.createHTML(""));de&&de(m),Ot=m}},Zi=M({},[...Vr,...Hr,...Gf]),Qi=M({},[...Wr,...jf]),Ha=function(m){let k=I(m);(!k||!k.tagName)&&(k={namespaceURI:Mt,tagName:"template"});const x=_n(m.tagName),v=_n(k.tagName);return gr[m.namespaceURI]?m.namespaceURI===wn?k.namespaceURI===Le?x==="svg":k.namespaceURI===Cn?x==="svg"&&(v==="annotation-xml"||Mn[v]):!!Zi[x]:m.namespaceURI===Cn?k.namespaceURI===Le?x==="math":k.namespaceURI===wn?x==="math"&&On[v]:!!Qi[x]:m.namespaceURI===Le?k.namespaceURI===wn&&!On[v]||k.namespaceURI===Cn&&!Mn[v]?!1:!Qi[x]&&(za[x]||!Zi[x]):!!(Jt==="application/xhtml+xml"&&gr[m.namespaceURI]):!1},Ae=function(m){Kt(e.removed,{element:m});try{I(m).removeChild(m)}catch{y(m)}},ot=function(m,k){try{Kt(e.removed,{attribute:k.getAttributeNode(m),from:k})}catch{Kt(e.removed,{attribute:null,from:k})}if(k.removeAttribute(m),m==="is")if(Tt||xn)try{Ae(k)}catch{}else try{k.setAttribute(m,"")}catch{}},es=function(m){let k=null,x=null;if(fr)m="<remove></remove>"+m;else{const _=_r(m,/^[\r\n\t ]+/);x=_&&_[0]}Jt==="application/xhtml+xml"&&Mt===Le&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const v=R?R.createHTML(m):m;if(Mt===Le)try{k=new f().parseFromString(v,Jt)}catch{}if(!k||!k.documentElement){k=$e.createDocument(Mt,"template",null);try{k.documentElement.innerHTML=mr?Oe:v}catch{}}const ee=k.body||k.documentElement;return m&&x&&ee.insertBefore(t.createTextNode(x),ee.childNodes[0]||null),Mt===Le?Q.call(k,st?"html":"body")[0]:st?k.documentElement:ee},ts=function(m){return E.call(m.ownerDocument||m,m,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},br=function(m){return m instanceof u&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof h)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},ns=function(m){return typeof l=="function"&&m instanceof l};function ze(T,m,k){vn(T,x=>{x.call(e,m,k,Ot)})}const rs=function(m){let k=null;if(ze(le.beforeSanitizeElements,m,null),br(m))return Ae(m),!0;const x=U(m.nodeName);if(ze(le.uponSanitizeElement,m,{tagName:x,allowedTags:W}),Sn&&m.hasChildNodes()&&!ns(m.firstElementChild)&&ae(/<[/\w!]/g,m.innerHTML)&&ae(/<[/\w!]/g,m.textContent)||m.nodeType===Xt.progressingInstruction||Sn&&m.nodeType===Xt.comment&&ae(/<[/\w]/g,m.data))return Ae(m),!0;if(!(St.tagCheck instanceof Function&&St.tagCheck(x))&&(!W[x]||Ut[x])){if(!Ut[x]&&ss(x)&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,x)||z.tagNameCheck instanceof Function&&z.tagNameCheck(x)))return!1;if(dr&&!wt[x]){const v=I(m)||m.parentNode,ee=L(m)||m.childNodes;if(ee&&v){const _=ee.length;for(let ge=_-1;ge>=0;--ge){const Be=g(ee[ge],!0);Be.__removalCount=(m.__removalCount||0)+1,v.insertBefore(Be,C(m))}}}return Ae(m),!0}return m instanceof a&&!Ha(m)||(x==="noscript"||x==="noembed"||x==="noframes")&&ae(/<\/no(script|embed|frames)/i,m.innerHTML)?(Ae(m),!0):(xt&&m.nodeType===Xt.text&&(k=m.textContent,vn([or,lr,ar],v=>{k=Gt(k,v," ")}),m.textContent!==k&&(Kt(e.removed,{element:m.cloneNode()}),m.textContent=k)),ze(le.afterSanitizeElements,m,null),!1)},is=function(m,k,x){if(Ji&&(k==="id"||k==="name")&&(x in t||x in Va))return!1;if(!(hr&&!cr[k]&&ae(va,k))){if(!(Wi&&ae(Ia,k))){if(!(St.attributeCheck instanceof Function&&St.attributeCheck(k,m))){if(!K[k]||cr[k]){if(!(ss(m)&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,m)||z.tagNameCheck instanceof Function&&z.tagNameCheck(m))&&(z.attributeNameCheck instanceof RegExp&&ae(z.attributeNameCheck,k)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(k,m))||k==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,x)||z.tagNameCheck instanceof Function&&z.tagNameCheck(x))))return!1}else if(!pr[k]){if(!ae(_i,Gt(x,Bi,""))){if(!((k==="src"||k==="xlink:href"||k==="href")&&m!=="script"&&qf(x,"data:")===0&&Gi[m])){if(!(Ui&&!ae(Ra,Gt(x,Bi,"")))){if(x)return!1}}}}}}}return!0},ss=function(m){return m!=="annotation-xml"&&_r(m,Pa)},ls=function(m){ze(le.beforeSanitizeAttributes,m,null);const{attributes:k}=m;if(!k||br(m))return;const x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let v=k.length;for(;v--;){const ee=k[v],{name:_,namespaceURI:ge,value:Be}=ee,Et=U(_),kr=Be;let G=_==="value"?kr:Jf(kr);if(x.attrName=Et,x.attrValue=G,x.keepAttr=!0,x.forceKeepAttr=void 0,ze(le.uponSanitizeAttribute,m,x),G=x.attrValue,$i&&(Et==="id"||Et==="name")&&(ot(_,m),G=Fa+G),Sn&&ae(/((--!?|])>)|<\/(style|title|textarea)/i,G)){ot(_,m);continue}if(Et==="attributename"&&_r(G,"href")){ot(_,m);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){ot(_,m);continue}if(!qi&&ae(/\/>/i,G)){ot(_,m);continue}xt&&vn([or,lr,ar],cs=>{G=Gt(G,cs," ")});const as=U(m.nodeName);if(!is(as,Et,G)){ot(_,m);continue}if(R&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!ge)switch(p.getAttributeType(as,Et)){case"TrustedHTML":{G=R.createHTML(G);break}case"TrustedScriptURL":{G=R.createScriptURL(G);break}}if(G!==kr)try{ge?m.setAttributeNS(ge,_,G):m.setAttribute(_,G),br(m)?Ae(m):go(e.removed)}catch{ot(_,m)}}ze(le.afterSanitizeAttributes,m,null)},Wa=function T(m){let k=null;const x=ts(m);for(ze(le.beforeSanitizeShadowDOM,m,null);k=x.nextNode();)ze(le.uponSanitizeShadowNode,k,null),rs(k),ls(k),k.content instanceof s&&T(k.content);ze(le.afterSanitizeShadowDOM,m,null)};return e.sanitize=function(T){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=null,x=null,v=null,ee=null;if(mr=!T,mr&&(T="<!-->"),typeof T!="string"&&!ns(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw jt("dirty is not a string, aborting")}else throw jt("toString is not a function");if(!e.isSupported)return T;if(ur||yr(m),e.removed=[],typeof T=="string"&&(qt=!1),qt){if(T.nodeName){const Be=U(T.nodeName);if(!W[Be]||Ut[Be])throw jt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof l)k=es("<!---->"),x=k.ownerDocument.importNode(T,!0),x.nodeType===Xt.element&&x.nodeName==="BODY"||x.nodeName==="HTML"?k=x:k.appendChild(x);else{if(!Tt&&!xt&&!st&&T.indexOf("<")===-1)return R&&Tn?R.createHTML(T):T;if(k=es(T),!k)return Tt?null:Tn?Oe:""}k&&fr&&Ae(k.firstChild);const _=ts(qt?T:k);for(;v=_.nextNode();)rs(v),ls(v),v.content instanceof s&&Wa(v.content);if(qt)return T;if(Tt){if(xn)for(ee=B.call(k.ownerDocument);k.firstChild;)ee.appendChild(k.firstChild);else ee=k;return(K.shadowroot||K.shadowrootmode)&&(ee=sr.call(n,ee,!0)),ee}let ge=st?k.outerHTML:k.innerHTML;return st&&W["!doctype"]&&k.ownerDocument&&k.ownerDocument.doctype&&k.ownerDocument.doctype.name&&ae(ba,k.ownerDocument.doctype.name)&&(ge="<!DOCTYPE "+k.ownerDocument.doctype.name+`>
19
+ </${e}>`};class Fe extends me.VividElement{constructor(){super(...arguments),this.anchorBlocksPopover=!1,this.onAnchorBlockPopoverChanged=()=>{this.anchorBlocksPopover=this.anchorEl?.dataset.blockPopover==="true"||!1},this.requestedOpenState=!1}static setBlockPopover(e,t){e.dataset.blockPopover=t?"true":"false";const n=new CustomEvent("block-popover-changed",{bubbles:!1,composed:!1});e.dispatchEvent(n)}anchorElChanged(e,t){e?.removeEventListener("block-popover-changed",this.onAnchorBlockPopoverChanged),t?.addEventListener("block-popover-changed",this.onAnchorBlockPopoverChanged),this.onAnchorBlockPopoverChanged()}anchorIdChanged(){this.updateAnchor()}updateAnchor(){this.anchorId&&this.isConnected?this.anchorEl=this.getRootNode().getElementById(this.anchorId)||void 0:this.anchorEl=void 0}requestOpenState(e){this.requestedOpenState=e}get open(){return this.requestedOpenState&&!!this.anchorEl&&!this.anchorBlocksPopover}#e;connectedCallback(){super.connectedCallback(),this.updateAnchor(),this.#e=new MutationObserver(e=>{e.some(t=>Array.from(t.addedNodes).some(n=>n instanceof HTMLElement&&n.id===this.anchorId))&&this.updateAnchor()}),this.#e.observe(this.getRootNode(),{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}}Wt([me.observable],Fe.prototype,"offset",2);Wt([me.observable],Fe.prototype,"anchorBlocksPopover",2);Wt([me.observable],Fe.prototype,"anchorEl",2);Wt([me.observable],Fe.prototype,"anchorId",2);Wt([me.observable],Fe.prototype,"requestedOpenState",2);Wt([me.volatile],Fe.prototype,"open",1);const If=me.defineVividComponent("popover",Fe,vf,[Gr.popupDefinition],{}),Rf=".link-popover{display:flex;flex-direction:column;padding:16px;gap:8px;inline-size:450px}.link-popover-header{display:flex;align-items:center;justify-content:space-between}.link-popover-label{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.link-popover-content{display:flex;flex-direction:column;gap:16px}.link,.editor a[href],.link:visited,.editor a[href]:visited{color:var(--vvd-color-cta-600)}.link:hover,.editor a[href]:hover{color:var(--vvd-color-cta-500)}.link:active,.editor a[href]:active{color:var(--vvd-color-cta-400)}.link-action-bar{display:flex;justify-content:end;gap:8px}.link-toolbar-menu{display:flex;flex-direction:column;padding:8px;gap:16px;inline-size:368px}";class pa extends ${constructor(){super(...arguments),this.name="RteLinkFeature",this.removeLink=(e,t)=>{const n=e.tr,i=this.getCurrentLink(e);return n.removeMark(i.start,i.end,e.schema.marks.link),t?.(n.scrollIntoView()),!0}}getStyles(){return[this.contribution(Rf)]}getSchema(){return[this.contribution({marks:{link:{attrs:{href:{validate:"string"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(e){return{href:e.getAttribute("href")}}}],toDOM(e){const{href:t}=e.attrs;return["a",{href:t},0]}}}})]}getTextblockMarks(){return[this.contribution({markName:"link"})]}getPlugins(e){return[this.contribution(new ce({props:{decorations:t=>{const n=this.getCurrentLink(t);if(n){const i=ie.inline(n.start,n.end,{id:"current-link"});return P.create(t.doc,[i])}return null}},view:t=>{const n=new Pi(t,e,{popupPlacement:"bottom"}),i=e.createComponent(Fe);i.anchorId="current-link";const s=Ne(n,{className:"link-popover",children:[Ne(n,{className:"link-popover-header",children:[Ne(n,{className:"link-popover-label",children:[po(n,{text:()=>this.getCurrentLink(n.view.state)?.text||""})]}),q(n,{icon:"close-line",label:()=>n.rte.getLocale().richTextEditor.close,noTooltip:!0,onClick:()=>{i.requestOpenState(!1)}})]}),Ne(n,{className:"link-popover-content",children:[bf(n,{className:"link",href:()=>this.getCurrentLink(n.view.state)?.href||"",target:"_blank",rel:"noopener",children:[po(n,{text:()=>this.getCurrentLink(n.view.state)?.href||""})]}),Ne(n,{className:"link-action-bar",children:[q(n,{icon:"delete-line",label:()=>n.rte.getLocale().richTextEditor.delete,connotation:"alert",variant:"popover",noTooltip:!0,onClick:()=>{const{state:o,dispatch:l}=n.view;this.removeLink(o,l)}}),q(n,{icon:"edit-line",label:()=>n.rte.getLocale().richTextEditor.edit,variant:"popover",noTooltip:!0,onClick:()=>(this.toolbarMenu.open=!0,i.requestOpenState(!1),!0)})]})]})]});return i.appendChild(s),t.dom.getRootNode().querySelector(".popovers").appendChild(i),{update:o=>{const l=o.state;n.updateBindings();const a=this.getCurrentLink(l);i.requestOpenState(!!a)},destroy:()=>{i.remove()}}}}))]}getToolbarItems(e){const t=i=>{const{from:s,to:o}=i.selection;return s===o?"":i.doc.textBetween(s,o," ")},n=i=>{try{return new URL(i),!0}catch{return!1}};return[this.contribution({section:"insert",render:i=>{const s=fo(i,{label:()=>i.rte.getLocale().richTextEditor.linkText,placeholder:()=>i.rte.getLocale().richTextEditor.linkTextPlaceholder,slot:"header",autofocus:!0,value:()=>this.getCurrentLink(i.view.state)?.text||t(i.view.state)||"",onInput:()=>{a()}}),o=fo(i,{label:()=>i.rte.getLocale().richTextEditor.linkUrl,type:"url",placeholder:()=>i.rte.getLocale().richTextEditor.linkUrlPlaceholder,slot:"header",value:()=>this.getCurrentLink(i.view.state)?.href||"",onInput:()=>{a()}}),l=q(i,{label:()=>i.rte.getLocale().richTextEditor.apply,variant:"popover-primary",disabled:()=>{const h=this.getCurrentLink(i.view.state);return!(h&&h.text.length&&n(h.href))},onClick:()=>{const{state:h,dispatch:u}=i.view;this.insertLink(e,o.value,s.value)(h,u)}}),a=()=>{l.querySelector('[data-vvd-component="button"]').disabled=!(s.value.length&&n(o.value))},c=Fi(i,{label:()=>i.rte.getLocale().richTextEditor.hyperlink,trigger:q(i,{label:()=>i.rte.getLocale().richTextEditor.hyperlink,icon:"link-line"}),children:[Ne(i,{className:"link-toolbar-menu",slot:"header",children:[s,o,Ne(i,{className:"link-action-bar",slot:"header",children:[q(i,{label:()=>i.rte.getLocale().richTextEditor.cancel,variant:"popover",onClick:()=>{this.toolbarMenu.open=!1}}),l]})]})]});return this.toolbarMenu=c.lastElementChild,c}},1)]}getCurrentLink(e){const t=e.selection;if(!(t instanceof O&&t.empty))return null;const{$from:n}=t,s=e.schema.marks.link.isInSet(n.marks());if(!s)return null;const o=n.parent.childAfter(n.parentOffset),l=n.pos-n.parentOffset+o.offset,a=l+o.node.nodeSize;return{text:o.node.text,href:s.attrs.href,start:l,end:a}}insertLink(e,t,n){return(i,s)=>{let{from:o,to:l}=i.selection;const a=i.tr,c=this.getCurrentLink(i);return c&&(o=c.start,l=c.end),a.insertText(n,o,l),a.addMark(o,o+n.length,e.schema.marks.link.create({href:t})),s?.(a.scrollIntoView()),!0}}}const Pf=H(pa),Ff=".toolbar{display:flex;flex-wrap:wrap;align-items:center;padding:4px;background-color:var(--vvd-color-neutral-50);gap:8px}";class ma extends ${constructor(e){super(),this.config=e,this.name="RteToolbarFeature"}getStyles(){return[this.contribution(Ff)]}getPlugins(e){const t=["history","font","text-style","textblock","insert"],n=new Map(t.map(i=>[i,[]]));for(const i of Ft(e.features.flatMap(s=>s.getToolbarItems(e))))n.get(i.section).push(i);return[this.contribution(new ce({view:i=>{const s=new Pi(i,e,{popupPlacement:this.config?.popupDirection==="outward"?"bottom":"top"}),o=i.dom.getRootNode().querySelector(".toolbar");let l=!1;for(const a of t){const c=n.get(a);c.length&&l&&(o.appendChild(ci(s)),l=!1);for(const h of c)o.appendChild(h.render(s)),l=!0}return{update(){s.updateBindings()},destroy(){o.innerHTML=""}}}}))]}}const Lf=H(ma);class zf{constructor(e){this[A]=new Bf(e)}instantiateEditor(e){return new cd(this,e)}}class Bf{constructor(e){const t=s=>s.flatMap(o=>o.getFeatures().flatMap(l=>l===o?o:t([l])));this.features=t(e.map(s=>s[A])),this.featureMap=new Map;for(const s of this.features){const o=s.constructor;if(this.featureMap.has(o))throw new Error(`Duplicate feature: ${o.name}`);this.featureMap.set(o,s)}if(!this.featureMap.has(da))throw new Error("RteBase feature is required");if(this.featureMap.has(pa)&&!this.featureMap.has(ma))throw new Error("RteToolbarFeature is required for RteLinkFeature");this.textblockAttrs=new Cu(Ft(this.features.flatMap(s=>s.getTextblockAttrs()))),this.textblockMarks=new wu(Ft(this.features.flatMap(s=>s.getTextblockMarks())));const n=Ft(this.features.flatMap(s=>s.getSchema(this.textblockAttrs,this.textblockMarks))),i={nodes:{},marks:{}};for(const s of n)Object.assign(i.nodes,s.nodes??{}),Object.assign(i.marks,s.marks??{});for(const s of this.textblockMarks.getReferencedNodeNames())if(!(s in i.nodes))throw new Error(`Unknown node "${s}"`);this.schema=new Xo(i)}}/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:ga,setPrototypeOf:mo,isFrozen:_f,getPrototypeOf:Vf,getOwnPropertyDescriptor:Hf}=Object;let{freeze:de,seal:we,create:hi}=Object,{apply:ui,construct:fi}=typeof Reflect<"u"&&Reflect;de||(de=function(e){return e});we||(we=function(e){return e});ui||(ui=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});fi||(fi=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const vn=pe(Array.prototype.forEach),Wf=pe(Array.prototype.lastIndexOf),go=pe(Array.prototype.pop),Kt=pe(Array.prototype.push),Uf=pe(Array.prototype.splice),_n=pe(String.prototype.toLowerCase),Br=pe(String.prototype.toString),_r=pe(String.prototype.match),Gt=pe(String.prototype.replace),qf=pe(String.prototype.indexOf),Jf=pe(String.prototype.trim),Ee=pe(Object.prototype.hasOwnProperty),ae=pe(RegExp.prototype.test),jt=$f(TypeError);function pe(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ui(r,e,n)}}function $f(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return fi(r,t)}}function M(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_n;mo&&mo(r,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=t(i);s!==i&&(_f(e)||(e[n]=s),i=s)}r[i]=!0}return r}function Kf(r){for(let e=0;e<r.length;e++)Ee(r,e)||(r[e]=null);return r}function Ve(r){const e=hi(null);for(const[t,n]of ga(r))Ee(r,t)&&(Array.isArray(n)?e[t]=Kf(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Ve(n):e[t]=n);return e}function Yt(r,e){for(;r!==null;){const n=Hf(r,e);if(n){if(n.get)return pe(n.get);if(typeof n.value=="function")return pe(n.value)}r=Vf(r)}function t(){return null}return t}const yo=de(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Vr=de(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hr=de(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Gf=de(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wr=de(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jf=de(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=de(["#text"]),ko=de(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ur=de(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),So=de(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),In=de(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yf=we(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xf=we(/<%[\w\W]*|[\w\W]*%>/gm),Zf=we(/\$\{[\w\W]*/gm),Qf=we(/^data-[\-\w.\u00B7-\uFFFF]+$/),ed=we(/^aria-[\-\w]+$/),ya=we(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),td=we(/^(?:\w+script|data):/i),nd=we(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ba=we(/^html$/i),rd=we(/^[a-z][.\w]*(-[.\w]+)+$/i);var xo=Object.freeze({__proto__:null,ARIA_ATTR:ed,ATTR_WHITESPACE:nd,CUSTOM_ELEMENT:rd,DATA_ATTR:Qf,DOCTYPE_NAME:ba,ERB_EXPR:Xf,IS_ALLOWED_URI:ya,IS_SCRIPT_OR_DATA:td,MUSTACHE_EXPR:Yf,TMPLIT_EXPR:Zf});const Xt={element:1,text:3,progressingInstruction:7,comment:8,document:9},id=function(){return typeof window>"u"?null:window},sd=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ka(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:id();const e=T=>ka(T);if(e.version="3.3.0",e.removed=[],!r||!r.document||r.document.nodeType!==Xt.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:a,NodeFilter:c,NamedNodeMap:h=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:p}=r,d=a.prototype,g=Yt(d,"cloneNode"),y=Yt(d,"remove"),C=Yt(d,"nextSibling"),L=Yt(d,"childNodes"),I=Yt(d,"parentNode");if(typeof o=="function"){const T=t.createElement("template");T.content&&T.content.ownerDocument&&(t=T.content.ownerDocument)}let R,Oe="";const{implementation:$e,createNodeIterator:E,createDocumentFragment:B,getElementsByTagName:Q}=t,{importNode:sr}=n;let le=To();e.isSupported=typeof ga=="function"&&typeof I=="function"&&$e&&$e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:or,ERB_EXPR:lr,TMPLIT_EXPR:ar,DATA_ATTR:va,ARIA_ATTR:Ia,IS_SCRIPT_OR_DATA:Ra,ATTR_WHITESPACE:Bi,CUSTOM_ELEMENT:Pa}=xo;let{IS_ALLOWED_URI:_i}=xo,W=null;const Vi=M({},[...yo,...Vr,...Hr,...Wr,...bo]);let K=null;const Hi=M({},[...ko,...Ur,...So,...In]);let z=Object.seal(hi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ut=null,cr=null;const St=Object.seal(hi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Wi=!0,hr=!0,Ui=!1,qi=!0,xt=!1,Sn=!0,st=!1,ur=!1,fr=!1,Tt=!1,xn=!1,Tn=!1,Ji=!0,$i=!1;const Fa="user-content-";let dr=!0,qt=!1,Ct={},wt=null;const Ki=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Gi=null;const ji=M({},["audio","video","img","source","image","track"]);let pr=null;const Yi=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cn="http://www.w3.org/1998/Math/MathML",wn="http://www.w3.org/2000/svg",Le="http://www.w3.org/1999/xhtml";let Mt=Le,mr=!1,gr=null;const La=M({},[Cn,wn,Le],Br);let Mn=M({},["mi","mo","mn","ms","mtext"]),On=M({},["annotation-xml"]);const za=M({},["title","style","font","a","script"]);let Jt=null;const Ba=["application/xhtml+xml","text/html"],_a="text/html";let U=null,Ot=null;const Va=t.createElement("form"),Xi=function(m){return m instanceof RegExp||m instanceof Function},yr=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===m)){if((!m||typeof m!="object")&&(m={}),m=Ve(m),Jt=Ba.indexOf(m.PARSER_MEDIA_TYPE)===-1?_a:m.PARSER_MEDIA_TYPE,U=Jt==="application/xhtml+xml"?Br:_n,W=Ee(m,"ALLOWED_TAGS")?M({},m.ALLOWED_TAGS,U):Vi,K=Ee(m,"ALLOWED_ATTR")?M({},m.ALLOWED_ATTR,U):Hi,gr=Ee(m,"ALLOWED_NAMESPACES")?M({},m.ALLOWED_NAMESPACES,Br):La,pr=Ee(m,"ADD_URI_SAFE_ATTR")?M(Ve(Yi),m.ADD_URI_SAFE_ATTR,U):Yi,Gi=Ee(m,"ADD_DATA_URI_TAGS")?M(Ve(ji),m.ADD_DATA_URI_TAGS,U):ji,wt=Ee(m,"FORBID_CONTENTS")?M({},m.FORBID_CONTENTS,U):Ki,Ut=Ee(m,"FORBID_TAGS")?M({},m.FORBID_TAGS,U):Ve({}),cr=Ee(m,"FORBID_ATTR")?M({},m.FORBID_ATTR,U):Ve({}),Ct=Ee(m,"USE_PROFILES")?m.USE_PROFILES:!1,Wi=m.ALLOW_ARIA_ATTR!==!1,hr=m.ALLOW_DATA_ATTR!==!1,Ui=m.ALLOW_UNKNOWN_PROTOCOLS||!1,qi=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=m.SAFE_FOR_TEMPLATES||!1,Sn=m.SAFE_FOR_XML!==!1,st=m.WHOLE_DOCUMENT||!1,Tt=m.RETURN_DOM||!1,xn=m.RETURN_DOM_FRAGMENT||!1,Tn=m.RETURN_TRUSTED_TYPE||!1,fr=m.FORCE_BODY||!1,Ji=m.SANITIZE_DOM!==!1,$i=m.SANITIZE_NAMED_PROPS||!1,dr=m.KEEP_CONTENT!==!1,qt=m.IN_PLACE||!1,_i=m.ALLOWED_URI_REGEXP||ya,Mt=m.NAMESPACE||Le,Mn=m.MATHML_TEXT_INTEGRATION_POINTS||Mn,On=m.HTML_INTEGRATION_POINTS||On,z=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&Xi(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&Xi(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xt&&(hr=!1),xn&&(Tt=!0),Ct&&(W=M({},bo),K=[],Ct.html===!0&&(M(W,yo),M(K,ko)),Ct.svg===!0&&(M(W,Vr),M(K,Ur),M(K,In)),Ct.svgFilters===!0&&(M(W,Hr),M(K,Ur),M(K,In)),Ct.mathMl===!0&&(M(W,Wr),M(K,So),M(K,In))),m.ADD_TAGS&&(typeof m.ADD_TAGS=="function"?St.tagCheck=m.ADD_TAGS:(W===Vi&&(W=Ve(W)),M(W,m.ADD_TAGS,U))),m.ADD_ATTR&&(typeof m.ADD_ATTR=="function"?St.attributeCheck=m.ADD_ATTR:(K===Hi&&(K=Ve(K)),M(K,m.ADD_ATTR,U))),m.ADD_URI_SAFE_ATTR&&M(pr,m.ADD_URI_SAFE_ATTR,U),m.FORBID_CONTENTS&&(wt===Ki&&(wt=Ve(wt)),M(wt,m.FORBID_CONTENTS,U)),dr&&(W["#text"]=!0),st&&M(W,["html","head","body"]),W.table&&(M(W,["tbody"]),delete Ut.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=m.TRUSTED_TYPES_POLICY,Oe=R.createHTML("")}else R===void 0&&(R=sd(p,i)),R!==null&&typeof Oe=="string"&&(Oe=R.createHTML(""));de&&de(m),Ot=m}},Zi=M({},[...Vr,...Hr,...Gf]),Qi=M({},[...Wr,...jf]),Ha=function(m){let k=I(m);(!k||!k.tagName)&&(k={namespaceURI:Mt,tagName:"template"});const x=_n(m.tagName),v=_n(k.tagName);return gr[m.namespaceURI]?m.namespaceURI===wn?k.namespaceURI===Le?x==="svg":k.namespaceURI===Cn?x==="svg"&&(v==="annotation-xml"||Mn[v]):!!Zi[x]:m.namespaceURI===Cn?k.namespaceURI===Le?x==="math":k.namespaceURI===wn?x==="math"&&On[v]:!!Qi[x]:m.namespaceURI===Le?k.namespaceURI===wn&&!On[v]||k.namespaceURI===Cn&&!Mn[v]?!1:!Qi[x]&&(za[x]||!Zi[x]):!!(Jt==="application/xhtml+xml"&&gr[m.namespaceURI]):!1},Ae=function(m){Kt(e.removed,{element:m});try{I(m).removeChild(m)}catch{y(m)}},ot=function(m,k){try{Kt(e.removed,{attribute:k.getAttributeNode(m),from:k})}catch{Kt(e.removed,{attribute:null,from:k})}if(k.removeAttribute(m),m==="is")if(Tt||xn)try{Ae(k)}catch{}else try{k.setAttribute(m,"")}catch{}},es=function(m){let k=null,x=null;if(fr)m="<remove></remove>"+m;else{const _=_r(m,/^[\r\n\t ]+/);x=_&&_[0]}Jt==="application/xhtml+xml"&&Mt===Le&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const v=R?R.createHTML(m):m;if(Mt===Le)try{k=new f().parseFromString(v,Jt)}catch{}if(!k||!k.documentElement){k=$e.createDocument(Mt,"template",null);try{k.documentElement.innerHTML=mr?Oe:v}catch{}}const ee=k.body||k.documentElement;return m&&x&&ee.insertBefore(t.createTextNode(x),ee.childNodes[0]||null),Mt===Le?Q.call(k,st?"html":"body")[0]:st?k.documentElement:ee},ts=function(m){return E.call(m.ownerDocument||m,m,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},br=function(m){return m instanceof u&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof h)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},ns=function(m){return typeof l=="function"&&m instanceof l};function ze(T,m,k){vn(T,x=>{x.call(e,m,k,Ot)})}const rs=function(m){let k=null;if(ze(le.beforeSanitizeElements,m,null),br(m))return Ae(m),!0;const x=U(m.nodeName);if(ze(le.uponSanitizeElement,m,{tagName:x,allowedTags:W}),Sn&&m.hasChildNodes()&&!ns(m.firstElementChild)&&ae(/<[/\w!]/g,m.innerHTML)&&ae(/<[/\w!]/g,m.textContent)||m.nodeType===Xt.progressingInstruction||Sn&&m.nodeType===Xt.comment&&ae(/<[/\w]/g,m.data))return Ae(m),!0;if(!(St.tagCheck instanceof Function&&St.tagCheck(x))&&(!W[x]||Ut[x])){if(!Ut[x]&&ss(x)&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,x)||z.tagNameCheck instanceof Function&&z.tagNameCheck(x)))return!1;if(dr&&!wt[x]){const v=I(m)||m.parentNode,ee=L(m)||m.childNodes;if(ee&&v){const _=ee.length;for(let ge=_-1;ge>=0;--ge){const Be=g(ee[ge],!0);Be.__removalCount=(m.__removalCount||0)+1,v.insertBefore(Be,C(m))}}}return Ae(m),!0}return m instanceof a&&!Ha(m)||(x==="noscript"||x==="noembed"||x==="noframes")&&ae(/<\/no(script|embed|frames)/i,m.innerHTML)?(Ae(m),!0):(xt&&m.nodeType===Xt.text&&(k=m.textContent,vn([or,lr,ar],v=>{k=Gt(k,v," ")}),m.textContent!==k&&(Kt(e.removed,{element:m.cloneNode()}),m.textContent=k)),ze(le.afterSanitizeElements,m,null),!1)},is=function(m,k,x){if(Ji&&(k==="id"||k==="name")&&(x in t||x in Va))return!1;if(!(hr&&!cr[k]&&ae(va,k))){if(!(Wi&&ae(Ia,k))){if(!(St.attributeCheck instanceof Function&&St.attributeCheck(k,m))){if(!K[k]||cr[k]){if(!(ss(m)&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,m)||z.tagNameCheck instanceof Function&&z.tagNameCheck(m))&&(z.attributeNameCheck instanceof RegExp&&ae(z.attributeNameCheck,k)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(k,m))||k==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&ae(z.tagNameCheck,x)||z.tagNameCheck instanceof Function&&z.tagNameCheck(x))))return!1}else if(!pr[k]){if(!ae(_i,Gt(x,Bi,""))){if(!((k==="src"||k==="xlink:href"||k==="href")&&m!=="script"&&qf(x,"data:")===0&&Gi[m])){if(!(Ui&&!ae(Ra,Gt(x,Bi,"")))){if(x)return!1}}}}}}}return!0},ss=function(m){return m!=="annotation-xml"&&_r(m,Pa)},ls=function(m){ze(le.beforeSanitizeAttributes,m,null);const{attributes:k}=m;if(!k||br(m))return;const x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let v=k.length;for(;v--;){const ee=k[v],{name:_,namespaceURI:ge,value:Be}=ee,Et=U(_),kr=Be;let G=_==="value"?kr:Jf(kr);if(x.attrName=Et,x.attrValue=G,x.keepAttr=!0,x.forceKeepAttr=void 0,ze(le.uponSanitizeAttribute,m,x),G=x.attrValue,$i&&(Et==="id"||Et==="name")&&(ot(_,m),G=Fa+G),Sn&&ae(/((--!?|])>)|<\/(style|title|textarea)/i,G)){ot(_,m);continue}if(Et==="attributename"&&_r(G,"href")){ot(_,m);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){ot(_,m);continue}if(!qi&&ae(/\/>/i,G)){ot(_,m);continue}xt&&vn([or,lr,ar],cs=>{G=Gt(G,cs," ")});const as=U(m.nodeName);if(!is(as,Et,G)){ot(_,m);continue}if(R&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!ge)switch(p.getAttributeType(as,Et)){case"TrustedHTML":{G=R.createHTML(G);break}case"TrustedScriptURL":{G=R.createScriptURL(G);break}}if(G!==kr)try{ge?m.setAttributeNS(ge,_,G):m.setAttribute(_,G),br(m)?Ae(m):go(e.removed)}catch{ot(_,m)}}ze(le.afterSanitizeAttributes,m,null)},Wa=function T(m){let k=null;const x=ts(m);for(ze(le.beforeSanitizeShadowDOM,m,null);k=x.nextNode();)ze(le.uponSanitizeShadowNode,k,null),rs(k),ls(k),k.content instanceof s&&T(k.content);ze(le.afterSanitizeShadowDOM,m,null)};return e.sanitize=function(T){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=null,x=null,v=null,ee=null;if(mr=!T,mr&&(T="<!-->"),typeof T!="string"&&!ns(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw jt("dirty is not a string, aborting")}else throw jt("toString is not a function");if(!e.isSupported)return T;if(ur||yr(m),e.removed=[],typeof T=="string"&&(qt=!1),qt){if(T.nodeName){const Be=U(T.nodeName);if(!W[Be]||Ut[Be])throw jt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof l)k=es("<!---->"),x=k.ownerDocument.importNode(T,!0),x.nodeType===Xt.element&&x.nodeName==="BODY"||x.nodeName==="HTML"?k=x:k.appendChild(x);else{if(!Tt&&!xt&&!st&&T.indexOf("<")===-1)return R&&Tn?R.createHTML(T):T;if(k=es(T),!k)return Tt?null:Tn?Oe:""}k&&fr&&Ae(k.firstChild);const _=ts(qt?T:k);for(;v=_.nextNode();)rs(v),ls(v),v.content instanceof s&&Wa(v.content);if(qt)return T;if(Tt){if(xn)for(ee=B.call(k.ownerDocument);k.firstChild;)ee.appendChild(k.firstChild);else ee=k;return(K.shadowroot||K.shadowrootmode)&&(ee=sr.call(n,ee,!0)),ee}let ge=st?k.outerHTML:k.innerHTML;return st&&W["!doctype"]&&k.ownerDocument&&k.ownerDocument.doctype&&k.ownerDocument.doctype.name&&ae(ba,k.ownerDocument.doctype.name)&&(ge="<!DOCTYPE "+k.ownerDocument.doctype.name+`>
20
20
  `+ge),xt&&vn([or,lr,ar],Be=>{ge=Gt(ge,Be," ")}),R&&Tn?R.createHTML(ge):ge},e.setConfig=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yr(T),ur=!0},e.clearConfig=function(){Ot=null,ur=!1},e.isValidAttribute=function(T,m,k){Ot||yr({});const x=U(T),v=U(m);return is(x,v,k)},e.addHook=function(T,m){typeof m=="function"&&Kt(le[T],m)},e.removeHook=function(T,m){if(m!==void 0){const k=Wf(le[T],m);return k===-1?void 0:Uf(le[T],k,1)[0]}return go(le[T])},e.removeHooks=function(T){le[T]=[]},e.removeAllHooks=function(){le=To()},e}var Sa=ka();const Xn=r=>({...r}),od=r=>({nodes:Object.fromEntries(Object.keys(r.nodes).map(e=>[e,(r.nodes[e].spec.parseDOM??[]).map(Xn)])),marks:Object.fromEntries(Object.keys(r.marks).map(e=>[e,(r.marks[e].spec.parseDOM??[]).map(Xn)]))});class xa{constructor(e,t){this[A]=new ld(e[A],t)}parseDocument(e,t){return this[A].parser.parse(this.parseHtml(e,t),{preserveWhitespace:!0}).toJSON()}parseFragment(e,t){return this[A].parser.parseSlice(this.parseHtml(e,t),{preserveWhitespace:!0}).content.toJSON()??[]}parseHtml(e,t){const n=Sa.sanitize(e,{RETURN_DOM:!0}),i=document.createDocumentFragment();return i.appendChild(n),t?.modifyDom?.(i),i}}class ld{constructor(e,t){const n=od(e.schema);t?.modifyParseRules?.(n),this.parser=ad(e.schema,n)}transform(e){return Sa.sanitize(e)}}const ad=(r,{marks:e,nodes:t})=>{const n=[],i=o=>o.priority??50;function s(o){let l=0;for(;l<n.length;l++){const a=n[l];if(i(a)<i(o))break}n.splice(l,0,o)}for(const o in e)e[o]?.forEach(l=>{s(l=Xn(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)});for(const o in t)t[o]?.forEach(l=>{s(l=Xn(l)),l.node||l.ignore||l.mark||(l.node=o)});return new Lt(r,n)};class Ta{constructor(e,t){this[A]=new Li(e[A],t)}serializeDocument(e,t){return this[A].serializeFragment(e.content,t)}serializeFragment(e,t){return this[A].serializeFragment(e,t)}}class Li{constructor(e,t){this.config=e;const n=Li.domSerializersFromSchema(e.schema);Object.assign(n.nodes,t?.serializers?.nodes??{}),Object.assign(n.marks,t?.serializers?.marks??{}),this.serializer=new kt(n.nodes,n.marks)}static domSerializersFromSchema(e){const t={nodes:{},marks:{}};for(const n in e.marks){const i=e.marks[n].spec.toDOM;i&&(t.marks[n]=i)}for(const n in e.nodes){const i=e.nodes[n].spec.serializeToDOM??e.nodes[n].spec.toDOM;i&&(t.nodes[n]=i)}return t.nodes.text=n=>document.createTextNode(n.text),t}serializeFragment(e,t){const n=b.fromJSON(this.config.schema,e),i=this.serializer.serializeFragment(n),s=document.createDocumentFragment();s.appendChild(i),t?.modifyDom?.(s);const o=document.createElement("div");return o.appendChild(s),o.innerHTML}}const Ca=(r,e)=>{const t=r.topNodeType.createAndFill(null,e?b.fromJSON(r,e.content):null);if(!t)throw new Error("Document could not be parsed");return t.check(),t};class cd{constructor(e,t){this.options=t,this[A]=new hd(e,t)}getDocument(){return this[A].state.doc.toJSON()}reset(e){this[A].reset(e)}replaceSelection(e,t){const{state:n,tr:i,schema:s,dispatchTransaction:o}=this[A];i.replaceSelection(new S(b.fromJSON(s,e),0,0)),i.doc.check();const l=i.doc.resolve(i.mapping.map(n.selection.from)),a=i.doc.resolve(i.selection.to),[c,h]=t?.cursorPlacement==="start"?[l,a]:[a,l];t?.selectContent?i.setSelection(n.selection instanceof Z?new Z(i.doc):O.between(h,c)):i.setSelection(O.between(c,c)),o(i)}replaceDocument(e,t){const{state:n,tr:i,schema:s,dispatchTransaction:o}=this[A];i.replaceWith(0,n.doc.content.size,Ca(s,e)),t?.selectContent?i.setSelection(new Z(i.doc)):t?.cursorPlacement==="end"?i.setSelection(O.atEnd(i.doc)):i.setSelection(O.atStart(i.doc)),o(i)}}class hd{constructor(e,t){this.options=t,this.view=null,this.dispatchTransaction=i=>{const s=this.state;return this.state=this.state.apply(i),this.view?.updateState(this.state),s.doc!==this.state.doc&&this.options?.onChange?.(),this.state};const n=e[A];this.config=n,this.schema=n.schema,this.textblockAttrs=n.textblockAttrs,this.features=n.features,this.foreignHtmlParser=t?.foreignHtmlParser??new xa(e),this.foreignHtmlSerializer=t?.foreignHtmlSerializer??new Ta(e),this.styles=new me.ElementStyles(Ft(n.features.flatMap(i=>i.getStyles()))),this.initState(t?.initialDocument)}getFeature(e){const t=this.config.featureMap.get(e);if(!t)throw new Error(`Feature not found: ${e.name}`);return t}initState(e){this.state=It.create({doc:Ca(this.schema,e),schema:this.config.schema,plugins:Ft(this.config.features.flatMap(t=>t.getPlugins(this)))})}reset(e){const t=ln.getState(this.state);this.initState(e),this.updateHostState(t),this.view?.updateState(this.state)}createView(e){this.view=new Kl(e,{state:this.state,dispatchTransaction:this.dispatchTransaction})}destroyViewIfNeeded(){this.view&&(this.view.destroy(),this.view=null)}createComponent(e){return document.createElement(this.hostState().ctx.tagFor(e,!0))}getLocale(){return this.hostState().locale}get tr(){return this.state.tr}hostState(){const e=ln.getState(this.state);if(!e)throw new Error("No host state available");return e}updateHostState(e){this.dispatchTransaction(this.tr.setMeta(ln,e))}}var ud=Object.defineProperty,fd=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=o(e,t,i)||i);return i&&ud(e,t,i),i};class wa extends Ua.WithObservableLocale(me.VividElement){instanceChanged(e){e?.[A].destroyViewIfNeeded(),this._initViewIfNeeded(),e?.[A].styles.removeStylesFrom(this.shadowRoot),this.instance?.[A].styles.addStylesTo(this.shadowRoot)}_initViewIfNeeded(){const e=this.instance?.[A];e&&this.$fastController.isConnected&&!e.view&&(this._syncStateIfNeeded(),e.createView(this._editorEl))}_destroyViewIfNeeded(){this.instance?.[A].destroyViewIfNeeded()}connectedCallback(){super.connectedCallback(),this._initViewIfNeeded()}disconnectedCallback(){super.disconnectedCallback(),this._destroyViewIfNeeded()}localeChanged(){this._syncStateIfNeeded()}_syncStateIfNeeded(){this.instance?.[A].updateHostState({locale:this.locale,ctx:this._ctx})}}fd([me.observable],wa.prototype,"instance");const dd=r=>me.html`<template :_ctx="${()=>r}">
21
21
  <div class="rte">
22
22
  <div class="editor-viewport" ${hs.ref("editorViewportElement")}>
@@ -9720,7 +9720,7 @@ function ta(r) {
9720
9720
  /* v8 ignore next 1 -- @preserve*/
9721
9721
  throw new Error("No default textblock found.");
9722
9722
  }
9723
- const Su = "[data-class=ui-select]{min-inline-size:120px}.ui-divider{block-size:20px}.ui-button-group{display:flex;gap:4px}.ui-tooltip,.ui-menu{display:contents;--_popup-display: contents}.ui-tooltip-wrapper{display:contents}", xu = '.ProseMirror{flex:1;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none}.ProseMirror-selectednode{--focus-stroke-gap-color: transparent;--focus-border-radius: 2px;position:relative;outline:none}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:var(--focus-border-radius, inherit);block-size:calc(100% + var(--focus-block-size-addition, 4px));content:"";inline-size:calc(100% + var(--focus-block-size-addition, 4px));inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}';
9723
+ const Su = "[data-class=ui-select]{min-inline-size:120px}.ui-divider{block-size:20px}.ui-button-group{display:flex;gap:4px}.ui-tooltip,.ui-menu{display:contents;--_popup-display: contents}.ui-tooltip-wrapper{display:contents}", xu = '.ProseMirror{flex:1;padding:var(--editor-padding-block) var(--editor-padding-inline);outline:none}.ProseMirror-selectednode{--focus-stroke-gap-color: transparent;--focus-border-radius: 2px;position:relative;outline:none}.ProseMirror-selectednode:after{box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));position:absolute;display:block;border-radius:var(--focus-border-radius, inherit);block-size:calc(100% + var(--focus-block-size-addition, 4px));content:"";inline-size:calc(100% + var(--focus-block-size-addition, 4px));inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}';
9724
9724
  var Yn = 200, J = function() {
9725
9725
  };
9726
9726
  J.prototype.append = function(e) {
@@ -10721,7 +10721,7 @@ class ca extends K {
10721
10721
  className: "link-popover-label",
10722
10722
  children: [
10723
10723
  uo(n, {
10724
- text: () => n.rte.getLocale().richTextEditor.clickHere
10724
+ text: () => this.getCurrentLink(n.view.state)?.text || ""
10725
10725
  })
10726
10726
  ]
10727
10727
  }),