@yiitap/vue 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/index.cjs +199 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.js +199 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +45043 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/vue.css +1 -0
  10. package/package.json +120 -0
  11. package/types/__tests__/index.spec.d.ts +1 -0
  12. package/types/components/YiiEditor.vue.d.ts +701 -0
  13. package/types/components/buttons/OAiBtn.vue.d.ts +20 -0
  14. package/types/components/buttons/OAlignDropdown.vue.d.ts +10 -0
  15. package/types/components/buttons/OAlignGroup.vue.d.ts +11 -0
  16. package/types/components/buttons/OBackColorDropdown.vue.d.ts +10 -0
  17. package/types/components/buttons/OEmojiBtn.vue.d.ts +10 -0
  18. package/types/components/buttons/OFontFamilyDropdown.vue.d.ts +10 -0
  19. package/types/components/buttons/OForeColorDropdown.vue.d.ts +10 -0
  20. package/types/components/buttons/OHeadingDropdown.vue.d.ts +10 -0
  21. package/types/components/buttons/OLinkBtn.vue.d.ts +11 -0
  22. package/types/components/buttons/OLinkEditBtn.vue.d.ts +13 -0
  23. package/types/components/buttons/OLinkOpenBtn.vue.d.ts +10 -0
  24. package/types/components/buttons/OListDropdown.vue.d.ts +10 -0
  25. package/types/components/buttons/OListGroup.vue.d.ts +13 -0
  26. package/types/components/buttons/OMoreBubble.vue.d.ts +13 -0
  27. package/types/components/buttons/OSimpleCommandBtn.vue.d.ts +20 -0
  28. package/types/components/buttons/OStyleDropdown.vue.d.ts +10 -0
  29. package/types/components/buttons/OTableBtn.vue.d.ts +10 -0
  30. package/types/components/buttons/OTableGroup.vue.d.ts +13 -0
  31. package/types/components/buttons/OTextColorDropdown.vue.d.ts +11 -0
  32. package/types/components/buttons/OTextFormatDropdown.vue.d.ts +11 -0
  33. package/types/components/common/OBlockList.vue.d.ts +26 -0
  34. package/types/components/common/OBlockListItem.vue.d.ts +16 -0
  35. package/types/components/common/OBlockMenu.vue.d.ts +69 -0
  36. package/types/components/common/OBlockPlaceholder.vue.d.ts +23 -0
  37. package/types/components/common/OBlockPopover.vue.d.ts +534 -0
  38. package/types/components/common/OBlockToolbar.vue.d.ts +593 -0
  39. package/types/components/common/OCalloutColorBoard.vue.d.ts +36 -0
  40. package/types/components/common/OCalloutColorDropdown.vue.d.ts +14 -0
  41. package/types/components/common/OColorBoard.vue.d.ts +36 -0
  42. package/types/components/common/OCommandBtn.vue.d.ts +196 -0
  43. package/types/components/common/OCommonBtn.vue.d.ts +214 -0
  44. package/types/components/common/OContextMenu.vue.d.ts +469 -0
  45. package/types/components/common/ODocToc.vue.d.ts +68 -0
  46. package/types/components/common/OEmojiSelect.vue.d.ts +26 -0
  47. package/types/components/common/OLanguageDropdown.vue.d.ts +18 -0
  48. package/types/components/common/OMediaInput.vue.d.ts +27 -0
  49. package/types/components/common/OMenubarBtn.vue.d.ts +179 -0
  50. package/types/components/common/OMetaInput.vue.d.ts +155 -0
  51. package/types/components/common/ONodeView.vue.d.ts +213 -0
  52. package/types/components/common/OTableCellBackground.vue.d.ts +10 -0
  53. package/types/components/common/OTableGrid.vue.d.ts +6 -0
  54. package/types/components/common/OTextColorBoard.vue.d.ts +36 -0
  55. package/types/components/common/OToast.d.ts +11 -0
  56. package/types/components/common/o-side-menu/AddNode.vue.d.ts +46 -0
  57. package/types/components/common/o-side-menu/AddNodeView.vue.d.ts +50 -0
  58. package/types/components/common/o-side-menu/DragNode.vue.d.ts +54 -0
  59. package/types/components/common/o-side-menu/DragNodeMenu.vue.d.ts +64 -0
  60. package/types/components/common/o-side-menu/DragNodeView.vue.d.ts +50 -0
  61. package/types/components/common/o-side-node/AddNode.vue.d.ts +92 -0
  62. package/types/components/common/o-side-node/AddNodeView.vue.d.ts +96 -0
  63. package/types/components/common/o-side-node/DragNode.vue.d.ts +96 -0
  64. package/types/components/common/o-side-node/DragNodeView.vue.d.ts +96 -0
  65. package/types/components/common/o-side-node/index.vue.d.ts +96 -0
  66. package/types/components/index.d.ts +37 -0
  67. package/types/components/menu.d.ts +1 -0
  68. package/types/components/menus/OAiMenu.vue.d.ts +27 -0
  69. package/types/components/menus/OBubbleMenu.vue.d.ts +39 -0
  70. package/types/components/menus/OFloatingMenu.vue.d.ts +39 -0
  71. package/types/components/menus/OMainMenu.vue.d.ts +59 -0
  72. package/types/components/menus/OSideMenu.vue.d.ts +23 -0
  73. package/types/components/menus/side-menu/index.d.ts +2 -0
  74. package/types/components/ui/OBtn.vue.d.ts +123 -0
  75. package/types/components/ui/OBtnGroup.vue.d.ts +100 -0
  76. package/types/components/ui/OCheckbox.vue.d.ts +27 -0
  77. package/types/components/ui/ODivider.vue.d.ts +14 -0
  78. package/types/components/ui/OIcon.vue.d.ts +50 -0
  79. package/types/components/ui/OInput.vue.d.ts +125 -0
  80. package/types/components/ui/OList.vue.d.ts +56 -0
  81. package/types/components/ui/OListItem.vue.d.ts +42 -0
  82. package/types/components/ui/OPopover.vue.d.ts +242 -0
  83. package/types/components/ui/OTooltip.d.ts +16 -0
  84. package/types/components/ui/OTooltip.vue.d.ts +119 -0
  85. package/types/constants/ai.d.ts +6 -0
  86. package/types/constants/block.d.ts +7 -0
  87. package/types/constants/color.d.ts +5 -0
  88. package/types/constants/data.d.ts +4 -0
  89. package/types/constants/empty-block.d.ts +21 -0
  90. package/types/constants/index.d.ts +4 -0
  91. package/types/constants/language.d.ts +1 -0
  92. package/types/constants/menu.d.ts +31 -0
  93. package/types/extensions/ai-block/index.d.ts +3 -0
  94. package/types/extensions/ai-block/view.vue.d.ts +92 -0
  95. package/types/extensions/blockquote/index.d.ts +3 -0
  96. package/types/extensions/blockquote/view.vue.d.ts +92 -0
  97. package/types/extensions/callout/index.d.ts +3 -0
  98. package/types/extensions/callout/view.vue.d.ts +92 -0
  99. package/types/extensions/char-command/emoji/suggestion.d.ts +14 -0
  100. package/types/extensions/char-command/emoji/view.vue.d.ts +72 -0
  101. package/types/extensions/char-command/slash/suggestion.d.ts +14 -0
  102. package/types/extensions/char-command/slash/view.vue.d.ts +192 -0
  103. package/types/extensions/code-block/index.d.ts +3 -0
  104. package/types/extensions/code-block/view.vue.d.ts +92 -0
  105. package/types/extensions/dynamic.d.ts +7 -0
  106. package/types/extensions/heading/index.d.ts +7 -0
  107. package/types/extensions/heading/view.vue.d.ts +92 -0
  108. package/types/extensions/horizontal-rule/index.d.ts +2 -0
  109. package/types/extensions/horizontal-rule/view.vue.d.ts +92 -0
  110. package/types/extensions/image/index.d.ts +3 -0
  111. package/types/extensions/image/view.vue.d.ts +92 -0
  112. package/types/extensions/index.d.ts +49 -0
  113. package/types/extensions/link/helpers/clickSelectHandler.d.ts +2 -0
  114. package/types/extensions/link/index.d.ts +3 -0
  115. package/types/extensions/paragraph/index.d.ts +2 -0
  116. package/types/extensions/paragraph/view.vue.d.ts +92 -0
  117. package/types/extensions/side-menu/index.d.ts +2 -0
  118. package/types/extensions/side-menu/side-menu-plugin.d.ts +72 -0
  119. package/types/extensions/side-menu/utils.d.ts +50 -0
  120. package/types/extensions/table-cell/index.d.ts +3 -0
  121. package/types/extensions/table-cell/view.vue.d.ts +92 -0
  122. package/types/extensions/table-header/index.d.ts +3 -0
  123. package/types/extensions/table-header/view.vue.d.ts +92 -0
  124. package/types/extensions/table-wrapper/index.d.ts +2 -0
  125. package/types/extensions/table-wrapper/view.vue.d.ts +92 -0
  126. package/types/extensions/video/index.d.ts +2 -0
  127. package/types/extensions/video/view.vue.d.ts +92 -0
  128. package/types/hooks/index.d.ts +5 -0
  129. package/types/hooks/useAi.d.ts +6 -0
  130. package/types/hooks/useI18n.d.ts +8 -0
  131. package/types/hooks/useNodeView.d.ts +6 -0
  132. package/types/hooks/useTheme.d.ts +6 -0
  133. package/types/hooks/useTiptap.d.ts +8 -0
  134. package/types/i18n/index.d.ts +4 -0
  135. package/types/i18n/messages/en.d.ts +232 -0
  136. package/types/i18n/messages/pl.d.ts +182 -0
  137. package/types/i18n/messages/pt-br.d.ts +182 -0
  138. package/types/i18n/messages/zh-hans.d.ts +230 -0
  139. package/types/i18n/messages/zh-hant.d.ts +183 -0
  140. package/types/index.d.ts +11 -0
  141. package/types/utils/convert.d.ts +1 -0
  142. package/types/utils/uuid.d.ts +1 -0
package/dist/index.js ADDED
@@ -0,0 +1,199 @@
1
+ var YiiEditor=function(z,a,Zo,_b,Ar){"use strict";var yR=Object.defineProperty;var kR=(z,a,Zo)=>a in z?yR(z,a,{enumerable:!0,configurable:!0,writable:!0,value:Zo}):z[a]=Zo;var tt=(z,a,Zo)=>kR(z,typeof a!="symbol"?a+"":a,Zo);/**
2
+ * Copyright 2025 Yiitap
3
+ * @license MIT
4
+ **/function bt(t){this.content=t}bt.prototype={constructor:bt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new bt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new bt(n)},addToStart:function(t,e){return new bt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new bt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new bt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=bt.from(t),t.size?new bt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=bt.from(t),t.size?new bt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=bt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},bt.from=function(t){if(t instanceof bt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new bt(e)};function Sd(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Sd(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function xd(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=xd(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new A(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new A(o,r)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new A(r,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Sd(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return xd(this,e,n,o)}findIndex(e,n=-1){if(e==0)return Mi(0,e);if(e==this.size)return Mi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,r=0;;o++){let i=this.child(o),s=r+i.nodeSize;if(s>=e)return s==e||n>0?Mi(o+1,s):Mi(o,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new A(n||e,o)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const Ba={index:0,offset:0};function Mi(t,e){return Ba.index=t,Ba.offset=e,Ba}function Ai(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!Ai(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!Ai(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let Ue=class Ed{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ai(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ed.none;if(e instanceof Ed)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};Ue.none=[];class vi extends Error{}class V{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Td(this.content,e+this.openStart,n);return o&&new V(o,this.openStart,this.openEnd)}removeBetween(e,n){return new V(Nd(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return V.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(A.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new V(e,o,r)}}V.empty=new V(A.empty,0,0);function Nd(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Nd(i.content,e-r-1,n-r-1)))}function Td(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=Td(s.content,e-i-1,n);return l&&t.replaceChild(r,s.copy(l))}function Cb(t,e,n){if(n.openStart>t.depth)throw new vi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new vi("Inconsistent open depths");return Od(t,e,n,0)}function Od(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=Od(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return Oo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Sb(n,t);return Oo(i,Ad(t,s,l,e,o))}else return Oo(i,Ri(t,e,o))}function Md(t,e){if(!e.type.compatibleContent(t.type))throw new vi("Cannot join "+e.type.name+" onto "+t.type.name)}function Da(t,e,n){let o=t.node(n);return Md(o,e.node(n)),o}function To(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function vr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(To(t.nodeAfter,o),i++));for(let l=i;l<s;l++)To(r.child(l),o);e&&e.depth==n&&e.textOffset&&To(e.nodeBefore,o)}function Oo(t,e){return t.type.checkContent(e),t.copy(e)}function Ad(t,e,n,o,r){let i=t.depth>r&&Da(t,e,r+1),s=o.depth>r&&Da(n,o,r+1),l=[];return vr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Md(i,s),To(Oo(i,Ad(t,e,n,o,r+1)),l)):(i&&To(Oo(i,Ri(t,e,r+1)),l),vr(e,n,r,l),s&&To(Oo(s,Ri(n,o,r+1)),l)),vr(o,null,r,l),new A(l)}function Ri(t,e,n){let o=[];if(vr(null,t,n,o),t.depth>n){let r=Da(t,e,n+1);To(Oo(r,Ri(t,e,n+1)),o)}return vr(e,null,n,o),new A(o)}function Sb(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(A.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Rr{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ue.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Bi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Rr(n,o,i)}static resolveCached(e,n){let o=vd.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else vd.set(e,o=new xb);let r=o.elts[o.i]=Rr.resolve(e,n);return o.i=(o.i+1)%Nb,r}}class xb{constructor(){this.elts=[],this.i=0}}const Nb=12,vd=new WeakMap;class Bi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Tb=Object.create(null);let Cn=class _d{constructor(e,n,o,r=Ue.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&Ai(this.attrs,n||e.defaultAttrs||Tb)&&Ue.sameSet(this.marks,o||Ue.none)}copy(e=null){return e==this.content?this:new _d(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _d(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return V.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new V(d,r.depth-s,i.depth-s)}replace(e,n,o){return Cb(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Rr.resolveCached(this,e)}resolveNoCache(e){return Rr.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rd(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=A.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ue.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Ue.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=A.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Cn.prototype.text=void 0;class Di extends Cn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Di(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Di(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Mo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Ob(e,n);if(o.next==null)return Mo.empty;let r=Bd(o);o.next&&o.err("Unexpected trailing text");let i=Ib(Db(r));return Lb(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return A.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:p}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let f=i(p,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
5
+ `)}}Mo.empty=new Mo(!0);class Ob{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Bd(t){let e=[];do e.push(Mb(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Mb(t){let e=[];do e.push(Ab(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Ab(t){let e=Bb(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=vb(t,e);else break;return e}function Dd(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function vb(t,e){let n=Dd(t),o=n;return t.eat(",")&&(t.next!="}"?o=Dd(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function Rb(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function Bb(t){if(t.eat("(")){let e=Bd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Rb(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Db(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Id(t,e){return e-t}function Ld(t,e){let n=[];return o(e),n.sort(Id);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function Ib(t){let e=Object.create(null);return n(Ld(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Ld(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new Mo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Id);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function Lb(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pd(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function $d(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Fd(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Vd(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new $b(t,o,e[o]);return n}let zd=class wb{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Vd(e,o.attrs),this.defaultAttrs=Pd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Mo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$d(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Cn(this,this.computeAttrs(e),A.from(n),Ue.setFrom(o))}createChecked(e=null,n,o){return n=A.from(n),this.checkContent(n),new Cn(this,this.computeAttrs(e),n,Ue.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(A.empty,!0);return i?new Cn(this,e,n.append(i),Ue.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Fd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:Ue.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new wb(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Pb(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class $b{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Pb(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Ii{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Vd(e,r.attrs),this.excluded=null;let i=Pd(this.attrs);this.instance=i?new Ue(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ue(this,$d(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Ii(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Fd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Hd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=bt.from(e.nodes),n.marks=bt.from(e.marks||{}),this.nodes=zd.compile(this.spec.nodes,this),this.marks=Ii.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=Mo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Ud(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Ud(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof zd){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Di(o,o.defaultAttrs,e,Ue.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Cn.fromJSON(this,e)}markFromJSON(e){return Ue.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ud(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function Fb(t){return t.tag!=null}function Vb(t){return t.style!=null}let Qo=class Cd{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(Fb(r))this.tags.push(r);else if(Vb(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new jd(this,n,!1);return o.addAll(e,Ue.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new jd(this,n,!0);return o.addAll(e,Ue.none,n.from,n.to),V.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(Ub(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Gd(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Gd(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Cd(e,Cd.schemaRules(e)))}};const qd={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},zb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Kd={ol:!0,ul:!0},Br=1,Ia=2,Li=4;function Wd(t,e,n){return e!=null?(e?Br:0)|(e==="full"?Ia:0):t&&t.whitespace=="pre"?Br|Ia:n&-5}class Pi{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=Ue.none,this.match=i||(s&Li?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Br)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class jd{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=Wd(null,n.preserveWhitespace,0)|(o?Li:0);r?i=new Pi(r.type,r.attrs,Ue.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Pi(null,null,Ue.none,!0,null,s):i=new Pi(e.schema.topNodeType,null,Ue.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ia?"full":this.localPreserveWS||(r.options&Br)>0;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)i!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,`
6
+ `);else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],l=e.previousSibling;(!s||l&&l.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Kd.hasOwnProperty(s)&&this.parser.normalizeLists&&Hb(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:zb.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(qd.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let p=c&&c.skip?n:this.readStyles(e,n);p&&this.addAll(e,p),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o)||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n){let o,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(e);if(l&&(!o||o.length>l.length)&&(o=l,r=s,!l.length)||s.solid)break}if(!o)return null;this.sync(r);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}let o=this.findPlace(e,n);if(o){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let i=Ue.none;for(let s of o.concat(e.marks))(r.type?r.type.allowsMarkType(s.type):Yd(s.type,e.type))&&(i=s.addToSet(i));return r.content.push(e.mark(i)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Wd(e,i,s.options);s.options&Li&&s.content.length==0&&(l|=Li);let c=Ue.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):Yd(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Pi(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Br)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function Hb(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Kd.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function Ub(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Gd(t){let e={};for(let n in t)e[n]=t[n];return e}function Yd(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class Ao{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=La(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=$i(La(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&$i(La(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return $i(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ao(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Jd(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return Jd(e.marks)}}function Jd(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function La(t){return t.document||window.document}const Xd=new WeakMap;function qb(t){let e=Xd.get(t);return e===void 0&&Xd.set(t,e=Kb(t)),e}function Kb(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function $i(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=qb(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let p in d)if(d[p]!=null){let f=p.indexOf(" ");f>0?c.setAttributeNS(p.slice(0,f),p.slice(f+1),d[p]):c.setAttribute(p,d[p])}}for(let p=u;p<e.length;p++){let f=e[p];if(f===0){if(p<e.length-1||p>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=$i(t,f,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Zd=65535,Qd=Math.pow(2,16);function Wb(t,e){return t+e*Qd}function eu(t){return t&Zd}function jb(t){return(t-(t&Zd))/Qd}const tu=1,nu=2,Fi=4,ou=8;class Pa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&ou)>0}get deletedBefore(){return(this.delInfo&(tu|Fi))>0}get deletedAfter(){return(this.delInfo&(nu|Fi))>0}get deletedAcross(){return(this.delInfo&Fi)>0}}class Kt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Kt.empty)return Kt.empty}recover(e){let n=0,o=eu(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+jb(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],p=c+d;if(e<=p){let f=d?e==c?-1:e==p?1:n:n,h=c+r+(f<0?0:u);if(o)return h;let m=e==(n<0?c:p)?null:Wb(l/3,e-c),g=e==c?nu:e==p?tu:Fi;return(n<0?e!=c:e!=p)&&(g|=ou),new Pa(h,g,m)}r+=u-d}return o?e+r:new Pa(e+r,0,null)}touches(e,n){let o=0,r=eu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Kt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Kt.empty:new Kt(e<0?[0,-e,0]:[0,0,e])}}Kt.empty=new Kt([]);class Dr{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Dr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Dr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Pa(e,r,null)}}const $a=Object.create(null);class _t{getMap(){return Kt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=$a[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in $a)throw new RangeError("Duplicate use of step JSON ID "+e);return $a[e]=n,n.prototype.jsonID=e,n}}class rt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new rt(e,null)}static fail(e){return new rt(null,e)}static fromReplace(e,n,o,r){try{return rt.ok(e.replace(n,o,r))}catch(i){if(i instanceof vi)return rt.fail(i.message);throw i}}}function Fa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(Fa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return A.fromArray(o)}class to extends _t{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new V(Fa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return rt.fromReplace(e,this.from,this.to,i)}invert(){return new Sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new to(n.pos,o.pos,this.mark)}merge(e){return e instanceof to&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new to(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new to(n.from,n.to,e.markFromJSON(n.mark))}}_t.jsonID("addMark",to);class Sn extends _t{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new V(Fa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return rt.fromReplace(e,this.from,this.to,o)}invert(){return new to(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new Sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof Sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Sn(n.from,n.to,e.markFromJSON(n.mark))}}_t.jsonID("removeMark",Sn);class no extends _t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return rt.fromReplace(e,this.pos,this.pos+1,new V(A.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new no(this.pos,n.marks[r]);return new no(this.pos,this.mark)}}return new er(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new no(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new no(n.pos,e.markFromJSON(n.mark))}}_t.jsonID("addNodeMark",no);class er extends _t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return rt.fromReplace(e,this.pos,this.pos+1,new V(A.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new no(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new er(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new er(n.pos,e.markFromJSON(n.mark))}}_t.jsonID("removeNodeMark",er);class ut extends _t{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Va(e,this.from,this.to)?rt.fail("Structure replace would overwrite content"):rt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Kt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ut(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ut(n.pos,Math.max(n.pos,o.pos),this.slice)}merge(e){if(!(e instanceof ut)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ut(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ut(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ut(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}_t.jsonID("replace",ut);class pt extends _t{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Va(e,this.from,this.gapFrom)||Va(e,this.gapTo,this.to)))return rt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return rt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?rt.fromReplace(e,this.from,this.to,o):rt.fail("Content does not fit in gap")}getMap(){return new Kt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new pt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new pt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new pt(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}_t.jsonID("replaceAround",pt);function Va(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function Gb(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!o.isInSet(p)&&u.type.allowsMarkType(o.type)){let f=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(m)||(s&&s.to==f&&s.mark.eq(p[g])?s.to=h:r.push(s=new Sn(f,h,p[g])));l&&l.to==f?l.to=h:i.push(l=new to(f,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function Yb(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Ii){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let p=c[u],f;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&p.eq(r[h].style)&&(f=m)}f?(f.to=d,f.step=i):r.push({style:p,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new Sn(s.from,s.to,s.style)))}function za(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,p=o.matchType(d.type);if(!p)s.push(new ut(l,u,V.empty));else{o=p;for(let f=0;f<d.marks.length;f++)n.allowsMarkType(d.marks[f].type)||t.step(new Sn(l,u,d.marks[f]));if(r&&d.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(d.text);)m||(m=new V(A.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ut(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(A.empty,!0);t.replace(l,l,new V(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function Jb(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function tr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth;;--o){let r=t.$from.node(o),i=t.$from.index(o),s=t.$to.indexAfter(o);if(o<t.depth&&r.canReplace(i,s,n))return o;if(o==0||r.type.spec.isolating||!Jb(r,i,s))break}return null}function Xb(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=A.empty,p=0;for(let m=i,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,u=A.from(o.node(m).copy(u)),p++):c--;let f=A.empty,h=0;for(let m=i,g=!1;m>n;m--)g||r.after(m+1)<r.end(m)?(g=!0,f=A.from(r.node(m).copy(f)),h++):d++;t.step(new pt(c,d,s,l,new V(u.append(f),p,h),u.size-p,!0))}function Ha(t,e,n=null,o=t){let r=Zb(t,e),i=r&&Qb(o,e);return i?r.map(ru).concat({type:e,attrs:n}).concat(i.map(ru)):null}function ru(t){return{type:t,attrs:null}}function Zb(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function Qb(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function ey(t,e,n){let o=A.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=A.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new pt(r,i,r,i,new V(o,0,0),n.length,!0))}function ty(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&ny(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&su(t,s,l,i),za(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),p=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new pt(p,f,p+1,f-1,new V(A.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&iu(t,s,l,i),!1}})}function iu(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function su(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
8
+ `))}})}function ny(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function oy(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new pt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new V(A.from(s),0,0),1,!0))}function Vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let p=r.node(d),f=r.index(d);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||p;if(!p.canReplace(f+1,p.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function ry(t,e,n=1,o){let r=t.doc.resolve(e),i=A.empty,s=A.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=A.from(r.node(l).copy(i));let u=o&&o[d];s=A.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ut(e,e,new V(i.append(s),n,n),!0))}function oo(t,e){let n=t.resolve(e),o=n.index();return au(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function iy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function au(t,e){return!!(t&&e&&!t.isLeaf&&iy(t,e))}function Vi(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&au(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function sy(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",p=!!s.contentMatch.matchType(r);u&&!p?o=!1:!u&&p&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);su(t,u.node(),u.before(),l)}s.inlineContent&&za(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ut(d,c.map(e+n,-1),V.empty,!0)),o===!0){let u=t.doc.resolve(d);iu(t,u.node(),u.before(),t.steps.length)}return t}function ay(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function lu(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let p=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function zi(t,e,n=e,o=V.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return cu(r,i,o)?new ut(e,n,o):new ly(r,i,o).fit()}function cu(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ly{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=A.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=A.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new V(i,s,l);return e>-1?new pt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ut(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ua(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,p=null;if(n==1&&(s?d.matchType(s.type)||(p=d.fillBefore(A.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:p};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ua(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new V(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ua(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new V(Ir(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new V(Ir(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:p,type:f}=this.frontier[n];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));p=p.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),b=p.matchType(g.type);if(!b)break;d++,(d>1||c==0||g.content.size)&&(p=b,u.push(du(g.mark(f.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Lr(this.placed,n,A.from(u)),this.frontier[n].match=p,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=l;g<h;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?e==0?V.empty:new V(Ir(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new V(Ir(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Lr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Lr(this.placed,this.depth,A.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=Lr(this.placed,this.frontier.length,n))}}function Ir(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ir(t.firstChild.content,e-1,n)))}function Lr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Lr(t.lastChild.content,e-1,n)))}function Ua(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function du(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,du(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(A.empty,!0)))),t.copy(o)}function qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!cy(n,i.content,s)?l:null}function cy(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function dy(t){return t.spec.defining||t.spec.definingForContent}function uy(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(cu(r,i,o))return t.step(new ut(e,n,o));let s=pu(r,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let f=r.depth,h=r.pos-1;f>0;f--,h--){let m=r.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?l=f:r.before(f)==h&&s.splice(1,0,-f)}let c=s.indexOf(l),d=[],u=o.openStart;for(let f=o.content,h=0;;h++){let m=f.firstChild;if(d.push(m),h==o.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=d[f],m=dy(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=o.openStart;f>=0;f--){let h=(f+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<s.length;g++){let b=s[(g+c)%s.length],y=!0;b<0&&(y=!1,b=-b);let w=r.node(b-1),_=r.index(b-1);if(w.canReplaceWith(_,_,m.type,m.marks))return t.replace(r.before(b),y?i.after(b):n,new V(uu(o.content,0,o.openStart,h),h,o.openEnd))}}let p=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,o),!(t.steps.length>p));f--){let h=s[f];h<0||(e=r.before(h),n=i.after(h))}}function uu(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(uu(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return t}function py(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=ay(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new V(A.from(o),0,0))}function fy(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=pu(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function pu(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class nr extends _t{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return rt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return rt.fromReplace(e,this.pos,this.pos+1,new V(A.from(r),0,n.isLeaf?0:1))}getMap(){return Kt.empty}invert(e){return new nr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new nr(n.pos,n.attr,n.value)}}_t.jsonID("attr",nr);class Pr extends _t{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return rt.ok(o)}getMap(){return Kt.empty}invert(e){return new Pr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Pr(n.attr,n.value)}}_t.jsonID("docAttr",Pr);let or=class extends Error{};or=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},or.prototype=Object.create(Error.prototype),or.prototype.constructor=or,or.prototype.name="TransformError";class Ka{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Dr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new or(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=V.empty){let r=zi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new V(A.from(o),0,0))}delete(e,n){return this.replace(e,n,V.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return uy(this,e,n,o),this}replaceRangeWith(e,n,o){return py(this,e,n,o),this}deleteRange(e,n){return fy(this,e,n),this}lift(e,n){return Xb(this,e,n),this}join(e,n=1){return sy(this,e,n),this}wrap(e,n){return ey(this,e,n),this}setBlockType(e,n=e,o,r=null){return ty(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return oy(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new nr(e,n,o)),this}setDocAttribute(e,n){return this.step(new Pr(e,n)),this}addNodeMark(e,n){return this.step(new no(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ue)){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n=n.isInSet(o.marks),!n)return this}return this.step(new er(e,n)),this}split(e,n=1,o){return ry(this,e,n,o),this}addMark(e,n,o){return Gb(this,e,n,o),this}removeMark(e,n,o){return Yb(this,e,n,o),this}clearIncompatible(e,n,o){return za(this,e,n,o),this}}const Wa=Object.create(null);class le{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new fu(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=V.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?V.empty:n),l==0&&gu(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),gu(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new te(e):rr(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?rr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):rr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Wt(e.node(0))}static atStart(e){return rr(e,e,0,0,1)||new Wt(e)}static atEnd(e){return rr(e,e,e.content.size,e.childCount,-1)||new Wt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Wa[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Wa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Wa[e]=n,n.prototype.jsonID=e,n}getBookmark(){return te.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class fu{constructor(e,n){this.$from=e,this.$to=n}}let hu=!1;function mu(t){!hu&&!t.parent.inlineContent&&(hu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class te extends le{constructor(e,n=e){mu(e),mu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return le.near(o);let r=e.resolve(n.map(this.anchor));return new te(r.parent.inlineContent?r:o,o)}replace(e,n=V.empty){if(super.replace(e,n),n==V.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof te&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Hi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new te(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=le.findFrom(n,o,!0)||le.findFrom(n,-o,!0);if(i)n=i.$head;else return le.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(le.findFrom(e,-o,!0)||le.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new te(e,n)}}le.jsonID("text",te);class Hi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Hi(e.map(this.anchor),e.map(this.head))}resolve(e){return te.between(e.resolve(this.anchor),e.resolve(this.head))}}class ne extends le{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?le.near(i):new ne(i)}content(){return new V(A.from(this.node),0,0)}eq(e){return e instanceof ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ja(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ne(e.resolve(n.anchor))}static create(e,n){return new ne(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ne.prototype.visible=!1,le.jsonID("node",ne);class ja{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Hi(o,o):new ja(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&ne.isSelectable(o)?new ne(n):le.near(n)}}class Wt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=V.empty){if(n==V.empty){e.delete(0,e.doc.content.size);let o=le.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Wt(e)}map(e){return new Wt(e)}eq(e){return e instanceof Wt}getBookmark(){return hy}}le.jsonID("all",Wt);const hy={map(){return this},resolve(t){return new Wt(t)}};function rr(t,e,n,o,r,i=!1){if(e.inlineContent)return te.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&ne.isSelectable(l))return ne.create(t,n-(r<0?l.nodeSize:0))}else{let c=rr(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function gu(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ut||r instanceof pt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const bu=1,yu=2,ku=4;class my extends Ka{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|bu)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&bu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yu,this}ensureMarks(e){return Ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Ue.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),o=o??n,!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=ku,this}get scrolledIntoView(){return(this.updated&ku)>0}}function wu(t,e){return!e||!t?t:t.bind(e)}class $r{constructor(e,n,o){this.name=e,this.init=wu(n.init,o),this.apply=wu(n.apply,o)}}const gy=[new $r("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new $r("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new $r("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new $r("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ga{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gy.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new $r(o.key,o.spec.state,o))})}}class ir{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let p=0;p<this.config.plugins.length;p++)r.push(p<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ir(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new my(this)}static create(e){let n=new Ga(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new ir(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new Ga(this.schema,e.plugins),o=n.fields,r=new ir(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Ga(e.schema,e.plugins),i=new ir(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Cn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=le.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Eu(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Eu(r,e,{})),n[o]=r}return n}class Ae{constructor(e){this.spec=e,this.props={},e.props&&Eu(e.props,this,this.props),this.key=e.key?e.key.key:_u("plugin")}getState(e){return e[this.key]}}const Ya=Object.create(null);function _u(t){return t in Ya?t+"$"+ ++Ya[t]:(Ya[t]=0,t+"$")}class Ne{constructor(e="key"){this.key=_u(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const yt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Fr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ja=null;const zn=function(t,e,n){let o=Ja||(Ja=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},by=function(){Ja=null},vo=function(t,e,n,o){return n&&(Cu(t,e,n,o,-1)||Cu(t,e,n,o,1))},yy=/^(img|br|input|textarea|hr)$/i;function Cu(t,e,n,o,r){for(;;){if(t==n&&e==o)return!0;if(e==(r<0?0:tn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Vr(t)||yy.test(t.nodeName)||t.contentEditable=="false")return!1;e=yt(t)+(r<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.contentEditable=="false")return!1;e=r<0?tn(t):0}else return!1}}function tn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ky(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=tn(t)}else if(t.parentNode&&!Vr(t))e=yt(t),t=t.parentNode;else return null}}function wy(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Vr(t))e=yt(t)+1,t=t.parentNode;else return null}}function Ey(t,e,n){for(let o=e==0,r=e==tn(t);o||r;){if(t==n)return!0;let i=yt(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==tn(t)}}function Vr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ui=function(t){return t.focusNode&&vo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ro(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function _y(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Cy(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(tn(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(tn(o.startContainer),o.startOffset)}}}const xn=typeof navigator<"u"?navigator:null,Su=typeof document<"u"?document:null,ro=xn&&xn.userAgent||"",Xa=/Edge\/(\d+)/.exec(ro),xu=/MSIE \d/.exec(ro),Za=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ro),$t=!!(xu||Za||Xa),io=xu?document.documentMode:Za?+Za[1]:Xa?+Xa[1]:0,hn=!$t&&/gecko\/(\d+)/i.test(ro);hn&&+(/Firefox\/(\d+)/.exec(ro)||[0,0])[1];const Qa=!$t&&/Chrome\/(\d+)/.exec(ro),Ct=!!Qa,Nu=Qa?+Qa[1]:0,Mt=!$t&&!!xn&&/Apple Computer/.test(xn.vendor),sr=Mt&&(/Mobile\/\w+/.test(ro)||!!xn&&xn.maxTouchPoints>2),nn=sr||(xn?/Mac/.test(xn.platform):!1),Sy=xn?/Win/.test(xn.platform):!1,Hn=/Android \d/.test(ro),zr=!!Su&&"webkitFontSmoothing"in Su.documentElement.style,xy=zr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ny(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Un(t,e){return typeof t=="number"?t:t[e]}function Ty(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Tu(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Fr(s)){if(s.nodeType!=1)continue;let l=s,c=l==i.body,d=c?Ny(i):Ty(l),u=0,p=0;if(e.top<d.top+Un(o,"top")?p=-(d.top-e.top+Un(r,"top")):e.bottom>d.bottom-Un(o,"bottom")&&(p=e.bottom-e.top>d.bottom-d.top?e.top+Un(r,"top")-d.top:e.bottom-d.bottom+Un(r,"bottom")),e.left<d.left+Un(o,"left")?u=-(d.left-e.left+Un(r,"left")):e.right>d.right-Un(o,"right")&&(u=e.right-d.right+Un(r,"right")),u||p)if(c)i.defaultView.scrollBy(u,p);else{let f=l.scrollLeft,h=l.scrollTop;p&&(l.scrollTop+=p),u&&(l.scrollLeft+=u);let m=l.scrollLeft-f,g=l.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Oy(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Ou(t.dom)}}function Ou(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Fr(o));return e}function My({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Mu(n,o==0?0:o-e)}function Mu(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let ar=null;function Ay(t){if(t.setActive)return t.setActive();if(ar)return t.focus(ar);let e=Ou(t);t.focus(ar==null?{get preventScroll(){return ar={preventScroll:!0},!0}}:void 0),ar||(ar=!1,Mu(e,0))}function Au(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,p=0;u;u=u.nextSibling,p++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=zn(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){n=u,o=g,r=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=p+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=p+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?vy(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Au(n,r)}function vy(t,e){let n=t.nodeValue.length,o=document.createRange();for(let r=0;r<n;r++){o.setEnd(t,r+1),o.setStart(t,r);let i=so(o,1);if(i.top!=i.bottom&&el(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function el(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ry(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function By(t,e,n){let{node:o,offset:r}=Au(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function Dy(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function vu(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(el(e,d))return vu(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Iy(t,e){let n=t.dom.ownerDocument,o,r=0,i=Cy(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!el(e,d)||(s=vu(t.dom,e,d),!s))return null}if(Mt)for(let d=s;o&&d;d=Fr(d))d.draggable&&(o=void 0);if(s=Ry(s,e),o){if(hn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],p;u.nodeName=="IMG"&&(p=u.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&r++}let d;zr&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=Dy(t,o,r,e))}l==null&&(l=By(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Ru(t){return t.top<t.bottom||t.left<t.right}function so(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(Ru(o))return o}return Array.prototype.find.call(n,Ru)||t.getBoundingClientRect()}const Ly=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Bu(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=zr||hn;if(o.nodeType==3)if(s&&(Ly.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=so(zn(o,r,r),n);if(hn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=so(zn(o,r-1,r-1),-1);if(d.top==c.top){let u=so(zn(o,r,r+1),-1);if(u.top!=c.top)return Hr(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Hr(so(zn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==tn(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return tl(c.getBoundingClientRect(),!1)}if(i==null&&r<tn(o)){let c=o.childNodes[r];if(c.nodeType==1)return tl(c.getBoundingClientRect(),!0)}return tl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==tn(o))){let c=o.childNodes[r-1],d=c.nodeType==3?zn(c,tn(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Hr(so(d,1),!1)}if(i==null&&r<tn(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?zn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Hr(so(d,-1),!0)}return Hr(so(o.nodeType==3?zn(o):o,-n),n>=0)}function Hr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function tl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Du(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function Py(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return Du(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Bu(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=zn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const $y=/[\u0590-\u08ac]/;function Fy(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!$y.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:Du(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:p}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),b=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,p),c&&(c!=u||d!=p)&&l.extend&&l.extend(c,d)}catch{}return f!=null&&(l.caretBidiLevel=f),b}):o.pos==o.start()||o.pos==o.end()}let Iu=null,Lu=null,Pu=!1;function Vy(t,e,n){return Iu==e&&Lu==n?Pu:(Iu=e,Lu=n,Pu=n=="up"||n=="down"?Py(t,e,n):Fy(t,e,n))}const on=0,$u=1,Bo=2,Nn=3;class Ur{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=on,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>yt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof zu){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof Fu&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?yt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?yt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let p=l;p>0;p--){let f=this.children[p-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=yt(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let p=this.children[u];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=yt(p.dom);break}n+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],b=m+g.size;if(i>m&&s<b)return g.setSelection(e-m-g.border,n-m-g.border,o,r);m=b}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),p=!1;if((hn||Mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(p=!!(m&&h.nodeValue[m-1]==`
9
+ `),p&&m==h.nodeValue.length)for(let g=h,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(l=c={node:b.parentNode,offset:yt(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[m-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(hn&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||p&&Mt)&&vo(l.node,l.offset,u.anchorNode,u.anchorOffset)&&vo(c.node,c.offset,u.focusNode,u.focusOffset))return;let f=!1;if((d.extend||e==n)&&!p){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?Bo:$u,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Nn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Bo:Nn}o=s}this.dirty=Bo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?Bo:$u;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Fu extends Ur{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==on&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class zy extends Ur{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Do extends Ur{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=Ao.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new Do(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Nn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Nn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=on){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=on}}slice(e,n,o){let r=Do.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ol(i,n,s,o)),e>0&&(i=ol(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ao extends Ur{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:p}=Ao.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=qu(u,o,n),d?c=new Hy(e,n,o,r,u,p||null,f,d,i,s+1):n.isText?new qi(e,n,o,r,u,f,i):new ao(e,n,o,r,u,p||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,o){return this.dirty==on&&e.eq(this.node)&&Ki(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new qy(this,s&&s.node,e);jy(this.node,this.innerDeco,(d,u,p)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e):d.type.side>=0&&!p&&c.syncToMarks(u==this.node.childCount?Ue.none:this.node.child(u).marks,o,e),c.placeWidget(d,e,r)},(d,u,p,f)=>{c.syncToMarks(d.marks,o,e);let h;c.findNodeMatch(d,u,p,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,p,h,e)||c.updateNextNode(d,u,p,e,f,r)||c.addNode(d,u,p,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Bo)&&(s&&this.protectLocalComposition(e,s),Hu(this.contentDOM,this.children,e),sr&&Gy(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof te)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Yy(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new zy(this,i,n,r);e.input.compositionNodes.push(s),this.children=ol(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==Nn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=on}updateOuterDeco(e){if(Ki(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Uu(this.dom,this.nodeDOM,nl(this.outerDeco,this.node,n),nl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Vu(t,e,n,o,r){qu(o,e,t);let i=new ao(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class qi extends ao{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==Nn||this.dirty!=on&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=on||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=on,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new qi(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Nn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zu extends Ur{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==on&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Hy extends ao{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==Nn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Hu(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=Ku(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof Do){let c=o?o.previousSibling:t.lastChild;Hu(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=Ku(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const qr=function(t){t&&(this.nodeName=t)};qr.prototype=Object.create(null);const Io=[new qr];function nl(t,e,n){if(t.length==0)return Io;let o=n?Io[0]:new qr,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new qr(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new qr(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function Uu(t,e,n,o){if(n==Io&&o==Io)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Io[0]),r=c}Uy(r,l||Io[0],s)}return r}function Uy(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function qu(t,e,n){return Uu(t,t,Io,nl(e,n,t.nodeType!=1))}function Ki(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ku(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class qy{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ky(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=on,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[i])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Do.create(this.top,e[i],n,o);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==Nn&&s.dom==s.contentDOM&&(s.dirty=Bo),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof ao){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,p,f=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Nn&&Ki(n,c.outerDeco));if(!f&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(p=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Bo,p.updateChildren(r,s+1),p.dirty=on),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Ki(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=ao.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=ao.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new Fu(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Do;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Mt||Ct)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new zu(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Ky(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof Do)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function Wy(t,e){return t.type.side-e.type.side}function jy(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,p;for(;s<r.length&&r[s].to==i;){let b=r[s++];b.widget&&(u?(p||(p=[u])).push(b):u=b)}if(u)if(p){p.sort(Wy);for(let b=0;b<p.length;b++)n(p[b],d,!!c)}else n(u,d,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(d<t.childCount)h=d,f=t.child(d++);else break;for(let b=0;b<l.length;b++)l[b].to<=i&&l.splice(b--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+f.nodeSize;if(f.isText){let b=m;s<r.length&&r[s].from<b&&(b=r[s].from);for(let y=0;y<l.length;y++)l[y].to<b&&(b=l[y].to);b<m&&(c=f.cut(b-i),f=f.cut(0,b-i),m=b,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=f.isInline&&!f.isLeaf?l.filter(b=>!b.inline):l.slice();o(f,g,e.forChild(i,f),h),i=m}}function Gy(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Yy(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ol(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function rl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(Ui(n)){for(c=s;r&&!r.node;)r=r.parent;let p=r.node;if(r&&p.isAtom&&ne.isSelectable(p)&&r.parent&&!(p.isInline&&Ey(n.focusNode,n.focusOffset,r.dom))){let f=r.posBefore;d=new ne(s==f?l:o.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=s,f=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);p=Math.min(p,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,s]=f==t.state.selection.anchor?[f,p]:[p,f],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let p=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=sl(t,u,l,p)}return d}function Wu(t){return t.editable?t.hasFocus():Qu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qn(t,e=!1){let n=t.state.selection;if(Ju(t,n),!!Wu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ct){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&vo(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Xy(t);else{let{anchor:o,head:r}=n,i,s;ju&&!(n instanceof te)&&(n.$from.parent.inlineContent||(i=Gu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Gu(t,n.to))),t.docView.setSelection(o,r,t,e),ju&&(i&&Yu(i),s&&Yu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Jy(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ju=Mt||Ct&&Nu<63;function Gu(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(Mt&&r&&r.contentEditable=="false")return il(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return il(r);if(i)return il(i)}}function il(t){return t.contentEditable="true",Mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Yu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Jy(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Wu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Xy(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let o=t.cursorWrapper.dom,r=o.nodeName=="IMG";r?n.setStart(o.parentNode,yt(o)+1):n.setStart(o,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&$t&&io<=11&&(o.disabled=!0,o.disabled=!1)}function Ju(t,e){if(e instanceof ne){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Xu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Xu(t)}function Xu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function sl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||te.between(e,n,o)}function Zu(t){return t.editable&&!t.hasFocus()?!1:Qu(t)}function Qu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Zy(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return vo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function al(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&le.findFrom(i,e)}function lo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ep(t,e,n){let o=t.state.selection;if(o instanceof te)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return lo(t,new te(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=al(t.state,e);return r&&r instanceof ne?lo(t,r):!1}else if(!(nn&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?ne.isSelectable(i)?lo(t,new ne(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):zr?lo(t,new te(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof ne&&o.node.isInline)return lo(t,new te(e>0?o.$to:o.$from));{let r=al(t.state,e);return r?lo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Kr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function lr(t,e){return e<0?Qy(t):ek(t)}function Qy(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(hn&&n.nodeType==1&&o<Wi(n)&&Kr(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Kr(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(tp(n))break;{let l=n.previousSibling;for(;l&&Kr(l,-1);)r=n.parentNode,i=yt(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?ll(t,n,o):r&&ll(t,r,i)}function ek(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Kr(l,1))i=n,s=++o;else break}else{if(tp(n))break;{let l=n.nextSibling;for(;l&&Kr(l,1);)i=l.parentNode,s=yt(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&ll(t,i,s)}function tp(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function tk(t,e){for(;t&&e==t.childNodes.length&&!Vr(t);)e=yt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function nk(t,e){for(;t&&!e&&!Vr(t);)e=yt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function ll(t,e,n){if(e.nodeType!=3){let i,s;(s=tk(e,n))?(e=s,n=0):(i=nk(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(Ui(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&qn(t)},50)}function np(t,e){let n=t.state.doc.resolve(e);if(!(Ct||Sy)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function op(t,e,n){let o=t.state.selection;if(o instanceof te&&!o.empty||n.indexOf("s")>-1||nn&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=al(t.state,e);if(s&&s instanceof ne)return lo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Wt?le.near(s,e):le.findFrom(s,e);return l?lo(t,l):!1}return!1}function rp(t,e){if(!(t.state.selection instanceof te))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function ip(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ok(t){if(!Mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;ip(t,o,"true"),setTimeout(()=>ip(t,o,"false"),20)}return!1}function rk(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ik(t,e){let n=e.keyCode,o=rk(e);if(n==8||nn&&n==72&&o=="c")return rp(t,-1)||lr(t,-1);if(n==46&&!e.shiftKey||nn&&n==68&&o=="c")return rp(t,1)||lr(t,1);if(n==13||n==27)return!0;if(n==37||nn&&n==66&&o=="c"){let r=n==37?np(t,t.state.selection.from)=="ltr"?-1:1:-1;return ep(t,r,o)||lr(t,r)}else if(n==39||nn&&n==70&&o=="c"){let r=n==39?np(t,t.state.selection.from)=="ltr"?1:-1:1;return ep(t,r,o)||lr(t,r)}else{if(n==38||nn&&n==80&&o=="c")return op(t,-1,o)||lr(t,-1);if(n==40||nn&&n==78&&o=="c")return ok(t)||op(t,1,o)||lr(t,1);if(o==(nn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function cl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||Ao.fromSchema(t.state.schema),l=fp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,p=0;for(;d&&d.nodeType==1&&(u=up[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),p++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${p?` -${p}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
10
+
11
+ `);return{dom:c,text:f,slice:e}}function sp(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",f=>{e=f(e,i||o,t)}),i)return e?new V(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
12
+ `))),0,0):V.empty;let p=t.someProp("clipboardTextParser",f=>f(e,r,o,t));if(p)l=p;else{let f=r.marks(),{schema:h}=t.state,m=Ao.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",p=>{n=p(n,t)}),s=ck(n),zr&&dk(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let p=+u[3];p>0;p--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Qo.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!sk.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=uk(dp(l,+u[1],+u[2]),u[4]);else if(l=V.maxOpen(ak(l.content,r),!0),l.openStart||l.openEnd){let p=0,f=0;for(let h=l.content.firstChild;p<l.openStart&&!h.type.spec.isolating;p++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=dp(l,p,f)}return t.someProp("transformPasted",p=>{l=p(l,t)}),l}const sk=/^(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 ak(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&lp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=cp(s[s.length-1],i.length));let u=ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return A.from(s)}return t}function ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,A.from(t));return t}function lp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=lp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(A.from(ap(n,t,r+1))))}}function cp(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,cp(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(o))}function dl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=dl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function dp(t,e,n){return e<t.openStart&&(t=new V(dl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new V(dl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const up={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 pp=null;function fp(){return pp||(pp=document.implementation.createHTMLDocument("title"))}let ul=null;function lk(t){let e=window.trustedTypes;return e?(ul||(ul=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ul.createHTML(t)):t}function ck(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=fp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&up[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=lk(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function dk(t){let e=t.querySelectorAll(Ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function uk(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=A.from(c.create(o[l+1],r)),i++,s++}return new V(r,i,s)}const At={},vt={},pk={touchstart:!0,touchmove:!0};class fk{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},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 hk(t){for(let e in At){let n=At[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{gk(t,o)&&!fl(t,o)&&(t.editable||!(o.type in vt))&&n(t,o)},pk[e]?{passive:!0}:void 0)}Mt&&t.dom.addEventListener("input",()=>null),pl(t)}function co(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function mk(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>fl(t,o))})}function fl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function gk(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function bk(t,e){!fl(t,e)&&At[e.type]&&(t.editable||!(e.type in vt))&&At[e.type](t,e)}vt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!mp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Hn&&Ct&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),sr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,Ro(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||ik(t,n)?n.preventDefault():co(t,"key")},vt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},vt.keypress=(t,e)=>{let n=e;if(mp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||nn&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof te)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode);!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",i=>i(t,o.$from.pos,o.$to.pos,r))&&t.dispatch(t.state.tr.insertText(r).scrollIntoView()),n.preventDefault()}};function ji(t){return{left:t.clientX,top:t.clientY}}function yk(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function hl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function cr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function kk(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&ne.isSelectable(o)?(cr(t,new ne(n)),!0):!1}function wk(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof ne&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(ne.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(cr(t,ne.create(t.state.doc,r)),!0):!1}function Ek(t,e,n,o,r){return hl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?wk(t,n):kk(t,n))}function _k(t,e,n,o){return hl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function Ck(t,e,n,o){return hl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||Sk(t,n,o)}function Sk(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(cr(t,te.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)cr(t,te.create(o,l+1,l+1+s.content.size));else if(ne.isSelectable(s))cr(t,ne.create(o,l));else continue;return!0}}function ml(t){return Gi(t)}const hp=nn?"metaKey":"ctrlKey";At.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=ml(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&yk(n,t.input.lastClick)&&!n[hp]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(ji(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new xk(t,s,n,!!o)):(i=="doubleClick"?_k:Ck)(t,s.pos,s.inside,n)?n.preventDefault():co(t,"pointer"))};class xk{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[hp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof ne&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&hn&&!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)),co(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(()=>qn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ji(e))),this.updateAllowDefault(e),this.allowDefault||!n?co(this.view,"pointer"):Ek(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Mt&&this.mightDrag&&!this.mightDrag.node.isAtom||Ct&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(cr(this.view,le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):co(this.view,"pointer")}move(e){this.updateAllowDefault(e),co(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)}}At.touchstart=t=>{t.input.lastTouch=Date.now(),ml(t),co(t,"pointer")},At.touchmove=t=>{t.input.lastTouch=Date.now(),co(t,"pointer")},At.contextmenu=t=>ml(t);function mp(t,e){return t.composing?!0:Mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Nk=Hn?5e3:-1;vt.compositionstart=vt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof te&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Gi(t,!0),t.markCursor=null;else if(Gi(t,!e.selection.empty),hn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}gp(t,Nk)},vt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,gp(t,20))};function gp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Gi(t),e))}function bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ok());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Tk(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ky(e.focusNode,e.focusOffset),o=wy(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function Ok(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Gi(t,e=!1){if(!(Hn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),bp(t),e||t.docView&&t.docView.dirty){let n=rl(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Mk(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Wr=$t&&io<15||sr&&xy<604;At.copy=vt.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Wr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=cl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):Mk(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ak(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function vk(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?jr(t,o.value,null,r,e):jr(t,o.textContent,o.innerHTML,r,e)},50)}function jr(t,e,n,o,r){let i=sp(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||V.empty)))return!0;if(!i)return!1;let s=Ak(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function yp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}vt.paste=(t,e)=>{let n=e;if(t.composing&&!Hn)return;let o=Wr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&jr(t,yp(o),o.getData("text/html"),r,n)?n.preventDefault():vk(t,n)};class kp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const wp=nn?"altKey":"ctrlKey";At.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(ji(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof ne?r.to-1:r.to))){if(o&&o.mightDrag)s=ne.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let p=t.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=t.docView&&(s=ne.create(t.state.doc,p.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=cl(t,l);(!n.dataTransfer.files.length||!Ct||Nu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Wr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Wr||n.dataTransfer.setData("text/plain",d),t.dragging=new kp(u,!n[wp],s)},At.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},vt.dragover=vt.dragenter=(t,e)=>e.preventDefault(),vt.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(ji(n));if(!r)return;let i=t.state.doc.resolve(r.pos),s=o&&o.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=sp(t,yp(n.dataTransfer),Wr?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(o&&!n[wp]);if(t.someProp("handleDrop",m=>m(t,n,s||V.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?lu(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let d=t.state.tr;if(l){let{node:m}=o;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=d.doc;if(p?d.replaceRangeWith(u,u,s.content.firstChild):d.replaceRange(u,u,s),d.doc.eq(f))return;let h=d.doc.resolve(u);if(p&&ne.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new ne(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,b,y,w)=>m=w),d.setSelection(sl(t,h,d.doc.resolve(m)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))},At.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&qn(t)},20))},At.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},At.beforeinput=(t,e)=>{if(Ct&&Hn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Ro(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in vt)At[t]=vt[t];function Gr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Yi{constructor(e,n){this.toDOM=e,this.spec=n||Lo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new Ye(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Yi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Gr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class uo{constructor(e,n){this.attrs=e,this.spec=n||Lo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Ye(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof uo&&Gr(this.attrs,e.attrs)&&Gr(this.spec,e.spec)}static is(e){return e.type instanceof uo}destroy(){}}class gl{constructor(e,n){this.attrs=e,this.spec=n||Lo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Ye(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof gl&&Gr(this.attrs,e.attrs)&&Gr(this.spec,e.spec)}destroy(){}}class Ye{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new Ye(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new Ye(e,e,new Yi(n,o))}static inline(e,n,o,r){return new Ye(e,n,new uo(o,r))}static node(e,n,o,r){return new Ye(e,n,new gl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof uo}get widget(){return this.type instanceof Yi}}const dr=[],Lo={};class Oe{constructor(e,n){this.local=e.length?e:dr,this.children=n.length?n:dr}static create(e,n){return n.length?Ji(n,e,0,Lo):St}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==St||e.maps.length==0?this:this.mapInner(e,n,0,0,o||Lo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Rk(this.children,s||[],e,n,o,r,i):s?new Oe(s.sort(Po),dr):St}add(e,n){return n.length?this==St?Oe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=_p(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,Lo)),i+=3}});let s=Ep(i?Cp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Oe(s.length?this.local.concat(s).sort(Po):this.local,r||this.children)}remove(e){return e.length==0||this==St?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,p;u<e.length;u++)(p=e[u])&&p.from>l&&p.to<c&&(e[u]=null,(s||(s=[])).push(p));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=St?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Oe(r,o):St}forChild(e,n){if(this==St)return this;if(n.isLeaf)return Oe.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof uo){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new Oe(r.sort(Po),dr);return o?new po([l,o]):l}return o||St}eq(e){if(this==e)return!0;if(!(e instanceof Oe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return bl(this.localsInner(e))}localsInner(e){if(this==St)return dr;if(e.inlineContent||!this.local.some(uo.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof uo||n.push(this.local[o]);return n}forEachSet(e){e(this)}}Oe.empty=new Oe([],[]),Oe.removeOverlap=bl;const St=Oe.empty;class po{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,Lo));return po.from(o)}forChild(e,n){if(n.isLeaf)return Oe.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=St&&(i instanceof po?o=o.concat(i.members):o.push(i))}return po.from(o)}eq(e){if(!(e instanceof po)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?bl(o?n:n.sort(Po)):dr}static from(e){switch(e.length){case 0:return St;case 1:return e[0];default:return new po(e.every(n=>n instanceof Oe)?e:e.reduce((n,o)=>n.concat(o instanceof Oe?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Rk(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let p=0;n.maps[d].forEach((f,h,m,g)=>{let b=g-m-(h-f);for(let y=0;y<l.length;y+=3){let w=l[y+1];if(w<0||f>w+u-p)continue;let _=l[y]+u-p;h>=_?l[y+1]=f<=_?-2:-1:f>=u&&b&&(l[y]+=b,l[y+1]+=b)}p+=b}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),p=u-r;if(p<0||p>=o.content.size){c=!0;continue}let f=n.map(t[d+1]+i,-1),h=f-r,{index:m,offset:g}=o.content.findIndex(p),b=o.maybeChild(m);if(b&&g==p&&g+b.nodeSize==h){let y=l[d+2].mapInner(n,b,u+1,t[d]+i+1,s);y!=St?(l[d]=p,l[d+1]=h,l[d+2]=y):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=Bk(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,f=0;p<u.children.length;p+=3){let h=u.children[p];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[p],u.children[p+1],u.children[p+2])}}return new Oe(e.sort(Po),l)}function Ep(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new Ye(r.from+e,r.to+e,r.type))}return n}function Bk(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let p=c.local[u].map(o,r,d);p?n.push(p):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function _p(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Cp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=_p(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=St&&r.push(c,c+l.nodeSize,u)}});let s=Ep(i?Cp(t):t,-n).sort(Po);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Oe(s,r):St}function Po(t,e){return t.from-e.from||t.to-e.to}function bl(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),Sp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),Sp(e,r,o.copy(i.from,o.to)));break}}}return e}function Sp(t,e,n){for(;e<t.length&&Po(n,t[e])>0;)e++;t.splice(e,0,n)}function yl(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=St&&e.push(o)}),t.cursorWrapper&&e.push(Oe.create(t.state.doc,[t.cursorWrapper.deco])),po.from(e)}const Dk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ik=$t&&io<=11;class Lk{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 Pk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Lk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);$t&&io<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Ik&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,Dk)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(Zu(this.view)){if(this.suppressingSelectionUpdates)return qn(this.view);if($t&&io<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vo(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 n=new Set,o;for(let i=e.focusNode;i;i=Fr(i))n.add(i);for(let i=e.anchorNode;i;i=Fr(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))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 n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Zu(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let p=this.registerMutation(n[u],c);p&&(i=i<0?p.from:Math.min(p.from,i),s=s<0?p.to:Math.max(p.to,s),p.typeOver&&(l=!0))}if(hn&&c.length){let u=c.filter(p=>p.nodeName=="BR");if(u.length==2){let[p,f]=u;p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!p||Vk(e,p)!=h)&&f.remove()}}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ui(o)&&(d=rl(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qn(e),this.currentSelection.set(o)):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),$k(e)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||qn(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let p=e.addedNodes[u];n.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if($t&&io<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:p,nextSibling:f}=e.addedNodes[u];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(r=p),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=r&&r.parentNode==e.target?yt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?yt(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let xp=new WeakMap,Np=!1;function $k(t){if(!xp.has(t)&&(xp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=hn,Np)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."),Np=!0}}function Tp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return vo(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function Fk(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Tp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Tp(t,n):null}function Vk(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function zk(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Ui(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Ct&&t.input.lastKeyCode===8)for(let b=i;b>r;b--){let y=o.childNodes[b-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=b;break}if(!w||w.size)break}let p=t.state.doc,f=t.someProp("domParser")||Qo.fromSchema(t.state.schema),h=p.resolve(s),m=null,g=f.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Hk,context:h});if(d&&d[0].pos!=null){let b=d[0].pos,y=d[1]&&d[1].pos;y==null&&(y=b),m={anchor:b+s,head:y+s}}return{doc:g,sel:m,from:s,to:l}}function Hk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Uk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function qk(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,v=rl(t,T);if(v&&!t.state.selection.eq(v)){if(Ct&&Hn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Y=>Y(t,Ro(13,"Enter"))))return;let H=t.state.tr.setSelection(v);T=="pointer"?H.setMeta("pointer",!0):T=="key"&&H.scrollIntoView(),i&&H.setMeta("composition",i),t.dispatch(H)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=zk(t,e,n),u=t.state.doc,p=u.slice(d.from,d.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=jk(p.content,d.doc.content,d.from,f,h);if(m&&t.input.domChangeCount++,(sr&&t.input.lastIOSEnter>Date.now()-225||Hn)&&r.some(T=>T.nodeType==1&&!Uk.test(T.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",T=>T(t,Ro(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof te&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let T=Op(t,t.state.doc,d.sel);if(T&&!T.eq(t.state.selection)){let v=t.state.tr.setSelection(T);i&&v.setMeta("composition",i),t.dispatch(v)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof te&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),$t&&io<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),b=d.doc.resolveNoCache(m.endB-d.from),y=u.resolve(m.start),w=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA,_;if((sr&&t.input.lastIOSEnter>Date.now()-225&&(!w||r.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!w&&g.pos<d.doc.content.size&&!g.sameParent(b)&&(_=le.findFrom(d.doc.resolve(g.pos+1),1,!0))&&_.head==b.pos)&&t.someProp("handleKeyDown",T=>T(t,Ro(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Wk(u,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",T=>T(t,Ro(8,"Backspace")))){Hn&&Ct&&t.domObserver.suppressSelectionUpdates();return}Ct&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Hn&&!w&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,b=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,Ro(13,"Enter"))})},20));let k=m.start,S=m.endA,C,R,B;if(w){if(g.pos==b.pos)$t&&io<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>qn(t),20)),C=t.state.tr.delete(k,S),R=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(B=Kk(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start()))))C=t.state.tr,B.type=="add"?C.addMark(k,S,B.mark):C.removeMark(k,S,B.mark);else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let T=g.parent.textBetween(g.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",v=>v(t,k,S,T)))return;C=t.state.tr.insertText(T,k,S)}}if(C||(C=t.state.tr.replace(k,S,d.doc.slice(m.start-d.from,m.endB-d.from))),d.sel){let T=Op(t,C.doc,d.sel);T&&!(Ct&&t.composing&&T.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(T.head==k||T.head==C.mapping.map(S)-1)||$t&&T.empty&&T.head==k)&&C.setSelection(T)}R&&C.ensureMarks(R),i&&C.setMeta("composition",i),t.dispatch(C.scrollIntoView())}function Op(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:sl(t,e.resolve(n.anchor),e.resolve(n.head))}function Kk(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(A.from(d).eq(t))return{mark:l,type:s}}function Wk(t,e,n,o,r){if(n-e<=r.pos-o.pos||kl(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(kl(i,!0,!0));return!s.parent.isTextblock||s.pos>n||kl(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function kl(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function jk(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Mp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Mp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Mp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Gk{constructor(e,n){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 fk,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Dp),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=Rp(this),vp(this),this.nodeViews=Bp(this),this.docView=Vu(this.state.doc,Ap(this),yl(this),this.dom,this),this.domObserver=new Pk(this,(o,r,i,s)=>qk(this,o,r,i,s)),this.domObserver.start(),hk(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Dp),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Bp(this);Jk(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&pl(this),this.editable=Rp(this),vp(this);let c=yl(this),d=Ap(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(r.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Oy(this);if(s){this.domObserver.stop();let h=p&&($t||Ct)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Yk(r.selection,e.selection);if(p){let m=Ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Tk(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Vu(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Zy(this))?qn(this,h):(Ju(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&My(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ne){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Tu(this,n.getBoundingClientRect(),e)}else Tu(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 n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new kp(e.slice,e.move,r<0?void 0:ne.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if($t){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&&Ay(this.dom),qn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Iy(this,e)}coordsAtPos(e,n=1){return Bu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Vy(this,n||this.state,e)}pasteHTML(e,n){return jr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return cl(this,e)}destroy(){this.docView&&(mk(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,by())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bk(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Mt&&this.root.nodeType===11&&_y(this.dom.ownerDocument)==this.dom&&Fk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Ap(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[Ye.node(0,t.state.doc.content.size,e)]}function vp(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ye.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Rp(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Yk(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Bp(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Jk(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function Dp(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var fo={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:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Xk=typeof navigator<"u"&&/Mac/.test(navigator.platform),Zk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),kt=0;kt<10;kt++)fo[48+kt]=fo[96+kt]=String(kt);for(var kt=1;kt<=24;kt++)fo[kt+111]="F"+kt;for(var kt=65;kt<=90;kt++)fo[kt]=String.fromCharCode(kt+32),Xi[kt]=String.fromCharCode(kt);for(var wl in fo)Xi.hasOwnProperty(wl)||(Xi[wl]=fo[wl]);function Qk(t){var e=Xk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:fo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const ew=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function tw(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))ew?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function nw(t){let e=Object.create(null);for(let n in t)e[tw(n)]=t[n];return e}function El(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ow(t){return new Ae({props:{handleKeyDown:_l(t)}})}function _l(t){let e=nw(t);return function(n,o){let r=Qk(o),i,s=e[El(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[El(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.shiftKey||o.altKey||o.metaKey||r.charCodeAt(0)>127)&&(i=fo[o.keyCode])&&i!=r){let l=e[El(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Cl=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Ip(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Lp=(t,e,n)=>{let o=Ip(t,n);if(!o)return!1;let r=Sl(o);if(!r){let s=o.blockRange(),l=s&&tr(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(Kp(t,r,e,-1))return!0;if(o.parent.content.size==0&&(ur(i,"end")||ne.isSelectable(i)))for(let s=o.depth;;s--){let l=zi(t.doc,o.before(s),o.after(s),V.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(ur(i,"end")?le.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):ne.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},rw=(t,e,n)=>{let o=Ip(t,n);if(!o)return!1;let r=Sl(o);return r?Pp(t,r,e):!1},iw=(t,e,n)=>{let o=Fp(t,n);if(!o)return!1;let r=xl(o);return r?Pp(t,r,e):!1};function Pp(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=zi(t.doc,i,c,V.empty);if(!d||d.from!=i||d instanceof ut&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(te.create(u.doc,i)),n(u.scrollIntoView())}return!0}function ur(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const $p=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Sl(o)}let s=i&&i.nodeBefore;return!s||!ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(ne.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Sl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Fp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Vp=(t,e,n)=>{let o=Fp(t,n);if(!o)return!1;let r=xl(o);if(!r)return!1;let i=r.nodeAfter;if(Kp(t,r,e,1))return!0;if(o.parent.content.size==0&&(ur(i,"start")||ne.isSelectable(i))){let s=zi(t.doc,o.before(),o.after(),V.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(ur(i,"start")?le.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):ne.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},zp=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=xl(o)}let s=i&&i.nodeAfter;return!s||!ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(ne.create(t.doc,i.pos)).scrollIntoView()),!0)};function xl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const sw=(t,e)=>{let n=t.selection,o=n instanceof ne,r;if(o){if(n.node.isTextblock||!oo(t.doc,n.from))return!1;r=n.from}else if(r=Vi(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(ne.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},aw=(t,e)=>{let n=t.selection,o;if(n instanceof ne){if(n.node.isTextblock||!oo(t.doc,n.to))return!1;o=n.to}else if(o=Vi(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},lw=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&tr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Hp=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
13
+ `).scrollIntoView()),!0)};function Nl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const cw=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=Nl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(le.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Up=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Wt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Nl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(te.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},qp=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&tr(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function dw(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof ne&&e.selection.node.isBlock)return!o.parentOffset||!Vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=Nl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof te||e.selection instanceof Wt)&&u.deleteSelection();let p=u.mapping.map(o.pos),f=Vn(u.doc,p,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Vn(u.doc,p,i.length,i)),u.split(p,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const uw=dw(),pw=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(ne.create(t.doc,r))),!0)};function fw(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||oo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Kp(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&fw(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=A.empty;for(let y=s.length-1;y>=0;y--)m=A.from(s[y].create(null,m));m=A.from(r.copy(m));let g=t.tr.step(new pt(e.pos-1,h,e.pos,h,new V(m,1,0),s.length,!0)),b=g.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==r.type&&oo(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:le.findFrom(e,1),p=u&&u.$from.blockRange(u.$to),f=p&&tr(p);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(p,f).scrollIntoView()),!0;if(d&&ur(i,"start",!0)&&ur(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=A.empty;for(let _=m.length-1;_>=0;_--)y=A.from(m[_].copy(y));let w=t.tr.step(new pt(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new V(y,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Wp(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(te.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const hw=Wp(-1),mw=Wp(1);function gw(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Ha(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function jp(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),p=u.index();r=u.parent.canReplaceWith(p,p+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function Tl(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}Tl(Cl,Lp,$p),Tl(Cl,Vp,zp),Tl(Hp,Up,qp,uw),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function bw(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return yw(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function yw(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Bi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Bi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Ha(i,n,o,e);return l?(t&&kw(t,e,l,r,n),!0):!1}function kw(t,e,n,o,r){let i=A.empty;for(let u=n.length-1;u>=0;u--)i=A.from(n[u].type.create(n[u].attrs,i));t.step(new pt(e.start-(o?2:0),e.end,e.start,e.end,new V(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,p=e.endIndex,f=!0;u<p;u++,f=!1)!f&&Vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function ww(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?Ew(e,n,t,i):_w(e,n,i):!0:!1}}function Ew(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new pt(i-1,s,i,s,new V(A.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Bi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=tr(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return oo(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function _w(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?A.empty:A.from(r))))return!1;let p=i.pos,f=p+s.nodeSize;return o.step(new pt(p-(l?1:0),f+(c?1:0),p+1,f-1,new V((l?A.empty:A.from(r.copy(A.empty))).append(c?A.empty:A.from(r.copy(A.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function Cw(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=A.from(d?t.create():null),p=new V(A.from(t.create(null,A.from(l.type.create(null,u)))),d?3:1,0),f=i.start,h=i.end;n(e.tr.step(new pt(f-(d?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}function Zi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}class Qi{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:o}=this,{view:r}=n,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...u)=>{const p=c(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],c=!!e,d=e||i.tr,u=()=>(!c&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),l.every(f=>f===!0)),p={...Object.fromEntries(Object.entries(o).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(d,n),y=h(...g)(b);return l.push(y),p}])),run:u};return p}createCan(e){const{rawCommands:n,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(n).map(([c,d])=>[c,(...u)=>d(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:Zi({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([c,d])=>[c,(...u)=>d(...u)(l)]))}};return l}}class Sw{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const o=this.callbacks[e];return o&&o.forEach(r=>r.apply(this,n)),this}off(e,n){const o=this.callbacks[e];return o&&(n?this.callbacks[e]=o.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const o=(...r)=>{this.off(e,o),n.apply(this,r)};return this.on(e,o)}removeAllListeners(){this.callbacks={}}}function G(t,e,n){return t.config[e]===void 0&&t.parent?G(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?G(t.parent,e,n):null}):t.config[e]}function es(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function Gp(t){const e=[],{nodeExtensions:n,markExtensions:o}=es(t),r=[...n,...o],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=G(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(p=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:p,name:f,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=G(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,p])=>{const f={...i,...p};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function ft(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ce(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),l.forEach(u=>{const[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),o[r]=Array.from(d.entries()).map(([u,p])=>`${u}: ${p}`).join("; ")}else o[r]=i}),o},{})}function Ol(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Ce(n,o),{})}function Yp(t){return typeof t=="function"}function ye(t,e=void 0,...n){return Yp(t)?e?t.bind(e)(...n):t(...n):t}function xw(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Nw(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Jp(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Nw(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function Xp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&xw(n)?!1:n!=null))}function Zp(t,e){var n;const o=Gp(t),{nodeExtensions:r,markExtensions:i}=es(t),s=(n=r.find(d=>G(d,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(y=>y.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=t.reduce((y,w)=>{const _=G(w,"extendNodeSchema",p);return{...y,..._?_(d):{}}},{}),h=Xp({...f,content:ye(G(d,"content",p)),marks:ye(G(d,"marks",p)),group:ye(G(d,"group",p)),inline:ye(G(d,"inline",p)),atom:ye(G(d,"atom",p)),selectable:ye(G(d,"selectable",p)),draggable:ye(G(d,"draggable",p)),code:ye(G(d,"code",p)),whitespace:ye(G(d,"whitespace",p)),linebreakReplacement:ye(G(d,"linebreakReplacement",p)),defining:ye(G(d,"defining",p)),isolating:ye(G(d,"isolating",p)),attrs:Object.fromEntries(u.map(y=>{var w;return[y.name,{default:(w=y==null?void 0:y.attribute)===null||w===void 0?void 0:w.default}]}))}),m=ye(G(d,"parseHTML",p));m&&(h.parseDOM=m.map(y=>Jp(y,u)));const g=G(d,"renderHTML",p);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Ol(y,u)}));const b=G(d,"renderText",p);return b&&(h.toText=b),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(b=>b.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=t.reduce((b,y)=>{const w=G(y,"extendMarkSchema",p);return{...b,...w?w(d):{}}},{}),h=Xp({...f,inclusive:ye(G(d,"inclusive",p)),excludes:ye(G(d,"excludes",p)),group:ye(G(d,"group",p)),spanning:ye(G(d,"spanning",p)),code:ye(G(d,"code",p)),attrs:Object.fromEntries(u.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),m=ye(G(d,"parseHTML",p));m&&(h.parseDOM=m.map(b=>Jp(b,u)));const g=G(d,"renderHTML",p);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:Ol(b,u)})),[d.name,h]}));return new Hd({topNode:s,nodes:l,marks:c})}function Ml(t,e){return e.nodes[t]||e.marks[t]||null}function Qp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Al(t,e){const n=Ao.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const Tw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function vl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Yr{constructor(e){this.find=e.find,this.handler=e.handler}}const Ow=(t,e)=>{if(vl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ts(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const p=Tw(d)+i;return s.forEach(f=>{if(u)return;const h=Ow(p,f.find);if(!h)return;const m=c.state.tr,g=Zi({state:c.state,transaction:m}),b={from:o-(h[0].length-i.length),to:r},{commands:y,chain:w,can:_}=new Qi({editor:n,state:g});f.handler({state:g,range:b,match:h,commands:y,chain:w,can:_})===null||!m.steps.length||(m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Mw(t){const{editor:e,rules:n}=t,o=new Ae({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Al(A.from(u),s.schema);const{from:p}=c,f=p+u.length;ts({editor:e,from:p,to:f,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ts({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ts({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ts({editor:e,from:s.pos,to:s.pos,text:`
14
+ `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Aw(t){return Object.prototype.toString.call(t).slice(8,-1)}function ns(t){return Aw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function rs(t,e){const n={...t};return ns(t)&&ns(e)&&Object.keys(e).forEach(o=>{ns(e[o])&&ns(t[o])?n[o]=rs(t[o],e[o]):n[o]=e[o]}),n}class rn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(G(this,"addOptions",{name:this.name}))),this.storage=ye(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new rn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>rs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new rn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ye(G(n,"addOptions",{name:n.name})),n.storage=ye(G(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>(d==null?void 0:d.type.name)===n.name))return!1;const c=s.find(d=>(d==null?void 0:d.type.name)===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}}function vw(t){return typeof t=="number"}class Rw{constructor(e){this.find=e.find,this.handler=e.handler}}const Bw=(t,e,n)=>{if(vl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Dw(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),p=[];return n.doc.nodesBetween(o,r,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(o,m),b=Math.min(r,m+h.content.size),y=h.textBetween(g-m,b-m,void 0,"");Bw(y,i.find,s).forEach(_=>{if(_.index===void 0)return;const k=g+_.index+1,S=k+_[0].length,C={from:n.tr.mapping.map(k),to:n.tr.mapping.map(S)},R=i.handler({state:n,range:C,match:_,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});p.push(R)})}),p.every(h=>h!==null)}let is=null;const Iw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function Lw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:p,to:f,rule:h,pasteEvt:m})=>{const g=u.tr,b=Zi({state:u,transaction:g});if(!(!Dw({editor:e,state:b,from:Math.max(p-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new Ae({view(p){const f=m=>{var g;o=!((g=p.dom.parentElement)===null||g===void 0)&&g.contains(m.target)?p.dom.parentElement:null,o&&(is=e)},h=()=>{is&&(is=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(p,f)=>{if(i=o===p.dom.parentElement,l=f,!i){const h=is;h&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(p,f)=>{var h;const m=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(p,f,h)=>{const m=p[0],g=m.getMeta("uiEvent")==="paste"&&!r,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),w=!!y;if(!g&&!b&&!w)return;if(w){let{text:S}=y;typeof S=="string"?S=S:S=Al(A.from(S),h.schema);const{from:C}=y,R=C+S.length,B=Iw(S);return c({rule:u,state:h,from:C,to:{b:R},pasteEvt:B})}const _=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!vw(_)||!k||_===k.b))return c({rule:u,state:h,from:_,to:k,pasteEvt:s})}}))}function Pw(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}class $o{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=$o.resolve(e),this.schema=Zp(this.extensions,n),this.setupExtensions()}static resolve(e){const n=$o.sort($o.flatten(e)),o=Pw(n.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const o={name:n.name,options:n.options,storage:n.storage},r=G(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((o,r)=>{const i=G(o,"priority")||100,s=G(r,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const o={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Ml(n.name,this.schema)},r=G(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=$o.sort([...this.extensions].reverse()),o=[],r=[],i=n.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Ml(s.name,this.schema)},c=[],d=G(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&G(s,"exitable",l)&&(u.ArrowRight=()=>rn.handleExit({editor:e,mark:s})),d){const g=Object.fromEntries(Object.entries(d()).map(([b,y])=>[b,()=>y({editor:e})]));u={...u,...g}}const p=ow(u);c.push(p);const f=G(s,"addInputRules",l);Qp(s,e.options.enableInputRules)&&f&&o.push(...f());const h=G(s,"addPasteRules",l);Qp(s,e.options.enablePasteRules)&&h&&r.push(...h());const m=G(s,"addProseMirrorPlugins",l);if(m){const g=m();c.push(...g)}return c}).flat();return[Mw({editor:e,rules:o}),...Lw({editor:e,rules:r}),...i]}get attributes(){return Gp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=es(this.extensions);return Object.fromEntries(n.filter(o=>!!G(o,"addNodeView")).map(o=>{const r=this.attributes.filter(c=>c.type===o.name),i={name:o.name,options:o.options,storage:o.storage,editor:e,type:ft(o.name,this.schema)},s=G(o,"addNodeView",i);if(!s)return[];const l=(c,d,u,p,f)=>{const h=Ol(c,r);return s()({node:c,view:d,getPos:u,decorations:p,innerDecorations:f,editor:e,extension:o,HTMLAttributes:h})};return[o.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Ml(e.name,this.schema)};e.type==="mark"&&(!((n=ye(G(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=G(e,"onBeforeCreate",o),i=G(e,"onCreate",o),s=G(e,"onUpdate",o),l=G(e,"onSelectionUpdate",o),c=G(e,"onTransaction",o),d=G(e,"onFocus",o),u=G(e,"onBlur",o),p=G(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),p&&this.editor.on("destroy",p)})}}class De{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(G(this,"addOptions",{name:this.name}))),this.storage=ye(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>rs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new De({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ye(G(n,"addOptions",{name:n.name})),n.storage=ye(G(n,"addStorage",{name:n.name,options:n.options})),n}}function ef(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
15
+
16
+ `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,p)=>{var f;c.isBlock&&d>o&&(l+=i);const h=s==null?void 0:s[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:p,range:e})),!1;c.isText&&(l+=(f=c==null?void 0:c.text)===null||f===void 0?void 0:f.slice(Math.max(o,d)-d,r-d))}),l}function Rl(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const $w=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ae({key:new Ne("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Rl(n);return ef(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Fw=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),Vw=(t=!1)=>({commands:e})=>e.setContent("",t),zw=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,p=d.resolve(u.map(c)),f=d.resolve(u.map(c+l.nodeSize)),h=p.blockRange(f);if(!h)return;const m=tr(h);if(l.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},Hw=t=>e=>t(e),Uw=()=>({state:t,dispatch:e})=>Up(t,e),qw=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new te(o.doc.resolve(s-1))),!0},Kw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1},Ww=t=>({tr:e,state:n,dispatch:o})=>{const r=ft(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},jw=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},Gw=()=>({state:t,dispatch:e})=>Cl(t,e),Yw=()=>({commands:t})=>t.keyboardShortcut("Enter"),Jw=()=>({state:t,dispatch:e})=>cw(t,e);function ss(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:vl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function tf(t,e,n={}){return t.find(o=>o.type===e&&ss(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function nf(t,e,n={}){return!!tf(t,e,n)}function pr(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!tf([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&nf([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&nf([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function ho(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Xw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=ho(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const p=pr(c,i,e);if(p&&p.from<=d&&p.to>=u){const f=te.create(s,p.from,p.to);n.setSelection(f)}}return!0},Zw=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function as(t){return t instanceof te}function Kn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function of(t,e=null){if(!e)return null;const n=le.atStart(t),o=le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?te.create(t,Kn(0,r,i),Kn(t.content.size,r,i)):te.create(t,Kn(e,r,i),Kn(e,r,i))}function rf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ls(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Qw=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ls()||rf())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!as(n.state.selection))return s(),!0;const l=of(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},eE=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),tE=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),sf=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&sf(o)}return t};function Jr(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return sf(n)}function cs(t,e,n){if(t instanceof Cn||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),cs("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Hd({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Qo.fromSchema(c).parseSlice(Jr(t),n.parseOptions):Qo.fromSchema(c).parse(Jr(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Qo.fromSchema(e);return n.slice?i.parseSlice(Jr(t),n.parseOptions).content:i.parse(Jr(t),n.parseOptions)}return cs("",e,n)}function nE(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ut||r instanceof pt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const oE=t=>!("type"in t),rE=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=cs(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(m){return i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,p=!0;if((oE(l)?l:[l]).forEach(m=>{m.check(),u=u?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),c===d&&p){const{parent:m}=o.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,d+=1)}let h;if(u){if(Array.isArray(e))h=e.map(m=>m.text||"").join("");else if(e instanceof A){let m="";e.forEach(g=>{g.text&&(m+=g.text)}),h=m}else typeof e=="object"&&e&&e.text?h=e.text:h=e;o.insertText(h,c,d)}else h=l,o.replaceWith(c,d,h);n.updateSelection&&nE(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:c,text:h})}return!0},iE=()=>({state:t,dispatch:e})=>sw(t,e),sE=()=>({state:t,dispatch:e})=>aw(t,e),aE=()=>({state:t,dispatch:e})=>Lp(t,e),lE=()=>({state:t,dispatch:e})=>Vp(t,e),cE=()=>({state:t,dispatch:e,tr:n})=>{try{const o=Vi(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},dE=()=>({state:t,dispatch:e,tr:n})=>{try{const o=Vi(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},uE=()=>({state:t,dispatch:e})=>rw(t,e),pE=()=>({state:t,dispatch:e})=>iw(t,e);function af(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fE(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))ls()||af()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}const hE=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=fE(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c==null||c.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function Xr(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ft(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(p,f)=>{if(p.isText)return;const h=Math.max(o,f),m=Math.min(r,f+p.nodeSize);l.push({node:p,from:h,to:m})});const c=r-o,d=l.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>ss(p.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((p,f)=>p+f.to-f.from,0)>=c}const mE=(t,e={})=>({state:n,dispatch:o})=>{const r=ft(t,n.schema);return Xr(n,r,e)?lw(n,o):!1},gE=()=>({state:t,dispatch:e})=>qp(t,e),bE=t=>({state:e,dispatch:n})=>{const o=ft(t,e.schema);return ww(o)(e,n)},yE=()=>({state:t,dispatch:e})=>Hp(t,e);function ds(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function lf(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}const kE=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ds(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=ft(t,o.schema)),l==="mark"&&(s=ho(t,o.schema)),r&&n.selection.ranges.forEach(c=>{o.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{i&&i===d.type&&n.setNodeMarkup(u,void 0,lf(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&n.addMark(u,u+d.nodeSize,s.create(lf(p.attrs,e)))})})}),!0):!1},wE=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),EE=()=>({tr:t,dispatch:e})=>{if(e){const n=new Wt(t.doc);t.setSelection(n)}return!0},_E=()=>({state:t,dispatch:e})=>$p(t,e),CE=()=>({state:t,dispatch:e})=>zp(t,e),SE=()=>({state:t,dispatch:e})=>pw(t,e),xE=()=>({state:t,dispatch:e})=>mw(t,e),NE=()=>({state:t,dispatch:e})=>hw(t,e);function Bl(t,e,n={},o={}){return cs(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const TE=(t,e=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{var c,d;const{doc:u}=i;if(n.preserveWhitespace!=="full"){const p=Bl(t,r.schema,n,{errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck});return s&&i.replaceWith(0,u.content.size,p).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=o.errorOnInvalidContent)!==null&&d!==void 0?d:r.options.enableContentCheck})};function cf(t,e){const n=ho(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function OE(t,e){const n=new Ka(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function ME(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Dl(t,e){const n=[];return t.descendants((o,r)=>{e(o)&&n.push({node:o,pos:r})}),n}function AE(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function df(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function Il(t){return e=>df(e.$from,t)}function vE(t,e){const n=$o.resolve(t);return Zp(n,e)}function RE(t,e){const n=vE(e),o=Jr(t);return Qo.fromSchema(n).parse(o).toJSON()}function uf(t,e){const n={from:0,to:t.content.size};return ef(t,n,e)}function BE(t,e){const n=ft(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function pf(t,e){const n=ds(typeof e=="string"?e:e.name,t.schema);return n==="node"?BE(t,e):n==="mark"?cf(t,e):{}}function DE(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function IE(t){const e=DE(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function LE(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),p=e.invert().map(d,-1),f=e.invert().map(u);o.push({oldRange:{from:p,to:f},newRange:{from:d,to:u}})})}),IE(o)}function Ll(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=pr(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}function us(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function Pl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?ho(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>ss(p.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:p,$to:f})=>{const h=p.pos,m=f.pos;t.doc.nodesBetween(h,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,b),w=Math.min(m,b+g.nodeSize),_=w-y;s+=_,l.push(...g.marks.map(k=>({mark:k,from:y,to:w})))})}),s===0)return!1;const c=l.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>ss(p.mark.attrs,n,{strict:!1})).reduce((p,f)=>p+f.to-f.from,0),d=l.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,f)=>p+f.to-f.from,0);return(c>0?c+d:c)>=s}function PE(t,e,n={}){if(!e)return Xr(t,null,n)||Pl(t,null,n);const o=ds(e,t.schema);return o==="node"?Xr(t,e,n):o==="mark"?Pl(t,e,n):!1}function ff(t,e){const{nodeExtensions:n}=es(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=ye(G(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function $l(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!==null&&o!==void 0?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&($l(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function hf(t){return t instanceof ne}function mf(t,e,n){const r=t.state.doc.content.size,i=Kn(e,0,r),s=Kn(n,0,r),l=t.coordsAtPos(i),c=t.coordsAtPos(s,-1),d=Math.min(l.top,c.top),u=Math.max(l.bottom,c.bottom),p=Math.min(l.left,c.left),f=Math.max(l.right,c.right),h=f-p,m=u-d,y={top:d,bottom:u,left:p,right:f,width:h,height:m,x:p,y:d};return{...y,toJSON:()=>y}}function $E(t,e,n){var o;const{selection:r}=e;let i=null;if(as(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!==null&&o!==void 0?o:i.marks();return!!n.isInSet(l)||!l.some(c=>c.type.excludes(n))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,p,f)=>{if(d)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));d=h&&m}return!d}),d})}const FE=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=ho(t,o.schema);if(r)if(s){const d=cf(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;o.doc.nodesBetween(u,p,(f,h)=>{const m=Math.max(h,u),g=Math.min(h+f.nodeSize,p);f.marks.find(y=>y.type===c)?f.marks.forEach(y=>{c===y.type&&n.addMark(m,g,c.create({...y.attrs,...e}))}):n.addMark(m,g,c.create(e))})});return $E(o,n,c)},VE=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),zE=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ft(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>jp(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>jp(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},HE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=Kn(t,0,o.content.size),i=ne.create(o,r);e.setSelection(i)}return!0},UE=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=te.atStart(o).from,l=te.atEnd(o).to,c=Kn(r,s,l),d=Kn(i,s,l),u=te.create(o,c,d);e.setSelection(u)}return!0},qE=t=>({state:e,dispatch:n})=>{const o=ft(t,e.schema);return Cw(o)(e,n)};function gf(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e==null?void 0:e.includes(r.type.name));t.tr.ensureMarks(o)}}const KE=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=us(d,l.node().type.name,l.node().attrs);if(i instanceof ne&&i.node.isBlock)return!l.parentOffset||!Vn(s,l.pos)?!1:(o&&(t&&gf(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,f=l.depth===0?void 0:ME(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,attrs:u}]:void 0,m=Vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Vn(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),o){if(m&&(i instanceof te&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!p&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),b=e.doc.resolve(g);l.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&gf(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},WE=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ft(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const p=c.node(-1);if(p.type!==l)return!1;const f=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let y=A.empty;const w=c.index(-1)?1:c.index(-2)?2:3;for(let B=c.depth-w;B>=c.depth-3;B-=1)y=A.from(c.node(B).copy(y));const _=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,k={...us(f,c.node().type.name,c.node().attrs),...e},S=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;y=y.append(A.from(l.createAndFill(null,S)||void 0));const C=c.before(c.depth-(w-1));n.replace(C,c.after(-_),new V(y,4-w,0));let R=-1;n.doc.nodesBetween(C,n.doc.content.size,(B,T)=>{if(R>-1)return!1;B.isTextblock&&B.content.size===0&&(R=T+1)}),R>-1&&n.setSelection(te.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...us(f,p.type.name,p.attrs),...e},g={...us(f,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const b=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Vn(n.doc,c.pos,2))return!1;if(r){const{selection:y,storedMarks:w}=o,{splittableMarks:_}=i.extensionManager,k=w||y.$to.parentOffset&&y.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!k||!r)return!0;const S=k.filter(C=>_.includes(C.type.name));n.ensureMarks(S)}return!0},Fl=(t,e)=>{const n=Il(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&oo(t.doc,n.pos)&&t.join(n.pos),!0},Vl=(t,e)=>{const n=Il(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&oo(t.doc,o)&&t.join(o),!0};var jE=Object.freeze({__proto__:null,blur:Fw,clearContent:Vw,clearNodes:zw,command:Hw,createParagraphNear:Uw,cut:qw,deleteCurrentNode:Kw,deleteNode:Ww,deleteRange:jw,deleteSelection:Gw,enter:Yw,exitCode:Jw,extendMarkRange:Xw,first:Zw,focus:Qw,forEach:eE,insertContent:tE,insertContentAt:rE,joinBackward:aE,joinDown:sE,joinForward:lE,joinItemBackward:cE,joinItemForward:dE,joinTextblockBackward:uE,joinTextblockForward:pE,joinUp:iE,keyboardShortcut:hE,lift:mE,liftEmptyBlock:gE,liftListItem:bE,newlineInCode:yE,resetAttributes:kE,scrollIntoView:wE,selectAll:EE,selectNodeBackward:_E,selectNodeForward:CE,selectParentNode:SE,selectTextblockEnd:xE,selectTextblockStart:NE,setContent:TE,setMark:FE,setMeta:VE,setNode:zE,setNodeSelection:HE,setTextSelection:UE,sinkListItem:qE,splitBlock:KE,splitListItem:WE,toggleList:(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:p,splittableMarks:f}=r.extensionManager,h=ft(t,s.schema),m=ft(e,s.schema),{selection:g,storedMarks:b}=s,{$from:y,$to:w}=g,_=y.blockRange(w),k=b||g.$to.parentOffset&&g.$from.marks();if(!_)return!1;const S=Il(C=>ff(C.type.name,p))(g);if(_.depth>=1&&S&&_.depth-S.depth<=1){if(S.node.type===h)return d.liftListItem(m);if(ff(S.node.type.name,p)&&h.validContent(S.node.content)&&l)return c().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>Fl(i,h)).command(()=>Vl(i,h)).run()}return!n||!k||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Fl(i,h)).command(()=>Vl(i,h)).run():c().command(()=>{const C=u().wrapInList(h,o),R=k.filter(B=>f.includes(B.type.name));return i.ensureMarks(R),C?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Fl(i,h)).command(()=>Vl(i,h)).run()},toggleMark:(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=ho(t,o.schema);return Pl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},toggleNode:(t,e,n={})=>({state:o,commands:r})=>{const i=ft(t,o.schema),s=ft(e,o.schema),l=Xr(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},toggleWrap:(t,e={})=>({state:n,commands:o})=>{const r=ft(t,n.schema);return Xr(n,r,e)?o.lift(r):o.wrapIn(r,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=ho(t,o.schema),{$from:d,empty:u,ranges:p}=l;if(!r)return!0;if(u&&s){let{from:f,to:h}=l;const m=(i=d.marks().find(b=>b.type===c))===null||i===void 0?void 0:i.attrs,g=pr(d,c,m);g&&(f=g.from,h=g.to),n.removeMark(f,h,c)}else p.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,c)});return n.removeStoredMark(c),!0},updateAttributes:(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ds(typeof t=="string"?t:t.name,o.schema);return l?(l==="node"&&(i=ft(t,o.schema)),l==="mark"&&(s=ho(t,o.schema)),r&&n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let p,f,h,m;n.selection.empty?o.doc.nodesBetween(d,u,(g,b)=>{i&&i===g.type&&(h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),p=b,f=g)}):o.doc.nodesBetween(d,u,(g,b)=>{b<d&&i&&i===g.type&&(h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),p=b,f=g),b>=d&&b<=u&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(y=>{if(s===y.type){const w=Math.max(b,d),_=Math.min(b+g.nodeSize,u);n.addMark(w,_,s.create({...y.attrs,...e}))}}))}),f&&(p!==void 0&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(g=>{s===g.type&&n.addMark(h,m,s.create({...g.attrs,...e}))}))}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:o})=>{const r=ft(t,n.schema);return gw(r,e)(n,o)},wrapInList:(t,e={})=>({state:n,dispatch:o})=>{const r=ft(t,n.schema);return bw(r,e)(n,o)}});const GE=De.create({name:"commands",addCommands(){return{...jE}}}),YE=De.create({name:"drop",addProseMirrorPlugins(){return[new Ae({key:new Ne("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),JE=De.create({name:"editable",addProseMirrorPlugins(){return[new Ae({key:new Ne("editable"),props:{editable:()=>this.editor.options.editable}})]}}),XE=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ae({key:new Ne("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),ZE=De.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:p}=c,{pos:f,parent:h}=p,m=p.parent.isTextblock&&f>0?l.doc.resolve(f-1):p,g=m.parent.type.spec.isolating,b=p.pos-p.parentOffset,y=g&&m.parent.childCount===1?b===p.pos:le.atStart(d).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&p.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ls()||af()?i:r},addProseMirrorPlugins(){return[new Ae({key:new Ne("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const o=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),r=t.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=le.atStart(e.doc).from,d=le.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!$l(n.doc))return;const f=n.tr,h=Zi({state:n,transaction:f}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),QE=De.create({name:"paste",addProseMirrorPlugins(){return[new Ae({key:new Ne("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),e0=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Ae({key:new Ne("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Fo{get name(){return this.node.type.name}constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Fo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Fo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Fo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1),l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new Fo(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new Fo(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const t0=`.ProseMirror {
17
+ position: relative;
18
+ }
19
+
20
+ .ProseMirror {
21
+ word-wrap: break-word;
22
+ white-space: pre-wrap;
23
+ white-space: break-spaces;
24
+ -webkit-font-variant-ligatures: none;
25
+ font-variant-ligatures: none;
26
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
27
+ }
28
+
29
+ .ProseMirror [contenteditable="false"] {
30
+ white-space: normal;
31
+ }
32
+
33
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
34
+ white-space: pre-wrap;
35
+ }
36
+
37
+ .ProseMirror pre {
38
+ white-space: pre-wrap;
39
+ }
40
+
41
+ img.ProseMirror-separator {
42
+ display: inline !important;
43
+ border: none !important;
44
+ margin: 0 !important;
45
+ width: 0 !important;
46
+ height: 0 !important;
47
+ }
48
+
49
+ .ProseMirror-gapcursor {
50
+ display: none;
51
+ pointer-events: none;
52
+ position: absolute;
53
+ margin: 0;
54
+ }
55
+
56
+ .ProseMirror-gapcursor:after {
57
+ content: "";
58
+ display: block;
59
+ position: absolute;
60
+ top: -2px;
61
+ width: 20px;
62
+ border-top: 1px solid black;
63
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
64
+ }
65
+
66
+ @keyframes ProseMirror-cursor-blink {
67
+ to {
68
+ visibility: hidden;
69
+ }
70
+ }
71
+
72
+ .ProseMirror-hideselection *::selection {
73
+ background: transparent;
74
+ }
75
+
76
+ .ProseMirror-hideselection *::-moz-selection {
77
+ background: transparent;
78
+ }
79
+
80
+ .ProseMirror-hideselection * {
81
+ caret-color: transparent;
82
+ }
83
+
84
+ .ProseMirror-focused .ProseMirror-gapcursor {
85
+ display: block;
86
+ }
87
+
88
+ .tippy-box[data-animation=fade][data-state=hidden] {
89
+ opacity: 0
90
+ }`;function n0(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let jt=class extends Sw{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:o,moved:r})=>this.options.onDrop(n,o,r)),this.on("paste",({event:n,slice:o})=>this.options.onPaste(n,o)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=n0(t0,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const o=Yp(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=n.filter(l=>!l.key.startsWith(s))}),n.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,n;const r=[...this.options.enableCoreExtensions?[JE,$w.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),GE,XE,ZE,e0,YE,QE].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new $o(r,this)}createCommandManager(){this.commandManager=new Qi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Bl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=Bl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=of(n,this.options.autofocus);this.view=new Gk(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ir.create({doc:n,selection:o||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const n=this.state.apply(e),o=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return pf(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return PE(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Al(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
91
+
92
+ `,textSerializers:o={}}=e||{};return uf(this.state.doc,{blockSeparator:n,textSerializers:{...Rl(this.schema),...o}})}get isEmpty(){return $l(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Fo(n,this)}get $doc(){return this.$pos(0)}};function Vo(t){return new Yr({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ye(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),d=n.from+l.indexOf(s),u=d+s.length;if(Ll(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<n.to&&i.delete(u,n.to),d>n.from&&i.delete(n.from+c,d);const f=n.from+c+s.length;i.addMark(n.from+c,f,t.type.create(r||{})),i.removeStoredMark(t.type)}}})}function ps(t){return new Yr({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ye(t.getAttributes,void 0,o)||{},{tr:i}=e,s=n.from;let l=n.to;const c=t.type.create(r);if(o[1]){const d=o[0].lastIndexOf(o[1]);let u=s+d;u>l?u=l:l=u+o[1].length;const p=o[0][o[0].length-1];i.insertText(p,s+o[0].length-1),i.replaceWith(u,l,c)}else if(o[0]){const d=t.type.isInline?s:s-1;i.insert(d,t.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}})}function zl(t){return new Yr({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),i=ye(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function Je(t){return new Yr({find:t.find,handler:({state:e,range:n,match:o})=>{let r=t.replace,i=n.from;const s=n.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const c=i-s;c>0&&(r=o[0].slice(l-c,l)+r,i=s)}e.tr.insertText(r,i,s)}})}function fr(t){return new Yr({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=ye(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&Ha(c,t.type,i);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){const{selection:p,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,m=f||p.$to.parentOffset&&p.$from.marks();if(m){const g=m.filter(b=>h.includes(b.type.name));s.ensureMarks(g)}}if(t.keepAttributes){const p=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(p,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&oo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)}})}class Fe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ye(G(this,"addOptions",{name:this.name}))),this.storage=ye(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Fe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>rs(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Fe(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ye(G(n,"addOptions",{name:n.name})),n.storage=ye(G(n,"addStorage",{name:n.name,options:n.options})),n}}class o0{constructor(e,n,o){this.isDragging=!1,this.component=e,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...o},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.innerDecorations=n.innerDecorations,this.view=n.view,this.HTMLAttributes=n.HTMLAttributes,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var n,o,r,i,s,l,c;const{view:d}=this.editor,u=e.target,p=u.nodeType===3?(n=u.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((o=this.contentDOM)===null||o===void 0)&&o.contains(u)||!p)return;let f=0,h=0;if(this.dom!==p){const y=this.dom.getBoundingClientRect(),w=p.getBoundingClientRect(),_=(r=e.offsetX)!==null&&r!==void 0?r:(i=e.nativeEvent)===null||i===void 0?void 0:i.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=w.x-y.x+_,h=w.y-y.y+k}(c=e.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,f,h);const m=this.getPos();if(typeof m!="number")return;const g=ne.create(d.state.doc,m),b=d.state.tr.setSelection(g);d.dispatch(b)}stopEvent(e){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const o=e.target;if(!(this.dom.contains(o)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(o))))return!1;const i=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(o.tagName)||o.isContentEditable)&&!s&&!i)return!0;const{isEditable:c}=this.editor,{isDragging:d}=this,u=!!this.node.type.spec.draggable,p=ne.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",m=e.type==="cut",g=e.type==="mousedown";if(!u&&p&&i&&e.target===this.dom&&e.preventDefault(),u&&i&&!d&&e.target===this.dom)return e.preventDefault(),!1;if(u&&c&&!d&&g){const b=o.closest("[data-drag-handle]");b&&(this.dom===b||this.dom.contains(b))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(d||s||f||h||m||g&&p)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(ls()||rf())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(o=>o.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:n})=>{const o=this.getPos();return typeof o!="number"?!1:(n.setNodeMarkup(o,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const n=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:n})}}function mo(t){return new Rw({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=ye(t.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],c=o[0];let d=n.to;if(l){const u=c.search(/\S/),p=n.from+c.indexOf(l),f=p+l.length;if(Ll(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>p).length)return null;f<n.to&&s.delete(f,n.to),p>n.from&&s.delete(n.from+u,p),d=n.from+u+l.length,s.addMark(n.from+u,d,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function bf(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Ft="top",sn="bottom",an="right",Vt="left",Hl="auto",Zr=[Ft,sn,an,Vt],hr="start",Qr="end",r0="clippingParents",yf="viewport",ei="popper",i0="reference",kf=Zr.reduce(function(t,e){return t.concat([e+"-"+hr,e+"-"+Qr])},[]),wf=[].concat(Zr,[Hl]).reduce(function(t,e){return t.concat([e,e+"-"+hr,e+"-"+Qr])},[]),s0="beforeRead",a0="read",l0="afterRead",c0="beforeMain",d0="main",u0="afterMain",p0="beforeWrite",f0="write",h0="afterWrite",m0=[s0,a0,l0,c0,d0,u0,p0,f0,h0];function Tn(t){return t?(t.nodeName||"").toLowerCase():null}function Gt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function zo(t){var e=Gt(t).Element;return t instanceof e||t instanceof Element}function ln(t){var e=Gt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Ul(t){if(typeof ShadowRoot>"u")return!1;var e=Gt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function g0(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},r=e.attributes[n]||{},i=e.elements[n];!ln(i)||!Tn(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function b0(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),l=s.reduce(function(c,d){return c[d]="",c},{});!ln(r)||!Tn(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(c){r.removeAttribute(c)}))})}}const Ef={name:"applyStyles",enabled:!0,phase:"write",fn:g0,effect:b0,requires:["computeStyles"]};function On(t){return t.split("-")[0]}var Ho=Math.max,fs=Math.min,mr=Math.round;function ql(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function _f(){return!/^((?!chrome|android).)*safari/i.test(ql())}function gr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&ln(t)&&(r=t.offsetWidth>0&&mr(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&mr(o.height)/t.offsetHeight||1);var s=zo(t)?Gt(t):window,l=s.visualViewport,c=!_f()&&n,d=(o.left+(c&&l?l.offsetLeft:0))/r,u=(o.top+(c&&l?l.offsetTop:0))/i,p=o.width/r,f=o.height/i;return{width:p,height:f,top:u,right:d+p,bottom:u+f,left:d,x:d,y:u}}function Kl(t){var e=gr(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function Cf(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ul(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Wn(t){return Gt(t).getComputedStyle(t)}function y0(t){return["table","td","th"].indexOf(Tn(t))>=0}function go(t){return((zo(t)?t.ownerDocument:t.document)||window.document).documentElement}function hs(t){return Tn(t)==="html"?t:t.assignedSlot||t.parentNode||(Ul(t)?t.host:null)||go(t)}function Sf(t){return!ln(t)||Wn(t).position==="fixed"?null:t.offsetParent}function k0(t){var e=/firefox/i.test(ql()),n=/Trident/i.test(ql());if(n&&ln(t)){var o=Wn(t);if(o.position==="fixed")return null}var r=hs(t);for(Ul(r)&&(r=r.host);ln(r)&&["html","body"].indexOf(Tn(r))<0;){var i=Wn(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function ti(t){for(var e=Gt(t),n=Sf(t);n&&y0(n)&&Wn(n).position==="static";)n=Sf(n);return n&&(Tn(n)==="html"||Tn(n)==="body"&&Wn(n).position==="static")?e:n||k0(t)||e}function Wl(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ni(t,e,n){return Ho(t,fs(e,n))}function w0(t,e,n){var o=ni(t,e,n);return o>n?n:o}function xf(){return{top:0,right:0,bottom:0,left:0}}function Nf(t){return Object.assign({},xf(),t)}function Tf(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var E0=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Nf(typeof e!="number"?e:Tf(e,Zr))};function _0(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,l=On(n.placement),c=Wl(l),d=[Vt,an].indexOf(l)>=0,u=d?"height":"width";if(!(!i||!s)){var p=E0(r.padding,n),f=Kl(i),h=c==="y"?Ft:Vt,m=c==="y"?sn:an,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],b=s[c]-n.rects.reference[c],y=ti(i),w=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,_=g/2-b/2,k=p[h],S=w-f[u]-p[m],C=w/2-f[u]/2+_,R=ni(k,C,S),B=c;n.modifiersData[o]=(e={},e[B]=R,e.centerOffset=R-C,e)}}function C0(t){var e=t.state,n=t.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Cf(e.elements.popper,r)&&(e.elements.arrow=r))}const S0={name:"arrow",enabled:!0,phase:"main",fn:_0,effect:C0,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(t){return t.split("-")[1]}var x0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function N0(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:mr(n*r)/r||0,y:mr(o*r)/r||0}}function Of(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,p=t.isFixed,f=s.x,h=f===void 0?0:f,m=s.y,g=m===void 0?0:m,b=typeof u=="function"?u({x:h,y:g}):{x:h,y:g};h=b.x,g=b.y;var y=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),_=Vt,k=Ft,S=window;if(d){var C=ti(n),R="clientHeight",B="clientWidth";if(C===Gt(n)&&(C=go(n),Wn(C).position!=="static"&&l==="absolute"&&(R="scrollHeight",B="scrollWidth")),C=C,r===Ft||(r===Vt||r===an)&&i===Qr){k=sn;var T=p&&C===S&&S.visualViewport?S.visualViewport.height:C[R];g-=T-o.height,g*=c?1:-1}if(r===Vt||(r===Ft||r===sn)&&i===Qr){_=an;var v=p&&C===S&&S.visualViewport?S.visualViewport.width:C[B];h-=v-o.width,h*=c?1:-1}}var H=Object.assign({position:l},d&&x0),Y=u===!0?N0({x:h,y:g},Gt(n)):{x:h,y:g};if(h=Y.x,g=Y.y,c){var $;return Object.assign({},H,($={},$[k]=w?"0":"",$[_]=y?"0":"",$.transform=(S.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",$))}return Object.assign({},H,(e={},e[k]=w?g+"px":"",e[_]=y?h+"px":"",e.transform="",e))}function T0(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=o===void 0?!0:o,i=n.adaptive,s=i===void 0?!0:i,l=n.roundOffsets,c=l===void 0?!0:l,d={placement:On(e.placement),variation:br(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Of(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Of(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const O0={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:T0,data:{}};var ms={passive:!0};function M0(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,c=Gt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&d.forEach(function(u){u.addEventListener("scroll",n.update,ms)}),l&&c.addEventListener("resize",n.update,ms),function(){i&&d.forEach(function(u){u.removeEventListener("scroll",n.update,ms)}),l&&c.removeEventListener("resize",n.update,ms)}}const A0={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:M0,data:{}};var v0={left:"right",right:"left",bottom:"top",top:"bottom"};function gs(t){return t.replace(/left|right|bottom|top/g,function(e){return v0[e]})}var R0={start:"end",end:"start"};function Mf(t){return t.replace(/start|end/g,function(e){return R0[e]})}function jl(t){var e=Gt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function Gl(t){return gr(go(t)).left+jl(t).scrollLeft}function B0(t,e){var n=Gt(t),o=go(t),r=n.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,c=0;if(r){i=r.width,s=r.height;var d=_f();(d||!d&&e==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:i,height:s,x:l+Gl(t),y:c}}function D0(t){var e,n=go(t),o=jl(t),r=(e=t.ownerDocument)==null?void 0:e.body,i=Ho(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Ho(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+Gl(t),c=-o.scrollTop;return Wn(r||n).direction==="rtl"&&(l+=Ho(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:c}}function Yl(t){var e=Wn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function Af(t){return["html","body","#document"].indexOf(Tn(t))>=0?t.ownerDocument.body:ln(t)&&Yl(t)?t:Af(hs(t))}function oi(t,e){var n;e===void 0&&(e=[]);var o=Af(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),i=Gt(o),s=r?[i].concat(i.visualViewport||[],Yl(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(oi(hs(s)))}function Jl(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function I0(t,e){var n=gr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function vf(t,e,n){return e===yf?Jl(B0(t,n)):zo(e)?I0(e,n):Jl(D0(go(t)))}function L0(t){var e=oi(hs(t)),n=["absolute","fixed"].indexOf(Wn(t).position)>=0,o=n&&ln(t)?ti(t):t;return zo(o)?e.filter(function(r){return zo(r)&&Cf(r,o)&&Tn(r)!=="body"}):[]}function P0(t,e,n,o){var r=e==="clippingParents"?L0(t):[].concat(e),i=[].concat(r,[n]),s=i[0],l=i.reduce(function(c,d){var u=vf(t,d,o);return c.top=Ho(u.top,c.top),c.right=fs(u.right,c.right),c.bottom=fs(u.bottom,c.bottom),c.left=Ho(u.left,c.left),c},vf(t,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Rf(t){var e=t.reference,n=t.element,o=t.placement,r=o?On(o):null,i=o?br(o):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(r){case Ft:c={x:s,y:e.y-n.height};break;case sn:c={x:s,y:e.y+e.height};break;case an:c={x:e.x+e.width,y:l};break;case Vt:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var d=r?Wl(r):null;if(d!=null){var u=d==="y"?"height":"width";switch(i){case hr:c[d]=c[d]-(e[u]/2-n[u]/2);break;case Qr:c[d]=c[d]+(e[u]/2-n[u]/2);break}}return c}function ri(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=o===void 0?t.placement:o,i=n.strategy,s=i===void 0?t.strategy:i,l=n.boundary,c=l===void 0?r0:l,d=n.rootBoundary,u=d===void 0?yf:d,p=n.elementContext,f=p===void 0?ei:p,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,b=g===void 0?0:g,y=Nf(typeof b!="number"?b:Tf(b,Zr)),w=f===ei?i0:ei,_=t.rects.popper,k=t.elements[m?w:f],S=P0(zo(k)?k:k.contextElement||go(t.elements.popper),c,u,s),C=gr(t.elements.reference),R=Rf({reference:C,element:_,placement:r}),B=Jl(Object.assign({},_,R)),T=f===ei?B:C,v={top:S.top-T.top+y.top,bottom:T.bottom-S.bottom+y.bottom,left:S.left-T.left+y.left,right:T.right-S.right+y.right},H=t.modifiersData.offset;if(f===ei&&H){var Y=H[r];Object.keys(v).forEach(function($){var q=[an,sn].indexOf($)>=0?1:-1,K=[Ft,sn].indexOf($)>=0?"y":"x";v[$]+=Y[K]*q})}return v}function $0(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?wf:c,u=br(o),p=u?l?kf:kf.filter(function(m){return br(m)===u}):Zr,f=p.filter(function(m){return d.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,g){return m[g]=ri(t,{placement:g,boundary:r,rootBoundary:i,padding:s})[On(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function F0(t){if(On(t)===Hl)return[];var e=gs(t);return[Mf(t),e,Mf(e)]}function V0(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!0:s,c=n.fallbackPlacements,d=n.padding,u=n.boundary,p=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,b=e.options.placement,y=On(b),w=y===b,_=c||(w||!m?[gs(b)]:F0(b)),k=[b].concat(_).reduce(function(it,Be){return it.concat(On(Be)===Hl?$0(e,{placement:Be,boundary:u,rootBoundary:p,padding:d,flipVariations:m,allowedAutoPlacements:g}):Be)},[]),S=e.rects.reference,C=e.rects.popper,R=new Map,B=!0,T=k[0],v=0;v<k.length;v++){var H=k[v],Y=On(H),$=br(H)===hr,q=[Ft,sn].indexOf(Y)>=0,K=q?"width":"height",oe=ri(e,{placement:H,boundary:u,rootBoundary:p,altBoundary:f,padding:d}),x=q?$?an:Vt:$?sn:Ft;S[K]>C[K]&&(x=gs(x));var M=gs(x),F=[];if(i&&F.push(oe[Y]<=0),l&&F.push(oe[x]<=0,oe[M]<=0),F.every(function(it){return it})){T=H,B=!1;break}R.set(H,F)}if(B)for(var X=m?3:1,ee=function(Be){var Z=k.find(function(we){var Ee=R.get(we);if(Ee)return Ee.slice(0,Be).every(function(et){return et})});if(Z)return T=Z,"break"},de=X;de>0;de--){var xe=ee(de);if(xe==="break")break}e.placement!==T&&(e.modifiersData[o]._skip=!0,e.placement=T,e.reset=!0)}}const z0={name:"flip",enabled:!0,phase:"main",fn:V0,requiresIfExists:["offset"],data:{_skip:!1}};function Bf(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Df(t){return[Ft,an,sn,Vt].some(function(e){return t[e]>=0})}function H0(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=ri(e,{elementContext:"reference"}),l=ri(e,{altBoundary:!0}),c=Bf(s,o),d=Bf(l,r,i),u=Df(c),p=Df(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}const U0={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:H0};function q0(t,e,n){var o=On(t),r=[Vt,Ft].indexOf(o)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],l=i[1];return s=s||0,l=(l||0)*r,[Vt,an].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function K0(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=r===void 0?[0,0]:r,s=wf.reduce(function(u,p){return u[p]=q0(p,e.rects,i),u},{}),l=s[e.placement],c=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[o]=s}const W0={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:K0};function j0(t){var e=t.state,n=t.name;e.modifiersData[n]=Rf({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const G0={name:"popperOffsets",enabled:!0,phase:"read",fn:j0,data:{}};function Y0(t){return t==="x"?"y":"x"}function J0(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!1:s,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,g=m===void 0?0:m,b=ri(e,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),y=On(e.placement),w=br(e.placement),_=!w,k=Wl(y),S=Y0(k),C=e.modifiersData.popperOffsets,R=e.rects.reference,B=e.rects.popper,T=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,v=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Y={x:0,y:0};if(C){if(i){var $,q=k==="y"?Ft:Vt,K=k==="y"?sn:an,oe=k==="y"?"height":"width",x=C[k],M=x+b[q],F=x-b[K],X=h?-B[oe]/2:0,ee=w===hr?R[oe]:B[oe],de=w===hr?-B[oe]:-R[oe],xe=e.elements.arrow,it=h&&xe?Kl(xe):{width:0,height:0},Be=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:xf(),Z=Be[q],we=Be[K],Ee=ni(0,R[oe],it[oe]),et=_?R[oe]/2-X-Ee-Z-v.mainAxis:ee-Ee-Z-v.mainAxis,nt=_?-R[oe]/2+X+Ee+we+v.mainAxis:de+Ee+we+v.mainAxis,fn=e.elements.arrow&&ti(e.elements.arrow),Pn=fn?k==="y"?fn.clientTop||0:fn.clientLeft||0:0,kn=($=H==null?void 0:H[k])!=null?$:0,Zt=x+et-kn-Pn,wn=x+nt-kn,fe=ni(h?fs(M,Zt):M,x,h?Ho(F,wn):F);C[k]=fe,Y[k]=fe-x}if(l){var Ut,Tt=k==="x"?Ft:Vt,ae=k==="x"?sn:an,Dt=C[S],He=S==="y"?"height":"width",ve=Dt+b[Tt],It=Dt-b[ae],ot=[Ft,Vt].indexOf(y)!==-1,En=(Ut=H==null?void 0:H[S])!=null?Ut:0,Lt=ot?ve:Dt-R[He]-B[He]-En+v.altAxis,L=ot?Dt+R[He]+B[He]-En-v.altAxis:It,W=h&&ot?w0(Lt,Dt,L):ni(h?Lt:ve,Dt,h?L:It);C[S]=W,Y[S]=W-Dt}e.modifiersData[o]=Y}}const X0={name:"preventOverflow",enabled:!0,phase:"main",fn:J0,requiresIfExists:["offset"]};function Z0(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Q0(t){return t===Gt(t)||!ln(t)?jl(t):Z0(t)}function e_(t){var e=t.getBoundingClientRect(),n=mr(e.width)/t.offsetWidth||1,o=mr(e.height)/t.offsetHeight||1;return n!==1||o!==1}function t_(t,e,n){n===void 0&&(n=!1);var o=ln(e),r=ln(e)&&e_(e),i=go(e),s=gr(t,r,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((Tn(e)!=="body"||Yl(i))&&(l=Q0(e)),ln(e)?(c=gr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=Gl(i))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function n_(t){var e=new Map,n=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function r(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var c=e.get(l);c&&r(c)}}),o.push(i)}return t.forEach(function(i){n.has(i.name)||r(i)}),o}function o_(t){var e=n_(t);return m0.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function r_(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function i_(t){var e=t.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(e).map(function(n){return e[n]})}var If={placement:"bottom",modifiers:[],strategy:"absolute"};function Lf(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function s_(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,i=r===void 0?If:r;return function(l,c,d){d===void 0&&(d=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},If,i),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},p=[],f=!1,h={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;g(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:zo(l)?oi(l):l.contextElement?oi(l.contextElement):[],popper:oi(c)};var _=o_(i_([].concat(o,u.options.modifiers)));return u.orderedModifiers=_.filter(function(k){return k.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,_=y.popper;if(Lf(w,_)){u.rects={reference:t_(w,ti(_),u.options.strategy==="fixed"),popper:Kl(_)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(v){return u.modifiersData[v.name]=Object.assign({},v.data)});for(var k=0;k<u.orderedModifiers.length;k++){if(u.reset===!0){u.reset=!1,k=-1;continue}var S=u.orderedModifiers[k],C=S.fn,R=S.options,B=R===void 0?{}:R,T=S.name;typeof C=="function"&&(u=C({state:u,options:B,name:T,instance:h})||u)}}}},update:r_(function(){return new Promise(function(b){h.forceUpdate(),b(u)})}),destroy:function(){g(),f=!0}};if(!Lf(l,c))return h;h.setOptions(d).then(function(b){!f&&d.onFirstUpdate&&d.onFirstUpdate(b)});function m(){u.orderedModifiers.forEach(function(b){var y=b.name,w=b.options,_=w===void 0?{}:w,k=b.effect;if(typeof k=="function"){var S=k({state:u,name:y,instance:h,options:_}),C=function(){};p.push(S||C)}})}function g(){p.forEach(function(b){return b()}),p=[]}return h}}var a_=[A0,G0,O0,Ef,W0,z0,X0,S0,U0],l_=s_({defaultModifiers:a_}),c_="tippy-box",Pf="tippy-content",d_="tippy-backdrop",$f="tippy-arrow",Ff="tippy-svg-arrow",Uo={passive:!0,capture:!0},Vf=function(){return document.body};function u_(t,e){return{}.hasOwnProperty.call(t,e)}function Xl(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function Zl(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function zf(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Hf(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function p_(t,e){var n=Object.assign({},t);return e.forEach(function(o){delete n[o]}),n}function f_(t){return t.split(/\s+/).filter(Boolean)}function yr(t){return[].concat(t)}function Uf(t,e){t.indexOf(e)===-1&&t.push(e)}function h_(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function m_(t){return t.split("-")[0]}function bs(t){return[].slice.call(t)}function qf(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function ii(){return document.createElement("div")}function si(t){return["Element","Fragment"].some(function(e){return Zl(t,e)})}function g_(t){return Zl(t,"NodeList")}function b_(t){return Zl(t,"MouseEvent")}function y_(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function k_(t){return si(t)?[t]:g_(t)?bs(t):Array.isArray(t)?t:bs(document.querySelectorAll(t))}function Ql(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Kf(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function w_(t){var e,n=yr(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function E_(t,e){var n=e.clientX,o=e.clientY;return t.every(function(r){var i=r.popperRect,s=r.popperState,l=r.props,c=l.interactiveBorder,d=m_(s.placement),u=s.modifiersData.offset;if(!u)return!0;var p=d==="bottom"?u.top.y:0,f=d==="top"?u.bottom.y:0,h=d==="right"?u.left.x:0,m=d==="left"?u.right.x:0,g=i.top-o+p>c,b=o-i.bottom-f>c,y=i.left-n+h>c,w=n-i.right-m>c;return g||b||y||w})}function ec(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function Wf(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var Mn={isTouch:!1},jf=0;function __(){Mn.isTouch||(Mn.isTouch=!0,window.performance&&document.addEventListener("mousemove",Gf))}function Gf(){var t=performance.now();t-jf<20&&(Mn.isTouch=!1,document.removeEventListener("mousemove",Gf)),jf=t}function C_(){var t=document.activeElement;if(y_(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function S_(){document.addEventListener("touchstart",__,Uo),window.addEventListener("blur",C_)}var x_=typeof window<"u"&&typeof document<"u",N_=x_?!!window.msCrypto:!1;function kr(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Yf(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function T_(t){return Yf(`
93
+ %ctippy.js
94
+
95
+ %c`+Yf(t)+`
96
+
97
+ %c👷‍ This is a development-only message. It will be removed in production.
98
+ `)}function Jf(t){return[T_(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var ai;process.env.NODE_ENV!=="production"&&O_();function O_(){ai=new Set}function jn(t,e){if(t&&!ai.has(e)){var n;ai.add(e),(n=console).warn.apply(n,Jf(e))}}function tc(t,e){if(t&&!ai.has(e)){var n;ai.add(e),(n=console).error.apply(n,Jf(e))}}function M_(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;tc(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),tc(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var Xf={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},A_={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Yt=Object.assign({appendTo:Vf,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Xf,A_),v_=Object.keys(Yt),R_=function(e){process.env.NODE_ENV!=="production"&&eh(e,[]);var n=Object.keys(e);n.forEach(function(o){Yt[o]=e[o]})};function Zf(t){var e=t.plugins||[],n=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var l;o[i]=t[i]!==void 0?t[i]:(l=Yt[i])!=null?l:s}return o},{});return Object.assign({},t,n)}function B_(t,e){var n=e?Object.keys(Zf(Object.assign({},Yt,{plugins:e}))):v_,o=n.reduce(function(r,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function Qf(t,e){var n=Object.assign({},e,{content:zf(e.content,[t])},e.ignoreAttributes?{}:B_(t,e.plugins));return n.aria=Object.assign({},Yt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function eh(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(o){var r=p_(Yt,Object.keys(Xf)),i=!u_(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),jn(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
99
+
100
+ `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
101
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var D_=function(){return"innerHTML"};function nc(t,e){t[D_()]=e}function th(t){var e=ii();return t===!0?e.className=$f:(e.className=Ff,si(t)?e.appendChild(t):nc(e,t)),e}function nh(t,e){si(e.content)?(nc(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?nc(t,e.content):t.textContent=e.content)}function oc(t){var e=t.firstElementChild,n=bs(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(Pf)}),arrow:n.find(function(o){return o.classList.contains($f)||o.classList.contains(Ff)}),backdrop:n.find(function(o){return o.classList.contains(d_)})}}function oh(t){var e=ii(),n=ii();n.className=c_,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=ii();o.className=Pf,o.setAttribute("data-state","hidden"),nh(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(i,s){var l=oc(e),c=l.box,d=l.content,u=l.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&nh(d,t.props),s.arrow?u?i.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(th(s.arrow))):c.appendChild(th(s.arrow)):u&&c.removeChild(u)}return{popper:e,onUpdate:r}}oh.$$tippy=!0;var I_=1,ys=[],rc=[];function L_(t,e){var n=Qf(t,Object.assign({},Yt,Zf(qf(e)))),o,r,i,s=!1,l=!1,c=!1,d=!1,u,p,f,h=[],m=Hf(Zt,n.interactiveDebounce),g,b=I_++,y=null,w=h_(n.plugins),_={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},k={id:b,reference:t,popper:ii(),popperInstance:y,props:n,state:_,plugins:w,clearDelayTimeouts:Lt,setProps:L,setContent:W,show:he,hide:Re,hideWithInteractivity:st,enable:ot,disable:En,unmount:Qt,destroy:Ni};if(!n.render)return process.env.NODE_ENV!=="production"&&tc(!0,"render() function has not been supplied."),k;var S=n.render(k),C=S.popper,R=S.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+k.id,k.popper=C,t._tippy=k,C._tippy=k;var B=w.map(function(N){return N.fn(k)}),T=t.hasAttribute("aria-expanded");return fn(),X(),x(),M("onCreate",[k]),n.showOnCreate&&ve(),C.addEventListener("mouseenter",function(){k.props.interactive&&k.state.isVisible&&k.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){k.props.interactive&&k.props.trigger.indexOf("mouseenter")>=0&&q().addEventListener("mousemove",m)}),k;function v(){var N=k.props.touch;return Array.isArray(N)?N:[N,0]}function H(){return v()[0]==="hold"}function Y(){var N;return!!((N=k.props.render)!=null&&N.$$tippy)}function $(){return g||t}function q(){var N=$().parentNode;return N?w_(N):document}function K(){return oc(C)}function oe(N){return k.state.isMounted&&!k.state.isVisible||Mn.isTouch||u&&u.type==="focus"?0:Xl(k.props.delay,N?0:1,Yt.delay)}function x(N){N===void 0&&(N=!1),C.style.pointerEvents=k.props.interactive&&!N?"":"none",C.style.zIndex=""+k.props.zIndex}function M(N,J,ce){if(ce===void 0&&(ce=!0),B.forEach(function(Se){Se[N]&&Se[N].apply(Se,J)}),ce){var Ie;(Ie=k.props)[N].apply(Ie,J)}}function F(){var N=k.props.aria;if(N.content){var J="aria-"+N.content,ce=C.id,Ie=yr(k.props.triggerTarget||t);Ie.forEach(function(Se){var mt=Se.getAttribute(J);if(k.state.isVisible)Se.setAttribute(J,mt?mt+" "+ce:ce);else{var Pt=mt&&mt.replace(ce,"").trim();Pt?Se.setAttribute(J,Pt):Se.removeAttribute(J)}})}}function X(){if(!(T||!k.props.aria.expanded)){var N=yr(k.props.triggerTarget||t);N.forEach(function(J){k.props.interactive?J.setAttribute("aria-expanded",k.state.isVisible&&J===$()?"true":"false"):J.removeAttribute("aria-expanded")})}}function ee(){q().removeEventListener("mousemove",m),ys=ys.filter(function(N){return N!==m})}function de(N){if(!(Mn.isTouch&&(c||N.type==="mousedown"))){var J=N.composedPath&&N.composedPath()[0]||N.target;if(!(k.props.interactive&&Wf(C,J))){if(yr(k.props.triggerTarget||t).some(function(ce){return Wf(ce,J)})){if(Mn.isTouch||k.state.isVisible&&k.props.trigger.indexOf("click")>=0)return}else M("onClickOutside",[k,N]);k.props.hideOnClick===!0&&(k.clearDelayTimeouts(),k.hide(),l=!0,setTimeout(function(){l=!1}),k.state.isMounted||Z())}}}function xe(){c=!0}function it(){c=!1}function Be(){var N=q();N.addEventListener("mousedown",de,!0),N.addEventListener("touchend",de,Uo),N.addEventListener("touchstart",it,Uo),N.addEventListener("touchmove",xe,Uo)}function Z(){var N=q();N.removeEventListener("mousedown",de,!0),N.removeEventListener("touchend",de,Uo),N.removeEventListener("touchstart",it,Uo),N.removeEventListener("touchmove",xe,Uo)}function we(N,J){et(N,function(){!k.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&J()})}function Ee(N,J){et(N,J)}function et(N,J){var ce=K().box;function Ie(Se){Se.target===ce&&(ec(ce,"remove",Ie),J())}if(N===0)return J();ec(ce,"remove",p),ec(ce,"add",Ie),p=Ie}function nt(N,J,ce){ce===void 0&&(ce=!1);var Ie=yr(k.props.triggerTarget||t);Ie.forEach(function(Se){Se.addEventListener(N,J,ce),h.push({node:Se,eventType:N,handler:J,options:ce})})}function fn(){H()&&(nt("touchstart",kn,{passive:!0}),nt("touchend",wn,{passive:!0})),f_(k.props.trigger).forEach(function(N){if(N!=="manual")switch(nt(N,kn),N){case"mouseenter":nt("mouseleave",wn);break;case"focus":nt(N_?"focusout":"blur",fe);break;case"focusin":nt("focusout",fe);break}})}function Pn(){h.forEach(function(N){var J=N.node,ce=N.eventType,Ie=N.handler,Se=N.options;J.removeEventListener(ce,Ie,Se)}),h=[]}function kn(N){var J,ce=!1;if(!(!k.state.isEnabled||Ut(N)||l)){var Ie=((J=u)==null?void 0:J.type)==="focus";u=N,g=N.currentTarget,X(),!k.state.isVisible&&b_(N)&&ys.forEach(function(Se){return Se(N)}),N.type==="click"&&(k.props.trigger.indexOf("mouseenter")<0||s)&&k.props.hideOnClick!==!1&&k.state.isVisible?ce=!0:ve(N),N.type==="click"&&(s=!ce),ce&&!Ie&&It(N)}}function Zt(N){var J=N.target,ce=$().contains(J)||C.contains(J);if(!(N.type==="mousemove"&&ce)){var Ie=He().concat(C).map(function(Se){var mt,Pt=Se._tippy,So=(mt=Pt.popperInstance)==null?void 0:mt.state;return So?{popperRect:Se.getBoundingClientRect(),popperState:So,props:n}:null}).filter(Boolean);E_(Ie,N)&&(ee(),It(N))}}function wn(N){var J=Ut(N)||k.props.trigger.indexOf("click")>=0&&s;if(!J){if(k.props.interactive){k.hideWithInteractivity(N);return}It(N)}}function fe(N){k.props.trigger.indexOf("focusin")<0&&N.target!==$()||k.props.interactive&&N.relatedTarget&&C.contains(N.relatedTarget)||It(N)}function Ut(N){return Mn.isTouch?H()!==N.type.indexOf("touch")>=0:!1}function Tt(){ae();var N=k.props,J=N.popperOptions,ce=N.placement,Ie=N.offset,Se=N.getReferenceClientRect,mt=N.moveTransition,Pt=Y()?oc(C).arrow:null,So=Se?{getBoundingClientRect:Se,contextElement:Se.contextElement||$()}:t,Ti={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(O){var P=O.state;if(Y()){var ue=K(),Ge=ue.box;["placement","reference-hidden","escaped"].forEach(function(qe){qe==="placement"?Ge.setAttribute("data-placement",P.placement):P.attributes.popper["data-popper-"+qe]?Ge.setAttribute("data-"+qe,""):Ge.removeAttribute("data-"+qe)}),P.attributes.popper={}}}},qt=[{name:"offset",options:{offset:Ie}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!mt}},Ti];Y()&&Pt&&qt.push({name:"arrow",options:{element:Pt,padding:3}}),qt.push.apply(qt,(J==null?void 0:J.modifiers)||[]),k.popperInstance=l_(So,C,Object.assign({},J,{placement:ce,onFirstUpdate:f,modifiers:qt}))}function ae(){k.popperInstance&&(k.popperInstance.destroy(),k.popperInstance=null)}function Dt(){var N=k.props.appendTo,J,ce=$();k.props.interactive&&N===Vf||N==="parent"?J=ce.parentNode:J=zf(N,[ce]),J.contains(C)||J.appendChild(C),k.state.isMounted=!0,Tt(),process.env.NODE_ENV!=="production"&&jn(k.props.interactive&&N===Yt.appendTo&&ce.nextElementSibling!==C,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
102
+
103
+ `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
104
+
105
+ `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
106
+
107
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function He(){return bs(C.querySelectorAll("[data-tippy-root]"))}function ve(N){k.clearDelayTimeouts(),N&&M("onTrigger",[k,N]),Be();var J=oe(!0),ce=v(),Ie=ce[0],Se=ce[1];Mn.isTouch&&Ie==="hold"&&Se&&(J=Se),J?o=setTimeout(function(){k.show()},J):k.show()}function It(N){if(k.clearDelayTimeouts(),M("onUntrigger",[k,N]),!k.state.isVisible){Z();return}if(!(k.props.trigger.indexOf("mouseenter")>=0&&k.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&s)){var J=oe(!1);J?r=setTimeout(function(){k.state.isVisible&&k.hide()},J):i=requestAnimationFrame(function(){k.hide()})}}function ot(){k.state.isEnabled=!0}function En(){k.hide(),k.state.isEnabled=!1}function Lt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function L(N){if(process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("setProps")),!k.state.isDestroyed){M("onBeforeUpdate",[k,N]),Pn();var J=k.props,ce=Qf(t,Object.assign({},J,qf(N),{ignoreAttributes:!0}));k.props=ce,fn(),J.interactiveDebounce!==ce.interactiveDebounce&&(ee(),m=Hf(Zt,ce.interactiveDebounce)),J.triggerTarget&&!ce.triggerTarget?yr(J.triggerTarget).forEach(function(Ie){Ie.removeAttribute("aria-expanded")}):ce.triggerTarget&&t.removeAttribute("aria-expanded"),X(),x(),R&&R(J,ce),k.popperInstance&&(Tt(),He().forEach(function(Ie){requestAnimationFrame(Ie._tippy.popperInstance.forceUpdate)})),M("onAfterUpdate",[k,N])}}function W(N){k.setProps({content:N})}function he(){process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("show"));var N=k.state.isVisible,J=k.state.isDestroyed,ce=!k.state.isEnabled,Ie=Mn.isTouch&&!k.props.touch,Se=Xl(k.props.duration,0,Yt.duration);if(!(N||J||ce||Ie)&&!$().hasAttribute("disabled")&&(M("onShow",[k],!1),k.props.onShow(k)!==!1)){if(k.state.isVisible=!0,Y()&&(C.style.visibility="visible"),x(),Be(),k.state.isMounted||(C.style.transition="none"),Y()){var mt=K(),Pt=mt.box,So=mt.content;Ql([Pt,So],0)}f=function(){var qt;if(!(!k.state.isVisible||d)){if(d=!0,C.offsetHeight,C.style.transition=k.props.moveTransition,Y()&&k.props.animation){var E=K(),O=E.box,P=E.content;Ql([O,P],Se),Kf([O,P],"visible")}F(),X(),Uf(rc,k),(qt=k.popperInstance)==null||qt.forceUpdate(),M("onMount",[k]),k.props.animation&&Y()&&Ee(Se,function(){k.state.isShown=!0,M("onShown",[k])})}},Dt()}}function Re(){process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("hide"));var N=!k.state.isVisible,J=k.state.isDestroyed,ce=!k.state.isEnabled,Ie=Xl(k.props.duration,1,Yt.duration);if(!(N||J||ce)&&(M("onHide",[k],!1),k.props.onHide(k)!==!1)){if(k.state.isVisible=!1,k.state.isShown=!1,d=!1,s=!1,Y()&&(C.style.visibility="hidden"),ee(),Z(),x(!0),Y()){var Se=K(),mt=Se.box,Pt=Se.content;k.props.animation&&(Ql([mt,Pt],Ie),Kf([mt,Pt],"hidden"))}F(),X(),k.props.animation?Y()&&we(Ie,k.unmount):k.unmount()}}function st(N){process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("hideWithInteractivity")),q().addEventListener("mousemove",m),Uf(ys,m),m(N)}function Qt(){process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("unmount")),k.state.isVisible&&k.hide(),k.state.isMounted&&(ae(),He().forEach(function(N){N._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),rc=rc.filter(function(N){return N!==k}),k.state.isMounted=!1,M("onHidden",[k]))}function Ni(){process.env.NODE_ENV!=="production"&&jn(k.state.isDestroyed,kr("destroy")),!k.state.isDestroyed&&(k.clearDelayTimeouts(),k.unmount(),Pn(),delete t._tippy,k.state.isDestroyed=!0,M("onDestroy",[k]))}}function cn(t,e){e===void 0&&(e={});var n=Yt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(M_(t),eh(e,n)),S_();var o=Object.assign({},e,{plugins:n}),r=k_(t);if(process.env.NODE_ENV!=="production"){var i=si(o.content),s=r.length>1;jn(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
108
+
109
+ `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
110
+
111
+ `,`1) content: element.innerHTML
112
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(c,d){var u=d&&L_(d,o);return u&&c.push(u),c},[]);return si(t)?l[0]:l}cn.defaultProps=Yt,cn.setDefaultProps=R_,cn.currentInput=Mn,Object.assign({},Ef,{effect:function(e){var n=e.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow)}}),cn.setDefaultProps({render:oh});class P_{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:c,from:d,to:u})=>{const{doc:p,selection:f}=c,{empty:h}=f,m=!p.textBetween(d,u).length&&as(c.selection),g=this.element.contains(document.activeElement);return!(!(l.hasFocus()||g)||h||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var c;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(l.relatedTarget))||(l==null?void 0:l.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,c)=>{const d=!(c!=null&&c.selection.eq(l.state.selection)),u=!(c!=null&&c.doc.eq(l.state.doc));!d&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,d,u,c)},this.updateDelay))},this.updateHandler=(l,c,d,u)=>{var p,f,h;const{state:m,composing:g}=l,{selection:b}=m;if(g||!c&&!d)return;this.createTooltip();const{ranges:w}=b,_=Math.min(...w.map(C=>C.$from.pos)),k=Math.max(...w.map(C=>C.$to.pos));if(!((p=this.shouldShow)===null||p===void 0?void 0:p.call(this,{editor:this.editor,element:this.element,view:l,state:m,oldState:u,from:_,to:k}))){this.hide();return}(f=this.tippy)===null||f===void 0||f.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(hf(m.selection)){let C=l.nodeDOM(_);if(C){const R=C.dataset.nodeViewWrapper?C:C.querySelector("[data-node-view-wrapper]");if(R&&(C=R.firstChild),C)return C.getBoundingClientRect()}}return mf(l,_,k)})}),this.show()},this.editor=e,this.element=n,this.view=o,this.updateDelay=i,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=cn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=o.selection.from!==o.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,n);return}const i=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,i,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const rh=t=>new Ae({key:typeof t.pluginKey=="string"?new Ne(t.pluginKey):t.pluginKey,view:e=>new P_({view:e,...t})});De.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[rh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class $_{getTextContent(e){return uf(e,{textSerializers:Rl(this.editor.schema)})}constructor({editor:e,element:n,view:o,tippyOptions:r={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:s,state:l})=>{const{selection:c}=l,{$anchor:d,empty:u}=c,p=d.depth===1,f=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent&&d.parent.childCount===0&&!this.getTextContent(d.parent);return!(!s.hasFocus()||!u||!p||!f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var l;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=o,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=cn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var o,r,i;const{state:s}=e,{doc:l,selection:c}=s,{from:d,to:u}=c;if(n&&n.doc.eq(l)&&n.selection.eq(c))return;if(this.createTooltip(),!((o=this.shouldShow)===null||o===void 0?void 0:o.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(r=this.tippy)===null||r===void 0||r.setProps({getReferenceClientRect:((i=this.tippyOptions)===null||i===void 0?void 0:i.getReferenceClientRect)||(()=>mf(e,d,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ih=t=>new Ae({key:typeof t.pluginKey=="string"?new Ne(t.pluginKey):t.pluginKey,view:e=>new $_({view:e,...t})});De.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[ih({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const F_=a.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=a.ref(null);return a.onMounted(()=>{const{updateDelay:o,editor:r,pluginKey:i,shouldShow:s,tippyOptions:l}=t;r.registerPlugin(rh({updateDelay:o,editor:r,element:n.value,pluginKey:i,shouldShow:s,tippyOptions:l}))}),a.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return a.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}});function sh(t){return a.customRef((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class ah extends jt{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=sh(this.view.state),this.reactiveExtensionStorage=sh(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const o=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=o),o}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const V_=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=a.ref(),n=a.getCurrentInstance();return a.watchEffect(()=>{const o=t.editor;o&&o.options.element&&e.value&&a.nextTick(()=>{if(!e.value||!o.options.element.firstChild)return;const r=a.unref(e.value);e.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:r}),o.createNodeViews()})}),a.onBeforeUnmount(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:t=>{this.rootEl=t}})}}),z_=a.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:o,editor:r,tippyOptions:i,shouldShow:s}=t;r.registerPlugin(ih({pluginKey:o,editor:r,element:n.value,tippyOptions:i,shouldShow:s}))}),a.onBeforeUnmount(()=>{const{pluginKey:o,editor:r}=t;r.unregisterPlugin(o)}),()=>{var o;return a.h("div",{ref:n},(o=e.default)===null||o===void 0?void 0:o.call(e))}}}),An=a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),ic=a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}}),H_=(t={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new ah(t)}),a.onBeforeUnmount(()=>{var n,o,r;const i=(n=e.value)===null||n===void 0?void 0:n.options.element,s=i==null?void 0:i.cloneNode(!0);(o=i==null?void 0:i.parentNode)===null||o===void 0||o.replaceChild(s,i),(r=e.value)===null||r===void 0||r.destroy()}),e};class sc{constructor(e,{props:n={},editor:o}){this.editor=o,this.component=a.markRaw(e),this.el=document.createElement("div"),this.props=a.reactive(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,o,r;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(r=(o=this.renderedComponent.vNode)===null||o===void 0?void 0:o.component)===null||r===void 0?void 0:r.proxy}renderComponent(){let e=a.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&a.render(e,this.el),{vNode:e,destroy:()=>{this.el&&a.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,o])=>{this.props[n]=o}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const lt={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class U_ extends o0{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(r={})=>this.updateAttributes(r),deleteNode:()=>this.deleteNode()},n=this.onDragStart.bind(this);this.decorationClasses=a.ref(this.getDecorationClasses());const o=a.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:r=>{var i,s;return a.provide("onDragStart",n),a.provide("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)===null||s===void 0?void 0:s.call(i,r,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new sc(o,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,o=this.getPos();if(typeof o=="number")if(e<=o&&n>=o+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,o){const r=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=o,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:n,oldInnerDecorations:l,innerDecorations:o,updateProps:()=>r({node:e,decorations:n,innerDecorations:o})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===n&&this.innerDecorations===o||(this.node=e,this.decorations=n,this.innerDecorations=o,r({node:e,decorations:n,innerDecorations:o})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function dn(t,e){return n=>{if(!n.editor.contentComponent)return{};const o=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new U_(o,n,e)}}const q_=/^\s*>\s$/,lh=Fe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fr({find:q_,type:this.type})]}}),K_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,W_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,j_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,G_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Y_=rn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Vo({find:K_,type:this.type}),Vo({find:j_,type:this.type})]},addPasteRules(){return[mo({find:W_,type:this.type}),mo({find:G_,type:this.type})]}}),J_="listItem",ch="textStyle",dh=/^\s*([-+*])\s$/,X_=Fe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(J_,this.editor.getAttributes(ch)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fr({find:dh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fr({find:dh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ch),editor:this.editor})),[t]}}),Z_=/(^|[^`])`([^`]+)`(?!`)/,Q_=/(^|[^`])`([^`]+)`(?!`)/g,eC=rn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Vo({find:Z_,type:this.type})]},addPasteRules(){return[mo({find:Q_,type:this.type})]}}),tC=/^```([a-z]+)?[\s\n]$/,nC=/^~~~([a-z]+)?[\s\n]$/,uh=Fe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ce(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
113
+
114
+ `);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:o.nodeAt(l)?t.commands.command(({tr:d})=>(d.setSelection(le.near(o.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[zl({find:tC,type:this.type,getAttributes:t=>({language:t[1]})}),zl({find:nC,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ae({key:new Ne("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!n||!i)return!1;const{tr:s,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,`
115
+ `));return s.replaceSelectionWith(this.type.create({language:i},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(te.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),ks=Fe.create({name:"doc",topNode:!0,content:"block+"});function oC(t={}){return new Ae({view(e){return new rC(e,t)}})}class rC{constructor(e,n){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=n.width)!==null&&o!==void 0?o:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,o;if(n){let l=e.nodeBefore,c=e.nodeAfter;if(l||c){let d=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(d){let u=d.getBoundingClientRect(),p=l?u.bottom:u.top;l&&c&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:u.left,right:u.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!o){let l=this.editorView.coordsAtPos(this.cursorPos);o={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")i=-pageXOffset,s=-pageYOffset;else{let l=r.getBoundingClientRect();i=l.left-r.scrollLeft,s=l.top-r.scrollTop}this.element.style.left=o.left-i+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=lu(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const iC=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[oC(this.options)]}});class Xe extends le{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return Xe.valid(o)?new Xe(o):le.near(o)}content(){return V.empty}eq(e){return e instanceof Xe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Xe(e.resolve(n.pos))}getBookmark(){return new ac(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!sC(e)||!aC(e))return!1;let o=n.type.spec.allowGapCursor;if(o!=null)return o;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,o=!1){e:for(;;){if(!o&&Xe.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let c=e.doc.resolve(r);if(Xe.valid(c))return c}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!ne.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*n),o=!1;continue e}break}i=s,r+=n;let l=e.doc.resolve(r);if(Xe.valid(l))return l}return null}}}Xe.prototype.visible=!1,Xe.findFrom=Xe.findGapCursorFrom,le.jsonID("gapcursor",Xe);class ac{constructor(e){this.pos=e}map(e){return new ac(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Xe.valid(n)?new Xe(n):le.near(n)}}function sC(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(n==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function aC(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function lC(){return new Ae({props:{decorations:pC,createSelectionBetween(t,e,n){return e.pos==n.pos&&Xe.valid(n)?new Xe(n):null},handleClick:dC,handleKeyDown:cC,handleDOMEvents:{beforeinput:uC}}})}const cC=_l({ArrowLeft:ws("horiz",-1),ArrowRight:ws("horiz",1),ArrowUp:ws("vert",-1),ArrowDown:ws("vert",1)});function ws(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,c=s.empty;if(s instanceof te){if(!i.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=o.doc.resolve(e>0?l.after():l.before())}let d=Xe.findGapCursorFrom(l,e,c);return d?(r&&r(o.tr.setSelection(new Xe(d))),!0):!1}}function dC(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!Xe.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&ne.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Xe(o))),!0)}function uC(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Xe))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=A.empty;for(let s=o.length-1;s>=0;s--)r=A.from(o[s].createAndFill(null,r));let i=t.state.tr.replace(n.pos,n.pos,new V(r,0,0));return i.setSelection(te.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function pC(t){if(!(t.selection instanceof Xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Oe.create(t.doc,[Ye.widget(t.selection.head,e,{key:"gapcursor"})])}const fC=De.create({name:"gapCursor",addProseMirrorPlugins(){return[lC()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ye(G(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),hC=Fe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ce(this.options.HTMLAttributes,t)]},renderText(){return`
116
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const p=c.filter(f=>l.includes(f.type.name));d.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ph=Fe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ce(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>zl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Es=200,ht=function(){};ht.prototype.append=function(e){return e.length?(e=ht.from(e),!this.length&&e||e.length<Es&&this.leafAppend(e)||this.length<Es&&e.leafPrepend(this)||this.appendInner(e)):this},ht.prototype.prepend=function(e){return e.length?ht.from(e).append(this):this},ht.prototype.appendInner=function(e){return new mC(this,e)},ht.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ht.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},ht.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ht.prototype.forEach=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length),n<=o?this.forEachInner(e,n,o,0):this.forEachInvertedInner(e,n,o,0)},ht.prototype.map=function(e,n,o){n===void 0&&(n=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},n,o),r},ht.from=function(e){return e instanceof ht?e:e&&e.length?new fh(e):ht.empty};var fh=function(t){function e(o){t.call(this),this.values=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var c=i;c<s;c++)if(r(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var c=i-1;c>=s;c--)if(r(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Es)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Es)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ht);ht.empty=new fh([]);var mC=function(t){function e(n,o){t.call(this),this.left=n,this.right=o,this.length=n.length+o.length,this.depth=Math.max(n.depth,o.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e}(ht);const gC=500;class mn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;n&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,c,d=[],u=[];return this.items.forEach((p,f)=>{if(!p.step){r||(r=this.remapping(o,f+1),i=r.maps.length),i--,u.push(p);return}if(r){u.push(new vn(p.map));let h=p.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new vn(m,void 0,void 0,d.length+u.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(p.step);if(p.selection)return l=r?p.selection.map(r.slice(i)):p.selection,c=new mn(this.items.slice(0,o).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:l}}addTransform(e,n,o,r){let i=[],s=this.eventCount,l=this.items,c=!r&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let p=e.steps[u].invert(e.docs[u]),f=new vn(e.mapping.maps[u],p,n),h;(h=c&&c.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),r||(c=f)}let d=s-o.depth;return d>yC&&(l=bC(l,d),s-=d),new mn(l.append(i),s)}remapping(e,n){let o=new Dr;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,n),o}addMaps(e){return this.eventCount==0?this:new mn(this.items.append(e.map(n=>new vn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let c=n;this.items.forEach(f=>{let h=i.getMirror(--c);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),b=f.selection&&f.selection.map(i.slice(c+1,h));b&&l++,o.push(new vn(m,g,b))}else o.push(new vn(m))},r);let d=[];for(let f=n;f<s;f++)d.push(new vn(i.maps[f]));let u=this.items.slice(0,r).append(d).append(o),p=new mn(u,l);return p.emptyItemCount()>gC&&(p=p.compress(this.items.length-o.length)),p}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),o=n.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let c=s.step.map(n.slice(o)),d=c&&c.getMap();if(o--,d&&n.appendMap(d,o),c){let u=s.selection&&s.selection.map(n.slice(o));u&&i++;let p=new vn(d.invert(),c,u),f,h=r.length-1;(f=r.length&&r[h].merge(p))?r[h]=f:r.push(p)}}else s.map&&o--},this.items.length,0),new mn(ht.from(r.reverse()),i)}}mn.empty=new mn(ht.empty,0);function bC(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}class vn{constructor(e,n,o,r){this.map=e,this.step=n,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new vn(n.getMap().invert(),n,this.selection)}}}class bo{constructor(e,n,o,r,i){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const yC=20;function kC(t,e,n,o){let r=n.getMeta(qo),i;if(r)return r.historyState;n.getMeta(_C)&&(t=new bo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(qo))return s.getMeta(qo).redo?new bo(t.done.addTransform(n,void 0,o,_s(e)),t.undone,hh(n.mapping.maps),t.prevTime,t.prevComposition):new bo(t.done,t.undone.addTransform(n,void 0,o,_s(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-o.newGroupDelay||!wC(n,t.prevRanges)),d=s?lc(t.prevRanges,n.mapping):hh(n.mapping.maps);return new bo(t.done.addTransform(n,c?e.selection.getBookmark():void 0,o,_s(e)),mn.empty,d,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new bo(t.done.rebased(n,i),t.undone.rebased(n,i),lc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),lc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function wC(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(n=!0)}),n}function hh(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((o,r,i,s)=>e.push(i,s));return e}function lc(t,e){if(!t)return null;let n=[];for(let o=0;o<t.length;o+=2){let r=e.map(t[o],1),i=e.map(t[o+1],-1);r<=i&&n.push(r,i)}return n}function EC(t,e,n){let o=_s(e),r=qo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),c=new bo(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(qo,{redo:n,historyState:c})}let cc=!1,mh=null;function _s(t){let e=t.plugins;if(mh!=e){cc=!1,mh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cc=!0;break}}return cc}const qo=new Ne("history"),_C=new Ne("closeHistory");function CC(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ae({key:qo,state:{init(){return new bo(mn.empty,mn.empty,null,0,-1)},apply(e,n,o){return kC(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?bh:o=="historyRedo"?yh:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function gh(t,e){return(n,o)=>{let r=qo.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let i=EC(r,n,t);i&&o(e?i.scrollIntoView():i)}return!0}}const bh=gh(!1,!0),yh=gh(!0,!0),SC=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>bh(t,e),redo:()=>({state:t,dispatch:e})=>yh(t,e)}},addProseMirrorPlugins(){return[CC(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),kh=Fe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:o,$to:r}=n,i=t();return o.parentOffset===0?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):hf(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:l})=>{var c;if(l){const{$to:d}=s.selection,u=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?s.setSelection(te.create(s.doc,d.pos+1)):d.nodeAfter.isBlock?s.setSelection(ne.create(s.doc,d.pos)):s.setSelection(te.create(s.doc,d.pos));else{const p=(c=d.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();p&&(s.insert(u,p),s.setSelection(te.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ps({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),xC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,NC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,TC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,OC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,MC=rn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vo({find:xC,type:this.type}),Vo({find:TC,type:this.type})]},addPasteRules(){return[mo({find:NC,type:this.type}),mo({find:OC,type:this.type})]}}),AC=Fe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ce(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),vC="listItem",wh="textStyle",Eh=/^(\d+)\.\s$/,RC=Fe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ce(this.options.HTMLAttributes,n),0]:["ol",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(vC,this.editor.getAttributes(wh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fr({find:Eh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fr({find:Eh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(wh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),_h=Fe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),BC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,DC=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,IC=rn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Vo({find:BC,type:this.type})]},addPasteRules(){return[mo({find:DC,type:this.type})]}}),Ch=Fe.create({name:"text",group:"inline"}),LC=De.create({name:"starterKit",addExtensions(){var t,e,n,o,r,i,s,l,c,d,u,p,f,h,m,g,b,y;const w=[];return this.options.bold!==!1&&w.push(Y_.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&w.push(lh.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&w.push(X_.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&w.push(eC.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&w.push(uh.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&w.push(ks.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&w.push(iC.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&w.push(fC.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&w.push(hC.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&w.push(ph.configure((d=this.options)===null||d===void 0?void 0:d.heading)),this.options.history!==!1&&w.push(SC.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&w.push(kh.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&w.push(MC.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&w.push(AC.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&w.push(RC.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&w.push(_h.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&w.push(IC.configure((b=this.options)===null||b===void 0?void 0:b.strike)),this.options.text!==!1&&w.push(Ch.configure((y=this.options)===null||y===void 0?void 0:y.text)),w}}),PC=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var o,r;const i=n.getAttribute("style"),s=(r=(o=n.parentElement)===null||o===void 0?void 0:o.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},$C=rn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&PC(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,o)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||t.removeMark(o,o+n.nodeSize,this.type)}),!0}}}}),ie=a.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("span",{class:a.normalizeClass(["o-icon",{small:t.small}]),style:a.normalizeStyle({color:t.color})},[a.createElementVNode("i",{class:a.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}}),Sh={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},dc=(t,e)=>{const n=Sh[t];return n?n[e]:null},uc={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},ge={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},FC=[{label:"blue",value:"#2172e0",name:"blue"},{label:"indigo",value:"#3f51b5",name:"indigo"},{label:"cyan",value:"#00bcd4",name:"cyan"},{label:"teal",value:"#009688",name:"teal"},{label:"green",value:"#4caf50",name:"green"},{label:"deep-purple",value:"#673ab7",name:"deep-purple"},{label:"red",value:"#f44336",name:"red"},{label:"deep-orange",value:"#ff5722",name:"deep-orange"}],wr=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",icon:"format_h1",color:ge.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",icon:"format_h2",color:ge.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",icon:"format_h3",color:ge.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",icon:"check_box",color:ge.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",icon:"format_list_bulleted",color:ge.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",icon:"format_list_numbered",color:ge.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",icon:"format_quote_open",color:ge.brown,style:!0},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",color:ge.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",icon:"horizontal_rule",color:ge.blue},{label:"editor.callout",value:"callout",color:ge.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",icon:"emoji_emotions",color:ge.blue}],li=wr.filter(t=>t.style),Er=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:ge.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:ge.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:ge.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:ge.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:ge.indigo},{label:"label.image",value:"image",icon:"image",color:ge.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:ge.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:ge.purple}],Cs=[...wr,...Er],pc=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ge.blue,tips:"Ctrl+D",group:"label.common",filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:ge.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Ctrl+R",color:ge.blue,filter:"image,video,model"},{label:"label.color",value:"palette",icon:"palette",color:ge.purple,filter:"callout",component:"OCalloutColorBoard"}],xh=[{label:"ai.improve_writing",value:"improve_writing",icon:"title",color:ge.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fix_spelling_grammar",value:"fix_spelling_grammar",icon:"spellcheck",color:ge.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrich_with_emoji",value:"enrich_with_emoji",icon:"emoji_emotions",color:ge.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:ge.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.make_longer",value:"make_longer",icon:"subject",color:ge.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.make_shorter",value:"make_shorter",icon:"short_text",color:ge.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.change_tone",value:"change_tone",icon:"invert_colors",color:ge.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:ge.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],Nh=[{label:"ai.summarize",value:"summarize",icon:"notes",color:ge.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:ge.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],Th=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","fore-color","back-color","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],Oh=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","link","image"],Mh=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],Ah=["link-open","link-edit","linkUnset"],vh=["align-group","separator","link"],Rh=["align-group","separator","link-open","link-edit","linkUnset"],Bh=["heading","separator","italic","underline","font-family","separator","code","blockquote"],Dh=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],VC=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Ih=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],zC=["table-group","separator","align-group"],HC={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},UC=new _b({breaks:!0});function fc(){const t=a.inject("aiOption"),e=a.ref(null);function n(){if(!t.value)return;const{provider:r,apiKey:i,baseURL:s}=t.value,l=s||dc(r,"baseURL");!r||!i||!l||(e.value=new Zo({apiKey:i,baseURL:l,dangerouslyAllowBrowser:!0}))}const o=async(r,i)=>{var s,l,c;if(!e.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const d=await((s=e.value)==null?void 0:s.chat.completions.create({model:"deepseek-chat",messages:r,temperature:.7,stream:!0}));let u="";for await(const p of d){const f=((c=(l=p.choices[0])==null?void 0:l.delta)==null?void 0:c.content)||"";u+=f,i(f)}return u}catch(d){throw console.error("API Error:",d),new Error(d.message||"API request failed")}};return a.watch(()=>t,r=>{n()},{deep:!0}),a.onMounted(()=>{n()}),{md:UC,aiOption:t,createStreamingChatCompletion:o}}function Lh(){const t=a.ref(),e=a.ref(!1);function n(s){t.value=s,s.editor.on("selectionUpdate",i)}function o(){var s;(s=t.value)==null||s.editor.off("selectionUpdate",i)}const r=a.computed(()=>{var c;const s=(c=t.value)==null?void 0:c.getPos();if(typeof s!="number")return null;const l=t.value.editor.state.doc.nodeAt(s);return l?{start:s+1,end:s+l.nodeSize-1}:null}),i=()=>{if(!t.value)return;const{editor:s}=t.value;if(!s.isFocused){e.value=!1;return}const{selection:l}=s.state;l&&(e.value=(l==null?void 0:l.$from.pos)>=r.value.start&&(l==null?void 0:l.$to.pos)<=r.value.end)};return{isFocused:e,bind:n,unbind:o,checkFocus:i}}const Ph={isoName:"en-us",name:"English",nativeName:"English (US)",diagram:{name:"Text Diagram",flow:"Flow Diagram",sequence:"Sequence Diagram",class:"Class Diagram",state:"State Diagram",gantt:"Gantt Diagram",tips:"Generation of diagram and chart from text in a similar manner as markdown"},editor:{add:"Add",addMore:"Add More",url:"URL",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",textFormat:"More text format",list:"List",unorderedList:"Unordered List",orderedList:"Ordered List",todoList:"Todo List",subscript:"Subscript",superscript:"Superscript",hyperlink:"Hyperlink",toggleFullscreen:"Toggle Fullscreen",quote:"Quote",left:"Left align",center:"Center align",right:"Right align",justify:"Justify align",print:"Print",outdent:"Decrease indentation",indent:"Increase indentation",indentDropdown:"Indent",removeFormat:"Remove formatting",formatting:"Formatting",fontFamily:"Font Family",defaultFont:"Default Font",fontSize:"Font Size",align:"Align",hr:"Insert Horizontal Rule",undo:"Undo",redo:"Redo",heading:"Heading & Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",headings:"Headings",paragraph:"Paragraph",code:"Code",codeBlock:"Code Block",size1:"Very small",size2:"A bit small",size3:"Normal",size4:"Medium-large",size5:"Big",size6:"Very big",size7:"Maximum",viewSource:"View Source",textColor:"Text Color",highlightColor:"Highlight Color",default:"Default",lineHeight:"Line Height",blockquote:"Blockquote",table:"Table",photo:"Insert Photo",video:"Insert Video",formula:"Formula",inlineFormula:"Inline",blockFormula:"Block",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate",aiBlock:"AI Block"},label:{ai:"AI",cancel:"Cancel",color:"Color",edit:"Edit",write:"Write",link:"Link",linkAddress:"Link Address",ok:"Ok",preview:"Preview",template:"Template",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",replace:"Replace",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",more:"More",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search",think:"Think",suggested:"Suggested",noResults:"No results",generate:"Generate",generatedBy:"Generated by",update:"Update"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",selectColumn:"Select Column",removeColumn:"Remove Column",addRow:"Add Row",selectRow:"Select Row",removeRow:"Remove Row",merge:"Merge Cells",split:"Split Cells"},image:{preferences:"Image Preferences",ratio:"Ratio",size:"Size",width:"Width",height:"Height",src:"Image Source",caption:"Caption",link:"Link",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"},ai:{askAi:"Ask AI",tellAi:"Tell the AI what to write",improve_writing:"Improve writing",fix_spelling_grammar:"Fix spelling & grammar",enrich_with_emoji:"Enrich with Emoji",translate:"Translate to",make_longer:"Make longer",make_shorter:"Make shorter",continuation:"Continuation",change_tone:"Change tone",write:"Write anything",explain:"Explain",summarize:"Summarize",error:"Please provide correct AI configuration",tone:{formal:"Formal",casual:"Casual",friendly:"Friendly",enthusiastic:"Enthusiastic",authoritative:"Authoritative",humorous:"Humorous",inspirational:"Inspirational",empathetic:"Empathetic",mysterious:"Mysterious"}},language:{chinese_simplified:"Simplified Chinese",chinese_traditional:"Traditional Chinese",german:"German",french:"French",japanese:"Japanese",korean:"Korean"}},qC={isoName:"pl",nativeName:"Polski",diagram:{name:"Schemat tekstowy",flow:"Schemat przepływu",sequence:"Schemat sekwencji",class:"Schemat klas",state:"Diagram stanu",gantt:"Diagram Gantta",tips:"Generowanie diagramu i wykresu z tekstu w podobny sposób jak markdown"},editor:{add:"Dodaj",addMore:"Dodaj więcej",url:"URL",bold:"Pogrubienie",italic:"Kursywa",strikethrough:"Przekreślenie",underline:"Podkreślenie",textFormat:"More text format",unorderedList:"Lista wypunktowana",orderedList:"Lista numerowana",list:"List",todoList:"Lista rzeczy do zrobienia",subscript:"Indeks dolny",superscript:"Indeks górny",hyperlink:"Hiperłącze",toggleFullscreen:"Przełącz na tryb pełnoekranowy",quote:"Zacytuj",left:"Wyrównaj do lewej",center:"Wyrównaj do środka",right:"Wyrównaj do prawej",justify:"Wyjustuj",print:"Drukuj",outdent:"Zmniejsz wcięcie",indent:"Zwiększ wcięcie",indentDropdown:"Wcięcie",removeFormat:"Usuń formatowanie",formatting:"Formatowanie",fontFamily:"Nazwa czcionki",defaultFont:"Domyślna czcionka",fontSize:"Rozmiar czcionki",align:"Wyrównanie",hr:"Wstaw poziomą linię",undo:"Cofnij",redo:"Przywróć",heading:"Heading & Paragraph",heading1:"Nagłówek 1",heading2:"Nagłówek 2",heading3:"Nagłówek 3",heading4:"Nagłówek 4",heading5:"Nagłówek 5",headings:"Nagłówki",paragraph:"Paragraf",code:"Kod",codeBlock:"Blok kodu",size1:"Bardzo mała",size2:"Mała",size3:"Normalna",size4:"Średnio-duża",size5:"Duża",size6:"Bardzo duża",size7:"Maksymalna",viewSource:"Pokaż źródło",textColor:"Kolor czcionki",highlightColor:"Kolor wyróżnienia",default:"Dymyślny",lineHeight:"Wysokość linii",blockquote:"Cytat",table:"Tabela",photo:"Wstaw obraz",video:"Insert Video",formula:"Formuła",inlineFormula:"Formuła w treści",blockFormula:"Blokowa formuła",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Anuluj",edit:"Edycja",link:"Łącze",linkAddress:"Adres łącza",ok:"Ok",preview:"Podgląd",template:"Szablon",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferencje obrazu",ratio:"Ratio",size:"Rozmiar",width:"Szerokość",height:"Wysokość",src:"Źródło obrazu",caption:"Nagłówek",link:"Łącze",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},KC={isoName:"pt-br",nativeName:"Português (BR)",diagram:{name:"Diagrama de Texto",flow:"Diagrama de Fluxo",sequence:"Diagrama de sequência",class:"Diagrama de Classe",state:"Diagrama de Estado",gantt:"Diagrama de Gantt",tips:"Geração de diagrama ou gráfico a partir de texto semelhante a markdown"},editor:{add:"Adicionar",addMore:"Adicione Mais",url:"URL",bold:"Negrito",italic:"Itálico",strikethrough:"Tachar",underline:"Sublinhado",textFormat:"Mais formatos de textos",list:"Lista",unorderedList:"Lista com Marcadores",orderedList:"Lista Numerada",todoList:"Lista de afazer",subscript:"Subscrito",superscript:"Sobrescrito",hyperlink:"Hyperlink",toggleFullscreen:"Alternar tela-cheia",quote:"Citação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita",justify:"Justificar",print:"Imprimir",outdent:"Diminuir recuo",indent:"Aumentar recuo",indentDropdown:"Recuo",removeFormat:"Limpar formatação",formatting:"Formatação",fontFamily:"Fonte",defaultFont:"Fonte Padrão",fontSize:"Tamanho da fontee",align:"Alinhamento",hr:"Linha Horizontal",undo:"Desfazer",redo:"Refazer",heading:"Heading & Paragraph",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",heading4:"Título 4",heading5:"Título 5",headings:"Estilos de Parágrafo",paragraph:"Parágrafo",code:"Código",codeBlock:"Bloco de Código",size1:"Muito Pequeno",size2:"Pequeno",size3:"Normal",size4:"Médio",size5:"Grande",size6:"Enorme",size7:"Máximo",viewSource:"Código Fonte",textColor:"Cor do texto",highlightColor:"Cor do fundo",default:"Padrão",lineHeight:"Espaço entre linhas",blockquote:"Bloco de citação",table:"Tabela",photo:"Inserir Foto",video:"Insert Video",formula:"Fórmula",inlineFormula:"Linha",blockFormula:"Bloco",thirdPartyService:"Serviços de terceiros",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Cancelar",edit:"Editar",link:"Link",linkAddress:"Endereço do Link",ok:"Ok",preview:"Pré Visualização",template:"Modelo",example:"Exemplo",submit:"Enviar",settings:"Configurações",remove:"Excluir",help:"Ajuda",back:"Voltar",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferências da Imagem",ratio:"Ratio",size:"Tamanho",width:"Largura",height:"Altura",src:"Origem da imagem",caption:"Legenda",link:"Link",lockAspectRatio:"Bloquear proporção",unlockAspectRatio:"Desbloquear proporção",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Vídeo",map:"Mapa",design:"Design",develop:"Desenvolvimento",data:"Dados",others:"Outros",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},$h={isoName:"zh-hans",name:"Simplified Chinese",nativeName:"简体中文",diagram:{name:"文本绘图",flow:"流程图",sequence:"时序图",class:"类图",state:"状态图",gantt:"甘特图",tips:"使用Markdown风格文本生成流程图、顺序图、类图、状态图和甘特图"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗体",italic:"斜体",strikethrough:"删除线",underline:"下划线",textFormat:"更多格式",list:"列表",unorderedList:"无序列表",orderedList:"有序列表",todoList:"任务列表",subscript:"下标",superscript:"上标",hyperlink:"超链接",toggleFullscreen:"全屏切换",quote:"引号",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐",print:"打印",outdent:"减少缩进",indent:"增加缩进",indentDropdown:"缩进",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字体",defaultFont:"默认字体",fontSize:"字体大小",align:"对齐方式",hr:"插入分割线",undo:"撤消",redo:"重做",heading:"标题与段落",heading1:"标题一",heading2:"标题二",heading3:"标题三",heading4:"标题四",heading5:"标题五",headings:"标题",paragraph:"正文",code:"代码",codeBlock:"代码块",size1:"非常小",size2:"比较小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超级大",viewSource:"查看资料",textColor:"文字颜色",highlightColor:"背景颜色",default:"默认",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"图片",video:"视频",formula:"数学公式",inlineFormula:"行内公式",blockFormula:"块级公式",thirdPartyService:"第三方服务",horizontal:"水平线",callout:"高亮块",emoji:"表情",defaultColor:"默认颜色",noColor:"无色",delete:"删除",duplicate:"创建副本",aiBlock:"AI块"},label:{ai:"AI",cancel:"取消",color:"颜色",edit:"编辑",link:"链接",linkAddress:"链接地址",ok:"确定",preview:"预览",template:"模板",example:"示例",submit:"确定",settings:"设置",remove:"删除",replace:"替换",help:"帮助",back:"返回",styles:"样式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒体",image:"图片",video:"视频",model:"模型",modelViewer:"模型",more:"更多",toc:"目录",untitled:"未命名",typeForCommands:"输入 '/' 显示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"复制",cut:"剪切",search:"搜索",think:"思考",noResults:"没有结果",generate:"生成",generatedBy:"生成自",update:"更新"},table:{cellBackground:"单元格背景色",insert:"插入表格",remove:"删除表格",addColumn:"添加列",selectColumn:"选择列",removeColumn:"删除列",addRow:"添加行",selectRow:"选择行",removeRow:"删除行",merge:"合并单元格",split:"拆分单元格"},image:{preferences:"图片设置",ratio:"比例",size:"尺寸",width:"宽度",height:"高度",src:"图片地址",caption:"图片说明",link:"链接",lockAspectRatio:"锁定长宽比",unlockAspectRatio:"解锁长宽比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"视频",map:"地图",design:"设计",develop:"开发",data:"数据",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"优酷",iqiyi:"爱奇艺",bilibili:"Bilibili",qqvideo:"腾讯视频",google_map:"谷歌地图",amap:"高德地图",baidu_map:"百度",modao:"墨刀",lanhu:"蓝湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金数据",iframe:"IFrame",linkTips:"链接或代码",linkWarning:"无效的链接"},link:{back:"返回主菜单",edit:"编辑链接",off:"取消链接",open:"打开链接",open_in_new_tab:"在新标签页打开"},ai:{askAi:"探索AI",tellAi:"告诉AI需要写什么",improve_writing:"文本润色",fix_spelling_grammar:"修正拼写和语法",enrich_with_emoji:"丰富表情符号",translate:"翻译成",make_longer:"扩写",make_shorter:"简化",continuation:"续写",change_tone:"调整语气",write:"Write anything",explain:"解释",summarize:"总结",error:"请提供正确的 AI 配置信息",tone:{formal:"正式",casual:"休闲",friendly:"友好",enthusiastic:"热情",authoritative:"权威",humorous:"幽默",inspirational:"鼓舞人心",empathetic:"同理心",mysterious:"神秘"}},language:{chinese_simplified:"简体中文",chinese_traditional:"繁体中文",german:"德语",french:"法语",japanese:"日语",korean:"韩语"}},Fh={en:Ph,"en-us":Ph,pl:qC,"pt-br":KC,zh:$h,"zh-hans":$h,"zh-hant":{isoName:"zh-hant",name:"Traditional Chinese",nativeName:"繁體中文",diagram:{name:"文本繪圖",flow:"流程圖",sequence:"時序圖",class:"類圖",state:"狀態圖",gantt:"甘特圖",tips:"使用Markdown風格文本生成流程圖、順序圖、類圖、狀態圖和甘特圖"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗體",italic:"斜體",strikethrough:"刪除線",underline:"下劃線",textFormat:"更多格式",list:"列表",unorderedList:"無序列表",orderedList:"有序列表",todoList:"任務列表",subscript:"下標",superscript:"上標",hyperlink:"超鏈接",toggleFullscreen:"全屏切換",quote:"引號",left:"左對齊",center:"居中對齊",right:"右對齊",justify:"兩端對齊",print:"打印",outdent:"減少縮進",indent:"增加縮進",indentDropdown:"縮進",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字體",defaultFont:"默認字體",fontSize:"字體大小",align:"對齊方式",hr:"插入分割線",undo:"撤消",redo:"重做",heading:"標題與段落",heading1:"標題一",heading2:"標題二",heading3:"標題三",heading4:"標題四",heading5:"標題五",headings:"標題",paragraph:"正文",code:"代碼",codeBlock:"代碼塊",size1:"非常小",size2:"比較小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超級大",viewSource:"查看資料",textColor:"文字顏色",highlightColor:"背景顏色",default:"默認",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"圖片",video:"視頻",formula:"數學公式",inlineFormula:"行內公式",blockFormula:"塊級公式",thirdPartyService:"第三方服務",horizontal:"水平線",callout:"高亮塊",emoji:"表情",defaultColor:"默認顏色",noColor:"無色",delete:"刪除",duplicate:"創建副本"},label:{ai:"AI",cancel:"取消",edit:"編輯",link:"鏈接",linkAddress:"鏈接地址",ok:"確定",preview:"預覽",template:"模板",example:"示例",submit:"確定",settings:"設置",remove:"刪除",help:"幫助",back:"返回",styles:"樣式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒體",image:"圖片",video:"視頻",model:"模型",modelViewer:"模型",toc:"目錄",untitled:"未命名",typeForCommands:"輸入 '/' 顯示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"複製",cut:"剪切",search:"搜索"},table:{cellBackground:"單元格背景色",insert:"插入表格",remove:"刪除表格",addColumn:"添加列",removeColumn:"刪除列",addRow:"添加行",removeRow:"刪除行",merge:"合併/拆分 單元格"},image:{preferences:"圖片設置",ratio:"比例",size:"尺寸",width:"寬度",height:"高度",src:"圖片地址",caption:"圖片說明",link:"鏈接",lockAspectRatio:"鎖定長寬比",unlockAspectRatio:"解鎖長寬比",original:"原始",small:"小",medium:"中",large:"大"},embed:{video:"視頻",map:"地圖",design:"設計",develop:"開發",data:"數據",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"優酷",iqiyi:"愛奇藝",bilibili:"Bilibili",qqvideo:"騰訊視頻",google_map:"谷歌地圖",amap:"高德地圖",baidu_map:"百度",modao:"墨刀",lanhu:"藍湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金數據",iframe:"IFrame",linkTips:"鏈接或代碼",linkWarning:"無效的鏈接"},link:{back:"返回主菜單",edit:"編輯鏈接",off:"取消鏈接",open:"打開鏈接",open_in_new_tab:"在新標籤頁打開"}}},WC=Fh["en"],jC=t=>Fh[t]||WC;function be(){const t=a.inject("locale",{value:"en"}),e=a.computed(()=>jC(t.value)),n=a.computed(()=>{var r;return((r=e.value)==null?void 0:r.name)||"English"});function o(r){return r.split(".").reduce((i,s)=>{if(i)return i[s]},e.value)}return{languageName:n,locale:t,message:e,tr:o}}function _r(){const t=a.inject("darkMode",{value:!1}),e=a.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:e}}function Me(){const t=a.inject("isEditable",{value:!0});function e(o,r,i={}){if(!o.isEditable)return;const s=o==null?void 0:o.chain().focus(),l=o==null?void 0:o.commands;n(l,s,r,i)}function n(o,r,i,s={}){switch(console.log("command",i,s),i){case"aiBlock":r.toggleAiBlock().run();break;case"backColor":s.color?o.setHighlight({color:s.color}):o.unsetHighlight();break;case"blockquote":r.toggleBlockquote().run();break;case"bold":r.toggleBold().run();break;case"bulletList":r.toggleBulletList().run();break;case"callout":r.toggleCallout().run();break;case"clearFormat":r.unsetAllMarks().run();break;case"code":r.toggleCode().run();break;case"codeBlock":o.toggleCodeBlock({language:"bash"});break;case"content":o.insertContent(s.content);break;case"fontFamily":o.setFontFamily(s.fontFamily);break;case"foreColor":o.setColor(s.color);break;case"heading":r.toggleHeading(s).run();break;case"horizontalRule":r.setHorizontalRule().run();break;case"image":r.setImage({src:"init"}).run();break;case"imageUpdate":r.setImage(s).run();break;case"italic":r.toggleItalic().run();break;case"linkSet":r.extendMarkRange("link").setLink(s).run();break;case"linkUnset":r.extendMarkRange("link").unsetLink().run();break;case"orderedList":r.toggleOrderedList().run();break;case"paragraph":r.setParagraph().run();break;case"strike":r.toggleStrike().run();break;case"table":r.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":r.addColumnAfter().run();break;case"tableAddRow":r.addRowAfter().run();break;case"tableCellAttribute":r.setCellAttribute(s.name,s.value).run();break;case"tableDeleteColumn":r.deleteColumn().run();break;case"tableDeleteRow":r.deleteRow().run();break;case"tableDelete":r.deleteTable().run();break;case"tableInsert":r.insertTable(s).run();break;case"tableMergeCells":r.mergeCells().run();break;case"tableSelectColumn":r.selectColumn(s.pos).run();break;case"tableSelectRow":r.selectRow(s.pos).run();break;case"tableSplitCell":r.splitCell().run();break;case"taskList":o.toggleTaskList();break;case"textAlign":r.setTextAlign(s.textAlign).run();break;case"underline":r.toggleUnderline().run();break;case"video":r.setVideo({src:"init"}).run()}}return{isEditable:t,run:e,onCommand:n}}const Gn=a.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const e=t,{theme:n}=_r(),o=a.ref(),r=a.ref(),i=a.ref();function s(){i.value=cn(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function l(){i.value.setProps({theme:n.value})}return a.watch(n,c=>{l()}),a.onMounted(()=>{s()}),a.onUnmounted(()=>{i.value&&i.value.destroy()}),(c,d)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[a.renderSlot(c.$slots,"trigger"),a.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[a.renderSlot(c.$slots,"default")],512)],512))}}),Le=a.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createBlock(Gn,{class:"o-tooltip",placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("button",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[a.createVNode(ie,{name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"]),a.renderSlot(o.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),GC=a.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const e=t,{run:n}=Me(),{tr:o}=be(),r=a.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:o("label.ai")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:o("editor.aiBlock")}})),i=a.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){n(e.editor,e.name)}return(l,c)=>{var d;return a.openBlock(),a.createBlock(Le,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(t.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),YC={class:"o-block-placeholder"},JC={class:"icon"},XC={class:"placeholder"},hc=a.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("section",YC,[a.createElementVNode("div",JC,[a.createVNode(a.unref(ie),{name:t.icon},null,8,["name"])]),a.createElementVNode("div",XC,a.toDisplayString(t.placeholder),1)]))}}),ZC={class:"group o-tips"},QC={key:1,class:"item"},Ss=a.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=be(),i=a.ref([]),s=(h,m)=>{h&&(i.value[m]=h)},l=a.ref(0);function c(h,m,g){o("select",h,g),i.value[m]&&i.value[m].setShow(!1)}function d(){l.value=(l.value+n.items.length-1)%n.items.length}function u(){l.value=(l.value+1)%n.items.length}function p(){c(n.items[l.value],l.value)}function f(h){switch(h.key){case"ArrowUp":h.preventDefault(),d();break;case"ArrowDown":h.preventDefault(),u();break;case"Enter":h.preventDefault(),p();break}}return a.watch(()=>n.useKeyboard,h=>{h?window.addEventListener("keydown",f):window.removeEventListener("keydown",f)}),a.onMounted(()=>{n.useKeyboard&&window.addEventListener("keydown",f)}),a.onBeforeUnmount(()=>{n.useKeyboard&&window.removeEventListener("keydown",f)}),(h,m)=>(a.openBlock(),a.createBlock(a.unref(Jt),{class:"o-block-list",hoverable:"",clickable:""},{default:a.withCtx(()=>[t.items.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(t.items,(g,b)=>{var y;return a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[b>0?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",ZC,a.toDisplayString(a.unref(r)(g.group)),1)],64)):a.createCommentVNode("",!0),(y=g.children)!=null&&y.length?(a.openBlock(),a.createBlock(a.unref(Pe),{key:1,ref_for:!0,ref:w=>s(w,b),placement:"right-start",offset:[-10,16]},{trigger:a.withCtx(()=>[a.createVNode(a.unref(mc),{item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:""},null,8,["item","class"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Ss),{items:g.children,onSelect:w=>c(g,b,w)},null,8,["items","onSelect"])]),_:2},1536)):(a.openBlock(),a.createBlock(a.unref(mc),{key:2,item:g,class:a.normalizeClass(["item",{"is-active":b===l.value}]),clickable:"",onClick:w=>c(g,b)},null,8,["item","class","onClick"]))],64)}),128)):(a.openBlock(),a.createElementBlock("div",QC,a.toDisplayString(a.unref(r)("label.noResults")),1))]),_:1}))}}),eS={key:0,class:"o-tips"},mc=a.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:e}){const{tr:n}=be();return(o,r)=>(a.openBlock(),a.createBlock(a.unref(zt),{class:"o-block-list-item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:t.item.icon,color:t.item.color},null,8,["name","color"])]),suffix:a.withCtx(()=>{var i;return[t.item.tips?(a.openBlock(),a.createElementBlock("span",eS,a.toDisplayString(t.item.tips),1)):a.createCommentVNode("",!0),(i=t.item.children)!=null&&i.length?(a.openBlock(),a.createBlock(a.unref(ie),{key:1,name:"navigate_next",class:"o-tips"})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)(t.item.label)),1)]),_:1}))}}),tS={key:1,class:"group o-tips"},nS={class:"suffix o-tips"},oS={key:1,class:"item"},yo=a.defineComponent({__name:"OBlockMenu",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=be(),i=a.ref([]),s=a.computed(()=>{var h;return(h=n.node)==null?void 0:h.type.name}),l=a.computed(()=>{const h=pc.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf("common"))>=0}),m=pc.filter(g=>{var b;return((b=g.filter)==null?void 0:b.indexOf(s.value))>=0});if(m.length>0){const g=m[0];g.group=`editor.${s.value}`}return[...h,...m]});function c(h){switch(h.component){case"OCalloutColorBoard":return bc;default:return null}}function d(h){o("action",h),setTimeout(()=>{u(h)},0)}function u(h){switch(h.value){case"delete":n.deleteNode();break;case"duplicate":p();break}}function p(){var y,w,_;const h=n.node.nodeSize,m=n.getPos()+h,g=JSON.parse(JSON.stringify(n.node));(y=n.editor)==null||y.commands.insertContentAt(m,{type:"paragraph"}),(w=n.editor)==null||w.commands.insertContentAt(m,g);const b=m+h+1;(_=n.editor)==null||_.commands.focus(b)}function f(h,m){switch(console.log("select",h,m),m.name){case"backColor":n.updateAttributes({backColor:m.value});break;case"foreColor":n.updateAttributes({borderColor:m.value});break}}return(h,m)=>(a.openBlock(),a.createBlock(a.unref(Jt),{class:"o-block-menu",hoverable:"",clickable:""},{default:a.withCtx(()=>[l.value.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(l.value,(g,b)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[b>0?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),t.showGroup?(a.openBlock(),a.createElementBlock("div",tS,a.toDisplayString(a.unref(r)(g.group)),1)):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0),c(g)?(a.openBlock(),a.createBlock(a.unref(Pe),{key:1,ref_for:!0,ref:i.value[g.value],offset:[0,16],placement:"right"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(zt),{class:"item",clickable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"navigate_next",class:"o-tips"})]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(r)(g.label)),1)]),_:2},1024)]),default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(c(g)),{onSelect:y=>f(g,y)},null,40,["onSelect"]))]),_:2},1536)):(a.openBlock(),a.createBlock(a.unref(zt),{key:2,class:"item",clickable:"",onClick:y=>d(g)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:g.icon,color:t.colorful?g.color:""},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("div",nS,a.toDisplayString(g.tips),1)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(r)(g.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(a.openBlock(),a.createElementBlock("div",oS,"No result"))]),_:1}))}}),Yn=a.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:e}){const n=t,o=e,r=a.ref();function i(l){o("update:modelValue",l)}function s(){console.log("click outside"),n.hideClickOutside&&o("update:modelValue",!1)}return a.watch(()=>n.modelValue,l=>{var c,d;l?(c=r.value)==null||c.setShow(!0):(d=r.value)==null||d.setShow(!1)}),a.onMounted(()=>{var l;n.modelValue&&((l=r.value)==null||l.setShow(!0))}),a.onUnmounted(()=>{var l;(l=r.value)==null||l.setShow(!1)}),(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,placement:t.placement,"tippy-class":t.tippyClass,"content-class":t.contentClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue,"onUpdate:show":i,onClickoutside:s},{trigger:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),default:a.withCtx(()=>[a.renderSlot(l.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),rS={class:"o-block-toolbar editable-only"},iS={class:"button-group"},gc=a.defineComponent({__name:"OBlockToolbar",props:{...lt,type:{type:String,default:"link"}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=be(),s=a.ref();function l(c){var d;o("action",c),(d=s.value)==null||d.setShow(!1)}return(c,d)=>(a.openBlock(),a.createElementBlock("div",rS,[a.createElementVNode("section",iS,[a.renderSlot(c.$slots,"default"),a.createVNode(a.unref(Pe),{ref_key:"popover",ref:s,placement:"bottom-end",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"more_horiz",tooltip:a.unref(i)("label.more")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(yo),a.mergeProps(n,{onAction:l}),null,16)]),_:1},512)])]))}}),sS={class:"o-callout-color-board"},aS={class:"fore-colors"},lS={class:"color-row"},cS={class:"color-row"},dS={class:"back-colors"},uS={class:"color-row"},pS={class:"color-row"},bc=a.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,l){n("select",{name:s,value:l.value})}const r=a.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=a.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(a.openBlock(),a.createElementBlock("section",sS,[a.createElementVNode("section",aS,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),a.createElementVNode("div",lS,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:l[0]||(l[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:l[1]||(l[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",cS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,d)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>o("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),a.createElementVNode("section",dS,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",uS,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:l[2]||(l[2]=c=>o("backColor",{value:"#F5F5F5"}))}),t.backColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:l[3]||(l[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",pS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,d)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),fS=a.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:e}){const n=e,{tr:o}=be(),{run:r}=Me(),i=a.ref(null),s=a.ref(""),l=a.ref("");function c(d,u){d==="foreColor"?(s.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(l.value=u,localStorage.setItem("yiitap.text-color.back",u)),n("select",d,u)}return a.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"palette",tooltip:a.unref(o)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var p;return[a.createVNode(a.unref(bc),{"fore-color":s.value,"back-color":l.value,"default-label":a.unref(o)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),ci=a.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref();a.computed(()=>{var l;return n.clientX||((l=n.event)==null?void 0:l.clientX)||0}),a.computed(()=>{var l;return n.clientY||((l=n.event)==null?void 0:l.clientY)||0});function i(l){o("update:modelValue",l)}function s(){o("update:modelValue",!1)}return a.watch(()=>n.modelValue,l=>{var c;l?setTimeout(()=>{var d;(d=r.value)==null||d.setShow(l)},0):(c=r.value)==null||c.setShow(l)}),(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":i,onClickoutside:s},{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},8,["show","event"]))}}),hS={class:"o-color-board"},mS={class:"cell-container"},gS={class:"label"},bS=["onClick"],xs=a.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=t,o=e;function r(c){o("select",c.hex)}function i(c){return n.activeColor===c}function s(c){return"abc"}const l=a.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,d)=>(a.openBlock(),a.createElementBlock("section",hS,[a.createElementVNode("div",{class:"default-color",onClick:d[0]||(d[0]=u=>r({hex:t.defaultColor}))},[a.createElementVNode("div",mS,[a.createElementVNode("div",{class:"cell border",style:a.normalizeStyle({background:t.defaultColor})},[a.createVNode(a.unref(ie),{name:"slash_forward"})],4)]),a.createElementVNode("div",gS,a.toDisplayString(t.defaultLabel),1)]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,(u,p)=>(a.openBlock(),a.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u,(f,h)=>(a.openBlock(),a.createElementBlock("div",{class:"",key:`col-${h}`},[a.createElementVNode("div",{class:"cell-container",onClick:m=>r(f)},[a.createElementVNode("div",{class:a.normalizeClass(["cell",{border:f.border}]),style:a.normalizeStyle({backgroundColor:f.hex})},[i(f.hex)?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",style:a.normalizeStyle({color:s(f.rgb)})},null,8,["style"])):a.createCommentVNode("",!0)],6)],8,bS)]))),128))]))),128))]))}}),ct=a.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Gn),{placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("button",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=i=>n("click",i))},[t.icon?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"])):a.createCommentVNode("",!0),a.renderSlot(o.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),yS={key:0,class:"o-doc-toc toc"},kS={class:"mini-view"},wS={class:"toc__list"},ES={class:"main-view o-scroll"},_S={class:"toc__title"},CS={class:"toc__list"},SS=["onClick"],xS=a.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:jt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=be(),s=a.ref([]),l=a.ref("");function c(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",p)}function u(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,b)=>{if(g.type.name==="heading"){const y=g.attrs["data-id"];h.push({level:g.attrs.level,text:g.textContent,id:y})}}),s.value=h}function p(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const b=g.getBoundingClientRect();if(b.top>=0&&b.top<window.innerHeight/2){l.value=m.id;break}}r("docScroll",h)}function f(h){l.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return a.watch(()=>o.editor,h=>{c()}),e({onScroll:p,headings:s}),(h,m)=>s.value.length?(a.openBlock(),a.createElementBlock("section",yS,[a.createVNode(a.unref(Pe),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:a.withCtx(()=>[a.createElementVNode("div",kS,[a.createElementVNode("ul",wS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(g,b)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:b},[g.level<=Math.max(Math.min(t.maxLevel,3),2)?(a.openBlock(),a.createElementBlock("li",{key:0,class:a.normalizeClass(["toc__item",[l.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):a.createCommentVNode("",!0)],64))),128))])])]),default:a.withCtx(()=>[a.createElementVNode("div",ES,[a.createElementVNode("div",_S,a.toDisplayString(a.unref(i)("label.toc")),1),a.createElementVNode("ul",CS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(g,b)=>(a.openBlock(),a.createElementBlock("li",{class:a.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:b},[a.createElementVNode("span",{class:a.normalizeClass(["heading",{selected:l.value===g.id}]),onClick:y=>f(g)},a.toDisplayString(g.text),11,SS)],2))),128))])])]),_:1},512)])):a.createCommentVNode("",!0)}}),NS={class:"o-emoji-select"},TS={key:0},OS={class:"groups o-scroll"},MS={class:"items"},AS=["onClick"],vS={key:0,class:"groups-empty"},RS={class:"group-icons"},BS=["onClick"],Ns=a.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(""),s=a.ref([]),l=a.ref([]),c=a.ref(0),d=a.computed(()=>i.value?s.value:n.items),u=a.computed(()=>{let m=!1;return d.value.map(g=>{m=m||g.emojis.length}),m});function p(){c.value=0,s.value=i.value?Ar.filterEmojiGroups(i.value):[]}function f(m){o("select",m)}function h(m,g){c.value=g,l.value[g].scrollIntoView({behavior:"instant",block:"start"})}return a.onMounted(()=>{}),(m,g)=>(a.openBlock(),a.createElementBlock("section",NS,[t.enableSearch?(a.openBlock(),a.createElementBlock("div",TS,[a.createVNode(a.unref(Rn),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=b=>i.value=b),p],type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0),a.createElementVNode("section",OS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.value,(b,y)=>{var w;return a.withDirectives((a.openBlock(),a.createElementBlock("div",{key:`group-${y}`,class:"group"},[a.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:l},a.toDisplayString(b.name),513),a.createElementVNode("section",MS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b.emojis,(_,k)=>(a.openBlock(),a.createElementBlock("div",{key:`item-${k}`},[a.createElementVNode("div",{class:"item",onClick:S=>f(_)},a.toDisplayString(_.emoji),9,AS)]))),128))])],512)),[[a.vShow,(w=b.emojis)==null?void 0:w.length]])}),128)),u.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",vS,"没有记录"))]),a.createElementVNode("section",RS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.value,(b,y)=>(a.openBlock(),a.createBlock(a.unref(Gn),{key:`target-${y}`,delay:300},{trigger:a.withCtx(()=>{var w;return[a.withDirectives(a.createElementVNode("div",{class:a.normalizeClass(["item",{active:c.value===y}]),onClick:_=>h(b,y)},[a.createVNode(a.unref(ie),{name:a.unref(Ar.emojiGroupIcons)[b.slug]},null,8,["name"])],10,BS),[[a.vShow,(w=b.emojis)==null?void 0:w.length]])]}),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(b.name),1)]),_:2},1024))),128))])]))}}),yc=[{label:"Arduino",value:"arduino",icon:"code_blocks"},{label:"Bash",value:"bash",icon:"code_blocks"},{label:"C",value:"c",icon:"code_blocks"},{label:"C++",value:"cpp",icon:"code_blocks"},{label:"C#",value:"csharp",icon:"code_blocks"},{label:"CSS",value:"css",icon:"code_blocks"},{label:"Diff",value:"diff",icon:"code_blocks"},{label:"Go",value:"go",icon:"code_blocks"},{label:"GraphQL",value:"graphql",icon:"code_blocks"},{label:"Ini",value:"ini",icon:"code_blocks"},{label:"Java",value:"java",icon:"code_blocks"},{label:"JavaScript",value:"javascript",icon:"code_blocks"},{label:"JSON",value:"json",icon:"code_blocks"},{label:"Kotlin",value:"kotlin",icon:"code_blocks"},{label:"Less",value:"less",icon:"code_blocks"},{label:"Lua",value:"lua",icon:"code_blocks"},{label:"Makefile",value:"makefile",icon:"code_blocks"},{label:"Markdown",value:"markdown",icon:"code_blocks"},{label:"Objective-C",value:"objectivec",icon:"code_blocks"},{label:"Perl",value:"perl",icon:"code_blocks"},{label:"PHP",value:"php",icon:"code_blocks"},{label:"PHP-Template",value:"php-template",icon:"code_blocks"},{label:"Plain Text",value:"plaintext",icon:"code_blocks"},{label:"Python",value:"python",icon:"code_blocks"},{label:"Python-Repl",value:"python-repl",icon:"code_blocks"},{label:"R",value:"r",icon:"code_blocks"},{label:"Ruby",value:"ruby",icon:"code_blocks"},{label:"Rust",value:"rust",icon:"code_blocks"},{label:"Scss",value:"scss",icon:"code_blocks"},{label:"Shell",value:"shell",icon:"code_blocks"},{label:"SQL",value:"sql",icon:"code_blocks"},{label:"Swift",value:"swift",icon:"code_blocks"},{label:"TypeScript",value:"typescript",icon:"code_blocks"},{label:"VB.Net",value:"vbnet",icon:"code_blocks"},{label:"WebAssembly",value:"wasm",icon:"code_blocks"},{label:"XML",value:"xml",icon:"code_blocks"},{label:"YAML",value:"yaml",icon:"code_blocks"}],DS={class:"selected-language"},IS={class:"header"},LS={class:"o-scroll"},Vh=a.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=be(),i=a.ref(),s=a.ref(),l=a.ref(""),c=a.ref(0),d=a.ref(""),u=a.computed(()=>l.value?yc.filter(y=>y.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):yc),p=a.computed(()=>yc.find(y=>y.value===d.value));function f(y){y&&setTimeout(()=>{var w;(w=s.value)==null||w.focus(),c.value=0,window.addEventListener("keyup",b)},0)}function h(){window.removeEventListener("keyup",b)}function m(y){h(),d.value=y.value,o("select",y.value)}function g(){m(u.value[c.value])}function b(y){if(u.value.length>0){switch(y.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":g();break}c.value>=u.value.length&&(c.value=0),c.value<0&&(c.value=u.value.length-1)}else c.value=0}return a.onMounted(()=>{d.value=n.language}),(y,w)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":f},{trigger:a.withCtx(()=>[a.createVNode(a.unref(xt),{class:"o-dropdown-btn"},{default:a.withCtx(()=>{var _;return[a.createElementVNode("span",DS,a.toDisplayString((_=p.value)==null?void 0:_.label),1),a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:a.withCtx(()=>[a.createElementVNode("header",IS,[a.createVNode(a.unref(Rn),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":w[0]||(w[0]=_=>l.value=_),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),a.createElementVNode("section",LS,[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(_,k)=>(a.openBlock(),a.createBlock(a.unref(zt),{key:k,onClick:S=>m(_),class:a.normalizeClass({"is-active":_.value===d.value,"is-select":k===c.value})},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:_.icon},null,8,["name"])]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(_.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),PS={class:"o-media-input"},$S={class:"fields"},FS={class:"actions"},kc=a.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=be(),i=a.ref(),s=a.ref(""),l=a.ref("");function c(){return l.value?(s.value="null",!0):(s.value="error",!1)}function d(){c()&&o("input",l.value)}return a.onMounted(()=>{l.value=n.val,setTimeout(()=>{var u;(u=i.value)==null||u.focus()},0)}),(u,p)=>(a.openBlock(),a.createElementBlock("section",PS,[a.createElementVNode("section",$S,[p[1]||(p[1]=a.createElementVNode("div",{class:"o-media-title"},"Link",-1)),a.createVNode(a.unref(Rn),{ref_key:"input",ref:i,modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=f=>l.value=f),status:s.value,type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),a.createElementVNode("footer",FS,[a.createVNode(a.unref(xt),{type:"info",onClick:d},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),VS={class:"o-meta-input"},zS={class:"header"},HS={class:"title"},US={class:"fields"},qS={class:"actions"},wc=a.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:e}){const n=t,o=e,{tr:r}=be(),i=a.ref(null),s=a.ref("");function l(){console.log("confirm",s.value),o("confirm",s.value)}return a.onMounted(()=>{s.value=n.val,setTimeout(()=>{var c;(c=i.value)==null||c.focus()},0)}),(c,d)=>(a.openBlock(),a.createElementBlock("section",VS,[a.createElementVNode("section",zS,[a.createElementVNode("div",HS,a.toDisplayString(t.title),1),a.createElementVNode("div",null,[a.renderSlot(c.$slots,"header-right")])]),a.createElementVNode("section",US,[a.createVNode(a.unref(Rn),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=u=>s.value=u),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),a.createElementVNode("footer",qS,[a.createVNode(a.unref(xt),{type:"tertiary",onClick:d[1]||(d[1]=u=>o("cancel"))},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.cancel")),1)]),_:1}),a.createVNode(a.unref(xt),{type:"info",onClick:l},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(a.unref(r)("label.ok")),1)]),_:1})])]))}}),KS={class:"o-table-grid"},WS=["onMouseover"],zh=a.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:e}){const n=e,o=a.ref(6),r=a.ref(6),i=a.ref(2),s=a.ref(2);function l(d,u){i.value=d,s.value=u,o.value===d&&o.value<10&&(o.value+=1),r.value===u&&r.value<10&&(r.value+=1)}function c(){n("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(d,u)=>(a.openBlock(),a.createElementBlock("section",KS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,(p,f)=>(a.openBlock(),a.createElementBlock("div",{class:"rows",key:`row-${f}`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(h,m)=>(a.openBlock(),a.createElementBlock("div",{key:`col-${m}`},[a.createElementVNode("div",{class:a.normalizeClass(["cell",{selected:p<=i.value&&h<=s.value}]),onMouseover:g=>l(p,h),onClick:c},null,42,WS)]))),128))]))),128)),a.createElementVNode("footer",null,a.toDisplayString(i.value)+" x "+a.toDisplayString(s.value),1)]))}}),jS={class:"o-table-cell-background o-button-group"},GS={class:"o-command-btn"},Hh=a.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(),i=a.ref("#ffec3d");function s(){l(i.value)}function l(c){r.value.setShow(!1),i.value=c,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Gn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",jS,[a.createElementVNode("div",{class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},[a.createVNode(a.unref(ie),{name:"crop_16_9",class:"arrow"}),a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),a.createElementVNode("div",GS,[a.createVNode(a.unref(ie),{name:"arrow_drop_down"})])])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.highlightColor")),1)]),_:1})]),default:a.withCtx(()=>[a.createVNode(a.unref(xs),{"default-color":"","default-label":a.unref(n)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),YS={class:"o-simple-color-board"},JS={class:"fore-colors"},XS={class:"color-row"},ZS={class:"color-row"},QS={class:"back-colors"},ex={class:"color-row"},tx={class:"color-row"},Uh=a.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:e}){const n=e;function o(s,l){n("select",s,l.value)}const r=a.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=a.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(a.openBlock(),a.createElementBlock("section",YS,[a.createElementVNode("section",JS,[l[4]||(l[4]=a.createElementVNode("div",{class:"label o-tips"},"Color",-1)),a.createElementVNode("div",XS,[a.createVNode(a.unref(Le),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:l[0]||(l[0]=c=>o("foreColor",{value:""}))}),t.foreColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:l[1]||(l[1]=c=>o("foreColor",{value:t.foreColor}))},null,8,["color"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",ZS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,d)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${d}`,icon:"format_text",color:c.value,tooltip:c.label,onClick:u=>o("foreColor",c)},null,8,["color","tooltip","onClick"]))),128))])]),a.createElementVNode("section",QS,[l[5]||(l[5]=a.createElementVNode("div",{class:"label o-tips"},"Background",-1)),a.createElementVNode("div",ex,[a.createVNode(a.unref(Le),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:l[2]||(l[2]=c=>o("backColor",{value:""}))}),t.backColor?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:l[3]||(l[3]=c=>o("backColor",{value:t.backColor}))},null,8,["content-style"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",tx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(c,d)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:`col-${d}`,icon:"format_text",tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>o("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}});class nx{constructor(){tt(this,"instances",[])}error(e,n=3e3){this.show(e,"error",n)}info(e,n=3e3){this.show(e,"info",n)}success(e,n=3e3){this.show(e,"success",n)}warning(e,n=3e3){this.show(e,"warning",n)}show(e,n="info",o=3e3){const r=`
117
+ <div class="o-toast ${n}">
118
+ <i class="yiitip-icon icon-${n}"></i>
119
+ <span class="message">${e}</span>
120
+ </div>
121
+ `,i=cn(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:r,onHidden:s=>{s.destroy(),this.instances=this.instances.filter(l=>l!==s)}});i.show(),o>0&&setTimeout(()=>{i.hide()},o),this.instances.push(i),this.repositionToasts()}repositionToasts(){this.instances.forEach((e,n)=>{e.setProps({placement:"bottom",offset:[0,n*55]})})}}const Ec=new nx,di=[{type:"paragraph",content:[]}],qh=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Kh=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],ox={class:"o-add-node-view"},rx={key:0,class:"view-main"},ix={class:"group o-tips"},sx={class:"panel"},ax={class:"group o-tips"},lx={key:1,class:"item"},cx={key:1,class:"view-emoji"},dx=a.defineComponent({__name:"AddNodeView",props:lt,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=be(),{run:s}=Me(),l=a.ref("main"),c=a.ref(0);function d(f){const h=n.editor.chain();let m=null;switch(f.value){case"blockquote":m={content:di};break;case"callout":m={content:di,attrs:{icon:"💡"}};break;case"codeBlock":m={content:[],attrs:{language:"shell"}};break;case"emoji":m={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":m={attrs:f.options};break;case"horizontalRule":m={};break;case"paragraph":m={content:[]};break;case"bulletList":case"orderedList":m={content:qh};break;case"taskList":m={content:Kh};break;case"table":setTimeout(()=>{h.insertContentAt(p.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":m={type:"paragraph",content:[{type:f.value,attrs:{src:"init"}}]};break;case"model-viewer":m={attrs:{src:"init"}};break}m&&(m.type=m.type||f.value,setTimeout(()=>{u.value?h.insertContent(m).focus().run():h.insertContentAt(p.value,m).focus().run()},1)),o("action",f)}const u=a.computed(()=>n.node.content.size===0),p=a.computed(()=>u.value?c.value:c.value+n.node.nodeSize);return a.onMounted(()=>{c.value=n.getPos()}),(f,h)=>(a.openBlock(),a.createElementBlock("section",ox,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",rx,[a.createElementVNode("section",null,[a.createElementVNode("div",ix,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",sx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(wr),(m,g)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:g,icon:m.icon,tooltip:a.unref(i)(m.label),quaternary:"",onClick:b=>d(m)},null,8,["icon","tooltip","onClick"]))),128))])]),a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(Er).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(Er),(m,g)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:g},[m.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[g>0?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",ax,a.toDisplayString(a.unref(i)(m.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(zt),{class:"item",clickable:"",onClick:b=>d(m)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:m.icon,color:m.color},null,8,["name","color"])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(i)(m.label)),1)]),_:2},1032,["onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",lx,"No result"))]),_:1})])):l.value==="emoji"?(a.openBlock(),a.createElementBlock("section",cx)):a.createCommentVNode("",!0)]))}}),ux=a.defineComponent({__name:"AddNode",props:lt,setup(t){const e=t,n=a.ref(null),o=a.ref(!1);function r(s){o.value=s}function i(){var s;(s=n.value)==null||s.setShow(!1),o.value=!1}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:n,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":r},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-add-node",{"is-selected":o.value}])},[a.createVNode(a.unref(xt),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(dx,a.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),px={class:"o-drag-node-view"},fx={key:0,class:"view-main"},hx={key:0},mx={class:"panel"},gx=a.defineComponent({__name:"DragNodeView",props:lt,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=be(),{run:s,onCommand:l}=Me(),c=a.ref("main"),d=a.ref(["heading","codeBlock","paragraph"]),u=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const w=g[0];if(w.type.name==="image")return w.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>li.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=n.editor)==null?void 0:b.isActive(u.value,g.options))}function h(g){switch(g.value){default:m(g);break}o("action",g)}function m(g){var _,k,S,C,R;const b=n.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const B=(_=n.editor)==null?void 0:_.isActive(u.value),T=(k=n.editor)==null?void 0:k.commands.lift(u.value);console.log("lift",u.value,B,T);return}const y=(S=n.editor)==null?void 0:S.commands,w=(C=n.editor)==null?void 0:C.chain().focus(b+1);console.log("runCommand",g),l(y,w,g.value,g.options),(R=n.editor)==null||R.commands.setNodeSelection(b)}return a.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ge.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:ge.deepOrange}]),(g,b)=>(a.openBlock(),a.createElementBlock("section",px,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",fx,[p.value?(a.openBlock(),a.createElementBlock("section",hx,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",mx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(li),(y,w)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:w,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:_=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(yo),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),bx=a.defineComponent({__name:"DragNode",props:lt,emits:["action"],setup(t,{emit:e}){const n=t,o=e,{run:r}=Me(),i=a.ref(null),s=a.ref(0),l=a.ref(!1),c=a.ref(["heading","codeBlock","paragraph"]),d=a.ref(!1),u=a.computed(()=>{var w,_;const y=(w=n.node)==null?void 0:w.content.content;if(y.length>0){const k=y[0];if(k.type.name==="image")return k.type.name}return(_=n.node)==null?void 0:_.type.name}),p=a.computed(()=>{var w;let y=u.value;return y==="heading"?{icon:`format_h${((w=n.node.attrs)==null?void 0:w.level)||1}`,color:ge.blue}:(y==="table-wrapper"&&(y="table"),Cs.find(_=>_.value===y)||{icon:"title"})});function f(y){var w;(w=i.value)==null||w.setShow(!1),o("action",y)}function h(y){l.value=y,console.log("show",y),y&&m()}function m(){var w;let y=n.getPos();c.value.includes(u.value)||(y+=1),(w=n.editor)==null||w.commands.setNodeSelection(y),s.value=y}function g(y){d.value=!0,setTimeout(()=>{d.value=!1},10)}function b(y){d.value=!1}return(y,w)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":h},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-drag-node",{"is-selected":l.value,"is-dragging":d.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:g,onDragend:b},[a.createVNode(a.unref(xt),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(ie),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(gx,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),yx=a.defineComponent({__name:"index",props:lt,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(!1),i=a.ref(0);a.ref(0);const s=a.computed(()=>l.value==="paragraph"&&n.node.content.size===0),l=a.computed(()=>{var f,h;const p=(f=n.node)==null?void 0:f.content.content;if(p.length>0){const m=p[0];if(m.type.name==="image")return m.type.name}return(h=n.node)==null?void 0:h.type.name}),c=a.computed(()=>{var p;return i.value||((p=n.node.attrs)==null?void 0:p.level)}),d=a.computed(()=>l.value==="heading"?`type-heading-${c.value}`:`type-${l.value}`);function u(p){o("action",p)}return a.onMounted(()=>{i.value=0}),(p,f)=>{var h;return(h=p.editor)!=null&&h.isEditable?(a.openBlock(),a.createElementBlock("section",{key:0,class:a.normalizeClass(["o-side-node",{"is-active":r.value,"is-empty":s.value}])},[a.createElementVNode("section",{class:a.normalizeClass(["action-container",d.value])},[a.createVNode(ux,a.normalizeProps(a.guardReactiveProps(n)),null,16),s.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(bx,a.mergeProps({key:0},n,{onAction:u}),null,16))],2)],2)):a.createCommentVNode("",!0)}}}),gn=a.defineComponent({__name:"ONodeView",props:lt,emits:["action"],setup(t,{emit:e}){const n=t,o=e,r=a.inject("sideNode",{value:!1});return a.computed(()=>{const i={};return n.node.attrs["data-id"]&&(i["data-id"]=n.node.attrs["data-id"]),i}),(i,s)=>(a.openBlock(),a.createBlock(a.unref(ic),{class:"o-node-view","data-id":i.node.attrs["data-id"]},{default:a.withCtx(()=>{var l;return[a.unref(r)&&((l=i.editor)!=null&&l.isEditable)?(a.openBlock(),a.createBlock(yx,a.mergeProps({key:0},n,{onAction:s[0]||(s[0]=c=>o("action"))}),null,16)):a.createCommentVNode("",!0),a.renderSlot(i.$slots,"default")]}),_:3},8,["data-id"]))}}),kx={class:"o-add-node-view"},wx={key:0,class:"view-main"},Ex={class:"group o-tips"},_x={class:"panel"},Cx={class:"group o-tips"},Sx={key:1,class:"item"},xx=a.defineComponent({__name:"AddNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=be(),{run:s}=Me(),l=a.ref("main");function c(p){const f=n.editor.chain();let h=null;switch(p.value){case"aiBlock":h={content:di,attrs:{icon:"💡"}};break;case"blockquote":h={content:di};break;case"callout":h={content:di,attrs:{icon:"💡"}};break;case"codeBlock":h={content:[],attrs:{language:"shell"}};break;case"emoji":h={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":h={attrs:p.options};break;case"horizontalRule":h={};break;case"paragraph":h={content:[]};break;case"bulletList":case"orderedList":h={content:qh};break;case"taskList":h={content:Kh};break;case"table":setTimeout(()=>{f.insertContentAt(u.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),o("action",p);return;case"image":h={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":h={attrs:{src:"init"}};break}if(h){const m=u.value;h.type=h.type||p.value,setTimeout(()=>{d.value?f.insertContent(h).focus().run():f.insertContentAt(m,h).focus().run()},1)}o("action",p)}const d=a.computed(()=>{var p;return((p=n.node)==null?void 0:p.content.size)===0}),u=a.computed(()=>d.value?n.getPos():n.getPos()+n.node.nodeSize);return(p,f)=>(a.openBlock(),a.createElementBlock("section",kx,[l.value==="main"?(a.openBlock(),a.createElementBlock("section",wx,[a.createElementVNode("section",null,[a.createElementVNode("div",Ex,a.toDisplayString(a.unref(i)("label.basic")),1),a.createElementVNode("section",_x,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(wr),(h,m)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:m,icon:h.icon,tooltip:a.unref(i)(h.label),quaternary:"",onClick:g=>c(h)},null,8,["icon","tooltip","onClick"]))),128))])]),a.createVNode(a.unref(Rt)),a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[a.unref(Er).length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(Er),(h,m)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:m},[h.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[m>0?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",Cx,a.toDisplayString(a.unref(i)(h.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(zt),{class:"item",clickable:"",onClick:g=>c(h)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:h.icon,color:h.color},null,8,["name","color"])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",Sx,"No result"))]),_:1})])):a.createCommentVNode("",!0)]))}}),Wh=a.defineComponent({__name:"AddNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},setup(t){const e=t,n=a.ref(),o=a.ref(!1),r=a.computed(()=>{var c;return((c=e.node)==null?void 0:c.content.size)===0});a.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function i(c){o.value=c}function s(){var c;(c=n.value)==null||c.setShow(!0)}function l(){var c;(c=n.value)==null||c.setShow(!1),o.value=!1}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:n,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[a.createVNode(a.unref(xt),{type:"tertiary",class:"o-node-btn",onClick:s},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"add",small:""})]),_:1})],2)]),default:a.withCtx(()=>[a.createVNode(xx,a.mergeProps(e,{onAction:l}),null,16)]),_:1},512))}}),Nx={class:"o-drag-node-view"},Tx={key:0,class:"view-main"},Ox={key:0},Mx={class:"panel"},Ax=a.defineComponent({__name:"DragNodeView",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action"],setup(t,{emit:e}){const n=t,o=e,{locale:r,tr:i}=be(),{run:s,onCommand:l}=Me(),c=a.ref("main"),d=a.ref(["heading","codeBlock","paragraph"]),u=a.computed(()=>{var b,y;const g=(b=n.node)==null?void 0:b.content.content;if(g.length>0){const w=g[0];if(w.type.name==="image")return w.type.name}return(y=n.node)==null?void 0:y.type.name}),p=a.computed(()=>li.find(g=>g.value===u.value));function f(g){var b;return g.value===u.value&&((b=n.editor)==null?void 0:b.isActive(u.value,g.options))}function h(g){switch(g.value){case"delete":break;case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var _,k,S,C,R;const b=n.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const B=(_=n.editor)==null?void 0:_.isActive(u.value),T=(k=n.editor)==null?void 0:k.commands.lift(u.value);console.log("lift",u.value,B,T);return}const y=(S=n.editor)==null?void 0:S.commands,w=(C=n.editor)==null?void 0:C.chain().focus(b+1);console.log("runCommand",g),l(y,w,g.value,g.options),(R=n.editor)==null||R.commands.focus()}return(g,b)=>(a.openBlock(),a.createElementBlock("section",Nx,[c.value==="main"?(a.openBlock(),a.createElementBlock("section",Tx,[p.value?(a.openBlock(),a.createElementBlock("section",Ox,[b[0]||(b[0]=a.createElementVNode("div",{class:"group o-tips"},"Turn into",-1)),a.createElementVNode("section",Mx,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(li),(y,w)=>(a.openBlock(),a.createBlock(a.unref(Le),{key:w,icon:y.icon,tooltip:a.unref(i)(y.label),"content-class":{"is-active":f(y)},quaternary:"",onClick:_=>h(y)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):a.createCommentVNode("",!0),a.createVNode(a.unref(yo),a.mergeProps(n,{colorful:"","show-group":"",onAction:h}),null,16)])):a.createCommentVNode("",!0)]))}}),jh=a.defineComponent({__name:"DragNode",props:{editor:{type:Object,required:!0},node:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0}},emits:["action","dragstart","dragend"],setup(t,{emit:e}){const n=t,o=e,{run:r}=Me(),i=a.ref(null),s=a.ref(!1),l=a.ref(["heading","codeBlock","paragraph"]),c=a.computed(()=>{var b,y,w;const g=(y=(b=n.node)==null?void 0:b.content)==null?void 0:y.content;if((g==null?void 0:g.length)>0){const _=g[0];if(_.type.name==="image")return _.type.name}return(w=n.node)==null?void 0:w.type.name}),d=a.computed(()=>{var b;let g=c.value;return g==="heading"?{icon:`format_h${((b=n.node.attrs)==null?void 0:b.level)||1}`,color:ge.blue}:(g==="table-wrapper"&&(g="table"),Cs.find(y=>y.value===g)||{icon:"title"})});function u(g){o("dragstart",g)}function p(g){o("dragend",g)}function f(g){var b;(b=i.value)==null||b.setShow(!1),o("action",g)}function h(g){s.value=g,g&&m()}function m(){var b;let g=n.getPos();l.value.includes(c.value)||(g+=1),(b=n.editor)==null||b.commands.setNodeSelection(g)}return a.watch(()=>n.getPos(),g=>{var b;(b=i.value)==null||b.setShow(!1)}),(g,b)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:u,onDragend:p},[a.createVNode(a.unref(xt),{type:"tertiary",class:"o-node-btn"},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),a.createVNode(a.unref(ie),{name:"drag_indicator",small:""})]),_:1})],34)]),default:a.withCtx(()=>[a.createVNode(Ax,a.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),vx={key:0,class:"spinner"},Rx={key:2,class:"o-btn__label"},xt=a.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(a.openBlock(),a.createElementBlock("button",{class:a.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:r[0]||(r[0]=i=>n("click",i))},[t.loading?(a.openBlock(),a.createElementBlock("div",vx)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.icon?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:t.icon,class:a.normalizeClass(t.iconClass)},null,8,["name","class"])):a.createCommentVNode("",!0)],64)),t.label?(a.openBlock(),a.createElementBlock("span",Rx,a.toDisplayString(t.label),1)):a.createCommentVNode("",!0),a.renderSlot(o.$slots,"default")],2))}}),Bx={class:"o-btn-group"},Gh=a.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:e}){return(n,o)=>(a.openBlock(),a.createElementBlock("div",Bx,[a.renderSlot(n.$slots,"default")]))}}),Dx={class:"o-checkbox"},Ix={class:"o-checkbox__main"},Lx={class:"o-checkbox__suffix"},_c=a.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.computed({get(){return n.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(a.openBlock(),a.createElementBlock("div",Dx,[a.createElementVNode("div",Ix,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),type:"checkbox"},null,512),[[a.vModelCheckbox,r.value]])]),a.createElementVNode("div",Lx,a.toDisplayString(t.label),1)]))}}),Rt=a.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),Px={class:"o-input__prefix"},$x={class:"o-input__main"},Fx=["placeholder"],Vx={class:"o-input__suffix"},Rn=a.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","focus","update:modelValue"],setup(t,{expose:e,emit:n}){const o=t,r=n,i=a.ref(null),s=a.computed({get(){return o.modelValue},set(d){r("update:modelValue",d)}});function l(){var d;(d=i.value)==null||d.focus()}function c(){s.value="",l()}return e({clear:c,focus:l}),(d,u)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["o-input",`type-${t.type}`])},[a.createElementVNode("div",Px,[a.renderSlot(d.$slots,"prefix")]),a.createElementVNode("div",$x,[a.withDirectives(a.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":u[0]||(u[0]=p=>s.value=p),placeholder:t.placeholder,onFocus:u[1]||(u[1]=p=>r("focus")),onBlur:u[2]||(u[2]=p=>r("blur"))},null,40,Fx),[[a.vModelText,s.value]])]),a.createElementVNode("div",Vx,[a.renderSlot(d.$slots,"suffix"),t.clearable&&s.value?(a.openBlock(),a.createBlock(ie,{key:0,name:"close",class:"clear o-tips",onClick:c})):a.createCommentVNode("",!0)])],2))}}),Jt=a.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("ul",{class:a.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[a.renderSlot(e.$slots,"default")],2))}}),zx={class:"o-list-item"},Hx={class:"o-list-item__prefix"},Ux={class:"o-list-item__main"},qx={class:"o-list-item__suffix"},zt=a.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("li",zx,[a.createElementVNode("div",Hx,[a.renderSlot(e.$slots,"prefix")]),a.createElementVNode("div",Ux,[a.renderSlot(e.$slots,"default")]),a.createElementVNode("div",qx,[a.renderSlot(e.$slots,"suffix")])]))}}),Pe=a.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:e,emit:n}){const o=t,r=n,{theme:i}=_r(),s=a.ref(null),l=a.ref(),c=a.ref();function d(h){var m,g,b,y;h?((g=c.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?u:null}),(b=c.value)==null||b.show()):(y=c.value)==null||y.hide()}function u(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,b;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((b=o.event)==null?void 0:b.clientY)||0}}}}function p(){c.value=cn(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:l.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function f(){c.value.setProps({theme:i.value})}return a.watch(i,h=>{f()}),e({setShow:d}),a.onMounted(()=>{p()}),a.onUnmounted(()=>{c.value&&c.value.destroy()}),(h,m)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[a.renderSlot(h.$slots,"trigger"),t.disable?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"contentRef",ref:l,class:a.normalizeClass(["popover-content",t.contentClass])},[a.renderSlot(h.$slots,"default")],2))],512))}}),Yh=[`
122
+ Certainly! Here's a detailed prompt you can use to instruct a Large Language Model (LLM) to act as a writing expert:
123
+
124
+ ---
125
+ `,`
126
+ **Prompt:**
127
+
128
+ "You are an expert writing assistant with extensive knowledge in crafting high-quality, engaging, and polished content across various genres and formats. Your expertise includes creative writing, technical writing, academic writing, business communication, and storytelling. Your goal is to assist users in generating, refining, and enhancing their written work while maintaining clarity, coherence, and style.
129
+ `,`
130
+ When responding to requests, follow these guidelines:
131
+
132
+ 1. **Understand the Purpose:** Clarify the intent, audience, and tone of the content before proceeding.
133
+ 2. **Provide Structure:** Offer clear outlines, logical flow, and well-organized ideas.
134
+ 3. **Enhance Creativity:** Use vivid language, metaphors, and storytelling techniques where appropriate.
135
+ 4. **Ensure Accuracy:** Fact-check information and maintain grammatical correctness.
136
+ 5. **Adapt to Style:** Match the tone, voice, and style to the user's needs (e.g., formal, casual, persuasive, descriptive).
137
+ 6. **Offer Suggestions:** Provide alternatives, improvements, or edits to elevate the quality of the text.
138
+ 7. **Be Concise:** Avoid unnecessary verbosity while ensuring the message is complete and impactful.
139
+ `,`
140
+ If the user provides a specific topic, text, or request, analyze it carefully and respond with tailored advice, examples, or revisions. If the request is vague, ask clarifying questions to better understand the user's needs.
141
+
142
+ Let’s begin! What type of writing assistance do you need today?"
143
+ `,`
144
+ ---
145
+
146
+ This prompt ensures the LLM acts as a professional writing assistant, capable of handling diverse writing tasks with precision and creativity. Let me know if you'd like further customization!
147
+ `],Kx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Wx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Jh=rn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Vo({find:Kx,type:this.type})]},addPasteRules(){return[mo({find:Wx,type:this.type})]}}),Xh=De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ae({key:new Ne("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Oe.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,d)=>{if(c.isText)return;if(!(r>=d&&r<=d+c.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((c,d)=>{if(c.isText||!(r>=d&&r<=d+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Oe.create(t,i)}}})]}}),Zh=De.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Qh=De.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),jx=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Gx=Fe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ps({find:jx,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),Yx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Jx="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Cr=(t,e)=>{for(const n in e)t[n]=e[n];return t},Cc="numeric",Sc="ascii",xc="alpha",ui="asciinumeric",pi="alphanumeric",Nc="domain",em="emoji",Xx="scheme",Zx="slashscheme",Tc="whitespace";function Qx(t,e){return t in e||(e[t]=[]),e[t]}function Ko(t,e,n){e[Cc]&&(e[ui]=!0,e[pi]=!0),e[Sc]&&(e[ui]=!0,e[xc]=!0),e[ui]&&(e[pi]=!0),e[xc]&&(e[pi]=!0),e[pi]&&(e[Nc]=!0),e[em]&&(e[Nc]=!0);for(const o in e){const r=Qx(o,n);r.indexOf(t)<0&&r.push(t)}}function eN(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Ht(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ht.groups={},Ht.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Ht.groups;let r;return e&&e.j?r=e:(r=new Ht(e),n&&o&&Ko(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Ht.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,l=r.go(t);if(l?(s=new Ht,Cr(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Ht,i){if(o)if(s.t&&typeof s.t=="string"){const c=Cr(eN(s.t,o),n);Ko(i,c,o)}else n&&Ko(i,n,o);s.t=i}return r.j[t]=s,s}};const ke=(t,e,n,o,r)=>t.ta(e,n,o,r),Ze=(t,e,n,o,r)=>t.tr(e,n,o,r),tm=(t,e,n,o,r)=>t.ts(e,n,o,r),D=(t,e,n,o,r)=>t.tt(e,n,o,r),Jn="WORD",Oc="UWORD",nm="ASCIINUMERICAL",om="ALPHANUMERICAL",fi="LOCALHOST",Mc="TLD",Ac="UTLD",Ts="SCHEME",Sr="SLASH_SCHEME",vc="NUM",Rc="WS",Bc="NL",hi="OPENBRACE",mi="CLOSEBRACE",Os="OPENBRACKET",Ms="CLOSEBRACKET",As="OPENPAREN",vs="CLOSEPAREN",Rs="OPENANGLEBRACKET",Bs="CLOSEANGLEBRACKET",Ds="FULLWIDTHLEFTPAREN",Is="FULLWIDTHRIGHTPAREN",Ls="LEFTCORNERBRACKET",Ps="RIGHTCORNERBRACKET",$s="LEFTWHITECORNERBRACKET",Fs="RIGHTWHITECORNERBRACKET",Vs="FULLWIDTHLESSTHAN",zs="FULLWIDTHGREATERTHAN",Hs="AMPERSAND",Dc="APOSTROPHE",Us="ASTERISK",ko="AT",qs="BACKSLASH",Ks="BACKTICK",Ws="CARET",wo="COLON",Ic="COMMA",js="DOLLAR",Bn="DOT",Gs="EQUALS",Lc="EXCLAMATION",un="HYPHEN",gi="PERCENT",Ys="PIPE",Js="PLUS",Xs="POUND",bi="QUERY",Pc="QUOTE",rm="FULLWIDTHMIDDLEDOT",$c="SEMI",Dn="SLASH",yi="TILDE",Zs="UNDERSCORE",im="EMOJI",Qs="SYM";var sm=Object.freeze({__proto__:null,WORD:Jn,UWORD:Oc,ASCIINUMERICAL:nm,ALPHANUMERICAL:om,LOCALHOST:fi,TLD:Mc,UTLD:Ac,SCHEME:Ts,SLASH_SCHEME:Sr,NUM:vc,WS:Rc,NL:Bc,OPENBRACE:hi,CLOSEBRACE:mi,OPENBRACKET:Os,CLOSEBRACKET:Ms,OPENPAREN:As,CLOSEPAREN:vs,OPENANGLEBRACKET:Rs,CLOSEANGLEBRACKET:Bs,FULLWIDTHLEFTPAREN:Ds,FULLWIDTHRIGHTPAREN:Is,LEFTCORNERBRACKET:Ls,RIGHTCORNERBRACKET:Ps,LEFTWHITECORNERBRACKET:$s,RIGHTWHITECORNERBRACKET:Fs,FULLWIDTHLESSTHAN:Vs,FULLWIDTHGREATERTHAN:zs,AMPERSAND:Hs,APOSTROPHE:Dc,ASTERISK:Us,AT:ko,BACKSLASH:qs,BACKTICK:Ks,CARET:Ws,COLON:wo,COMMA:Ic,DOLLAR:js,DOT:Bn,EQUALS:Gs,EXCLAMATION:Lc,HYPHEN:un,PERCENT:gi,PIPE:Ys,PLUS:Js,POUND:Xs,QUERY:bi,QUOTE:Pc,FULLWIDTHMIDDLEDOT:rm,SEMI:$c,SLASH:Dn,TILDE:yi,UNDERSCORE:Zs,EMOJI:im,SYM:Qs});const Xn=/[a-z]/,ki=new RegExp("\\p{L}","u"),Fc=new RegExp("\\p{Emoji}","u"),Zn=/\d/,Vc=/\s/,am="\r",zc=`
148
+ `,tN="️",nN="‍",Hc="";let ea=null,ta=null;function oN(t=[]){const e={};Ht.groups=e;const n=new Ht;ea==null&&(ea=cm(Yx)),ta==null&&(ta=cm(Jx)),D(n,"'",Dc),D(n,"{",hi),D(n,"}",mi),D(n,"[",Os),D(n,"]",Ms),D(n,"(",As),D(n,")",vs),D(n,"<",Rs),D(n,">",Bs),D(n,"(",Ds),D(n,")",Is),D(n,"「",Ls),D(n,"」",Ps),D(n,"『",$s),D(n,"』",Fs),D(n,"<",Vs),D(n,">",zs),D(n,"&",Hs),D(n,"*",Us),D(n,"@",ko),D(n,"`",Ks),D(n,"^",Ws),D(n,":",wo),D(n,",",Ic),D(n,"$",js),D(n,".",Bn),D(n,"=",Gs),D(n,"!",Lc),D(n,"-",un),D(n,"%",gi),D(n,"|",Ys),D(n,"+",Js),D(n,"#",Xs),D(n,"?",bi),D(n,'"',Pc),D(n,"/",Dn),D(n,";",$c),D(n,"~",yi),D(n,"_",Zs),D(n,"\\",qs),D(n,"・",rm);const o=Ze(n,Zn,vc,{[Cc]:!0});Ze(o,Zn,o);const r=Ze(o,Xn,nm,{[ui]:!0}),i=Ze(o,ki,om,{[pi]:!0}),s=Ze(n,Xn,Jn,{[Sc]:!0});Ze(s,Zn,r),Ze(s,Xn,s),Ze(r,Zn,r),Ze(r,Xn,r);const l=Ze(n,ki,Oc,{[xc]:!0});Ze(l,Xn),Ze(l,Zn,i),Ze(l,ki,l),Ze(i,Zn,i),Ze(i,Xn),Ze(i,ki,i);const c=D(n,zc,Bc,{[Tc]:!0}),d=D(n,am,Rc,{[Tc]:!0}),u=Ze(n,Vc,Rc,{[Tc]:!0});D(n,Hc,u),D(d,zc,c),D(d,Hc,u),Ze(d,Vc,u),D(u,am),D(u,zc),Ze(u,Vc,u),D(u,Hc,u);const p=Ze(n,Fc,im,{[em]:!0});D(p,"#"),Ze(p,Fc,p),D(p,tN,p);const f=D(p,nN);D(f,"#"),Ze(f,Fc,p);const h=[[Xn,s],[Zn,r]],m=[[Xn,null],[ki,l],[Zn,i]];for(let g=0;g<ea.length;g++)Eo(n,ea[g],Mc,Jn,h);for(let g=0;g<ta.length;g++)Eo(n,ta[g],Ac,Oc,m);Ko(Mc,{tld:!0,ascii:!0},e),Ko(Ac,{utld:!0,alpha:!0},e),Eo(n,"file",Ts,Jn,h),Eo(n,"mailto",Ts,Jn,h),Eo(n,"http",Sr,Jn,h),Eo(n,"https",Sr,Jn,h),Eo(n,"ftp",Sr,Jn,h),Eo(n,"ftps",Sr,Jn,h),Ko(Ts,{scheme:!0,ascii:!0},e),Ko(Sr,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],w=t[g][1]?{[Xx]:!0}:{[Zx]:!0};b.indexOf("-")>=0?w[Nc]=!0:Xn.test(b)?Zn.test(b)?w[ui]=!0:w[Sc]=!0:w[Cc]=!0,tm(n,b,b,w)}return tm(n,"localhost",fi,{ascii:!0}),n.jd=new Ht(Qs),{start:n,tokens:Cr({groups:e},sm)}}function lm(t,e){const n=rN(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=t,c=null,d=0,u=null,p=-1,f=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(p=0,f=0,u=l):p>=0&&(p+=n[s].length,f++),d+=n[s].length,i+=n[s].length,s++;i-=p,s-=f,d-=p,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function rN(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function Eo(t,e,n,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Ht(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Ht(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function cm(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const wi={defaultProtocol:"http",events:null,format:dm,formatHref:dm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Uc(t,e=null){let n=Cr({},wi);t&&(n=Cr(n,t instanceof Uc?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}Uc.prototype={o:wi,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:wi[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function dm(t){return t}function um(t,e){this.t="token",this.v=t,this.tk=e}um.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=wi.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Cr(s,u),{tagName:r,attributes:s,content:i,eventListeners:p}}};function na(t,e){class n extends um{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const pm=na("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fm=na("text"),iN=na("nl"),oa=na("url",{isLink:!0,toHref(t=wi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fi&&t[1].t===wo}}),pn=t=>new Ht(t);function sN({groups:t}){const e=t.domain.concat([Hs,Us,ko,qs,Ks,Ws,js,Gs,un,vc,gi,Ys,Js,Xs,Dn,Qs,yi,Zs]),n=[wo,Ic,Bn,Lc,gi,bi,Pc,$c,Rs,Bs,hi,mi,Ms,Os,As,vs,Ds,Is,Ls,Ps,$s,Fs,Vs,zs],o=[Hs,Dc,Us,qs,Ks,Ws,js,Gs,un,hi,mi,gi,Ys,Js,Xs,bi,Dn,Qs,yi,Zs],r=pn(),i=D(r,yi);ke(i,o,i),ke(i,t.domain,i);const s=pn(),l=pn(),c=pn();ke(r,t.domain,s),ke(r,t.scheme,l),ke(r,t.slashscheme,c),ke(s,o,i),ke(s,t.domain,s);const d=D(s,ko);D(i,ko,d),D(l,ko,d),D(c,ko,d);const u=D(i,Bn);ke(u,o,i),ke(u,t.domain,i);const p=pn();ke(d,t.domain,p),ke(p,t.domain,p);const f=D(p,Bn);ke(f,t.domain,p);const h=pn(pm);ke(f,t.tld,h),ke(f,t.utld,h),D(d,fi,h);const m=D(p,un);D(m,un,m),ke(m,t.domain,p),ke(h,t.domain,p),D(h,Bn,f),D(h,un,m);const g=D(h,wo);ke(g,t.numeric,pm);const b=D(s,un),y=D(s,Bn);D(b,un,b),ke(b,t.domain,s),ke(y,o,i),ke(y,t.domain,s);const w=pn(oa);ke(y,t.tld,w),ke(y,t.utld,w),ke(w,t.domain,s),ke(w,o,i),D(w,Bn,y),D(w,un,b),D(w,ko,d);const _=D(w,wo),k=pn(oa);ke(_,t.numeric,k);const S=pn(oa),C=pn();ke(S,e,S),ke(S,n,C),ke(C,e,S),ke(C,n,C),D(w,Dn,S),D(k,Dn,S);const R=D(l,wo),B=D(c,wo),T=D(B,Dn),v=D(T,Dn);ke(l,t.domain,s),D(l,Bn,y),D(l,un,b),ke(c,t.domain,s),D(c,Bn,y),D(c,un,b),ke(R,t.domain,S),D(R,Dn,S),D(R,bi,S),ke(v,t.domain,S),ke(v,e,S),D(v,Dn,S);const H=[[hi,mi],[Os,Ms],[As,vs],[Rs,Bs],[Ds,Is],[Ls,Ps],[$s,Fs],[Vs,zs]];for(let Y=0;Y<H.length;Y++){const[$,q]=H[Y],K=D(S,$);D(C,$,K),D(K,q,S);const oe=pn(oa);ke(K,e,oe);const x=pn();ke(K,n),ke(oe,e,oe),ke(oe,n,x),ke(x,e,oe),ke(x,n,x),D(oe,q,S),D(x,q,S)}return D(r,fi,w),D(r,Bc,iN),{start:r,tokens:sm}}function aN(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,d=null,u=0,p=null,f=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(d=c||l.go(n[r].t));)c=null,l=d,l.accepts()?(f=0,p=l):f>=0&&f++,r++,u++;if(f<0)r-=u,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(qc(fm,e,s)),s=[]),r-=f,u-=f;const h=p.t,m=n.slice(r-u,r);i.push(qc(h,e,m))}}return s.length>0&&i.push(qc(fm,e,s)),i}function qc(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const lN=typeof console<"u"&&console&&console.warn||(()=>{}),cN="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",je={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dN(){return Ht.groups={},je.scanner=null,je.parser=null,je.tokenQueue=[],je.pluginQueue=[],je.customSchemes=[],je.initialized=!1,je}function hm(t,e=!1){if(je.initialized&&lN(`linkifyjs: already initialized - will not register custom scheme "${t}" ${cN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
149
+ 1. Must only contain digits, lowercase ASCII letters or "-"
150
+ 2. Cannot start or end with "-"
151
+ 3. "-" cannot repeat`);je.customSchemes.push([t,e])}function uN(){je.scanner=oN(je.customSchemes);for(let t=0;t<je.tokenQueue.length;t++)je.tokenQueue[t][1]({scanner:je.scanner});je.parser=sN(je.scanner.tokens);for(let t=0;t<je.pluginQueue.length;t++)je.pluginQueue[t][1]({scanner:je.scanner,parser:je.parser});return je.initialized=!0,je}function Kc(t){return je.initialized||uN(),aN(je.parser.start,t,lm(je.scanner.start,t))}Kc.scan=lm;function mm(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new Uc(n),r=Kc(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}function pN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function fN(t){return new Ae({key:new Ne("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=OE(n.doc,[...e]);if(LE(l).forEach(({newRange:d})=>{const u=AE(o.doc,d,h=>h.isTextblock);let p,f;if(u.length>1?(p=u[0],f=o.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):u.length&&o.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(p=u[0],f=o.doc.textBetween(p.pos,d.to,void 0," ")),p&&f){const h=f.split(" ").filter(y=>y!=="");if(h.length<=0)return!1;const m=h[h.length-1],g=p.pos+f.lastIndexOf(m);if(!m)return!1;const b=Kc(m).map(y=>y.toObject(t.defaultProtocol));if(!pN(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>o.schema.marks.code?!o.doc.rangeHasMark(y.from,y.to,o.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Ll(y.from,y.to,o.doc).some(w=>w.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function hN(t){return new Ae({key:new Ne("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=o.target;const l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(f=>f.nodeName==="A"))return!1;const c=pf(e.state,t.type.name),d=o.target,u=(r=d==null?void 0:d.href)!==null&&r!==void 0?r:c.href,p=(i=d==null?void 0:d.target)!==null&&i!==void 0?i:c.target;return d&&u?(window.open(u,p),!0):!1}}})}function mN(t){return new Ae({key:new Ne("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{state:r}=e,{selection:i}=r,{empty:s}=i;if(s)return!1;let l="";o.content.forEach(d=>{l+=d.textContent});const c=mm(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}const gN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Wo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(gN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Wc=rn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){hm(t);return}hm(t.scheme,t.optionalSlashes)})},onDestroy(){dN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Wo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Wo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Wo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ce(this.options.HTMLAttributes,t),0]:["a",Ce(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Wo(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Wo(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[mo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=mm(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Wo(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(fN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Wo(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(hN({type:this.type})),this.options.linkOnPaste&&t.push(mN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function bN(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,d=bf(n),u=new RegExp(`\\s${d}$`),p=s?"^":"",f=r?"":d,h=c?new RegExp(`${p}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${d}[^\\s${f}]*`,"gm"),m=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,b=Array.from(m.matchAll(h)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),w=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!w)return null;const _=g+b.index;let k=_+b[0].length;return c&&u.test(m.slice(k-1,k+1))&&(b[0]+=" ",k+=1),_<l.pos&&k>=l.pos?{range:{from:_,to:k},query:b[0].slice(n.length),text:b[0]}:null}const yN=new Ne("suggestion");function kN({pluginKey:t=yN,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:d=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=bN}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,w)=>{var _,k,S,C,R,B,T;const v=(_=this.key)===null||_===void 0?void 0:_.getState(w),H=(k=this.key)===null||k===void 0?void 0:k.getState(y.state),Y=v.active&&H.active&&v.range.from!==H.range.from,$=!v.active&&H.active,q=v.active&&!H.active,K=!$&&!q&&v.query!==H.query,oe=$||Y&&K,x=K||Y,M=q||Y&&K;if(!oe&&!x&&!M)return;const F=M&&!oe?v:H,X=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:ee=>d({editor:e,range:F.range,props:ee}),decorationNode:X,clientRect:X?()=>{var ee;const{decorationId:de}=(ee=this.key)===null||ee===void 0?void 0:ee.getState(e.state),xe=y.dom.querySelector(`[data-decoration-id="${de}"]`);return(xe==null?void 0:xe.getBoundingClientRect())||null}:null},oe&&((S=g==null?void 0:g.onBeforeStart)===null||S===void 0||S.call(g,m)),x&&((C=g==null?void 0:g.onBeforeUpdate)===null||C===void 0||C.call(g,m)),(x||oe)&&(m.items=await u({editor:e,query:F.query})),M&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),x&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),oe&&((T=g==null?void 0:g.onStart)===null||T===void 0||T.call(g,m))},destroy:()=>{var y;m&&((y=g==null?void 0:g.onExit)===null||y===void 0||y.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,w,_,k){const{isEditable:S}=e,{composing:C}=e.view,{selection:R}=y,{empty:B,from:T}=R,v={...w};if(v.composing=C,S&&(B||e.view.composing)){(T<w.range.from||T>w.range.to)&&!C&&!w.composing&&(v.active=!1);const H=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),Y=`id_${Math.floor(Math.random()*4294967295)}`;H&&f({editor:e,state:k,range:H.range,isActive:w.active})?(v.active=!0,v.decorationId=w.decorationId?w.decorationId:Y,v.range=H.range,v.query=H.query,v.text=H.text):v.active=!1}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}},props:{handleKeyDown(y,w){var _;const{active:k,range:S}=b.getState(y.state);return k&&((_=g==null?void 0:g.onKeyDown)===null||_===void 0?void 0:_.call(g,{view:y,event:w,range:S}))||!1},decorations(y){const{active:w,range:_,decorationId:k}=b.getState(y);return w?Oe.create(y.doc,[Ye.inline(_.from,_.to,{nodeName:l,class:c,"data-decoration-id":k})]):null}}});return b}const wN=new Ne("mention"),EN=Fe.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",Ce(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:wN,command:({editor:t,range:e,props:n})=>{var o,r,i;const s=t.view.state.selection.$to.nodeAfter;((o=s==null?void 0:s.text)===null||o===void 0?void 0:o.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),o=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(o)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ce({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=Ce({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:n,node:t});return typeof o=="string"?["span",Ce({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:o}=e,{empty:r,anchor:i}=o;return r?(e.doc.nodesBetween(i-1,i,(s,l)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[kN({editor:this.editor,...this.options.suggestion})]}}),_N=/^\s*(\[([( |x])?\])\s$/,gm=Fe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div");return i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=d.target;o.isEditable&&typeof n=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const f=n();if(typeof f!="number")return!1;const h=p.doc.nodeAt(f);return p.setNodeMarkup(f,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{r.setAttribute(d,u)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([d,u])=>{r.setAttribute(d,u)}),{dom:r,contentDOM:c,update:d=>d.type!==this.type?!1:(r.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,!0)}}},addInputRules(){return[fr({find:_N,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),bm=Fe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ce(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ym=De.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),CN=t=>Je({find:/--$/,replace:t??"—"}),SN=t=>Je({find:/\.\.\.$/,replace:t??"…"}),xN=t=>Je({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),NN=t=>Je({find:/"$/,replace:t??"”"}),TN=t=>Je({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),ON=t=>Je({find:/'$/,replace:t??"’"}),MN=t=>Je({find:/<-$/,replace:t??"←"}),AN=t=>Je({find:/->$/,replace:t??"→"}),vN=t=>Je({find:/\(c\)$/,replace:t??"©"}),RN=t=>Je({find:/\(tm\)$/,replace:t??"™"}),BN=t=>Je({find:/\(sm\)$/,replace:t??"℠"}),DN=t=>Je({find:/\(r\)$/,replace:t??"®"}),IN=t=>Je({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),LN=t=>Je({find:/\+\/-$/,replace:t??"±"}),PN=t=>Je({find:/!=$/,replace:t??"≠"}),$N=t=>Je({find:/<<$/,replace:t??"«"}),FN=t=>Je({find:/>>$/,replace:t??"»"}),VN=t=>Je({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),zN=t=>Je({find:/\^2$/,replace:t??"²"}),HN=t=>Je({find:/\^3$/,replace:t??"³"}),UN=t=>Je({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),qN=t=>Je({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),km=De.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(CN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(SN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(xN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(NN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(TN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(ON(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(MN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(AN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(vN(this.options.copyright)),this.options.trademark!==!1&&t.push(RN(this.options.trademark)),this.options.servicemark!==!1&&t.push(BN(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(DN(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(IN(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(LN(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(PN(this.options.notEqual)),this.options.laquo!==!1&&t.push($N(this.options.laquo)),this.options.raquo!==!1&&t.push(FN(this.options.raquo)),this.options.multiplication!==!1&&t.push(VN(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(zN(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(HN(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(UN(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(qN(this.options.threeQuarters)),t}}),wm=rn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var jc,Gc;if(typeof WeakMap<"u"){let t=new WeakMap;jc=e=>t.get(e),Gc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;jc=o=>{for(let r=0;r<t.length;r+=2)if(t[r]==o)return t[r+1]},Gc=(o,r)=>(n==10&&(n=0),t[n++]=o,t[n++]=r)}var Qe=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:r,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:s==this.height)?null:this.map[o+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:o,top:r,bottom:i}=this.findCell(t),{left:s,right:l,top:c,bottom:d}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(r,c),right:Math.max(o,l),bottom:Math.max(i,d)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let r=t.left;r<t.right;r++){const i=o*this.width+r,s=this.map[i];n[s]||(n[s]=!0,!(r==t.left&&r&&this.map[i-1]==s||o==t.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,r=0;;o++){const i=r+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const l=(t+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(t){return jc(t)||Gc(t,KN(t))}};function KN(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=WN(t),n=t.childCount,o=[];let r=0,i=null;const s=[];for(let d=0,u=e*n;d<u;d++)o[d]=0;for(let d=0,u=0;d<n;d++){const p=t.child(d);u++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==p.childCount)break;const g=p.child(m),{colspan:b,rowspan:y,colwidth:w}=g.attrs;for(let _=0;_<y;_++){if(_+d>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-_});break}const k=r+_*e;for(let S=0;S<b;S++){o[k+S]==0?o[k+S]=u:(i||(i=[])).push({type:"collision",row:d,pos:u,n:b-S});const C=w&&w[S];if(C){const R=(k+S)%e*2,B=s[R];B==null||B!=C&&s[R+1]==1?(s[R]=C,s[R+1]=1):B==C&&s[R+1]++}}}r+=b,u+=g.nodeSize}const f=(d+1)*e;let h=0;for(;r<f;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:d,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new Qe(e,n,o,i);let c=!1;for(let d=0;!c&&d<s.length;d+=2)s[d]!=null&&s[d+1]<n&&(c=!0);return c&&jN(l,s,t),l}function WN(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const r=t.child(o);let i=0;if(n)for(let s=0;s<o;s++){const l=t.child(s);for(let c=0;c<l.childCount;c++){const d=l.child(c);s+d.attrs.rowspan>o&&(i+=d.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function jN(t,e,n){t.problems||(t.problems=[]);const o={};for(let r=0;r<t.map.length;r++){const i=t.map[r];if(o[i])continue;o[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const c=s.attrs;for(let d=0;d<c.colspan;d++){const u=(r+d)%t.width,p=e[u*2];p!=null&&(!c.colwidth||c.colwidth[d]!=p)&&((l||(l=GN(c)))[d]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function GN(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Nt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],r=o.spec.tableRole;r&&(e[r]=o)}}return e}var _o=new Ne("selectingCells");function xr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function YN(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function bn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function ra(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=xr(e.$head)||JN(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function JN(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Yc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function XN(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Jc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Em(t,e,n){const o=t.node(-1),r=Qe.get(o),i=t.start(-1),s=r.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function jo(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function _m(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(e,0,0)}return o}function ZN(t,e,n){const o=Nt(e.type.schema).header_cell;for(let r=0;r<t.height;r++)if(e.nodeAt(t.map[n+r*t.width]).type!=o)return!1;return!0}var Ve=class eo extends le{constructor(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,n.pos-i),l=e.node(0),c=r.cellsInRect(s).filter(u=>u!=n.pos-i);c.unshift(n.pos-i);const d=c.map(u=>{const p=o.nodeAt(u);if(!p)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new fu(l.resolve(f),l.resolve(f+p.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),r=e.resolve(n.map(this.$headCell.pos));if(Yc(o)&&Yc(r)&&Jc(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?eo.rowSelection(o,r):i&&this.isColSelection()?eo.colSelection(o,r):new eo(o,r)}return te.between(o,r)}content(){const e=this.$anchorCell.node(-1),n=Qe.get(e),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let c=r.top;c<r.bottom;c++){const d=[];for(let u=c*n.width+r.left,p=r.left;p<r.right;p++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=r.left-h.left,b=h.right-r.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=jo(y,0,g)),b>0&&(y=jo(y,y.colspan-b,b)),h.left<r.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(h.top<r.top||h.bottom>r.bottom){const y={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}d.push(m)}s.push(e.child(c).copy(A.from(d)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new V(A.from(l),1,1)}replace(e,n=V.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:c}=r[s],d=e.mapping.slice(o);e.replace(d.map(l.pos),d.map(c.pos),s?V.empty:n)}const i=le.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new V(A.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=Qe.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(n.pos-i),c=e.node(0);return s.top<=l.top?(s.top>0&&(e=c.resolve(i+r.map[s.left])),l.bottom<r.height&&(n=c.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(n=c.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=c.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new eo(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Qe.get(e),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof eo&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),r=Qe.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(n.pos-i),c=e.node(0);return s.left<=l.left?(s.left>0&&(e=c.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(n=c.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(n=c.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=c.resolve(i+r.map[r.width*(s.top+1)-1]))),new eo(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new eo(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new eo(e.resolve(n),e.resolve(o))}getBookmark(){return new QN(this.$anchorCell.pos,this.$headCell.pos)}};Ve.prototype.visible=!1,le.jsonID("cell",Ve);var QN=class Eb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Eb(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Jc(n,o)?new Ve(n,o):le.near(o,1)}};function eT(t){if(!(t.selection instanceof Ve))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(Ye.node(o,o+n.nodeSize,{class:"selectedCell"}))}),Oe.create(t.doc,e)}function tT({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,r=t.depth;for(;r>=0&&!(t.after(r+1)<t.end(r));r--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return n==o&&/row|table/.test(t.node(r).type.spec.tableRole)}function nT({$from:t,$to:e}){let n,o;for(let r=t.depth;r>0;r--){const i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&e.parentOffset===0}function oT(t,e,n){const o=(e||t).selection,r=(e||t).doc;let i,s;if(o instanceof ne&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ve.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Ve.rowSelection(l,l)}else if(!n){const l=Qe.get(o.node),c=o.from+1,d=c+l.map[l.width*l.height-1];i=Ve.create(r,c+1,d)}}else o instanceof te&&tT(o)?i=te.create(r,o.from):o instanceof te&&nT(o)&&(i=te.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var rT=new Ne("fix-tables");function Cm(t,e,n,o){const r=t.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const c=e.child(s);for(let d=l,u=Math.min(r,s+3);d<u;d++)if(t.child(d)==c){l=d+1,n+=c.nodeSize;continue e}o(c,n),l<r&&t.child(l).sameMarkup(c)?Cm(t.child(l),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Sm(t,e){let n;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=iT(t,r,i,n))};return e?e.doc!=t.doc&&Cm(e.doc,t.doc,0,o):t.doc.descendants(o),n}function iT(t,e,n,o){const r=Qe.get(e);if(!r.problems)return o;o||(o=t.tr);const i=[];for(let c=0;c<r.height;c++)i.push(0);for(let c=0;c<r.problems.length;c++){const d=r.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const p=u.attrs;for(let f=0;f<p.rowspan;f++)i[d.row+f]+=d.n;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,jo(p,p.colspan-d.n,d.n))}else if(d.type=="missing")i[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+e.nodeSize)}}let s,l;for(let c=0;c<i.length;c++)i[c]&&(s==null&&(s=c),l=c);for(let c=0,d=n+1;c<r.height;c++){const u=e.child(c),p=d+u.nodeSize,f=i[c];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=Nt(t.schema)[h].createAndFill();y&&m.push(y)}const g=(c==0||s==c-1)&&l==c?d+1:p-1;o.insert(o.mapping.map(g),m)}d=p}return o.setMeta(rT,{fixTables:!0})}function In(t){const e=t.selection,n=ra(t),o=n.node(-1),r=n.start(-1),i=Qe.get(o);return{...e instanceof Ve?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function xm(t,{map:e,tableStart:n,table:o},r){let i=r>0?-1:0;ZN(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const c=e.map[l],d=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,_m(d.attrs,r-e.colCount(c))),s+=d.attrs.rowspan-1}else{const c=i==null?Nt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,d=e.positionAt(s,r,o);t.insert(t.mapping.map(n+d),c.createAndFill())}}return t}function sT(t,e){if(!bn(t))return!1;if(e){const n=In(t);e(xm(t.tr,n,n.left))}return!0}function aT(t,e){if(!bn(t))return!1;if(e){const n=In(t);e(xm(t.tr,n,n.right))}return!0}function lT(t,{map:e,table:n,tableStart:o},r){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,c=e.map[l],d=n.nodeAt(c),u=d.attrs;if(r>0&&e.map[l-1]==c||r<e.width-1&&e.map[l+1]==c)t.setNodeMarkup(t.mapping.slice(i).map(o+c),null,jo(u,r-e.colCount(c)));else{const p=t.mapping.slice(i).map(o+c);t.delete(p,p+d.nodeSize)}s+=u.rowspan}}function cT(t,e){if(!bn(t))return!1;if(e){const n=In(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;lT(o,n,r),r!=n.left;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Qe.get(i)}e(o)}return!0}function dT(t,e,n){var o;const r=Nt(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((o=e.nodeAt(t.map[i+n*t.width]))==null?void 0:o.type)!=r)return!1;return!0}function Nm(t,{map:e,tableStart:n,table:o},r){var i;let s=n;for(let d=0;d<r;d++)s+=o.child(d).nodeSize;const l=[];let c=r>0?-1:0;dT(e,o,r+c)&&(c=r==0||r==e.height?null:0);for(let d=0,u=e.width*r;d<e.width;d++,u++)if(r>0&&r<e.height&&e.map[u]==e.map[u-e.width]){const p=e.map[u],f=o.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...f,rowspan:f.rowspan+1}),d+=f.colspan-1}else{const p=c==null?Nt(o.type.schema).cell:(i=o.nodeAt(e.map[u+c*e.width]))==null?void 0:i.type,f=p==null?void 0:p.createAndFill();f&&l.push(f)}return t.insert(s,Nt(o.type.schema).row.create(null,l)),t}function uT(t,e){if(!bn(t))return!1;if(e){const n=In(t);e(Nm(t.tr,n,n.top))}return!0}function pT(t,e){if(!bn(t))return!1;if(e){const n=In(t);e(Nm(t.tr,n,n.bottom))}return!0}function fT(t,{map:e,table:n,tableStart:o},r){let i=0;for(let d=0;d<r;d++)i+=n.child(d).nodeSize;const s=i+n.child(r).nodeSize,l=t.mapping.maps.length;t.delete(i+o,s+o);const c=new Set;for(let d=0,u=r*e.width;d<e.width;d++,u++){const p=e.map[u];if(!c.has(p)){if(c.add(p),r>0&&p==e.map[u-e.width]){const f=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+o),null,{...f,rowspan:f.rowspan-1}),d+=f.colspan-1}else if(r<e.height&&p==e.map[u+e.width]){const f=n.nodeAt(p),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(r+1,d,n);t.insert(t.mapping.slice(l).map(o+g),m),d+=h.colspan-1}}}}function hT(t,e){if(!bn(t))return!1;if(e){const n=In(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;fT(o,n,r),r!=n.top;r--){const i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Qe.get(n.table)}e(o)}return!0}function Tm(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function mT({width:t,height:e,map:n},o){let r=o.top*t+o.left,i=r,s=(o.bottom-1)*t+o.left,l=r+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[i]==n[i-1]||o.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[r]==n[r-t]||o.bottom<e&&n[s]==n[s+t])return!0;r++,s++}return!1}function Om(t,e){const n=t.selection;if(!(n instanceof Ve)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=In(t),{map:r}=o;if(mT(r,o))return!1;if(e){const i=t.tr,s={};let l=A.empty,c,d;for(let u=o.top;u<o.bottom;u++)for(let p=o.left;p<o.right;p++){const f=r.map[u*r.width+p],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,d=h;else{Tm(h)||(l=l.append(h.content));const m=i.mapping.map(f+o.tableStart);i.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(i.setNodeMarkup(c+o.tableStart,null,{..._m(d.attrs,d.attrs.colspan,o.right-o.left-d.attrs.colspan),rowspan:o.bottom-o.top}),l.size){const u=c+1+d.content.size,p=Tm(d)?c+1:u;i.replaceWith(p+o.tableStart,u+o.tableStart,l)}i.setSelection(new Ve(i.doc.resolve(c+o.tableStart))),e(i)}return!0}function Mm(t,e){const n=Nt(t.schema);return gT(({node:o})=>n[o.type.spec.tableRole])(t,e)}function gT(t){return(e,n)=>{var o;const r=e.selection;let i,s;if(r instanceof Ve){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(i=YN(r.$from),!i)return!1;s=(o=xr(r.$from))==null?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const c=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=In(e),p=e.tr;for(let h=0;h<u.right-u.left;h++)c.push(d?{...l,colwidth:d&&d[h]?[d[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&h==u.top||p.insert(f=p.mapping.map(m+u.tableStart,1),t({node:i,row:h,col:g}).createAndFill(c[b]))}p.setNodeMarkup(s,t({node:i,row:u.top,col:u.left}),c[0]),r instanceof Ve&&p.setSelection(new Ve(p.doc.resolve(r.$anchorCell.pos),f?p.doc.resolve(f):void 0)),n(p)}return!0}}function bT(t,e){return function(n,o){if(!bn(n))return!1;const r=ra(n);if(r.nodeAfter.attrs[t]===e)return!1;if(o){const i=n.tr;n.selection instanceof Ve?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[t]:e}),o(i)}return!0}}function yT(t){return function(e,n){if(!bn(e))return!1;if(n){const o=Nt(e.schema),r=In(e),i=e.tr,s=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(c=>r.table.nodeAt(c));for(let c=0;c<s.length;c++)l[c].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[c],o.cell,l[c].attrs);if(i.steps.length==0)for(let c=0;c<s.length;c++)i.setNodeMarkup(r.tableStart+s[c],o.header_cell,l[c].attrs);n(i)}return!0}}function Am(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ei(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?yT(t):function(n,o){if(!bn(n))return!1;if(o){const r=Nt(n.schema),i=In(n),s=n.tr,l=Am("row",i,r),c=Am("column",i,r),u=(t==="column"?l:t==="row"?c:!1)?1:0,p=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?c?r.cell:r.header_cell:t=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(p).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),o(s)}return!0}}Ei("row",{useDeprecatedLogic:!0}),Ei("column",{useDeprecatedLogic:!0});var kT=Ei("cell",{useDeprecatedLogic:!0});function wT(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,r=t.before();o>=0;o--){const i=t.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),r=t.after();o<n.childCount;o++){const i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function vm(t){return function(e,n){if(!bn(e))return!1;const o=wT(ra(e),t);if(o==null)return!1;if(n){const r=e.doc.resolve(o);n(e.tr.setSelection(te.between(r,XN(r))).scrollIntoView())}return!0}}function ET(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function ia(t,e){const n=t.selection;if(!(n instanceof Ve))return!1;if(e){const o=t.tr,r=Nt(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new V(r,0,0))}),o.docChanged&&e(o)}return!0}function _T(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,n-1),p=c<e.childCount-1?0:Math.max(0,o-1);(u||p)&&(d=Xc(Nt(s).row,new V(d,u,p)).content),l.push(d)}else if(i=="cell"||i=="header_cell")l.push(n||o?Xc(Nt(s).row,new V(e,n,o)).content:e);else return null;return CT(s,l)}function CT(t,e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:c}=i.child(s).attrs;for(let d=r;d<r+l;d++)n[d]=(n[d]||0)+c}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=e.length&&e.push(A.empty),n[r]<o){const i=Nt(t).cell.createAndFill(),s=[];for(let l=n[r];l<o;l++)s.push(i);e[r]=e[r].append(A.from(s))}return{height:e.length,width:o,rows:e}}function Xc(t,e){const n=t.createAndFill();return new Ka(n).replace(0,n.content.size,e).doc}function ST({width:t,height:e,rows:n},o,r){if(t!=o){const i=[],s=[];for(let l=0;l<n.length;l++){const c=n[l],d=[];for(let u=i[l]||0,p=0;u<o;p++){let f=c.child(p%c.childCount);u+f.attrs.colspan>o&&(f=f.type.createChecked(jo(f.attrs,f.attrs.colspan,u+f.attrs.colspan-o),f.content)),d.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(A.from(d))}n=s,t=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const c=[],d=n[l%e];for(let u=0;u<d.childCount;u++){let p=d.child(u);s+p.attrs.rowspan>r&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,r-p.attrs.rowspan)},p.content)),c.push(p)}i.push(A.from(c))}n=i,e=r}return{width:t,height:e,rows:n}}function xT(t,e,n,o,r,i,s){const l=t.doc.type.schema,c=Nt(l);let d,u;if(r>e.width)for(let p=0,f=0;p<e.height;p++){const h=n.child(p);f+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let b=e.width;b<r;b++)m.push(g);t.insert(t.mapping.slice(s).map(f-1+o),m)}if(i>e.height){const p=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const b=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==c.header_cell;p.push(b?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const f=c.row.create(null,A.from(p)),h=[];for(let m=e.height;m<i;m++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(d||u)}function Rm(t,e,n,o,r,i,s,l){if(s==0||s==e.height)return!1;let c=!1;for(let d=r;d<i;d++){const u=s*e.width+d,p=e.map[u];if(e.map[u-e.width]==p){c=!0;const f=n.nodeAt(p),{top:h,left:m}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,m,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),d+=f.attrs.colspan-1}}return c}function Bm(t,e,n,o,r,i,s,l){if(s==0||s==e.width)return!1;let c=!1;for(let d=r;d<i;d++){const u=d*e.width+s,p=e.map[u];if(e.map[u-1]==p){c=!0;const f=n.nodeAt(p),h=e.colCount(p),m=t.mapping.slice(l).map(p+o);t.setNodeMarkup(m,null,jo(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(m+f.nodeSize,f.type.createAndFill(jo(f.attrs,0,s-h))),d+=f.attrs.rowspan-1}}return c}function Dm(t,e,n,o,r){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=Qe.get(i);const{top:l,left:c}=o,d=c+r.width,u=l+r.height,p=t.tr;let f=0;function h(){if(i=n?p.doc.nodeAt(n-1):p.doc,!i)throw new Error("No table found");s=Qe.get(i),f=p.mapping.maps.length}xT(p,s,i,n,d,u,f)&&h(),Rm(p,s,i,n,c,d,l,f)&&h(),Rm(p,s,i,n,c,d,u,f)&&h(),Bm(p,s,i,n,l,u,c,f)&&h(),Bm(p,s,i,n,l,u,d,f)&&h();for(let m=l;m<u;m++){const g=s.positionAt(m,c,i),b=s.positionAt(m,d,i);p.replace(p.mapping.slice(f).map(g+n),p.mapping.slice(f).map(b+n),new V(r.rows[m-l],0,0))}h(),p.setSelection(new Ve(p.doc.resolve(n+s.positionAt(l,c,i)),p.doc.resolve(n+s.positionAt(u-1,d-1,i)))),e(p)}var NT=_l({ArrowLeft:aa("horiz",-1),ArrowRight:aa("horiz",1),ArrowUp:aa("vert",-1),ArrowDown:aa("vert",1),"Shift-ArrowLeft":la("horiz",-1),"Shift-ArrowRight":la("horiz",1),"Shift-ArrowUp":la("vert",-1),"Shift-ArrowDown":la("vert",1),Backspace:ia,"Mod-Backspace":ia,Delete:ia,"Mod-Delete":ia});function sa(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function aa(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;if(i instanceof Ve)return sa(n,o,le.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=Im(r,t,e);if(s==null)return!1;if(t=="horiz")return sa(n,o,le.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(s),c=Em(l,t,e);let d;return c?d=le.near(c,1):e<0?d=le.near(n.doc.resolve(l.before(-1)),-1):d=le.near(n.doc.resolve(l.after(-1)),1),sa(n,o,d)}}}function la(t,e){return(n,o,r)=>{if(!r)return!1;const i=n.selection;let s;if(i instanceof Ve)s=i;else{const c=Im(r,t,e);if(c==null)return!1;s=new Ve(n.doc.resolve(c))}const l=Em(s.$headCell,t,e);return l?sa(n,o,new Ve(s.$anchorCell,l)):!1}}function TT(t,e){const n=t.state.doc,o=xr(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new Ve(o))),!0):!1}function OT(t,e,n){if(!bn(t.state))return!1;let o=_T(n);const r=t.state.selection;if(r instanceof Ve){o||(o={width:1,height:1,rows:[A.from(Xc(Nt(t.state.schema).cell,n))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=Qe.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=ST(o,l.right-l.left,l.bottom-l.top),Dm(t.state,t.dispatch,s,l,o),!0}else if(o){const i=ra(t.state),s=i.start(-1);return Dm(t.state,t.dispatch,s,Qe.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function MT(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=Lm(t,e.target);let r;if(e.shiftKey&&t.state.selection instanceof Ve)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=xr(t.state.selection.$anchor))!=null&&((n=Zc(t,e))==null?void 0:n.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(c,d){let u=Zc(t,d);const p=_o.getState(t.state)==null;if(!u||!Jc(c,u))if(p)u=c;else return;const f=new Ve(c,u);if(p||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);p&&h.setMeta(_o,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),_o.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_o,-1))}function l(c){const d=c,u=_o.getState(t.state);let p;if(u!=null)p=t.state.doc.resolve(u);else if(Lm(t,d.target)!=o&&(p=Zc(t,e),!p))return s();p&&i(p,d)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function Im(t,e,n){if(!(t.state.selection instanceof te))return null;const{$head:o}=t.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=o.before(r),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function Lm(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Zc(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?xr(t.state.doc.resolve(n.pos)):null}var AT=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qc(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Qc(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qc(t,e,n,o,r,i){var s;let l=0,c=!0,d=e.firstChild;const u=t.firstChild;if(u){for(let p=0,f=0;p<u.childCount;p++){const{colspan:h,colwidth:m}=u.child(p).attrs;for(let g=0;g<h;g++,f++){const b=r==f?i:m&&m[g],y=b?b+"px":"";if(l+=b||o,b||(c=!1),d)d.style.width!=y&&(d.style.width=y),d=d.nextSibling;else{const w=document.createElement("col");w.style.width=y,e.appendChild(w)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)==null||s.removeChild(d),d=p}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Xt=new Ne("tableColumnResizing");function vT({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=AT,lastColumnResizable:r=!0}={}){const i=new Ae({key:Xt,state:{init(s,l){var c,d;const u=(d=(c=i.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,p=Nt(l.schema).table.name;return o&&u&&(u[p]=(f,h)=>new o(f,n,h)),new RT(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Xt.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{BT(s,l,t,r)},mouseleave:s=>{DT(s)},mousedown:(s,l)=>{IT(s,l,e,n)}},decorations:s=>{const l=Xt.getState(s);if(l&&l.activeHandle>-1)return VT(s,l.activeHandle)},nodeViews:{}}});return i}var RT=class Ra{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(Xt);if(o&&o.setHandle!=null)return new Ra(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Ra(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return Yc(e.doc.resolve(r))||(r=-1),new Ra(r,n.dragging)}return n}};function BT(t,e,n,o){if(!t.editable)return;const r=Xt.getState(t.state);if(r&&!r.dragging){const i=PT(e.target);let s=-1;if(i){const{left:l,right:c}=i.getBoundingClientRect();e.clientX-l<=n?s=Pm(t,e,"left",n):c-e.clientX<=n&&(s=Pm(t,e,"right",n))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=t.state.doc.resolve(s),c=l.node(-1),d=Qe.get(c),u=l.start(-1);if(d.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==d.width-1)return}Fm(t,s)}}}function DT(t){if(!t.editable)return;const e=Xt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Fm(t,-1)}function IT(t,e,n,o){var r;if(!t.editable)return!1;const i=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=Xt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=t.state.doc.nodeAt(s.activeHandle),c=LT(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Xt,{setDragging:{startX:e.clientX,startWidth:c}}));function d(p){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u);const f=Xt.getState(t.state);f!=null&&f.dragging&&($T(t,f.activeHandle,$m(f.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Xt,{setDragging:null})))}function u(p){if(!p.which)return d(p);const f=Xt.getState(t.state);if(f&&f.dragging){const h=$m(f.dragging,p,n);Vm(t,f.activeHandle,h,o)}}return Vm(t,s.activeHandle,c,o),i.addEventListener("mouseup",d),i.addEventListener("mousemove",u),e.preventDefault(),!0}function LT(t,e,{colspan:n,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=t.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,c=n;if(o)for(let d=0;d<n;d++)o[d]&&(l-=o[d],c--);return l/c}function PT(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Pm(t,e,n,o){const r=n=="right"?-o:o,i=t.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=xr(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;const c=Qe.get(l.node(-1)),d=l.start(-1),u=c.map.indexOf(l.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function $m(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Fm(t,e){t.dispatch(t.state.tr.setMeta(Xt,{setHandle:e}))}function $T(t,e,n){const o=t.state.doc.resolve(e),r=o.node(-1),i=Qe.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let d=0;d<i.height;d++){const u=d*i.width+l;if(d&&i.map[u]==i.map[u-i.width])continue;const p=i.map[u],f=r.nodeAt(p).attrs,h=f.colspan==1?0:l-i.colCount(p);if(f.colwidth&&f.colwidth[h]==n)continue;const m=f.colwidth?f.colwidth.slice():FT(f.colspan);m[h]=n,c.setNodeMarkup(s+p,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function Vm(t,e,n,o){const r=t.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=Qe.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let c=t.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&Qc(i,c.firstChild,c,o,l,n)}function FT(t){return Array(t).fill(0)}function VT(t,e){var n;const o=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Oe.empty;const s=Qe.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<s.height;d++){const u=c+d*s.width;if((c==s.width-1||s.map[u]!=s.map[u+1])&&(d==0||s.map[u]!=s.map[u-s.width])){const p=s.map[u],f=l+p+i.nodeAt(p).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(n=Xt.getState(t))!=null&&n.dragging&&o.push(Ye.node(l+p,l+p+i.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),o.push(Ye.widget(f,h))}}return Oe.create(t.doc,o)}function zT({allowTableNodeSelection:t=!1}={}){return new Ae({key:_o,state:{init(){return null},apply(e,n){const o=e.getMeta(_o);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:r,pos:i}=e.mapping.mapResult(n);return r?null:i}},props:{decorations:eT,handleDOMEvents:{mousedown:MT},createSelectionBetween(e){return _o.getState(e.state)!=null?e.state.selection:null},handleTripleClick:TT,handleKeyDown:NT,handlePaste:OT},appendTransaction(e,n,o){return oT(o,Sm(o,n),t)}})}function ed(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function zm(t,e,n,o,r,i){var s;let l=0,c=!0,d=e.firstChild;const u=t.firstChild;if(u!==null)for(let p=0,f=0;p<u.childCount;p+=1){const{colspan:h,colwidth:m}=u.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=r===f?i:m&&m[g],y=b?`${b}px`:"";if(l+=b||o,b||(c=!1),d){if(d.style.width!==y){const[w,_]=ed(o,b);d.style.setProperty(w,_)}d=d.nextSibling}else{const w=document.createElement("col"),[_,k]=ed(o,b);w.style.setProperty(_,k),e.appendChild(w)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)===null||s===void 0||s.removeChild(d),d=p}c?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class HT{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),zm(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,zm(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function UT(t,e,n,o){let r=0,i=!0;const s=[],l=t.firstChild;if(!l)return{};for(let p=0,f=0;p<l.childCount;p+=1){const{colspan:h,colwidth:m}=l.child(p).attrs;for(let g=0;g<h;g+=1,f+=1){const b=n===f?o:m&&m[g];r+=b||e,b||(i=!1);const[y,w]=ed(e,b);s.push(["col",{style:`${y}: ${w}`}])}}const c=i?`${r}px`:"",d=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:d}}function Hm(t,e){return t.createAndFill()}function qT(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function Um(t,e,n,o,r){const i=qT(t),s=[],l=[];for(let d=0;d<n;d+=1){const u=Hm(i.cell);if(u&&l.push(u),o){const p=Hm(i.header_cell);p&&s.push(p)}}const c=[];for(let d=0;d<e;d+=1)c.push(i.row.createChecked(null,o&&d===0?s:l));return i.table.createChecked(null,c)}function KT(t){return t instanceof Ve}const ca=({editor:t})=>{const{selection:e}=t.state;if(!KT(e))return!1;let n=0;const o=df(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},qm=Fe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:HT,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:r}=UT(t,this.options.cellMinWidth);return["table",Ce(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${r}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=Um(i.schema,t,e,n);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(te.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>sT(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>aT(t,e),deleteColumn:()=>({state:t,dispatch:e})=>cT(t,e),addRowBefore:()=>({state:t,dispatch:e})=>uT(t,e),addRowAfter:()=>({state:t,dispatch:e})=>pT(t,e),deleteRow:()=>({state:t,dispatch:e})=>hT(t,e),deleteTable:()=>({state:t,dispatch:e})=>ET(t,e),mergeCells:()=>({state:t,dispatch:e})=>Om(t,e),splitCell:()=>({state:t,dispatch:e})=>Mm(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ei("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ei("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>kT(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Om(t,e)?!0:Mm(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>bT(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>vm(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>vm(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Sm(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=Ve.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ca,"Mod-Backspace":ca,Delete:ca,"Mod-Delete":ca}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[vT({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zT({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ye(G(t,"tableRole",e))}}}),Km=Fe.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ce(this.options.HTMLAttributes,t),0]}}),Wm=Fe.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ce(this.options.HTMLAttributes,t),0]}}),td=Fe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ce(this.options.HTMLAttributes,t),0]}});/**
152
+ * Copyright 2025 Yiitap
153
+ * @license MIT
154
+ **/const jm=t=>{const e=/(#[0-9a-f]{3,6})\b/gi,n=[];return t.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],l=i.index||0,c=r+l,d=c+s.length,u=Ye.inline(c,d,{class:"color",style:`--color: ${s}`});n.push(u)})}),Oe.create(t,n)},Gm=De.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new Ae({key:new Ne("colorHighlighter"),state:{init(t,{doc:e}){return jm(e)},apply(t,e){return t.docChanged?jm(t.doc):e}},props:{decorations(t){return this.getState(t)}}})]}});/**
155
+ * Copyright 2025 Yiitap
156
+ * @license MIT
157
+ **/De.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ae({key:new Ne("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!n||!o)return Oe.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,d)=>{if(!c.isText){if(!(r>=d&&r<=d+c.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((c,d)=>{if(c.isText||!(r>=d&&r<=d+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Oe.create(t,i)}}})]}});/**
158
+ * Copyright 2025 Yiitap
159
+ * @license MIT
160
+ **/const Ym=De.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ae({key:new Ne("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];return n?(t.descendants((i,s)=>{const l=o>=s&&o<=s+i.nodeSize,c=!i.isLeaf&&!i.childCount,d=this.options.showOnlyCurrent;if((l||!d)&&c){const u=[this.options.emptyNodeClass];this.editor.isEmpty&&u.push(this.options.emptyEditorClass);const p=Ye.node(s,s+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:s,hasAnchor:l}):this.options.placeholder});r.push(p)}return this.options.includeChildren}),Oe.create(t,r)):null}}})]}});/**
161
+ * Copyright 2025 Yiitap
162
+ * @license MIT
163
+ **/const _i="selection-decoration",da={BLUR:"blur",FOCUS:"focus"},Jm=De.create({name:_i,addProseMirrorPlugins(){return[new Ae({key:new Ne(_i),state:{init(t){return Oe.empty},apply:(t,e)=>{const{selection:n,doc:o}=t,r=t.getMeta(_i),i=n&&n.from!==n.to;if(!i||(r==null?void 0:r.action)===da.FOCUS)return Oe.empty;if(i&&(r==null?void 0:r.action)===da.BLUR){const s=Ye.inline(n.from,n.to,{class:"selection-decoration-blur"});return Oe.create(o,[s])}return e}},props:{decorations(t){return this.getState(t)},handleDOMEvents:{blur:t=>{const{tr:e}=t.state,n=e.setMeta(_i,{from:e.selection.from,to:e.selection.to,action:da.BLUR});t.dispatch(n)},focus:t=>{const{tr:e}=t.state,n=e.setMeta(_i,{from:e.selection.from,to:e.selection.to,action:da.FOCUS});t.dispatch(n)}}}})]}});/**
164
+ * Copyright 2025 Yiitap
165
+ * @license MIT
166
+ **/function Xm(t,e,n,o,r,i){let s=0,l=!0,c=e.firstChild;const d=t.firstChild;for(let u=0,p=0;u<d.childCount;u+=1){const{colspan:f,colwidth:h}=d.child(u).attrs;for(let m=0;m<f;m+=1,p+=1){const g=r===p?i:h&&h[m],b=g?`${g}px`:"";if(s+=g||o,g||(l=!1),c)c.style.width!==b&&(c.style.width=b),c=c.nextSibling;else{const y=document.createElement("col");y.className=`col-${p}`,e.appendChild(y).style.width=b}}}for(;c;){const u=c.nextSibling;c.parentNode.removeChild(c),c=u}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class WT{constructor(e,n,o){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Xm(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Xm(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}const Zm=qm.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:WT,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),insertTable:e=>({editor:n,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:l=3,withHeaderRow:c=!0}=e||{},d=Um(n.schema,s,l,c);if(i){const u=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[d.toJSON()]}),r.scrollIntoView().setSelection(te.near(r.doc.resolve(u)))}return!0},deleteTable:()=>({state:e,dispatch:n})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return n&&n(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Ve.rowSelection(r);n.setSelection(i)}return!0},selectColumn:e=>({tr:n,dispatch:o})=>{if(o){const r=n.doc.resolve(e),i=Ve.colSelection(r);n.setSelection(i)}return!0}}}});/**
167
+ * Copyright 2025 Yiitap
168
+ * @license MIT
169
+ **/function jT({node:t,types:e}){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function ua({node:t,types:e}){return t?!jT({node:t,types:e}):!1}const Qm=De.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const t=new Ne(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>this.options.notAfter.includes(n.name));return[new Ae({key:t,appendTransaction:(n,o,r)=>{const{doc:i,tr:s,schema:l}=r,c=t.getState(r),d=i.content.size,u=l.nodes[this.options.node];if(!(!c||!u))return s.insert(d,u.create())},state:{init:(n,o)=>{const r=o.tr.doc.lastChild,i=(r==null?void 0:r.firstChild)??null;return ua({node:r,types:e})||ua({node:i,types:e})},apply:(n,o)=>{var s;if(!n.docChanged)return o;const r=n.doc.lastChild,i=((s=n.doc.lastChild)==null?void 0:s.firstChild)??null;return ua({node:r,types:e})||ua({node:i,types:e})}}})]}});for(var wt=[],nd=0;nd<256;++nd)wt.push((nd+256).toString(16).slice(1));function GT(t,e=0){return(wt[t[e+0]]+wt[t[e+1]]+wt[t[e+2]]+wt[t[e+3]]+"-"+wt[t[e+4]]+wt[t[e+5]]+"-"+wt[t[e+6]]+wt[t[e+7]]+"-"+wt[t[e+8]]+wt[t[e+9]]+"-"+wt[t[e+10]]+wt[t[e+11]]+wt[t[e+12]]+wt[t[e+13]]+wt[t[e+14]]+wt[t[e+15]]).toLowerCase()}var pa,YT=new Uint8Array(16);function JT(){if(!pa&&(pa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pa(YT)}var XT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const eg={randomUUID:XT};function ZT(t,e,n){if(eg.randomUUID&&!t)return eg.randomUUID();t=t||{};var o=t.random||(t.rng||JT)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,GT(o)}/**
170
+ * Copyright 2025 Yiitap
171
+ * @license MIT
172
+ **/const tg=Fe.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"data-id",types:["heading"],enableRender:!1,enableInJSON:!1,generateId:()=>ZT()}),addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(this.options.attributeName),renderHTML:t=>this.options.enableRender?{[this.options.attributeName]:t[this.options.attributeName]}:{},toJSON:t=>this.options.enableInJSON?t:void 0}}}]},addProseMirrorPlugins(){return[new Ae({key:new Ne(this.name),props:{transformPastedHTML:t=>{const e=new DOMParser().parseFromString(t,"text/html"),n=this.options.attributeName;return e.querySelectorAll(`[${n}]`).forEach(o=>{o.setAttribute(n,this.options.generateId())}),e.body.innerHTML}},appendTransaction:(t,e,n)=>{const o=n.tr,r=this.options.attributeName;let i=!1;return n.doc.descendants((s,l)=>{s.isText||!s.attrs[r]&&this.options.types.includes(s.type.name)&&(o.setNodeMarkup(l,void 0,{...s.attrs,[r]:this.options.generateId()}),i=!0)}),i?o:null}})]}});/**
173
+ * Copyright 2025 Yiitap
174
+ * @license MIT
175
+ **/function QT(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=t,c=o&&!r,d=bf(n),u=new RegExp(`\\s${d}$`),p=s?"^":"",f=r?"":d,h=c?new RegExp(`${p}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${p}(?:^)?${d}[^\\s${f}]*`,"gm"),m=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,b=Array.from(m.matchAll(h)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),w=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!w)return null;const _=g+b.index;let k=_+b[0].length;return c&&u.test(m.slice(k-1,k+1))&&(b[0]+=" ",k+=1),_<l.pos&&k>=l.pos?{range:{from:_,to:k},query:b[0].slice(n.length),text:b[0]}:null}const e1=new Ne("suggestion");function fa({pluginKey:t=e1,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:c="suggestion",command:d=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:h=QT}){let m;const g=p==null?void 0:p(),b=new Ae({key:t,view(){return{update:async(y,w)=>{var _,k,S,C,R,B,T;const v=(_=this.key)===null||_===void 0?void 0:_.getState(w),H=(k=this.key)===null||k===void 0?void 0:k.getState(y.state),Y=v.active&&H.active&&v.range.from!==H.range.from,$=!v.active&&H.active,q=v.active&&!H.active,K=!$&&!q&&v.query!==H.query,oe=$||Y&&K,x=K||Y,M=q||Y&&K;if(!oe&&!x&&!M)return;const F=M&&!oe?v:H,X=y.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);m={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:ee=>d({editor:e,range:F.range,props:ee}),decorationNode:X,clientRect:X?()=>{var ee;const{decorationId:de}=(ee=this.key)===null||ee===void 0?void 0:ee.getState(e.state),xe=y.dom.querySelector(`[data-decoration-id="${de}"]`);return(xe==null?void 0:xe.getBoundingClientRect())||null}:null},oe&&((S=g==null?void 0:g.onBeforeStart)===null||S===void 0||S.call(g,m)),x&&((C=g==null?void 0:g.onBeforeUpdate)===null||C===void 0||C.call(g,m)),(x||oe)&&(m.items=await u({editor:e,query:F.query})),M&&((R=g==null?void 0:g.onExit)===null||R===void 0||R.call(g,m)),x&&((B=g==null?void 0:g.onUpdate)===null||B===void 0||B.call(g,m)),oe&&((T=g==null?void 0:g.onStart)===null||T===void 0||T.call(g,m))},destroy:()=>{var y;m&&((y=g==null?void 0:g.onExit)===null||y===void 0||y.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,w,_,k){const{isEditable:S}=e,{composing:C}=e.view,{selection:R}=y,{empty:B,from:T}=R,v={...w};if(v.composing=C,S&&(B||e.view.composing)){(T<w.range.from||T>w.range.to)&&!C&&!w.composing&&(v.active=!1);const H=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),Y=`id_${Math.floor(Math.random()*4294967295)}`;H&&f({editor:e,state:k,range:H.range,isActive:w.active})?(v.active=!0,v.decorationId=w.decorationId?w.decorationId:Y,v.range=H.range,v.query=H.query,v.text=H.text):v.active=!1}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}},props:{handleKeyDown(y,w){var _;const{active:k,range:S}=b.getState(y.state);return k&&((_=g==null?void 0:g.onKeyDown)===null||_===void 0?void 0:_.call(g,{view:y,event:w,range:S}))||!1},decorations(y){const{active:w,range:_,decorationId:k}=b.getState(y);return w?Oe.create(y.doc,[Ye.inline(_.from,_.to,{nodeName:l,class:c,"data-decoration-id":k})]):null}}});return b}const t1=De.create({name:"char-command",addOptions(){return{pluginKey:"char-command",suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[fa({pluginKey:new Ne(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),n1=De.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[fa({pluginKey:new Ne("colon-command"),editor:this.editor,...this.options.suggestion})]}}),o1=De.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[fa({pluginKey:new Ne("slash-command"),editor:this.editor,...this.options.suggestion})]}}),r1=De.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[fa({pluginKey:new Ne("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}});/**
176
+ * Copyright 2025 Yiitap
177
+ * @license MIT
178
+ **/const i1=Fe.create({name:"aiBlock",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{provider:{default:""},prompt:{default:""},time:{default:0}}},parseHTML(){return[{tag:'div[data-type="aiBlock"]'}]},renderHTML({HTMLAttributes:t}){return["div",Ce(t,{"data-type":"aiBlock"}),0]},addCommands(){return{setAiBlock:()=>({commands:t})=>t.wrapIn(this.name),toggleAiBlock:()=>({commands:t})=>t.toggleWrap(this.name),unsetAiBlock:()=>({commands:t})=>t.lift(this.name),updateAiBlock:(t,e)=>({editor:n,tr:o,dispatch:r})=>{const i=o.doc.nodeAt(t);if(!i||i.type.name!==this.name)return console.error("Invalid node type."),!1;try{const s=Cn.fromJSON(n.schema,e),l=i.copy(s.content);return o.replaceWith(t,t+i.nodeSize,l),r==null?void 0:r(o)}catch(s){return console.error("Invalid content structure:",s),!1}}}},addKeyboardShortcuts(){return{"Mod-a":({editor:t})=>{var s;const{state:e,view:n}=t,{selection:o,tr:r}=e,{$from:i}=o;if(((s=i.node(-1))==null?void 0:s.type.name)===this.name){const l=i.start(-1)+1,c=i.end(-1)-1,d=te.create(r.doc,l,c);return r.setSelection(d),n.dispatch(r),!0}return!1}}}}),s1={class:"o-scroll"},a1={class:"view-main"},l1={class:"block-container"},c1={class:"block-content"},d1={key:0,class:"edit-prompt"},u1={key:1},p1={"data-tippy-role":"tooltip"},f1={class:"label"},h1={class:"block-container"},m1={class:"block-content"},g1=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{md:n,aiOption:o,createStreamingChatCompletion:r}=fc(),{languageName:i,tr:s}=be(),{isFocused:l,bind:c,unbind:d,checkFocus:u}=Lh(),{theme:p}=_r(),{isEditable:f}=Me(),{getPos:h}=e,m=a.ref(null),g=a.ref(""),b=a.ref(!1),y=a.ref({}),w=a.ref(!1),_=a.ref(!1),k=a.ref(""),S=a.ref(null),C=a.ref(!1),R=a.ref(!1),B=a.computed(()=>({role:"system",content:uc.writing.replace("[LANGUAGE]",i.value)})),T=a.ref([B.value]),v=a.computed(()=>!e.node.textContent),H=a.computed(()=>Nh),Y=a.computed({get(){return e.node.attrs.provider},set(Z){e.updateAttributes({provider:Z})}}),$=a.computed({get(){return e.node.attrs.prompt},set(Z){e.updateAttributes({prompt:Z})}}),q=a.computed({get(){return e.node.attrs.time},set(Z){e.updateAttributes({time:Z})}});function K(){g.value=$.value,v.value&&!$.value&&setTimeout(()=>{var Z;(Z=m.value)==null||Z.focus()},0)}function oe(){setTimeout(()=>{},0)}function x(){k.value="edit",setTimeout(()=>{var Z;(Z=S.value)==null||Z.focus()},0)}function M(){Y.value=o.value.provider,$.value=g.value,q.value=Date.now(),C.value=!0,k.value&&(k.value=""),R.value?X():F()}async function F(){const Z=h();let we="";T.value.push({role:"user",content:$.value}),T.value[0].role==="system"&&(T.value.shift(),T.value.unshift(B.value));try{const Ee=await r(T.value,et=>{we+=et,T.value=[...T.value.slice(0,-1),{role:"assistant",content:we}];const nt=pd(n.render(we));ee(Z,nt)})}catch(Ee){T.value.pop(),console.error(Ee),Ec.error(s("ai.error"))}C.value=!1}async function X(){const Z=h();let we="";try{for(const Ee of Yh){await new Promise(nt=>setTimeout(nt,500)),we+=Ee;const et=pd(n.render(we));ee(Z,et)}}catch(Ee){console.error(Ee)}C.value=!1}function ee(Z,we){var et;const Ee=e.node.toJSON();Ee.content=we.content,(et=e.editor)==null||et.commands.updateAiBlock(Z,Ee),e.editor.commands.setNodeSelection(Z),e.editor.view.focus(),de()}function de(){const we=e.node.content.lastChild;if(we&&we.attrs["data-id"]){const Ee=we.attrs["data-id"],et=document.querySelector(`[data-id="${Ee}"]`);et&&et.scrollIntoView({behavior:"smooth",block:"center"})}}function xe(Z){b.value=!1,Z.value}function it(Z,we){we?g.value=s(we.label):g.value=s(Z.label),w.value=!1}function Be(Z){b.value=!0,y.value=Z}return a.watch(()=>e.node.content,Z=>{u()}),a.watch(v,Z=>{Z&&(_.value=!1)}),a.watch(l,Z=>{Z&&!v.value&&setTimeout(()=>{g.value=$.value,k.value="",_.value=Z},100)}),a.onMounted(()=>{K(),c(e)}),a.onBeforeUnmount(()=>{d()}),(Z,we)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:["o-ai-block-view",{"is-empty":v.value,"has-focus":a.unref(l)}],onContextmenu:a.withModifiers(Be,["prevent"])}),{default:a.withCtx(()=>[v.value?(a.openBlock(),a.createBlock(a.unref(Yn),{key:0,modelValue:w.value,"onUpdate:modelValue":we[1]||(we[1]=Ee=>w.value=Ee),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":a.withCtx(()=>[a.createElementVNode("section",s1,[a.createElementVNode("section",a1,[a.createVNode(a.unref(Ss),{items:H.value,onSelect:it,"use-keyboard":w.value},null,8,["items","use-keyboard"])])])]),default:a.withCtx(()=>[a.createElementVNode("div",l1,[a.createElementVNode("div",c1,[a.createVNode(a.unref(Rn),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":we[0]||(we[0]=Ee=>g.value=Ee),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:oe},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"auto_awesome"})]),suffix:a.withCtx(()=>[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:a.unref(s)("label.generate"),loading:C.value,onClick:M},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(a.unref(Yn),{modelValue:_.value,"onUpdate:modelValue":we[4]||(we[4]=Ee=>_.value=Ee),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":a.withCtx(()=>[k.value==="edit"?(a.openBlock(),a.createElementBlock("section",d1,[a.createVNode(a.unref(Rn),{ref_key:"updateInputRef",ref:S,modelValue:g.value,"onUpdate:modelValue":we[2]||(we[2]=Ee=>g.value=Ee),placeholder:a.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"auto_awesome"})]),suffix:a.withCtx(()=>[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:a.unref(s)("label.generate"),loading:C.value,onClick:M},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(a.openBlock(),a.createElementBlock("section",u1,[a.createVNode(a.unref(Gh),null,{default:a.withCtx(()=>[a.createElementVNode("div",p1,[a.createVNode(a.unref(xt),{icon:"auto_awesome",onClick:x},{default:a.withCtx(()=>[a.createElementVNode("span",f1,a.toDisplayString(a.unref(s)("label.generatedBy"))+" "+a.toDisplayString(a.unref(dc)(Y.value,"name")||"AI"),1)]),_:1})]),a.createVNode(a.unref(yn),{icon:"autorenew",tooltip:a.unref(s)("label.update"),loading:C.value,onClick:M},null,8,["tooltip","loading"])]),_:1})]))]),default:a.withCtx(()=>[a.createElementVNode("div",h1,[a.createElementVNode("div",m1,[a.createVNode(a.unref(An))]),a.unref(f)?(a.openBlock(),a.createBlock(a.unref(ci),{key:0,modelValue:b.value,"onUpdate:modelValue":we[3]||(we[3]=Ee=>b.value=Ee),event:y.value},{default:a.withCtx(()=>[a.createVNode(a.unref(yo),a.mergeProps(e,{onAction:xe}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[a.vShow,!v.value]])]),_:1},16,["class"]))}}),ng=i1.extend({addNodeView(){return dn(g1)}}),b1=a.defineComponent({__name:"view",props:lt,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:"o-blockquote-view"}),{default:a.withCtx(()=>[a.createElementVNode("blockquote",null,[a.createVNode(a.unref(An))])]),_:1},16))}}),og=lh.extend({draggable:!0,addNodeView(){return dn(b1)}});/**
179
+ * Copyright 2025 Yiitap
180
+ * @license MIT
181
+ **/const y1=Fe.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:t}){return["div",Ce(t,{"data-type":"callout"}),0]},addCommands(){return{setCallout:()=>({commands:t})=>t.wrapIn(this.name),toggleCallout:()=>({commands:t})=>t.toggleWrap(this.name),unsetCallout:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-a":({editor:t})=>{var s;const{state:e,view:n}=t,{selection:o,tr:r}=e,{$from:i}=o;if(((s=i.node(-1))==null?void 0:s.type.name)===this.name){const l=i.start(-1)+1,c=i.end(-1)-1,d=te.create(r.doc,l,c);return r.setSelection(d),n.dispatch(r),!0}return!1}}}}),k1={class:"callout-container"},w1={class:"callout-icon"},E1={class:"callout-content"},_1=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{theme:n}=_r(),{isEditable:o}=Me(),r=a.ref(!1),i=a.ref(!1),s=a.ref({}),l=a.ref(null),c=a.computed(()=>{const{selection:k}=e.editor.view.state,S=k.from,C=e.getPos(),R=C+e.node.nodeSize;return S>=C&&S<=R}),d=a.computed({get(){return e.node.attrs.backColor},set(k){e.updateAttributes({backColor:k})}}),u=a.computed({get(){return e.node.attrs.backColorDark},set(k){e.updateAttributes({backColorDark:k})}}),p=a.computed({get(){return e.node.attrs.borderColor},set(k){e.updateAttributes({borderColor:k})}}),f=a.computed({get(){return e.node.attrs.borderColorDark},set(k){e.updateAttributes({borderColorDark:k})}}),h=a.computed(()=>n.value==="dark"?u.value:d.value),m=a.computed(()=>n.value==="dark"?f.value:p.value);function g(k){e.updateAttributes({icon:k})}function b(k){switch(r.value=!1,k.value){case"palette":w(!0);break}}function y(k){r.value=!0,s.value=k}function w(k){i.value=k}function _(k,S){var C;switch(k){case"backColor":d.value=S;break;case"foreColor":p.value=S;break;case"icon":g(S.emoji),(C=l.value)==null||C.setShow(!1);break}}return a.watch(c,k=>{w(k)}),(k,S)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:a.withModifiers(y,["prevent"])}),{default:a.withCtx(()=>[a.createElementVNode("div",k1,[a.createVNode(a.unref(Pe),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!a.unref(o)},{trigger:a.withCtx(()=>[a.createElementVNode("div",w1,a.toDisplayString(k.node.attrs.icon),1)]),default:a.withCtx(()=>[a.createVNode(a.unref(Ns),{items:a.unref(Ar.emojiGroups),onSelect:S[0]||(S[0]=C=>_("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),a.createElementVNode("div",E1,[a.createVNode(a.unref(An))]),a.unref(o)?(a.openBlock(),a.createBlock(a.unref(ci),{key:0,modelValue:r.value,"onUpdate:modelValue":S[1]||(S[1]=C=>r.value=C),event:s.value},{default:a.withCtx(()=>[a.createVNode(a.unref(yo),a.mergeProps(e,{onAction:b}),null,16)]),_:1},8,["modelValue","event"])):a.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),rg=y1.extend({addNodeView(){return dn(_1)}});function C1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ig(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],o=typeof n;(o==="object"||o==="function")&&!Object.isFrozen(n)&&ig(n)}),t}class sg{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function ag(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Co(t,...e){const n=Object.create(null);for(const o in t)n[o]=t[o];return e.forEach(function(o){for(const r in o)n[r]=o[r]}),n}const S1="</span>",lg=t=>!!t.scope,x1=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((o,r)=>`${o}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`};class N1{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=ag(e)}openNode(e){if(!lg(e))return;const n=x1(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){lg(e)&&(this.buffer+=S1)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const cg=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class od{constructor(){this.rootNode=cg(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=cg({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(o=>this._walk(e,o)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{od._collapse(n)}))}}class T1 extends od{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const o=e.root;n&&(o.scope=`language:${n}`),this.add(o)}toHTML(){return new N1(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Ci(t){return t?typeof t=="string"?t:t.source:null}function dg(t){return Go("(?=",t,")")}function O1(t){return Go("(?:",t,")*")}function M1(t){return Go("(?:",t,")?")}function Go(...t){return t.map(n=>Ci(n)).join("")}function A1(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function rd(...t){return"("+(A1(t).capture?"":"?:")+t.map(o=>Ci(o)).join("|")+")"}function ug(t){return new RegExp(t.toString()+"|").exec("").length-1}function v1(t,e){const n=t&&t.exec(e);return n&&n.index===0}const R1=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function id(t,{joinWith:e}){let n=0;return t.map(o=>{n+=1;const r=n;let i=Ci(o),s="";for(;i.length>0;){const l=R1.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+r):(s+=l[0],l[0]==="("&&n++)}return s}).map(o=>`(${o})`).join(e)}const B1=/\b\B/,pg="[a-zA-Z]\\w*",sd="[a-zA-Z_]\\w*",fg="\\b\\d+(\\.\\d+)?",hg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",mg="\\b(0b[01]+)",D1="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",I1=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=Go(e,/.*\b/,t.binary,/\b.*/)),Co({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,o)=>{n.index!==0&&o.ignoreMatch()}},t)},Si={begin:"\\\\[\\s\\S]",relevance:0},L1={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Si]},P1={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Si]},$1={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ha=function(t,e,n={}){const o=Co({scope:"comment",begin:t,end:e,contains:[]},n);o.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const r=rd("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return o.contains.push({begin:Go(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),o},F1=ha("//","$"),V1=ha("/\\*","\\*/"),z1=ha("#","$"),H1={scope:"number",begin:fg,relevance:0},U1={scope:"number",begin:hg,relevance:0},q1={scope:"number",begin:mg,relevance:0},K1={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Si,{begin:/\[/,end:/\]/,relevance:0,contains:[Si]}]},W1={scope:"title",begin:pg,relevance:0},j1={scope:"title",begin:sd,relevance:0},G1={begin:"\\.\\s*"+sd,relevance:0};var ma=Object.freeze({__proto__:null,APOS_STRING_MODE:L1,BACKSLASH_ESCAPE:Si,BINARY_NUMBER_MODE:q1,BINARY_NUMBER_RE:mg,COMMENT:ha,C_BLOCK_COMMENT_MODE:V1,C_LINE_COMMENT_MODE:F1,C_NUMBER_MODE:U1,C_NUMBER_RE:hg,END_SAME_AS_BEGIN:function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:z1,IDENT_RE:pg,MATCH_NOTHING_RE:B1,METHOD_GUARD:G1,NUMBER_MODE:H1,NUMBER_RE:fg,PHRASAL_WORDS_MODE:$1,QUOTE_STRING_MODE:P1,REGEXP_MODE:K1,RE_STARTERS_RE:D1,SHEBANG:I1,TITLE_MODE:W1,UNDERSCORE_IDENT_RE:sd,UNDERSCORE_TITLE_MODE:j1});function Y1(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function J1(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function X1(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Y1,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function Z1(t,e){Array.isArray(t.illegal)&&(t.illegal=rd(...t.illegal))}function Q1(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function eO(t,e){t.relevance===void 0&&(t.relevance=1)}const tO=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(o=>{delete t[o]}),t.keywords=n.keywords,t.begin=Go(n.beforeMatch,dg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},nO=["of","and","for","in","not","or","if","then","parent","list","value"],oO="keyword";function gg(t,e,n=oO){const o=Object.create(null);return typeof t=="string"?r(n,t.split(" ")):Array.isArray(t)?r(n,t):Object.keys(t).forEach(function(i){Object.assign(o,gg(t[i],e,i))}),o;function r(i,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){const c=l.split("|");o[c[0]]=[i,rO(c[0],c[1])]})}}function rO(t,e){return e?Number(e):iO(t)?0:1}function iO(t){return nO.includes(t.toLowerCase())}const bg={},Yo=t=>{console.error(t)},yg=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Nr=(t,e)=>{bg[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),bg[`${t}/${e}`]=!0)},ga=new Error;function kg(t,e,{key:n}){let o=0;const r=t[n],i={},s={};for(let l=1;l<=e.length;l++)s[l+o]=r[l],i[l+o]=!0,o+=ug(e[l-1]);t[n]=s,t[n]._emit=i,t[n]._multi=!0}function sO(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Yo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ga;if(typeof t.beginScope!="object"||t.beginScope===null)throw Yo("beginScope must be object"),ga;kg(t,t.begin,{key:"beginScope"}),t.begin=id(t.begin,{joinWith:""})}}function aO(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Yo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ga;if(typeof t.endScope!="object"||t.endScope===null)throw Yo("endScope must be object"),ga;kg(t,t.end,{key:"endScope"}),t.end=id(t.end,{joinWith:""})}}function lO(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function cO(t){lO(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),sO(t),aO(t)}function dO(t){function e(s,l){return new RegExp(Ci(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=ug(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=e(id(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const d=c.findIndex((p,f)=>f>0&&p!==void 0),u=this.matchIndexes[d];return c.splice(0,d),Object.assign(c,u)}}class o{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([d,u])=>c.addRule(d,u)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let d=c.exec(l);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,d=u.exec(l)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function r(s){const l=new o;return s.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){const c=s;if(s.isCompiled)return c;[J1,Q1,cO,tO].forEach(u=>u(s,l)),t.compilerExtensions.forEach(u=>u(s,l)),s.__beforeBegin=null,[X1,Z1,eO].forEach(u=>u(s,l)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=gg(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(d,!0),l&&(s.begin||(s.begin=/\B|\b/),c.beginRe=e(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=e(c.end)),c.terminatorEnd=Ci(c.end)||"",s.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(c.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return uO(u==="self"?s:u)})),s.contains.forEach(function(u){i(u,c)}),s.starts&&i(s.starts,l),c.matcher=r(c),c}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Co(t.classNameAliases||{}),i(t)}function wg(t){return t?t.endsWithParent||wg(t.starts):!1}function uO(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Co(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:wg(t)?Co(t,{starts:t.starts?Co(t.starts):null}):Object.isFrozen(t)?Co(t):t}var pO="11.10.0";class fO extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const ad=ag,Eg=Co,_g=Symbol("nomatch"),hO=7,Cg=function(t){const e=Object.create(null),n=Object.create(null),o=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:T1};function c(x){return l.noHighlightRe.test(x)}function d(x){let M=x.className+" ";M+=x.parentNode?x.parentNode.className:"";const F=l.languageDetectRe.exec(M);if(F){const X=T(F[1]);return X||(yg(i.replace("{}",F[1])),yg("Falling back to no-highlight mode for this block.",x)),X?F[1]:"no-highlight"}return M.split(/\s+/).find(X=>c(X)||T(X))}function u(x,M,F){let X="",ee="";typeof M=="object"?(X=x,F=M.ignoreIllegals,ee=M.language):(Nr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Nr("10.7.0",`Please use highlight(code, options) instead.
182
+ https://github.com/highlightjs/highlight.js/issues/2277`),ee=x,X=M),F===void 0&&(F=!0);const de={code:X,language:ee};K("before:highlight",de);const xe=de.result?de.result:p(de.language,de.code,F);return xe.code=de.code,K("after:highlight",xe),xe}function p(x,M,F,X){const ee=Object.create(null);function de(L,W){return L.keywords[W]}function xe(){if(!ae.keywords){He.addText(ve);return}let L=0;ae.keywordPatternRe.lastIndex=0;let W=ae.keywordPatternRe.exec(ve),he="";for(;W;){he+=ve.substring(L,W.index);const Re=fe.case_insensitive?W[0].toLowerCase():W[0],st=de(ae,Re);if(st){const[Qt,Ni]=st;if(He.addText(he),he="",ee[Re]=(ee[Re]||0)+1,ee[Re]<=hO&&(It+=Ni),Qt.startsWith("_"))he+=W[0];else{const N=fe.classNameAliases[Qt]||Qt;Z(W[0],N)}}else he+=W[0];L=ae.keywordPatternRe.lastIndex,W=ae.keywordPatternRe.exec(ve)}he+=ve.substring(L),He.addText(he)}function it(){if(ve==="")return;let L=null;if(typeof ae.subLanguage=="string"){if(!e[ae.subLanguage]){He.addText(ve);return}L=p(ae.subLanguage,ve,!0,Dt[ae.subLanguage]),Dt[ae.subLanguage]=L._top}else L=h(ve,ae.subLanguage.length?ae.subLanguage:null);ae.relevance>0&&(It+=L.relevance),He.__addSublanguage(L._emitter,L.language)}function Be(){ae.subLanguage!=null?it():xe(),ve=""}function Z(L,W){L!==""&&(He.startScope(W),He.addText(L),He.endScope())}function we(L,W){let he=1;const Re=W.length-1;for(;he<=Re;){if(!L._emit[he]){he++;continue}const st=fe.classNameAliases[L[he]]||L[he],Qt=W[he];st?Z(Qt,st):(ve=Qt,xe(),ve=""),he++}}function Ee(L,W){return L.scope&&typeof L.scope=="string"&&He.openNode(fe.classNameAliases[L.scope]||L.scope),L.beginScope&&(L.beginScope._wrap?(Z(ve,fe.classNameAliases[L.beginScope._wrap]||L.beginScope._wrap),ve=""):L.beginScope._multi&&(we(L.beginScope,W),ve="")),ae=Object.create(L,{parent:{value:ae}}),ae}function et(L,W,he){let Re=v1(L.endRe,he);if(Re){if(L["on:end"]){const st=new sg(L);L["on:end"](W,st),st.isMatchIgnored&&(Re=!1)}if(Re){for(;L.endsParent&&L.parent;)L=L.parent;return L}}if(L.endsWithParent)return et(L.parent,W,he)}function nt(L){return ae.matcher.regexIndex===0?(ve+=L[0],1):(Lt=!0,0)}function fn(L){const W=L[0],he=L.rule,Re=new sg(he),st=[he.__beforeBegin,he["on:begin"]];for(const Qt of st)if(Qt&&(Qt(L,Re),Re.isMatchIgnored))return nt(W);return he.skip?ve+=W:(he.excludeBegin&&(ve+=W),Be(),!he.returnBegin&&!he.excludeBegin&&(ve=W)),Ee(he,L),he.returnBegin?0:W.length}function Pn(L){const W=L[0],he=M.substring(L.index),Re=et(ae,L,he);if(!Re)return _g;const st=ae;ae.endScope&&ae.endScope._wrap?(Be(),Z(W,ae.endScope._wrap)):ae.endScope&&ae.endScope._multi?(Be(),we(ae.endScope,L)):st.skip?ve+=W:(st.returnEnd||st.excludeEnd||(ve+=W),Be(),st.excludeEnd&&(ve=W));do ae.scope&&He.closeNode(),!ae.skip&&!ae.subLanguage&&(It+=ae.relevance),ae=ae.parent;while(ae!==Re.parent);return Re.starts&&Ee(Re.starts,L),st.returnEnd?0:W.length}function kn(){const L=[];for(let W=ae;W!==fe;W=W.parent)W.scope&&L.unshift(W.scope);L.forEach(W=>He.openNode(W))}let Zt={};function wn(L,W){const he=W&&W[0];if(ve+=L,he==null)return Be(),0;if(Zt.type==="begin"&&W.type==="end"&&Zt.index===W.index&&he===""){if(ve+=M.slice(W.index,W.index+1),!r){const Re=new Error(`0 width match regex (${x})`);throw Re.languageName=x,Re.badRule=Zt.rule,Re}return 1}if(Zt=W,W.type==="begin")return fn(W);if(W.type==="illegal"&&!F){const Re=new Error('Illegal lexeme "'+he+'" for mode "'+(ae.scope||"<unnamed>")+'"');throw Re.mode=ae,Re}else if(W.type==="end"){const Re=Pn(W);if(Re!==_g)return Re}if(W.type==="illegal"&&he==="")return 1;if(En>1e5&&En>W.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ve+=he,he.length}const fe=T(x);if(!fe)throw Yo(i.replace("{}",x)),new Error('Unknown language: "'+x+'"');const Ut=dO(fe);let Tt="",ae=X||Ut;const Dt={},He=new l.__emitter(l);kn();let ve="",It=0,ot=0,En=0,Lt=!1;try{if(fe.__emitTokens)fe.__emitTokens(M,He);else{for(ae.matcher.considerAll();;){En++,Lt?Lt=!1:ae.matcher.considerAll(),ae.matcher.lastIndex=ot;const L=ae.matcher.exec(M);if(!L)break;const W=M.substring(ot,L.index),he=wn(W,L);ot=L.index+he}wn(M.substring(ot))}return He.finalize(),Tt=He.toHTML(),{language:x,value:Tt,relevance:It,illegal:!1,_emitter:He,_top:ae}}catch(L){if(L.message&&L.message.includes("Illegal"))return{language:x,value:ad(M),illegal:!0,relevance:0,_illegalBy:{message:L.message,index:ot,context:M.slice(ot-100,ot+100),mode:L.mode,resultSoFar:Tt},_emitter:He};if(r)return{language:x,value:ad(M),illegal:!1,relevance:0,errorRaised:L,_emitter:He,_top:ae};throw L}}function f(x){const M={value:ad(x),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return M._emitter.addText(x),M}function h(x,M){M=M||l.languages||Object.keys(e);const F=f(x),X=M.filter(T).filter(H).map(Be=>p(Be,x,!1));X.unshift(F);const ee=X.sort((Be,Z)=>{if(Be.relevance!==Z.relevance)return Z.relevance-Be.relevance;if(Be.language&&Z.language){if(T(Be.language).supersetOf===Z.language)return 1;if(T(Z.language).supersetOf===Be.language)return-1}return 0}),[de,xe]=ee,it=de;return it.secondBest=xe,it}function m(x,M,F){const X=M&&n[M]||F;x.classList.add("hljs"),x.classList.add(`language-${X}`)}function g(x){let M=null;const F=d(x);if(c(F))return;if(K("before:highlightElement",{el:x,language:F}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),l.throwUnescapedHTML))throw new fO("One of your code blocks includes unescaped HTML.",x.innerHTML);M=x;const X=M.textContent,ee=F?u(X,{language:F,ignoreIllegals:!0}):h(X);x.innerHTML=ee.value,x.dataset.highlighted="yes",m(x,F,ee.language),x.result={language:ee.language,re:ee.relevance,relevance:ee.relevance},ee.secondBest&&(x.secondBest={language:ee.secondBest.language,relevance:ee.secondBest.relevance}),K("after:highlightElement",{el:x,result:ee,text:X})}function b(x){l=Eg(l,x)}const y=()=>{k(),Nr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){k(),Nr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function k(){if(document.readyState==="loading"){_=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function S(){_&&k()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",S,!1);function C(x,M){let F=null;try{F=M(t)}catch(X){if(Yo("Language definition for '{}' could not be registered.".replace("{}",x)),r)Yo(X);else throw X;F=s}F.name||(F.name=x),e[x]=F,F.rawDefinition=M.bind(null,t),F.aliases&&v(F.aliases,{languageName:x})}function R(x){delete e[x];for(const M of Object.keys(n))n[M]===x&&delete n[M]}function B(){return Object.keys(e)}function T(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function v(x,{languageName:M}){typeof x=="string"&&(x=[x]),x.forEach(F=>{n[F.toLowerCase()]=M})}function H(x){const M=T(x);return M&&!M.disableAutodetect}function Y(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=M=>{x["before:highlightBlock"](Object.assign({block:M.el},M))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=M=>{x["after:highlightBlock"](Object.assign({block:M.el},M))})}function $(x){Y(x),o.push(x)}function q(x){const M=o.indexOf(x);M!==-1&&o.splice(M,1)}function K(x,M){const F=x;o.forEach(function(X){X[F]&&X[F](M)})}function oe(x){return Nr("10.7.0","highlightBlock will be removed entirely in v12.0"),Nr("10.7.0","Please use highlightElement now."),g(x)}Object.assign(t,{highlight:u,highlightAuto:h,highlightAll:k,highlightElement:g,highlightBlock:oe,configure:b,initHighlighting:y,initHighlightingOnLoad:w,registerLanguage:C,unregisterLanguage:R,listLanguages:B,getLanguage:T,registerAliases:v,autoDetection:H,inherit:Eg,addPlugin:$,removePlugin:q}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=pO,t.regex={concat:Go,lookahead:dg,either:rd,optional:M1,anyNumberOfTimes:O1};for(const x in ma)typeof ma[x]=="object"&&ig(ma[x]);return Object.assign(t,ma),t},Tr=Cg({});Tr.newInstance=()=>Cg({});var mO=Tr;Tr.HighlightJS=Tr,Tr.default=Tr;var gO=C1(mO);function Sg(t,e=[]){return t.map(n=>{const o=[...e,...n.properties?n.properties.className:[]];return n.children?Sg(n.children,o):{text:n.value,classes:o}}).flat()}function xg(t){return t.value||t.children||[]}function bO(t){return!!gO.getLanguage(t)}function Ng({doc:t,name:e,lowlight:n,defaultLanguage:o}){const r=[];return Dl(t,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const c=i.node.attrs.language||o,d=n.listLanguages(),u=c&&(d.includes(c)||bO(c)||!((s=n.registered)===null||s===void 0)&&s.call(n,c))?xg(n.highlight(c,i.node.textContent)):xg(n.highlightAuto(i.node.textContent));Sg(u).forEach(p=>{const f=l+p.text.length;if(p.classes.length){const h=Ye.inline(l,f,{class:p.classes.join(" ")});r.push(h)}l=f})}),Oe.create(t,r)}function yO(t){return typeof t=="function"}function kO({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(r=>yO(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new Ae({key:new Ne("lowlight"),state:{init:(r,{doc:i})=>Ng({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(r,i,s,l)=>{const c=s.selection.$head.parent.type.name,d=l.selection.$head.parent.type.name,u=Dl(s.doc,f=>f.type.name===t),p=Dl(l.doc,f=>f.type.name===t);return r.docChanged&&([c,d].includes(t)||p.length!==u.length||r.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?Ng({doc:r.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}const wO=uh.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],kO({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function EO(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[S,p,l,n,t.C_BLOCK_COMMENT_MODE,u,d],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:C.concat([{begin:/\(/,end:/\)/,keywords:k,contains:C.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:k,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,l,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,S,C,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function _O(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=EO(t),o=n.keywords;return o.type=[...o.type,...e.type],o.literal=[...o.literal,...e.literal],o.built_in=[...o.built_in,...e.built_in],o._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function CO(t){const e=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,r]};r.contains.push(l);const c={match:/\\"/},d={className:"string",begin:/'/,end:/'/},u={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],b=["true","false"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:b,built_in:[...w,..._,"set","shopt",...k,...S]},contains:[h,t.SHEBANG(),m,p,i,s,y,l,c,d,u,n]}}function SO(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+t.IDENT_RE+"\\s*\\(",b={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[p,l,n,t.C_BLOCK_COMMENT_MODE,u,d],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:y.concat([{begin:/\(/,end:/\)/,keywords:b,contains:y.concat(["self"]),relevance:0}]),relevance:0},_={begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,l,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(w,_,y,[p,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:p,strings:d,keywords:b}}}function xO(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",s="(?!struct)("+o+"|"+e.optional(r)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(r)+t.IDENT_RE,relevance:0},h=e.optional(r)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[S,p,l,n,t.C_BLOCK_COMMENT_MODE,u,d],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:C.concat([{begin:/\(/,end:/\)/,keywords:k,contains:C.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:k,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,u,l,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,u,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,B,S,C,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function NO(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],o=["default","false","null","true"],r=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:r.concat(i),built_in:e,literal:o},l=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=t.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},h=t.inherit(f,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,h]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});f.contains=[g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],h.contains=[b,m,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[d,g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},_=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",k={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+_+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[y,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},k]}}const TO=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),OO=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],MO=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],AO=[...OO,...MO],vO=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),RO=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),BO=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),DO=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function IO(t){const e=t.regex,n=TO(t),o={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",l=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,o,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+RO.join("|")+")"},{begin:":(:)?("+BO.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+DO.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:vO.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+AO.join("|")+")\\b"}]}}function LO(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function PO(t){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,illegal:/["']/}]}]}}function $O(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function FO(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const r={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},l={begin:/\[/,end:/\]/,contains:[o,i,r,s,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,d=/"(\\"|[^"])*"/,u=/'[^']*'/,p=e.either(c,d,u),f=e.concat(p,"(\\s*\\.\\s*",p,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[o,l,i,r,s,n]}}]}}var Or="[0-9](_*[0-9])*",ba=`\\.(${Or})`,ya="[0-9a-fA-F](_*[0-9a-fA-F])*",Tg={className:"number",variants:[{begin:`(\\b(${Or})((${ba})|\\.)?|(${ba}))[eE][+-]?(${Or})[fFdD]?\\b`},{begin:`\\b(${Or})((${ba})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ba})[fFdD]?\\b`},{begin:`\\b(${Or})[fFdD]\\b`},{begin:`\\b0[xX]((${ya})\\.?|(${ya})?\\.(${ya}))[pP][+-]?(${Or})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ya})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Og(t,e,n){return n===-1?"":t.replace(e,o=>Og(t,e,n-1))}function VO(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",o=n+Og("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+o+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Tg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Tg,d]}}const Mg="[A-Za-z$_][0-9A-Za-z$_]*",zO=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],HO=["true","false","null","undefined","NaN","Infinity"],Ag=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],vg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Rg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],UO=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qO=[].concat(Rg,Ag,vg);function KO(t){const e=t.regex,n=(M,{after:F})=>{const X="</"+M[0].slice(1);return M.input.indexOf(X,F)!==-1},o=Mg,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,F)=>{const X=M[0].length+M.index,ee=M.input[X];if(ee==="<"||ee===","){F.ignoreMatch();return}ee===">"&&(n(M,{after:X})||F.ignoreMatch());let de;const xe=M.input.substring(X);if(de=xe.match(/^\s*=/)){F.ignoreMatch();return}if((de=xe.match(/^\s+extends\s+/))&&de.index===0){F.ignoreMatch();return}}},l={$pattern:Mg,keyword:zO,literal:HO,built_in:qO,"variable.language":UO},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},_=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=_.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(_)});const k=[].concat(w,f.contains),S=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(k)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},R={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},B={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ag,...vg]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},v={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(M){return e.concat("(?!",M.join("|"),")")}const $={match:e.concat(/\b/,Y([...Rg,"super","import"].map(M=>`${M}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},K={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},oe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(oe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,w,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},x,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:oe,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},v,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},$,H,R,K,{match:/\$[(.]/}]}}function WO(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},o=["true","false","null"],r={scope:"literal",beginKeywords:o.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:o},contains:[e,n,t.QUOTE_STRING_MODE,r,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Mr="[0-9](_*[0-9])*",ka=`\\.(${Mr})`,wa="[0-9a-fA-F](_*[0-9a-fA-F])*",jO={className:"number",variants:[{begin:`(\\b(${Mr})((${ka})|\\.)?|(${ka}))[eE][+-]?(${Mr})[fFdD]?\\b`},{begin:`\\b(${Mr})((${ka})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ka})[fFdD]?\\b`},{begin:`\\b(${Mr})[fFdD]\\b`},{begin:`\\b0[xX]((${wa})\\.?|(${wa})?\\.(${wa}))[pP][+-]?(${Mr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${wa})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function GO(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},o={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,r]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,r]}]};r.contains.push(s);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},d=jO,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=p;return f.variants[1].contains=[p],p.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,n,o,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[p,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,l,c,s,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
183
+ `},d]}}const YO=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),JO=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],XO=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],ZO=[...JO,...XO],QO=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Bg=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Dg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),eM=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),tM=Bg.concat(Dg).sort().reverse();function nM(t){const e=YO(t),n=tM,o="and or not only",r="[\\w-]+",i="("+r+"|@\\{"+r+"\\})",s=[],l=[],c=function(_){return{className:"string",begin:"~?"+_+".*?"+_}},d=function(_,k,S){return{className:_,begin:k,relevance:S}},u={$pattern:/[a-z-]+/,keyword:o,attribute:QO.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:u,relevance:0};l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,p,d("variable","@@?"+r,10),d("variable","@\\{"+r+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=l.concat({begin:/\{/,end:/\}/,contains:s}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+eM.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:l,relevance:0}},b={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,d("keyword","all\\b"),d("variable","@\\{"+r+"\\}"),{begin:"\\b("+ZO.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,d("selector-tag",i,0),d("selector-id","#"+i),d("selector-class","\\."+i,0),d("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Bg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Dg.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,w,m,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function oM(t){const e="\\[=*\\[",n="\\]=*\\]",o={begin:e,end:n,contains:["self"]},r=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[o],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:r.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:r}].concat(r)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[o],relevance:5}])}}function rM(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},o={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},r={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},s={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,o,r,i,s]}}function iM(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=t.inherit(d,{contains:[]}),f=t.inherit(u,{contains:[]});d.contains.push(f),u.contains.push(p);let h=[n,c];return[d,u,p,f].forEach(y=>{y.contains=y.contains.concat(h)}),h=h.concat(d,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,i,d,u,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},r,o,c,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function sM(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function aM(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],o=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},s={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},d={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,i,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const w=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,o)},h=(g,b,y)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,o),m=[c,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...p,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",e.either(...p,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,l,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:m}}function lM(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+o},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(q,K)=>{K.data._beginMatch=q[1]||q[2]},"on:end":(q,K)=>{K.data._beginMatch!==q[1]&&K.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[
184
+ ]`,m={scope:"string",variants:[u,d,p,f]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],k={keyword:y,literal:(q=>{const K=[];return q.forEach(oe=>{K.push(oe),oe.toLowerCase()===oe?K.push(oe.toUpperCase()):K.push(oe.toLowerCase())}),K})(b),built_in:w},S=q=>q.map(K=>K.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,e.concat(h,"+"),e.concat("(?!",S(w).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},R=e.concat(o,"\\b(?!\\()"),B={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),R],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,e.concat(/::/,e.lookahead(/(?!class\b)/)),R],scope:{1:"title.class",3:"variable.constant"}},{match:[r,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:e.concat(o,e.lookahead(":"),e.lookahead(/(?!::)/))},v={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[T,s,B,t.C_BLOCK_COMMENT_MODE,m,g,C]},H={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(w).join("\\b|"),"\\b)"),o,e.concat(h,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[v]};v.contains.push(H);const Y=[T,B,t.C_BLOCK_COMMENT_MODE,m,g,C],$={begin:e.concat(/#\[\s*\\?/,e.either(r,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...Y]},...Y,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:k,contains:[$,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},s,H,B,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},C,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",$,s,B,t.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},m,g]}}function cM(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function dM(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function uM(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},u={begin:/\{\{/,relevance:0},p={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${o.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,g,p,t.HASH_COMMENT_MODE]}]};return d.contains=[p,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,p]}]}}function pM(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function fM(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,o=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[r,o]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,o]},{scope:{1:"punctuation",2:"number"},match:[i,o]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,o]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function hM(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=e.concat(o,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},d=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:s},p={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},C=[p,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:s},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,d),relevance:0}].concat(c,d);u.contains=C,g.contains=C;const v=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:C}}];return d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(v).concat(d).concat(C)}}function mM(t){const e=t.regex,n=/(r#)?/,o=e.concat(n,t.UNDERSCORE_IDENT_RE),r=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:l,literal:c,built_in:d},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},i]}}const gM=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),bM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],yM=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],kM=[...bM,...yM],wM=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),EM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_M=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),CM=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function SM(t){const e=gM(t),n=_M,o=EM,r="@[a-z-]+",i="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+kM.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+o.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+CM.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,l,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:wM.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function xM(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function NM(t){const e=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=u,m=[...d,...c].filter(S=>!u.includes(S)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function w(S){return e.concat(/\b/,e.either(...S.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const _={scope:"keyword",match:w(f),relevance:0};function k(S,{exceptions:C,when:R}={}){const B=R;return C=C||[],S.map(T=>T.match(/\|\d+$/)||C.includes(T)?T:B(T)?`${T}|0`:T)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(m,{when:S=>S.length<3}),literal:i,type:l,built_in:p},contains:[{scope:"type",match:w(s)},_,y,g,o,r,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function Ig(t){return t?typeof t=="string"?t:t.source:null}function xi(t){return ze("(?=",t,")")}function ze(...t){return t.map(n=>Ig(n)).join("")}function TM(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Bt(...t){return"("+(TM(t).capture?"":"?:")+t.map(o=>Ig(o)).join("|")+")"}const ld=t=>ze(/\b/,t,/\w$/.test(t)?/\b/:/\B/),OM=["Protocol","Type"].map(ld),Lg=["init","self"].map(ld),MM=["Any","Self"],cd=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Pg=["false","nil","true"],AM=["assignment","associativity","higherThan","left","lowerThan","none","right"],vM=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],$g=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Fg=Bt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Vg=Bt(Fg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),dd=ze(Fg,Vg,"*"),zg=Bt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Ea=Bt(zg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ln=ze(zg,Ea,"*"),_a=ze(/[A-Z]/,Ea,"*"),RM=["attached","autoclosure",ze(/convention\(/,Bt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ze(/objc\(/,Ln,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],BM=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function DM(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),o=[t.C_LINE_COMMENT_MODE,n],r={match:[/\./,Bt(...OM,...Lg)],className:{2:"keyword"}},i={match:ze(/\./,Bt(...cd)),relevance:0},s=cd.filter(fe=>typeof fe=="string").concat(["_|0"]),l=cd.filter(fe=>typeof fe!="string").concat(MM).map(ld),c={variants:[{className:"keyword",match:Bt(...l,...Lg)}]},d={$pattern:Bt(/\b\w+/,/#\w+/),keyword:s.concat(vM),literal:Pg},u=[r,i,c],p={match:ze(/\./,Bt(...$g)),relevance:0},f={className:"built_in",match:ze(/\b/,Bt(...$g),/(?=\()/)},h=[p,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:dd},{match:`\\.(\\.|${Vg})+`}]},b=[m,g],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",_={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(fe="")=>({className:"subst",variants:[{match:ze(/\\/,fe,/[0\\tnr"']/)},{match:ze(/\\/,fe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(fe="")=>({className:"subst",match:ze(/\\/,fe,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(fe="")=>({className:"subst",label:"interpol",begin:ze(/\\/,fe,/\(/),end:/\)/}),R=(fe="")=>({begin:ze(fe,/"""/),end:ze(/"""/,fe),contains:[k(fe),S(fe),C(fe)]}),B=(fe="")=>({begin:ze(fe,/"/),end:ze(/"/,fe),contains:[k(fe),C(fe)]}),T={className:"string",variants:[R(),R("#"),R("##"),R("###"),B(),B("#"),B("##"),B("###")]},v=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:v},Y=fe=>{const Ut=ze(fe,/\//),Tt=ze(/\//,fe);return{begin:Ut,end:Tt,contains:[...v,{scope:"comment",begin:`#(?!.*${Tt})`,end:/$/}]}},$={scope:"regexp",variants:[Y("###"),Y("##"),Y("#"),H]},q={match:ze(/`/,Ln,/`/)},K={className:"variable",match:/\$\d+/},oe={className:"variable",match:`\\$${Ea}+`},x=[q,K,oe],M={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:BM,contains:[...b,_,T]}]}},F={scope:"keyword",match:ze(/@/,Bt(...RM),xi(Bt(/\(/,/\s+/)))},X={scope:"meta",match:ze(/@/,Ln)},ee=[M,F,X],de={match:xi(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ze(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ea,"+")},{className:"type",match:_a,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ze(/\s+&\s+/,xi(_a)),relevance:0}]},xe={begin:/</,end:/>/,keywords:d,contains:[...o,...u,...ee,m,de]};de.contains.push(xe);const it={match:ze(Ln,/\s*:/),keywords:"_|0",relevance:0},Be={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",it,...o,$,...u,...h,...b,_,T,...x,...ee,de]},Z={begin:/</,end:/>/,keywords:"repeat each",contains:[...o,de]},we={begin:Bt(xi(ze(Ln,/\s*:/)),xi(ze(Ln,/\s+/,Ln,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ln}]},Ee={begin:/\(/,end:/\)/,keywords:d,contains:[we,...o,...u,...b,_,T,...ee,de,Be],endsParent:!0,illegal:/["']/},et={match:[/(func|macro)/,/\s+/,Bt(q.match,Ln,dd)],className:{1:"keyword",3:"title.function"},contains:[Z,Ee,e],illegal:[/\[/,/%/]},nt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Z,Ee,e],illegal:/\[|%/},fn={match:[/operator/,/\s+/,dd],className:{1:"keyword",3:"title"}},Pn={begin:[/precedencegroup/,/\s+/,_a],className:{1:"keyword",3:"title"},contains:[de],keywords:[...AM,...Pg],end:/}/},kn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Zt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},wn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ln,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[Z,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:_a},...u],relevance:0}]};for(const fe of T.variants){const Ut=fe.contains.find(ae=>ae.label==="interpol");Ut.keywords=d;const Tt=[...u,...h,...b,_,T,...x];Ut.contains=[...Tt,{begin:/\(/,end:/\)/,contains:["self",...Tt]}]}return{name:"Swift",keywords:d,contains:[...o,et,nt,kn,Zt,wn,fn,Pn,{beginKeywords:"import",end:/$/,contains:[...o],relevance:0},$,...u,...h,...b,_,T,...x,...ee,de,Be]}}const Ca="[A-Za-z$_][0-9A-Za-z$_]*",Hg=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Ug=["true","false","null","undefined","NaN","Infinity"],qg=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Kg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Wg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jg=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Gg=[].concat(Wg,qg,Kg);function IM(t){const e=t.regex,n=(M,{after:F})=>{const X="</"+M[0].slice(1);return M.input.indexOf(X,F)!==-1},o=Ca,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,F)=>{const X=M[0].length+M.index,ee=M.input[X];if(ee==="<"||ee===","){F.ignoreMatch();return}ee===">"&&(n(M,{after:X})||F.ignoreMatch());let de;const xe=M.input.substring(X);if(de=xe.match(/^\s*=/)){F.ignoreMatch();return}if((de=xe.match(/^\s+extends\s+/))&&de.index===0){F.ignoreMatch();return}}},l={$pattern:Ca,keyword:Hg,literal:Ug,built_in:Gg,"variable.language":jg},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:o+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},_=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,{match:/\$\d+/},p];f.contains=_.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(_)});const k=[].concat(w,f.contains),S=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(k)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},R={variants:[{match:[/class/,/\s+/,o,/\s+/,/extends/,/\s+/,e.concat(o,"(",e.concat(/\./,o),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,o],scope:{1:"keyword",3:"title.class"}}]},B={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...qg,...Kg]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},v={variants:[{match:[/function/,/\s+/,o,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(M){return e.concat("(?!",M.join("|"),")")}const $={match:e.concat(/\b/,Y([...Wg,"super","import"].map(M=>`${M}\\s*\\(`)),o,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:e.concat(/\./,e.lookahead(e.concat(o,/(?![0-9A-Za-z$_(])/))),end:o,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},K={match:[/get|set/,/\s+/,o,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},oe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",x={match:[/const|var|let/,/\s+/,o,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(oe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,m,g,b,w,{match:/\$\d+/},p,B,{scope:"attr",match:o+e.lookahead(":"),relevance:0},x,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:oe,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},v,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,t.inherit(t.TITLE_MODE,{begin:o,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+o,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},$,H,R,K,{match:/\$[(.]/}]}}function LM(t){const e=t.regex,n=IM(t),o=Ca,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Ca,keyword:Hg.concat(c),literal:Ug,built_in:Gg.concat(r),"variable.language":jg},u={className:"meta",begin:"@"+o},p=(g,b,y)=>{const w=g.contains.findIndex(_=>_.label===b);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,y)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(u);const f=n.contains.find(g=>g.scope==="attr"),h=Object.assign({},f,{match:e.concat(o,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,h]),n.contains=n.contains.concat([u,i,s,h]),p(n,"shebang",t.SHEBANG()),p(n,"use_strict",l);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function PM(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:e.concat(/# */,e.either(i,r),/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(i,r),/ +/,e.either(s,l),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},p=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,o,c,d,u,p,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function $M(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:o},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,s,r,t.QUOTE_STRING_MODE,c,d,l]}}function FM(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(i,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,c,l,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,c,l]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function VM(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,r]},l=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},b=[o,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},m,g,i,s],y=[...b];return y.pop(),y.push(l),h.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const zM={arduino:_O,bash:CO,c:SO,cpp:xO,csharp:NO,css:IO,diff:LO,go:PO,graphql:$O,ini:FO,java:VO,javascript:KO,json:WO,kotlin:GO,less:nM,lua:oM,makefile:rM,markdown:iM,objectivec:sM,perl:aM,php:lM,"php-template":cM,plaintext:dM,python:uM,"python-repl":pM,r:fM,ruby:hM,rust:mM,scss:SM,shell:xM,sql:NM,swift:DM,typescript:LM,vbnet:PM,wasm:$M,xml:FM,yaml:VM};function HM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ud,Yg;function UM(){if(Yg)return ud;Yg=1;function t(E){return E instanceof Map?E.clear=E.delete=E.set=function(){throw new Error("map is read-only")}:E instanceof Set&&(E.add=E.clear=E.delete=function(){throw new Error("set is read-only")}),Object.freeze(E),Object.getOwnPropertyNames(E).forEach(O=>{const P=E[O],ue=typeof P;(ue==="object"||ue==="function")&&!Object.isFrozen(P)&&t(P)}),E}class e{constructor(O){O.data===void 0&&(O.data={}),this.data=O.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(E){return E.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(E,...O){const P=Object.create(null);for(const ue in E)P[ue]=E[ue];return O.forEach(function(ue){for(const Ge in ue)P[Ge]=ue[Ge]}),P}const r="</span>",i=E=>!!E.scope,s=(E,{prefix:O})=>{if(E.startsWith("language:"))return E.replace("language:","language-");if(E.includes(".")){const P=E.split(".");return[`${O}${P.shift()}`,...P.map((ue,Ge)=>`${ue}${"_".repeat(Ge+1)}`)].join(" ")}return`${O}${E}`};class l{constructor(O,P){this.buffer="",this.classPrefix=P.classPrefix,O.walk(this)}addText(O){this.buffer+=n(O)}openNode(O){if(!i(O))return;const P=s(O.scope,{prefix:this.classPrefix});this.span(P)}closeNode(O){i(O)&&(this.buffer+=r)}value(){return this.buffer}span(O){this.buffer+=`<span class="${O}">`}}const c=(E={})=>{const O={children:[]};return Object.assign(O,E),O};class d{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(O){this.top.children.push(O)}openNode(O){const P=c({scope:O});this.add(P),this.stack.push(P)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(O){return this.constructor._walk(O,this.rootNode)}static _walk(O,P){return typeof P=="string"?O.addText(P):P.children&&(O.openNode(P),P.children.forEach(ue=>this._walk(O,ue)),O.closeNode(P)),O}static _collapse(O){typeof O!="string"&&O.children&&(O.children.every(P=>typeof P=="string")?O.children=[O.children.join("")]:O.children.forEach(P=>{d._collapse(P)}))}}class u extends d{constructor(O){super(),this.options=O}addText(O){O!==""&&this.add(O)}startScope(O){this.openNode(O)}endScope(){this.closeNode()}__addSublanguage(O,P){const ue=O.root;P&&(ue.scope=`language:${P}`),this.add(ue)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(E){return E?typeof E=="string"?E:E.source:null}function f(E){return g("(?=",E,")")}function h(E){return g("(?:",E,")*")}function m(E){return g("(?:",E,")?")}function g(...E){return E.map(P=>p(P)).join("")}function b(E){const O=E[E.length-1];return typeof O=="object"&&O.constructor===Object?(E.splice(E.length-1,1),O):{}}function y(...E){return"("+(b(E).capture?"":"?:")+E.map(ue=>p(ue)).join("|")+")"}function w(E){return new RegExp(E.toString()+"|").exec("").length-1}function _(E,O){const P=E&&E.exec(O);return P&&P.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function S(E,{joinWith:O}){let P=0;return E.map(ue=>{P+=1;const Ge=P;let qe=p(ue),Q="";for(;qe.length>0;){const j=k.exec(qe);if(!j){Q+=qe;break}Q+=qe.substring(0,j.index),qe=qe.substring(j.index+j[0].length),j[0][0]==="\\"&&j[1]?Q+="\\"+String(Number(j[1])+Ge):(Q+=j[0],j[0]==="("&&P++)}return Q}).map(ue=>`(${ue})`).join(O)}const C=/\b\B/,R="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",T="\\b\\d+(\\.\\d+)?",v="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",H="\\b(0b[01]+)",Y="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(E={})=>{const O=/^#![ ]*\//;return E.binary&&(E.begin=g(O,/.*\b/,E.binary,/\b.*/)),o({scope:"meta",begin:O,end:/$/,relevance:0,"on:begin":(P,ue)=>{P.index!==0&&ue.ignoreMatch()}},E)},q={begin:"\\\\[\\s\\S]",relevance:0},K={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},oe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},x={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},M=function(E,O,P={}){const ue=o({scope:"comment",begin:E,end:O,contains:[]},P);ue.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ge=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ue.contains.push({begin:g(/[ ]+/,"(",Ge,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ue},F=M("//","$"),X=M("/\\*","\\*/"),ee=M("#","$"),de={scope:"number",begin:T,relevance:0},xe={scope:"number",begin:v,relevance:0},it={scope:"number",begin:H,relevance:0},Be={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},Z={scope:"title",begin:R,relevance:0},we={scope:"title",begin:B,relevance:0},Ee={begin:"\\.\\s*"+B,relevance:0};var nt=Object.freeze({__proto__:null,APOS_STRING_MODE:K,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:it,BINARY_NUMBER_RE:H,COMMENT:M,C_BLOCK_COMMENT_MODE:X,C_LINE_COMMENT_MODE:F,C_NUMBER_MODE:xe,C_NUMBER_RE:v,END_SAME_AS_BEGIN:function(E){return Object.assign(E,{"on:begin":(O,P)=>{P.data._beginMatch=O[1]},"on:end":(O,P)=>{P.data._beginMatch!==O[1]&&P.ignoreMatch()}})},HASH_COMMENT_MODE:ee,IDENT_RE:R,MATCH_NOTHING_RE:C,METHOD_GUARD:Ee,NUMBER_MODE:de,NUMBER_RE:T,PHRASAL_WORDS_MODE:x,QUOTE_STRING_MODE:oe,REGEXP_MODE:Be,RE_STARTERS_RE:Y,SHEBANG:$,TITLE_MODE:Z,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:we});function fn(E,O){E.input[E.index-1]==="."&&O.ignoreMatch()}function Pn(E,O){E.className!==void 0&&(E.scope=E.className,delete E.className)}function kn(E,O){O&&E.beginKeywords&&(E.begin="\\b("+E.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",E.__beforeBegin=fn,E.keywords=E.keywords||E.beginKeywords,delete E.beginKeywords,E.relevance===void 0&&(E.relevance=0))}function Zt(E,O){Array.isArray(E.illegal)&&(E.illegal=y(...E.illegal))}function wn(E,O){if(E.match){if(E.begin||E.end)throw new Error("begin & end are not supported with match");E.begin=E.match,delete E.match}}function fe(E,O){E.relevance===void 0&&(E.relevance=1)}const Ut=(E,O)=>{if(!E.beforeMatch)return;if(E.starts)throw new Error("beforeMatch cannot be used with starts");const P=Object.assign({},E);Object.keys(E).forEach(ue=>{delete E[ue]}),E.keywords=P.keywords,E.begin=g(P.beforeMatch,f(P.begin)),E.starts={relevance:0,contains:[Object.assign(P,{endsParent:!0})]},E.relevance=0,delete P.beforeMatch},Tt=["of","and","for","in","not","or","if","then","parent","list","value"],ae="keyword";function Dt(E,O,P=ae){const ue=Object.create(null);return typeof E=="string"?Ge(P,E.split(" ")):Array.isArray(E)?Ge(P,E):Object.keys(E).forEach(function(qe){Object.assign(ue,Dt(E[qe],O,qe))}),ue;function Ge(qe,Q){O&&(Q=Q.map(j=>j.toLowerCase())),Q.forEach(function(j){const pe=j.split("|");ue[pe[0]]=[qe,He(pe[0],pe[1])]})}}function He(E,O){return O?Number(O):ve(E)?0:1}function ve(E){return Tt.includes(E.toLowerCase())}const It={},ot=E=>{console.error(E)},En=(E,...O)=>{console.log(`WARN: ${E}`,...O)},Lt=(E,O)=>{It[`${E}/${O}`]||(console.log(`Deprecated as of ${E}. ${O}`),It[`${E}/${O}`]=!0)},L=new Error;function W(E,O,{key:P}){let ue=0;const Ge=E[P],qe={},Q={};for(let j=1;j<=O.length;j++)Q[j+ue]=Ge[j],qe[j+ue]=!0,ue+=w(O[j-1]);E[P]=Q,E[P]._emit=qe,E[P]._multi=!0}function he(E){if(Array.isArray(E.begin)){if(E.skip||E.excludeBegin||E.returnBegin)throw ot("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),L;if(typeof E.beginScope!="object"||E.beginScope===null)throw ot("beginScope must be object"),L;W(E,E.begin,{key:"beginScope"}),E.begin=S(E.begin,{joinWith:""})}}function Re(E){if(Array.isArray(E.end)){if(E.skip||E.excludeEnd||E.returnEnd)throw ot("skip, excludeEnd, returnEnd not compatible with endScope: {}"),L;if(typeof E.endScope!="object"||E.endScope===null)throw ot("endScope must be object"),L;W(E,E.end,{key:"endScope"}),E.end=S(E.end,{joinWith:""})}}function st(E){E.scope&&typeof E.scope=="object"&&E.scope!==null&&(E.beginScope=E.scope,delete E.scope)}function Qt(E){st(E),typeof E.beginScope=="string"&&(E.beginScope={_wrap:E.beginScope}),typeof E.endScope=="string"&&(E.endScope={_wrap:E.endScope}),he(E),Re(E)}function Ni(E){function O(Q,j){return new RegExp(p(Q),"m"+(E.case_insensitive?"i":"")+(E.unicodeRegex?"u":"")+(j?"g":""))}class P{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(j,pe){pe.position=this.position++,this.matchIndexes[this.matchAt]=pe,this.regexes.push([pe,j]),this.matchAt+=w(j)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const j=this.regexes.map(pe=>pe[1]);this.matcherRe=O(S(j,{joinWith:"|"}),!0),this.lastIndex=0}exec(j){this.matcherRe.lastIndex=this.lastIndex;const pe=this.matcherRe.exec(j);if(!pe)return null;const gt=pe.findIndex((Oi,md)=>md>0&&Oi!==void 0),at=this.matchIndexes[gt];return pe.splice(0,gt),Object.assign(pe,at)}}class ue{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(j){if(this.multiRegexes[j])return this.multiRegexes[j];const pe=new P;return this.rules.slice(j).forEach(([gt,at])=>pe.addRule(gt,at)),pe.compile(),this.multiRegexes[j]=pe,pe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(j,pe){this.rules.push([j,pe]),pe.type==="begin"&&this.count++}exec(j){const pe=this.getMatcher(this.regexIndex);pe.lastIndex=this.lastIndex;let gt=pe.exec(j);if(this.resumingScanAtSamePosition()&&!(gt&&gt.index===this.lastIndex)){const at=this.getMatcher(0);at.lastIndex=this.lastIndex+1,gt=at.exec(j)}return gt&&(this.regexIndex+=gt.position+1,this.regexIndex===this.count&&this.considerAll()),gt}}function Ge(Q){const j=new ue;return Q.contains.forEach(pe=>j.addRule(pe.begin,{rule:pe,type:"begin"})),Q.terminatorEnd&&j.addRule(Q.terminatorEnd,{type:"end"}),Q.illegal&&j.addRule(Q.illegal,{type:"illegal"}),j}function qe(Q,j){const pe=Q;if(Q.isCompiled)return pe;[Pn,wn,Qt,Ut].forEach(at=>at(Q,j)),E.compilerExtensions.forEach(at=>at(Q,j)),Q.__beforeBegin=null,[kn,Zt,fe].forEach(at=>at(Q,j)),Q.isCompiled=!0;let gt=null;return typeof Q.keywords=="object"&&Q.keywords.$pattern&&(Q.keywords=Object.assign({},Q.keywords),gt=Q.keywords.$pattern,delete Q.keywords.$pattern),gt=gt||/\w+/,Q.keywords&&(Q.keywords=Dt(Q.keywords,E.case_insensitive)),pe.keywordPatternRe=O(gt,!0),j&&(Q.begin||(Q.begin=/\B|\b/),pe.beginRe=O(pe.begin),!Q.end&&!Q.endsWithParent&&(Q.end=/\B|\b/),Q.end&&(pe.endRe=O(pe.end)),pe.terminatorEnd=p(pe.end)||"",Q.endsWithParent&&j.terminatorEnd&&(pe.terminatorEnd+=(Q.end?"|":"")+j.terminatorEnd)),Q.illegal&&(pe.illegalRe=O(Q.illegal)),Q.contains||(Q.contains=[]),Q.contains=[].concat(...Q.contains.map(function(at){return J(at==="self"?Q:at)})),Q.contains.forEach(function(at){qe(at,pe)}),Q.starts&&qe(Q.starts,j),pe.matcher=Ge(pe),pe}if(E.compilerExtensions||(E.compilerExtensions=[]),E.contains&&E.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return E.classNameAliases=o(E.classNameAliases||{}),qe(E)}function N(E){return E?E.endsWithParent||N(E.starts):!1}function J(E){return E.variants&&!E.cachedVariants&&(E.cachedVariants=E.variants.map(function(O){return o(E,{variants:null},O)})),E.cachedVariants?E.cachedVariants:N(E)?o(E,{starts:E.starts?o(E.starts):null}):Object.isFrozen(E)?o(E):E}var ce="11.11.1";class Ie extends Error{constructor(O,P){super(O),this.name="HTMLInjectionError",this.html=P}}const Se=n,mt=o,Pt=Symbol("nomatch"),So=7,Ti=function(E){const O=Object.create(null),P=Object.create(null),ue=[];let Ge=!0;const qe="Could not find the language '{}', did you forget to load/include a language module?",Q={disableAutodetect:!0,name:"Plain text",contains:[]};let j={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function pe(I){return j.noHighlightRe.test(I)}function gt(I){let se=I.className+" ";se+=I.parentNode?I.parentNode.className:"";const Te=j.languageDetectRe.exec(se);if(Te){const Ke=xo(Te[1]);return Ke||(En(qe.replace("{}",Te[1])),En("Falling back to no-highlight mode for this block.",I)),Ke?Te[1]:"no-highlight"}return se.split(/\s+/).find(Ke=>pe(Ke)||xo(Ke))}function at(I,se,Te){let Ke="",dt="";typeof se=="object"?(Ke=I,Te=se.ignoreIllegals,dt=se.language):(Lt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Lt("10.7.0",`Please use highlight(code, options) instead.
185
+ https://github.com/highlightjs/highlight.js/issues/2277`),dt=I,Ke=se),Te===void 0&&(Te=!0);const _n={code:Ke,language:dt};Oa("before:highlight",_n);const No=_n.result?_n.result:Oi(_n.language,_n.code,Te);return No.code=_n.code,Oa("after:highlight",No),No}function Oi(I,se,Te,Ke){const dt=Object.create(null);function _n(U,re){return U.keywords[re]}function No(){if(!me.keywords){Et.addText(We);return}let U=0;me.keywordPatternRe.lastIndex=0;let re=me.keywordPatternRe.exec(We),_e="";for(;re;){_e+=We.substring(U,re.index);const $e=Fn.case_insensitive?re[0].toLowerCase():re[0],Ot=_n(me,$e);if(Ot){const[Qn,gR]=Ot;if(Et.addText(_e),_e="",dt[$e]=(dt[$e]||0)+1,dt[$e]<=So&&(va+=gR),Qn.startsWith("_"))_e+=re[0];else{const bR=Fn.classNameAliases[Qn]||Qn;$n(re[0],bR)}}else _e+=re[0];U=me.keywordPatternRe.lastIndex,re=me.keywordPatternRe.exec(We)}_e+=We.substring(U),Et.addText(_e)}function Ma(){if(We==="")return;let U=null;if(typeof me.subLanguage=="string"){if(!O[me.subLanguage]){Et.addText(We);return}U=Oi(me.subLanguage,We,!0,kb[me.subLanguage]),kb[me.subLanguage]=U._top}else U=gd(We,me.subLanguage.length?me.subLanguage:null);me.relevance>0&&(va+=U.relevance),Et.__addSublanguage(U._emitter,U.language)}function en(){me.subLanguage!=null?Ma():No(),We=""}function $n(U,re){U!==""&&(Et.startScope(re),Et.addText(U),Et.endScope())}function mb(U,re){let _e=1;const $e=re.length-1;for(;_e<=$e;){if(!U._emit[_e]){_e++;continue}const Ot=Fn.classNameAliases[U[_e]]||U[_e],Qn=re[_e];Ot?$n(Qn,Ot):(We=Qn,No(),We=""),_e++}}function gb(U,re){return U.scope&&typeof U.scope=="string"&&Et.openNode(Fn.classNameAliases[U.scope]||U.scope),U.beginScope&&(U.beginScope._wrap?($n(We,Fn.classNameAliases[U.beginScope._wrap]||U.beginScope._wrap),We=""):U.beginScope._multi&&(mb(U.beginScope,re),We="")),me=Object.create(U,{parent:{value:me}}),me}function bb(U,re,_e){let $e=_(U.endRe,_e);if($e){if(U["on:end"]){const Ot=new e(U);U["on:end"](re,Ot),Ot.isMatchIgnored&&($e=!1)}if($e){for(;U.endsParent&&U.parent;)U=U.parent;return U}}if(U.endsWithParent)return bb(U.parent,re,_e)}function uR(U){return me.matcher.regexIndex===0?(We+=U[0],1):(wd=!0,0)}function pR(U){const re=U[0],_e=U.rule,$e=new e(_e),Ot=[_e.__beforeBegin,_e["on:begin"]];for(const Qn of Ot)if(Qn&&(Qn(U,$e),$e.isMatchIgnored))return uR(re);return _e.skip?We+=re:(_e.excludeBegin&&(We+=re),en(),!_e.returnBegin&&!_e.excludeBegin&&(We=re)),gb(_e,U),_e.returnBegin?0:re.length}function fR(U){const re=U[0],_e=se.substring(U.index),$e=bb(me,U,_e);if(!$e)return Pt;const Ot=me;me.endScope&&me.endScope._wrap?(en(),$n(re,me.endScope._wrap)):me.endScope&&me.endScope._multi?(en(),mb(me.endScope,U)):Ot.skip?We+=re:(Ot.returnEnd||Ot.excludeEnd||(We+=re),en(),Ot.excludeEnd&&(We=re));do me.scope&&Et.closeNode(),!me.skip&&!me.subLanguage&&(va+=me.relevance),me=me.parent;while(me!==$e.parent);return $e.starts&&gb($e.starts,U),Ot.returnEnd?0:re.length}function hR(){const U=[];for(let re=me;re!==Fn;re=re.parent)re.scope&&U.unshift(re.scope);U.forEach(re=>Et.openNode(re))}let Aa={};function yb(U,re){const _e=re&&re[0];if(We+=U,_e==null)return en(),0;if(Aa.type==="begin"&&re.type==="end"&&Aa.index===re.index&&_e===""){if(We+=se.slice(re.index,re.index+1),!Ge){const $e=new Error(`0 width match regex (${I})`);throw $e.languageName=I,$e.badRule=Aa.rule,$e}return 1}if(Aa=re,re.type==="begin")return pR(re);if(re.type==="illegal"&&!Te){const $e=new Error('Illegal lexeme "'+_e+'" for mode "'+(me.scope||"<unnamed>")+'"');throw $e.mode=me,$e}else if(re.type==="end"){const $e=fR(re);if($e!==Pt)return $e}if(re.type==="illegal"&&_e==="")return We+=`
186
+ `,1;if(kd>1e5&&kd>re.index*3)throw new Error("potential infinite loop, way more iterations than matches");return We+=_e,_e.length}const Fn=xo(I);if(!Fn)throw ot(qe.replace("{}",I)),new Error('Unknown language: "'+I+'"');const mR=Ni(Fn);let yd="",me=Ke||mR;const kb={},Et=new j.__emitter(j);hR();let We="",va=0,Xo=0,kd=0,wd=!1;try{if(Fn.__emitTokens)Fn.__emitTokens(se,Et);else{for(me.matcher.considerAll();;){kd++,wd?wd=!1:me.matcher.considerAll(),me.matcher.lastIndex=Xo;const U=me.matcher.exec(se);if(!U)break;const re=se.substring(Xo,U.index),_e=yb(re,U);Xo=U.index+_e}yb(se.substring(Xo))}return Et.finalize(),yd=Et.toHTML(),{language:I,value:yd,relevance:va,illegal:!1,_emitter:Et,_top:me}}catch(U){if(U.message&&U.message.includes("Illegal"))return{language:I,value:Se(se),illegal:!0,relevance:0,_illegalBy:{message:U.message,index:Xo,context:se.slice(Xo-100,Xo+100),mode:U.mode,resultSoFar:yd},_emitter:Et};if(Ge)return{language:I,value:Se(se),illegal:!1,relevance:0,errorRaised:U,_emitter:Et,_top:me};throw U}}function md(I){const se={value:Se(I),illegal:!1,relevance:0,_top:Q,_emitter:new j.__emitter(j)};return se._emitter.addText(I),se}function gd(I,se){se=se||j.languages||Object.keys(O);const Te=md(I),Ke=se.filter(xo).filter(hb).map(en=>Oi(en,I,!1));Ke.unshift(Te);const dt=Ke.sort((en,$n)=>{if(en.relevance!==$n.relevance)return $n.relevance-en.relevance;if(en.language&&$n.language){if(xo(en.language).supersetOf===$n.language)return 1;if(xo($n.language).supersetOf===en.language)return-1}return 0}),[_n,No]=dt,Ma=_n;return Ma.secondBest=No,Ma}function eR(I,se,Te){const Ke=se&&P[se]||Te;I.classList.add("hljs"),I.classList.add(`language-${Ke}`)}function bd(I){let se=null;const Te=gt(I);if(pe(Te))return;if(Oa("before:highlightElement",{el:I,language:Te}),I.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",I);return}if(I.children.length>0&&(j.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(I)),j.throwUnescapedHTML))throw new Ie("One of your code blocks includes unescaped HTML.",I.innerHTML);se=I;const Ke=se.textContent,dt=Te?at(Ke,{language:Te,ignoreIllegals:!0}):gd(Ke);I.innerHTML=dt.value,I.dataset.highlighted="yes",eR(I,Te,dt.language),I.result={language:dt.language,re:dt.relevance,relevance:dt.relevance},dt.secondBest&&(I.secondBest={language:dt.secondBest.language,relevance:dt.secondBest.relevance}),Oa("after:highlightElement",{el:I,result:dt,text:Ke})}function tR(I){j=mt(j,I)}const nR=()=>{Ta(),Lt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function oR(){Ta(),Lt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let pb=!1;function Ta(){function I(){Ta()}if(document.readyState==="loading"){pb||window.addEventListener("DOMContentLoaded",I,!1),pb=!0;return}document.querySelectorAll(j.cssSelector).forEach(bd)}function rR(I,se){let Te=null;try{Te=se(E)}catch(Ke){if(ot("Language definition for '{}' could not be registered.".replace("{}",I)),Ge)ot(Ke);else throw Ke;Te=Q}Te.name||(Te.name=I),O[I]=Te,Te.rawDefinition=se.bind(null,E),Te.aliases&&fb(Te.aliases,{languageName:I})}function iR(I){delete O[I];for(const se of Object.keys(P))P[se]===I&&delete P[se]}function sR(){return Object.keys(O)}function xo(I){return I=(I||"").toLowerCase(),O[I]||O[P[I]]}function fb(I,{languageName:se}){typeof I=="string"&&(I=[I]),I.forEach(Te=>{P[Te.toLowerCase()]=se})}function hb(I){const se=xo(I);return se&&!se.disableAutodetect}function aR(I){I["before:highlightBlock"]&&!I["before:highlightElement"]&&(I["before:highlightElement"]=se=>{I["before:highlightBlock"](Object.assign({block:se.el},se))}),I["after:highlightBlock"]&&!I["after:highlightElement"]&&(I["after:highlightElement"]=se=>{I["after:highlightBlock"](Object.assign({block:se.el},se))})}function lR(I){aR(I),ue.push(I)}function cR(I){const se=ue.indexOf(I);se!==-1&&ue.splice(se,1)}function Oa(I,se){const Te=I;ue.forEach(function(Ke){Ke[Te]&&Ke[Te](se)})}function dR(I){return Lt("10.7.0","highlightBlock will be removed entirely in v12.0"),Lt("10.7.0","Please use highlightElement now."),bd(I)}Object.assign(E,{highlight:at,highlightAuto:gd,highlightAll:Ta,highlightElement:bd,highlightBlock:dR,configure:tR,initHighlighting:nR,initHighlightingOnLoad:oR,registerLanguage:rR,unregisterLanguage:iR,listLanguages:sR,getLanguage:xo,registerAliases:fb,autoDetection:hb,inherit:mt,addPlugin:lR,removePlugin:cR}),E.debugMode=function(){Ge=!1},E.safeMode=function(){Ge=!0},E.versionString=ce,E.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:h};for(const I in nt)typeof nt[I]=="object"&&t(nt[I]);return Object.assign(E,nt),E},qt=Ti({});return qt.newInstance=()=>Ti({}),ud=qt,qt.HighlightJS=qt,qt.default=qt,ud}var qM=UM();const KM=HM(qM),Jg={},WM="hljs-";function jM(t){const e=KM.newInstance();return t&&i(t),{highlight:n,highlightAuto:o,listLanguages:r,register:i,registerAlias:s,registered:l};function n(c,d,u){const p=u||Jg,f=typeof p.prefix=="string"?p.prefix:WM;if(!e.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");e.configure({__emitter:GM,classPrefix:f});const h=e.highlight(d,{ignoreIllegals:!0,language:c});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const m=h._emitter.root,g=m.data;return g.language=h.language,g.relevance=h.relevance,m}function o(c,d){const p=(d||Jg).subset||r();let f=-1,h=0,m;for(;++f<p.length;){const g=p[f];if(!e.getLanguage(g))continue;const b=n(g,c,d);b.data&&b.data.relevance!==void 0&&b.data.relevance>h&&(h=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function r(){return e.listLanguages()}function i(c,d){if(typeof c=="string")e.registerLanguage(c,d);else{let u;for(u in c)Object.hasOwn(c,u)&&e.registerLanguage(u,c[u])}}function s(c,d){if(typeof c=="string")e.registerAliases(typeof d=="string"?d:[...d],{languageName:c});else{let u;for(u in c)if(Object.hasOwn(c,u)){const p=c[u];e.registerAliases(typeof p=="string"?p:[...p],{languageName:u})}}}function l(c){return!!e.getLanguage(c)}}class GM{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],o=n.children[n.children.length-1];o&&o.type==="text"?o.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const o=this.stack[this.stack.length-1],r=e.root.children;n?o.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):o.children.push(...r)}openNode(e){const n=this,o=e.split(".").map(function(s,l){return l?s+"_".repeat(l):n.options.classPrefix+s}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:o},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}/**
187
+ * Copyright 2025 Yiitap
188
+ * @license MIT
189
+ **/function YM(t){const e=document.createElement("textarea");e.value=t,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const n=document.execCommand("copy");return e.remove(),n}function JM(t){return navigator.clipboard!==void 0?navigator.clipboard.writeText(t):new Promise((e,n)=>{const o=YM(t);o?e(!0):n(o)})}const XM={class:"code-block-toolbar"},ZM={class:"wrap editable"},QM={class:"wrap"},eA={class:"language readonly"},tA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,n=a.ref("content_copy"),o=a.computed({get(){return e.node.attrs.language},set(d){e.updateAttributes({language:d})}}),r=a.computed({get(){return e.node.attrs.wrap},set(d){e.updateAttributes({wrap:d})}}),i=a.computed(()=>r.value?"text_select_move_down":"format_text_wrap");function s(d){o.value=d}function l(){const d=e.node.content.content[0].text;JM(d).then(()=>{n.value="done",setTimeout(()=>{n.value="content_copy"},2e3)})}function c(){r.value=!r.value}return(d,u)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:"o-code-block-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",XM,[a.createElementVNode("div",ZM,[a.createVNode(a.unref(Vh),{language:o.value,onSelect:s},null,8,["language"])]),a.createElementVNode("div",QM,[a.createElementVNode("div",eA,a.toDisplayString(o.value),1),a.createVNode(a.unref(Le),{icon:i.value,"icon-class":{"rotate-270":r.value},tooltip:"Wrap",class:"editable",onClick:c},null,8,["icon","icon-class"]),a.createVNode(a.unref(Le),{icon:n.value,tooltip:"Copy",onClick:l},null,8,["icon"])])]),a.createElementVNode("pre",null,[a.createVNode(a.unref(An),{as:"code",class:a.normalizeClass({wrap:r.value})},null,8,["class"])])]),_:1},16))}}),nA=jM(zM),Xg=wO.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return dn(tA)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",lowlight:nA}),oA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,n=a.computed(()=>e.node.attrs.level);return(o,r)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:["o-heading-view",`h${n.value}`],style:`text-align: ${o.node.attrs.textAlign}`}),{default:a.withCtx(()=>[a.createVNode(a.unref(An))]),_:1},16,["class","style"]))}}),Zg=ph.extend({draggable:!0,addNodeView(){return dn(oA)}}),rA={class:"horizontal"},iA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:"o-horizontal-view"}),{default:a.withCtx(()=>[a.createElementVNode("div",rA,[a.createVNode(a.unref(An),{as:"div",class:"divider"})])]),_:1},16))}}),Qg=kh.extend({draggable:!0,addNodeView(){return dn(iA)}});/**
190
+ * Copyright 2025 Yiitap
191
+ * @license MIT
192
+ **/const sA=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,aA=Fe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ce(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ps({find:sA,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}}),lA=aA.extend({draggable:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),size:{default:"",rendered:!1},ratio:{default:"",rendered:!1},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:t,HTMLAttributes:e}){return e.size=t.attrs.size,e.ratio=t.attrs.ratio,["img",Ce(this.options.HTMLAttributes,e)]}}),cA={key:1,class:"image-container"},dA={key:1},uA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{isEditable:n}=Me(),o=a.ref(!1),r=a.ref(!1),i=a.ref({}),s=a.ref(null),l=a.ref(!1),c=a.computed(()=>e.node.attrs),d=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}}),u=a.computed({get(){return e.node.attrs.title},set(y){e.updateAttributes({title:y})}});function p(){l.value=!0,setTimeout(()=>{var y;(y=s.value)==null||y.focus()},0)}function f(){l.value=!1}function h(){d.value==="init"&&b(!0)}function m(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function g(y){d.value=y,b(!1)}function b(y){r.value=y}return a.onMounted(()=>{b(d.value==="init")}),(y,w)=>{var _;return a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:["o-image-view",{"with-caption":c.value.alt,"with-ratio":c.value.ratio,readonly:!((_=y.editor)!=null&&_.isEditable),init:d.value==="init"}],size:c.value.size,as:"div",onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Yn),{modelValue:r.value,"onUpdate:modelValue":w[1]||(w[1]=k=>r.value=k),placement:d.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(kc),{val:d.value==="init"?"":d.value,type:"image",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var k;return[d.value==="init"?(a.openBlock(),a.createBlock(a.unref(hc),{key:0,icon:"image",placeholder:"Add an image"})):(a.openBlock(),a.createElementBlock("div",cA,[a.unref(n)?(a.openBlock(),a.createBlock(a.unref(gc),a.mergeProps({key:0},e,{onAction:m}),{default:a.withCtx(()=>[a.createVNode(a.unref(Le),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):a.createCommentVNode("",!0),a.createElementVNode("img",a.mergeProps(c.value,{draggable:"true","data-drag-handle":""}),null,16),a.createElementVNode("div",{class:"caption",onClick:p},[(k=y.editor)!=null&&k.isEditable&&l.value?(a.openBlock(),a.createBlock(a.unref(Rn),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":w[0]||(w[0]=S=>u.value=S),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",dA,a.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(ci),{modelValue:o.value,"onUpdate:modelValue":w[2]||(w[2]=k=>o.value=k),event:i.value},{default:a.withCtx(()=>[a.createVNode(a.unref(yo),a.mergeProps(e,{onAction:m}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class","size"])}}}),eb=lA.extend({addNodeView(){return dn(uA)}}).configure({inline:!0});function pA(t){return new Ae({key:new Ne("handleClickSelectLink"),props:{handleClick:(e,n,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=pr(i.resolve(n),r.marks.link);if(!l)return!1;const c=i.resolve(l.from),d=i.resolve(l.to),u=s.setSelection(new te(c,d));return e.dispatch(u),!0}}})}const fA=Wc.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],pA({type:this.type})]}}).configure({openOnClick:!1}),hA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t;return(n,o)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:"o-paragraph-view"}),{default:a.withCtx(()=>[a.createVNode(a.unref(An),{as:"p",style:a.normalizeStyle(`text-align: ${n.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),tb=_h.extend({draggable:!1,addNodeView(){return dn(hA,{stopEvent:()=>!1})}}),mA={class:"add"},gA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{tr:n}=be(),{isEditable:o,run:r}=Me(),i=a.ref(!1);function s(){i.value=!0}function l(){c("tableSelectRow",{pos:e.getPos()})}function c(d,u={}){d==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,d,u)},0)}return(d,u)=>(a.openBlock(),a.createBlock(a.unref(ic),a.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:a.withCtx(()=>[a.unref(o)?(a.openBlock(),a.createBlock(a.unref(Yn),{key:0,modelValue:i.value,"onUpdate:modelValue":u[2]||(u[2]=p=>i.value=p),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:l},null,8,["tooltip"]),a.createVNode(a.unref(ct),{icon:"delete",placement:"left",tooltip:a.unref(n)("table.removeRow"),onClick:u[1]||(u[1]=p=>c("tableDeleteRow"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["row-handler",{active:i.value}]),onClick:s},[a.createElementVNode("div",mA,[u[3]||(u[3]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(ge).blue,tooltip:a.unref(n)("table.addRow"),placement:"left",onClick:u[0]||(u[0]=a.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):a.createCommentVNode("",!0),a.createVNode(a.unref(An))]),_:1},16,["style"]))}}),nb=Km.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return dn(gA,{stopEvent:()=>!1})}}),bA={class:"add"},yA={class:"add"},kA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{tr:n}=be(),{isEditable:o,run:r}=Me(),i=a.ref(!1),s=a.ref(!1);function l(){setTimeout(()=>{i.value=!0},0)}function c(){s.value=!0}function d(){i.value=!1,p("tableSelectColumn",{pos:e.getPos()})}function u(){p("tableSelectRow",{pos:e.getPos()})}function p(f,h={}){f==="tableDeleteRow"?s.value=!1:f==="tableDeleteColumn"&&(i.value=!1),setTimeout(()=>{r(e.editor,f,h)},0)}return(f,h)=>(a.openBlock(),a.createBlock(a.unref(ic),a.mergeProps({class:"o-table-header-view",as:"th"},f.node.attrs,{style:{background:f.node.attrs.background}}),{default:a.withCtx(()=>[a.unref(o)?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(a.unref(Yn),{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=m=>i.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"select_all",tooltip:a.unref(n)("table.selectColumn"),onClick:d},null,8,["tooltip"]),a.createVNode(a.unref(ct),{icon:"delete",tooltip:a.unref(n)("table.removeColumn"),onClick:h[1]||(h[1]=m=>p("tableDeleteColumn"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["col-handler",{active:i.value}]),onClick:l},[a.createElementVNode("div",bA,[h[6]||(h[6]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(ge).blue,tooltip:a.unref(n)("table.addColumn"),onClick:h[0]||(h[0]=a.withModifiers(m=>p("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),a.createVNode(a.unref(Yn),{modelValue:s.value,"onUpdate:modelValue":h[5]||(h[5]=m=>s.value=m),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"select_all",placement:"left",tooltip:a.unref(n)("table.selectRow"),onClick:u},null,8,["tooltip"]),a.createVNode(a.unref(ct),{icon:"delete",placement:"left",tooltip:a.unref(n)("table.removeRow"),onClick:h[4]||(h[4]=m=>p("tableDeleteRow"))},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createElementVNode("section",{class:a.normalizeClass(["row-handler",{active:s.value}]),onClick:c},[a.createElementVNode("div",yA,[h[7]||(h[7]=a.createElementVNode("div",{class:"indicator"},[a.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[a.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),a.createVNode(a.unref(yn),{icon:"add_circle",color:a.unref(ge).blue,tooltip:a.unref(n)("table.addRow"),placement:"left",onClick:h[3]||(h[3]=a.withModifiers(m=>p("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):a.createCommentVNode("",!0),a.createVNode(a.unref(An))]),_:1},16,["style"]))}}),ob=Wm.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return dn(kA,{stopEvent:()=>!1})}});/**
193
+ * Copyright 2025 Yiitap
194
+ * @license MIT
195
+ **/const wA=Fe.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:t}){return["table-wrapper",Ce(t),0]}}),EA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,n=a.inject("sideNode",{value:!1}),o=a.ref(!1),r=a.computed(()=>{const{selection:s}=e.editor.view.state,l=s.from,c=e.getPos(),d=c+e.node.nodeSize;return l>=c&&l<=d});function i(s){o.value=s}return a.watch(r,s=>{console.log("isFocused",e.node.attrs),i(s)}),(s,l)=>(a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":a.unref(n)}]}),{default:a.withCtx(()=>[a.createVNode(a.unref(An),{as:"table"})]),_:1},16,["class"]))}}),rb=wA.extend({addNodeView(){return dn(EA,{stopEvent:()=>!1})}});/**
196
+ * Copyright 2025 Yiitap
197
+ * @license MIT
198
+ **/const _A=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,CA=Fe.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:t=>{var e;return((e=t.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:t,HTMLAttributes:e}){return["video",{caption:t.attrs.caption},["source",Ce(this.options.HTMLAttributes,e)]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ps({find:_A,type:this.type,getAttributes:t=>{const[e]=t;return{src:e}}})]}}),SA={key:1,class:"video-container"},xA={key:1},NA=a.defineComponent({__name:"view",props:lt,setup(t){const e=t,{isEditable:n}=Me(),o=a.ref(!1),r=a.ref({}),i=a.ref(null),s=a.ref(!1),l=a.ref(!1),c=a.computed({get(){return e.node.attrs.caption},set(y){e.updateAttributes({caption:y})}}),d=a.computed({get(){return e.node.attrs.src},set(y){e.updateAttributes({src:y})}});function u(y){switch(o.value=!1,y.value){case"replace":b(!0);break}}function p(){s.value=!0,setTimeout(()=>{var y;(y=i.value)==null||y.focus()},0)}function f(){s.value=!1}function h(){d.value==="init"&&b(!0)}function m(y){o.value=!0,r.value=y}function g(y){d.value=y,b(!1)}function b(y){l.value=y}return a.onMounted(()=>{b(d.value==="init")}),(y,w)=>{var _;return a.openBlock(),a.createBlock(a.unref(gn),a.mergeProps(e,{class:["o-video-view",{readonly:!((_=y.editor)!=null&&_.isEditable),init:d.value==="init"}],as:"div",onContextmenu:a.withModifiers(m,["prevent"]),onClick:h}),{default:a.withCtx(()=>[a.createVNode(a.unref(Yn),{modelValue:l.value,"onUpdate:modelValue":w[1]||(w[1]=k=>l.value=k),placement:d.value==="init"?"bottom":"top"},{"popover-content":a.withCtx(()=>[a.createVNode(a.unref(kc),{val:d.value==="init"?"":d.value,type:"video",onInput:g},null,8,["val"])]),default:a.withCtx(()=>{var k;return[d.value==="init"?(a.openBlock(),a.createBlock(a.unref(hc),{key:0,icon:"videocam",placeholder:"Add a video"})):(a.openBlock(),a.createElementBlock("div",SA,[w[3]||(w[3]=a.createElementVNode("div",{class:"video-cover"},null,-1)),a.unref(n)?(a.openBlock(),a.createBlock(a.unref(gc),a.mergeProps({key:0},e,{onAction:u}),{default:a.withCtx(()=>[a.createVNode(a.unref(Le),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):a.createCommentVNode("",!0),a.createElementVNode("video",a.mergeProps(y.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[a.createElementVNode("source",a.normalizeProps(a.guardReactiveProps(y.node.attrs)),null,16)],16),a.createElementVNode("div",{class:"caption",onClick:p},[(k=y.editor)!=null&&k.isEditable&&s.value?(a.openBlock(),a.createBlock(a.unref(Rn),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=S=>c.value=S),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(a.openBlock(),a.createElementBlock("span",xA,a.toDisplayString(c.value),1))])]))]}),_:1},8,["modelValue","placement"]),a.createVNode(a.unref(ci),{modelValue:o.value,"onUpdate:modelValue":w[2]||(w[2]=k=>o.value=k),event:r.value},{default:a.withCtx(()=>[a.createVNode(a.unref(yo),a.mergeProps(e,{onAction:u}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),ib=CA.extend({addNodeView(){return dn(NA)}}),TA=["BackColor","Focus","FontFamily","ForeColor","Table","TaskItem","TaskList","TextAlign","Typography","Underline","OHorizontalRule","OSelectionDecoration","OUniqueID"],OA=["BackColor","Bold","BulletList","Code","CodeBlockLowlight","Focus","FontFamily","ForeColor","HorizontalRule","Image","Italic","Link","ListItem","Mention","OrderedList","Strike","Table","TaskItem","TaskList","TextAlign","Typography","Underline"],MA=["OAiBlock","OBlockquote","OCallout","OCharCommand","OCodeBlock","OColon","OColorHighlighter","OFocus","OHeading","OHorizontalRule","OImage","OLink","OParagraph","OSelectionDecoration","OSlash","OSlashZh","OTableWrapper","OTrailingNode","OUniqueID","OVideo"],AA=[...OA,...MA],vA=[ks,Jh,Xh,Zh,Qh,Wc,EN,gm,bm,ym,km,wm,td,Ch,ng,og,Gm,rg,t1,Xg,Zg,Qg,eb,tb,Ym,Jm,Zm,nb,ob,rb,Qm,tg,ib],pd=t=>RE(t,vA),RA={key:0,class:"o-ai-menu"},BA={key:0,class:"o-scroll"},DA={class:"view-main"},IA={key:1,class:"view-output"},LA={class:"action-container"},PA={class:"actions"},$A={key:0,class:"o-scroll"},FA=["innerHTML"],VA={class:"ai-io-panel"},zA={class:"o-flex o-item-center actions"},sb=a.defineComponent({__name:"OAiMenu",props:{editor:{type:jt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:e}){const n=t,o=e,{md:r,aiOption:i,createStreamingChatCompletion:s}=fc(),{languageName:l,tr:c}=be(),d=a.ref(),u=a.ref(!1),p=a.ref(""),f=a.ref(""),h=a.ref("main"),m=a.ref(""),g=a.ref(!1),b=a.ref(!1),y=a.computed(()=>({role:"system",content:uc.writing.replace("[LANGUAGE]",l.value)})),w=a.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),_=a.computed(()=>xh.filter($=>$.value.indexOf(p.value)>=0));function k(){const{from:$,to:q}=n.editor.state.selection;return n.editor.state.doc.textBetween($,q,"")}function S(){setTimeout(()=>{u.value=!0},0)}function C($,q){switch(q&&(u.value=!0),m.value=$.options.prompt.replaceAll("[CONTENT]",k()),$.value){case"translate":m.value=m.value.replace("[LANGUAGE]",q.value);break;case"change_tone":m.value=m.value.replace("[TONE]",q.value);break}return p.value=c($.label),T(),!0}function R(){var $;Y(),($=d.value)==null||$.focus()}function B(){const $=pd(f.value);let q=0;for(const K of $.content){const oe=Cn.fromJSON(n.editor.schema,K);q+=oe.nodeSize}n.editor.chain().focus().deleteSelection().insertContent($.content).setTextSelection({from:n.editor.state.selection.from,to:n.editor.state.selection.from+q+1}).run(),Y(),u.value=!1,setTimeout(()=>{o("confirm")},0)}function T(){h.value="output",g.value=!0,b.value?H():v()}async function v(){let $="";w.value.push({role:"user",content:m.value}),w.value[0].role==="system"&&(w.value.shift(),w.value.unshift(y.value));try{const q=await s(w.value,K=>{$+=K,w.value=[...w.value.slice(0,-1),{role:"assistant",content:$}],f.value=r.render($)})}catch(q){w.value.pop(),console.error(q),Ec.error(c("ai.error"))}g.value=!1}async function H(){let $="";for(const q of Yh)await new Promise(K=>setTimeout(K,500)),$+=q,f.value=r.render($);g.value=!1}function Y(){h.value="main",f.value="",p.value=""}return a.onMounted(()=>{setTimeout(()=>{var $;($=d.value)==null||$.focus(),u.value=!0},300)}),($,q)=>t.editor?(a.openBlock(),a.createElementBlock("section",RA,[a.createVNode(a.unref(Yn),{modelValue:u.value,"onUpdate:modelValue":q[1]||(q[1]=K=>u.value=K),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":a.withCtx(()=>[h.value==="main"?(a.openBlock(),a.createElementBlock("div",BA,[a.createElementVNode("section",DA,[a.createVNode(a.unref(Ss),{items:_.value,onSelect:C,"use-keyboard":u.value},null,8,["items","use-keyboard"])])])):a.createCommentVNode("",!0),h.value==="output"?(a.openBlock(),a.createElementBlock("section",IA,[a.createElementVNode("div",LA,[a.createElementVNode("div",null,[a.createVNode(a.unref(ie),{name:"auto_awesome",class:"o-tips"})]),a.createElementVNode("div",PA,[a.createVNode(a.unref(yn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:g.value,onClick:B},null,8,["loading"]),g.value?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(a.unref(yn),{key:0,icon:"close",tooltip:"Cancel",onClick:R}))])]),f.value?(a.openBlock(),a.createElementBlock("div",$A,[a.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,FA)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createElementVNode("section",VA,[a.createVNode(a.unref(Rn),{ref_key:"inputRef",ref:d,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":q[0]||(q[0]=K=>p.value=K),type:"text",placeholder:a.unref(c)("ai.askAi"),autofocus:"",onFocus:S},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"auto_awesome",class:"o-tips"})]),suffix:a.withCtx(()=>[a.createElementVNode("div",zA,[a.createVNode(a.unref(yn),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):a.createCommentVNode("",!0)}}),HA={key:0,class:"spinner"},yn=a.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:e}){const n=t,o=e;function r(){n.loading||o("click")}return(i,s)=>(a.openBlock(),a.createBlock(a.unref(Gn),{placement:t.placement},{trigger:a.withCtx(()=>[a.createElementVNode("div",{class:a.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:a.normalizeStyle(t.contentStyle),onClick:a.withModifiers(r,["stop"])},[t.loading?(a.openBlock(),a.createElementBlock("div",HA)):(a.openBlock(),a.createBlock(a.unref(ie),{key:1,name:t.icon,color:t.color,class:a.normalizeClass(t.iconClass)},null,8,["name","color","class"])),a.renderSlot(i.$slots,"default")],6)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),UA=a.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:e}=be();return(n,o)=>(a.openBlock(),a.createBlock(yn,{"content-class":"o-ai-btn",icon:"auto_awesome",color:a.unref(ge).purple,tooltip:a.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),qA=a.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_center"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"},{label:n("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"textAlign",{textAlign:l})}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:a.unref(n)("editor.align")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,u)=>{var p;return a.openBlock(),a.createBlock(a.unref(zt),{key:u,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:f=>s(d.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive({textAlign:d.value})?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),KA={class:"o-align-group"},WA=a.defineComponent({__name:"OAlignGroup",props:{editor:{type:jt}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_left"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,l)=>(a.openBlock(),a.createElementBlock("div",KA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,d)=>{var u;return a.openBlock(),a.createBlock(Le,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),jA={class:"o-back-color-dropdown o-button-group"},GA=a.defineComponent({__name:"OBackColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.ref("#ffec3d");function s(){l(i.value)}function l(c){r.value.setShow(!1),i.value=c,o(e.editor,"backColor",{color:c})}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Gn),{trigger:"hover"},{trigger:a.withCtx(()=>[a.createElementVNode("div",jA,[a.createVNode(a.unref(xt),{icon:"ink_highlighter",class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},{default:a.withCtx(()=>[a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),a.createVNode(a.unref(xt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.highlightColor")),1)]),_:1})]),default:a.withCtx(()=>{var u;return[a.createVNode(a.unref(xs),{"default-color":"","default-label":a.unref(n)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),YA=a.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:a.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Ns),{items:a.unref(Ar.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),JA=a.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,"fontFamily",{fontFamily:l})}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:a.unref(n)("editor.fontFamily")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,u)=>{var p;return a.openBlock(),a.createElementBlock(a.Fragment,{key:u},[d.separator?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(zt),{class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:f=>s(d.value)},{suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive("textStyle",{fontFamily:d.value})?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createElementVNode("span",{style:a.normalizeStyle(`font-family: ${d.value}`)},a.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),XA={class:"o-fore-color-dropdown o-button-group"},ZA=a.defineComponent({__name:"OForeColorDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.ref("#ff4d4f");function s(){l(i.value)}function l(c){var d;(d=r.value)==null||d.setShow(!1),i.value=c,o(e.editor,"foreColor",{color:c})}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Gn),null,{trigger:a.withCtx(()=>[a.createElementVNode("div",XA,[a.createVNode(a.unref(xt),{icon:"format_color_text",class:"o-command-btn label",onClick:a.withModifiers(s,["stop"])},{default:a.withCtx(()=>[a.createElementVNode("div",{class:"indicator",style:a.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),a.createVNode(a.unref(xt),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(a.unref(n)("editor.textColor")),1)]),_:1})]),default:a.withCtx(()=>{var u;return[a.createVNode(a.unref(xs),{"default-color":"","default-label":a.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),QA=a.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:n("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:n("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:n("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:n("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:n("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(c){var d,u;return c.value==="heading"?(d=e.editor)==null?void 0:d.isActive(c.value,{level:c.valueAlt}):(u=e.editor)==null?void 0:u.isActive(c.value)}function l(c){var d;(d=r.value)==null||d.setShow(!1),o(e.editor,c.value,{level:c.valueAlt})}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:a.unref(n)("editor.heading")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[u.separator?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(zt),{class:a.normalizeClass({"is-active":s(u)}),onClick:f=>l(u)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(u)?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),ev={class:"o-list-dropdown o-button-group"},tv=a.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.ref();function s(){o(e.editor,i.value.value)}function l(d){r.value.setShow(!1),i.value=d,o(e.editor,d.value)}const c=a.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);return a.onMounted(()=>{i.value=c.value[0]}),(d,u)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(Gn),{trigger:"hover"},{trigger:a.withCtx(()=>{var p;return[a.createElementVNode("div",ev,[a.createVNode(a.unref(xt),{icon:(p=i.value)==null?void 0:p.icon,class:"o-command-btn",onClick:a.withModifiers(s,["stop"])},null,8,["icon"]),a.createVNode(a.unref(xt),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:a.withCtx(()=>{var p;return[a.createTextVNode(" "+a.toDisplayString((p=i.value)==null?void 0:p.label),1)]}),_:1})]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,(p,f)=>{var h;return a.openBlock(),a.createBlock(a.unref(zt),{key:f,class:a.normalizeClass({"is-active":(h=t.editor)==null?void 0:h.isActive(p.value)}),onClick:m=>l(p)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:p.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive(p.value)?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),nv={class:"o-list-group"},ov=a.defineComponent({__name:"OListGroup",props:{editor:{type:jt,required:!0}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,l)=>(a.openBlock(),a.createElementBlock("div",nv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,(c,d)=>{var u;return a.openBlock(),a.createBlock(Le,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(c.value)},onClick:p=>i(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),rv=a.defineComponent({__name:"OLinkBtn",props:{editor:{type:jt}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(),i=a.ref(!1),s=a.ref(""),l=a.ref(!0);function c(){var f;s.value="",l.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,l.value=p.target==="_blank",console.log("show",i.value,p,l.value))}function d(){var p;(p=r.value)==null||p.setShow(!1)}function u(p){var f;p?o(e.editor,"linkSet",{href:p,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:a.withCtx(()=>{var h;return[a.createVNode(a.unref(ct),{icon:"link","content-class":{"is-active":(h=t.editor)==null?void 0:h.isActive("link")},tooltip:a.unref(n)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(wc),{key:0,title:a.unref(n)("editor.hyperlink"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(_c),{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=h=>l.value=h),label:a.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):a.createCommentVNode("",!0)]),_:1},8,["show"]))}}),iv=a.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:jt,required:!0}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(),i=a.ref(!1),s=a.ref(""),l=a.ref(!0);function c(){var f;s.value="",l.value=!0;const p=(f=e.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(s.value=p.href,l.value=p.target==="_blank")}function d(){var p;(p=r.value)==null||p.setShow(!1)}function u(p){var f;p?o(e.editor,"linkSet",{href:p,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(f=r.value)==null||f.setShow(!1)}return(p,f)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[f[1]||(f[1]=h=>i.value=h),c]},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"edit",tooltip:a.unref(n)("link.edit")},null,8,["tooltip"])]),default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(wc),{key:0,title:a.unref(n)("link.edit"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":a.withCtx(()=>[a.createVNode(a.unref(_c),{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=h=>l.value=h),label:a.unref(n)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):a.createCommentVNode("",!0)]),_:1},8,["show"]))}}),sv=a.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(a.openBlock(),a.createBlock(Le,{icon:"open_in_new",tooltip:a.unref(n)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),av={class:"o-command-btn"},lv={class:"o-more-bubble"},cv=a.defineComponent({__name:"OMoreBubble",props:{editor:{type:jt,required:!0}},setup(t){const e=a.ref();return(n,o)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:a.withCtx(()=>[a.createElementVNode("div",av,[a.createVNode(a.unref(ie),{name:"more_horiz"})])]),default:a.withCtx(()=>[a.createElementVNode("section",lv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Bh),(r,i)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:i},[r==="separator"?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0,vertical:""})):typeof r=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Sa)(r)),{key:1,name:r,editor:t.editor},null,8,["name","editor"])):a.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),dv=a.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",icon:"title"},{label:n("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:n("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:n("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:n("editor.todoList"),value:"taskList",icon:"check_box"},{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:n("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(c){var d;return(d=e.editor)==null?void 0:d.isActive(c.value,c.options)}function l(c){r.value.setShow(!1),o(e.editor,c.value,c.options)}return(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:a.unref(n)("label.styles")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(u,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[u.separator?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0})):a.createCommentVNode("",!0),a.createVNode(a.unref(zt),{class:a.normalizeClass({"is-active":s(u)}),onClick:f=>l(u)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:u.icon},null,8,["name"])]),suffix:a.withCtx(()=>[s(u)?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),uv=a.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"tableInsert",s)}return(s,l)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"window","content-class":"o-table-btn",tooltip:a.unref(n)("table.insert")},null,8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(zh),{onSelect:i})]),_:1},512))}}),pv={class:"o-table-group"},fv={ai:UA,"align-dropdown":qA,"align-group":WA,"back-color":GA,"font-family":JA,"fore-color":ZA,heading:QA,"list-dropdown":tv,"list-group":ov,link:rv,"link-edit":iv,"link-open":sv,emoji:YA,more:cv,"style-dropdown":dv,table:uv,"table-group":a.defineComponent({__name:"OTableGroup",props:{editor:{type:jt,required:!0}},setup(t){const{tr:e}=be(),{run:n}=Me();return(o,r)=>{var i,s;return a.openBlock(),a.createElementBlock("section",pv,[(i=t.editor)!=null&&i.can().mergeCells()?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"cell_merge",tooltip:a.unref(e)("table.merge"),onClick:r[0]||(r[0]=l=>a.unref(n)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):a.createCommentVNode("",!0),(s=t.editor)!=null&&s.can().splitCell()?(a.openBlock(),a.createBlock(a.unref(Le),{key:1,icon:"splitscreen_left",tooltip:a.unref(e)("table.split"),onClick:r[1]||(r[1]=l=>a.unref(n)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):a.createCommentVNode("",!0),a.createVNode(a.unref(Hh),{editor:t.editor},null,8,["editor"])])}}}),"text-color-dropdown":a.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:jt}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(null),i=a.ref(""),s=a.ref("");function l(c,d){c==="foreColor"?(i.value=d,localStorage.setItem("yiitap.text-color.fore",d)):c==="backColor"&&(s.value=d,localStorage.setItem("yiitap.text-color.back",d)),r.value.setShow(!1),o(e.editor,c,{color:d})}return a.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,d)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:a.unref(n)("editor.textColor")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>{var u;return[a.createVNode(a.unref(Uh),{"fore-color":i.value,"back-color":s.value,"default-label":a.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),"text-format-dropdown":a.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:jt}},setup(t){const e=t,{tr:n}=be(),{run:o}=Me(),r=a.ref(),i=a.computed(()=>[{label:n("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:n("editor.underline"),value:"underline",icon:"format_underlined"},{label:n("editor.code"),value:"code",icon:"code"}]);function s(l){var c;(c=r.value)==null||c.setShow(!1),o(e.editor,l)}return(l,c)=>(a.openBlock(),a.createBlock(a.unref(Pe),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:a.withCtx(()=>[a.createVNode(a.unref(ct),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:a.unref(n)("editor.textFormat")},{default:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:a.withCtx(()=>[a.createVNode(a.unref(Jt),{hoverable:"",clickable:""},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,(d,u)=>{var p;return a.openBlock(),a.createBlock(a.unref(zt),{key:u,class:a.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:f=>s(d.value)},{prefix:a.withCtx(()=>[a.createVNode(a.unref(ie),{name:d.icon},null,8,["name"])]),suffix:a.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(d.value)?(a.openBlock(),a.createBlock(a.unref(ie),{key:0,name:"done",small:""})):a.createCommentVNode("",!0)]}),default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}})},Sa=t=>fv[t]||GC,hv={class:"o-main-menu"},mv={class:"left"},gv={class:"right"},ab=a.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const e=t,n=a.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=Oh),o.length>0?o:Th});return(o,r)=>(a.openBlock(),a.createElementBlock("section",hv,[a.createElementVNode("section",mv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.value,(i,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:s},[i==="separator"?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0,vertical:""})):typeof i=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Sa)(i)),{key:1,name:i,editor:t.editor},null,8,["name","editor"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(i),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),a.renderSlot(o.$slots,"left")]),a.createElementVNode("section",gv,[a.renderSlot(o.$slots,"right")])]))}}),bv={key:0},yv={key:1,class:"container"},kv=a.defineComponent({__name:"OBubbleMenu",props:{editor:{type:jt},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,{tr:n}=be(),{theme:o}=_r(),r=a.ref(!1),i=a.ref(!1),s=a.ref(!1),l=a.ref({duration:100,placement:"bottom-start",role:"popover",trigger:"manual",arrow:!1,onShow:()=>{r.value=!1,i.value=!1,s.value=!1},onHide:()=>{s.value=!1}});function c(){r.value=!0}function d(b){b==="ai"&&(i.value=!0)}function u(){s.value=!0}function p(b){const{schema:y}=e.editor,w=y.marks.link;if(!w||!b)return!1;const{$from:_,$to:k}=b;return!!pr(_,w)}function f({editor:b,element:y,view:w,state:_,oldState:k,from:S,to:C}){var K;const{doc:R,selection:B}=_,{empty:T}=B,v=!R.textBetween(S,C).length&&as(_.selection);if(!w.hasFocus()||T||s.value||v&&b.isActive("link")&&!b.isActive("image"))return!1;const H=["image"],Y=["toc","video","model-viewer"],$=B.node,q=(K=$==null?void 0:$.type)==null?void 0:K.name;return!(b.isActive("codeBlock")||Y.indexOf(q)>=0||q&&!H.includes(q))}const h=a.computed(()=>{if(e.editor){const{state:b}=e.editor,{tr:y}=b,{selection:w}=y;return p(w)}else return!1}),m=a.computed(()=>{var b;return!r.value&&h.value&&!((b=e.editor)!=null&&b.isActive("image"))}),g=a.computed(()=>{var y,w;let b=e.menu;return r.value||((y=e.editor)!=null&&y.isActive("image")?b=h.value?Rh:vh:(w=e.editor)!=null&&w.isActive("table")?b=Dh:h.value&&(b=Ah)),b.length>0?b:Mh});return a.onMounted(()=>{r.value=!1}),(b,y)=>t.editor?(a.openBlock(),a.createElementBlock("section",bv,[a.createVNode(a.unref(F_),{class:a.normalizeClass(["o-bubble-menu",t.menuClass]),editor:t.editor,"should-show":f,"tippy-options":l.value},{default:a.withCtx(()=>[i.value?(a.openBlock(),a.createBlock(a.unref(sb),{key:0,editor:t.editor,onConfirm:u},null,8,["editor"])):(a.openBlock(),a.createElementBlock("section",yv,[m.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createVNode(a.unref(Le),{icon:"arrow_back",tooltip:a.unref(n)("link.back"),onClick:c},null,8,["tooltip"]),a.createVNode(a.unref(Rt),{vertical:""})],64)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g.value,(w,_)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:_},[w==="separator"?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0,vertical:""})):typeof w=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Sa)(w)),{key:1,name:w,editor:t.editor,onClick:k=>d(w)},null,8,["name","editor","onClick"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(w),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))]))]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),wv={key:0},Ev={class:"container"},_v=a.defineComponent({__name:"OFloatingMenu",props:{editor:{type:ah},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const e=t,n=a.ref(!1),o=a.ref({arrow:!1,duration:100,role:"popover",placement:"right",offset:[0,168]});function r(){n.value=!0}function i(d){const{schema:u}=e.editor,p=u.marks.link;if(!p||!d)return!1;const{$from:f,$to:h}=d;return!!pr(f,p)}const s=a.computed(()=>{if(e.editor){const{state:d}=e.editor,{tr:u}=d,{selection:p}=u;return i(p)}else return!1}),l=a.computed(()=>!n.value&&s.value),c=a.computed(()=>{let d=e.menu;return d.length>0?d:Ih});return(d,u)=>t.editor?(a.openBlock(),a.createElementBlock("section",wv,[a.createVNode(a.unref(z_),{class:a.normalizeClass(["o-floating-menu",t.menuClass]),editor:t.editor,"tippy-options":o.value},{default:a.withCtx(()=>[a.createElementVNode("section",Ev,[l.value?(a.openBlock(),a.createBlock(a.unref(Le),{key:0,icon:"arrow_back",onClick:r})):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,(p,f)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:f},[p==="separator"?(a.openBlock(),a.createBlock(a.unref(Rt),{key:0,vertical:""})):typeof p=="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Sa)(p)),{key:1,name:p,editor:t.editor},null,8,["name","editor"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(p),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))])]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}});function fd(t,e){const n=e==null?void 0:e.posAtCoords(t);if(!n)return;let o=xa(n.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function xa(t,e){return e.nodeDOM(t)||e.domAtPos(t).node}function hd(t,e){const n=fd(t,e);if(n&&n.nodeType===1){const o=e.docView,r=o.nearestDesc(n,!0);return!r||r===o?null:r.posBefore}return null}function Cv(t,e){let n,o;const r=e.resolve(t.from).node().type.spec.group==="blockContent",i=e.resolve(t.to).node().type.spec.group==="blockContent",s=Math.min(t.$anchor.depth,t.$head.depth);if(r&&i){const l=t.$from.start(s-1),c=t.$to.end(s-1);n=e.resolve(l-1).pos,o=e.resolve(c+1).pos}else n=t.from,o=t.to;return{from:n,to:o}}function Sv(t,e){const n=hd(t,e.view);return n&&n>=0?{node:e.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const Na=new Ne("sideMenu");class xv{constructor(){tt(this,"hovered",!1);tt(this,"coords",{left:0,top:0});tt(this,"className","")}init(e){return this}apply({tr:e,oldState:n,newState:o}){return e.docChanged?this:this}setHover(e,n,o=""){this.hovered=e,this.coords=n,this.className=o}}class Nv{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250}){tt(this,"editor");tt(this,"element");tt(this,"view");tt(this,"preventHide",!1);tt(this,"tippy");tt(this,"tippyOptions");tt(this,"updateDelay");tt(this,"updateDebounceTimer");tt(this,"mousedownHandler",()=>{this.preventHide=!0});tt(this,"onDragStart",e=>{this.hide()});tt(this,"blurHandler",({event:e})=>{var n;e!=null&&e.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(e.relatedTarget))||this.hide()});tt(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});tt(this,"handleDebouncedUpdate",(e,n)=>{const o=!(n!=null&&n.selection.eq(e.state.selection)),r=!(n!=null&&n.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,n)},this.updateDelay))});tt(this,"updateHandler",(e,n,o,r)=>{var u,p;const{state:i,composing:s}=e,{coords:l}=Na.getState(i),c=fd(l,e),d=hd(l,e);!c||d<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=e,this.element=n,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=cn(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=!(n!=null&&n.selection.eq(e.state.selection)),i=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,r,i,n)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,n;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)==null||n.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const Tv=(t,e)=>{if(!t.dataTransfer)return;const n=e.view,o=n.dom.getBoundingClientRect(),r={left:o.left+o.width/2,top:t.clientY},i=hd(r,n);if(i===null)return;const s=n.state.selection,l=n.state.doc;Cv(s,l),n.dispatch(n.state.tr.setSelection(ne.create(n.state.doc,i))),Mv(n,i);const c=n.state.selection.content(),{dom:d,text:u}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",d.innerHTML),t.dataTransfer.setData("text/plain",u),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Jo,0,0),n.dragging={slice:c,move:!0}},Ov=(t,e)=>{lb()};let Jo;function Mv(t,e,n=e){const o=t.domAtPos(e).node.cloneNode(!0),r=t.domAtPos(e).node,i=(p,f)=>Array.prototype.indexOf.call(p.children,f),s=p=>{let f=p,h=f.parentElement;for(;h;){if(h===t.dom)return f;f=h,h=f.parentElement}return f};let l=-1,c=-1;e===n?(l=i(r,s(xa(e,t))),c=l):(l=i(r,s(xa(e+1,t))),c=i(r,s(xa(n-1,t))));for(let p=r.childElementCount-1;p>=0;p--)(p>l||p<c)&&o.removeChild(o.children[p]);lb(),Jo=o;const u=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Jo.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Jo)}function lb(){Jo!==void 0&&(document.body.removeChild(Jo),Jo=void 0)}class Av{constructor(e){tt(this,"options");tt(this,"plugin");tt(this,"sideMenuView");const n=new xv;this.options=e,this.plugin=new Ae({key:Na,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=fd(i,o),l=(s==null?void 0:s.className)||"",c=n.className;l.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(n.setHover(!0,i,l),o.dispatch(o.state.tr.setMeta(Na,n)))}}},state:{init(o,r){return n.init(r)},apply(o,r,i,s){return n.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new Nv({view:o,...e}),this.sideMenuView)})}dragstart(e){Tv(e,this.options.editor)}dragend(e){Ov(e,this.options.editor)}}const vv=a.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:e,slots:n}){const o=a.ref(null),r=a.ref(),i=l=>{var c;(c=r.value)==null||c.dragstart(l)},s=l=>{var c;(c=r.value)==null||c.dragend(l)};return a.onMounted(()=>{const{pluginKey:l,editor:c,updateDelay:d,tippyOptions:u}=t;r.value=new Av({updateDelay:d,editor:c,element:o.value,pluginKey:l,tippyOptions:u}),c.registerPlugin(r.value.plugin)}),a.onBeforeUnmount(()=>{const{pluginKey:l,editor:c}=t;c.unregisterPlugin(l)}),e({...t,dragstart:i,dragend:s}),()=>{var l;return a.h("div",{ref:o},(l=n.default)==null?void 0:l.call(n))}}}),Rv={key:0,class:"o-side-menu"},Bv={class:"container"},Dv=a.defineComponent({__name:"OSideMenu",props:{editor:{type:jt,required:!0},menuClass:{type:String,default:""}},setup(t){const e=t,n=a.ref(null),o=a.ref(null),r=a.ref(0),i=a.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=a.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:c,deleteNode:l,view:void 0,innerDecorations:[],HTMLAttributes:void 0}));function l(){var m,g;const f=r.value,h=f+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:f,to:h})}function c(f){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...f}),!0})}function d({editor:f,transaction:h}){let m={left:0,top:0};const g=Na.getState(e.editor.view.state);if(g){m=g.coords;const b=Sv(m,f);b.node&&b.pos>0&&(o.value=b.node,r.value=b.pos)}}function u(f){var h;(h=n.value)==null||h.dragstart(f)}function p(f){var h;(h=n.value)==null||h.dragend(f)}return a.onMounted(()=>{var f;(f=e.editor)==null||f.on("transaction",d)}),(f,h)=>t.editor?(a.openBlock(),a.createElementBlock("section",Rv,[a.createVNode(a.unref(vv),{ref_key:"menu",ref:n,class:a.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":i.value},{default:a.withCtx(()=>[a.createElementVNode("section",Bv,[o.value?(a.openBlock(),a.createBlock(a.unref(Wh),a.normalizeProps(a.mergeProps({key:0},s.value)),null,16)):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createBlock(a.unref(jh),a.mergeProps({key:1},s.value,{onDragstart:u,onDragend:p}),null,16)):a.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):a.createCommentVNode("",!0)}}),Iv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=be(),{onCommand:n}=Me();return{locale:t,tr:e,onCommand:n}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Rt,OIcon:ie,OList:Jt,OListItem:zt},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.run(t);break}return!0},run(t){const e=this.editor.chain().focus().deleteRange(this.range),n=this.editor.commands;switch(t.value){case"codeBlock":n.deleteRange(this.range),this.editor.commands.setCodeBlock({language:"bash"});break;case"content":n.deleteRange(this.range),this.editor.commands.insertContent(t.options.content);break;case"emoji":n.deleteRange(this.range),this.editor.commands.insertContent(":");break;case"taskList":n.deleteRange(this.range),this.editor.commands.toggleTaskList();break;default:this.onCommand(n,e,t.value,t.options);break}},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const e=this.items[t];e&&this.onClick(e)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return wr.slice(1)}},mounted(){this.selectedIndex=0}},cb=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},Lv={key:0,class:"view-main"},Pv={class:"group o-tips"},$v={class:"o-tips"},Fv={key:1,class:"item"},Vv={key:1,class:"view-emoji"},zv={key:2,class:"view-emoji"};function Hv(t,e,n,o,r,i){const s=a.resolveComponent("o-divider"),l=a.resolveComponent("o-icon"),c=a.resolveComponent("o-list-item"),d=a.resolveComponent("o-list");return a.openBlock(),a.createElementBlock("section",{class:a.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(a.openBlock(),a.createElementBlock("section",Lv,[a.createVNode(d,{hoverable:"",clickable:""},{default:a.withCtx(()=>[n.items.length?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(n.items,(u,p)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:p},[u.group?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[p>0?(a.openBlock(),a.createBlock(s,{key:0})):a.createCommentVNode("",!0),a.createElementVNode("div",Pv,a.toDisplayString(o.tr(u.group)),1)],64)):a.createCommentVNode("",!0),a.createVNode(c,{class:a.normalizeClass(["item",{"is-active":p===r.selectedIndex}]),clickable:"",onClick:f=>i.onClick(u)},{prefix:a.withCtx(()=>[a.createVNode(l,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:a.withCtx(()=>[a.createElementVNode("span",$v,a.toDisplayString(u.tips),1)]),default:a.withCtx(()=>[a.createTextVNode(" "+a.toDisplayString(o.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(a.openBlock(),a.createElementBlock("div",Fv,"No result"))]),_:1})])):r.view==="emoji"?(a.openBlock(),a.createElementBlock("section",Vv)):r.view==="ai"?(a.openBlock(),a.createElementBlock("section",zv)):a.createCommentVNode("",!0)],2)}const Uv=cb(Iv,[["render",Hv]]),db={items:({query:t})=>Cs.filter(e=>e.value.toLowerCase().startsWith(t.toLowerCase())),render:()=>{let t,e;return{onStart:n=>{t=new sc(Uv,{props:n,editor:n.editor}),n.clientRect&&(e=cn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}}))},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},qv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:e}=be(),{run:n}=Me();return{locale:t,tr:e,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:Ns},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},Kv={class:"o-colon-view"};function Wv(t,e,n,o,r,i){const s=a.resolveComponent("o-emoji-select");return a.openBlock(),a.createElementBlock("section",Kv,[a.createVNode(s,{items:n.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const jv=cb(qv,[["render",Wv]]),Gv={items:({query:t})=>Ar.filterEmojiGroups(t),render:()=>{let t,e;return{onStart:n=>{t=new sc(jv,{props:n,editor:n.editor}),n.clientRect&&(e=cn("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}}))},onUpdate(n){t.updateProps(n),e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var o;return n.event.key==="Escape"?(e[0].hide(),t.destroy(),!0):(o=t.ref)==null?void 0:o.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}},Yv={BackColor:Jh.configure({multicolor:!0}),Focus:Xh,ForeColor:Qh,FontFamily:Zh,Image:Gx,Link:Wc,TextAlign:ym.configure({types:["heading","paragraph"]}),TaskItem:gm,TaskList:bm.configure({itemTypeName:"taskItem"}),Underline:wm,Typography:km,OAiBlock:ng,OColon:n1.configure({suggestion:Gv}),OSlash:o1.configure({suggestion:db}),OSlashZh:r1.configure({suggestion:db}),OBlockquote:og,OCallout:rg,OCodeBlock:Xg,OColorHighlighter:Gm,OHeading:Zg,OHorizontalRule:Qg,OImage:eb,OLink:fA.configure({openOnClick:!1}),OParagraph:tb,OSelectionDecoration:Jm,OTrailingNode:Qm,OUniqueID:tg.configure({attributeName:"data-id",enableRender:!1,types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:ib};class Jv{constructor(e){return Yv[e]}}const Xv=[rb,Zm.configure({resizable:!0}),td,ob,nb];qm.configure({resizable:!0});const Zv=["data-theme"],ub=a.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},showSideMenu:{type:Boolean,default:!1},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)},aiOption:{type:Object,default:()=>{}}},emits:["transaction","update"],setup(t,{expose:e,emit:n}){const o=t,r=n,{tr:i}=be(),s=a.ref(!1),l=a.ref(!0),c=a.ref("en"),d=a.ref(!1),u=a.ref();a.provide("darkMode",s),a.provide("isEditable",l),a.provide("locale",c),a.provide("sideNode",d),a.provide("aiOption",u);const p=a.computed(()=>y()),f=H_({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:p.value,onUpdate:()=>{var k,S;const w=(k=f.value)==null?void 0:k.getJSON(),_=(S=f.value)==null?void 0:S.getHTML();r("update",{json:w,html:_})},onTransaction:({editor:w,transaction:_})=>{r("transaction",{editor:w,transaction:_})}}),h=a.computed(()=>({editor:f.value,menu:o.mainMenu})),m=a.computed(()=>({editor:f.value,menu:o.bubbleMenu})),g=a.computed(()=>({editor:f.value,menu:o.floatingMenu})),b=a.computed(()=>({editor:f.value,menu:[]}));function y(){const w=[];o.title?w.push(ks.extend({content:"heading block*"})):w.push(ks),w.push(Ym.configure({placeholder:({editor:k,node:S,pos:C})=>{if(S.type.name==="heading"){const R=S.attrs.level;return C>0?`H${R}`:i("label.untitled")}else return S.type.name==="paragraph"?i("label.typeForCommands"):""}})),w.push($C),w.push(LC.configure({document:!1,blockquote:o.extensions.includes("OBlockquote")?!1:{},codeBlock:!1,heading:o.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:o.extensions.includes("OParagraph")?!1:{},dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},horizontalRule:!1}));const _=TA.concat(o.extensions);for(const k of _)if(typeof k=="string"){if(!AA.includes(k))continue;switch(k){case"Table":w.push(...Xv);break;default:try{const S=new Jv(k);w.push(S)}catch(S){console.error(S.message)}break}}else w.push(k);return w}return a.watch(()=>o.darkMode,w=>{s.value=w}),a.watch(()=>o.locale,w=>{c.value=w}),a.watch(()=>o.aiOption,w=>{u.value=w},{deep:!0}),a.watch(()=>o.editable,w=>{var _;(_=f.value)==null||_.setEditable(w),l.value=w}),a.onBeforeMount(()=>{l.value=o.editable,u.value=o.aiOption,s.value=o.darkMode,c.value=o.locale,d.value=!o.showSideMenu&&o.showSideNode}),e({editor:f,darkMode:s,locale:c}),(w,_)=>{var k,S,C;return a.openBlock(),a.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[t.showMainMenu?(a.openBlock(),a.createBlock(ab,a.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:a.withCtx(()=>[a.renderSlot(w.$slots,"toolbar-left")]),right:a.withCtx(()=>[a.renderSlot(w.$slots,"toolbar-right")]),_:3},16)):a.createCommentVNode("",!0),(k=a.unref(f))!=null&&k.isEditable&&t.showBubbleMenu?(a.openBlock(),a.createBlock(kv,a.normalizeProps(a.mergeProps({key:1},m.value)),null,16)):a.createCommentVNode("",!0),(S=a.unref(f))!=null&&S.isEditable&&t.showFloatingMenu?(a.openBlock(),a.createBlock(_v,a.normalizeProps(a.mergeProps({key:2},g.value)),null,16)):a.createCommentVNode("",!0),(C=a.unref(f))!=null&&C.isEditable&&t.showSideMenu?(a.openBlock(),a.createBlock(Dv,a.normalizeProps(a.mergeProps({key:3},b.value)),null,16)):a.createCommentVNode("",!0),a.createVNode(a.unref(V_),{class:a.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:a.unref(f)},null,8,["class","editor"])],8,Zv)}}}),Qv={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",ub)}};return z.AddNode=Wh,z.AiBlocks=Nh,z.AiProviders=Sh,z.AskAiBlocks=xh,z.BasicBlocks=wr,z.BlockMenus=pc,z.Blocks=Cs,z.Color=ge,z.ColorList=FC,z.CommonBlocks=Er,z.DefaultBubble=Mh,z.DefaultEmbedServices=HC,z.DefaultFloating=Ih,z.DefaultMenu=Th,z.DragNode=jh,z.ImageBubble=vh,z.ImageLinkBubble=Rh,z.LinkBubble=Ah,z.MoreBubble=Bh,z.OAiMenu=sb,z.OBlockList=Ss,z.OBlockListItem=mc,z.OBlockMenu=yo,z.OBlockPlaceholder=hc,z.OBlockPopover=Yn,z.OBlockToolbar=gc,z.OBtn=xt,z.OBtnGroup=Gh,z.OCalloutColorBoard=bc,z.OCalloutColorDropdown=fS,z.OCheckbox=_c,z.OColorBoard=xs,z.OCommandBtn=ct,z.OCommonBtn=yn,z.OContextMenu=ci,z.ODivider=Rt,z.ODocToc=xS,z.OEmojiSelect=Ns,z.OIcon=ie,z.OInput=Rn,z.OLanguageDropdown=Vh,z.OList=Jt,z.OListItem=zt,z.OMainMenu=ab,z.OMediaInput=kc,z.OMenubarBtn=Le,z.OMetaInput=wc,z.ONodeView=gn,z.OPopover=Pe,z.OTableCellBackground=Hh,z.OTableGrid=zh,z.OTextColorBoard=Uh,z.OToast=Ec,z.OTooltip=Gn,z.Prompts=uc,z.StyleBlocks=li,z.TableBubble=Dh,z.TableFloating=zC,z.TableMenu=Oh,z.TableWrapperBubble=VC,z.YiiEditor=ub,z.YiiEditorPlugin=Qv,z.getProviderProp=dc,z.useAi=fc,z.useI18n=be,z.useNodeView=Lh,z.useTheme=_r,z.useTiptap=Me,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),z}({},Vue,OpenAi,MarkdownIt,EmojiUtil);
199
+ //# sourceMappingURL=index.js.map